INCATools / INCATools/ontology-development-kit
Automatic generation of the schema documentation is broken
- Dominant language
- Dockerfile
- Stars
- 375
- Forks
- 69
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 7
Description
The `dump-schema` command (used to dump the schema of the configuration object, which is then used to automatically produce the documentation of said schema) is broken:
```sh
$ odkrun -l python ./odk/odk.py dump-schema
Traceback (most recent call last):
File "/work/./odk/odk.py", line 1605, in
cli()
File "/usr/local/lib/python3.12/dist-packages/click/core.py", line 1442, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/click/core.py", line 1363, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/click/core.py", line 1830, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/click/core.py", line 1226, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/click/core.py", line 794, in invoke
return callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/work/./odk/odk.py", line 1394, in dump_schema
print(json.dumps(clazz.json_schema(), sort_keys=True, indent=4))
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/dataclasses_jsonschema/__init__.py", line 941, in json_schema
properties[f.mapped_name], is_required = cls._get_field_schema(f.field, schema_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/dataclasses_jsonschema/__init__.py", line 772, in _get_field_schema
field_meta, required = cls._get_field_meta(field, schema_options.schema_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/dataclasses_jsonschema/__init__.py", line 745, in _get_field_meta
field_meta.default = cls._encode_field(field.type, default_value, omit_none=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/dataclasses_jsonschema/__init__.py", line 443, in _encode_field
return encoder(field_type, value, omit_none)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/dataclasses_jsonschema/__init__.py", line 209, in _encoder_is_json_schema_subclass
return v.to_dict(omit_none=o, validate=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DataClassJsonMixin.to_dict() got an unexpected keyword argument 'omit_none'
```
Bisecting identifies commit aff9e65f76f6d48eb0c43c5b0d1352784bce87bc as introducing the issue.
Contributor guide
Research direction
Start with the dump_schema function in odk/odk.py around line 1394 and reproduce the failure using the documented odkrun command. Inspect commit aff9e65f76f6d48eb0c43c5b0d1352784bce87bc and the dataclasses_jsonschema compatibility shown in the traceback. Done means dump-schema runs successfully and emits the schema JSON used for documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100