Skip to content

Support schema-level nullable: true in OpenAPI 3.0 #41

Description

@halotukozak

Description

OpenAPI 3.0 allows nullable: true on schema definitions independent of the required property list. Currently, nullability is inferred only from whether a property name is in the parent's required set. This means a property that is required but also nullable: true will be generated as non-nullable in Kotlin, which is incorrect.

Note: This topic needs additional research before implementation. The acceptance criteria below are preliminary and should be verified against the OpenAPI 3.0 spec and real-world usage patterns (e.g. how nullable interacts with allOf, oneOf, $ref, etc.). Update this issue with findings before starting work.

Acceptance criteria (preliminary — verify after research)

  • SpecParser reads the nullable flag from schema definitions
  • PropertyModel.nullable is true when either the property is not in required OR the schema has nullable: true
  • TypeRef carries nullability information where relevant
  • Generated data class properties have nullable Kotlin types when nullable: true is set on the schema
  • Tests cover: required+nullable, required+non-nullable, optional+nullable, optional+non-nullable combinations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions