[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:
toUser2:
-
name: "User"
toname: "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