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 priority mapping (resolves #63) #64

Closed
wants to merge 1 commit into from

Conversation

zotanmew
Copy link

No description provided.

{
internal sealed class PriorityConverter : JsonConverter<Priority?>
{
public override Priority? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Copy link
Owner

Choose a reason for hiding this comment

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

Why do we need this?
Can we just update the enum values?

Copy link
Author

Choose a reason for hiding this comment

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

The API returns 1-4 but means 4-1, we need to reverse the order

Copy link
Author

Choose a reason for hiding this comment

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

There's no way to give an enum a constructor that would do this, so a JsonConverter is the only way

@olsh
Copy link
Owner

olsh commented Jan 29, 2025

Thank you! 👍🏻

@olsh
Copy link
Owner

olsh commented Feb 3, 2025

Fixed in #65

@olsh olsh closed this Feb 3, 2025
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