lerenn / asyncapi-codegen

An AsyncAPI Golang Code generator that generates all Go code from the broker to the application/user. Just plug your application to your favorite message broker!
Apache License 2.0
78 stars 21 forks source link

When using message trait, the message generation is broken #173

Closed lerenn closed 3 months ago

lerenn commented 3 months ago

When using a message trait on a message, the struct representing headers is uncorrectly named and the file is not correct as collision occurs as well as non corresponding naming. Example:

type header struct {
    CorrelationId *string `json:"correlation_id"`
}

// ListResponseMessage is the message expected for 'ListResponseMessage' channel.
type ListResponseMessage struct {
    // Headers will be used to fill the message headers
    Headers Header

From

components:
  messageTraits:
    withCorrelationID:
      headers:
        type: object
        properties:
          correlationId:
            description: Correlation ID set by client
            type: string