Skip to content

Commit c5993ca

Browse files
committed
Fix printing object type definitions
Directives come after the implemented interfaces. See https://github.com/graphql/graphql-js/blob/360fa06e43fed32b63fba99b353515e7b56eee20/src/language/printer.js#L117-L129 for the canonical printer.
1 parent c43198d commit c5993ca

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/graphql/language/printer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ def print_scalar_type_definition(scalar_type)
154154
def print_object_type_definition(object_type)
155155
out = print_description(object_type)
156156
out << "type #{object_type.name}"
157-
out << print_directives(object_type.directives)
158157
out << " implements " << object_type.interfaces.map(&:name).join(", ") unless object_type.interfaces.empty?
158+
out << print_directives(object_type.directives)
159159
out << print_field_definitions(object_type.fields)
160160
end
161161

spec/graphql/language/printer_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
end
106106

107107
describe "full featured schema" do
108-
# From: https://github.com/graphql/graphql-js/blob/bc96406ab44453a120da25a0bd6e2b0237119ddf/src/language/__tests__/schema-kitchen-sink.graphql
108+
# Based on: https://github.com/graphql/graphql-js/blob/bc96406ab44453a120da25a0bd6e2b0237119ddf/src/language/__tests__/schema-kitchen-sink.graphql
109109
let(:query_string) {<<-schema
110110
schema {
111111
query: QueryType
@@ -128,7 +128,7 @@
128128
# Scalar description
129129
scalar CustomScalar
130130
131-
type AnnotatedObject @onObject(arg: "value") {
131+
type AnnotatedObject implements Bar @onObject(arg: "value") {
132132
annotatedField(arg: Type = "default" @onArg): Type @onField
133133
}
134134

0 commit comments

Comments
 (0)