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(csharp): remove global enum converter #3765

Merged
merged 2 commits into from
Sep 18, 2024
Merged

fix(csharp): remove global enum converter #3765

merged 2 commits into from
Sep 18, 2024

Conversation

morganleroi
Copy link
Contributor

@morganleroi morganleroi commented Sep 17, 2024

🧭 What and Why

This PR removes the global Enum to string converter from the Serializer configuration and move this to every Algolia POCO enum. It means that only Algolia POCO enum will be converted as string. Every other enum will be converter as int (default behaviour from System.Text.Json or NewtonSoft).

With this PR, the generated client behaves the same way the legacy one.

Please note that we do not use JsonStringEnumConverter from System.Text.Json because our enum values are flagged with custom name.

Changes included:

  • List changes
  • Remove global enum converter from the Serializer.

@algolia-bot
Copy link
Collaborator

algolia-bot commented Sep 17, 2024

✔️ Code generated!

Name Link
🪓 Triggered by cd5397766971852373b7d585ccf81144600acdf3
🍃 Generated commit 32813bb4a4916a2ab96f6c8cb0b53430f1487a86
🌲 Generated branch generated/fix/csharp-enum
📊 Benchmark results

Benchmarks performed on the method using a mock server, the results might not reflect the real-world performance.

Language Req/s
csharp 1150

@morganleroi morganleroi marked this pull request as draft September 17, 2024 14:39
@morganleroi morganleroi self-assigned this Sep 17, 2024
@morganleroi morganleroi changed the title remove global enum converter fix(csharp): remove global enum converter Sep 17, 2024
@millotp
Copy link
Collaborator

millotp commented Sep 17, 2024

what is the usage of those enum ? currently in the snippets its like Enum.Parse<Action>("AddObject"),, could it be prettier ?

@morganleroi
Copy link
Contributor Author

Yes, for the snippet it could be Action.AddObject. I'm not sure why we did that ... But it's not related to my PR anyway.

@morganleroi morganleroi marked this pull request as ready for review September 18, 2024 06:33
@morganleroi morganleroi merged commit e74af8d into main Sep 18, 2024
13 checks passed
@morganleroi morganleroi deleted the fix/csharp-enum branch September 18, 2024 06:34
algolia-bot added a commit that referenced this pull request Sep 18, 2024
Co-authored-by: Morgan Leroi <morgan.leroi@gmail.com>
algolia-bot added a commit to algolia/algoliasearch-client-csharp that referenced this pull request Sep 18, 2024
algolia/api-clients-automation#3765

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Morgan Leroi <morgan.leroi@gmail.com>
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.

3 participants