Releases: obmarg/cynic
Releases · obmarg/cynic
v0.7.0
v0.6.0
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 thequery_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
Breaking Changes
Query::body
no longer exists, theQuery
itself is now directly
serializable, and exposes thequery
type itself. Errors that were
previously exposed byQuery::body()
will now be surfaced when serializing a
Query.Argument::new
has been updated to take aSerialiableArgument
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.
v0.4.0
Breaking Changes
schema_path
parameters are now relative toCARGO_MANFIEST_DIR
rather than
the current working directory. This fixes an issue with cargo workspace
projects where doc-tests would be relative to the sub-crate but cargo builds
were relative to the workspace root. For projects not using workspaces this
will probably make no difference- The
query_dsl
has been reworked. Before each field with arguments had one
or two structs: one for optional arguments & one for required arguments, and
these were passed to the selector function before the selection set argument.
Now each selector function takes the required arguments, and then returns a
struct that follows the builder pattern to allow for optional arguments to be
added. This fixes a few issues and is a bit more ergonomic.
Bug Fixes
- Fixed a bug where any type used as an optional argument needed to implement
Default. This was fixed by thequery_dsl
rework. - Fixed a bug where optional arguments that were enums or interfaces had to be
provided or type inference problems occurred. This was also fixed by the
query_dsl
rework.
v0.3.0
New Features
- Added chrono::DateTime scalar support behind a chrono feature flag.
- The
cynic::selection_set
module and all it's contents are now documented. QueryBody
now exposes it's arguments & query fields for greater flexibility
(and use in snapshot testing etc.)
Bug Fixes
- Generated
query_dsl
now disables unused import warnings where appropriate. - Exposed
Id::inner
&Id::into_inner
functions - these were meant to be
public but were not - Cleaned up a ton of compiler warnings - mostly unused imports and a few unused
variables query_dsl
addsallow(dead_code)
annotations so we don't get tons of dead
code warnings when we're not exercising an entire schema.query_dsl
no longer creates mutableVec
for fields without arguments -
this was leading to tons of "doesn't need to be mutable" warnings.ID
fields are now correctly given thecynic::Id
type inquery_dsl
- previously
they were being forced to String.cynic::Id
is now acynic::Scalar
- Fixed an issue in
derive(QueryFragment)
where Enums inside lists would not be
treated as Enums. DecodeError
now implementsstd::error::Error
v0.2.0
Breaking Changes
- The generated
query_dsl
no longer contains generated enums - users should
provide their own enums andderive(cynic::Enum)
on them. Cynic querygen
can be used to help with this. - The generated
query_dsl
no longer contains generated input objects - users
should provide their own structs andimpl cynic::InputObject
on them. A
derive for this should be coming in the future.
New Features
- Union types can be queried via
#[derive(InlineFragments)]
on an enum. - Schemas that use interfaces are now supported, though interfaces are not
yet queryable. #[derive(QueryFragment)]
now explicitly checks for required/list type
mismatches & other easy mistakes, and warns the user appropriately.- Added an
output_query_dsl
function suitable for running inside build.rs - Added a flatten option at the field level. When present this will flatten
nested options & vectors into the provided type. Used to handle the common
case in GQL where someone has defined an optional list of optionals. This is
a pain in Rust, since the same thing can usually be represented by a
non-optional list of non-optionals. - Added a cynic-querygen for generating QueryFragment structs from a graphql
schema & query. This currently has a WIP web interface and a WIP CLI, though
neither of them are particularly user friendly at this point. - Added a
cynic::query_module
attribute macro that can be applied to modules
containing QueryFragments & InlineFragments. When this attribute is present
the derive will be done for all QueryFragments & InlineFragments contained
within. This allows users to omit some of the parameters these derives
usually require, as thequery_module
attribute provides them and fills them
in. These modules may be expanded in the future to provide more
"intelligent" features. - Added support for mapN up to N = 50, therefore adding support for GraphQL
objects with up to 50 fields. - Added new
cynic::Enum
derive that matches up a Rust enum with a GraphQL enum.
cynic-querygen
will automatically provide enums using this derive when a
query includes an enum. - Added
SelectionSet::and_then
for chaining decode operations on selection sets. - Added
cynic::Scalar
derive for newtype structs so that users can easily
define their own scalars. Also added support for this to cynic-querygen - Added
cynic::Id
type to handle Ids in queries. - Added
cynic::InputObject
trait to allow thequery_dsl
to handle
InputObjects generically.
Changed
- Split the procedural macros out into their own cynic-proc-macros crate.
cynic-codegen now exists as a re-usable library for programatically
doing the codegen. - The IntoArguments trait is now named FromArguments and has had it's
parameters switched up. - Added a StarWars API example
Bug Fixes
- Now supports schemas that define their root query types. Before we just
assumed there was a type called query. - Fixed a few things that stop the examples in the documentation from
compiling. - Fixed all the tests
- We now use the correct case for non built-in scalar types
- Fixed an issue that prevented propagation of argument structs into inner
QueryFragments