Skip to content

add model-json-tag to cmd arguments #499

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

mispp
Copy link

@mispp mispp commented May 25, 2025

add options to generate json tags, as mentioned in #486

cmd/jet/main.go Outdated
@@ -94,6 +100,10 @@ func main() {
printErrorAndExit("ERROR: required flag(s) missing")
}

if modelJsonTag != "" && !slices.Contains([]string{"none", "snake-case", "pascal-case", "camel-case"}, modelJsonTag) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"" can be moved to Contains([]string{?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@go-jet
Copy link
Owner

go-jet commented May 27, 2025

Thanks, looks good.

To wrap it up, it would be good to have at least one test here - https://github.com/go-jet/jet/blob/master/tests/postgres/generator_test.go.
No need to assert every model file content, just one should be enough.


var jsonTag string
switch modelJsonTag {
case "":
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are probably failing because of this line, since it adds a empty tag in default case. Check: https://app.circleci.com/pipelines/github/go-jet/jet/1131/workflows/590c63e5-ce37-4f5b-9c67-58dd5c09e178/jobs/1314

@go-jet
Copy link
Owner

go-jet commented Jun 3, 2025

Thanks, looks good.

To wrap it up, it would be good to have at least one test here - https://github.com/go-jet/jet/blob/master/tests/postgres/generator_test.go. No need to assert every model file content, just one should be enough.

Test also.

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