asyncapi / saunter

Saunter is a code-first AsyncAPI documentation generator for dotnet.
https://www.asyncapi.com/
MIT License
195 stars 55 forks source link

Add support for message headers #150

Closed devlux closed 1 year ago

devlux commented 1 year ago

Add support for message headers:

{
    "asyncapi": "2.4.0",
    "defaultContentType": "application/json",
    "channels": {
        "channel.my.message": {
            "publish": {
                "operationId": "MyMessagePublisher",
                "summary": "",
                "message": {
                    "$ref": "#/components/messages/myMessage"
                }
            }
        }
    },
    "components": {
        "schemas": {
            "myMessage": {
                "id": "myMessage",
                "type": "object",
                "additionalProperties": false
            },
            "myMessageHeader": {
                "id": "myMessageHeader",
                "type": "object",
                "additionalProperties": false,
                "required": ["stringHeader"],
                "properties": {
                    "stringHeader": {
                        "type": "string",
                        "minLength": 1
                    },
                    "nullableIntHeader": {
                        "type": ["integer", "null"],
                        "format": "int32"
                    }
                }
            }
        },
        "messages": {
            "myMessage": {
                "headers": {
                    "$ref": "#/components/schemas/myMessageHeader"
                },
                "payload": {
                    "$ref": "#/components/schemas/myMessage"
                },
                "name": "myMessage"
            }
        }
    }
}

https://www.asyncapi.com/docs/reference/specification/v2.5.0#messageObject

m-wild commented 1 year ago

This is live in v0.12.0