|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +class GraphqlRubyIssueReproductionSchema < GraphQL::Schema |
| 4 | + mutation(Types::MutationType) |
| 5 | + query(Types::QueryType) |
| 6 | + |
| 7 | + # For batch-loading (see https://graphql-ruby.org/dataloader/overview.html) |
| 8 | + use GraphQL::Dataloader |
| 9 | + |
| 10 | + # GraphQL-Ruby calls this when something goes wrong while running a query: |
| 11 | + def self.type_error(err, context) |
| 12 | + # if err.is_a?(GraphQL::InvalidNullError) |
| 13 | + # # report to your bug tracker here |
| 14 | + # return nil |
| 15 | + # end |
| 16 | + super |
| 17 | + end |
| 18 | + |
| 19 | + # Union and Interface Resolution |
| 20 | + def self.resolve_type(abstract_type, obj, ctx) |
| 21 | + # TODO: Implement this method |
| 22 | + # to return the correct GraphQL object type for `obj` |
| 23 | + raise(GraphQL::RequiredImplementationMissingError) |
| 24 | + end |
| 25 | + |
| 26 | + # Limit the size of incoming queries: |
| 27 | + max_query_string_tokens(5000) |
| 28 | + |
| 29 | + # Stop validating when it encounters this many errors: |
| 30 | + validate_max_errors(100) |
| 31 | + |
| 32 | + # Relay-style Object Identification: |
| 33 | + |
| 34 | + # Return a string UUID for `object` |
| 35 | + def self.id_from_object(object, type_definition, query_ctx) |
| 36 | + # For example, use Rails' GlobalID library (https://github.com/rails/globalid): |
| 37 | + object.to_gid_param |
| 38 | + end |
| 39 | + |
| 40 | + # Given a string UUID, find the object |
| 41 | + def self.object_from_id(global_id, query_ctx) |
| 42 | + # For example, use Rails' GlobalID library (https://github.com/rails/globalid): |
| 43 | + GlobalID.find(global_id) |
| 44 | + end |
| 45 | +end |
0 commit comments