OpenAPITools / OpenAPITools/openapi-generator

[BUG] [Online Generator] silently fails and seemingly does nothing when spec uploaded

Open
#7,075 0 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Steps to reproduce

  1. Go to the online generator (stable or master, same on both)
  2. Upload any valid json spec

Expected behavior

Something on the page should change.

If the spec is invalid, it should say so. (It does if you try to upload a yaml spec.)

If the spec is valid, I should get a download popup, or a link saying "click here to generate", or something, anything.

Actual behavior

Nothing happens that the user can see.

In the console there's an error.

There was an issue while parsing the spec  TypeError: (intermediate value).source is undefined
    t http://api.openapi-generator.tech/rapidoc-min.js:181
    _n http://api.openapi-generator.tech/rapidoc-min.js:181
    s http://api.openapi-generator.tech/rapidoc-min.js:181
  rapidoc-min.js:181:67459
 Spec Conversion - Success !!! rapidoc-min.js:181:67544
Unable to resolve the API spec.. a is undefined rapidoc-min.js:181:81881
    loadSpec http://api.openapi-generator.tech/rapidoc-min.js:181

Note that the logs say "Success", immediately after saying failure. So it looks like the error isn't caught properly.

Screen Shot 2020-07-30 at 8 49 07 am

Example spec

{
  "swagger": "2.0",
  "info": {
    "description": "API for demonstrating unit test bug",
    "version": "1.0.0",
    "title": "MWE"
  },
  "host": "example.com",
  "basePath": "/v1",
  "schemes": [
    "http"
  ],
  "paths": {
    "/example": {
      "post": {
        "description": "sample call",
        "operationId": "sample_post",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "201": {
            "description": "pending",
            "schema": {
              "$ref": "#/definitions/example-post-response"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "example-post-response": {
      "type": "object",
      "required": [
        "user"
      ],
      "properties": {
        "user": {
          "type": "string",
          "example": "User A",
          "description": "The user who initiated the request",
          "enum": [
            "User B",
            "User A"
          ]
        }
      }
    }
  }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the online generator and reproduce the upload with the example JSON while inspecting the browser console and rapidoc-min.js:181. Trace the parsing and spec-loading failure from the reported stack. Done means valid JSON produces visible generation feedback, while invalid input reports an error without contradictory success logging.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.