Apollo / GraphQL Same Query with Different Parameters
问题 How would I go about having an Apollo query with different parameters. Let's say my app has the concept of users and I want my API to be able to find a user either by ID or username. It doesn't seem I can do this type Query { user(id: ID!): User user(username: String!): User } do I have to resort to something like this type Query { userById(id: ID!): User userByUsername(username: String!): User } 回答1: Create a new input type with ID and username as fields and specify it as parameter. type