Validating the YAML or JSON definition of an API or Product
You can validate a YAML or JSON definition by using the IBM® API Connect developer toolkit.
To complete the steps that are described in this topic, you must have installed the developer toolkit. For more information, see Installing the toolkit.
Before you begin
To perform validation by using the developer toolkit, enter the following command:
apic validate filename
where filename is the file name of the API definition file you want to validate.
- Include --product-only to validate only a Product definition and not any APIs that it references.
- Include --no-extensions to validate only the default OpenAPI section of the API and none of its extensions.
- If the OpenAPI file that defines your
API uses a
$reffield to reference a fragment of OpenAPI code that is defined in a separate file, the
$reffield is replaced with the contents of the target file before the draft API is created with the apic drafts:validate command. For more information, see Using $ref to reuse code fragments in your OpenAPI files.
- Products that contain an API with a Swagger property using regex that include
lookahead assertions, such as "
(?" cannot be validated or published. An error message is returned. For example:
Product has not been published! The multipart 'openapi' field contains an OpenAPI definition with validation errors. definitions.properties.pattern Does not match format 'regex' (context: (root).definitions.properties.pattern, line: 0, col: 0) 400