Skip to content

Releases: obmarg/cynic

v0.12.3

02 Apr 14:49
Compare
Choose a tag to compare

Bug Fixes

  • The cynic::Scalar derive output no longer contains a spurious ? that
    clippy warns about in Rust 1.51.

v0.12.2

02 Apr 14:48
Compare
Choose a tag to compare

Bug Fixes

  • Hopefully fixed the build of documentation for docs.rs

v0.12.1

12 Feb 16:51
Compare
Choose a tag to compare

Bug Fixes

  • chrono::NaiveTime now supports times without seconds (e.g. 10:30)
  • Failures to parse chrono types now provide error messages that mention
    chrono: these were fairly hard to diagnose before.

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.