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()
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:49 (opens in a new tab)
canLoadSync
▸ canLoadSync(pointer
, options
): boolean
Parameters
Name | Type |
---|---|
pointer | string |
options | JsonFileLoaderOptions |
Returns
boolean
Defined in
packages/loaders/json-file/src/index.ts:65 (opens in a new tab)
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:161 (opens in a new tab)
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:93 (opens in a new tab)
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:128 (opens in a new tab)
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:81 (opens in a new tab)
resolveGlobsSync
▸ resolveGlobsSync(glob
, options
): string
[]
Parameters
Name | Type |
---|---|
glob | string |
options | JsonFileLoaderOptions |
Returns
string
[]
Defined in
packages/loaders/json-file/src/index.ts:87 (opens in a new tab)