jskov / openapi-jaxrs-client

An OpenAPI JAX-RS client code generator
Apache License 2.0
1 stars 4 forks source link

How to handle (non)@Nullable for DTOs? #659

Open jskov opened 5 months ago

jskov commented 5 months ago

This class will fail NullAway check because the constructor does not ensure initialization of bar:

public class TestNull {
    @Nullable String foo;
    String bar;
}

But if the field has no default, the generator cannot make a valid (@Nullable-annotated) class.

Probably have to mark the DTO with @NullUnmarked

This should only happen types that require inheritance (and thus force use of POJOs). Not sure how big a problem it will be in practice. (and even if it ends up being a PITA, not sure how to fix it)