Skip to content

Type Attribute Overrides #258

Closed Answered by CarstenWickner
dalucasPeraton asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @dalucasPeraton,

There was no particular annotation of that name. It is merely a fictional example to illustrate the use of those Type Attribute Overrides.
You can create the annotation type yourself if you want to use it for such a scenario.

@Retention(RetentionPolicy.RUNTIME)
@interface ValidOneOfTypes {
  Class[] value();
}

EDIT: as discussed below, the @Retention(RetentionPolicy.RUNTIME) is required for the annotation being picked up by the schema generator at runtime. Other annotations are (currently) not considered.

Alternatively, you could use the jsonschema-module-swagger-2 and add the @Schema(anyOf = {String.class, Number.class}) annotation. That would be the io.swagger.v3.o…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@dalucasPeraton
Comment options

@CarstenWickner
Comment options

@dalucasPeraton
Comment options

Answer selected by CarstenWickner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants