Skip to main content
Version: 0.8.0

What's new in v0.8

v0.8.0​

Breaking change: no ctx options argument when a schema declares none​

A schema without ctx_options(...) no longer takes () as the last argument of create, update and delete, and create/update no longer return () next to the data. Schemas that declare ctx_options(...) don't change.

// v0.7
let (post, _ctx_options) = PostModel.create(input, ()).unwrap();
let (changes, _ctx_options) = PostModel.update(post, updates, ()).unwrap();
PostModel.delete(&post, ());

// v0.8
let post = PostModel.create(input).unwrap();
let changes = PostModel.update(post, updates).unwrap();
PostModel.delete(&post);

What create and update return, for a schema without ctx_options(...):

The path has on_success/on_failure handlersv0.7v0.8
noOk((data, ())) / Err((errors, ()))Ok(data) / Err(errors)
yesOk((data, (), handle)) / Err((errors, (), handle))Ok((data, handle)) / Err((errors, handle))

"Nothing to update" is Err(None), or Err((None, handle)) with on_failure handlers. With no handlers, the error is the error payload itself, so .unwrap() and ? work directly. Handlers, validators and resolvers keep their options parameter: they receive () options, as before.

To migrate, remove the () argument from every call, and the _ctx_options element from the results (let (post, _ctx_options) = ... becomes let post = ...). The compiler points at every call that needs it.

The changes of v0.7 are in the v0.7.2 docs.