Replies: 2 comments
-
you can define your own |
Beta Was this translation helpful? Give feedback.
0 replies
-
@graemerocher thanks, so you suggest subclassing the suite of e.g. Jakarta annotations and adding @inherited to each subclass, then using those new subclassed annotations instead? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Issue description
We are migrating from 1.x to 3.6.x.
In our system, we define our HTTP API specifications via java interfaces. All swagger annotations and generic API semantics are declared in a java module that only contains java interfaces, annotated with swagger, micronaut server-side and jakarta annotations (e.g. Nullable, Non/NotNull etc). We need to use the validation rules/etc in the API interface so that the swagger processor understands required vs optional and therefore produces the correct swagger definitions.
We then implement the actual interfaces inside a separate micronaut http server-side modules (e.g. using netty, or AWS API gateway, depending on the deployment scenario).
We have declared some optional HTTP request parameters (e.g. query) in our API interface module. As mentioned above, we do this e.g. via @nullable so that the swagger file correctly reflects the optionality.
In 1.x, the server-side HTTP interface implementation also was correctly aware of the optionality. However, in 3.6.x our tests fail because the server module appears to be unaware of the Nullable annotation that was applied to the java interface definition.
From reading https://docs.micronaut.io/3.6.0/guide/#breaks it appears that this is intentional:
The consequence of this is that we now need to apply @nullable annotations on both our API interfaces and also implementations, which is clearly error prone and not consistent with the principles of DRY.
Our biggest concern is that in order to make the APIs work again, we will need to copy & paste the annotations. There could be some human error during this exercise, which might lead to an endpoint behaving incorrectly. Hopefully test coverage would prevent this, but there is always a risk that we missed a test case.
What is the recommended approach to such migrations?
Beta Was this translation helpful? Give feedback.
All reactions