Skip to content

[migration tsp] How to support optional response body #3760

@v-jiaodi

Description

@v-jiaodi

1.Spec PR: Azure/azure-rest-api-specs#39837
response:

"responses": {
  "200": {
    "description": "OK"
  },
  "201": {
    "description": "Partner Topic update request accepted.",
    "schema": {
      "$ref": "#/definitions/PartnerTopic"
    }
  },
update is ArmCustomPatchSync<
    Employee,
    Azure.ResourceManager.Foundations.ResourceUpdateModel<Employee, EmployeeProperties>,
    Response = OkResponse | ArmResourceCreatedSyncResponse<Employee>
  >;
  • generated swagger:
responses": {
          "200": {
            "description": "The request has succeeded."
          },
          "201": {
            "description": "Resource 'Employee' create operation succeeded",
            "schema": {
              "$ref": "#/definitions/Employee"
            }
          },
          "default": {
...
        }

in this case, tcgc will use the response type from 201 as the method.response
Image
here is the playground

this issue is to confirm how to support optional response body

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions