asyncapi-codegen
asyncapi-codegen copied to clipboard
Generation: add overwriteable type names
Current Behaviour
Given the following spec:
components:
messages:
EventSuccess:
payload:
type: object
properties:
event_id:
type: integer
description: The id of the event
x-go-name: EventID
The produced output will have the generated type:
> asyncapi-codegen -i asyncapi.yml -g types -o gen.gen.go
// EventSuccessMessagePayload is a schema from the AsyncAPI specification required in messages
type EventSuccessMessagePayload struct {
// Description: The id of the event
EventId *int64 `json:"event_id"`
}
Desired Behaviour
The x-go-name
directive is respected, the same way oapi-codegen
does here
type EventSuccessMessagePayload struct {
// Description: The id of the event
EventID *int64 `json:"event_id"`
}
Notes
- Ok, I'm back with more XD
- This is similar to #162. It's handy to be able to overwrite the generated field names, for the consistency of the user's codebase.
Hello @wizzardich ! Thanks for taking the time to open the issues !
I'm on vacation until next week, so I may have not a lot of time, but I'll review everything ASAP :)
It's a bit busy for me as well right now, but I'll try to get to it in coming weeks!