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

Add SourceGenerator support to the standalone tool #179

Open
attilah opened this issue Oct 5, 2023 · 3 comments
Open

Add SourceGenerator support to the standalone tool #179

attilah opened this issue Oct 5, 2023 · 3 comments
Assignees
Labels
enhancement New feature, bug fix, or request

Comments

@attilah
Copy link

attilah commented Oct 5, 2023

Is your feature request related to a problem? Please describe.
To enable the generated client to have the serializers source generated, the tool could generate an <ApiTypeName>JsonSerializerContext class which inherits from JsonSerializerContext and add all the type names with JsonSerializable to the class, so the serializer source generator could kick in and do its job.

This feature can only be added to the standalone tool because source generators cannot interact with each other currently.

Describe the solution you'd like
An <ApiTypeName>JsonSerializerContext class would be generated as well.

Describe alternatives you've considered
Manually write this class by hand which is tedious.

Additional context
More info on it: https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-source-generator/

@attilah attilah added the enhancement New feature, bug fix, or request label Oct 5, 2023
@christianhelle
Copy link
Owner

@attilah thanks for taking the time to suggest this

I'm unsure how the Refit generated code works with System.Text.Json source generators but I can investigate it. I'll see what I can do.

@christianhelle
Copy link
Owner

@all-contributors please add @attilah for ideas

@allcontributors
Copy link
Contributor

@christianhelle

I've put up a pull request to add @attilah! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, bug fix, or request
Projects
None yet
Development

No branches or pull requests

2 participants