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

Schema with comments for documentation not supported #5

Open
texascloud opened this issue Jul 31, 2018 · 6 comments
Open

Schema with comments for documentation not supported #5

texascloud opened this issue Jul 31, 2018 · 6 comments

Comments

@texascloud
Copy link

Assume the following schema is in a file named example.graphql

type Query {
    animals: [Animal]
}

type Animal {
    id: ID!
    "Scientific name of the Animal"
    name: String!
    "Hunting status of the Animal"
    status: Status!
}

"Indicates whether the animal can be hunted"
enum Status {
    pending
    available
}

Uploading it is successful, but no resolvermap gets created for it. It's due to the comments not being able to be parsed. However GraphQL Playground has support for showing these strings as documentation for the schema.

~/scratch/qloo » qlooctl schema create -f ./example.graphql animal
schema created successfully
------------------------------------------------------------
~/scratch/qloo » qlooctl schema get animal -o yaml
inline_schema: |
  type Query {
      animals: [Animal]
  }

  type Animal {
      id: ID!
      "Scientific name of the Animal"
      name: String!
      "Hunting status of the Animal"
      status: Status!
  }

  "Indicates whether the animal can be hunted"
  enum Status {
      pending
      available
  }
metadata:
  namespace: gloo-system
  resource_version: "2356965"
name: animal
status:
  reason: 'failed to parse schema: graphql: syntax error: unexpected "\"Scientific
    name of the Animal\"", expecting Ident (line 7, column 5)'
  state: Rejected
@ilackarms
Copy link
Member

ahh, this makes sense. will need some time to look into a fix for this, feel free to bump this issue if it doesn't get attention in the next week or so.

also, we'd happily accept a pull request to help us add support for comments.

@texascloud
Copy link
Author

Could you point me to where the parser logic is for consuming the schema?

@ilackarms
Copy link
Member

https://github.com/solo-io/qloo/blob/master/pkg/core/event_loop.go#L232

the schema parsing is delegated to https://github.com/vektah/gqlgen
i'm surprised that library doesn't support comments. we might just need to do a dep ensure -v -update ...
or open an issue there ^_^

@deorbit
Copy link

deorbit commented Jun 4, 2019

It looks like this was fixed: 99designs/gqlgen#86 (comment). Are you able to update the gqlgen dependency?

@simenandre
Copy link

Bump :)

@fresonn
Copy link

fresonn commented Oct 25, 2022

Any updates? Still doesn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants