Releases: obmarg/cynic
Releases · obmarg/cynic
v2.0.1
v2.0.0
This release contains a lot of breaking changes.
See the upgrade guide for help
Breaking Changes
- Cynic no longer supports providing variables via the
arg.X
syntax. Instead
you should provide variables similar to how you would do in a GraphQL query:
#[arguments(someArg: $my_variable)]
, wheremy_variable
is a field on your
QueryVariables
struct. - Arguments should be provided with the casing of the GraphQL schema rather
thansnake_casing
them. - Cynic now derives
serde::Serialize
andserde::Deserialize
where
appropriate so you can no longer do this yourself on structs you are using
with cynic. - Decoding GraphQLResponses should now be done directly with serde using a
decode_response
function on the operation (unless you're using anhttp
extension trait, which will deal with this for you). Operation
has changed:- It no longer has a lifetime.
- It is now generic over the arguments type.
- The
http
extension traits have had their signatures changed to accomodate
the new signature ofOperation
. Their use should still be the same. - An
Enum
can no longer be shared between schemas. If you were doing this,
you should define twoEnum
s and provide conversion functions beteween the
two of them. InlineFragments
now always require a fallback and no longer perform
exhaustiveness checking.QueryBuilder
,MutationBuilder
andSubscriptionBuilder
no longer have a
ResponseData
associated type.QueryBuilder::build
,MutationBuilder::build
and
SubscriptionBuilder::build
now take their argument by value not by
reference.- The
surf
,reqwest
&reqwest-blocking
features have been renamed to
http-surf
,http-reqwest
&http-reqwest-blocking
respectively. - The
http-reqwest
feature no longer uses thenative-tls
feature. Users
should enable one of thetls
features ofreqwest
themselves. - The
surf-h1-client
,surf-curl-client
,surf-wasm-client
,
surf-middleware-logger
&surf-encoding
features have been removed. If
users want to enable these features in surf they should do it in their own
Cargo.toml
. cynic
no longer re-exportsserde_json
- The
GraphQlError
&GraphQlResponse
structs no longer contain a
serde_json::Value
for extensions. They now have generic parameters that you
should provide if you care about error extensions. - The output of the
use_schema
macro is no longer re-cased. - The deprecated
query_module
attribute for the various derive/attribute
macros has been removed - if you're using it you should update to
schema_module
which behaves the same.
Deprecations
- The
FragmentArguments
trait & derive has been renamed toQueryVariables
- The
argument_struct
attribute forQueryFragment
andInlineFragments
has
been deprecated in favour ofvariables
Bug Fixes
- Fixed a case where the generator would output the incorrect casing for some
occurrences of a custom scalar in the output (#346) - Cynic should now support schemas which have 2 similarly named but differently
cased scalars. - Cynic should no longer fail to compile in the face of various non-breaking
schema changes. #[cynic(flatten)]
no longer allows you to omit a list type on output fields.
Previously this would compile but probably fail to deserialize.- Non-nullable arguments & input object fields with defaults are no longer
considered required
Changes
- Cynic now supports a new syntax for arguments:
#[arguments(someArg: {"someField": 1})]
cynic
no longer usesinflector
to re-case things. Hopefully this won't
cause any regressions, but if it does please raise an issue.InlineFragments
now take their expected typenames from theQueryFragment
inside their variants, rather than from the name of the variants themselves.- Queries output by cynic may have more literals in the GraphQL query string
than they had in previous versions of cynic. Though the end result should
be the same. use_schema
output can now live in a separate crate from queries, which
should help with large schema support. (The exception isimpl_scalar
invocations which must live in the same crate as the schema)- Cynic now allows fields to be
Arc
orRc
- The generator no longer outputs input types that are provided in argument
literals, as these are no longer used in the generated code.
v1.0.0
Breaking Changes
- The
CynicReqwestError
enum (behind thereqwest
&reqwest-blocking
feature flags) has a new variant to handle non 2XX responses from servers. - Removed the
GraphQlResult
&PossiblyParsedData
types (which weren't being
used) - Removed the following deprecated things:
query_dsl!
, thequery_module
module attribute, theGraphQLError
,GraphQLResponse
,
GraphQLErrorLocation
&GraphQlErrorPathSegment
type aliases.
New Features
- The
InlineFragments
derive now supports a rename attribute on variants
Changes
- The
QueryFragment
derive now supports fields with types that take generic
parameters directly, e.g.DateTime<Utc>
from chrono. Previously this would
have required a type alias to hide the generic parameters from cynic.
Bug Fixes
- The various HTTP client integrations will now return HTTP error details and
the full body on non 2XX responses that don't contain a valid GraphQL
response. Previously they would have tried to decode the response as GraphQL
and returned the error from that operation.
v0.15.1
New Features
New generator features, so I'm putting them out in a point release:
- Querygen now supports inline fragments on union types & interfaces.
- Querygen now supports subscriptions
Bug Fixes
- Querygen no longer duplicates variable names in generated
ArgumentStruct
s
when an argument is used twice in a query. - Fixed support for
Float
scalars in the generator. - Fixed support for fields named
self
,super
etc. which can't be made into
raw identifiers.
v0.15.0
Breaking Changes
- Removed the no longer used
chrono
feature. It didn't enable any code so
downstreams shouldn't really be broken by this (other than a possible
Cargo.toml
tweak)
New Features
- Cynic now supports GraphQL field aliases. These can be requested, but will
also automatically be added to queries if any QueryFragment requests the same
field twice. - The generator also now supports field aliases.
Bug Fixes
- Fixed a case where the generator would not generate
InputObjects
that it
should have been generating, if thoseInputObjects
were arguments to a leaf
field.
Changes
- Disabled the heavyweight feature of inflector, which should make it (and
therefore cynic) a lighter dependency.
v0.14.1
v0.14.0
New Features
- You can now
spread
aQueryFragment
into anotherQueryFragment
with the
#[cynic(spread)]
field attribute. - The
QueryFragment
derive now supports renaming fields.
Bug Fixes
- Underscore field names are now supported in schemas and for querying.
- Field names with leading underscores will no longer have those leading
underscores removed.
v0.13.2
v0.13.1
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.