Skip to content

Releases: obmarg/cynic

v0.12.0

08 Feb 14:14
Compare
Choose a tag to compare

Breaking Changes

  • selection_set::inline_fragments now takes a backup selection set parameter
    for when we get an unexpected __typename.
  • The InlineFragments derive now performs exhaustiveness checking and
    validates the provided variants.
  • InlineFragments has a new required function fallback

New Features

  • InlineFragments are now validated for exhaustiveness & correctness.
  • InlineFragments now support a fallback variant for the case where users
    only care about some of the possibilities.
  • QueryFragment can now be derived for interfaces
  • chrono::NaiveTime is now supported as a Scalar when the chrono feature is
    active
  • Cynic errors will now suggest possible fixes when you mis-spell or mis-name
    a type in your code.

Changes

  • Updated reqwest dependency to 0.11

v0.11.1

30 Jan 17:18
Compare
Choose a tag to compare

Bug Fixes

  • Optional InputObject arguments can now be provided by reference. Previously
    this required a clone.
  • The generator no longer panics if it can't find the root type of a schema.
  • The generator no longer tries (and fails) to run queries when it has no URL
    to work with.
  • Makes sure docs.rs builds documentation for the HTTP client code.

v0.11.0

31 Dec 12:31
Compare
Choose a tag to compare

Breaking Changes

  • QueryFragment::fragment now accepts a FragmentContext rather than
    arguments. This change was neccesary to support recursive queries.
  • It is no longer recommended to use QueryFragment::fragment directly -
    instead an Operation should be constructed with QueryBuilder::build or
    MutationBuilder::build. Note that these return an Operation so you no
    longer need to construct one manually.
  • GraphQL fields with names that match rust keywords will no longer be
    postfixed with a _ - you should now use a raw identifier (or rename) for
    these fields.
  • Derived Enums now default to rename_all = "SCREAMING_SNAKE_CASE" if not
    provided. To revert to the old behaviour you should explicitly provide "None"
  • Derived InputObjects now default to rename_all = "camelCase" if not
    provided. To revert to the old behaviour you should explicitly provide
    rename_all = "None"
  • Removed the kebab-case & SCREAMING-KEBAB-CASE rename_all rules - fairly
    sure kebab case is not valid in GraphQL so this shouldn't affect much.

New Features

  • Cynic now supports recursive queries via the #[cynic(recurse="N")]
    attribute on fields that recurse.
  • The generator now understands query fragments, spreads and inline fragment
    spreads. Inline fragments for interface/union types are not yet supported.
  • Interfaces can be queried via #[derive(InlineFragments)] on an enum.
  • Added support for using chrono::NaiveDate as scalars. The decode/encode
    functions will convert to/from dates in the ISO 8601 format, that is
    YYYY-MM-DD
  • Added QueryBuilder & MutationBuilder traits for constructing Operations
    from QueryFragments.

Bug Fixes

  • The generator (and therefore the generator tests) should now work when run on
    windows.
  • Paths output as part of generator are now all raw strings, so should support
    windows path separators.
  • The generator now correctly wraps literal ID parameters with cynic::Id::New
  • Cynic derives (and cynic itself) no longer emit clippy warnings (on 1.48 at least)
  • We now support raw identifiers in QueryFragment derives, useful for fields
    named type or similar.
  • The generator now correctly renames InputObject fields & Enum variants if the
    default rename_all doesn't work for them.
  • The InputObject derive no longer looks up scalars inside query_dsl (which
    required them to be pub used in query_dsl).
  • The generator is now context aware with argument values, and does a better job
    of figuring out whether to clone or take by reference.

Changes

  • The generator is now a lot more thorough, it:
    • Deduplicates generated types
    • Supports multiple queries, sharing structs between all the generated queries
      as appropriate.
    • Generates unique names for each struct it creates, even when faced with
      different structs targetting the same type.
    • Generates partial InputObjects when faced with literals with missing fields
      (previously it would generate all fields even when unused)
    • Correctly generates different argument structs if a single type with
      arguments is used in multiple queries. Though the correct IntoArgument impl
      is not yet generated.
  • The generator now generates scalars with public fields
  • The generator now derives Clone on scalars as certain positions they can
    appear in require cloning
  • The generator now outputs correct Rust code when faced with queries that rely
    on list coercion.
  • rename_all attribute is no longer case sensitive.
  • Improved the docs for attributes in the book

v0.10.1

04 Nov 15:33
Compare
Choose a tag to compare

Bug Fixes

  • Implemented SerializableArgument for the various scalars in the
    integrations folder. This was preventing them actually being used as
    scalars in input contexts.

v0.10.0

11 Oct 15:21
Compare
Choose a tag to compare

Breaking Changes

  • QueryFragment::fragment and InlineFragment::fragments now accept their
    Argument parameters by reference.
  • define_into_argument_for_scalar has been renamed to
    impl_into_argument_for_options
  • There's no longer a blanket impl of SerializableArgument for any Scalar.
    SerializableArgument now needs to be implemented on each Scalar. There's
    a impl_serializable_argument_for_scalar macro that does this. The Scalar
    derive automatically calls this macro, so this is only a change if you have a
    custom Scalar
  • The IntoArgument trait now has an Output associated type that is used for
    the return value of IntoArgument::into_argument
  • The InputObject derive no longer complains if you omit optional fields.
    The old behaviour can be brought back by attaching a require_all_fields
    annotation to the InputObject.
  • SerializeError now requires Send + Sync on it's boxed value.

