Skip to content

Add summary and kind fields to @tagMetadata decorator#10769

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/add-support-for-tag-metadata-summary-kind
Open

Add summary and kind fields to @tagMetadata decorator#10769
Copilot wants to merge 3 commits into
mainfrom
copilot/add-support-for-tag-metadata-summary-kind

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 22, 2026

@tagMetadata lacked summary and kind fields introduced in OpenAPI 3.2 tag objects. These fields needed version-aware handling since they don't exist in OpenAPI 3.0/3.1.

Changes

  • TagMetadata model (packages/openapi/lib/decorators.tsp, generated-defs): Added summary and kind optional fields.

  • Emitter (packages/openapi3/src/openapi.ts): Version-aware emission in resolveDocumentTags:

    • OpenAPI 3.2 → native summary / kind fields
    • OpenAPI 3.0/3.1 → x-oai-summary / x-oai-kind extensions
  • Converter (transform-tags.ts, generate-tags.ts, interfaces.ts): Bidirectional support — reads both native 3.2 fields and x-oai- extensions from 3.0/3.1 documents, and generates the corresponding TypeSpec decorator properties.

Usage

@service
@tagMetadata("foo", #{ summary: "all operations that allow doing Foo", kind: "FooGroup" })
namespace PetStore {}

OpenAPI 3.2 output:

tags:
  - name: foo
    summary: "all operations that allow doing Foo"
    kind: FooGroup

OpenAPI 3.0/3.1 output:

tags:
  - name: foo
    x-oai-summary: "all operations that allow doing Foo"
    x-oai-kind: FooGroup

Copilot AI linked an issue May 22, 2026 that may be closed by this pull request
3 tasks
- Add summary and kind to TagMetadata model in decorators.tsp
- Update generated-defs TypeSpec.OpenAPI.ts with new fields
- Emit summary/kind as native fields for OpenAPI 3.2
- Emit summary/kind as x-oai-summary/x-oai-kind extensions for OpenAPI 3.0/3.1
- Update converter to import summary/kind from both native and x-oai- fields
- Add tests for version-specific summary/kind behavior
- Update tag-metadata spec snapshot to include summary and kind
- Add 3.2 tag-metadata spec snapshot test
- Add changelog entry

Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/73460656-985a-4d04-9a50-f6010a0c0987

Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added lib:openapi emitter:openapi3 Issues for @typespec/openapi3 emitter openapi3:converter Issues for @typespec/openapi3 openapi to typespec converter labels May 22, 2026
Copilot AI changed the title [WIP] Add support for summary and kind in tagMetadata decorator Add summary and kind fields to @tagMetadata decorator May 22, 2026
Copilot AI requested a review from baywet May 22, 2026 14:00
Copilot finished work on behalf of baywet May 22, 2026 14:00
@baywet baywet marked this pull request as ready for review May 22, 2026 14:01
@baywet baywet enabled auto-merge May 22, 2026 14:02
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 22, 2026

Open in StackBlitz

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

commit: 2e7c91e

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 lib:openapi openapi3:converter Issues for @typespec/openapi3 openapi to typespec converter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for summary and kind in tagMetadata decorator

3 participants