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
Describe the bug Importing a schema and partial overwrite it (e.g., set a different default value) leads to lost type information
To Reproduce
schemaA
{ "type": "object", "title": "SchemaA", "properties": { "test": { "title": "test", "type": "string", "default": "default_value1" } } }
schemaB.json
{ "allOf": [ { "$ref": "SchemaA.json" } ], "type": "object", "title": "SchemaB", "properties": { "test": { "default": "default_value2" } } }
Used commandline:
$ datamodel-codegen --input schemaB.json --output model.py
Result model.py: type of test in SchemaB is resetted to Any
test
Any
class SchemaA(BaseModel): test: Optional[str] = Field('default_value1', title='test') class SchemaB(SchemaA): test: Optional[Any] = 'default_value2'
Expected behavior type of test in SchemaB is still str
str
class SchemaA(BaseModel): test: Optional[str] = Field('default_value1', title='test') class SchemaB(SchemaA): test: Optional[str] = 'default_value2'
Version:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Importing a schema and partial overwrite it (e.g., set a different default value) leads to lost type information
To Reproduce
schemaA
schemaB.json
Used commandline:
Result model.py: type of
test
in SchemaB is resetted toAny
Expected behavior
type of
test
in SchemaB is stillstr
Version:
The text was updated successfully, but these errors were encountered: