Skip to content

GraphQLParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/parsers/api-schema/graphql.parser.ts

GraphQL Parser Implementation

Supports:

  • GraphQL Schema Definition Language (SDL)
  • Queries, Mutations, Subscriptions
  • Object Types, Input Types, Enums, Interfaces, Unions
  • Directives and field arguments

Implements: IParser

Methods

MethodSignatureReturns
initializeinitialize(_config: ParserConfig)Promise<void>
canParsecanParse(filePath: string)boolean
parseFileparseFile(filePath: string, content: string)Promise<ParseResult>
parseFilesparseFiles(files: ParseFileInput[])Promise<ParseResult[]>
destroydestroy()Promise<void>

Properties

PropertyType
nameany
versionany
supportedPatternsany

Where it refuses work

  • GraphQLParser stops the work with an early return when type instanceof GraphQLNonNull, in 3 places.
  • GraphQLParser stops the work with an early return when type instanceof GraphQLList, in 2 places.
  • GraphQLParser stops the work with an early return when typeName.startsWith('__').
  • GraphQLParser stops the work with an early return when ['Query', 'Mutation', 'Subscription'].includes(typeName).

When something fails

  • GraphQLParser handles failure in 1 place: it turns it into a return value in all 1.

Was this page helpful?

Download as PDF