New Features

  • The bson feature, which allows to use ObjectId in schemas, added.
  • The uuid feature, which allows to use Uuid in schemas, added.
  • The url feature, which allows to use Url in schemas, added.
  • InputObjects may now contain fields inside a Box. This allows for
    recursive InputObject types.
  • The surf feature enables integration with the surf HTTP client, so users
    don't have to write it themselves.
  • The reqwest & reqwest-blocking features, which add support for the
    reqwest HTTP client.
  • Optional fields on an InputObject may now be annotated with
    skip_serializing_if="path", similar to serde. This allows users to omit
    fields from InputObjects under certain circumstances.
  • All optional fields of the GraphQLError type are now modeled according to the
    spec, including the extensions field, which is expressed as an
    Option<serde_json::Value>.

Changes

  • A SerializableArgument no longer needs to be 'static + Send.
  • FragmentArguments & InputObjects no longer need to be Clone.

v0.9.0

11 Sep 20:17
Compare
Choose a tag to compare

Breaking Changes

  • InputObject no longer has a serialize method - this is now handled by a
    SerializableArgument impl instead, which is generated by the InputObject
    derive.
  • Query has been renamed to Operation to make it clear it's used for both
    queries & mutations.
  • Query::new is now Operation::query

New Features

  • InputObjects can now be derived and will be generated by querygen.
  • Querygen output is now tested more thoroughly - should be less changes
    required by users just to get it to compile.
  • Cynic now supports running & generating code for mutations.

Removed Features

  • Removed the optimised_query_modules feature from codegen, as it invovled
    more code than it was worth to keep it around. Functionally this should make
    no difference, though it may change performance characteristics of compiling
    cynic code. Didn't seem to make a significant difference when I was using it
    though.

Bug Fixes

  • Fixed a compile issue in the generated query_dsl for schemas with fields
    with > 1 required argument.
  • Fixed an issue that required users to add serde_json to their dependencies.
    We now re-export it as cynic::serde_json and use that in our derive output.
  • querygen now adds rename_all="SCREAMING_SNAKE_CASE" to Enums by default -
    the GQL convention is to have them in this format and querygen was already
    doing the transformation into the PascalCase rust usually uses so this
    should make things more likely to work by default.
  • Removed fontawesome from the querygen HTML. Think I added this along with
    bulma but it's not being used, and adds 400kb to the payload.
  • Fixed a bug where querygen would not snake case field names when generating
    QueryFragments.
  • querygen will now take references to arguments rather than ownership (which
    didn't work for most non-enum types).
  • Fixed an issue where querygen was adding ID literals as Strings in arguments,
    rather than IDs.

v0.8.0

16 Aug 15:34
Compare
Choose a tag to compare

Breaking Changes

  • Integer fields are now i32 rather than i64 inline with the GraphQL spec. If
    larger integers are required a custom scalar should be used.
  • The cynic_arguments attribute for passing arguments to GraphQL fields is
    now named arguments

New Features

  • querygen-web now incorporates graphiql & graphiql explorer, to make testing &
    building queries easier.
  • querygen now supports bare selection sets, they're assumed to be queries.
    Quite easy to create these in GraphiQL/GraphqlExplorer, and they work for
    queries so seemed important.
  • Arguments are now converted using the IntoArgument<T> trait - default
    conversions are provided for Option and reference types, so users don't
    always have to wrap Options in Some or explicitly clone their arguments.
  • As a result of the above, cynic will no longer stop compiling when a schema
    changes a required argument to optional.

Bug Fixes

  • Fixed an issue with cynic-querygen where it guessed the name for the root of
    a query and crashed out if it was wrong (which was often).
  • Fixed an issue where querygen would fail if given a query with a hardcoded
    enum value (#33)
  • Integers are now i32 rather than i64, inline with the GraphQL spec. If
    larger integers are required a custom scalar should be used.
  • Querygen now puts argument_struct attrs on types that have arguments rather
    than just types that have children with arguments. (#37)
  • Fixed an issue where querygen would use the name of the query as the
    graphql_type on the root struct of named queries.
  • Fixed a bunch of broken links in the book.

v0.7.0

23 Jun 13:56
Compare
Choose a tag to compare

Breaking Changes

  • SerializableArguments are now required to be Send. Found this was
    required for using cynic in an async context. May revisit at some point to
    see if it's 100% required.

v0.6.0

17 Jun 09:49
Compare
Choose a tag to compare

New Features

  • cynic::Id now derives PartialEq, Hash & Eq
  • Added cynic::Id::new function

Bug Fixes

  • Using a query_module should no longer cause errors on an individual derive
    to be attributed to the query_module span - the error information should
    now be associated with the derive it originated from.
  • Fixed some dead code warnings in the selection builders output by query DSL

v0.5.0

14 Jun 16:20
Compare
Choose a tag to compare

Breaking Changes

  • Query::body no longer exists, the Query itself is now directly
    serializable, and exposes the query type itself. Errors that were
    previously exposed by Query::body() will now be surfaced when serializing a
    Query.
  • Argument::new has been updated to take a SerialiableArgument itself.
  • Removed selection_set::Error.
  • SerializableArgument::serialize & Scalar::encode now return
    Box<std::error::Error> errors rather than ()

Bug Fixes

  • cynic-codegen will now build with the rustfmt feature disabled.
  • Removed some unwraps that I lazily put in and forgot to remove.