A small Mule 4 API built with spec-driven development (SDD) using OpenSpec.
The interesting part is not the API. It is the path from a one-line request to code:
- A short, incomplete request.
- An OpenSpec change (
proposal.md,specs/,design.md,tasks.md) that makes the missing decisions explicit, reviewed before any code exists. - Human approval of one commit of that change.
- An AI agent implementing from the approved artifacts only.
- Each spec scenario proven with a real call, below.
- The change archived into
openspec/specs/, and a second change that evolves the API through a delta.
Follow it in the commit history and in openspec/.
The add-delivery-status change is implemented and each of its scenarios is
proven with a real call (see Evidence, run on Mule runtime 4.12.3).
The add-estimated-delivery-date change adds estimatedDeliveryDate to the
successful response. The three success calls below were re-run on Mule runtime
4.12.3 with it. One call per unchanged error scenario (404, 400, 405) was
re-run and returned the same status line, Content-Type and body as before.
Each scenario of add-delivery-status, run against the application deployed on a
Mule 4.12.3 runtime with curl -si. Status line, Content-Type and body are the
real responses.
$ curl -si http://localhost:8081/api/orders/1001/delivery-status
HTTP/1.1 200 OK
content-type: application/json
content-length: 94
{
"orderNumber": "1001",
"status": "IN_TRANSIT",
"estimatedDeliveryDate": "2026-10-15"
}
$ curl -si http://localhost:8081/api/orders/1002/delivery-status
HTTP/1.1 200 OK
content-type: application/json
content-length: 91
{
"orderNumber": "1002",
"status": "PENDING",
"estimatedDeliveryDate": "2026-10-20"
}
$ curl -si http://localhost:8081/api/orders/1003/delivery-status
HTTP/1.1 200 OK
content-type: application/json
content-length: 85
{
"orderNumber": "1003",
"status": "DELIVERED",
"estimatedDeliveryDate": null
}
$ curl -si http://localhost:8081/api/orders/9999/delivery-status
HTTP/1.1 404 Not Found
content-type: application/json
content-length: 39
{
"message": "Order 9999 not found"
}
$ curl -si http://localhost:8081/api/orders/01001/delivery-status
HTTP/1.1 404 Not Found
content-type: application/json
content-length: 40
{
"message": "Order 01001 not found"
}
$ curl -si http://localhost:8081/api/orders/abc/delivery-status
HTTP/1.1 400 Bad Request
content-type: application/json
content-length: 44
Connection: close
{
"message": "Invalid order number: abc"
}
$ curl -si http://localhost:8081/api/orders/123456789012345678901/delivery-status
HTTP/1.1 400 Bad Request
content-type: application/json
content-length: 62
Connection: close
{
"message": "Invalid order number: 123456789012345678901"
}
$ curl -si -X POST http://localhost:8081/api/orders/1001/delivery-status
HTTP/1.1 405 Method Not Allowed
content-type: application/json
content-length: 37
{
"message": "Method not allowed"
}
$ curl -si -X POST http://localhost:8081/api/orders/abc/delivery-status
HTTP/1.1 405 Method Not Allowed
content-type: application/json
content-length: 37
{
"message": "Method not allowed"
}