baobabsoluciones/cornflow

test_dags do not allow a jsonschema to have various valid types for one property

Aperta

#590 aperta il 18 dic 2024

 (0 commenti) (0 reazioni) (1 assegnatario)Python (5 fork)auto 404
bugclientdagsgood first issue

Metriche repository

Star
 (21 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Describe the bug The test_try_solving_testcase from test_dags.py fails if a jsonschema has various valid types for one property of the json schema.

To Reproduce Run the tests with a json schmea with various valid types. This is the error:

Error
Traceback (most recent call last):
  File "C:\Users\GuillermoGonzález-Sa\projects\XXX\tests\test_dag.py", line 59, in test_try_solving_testcase
    marshm = SchemaManager(self.app.instance.schema).jsonschema_to_flask()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\GuillermoGonzález-Sa\projects\XXX\venv\Lib\site-packages\cornflow_client\schema\manager.py", line 159, in to_marshmallow
    return self.to_schema_dict_obj().to_marshmallow()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\GuillermoGonzález-Sa\projects\XXX\venv\Lib\site-packages\cornflow_client\schema\manager.py", line 146, in to_schema_dict_obj
    return DictSchema(self.get_jsonschema())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\GuillermoGonzález-Sa\projects\XXX\venv\Lib\site-packages\cornflow_client\schema\dictSchema.py", line 30, in __init__
    self._get_element_dict(schema_dict=schema_dict, item=item)
  File "C:\Users\GuillermoGonzález-Sa\projects\XXX\venv\Lib\site-packages\cornflow_client\schema\dictSchema.py", line 106, in _get_element_dict
    "type": self._get_array_schema(schema_dict=schema_dict, item=item),
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\GuillermoGonzález-Sa\projects\XXX\venv\Lib\site-packages\cornflow_client\schema\dictSchema.py", line 165, in _get_array_schema
    self._get_element_dict(
  File "C:\Users\GuillermoGonzález-Sa\projects\XXX\venv\Lib\site-packages\cornflow_client\schema\dictSchema.py", line 111, in _get_element_dict
    return self._get_field_dict(item, required_list)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\GuillermoGonzález-Sa\projects\XXX\venv\Lib\site-packages\cornflow_client\schema\dictSchema.py", line 206, in _get_field_dict
    type=self._get_type(item[1]["type"]),
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\GuillermoGonzález-Sa\projects\XXX\venv\Lib\site-packages\cornflow_client\schema\dictSchema.py", line 252, in _get_type
    raise Warning("Warning: more than one type given")
Warning: Warning: more than one type given

Expected behavior To be able to accept various valid data types.

Metadata (please complete the following information):

  • cornflow-client 1.1.4

Additional context Check where the SchemaManager is used and for what. Maybe is an old dependency that we no longer need.

Guida contributor