Fix nullable items in nested Kotlin arrays

M-
8h ago
+70-2

Summary

  • Preserve nullability when Kotlin client models contain nested arrays whose items reference nullable schemas.
  • Resolve referenced item schemas when determining nullability while retaining support for inline nullable item schemas.
  • Add a regression test and OpenAPI fixture for issue #25471.

Root cause

The Kotlin generator checked nullability on the $ref item schema itself rather than the schema it references. As a result, nullable model items inside nested arrays were generated as non-nullable Kotlin types.

Testing

  • ./mvnw -pl modules/openapi-generator -Dtest=KotlinClientCodegenModelTest test

Summary by cubic

Fixes Kotlin client generation so nullable model items inside nested arrays keep their nullable type instead of being generated as non-nullable.

  • Resolves referenced item schemas when checking nullability, while preserving support for inline nullable item schemas.
  • Adds a regression test and OpenAPI fixture for issue #25471.