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: add go omitempty json tag #2004

Merged
merged 4 commits into from
May 21, 2024
Merged

fix: add go omitempty json tag #2004

merged 4 commits into from
May 21, 2024

Conversation

Souvikns
Copy link
Member

@Souvikns Souvikns commented May 20, 2024

Description

This PR is adding a new option for GO_COMMON_PRESET for generating omitempty parameter.

Related Issue

Checklist

  • The code follows the project's coding standards and is properly linted (npm run lint).
  • Tests have been added or updated to cover the changes.
  • Documentation has been updated to reflect the changes.
  • All tests pass successfully locally.(npm run test).

Additional Notes

Copy link

netlify bot commented May 20, 2024

Deploy Preview for modelina canceled.

Name Link
🔨 Latest commit 7d863fe
🔍 Latest deploy log https://app.netlify.com/sites/modelina/deploys/664c55ac66d8d30008cc3515

Copy link
Member

@jonaslagoni jonaslagoni left a comment

Choose a reason for hiding this comment

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

I dont think this should be having it's own option, it's required for the json tags to correctly work IMO 🤔

Why would you like to have it as an option @Souvikns?

@Souvikns
Copy link
Member Author

It needs addJsonTag to work, I added an option thinking that if anyone does not need it, if anyone wants to have empty data while Marshaling, they can do it. Just didn't wanted to force the omitempty tag on the user.

@jonaslagoni
Copy link
Member

The problem as I see it with adding it as an option is that it currently (by default) creates incorrect JSON Data as soon as you have an optional property or null type. To me this is a bug rather then a missing feature 🤔

@Souvikns Souvikns requested a review from jonaslagoni May 21, 2024 07:55
@jonaslagoni jonaslagoni changed the title feat: add go omitempty json tag fix: add go omitempty json tag May 21, 2024
Copy link
Member

@jonaslagoni jonaslagoni left a comment

Choose a reason for hiding this comment

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

Got some snapshots that are not happy ✌️

Copy link

sonarcloud bot commented May 21, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@Souvikns Souvikns requested a review from jonaslagoni May 21, 2024 08:26
Copy link
Member

@jonaslagoni jonaslagoni left a comment

Choose a reason for hiding this comment

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

👍

@jonaslagoni jonaslagoni merged commit 4a296b7 into asyncapi:next May 21, 2024
14 checks passed
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 4.0.0-next.40 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants