Skip to content

[OpenApi] Infinite recursion #1751

Closed
Closed
@coyotte508

Description

@coyotte508

Describe the bug

The openapi handler triggers a "Maximum calls stack size exceeded" error

To Reproduce
Steps to reproduce the behavior:

Use the following openapi file (I trimmed down as much as possible while keeping the error):

openapi: 3.0.0
info:
  title: 'hello'
  version: '0.1.0'
  contact: {}
tags: []
servers:
  - url: /api
    description: API
components:
  schemas:
    UserGet:
      type: object
      properties:
        _resolveType:
          type: string
          enum:
            - user
        id:
          type: string
      required:
        - _resolveType
        - id
    CompanyGet:
      type: object
      properties:
        _resolveType:
          type: string
          enum:
            - company
        id:
          type: string
      required:
        - _resolveType
        - id
    TicketUpdateGet:
      type: object
      properties:
        id:
          type: string
        authorId:
          type: string
        ticketId:
          type: string
      required:
        - id
        - type
        - authorId
        - ticketId
    TicketMessageGet:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
        authorId:
          type: string
        ticketId:
          type: string
      required:
        - id
        - type
        - authorId
        - ticketId
    TicketMessagePatch:
      type: object
      properties:
        content:
          type: string
      required:
        - content
    PersonGet:
      oneOf:
        - $ref: '#/components/schemas/CompanyGet'
        - $ref: '#/components/schemas/UserGet'
      discriminator:
        propertyName: _resolveType
        mapping:
          user: '#/components/schemas/UserGet'
          company: '#/components/schemas/CompanyGet'
paths:
  '/users/{userId}':
    get:
      operationId: UsersGetUser
      parameters:
        - name: userId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
          links:
            Messages:
              operationId: TicketMessagesGetMessages
              parameters:
                authorId: $response.body#/id
            Tickets:
              operationId: TicketsGetTickets
              parameters:
                creatorId: $response.body#/id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserGet'
  '/companies/{companyId}':
    get:
      operationId: CompanysGetCompany
      parameters:
        - name: companyId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
          links:
            Messages:
              operationId: TicketMessagesGetMessages
              parameters:
                authorId: $response.body#/id
            Tickets:
              operationId: TicketsGetTickets
              parameters:
                creatorId: $response.body#/id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompanyGet'
  '/persons/{personId}':
    get:
      operationId: PersonsGetPerson
      description: ''
      parameters:
        - name: personId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PersonGet'
  /tickets/messages:
    get:
      operationId: TicketMessagesGetMessages
      parameters:
        - name: ticketId
          required: false
          in: query
          schema:
            type: string
        - name: authorId
          required: false
          in: query
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  oneOf:
                    - $ref: '#/components/schemas/TicketUpdateGet'
                    - $ref: '#/components/schemas/TicketMessageGet'
  '/tickets/messages/{messageId}':
    patch:
      operationId: TicketMessagesUpdateTicketMessage
      parameters:
        - name: messageId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TicketMessagePatch'
      responses:
        '200':
          description: ''
          links:
            Author:
              operationId: PersonsGetPerson
              parameters:
                personId: $response.body#/authorId
            Ticket:
              operationId: TicketsGetTicket
              parameters:
                ticketId: $response.body#/ticketId
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TicketMessageGet'

Expected behavior

No infinite recursion

Environment:

  • OS: WSL2
  • @graphql-mesh/openapi: 0.13.2
  • NodeJS: 14.15.5

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions