IBM / openapi-validator

Configurable and extensible validator/linter for OpenAPI documents
Apache License 2.0
481 stars 88 forks source link

fix: adjust header parameter casing convention check #648

Closed dpopp07 closed 6 months ago

dpopp07 commented 6 months ago

This allows us to support standard header patterns that would previously be flagged by the validator. The casing function options provided by Spectral are not sophsiticated enough to support the complexity of header parameter conventions (which use kebab-separated pascal case with capitalized abbreviations).

The new regular expression is a little more relaxed than the old convention but it also more accurate.

I made this change in a configuration-compatible way by expanding the config support to accept function arguments for either the casing or pattern built-in Spectral functions. This is slightly hacky but gives both us and users more control without changing any existing behavior. We might want to make this change for our other casing convention checks but for now, this is sufficient to solve our issues. The way we support configuration of Spectral functions is complicated, especially when we decide we don't want to use those functions 🙂

I'm also happy to make this a "hidden feature" and take it out of the document and just use it as a convenience pattern for us to control casing through regular expressions without changing our configuration API.

ibm-devx-sdk commented 6 months ago

:tada: This PR is included in version 1.3.1 :tada:

The release is available on npm package (@latest dist-tag)

Your semantic-release bot :package::rocket:

ibm-devx-sdk commented 6 months ago

:tada: This PR is included in version 1.15.3 :tada:

The release is available on npm package (@latest dist-tag)

Your semantic-release bot :package::rocket:

ibm-devx-sdk commented 6 months ago

:tada: This PR is included in version 1.16.3 :tada:

The release is available on npm package (@latest dist-tag)

Your semantic-release bot :package::rocket: