Skip to content

Add patterns.md example for calling an external API (#38)#46

Merged
yavorpanayotov merged 1 commit into
mainfrom
docs/external-api-pattern
Jun 19, 2026
Merged

Add patterns.md example for calling an external API (#38)#46
yavorpanayotov merged 1 commit into
mainfrom
docs/external-api-pattern

Conversation

@yavorpanayotov

Copy link
Copy Markdown
Collaborator

What

Adds a worked example to patterns.md for the common "my spec is a client that calls an external typed API" case — a third-party REST service, vendor SDK, or MCP server — closing #38.

Changes (docs only, no language change)

  1. New sub-example under Pattern 9Example: Calling an external API (the demands side). A self-contained geocoding-client spec showing:

    • a module-level contract (GeocodingApi) with typed signatures
    • a surface referencing it from the caller's side via contracts: demands GeocodingApi
    • a direction-marker note contrasting demands (call out / counterpart implements) vs. fulfils (supply the API) vs. provides (user fires a domain rule)
  2. Redirect note on Pattern 6's APIAccess surface — the exact spot where readers get misdirected toward provides: per the issue.

  3. Summary-table tweak — surfaces the "external-API client (demands)" keyword so a reader scanning for "API" finds Pattern 9.

Validity

Checked the new spec against the language reference: canonical section order, Decimal primitive, facing accepting an entity type directly, contract signatures with ≥1 param, @guidance after @invariants. The checker itself lives in juxt/allium-tools, so it was not run here.

Closes #38

🤖 Generated with Claude Code

Add a worked example under Pattern 9 showing the common "my spec is a
client that calls an external typed API" case: a module-level contract
referenced from the caller's surface via `contracts: demands`. Includes
a direction-marker note contrasting `demands` (call out / counterpart
implements), `fulfils` (supply the API), and `provides` (user fires a
domain rule).

Also add a redirect note on Pattern 6's APIAccess surface — where readers
get misdirected toward `provides:` — and surface the keyword in the
summary table for discoverability.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@yavorpanayotov yavorpanayotov merged commit 5df1b13 into main Jun 19, 2026
1 check passed
@yavorpanayotov yavorpanayotov deleted the docs/external-api-pattern branch June 19, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a patterns.md example for calling an external API

1 participant