You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an object that is used in a request body, with the following annotation on one of it's fields
public static class Area {
@Schema(oneOf = { String.class, Number.class }, description = SwaggerAPIMessages.KEY, required = true, example = "")
private Object key;
When i generate swagger, and import to editor.swagger.io i get
structural error at components.schemas.Area.properties.key
should NOT have additional properties
additionalProperty: jsonSchema
Jump to line 404
where the generated swagger there, is
Area:
required:
- key
- value
type: object
properties:
key:
type: object
description: The category part for a x,y plot
jsonSchema:
type: object
description: The category part for a x,y plot
I also see no creation of the oneOf specification.
Anyone know what i'm doing wrong?
The text was updated successfully, but these errors were encountered:
Given the presence of jsonSchema value, this looks like to be at least partially caused by lack of usage of ObjectMapper configured by io.swagger.v3.core.util.Json or io.swagger.v3.core.util.Yaml. How are you serializing the resolved OpenAPI object? please use Yaml.pretty(openAPI)
In your scenario (primitive or object type of field annotated with oneOf) 2.2.2 version indeed ignores oneOf annotations. refs #4247 - fix composed schema resolving on props #4248 fixes this, and it should work ok in lastest snapshot / next release.
Closing ticket, please reopen if still experiencing issues
Using swagger: 2.2.2
I have an object that is used in a request body, with the following annotation on one of it's fields
When i generate swagger, and import to editor.swagger.io i get
structural error at components.schemas.Area.properties.key
should NOT have additional properties
additionalProperty: jsonSchema
Jump to line 404
where the generated swagger there, is
I also see no creation of the oneOf specification.
Anyone know what i'm doing wrong?
The text was updated successfully, but these errors were encountered: