Releases: apollographql/apollo-rs
apollo-encoder@0.7.0
BREAKING
-
apollo-parser@0.6.0 - goto-bus-stop, pull/621
This updates the version of
apollo-parser
required by theTryFrom
implementations in this crate. -
apollo-compiler@0.11.0 - goto-bus-stop, pull/622
This updates the version of
apollo-compiler
required by theTryFrom
implementations in this crate.
apollo-compiler@0.11.0
Features
- add
InterfaceTypeDefinition::implementors(&db)
to list object types and other interfaces that implement an interface, by Geal in pull/616
Fixes
- fix
SelectionSet::is_introspection
when the same fragment is spread multiple times, by glasser in pull/614, issue/613
Maintenance
- update
apollo-parser
to 0.6.0, by goto-bus-stop in pull/621
apollo-encoder@0.6.0 (#589)
BREAKING
-
apollo-compiler@0.10.0 - goto-bus-stop, pull/588
This updates the version of
apollo-compiler
required by theTryFrom
implementations in this crate.
Fixes
-
schema extension without fields skips empty block - dariuszkuc, pull/582
Prevents outputting the invalid code
extend schema {}
.
apollo-compiler@0.10.0
BREAKING
SelectionSet::merge
is renamed toSelectionSet::concat
to clarify that it doesn't do field merging, by goto-bus-stop in pull/570hir::InlineFragment::type_condition
now only returnsSome()
if a type condition was explicitly specified, by goto-bus-stop in pull/586
Features
-
add
root_operation_name(OperationType)
helper method onhir::SchemaDefinition
by SimonSapin in pull/579 -
add an
UndefinedDirective
diagnostic type, by goto-bus-stop in pull/587This 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
- update dependencies, by goto-bus-stop in commit/daf918b
- add a test for validation with
set_type_system_hir()
, by goto-bus-stop in pull/583
apollo-compiler@0.9.4
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/577When 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.
apollo-compiler@0.9.3
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
- use official ariadne release, by goto-bus-stop in pull/568
apollo-compiler@0.9.2
Features
-
add
as_$type()
methods tohir::Value
, by goto-bus-stop in pull/564These 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/563Previously undefined variables were reported with an
UndefinedDefinition
diagnostic.
Splitting it up lets us provide a better error message for missing variables.
apollo-compiler@0.9.1 (#561)
Fixes
- Update the apollo-parser dependency version, by goto-bus-stop in pull/559
apollo-parser@0.5.3
apollo-compiler@0.9.0
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
- validate values are of correct type, by lrlna in pull/550
- support the built-in
@deprecated
directive on arguments and input values, by goto-bus-stop in pull/518 - validate that variable usage is allowed, by lrlna in pull/537
- validate executable documents do not contain type definitions, by goto-bus-stop in pull/535
- validate union extensions, by goto-bus-stop in pull/534
- validate input object extensions, by goto-bus-stop in pull/533
- validate interface extensions, by goto-bus-stop in pull/532
- validate enum extensions, by goto-bus-stop in pull/528
- validate object type extensions, by goto-bus-stop in pull/524
- validate fragment spread is possible, by goto-bus-stop in pull/511
Fixes
- fix recursion cycle in
is_introspection
HIR getter, by allancalix and goto-bus-stop in pull/544 and pull/552