GraphiDocsOrg / docs

Static page generator for documenting GraphQL Schema
https://graphidocsorg.github.io/docs/
24 stars 1 forks source link

Extension declarations do not show up #22

Open ruiaraujo opened 5 years ago

ruiaraujo commented 5 years ago

We are using the -s option with a SDL language file.

This file is a concat of multiple separate files which use the extend Type syntax to extend the Query type.

Unfortunately, these do not show up in the docs.

mitchellsimoens commented 5 years ago

Hey, thanks for using this project and reporting a bug. Would you happen to have a simple test case that I can debug?

ruiaraujo commented 5 years ago

Try this file

type Query {
  version: String!
  name: String!
}

extend type Query {
  hello: String!
}
mitchellsimoens commented 5 years ago

Thanks for that simple sample. Walking through the code, I actually think this is a bug with graphql creating an ast. I can see where it adds the type (and checks for any directives) but I don't see where it's handling extensions. I'm going to find some time to create a test outside of this project to see if it is a bug of theirs and that way I can submit a bug report.

I will go ahead and see what you would expect here for this project. Would you like to just see the hello field with the other two fields in the type code block or something special to show it was added in via extension?

mitchellsimoens commented 5 years ago

Yes, looks like this is an upstream bug in graphql-js. There is this issue that discusses extension and the ast being built not including it but looks like they want to throw an error in that simple case.

However, I don't see why a type extension like your simple example shouldn't just work so I opened this: graphql/graphql-js#1701

mitchellsimoens commented 5 years ago

So good news, they are refactoring some things and one of the things they are doing is handling the extension stuff properly and plan on having that done for their next major release which is good! I'll keep this open so I'll circle around when they get their issue fixed.