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

Error when trying to lint schemas with circular references #870

Closed
rafael-andrade-3010 opened this issue Dec 20, 2019 · 7 comments
Closed
Assignees
Labels
t/bug Something isn't working

Comments

@rafael-andrade-3010
Copy link

rafael-andrade-3010 commented Dec 20, 2019

When we run the command spectral lint in our project, we are having the following error

1:1 error invalid-ref ENOENT: no such file or directory, open '<path>/openapi-simplifed.yaml'

We are running the command like this

spectral lint schemas-2/*.yaml

You can try to run the spectral lint in this sample to test.
github-error-sample.zip

Thanks

@rafael-andrade-3010 rafael-andrade-3010 changed the title Error when trying to lint schemas with multiple leves Error when trying to lint schemas with multiple levels Dec 20, 2019
@P0lip P0lip added the t/bug Something isn't working label Dec 27, 2019
@P0lip P0lip changed the title Error when trying to lint schemas with multiple levels Error when trying to lint schemas with circular references Dec 28, 2019
@P0lip
Copy link
Contributor

P0lip commented Jan 9, 2020

Forgot to post an update on this one.
I investigated the issue a few days ago and found out its caused by json-ref-resolver and its caching mechanism.
We haven't fixed that yet, but it's a WIP.

@kylesykes
Copy link
Contributor

@P0lip would this also be the cause for inconsistent failures when linting with v5? I'm attaching an example that replicates the inconsistent failures we are seeing (which has been maddening to debug).

The screenshot below is running the attached example multiple times in a row. I feel like it would be really weird if json-ref-resolvers caching issues extended beyond individual runs of Spectral (meaning the cache is happening somewhere on my machine and corrupting future runs of Spectral?)

I figured I would comment here before opening a new issue if it happens to be symptoms of the same behavior. If you don't think this is causing it, I can open a new issue with the same information to better track the cause.

stoplight_breaking_example.zip
image

@lehphyro
Copy link

lehphyro commented Feb 8, 2020

We have the same issue, please note that it's not about circular references but rather just following references properly so the issue title should be fixed.

@P0lip
Copy link
Contributor

P0lip commented Feb 12, 2020

@kylesykes @lehphyro
Hey folks.
Sorry not keeping you waiting.
The fix is under way - going to take a while, but it's in progress.

The screenshot below is running the attached example multiple times in a row. I feel like it would be really weird if json-ref-resolvers caching issues extended beyond individual runs of Spectral (meaning the cache is happening somewhere on my machine and corrupting future runs of Spectral?)

answering your question - that is totally possible.

@philsturgeon
Copy link
Contributor

@P0lip did we get this one sorted out?

@P0lip
Copy link
Contributor

P0lip commented Apr 28, 2020

Not yet. I was hoping to fix json-ref-resolver and started working on the fix, but since we decided to abandon it, it didn't move any forward.

@philsturgeon
Copy link
Contributor

Ok, let's consider this issue superseded by #1054. Moving to a popular, well used JSON Ref package should be a big win for trouble like this, especially with $ref changes coming in OAS3.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants