Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Nullability for @NonNullApi for "any other annotation that has the name nullable" #3350

Open
Pascalmh opened this issue Mar 14, 2025 · 2 comments · May be fixed by vaadin/docs#4155
Open
Labels
bug Something isn't working hilla Issues related to Hilla

Comments

@Pascalmh
Copy link

Describe the bug

When NOT using the @NonNullApiHilla will mark properties in the generated typescript interfaces as optional when adding

any other annotation (including custom) that has the name nonnull (case-insensitive).
– https://vaadin.com/docs/latest/hilla/reference/type-nullability

This does not work the other way around, when using the @NonNullApi (https://vaadin.com/docs/latest/hilla/reference/type-nullability#nonnullapi)

And adding this annotation: @org.springframework.lang.Nullable the property will not be marked as optional in the generated typescript interface.

Expected-behavior

any other annotation (including custom) that has the name nullable (case-insensitive) makes the generated property in the typescript interface optional.

Reproduction

  • use @NonNullApi
  • add the Annotation @org.springframework.lang.Nullable

System Info

Vaadin 24.6.2

@Pascalmh Pascalmh added bug Something isn't working hilla Issues related to Hilla labels Mar 14, 2025
@cromoteca
Copy link
Contributor

cromoteca commented Mar 14, 2025

Support for Spring annotations is added in 24.7. In 24.6 you can use com.vaadin.hilla.Nullable for that. Also note that, while 24.7 supports Spring nullability annotations, JSpecify ones are recommended, as Spring is also going to use JSpecify by default, see spring-projects/spring-framework#28797. Hilla 24.7 also introduces support for JSpecify annotations.

@platosha
Copy link
Contributor

Let's clarify the docs in vaadin/docs#4155.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hilla Issues related to Hilla
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants