Skip to content

fix: add JSON omitempty and omitzero tags to asyncapiv3 types#286

Open
justenstall wants to merge 1 commit intolerenn:mainfrom
justenstall:add-json-omitempty
Open

fix: add JSON omitempty and omitzero tags to asyncapiv3 types#286
justenstall wants to merge 1 commit intolerenn:mainfrom
justenstall:add-json-omitempty

Conversation

@justenstall
Copy link
Copy Markdown

This PR adds omitempty and omitzero to the JSON struct tags for any fields that are not required according to the AsyncAPI specification. Some fields required the newer omitzero tag to be excluded without changing them to a pointer type, but I used omitempty for every other field for maximum backwards compatibility.

There is also a bug fix for the Operation.Description field, which was set to use string as its name in JSON.

I documented that the MessageTrait.Payload field should probably be removed, but kept it for now.

I also documented some nuances with the interpretation of the Operation.Messages field.

Signed-off-by: Justen Stall <39888103+justenstall@users.noreply.github.com>
@lerenn
Copy link
Copy Markdown
Owner

lerenn commented Oct 27, 2025

Sorry about the delay, I had some changes in my life this 2 past months, I'll take a look ASAP.

@stavros-k
Copy link
Copy Markdown

Fixes also #300

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.

3 participants