Skip to content

feat(core): honor schema-level nullable:true in OpenAPI 3.0#83

Open
halotukozak wants to merge 3 commits into
masterfrom
feat/41-schema-nullable
Open

feat(core): honor schema-level nullable:true in OpenAPI 3.0#83
halotukozak wants to merge 3 commits into
masterfrom
feat/41-schema-nullable

Conversation

@halotukozak

Copy link
Copy Markdown
Member

What

OpenAPI 3.0 nullable: true was ignored — nullability came only from the parent's required set. A property that is required and nullable: true was generated as a non-nullable Kotlin type, which is incorrect.

  • SpecParser.propertyModels now sets nullable = propName !in required || propSchema.nullable == true.
  • The allOf merge preserves schema-level nullability when recomputing against the union of required sets (prop.name !in required || prop.nullable).

Tests

Covers the four combinations on a plain object schema:

  • required + nullable:true → nullable
  • required + no nullable → non-nullable
  • optional + nullable:true → nullable
  • optional + no nullable → nullable

Notes

OpenAPI 3.1 nullability (type arrays / null in type) is out of scope — this addresses the 3.0 nullable keyword. allOf+nullable ordering edge cases (a property declared in one member, marked required in a later member) are rare and handled best-effort via the OR.

Closes #41

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Coverage Report

Overall Project 96.21% 🍏
Files changed 100% 🍏

File Coverage
SpecParser.kt 93.59% 🍏

Property nullability was derived solely from the parent's required set,
so a required property marked nullable:true was generated as a
non-nullable Kotlin type. The parser now treats a property as nullable
when it is absent from required OR the schema sets nullable:true. The
allOf merge preserves schema-level nullability when recomputing against
the union of required sets.

Closes #41

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@halotukozak halotukozak force-pushed the feat/41-schema-nullable branch from 10c3893 to a4396eb Compare June 9, 2026 14:13
@halotukozak halotukozak added this to the 1.0.0 milestone Jun 9, 2026
@halotukozak halotukozak self-assigned this Jun 9, 2026
@halotukozak halotukozak added the bug Something isn't working label Jun 9, 2026
…able

# Conflicts:
#	core/src/main/kotlin/com/avsystem/justworks/core/parser/SpecParser.kt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support schema-level nullable: true in OpenAPI 3.0

1 participant