Skip to content

Add spector case for extensible enum with special word member names#9785

Open
Copilot wants to merge 12 commits intomainfrom
copilot/add-spector-case-special-word
Open

Add spector case for extensible enum with special word member names#9785
Copilot wants to merge 12 commits intomainfrom
copilot/add-spector-case-special-word

Conversation

Copy link
Contributor

Copilot AI commented Feb 24, 2026

  • Add extensible enum (union) with 33 special word member names to special-words/main.tsp
  • Simplify to single @put operation per reviewer feedback
  • Add ExtensibleString return type so mock API echoes back the sent value
  • Simplify return type to putExtensibleStringValue(@body body: ExtensibleString): ExtensibleString;
  • Add handler to dynamically extract request body and echo it back in response
  • Remove explicit contentType headers (default application/json is sufficient)
  • Remove redundant @doc decorators from union definition for consistency with rest of file
  • Rename union Enum to union ExtensibleString to avoid blocking actual enum tests
  • Rename interface Enums to ExtensibleStrings, route /enums to /extensible-strings, and operation putEnumValue to putExtensibleStringValue
  • Regenerate spec-summary
  • Add chronus changeset for @typespec/http-specs
  • Build validated (61 scenarios pass)
  • Format, code review, and security scan clean

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ames

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added the lib:http-specs For issues/prs related to the @typespec/http-specs package label Feb 24, 2026
Copilot AI changed the title [WIP] Add new spector case for special word in enum Add spector case for extensible enum with special word member names Feb 24, 2026
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
…n/json

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
@msyyc
Copy link
Contributor

msyyc commented Feb 24, 2026

@copilot check all changes of the PR to make sure they are consistent.

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 24, 2026

@copilot check all changes of the PR to make sure they are consistent.

Reviewed all changes for consistency in f70bb68. Found and fixed one issue: the union Enum definition had redundant @doc decorators on the union itself and on every member, which was inconsistent with the rest of the file (no other types use @doc). Removed them, keeping just the JSDoc comment. All three changed files are now consistent:

  • main.tsp: Union uses JSDoc only (matching existing models/operations), single @put op with Enum input/output, no explicit contentType
  • mockapi.ts: Handler echoes req.body back in response, matching the TSP contract
  • spec-summary.md: Auto-generated, matches the scenario definition

Build passes with 61 valid scenarios.

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
@msyyc msyyc marked this pull request as ready for review February 26, 2026 06:30
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 26, 2026

Open in StackBlitz

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http@9785
npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-specs@9785

commit: 473f21b

@github-actions
Copy link
Contributor

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

The following packages have changes but are not documented.

  • @typespec/http-specs
Show changes

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@msyyc
Copy link
Contributor

msyyc commented Feb 26, 2026

@copilot fix ci error:

Run pnpm chronus verify --since main
There is undocummented changes. Run chronus add to add a changeset.

The following packages have changes but are not documented.
 - @typespec/http-specs

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 26, 2026

@copilot fix ci error:

Run pnpm chronus verify --since main

...

Added the chronus changeset for @typespec/http-specs in 9b6d78f.

/**
* Verify enum member names that are special words using extensible enum (union).
*/
union Enum {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
union Enum {
union OpenStringUnion {

or ExtensibleString

as this is not an enum and would block an actual enum test

Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot rename union Enum to ExtensibleString. And DO update all related code and doc after rename.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed union Enum to union ExtensibleString and updated all references in the operation signature in 1eb659f.

Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot Also update namespace/interface/route/...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed interface EnumsExtensibleStrings, route /enums/extensible-strings, and operation putEnumValueputExtensibleStringValue. Updated mockapi.ts scenario name/URI and regenerated spec-summary.md accordingly in 3efd8b8.

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 27, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build sh .0/b�� ebsite/src/conte--llmstxt .json /.bin/sh ture 7b6e072b8b5df199/home/REDACTED/work/typespec/typespec/packages/http-specs/node_modules�� in/tsp sh pec/�� ../../website/src/content/docs/d--typekits node _modules/pnpm/dist/node-gyp-bin/sh /library-linter node tsconfig.build.j/home/REDACTED/work/typespec/typespec/packages/http-server-js/node_modules/.bin/..hint modules/@npmcli/doc node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

…viewer feedback

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
@msyyc msyyc requested a review from timotheeguerin February 27, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib:http-specs For issues/prs related to the @typespec/http-specs package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants