instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.58k stars 2.48k forks source link

Missing schema.graphql file #2161

Open pambrose opened 1 year ago

pambrose commented 1 year ago

Summary:

Please add a schema.graphql file to the repo—or at least point people toward how to create it. It seems odd to make a graphql endpoint available and not have any mention of its schema.

I tried to get it by using introspection on the Canvas graphql endpoint, but the results were incomplete.

Thanks, Paul

pambrose commented 1 year ago

Can I please get someone from Instructure to respond to this?

HexaCubist commented 1 year ago

Kia ora @pambrose - if this is helpful, the GraphQL Schema file seems to have been removed at some point in favour of generating it at build time. My way of interfacing with Canvas's GraphQL API is through GraphQL Code Generator, which can automatically add type hinting and validation to your code.

For exploring the schema, I use the GraphiQL interface (append "/graphiql" to your canvas domain). I believe this uses introspection queries in the same was as the code generator and works great.

Hope this helps!

pambrose commented 1 year ago

The answer to my questions is: 1) clone the canvas repo 2) install all the required ruby stuff on your machine 3) run the command bundle exec rails graphql:schema

That generates a schema.graphql file.

I do not know why Instructure makes this so difficult. When querying for the schema, this is what the answer should look like: https://docs.github.com/en/graphql/overview/public-schema