API Design & Governance
OverviewReferencesSession prep
Course
0/15
  1. 1Design-First Foundations
    • Why design-first
    • RAML vs OAS
    • Your first spec in API Designer
  2. 2Reuse & Fragments
    • Exchange as the reuse hub
    • Spec fragments & dependencies
    • Semantic versioning for APIs
  3. 3API Governance
    • Rulesets & conformance
    • Encoding org API standards
    • Automated conformance checks
  4. 4Lifecycle & Publishing
    • The mocking service
    • Publishing & the developer portal
    • Graceful deprecation
  5. 5Coaching the Rollout
    • Positioning design-first
    • Aligning with the C4E
    • Objections as coaching moments
References Session prep
Reuse & Fragments

Spec fragments & dependencies

7 min · 55 XP · Read → Check → Complete


Factor out what repeats

A spec fragment is a reusable piece of a specification published to Exchange as its own asset — a data type, a trait, a security scheme, a library. Other specs declare it as a dependency and pull it in.

RAML example — a shared library consumed via uses

#%RAML 1.0
title: Orders API
uses:
  common: exchange_modules/com.acme/common-types/1.0.0/common-types.raml
/orders:
  post:
    body:
      application/json:
        type: common.Order

Why it matters

  • One definition of Order, Error, or Pagination across every API.
  • Fix a shared type once; dependents adopt the new version deliberately.
  • Smaller, cleaner specs that are easier to review and govern.

Dependencies are versioned

When you add a fragment, Exchange records the exact version as a dependency. Upgrading is an explicit act — you bump the dependency, you do not get silently changed underneath.

Coaching note

Start fragments with the obvious shared shapes — common error envelope, pagination, standard headers. Over-fragmenting early creates ceremony; let reuse emerge from real repetition.

Check your understanding
  1. 1. What is a spec fragment?

  2. 2. How does a spec adopt a new version of a fragment it depends on?

  3. 3. What is the benefit of factoring common shapes into fragments?

  4. 4. In RAML, how are fragment dependencies declared?

  5. 5. What should you coach about starting with fragments?

  6. 6. What makes specs that use fragments easier to work with?

Exchange as the reuse hubSemantic versioning for APIs