Skip to content

Releases: apollographql/apollo-rs

[email protected]

10 Nov 15:33
8e52895

Choose a tag to compare

0.15.2 - 2025-11-10

Fixes

  • Return arbitrary::Error::IncorrectFormat for unsupported floats- tninesling, pull/1005
    When generating floats for GraphQL documents, we were naively unwrapping the
    conversion from f64 to serde_json::Number. This would panic when
    arbitrary returned f64::INFINITY of f64::NAN because the Number
    conversion only works when its input is finite. In this case, the underlying
    bytes used to generate the value are considered to be in an invalid format.
    So, we return arbitrary::Error::IncorrectFormat to tell fuzzers to use a
    different seed in the future.

Maintenance

[email protected]

10 Nov 16:26
a4df4cf

Choose a tag to compare

Features

  • Allow coercing Int variables to Float - tninesling, pull/1011

    The GraphQL spec allows coercing Int values to Float in input positions (see
    input coercion). There are a couple things to note about this.

    • Strings are not allowed to be coerced in this position, even if they are
      numeric.
    • Ints can only be converted to Float when they are "representable by finite
      IEEE 754" floating point numbers.

    Since an IEEE 754 floating point double (f64) has 53 bits of precision, it can
    safely represent up to the value 2^53 - 1 as a finite value. Beyond that, the
    round trip from integer to float and back will lose information. This is
    represented with a new MAX_SAFE_INT constant which is often included in
    other languages like JavaScript's Number.MAX_SAFE_INT. When, we encounter an
    Int variable in a Float position, we ensure that its value is finitely
    representable.

    There is some nuance in that the spec does not say all floats have to be
    within this range. So, this implementation allows explicitly passed floats
    which are greater than that bound, only applying the integer conversion limit
    when coercing a value.

Fixes

  • Validate missing fragments when parsing standalone executable documents - Abdel-Monaam-Aouini, pull/1003

    When validating standalone executable documents, the use of undefined fragment
    definitions will return a validation error. Previously, executable documents
    like the following would pass validation without errors, despite
    CompanyFragment being undefined.

    query {
      company {
        user {
          ...UserFragment
        }
        ...CompanyFragment
      }
    }
    fragment UserFragment on User {
      id
      name
    }

Maintenance

  • Add benchmark for parsing and validation when a type has many extensions tninesling, pull/1000

    Introduces a new benchmark for query parsing and validation when a type has
    many extensions. We made an update in [email protected] to expose
    .iter_origins() for AST nodes, and we reimplemented .extensions() in
    terms of .iter_origins(). We were concerned that this may have caused a
    performance regression in parsing, but running this new benchmark against
    main with 1.28.0 as the base indicates no change in performance.

[email protected]

27 Aug 15:01
e651a95

Choose a tag to compare

