Is it possible to have different #Ref Based on My API's Version
Hello,
I am new to swagger and using OpenAPI 3 and have come across something I can't find a reference or example to. Might be that I don't know the right key words to look for.
Here is a snippit of my YAML
servers:
- url: http://MySite:{Port}/MyRoute/{APIVersion}
variables:
APIVersion:
enum:
- '1'
- '2'
- '3'
default: '1'
Depending on what version of the API the user selects the request body schema description is different.
Here is a small example of what I mean:
APIVersion 1 - {MyField:0}
APIVersion 2 - {MyField:0, MyNewField:1}
This structure evolves with APIVersions
Question: Is there a way to load a different reference depending on what APIVersion is selected by the user, or do I need to create a different YAML file for each version?
Something of this nature:
content:
application/json:
schema:
if APIVersion = 1
$ref: '#/components/schemas/ConfigStructure'
else if APIVersion = 2
$ref: '#/components/schemas/ConfigStructure2'
Thanks for your help and time,
Marc