Example, retrieve the arguments of the types (User...
# orm-help
d
Example, retrieve the arguments of the types (UserInput, ...)
h
You can use some like tsdoc. But we already document the graphql schema very well so anyone can understand the schema using graphql-playgorund
d
Yes, you're right, but it's not the documentation for the developer but for the end user. 🙂 Example: The user requests "@Bot help createUser" The answer : "@Bot Hello createUser <FirstName> <LastName> <email> <company> " And in the backend, it's translated `` ` prisma.createUser (data: {firstname, lastname, email, company}) `` ` Prisma has already created everything (interfaces, schema), it would be a shame to recreate the same model above. 🙂 That's why I'm trying to interpret the schema to deduce the arguments of the command
The "simplest" solution I've found, at the moment, is to make an introspectionQuery gql query on the backend
it seems less complicated than starting TS interfaces
h
Yes that would be easiest and most reliable way. We also use introspection query in graphql-playground to generate schema docs
you can refer the implementation there if you want
d
Ok, that reassures me. thanks for taking the time to respond
d
Too bad there is no query __Field (name: "") 🙂
h
you can the field name using
__typename
it is in the graphql spec but I guess that will be not as useful for you
d
Ha, prisma also uses apollo tools? 🙂
h
yes, apollo for frontend stuff and as a graphql client. We don't reinvent things that doesn't need to be reinvented 🙂
so you can use a introspectionQuery from graphql. Then use buildClientSchema to convert that introspection to a graphql schema and then use parse or print from graphql according to your usecase
d
Hey, buildClientSchema is exactly what I needed !