Releases: obmarg/cynic
Releases · obmarg/cynic
v0.12.3
v0.12.2
v0.12.1
v0.12.0
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 functionfallback
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 interfaceschrono::NaiveTime
is now supported as a Scalar when thechrono
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
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
Breaking Changes
QueryFragment::fragment
now accepts aFragmentContext
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 withQueryBuilder::build
or
MutationBuilder::build
. Note that these return anOperation
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 torename_all = "SCREAMING_SNAKE_CASE"
if not
provided. To revert to the old behaviour you should explicitly provide "None" - Derived
InputObjects
now default torename_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
namedtype
or similar. - The generator now correctly renames InputObject fields & Enum variants if the
defaultrename_all
doesn't work for them. - The
InputObject
derive no longer looks up scalars insidequery_dsl
(which
required them to bepub use
d inquery_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
v0.10.0
Breaking Changes
QueryFragment::fragment
andInlineFragment::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 anyScalar
.
SerializableArgument
now needs to be implemented on eachScalar
. There's
aimpl_serializable_argument_for_scalar
macro that does this. TheScalar
derive automatically calls this macro, so this is only a change if you have a
customScalar
- The
IntoArgument
trait now has anOutput
associated type that is used for
the return value ofIntoArgument::into_argument
- The
InputObject
derive no longer complains if you omit optional fields.
The old behaviour can be brought back by attaching arequire_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. InputObject
s may now contain fields inside aBox
. This allows for
recursiveInputObject
types.- The
surf
feature enables integration with thesurf
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 theextensions
field, which is expressed as an
Option<serde_json::Value>
.
Changes
- A
SerializableArgument
no longer needs to be'static + Send
. FragmentArguments
&InputObject
s no longer need to beClone
.
v0.9.0
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 toOperation
to make it clear it's used for both
queries & mutations.Query::new
is nowOperation::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 ascynic::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 thePascalCase
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
QueryFragment
s. - 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
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 namedarguments
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 forOption
and reference types, so users don't
always have to wrap Options inSome
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.