How to define constant string in Swagger open api 3.0
As @Helen already pointed out, and as you can read in the linked answer, currently it does not seem to get any better than an enum
with only one value. Full example that can be pasted into http://editor.swagger.io/:
{
"openapi": "3.0.0",
"info": {
"title": "Some API",
"version": "Some version"
},
"paths": {},
"components": {
"schemas": {
"StatusCode": {
"title": "StatusCode",
"enum": [
"The only possible value"
],
"type": "string"
}
}
}
}
There is a related topic on Github which is unsolved as of now: https://github.com/OAI/OpenAPI-Specification/issues/1313