Open jumpman255 opened 4 years ago
Hi @jumpman255
It's expected as the components section is not available in the current file (paths.yaml). You need to specify the file name as user schema is declared in schemas.yaml:
Use as below: $ref: './schemas.yaml#/components/schemas/User'
While your solution works, mine should also work according to OpenAPI specifications but doesn't with swagger-parser
. I finally resolved the refs manually with the package json-refs
.
@jumpman255 Can you please share the related OpenAPI specifications? Swagger-parser should adhere to spec
Here's a simplified version of my code. I have this file structure:
Here is
index.yaml
:Here is
schemas.yaml
:Here is
paths.yaml
:This is the returned error from
paths.yaml
:MissingPointerError: Token "components" does not exist.
As soon as I remove the reference, it's working.According to the specifications:
This should work.
I just made a (non)working exemple: https://github.com/jumpman255/swagger-parser-child-bug