OpenAPITools / OpenAPITools/openapi-generator

[BUG] graphql-schema and graphql-nodejs-express-server generate totally different graphql files

Open
#9,907 1 comment 0 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

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Example API from graphql-schema: https://github.com/OpenAPITools/openapi-generator/blob/master/samples/config/petstore/graphql-schema/petstore/api/pet_api.graphql

Example API from graphql-nodejs-express-server: https://github.com/OpenAPITools/openapi-generator/blob/master/samples/server/petstore/graphql-nodejs-express-server/petstore/api/pet_api.graphql

There are several problems of the generated result when using graphql-schema, graphql-nodejs-express-server generates the correct result:

  • Not type mutation, but type Mutation
  • @return [null] is invalid
  • # @param Pet is invalid, input and type should be seperated clearly
openapi-generator version

5.1.1

OpenAPI declaration file content or url

Provided before.

Suggest a fix
  • I think the graphql-file generation logic of graphql-nodejs-express-server can be just migrated to graphql-schema
  • Or graphql-schema can be just deprecated, then let graphql-nodejs-express-server generate only graphql files, but not the js part

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

Compare the referenced pet_api.graphql files under samples/config/petstore/graphql-schema and samples/server/petstore/graphql-nodejs-express-server. Trace the graphql-schema and graphql-nodejs-express-server generator entry points and templates, then run the relevant generator tests or petstore sample generation. Done means graphql-schema produces valid GraphQL matching the working generator’s expected mutations, return types, and input/type separation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, node.js
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.