Validating the OpenAPI YAML source

How to validate the OpenAPI YAML source against swagger specifications when you're editing an API.

About this task

When you're configuring an API in the API editor, you can validate the OpenAPI YAML source by clicking Validate > With specifications. If any swagger parser validation errors are found, an error icon is displayed that you can then click to see the individual errors, and where they occur in the YAML. You can then fix the errors, save the updates, and continue to validate the OpenAPI YAML throughout the API configuration process.
Note:
  • OpenAPI validation does not show gateway or policy errors that will stop your API from being staged or published. This type of validation occurs only when you try to stage or publish your API. For more information, see Staging an API or Publishing an API.
  • You can also validate your API document by using API governance rulesets. For more information, see Validating an API document by using API governance.

You can complete this task either by using the API Designer UI application, or by using the browser-based API Manager UI.

Procedure

To validate the OpenAPI YAML source, complete the following steps.

  1. Open the required API for editing, as described in Editing an OpenAPI 2.0 API definition or Editing an OpenAPI 3.0 API definition.
  2. Click Validate > With specifications from the menu bar in the header.
    Screen capture of the header menu bar showing the Online slider control, the Validate button, and the Save button.
  3. If any swagger parser validation errors are found, an error icon is displayed on the header menu bar, with the number of OpenAPI errors found displayed next to the icon.
    For example, Small, circular, red error icon, with the number one next to it..
  4. You can then click the error icon to see a detailed list of the errors, and their location in the YAML. If you're in Form Form icon view, you can click an individual error to navigate directly to the relevant API section in the form.
  5. After you fix the error, click Save to save your updates, and then click Validate again.
  6. When all of the errors are fixed, the validation returns a success message.
    For example, Screen capture of a small, green circle containing a black checkmark, next to the words API has been validated..