FAQ

  • GitHub GitHub Repo stars
  • Discord Discord Server
  • ✨ New! Try the OpenAPI Doctor ✨ The OpenAPI Doctor
    Recommended

    asyncapi-content-type


    Formats: Severity:

    asyncapi-content-type checks that payload-bearing messages declare how their payload is encoded.

    Why did this violation appear?

    A message has payload, but neither the message has contentType nor the document has a root defaultContentType.

    Bad example

    asyncapi: 3.1.0
    components:
      messages:
        UserCreated:
          payload:
            type: object
    

    Good example

    asyncapi: 3.1.0
    defaultContentType: application/json
    components:
      messages:
        UserCreated:
          payload:
            type: object
    

    How do I fix this violation?

    Add defaultContentType at the document root or add contentType to each payload-bearing message.