Skip to content

Fix tagMetadata extension diagnostic targets#10776

Open
kiwigitops wants to merge 1 commit into
microsoft:mainfrom
kiwigitops:fix-openapi-tagmetadata-extension-target
Open

Fix tagMetadata extension diagnostic targets#10776
kiwigitops wants to merge 1 commit into
microsoft:mainfrom
kiwigitops:fix-openapi-tagmetadata-extension-target

Conversation

@kiwigitops
Copy link
Copy Markdown

Closes #10767

This keeps the OpenAPI extension-key validation tied to the metadata object literal, so invalid keys such as custom are reported on the offending property instead of the tag name.

Verification:

  • npx pnpm --filter @typespec/openapi build
  • npx pnpm --filter @typespec/openapi test -- decorators.test.ts

@kiwigitops kiwigitops force-pushed the fix-openapi-tagmetadata-extension-target branch from 8500595 to 2fc1378 Compare May 30, 2026 19:51
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 1, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/openapi@10776

commit: 2fc1378

expectDiagnostics(diagnostics, {
code: "@typespec/openapi/invalid-extension-key",
message: `OpenAPI extension must start with 'x-' but was 'custom'`,
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

expectDiagnostics takes in a pos and the actual value can be retrieved if using compileAndDiagnose and using a marker in the code

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

❌ There is undocummented changes. Run chronus add to add a changeset or click here.

The following packages have changes but are not documented.

  • @typespec/openapi
Show changes

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tagMetadata custom property without x report error on wrong location

2 participants