Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 17, 2025

Plan: Add query parameter as list parameter test

  • Explore repository structure and understand existing tests
  • Add list parameter scenario in /packages/http-specs/specs/parameters/query/main.tsp
  • Add corresponding mock API in /packages/http-specs/specs/parameters/query/mockapi.ts
  • Validate the scenario format
  • Validate the mock API
  • Test the implementation and verify formatting
  • Run E2E tests to verify functionality
  • Verify test passes and is included in coverage
  • Address PR feedback: Rename interface from List to QueryList
  • Add changelog entry for the http-specs package

Implementation Summary

Successfully added a new test scenario Parameters_Query_QueryList_post for query parameters with list/array values:

Changes Made:

  1. main.tsp: Added QueryList interface with a POST operation that accepts listParameter: string[] as a query parameter
  2. mockapi.ts: Added mock API definition expecting the list to be serialized as CSV ("a,b,c")
  3. spec-summary.md: Auto-generated documentation showing the new test
  4. Changelog: Added chronus change file for the new feature

Test Details:

  • Endpoint: POST /parameters/query/list
  • Parameter: listParameter (type: string[])
  • Expected behavior: Client should pass array ["a", "b", "c"] and it should be serialized as "a,b,c" (CSV format)
  • Response: 204 No Content

Validation Results:

✅ Scenario validation: PASSED
✅ Mock API validation: PASSED
✅ Code formatting: PASSED

PR Feedback Addressed:

  • Renamed interface from List to QueryList as requested
  • Updated mock API scenario name to Parameters_Query_QueryList_post to match
  • Added changelog entry using chronus format
Original prompt

This section details on the original issue you should resolve

<issue_title>Add query paramerter as list parameter test</issue_title>
<issue_description>I need a new test in "packages/http-specs/specs/parameters/query" to test what happen if the parameter is a list:

@query
listParameter: string[];

It's expected that the list is serialized as CSV. The scenario should ask for the person calling this test, to pass an array like {"a","b","c"], and the http part should expect to receive "a.b.c" for the query parameter.</issue_description>

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


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

Copilot AI changed the title [WIP] Add query parameter as list parameter test Add query parameter list serialization test for CSV format Dec 17, 2025
Copilot AI requested a review from lmazuel December 17, 2025 20:14
Copy link
Member

@lmazuel lmazuel left a comment

Choose a reason for hiding this comment

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

LGTM


@doc("List query parameter verification")
@route("/list")
interface List {
Copy link
Member

Choose a reason for hiding this comment

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

Can you rename it QueryList ?

Copy link
Member

Choose a reason for hiding this comment

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

@copilot Can you rename it QueryList ?

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 to QueryList in commit 0290e86.

Copy link
Contributor Author

Copilot AI commented Dec 17, 2025

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 vite k/ty�� ebsite/src/content/docs/docs/emitters/openapi3/reference node _modules/.bin/sh -p . rgo/bin/node node cal/�� lmstxt --output-dir ../../website/src/content/docs/docs/libraries/http/reference node /.bin/sh compile . cal/share/pnpm/.tsx ./.scripts/regen-compiler-docs.ts sh (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 Dec 17, 2025

Open in StackBlitz

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

commit: 64076e4

@lmazuel
Copy link
Member

lmazuel commented Dec 17, 2025

@copilot you need to update the ChangeLog of the http-specs package for the CI to pass

Copy link
Contributor Author

Copilot AI commented Dec 17, 2025

@copilot you need to update the ChangeLog of the http-specs package for the CI to pass

Added changelog entry in commit 64076e4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add query paramerter as list parameter test

2 participants