Skip to content

[Gap]: recipes hand-write validation and fixed responses that YAML already expresses #555

Closed

Description

@jimhoyd

What you were trying to do

Audit recipes/examples against the declarative-first rule (docs/PROJECT-DIRECTION.md).

Where it broke down

These recipes predate request.body.schema (69565c7) and respond.json, and still use trusted function code:

Location Hand-written Declarative replacement
recipes/contact-form/functions/contact.mjs:7-18 name/email/message checks request.body.schema (required, minLength, maxLength, pattern)
recipes/middleware/middleware/body.mjs:3-15 (+ examples/cookbook copy) name/age/unknown-field checks request.body.schema with additionalProperties: false
recipes/static-plus-api/functions/info.mjs fixed JSON respond: {json: …}
recipes/cors-api/functions/items.mjs fixed JSON list respond.json behind the CORS middleware
recipes/webhook-receiver/functions/receive.mjs:6-15 header + payload.id checks header parameter with pattern + request.body.schema
examples/cookbook/routes/code.yaml:47-53 two-value redirect choice conditional with match.query (low; file demonstrates code)
packages/auth/src/scaffold.ts:149 policies: {extensions: {auth: {}}} documented short form auth: true

Separately, recipes/middleware/middleware/{auth,request-id,errors,debug}.mjs comments describe "guest" limits (no atob, no crypto) although those routes run trusted.

Code or YAML you had to write by hand

The function modules listed above.

Verification

Read the files; ran urlcode review on five recipes (0 observations, see the review-detector issue). Not verified: that each replacement passes the recipe's fixtures — convert and run urlcode test per recipe.

Activity

  1. added
    ai-first
    examples
    on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-firstexamples

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions