spec/graphql/schema/printer_spec.rb in graphql-0.18.15 vs spec/graphql/schema/printer_spec.rb in graphql-0.19.0
- old
+ new
@@ -11,10 +11,12 @@
choice_type = GraphQL::EnumType.define do
name "Choice"
value "FOO"
value "BAR"
+ value "BAZ", deprecation_reason: 'Use "BAR".'
+ value "WOZ", deprecation_reason: GraphQL::Directive::DEFAULT_DEPRECATION_REASON
end
sub_input_type = GraphQL::InputObjectType.define do
name "Sub"
input_field :string, types.String
@@ -44,10 +46,11 @@
field :id, !types.ID
field :title, !types.String
field :body, !types.String
field :comments, types[!comment_type]
+ field :comments_count, !types.Int, deprecation_reason: 'Use "comments".'
end
query_root = GraphQL::ObjectType.define do
name "Query"
description "The query root of this schema"
@@ -68,43 +71,60 @@
expected = <<SCHEMA
schema {
query: Query
}
+directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
+
+directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
+
+directive @deprecated(reason: String = \"No longer supported\") on FIELD_DEFINITION | ENUM_VALUE
+
type __Directive {
name: String!
description: String
- args: [__InputValue!]!
locations: [__DirectiveLocation!]!
- onOperation: Boolean!
- onFragment: Boolean!
- onField: Boolean!
+ args: [__InputValue!]!
+ onOperation: Boolean! @deprecated(reason: \"Use `locations`.\")
+ onFragment: Boolean! @deprecated(reason: \"Use `locations`.\")
+ onField: Boolean! @deprecated(reason: \"Use `locations`.\")
}
enum __DirectiveLocation {
QUERY
MUTATION
SUBSCRIPTION
FIELD
FRAGMENT_DEFINITION
FRAGMENT_SPREAD
INLINE_FRAGMENT
+ SCHEMA
+ SCALAR
+ OBJECT
+ FIELD_DEFINITION
+ ARGUMENT_DEFINITION
+ INTERFACE
+ UNION
+ ENUM
+ ENUM_VALUE
+ INPUT_OBJECT
+ INPUT_FIELD_DEFINITION
}
type __EnumValue {
name: String!
description: String
- deprecationReason: String
isDeprecated: Boolean!
+ deprecationReason: String
}
type __Field {
name: String!
description: String
+ args: [__InputValue!]!
type: __Type!
isDeprecated: Boolean!
- args: [__InputValue!]!
deprecationReason: String
}
type __InputValue {
name: String!
@@ -113,14 +133,14 @@
defaultValue: String
}
type __Schema {
types: [__Type!]!
- directives: [__Directive!]!
queryType: __Type!
mutationType: __Type
subscriptionType: __Type
+ directives: [__Directive!]!
}
type __Type {
name: String
description: String
@@ -156,10 +176,12 @@
}
enum Choice {
FOO
BAR
+ BAZ @deprecated(reason: "Use \\\"BAR\\\".")
+ WOZ @deprecated
}
type Comment implements Node {
id: ID!
}
@@ -171,9 +193,10 @@
type Post {
id: ID!
title: String!
body: String!
comments: [Comment!]
+ comments_count: Int! @deprecated(reason: \"Use \\\"comments\\\".\")
}
type Query {
post(id: ID!, varied: Varied = {id: \"123\", int: 234, float: 2.3, enum: FOO, sub: [{string: \"str\"}]}): Post
}