Overview

19 Enriching API design artifacts

This chapter explains how to enrich an API design reference kit so it better serves design discussions and the next stages of the API lifecycle. The kit—built around an API capabilities canvas, an OpenAPI document, and design guidelines with a shared library and lint rules—acts as a living, central source of truth. It helps teams refine needs, model concepts and operations, align on security and behavior, and then carry that clarity into development, testing, deployment, and consumption; for private APIs, it is often the primary resource developers rely on. The emphasis is on practical, context-aware enhancements that improve understanding and accuracy without turning the kit into full-blown public documentation.

Several low-effort improvements raise the kit’s usefulness: adding a concise overview and cross-references in OpenAPI, grouping operations by concepts and use cases with tags, and—where needed—lightweight use case descriptions. Data models gain precision by leveraging JSON Schema keywords for ranges, sizes, patterns, enumerations, and defaults, reducing ambiguity for documentation, code generation, testing, and mocking. Carefully crafted examples further clarify intent: small, property-level samples in schemas and richer, documented examples for parameters, bodies, and headers in OpenAPI, with reuse to avoid duplication and consistent naming to connect request/response pairs. The chapter stresses balancing effort and value—favoring focused examples and shared patterns, supported by lint rules and compatible tooling—over exhaustive, portal-grade artifacts during design.

To smooth implementation, the chapter advocates embedding targeted implementation notes in OpenAPI or guidelines and adapting the spec for code generation by using stable tags, operation identifiers, and JSON Schema features supported by generators. For experiential feedback, teams can spin up basic mocks directly from OpenAPI or prefer an early implementation prototype when realistic behavior is needed, keeping heavy scripted mocks for later. Finally, adding functional tests during design can clarify complex logic, reduce cross-team friction, and support standard APIs, while remaining mindful that broader performance and security testing unfold later. Overall, the recommended enrichments are modular, tool-friendly, and tailored to context, turning a solid kit into a durable accelerator for building, testing, deploying, and documenting APIs.

Though "Enrich API design artifacts" is the final step in the sequential design process diagram, we work on the API design reference kit across all steps. Its content is helpful during design and the subsequent API lifecycle stages.
CH19 F01 lauret3
The API design reference kit contains all the artifacts necessary to describe an API and help understand it fully. Artifacts can be documents (such as a wiki page or guidelines), machine-readable documents (such as OpenAPI), applications (such as a simulated API or linter), or pieces of code (such as tests).
CH19 F02 lauret3
Add an info.summary is necessary for understanding. Leverage Markdown in info.description or the root externalDocs.url to link the OpenAPI document to other artifacts.
CH19 F03 lauret3
Group operations by adding tags. Sort groups by adding the root-level tags list. Operations can’t be reordered in groups.
CH19 F04 lauret3
By leveraging a tag’s externalDocs, we may add a link to the sheet and line corresponding to the use case in the API capabilities canvas.
CH19 F05 lauret3
The root tag object supports a Markdown description; we may use it to describe the order of the operations, but that may be a lot of work.
CH19 F06 lauret3
JSON Schema allows for defining numerical ranges and array and string lengths. These ranges can be open-ended.
CH19 F07 lauret3
JSON Schema can describe a value with pattern (regex), enum (authorized values), and default (default value).
CH19 F08 lauret3
To describe data better, add a single example or examples list to any part of a schema; this will improve schema documentation and generated samples.
CH19 F09 lauret3
Add an examples map near the schema of a parameter, request or response body, or response header to illustrate it better with one or multiple documented examples.
CH19 F10 lauret3
Define examples under components.examples and use them with a $ref to avoid duplication.
CH19 F11 lauret3
Use the same example key (for tools) and summary (for documentation readers) to enable connecting examples.
CH19 F12 lauret3

FAQ

What is an API design reference kit and why does it matter?The kit is a curated set of artifacts that fully describe an API’s interface to support design, development, testing, deployment, and consumption. Core items include the API capabilities canvas, an OpenAPI document, and design guidelines (with an OpenAPI library and linting rules). Optionally, it can include a simulated or prototyped API and functional tests. It becomes a central source of truth during design and a practical deliverable across the API lifecycle.
What are the core artifacts and which enrichments are worth considering?Core: API capabilities canvas, OpenAPI, and design guidelines (library + rules). Enrichments: add an overview and links in OpenAPI, sharpen data models with JSON Schema, provide examples (JSON Schema and OpenAPI), embed implementation notes or extensions, adapt OpenAPI for code generation, create a mock or early prototype, and include functional tests. Tailor the effort to your context—this kit is not a public API portal, but may be the only resource for private APIs.
How can I make my OpenAPI file a central hub for the kit?Add a concise info.summary and a richer info.description with Markdown links to related artifacts (canvas, guidelines, linters, test collections, mock/prototype). Use root-level externalDocs to link to a documentation hub if OpenAPI is not the central page. Most OpenAPI objects also support description and externalDocs—use them to cross-link components to guidelines.
How do tags improve the API overview for concepts and use cases?Assign tags to operations to group them by domain concepts or use cases; tools render navigation by tag, making long operation lists easier to understand. Define a root-level tags list to control group order. For use-case ordering of operations, consider complementary formats since operations within a tag cannot be reordered.
What’s the best way to document use case flows: OpenAPI, Arazzo, or Postman?Lightweight: use OpenAPI tags with optional descriptions or externalDocs links to your canvas. Richer flows: use Arazzo (for HTTP operation sequences) if your tooling supports it. Hands-on and testable: use Postman Collections to model sequences with examples and scripts, which can later power mocks or tests.
How can JSON Schema increase data model precision?Use JSON Schema keywords to replace vague prose: - Ranges: minimum, maximum, exclusiveMinimum, exclusiveMaximum - Lengths: minItems/maxItems (arrays), minLength/maxLength (strings) - Patterns: pattern for regex validation - Enumerations: enum for fixed sets - Defaults: default for static default values If values are dynamic (e.g., enums or limits), expose an endpoint instead of hard-coding them.
When and how should I add examples, and what tool caveats apply?For individual fields, prefer JSON Schema examples (examples array). For parameters, bodies, and headers, use OpenAPI examples (a named map with value, summary, description). Avoid the singular example wherever possible in OpenAPI; the examples map is richer. Add spectral rules (oas3-valid-media-example, oas3-valid-schema-example) to validate examples against schemas. Some tools still favor example over examples—check compatibility.
How do I avoid duplicating examples and connect request/response examples?Define reusable examples under components.examples and $ref them where needed to avoid duplication (e.g., a common “empty search result”). To connect end-to-end examples, give request and response examples the same key and summary (e.g., “Success”) so users and tools can correlate them. For many complete, linked examples, consider Postman Collections.
How can I add implementation notes without polluting public docs?Embed implementation notes in descriptions (clearly marked, e.g., “Implementation notes”) or use custom extensions like x-implementation-notes. Keep generic implementation guidance in guidelines and link from OpenAPI (externalDocs). If the kit feeds public docs, strip these notes with tooling (jq/yq or JSONPath-based scripts) before publishing.
When should I mock, prototype, or add functional tests during design?Quick feedback: generate a basic mock from OpenAPI (tools like Microcks or Postman) using schemas and examples. Realistic behavior: favor an early implementation prototype over complex scripted mocks; you can evolve it into the final service. Functional tests are useful to clarify tricky logic, smooth cross-team collaboration, or enforce private standards; use portable formats like Postman Collections.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • The Design of Web APIs, Second Edition ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • The Design of Web APIs, Second Edition ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • The Design of Web APIs, Second Edition ebook for free