Fix: Correctly resolve relative server URLs in OpenAPI specs#134
Open
calvernaz wants to merge 4 commits intojentic:mainfrom
Open
Fix: Correctly resolve relative server URLs in OpenAPI specs#134calvernaz wants to merge 4 commits intojentic:mainfrom
calvernaz wants to merge 4 commits intojentic:mainfrom
Conversation
- Fixes short-circuit logic in ServerProcessor that prevented relative URLs from being resolved against the base server config. - Ensures absolute URLs are generated even when no server variables are present in the relative path. - Adds regression tests for relative server URL resolution.
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the ServerProcessor that incorrectly handled relative server URLs from OpenAPI specifications. The issue was that the early-return logic would incorrectly return relative paths (like /pet/{petId}) without resolving them against the base server URL when they didn't contain server variables in the host portion. The fix adds proper validation to distinguish between absolute URLs and relative paths before deciding whether to return early or continue with server URL resolution.
Key Changes:
- Enhanced the early-return condition to verify both scheme and netloc are present before treating a URL as absolute
- Added comprehensive regression tests for relative URL resolution with base paths
- Minor whitespace cleanup
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
runner/arazzo_runner/executor/server_processor.py |
Fixed short-circuit logic in resolve_server_params() to properly validate absolute URLs before early return, ensuring relative paths are correctly resolved against base server configurations |
runner/tests/executor/test_server_processor.py |
Added two regression tests (test_resolve_server_params_with_base_path and test_resolve_server_params_with_base_path_and_leading_slash_in_base_url) to verify correct handling of relative URLs with base paths |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where the ServerProcessor failed to correctly resolve relative server URLs (e.g. /api/v3) from OpenAPI specifications.
Previously, resolve_server_params would short-circuit and return the relative URL template as-is if no variables were present, leading to invalid request URLs (missing scheme/host) when the OpenAPI server definition was relative.