Audit your documents for useful metrics such as query depth, directive count and alias count. This
is useful if you want to introduce security rules on your GraphQL server (e.g. via
graphql-armor (opens in a new tab)) and need to figure out the
values for doing so.
Run the following command:
graphql-inspector audit DOCUMENTS
graphql-inspector audit './documents/*.graphql'
DOCUMENTS- a glob pattern that points to GraphQL Documents / Operations
-d, --detail- Print statistics for each single GraphQL operation (default:
--complexityScalarCost- The cost of a scalar field for calculating the complexity score (default:
--complexityObjectCost- The cost of an object field for calculating the complexity score (default:
--complexityDepthCostFactor- The cost factor of a field per depth level for calculating the complexity score (default:
A list of metrics including the maximum depth limit, maximum alias count and maximum directive count.
This process does not fail, as it is mainly for showing useful information. In case you want to
enforce a certain query deth, directive count or alias count limit check the
--maxDirectiveCount flags in the Validate Documents