openapi-lint-vscode icon indicating copy to clipboard operation
openapi-lint-vscode copied to clipboard

Linting/Validation does not default to "resolve"

Open stevenj opened this issue 5 years ago • 4 comments

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?

stevenj avatar Apr 13 '20 01:04 stevenj

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).

MikeRalphson avatar Apr 13 '20 15:04 MikeRalphson

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 avatar Apr 14 '20 02:04 stevenj

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.

stevenj avatar Apr 14 '20 14:04 stevenj

Ok, that sounds very reasonable.

MikeRalphson avatar Apr 14 '20 14:04 MikeRalphson