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
Describe the bug
Generating pydantic_v2.BaseModel from jsonschema with a reference schema in another file alongside a "additionalProperties": false, creates an invalid Pydantic object.
For reference, both files were placed in a directory named src and an output folder named output was also created.
Expected behavior
The generated Python code contains:
classModel(RootModel[Any]):
model_config=ConfigDict(
extra="forbid",
)
root: Any
Whereas I expected:
classModel(RootModel[Any]):
root: Any
In the generated file for Example 1. Removing the "additionalProperties": false, from Example 2 solves this though I'm not sure if this is intended behaviour as I don't see why it would be incorrect to define it that way.
Version:
OS: Linux Mint 22
Python version: 3.12.2
datamodel-code-generator version: 0.26.1
The text was updated successfully, but these errors were encountered:
Describe the bug
Generating
pydantic_v2.BaseModel
from jsonschema with a reference schema in another file alongside a"additionalProperties": false,
creates an invalid Pydantic object.To Reproduce
Example schema 1:
Example schema 2:
Used commandline:
For reference, both files were placed in a directory named
src
and an output folder namedoutput
was also created.Expected behavior
The generated Python code contains:
Whereas I expected:
In the generated file for Example 1. Removing the
"additionalProperties": false,
from Example 2 solves this though I'm not sure if this is intended behaviour as I don't see why it would be incorrect to define it that way.Version:
3.12.2
0.26.1
The text was updated successfully, but these errors were encountered: