Skip to content

[Spector] Add 200 body / 204 no-content success response scenario - #11677

Open
JoshLove-msft with Copilot wants to merge 2 commits into
mainfrom
copilot/add-200-body-204-no-content
Open

[Spector] Add 200 body / 204 no-content success response scenario#11677
JoshLove-msft with Copilot wants to merge 2 commits into
mainfrom
copilot/add-200-body-204-no-content

Conversation

Copilot AI commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Adds HTTP Spector coverage for an operation with multiple success responses where one variant carries a body and the other does not. This lets emitters verify they distinguish a 204 empty-success variant from a nullable body on a single response.

Scenario

New namespace Response.BodyOrNoContent under response/body-or-no-content. Both operations return the same union so the generated shape matches the issue exactly; a mock endpoint is deterministic, so each declared outcome gets its own route:

alias LayoutResponse = {
  @statusCode statusCode: 200;
  @body layout: BlobLayout;
} | {
  @statusCode statusCode: 204;
};

@route("/body") @get op getBody(): LayoutResponse;         // mock → 200 { "content": "hello" }
@route("/no-content") @get op getNoContent(): LayoutResponse; // mock → 204, no body

Changes

  • specs/response/body-or-no-content/main.tsp — scenario definitions with docs calling out the validation goals (both classified successful, 200 deserialized normally, 204 skips body deserialization, raw status/headers available).
  • specs/response/body-or-no-content/mockapi.tspassOnSuccess mocks for the 200-with-body and 204-no-content routes.
  • spec-summary.md — regenerated.
  • .chronus/changes/feature entry for @typespec/http-specs.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@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 Aug 14, 2026
Copilot AI changed the title [WIP] Add HTTP Spector scenario for 200 and 204 responses [Spector] Add 200 body / 204 no-content success response scenario Aug 14, 2026
Copilot AI requested a review from JoshLove-msft August 14, 2026 20:49
@JoshLove-msft
JoshLove-msft marked this pull request as ready for review August 14, 2026 22:38
@azure-sdk-automation

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@pkg-pr-new

pkg-pr-new Bot commented Aug 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: a305245

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.

[Spector] Add 200 body / 204 no-content success response scenario

2 participants