Skip to content

fix: disable response model for mock webhook route - #88

Open
FanouZeng-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:fix/webhook-response-model
Open

fix: disable response model for mock webhook route#88
FanouZeng-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:fix/webhook-response-model

Conversation

@FanouZeng-TT

Copy link
Copy Markdown
Contributor

Description

MockWebhookServer now returns either a JSONResponse for a simulated transient failure or a dictionary for success:

async def order_event(...) -> JSONResponse | dict[str, str]:

FastAPI treats that union annotation as a response model and raises FastAPIError while registering the route because JSONResponse is not a valid Pydantic response field. As a result, all nine webhook tests fail during setup before starting the mock server.

Fix: set response_model=None on the mock webhook route. This disables response-schema generation for the test endpoint while preserving its existing 500/200 status codes, bodies, and event recording.

Category (Required)

  • Core Protocol: Changes to the base communication layer, global context, or breaking refactors. (Requires Technical Council approval)
  • Governance/Contributing: Updates to GOVERNANCE.md, CONTRIBUTING.md, or CODEOWNERS. (Requires Governance Council approval)
  • Capability: New schemas (Discovery, Cart, etc.) or extensions. (Requires Maintainer approval)
  • Documentation: Updates to README, or documentations regarding schema or capabilities. (Requires Maintainer approval)
  • Infrastructure: CI/CD, Linters, or build scripts. (Requires DevOps Maintainer approval)
  • Maintenance: Version bumps, lockfile updates, or minor bug fixes. (Requires DevOps Maintainer approval)
  • SDK: Language-specific SDK updates and releases. (Requires DevOps Maintainer approval)
  • Samples / Conformance: Maintaining samples and the conformance suite. (Requires Maintainer approval)
  • UCP Schema: Changes to the ucp-schema tool (resolver, linter, validator). (Requires Maintainer approval)
  • Community Health (.github): Updates to templates, workflows, or org-level configs. (Requires DevOps Maintainer approval)

Related Issues

N/A

Checklist

  • I have followed the Contributing Guide (including Conventional Commits title requirements and ! for breaking changes).
  • I have updated the documentation (if applicable).
  • My changes pass all local linting and formatting checks.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • (For Core/Capability) I have included/updated the relevant JSON schemas.
  • I have regenerated Python Pydantic models by running generate_models.sh under python_sdk.

Screenshots / Logs (if applicable)

  • Verified the mock route still returns 500 {"status":"retry"} followed by 200 {"status":"ok"} and records both statuses.
  • webhook_structure_test.py: 6/6 passed.
  • webhook_test.py: 3/3 passed.
  • All 17 conformance test files passed against the reference server.
  • Repository-wide pre-commit and git diff --check passed.

@damaz91 damaz91 added the status:needs-triage Signal that the PR is ready for human triage label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:needs-triage Signal that the PR is ready for human triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants