Skip to content

Generated struct field names should be PascalCase without underscores #147

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions