microsoft / microsoft/typespec

[python] generated tests should not suggest read-only in request

Open
#5,785 0 comments 0 reactions 1 assignee Claimed by @msyyc View on GitHub
emitter:client:python
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

transferred from https://github.com/Azure/autorest.python/issues/2978

See this field that is `visibility("read")`:
https://github.com/Azure/azure-rest-api-specs/blob/c9a4dc04527f7fdb4a944e2c392f2de280ef7cae/specification/durabletask/DurableTask.Management/main.tsp#L70

And the generated test for Python looks like this:
```
@recorded_by_proxy
def test_schedulers_begin_update(self, resource_group):
response = self.client.schedulers.begin_update(
resource_group_name=resource_group.name,
scheduler_name="str",
properties={
"location": "str",
"id": "str",
"name": "str",
"properties": {
"ipAllowlist": ["str"],
"sku": {"name": "str", "capacity": 0, "redundancyState": "str"},
"endpoint": "str",
"provisioningState": "str",
},
"systemData": {
"createdAt": "2020-02-20 00:00:00",
"createdBy": "str",
"createdByType": "str",
"lastModifiedAt": "2020-02-20 00:00:00",
"lastModifiedBy": "str",
"lastModifiedByType": "str",
},
"tags": {"str": "str"},
"type": "str",
},
).result() # call '.result()' to poll until service return final result
```

Note that we suggest `redundancyState` in the request. As this field is "read", it should not be suggested and should be ommmited.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.