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

Enforce enum serialization policy #729

Open
HauklandJ opened this issue Aug 19, 2024 · 2 comments · May be fixed by #773
Open

Enforce enum serialization policy #729

HauklandJ opened this issue Aug 19, 2024 · 2 comments · May be fixed by #773
Assignees

Comments

@HauklandJ
Copy link
Contributor

HauklandJ commented Aug 19, 2024

As discovered in 2309. If an application chooses to specify JsonStringEnumConverter for JsonSerializerOptions then enums which are implemented with the default serialization behaviour will result in unexpected behaviour.

We should consider enforcing serialization rules for these enums.

@ivarne
Copy link
Member

ivarne commented Aug 19, 2024

  • Go through all enums that we use for serialisation and ensure that they are annotated with JsonNumberEnumConverter so that global settings in apps don't apply
  • Write a test that searches all types in assemblies that have System.Text.Json.Serialization annotations specifies how to serialise enums with either string or number
  • Verify that swagger docs for enums actually reflects the serialisation strategy we use.

@ivarne ivarne added the good-first-issue Issues that are easy to fix for new team members or external contributors label Aug 20, 2024
@HauklandJ
Copy link
Contributor Author

Image

@HauklandJ HauklandJ self-assigned this Sep 12, 2024
@HauklandJ HauklandJ added kind/chore and removed good-first-issue Issues that are easy to fix for new team members or external contributors status/triage labels Sep 12, 2024
@HauklandJ HauklandJ linked a pull request Sep 12, 2024 that will close this issue
5 tasks
@HauklandJ HauklandJ linked a pull request Sep 12, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🔎 Review
Development

Successfully merging a pull request may close this issue.

2 participants