Skip to content

Placement of @OData.NextLink property breaks paging support for AutoREST based code generators #282

@peombwa

Description

@peombwa

Starting in Microsoft.OpenApi.OData v1.1.0, @OData.NextLink property of response collection schema was moved to a base collection pagination and count responses schema. Unfortunately, AutoREST does not support this representation at the moment. See how AutoREST supports paging at https://github.com/microsoftgraph/microsoft-graph-devx-api/issues/199.

Assemblies affected

Microsoft.OpenApi.OData v1.1.0

Expected result

paths:
  /applications:
    get:
      tags:
        - applications.application
      summary: List applications
      operationId: applications.application_ListApplication
      responses:
        '200':
          $ref: '#/components/responses/microsoft.graph.applicationCollectionResponse'
        default:
          $ref: '#/components/responses/error'
      x-ms-pageable:
        nextLinkName: '@odata.nextLink' # REQUIRED: property name for next page URL
        operationName: listMore
      x-ms-docs-operation-type: operation
components:
  responses:
    microsoft.graph.applicationCollectionResponse:
      description: Retrieved collection
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/microsoft.graph.applicationCollectionResponse'
  schemas:
    microsoft.graph.applicationCollectionResponse:
      title: Collection of application
      type: object
      properties:
        value:
          type: array
          items:
            $ref: '#/components/schemas/microsoft.graph.application'
        '@odata.nextLink':   # REQUIRED: next page URL (referred to by "nextLinkName")
          type: string
      additionalProperties:
        type: object

Actual result

paths:
  /applications:
    get:
      tags:
        - applications.application
      summary: List applications
      operationId: applications.application_ListApplication
      responses:
        '200':
          $ref: '#/components/responses/microsoft.graph.applicationCollectionResponse'
        default:
          $ref: '#/components/responses/error'
      x-ms-pageable:
        nextLinkName: '@odata.nextLink' # REQUIRED: property name for next page URL
        operationName: listMore
      x-ms-docs-operation-type: operation
components:
  responses:
    microsoft.graph.applicationCollectionResponse:
      description: Retrieved collection
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/microsoft.graph.applicationCollectionResponse'
  schemas:
    microsoft.graph.applicationCollectionResponse:
      title: Collection of application
      type: object
      allOf:
        - $ref: '#/components/schemas/BaseCollectionPaginationCountResponse'
        - type: object
          properties:
            value:
              type: array
              items:
                $ref: '#/components/schemas/microsoft.graph.application'
          additionalProperties:
            type: object
      additionalProperties:
        type: object
    BaseCollectionPaginationCountResponse:
      title: Base collection pagination and count responses
      type: object
      properties:
        '@odata.nextLink': # NOT supported by AutoREST.
          type: string
          nullable: true
      additionalProperties:
        type: object

Metadata

Metadata

Assignees

Labels

priority:p0Blocking issue/ loss of critical functions. An ICM may be filed to communicate urgency. SLA<=48hrstype:bugA broken experience

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions