OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.63k stars 6.53k forks source link

[BUG] [javascript-flowtyped] Add Error to language primitives #6012

Open thSoft opened 4 years ago

thSoft commented 4 years ago

Bug Report Checklist

Description

When there is a type named Error in the specification, the generator generates code that does not typecheck.

openapi-generator version

4.3.0

OpenAPI declaration file content or url
openapi: '3.0.0'
info:
  version: 0.0.0
  title: Bug
paths:
  /bug:
    get:
      responses:
        default:
          $ref: '#/components/responses/UnexpectedError'
components:
  responses:
    UnexpectedError:
      description: unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      properties:
        code:
          type: integer
          format: int32
          example: 500
Command line used for generation

openapi-generator generate -i bug.yaml -g javascript-flowtyped -o bug/

Steps to reproduce
Related issues/PRs

I found none.

Suggest a fix

Reject the specification if it contains a type named Error.

auto-labeler[bot] commented 4 years ago

👍 Thanks for opening this issue! 🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.