Validate API version
API version in examples should be the same as the one specified in swagger, and the folder name
Majority of our swagger specs do not have an enum: ["..."] constraint for api-version. In autorest we deduce the value of the api-version from the version property in the info object and set that value to the api-version in the client constructor.
If the api-version has the enum constraint then model validator will validate the example accordingly. Basically the underlying json schema validator in the model validator will take care of it.
If the api-version parameter in the swagger does not have the enum constraint then there is no sane way of validating the value for api-version parameter apart from it being required and must be of type string.
A possible solution:
Although we can do one hack in the model validator. We do a bunch of transformations like resolving remote references, converting polymorphic models to oneOf references, etc. So we could add one more transformation that will add the value in info.version as an enum constraint on the api-version parameter if it already does not have an enum constraint. Then oav will fail if the value in the api-version parameter in an example does not match the value in the enum.
This could be beneficial in live validation as well.