Closed Asaboha closed 3 weeks ago
Thanks for opening this pull request! If you have implemented new functions, write about them in the readme file.
[!WARNING]
Rate limit exceeded
@Asaboha has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 24 minutes and 52 seconds before requesting another review.
How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR. We recommend that you space out your commits to avoid hitting the rate limit.How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our [FAQ](https://coderabbit.ai/docs/faq) for further information.Commits
Files that changed from the base of the PR and between 344f83a314cffdf20f4f75c9e45d74f4934414cf and 92310619b7aa4b4b384115d92c84dbec033505fe.
The recent changes enhance the SwaggerJsonTransformer
class by refining the RemoveRedundantRoutes
method to include additional parameters for better route processing. New test resources and scenarios have been added to validate these modifications, particularly focusing on catch-all routes in Ocelot configurations. Overall, these updates improve the handling of API documentation generation, ensuring more accurate and robust route management.
Files | Change Summary |
---|---|
src/MMLib.SwaggerForOcelot/Transformation/SwaggerJsonTransformer.cs |
Modified RemoveRedundantRoutes method signature to add downstreamPath and basePath , enhancing route evaluation. |
tests/MMLib.SwaggerForOcelot.Tests/MMLib.SwaggerForOcelot.Tests.csproj |
Added two new embedded JSON resources for testing Ocelot routing scenarios. |
tests/MMLib.SwaggerForOcelot.Tests/Resources/DifferentOcelotRoutesForOneDownstreamTransformedWithCatchAll.json , tests/MMLib.SwaggerForOcelot.Tests/Resources/DifferentOcelotRoutesForOneDownstreamWithCatchAll.json |
Defined new OpenAPI specifications for endpoints, enhancing API documentation clarity. |
tests/MMLib.SwaggerForOcelot.Tests/SwaggerForOcelotMiddlewareShould.cs |
Introduced a new test method to validate transformation of routes with catch-all parameters, improving test coverage. |
sequenceDiagram
participant Client
participant Middleware
participant SwaggerJsonTransformer
Client->>Middleware: Request API Documentation
Middleware->>SwaggerJsonTransformer: Invoke Transform method
SwaggerJsonTransformer->>SwaggerJsonTransformer: RemoveRedundantRoutes(routes, downstreamPath, basePath)
SwaggerJsonTransformer-->>Middleware: Return transformed Swagger output
Middleware-->>Client: Respond with API Documentation
š In fields of code, where changes bloom,
A rabbit hops, dispelling gloom.
With paths transformed and tests in line,
API docs now brightly shine!
Let's leap and cheer, for clarity's grace,
Together we thrive, in this coding space! š¼
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?
Hi @Asaboha,
why did you close this PR?
Not sure if this is a valid use case, I should I have raised an issue first that json exceptin is thrown if there are multiple catchAll routes
if there are multiple catchAll routes with different paths (might be redundant)
for example downstream has single route
but in ocelot has 2 matching upstream paths
currently our application gets an error message thrown " Can not add property get to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object."
in SwaggerJsonTransformer.cs function "SwaggerJsonTransformer.cs" replaced
route.UpstreamPath
with "ConvertDownstreamPathToUpstreamPath" that's acatually used to generater Swagger doc Json properties namesSummary by CodeRabbit
New Features
Bug Fixes
Tests