Forum Discussion
When using oneOf, the subschemas must have unique required properties so that the tools can match the payload to the correct schema. Try specifying the required properties for Fish and Dog and see if it helps:
Fish:
type: object
required: [depth] # <-----------
properties:
depth:
type: integer
Dog:
type: object
required: [country] # <-----------
properties:
country:
type: string
HKosova thank you for the suggestion, I have applied the changes to the schemas as follows:
Fish:
type: object
required:
[depth]
properties:
depth:
type: integer
Dog:
type: object
required:
[country]
properties:
country:
type: string
But the errors results the same when calling the endpoint of the newly generated JAX-RS server
- dirosden4 years agoNew Member
dseybo - Did you get this to work? Having the same issue when parsing the request.
- dseybo4 years agoNew Contributor
dirosden unfortunately not, this is still an issue in the Swagger code generator for JAX-RS: https://github.com/swagger-api/swagger-codegen/issues/10520
Meanwhile, I have also tried to OpenAPI code generators but it turned out that a they have a different issue: https://github.com/OpenAPITools/openapi-generator/issues/7256
But I was able to implement the missing classes manually and with that workaround I am able to use oneOf with JAX-RS
Related Content
- 12 years ago
- 6 years ago
Recent Discussions
- 7 days ago
- 7 days ago
- 24 days ago