-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
how to allow "any" body (map[string]interface{})? #261
Comments
Oh, I've found some workaround for this issue. I added body:
type: object
description: "Any valid JSON payload to be passed through for processing"
x-go-type: json.RawMessage and also removed type WebhookEventMessagePayload struct {
// Description: Any valid JSON payload to be passed through for processing
Body json.RawMessage `json:"body" validate:"required"`
} Only leftover is that it still generates following code even if it's no longer used: // BodyPropertyFromWebhookEventMessagePayload is a schema from the AsyncAPI specification required in messages
// Description: Any valid JSON payload to be passed through for processing
type BodyPropertyFromWebhookEventMessagePayload struct{} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With OpenAPI when I define component like this:
and generate types (using this generator) I will get following type:
but when I do the same in my AsyncAPI schema I get
Error: json: cannot unmarshal bool into Go struct field Schema.components.schemas.additionalProperties of type asyncapiv3.Schema
and when I change it to:
I get something like this:
and functions
MarshalJSON
andUnmarshalJSON
but all that looks super weird.AFAICT
AdditionalPropertiesFromBodyPropertyFromWebhookEventMessagePayload
is an empty struct, which means it’s not set up to hold any actual data.I'd need to modify generated code in a following way:
or comment half of generated code and place simply something like this:
So my question is: am I wrong? How should I allow "any" body in message?
The text was updated successfully, but these errors were encountered: