Track governance violations in the API specification
Postman supports API governance rules for API specifications in OpenAPI 3.2, OpenAPI 3.1, OpenAPI 3.0, and OpenAPI 2.0 formats in Spec Hub.
Rule customization. Enterprise teams can also customize rulesets that Postman applies to API specifications. For more information, see Manage your API governance rulesets and functions.
Check rule violations in Spec Hub
To check the governance rule violations in an API specification in Spec Hub, do the following:
- Expand Specs in the sidebar and select an API specification you want to review.
- Below the specification editor, click the Issues tab to view a list of governance rule violations.
To learn more, see View rule violations in your specification.
Track governance rule violations in CI/CD
This feature is available with Postman Enterprise plans.
You can add a lint check to your CI/CD pipeline that enforces the API governance rulesets configured for your team every time the pipeline runs. Postman generates the Postman CLI configuration for the check from the specification editor.
To add a governance lint check to your CI/CD pipeline, do the following:
-
Expand Specs in the sidebar and select an API specification.
-
In the workbench, click
Lint in the upper right.
-
In the Spec Lint pane, select CI/CD Pipeline.
-
Select a CI/CD Provider and an Operating system for CI/CD.
-
Add the check to your pipeline:
- Copy the command - Click Copy Postman CLI Command, then paste the command into your CI/CD configuration file.
- Add a GitHub Actions workflow - If you’re working in Local View with GitHub Actions selected, click Add checks to repo to add the workflow file to your repository. To review the configuration and copy it yourself instead, expand View file and add checks manually.
- Use Agent Mode - If you’re working in Local View with a GitLab provider selected, click Add with Agent Mode to have Agent Mode add the check to your pipeline. To copy the command yourself instead, click Copy Command.
-
The generated command logs in to the Postman CLI with a Postman API key. If you haven’t already, save your Postman API key as a secret variable in your CI/CD provider.
When your CI/CD pipeline runs, the Postman CLI checks your specification for governance rule violations. To run the same check on your computer, select Terminal in the Spec Lint pane. To learn more, see Run a spec lint check with the Postman CLI.
Next steps
For the list of all the rule violations that Postman might show at the API specification phase of development, see OpenAPI 3 rules and OpenAPI 2 rules.