IBM / openapi-validator

Configurable and extensible validator/linter for OpenAPI documents
Apache License 2.0
493 stars 88 forks source link

fix: allow property names to be $ref without crashing #672

Closed dpopp07 closed 3 months ago

dpopp07 commented 3 months ago

The rules checking for valid ref patterns and for circular references both assumed that any $ref values found in the entire document would be reference values, and therefore strings.

However, it's valid to define the field with the literal name "$ref" in other places - e.g. as a property name. The ref-related rules would crash if it encountered these cases because of the assumption that the values would be strings. This commit adds a simple check to enforce that the rules are, in fact, dealing with a string value.

Resolves #661

PR summary

PR Checklist

General checklist

Please make sure that your PR fulfills the following requirements:

ibm-devx-sdk commented 3 months ago

:tada: This PR is included in version 1.18.2 :tada:

The release is available on npm package (@latest dist-tag)

Your semantic-release bot :package::rocket:

ibm-devx-sdk commented 3 months ago

:tada: This PR is included in version 1.19.2 :tada:

The release is available on npm package (@latest dist-tag)

Your semantic-release bot :package::rocket:

ibm-devx-sdk commented 3 weeks ago

:tada: This PR is included in version 1.4.0 :tada:

The release is available on npm package (@latest dist-tag)

Your semantic-release bot :package::rocket: