Module

Prospero.Validation

Package
purescript-prospero
Repository
rowtype-yoga/purescript-prospero

#validate Source

validate :: Array ValidationRule -> Array Selection -> GqlType -> Array GraphQLError

Run all validation rules, returning GraphQL errors

#validateDepth Source

validateDepth :: Int -> ValidationRule

Validate that query depth does not exceed a maximum

#validateFieldCount Source

validateFieldCount :: Int -> ValidationRule

Validate total number of fields does not exceed a maximum

#validateComplexity Source

validateComplexity :: Int -> ValidationRule

Validate query complexity with a simple cost model (each field = 1, each list multiplier = 10)

#SelectionMetrics Source

type SelectionMetrics = { cost :: Int, depth :: Int, fieldCount :: Int }

Metrics computed in a single pass over the selection tree

#analyzeSelections Source

analyzeSelections :: GqlType -> Array Selection -> SelectionMetrics

Compute depth, field count, and cost in a single traversal