Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mikicho committed Jan 7, 2022
1 parent e356a29 commit 428200f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/spec/openapi/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ function transformDefsToComponents (jsonSchema) {
jsonSchema.additionalProperties = { type: 'string' }
delete jsonSchema.patternProperties
} else if (jsonSchema.const) {
// Handle const, that is not part of OpenAPI definitions
// OAS 3.1 supports `const` but it is not supported by `swagger-ui`
// https://swagger.io/docs/specification/data-models/keywords/
jsonSchema.enum = [jsonSchema.const]
delete jsonSchema.const
}
Expand Down
3 changes: 2 additions & 1 deletion lib/spec/swagger/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ function replaceUnsupported (jsonSchema) {
jsonSchema.additionalProperties = { type: 'string' }
delete jsonSchema.patternProperties
} else if (jsonSchema.const) {
// Handle const, that is not part of OpenAPI definitions
// OAS 3.1 supports `const` but it is not supported by `swagger-ui`
// https://swagger.io/docs/specification/data-models/keywords/
jsonSchema.enum = [jsonSchema.const]
delete jsonSchema.const
}
Expand Down

0 comments on commit 428200f

Please sign in to comment.