-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add benchmarks for GQL and SDL validation (#1471)
- Loading branch information
1 parent
afe6d34
commit f68e8e2
Showing
9 changed files
with
59 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { join } from 'path'; | ||
import { readFileSync } from 'fs'; | ||
|
||
function readLocalFile(filename) { | ||
return readFileSync(join(__dirname, filename), 'utf8'); | ||
} | ||
|
||
export const bigSchemaSDL = readLocalFile('github-schema.graphql'); | ||
export const bigSchemaIntrospectionResult = JSON.parse( | ||
readLocalFile('github-schema.json'), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Copyright (c) 2018-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import { bigSchemaSDL } from '../../__fixtures__'; | ||
|
||
import { parse, getIntrospectionQuery, buildSchema } from '../../'; | ||
import { validate } from '../validate'; | ||
|
||
const schema = buildSchema(bigSchemaSDL, { assumeValid: true }); | ||
const queryAST = parse(getIntrospectionQuery()); | ||
|
||
export const name = 'Validate Introspection Query'; | ||
export function measure() { | ||
validate(schema, queryAST); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Copyright (c) 2018-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import { bigSchemaSDL } from '../../__fixtures__'; | ||
|
||
import { parse } from '../../'; | ||
import { validateSDL } from '../validate'; | ||
|
||
const sdlAST = parse(bigSchemaSDL); | ||
|
||
export const name = 'Validate SDL Document'; | ||
export function measure() { | ||
validateSDL(sdlAST); | ||
} |