You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previous version (v2.0) could be read as a jsonschema object to create pydantic schemas (which fwiw, I was originally intending to submit a PR to the python api to use pydantic for a smooth automated maintenance experience).
Using datamodel-code-generator to create python objects with the (now quite powerful/popular) pydantic library worked just fine with v2.0:
...
File "pydantic/main.py", line 406, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for JsonSchemaObject
properties -> additionalProperties
value is not a valid dict (type=type_error.dict)
I originally was opening an issue for the generator codebase, but came across this related issue, which toward the end looks like the problem came from a schema problem. Having some difficulty determining which change is causing this, however.
In case you're curious, the python generated is quite nice for the previous version (pasted below). Happy to open a PR or start a repo that automates this if you'd want a "standardized" pydantic-based api for python users. I'll be using this as a starting point for more general graph interop for networkx, pandas, serialization, etc.
Update: based on some digging and problem-solving here, along with the openapi spec docs, I've realized that there's not actually a problem with the schema itself, unless #56 is what is desired, but rather that the validators are unaware of the treatment of bools inside additionalProperties, items, etc.
By substituting false-> {"not":{}} in v2.1, the code generator I referenced works just fine. Feel free to close, unless you want to keep the reference alive for #56! Thanks!
Previous version (v2.0) could be read as a jsonschema object to create
pydantic
schemas (which fwiw, I was originally intending to submit a PR to the python api to use pydantic for a smooth automated maintenance experience).Using
datamodel-code-generator
to create python objects with the (now quite powerful/popular)pydantic
library worked just fine with v2.0:datamodel-codegen \ --url https://jsongraphformat.info/v2.0/json-graph-schema.json \ --output model.py \ --class-name 'JSONGraphSchema'
works just fine, but trying the new hypergraph version throws an obscure error:
datamodel-codegen \ --url https://raw.githubusercontent.com/jsongraph/json-graph-specification/master/json-graph-schema_v2.json \ --output tidy/model.py \ --class-name 'JSONGraphSchema'
I originally was opening an issue for the generator codebase, but came across this related issue, which toward the end looks like the problem came from a schema problem. Having some difficulty determining which change is causing this, however.
In case you're curious, the python generated is quite nice for the previous version (pasted below). Happy to open a PR or start a repo that automates this if you'd want a "standardized" pydantic-based api for python users. I'll be using this as a starting point for more general graph interop for networkx, pandas, serialization, etc.
The text was updated successfully, but these errors were encountered: