Add patterns.md example for calling an external API (#38)#46
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a worked example to
patterns.mdfor 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)
New sub-example under Pattern 9 —
Example: Calling an external API (the demands side). A self-contained geocoding-client spec showing:contract(GeocodingApi) with typed signaturescontracts: demands GeocodingApidemands(call out / counterpart implements) vs.fulfils(supply the API) vs.provides(user fires a domain rule)Redirect note on Pattern 6's
APIAccesssurface — the exact spot where readers get misdirected towardprovides:per the issue.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,
Decimalprimitive,facingaccepting an entity type directly, contract signatures with ≥1 param,@guidanceafter@invariants. The checker itself lives injuxt/allium-tools, so it was not run here.Closes #38
🤖 Generated with Claude Code