Skip to content

fix(openapi3): avoid duplicating parameter @extension on schema#11204

Open
timotheeguerin wants to merge 1 commit into
mainfrom
timotheeguerin/openapi3-fix-8271
Open

fix(openapi3): avoid duplicating parameter @extension on schema#11204
timotheeguerin wants to merge 1 commit into
mainfrom
timotheeguerin/openapi3-fix-8271

Conversation

@timotheeguerin

Copy link
Copy Markdown
Member

Fixes #8271

Problem

An @extension applied to a query/path/header parameter property was emitted twice: once on the OpenAPI Parameter Object root (correct) and once inside the nested schema object (unwanted duplicate).

{ "name": "filter", "in": "query", "required": true,
  "schema": { "type": "string", "x-my-ext": "hello" },
  "x-my-ext": "hello" }

Fix

In getOpenAPIParameterBase, the parameter property's own extension keys are stripped from the parameter schema (they remain on the Parameter Object root, consistent with the existing parameter component test and OpenAPI conventions).

Tests

Added a test asserting the extension is present on the parameter object and absent from its schema for both query and path parameters.

Parameter-level @extension values were emitted both on the OpenAPI Parameter Object and its nested schema. They are now emitted only on the parameter object.

Fixes #8271
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:openapi3 Issues for @typespec/openapi3 emitter label Jul 8, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/openapi3@11204

commit: 86e9d68

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @typespec/openapi3
Show changes

@typespec/openapi3 - fix ✏️

Fix @extension being duplicated on both the parameter object and its schema in OpenAPI output. Parameter extensions are now emitted only on the parameter object.

@timotheeguerin timotheeguerin marked this pull request as ready for review July 8, 2026 15:16
@azure-sdk-automation

azure-sdk-automation Bot commented Jul 8, 2026

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:openapi3 Issues for @typespec/openapi3 emitter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Duplicate extensions in OAS 3.1

1 participant