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

Generate Refit interfaces as partial by default #161

Closed
kirides opened this issue Sep 20, 2023 · 2 comments · Fixed by #162
Closed

Generate Refit interfaces as partial by default #161

kirides opened this issue Sep 20, 2023 · 2 comments · Fixed by #162
Assignees
Labels
enhancement New feature, bug fix, or request

Comments

@kirides
Copy link
Contributor

kirides commented Sep 20, 2023

I propose ~~ a --partial Flag for the CLI.~~ refit interfaces to be generated as partial interfaces by default, which would comply with most other code-generator tools out there and the way the models are generated currently.

Reasoning being, for certain classes we need to add attributes, interfaces or utility methods which is currently not possible without modifying the generated code.

By having partial classes for Models and Refit-Interfaces, we can make use of a generated.additions.cs (example name) which contains the needed modifications.

// a.cs
internal partial interface ISomething
{

}

// a.additions.cs
[FancyAttribute("With Value")]
[Headers("X-App: MyApp")]
partial interface ISomething {}
@kirides kirides added the enhancement New feature, bug fix, or request label Sep 20, 2023
@christianhelle
Copy link
Owner

@kirides The models are already partial.

How about we make the interfaces partial by default as well? I can't really see any reason for not making it partial to begin with

@kirides
Copy link
Contributor Author

kirides commented Sep 20, 2023

Sounds great @christianhelle

totally forgot that Models are partial by default, even though we already use them this way.

I updated the title and description to reflect the spec change :)

@kirides kirides changed the title --partial Flag - generate classes (and contracts?) as partial classes Generate Refit interfaces as partial by default Sep 20, 2023
@christianhelle christianhelle linked a pull request Sep 20, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants