-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Support resolving OpenAPI server URLs from HttpRequest #60617
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
Conversation
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.
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/OpenApi/src/Services/OpenApiDocumentService.cs:223
- Returning an empty collection using square brackets is invalid in C#. Replace with a valid initializer, for example: return new List();
return [];
...NetCore.OpenApi.Tests/Services/OpenApiDocumentService/OpenApiDocumentServiceTests.Servers.cs
Show resolved
Hide resolved
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.
Looks good! 👍
* Support resolving OpenAPI server URLs from HttpRequest * Try passing optional params everywhere
Closes #57332.
I was previously squeamish about introducing a dependency on
HttpRequest
inOpenApiDocumentService.GetOpenApiDocumentAsync
because it ends up being called from the build-time generation codepath but considering some ideas I have in that space I think it's fine for us to introduce a dependency on the HttpRequest for this codepath.I've retained the codepath that uses the ServerAddressFeature for back-compat in the case that an HttpContext is not available.
Note: this is a backport candidate.