Hi Sylvain,
I took another look at this. Pulling the entire schema with a single introspection query is possible - I found an example online which I share at the bottom. However, that results in very verbose responses and may not be practical – potentially helpful if used in conjunction with a diff command to isolate changes.
Our searching for a mechanism to return the original schema in IDL format as you request does not result in any apparent standard pattern. As previously mentioned, client-side tools are able to achieve this and I was able to successfully do it against graphman using this command:
> get-graphql-schema https://admin:7layer@localhost:8443/graphman > current_graphman.graphql
I wish there was a standard way to achieve what you want so we don’t come up with a proprietary one. I do understand the value. If you do see other graphql APIs doing something similar, please share. Our product team has been made aware of your request for consideration in the meantime.
Example introspection query for complete schema:
query IntrospectionQuery {
__schema {
queryType {
name
}
mutationType {
name
}
subscriptionType {
name
}
types {
...FullType
}
directives {
name
description
locations
args {
...InputValue
}
}
}
}
fragment FullType on __Type {
kind
name
description
fields(includeDeprecated: true) {
name
description
args {
...InputValue
}
type {
...TypeRef
}
isDeprecated
deprecationReason
}
inputFields {
...InputValue
}
interfaces {
...TypeRef
}
enumValues(includeDeprecated: true) {
name
description
isDeprecated
deprecationReason
}
possibleTypes {
...TypeRef
}
}
fragment InputValue on __InputValue {
name
description
type {
...TypeRef
}
defaultValue
}
fragment TypeRef on __Type {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
}
}
}
}
}
}
}
}