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

Rule for enforcing top-level JSON Object for AsyncAPI message payloads #2119

Open
jonaslagoni opened this issue Apr 7, 2022 · 0 comments
Open
Labels
AsyncAPI Issues related to the AsyncAPI ruleset enhancement New feature or request triaged

Comments

@jonaslagoni
Copy link
Collaborator

jonaslagoni commented Apr 7, 2022

User story.
As a user, I want to enforce all message payloads to always contain a JSON object as the top-level message payload.

Describe the solution you'd like

I want this rule to be part of the built-in ruleset.

Additional context
The way I am currently enforcing it is through the rule:

rules: 
  ...
  asyncapi-message-payload-must-have-root-level-object:
    description: Message payloads must at the root be an object
    given: $.channels.[*][subscribe,publish].message..payload
    severity: error
    then:
      function: schema
      functionOptions:
        schema:
          properties:
            type:
              const: "object"
@jonaslagoni jonaslagoni added enhancement New feature or request AsyncAPI Issues related to the AsyncAPI ruleset labels Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AsyncAPI Issues related to the AsyncAPI ruleset enhancement New feature or request triaged
Projects
None yet
Development

No branches or pull requests

2 participants