graphql-python / graphql-core-legacy

GraphQL base implementation for Python (legacy version – see graphql-core for the current one)
MIT License
374 stars 183 forks source link

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

Open msyfls123 opened 5 years ago

msyfls123 commented 5 years ago

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!