Overview

8 CI/CD for API artifacts 1: Source-stage governance controls

Large organizations often have many teams producing external APIs, and manual governance by a central review group does not scale well. To reduce slow reviews, inconsistent practices, and developer frustration, the chapter argues that API definitions and related deliverables should be treated as code and managed inside the CI/CD pipeline. That way, teams can get fast, repeatable feedback on design quality, conformance to style guidance, and the generation of API-related outputs such as documentation, SDKs, and score reports.

The chapter then shows how a pull request–based workflow can become the entry point for API governance. Instead of exchanging files and feedback through email, API design proposals live in version control and are reviewed through PRs. A minimum design review criteria gate is established so PRs must satisfy automated checks before governance review begins. These checks include validating the PR title for a work ticket reference, running API linting, checking for breaking changes, and optionally running prose linting on documentation, while code owner approval ensures that the governance team must sign off before merge.

Finally, the chapter broadens the discussion from individual checks to pipeline design and API artifact management. It explains how build server automation can enforce quality gates, provide clear failure feedback, and keep reviews fast, while also emphasizing practical concerns like branch protection, team roles, and reporting. It then introduces multifile API definitions as a way to manage large OpenAPI documents by splitting reusable components into separate files, bundling them when needed, and using tooling or design collaboration platforms to support maintainability and reuse without sacrificing governance.

An example flow of files and conversation between the governance team and a development team during the review of an API design change proposal
figure
The process the Acme team uses to check that PRs satisfy the minimum design review criteria and get approval from the governance team
figure
The Acme team’s deployment pipeline
figure
GitHub Actions concepts applied to the PR build workflow. On the GitHub Actions platform, events trigger workflows that are executed on runners.
figure
Extending the workflow file with a new job to validate the MDRC
figure
Output from running Vale on the API guide documentation
figure
Setting up GitHub branch protection rules
figure
Code owner reviews are required on PRs that change files in the chapter8/apis directory.
figure
The structure of an external OpenAPI reference
figure
An example of the directory structure containing a multifile OpenAPI document
figure

Summary

  • API governance teams can define minimum design review criteria (MDRC)—a set of automated checks that API design change proposals must pass before they go through a PR review. These automated checks in the pipeline should include API linting, breaking change checks, and any other automated checks the governance team thinks are important.
  • Using PR templates to prompt API designers to provide contextual information on why API design change PR is required helps PR reviewers understand the reason and scope of changes and helps them review it quicker.
  • Assigning code owners to files is a technique for requiring domain experts to review and approve changes to files in a team’s source repository. You can set members of the API governance team as code owners for API definition files to enforce that all design changes are reviewed by them.
  • Prose linters such as Vale can run in your PR build to check API guide documentation files for punctuation, spelling, grammar, style, and readability.
  • When using an API design collaboration tool, you can integrate with the source repository that contains your API definition files. Ensure the version-controlled source repository is the primary store of the API definition files.
  • Splitting API definition files into multiple files helps you make them more manageable and enhances collaboration on them with multiple teams. It also promotes the reuse of shared API components.

FAQ

Why should API definitions and related documentation be stored in version control instead of being shared by email or chat?Storing API definition files and guide documentation in version control creates a single source of truth, preserves file history, makes changes easy to review with diffs, and supports scalable collaboration through pull requests instead of scattered manual conversations.
What is a minimum design review criteria (MDRC) in an API delivery pipeline?An MDRC is a set of automated checks that API design proposals must pass before human review begins. In this chapter, it includes checks like PR title validation, API linting, breaking change detection, and prose linting for documentation.
How does a PR build help automate API governance?A PR build runs automated checks when a pull request is created or updated. It gives fast feedback on API consistency, breaking changes, and documentation quality, so the governance team only reviews proposals that already meet the required baseline.
Why is a PR template useful for API design proposals?A PR template prompts the submitter to include the reason for the change, the scope of the change, and a checklist. This improves review context and helps the governance team understand the proposal without having to ask for basic details.
How can a workflow validate that a PR title contains a work ticket reference?A script can check the PR title against a required pattern such as DEV-XXXX. If the title does not match, the workflow fails and tells the submitter to add a valid ticket reference.
How are API linting checks run in the GitHub Actions workflow?The workflow can run Spectral from the runner using npx, linting the OpenAPI definition against the project ruleset. This lets the pipeline fail on serious API style violations without needing a separate manual review first.
How are breaking changes detected between the PR branch and the main branch?The workflow checks out the main branch into a separate folder and uses a tool such as oasdiff to compare the baseline API definition with the one in the PR branch. If a path or other contract detail was removed or changed unsafely, the build fails.
Why is prose linting included in the source-stage governance controls?API guide documentation is treated as code, so it should also be checked automatically. Prose linting tools like Vale help catch spelling, grammar, punctuation, and style issues before the documentation is merged.
What is the purpose of code owners in API governance?Code owners ensure that changes to sensitive files, such as API definitions and API documentation, require approval from the right domain experts. In this chapter, that means the API governance team must approve relevant pull requests before they can be merged.
What are multifile API definitions and why use them?Multifile API definitions split a large OpenAPI document into smaller reusable files, such as separate path and component fragments. This improves maintainability, reduces merge conflicts, and makes large API definitions easier for teams and tools to manage.

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


Close
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
  • Automating API Delivery Automating API Delivery ebook for free
Close
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
  • Automating API Delivery Automating API Delivery ebook for free
Close
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
  • Automating API Delivery Automating API Delivery ebook for free