loaders_json_file_src.jsonfileloader

Class: JsonFileLoader#

loaders/json-file/src.JsonFileLoader

This loader loads documents and type definitions from JSON files.

The JSON file can be the result of an introspection query made against a schema:

const schema = await loadSchema('schema-introspection.json', {
loaders: [
new JsonFileLoader()
]
});

Or it can be a DocumentNode object representing a GraphQL document or type definitions:

const documents = await loadDocuments('queries/*.json', {
loaders: [
new GraphQLFileLoader()
]
});

Hierarchy#

  • JsonFileLoader

Implements#

Table of contents#

Constructors#

Methods#

Constructors#

constructor#

+ new JsonFileLoader(): JsonFileLoader

Returns: JsonFileLoader

Methods#

canLoad#

canLoad(pointer: string, options: JsonFileLoaderOptions): Promise<boolean\>

Parameters:#

NameType
pointerstring
optionsJsonFileLoaderOptions

Returns: Promise<boolean\>

Defined in: packages/loaders/json-file/src/index.ts:50


canLoadSync#

canLoadSync(pointer: string, options: JsonFileLoaderOptions): boolean

Parameters:#

NameType
pointerstring
optionsJsonFileLoaderOptions

Returns: boolean

Defined in: packages/loaders/json-file/src/index.ts:66


load#

load(pointer: string, options: JsonFileLoaderOptions): Promise<Source\>

Parameters:#

NameType
pointerstring
optionsJsonFileLoaderOptions

Returns: Promise<Source\>

Defined in: packages/loaders/json-file/src/index.ts:83


loadSync#

loadSync(pointer: string, options: JsonFileLoaderOptions): Source

Parameters:#

NameType
pointerstring
optionsJsonFileLoaderOptions

Returns: Source

Defined in: packages/loaders/json-file/src/index.ts:94


loaderId#

loaderId(): string

Returns: string

Defined in: packages/loaders/json-file/src/index.ts:46