NotImplementedError: It is not support to use $id with $ref
See original GitHub issueIs your feature request related to a problem? Please describe.
An Error occurs “NotImplementedError: It is not support to use $id with $ref” when attempting to convert local JSON schema file with multiple $ref
. Did not find any mention of this limitation, or a description of whether remote files are supported in the docs.
For example when converting https://vizztools.github.io/vizzToolsCore/json-schema/Organization.schema.json using
datamodel-codegen --input json-schema/Organization.schema.json --input-file-type jsonschema --output vizzToolsCore/Organization.py
Describe the solution you’d like
Would like to be able to convert to Pydantic types using JSON schema that use $id to “declare a base URI against which $ref URI-references are resolved”
Describe alternatives you’ve considered
If this is tricky to implement, maybe some examples and tips on how to optimally structure complicated multi-file schema to use with datamodel-code-generator
.
Additional context
This is a great tool! Very interested in using Pydantic and datamodel-code-generator
as the main generator to build our Python data models.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Thinking that using local file refs might help with the code generation; I changed to only update
$id
when deployed to gh-pages.Here are the originals: Organization_schema_example.zip The online version is https://vizztools.github.io/vizzToolsCore/json-schema/Organization.schema.json
Admittedly I may have misinterpreted how
$id
and$ref
should be used.I released a new version(
0.6.8
) includes the PR.