Skip to content

why @Schema(anyOf = {xxx.class, xxx.class}) doesn't work but @Schema(allOf = {xxx.class, xxx.class} can?) #265

Discussion options

You must be logged in to vote

Hi @manchuanxingmengyaxinhe,

Short answer: Your observation is correct, while allOf is supported out-of-the-box, anyOf (or oneOf for that matter) is not handled by the Swagger 2.0 Module yet.

if (annotation.allOf().length > 0) {
Stream.of(annotation.allOf())
.map(rawType -> context.getTypeContext().resolve(rawType))
.map(context::createDefinitionReference).forEach(memberAttributes
.withArray(context.getKeyword(SchemaKeyword.TAG_ALLOF))::add);
}

I've created PR #266 now, to add that missing s…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@manchuanxingmengyaxinhe
Comment options

@manchuanxingmengyaxinhe
Comment options

Answer selected by manchuanxingmengyaxinhe
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