Docs
Launch GraphOS Studio
You're viewing documentation for a previous version of this software. Switch to the latest stable version.


CLASS

ApolloCodegenFrontend

public final class ApolloCodegenFrontend

Methods

init()

public init() throws

loadSchema(from:)

public func loadSchema(from fileURL: URL) throws -> GraphQLSchema

Load a schema by parsing either an result or based on the file extension.

loadSchemaFromIntrospectionResult(_:)

public func loadSchemaFromIntrospectionResult(_ introspectionResult: String) throws -> GraphQLSchema

Load a schema by parsing an introspection result.

loadSchemaFromSDL(_:)

public func loadSchemaFromSDL(_ source: GraphQLSource) throws -> GraphQLSchema

Load a schema by parsing SDL.

printSchemaAsSDL(schema:)

public func printSchemaAsSDL(schema: GraphQLSchema) throws -> String

Take a loaded GQL schema and print it as SDL.

makeSource(_:filePath:)

public func makeSource(_ body: String, filePath: String) throws -> GraphQLSource

Create a GraphQLSource object from a string.

makeSource(from:)

public func makeSource(from fileURL: URL) throws -> GraphQLSource

Create a GraphQLSource object by reading from a file.

parseDocument(_:)

public func parseDocument(_ source: GraphQLSource) throws -> GraphQLDocument

Parses a from a source, returning a reference to the parsed AST that can be passed on to validation and compilation. Syntax errors will result in throwing a GraphQLError.

parseDocument(from:)

public func parseDocument(from fileURL: URL) throws -> GraphQLDocument

Parses a GraphQL document from a file, returning a reference to the parsed AST that can be passed on to validation and compilation. Syntax errors will result in throwing a GraphQLError.

mergeDocuments(_:)

public func mergeDocuments(_ documents: [GraphQLDocument]) throws -> GraphQLDocument

Validation and compilation take a single document, but you can merge documents, and and will remember their source.

validateDocument(schema:document:)

public func validateDocument(schema: GraphQLSchema, document: GraphQLDocument) throws -> [GraphQLError]

Validate a GraphQL document and return any validation errors as GraphQLErrors.

compile(schema:document:)

public func compile(schema: GraphQLSchema, document: GraphQLDocument) throws -> CompilationResult

Compiles a GraphQL document into an intermediate representation that is more suitable for analysis and code generation.

Next
Introduction
Edit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc.

Privacy Policy

Company