Skip to content

[Feature request] Means for having different casing in tag name #118

@shackra

Description

@shackra

I encountered this edge case, say you have this struct transform with camelcase:

type Blog struct {
	ID     string `json:"id"`
	WebURL string `json:"webURL"`
}

Now, the API offers you its data like this:

GET example.com/api/blog

HTTP/1.1 200 OK
Content-type: application/json

{
  "value": [
    {
      "id": "blog-a",
      "webUrl": "https://example.com"
    },
    {
      "id": "blog-b",
      "webUrl": "https://example.com"
    }
  ]
}

So, the API returns the web's URL in a field called webUrl, but gomodifytags transforms the part of the field "URL" as URL and not as Url. That's okay.

Currently, this can be solved by, either:

  • manually modifying the tag name, with the downside that refreshing the tags will overwrite such manual change.
  • changing the name of the field in the struct, with the downside that I prefer WebURL, not WebUrl in my struct field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions