swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

Will not generate client - specifically html

Open pambeard opened this issue 5 years ago • 2 comments

http.js:166 Uncaught (in promise) Error at http.js:166 at c (runtime.js:45) at Generator._invoke (runtime.js:274) at Generator.forEach.t. [as next] (runtime.js:97) at o (asyncToGenerator.js:5) at s (asyncToGenerator.js:27)

Q&A (please complete the following information)

  • OS: Windows
  • Browser: chrome,
  • Version: [e.g. 22]
  • Method of installation: docker image
  • Swagger-Editor version: [e.g. 3.10.0]
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Example Swagger/OpenAPI definition:


openapi: 3.0.1
info:
  title: MyTest REST API
  description: >-
    a description
  version: 2.1.0
  contact:
    name: dummy
    email: [email protected]
servers:
  - url: ''
paths:
  /v2/groups/:
    get:
      description: Provides a list of all `UserGroup` objects.
      parameters: []
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SimpleResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
      tags:
        - groups
    post:
      description: Creates a new `UserGroup` object.
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SimpleResponse'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'

components:
  schemas:
    SimpleResponse:
      type: object
      required:
        - status
        - detail
      properties:
        status:
          type: string
          enum:
            - Successful
            - Failure
          description: Status of the command
          example: Successful
        detail:
          type: string
          description: Details
          example: Reason
    

Swagger-Editor configuration options: all default, just opened the docker image

Describe the bug you're encountering

With the above yaml, click generate client html and an exception is thrown http.js:166 Uncaught (in promise) Error at http.js:166 at c (runtime.js:45) at Generator._invoke (runtime.js:274) at Generator.forEach.t. [as next] (runtime.js:97) at o (asyncToGenerator.js:5) at s (asyncToGenerator.js:27)

To reproduce...

Steps to reproduce the behavior:

  1. Open editor
  2. import file
  3. click Client Generate -> html
  4. See error

Expected behavior

Screenshots

image

Additional context or thoughts

pambeard avatar Aug 24 '20 00:08 pambeard

The problem seems to be

servers:
  - url: ''

If you remove these lines, codegen will work.

hkosova avatar Aug 24 '20 07:08 hkosova

Hi, the main readme.md seems to say codegen still doesn't work. Is that currently tru in 09/2021 ?

mgw-sbex avatar Sep 19 '21 21:09 mgw-sbex