Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$ref to adjacent_file object in #/components/parameters block not resolving #23

Open
seahorseing-around opened this issue Aug 12, 2020 · 5 comments

Comments

@seahorseing-around
Copy link

Loving the plugin! making lightweight of a new complex spec - but run into something you might not have caught yet.

I have references to both schema and parameter objects in an adjacent file.

If the reference is to adjacent_file.yaml#/components/schemas/schemaObject the link does resolve

If the reference is to adjacent_file.yaml#/components/parameters/schemaObject the link does not resolve

I wonder if the plugin is only built to support the schemas block? I haven't tried the other available components sections: https://swagger.io/docs/specification/components/.

Thanks,
Craig

@MikeRalphson
Copy link
Contributor

No, references should work wherever allowed by the spec. Can you share your files in a gist so I can debug?

@seahorseing-around
Copy link
Author

Afraid i can't share them - but i can try to recreate on an example - i'll see what i can do.

@MikeRalphson
Copy link
Contributor

Thanks. The extension uses the same libraries as boast in the swagger2openapi npm package. You could use that in verbose mode to see if there are any problems resolving your refs.

@seahorseing-around
Copy link
Author

SWAGGER Lint.zip

Sorry - not used Gist before and saw an easy attach here option - hope this is ok.

petstore_no_components.yaml presents an error:
image

If you uncomment the parameters block in petstore_no_components.yaml and switch the commented lines in the refs to use the local parameters all errors go, indicating the schemas references in the external file are resolving fine.

@MikeRalphson
Copy link
Contributor

I'll admit this is a little confusing in the current version. The message means the reference cannot be resolved as an internal reference. The command you need to use is "OpenAPI Resolve and Lint" if your API definition is made of multiple parts. I'll probably soon release a new version where this is the default behaviour anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants