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

Allow method name customization when generating multiple interfaces by endpoint #181

Merged
merged 5 commits into from
Oct 9, 2023

Conversation

christianhelle
Copy link
Owner

The changes here piggy back on --operation-name-template CLI argument to customize the Execute() method name in the interfaces generated when --multiple-interfaces ByEndpoint is set

This implements feature request #176 by @Noblix

…y value when --multiple-interfaces ByEndpoint is specified
Added the ability to dynamically assign method names in the interface generator of Refitter.Core following the settings.OperationNameTemplate. This enhancement boosts the flexibility of the code generator, letting the user set custom method names when the OperationNameTemplate setting is specified. Otherwise, it defaults to "Execute".
An additional test was added to the smoke-tests.ps1 script. This test involves generating and building MultipleInterfaces using the "--operation-name-template ExecuteAsync" argument. This change was made to provide validation for changes in operations with custom name formatting.
Detailed descriptions were added to the 'GenerateDeprecatedOperations' and 'OperationNameTemplate' properties in RefitGeneratorSettings.cs. Providing clear, concise comments will help other devs to understand the purpose of these properties, especially when setting 'generateDeprecatedOperations' and defining the operation name pattern.
Enhance the description for the `--operation-name-template` option in `Settings.cs`. The added explanation clarifies that when using the `--multiple-interfaces ByEndpoint` option, the operation name template will be used as the name for the `Execute()` method in the generated interface. Consequently, the same understanding is reflected in the README documentation for both the root level and Refitter library usage. This change was essential to provide users with a clearer understanding of how the `--operation-name-template` works with the `--multiple-interfaces ByEndpoint`.
@christianhelle christianhelle added the enhancement New feature, bug fix, or request label Oct 6, 2023
@christianhelle christianhelle self-assigned this Oct 6, 2023
@sonarcloud
Copy link

sonarcloud bot commented Oct 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

Merging #181 (6395eb0) into main (c0607de) will increase coverage by 0.00%.
Report is 4 commits behind head on main.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #181   +/-   ##
=======================================
  Coverage   98.70%   98.71%           
=======================================
  Files          47       47           
  Lines        1626     1633    +7     
=======================================
+ Hits         1605     1612    +7     
  Misses          6        6           
  Partials       15       15           
Flag Coverage Δ
unittests 98.71% <100.00%> (+<0.01%) ⬆️

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

Files Coverage Δ
src/Refitter.Core/RefitGeneratorSettings.cs 100.00% <ø> (ø)
...c/Refitter.Core/RefitMultipleInterfaceGenerator.cs 100.00% <100.00%> (ø)
src/Refitter.Tests/SwaggerPetstoreTests.cs 99.46% <100.00%> (+0.01%) ⬆️

@christianhelle christianhelle marked this pull request as ready for review October 7, 2023 14:32
@christianhelle christianhelle merged commit ad3c83c into main Oct 9, 2023
852 checks passed
@christianhelle christianhelle deleted the multiple-interface-operation-name-template branch October 9, 2023 06:53
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.

Allow for naming of methods when generating interfaces by endpoint
1 participant