Releases: apollographql/apollo-rs
Releases · apollographql/apollo-rs
[email protected]
Features
- Serialize with initial indentation - SimonSapin, pull/848
This helps use indentation in something that is partly but not entirely GraphQL syntax,
such as the debugging representation of an Apollo Router query plan.
Example:document.serialize().initial_indent_level(2).to_string()
- Add validation requiring composite types declare fields - tinnou, pull/847
Object types, interfaces, enums, unions, and input objects must all have at least one
member. This is now checked in schema validation.
[email protected] (#841)
BREAKING
- Move
NodeLocation
andFileId
fromapollo_compiler::validation
to the crate root - SimonSapin, pull/838
Maintenance
- Remove Salsa database for 1.2× ~ 2× validation speed - SimonSapin, pull/838
We were not taking advantage of caching it provides.
Additionally, validation usesSchema
andExecutableDocument
directly
rather than converting them to AST.$ cargo bench --bench multi-source supergraph parse_and_validate time: [398.09 µs 399.32 µs 400.82 µs] change: [-19.966% -19.418% -18.864%] (p = 0.00 < 0.05) Performance has improved. simple_query parse_and_validate time: [12.097 µs 12.104 µs 12.113 µs] change: [-52.467% -52.282% -52.109%] (p = 0.00 < 0.05) Performance has improved.
[email protected]
Fixes
- optimize the most common lexer matches into lookup tables - allancalix, pull/814
Parsing large schema documents can be up to 18% faster, typical documents a few percent. - fix infinite loops and crashes found through fuzzing - goto-bus-stop, pull/828
When using a token limit, it was possible to craft a document that would cause an infinite
loop, eventually leading to an out of memory crash. This is addressed along with several panics.
Maintenance
- reduce intermediate string allocations - goto-bus-stop, pull/820
[email protected]
This release includes a critical fix to overflow protection in validation.
Features
- New field merging validation implementation - goto-bus-stop, pull/816
- Uses the much more scalable XING algorithm.
- This also fixes some invalid selections that were previously accepted by apollo-compiler.
- Selections in fragment definitions are now only validated in the context of the operations they
are used in, reducing duplicate error reports for invalid fragments. This means invalid unused
fragments do not produce field merging errors, but they will still raise a different error because
fragments being unused is also an error according to the spec.
- Add owned IntoIterator for
DirectiveList
types - SimonSapin, pull/826
Fixes
- Actually run RecursionGuard in release mode - SimonSapin, pull/827
- Due to a
debug_assert!()
oversight, stack overflow protection in validation did not run
in release mode.
- Due to a
- Accept enum values as input for custom scalars - goto-bus-stop, pull/835
- Custom scalars accept any kind of input value. apollo-compiler used to raise a validation error when
an enum value was used directly for a custom scalar. However, using an enum value nested inside an
object or list was accepted. Now enum values are always accepted where a custom scalar is expected.
- Custom scalars accept any kind of input value. apollo-compiler used to raise a validation error when
Maintenance
- Replace uses of deprecated
IndexMap::remove
- goto-bus-stop, pull/817
[email protected] (#804)
BREAKING
InputValueDefinition::is_required()
returns false if it has a default value - goto-bus-stop, pull/798- Now
argument.is_required() == true
only if the type is non-null and there is no
default value, meaning a value must be provided when it's used.
- Now
Features
- Implement
fmt::Display
forComponentName
- goto-bus-stop, pull/795 - Add
FieldDefinition::argument_by_name
andDirectiveDefinition::argument_by_name
- goto-bus-stop, pull/801- These methods return an argument definition by name, or
None
.
- These methods return an argument definition by name, or
- Add
.lookup
methods to schema coordinates - goto-bus-stop, pull/803coord!(Type).lookup(&schema)
returns the type definition forType
.coord!(Type.field).lookup_field(&schema)
returns the field definition forfield
.coord!(Enum.VALUE).lookup_enum_value(&schema)
returns the enum value definition forVALUE
.coord!(InputType.field).lookup_input_field(&schema)
returns the input field definition forfield
.coord!(Type.field(argument:)).lookup(&schema)
returns the argument definition forargument
.coord!(@directive).lookup(&schema)
returns the directive definition for@directive
.coord!(@directive(argument:)).lookup(&schema)
returns the argument definition forargument
.string.parse::<SchemaCoordinate>()?.lookup(&schema)
returns an enum with all the elements
that can be looked up using schema coordinates.
Maintenance
- update ariadne to 0.4.0 - pull/793
Ariadne is the diagnostic printing crate used for validation errors. v0.4.0 improves memory usage.
[email protected]
1.0.0-beta.11 - 2023-12-19
This release includes support for GraphQL schema introspection directly in the
compiler. If this is a feature you're interested in, we encourage you to try it
out and leave us any feedback in the introspection discussion. More details on this feature in the changelog below.
Features
- Pretty CLI formatting for custom diagnostics - goto-bus-stop, pull/747:
- A
CliReport
builder API for printing with labeled source code
to a monospace text stream with optional ANSI color codes. - A
ToCliReport
trait for converting error types to aCliReport
when given a source map. - A
Diagnostic
struct for bundling such an error together with a source map
and implementDisplay
/Debug
by printing a CLI report
- A
- Add execution-related and introspection functionality - SimonSapin, pull/758:
- Add data structure in
apollo_compiler::execution
for a GraphQL response, its data, and errors.
All (de)serializable withserde
. - Add
coerce_variable_values()
in that same module. - Add
apollo_compiler::execution::SchemaIntrospection
providing full execution for the schema introspection parts of an operation
and separating the rest to be executed separately.
In order to support all kinds of introspection queries this includes
a full execution engine where users provide objects with resolvable fields.
At this time this engine is not exposed in the public API.
If you’re interested in it let us know about your use case! - Add
ExecutableDocument::insert_operation
convenience method.
- Add data structure in
- Add
NodeStr::from(Name)
- goto-bus-stop, pull/773 - Convenience accessors for
ast::Selection
enum - SimonSapin, pull/777
as_field
,as_inline_fragment
, andas_fragment_spread
; all returningOption<&_>
. - Add schema coordinates - goto-bus-stop, pull/757:
Schema coordinates are a compact, human-readable way to uniquely point to an item defined in a schema.string.parse::<SchemaCoordinate>()
parses a coordinate from a string.- Coordinates have a
Display
impl that writes them out with schema coordinate syntax. - The
coord!()
macro creates a static coordinate at compile time from spec syntax.
Fixes
- Fix serializing single-line strings with leading whitespace - goto-bus-stop, pull/774
Previously, the leading whitespace would get lost.
[email protected]
0.7.5 - 2023-12-18
Fixes
- fix parsing
\\"""
in block string - goto-bus-stop, pull/774
Previously this was parsed as\
followed by the end of the string,
now it's correctly parsed as\
followed by an escaped"""
. - emit syntax errors for variables in constant values - SimonSapin, pull/777
default values and type system directive arguments are considered constants
and may not use$foo
variable values. - emit syntax errors for type condition without a type name rishabh3112, pull/781
[email protected]
[email protected]
BREAKING
- Remove the
parser-impl
feature flag - SimonSapin, pull/754.
This functionality is now always enabled. - Use apollo-compiler instead of apollo-encoder for serialization - SimonSapin, pull/754.
The exact string output may change.
Fixes
- Make serialization ordering deterministic - SimonSapin, pull/754.
Internally useIndexMap
andIndexSet
instead ofIndexMap
andIndexSet
[email protected]
Features
- Add validation convenience APIs - SimonSapin, pull/764:
ast::Document::to_schema_validate
ast::Document::to_executable_validate
DiagnosticList::new
DiagnosticList::merge