Skip to content

Add generate.additional-tags config option#78

Merged
cubahno merged 1 commit into
mainfrom
ig/duplicate-json-tags
Apr 28, 2026
Merged

Add generate.additional-tags config option#78
cubahno merged 1 commit into
mainfrom
ig/duplicate-json-tags

Conversation

@cubahno
Copy link
Copy Markdown
Collaborator

@cubahno cubahno commented Apr 28, 2026

Summary

Closes #77

Adds a new generate.additional-tags config option that emits additional struct tags on generated fields, mirroring the json tag value.

This solves the problem where YAML libraries like go.yaml.in/yaml/v4 silently fail to unmarshal multi-word properties (e.g. closed_at) because they lowercase the Go field name without preserving underscores (closedat instead of closed_at).

Usage

generate:
  additional-tags:
    - yaml

Generates:

type Issue struct {
    ClosedAt  time.Time `json:"closed_at" yaml:"closed_at"`
    LabelName *string   `json:"label_name,omitempty" yaml:"label_name,omitempty"`
}

@cubahno cubahno changed the title Add generate.additional-tags config option for global struct tag mirr… Add generate.additional-tags config option Apr 28, 2026
@cubahno cubahno marked this pull request as ready for review April 28, 2026 17:04
@cubahno cubahno merged commit 743cf20 into main Apr 28, 2026
3 checks passed
@cubahno cubahno deleted the ig/duplicate-json-tags branch April 28, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Feature: emit yaml struct tags mirroring json tags for YAML-decodable models

1 participant