apollo-compiler@1.0.0-beta.6
BREAKING
-
Make everything know their own name - SimonSapin, pull/727 fixing issue/708.
In a few places (but not consistently) a
namefield
was omitted from some structs used as map values
on the basis that it would have been redundant with the map key.
This reverts that decision,
making it the user’s responsibility when mutating documents to keep names consistent.- Add a
pub name: Namefield toexecutable::Fragmentas well as
ScalarType,ObjectType,InterfaceType,EnumType,UnionType, andInputObjectType
inschema. - Add a
fn name(&self) -> &Namemethod to theschema::ExtendedTypeenum - Add a
pub name: Option<Name>field toexecutable::Operation - Remove
executable::OperationRef<'_>
(which was equivalent to(Option<&Name>, &Node<Operation>)),
replacing its uses with&Node<Operation>
- Add a
-
Rename
DirectivesandDiagnosticstoDirectiveListandDiagnosticList-
SimonSapin, pull/732 fixing issue/711.
The previous names were too similar toDirectiveandDiagnostic(singular). -
Rename
ComponentStrtoComponentName- SimonSapin, pull/713
and itsnode: NodeStrfield toname: Name. -
Assorted changed to GraphQL names - SimonSapin, pull/713 fixing issue/710.
- Check validity of
ast::Name.
NodeStris a smart string type with infallible conversion from&str.
ast::Nameused to be a type alias forNodeStr,
leaving the possibility of creating one invalid in GraphQL syntax.
Validation and serialization would not check this.
Nameis now a wrapper type forNodeStr.
Itsnewconstructor checks validity of the given string and returns aResult.
A newname!macro (see below) creates aNamewith compile-time checking. OperationType::default_type_namereturns aNameinstead of&strType::new_named("x")is removed. UseType::Named(name!("x"))instead.ComponentStris renamed toComponentName.
It no longer has infallible conversions from&strorString.
Itsnodefield is renamed toname;
the type of that field is changed fromNodeStrtoName.NodeStrno longer has ato_componentmethod, onlyNamedoes- Various function or method parameters changed from
impl Into<Name>toName,
since there is no longer an infallible conversion from&str
- Check validity of
Features
-
Add serialization support for everything - SimonSapin, pull/728.
Schema,ExecutableDocument, and all AST types
already supported serialization to GraphQL syntax
through theDisplaytrait and the.serialize()method.
This is now also the case of all other Rust types
representing some element of a GraphQL document:schema::Directivesschema::ExtendedTypeschema::ScalarTypeschema::ObjectTypeschema::InterfaceTypeschema::EnumTypeschema::UnionTypeschema::InputObjectTypeexecutable::Operationexecutable::Fragmentexecutable::SelectionSetexecutable::Selectionexecutable::Fieldexecutable::InlineFragmentexecutable::FragmentSpreadexecutable::FieldSet
-
Assorted changed to GraphQL names - SimonSapin, pull/713 fixing issue/710.
See also the BREAKING section above.- Add a
name!("example")macro,
to be imported withuse apollo_compiler::name;.
It creates anast::Namefrom a string literal, with a compile-time validity checking.
ANamecreated this way does not own allocated heap memory or a reference counter,
so cloning it is extremely cheap. - Add allocation-free
NodeStr::from_static.
This mostly exists to support thename!macro, but can also be used on its own:let s = apollo_compiler::NodeStr::from_static(&"example"); assert_eq!(s, "example");
- Add a
Fixes
- Fix crash in validation of self-referential fragments - goto-bus-stop, pull/733 fixing issue/716.
Now fragments that cyclically reference themselves inside a nested field also produce a
validation error, instead of causing a stack overflow crash.