Error: Cannot process schema $ref Cannot identify type of schema.
See original GitHub issueI’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:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
After correcting the references and removing the missing ones, I was able to generate a working GraphQL interface.