Skip to content

feat: add support for AsyncAPI headers#2484

Open
matthew-inamdar wants to merge 5 commits intoasyncapi:masterfrom
matthew-inamdar:master
Open

feat: add support for AsyncAPI headers#2484
matthew-inamdar wants to merge 5 commits intoasyncapi:masterfrom
matthew-inamdar:master

Conversation

@matthew-inamdar
Copy link
Copy Markdown

@matthew-inamdar matthew-inamdar commented Mar 11, 2026

Description

This PR adds opt-in support for header schemas in AsyncAPI specifications.

The ProcessorOptions type now accepts a new AsyncAPIInputProcessorOptions type for the asyncapi field.

The AsyncAPIInputProcessorOptions type has a single boolean option for includeMessageHeaders.

When includeMessageHeaders is set to true the following logic applies:

  1. During AsyncAPI traversal, models are generated for headers along with the existing logic of payloads.
  2. For operations with multiple messages:
    1. The payload union model name is suffixed with Payload
    2. The header union model is added and suffixed with Headers

N.B. I expect both the change in behavior for 2.i., and also the suffix naming convention to possibly be contentious and are therefore looking for guidance on these approaches.

Related Issue

#2482

Checklist

  • The code follows the project's coding standards and is properly linted (npm run lint).
  • Tests have been added or updated to cover the changes.
  • Documentation has been updated to reflect the changes.
  • All tests pass successfully locally.(npm run test).

Additional Notes

There is a further consideration about having a type generated for each message which is composed of headers and payload types – this would allow for discriminating once for the entire message instead of separately for both the headers and the payload.

This seems to require further changes to the behavior and I'm not confident if there is an appetite for it. If there is, I'll be happy to look into this approach.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 11, 2026

Deploy Preview for modelina failed.

Name Link
🔨 Latest commit fd1ceae
🔍 Latest deploy log https://app.netlify.com/projects/modelina/deploys/69b1440a09b01100087773bd

@matthew-inamdar matthew-inamdar changed the title Add support for AsyncAPI headers feat: Add support for AsyncAPI headers Mar 11, 2026
@matthew-inamdar matthew-inamdar changed the title feat: Add support for AsyncAPI headers feat: add support for AsyncAPI headers Mar 11, 2026
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant