question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot process schema $ref Cannot identify type of schema.

See original GitHub issue

I’m trying to use createGraphQlSchema as described in documentation but getting this error related to local references:

(node:252) UnhandledPromiseRejectionWarning: Error: Cannot process schema '{"$ref":"#/components/schemas/Id_2"}'. Cannot identify type of schema.
    at createDataDef (D:\Projects\graphql\node_modules\openapi-to-graphql\lib\preprocessor.js:436:19)
...

How can i fix this issue? Why it cannot process local references?

Here is parts of my JSON spec where i use references:

// openapi.json
...
    "order_id" : {
              "$ref" : "#/components/schemas/Id_2"
            },
...
"components" : {
    "schemas" : {
...
        "Id_2" : {
            "type" : "string",
            "description" : "Unique order identifier.",
            "example" : "bcc669fa-ef1f-429b-8dea-1bf5ac78f457"
          },
...
    }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sbrincommented, Oct 21, 2019

Thank you for your support. It was just a short part of my OAS. You’re right: after fixing my mistakes it works fine. But i still have schemaValidate exception when i’m trying to process full version of OAS (which is strange because it was generated from working YAML spec using openapi-generator).

I guess we can close this issue. Thank you for your support.

1reaction
Alan-Chacommented, Oct 17, 2019

After correcting the references and removing the missing ones, I was able to generate a working GraphQL interface.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Impossible to translate Stripe open api in graphql #284 - GitHub
It seems to don't work because the package cannot identify type of schema. It seems to come with "anyOf" and "oneOf" words. Error:...
Read more >
Unable to ref to another schema: Cannot resolve the name 'xs ...
java - Unable to ref to another schema: Cannot resolve the name 'xs:schema' to a(n) 'element declaration' component - Stack Overflow. Stack ...
Read more >
Understanding schema errors | HESA
Schema errors prevent the validation being run in full because the file cannot be read. This means that errors cannot be traced to...
Read more >
Why isn't my $ref working? - Using JSON Schema
Verify the “$ref” URI is formatted correctly, and the content is an exact match to the resource URI (no extraneous spaces or other...
Read more >
Errors occurred while compiling the XML schemas in the project
If no error is identified in your XSD schema, the XML compiler may not have enough information to provide a detailed error message....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found