allOf/anyOf support
See original GitHub issuePlease take the time to search the repository, if your question has already been asked or answered.
Springfox 2.9.1-SNAPSHOT
What kind of issue is this?
-
Question. Is this a question about how to do a certain thing?
-
Bug report. If you’ve found a bug, spend the time to write a failing test. Bugs with tests or steps to reproduce get fixed faster.
-
Feature Request. Start by telling us what problem you’re trying to solve. Often a solution already exists! Don’t send pull requests to implement new features without first getting our support. Sometimes we leave features out on purpose to keep the project small.
Is it possible to generate an oneOf/anyOf definitions described here with Springfox at the moment?
I have a REST resource that can return a serialized instance of one of two types, say A and B:
abstract class Common {
// Contains common fields for A and B
}
class A extends Common {
// Adds A specific fields
}
class B extends Common {
// Adds B specific fields
}
And here how my API would look like:
// Swagger documentation annotation
@ApiOperation(
value = "Get items",
// Specify a parent class here instead of actual definition
response = Common.class)
@GetMapping
public Common getItem(String id) {
...
}
Is there any way to define that a resource can return either of two concrete types with Springfox?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top GitHub Comments
Maybe I will answer. I have a similar problem and I am not pretty sure is it solvable by springfox (by OAS3 for sure is). Later I can provide github example but more/less I have the case:
So in my case, it should be sth like that:
But always I receive:
Maybe some extra annotations need to be added? I have tried a few approaches but failed each time.
We still need this. Springfox isn’t providing much value at the moment because the UI it generates is missing most of the relevant information.