Features

  • Add ignore_builtin_redefinitions method to SchemaBuilder- dariuszkuc, pull/990 and pull/994

    This allows input SDL to contain built-in types.

    The following SDL will result in a validation error, for example:

      let schema = r#"
        type __Directive {
          name: String!
          description: String!
          isRepeatable: String!
          args: __InputValue
          locations: String!
        }
        type Query {
          foo: String
        }
        "#;
    
      let valid = Schema::parse_and_validate(schema, "schema.graphql")?

    Error:

      Error: the type `__Directive` is defined multiple times in the schema
        ╭─[ built_in.graphql:87:6 ]
        │
     87 │ type __Directive {
        │      ─────┬─────  
        │           ╰─────── previous definition of `__Directive` here
        │
        ├─[ schema.graphql:2:6 ]
        │
      2 │ type __Directive {
        │      ─────┬─────  
        │           ╰─────── `__Directive` redefined here
        │ 
        │ Help: remove or rename one of the definitions, or use `extend`
    ────╯

    However, when using the ignore_builtin_redefinitions method, this successfully passes validation given the same schema:

      let builder = SchemaBuilder::new().ignore_builtin_redefinitions();
      let _ = builder
          .parse(schema, "schema.graphql")
          .build()
          .expect("schema parsed successfully");

Fixes

  • Fix handling of orphan root type extensions - dariuszkuc, pull/993

    SchemaBuilder's adopt_orphan_extensions method allows users to define type
    extensions without an existing type definition. But before this fix, orphan
    RootTypeOperation extensions would result in an invalid schema despite
    adopt_orphan_extensions being enabled. Using this method now generates a
    valid schema for all lone extensions.

  • Fix directive definition validation with nested types arguments - dariuszkuc, pull/987

    Directive definition with nested argument types resulted in a stack overflow, for example

      directive @custom(input: NestedInput) on OBJECT | INTERFACE
    
      input NestedInput {
        name: String
        nested: NestedInput
      }
      
      type Query @custom(input: {name: "hello", nested: {name: "hello"}}) {
        foo: String
      }
      
      query myQuery {
        foo
      }

    This fix ensures the above example is possible and does not result in a validation error.

  • Fix iter_origins() to be a pub method - duckki, pull/989

    Previously added ::iter_origins() methods on Schema and Type Definitions was not made pub.

[email protected]

27 Aug 15:02
932c794

Choose a tag to compare

Features

Fixes

  • Fix serialization in non-standard orphan extensions mode - duckki, pull/984

[email protected]

24 Apr 08:53
b734550

Choose a tag to compare

Features

  • Reject @skip/@include on subscription root fields - dariuszkuc SimonSapin and goto-bus-stop, pull/963

    This implements a GraphQL spec RFC, rejecting
    subscriptions in validation that can be invalid during execution.

  • New shorthand methods for mutable directive argument access - tninesling, pull/967

    Introduces new methods:

    • DirectiveList::get_all_mut
    • DirectiveList::argument_by_name_mut
    • DirectiveList::specified_argument_by_name_mut

Fixes

  • Update ariadne trait implementations - lrlna, pull/960

    [email protected] release changed their type signature for ariadne::Cache trait, which required an
    update to apollo-compiler's implementation of ariadne::Cache<FileId>.

    This release also had a slight change to path formatting, so if you had any snapshots in your
    tests, you can expect a change from this:

    Error: `typeFragment1` contains too much nesting
        ╭─[overflow.graphql:11:11]
    

    to this (notice the extra white space around the file path):

    Error: `typeFragment1` contains too much nesting
        ╭─[ overflow.graphql:11:11 ]
    
  • Harden stack overflow protection - goto-bus-stop, pull/966

    Closes a theoretical gap in stack overflow protection when processing long fragment chains, and
    significantly improves validation performance on documents with thousands of fragment definitions.

[email protected]

20 Aug 14:28
55002fd

Choose a tag to compare

0.8.1 - 2024-08-20

Features

This makes it easier for pretty-printers, linters and the like to work with the
parser API.

[email protected]

31 Jul 10:33
b510f48

Choose a tag to compare

  • Update apollo-parser dependency to 0.8.0
  • Update apollo-compiler dependency to =1.0.0-beta.20

[email protected]

31 Jul 08:45
b37fec8

Choose a tag to compare

BREAKING

This release removes the Error::new constructor. We recommend not creating instances of
apollo_parser::Error yourself at all.

Fixes

  • add missing location information for lexer errors - PhoebeSzmucer, pull/886, issue/731
    Unexpected characters now raise an error pointing to the character itself, instead of the start of the input document.

[email protected]

31 Jul 10:34
3df1e62

Choose a tag to compare

Fixes

  • Fix variable validation in operation directives - goto-bus-stop in pull/888.
    • query ($var: Int) @directive(arg: $var) is now accepted - it used to raise an unused variable error for $var.

Maintenance

[email protected]

19 Jul 18:15
13f4aa1

Choose a tag to compare

1.0.0-beta.19 - 2024-07-19

BREAKING

  • Remove deprecated Name reexports - SimonSapin in pull/877.
    apollo_compiler::Name should now be imported instead of:

    • apollo_compiler::ast::Name
    • apollo_compiler::schema::Name
    • apollo_compiler::executable::Name
      These other paths emitted deprecation warnings in 1.0.0-beta.18 and are now removed.
  • Move operations of an ExecutableDocument into a new struct - SimonSapin in pull/879.

    • doc.anonymous_operationdoc.operations.anonymous
    • doc.named_operationsdoc.operations.named
    • doc.get_operation()doc.operations.get()
    • doc.get_operation_mut()doc.operations.get_mut()
    • doc.insert_operation()doc.operations.insert()
    • doc.all_operations()doc.operations.iter()
      This change makes get_mut() borrow only doc.operations instead of the entire document, making it possible to also mutate doc.fragments during that mutable borrow.
  • Move or rename some import paths - SimonSapin in pull/885. Moved from the crate root to the new(ly public) apollo_compiler::parser module:

    • Parser
    • SourceFile
    • SourceMap
    • FileId

    Moved to the parser module and renamed:

    • NodeLocationSourceSpan
    • GraphQLLocationLineColumn
  • Return ranges of line/column locations - dylan-apollo in pull/861. SourceSpan contains a file ID and a range of UTF-8 offsets within that file. Various APIs can convert offsets to line and column numbers, but often only considered the start offset. They are now changed to consider the range of start and end positions.

    Added, returning Option<Range<LineColumn>>:

    • SourceSpan::line_column_range
    • Diagnostic::line_column_range
    • Name::line_column_range

    Removed:

    • LineColumn::from_node
    • Diagnostic::get_line_column
    • SourceFile::get_line_column
  • Use a fast hasher - o0Ignition0o in pull/881. Configured all hash-based collections used in apollo-compiler to use ahash, which is faster than the default standard library hasher. apollo_compiler::collections provides type aliases for collections configured with the same hasher as collections in various parts of the public API.

Features

  • Add a few helper methods - SimonSapin in pull/885:
    • executable::OperationMap::from_one
    • schema::SchemaDefinition::iter_root_operations()
    • schema::ExtendedType::is_leaf

Fixes