-
Notifications
You must be signed in to change notification settings - Fork 3
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
chore: Exclude Microsoft.AspNetCore namespace from swagger #1414
chore: Exclude Microsoft.AspNetCore namespace from swagger #1414
Conversation
📝 WalkthroughWalkthroughThe pull request introduces significant changes to the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
src/Digdir.Domain.Dialogporten.WebApi/Common/Swagger/TypeNameConverter.cs (1)
18-21
: Consider adding a comment explaining the namespace exclusion rationale.While the implementation is correct, it would be helpful to document why certain namespaces are excluded, particularly for maintenance purposes.
Add a comment above the array:
private static readonly string[] ExcludedNamespacePostfixes = []; + // Exclude common framework and internal namespaces to produce cleaner type names in Swagger documentation private static readonly string[] ExcludedNamespacePrefixes = [ "FastEndpoints",
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
docs/schema/V1/swagger.verified.json
(4 hunks)src/Digdir.Domain.Dialogporten.WebApi/Common/Swagger/TypeNameConverter.cs
(1 hunks)
🔇 Additional comments (4)
src/Digdir.Domain.Dialogporten.WebApi/Common/Swagger/TypeNameConverter.cs (1)
19-20
: LGTM! Changes align with PR objectives.
The addition of "Microsoft.AspNetCore." to the excluded namespaces will simplify type names in the Swagger documentation by removing this common prefix.
Let's verify the impact on the swagger documentation:
✅ Verification successful
Changes are safe and working as intended
The addition of "Microsoft.AspNetCore." to ExcludedNamespacePrefixes is correctly implemented and will effectively exclude Microsoft.AspNetCore namespaces from type names in Swagger documentation. The code shows:
- The TypeNameConverter is properly used in Program.cs for Swagger type name conversion
- The implementation correctly handles namespace exclusions through the ExcludePrefix method
- The change aligns with existing exclusion patterns like "FastEndpoints" and "Digdir.Domain.Dialogporten.*"
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining Microsoft.AspNetCore references in swagger files
# that might have been missed by this change
# Look for any Microsoft.AspNetCore references in swagger files
rg -t json "Microsoft\.AspNetCore" --glob "swagger*.json"
Length of output: 59
Script:
#!/bin/bash
# Let's first check if there are any swagger files in the repository
fd "swagger.*\.json$"
# Let's also check the implementation of TypeNameConverter to understand its usage
rg -l "TypeNameConverter"
# And examine how the TypeNameConverter is being used
ast-grep --pattern 'class TypeNameConverter {
$$$
}'
Length of output: 347
Script:
#!/bin/bash
# Let's examine the verified swagger file to check if type names are properly shortened
cat docs/schema/V1/swagger.verified.json
# Let's also check how TypeNameConverter is used in Program.cs
rg -A 5 "TypeNameConverter" src/Digdir.Domain.Dialogporten.WebApi/Program.cs
# And check its implementation
cat src/Digdir.Domain.Dialogporten.WebApi/Common/Swagger/TypeNameConverter.cs
Length of output: 269512
docs/schema/V1/swagger.verified.json (3)
Line range hint 149-192
: LGTM: Clean namespace rename from MicrosoftAspNetCore to JsonPatch
The schema renaming from MicrosoftAspNetCoreJsonPatchOperations_Operation
to JsonPatchOperations_Operation
and MicrosoftAspNetCoreJsonPatchOperations_OperationType
to JsonPatchOperations_OperationType
has been implemented correctly. The schema structure remains unchanged and all references have been properly updated.
6051-6051
: LGTM: Endpoint schema reference updated correctly
The PATCH endpoint's schema reference has been properly updated to use the renamed JsonPatchOperations_Operation
schema, maintaining consistency with the namespace changes.
Line range hint 1-6500
: Verify complete removal of Microsoft.AspNetCore namespace
Let's verify that all references to the Microsoft.AspNetCore namespace have been removed from the specification.
✅ Verification successful
Based on the search results, there are still multiple references to Microsoft.AspNetCore namespace in the codebase, but the file we're reviewing (docs/schema/V1/swagger.verified.json) does not contain any such references. The search results show references in other files like Program.cs, Controllers, and test projects, but none in the swagger specification file.
No Microsoft.AspNetCore references found in the swagger specification
The swagger specification has been properly cleaned up and does not contain any references to Microsoft.AspNetCore namespace. All references found are in the actual implementation files which is expected since the project uses ASP.NET Core framework.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Search for any remaining references to Microsoft.AspNetCore
# Test: Expect no matches as all references should have been renamed
echo "Searching for Microsoft.AspNetCore references..."
rg -i "microsoft\.aspnetcore"
echo "Searching for MicrosoftAspNetCore references..."
rg -i "microsoftaspnetcore"
Length of output: 5512
Description
Related Issue(s)
Verification
Documentation
docs
-directory, Altinnpedia or a separate linked PR in altinn-studio-docs., if applicable)Summary by CodeRabbit