v0.13.0
Breaking Changes
There are a number of breaking changes here, though they shouldn't require too
much work for users to update. An example of an upgrade can be found
here.
- The
cynic::Scalar
derive has some new requirements:- You should now derive (or otherwise implement)
serde::Serialize
for your
Scalar types. - The derive now requires a
schema_module
parameter. The
schema_for_derives
macro will automatically insert this (if you're using
it) but you may need to adduse super::schema;
to ensure it's
in-scope. - The derive now has an optional
graphql_type
parameter. This is required
if the name of your type and the name of the scalar in the schema differ.
- You should now derive (or otherwise implement)
- Scalars have been revamped:
- The scalar trait now has a typelock. This means that a Scalar impl is now
directly tied to the scalar definition in a givenquery_dsl
. - As a result, cynic can no longer define generic Scalar impls for 3rd party
types (such aschrono
,url
,uuid
etc.). Theimpl_scalar
macro has
been provided to allow users to use these types (or any type that is
serde::Serialize
) in their queries. - Cynic no longer requires you to define Scalar types you are not using.
select
functions generated for scalar fields inquery_dsl
now take
a selection_set that decodes the scalar type. This gives some flexibility
around scalar types.query_dsl
now defines markers for all the scalar types. As such you
should not import any custom scalars into your query_dsl module.
- The scalar trait now has a typelock. This means that a Scalar impl is now
- Required scalar arguments no longer have concrete types, so anything
that relied on type inference (i.e.arg = "hello".into()
) will no longer
work. You should either call an explicit function, or rely on aInputType
impl to do the conversion. - The
uuid
,chrono
,bson
, andurl
features have been retired. If you
were using these you should register them asScalar
with theimpl_scalar!
macro. SerializableArgument
has been retired in favour of just using
serde::Serialize
.- The return type of
cynic::Enum::select
now includes theTypeLock
of the
enum. This should only affect users that were implementingcynic::Enum
directly. Users of the derive should be unaffected. IntoArgument
has been removed in favour of the newInputType
trait.cynic::SerializeError
no longer exists.
New Features
- Support for building and decoding subscription queries.
- Alpha quality support for subscriptions over websockets with
graphql-ws-client
.
Deprecated
GraphQLError
,GraphQLResponse
, &GraphQLResult
have all been deprecated
in favour ofGraphQlError
,GraphQlResponse
, &GraphQlResult
. The types are
otherwise the same, just with different names.query_dsl!
has been deprecated in favour of a similar macro nameduse_schema!
- It's now recommended that you name your
query_dsl
moduleschema
instead. cynic_codegen::output_query_dsl
is now namedcynic_codegen::output_schema_module
.- The
query_module
attribute macro has been deprecated in favour of
schema_for_derives
- The
query_module
parameter to the derives has been deprecated in favour of
schema_module
.
Bug Fixes
- Cynic will now fail to compile you when you use an incorrect enum type for a
field in a QueryFragment. - Field type mismatch errors in QueryFragments are now reported on the span of
the field type. - You no longer need to define Scalars you are not using
- If a server adds a new scalar it will no longer break cynic clients.
- Fixed a case where InputObject errors were being shown against the
query_module
attr of the module they were defined in.
Changes
- The
graphql_type
parameter for most of the derives is now optional. It
defaults to the name of the struct/enum if not present. - Cynic will no longer generate invalid QueryFragments if fields are not
selected on a composite. - Cynic will now error if a QueryFragment selects no fields.