printSchemaDefinition method
Implementation
String? printSchemaDefinition(GraphQLSchema schema) {
if (schema.description == null && isSchemaOfCommonNames(schema)) {
return null;
}
final operationTypes = <String>[];
final queryType = schema.queryType;
if (queryType != null) {
operationTypes.add(' query: ${printTypeReference(queryType)}');
}
final mutationType = schema.mutationType;
if (mutationType != null) {
operationTypes.add(' mutation: ${printTypeReference(mutationType)}');
}
final subscriptionType = schema.subscriptionType;
if (subscriptionType != null) {
operationTypes
.add(' subscription: ${printTypeReference(subscriptionType)}');
}
return printDescription(schema.description) +
'schema {\n${operationTypes.join('\n')}\n}';
}