baobabsoluciones/cornflow

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

开放

#590 创建于 2024年12月18日

 (0 条评论) (0 个反应) (1 位负责人)Python (5 个派生)auto 404
bugclientdagsgood first issue

仓库指标

星标
 (21 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南