Skip to content

Different handling of java Optional for models and APIs #17675

Description

@arandth

I was trying to update from openapi-generator 7.1.0 to 7.2.0. That causes problems due to a changed handling of useOptional. In 7.1.0, only methods in API's were treated (not attributes of the generated model classes.)
With 7.2.0 that obviously changed, suddenly also the generated model classes have Optional fields (if they are not marked as required). One might argue that this is the correct behavior of the generator, but on the other hand it prevents us from updating - it would be a very hard work to change the implementation in either all APIs or all model classes.

So what we would need is to destinguish between APIs and models (such as "useOptionalInApi" / "useOptionalInModel" or similar). Is that already possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions