Skip to content

Python: [Breaking] Update OpenAPI document parsing options#14009

Merged
SergeyMenshykh merged 4 commits into
microsoft:mainfrom
SergeyMenshykh:semenshi/openapi-parsing-update
May 18, 2026
Merged

Python: [Breaking] Update OpenAPI document parsing options#14009
SergeyMenshykh merged 4 commits into
microsoft:mainfrom
SergeyMenshykh:semenshi/openapi-parsing-update

Conversation

@SergeyMenshykh
Copy link
Copy Markdown
Member

@SergeyMenshykh SergeyMenshykh commented May 14, 2026

Update OpenAPI document parsing to gate file and HTTP ref resolution separately.

Breaking change

  • RESOLVE_FILES is no longer enabled by default. Only internal JSON pointer references are resolved by default.
  • Users with multi-file OpenAPI specs must now pass enable_file_ref_resolution=True via OpenAPIFunctionExecutionParameters.
  • enable_external_ref_resolution has been renamed to enable_http_ref_resolution.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 14, 2026 14:19
@SergeyMenshykh SergeyMenshykh requested a review from a team as a code owner May 14, 2026 14:19
@moonbox3 moonbox3 added the python Pull requests for the Python Semantic Kernel label May 14, 2026
@SergeyMenshykh SergeyMenshykh self-assigned this May 14, 2026
@SergeyMenshykh SergeyMenshykh moved this to In Review in Agent Framework May 14, 2026
@moonbox3
Copy link
Copy Markdown
Collaborator

moonbox3 commented May 14, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
connectors/openapi_plugin
   openapi_function_execution_parameters.py290100% 
   openapi_manager.py79889%53, 74, 96–99, 144–145
   openapi_parser.py133893%82, 139, 203, 260, 274–275, 278–279
TOTAL28655563880% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3932 23 💤 0 ❌ 0 🔥 1m 58s ⏱️

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 4 | Confidence: 88% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Design Approach


Automated review by SergeyMenshykh's agents

Copy link
Copy Markdown
Contributor

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 updates Python OpenAPI parsing to make external HTTP $ref resolution opt-in via execution settings, while adding tests around the new default behavior.

Changes:

  • Added enable_external_ref_resolution to OpenAPI execution parameters.
  • Passed the new option through OpenAPI plugin creation into OpenApiParser.parse.
  • Added parser tests for default HTTP ref blocking and internal ref resolution.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
python/semantic_kernel/connectors/openapi_plugin/openapi_parser.py Adds resolver type selection for OpenAPI $ref handling.
python/semantic_kernel/connectors/openapi_plugin/openapi_manager.py Propagates execution settings into parser options.
python/semantic_kernel/connectors/openapi_plugin/openapi_function_execution_parameters.py Adds the new external ref resolution setting.
python/tests/unit/connectors/openapi_plugin/test_openapi_parser.py Adds coverage for HTTP and internal $ref parsing behavior.
python/tests/unit/connectors/openapi_plugin/test_openapi_manager.py Updates parser mock expectation for the new argument.
Comments suppressed due to low confidence (1)

python/semantic_kernel/connectors/openapi_plugin/openapi_parser.py:60

  • This only changes which refs prance resolves; it does not explicitly detect and reject HTTP/HTTPS $refs. Depending on the validator backend, those refs can be left unresolved in the parsed spec or still be fetched during validation, so the default does not reliably enforce the intended "block external HTTP refs" behavior. Add an explicit pre-validation check or a resolver/handler that fails closed for HTTP refs when the option is disabled.
        resolve_types = RESOLVE_INTERNAL | RESOLVE_FILES
        if enable_external_ref_resolution:
            resolve_types |= RESOLVE_HTTP
        parser = ResolvingParser(openapi_document, resolve_types=resolve_types)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread python/semantic_kernel/connectors/openapi_plugin/openapi_parser.py Outdated
Comment thread python/tests/unit/connectors/openapi_plugin/test_openapi_parser.py Outdated
Comment thread python/semantic_kernel/connectors/openapi_plugin/openapi_manager.py Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SergeyMenshykh SergeyMenshykh changed the title Python: Update OpenAPI document parsing options Python: [Breaking] Update OpenAPI document parsing options May 14, 2026
SergeyMenshykh and others added 2 commits May 14, 2026 16:27
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collapse multi-line ternary expressions in openapi_manager.py and
remove stale revision line from uv.lock.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SergeyMenshykh SergeyMenshykh marked this pull request as draft May 14, 2026 19:53
@SergeyMenshykh SergeyMenshykh marked this pull request as ready for review May 14, 2026 19:55
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 4 | Confidence: 94% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Design Approach


Automated review by SergeyMenshykh's agents

@SergeyMenshykh SergeyMenshykh added this pull request to the merge queue May 18, 2026
Merged via the queue into microsoft:main with commit 644eb0a May 18, 2026
33 checks passed
@SergeyMenshykh SergeyMenshykh deleted the semenshi/openapi-parsing-update branch May 18, 2026 12:57
@github-project-automation github-project-automation Bot moved this from In Review to Done in Agent Framework May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests for the Python Semantic Kernel

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants