Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 370b3ff

Browse files
author
Mark
committed
Throws error for .json schemas - which are unsupported.
1 parent 5162d3a commit 370b3ff

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphql-cli-generate-fragments",
3-
"version": "1.1.2",
3+
"version": "1.1.4",
44
"description": "Plugin for graphql-cli to generate fragments",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",

‎src/GenerateFragments.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,12 +455,22 @@ ${fragment}`
455455
}
456456
}
457457

458+
console.log(schemaPath)
459+
460+
461+
const getExtension = str => str.split('.').pop()
462+
463+
if(getExtension(schemaPath) !== 'graphql' && getExtension(schemaPath) !== 'gql'){
464+
throw new Error(`Schema has an extension of '.${getExtension(schemaPath)}'
465+
- Only '.graphql' schema's are supported by 'generate-fragments'.`)
466+
}
467+
458468
if (fs.existsSync(schemaPath!)) {
459469
return schemaPath!;
460470
} else {
461471
throw new Error(
462472
`Schema '${schemaPath!}' not found.${
463-
bundleDefined ? " Did you run bundle first?" : ""
473+
bundleDefined ? " Did you run bundle/get-schema first?" : ""
464474
}`
465475
);
466476
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /