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

Introspection: Skip/Include Directive Locations #40

Open
fungl164 opened this issue Jan 25, 2019 · 0 comments
Open

Introspection: Skip/Include Directive Locations #40

fungl164 opened this issue Jan 25, 2019 · 0 comments

Comments

@fungl164
Copy link

fungl164 commented Jan 25, 2019

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!
}
...
`
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

1 participant