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
  • #6975
Closed
Open
Issue created Jul 17, 2020 by Administrator@rootContributor

[BUG][NODEJS] graphql-nodejs-express-server with PetStore, only one type named "User"

Created by: kmturley

Description

When generating and running the PetStore demo with graphql-nodejs-express-server you get the error:

Error: There can be only one type named "User". Field "User.id" can only be defined once. Field "User.firstName" can only be defined once. Field "User.lastName" can only be defined once.

This errors and prevents the server from running.

openapi-generator version

"@openapitools/openapi-generator-cli": "^1.0.15-4.3.1"

OpenAPI declaration file content or url

Using: https://petstore.swagger.io/v2/swagger.yaml

definitions:
  User:
    type: "object"
    properties:
      id:
        type: "integer"
        format: "int64"
      username:
        type: "string"
      firstName:
        type: "string"
      lastName:
        type: "string"
      email:
        type: "string"
      password:
        type: "string"
      phone:
        type: "string"
      userStatus:
        type: "integer"
        format: "int32"
        description: "User Status"
    xml:
      name: "User"
Command line used for generation
npx @openapitools/openapi-generator-cli generate -i https://petstore.swagger.io/v2/swagger.yaml -g graphql-nodejs-express-server -o .
Steps to reproduce
npm install @openapitools/openapi-generator-cli
npx @openapitools/openapi-generator-cli generate -i https://petstore.swagger.io/v2/swagger.yaml -g graphql-nodejs-express-server -o .
cd openapi3graphql-server
npm install
npm start
Related issues/PRs

not found any similar

Suggest a fix

Changing the petstore.yaml User type to User2 fixes the issue

  • User: to User2:
  • name: "User" to name: "User2"
  • #/definitions/User to #/definitions/User2

It seems to be a conflict with the name type User is it a reserved type?

EDIT: Also just noticed it creates a subfolder openapi3graphql-server when the other generators do not

Assignee
Assign to
Time tracking