Forum Discussion
gajendrabisht
2 years agoNew Contributor
I want to show the value of field "id" to be "number" same as displayed for field "name" : "string" in default example on swagger UI. How can i do that?
Desired Output:
{
"id" : "number",
"category": {
"id" : "number",
"name" : "string"
}
}
- ponelat2 years agoStaff
That would make the example invalid since "number" isn't actually a number.
Some tools will attempt to validate that, although it is possible (but not advised) to work around that.
To workaround, use `default: 'number'` (eg: https://app.swaggerhub.com/apis/SwaggerPMTests/example-with-arbitrary-obj/1.0.0#/Example) . But again, this is not advised.
An alternative is to add more information about the field in `description` (see above example as well for that).
Related Content
Recent Discussions
- 9 hours agonoob_Vibes