Skip to content

Generated struct field names should be PascalCase without underscores #147

@edmundadjei

Description

@edmundadjei

The avrogo code generator produces non-idiomatic Go struct field names when Avro schema fields contain underscores. It preserves underscores in field names (e.g., Event_type) instead of converting to proper PascalCase (e.g., EventType).

{
"type": "record",
"name": "TestEvent",
"namespace": "test.events",
"fields": [
{
"name": "event_type",
"type": "string"
},
{
"name": "user_id",
"type": "string"
}
]
}

generates

type TestEvent struct {
Event_type string json:"event_type"
User_id string json:"user_id"
}

not
type TestEvent struct {
EventType string json:"event_type"
UserId string json:"user_id"
}

save the exampel schema to disk and run

avrogo -p test test_event.avsc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions