Skip to content

chore: Better error for unsupported optional + collection in views - #1515

Merged
octonato merged 4 commits into
mainfrom
wip-better-error-for-optionals-in-view-collections
Apr 14, 2026
Merged

octonato merged 4 commits into
mainfrom
wip-better-error-for-optionals-in-view-collections

Conversation

@johanandren

@johanandren johanandren commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor

Example:

Optional<List<...>>

View field 'MyRow.tags' has type Optional<List<...>> which is not supported. Use a collection type directly instead, it will be empty when there is no data.

Also covers List<Optional<...>> and other collection types

References https://github.com/lightbend/akka-runtime/issues/4932

@johanandren johanandren changed the title chore: Better error message for unsupported optional + collection in … chore: Better error for unsupported optional + collection in views Apr 14, 2026
@octonato

Copy link
Copy Markdown
Contributor

Can we do this with the compile time annotation processor?

@johanandren

Copy link
Copy Markdown
Contributor Author

Yes we can. Now added, also covered a few more unsupported (Map data types, unsupported java.time types, Optional<Optional<T>>)

@octonato octonato left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

The validation is much much more verbose than the previous impl, but much better. I'm happy we have a good friend writing all that for us.

@octonato
octonato merged commit 3fd995f into main Apr 14, 2026
34 checks passed
@octonato
octonato deleted the wip-better-error-for-optionals-in-view-collections branch April 14, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants