question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@Schema oneOf, anyOf, etc. and better support for inheritance

See original GitHub issue

Can we use polymorphism features like oneOf, anyOf etc with Springfox?

@ApiResponse( content = @Content( 
                    mediaType = MediaType.APPLICATION_JSON_VALUE, 
                    schema = @Schema(oneOf = { Bird.class, Cat.class })) )
@PostMapping( path = "animals", produces = "application/json" )
ResponseEntity<IAnimal> echoAnimal( @RequestBody IAnimal animal );

I used io.swagger.v3.oas.annotations.responses.ApiResponse. But did not work. Can anyone please help me to do it? Note: I am using springfox-boot-starter:3.0.0-SNAPSHOT.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dilipkrishcommented, Jul 13, 2020

Not yet. This will be available in the next release

1reaction
dilipkrishcommented, Jul 13, 2020

Yes will be pushing it today! 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

oneOf, anyOf, allOf, not - Swagger
Use the oneOf keyword to ensure the given data is valid against one of the specified schemas. ... The example above shows how...
Read more >
Fixed support for oneOf and anyOf to produce the right result ...
Referenced in this issue: RicoSuter/NSwag#2991 The only valid solution to generation of classes in C# to support anyOf and oneOf, is to merge...
Read more >
"extends"/"allOf" and schema inheritance - Google Groups
The core of inheritance is that "B extends A" means that "Every valid B is also a valid A". So, wherever you use...
Read more >
Proper use of polymorphism / inheritance in Open API 3
To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an allOf ......
Read more >
Class inheritance and polymorphism in JSON schema
The inheritance is achieved in JSON by the keyword allOf. This keyword validates the value against all the subschemas. In the sub class ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found