Skip to content

Support flattenFragments for validate command's max depth determination #2878

@n1ru4l

Description

@n1ru4l

We currently assume flattenFragments set to true for the audit command, but assume flattenFragments set to false for the validate command.

The reason for this is that the validate command was present before introducing the audit command and for some reason we re-implemented the depth count algorithm from scratch for the latter command based on the graphql-armor implementation (see graphql-armor source code).

To fix this inconsistency we should:

  1. Use the same implementation for both the audit and validate command
  2. Add a parameter for customizing how fragments should be treated (e.g. --max-depth-flattenfragments)

By default it makes more sense to have flattenFragments to be set to true as they do not really introduce depth for the execution compared to e.g. a selection set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions