Skip to content

[BUG] html2 generator JS error: "Cannot read property '$ref' of undefined" #2427

Open
@quinncomendant

Description

@quinncomendant
Description

The HTML output by the html2 generator gives this error when run in Chrome:

index.html:11 Uncaught TypeError: Cannot read property '$ref' of undefined
at HTMLDocument.<anonymous> (index.html:1288)
openapi-generator version

4.0.0-SNAPSHOT

OpenAPI declaration file content or url

The below yaml is valid as per:

[q@local] docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli validate -i /local/api.yaml
Validating spec (/local/api.yaml)
No validation issues detected.
openapi: 3.0.0
info:
  title: Anchor-ResMan adaptor
  description: A RESTful API for retrieval of property data cached by the Anchor-ResMan adapter background service.
  version: "1.0.0"
servers:
  - description: SwaggerHub API Auto Mocking
    url: https://virtserver.swaggerhub.com/strangecode/AnchorNW/1.0.0
paths:
  /properties:
    get:
      summary: get a list of properties
      operationId: searchProperties
      description: |
        Get a list of all properties, filtered by search criteria.
      parameters:
        - in: query
          name: searchString
          description: pass an optional search string for looking up inventory
          required: false
          schema:
            type: string
        - in: query
          name: skip
          description: number of records to skip for pagination
          schema:
            type: integer
            format: int32
            minimum: 0
        - in: query
          name: limit
          description: maximum number of records to return
          schema:
            type: integer
            format: int32
            minimum: 0
            maximum: 50
      responses:
        '200':
          description: properties results matching criteria
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Property'
        '400':
          description: bad input parameter
components:
  schemas:
    Property:
      type: object
      properties:
        propertyID:
          type: string
          format: uuid
          example: '31ed6cca-b03a-4fbd-a65f-0e8c5e578e34'
        name:
          type: string
          example: 'x UDG Everett LLC'
        streetAddress:
          type: string
          example: '316 NE 28th Avenue'
        city:
          type: string
          example: 'Portland'
        state:
          type: string
          example: 'OR'
        zip:
          type: string
          example: '97232'
        phone:
          type: string
          example: '(503) 726-7220'
        email:
          type: string
          example: '[email protected]'
        manager:
          type: string
          example: 'Mylisa Giroski'
        currentPeriodStart:
          type: string
          format: date
          example: '2019-01-01'
        currentPeriodEnd:
          type: string
          format: date
          example: '2019-01-31'
Command line used for generation
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -g html2 -i /local/api.yaml -o /local
Steps to reproduce
  1. Generate html2 from the above YAML file.
  2. Open in Chrome
  3. See the errors in Chrome DevTools

Screen Shot 2019-03-16 at 13 32 10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions