Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #6015
Closed
Open
Issue created Apr 22, 2020 by Administrator@rootContributor5 of 5 checklist items completed5/5 checklist items

[BUG] [javascript-flowtyped] Array alias is not generated properly in oneOf

Created by: thSoft

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
Description

If an alternative of oneOf is an array type, the generated Array type will miss a required type argument.

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/Response'
components:
  responses:
    Response:
      description: response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Record'
  schemas:
    Record:
      properties:
        property:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/Element'
              - $ref: '#/components/schemas/List'
    Element:
      properties:
        foo:
          type: integer
          format: int64
          example: 1
    List:
      type: array
      items:
        type: string
Command line used for generation

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

Steps to reproduce
  • Generate code with the above command line
  • Check the generated code with flow check bug
  • You get
Cannot use type without exactly 1 type argument.

     93│      * @type {Array<Element | Array>}
     94│      * @memberof Record
     95│      */
     96│     property?: Array<Element | Array>;
     97│ }
     98│
     99│

because Array requires a type argument.

Related issues/PRs

I found none.

Assignee
Assign to
Time tracking