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

feat: Add use-numeric-enum-json option. #625

Merged
merged 1 commit into from
Jul 28, 2022
Merged

Conversation

kev0960
Copy link
Contributor

@kev0960 kev0960 commented Jul 26, 2022

If this option is enabled, the JSON encoder (toJSON) will encode enum values as integer, rather than the string.

I need this option because I am using proto for the API between rust server and the react based client, and proto on the Rust side expects JSON to have integer values for the enum, rather than the string. It is also faster to compare integer so I think this is an option worthy added.

If this option is enabled, the JSON encoder (toJSON) will encode enum
values as integer, rather than the string.
@kev0960
Copy link
Contributor Author

kev0960 commented Jul 26, 2022

Related issue: #96

@kev0960
Copy link
Contributor Author

kev0960 commented Jul 27, 2022

@stephenh Could you take a look when you have a chance?

@stephenh
Copy link
Owner

Looks good, thanks @kev0960 !

@stephenh stephenh merged commit cd53d8c into stephenh:main Jul 28, 2022
stephenh pushed a commit that referenced this pull request Jul 28, 2022
# [1.121.0](v1.120.0...v1.121.0) (2022-07-28)

### Features

* Add use-numeric-enum-json option. ([#625](#625)) ([cd53d8c](cd53d8c))
@stephenh
Copy link
Owner

🎉 This PR is included in version 1.121.0 🎉

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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants