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

Linting/Validation does not default to "resolve" #20

Open
stevenj opened this issue Apr 13, 2020 · 4 comments
Open

Linting/Validation does not default to "resolve" #20

stevenj opened this issue Apr 13, 2020 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@stevenj
Copy link

stevenj commented Apr 13, 2020

When you have a OAS3 document with references, the linter/validator throws errors like "component name invalid"

If you manually run "resolve and validate" it reports no errors.

Is there an actual reason to NOT resolve references if present?

Is there any way to make resolve & validate the default?

@MikeRalphson
Copy link
Contributor

I assume your first point refers to external references, and only those in that trigger the bug in your other issue (#21). If not, could you please elaborate?

As to your second point, there is no notion of a default behaviour in this extension, because the validate/lint/resolve functionality is all manually selected from the command palette. Users can select a shortcut for whichever behaviour they prefer or just reuse the most recent command.

The reason resolving was not folded into the earlier existing commands was to not change existing behaviour (for example if you are developing an OAS document but have not fleshed out the referenced files yet).

@stevenj
Copy link
Author

stevenj commented Apr 14, 2020

Hmm, it must be another extension then that triggers the error. Sorry for the noise. I assumed this extension was running and linting my files automatically.

I appreciate the resolve for external references in your plugin, it stopped me from going insane.

@stevenj
Copy link
Author

stevenj commented Apr 14, 2020

No there is definitely something wrong.

I disabled openapi-lint and i get no more openapi lint style errors when i save a file. I re-enabled it and disabled my one other openapi plug in, and if i save a file the lint errors appear.

For example:

!chgemail.yml API/v1/auth
component name invalid

gets listed in the Problems page when i save a file.

I can replicate this if i also run "OpenAPI Validate" manually. So it appears that yes, when I install and enable openapi-lint it is running a openapi validation on save (which is great) BUT its not resolving references, and it should.

Running OpenAPI Resolve and Validate manually reports the document is valid.

On save, if anything is run it should be "Resolve and Validate" it would be great to actually have an option to decide which is run on save "Validate". "Resolve and Validate", "Lint", "Resolve and Lint" or none.

@MikeRalphson
Copy link
Contributor

Ok, that sounds very reasonable.

MikeRalphson added a commit that referenced this issue Apr 14, 2020
@MikeRalphson MikeRalphson self-assigned this Apr 14, 2020
@MikeRalphson MikeRalphson added the enhancement New feature or request label Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants