OAS 3.1: Support for const keyword
CameronMackenzie99 opened this issue · comments
OAS 3.1 introduced the const
keyword (see discussion), syntactically equivalent to a single value enum, for example:
{
"components": {
"schemas": {
"BingData": {
"additionalProperties": false,
"properties": {
"bing": {
"const": "Anything You Need",
"title": "Bing"
}
},
"required": [
"bing"
],
"title": "BingData",
"type": "object"
},
"DingData": {
"additionalProperties": false,
"properties": {
"anything_you_need": {
"const": "Anything You Need",
"title": "Anything You Need"
}
},
"required": [
"anything_you_need"
],
"title": "DingData",
"type": "object"
}
},
"info": {
"title": "Events",
"version": "0.1.0"
},
"openapi": "3.1.0"
}
}
Supporting this in the library will be really useful for consumers to be able to account for this keyword when parsing schemas.
I'm not entirely sure how this would be typed as I can see that the enum keyword is currently typed as any[]
here
Added in #132