I am working with Swagger (API v. 1.5.8) to document my Java/dropwizard code.
I know from the documentation that I can annotate my POJOs like this:
@ApiModelProperty(value = "pet status in the store", allowableValues = "available,pending,sold")
public String getStatus() {
return status;
}
to produce something like:
"properties": {
...,
"status": {
"type": "string",
"description": "pet status in the store",
"enum": [
"available",
"pending",
"sold"
]
}
}
Image now to implement the method:
@ApiModelProperty(value = "pets in the store")
public Set<String> getPets() {
return pets;
}
which returns a list of pets available in the store. For example, one day it could be
["cats", "dogs", "songbirds"]
["cats", "dogs"]
My API would in fact have an endpoint to fetch the list of pets:
Instead of using
allowableValues = "cats, dogs, songbirds"
I would like to specify with a Swagger annotation that
that field must contain a value returned by the given endpoint. That is, something like:
@ApiModelProperty(value = "pets in the store", allowableValues = "/pets")
public Set<String> getPets() {...}
This in order to allow my client/front-end to know which values can be use when making a request to,
for example, buying a pet online. Exactly how I could do if I had
"enum": ["cats", "dogs", ..]
Is it possible to accomplish something like this with the Swagger annotation?
If not, can I add a custom annotation to Swagger to do the same?
Thanks,
Niccolo`
--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.