-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: type directives are now parsed on TypeComposers initialization
closes #273
- Loading branch information
Showing
7 changed files
with
102 additions
and
0 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
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
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,60 @@ | ||
/* @flow */ | ||
|
||
import { buildSchema } from 'graphql'; | ||
import { SchemaComposer, dedent } from '../..'; | ||
|
||
describe('github issue #273: Object directives are removed from schema', () => { | ||
it('should keep @test directive on TestObject', () => { | ||
const schema = buildSchema(` | ||
directive @test on OBJECT | INPUT_OBJECT | SCALAR | ENUM | ||
type ModifyMe @test { | ||
id: ID! | ||
} | ||
input Input @test { | ||
id: ID! | ||
} | ||
scalar Scalar @test | ||
enum Enum @test | ||
type Query { | ||
hello(a: Input, s: Scalar, e: Enum): ModifyMe | ||
} | ||
`); | ||
|
||
const sc = new SchemaComposer(schema); | ||
|
||
const sdl = sc.toSDL({ | ||
exclude: ['ID', 'String', 'Int', 'Boolean', 'Float'], | ||
}); | ||
|
||
expect(sdl).toBe(dedent` | ||
directive @test on OBJECT | INPUT_OBJECT | SCALAR | ENUM | ||
"""Exposes a URL that specifies the behaviour of this scalar.""" | ||
directive @specifiedBy( | ||
"""The URL that specifies the behaviour of this scalar.""" | ||
url: String! | ||
) on SCALAR | ||
enum Enum @test | ||
input Input @test { | ||
id: ID! | ||
} | ||
type ModifyMe @test { | ||
id: ID! | ||
} | ||
type Query { | ||
hello(a: Input, s: Scalar, e: Enum): ModifyMe | ||
} | ||
scalar Scalar @test | ||
`); | ||
}); | ||
}); |