swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

$refs with malformed JSON pointers not flagged as error?

Open jdegre opened this issue 5 years ago • 1 comments

Hi, I found a $ref in a certain OpenAPI 3.0.x API description, with an invalid syntax, such as:

$ref: '#components/schemas/MyType'

Note that there is a missing / between # and components.

swagger-parser did not return any error after invoking validate(), or dereference().

Why is that? Does the fact that the string after # is not a valid JSON Pointer expression, imply that $ref is not considered as a JSON Reference that needs to be resolved?

Thanks in advance!

jdegre avatar Apr 08 '20 11:04 jdegre

Hi, I have this issue too. This malformed pointer is left unchanged during bundling and became dangling. I have to check resulting object manually for having such malformed pointers to generate an error during bundling rather than in runtime. Please fix it!

igor-anferov avatar Oct 08 '20 15:10 igor-anferov