I'm working on an openapi (3.0.2) specification for a spring client/server. I want to be able to specify that certain fields have a limited and finite set of values -- an enum. Trouble is, I want to reference an external data file of complex objects to serve as the limited and finite list. Like so:
The reference data:
“Countries”: [
{
“name”: “United States of America”,
“code3”: “USA”,
“code2”: “US”
},
{
“name”: “Canada”,
“code3”: “CAN”,
“code2”: “CA”
},
{
“name”: “Mexico”,
“code3”: “MEX”,
“code2”: “MX”
}
]
and what I want to be able to do is require an input parameter that specifically references code2:
“get”: {
“parameters”: [
“countryCode2”: {
“in”: “query”,
“schema”: {
“$ref”: “referencefile.json/#/Countries/code2”
}
}
]
}
I'm pretty sure this definition breaks, but I'm wondering if this is even possible without tearing my reference files apart.