I want to take this one step further. I want to specify a finite list of values as enumerable that are derived from a single property on an array of existing objects. I have two files: the schema, and an external json file containing reference data.
In my reference file, I have 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 do is specify that the correct set of enumerable values are the values in "code2". Is there a way to specify this without having to rip apart my reference files? Like so:
“get”: {
“parameters”: [
“countryCode2”: {
“in”: “query”,
“schema”: {
“$ref”: “referencefile.json/#/Countries/code2”
}
}
]
}