module Noir::GraphqlOperationParser

Overview

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.

Extended Modules

Defined in:

miniparsers/graphql_operation_parser.cr

Constant Summary

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

Keywords that introduce a top-level operation definition.

Instance Method Summary

Instance Method Detail

def 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.


[View source]
def parse_content(path : String, file_content : String) : Array(Endpoint) #

[View source]