Skip to content

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

Description

@lord-haffi

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")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdependenciesPull requests that update a dependency file

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions