Skip to content
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

Optional but not nullable fields (i.e. not nullable fields with default value) #45

Open
lord-haffi opened this issue Jan 16, 2024 · 0 comments
Assignees
Labels
bug Something isn't working dependencies Pull requests that update a dependency file

Comments

@lord-haffi
Copy link
Collaborator

lord-haffi commented Jan 16, 2024

I guess, this is a little bug in datamodel-code-generator. The field definition of
Zaehlpunkt.zeitreihentyp in ibims is not nullable but with a default value:

"zeitreihentyp": {
  "title": "Zeitreihentyp",
  "type": "string",
  "default": "Z21"
}

But the code generator produces:

zeitreihentyp: str | None = Field(default="Z21", title="Zeitreihentyp")

But it should be:

zeitreihentyp: str = Field(default="Z21", title="Zeitreihentyp")
@lord-haffi lord-haffi added bug Something isn't working dependencies Pull requests that update a dependency file labels Jan 16, 2024
@lord-haffi lord-haffi self-assigned this Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

1 participant