Escape-Technologies / graphman

Quikly scaffold a postman collection for a GraphQL API. Compatible with Postman & Insomnia.
MIT License
240 stars 12 forks source link

Error: Query type not found #8

Closed julienFlexsoft closed 1 year ago

julienFlexsoft commented 1 year ago

I get this error when running the command:

error: Uncaught (in promise) Error: Query type not found
  if (!queryType) throw new Error("Query type not found");
                        ^
    at createPostmanCollection (https://raw.githubusercontent.com/Escape-Technologies/graphman/main/src/lib.ts:296:25)
    at async https://raw.githubusercontent.com/Escape-Technologies/graphman/main/src/index.ts:23:20

Maybe it is because the type of my query is called "MyAppQuery" instead of "Query"? (same thing for mutations). This is allowed by the GraphQL spec.

In the introspection query this is indicated by this:

{
    "_queryType": "MyAppQuery",
    "_mutationType": "MyAppMutation"
    ...
}
julienFlexsoft commented 1 year ago

I can confirm that this is the cause of the error. I ran it locally and it works after changing the name to "MyAppQuery" and "MyAppMutation".

nohehf commented 1 year ago

Yes, for now, Graphman only supports default query and mutation names. However, this is a relatively easy fix. I don't know if I'll have time to fix it now, but I'll tag it as "good first issue", feel free to open an mr. By the way, we are currently working on an open source shared GraphQL introspection parser that GraphMan will depend on, solving this issue (as well as others).

nohehf commented 1 year ago

Hey @julienFlexsoft, I'm fixing it, could you give me your API endpoint URL so that I can test it? Cant find public APIs with non standard query and mutation type names

julienFlexsoft commented 1 year ago

Yes, this is the URL: [Redacted since it is fixed]

You'll see in the schema:

[Redacted since it is fixed]