Skip to content

v0.11.0

Compare
Choose a tag to compare
@obmarg obmarg released this 31 Dec 12:31

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