Redocly / redocly-cli

⚒️ Redocly CLI makes OpenAPI easy. Lint/validate to any standard, generate beautiful docs, and more.
https://redocly.com/docs/cli/
MIT License
931 stars 144 forks source link

lint info-license-strict exception for UNLICENSED #1754

Open jayvdb opened 2 weeks ago

jayvdb commented 2 weeks ago

Is your feature request related to a problem? Please describe.

For an private API, we are using

license:
  name: UNLICENSED

This is used to match the license value recommended in npm docs: https://docs.npmjs.com/cli/v10/configuring-npm/package-json

redocly lint emits warning

License object should contain url field.

Describe the solution you'd like

IMO UNLICENSED should be recognised as not needing a URL.

IMO the lint could also stipulate that UNLICENSED means the identifier field (SPDX) must not be present, as they are mutually exclusive.

Describe alternatives you've considered

Disabling the lint locally is a workaround, but then if someone adds a URL, and it is malformed, the linter will ignore it. Or someone helpfully but incorrectly adds "identifer: Unlicense" that should be blocked by the linter.

Additional context

tatomyr commented 2 weeks ago

I think this does not comply to the OpenAPI specification. To cover your case, you can either suppress that particular warning with the ignore file or write your rule via a custom plugin.

jayvdb commented 2 weeks ago

Sorry, could you indicate why this doesnt comply with the spec, and which version of the spec you are referring to?

tatomyr commented 2 weeks ago

Oh, sorry, I didn't mean it's against the spec. I was trying to say that that particular case is not described anywhere in the OpenAPI. So for me it doesn't make sense to modify our existing rule.