Skip to content

Introspection: Skip/Include Directive Locations #40

@fungl164

Description

@fungl164

Some newer apps complain about missing locations when placing an IntrospectionQuery request.

A quick fix is to add the following to the directive's definition object in the schema.go file:

"locations":   []string{"FIELD", "FRAGMENT_DEFINITION", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"},

Below is an example where it would be placed...

schema.go (lines 269-315)

result := map[string]interface{}{
  "queryType": executor.introspectType(params, queryRoot),
  "directives": []map[string]interface{}{
    {
      "name":        "skip",
      "description": "Conditionally exclude a field or fragment during execution",
      "args":        []map[string]interface{}{ ... },
      "locations":   []string{"FIELD", "FRAGMENT_DEFINITION", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"},
      "onOperation": false,
      "onField":     true,
      "onFragment":  true,
    },
    ...
  },
}

schema.go (lines 88-96)

const INTROSPECTION_SCHEMA = `
...
type __Directive {
  name: String!
  description: String
  args: [__InputValue!]!
  locations: [String!]!
  onOperation: Boolean!
  onFragment: Boolean!
  onField: Boolean!
}
...
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions