Skip to content

[typespec-python] Regenerate tests from microsoft/typespec PR #11087#48067

Merged
msyyc merged 1 commit into
typespec-python-generated-testsfrom
regen/typespec-python-pr-11087
Jul 16, 2026
Merged

[typespec-python] Regenerate tests from microsoft/typespec PR #11087#48067
msyyc merged 1 commit into
typespec-python-generated-testsfrom
regen/typespec-python-pr-11087

Conversation

@msyyc

@msyyc msyyc commented Jul 15, 2026

Copy link
Copy Markdown
Member

NOTE: This PR exists only to display the code diff. Please do not merge it.

Fixes #48066

Source: microsoft/typespec#11087

Automated regeneration of TypeSpec Python generated tests from microsoft/typespec PR #11087.

This PR was auto-generated. Re-run the workflow to update it after new commits are pushed to the upstream TypeSpec PR

@azure-pipelines

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

from .._utils.serialization import Deserializer, Serializer
from ..property.aio.operations import PropertyOperations
from ._configuration import BooleanClientConfiguration
from .operations import PropertyOperations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is no long the async import PropertyOperations?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

we configure namespace in regenerate-common.ts like https://github.com/microsoft/typespec/pull/11087/changes#diff-6d3a02078e3812a5ae4eb5b94e9f07952450932adb30a87dea6664ef8a270323 so the generated code structure is changed but the SDK API is not changed.

@msyyc
msyyc marked this pull request as ready for review July 16, 2026 02:48
@msyyc
msyyc requested a review from danieljurek as a code owner July 16, 2026 02:48
@msyyc msyyc changed the title [typespec-python] Regenerate tests from microsoft/typespec PR #11087 (DO NOT MERGE) [typespec-python] Regenerate tests from microsoft/typespec PR #11087 Jul 16, 2026
@azure-pipelines

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

@msyyc
msyyc merged commit 4309df6 into typespec-python-generated-tests Jul 16, 2026
3 checks passed
@msyyc
msyyc deleted the regen/typespec-python-pr-11087 branch July 16, 2026 02:49
live1206 pushed a commit to live1206/typespec that referenced this pull request Jul 16, 2026
… fix boolean-as-string encoding (microsoft#11087)

Adds Python SDK mock API test coverage for the `encode/boolean` Spector
scenarios from microsoft#10875 (`@encode(string)` on boolean types). This
required updating multiple layers of the Python codegen stack.

## Generator fixes

**`types.ts` — property emission**  
Preserves boolean `@encode(string)` metadata from the compiler and maps
it to the Python runtime’s `"str"` format token.

**`primitive_types.py` — `BooleanType`**  
Detects `yaml_data["encode"] == "string"` and sets `self.encode =
"str"`, mirroring `IntegerType`.

**`model_base.py.jinja2`**  
Adds `_deserialize_bool_as_str` for case-insensitive string-to-boolean
deserialization:

```python
def _deserialize_bool_as_str(attr: str) -> bool:
    return attr.lower() == "true"
```

Also dispatches to it when `annotation is bool and rf._format == "str"`.

## Test coverage

Adds sync and async tests for Azure and unbranded clients covering:

- `trueLower` — `"true"` → `True`
- `falseLower` — `"false"` → `False`
- `trueUpper` — `"TRUE"` → `True`
- `falseMixed` — `"FaLsE"` → `False`

## Dependencies

- Uses `@typespec/compiler` 1.14, which supports boolean
`@encode(string)`.
- Uses `@typespec/http-specs` `0.1.0-alpha.39`, containing the
`encode/boolean` scenarios.
- Adds `encode/boolean` to `regenerate-common.ts`.

## Code diff:
Azure/azure-sdk-for-python#48067

---------

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.

2 participants