Skip to content

Fix: Correctly resolve relative server URLs in OpenAPI specs#134

Open
calvernaz wants to merge 4 commits intojentic:mainfrom
calvernaz:fix/relative-server-url-resolution
Open

Fix: Correctly resolve relative server URLs in OpenAPI specs#134
calvernaz wants to merge 4 commits intojentic:mainfrom
calvernaz:fix/relative-server-url-resolution

Conversation

@calvernaz
Copy link
Copy Markdown

@calvernaz calvernaz commented Dec 12, 2025

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.

  • 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.

- 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.
Copilot AI review requested due to automatic review settings December 12, 2025 10:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

calvernaz and others added 3 commits December 12, 2025 10:05
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants