(es graphql.ExecutableSchema)
| 316 | } |
| 317 | |
| 318 | func NewDefaultHandler(es graphql.ExecutableSchema) *handler.Server { |
| 319 | // TODO: avoid this deprecated method, and customize the options |
| 320 | srv := handler.NewDefaultServer(es) |
| 321 | |
| 322 | srv.SetValidationRulesFn(func() *rules.Rules { |
| 323 | validationRules := rules.NewDefaultRules() |
| 324 | |
| 325 | // HACK: these rules are disabled because some clients don't send the right |
| 326 | // types: |
| 327 | // - PHP + Elixir SDKs send enums quoted |
| 328 | // - The shell sends enums quoted, and ints/floats as strings |
| 329 | // - etc |
| 330 | validationRules.RemoveRule(rules.ValuesOfCorrectTypeRule.Name) |
| 331 | validationRules.RemoveRule(rules.ValuesOfCorrectTypeRuleWithoutSuggestions.Name) |
| 332 | |
| 333 | // HACK: this rule is disabled because PHP modules <=v0.15.2 query |
| 334 | // inputArgs incorrectly. |
| 335 | validationRules.RemoveRule(rules.ScalarLeafsRule.Name) |
| 336 | |
| 337 | // Replace PossibleFragmentSpreads with a version that handles |
| 338 | // interface-implements-interface per the GraphQL spec. The |
| 339 | // default rule only checks possibleTypes overlap, which fails |
| 340 | // when an interface has no concrete implementors in the current |
| 341 | // schema view (e.g. `... on TestCustomIface` inside `node(id:)` |
| 342 | // when the concrete types are in other modules). Per the spec, |
| 343 | // `... on A` is valid in a `B` context when A implements B. |
| 344 | validationRules.ReplaceRule(rules.PossibleFragmentSpreadsRule.Name, possibleFragmentSpreadsRule) |
| 345 | |
| 346 | return validationRules |
| 347 | }) |
| 348 | |
| 349 | return srv |
| 350 | } |
| 351 | |
| 352 | var coreScalars = []ScalarType{ |
| 353 | Boolean(false), |
no outgoing calls