microprofile/microprofile-open-api

`@DependentRequired`, `@DependentSchema` and `@SchemaProperty` are missing `@Target`

Closed this issue · 1 comments

I believe all of these annotations are only intended to be used as nested annotations within @Schema, so they should have @Target({}).

Without @Target they can be placed anywhere, but they'll likely be ignored.

Most are also missing @Retention so if placed on a Java element, they won't be visible at runtime. When used as a nested annotation (as intended for these annotations), @Retention has no effect.

I'm unsure whether fixing this would constitute a breaking change:

  • I don't think it would prevent anything loading at runtime (since annotation errors are generally ignored at runtime).
  • It would break source-compatibility, users who used these annotations directly on a Java element would get compile errors.
  • I don't think any implementation should be processing these annotations if they're placed on a Java element.

I suspect strict semver would say it's a breaking change requiring a major version, but perhaps we can choose to be flexible on that since the missing @Target was indeed a bug. I'd say the pragmatic thing would be to fix this in the next minor release.