Enum is not supported on response
Closed this issue · 2 comments
nlewo commented
In my openapi schema, a response attribute looks like:
"status": {
"type": "string",
"title": "Status",
"minLength": 1,
"enum": [
"active",
"paused",
],
}
However, the generated response based on this schema looks like:
{
"status": "Eum molestiae et soluta. Occaecati optio qui qui nesciunt. Neque vel sit exercitationem sequi commodi officia. Nam deserunt voluptatibus. Autem fugiat veritatis aut.",
}
I would have expected the value of the status attribute to be one of the values belonging to the enum, ie active
or paused
.
strider2038 commented
Hello! I cannot reproduce an error. Enum works fine for this schema.
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Status test",
"license": {
"name": "MIT"
}
},
"servers": [
{
"url": "http://example.com/v1"
}
],
"paths": {
"/status": {
"get": {
"summary": "Status",
"operationId": "getStatus",
"responses": {
"200": {
"description": "Status test",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": {
"type": "string",
"title": "Status",
"minLength": 1,
"enum": [
"active",
"paused"
]
}
}
}
}
}
}
}
}
}
}
}
Can you give a full example of a schema?
nlewo commented
Hm, it seems I was tired because i'm no longer able to reproduce my issue... I tried again on my schema and i'm actually get correct enum values:/
Sorry for the noise and thanks for this project!