Add less verbose ways to say that types are not nullable by default #107
Labels
enhancement
New feature or request
Epic
help wanted
Extra attention is needed
hilla
Issues related to Hilla
With the introduction of V21, parameter types and return types from endpoints are now nullable by default. Making an type not-nullable when accessed via TypeScript requires the use of an "@nonnull" annotation.
The problem is: in order to make the Typescript calls cleaner, every single attribute or return type needs to be annotated with
@Nonnull
, which becomes quite verbose. Also when usingLists
, annotating parameterized types is not convenient (some IDEs have poor support for such structure). Example:@Nonnull List<@Nonnull Person>
.There should be an easier way for the developers to say that either all Endpoints or some subset of Endpoints have all types not-nullable (basically the behavior up to V20).
This can be done in the following ways:
@Nonnull
annotation, that makes all types declared in the methods of the class@Nonnull
by default;pom.xml
to make all Endpoints@Nonnull
by default (the behavior from V20);@Nonnull
(or the opposite, a list with only nullables).We are open to feedback on which solution would be the best (or other solutions as well).
The text was updated successfully, but these errors were encountered: