We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"unevaluatedProperties"
I have a jsonschema
{ "title": "resource", "type": "object", "allOf": [ { "$ref": "#/$defs/PartialResource" } ], "$defs": { "PartialResource": { "title": "partial_resource", "properties": { "spec": { "title": "spec", "type": "string" }, "resource_kwargs": { "title": "resource_kwargs", "type": "object" }, "resource_path": { "title": "resource_path", "type": "string" }, "root": { "title": "root", "type": "string" }, "uid": { "title": "uid", "type": "string" } }, "required": [ "resource_kwargs", "resource_path", "root", "spec", "uid" ] } }, "properties": { "path_semantics": { "title": "path_semantics", "type": "string", "enum": [ "posix", "windows" ] }, "run_start": { "title": "run_start", "type": "string" } }, "unevaluatedProperties": false }
which generates a BaseModel:
BaseModel
class PartialResource(BaseModel): spec: str = Field(..., title="spec") resource_kwargs: Dict[str, Any] = Field(..., title="resource_kwargs") resource_path: str = Field(..., title="resource_path") root: str = Field(..., title="root") uid: str = Field(..., title="uid") class Resource(PartialResource): path_semantics: Optional[PathSemantics] = Field(None, title="path_semantics") run_start: Optional[str] = Field(None, title="run_start")
The "unevaluatedProperties" in the schema works in the same way as "additionalProperties", but allows the elements declared in subschema.
"additionalProperties"
For analogous behaviour in the generated BaseModel, we could change
datamodel-code-generator/datamodel_code_generator/model/pydantic_v2/base_model.py
Lines 240 to 247 in 396601e
to also check for "unevaluatedProperties": false and use "forbid".
"unevaluatedProperties": false
"forbid"
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have a jsonschema
which generates a
BaseModel
:The
"unevaluatedProperties"
in the schema works in the same way as"additionalProperties"
, but allows the elements declared in subschema.For analogous behaviour in the generated
BaseModel
, we could changedatamodel-code-generator/datamodel_code_generator/model/pydantic_v2/base_model.py
Lines 240 to 247 in 396601e
to also check for
"unevaluatedProperties": false
and use"forbid"
.The text was updated successfully, but these errors were encountered: