Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 29, 2026

Final Changes - Ready for Merge ✅

Changelog Entry Added ✅

Added changelog entry using pnpm change add:

  • Package: @typespec/http-specs
  • Change type: Feature
  • Description: "Add Spector tests for File type with various content types (body and multipart)"

Code Formatting ✅

Ran pnpm format to format the code according to project standards.

Complete Test Coverage

Body Tests (8 scenarios in /type/file):

  • ✅ Upload/download with specific content type (image/png)
  • ✅ Upload/download with JSON content type (application/json)
  • ✅ Upload/download with multiple content types (image/png | image/jpeg)
  • ✅ Upload/download with unspecified content type (sends image/png for testing)

Multipart Tests (3 scenarios in /payload/multipart):

  • ✅ File with specific content type (inline)
  • ✅ File with required filename (model with template)
  • ✅ File array (inline)

All PR Feedback Addressed

  1. ✅ Moved multipart tests to /payload/multipart
  2. ✅ Used inline Http.File<> syntax instead of model wrappers
  3. ✅ Renamed to FileWithRequiredFilename with template argument
  4. ✅ Removed unnecessary test
  5. ✅ Added JSON content type test
  6. ✅ Fixed default content type to use image/png
  7. ✅ Formatted code with pnpm format
  8. ✅ Added changelog entry with pnpm change add

Validation

  • ✅ All 61 scenarios compile successfully
  • ✅ All mock APIs validated
  • ✅ Code properly formatted
  • ✅ Changelog entry created
Original prompt

This section details on the original issue you should resolve

<issue_title>Add spector test for File</issue_title>
<issue_description>NEed test for usage as body in request and response as well as in multipart.

For the body test it should check with a specific content type. Another test should be with multiple content type</issue_description>

<agent_instructions>Follow other binary payload and multipart test in packages/https-specs for example</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: timotheeguerin <1031227+timotheeguerin@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 Jan 29, 2026
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copilot AI changed the title [WIP] Add spector test for File content type Add Spector tests for File type with content type variations Jan 29, 2026
Copilot AI requested a review from timotheeguerin January 29, 2026 15:54
Copilot AI and others added 2 commits January 29, 2026 16:18
…to multipart spec

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

Copilot AI commented Jan 29, 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: /usr/local/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build sed pec/�� ebsite/src/content/docs/docs/emitters/openapi3/reference node tools/pnpm/10.23.0_tmp_3778/node../../website/src/content/docs/docs/emitters/protobuf/reference n --local --verbsh node _modules/pnpm/ditspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/emitters/servers/http-server-csharp/reference --skip-js node p/no�� ite...&#34; --filter &#34;!@typespec/monorepo&#34; run regen-docs sh _modules/pnpm/dist/node-gyp-bin/sh xtern-signature sh node es/.bin/tspd sh (dns block)

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

contentType: "image/png";
}

model FileWithMultipleContentTypes extends TypeSpec.Http.File {
Copy link
Member

Choose a reason for hiding this comment

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

@copilot rename this one to FileWithRequiredFilename and keep only a single content type. Use the template argument to set it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 107bfbd. Renamed to FileWithRequiredFilename and changed to use template argument: extends TypeSpec.Http.File<"image/png">.

…ename, remove FileWithRequiredMetadata

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

Copilot AI commented Jan 29, 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: /usr/local/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build node pec/�� ebsite/src/content/docs/docs/emitters/openapi3/reference . (dns block)

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 29, 2026

Open in StackBlitz

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

commit: 4d4afda

…tion/octet-stream

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

Copilot AI commented Jan 29, 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: /usr/local/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build node n-sc�� ebsite/src/content/docs/docs/emitters/openapi3/reference . /.bin/sh --import @typespec/librar-c n-schema/referentspd doc . --enable-experimental --output-dir ../../website/src/content/docs/d--output-dir sh tool�� lmstxt --output-dir ../../website/src/content/docs/docs/libraries/http/reference sh ndor/bin/sh xtern-signature sh sh .0_tmp_3796/nodetsx ./.scripts/regen-compiler-docs.ts node (dns block)

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

@timotheeguerin
Copy link
Member

@copilot please run pnpm format to format the code. DO NOT try tro format yourself. THE CI will not pass without that

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

Copilot AI commented Jan 29, 2026

@copilot please run pnpm format to format the code. DO NOT try tro format yourself. THE CI will not pass without that

Done in 651bc95. Ran pnpm format which fixed the import statement formatting in mockapi.ts.

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: /usr/local/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build node k/ty�� ebsite/src/content/docs/docs/emitters/openapi3/reference . .0_tmp_3856/node_modules/pnpm/dist/node-gyp-bin/sh --import @typespec/librar/home/REDACTED/work/typespec/typespec/packages/http-specs/node_modules�� --no-emit sh tool�� lmstxt --output-dir ../../website/src/content/docs/docs/libraries/http/reference sh _modules/pnpm/dist/node-gyp-bin/sh n --local --verbsh sh pec/node_modulestsx ./.scripts/regen-compiler-docs.ts node (dns block)

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

@timotheeguerin
Copy link
Member

@copilot you also need to add a changelog entry in .chronus/changes/ with pnpm chronus add. This should be a feature

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

Copilot AI commented Jan 29, 2026

@copilot you also need to add a changelog entry in .chronus/changes/ with pnpm chronus add. This should be a feature

Done in 4d4afda. Added changelog entry using pnpm change add with change type "Feature" and description "Add Spector tests for File type with various content types (body and multipart)".

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.

Add spector test for File<ContentType>

2 participants