Skip to content

Commit

Permalink
implement test
Browse files Browse the repository at this point in the history
  • Loading branch information
vhatsura committed Apr 9, 2022
1 parent 40ea669 commit 913706a
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,42 @@ private void Executable_Directives_Are_Never_Removed_2()
.Resolve("test"))
.AddDirectiveType(new DirectiveType(d => d
.Name("_abc")
.Location(DirectiveLocation.Object| DirectiveLocation.Query)))
.Location(DirectiveLocation.Object | DirectiveLocation.Query)))
.AddType<FloatType>()
.ModifyOptions(o => o.RemoveUnreachableTypes = true)
.Create();

// assert
schema.ToString().MatchSnapshot();
}

[Fact]
private void Executable_Directives_Should_Be_Visited()
{
// arrange
// act
ISchema schema = SchemaBuilder.New()
.AddQueryType(c => c
.Name("abc")
.Field("field")
.Type(new NamedTypeNode("def"))
.Resolve("test"))
.AddInterfaceType(c => c
.Name("def")
.Field("field")
.Type<StringType>())
.AddObjectType(c => c
.Name("ghi")
.Implements(new NamedTypeNode("def"))
.Field("field")
.Type<StringType>()
.Resolve("test"))
.AddType(new UuidType('D'))
.AddDirectiveType(new DirectiveType(d => d
.Name("_abc")
.Location(DirectiveLocation.Object | DirectiveLocation.Query)
.Argument("arg")
.Type<UuidType>()))
.AddType<FloatType>()
.ModifyOptions(o => o.RemoveUnreachableTypes = true)
.Create();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
schema {
query: abc
}

interface def {
field: String
}

type abc {
field: def
}

type ghi implements def {
field: String
}

directive @_abc(arg: UUID) on QUERY | OBJECT

"The `@defer` directive may be provided for fragment spreads and inline fragments to inform the executor to delay the execution of the current fragment to indicate deprioritization of the current fragment. A query with `@defer` directive will cause the request to potentially return multiple responses, where non-deferred data is delivered in the initial response and data deferred is delivered in a subsequent response. `@include` and `@skip` take precedence over `@defer`."
directive @defer("If this argument label has a value other than null, it will be passed on to the result of this defer directive. This label is intended to give client applications a way to identify to which fragment a deferred result belongs to." label: String "Deferred when true." if: Boolean) on FRAGMENT_SPREAD | INLINE_FRAGMENT

"The `@specifiedBy` directive is used within the type system definition language to provide a URL for specifying the behavior of custom scalar definitions."
directive @specifiedBy("The specifiedBy URL points to a human-readable specification. This field will only read a result for scalar types." url: String!) on SCALAR

"The `@stream` directive may be provided for a field of `List` type so that the backend can leverage technology such as asynchronous iterators to provide a partial list in the initial response, and additional list items in subsequent responses. `@include` and `@skip` take precedence over `@stream`."
directive @stream("If this argument label has a value other than null, it will be passed on to the result of this stream directive. This label is intended to give client applications a way to identify to which fragment a streamed result belongs to." label: String "The initial elements that shall be send down to the consumer." initialCount: Int! = 0 "Streamed when true." if: Boolean) on FIELD

scalar UUID @specifiedBy(url: "https:\/\/tools.ietf.org\/html\/rfc4122")

0 comments on commit 913706a

Please sign in to comment.