javalin / javalin/javalin-openapi
OneOf for sealed classes imported from another module
- Dominant language
- Kotlin
- Stars
- 67
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
Hi @dzikoysk thank you for the great support of `@OneOf` for sealed classes. Unfortunately, recently I faced a new issue connected to it.
Previously I had only one submodule requiring OpenAPI spec but recently I got another one. And this second one uses some API classes from the first one. And there I discovered that automatic filling and mapping of `@OneOf` is not working for sealed classes imported from another module.
After looking into the annotation processor code I realized that it happens because the processor searches for candidate classes for `oneOf` list – (subtypes of the given sealed class) among the list of classes annotated with `@DiscrimnatorMappingName` which doesn't include any classes from an external module.
I couldn't find any quick solution to this problem and have to duplicate such classes in every module that uses them.
Do you have any idea of how to make `@OneOf` work properly (the same way as it works in its own module)? I'm ready to try to implement it if you have one.
Contributor guide
Research direction
Start by inspecting the annotation processor logic that builds the @OneOf list from @DiscriminatorMappingName-annotated classes. Trace how classes from another module are represented and compare that with same-module sealed-class handling. Done means @OneOf is automatically populated for imported sealed-class subtypes without duplicating those classes in each module.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100