API Connect has the ability to load and attacked Open API Extensions. Here we show how to access the content from the extension in the API Runtime.

For more information on OpenAPI Extensions please review https://swagger.io/docs/specification/v3_0/openapi-extensions/

To add an extension document in API Connect the following links can be used.

The Open API Extension can be accessed in a GatewayScript policy by retrieving the swagger document.

  if (context.swagger) {
    context.swagger.readAsJSON(function(error, swaggerDoc) {
      if (error) {
        context.set('message.body',error)
      }
      else {
        extensionContent = swaggerDoc["x-banking"]      
      }     
    });
  } 

The above the sample will set the variable extensionContent to the content of the OpenAPI extension x-banking.