graphql-tools-monorepo / 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()
]
});
Implements
Table of contents
Constructors
Methods
Constructors
constructor
• new JsonFileLoader(): JsonFileLoader
Returns
Methods
canLoad
▸ canLoad(pointer
, options
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
pointer | string |
options | JsonFileLoaderOptions |
Returns
Promise
<boolean
>
Defined in
packages/loaders/json-file/src/index.ts:55
canLoadSync
▸ canLoadSync(pointer
, options
): boolean
Parameters
Name | Type |
---|---|
pointer | string |
options | JsonFileLoaderOptions |
Returns
boolean
Defined in
packages/loaders/json-file/src/index.ts:73
handleFileContent
▸ handleFileContent(normalizedFilePath
, rawSDL
, options
): Source
Parameters
Name | Type |
---|---|
normalizedFilePath | string |
rawSDL | string |
options | JsonFileLoaderOptions |
Returns
Defined in
packages/loaders/json-file/src/index.ts:175
load
▸ load(pointer
, options
): Promise
<Source
[]>
Parameters
Name | Type |
---|---|
pointer | string |
options | JsonFileLoaderOptions |
Returns
Promise
<Source
[]>
Implementation of
Defined in
packages/loaders/json-file/src/index.ts:103
loadSync
▸ loadSync(pointer
, options
): Source
[]
Parameters
Name | Type |
---|---|
pointer | string |
options | JsonFileLoaderOptions |
Returns
Source
[]
Implementation of
Defined in
packages/loaders/json-file/src/index.ts:140
resolveGlobs
▸ resolveGlobs(glob
, options
): Promise
<string
[]>
Parameters
Name | Type |
---|---|
glob | string |
options | JsonFileLoaderOptions |
Returns
Promise
<string
[]>
Defined in
packages/loaders/json-file/src/index.ts:91
resolveGlobsSync
▸ resolveGlobsSync(glob
, options
): string
[]
Parameters
Name | Type |
---|---|
glob | string |
options | JsonFileLoaderOptions |
Returns
string
[]