-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Description
Is your feature request related to a problem? Please describe.
When generating an API using OpenAPI spec 3.1.0 the spring generator with Java the JsonNullable types are properly generated for properties that have either type: [string, 'null'] or anyOf - type: 'null' - ref: 'some-ref'
When changing the generation to use spring-kotlin the JsonNullable types are not generated correctly. They are generated with nullable types such as String? = null and not JsonNullable = JsonNullable.undefined()
Describe the solution you'd like
When using spring-kotlin to generate the schema with the API and using JsonNullable the proper types should be used. I would also like JsonNullable to be compatible with Jackson 3 though I realize that is another project. Currently JsonNullable is compatible with Jackson 2 and there is a workaround with Spring Boot 4.
Describe alternatives you've considered
I have implemented my own Patch class in Kotlin that handles the merge/patch logic and generate the OpenAPI spec from code. Doing this introduces undesired schemas into the spec such as Set and Ignore. Clients shouldn't have to worry about these schemas
Additional context
I've included a sample project that exhibits this behavior. If you change the generator to Spring it will generate the java classes with JsonNullable. I tried to import these classes and it causes errors when trying to use them with Kotlin. I have not found a solution there yet.