graphql v1.10.0 Release Notes

Release Date: 2020-01-20 // over 4 years ago
  • ๐Ÿ’ฅ Breaking Changes

    • Class-based schemas using the new interpreter will now use definition classes at runtime. #2363 (Previously, .to_graphql methods were used to generate singletons which were used at runtime.) This means:
      • Methods that used to receive types at runtime will now receive classes instead of those singletons.
      • .name will now call Class#name, which will give the class name. Use .graphql_name to get the name of a GraphQL type. (Fields, arguments and directives have .graphql_name too, so you can use it everywhere.)
      • Some methods that return hashes are slow because they merge hashes according to class inheritance, for example MySchema.types and MyObjectType.fields. Instead:
      • If you only need one item out of the Hash, use .get_type(type_name) or .get_field(field_name) instead. Those methods find a match without performing Hash merges.
      • If you need the whole Hash, get a cached value from context.warden (an instance of GraphQL::Schema::Warden) at runtime. Those values reflect the types and fields which are permitted for the current query, and they're cached for life of the query. Check the API docs to see methods on the warden.
    • Class-based schemas using the interpreter must add use GraphQL::Analysis::AST to their schema (and update their custom analyzers, see https://graphql-ruby.org/queries/ast_analysis.html) #2363
    • ๐Ÿ‘ ActiveSupport::Notifications events are correctly named in event.library format #2562
    • Field and Argument #authorized? methods now accept three arguments (instead of 2). They now accept (obj, args, ctx), where args is the arguments (for a field) or the argument value (for an argument). #2536
    • ๐Ÿ“œ Double-null !! is disallowed by the parser #2397
    • (Non-interpreter only) The return value of subscription fields is passed along to execute the subscription. Return nil to get the previous behavior. #2536
    • ๐Ÿ— Schema.from_definition builds a class-based schema from the definition string #2178
    • Only integers are accepted for Int type #2404
    • Custom scalars now call .coerce_input on all input values - previously this call was skipped for null values.

    ๐Ÿ—„ Deprecations

    • โฌ†๏ธ .define is deprecated; class-based schema definitions should be used instead. If you're having trouble or you can't find information about an upgrade path, please open an issue on GitHub!

    ๐Ÿ†• New Features

    • โž• Add tracing events for .authorized? and .resolve_type calls #2660
    • ๐Ÿ”Œ Schema.from_definition accepts using: for installing plugins (equivalent to use ... in class-based schemas) #2307
    • โž• Add $ to variable names in error messages #2531
    • โž• Add invalid value to argument error message #2531
    • Input object arguments with loads: get the loaded object in their authorized? hook, as arg in authorized?(obj, args, ctx). #2536
    • GraphQL::Pagination auto-pagination system #2143
    • ๐Ÿ— Schema.from_definition builds a class-based schema from the definition string #2178

    ๐Ÿ› Bug Fixes

    • ๐Ÿ›  Fix warnings on Ruby 2.7 #2668
    • ๐Ÿ›  Fix Ruby keyword list to support Ruby 2.7 #2640
    • โฌ‡๏ธ Reduce memory of class-based schema #2636
    • ๐Ÿ‘Œ Improve runtime performance of interpreter #2630
    • ๐Ÿ’Ž Big numbers (ie, greater than Ruby's Infinity) no longer :boom: when being reserialized #2320
    • Fix hasNextPage/hasPrevious page when max_page_size limits the items returned #2608
    • ๐Ÿ“œ Return parse errors for empty documents and empty argument lists #2344
    • 0๏ธโƒฃ Properly serialize defaultValue of input objects containing enum values #2439
    • Don't crash when a query contains !!. #2397
    • Resolver loads: assign the value to argument @loads #2364
    • Only integers are accepted for Int type #2404