All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased - ReleaseDate
0.10.1 - 2025-04-15
0.10.0 - 2025-04-13
- add OneOfInput macro
0.9.0 - 2024-05-31
- use async-graphql 7
- fix clippy errors in generated codes
0.8.1 - 2023-11-06
- remove
dynamic_graphql::Uploadstruct and useasync_graphql::Uploadinstead
0.8.0 - 2023-10-17
- upgrade dependencies:
- upgrade
async-graphqlto6,synto2
- upgrade
- change
#[graphql(impl(Node))]to#[graphql(implements(Node))]
0.7.3 - 2023-03-28
- Add
#[graphql(validator(validate_fn))]attribute to validate scalar value
#[derive(Scalar)]
#[graphql(validator(validate_foo))]
struct Foo(String);
fn validate_foo(value: &Value) -> bool {
match value {
Value::String(s) => s.len() <= 5,
_ => false,
}
}- add docs for
Interfacemacro
0.7.2 - 2023-03-20
- add
Registry::set_subscriptionmethod
- add docs for
SimpleObjectmacro - add docs for
ResolvedObjectandResolvedObjectFieldsmacro
0.7.1 - 2023-03-04
- add
Registry::apply_into_schema_buildermethod
0.7.0 - 2023-02-21
- add Scalar support
#[derive(Scalar)]
struct MyScalar {
value: String
}
impl ScalarValue for MyScalar {
fn from_value(value: dynamic_graphql::Value) -> dynamic_graphql::Result<Self> {
match value {
dynamic_graphql::Value::String(value) => Ok(MyScalar { value }),
_ => Err(dynamic_graphql::Error::new("Invalid value")),
}
}
fn to_value(&self) -> dynamic_graphql::Value {
dynamic_graphql::Value::String(self.value.clone())
}
}- support
Resultas input type
- fix silent integer overflow cast in
FromValuetrait. Now it returns error if value is out of range.
- move internal types to
internalmodule - simplify
GetOutputTypeRef/GetInputTypeRefsignatures - change signature of
FromValuetrait. Now it returnsInputValueResult<Self>
0.6.1 - 2023-02-08
- Support generics in
Uniontypes
0.6.0 - 2023-02-08
- add
#[graphql(get_type_name)attribute to override type name
use std::borrow::Cow;
#[derive(SimpleObject)]
#[graphql(get_type_name)]
struct Foo {
value: String
}
impl TypeName for Foo {
fn get_type_name() -> Cow<'static, str> {
"Bar".into()
}
}- remove
MARKfromInterfacetrait - use function instead constant for type names
- rename
GraphqlTypetoTypeName - rename
InputTypetoInputTypeName - rename
OutputTypetoOutputTypeName
0.5.4 - 2023-01-30
- remove
.parent()from expand object - improve lifetimes for
ExpandObjectFields
0.5.3 - 2023-01-30
- Improve
Register,GraphqlType,OutputTypefor refs
0.5.2 - 2023-01-30
- add
Resolvetrait to unifyResolveOwnedandResolveRef
0.5.1 - 2023-01-29
- dependency
dynamic-graphql-deriveversion
0.5.0 - 2023-01-29
- Add
#[graphql(register())]attribute to register types manually
#[derive(SimpleObject)]
struct Foo { value: String }
#[derive(SimpleObject)]
#[graphql(register(Foo))] // also register `Foo` type when Example is registered
struct Example { value: String }- Add
#[graphql(auto_register())]attribute to register types automatically for each instance of interface
/// call `registry.register::<Foo<T>>()` for each instance of `Node` (T)
#[Interface]
#[graphql(auto_register(Foo))]
trait Node {
fn id(&self) -> String;
}- Add schema
datato share data between schema definitions and execution time
// schema definition time
fn register(mut registry: Registry) -> Registry {
let my_data: &mut MyStruct = registry.data.get_mut_or_default();
}
// execution time
fn some_fn(ctx: &Context<'_>){
let my_data = ctx.get_schema_data().get::<MyStruct>(); // Option<&MyStruct>
}- Remove the
InterfaceTargettrait
0.4.0 - 2023-01-28
- Automatic register used types.
#[derive(SimpleObject)]
struct Example { value: String }
#[derive(SimpleObject)]
struct Query { example: Example }
#[derive(App)]
struct App (Query); // no need to register Example manually- force
'staticlifetime for#[derive(App)]attribute
// old
#[derive(App)]
struct ExampleApp<'a>(ExampleQuery<'a>);// new
#[derive(App)]
struct ExampleApp(ExampleQuery<'static>);- remove support for mark object as interface with string
#[graphql(mark("Node"))] - The way of defining the interface is changed. No need to define a new name (e.g.,
NodeInterface) for the interface and use it in#[graphql(mark(NodeInterface))]and#[graphql(impl(NodeInterface))]attributes. Now you can use#[graphql(mark(Node))]and#[graphql(impl(Node))]attributes.
// old
#[Interface(NodeInterface)]
trait Node {
fn id(&self) -> String;
}
#[derive(SimpleObject)]
#[graphql(mark(NodeInterface))]
struct Foo { id: String }
#[derive(SimpleObject)]
#[graphql(impl(NodeInterface))]
struct Bar;
impl Node for Bar {
fn id(&self) -> String {
"bar".to_string()
}
}
#[derive(ResolvedObject)]
struct Query;
#[ResolvedObjectFields]
impl Query {
async fn node(&self, id: String) -> NodeInterface {
NodeInterface::new_owned(Foo { id })
}
}// new
#[Interface]
trait Node {
fn id(&self) -> String;
}
#[derive(SimpleObject)]
#[graphql(mark(Node))]
struct Foo {
id: String,
}
#[derive(SimpleObject)]
#[graphql(impl(Node))]
struct Bar;
impl Node for Bar {
fn id(&self) -> String {
"bar".to_string()
}
}
#[derive(ResolvedObject)]
struct Query;
#[ResolvedObjectFields]
impl Query {
async fn node(&self, id: String) -> Instance<dyn Node> {
Instance::new_owned(Foo { id })
}
}- every
GraphQLTypenow should implementRegistertrait - remove
InterfaceRoot - add
Instancestruct,RegisterInstancetrait - remove constraint
SizedfromTinRegister<T> - significant changes in
InterfaceMarktrait
0.3.0 - 2023-01-25
- support
Uploadtype
- fix
remotein enum to accept path with::separator
remotein enum now defined asgraphql(remote(path::to::Other))instead ofgraphql(remote = "path::to::Other")
// old
#[derive(Enum)]
#[graphql(remote = "path::to::Other")]
enum MyEnum {}// new
#[derive(Enum)]
#[graphql(remote(path::to::Other))]
enum MyEnum {}0.2.0 - 2023-01-25
SimpleObject,ResolvedObject: changegraphql(mark_as=),graphql(mark_with=),graphql(implement=)tographql(mark())andgraphql(impl())- change
async-graphqldependency to `5.0.5'
before this release SimpleObject, ResolvedObject can implement interfaces this way:
#[derive(SimpleObject)]
#[graphql(mark_as = "Node")]
struct MyType {}
#[derive(SimpleObject)]
#[graphql(mark_with = "NodeInterface")]
struct OtherType {}
#[derive(SimpleObject)]
#[graphql(implement = "NodeInterface")]
struct AnotherType {}after this release SimpleObject, ResolvedObject can implement interfaces this way:
#[derive(SimpleObject)]
#[graphql(mark("Node"))]
struct MyType {}
#[derive(SimpleObject)]
#[graphql(mark(NodeInterface))]
struct OtherType {}
#[derive(SimpleObject)]
#[graphql(impl(NodeInterface))]
struct AnotherType {}0.1.1 - 2023-01-24
- support for
MaybeUndefinedinput type
- fix error when argument or optional input field is not provided
- fix error when
ResolvedObjectFieldsandExpandedObjectFieldsare used on impl path (e.g.impl other::MyType)
- remove
GraphqlDoctrait - change
FromValueargument toResult<dynamic::ValueAccessor> - add
Outputassociated type toGetOutputTypeRefandGetInputTypeRef