Skip to content

Permit specifying/overriding field names #73

@BatmanAoD

Description

@BatmanAoD

I have a handwritten struct that is shared between services in Python, TypeScript, C#, and Go.

The Go version has a field like this (where Date is a custom date type):

    EffectiveDate Date `json:"effective"`

It looks like it's currently impossible to generate a drop-in replacement because the field name doesn't match the JSON field name. Would it be possible to add the equivalent of metadata.<lang>Type but for field-naming? I.e., I'd like the schema to be able to generate the field like this:

    "effective": {
      "metadata": {
        "description": "The date that this transaction takes effect",
        "goField": "EffectiveDate"
      },
      "type": "Date"
    },

Presumably the TypeScript generator wouldn't offer this option for the reasons explained here, but I think it makes sense to offer it for all other supported languages.

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