Skip to content

Releases: obmarg/cynic

v2.0.1

08 Nov 16:59
Compare
Choose a tag to compare

Bug Fixes

  • Some of the derives weren't recasing GraphQL types/fields correctly, leading
    to weird errors.
  • Scalars defined using impl_scalar! couldn't be used as variables. Now they
    can.

v2.0.0

07 Nov 15:44
Compare
Choose a tag to compare

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)], where my_variable is a field on your
    QueryVariables struct.
  • Arguments should be provided with the casing of the GraphQL schema rather
    than snake_casing them.
  • Cynic now derives serde::Serialize and serde::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 an http
    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 of Operation. Their use should still be the same.
  • An Enum can no longer be shared between schemas. If you were doing this,
    you should define two Enums and provide conversion functions beteween the
    two of them.
  • InlineFragments now always require a fallback and no longer perform
    exhaustiveness checking.
  • QueryBuilder, MutationBuilder and SubscriptionBuilder 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 the native-tls feature. Users
    should enable one of the tls features of reqwest 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-exports serde_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 to QueryVariables
  • The argument_struct attribute for QueryFragment and InlineFragments has
    been deprecated in favour of variables

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 uses inflector 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 the QueryFragment
    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 is impl_scalar
    invocations which must live in the same crate as the schema)
  • Cynic now allows fields to be Arc or Rc
  • 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

09 Dec 22:48
Compare
Choose a tag to compare

Breaking Changes

  • The CynicReqwestError enum (behind the reqwest & 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!, the query_module
    module attribute, the GraphQLError, 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

20 Oct 10:19
Compare
Choose a tag to compare

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 ArgumentStructs
    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

23 Sep 17:05
Compare
Choose a tag to compare

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 those InputObjects 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

29 Jul 16:01
Compare
Choose a tag to compare

Bug Fixes

  • InputObject now serializes fields in a stable order.

v0.14.0

06 Jun 13:25
Compare
Choose a tag to compare

New Features

  • You can now spread a QueryFragment into another QueryFragment 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

16 May 21:02
Compare
Choose a tag to compare

This release is only of the cynic crate - other crates remain at v0.13.1

Bug Fixes

  • This fixes a problem with JSON decoding that made it extremely inefficient
    (particularly on larger responses). In my benchmarking this improves
    decoding performance 10x.

v0.13.1

26 Apr 13:49
Compare
Choose a tag to compare

Bug Fixes

  • Fixes an issue where cynic would incorrectly case module certain names in the
    use_schema output

v0.13.0

04 Apr 16:57
Compare
Choose a tag to compare

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 add use 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.
  • 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 given query_dsl.
    • As a result, cynic can no longer define generic Scalar impls for 3rd party
      types (such as chrono, url, uuid etc.). The impl_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 in query_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.
  • 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 a InputType
    impl to do the conversion.
  • The uuid, chrono, bson, and url features have been retired. If you
    were using these you should register them as Scalar with the impl_scalar!
    macro.
  • SerializableArgument has been retired in favour of just using
    serde::Serialize.
  • The return type of cynic::Enum::select now includes the TypeLock of the
    enum. This should only affect users that were implementing cynic::Enum
    directly. Users of the derive should be unaffected.
  • IntoArgument has been removed in favour of the new InputType 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 of GraphQlError, GraphQlResponse, & GraphQlResult. The types are
    otherwise the same, just with different names.
  • query_dsl! has been deprecated in favour of a similar macro named use_schema!
  • It's now recommended that you name your query_dsl module schema instead.
  • cynic_codegen::output_query_dsl is now named cynic_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.