-
-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
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
oneOf with subschema array items not incorporated/generated as Any for pydantic.v2 #1910
Comments
Is this related to: datamodel-code-generator/datamodel_code_generator/parser/jsonschema.py Lines 681 to 694 in fcab9a4
If so - or if you can provide another hint - maybe we can have a look and work on a PR. This issue is really hampering our use case. |
I've been looking into a similar issue on my project - so far I think it may be related to enabling the I'm working off of a very slightly modified version of the CycloneDX 1.5 schema, where the
When I remove
I'll keep digging, but for now it appears that using annotations/field constraints ends up dropping type information somewhere down that path. |
I can confirm that dropping |
I see you already provided a PR - great :) |
Describe the bug
When using a JSON schema as input with aoneOf construct where one option is an array with items defined in a subschema, the resulting pydantic v2 model does not incorporate the subschema definition, but rather
list[Any]
To Reproduce
The following JSON schema snippet:
leads to the pydantic v2 model:
Used commandline:
Expected behavior
The resulting pydantic model should look like this:
Or maybe even more preferable, the addtional RootModel definition should be dropped as a whole:
Version:
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: