Skip to content

Fix flatten read-only properties case#4006

Merged
v-jiaodi merged 6 commits intoAzure:mainfrom
v-jiaodi:fix-flatten-case
Mar 6, 2026
Merged

Fix flatten read-only properties case#4006
v-jiaodi merged 6 commits intoAzure:mainfrom
v-jiaodi:fix-flatten-case

Conversation

@v-jiaodi
Copy link
Member

@v-jiaodi v-jiaodi commented Mar 4, 2026

the response body shall be wrapped with properties or propertiesOptional

@azure-sdk
Copy link
Collaborator

azure-sdk commented Mar 4, 2026

All changed packages have been documented.

  • @azure-tools/azure-http-specs
Show changes

@azure-tools/azure-http-specs - fix ✏️

Fix test cases for flatten property with read-only properties.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 4, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@azure-tools/azure-http-specs@4006

commit: 51108c6

@azure-sdk
Copy link
Collaborator

azure-sdk commented Mar 4, 2026

You can try these changes here

🛝 Playground 🌐 Website

@v-jiaodi v-jiaodi added this pull request to the merge queue Mar 6, 2026
Merged via the queue into Azure:main with commit 26d915b Mar 6, 2026
27 checks passed
@v-jiaodi v-jiaodi deleted the fix-flatten-case branch March 6, 2026 07:25
github-merge-queue bot pushed a commit to microsoft/typespec that referenced this pull request Mar 6, 2026
…del scenarios (#9949)

Adds Python SDK mock API tests for the Spector scenarios
introduced/fixed in
[Azure/typespec-azure#4006](Azure/typespec-azure#4006),
which corrected the `flattenReadOnlyModel` response shape so read-only
properties are returned wrapped in a `properties` object rather than
flattened to the parent level.

## Changes

- **Dependency bump**: `@azure-tools/azure-http-specs`
`0.1.0-alpha.38-dev.2` → `0.1.0-alpha.38-dev.6` to pick up the
new/updated Spector scenarios
- **New sync + async tests** in
`test_azure_client_generator_core_flatten[_async].py`:
- `test_put_flatten_unknown_model` — verifies `properties` is **not**
flattened for `unknown` (non-model) types
- `test_put_flatten_read_only_model` — verifies the response returns
read-only properties wrapped under `properties`:

```python
def test_put_flatten_read_only_model(client: FlattenPropertyClient):
    result = client.put_flatten_read_only_model(Solution(name="foo"))
    assert result == Solution(
        name="foo",
        properties=SolutionProperties(solution_id="solution1", title="Solution Title", content="Solution Content"),
    )
```

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>[python] add test case for
Azure/typespec-azure#4006
> </issue_title>
> <issue_description>follow skill
https://github.com/microsoft/typespec/blob/main/.github/skills/python-sdk-spector-mock-api-tests/SKILL.md
to write test case for Azure/typespec-azure#4006
> </issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes #9948

<!-- 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>
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.

3 participants