Adding an OpenAPI (Swagger 2.0) extension to an API definition (API Manager UI)
When you configure a REST or SOAP API definition, you can extend the OpenAPI (Swagger 2.0) specification by adding either a JSON or YAML extension schema depending on the version of IBM® API Connect you are using. You can also replace an extension with an updated version.
About this task
To make an extension available for adding to an API definition, you must first import a schema definition file for the extension. You import the extension into a Catalog; any extensions that are imported into Catalogs can be added to any of your API definitions.
Your schema definition file must be in JSON format.
Your schema definition file can be in YAML format or JSON format.
When you add an extension to an API definition, you can set values for any of the properties that are defined in the schema definition file for the extension. The values that you specify are subject to any validation criteria that are defined in the schema definition.
{
"extension": "1.0.0",
"info": {
"title": "Banking services",
"name": "banking",
"version": "1.0.1",
"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 type"]
}
}
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 type