Package graphql.language
Class AstSignature
java.lang.Object
graphql.language.AstSignature
This will produce signature and privacy safe query documents that can be used for query categorisation and logging.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivacySafeQuery
(Document document, String operationName) This can produce a "privacy safe" AST that some what conforms to the algorithm as outlined here which removes excess operations, removes any field aliases, hides some literal values and sorts the result.signatureQuery
(Document document, String operationName) This can produce a "signature" canonical AST that conforms to the algorithm as outlined here which removes excess operations, removes any field aliases, hides literal values and sorts the result into a canonical query.
-
Constructor Details
-
AstSignature
public AstSignature()
-
-
Method Details
-
signatureQuery
This can produce a "signature" canonical AST that conforms to the algorithm as outlined here which removes excess operations, removes any field aliases, hides literal values and sorts the result into a canonical query. A signature says two queries with the same signature can be thought of as the same query. For example a tracing system will want a canonical signature for queries to group them.- Parameters:
document
- the document to make a signature query fromoperationName
- the name of the operation to do it for (since only one query can be run at a time)- Returns:
- the signature query in document form
-
privacySafeQuery
This can produce a "privacy safe" AST that some what conforms to the algorithm as outlined here which removes excess operations, removes any field aliases, hides some literal values and sorts the result. This is not a signature. For example object literal structures are retained like `{ a : "", b : 0}` which means you can infer what was asked for but not what the values are. This differs fromsignatureQuery(Document, String)
which collapses literals to create more canonical signatures. A privacy safe Query is useful for logging say to show what shapes was asked for without revealing what data was provided- Parameters:
document
- the document to make a privacy safe query fromoperationName
- the name of the operation to do it for (since only one query can be run at a time)- Returns:
- the privacy safe query in document form
-