Commit 1dddaa9
Add test case for model property named "list" (#9259)
Adds test coverage for model properties using reserved keywords,
specifically "list" which is reserved in Python and other languages.
## Changes
- **`main.tsp`**: Added `ModelWithList` model with `list` property in
`ModelProperties` namespace, following existing pattern for reserved
word testing
- **`mockapi.ts`**: Added `SpecialWords_ModelProperties_withList`
scenario expecting `{"list": "ok"}` payload
- **Special words list**: Updated documentation to include "list" in the
enumerated reserved words
## Example
```typespec
model ModelWithList {
list: string;
}
@Scenario
@route("list")
op withList(@Body body: ModelWithList): void;
```
Validates that generators properly escape or handle the `list` property
name when generating client code.
> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### 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 sh n-sc�� ebsite/src/content/docs/docs/emitters/openapi3/reference
node
k/typespec/typespec/node_modules../../website/src/content/docs/docs/emitters/protobuf/reference
-p . n-schema/referentspd doc . --enable-experimental --output-dir
../../website/src/content/docs/docs/emitters/servers/http-server-csharp/reference
--skip-js node tool�� lmstxt --output-dir
../../website/src/content/docs/docs/libraries/http/reference node
pec/node_modules/.bin/sh /library-linter sh sh /.bin/sh sh` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/microsoft/typespec/settings/copilot/coding_agent)
(admins only)
>
> </details>
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>[specs] new test case for model whose property is named
"list"</issue_title>
> <issue_description>To cover scenario
#9248, we need a new test
case in
https://github.com/microsoft/typespec/blob/main/packages/http-specs/specs/special-words/main.tsp
that it has model property named "list"
>
> NOTE:
> - DO add changelog in
https://github.com/microsoft/typespec/tree/main/.chronus/changes
> - DO run command
https://github.com/microsoft/typespec/blob/664978b3cf7399e43e2823d3a69043203e740109/packages/http-specs/package.json#L14
under
https://github.com/microsoft/typespec/blob/main/packages/http-specs to
check all ci items.</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixes #9258
<!-- START COPILOT CODING AGENT TIPS -->
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>1 parent 3d25601 commit 1dddaa9
File tree
4 files changed
+52
-0
lines changed- .chronus/changes
- packages/http-specs
- specs/special-words
4 files changed
+52
-0
lines changedLines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3621 | 3621 | | |
3622 | 3622 | | |
3623 | 3623 | | |
| 3624 | + | |
| 3625 | + | |
| 3626 | + | |
| 3627 | + | |
| 3628 | + | |
| 3629 | + | |
| 3630 | + | |
| 3631 | + | |
| 3632 | + | |
| 3633 | + | |
| 3634 | + | |
| 3635 | + | |
3624 | 3636 | | |
3625 | 3637 | | |
3626 | 3638 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
269 | 270 | | |
270 | 271 | | |
271 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
272 | 291 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
42 | 56 | | |
43 | 57 | | |
44 | 58 | | |
| |||
0 commit comments