Skip to content

Built in tags metadata #10771

@timotheeguerin

Description

@timotheeguerin

We currently define @tagMetadata in openapi library to map to openapi meaning. However it could be beneficial to define tags as a more core typespec feature. Current @tag is a core decorator that just take a string. We could expand to allow enum member which would allow defining available tags as enum(s)

import "@typespec/openapi";

@tags
enum Tags {
  /** Abc tag */
  @summary("Abc")
  @OpenAPI.externalDocs("")
  // parent
  // kind
  tagA,

  /** Abc tag */
  @tagParent(Tags.tagA)
  @tagKind("abc")
  tagB,
}

@tag(Tags.tagA)
op a(): void;

Playground Link

Category as separate enums

enum TagGroupA {
  a,
  b,
}
enum TagGroupB {
  a,
  b,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions