-
Notifications
You must be signed in to change notification settings - Fork 25
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
Evaluate code gen to build pydantic models from JSON schema #84
Comments
Some notes copied from slack. From inside
And the output pydantic models will be in the It’s not perfect still... for example the datetime: Optional[Optional[str]] = Field(
None,
description='The searchable date/time of the assets, in UTC (Formatted in RFC 3339) ',
title='Date and Time',
) This is because the source JSON Schema has start_datetime: Optional[datetime] = Field(
None,
description='The searchable start date/time of the assets, in UTC (Formatted in RFC 3339) ',
title='Start Date and Time',
)
end_datetime: Optional[datetime] = Field(
None,
description='The searchable end date/time of the assets, in UTC (Formatted in RFC 3339) ',
title='End Date and Time',
)
created: Optional[datetime] = Field(None, title='Creation Time')
updated: Optional[datetime] = Field(None, title='Last Update Time') |
One thing that might be difficult with Pydantic is its support for model unions in relation to extensions. In a language like typescript, you could do |
duplicated of #50 |
@kylebarron mentioned this project is becoming more mature, might be worth looking into how useful it is here.
Would be really nice to programmatically generate pydantic models from the JSON schema fragments provided by the spec.
https://github.com/koxudaxi/datamodel-code-generator
The text was updated successfully, but these errors were encountered: