federation support: generation of documents extend types
It would be good to generate documentation with schemas that has federation support. Reference https://www.apollographql.com/docs/apollo-server/federation/introduction/
For example, the following federated query fails to generate document
extend type Query {
me: User
}
type User @key(fields: "id") {
id: ID!
username: String!
}
error message:
Must provide schema definition with query type or a type named Query
@ravisastryk Not sure if it helps, but in case of using federation, it would make sense to generate docs based on Gateway introspection (not downstream services) or on a JSON file produced by apollo client:download-schema command. I don't know your use case ofc, but worked for me.
There are two cases here:
-
I want to document the entire federated schema. I think this is possible today by taking your federated schemas, putting them together using the
composeAndValidatefunction from@apollo/federation, and then running graphdoc on the resulting schema.... I'm having some trouble withcomposeAndValidatedropping docstrings, so the resulting documentation is less than helpful. -
I want to document each service that makes up a federated service separately. I'm still trying to figure out how to do this, and it may involve additional direct support from graphdoc, because in this case you're intentionally wanting to parse and document an "incomplete" schema with @extends directives for types that don't exist. It isn't just for Query and Mutation, but any other extended types.