Run artifact

workspace/targets/ReadingList/blueprint/FEATURE-AddBook.md

FEATURE: Add Book

FieldValue
Version20261014 V1
DescriptionAccept a title and author, store the book, and reject an empty title or author.
Depends OnARCHITECTURE.md, DATABASE.md
ProvidesPOST /books
Consumesbooks.create

Purpose

A reader adds a book with a title and an author. An empty title or author is rejected with a clear error.

Route

POST /books accepts a JSON body with title and author.

Database Interface

Programmatic Acceptance

=== AC add-book-stores-valid ===
Intent: A valid submission returns 201 with the stored book's title and author.

import uuid from app_server.testing import web_client

title = uuid.uuid4().hex author = uuid.uuid4().hex client = web_client() response = client.post("/books", json={"title": title, "author": author}) assert response.status_code == 201 body = response.get_json() assert body["title"] == title assert body["author"] == author assert isinstance(body["id"], int) === END AC add-book-stores-valid ===

=== AC add-book-rejects-empty-title ===
Intent: An empty title returns 400 and names the title field.

import uuid from app_server.testing import web_client

author = uuid.uuid4().hex client = web_client() response = client.post("/books", json={"title": "", "author": author}) assert response.status_code == 400 assert response.get_json()["field"] == "title" === END AC add-book-rejects-empty-title ===

=== AC add-book-rejects-empty-author ===
Intent: An empty author returns 400 and names the author field.

import uuid from app_server.testing import web_client

title = uuid.uuid4().hex client = web_client() response = client.post("/books", json={"title": title, "author": ""}) assert response.status_code == 400 assert response.get_json()["field"] == "author" === END AC add-book-rejects-empty-author ===

=== AC add-book-rejects-whitespace-title ===
Intent: A whitespace-only title is treated as empty and returns 400.

import uuid from app_server.testing import web_client

author = uuid.uuid4().hex client = web_client() response = client.post("/books", json={"title": " ", "author": author}) assert response.status_code == 400 assert response.get_json()["field"] == "title" === END AC add-book-rejects-whitespace-title ===

User Acceptance

Guardrails