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 Default values are not picked, if properties are referenced (for OpenAPI yaml).
Note: Interestingly minimum and maximum values are correctly picked up. See below.
To Reproduce
Example schema:
components: schemas: Model: type: "object" properties: settingA: type: "number" default: 5 minimum: 0 maximum: 10 settingB: $ref: "#/components/schemas/ModelSettingB" ModelSettingB: type: "number" default: 5 minimum: 0 maximum: 10
Used commandline:
datamodel-codegen --input hello.yaml --input-file-type openapi --collapse-root-models
Current Output:
class Model(BaseModel): settingA: Optional[confloat(ge=0.0, le=10.0)] = 5 settingB: Optional[confloat(ge=0.0, le=10.0)] = None
Expected Output:
class Model(BaseModel): settingA: Optional[confloat(ge=0.0, le=10.0)] = 5 settingB: Optional[confloat(ge=0.0, le=10.0)] = 5
to happen.
Version:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Default values are not picked, if properties are referenced (for OpenAPI yaml).
Note: Interestingly minimum and maximum values are correctly picked up. See below.
To Reproduce
Example schema:
Used commandline:
Current Output:
Expected Output:
to happen.
Version:
The text was updated successfully, but these errors were encountered: