Skip to content

Can I parse the type of a field from query and schema? #253

@zhaoyi0113

Description

@zhaoyi0113

I am looking for a parser to tell me what the type of a field clients want to resolve. For example, I have a schema like below code. When the server receive a query from clients, e.g. query getChat { getChat(id: \"0x01\") { id }}. Am I able to tell what the type of the response is.

I can see there are two methods ParseSchema and ParseQuery but I am not sure whether I can use these two methods to achieve what I need.

type Message {
  msg: String!
  id: ID!
  topic: String!
}

type Mutation {
  sendChat(topic: String!, message: String!): ID!
}

type Query {
  getChat(id: ID!): Message!
}

type Subscription {
  # Subscribe to events on the given topic.
  event(
    # Name of the topic to subscribe to.
    on: String!
  ): Message!
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions