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

Added GenerateClients options for seperate generation #436

Merged
merged 3 commits into from
Aug 4, 2024

Conversation

berkslv
Copy link

@berkslv berkslv commented Aug 2, 2024

I added generateClients options to generate seperate client and contracts. Also add 1 test for this feature

@christianhelle christianhelle self-assigned this Aug 3, 2024
@christianhelle christianhelle added the enhancement New feature, bug fix, or request label Aug 3, 2024
Copy link

codecov bot commented Aug 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.45%. Comparing base (cf6cd27) to head (1c4b167).
Report is 23 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #436      +/-   ##
==========================================
+ Coverage   95.41%   95.45%   +0.03%     
==========================================
  Files          70       70              
  Lines        3406     3412       +6     
==========================================
+ Hits         3250     3257       +7     
  Misses        114      114              
+ Partials       42       41       -1     
Flag Coverage Δ
unittests 95.45% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@christianhelle christianhelle left a comment

Choose a reason for hiding this comment

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

Great stuff @berkslv

Thanks for being thorough by updating the docs and tests

I pulled your branch and tried it out locally to review. There is, unfortunately, one thing you missed, and as it is right now, the generated code will not build because the System.Text.Json.Serialization has not been imported

To fix this, you need to update RefitGenerator and replace lines 128-132

var contracts = RefitInterfaceImports
    .GetImportedNamespaces(settings)
    .Aggregate(
        generator.GenerateFile(),
        (current, import) => current.Replace($"{import}.", string.Empty));

with

var contracts = generator.GenerateFile();
if (settings.GenerateClients)
{
    contracts = RefitInterfaceImports
        .GetImportedNamespaces(settings)
        .Aggregate(
            contracts,
            (current, import) => current.Replace($"{import}.", string.Empty));
}

@christianhelle
Copy link
Owner

@all-contributors please add @berkslv for ideas and code

Copy link
Contributor

@christianhelle

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

Copy link

sonarcloud bot commented Aug 4, 2024

@berkslv
Copy link
Author

berkslv commented Aug 4, 2024

I have completed the changes you requested @christianhelle

Thank you for adding me as a contributor, I follow this repo closely in the future and try to add value to it.

Copy link
Owner

@christianhelle christianhelle left a comment

Choose a reason for hiding this comment

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

Works fine and looks good

@christianhelle christianhelle merged commit bdc8773 into christianhelle:main Aug 4, 2024
422 checks passed
@christianhelle
Copy link
Owner

Thank you for your contribution @berkslv

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 this pull request may close these issues.

3 participants