Skip to content

Commit

Permalink
Tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
dondonz committed May 1, 2024
1 parent ae47bd1 commit 32c87b5
Showing 1 changed file with 0 additions and 98 deletions.
98 changes: 0 additions & 98 deletions src/test/groovy/graphql/schema/idl/SchemaPrinterTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,6 @@ type Query {
GraphQLSchema schema = new SchemaGenerator().makeExecutableSchema(options, types, runtimeWiring)

def printOptions = defaultOptions()
.includeScalarTypes(true)
.useAstDefinitions(true)
.includeSchemaDefinition(true)
def result = new SchemaPrinter(printOptions).print(schema)
Expand Down Expand Up @@ -1478,7 +1477,6 @@ type MySubscription {
GraphQLSchema schema = new SchemaGenerator().makeExecutableSchema(options, types, runtimeWiring)

def printOptions = defaultOptions()
.includeScalarTypes(true)
.useAstDefinitions(false)
.includeSchemaDefinition(true)
def result = new SchemaPrinter(printOptions).print(schema)
Expand Down Expand Up @@ -1529,102 +1527,6 @@ type MyQuery {
'''
}

def "can parse and print extend schema description"() {
// DZ TODO: this is failing at the moment
def sdl = '''
directive @schemaDirective on SCHEMA
"""
My schema block description
"""
schema {
mutation: MyMutation
}
"""
My extend schema description
"""
extend schema @schemaDirective {
query: MyQuery
}
type MyQuery {
foo: String
}
type MyMutation {
pizza: String
}
'''

when:
def runtimeWiring = newRuntimeWiring().build()

def options = SchemaGenerator.Options.defaultOptions()
def types = new SchemaParser().parse(sdl)
GraphQLSchema schema = new SchemaGenerator().makeExecutableSchema(options, types, runtimeWiring)

def printOptions = defaultOptions()
.includeScalarTypes(true)
.useAstDefinitions(true)
.includeSchemaDefinition(true)
def result = new SchemaPrinter(printOptions).print(schema)

then:
result == '''"""
My schema block description
"""
schema {
mutation: MyMutation
}
"""
My extend schema description
"""
extend schema @schemaDirective {
query: MyQuery
}
"Marks the field, argument, input field or enum value as deprecated"
directive @deprecated(
"The reason for the deprecation"
reason: String = "No longer supported"
) on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION
"Directs the executor to include this field or fragment only when the `if` argument is true"
directive @include(
"Included when true."
if: Boolean!
) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
"Indicates an Input Object is a OneOf Input Object."
directive @oneOf on INPUT_OBJECT
directive @schemaDirective on SCHEMA
"Directs the executor to skip this field or fragment when the `if` argument is true."
directive @skip(
"Skipped when true."
if: Boolean!
) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
"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
type MyMutation {
pizza: String
}
type MyQuery {
foo: String
}
'''
}


def "can print a schema as AST elements"() {
def sdl = '''
directive @directive1 on SCALAR
Expand Down

0 comments on commit 32c87b5

Please sign in to comment.