Skip to content

Conversation

@Teagan42
Copy link
Contributor

What

  • generate Pydantic request models for REST tool and prompt endpoints when building the OpenAPI schema
  • update the REST endpoint tests to assert that POST operations expose JSON bodies instead of query parameters
  • bump the project version to 0.26.35 and mirror the change in docker dependencies

Why

  • the Swagger UI was incorrectly documenting POST endpoints such as /rest/search-media with query parameters, leading to broken example requests

Affects

  • REST OpenAPI schema generation and related tests

Testing

  • uv run ruff check .
  • uv run pytest

Documentation

  • No additional documentation changes were required beyond the corrected OpenAPI schema

https://chatgpt.com/codex/tasks/task_e_68dba2402c7c8328bf224b83d75432f8

Copilot AI review requested due to automatic review settings September 30, 2025 09:36
Copy link
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 fixes REST OpenAPI request body definitions to properly document POST endpoints with JSON request bodies instead of query parameters. The Swagger UI was incorrectly showing query parameters for POST operations like /rest/search-media, leading to broken example requests.

  • Generates Pydantic request models for REST tool and prompt endpoints when building the OpenAPI schema
  • Updates tests to verify POST operations correctly expose JSON bodies rather than query parameters
  • Bumps project version to 0.26.35 across both main and docker dependency files

Reviewed Changes

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

File Description
mcp_plex/server.py Adds _request_model function and updates _build_openapi_schema to generate Pydantic models for request bodies
tests/test_server.py Updates REST endpoint tests to validate JSON request bodies instead of query parameters
pyproject.toml Bumps version from 0.26.34 to 0.26.35
docker/pyproject.deps.toml Mirrors version bump in docker dependencies

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +126 to +127
model_name = "".join(part.capitalize() for part in name.replace("-", "_").split("_"))
model_name = f"{model_name or 'Request'}Request"
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

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

[nitpick] The model name generation logic is complex and could be simplified. Consider extracting this into a separate helper function with descriptive variable names to improve readability.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

Coverage

Coverage Report
FileStmtsMissCoverMissing
mcp_plex
   loader.py4172893%70, 73–74, 150, 179–183, 185–194, 205, 207–209, 225, 251, 652–654
   server.py3482792%107, 124, 142–143, 266, 494, 498, 520–526, 558–559, 562, 580, 585, 603, 634–635, 652–653, 676, 679–680, 727, 764
TOTAL9465594% 

Tests Skipped Failures Errors Time
66 0 💤 0 ❌ 0 🔥 31.722s ⏱️

@Teagan42 Teagan42 merged commit d422fa9 into main Sep 30, 2025
4 checks passed
@Teagan42 Teagan42 deleted the codex/fix-openapi-documentation-for-body-parameters branch September 30, 2025 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants