RegistryGenerator

Generates a GeneratedGraphQLRegistry Kotlin object that implements GraphQLDocumentRegistry. Maps operation names to their documents and hashes.

Example output:

public object GeneratedGraphQLRegistry : GraphQLDocumentRegistry {
override fun document(operationName: String): String? =
when (operationName) {
GraphQLOperations.Query.GetCurrentUser -> GraphQLDocuments.GetCurrentUser
GraphQLOperations.Query.GetMarketPlaceApps -> GraphQLDocuments.GetMarketPlaceApps
else -> null
}

override fun hash(operationName: String): String? =
when (operationName) {
GraphQLOperations.Query.GetCurrentUser -> GraphQLHashes.GetCurrentUser
GraphQLOperations.Query.GetMarketPlaceApps -> GraphQLHashes.GetMarketPlaceApps
else -> null
}
}

Functions

Link copied to clipboard
fun generate(operations: List<GraphQLOperationInfo>, packageName: String): FileSpec