Manage your API governance rulesets and functions

View as Markdown

The Ruleset Library is where you manage the reusable building blocks of your team’s governance strategy:

  • Rulesets — Sets of governance rules that validate your OpenAPI specifications against your custom standards. Rulesets can be applied to your team’s workspaces to enforce those standards.
  • Functions — Custom validation logic written in JSON or YAML and linted by Spectral. Use functions to enforce checks that aren’t covered by the standard rule types or that are custom to your team’s needs. Functions can be used in any ruleset.

Use the search field to find a specific ruleset or function, and click Add icon Create new to create a ruleset or function. The right pane provides quick access to Create a ruleset and Create a function. Each ruleset and function includes a rendered documentation view, making reviews easier without reading raw JSON or YAML. Users with the API Governance Manager or the API Catalog Manager role can manage rulesets and functions in the Ruleset Library.

The API Catalog's ruleset and functions interface

When editing your custom rulesets and functions, you can use the following options:

  • Use the JSON or YAML dropdown list to switch between the two formats for rulesets. Postman converts your ruleset between the two formats automatically.
  • Console icon View Command Palette — Opens the command palette, which provides quick access to frequently used commands.
  • Pretty icon Beautify — Formats your ruleset or function to make it easier to read.
  • Wrap icon Wrap text — Wraps long lines of text in the editor.
  • Copy icon Copy — Copies the entire ruleset or function to your clipboard.
  • Search icon Find — Search for specific strings.
The Ruleset Library editor menu options

Add a custom ruleset

Add a custom OpenAPI ruleset to create a reusable set of rules you define. You can create a ruleset from scratch or use the boilerplate ruleset to help you get started.

To add a custom ruleset, do the following:

  1. Click Home icon Home in the upper-left corner of the Postman app, then select API Catalog.
  2. Click Governance Groups in the sidebar.
  3. Click Create a ruleset. Or, select the Ruleset Library tab, then click Add icon Create new and select OpenAPI Ruleset.
  4. (Optional) Click the ruleset’s filename to rename it. By default, Postman creates a ruleset with a generic name (for example, “new-openapi-ruleset-1”).
  5. Select the Definition tab to edit the ruleset. You can write your ruleset from scratch or use the boilerplate ruleset to help you get started. As you write your ruleset, the editor provides autocompletion and syntax validation.
  6. Click Save to save your changes.

After you finish creating your ruleset, you can view your rules in the Documentation tab. You can then apply your ruleset to any workspace in your team by adding it to a governance group.

Add a custom function

You can add custom governance functions to use in your rulesets. Postman provides a boilerplate function to help you start writing your custom governance function. You can write your functions using JavaScript and Node.js. The editor provides autocompletion, syntax validation, and save gating to help you write your functions.

To add a custom function, do the following:

  1. Click Home icon Home in the upper-left corner of the Postman app, then select API Catalog.
  2. Click Governance Groups in the sidebar.
  3. Click Create a function. Or, select the Ruleset Library tab, then click Add icon Create new and select Custom Function.
  4. (Optional) Click the function’s filename to rename it. By default, Postman creates a function with a generic name (for example, “new_custom_function_1”).
  5. Write your function in the editor, following the custom functions guidelines.
  6. Click Save to save changes to your function.

Delete a function or ruleset

To delete a function or ruleset, do the following:

  1. Click Options icon More actions and select Delete next to the ruleset or function’s name.
  2. In the confirmation dialog, click Delete to confirm that you want to remove it.

Deleting rulesets and functions removes them permanently and they can’t be recovered. Any governance groups that reference removed rulesets or functions will fail to evaluate until the reference is updated.

Custom governance rule and function guidelines

Postman supports Spectral for custom governance rules and functions.