Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphql-mesh is unable to properly generate types from openapi yaml file, generates JSON types instead. #3942

Closed
1 of 4 tasks
gablabelle opened this issue May 17, 2022 · 4 comments · Fixed by #4221
Closed
1 of 4 tasks
Assignees

Comments

@gablabelle
Copy link
Contributor

gablabelle commented May 17, 2022

Issue workflow progress

Progress of the issue based on the Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

Unable to properly generate types, returns JSON instead.

Maybe there is a problem with the YAML file but it seems to validate OK in online validators.

To Reproduce
Steps to reproduce the behavior:

I have setup a codesandbox here:
https://codesandbox.io/s/staging-lake-ervh5v?file=/swagger.yaml

Screen Shot 2022-05-17 at 12 05 40

Expected behavior

Graphql-mesh should generate the proper type.

Environment:

  • Packages

    "@graphql-mesh/cli": "0.70.3",
    "@graphql-mesh/openapi": "0.25.6",
    "@graphql-mesh/transform-resolvers-composition": "0.12.53",
    "graphql": "16.0.1",
    "graphql-fields": "2.0.3"

Many thanks for your time and help.

@ardatan
Copy link
Owner

ardatan commented May 17, 2022

If the type is not a certain object type, it puts an empty JSON type. Please make sure you have a correct schema type in your OpenAPI schema.

@gablabelle
Copy link
Contributor Author

If the type is not a certain object type, it puts an empty JSON type. Please make sure you have a correct schema type in your OpenAPI schema.

Not sure to understand... could you give an example of something wrong in the yaml file please?

@caribouflex
Copy link

Hello, I have the exact same issue, as @gablabelle described.
@ardatan can you give an example of what you are suggesting based on the codesandbox that was given?
Thank you.

@ardatan
Copy link
Owner

ardatan commented Aug 3, 2022

Currently we are rewriting the OpenAPI handler and releasing it as newOpenapi handler which is named as @graphql-mesh/new-openapi under NPM;
You can see the configuration schema here;
https://github.com/Urigo/graphql-mesh/blob/master/packages/handlers/new-openapi/yaml-config.graphql

We cover more cases than the old open api handler. I did more improvements and fixes based on Toto's schema you provided;
#4221

You can test it using canary versions commented in the PR until it gets released and we'd appreciate if you give us a feedback in the meanwhile :) If you have any more issues, feel free to create a new issue with a reproduciton on CodeSandbox or StackBlitz or a failing test PR :)

Thank you very much for all those information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants