Azure / oav

Tools for validating OpenAPI (Swagger) files.
MIT License
95 stars 54 forks source link

Support $ref siblings #848

Open leni-msft opened 2 years ago

leni-msft commented 2 years ago

To align with autorest behavior https://github.com/Azure/autorest/blob/main/docs/openapi/howto/$ref-siblings.md

mikeharder commented 3 months ago

This should be fixed in coordination with https://github.com/Azure/azure-openapi-validator/issues/637.

Siblings of $ref may be either ignored or included, depending on the spec and tool versions: https://github.com/Azure/azure-openapi-validator/discussions/706

As long as we're using ajv@6, I think the fix is to change this:

https://github.com/Azure/oav/blob/b3a9b4c2e2f8d1aab9d3c907ee7e9d6425bff8cc/lib/swaggerValidator/ajvSchemaValidator.ts#L48

From "fail" to true (https://github.com/ajv-validator/ajv/blob/v6/lib/ajv.d.ts#L180).

This option is removed in ajv@7. See https://github.com/ajv-validator/ajv/releases/tag/v7.0.0, and search for "$ref".