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

Make sure schema generation handles optional properly #2356

Closed
stuartwdouglas opened this issue Aug 14, 2024 · 0 comments · Fixed by #2951
Closed

Make sure schema generation handles optional properly #2356

stuartwdouglas opened this issue Aug 14, 2024 · 0 comments · Fixed by #2951
Assignees
Labels

Comments

@stuartwdouglas
Copy link
Collaborator

In general schema generation should rely on the @NotNull annotation to handle optional values during schema generation. If a field / param has this annotation then it is not optional, otherwise it is. There are some exceptions to this such as primitive values which can never be null.

This should align with Kotlins type system, so Kotlin objects will map natively.

At the moment we don't really take this into account.

@github-actions github-actions bot added the triage Issue needs triaging label Aug 14, 2024
@ftl-robot ftl-robot mentioned this issue Aug 14, 2024
@gak gak removed the triage Issue needs triaging label Aug 14, 2024
@stuartwdouglas stuartwdouglas self-assigned this Oct 2, 2024
stuartwdouglas added a commit that referenced this issue Oct 2, 2024
For Kotlin this should exactly match the language semantics. For Java
types are not considered Optional unless they are wrapped in a java.util.Optional,
or annotated with @nullable.

The exception to this are the boxed primitive types, which are always considered nullable.

fixes: #2356
stuartwdouglas added a commit that referenced this issue Oct 2, 2024
For Kotlin this should exactly match the language semantics. For Java
types are not considered Optional unless they are wrapped in a java.util.Optional,
or annotated with @nullable.

The exception to this are the boxed primitive types, which are always considered nullable.

fixes: #2356
stuartwdouglas added a commit that referenced this issue Oct 2, 2024
For Kotlin this should exactly match the language semantics. For Java
types are not considered Optional unless they are wrapped in a java.util.Optional,
or annotated with @nullable.

The exception to this are the boxed primitive types, which are always considered nullable.

fixes: #2356
stuartwdouglas added a commit that referenced this issue Oct 2, 2024
For Kotlin this should exactly match the language semantics. For Java
types are not considered Optional unless they are wrapped in a java.util.Optional,
or annotated with @nullable.

The exception to this are the boxed primitive types, which are always considered nullable.

fixes: #2356
stuartwdouglas added a commit that referenced this issue Oct 2, 2024
For Kotlin this should exactly match the language semantics. For Java
types are not considered Optional unless they are wrapped in a java.util.Optional,
or annotated with @nullable.

The exception to this are the boxed primitive types, which are always considered nullable.

fixes: #2356
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants