stoplightio / spectral

A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI (v3.1, v3.0, and v2.0), Arazzo v1.0, as well as AsyncAPI v2.x.
https://stoplight.io/spectral
Apache License 2.0
2.45k stars 234 forks source link

feat(rulesets): add message traits array path to asyncapi headers schema type object rule #2460

Closed CalemRoelofsSB closed 1 year ago

CalemRoelofsSB commented 1 year ago

Recreation of #2402 to fix issues around commitlint

Checklist

Does this PR introduce a breaking change?

Additional context

Currently, the asyncapi-headers-schema-type-object will not trigger when the headers object is defined explicitly in the message.traits array. For example:

...
channels:
  'users/{userId}/loggedIn':
    publish:
      message:
        traits:
          - headers
              type: integer

The new path added in this PR will match on that array and perform the assertion on the type field of any object in that array that has a top level key of headers.

CalemRoelofsSB commented 1 year ago

ping @P0lip

P0lip commented 1 year ago

Looks good to me, although I'd wait for an approval from our AsyncAPI colleagues as they're the most familiar with it :)

CalemRoelofsSB commented 1 year ago

@P0lip @jonaslagoni thank you for the review folks! Unfortunately, I don't have permissions to merge this branch into develop so if one of you could oblige, that would be most appreciated :)

stoplight-bot commented 1 year ago

:tada: This PR is included in version @stoplight/spectral-rulesets-v1.16.0 :tada:

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

Your semantic-release bot :package::rocket:

stoplight-bot commented 1 year ago

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

The release is available on:

Your semantic-release bot :package::rocket:

stoplight-bot commented 1 year ago

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

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

Your semantic-release bot :package::rocket:

stoplight-bot commented 1 year ago

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

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

Your semantic-release bot :package::rocket: