Enums
You can use the '@enum'
reserved keyword to specify possible values of a request parameter or a model property. See more about it here.
Example #1
app.get('/path', (req, res) => {
...
/* #swagger.parameters['any_name'] = {
in: 'query',
description: 'Some description...',
schema: {
'@enum': ['arc', 'desc']
}
} */
...
});
Example #2 (reusable)
const doc = {
...
components: {
schemas: {
Color: {
'@enum': [
"black",
"white",
"red",
"green"
]
}
}
}
};
app.get('/path', (req, res) => {
...
/* #swagger.parameters['any_name'] = {
in: 'query',
description: 'Some description...',
schema: {
$ref: '#/components/schemas/Color'
}
} */
...
});