APIDevTools / swagger-parser

Swagger 2.0 and OpenAPI 3.0 parser/validator
https://apitools.dev/swagger-parser
MIT License
1.09k stars 154 forks source link

$refs with malformed JSON pointers not flagged as error? #141

Open jdegre opened 4 years ago

jdegre commented 4 years ago

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!

igor-anferov commented 3 years ago

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!