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

Unrecommend openapi-tags #1132

Closed
philsturgeon opened this issue Apr 29, 2020 · 2 comments · Fixed by #1304
Closed

Unrecommend openapi-tags #1132

philsturgeon opened this issue Apr 29, 2020 · 2 comments · Fixed by #1304
Labels
breaking Pull requests that introduce a breaking change
Milestone

Comments

@philsturgeon
Copy link
Contributor

User story.
As a non-Stoplight user I do not understand the importance of tags, so it is a surprise when im told I absolutely must add them.

Is your feature request related to a problem?
Spectral users occasionally ask why Spectral is telling them to do things not in the OpenAPI spec. The answer is usually "this is a linter, not a validator" and that most of the rules are useful: avoiding bugs, stopping them getting hacked, etc.

One rule which doesn't fit the description is openapi-tags. It is useful for bigger APIs, but I'm working on a single endpoint OpenAPI description and adding tags to that is pretty redundant. It's there because Stoplight docs like tags, but for a single endpoint API I don't need my docs grouped like that anyhow.

Describe the solution you'd like

For v6.0 we should just make this one rule recommended: false.

Additional context

In the future I'd like to look into a spectral-stoplight-ruleset with all sorts of rules relevant to Stoplight but not particularly relevant to other tools. Food for thought whilst working on this so we know the direction at least.

@philsturgeon philsturgeon added this to the v6.0 milestone Apr 29, 2020
@philsturgeon philsturgeon changed the title Unrecommend openapi-tags / Stoplight Ruleset Unrecommend openapi-tags Apr 29, 2020
@lornajane
Copy link
Contributor

I wonder if we could move to having a "minimally-valid" ruleset and then "probably-best-practice" ones? I agree with most of the current setup but always turn off tags since they don't make sense in our many small APIs. We use them in a few places, but not many.

@philsturgeon
Copy link
Contributor Author

philsturgeon commented Apr 29, 2020

Although it's not explicitly stated anywhere, this is what recommended was meant to be. By default you only get rules with recommended: true, and to get all the rules you do this:

extends:
- ["spectral:oas", "all"]

Having all rules is basically the "strict mode" from speccy (remember --ruleset=strict?). If you enable this, prepare for a world of pain, but otherwise we tell you if things are structurally and semantically correct.

openapi-tags has felt out of place in this model, as its more of a strict thing than other rules so we're moving it over.

@philsturgeon philsturgeon added the breaking Pull requests that introduce a breaking change label Jul 9, 2020
philsturgeon pushed a commit that referenced this issue Aug 18, 2020
If you want to use it, switch from  to

fixes #1132
philsturgeon pushed a commit that referenced this issue Aug 19, 2020
If you want to use it, switch from  to

fixes #1132
philsturgeon pushed a commit that referenced this issue Aug 20, 2020
* BREAKING: removed operation-default-response

The spec says: The default MAY be used as a default response object for all HTTP codes that are not covered individually by the specification.

There's no need to suggest anyone default is any more important than optional.

* chore: remove nvmrc

lets let people run this with whatever version and the CI will confirm it works with versions we care about.

* fixes #1273: allow 2xx or 3xx responses

* BREAKING: Made openapi-tags not recommended

If you want to use it, switch from  to

fixes #1132

* put nvmrc back

Co-authored-by: Phil Sturgeon <me@philsturgeon.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Pull requests that introduce a breaking change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants