Repository navigation
Conversation
|
@wing328 Please merge this. Copilot follows. I don't think any of it is blocking: Review of #25548AssessmentThis is a correct improvement, and I would approve it. The change follows the established .NET URI component model and the expected OpenAPI behavior for absolute operation server URLs:
All 72 CI checks pass, the mergeable state is clean, and there are no unresolved review threads. Consistency with .NET and OpenAPIAssigning uriBuilder.Host = url.Authority;The standard .NET representation keeps those components separate: uriBuilder.Host = url.Host;
uriBuilder.Port = url.Port;
uriBuilder.Scheme = url.Scheme;This is consistent with the Microsoft The path behavior is also correct for an OpenAPI operation server: Explicit path joining is necessary here. Resolving Relevant historyThe previous changes in this area are not repeatedly undoing one another. They have consistently moved toward preserving every configured URI component:
The design question was discussed directly in #19451. When a user asked why The same discussion also produced the root-path and trailing-slash follow-ups that became #21081 and #23355. Therefore, #25548 does not reverse an earlier decision. It completes the same behavior in the operation-server branch, which had been left with the older Why changes have been iterativeThe recurring fixes are caused by two separate URI-building branches: {{^servers}}
// Build from HttpClient.BaseAddress
{{/servers}}
{{#servers}}
// Build from the operation server
{{/servers}}Both branches independently reconstruct the URI. Fixes made to the The test matrix was also incomplete:
This is not a cycle of doing and undoing work, but it is a reactive pattern caused by duplicated URI composition and narrow regression tests. Non-blocking recommendationsThe new operation-server test currently covers an explicit port and a The first four forms verify the root and trailing-slash behavior already established by #21081 and #23355. A later refactor should centralize URI and path composition so both branches use the same implementation. Remaining OpenAPI gapOpenAPI permits relative server URLs such as: servers:
- url: /baseThe generated code still accesses This is a pre-existing limitation and is not introduced or worsened by #25548. It should be handled separately if complete OpenAPI Server Object support is required. RecommendationApprove and merge #25548. The implementation is consistent with prior decisions, follows the .NET |
Description
Fixes #25546
For C#
generichostoperations with their own server, append the operation path to the server base path and preserve an explicit port. Path parameter substitution remains in place.Tests
https://example.com:8443/base/files/hello%20worldthrough a local handler; before the fix it threwUriFormatException.Summary by cubic
Fixes C#
generichostoperations with per-operation servers so the operation path is appended to the server base path and explicit ports are preserved, which previously causedUriFormatExceptionat runtime.HostandPortseparately instead ofAuthority, which lost explicit ports and produced invalid URIs.Written for commit 4d5408b. Summary will update on new commits.