Skip to content

Releases: apollographql/apollo-rs

[email protected]

18 Aug 17:45
c6b9c2d
Compare
Choose a tag to compare

BREAKING

[email protected]

18 Aug 13:40
82f927a
Compare
Choose a tag to compare

Features

  • add InterfaceTypeDefinition::implementors(&db) to list object types and other interfaces that implement an interface, by Geal in pull/616

Fixes

Maintenance

[email protected] (#589)

20 Jun 14:36
b840606
Compare
Choose a tag to compare

BREAKING

Fixes

  • schema extension without fields skips empty block - dariuszkuc, pull/582

    Prevents outputting the invalid code extend schema {}.

[email protected]

20 Jun 13:39
80ba356
Compare
Choose a tag to compare

BREAKING

  • SelectionSet::merge is renamed to SelectionSet::concat to clarify that it doesn't do field merging, by goto-bus-stop in pull/570
  • hir::InlineFragment::type_condition now only returns Some() if a type condition was explicitly specified, by goto-bus-stop in pull/586

Features

  • add root_operation_name(OperationType) helper method on hir::SchemaDefinition by SimonSapin in pull/579

  • add an UndefinedDirective diagnostic type, by goto-bus-stop in pull/587

    This is used for directives instead of UndefinedDefinition.

Fixes

  • accept objects as values for custom scalars, by goto-bus-stop in pull/585

    The GraphQL spec is not entirely clear on this, but this is used in the real world with things
    like the _Any type in Apollo Federation.

Maintenance

[email protected]

06 Jun 11:38
6c7c902
Compare
Choose a tag to compare

Features

  • accept any primitive value type for custom scalar validation, by lrlna in pull/575

    If you provide a value to a custom scalar in your GraphQL source text, apollo-compiler
    now accepts any value type. Previously it was not possible to write values for custom
    scalars into a query or schema because the value you wrote would never match the custom
    scalar type.

    This now works:

    scalar UserID @specifiedBy(url: "https://my-app.net/api-docs/users#id")
    type Query {
      username (id: UserID): String
    }
    {
      username(id: 575)
    }
  • add type name to the UndefinedField diagnostic data, by goto-bus-stop in pull/577

    When querying a field that does not exist, the type name that's being queried is stored on
    the diagnostic, so you can use it when handling the error.

[email protected]

01 Jun 09:15
a32ac89
Compare
Choose a tag to compare

Fixes

  • fix nullable / non-nullable validations inside lists, by lrlna in pull/567

    Providing a variable of type [Int!]! to an argument of type [Int] is now allowed.

Maintenance

[email protected]

23 May 11:32
aa41b30
Compare
Choose a tag to compare

Features

  • add as_$type() methods to hir::Value, by goto-bus-stop in pull/564

    These methods simplify casting the hir::Value enum to single Rust types.
    Added methods:

    • hir::Value::as_i32() -> Option<i32>
    • hir::Value::as_f64() -> Option<f64>
    • hir::Value::as_str() -> Option<&str>
    • hir::Value::as_bool() -> Option<bool>
    • hir::Value::as_list() -> Option<&Vec<Value>>
    • hir::Value::as_object() -> Option<&Vec<(Name, Value)>>
    • hir::Value::as_variable() -> Option<&Variable>

Fixes

  • non-nullable variables should be accepted for nullable args, by lrlna in pull/565

    Fixes several null-related issues from 0.9.0.

  • add an UndefinedVariable diagnostic, by goto-bus-stop in pull/563

    Previously undefined variables were reported with an UndefinedDefinition diagnostic.
    Splitting it up lets us provide a better error message for missing variables.

[email protected] (#561)

19 May 10:12
aa25304
Compare
Choose a tag to compare

Fixes

[email protected]

12 May 11:09
439be98
Compare
Choose a tag to compare

0.5.3 - 2023-05-12

Fixes

  • variable definition list cannot be empty - lrlna, pull/553 fixing issue/546
    We previously allowed an operation with an empty variable definition list,
    which is incorrect. This change provides a fix.

[email protected]

12 May 15:27
Compare
Choose a tag to compare

0.9.0 - 2023-05-12

This release completes GraphQL validation specification, making the compiler spec-compliant.

You can validate the entire corpus of the compiler, or run individual compiler validation rules. The example below runs the whole corpus, as well specifically runs compiler.db.validate_executable(file_id) for each of the two defined operations.

let schema = r#"
type Query {
  cat: Cat
}

type Cat{
  name: String!
  nickname: String
  purrVolume: Int
  doesKnowCommand(catCommand: CatCommand!): Boolean!
}

enum CatCommand {
  HOP
}
    "#;

let cat_name_op = r#"
query getCatName {
  cat {
    name
  }
}
    "#;

let cat_command_op = r#"
query getCatName {
  cat {
    doesNotKnowCommand
  }
}
    "#;
let mut compiler = ApolloCompiler::new();
compiler.add_type_system(schema, "schema.graphl");
let cat_name_file = compiler.add_executable(cat_name_op, "cat_name_op.graphql");
let cat_command_file = compiler.add_executable(cat_command_op, "cat_command_op.graphql");

// validate both the operation and the type system
let all_diagnostics = compiler.validate();
assert_eq!(all_diagnostics.len(), 1);

// validate just the executables individual
let cat_name_op_diagnotics = compiler.db.validate_executable(cat_name_file);
assert!(cat_name_op_diagnotics.is_empty());

let cat_command_op_diagnotics = compiler.db.validate_executable(cat_command_file);
// This one has an error, where a field queries is not defined.
assert_eq!(cat_command_op_diagnotics.len(), 1);
for diag in cat_command_op_diagnotics {
    println!("{}", diag);
}

BREAKING

  • remove impl Default for ApolloCompiler, by [dariuszkuc] in pull/542

  • align HIR extension getters to those of their type definition, by lrlna in pull/540

    The following methods were changed:

    • InputObjectTypeExtension.fields_definition() -> InputObjectTypeDefinition.fields()
    • ObjectTypeExtension.fields_definition() -> ObjectTypeExtension.fields()
    • InterfaceTypeExtension.fields_definition() -> InterfaceTypeExtension.fields()
    • EnumTypeExtension.enum_values_definition() -> EnumTypeExtension.values()
    • UnionTypeExtension.union_members() -> UnionTypeExtension.members()

Features

Fixes