module

Noir::GraphqlOperationParser

Parses GraphQL operation documents (query Foo { ... }, mutation Bar { ... }, subscription Baz { ... }) carried in .graphql / .gql files and emits one /graphql endpoint per named top-level operation.

SDL schema documents are handled separately by the graphql_sdl analyzer; this parser deliberately reports nothing for them.

The scan is exposed twice: parse_content builds the endpoints, and operation_document? stops at the first operation. The detector uses the predicate, so "the detector claims this file" and "the analyzer produces something from it" are the same test rather than two that can drift.

Constants

DEFAULT_GRAPHQL_PATH = "/graphql"
OPERATION_KEYWORDS = {"query", "mutation", "subscription"}

Keywords that introduce a top-level operation definition.

Instance methods

operation_document?(file_content : String) : Bool

True as soon as one named top-level operation is found. Same walk as parse_content, without building any endpoint.

Source
parse_content(path : String, file_content : String) : Array(Endpoint)
Source