graphql-python / graphql-core-legacy

GraphQL base implementation for Python (legacy version – see graphql-core for the current one)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`schema_printer._print_object` should return interfaces joined with '&' instead of ','

msyfls123 opened this issue · comments

https://github.com/graphql-python/graphql-core/blame/master/graphql/utils/schema_printer.py#L132

def _print_object(type):
    # type: (GraphQLObjectType) -> str
    interfaces = type.interfaces
    implemented_interfaces = (
        " implements {}".format(", ".join(i.name for i in interfaces))
        if interfaces
        else ""
    )

https://facebook.github.io/graphql/draft/#sec-Interfaces

type Business implements NamedEntity & ValuedEntity {
  name: String
  value: Int
  employeeCount: Int
}

I do think we can use & instead of , here, so we can simply print schema to a file rather than fetching it through graphql get-schema in JavaScript world.
I compare both of them which was generated in my project and find the only difference, even better with descriptions.
Thanks!