Skip to content

[Bug] OpenAPI path parameters ignore style: label and style: matrix #5856

Open

Description

@BlueX888

Summary

OpenAPI path parameters declared with a non-default serialization style are sent as plain path segments. For a route GET /label/{id} with style: label, the request goes to /label/abc instead of /label/.abc; for style: matrix, /matrix/abc instead of /matrix/;id=abc. Servers that rely on these styles route or parse incorrectly, so such endpoints are unusable through the OpenAPI provider. The default simple style behaves correctly.

Reproduction (current main adf90b6, offline)

In-memory OpenAPI 3.1 spec with three operations: /simple/{id} (no style), /label/{id} (style: label), /matrix/{id} (style: matrix). Call each tool through FastMCP.from_openapi with a MockTransport capturing the request URL and id=abc.

Observed:

simple  https://example.test/simple/abc    PASS
label   https://example.test/label/abc     expected .../label/.abc
matrix  https://example.test/matrix/abc    expected .../matrix/;id=abc

Expected: label and matrix per the OAS 3.x style table, simple unchanged.

Root cause

fastmcp_slim/fastmcp/utilities/openapi/director.py: build() passes only the route path, path params and base URL into _build_url() (base ~line 119), and _build_url() (~398-452) substitutes each path parameter as a plain encoded segment without consulting ParameterInfo.style/explode.

Suggested fix

Resolve each path parameter's style/explode from the route and serialize label (.<value>) and matrix (;name=<value>) per the OAS table, including the standard exploded forms for arrays/objects, while leaving simple output byte-for-byte unchanged. Keep per-value encoding safe (no double-encoding; delimiters emitted literally).

Tests

A fix with 18 end-to-end tests is ready (label/matrix scalars, arrays and objects with explode false/true, encoding of special characters, multiple path params, existing prefix/suffix, simple controls and traversal pins). I'll open the linked PR with red/green evidence.

Activity

  1. added
    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.
    openapiRelated to OpenAPI integration, parsing, or code generation features.
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.openapiRelated to OpenAPI integration, parsing, or code generation features.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions