Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix printing object type definitions #1255

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/graphql/language/printer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ def print_scalar_type_definition(scalar_type)
def print_object_type_definition(object_type)
out = print_description(object_type)
out << "type #{object_type.name}"
out << print_directives(object_type.directives)
out << " implements " << object_type.interfaces.map(&:name).join(", ") unless object_type.interfaces.empty?
out << print_directives(object_type.directives)
out << print_field_definitions(object_type.fields)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/graphql/language/printer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
end

describe "full featured schema" do
# From: https://github.com/graphql/graphql-js/blob/bc96406ab44453a120da25a0bd6e2b0237119ddf/src/language/__tests__/schema-kitchen-sink.graphql
# Based on: https://github.com/graphql/graphql-js/blob/bc96406ab44453a120da25a0bd6e2b0237119ddf/src/language/__tests__/schema-kitchen-sink.graphql
let(:query_string) {<<-schema
schema {
query: QueryType
Expand All @@ -128,7 +128,7 @@
# Scalar description
scalar CustomScalar

type AnnotatedObject @onObject(arg: "value") {
type AnnotatedObject implements Bar @onObject(arg: "value") {
annotatedField(arg: Type = "default" @onArg): Type @onField
}

Expand Down