-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Handle paths that contain colons #227
Conversation
Added a new method ConvertColonsToPascalCase in the StringCasingExtensions class. This method will allow us to convert string with colons to PascalCase. The change will provide a consistent way to represent colon-separated values in PascalCase, matching our coding style convention. Also, a new unit test method was added for it in the StringCasingExtensionTests class to ensure the functionality works as expected.
The function 'CapitalizeFirstCharacter' in the 'StringCasingExtensions' was throwing an error if a null or an empty string was passed as an argument. Added a null or empty string check to prevent the error. Also, corresponding unit tests were added to confirm that it correctly handles null or empty strings.
OperationNameGenerator is updated to include the conversion of colons to PascalCase. This change addresses the problem of having inconsistent naming convention when colon exists in string. Now it ensures a unified naming convention throughout the code which result in better readability and maintenance.
OpenAPI documents are now generated with a separate method, named `GetOpenApiDocument`. This change was introduced to address a problem with special characters appearing in our API paths. A new method, `SanitizePath` has been added to remove these special characters from paths prior to the object creation.
This commit introduces a new file, ColonsInPathTests.cs in the Refitter.Tests project. The file includes tests to ensure correct code generation, absence of colons in the generated path, and successful build of the generated code. This is done to improve our coverage of edge cases where colons might appear in API paths.
Kudos, SonarCloud Quality Gate passed!
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #227 +/- ##
==========================================
- Coverage 98.30% 98.19% -0.12%
==========================================
Files 55 56 +1
Lines 2006 1939 -67
==========================================
- Hits 1972 1904 -68
- Misses 17 18 +1
Partials 17 17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This resolves #225 reported by @safakkesikci regarding OpenAPI specifications where paths include colons resulting in the generated code not being able to build
OpenApi spec:
customer.json
Refitter configuration file
Output