question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NotImplementedError: It is not support to use $id with $ref

See original GitHub issue

Is 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:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
edwardpmorriscommented, Nov 12, 2020

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.

0reactions
koxudaxicommented, Dec 2, 2020

I released a new version( 0.6.8) includes the PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python. SQL Alchemy NotImplementedError: Operator 'getitem ...
I create record in DB through sql alchemy. The next step is trying to capture the id of the created object ...
Read more >
Flask + multiprocessing: "NotImplementedError: Not supported ...
I'm trying to use multiprocessing to create a service that handles my pandas dataframe to give to Flask requests. Unfortunately, this throws an ......
Read more >
NotImplementedException Class (System) - Microsoft Learn
The NotImplementedException exception is thrown when a particular method, get accessor, or set accessor is present as a member of a type but...
Read more >
Rule Configuration - Sourcery Documentation
Perhaps you meant to `raise NotImplementedError`, which is used to indicate that a method or function has not yet been implemented.
Read more >
Source code for google.appengine.api.datastore
__id def _Kind(self): """Returns the index kind, a string. ... raise NotImplementedError('Entity does not support the copy() method.').
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found