heetch / heetch/avro

avrogo generates non-idiomatic names

Open
#126 6 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
95
Forks
18
PR merge metrics
No merged PRs in 30d

Description

Names produced by `avrogo` do not follow idiomatic Go capitalisation/initialisation rules. (e.g. use `ID` rather than `id` or `Id`).

This can be reproduced with the following schema
```
{
"name": "User",
"type": "record",
"fields": [
{
"name": "userID",
"type": {
"type": "string",
"logicalType": "uuid"
}
}
]
}
```

`avrogo` generates
```
type User struct {
Userid uuid.UUID `json:"userID"`
}
```

but an idiomatic representation would be
```
type User struct {
UserID uuid.UUID `json:"userID"`
}
```

There are third-party libraries available to achieve this (e.g. [github.com/hamba/avro](http://github.com/hamba/avro) uses [github.com/ettle/strcase](http://github.com/ettle/strcase)'s PascalCase).

If this were implemented then it would be helpful to allow additional initialisms with command line arguments. For example in my use case I have schemas referring to `MW` (megawatts) and would like that initialised too.

I'm happy to work on this but I want to check if the change would be accepted before starting.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.