prisma-labs / get-graphql-schema

Fetch and print the GraphQL schema from a GraphQL HTTP endpoint. (Can be used for Relay Modern.)
669 stars 62 forks source link

Does this tool support for Mac M1? #75

Closed lexuanquynh closed 1 year ago

lexuanquynh commented 1 year ago

I'm try using:

npm install -g get-graphql-schema

and succefully. But I can't use this tool in my Mac M1.

 command not found: get-graphql-schema

Does this tool support for Mac M1? Thanks.

turboflo commented 1 year ago

Try nvm install v15 before installing get-graphql-schema, it worked for me.

madabhaviamit commented 1 year ago

I am facing same issue, Tried with nvm install v15, It did not resolve @turboflo

@lexuanquynh, were you able to solve this issue?

Hyferion commented 1 year ago

Same issue on my m2

lexuanquynh commented 1 year ago

@madabhaviamit this is my solution:

Download the schema.

  1. Install get-graphql-schema with the command:
    npm install -g get-graphql-schema

If you are using Macbook silicon, make sure apollo-cli is not installed. If it exists, remove it with the command:

brew uninstall apollo-cli
  1. Download the schema from the backend Apollo website.

The schema must be download with the command:

get-graphql-schema https:/<your_backend>/api/v1/graphql --json > schema.json

After executing this command, you will see the schema.json file. This file is used to generate graphQL queries in the iOS project.

Writing the graphQL query.

For more information on how to write GraphQL scripts, please visit this [website](https://graphql.org/graphql-js/). You need to include the file in your iOS project. You have to create the Apollo build phase like as this image: ![image](https://github.com/prisma-labs/get-graphql-schema/assets/17588791/91b3a9c3-10d1-43a8-83da-ab681cb49d62) The reason it is commented out is because the API file was created from this build phase. You will need to uncomment this line the first time you build. The API file will automatically generate and you don't need change this file. For more information, please [click here.](https://www.apollographql.com/docs/ios/v0-legacy/installation) All done. Enjoy coding.
lexuanquynh commented 1 year ago

@madabhaviamit @Hyferion Sorry I missed the notification from Github.

trupeshv commented 1 year ago

@lexuanquynh you can use npx as prefix and then try once. Like.. npx get-graphql-schema -H "x-hasura-admin-secret:[ADMIN-SECRET-KEY]" [END-POINT] --introspect > lib/schema.graphql