api-management-developer-portal icon indicating copy to clipboard operation
api-management-developer-portal copied to clipboard

Maximum call stack size exceeded

Open smokedlinq opened this issue 1 year ago • 0 comments

Bug description

With an API operation that has a schema with a discriminated type, the portal will show the operations listing but not the operation details. In the developer tools, the console shows the following error: Maximum call stack size exceeded

I have a support case (2309010040007100) open for quite a while without much progress.

Full error from browser console:

Uncaught (in promise) RangeError: Maximum call stack size exceeded
    at new TypeDefinition (theme.js:23:1246540)
    at theme.js:23:1242507
    at Array.map (<anonymous>)
    at TypeDefinition.processCombinationProperties (theme.js:23:1241885)
    at new TypeDefinitionObjectProperty (theme.js:23:1241147)
    at new TypeDefinition (theme.js:23:1246540)
    at theme.js:23:1242507
    at Array.map (<anonymous>)
    at TypeDefinition.processCombinationProperties (theme.js:23:1241885)
    at new TypeDefinitionObjectProperty (theme.js:23:1241147)

Reproduction steps

  1. Create an API with the attached spec
    openapi: 3.0.1
    info:
      title: Debug
      version: '1.0'
    paths:
      '/{id}':
        get:
          summary: Get Customer
          description: Returns the customer profile.
          operationId: get-customer
          parameters:
            - name: id
              in: path
              description: Format - uuid. The customer identifier.
              required: true
              schema:
                type: string
                format: uuid
              example: 0202ea7b-550a-4a05-9313-520af0182428
          responses:
            '200':
              description: The customer profile.
              content:
                application/json:
                  schema:
                    $ref: '#/components/schemas/customer'
                  example:
                    mailingAddress:
                      type: street
                      street: 100 Street
                      city: City
                      state: NY
                      postalCode: '12345'
                      country: USA
    components:
      schemas:
        address:
          required:
            - type
          type: object
          oneOf:
            - $ref: '#/components/schemas/streetAddress'
            - $ref: '#/components/schemas/postOfficeAddress'
          properties:
            type:
              enum:
                - street
                - postOffice
              type: string
            city:
              maxLength: 128
              type: string
            state:
              maxLength: 128
              type: string
            postalCode:
              maxLength: 16
              type: string
            country:
              maxLength: 128
              type: string
          additionalProperties: false
          nullable: true
          discriminator:
            propertyName: type
            mapping:
              street: '#/components/schemas/streetAddress'
              postOffice: '#/components/schemas/postOfficeAddress'
        streetAddress:
          allOf:
            - $ref: '#/components/schemas/address'
            - required:
                - street
                - city
                - state
                - postalCode
                - country
              type: object
              properties:
                street:
                  maxLength: 128
                  type: string
                apartmentNumber:
                  maxLength: 128
                  type: string
                  nullable: true
              additionalProperties: false
        postOfficeAddress:
          allOf:
            - $ref: '#/components/schemas/address'
            - required:
                - poBox
                - city
                - state
                - postalCode
                - country
              type: object
              properties:
                poBox:
                  maxLength: 128
                  type: string
              additionalProperties: false
        customer:
          type: object
          properties:
            mailingAddress:
              $ref: '#/components/schemas/address'
          additionalProperties: false
    
  2. View the API operation in the developer portal and see that the description never loads and in the console the error

Expected behavior

The details and try it now functionality work

Is your portal managed or self-hosted?

Managed

API Management service name

See the support case for more information

Environment

  • Operating system: Windows
  • Browser: Edge
  • Version: 119.0.2151.72

Additional context

smokedlinq avatar Nov 21 '23 20:11 smokedlinq