Reorganize documentation to make room to grow (#84)
## Summary: In this commit I reorganize much of our documentation into a new `docs` directory, where there will hopefully be more room to grow and to organize things in a user-friendly way. There's almost no net-new documentation, although of course it's a great time to review it anyway. In particular: - I moved the documentation for the `genqlient.yaml` config file into an example file instead of GoDoc (which now just points to the example file); I think this will be a lot clearer for casual users. - I moved the documentation for the `@genqlient` directive out of GoDoc and into a GraphQL schema file (since while it's a comment it's all real syntax), likewise, and made the `GenqlientDirective` type private (since there's now nothing useful to do with it). - I moved `DESIGN.md` and the logo into `docs/` (just to keep the toplevel a bit cleaner), and separated the Contributing section of the README into `docs/CONTRIBUTING.md` (which github will automatically link on various issue and PR pages). This leaves it so that: - README.md is the only documentation at the toplevel (and will become just the high-level introduction as I add more user docs to `docs/`) - GoDoc is only documentation for if you want to call genqlient programmatically (which is fairly limited as the API surface is quite small: it's now just Main, Generate, and Config, plus a constructor, a single method, and a bunch of fields on the latter) In future commits, I'll add some more new documentation to the `docs` directory. Issue: https://github.com/Khan/genqlient/issues/26 ## Test plan: make check (and read the docs) Author: benjaminjkraft Reviewers: jvoll, benjaminjkraft, aberkan, dnerdy, MiguelCastillo, mahtabsabet Required Reviewers: Approved By: jvoll Checks: ✅ Lint, ✅ Test (1.17), ✅ Test (1.16), ✅ Test (1.15), ✅ Test (1.14), ✅ Test (1.17), ✅ Test (1.16), ✅ Test (1.15), ✅ Test (1.14), ✅ Lint Pull Request URL: https://github.com/Khan/genqlient/pull/84
This commit is contained in:
+9
-9
@@ -37,7 +37,7 @@ func (g *generator) baseTypeForOperation(operation ast.Operation) (*ast.Definiti
|
||||
// result will be unmarshaled.
|
||||
func (g *generator) convertOperation(
|
||||
operation *ast.OperationDefinition,
|
||||
queryOptions *GenqlientDirective,
|
||||
queryOptions *genqlientDirective,
|
||||
) (goType, error) {
|
||||
name := operation.Name + "Response"
|
||||
|
||||
@@ -87,7 +87,7 @@ var builtinTypes = map[string]string{
|
||||
// argument to a GraphQL operation.
|
||||
func (g *generator) convertInputType(
|
||||
typ *ast.Type,
|
||||
options, queryOptions *GenqlientDirective,
|
||||
options, queryOptions *genqlientDirective,
|
||||
) (goType, error) {
|
||||
// note prefix is ignored here (see generator.typeName), as is selectionSet
|
||||
// (for input types we use the whole thing)).
|
||||
@@ -102,7 +102,7 @@ func (g *generator) convertType(
|
||||
namePrefix *prefixList,
|
||||
typ *ast.Type,
|
||||
selectionSet ast.SelectionSet,
|
||||
options, queryOptions *GenqlientDirective,
|
||||
options, queryOptions *genqlientDirective,
|
||||
) (goType, error) {
|
||||
// We check for local bindings here, so that you can bind, say, a
|
||||
// `[String!]` to a struct instead of a slice. Global bindings can only
|
||||
@@ -145,7 +145,7 @@ func (g *generator) convertDefinition(
|
||||
def *ast.Definition,
|
||||
pos *ast.Position,
|
||||
selectionSet ast.SelectionSet,
|
||||
options, queryOptions *GenqlientDirective,
|
||||
options, queryOptions *genqlientDirective,
|
||||
) (goType, error) {
|
||||
// Check if we should use an existing type. (This is usually true for
|
||||
// GraphQL scalars, but we allow you to bind non-scalar types too, if you
|
||||
@@ -315,7 +315,7 @@ func (g *generator) convertSelectionSet(
|
||||
namePrefix *prefixList,
|
||||
selectionSet ast.SelectionSet,
|
||||
containingTypedef *ast.Definition,
|
||||
queryOptions *GenqlientDirective,
|
||||
queryOptions *genqlientDirective,
|
||||
) ([]*goStructField, error) {
|
||||
fields := make([]*goStructField, 0, len(selectionSet))
|
||||
for _, selection := range selectionSet {
|
||||
@@ -422,7 +422,7 @@ func (g *generator) convertSelectionSet(
|
||||
// the fragment's type. This is distinct from the rules for when a fragment
|
||||
// spread is legal, which is true when the fragment would be active for *any*
|
||||
// of the concrete types the spread-context could have (see
|
||||
// https://spec.graphql.org/draft/#sec-Fragment-Spreads or DESIGN.md).
|
||||
// https://spec.graphql.org/draft/#sec-Fragment-Spreads or docs/DESIGN.md).
|
||||
//
|
||||
// containingTypedef is as described in convertInlineFragment, below.
|
||||
// fragmentTypedef is the definition of the fragment's type-condition, i.e. the
|
||||
@@ -456,12 +456,12 @@ func fragmentMatches(containingTypedef, fragmentTypedef *ast.Definition) bool {
|
||||
//
|
||||
// In general, we treat such fragments' fields as if they were fields of the
|
||||
// parent selection-set (except of course they are only included in types the
|
||||
// fragment matches); see DESIGN.md for more.
|
||||
// fragment matches); see docs/DESIGN.md for more.
|
||||
func (g *generator) convertInlineFragment(
|
||||
namePrefix *prefixList,
|
||||
fragment *ast.InlineFragment,
|
||||
containingTypedef *ast.Definition,
|
||||
queryOptions *GenqlientDirective,
|
||||
queryOptions *genqlientDirective,
|
||||
) ([]*goStructField, error) {
|
||||
// You might think fragmentTypedef would be fragment.ObjectDefinition, but
|
||||
// actually that's the type into which the fragment is spread.
|
||||
@@ -601,7 +601,7 @@ func (g *generator) convertNamedFragment(fragment *ast.FragmentDefinition) (goTy
|
||||
func (g *generator) convertField(
|
||||
namePrefix *prefixList,
|
||||
field *ast.Field,
|
||||
fieldOptions, queryOptions *GenqlientDirective,
|
||||
fieldOptions, queryOptions *genqlientDirective,
|
||||
) (*goStructField, error) {
|
||||
if field.Definition == nil {
|
||||
// Unclear why gqlparser hasn't already rejected this,
|
||||
|
||||
Reference in New Issue
Block a user