Referring to an extension in an API definition
To refer to an OpenAPI extension in your API definition YAML (or JSON) file, add an extensions key under x-ibm-configuration.
Before you begin
About this task
The following example shows an extension definition file that defines a bank branch, in YAML
format:
extension: '1.0.0'
info:
title: Banking services
name: banking
version: 1.0.0
description: Banking extensions
contact:
name: IBM API Connect
url: https://apiconnect.ibm.com/
email: myname@ibm.com
portal-visible: true
properties:
title: "Branch"
type: "object"
properties:
Branch type:
type: "string"
enum:
- "ATM"
- "Walk in"
location:
type: "object"
title: "Location"
properties:
city:
type: "string"
default: "San Francisco"
state:
type: "string"
default: "CA"
citystate:
type: "string"
description: "This is generated automatically from the previous two fields"
template: "{{city}}, {{state}}"
watch:
city: "location.city"
state: "location.state"
required:
- Branch typeThe following table provides more information on the available fields when creating an API extension.
| Field | Description | Required | Default value | Example |
|---|---|---|---|---|
version |
Version number of the extension Note: The
version field must follow the
version.release.modification version numbering scheme. |
Yes | 1.0.0 |
|
title |
Title of the extension Note: The
title and name fields must
be kept short so that they can be displayed in the API Manager user interface. |
Yes | Banking service | |
name |
Short name for the extension Note: The
name field must be a single word and
contain only alphanumeric characters, dash, and underscore characters. |
Yes | banking | |
description |
Short description of the extension | No | Banking extensions | |
termsofservice |
Terms of service for the extension | No | Terms_of_Service | |
license.name |
Name of the license | No | IBM API Connect | |
license.URL |
URL to the license | No | https://apiconnect.ibm.com/ | |
contact.name |
Name of the contact | No | myname@ibm.com | |
contact.URL |
URL for contacting the organization | No | https://www.example.com/support | |
contact.email |
Email for contacting the organization | No | support@example.com | |
portal |
Whether the extension is visible in the developer portal | No | true |
true or false |
gateways |
List of gateways the extension can be used with Note: The
gateways field is
optional, but if included, it must list the types of gateways the extension can be used
with. |
No |
|
|
properties |
The custom properties to be included in the OpenAPI extension. | No | The properties field can be customized to include any valid OpenAPI
properties. |
Procedure
To enable the use of custom extensions in an API definition, complete the following steps: