Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix json:",omitempty" #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vincentkerdraon
Copy link

The json struct tag can be used without a first argument. In this case, the field name must be used.
See https://pkg.go.dev/encoding/json

Example code:

type Person struct {
Phone string json:",omitempty"
}

The json struct tag can be used without a first argument. In this case,
the field name must be used.
See https://pkg.go.dev/encoding/json

Example code:

type Person struct {
	Phone        string       `json:",omitempty"`
}
@tkrajina
Copy link
Owner

tkrajina commented Jul 8, 2023

Makes sense, thanks for the PR. Can you also add a test?

vincentgna added a commit to GoodNotes/typescriptify-golang-structs that referenced this pull request Feb 4, 2024
- Add ability to convert to JSII compatible camelCased fields
- Support valid `json:",omitempty"` tag (with test cases)
- Add `-local-pkg` flag for running tscriptify from local directory

References:
- tkrajina#73
- tkrajina#70
- https://github.com/rogpeppe/gohack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants