Skip to content

return-on-async

A Dynamic View return Step resolves to an async Relationship, which has no reply.

Severity: error · Since: v1.0.0

For the failing example below, archidocs check prints:

shop/services.yaml:28:11 error return-on-async Relationship "shop:mailer → shop:orders" is async, so it has no return; model a callback as its own Relationship

An async Relationship doesn’t wait for an answer, so there is no reply to draw. If the other side calls back later, that is a Relationship of its own and belongs in the Model.

shop/services.yaml:

services:
web:
name: Web
relationships:
- to: cart
cart:
name: Cart
components:
cart-api:
name: Cart API
orders:
name: Orders
events:
name: Events
type: broker
mailer:
name: Mailer
relationships:
- to: orders
interaction: async
via: events
channel: order-placed
views:
dynamic:
purchase:
title: Purchase
steps:
- { from: orders, to: mailer, return: true }

Remove the return Step, or model the callback as a Relationship of its own and add a Step for it.

shop/services.yaml:

services:
web:
name: Web
relationships:
- to: cart
cart:
name: Cart
components:
cart-api:
name: Cart API
orders:
name: Orders
events:
name: Events
type: broker
mailer:
name: Mailer
relationships:
- to: orders
interaction: async
via: events
channel: order-placed
views:
dynamic:
purchase:
title: Purchase
steps:
- { from: orders, to: mailer }

Documents the beta branch at cd98671, ahead of the latest release, v1.4.0.