fix(openapi): make unsupported-method warning reachable by h3xxit · Pull Request #93 · universal-tool-calling-protocol/python-utcp · GitHub
Skip to content

fix(openapi): make unsupported-method warning reachable#93

Merged
h3xxit merged 1 commit into
devfrom
fix/openapi-unsupported-method-warning
Jun 24, 2026
Merged

fix(openapi): make unsupported-method warning reachable#93
h3xxit merged 1 commit into
devfrom
fix/openapi-unsupported-method-warning

Conversation

@h3xxit

@h3xxit h3xxit commented Jun 24, 2026

Copy link
Copy Markdown
Member

Problem

P3 dead-code bug introduced in #88. convert() pre-filtered operations to SUPPORTED_HTTP_METHODS:

if method.upper() in SUPPORTED_HTTP_METHODS:
    tool = self._create_tool(...)

So unsupported verbs (options/head/trace) never reached _create_tool, making its validation guard — and the intended skip warning — unreachable dead code.

Root cause

The method check was duplicated: once in the loop filter, once in _create_tool. The loop filter excluded exactly the methods the inner guard was meant to warn about.

Fix

Split into two sets:

  • OPENAPI_OPERATION_METHODS (get/put/post/delete/options/head/patch/trace) — used by the loop only to tell operations apart from non-operation path-item keys (parameters, summary, $ref, servers).
  • SUPPORTED_HTTP_METHODS (the call-template subset) — _create_tool validates against this and warns+skips anything else.

Now unsupported operations reach _create_tool and emit the warning instead of being silently dropped.

Tests

Strengthened test_openapi_converter_skips_unsupported_methods to assert the warning is actually emitted (via capsys), not just that the tools are absent. Full converter suite: 5 passed.

Bumps utcp-http 1.1.8 → 1.1.9.

Note: the same bug was ported to typescript-utcp; fixed there in PR #27.

🤖 Generated with Claude Code


Summary by cubic

Fixes a dead-code path in the OpenAPI converter so unsupported HTTP methods emit a warning instead of being silently dropped. Ensures all OpenAPI operations reach validation while still skipping non-operation keys.

  • Bug Fixes
    • Introduced OPENAPI_OPERATION_METHODS for loop filtering; kept SUPPORTED_HTTP_METHODS for _create_tool validation.
    • Loop now filters on method.lower() against OpenAPI operations; _create_tool warns and skips options, head, and trace.
    • Strengthened test_openapi_converter_skips_unsupported_methods to assert the warning via capsys.
    • Bumped utcp-http to 1.1.9.

Written for commit a3bb75f. Summary will update on new commits.

Review in cubic

The convert() loop pre-filtered operations to SUPPORTED_HTTP_METHODS, so the
validation guard in _create_tool could never run and its warning never fired —
dead code. Split the method sets: the loop now filters on the full set of
OpenAPI operation methods (so it still skips non-operation path-item keys like
parameters/summary/$ref), and _create_tool remains the single place that
validates against SUPPORTED_HTTP_METHODS, warning and skipping options/head/
trace operations.

Strengthens the skip test to assert the warning is emitted. Bumps utcp-http
1.1.8 -> 1.1.9.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 3 files

Re-trigger cubic

@h3xxit h3xxit merged commit bb1ee06 into dev Jun 24, 2026
10 checks passed
@h3xxit h3xxit deleted the fix/openapi-unsupported-method-warning branch June 24, 2026 20:56
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.

1 participant