Finding API Conformance Issues in API Definitions
Apply governance rulesets to API definitions as you author them, either in Design Center using API Designer or by using the governance CLI. You can also validate governance rulesets to make sure they are formatted correctly using the governance CLI.
To validate APIs against governance rulesets, add the rulesets as dependencies to API specifications in Design Center API Designer. After you add the rulesets, expand the Project Errors section to view conformance messages.
|1||Add rulesets to your API project.|
|2||View conformance issues and filter by level of severity.|
|3||Expand the Project Errors section of the text editor to view nonconformance messages.|
If you want to use a command to validate your API definition against governance rulesets, use the
governance api validate command.
This command does not validate the dependencies of the API definition, such as fragments.
> governance api validate <governance-ruleset> <api-definition-zip-file>
This command validates an API definition against a specified ruleset.
anypoint-cli governance api validate ~/Downloads/ruleset.yaml ~/Downloads/order-api-1.0.0-raml.zip
For a specification that is conformant to the ruleset:
Spec conforms with Ruleset
For a specification that is nonconformant to the ruleset:
Ruleset /path/Downloads/ruleset.yaml Spec /path/Downloads/order-api-1.0.0-raml.zip Spec does not conform with Ruleset [.. full report shown here..]