Skip to content

Support original name for structs #314

Open
@ebooneBB

Description

A CLI option to allow for the original name in the avro schema (or fullname) to be maintained and capitalized in the resulting go struct would be beneficial.

Schema

{
  "name": "one_two_three_four__five",
  "type": "record",
  "fields": [
    {
      "name": "CreatedDate",
      "type": "long",
      "doc": "CreatedDate:DateTime"
    }
  ]
}

Current

Command

avrogen -pkg salesforce -o x.go -tags json:snake x.avsc

Output

package salesforce

// Code generated by avro/gen. DO NOT EDIT.

// OneTwoThreeFourFive is a generated struct.
type OneTwoThreeFourFive struct {
	CreatedDate int64 `avro:"CreatedDate" json:"created_date"`
}

Desired

Command (placeholder)

avrogen -pkg salesforce -o x.go -tags json:snake -originalname x.avsc

Output

package salesforce

// Code generated by avro/gen. DO NOT EDIT.

// One_two_three_four__five is a generated struct.
type One_two_three_four__five struct {
	CreatedDate int64 `avro:"CreatedDate" json:"created_date"`
}

Activity

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

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions