Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.62k stars 5.04k forks source link

Pageable LROs should be defined with `x-ms-pageable` #20875

Open heaths opened 2 years ago

heaths commented 2 years ago

There's a few LROs that are meant to return pageable results once complete - the original URI - and should be defined as such per https://github.com/Azure/autorest/tree/main/docs/extensions#x-ms-pageable.

These include, but may not be limited to:

For now in the SDK, we are using transforms but these changes should be in the swagger initially. For reference:

- where-operation: QuestionAnsweringProjects_UpdateQnas
  transform: |
    $["x-ms-pageable"] = {
      "nextLinkName": "nextLink",
      "itemName": "value"
    };

- where-operation: QuestionAnsweringProjects_UpdateSources
  transform: |
    $["x-ms-pageable"] = {
      "nextLinkName": "nextLink",
      "itemName": "value"
    };
sahithikkss commented 2 years ago

@rokulka FYI. Are the transforms needed for PATCH calls and done for SDK as per guidelines? @heaths I do not see the need for x-ms-pageable for above mentioned APIs. UpdateQnas or UpdateSources does not return any response that will need to be paginated. It is just a 202 on success with operation-location in header. Subsequent status polling is done using the job id in the header.

heaths commented 2 years ago

x-ms-pageable is needed for the final result, which is a 200 on the original URI. This impacts how LROs are generated for the SDK and is not pure swagger (hence being an extension for autorest). Without this or transforms - which then every SDK language has to do - SDKs will not include a pageable result when the LRO completes.