wework/speccy

Linting should not fail if tags are not in alphabetical order

monooso opened this issue · 4 comments

Linting fails if tags are not in alphabetical order. This should not be the case.

Detailed description

The default rules cause linting to fail if the tags array is not in alphabetical order (using the name property as the key).

However, the OpenAPI spec does not require that tags appear in alphabetical order. Quite the opposite, in fact:

The order of the tags can be used to reflect on their order by the parsing tools.

Context

One side-effect of this bug is that there's no way (that I'm aware of) to control the order of the endpoints in the generated documentation.

Possible implementation

Two possible solutions are:

  1. Fully remove the rule, or
  2. Move the rule to the "strict" ruleset.

Your environment

  • Node Version: 10.16.3
  • Operating system and version: macOS 10.14.6

Sorry for the comment in the referenced commit message (and thanks, GitHub, for being so "helpful"). OpenAPI has been trying my patience.

Rulesets are opinitionated by their very nature, and you can use different rulesets or skip this rule if you like.

Spectral makes it way easier to customize things like this if you're interested in a more mature library with better support. https://github.com/stoplightio/spectral

Hi @philsturgeon,

Rulesets are opinitionated by their very nature, and you can use different rulesets or skip this rule if you like.

Fair enough, I'll make the changes to my ruleset.

I would contest that a ruleset (however opinionated) shouldn't directly contravene the OpenAPI specification, but that's more of an open-ended discussion.

Cheers,
Stephen

It doesn’t contravene, to contravene OpenAPI speccy would have to suggest you write invalid OpenAPI. Instead it helps you write valid OpenAPI AND offers configurable complementary opinions.