Layer7 API Management

 View Only

Publishing API using Swagger and using the Validate Against Swagger Assertion

  • 1.  Publishing API using Swagger and using the Validate Against Swagger Assertion

    Posted Jun 19, 2020 06:18 PM
    • Gateway 9.4 
    • swagger base uri: /dev-api

    We wanted to leverage the publish by swagger wizard to quickly publish APIs but have been limited by the fact that the gateways publishes a single policy and uses regex for routing. This wont work for us because we are looking to put in place different requirements for each endpoint/ groups of endpoints. 

    We have now grouped the apis by part of the service uri so that we can publish them separately but still use the validate against swagger for path validation, for example 
    /dev-api/business*
    /dev-api/management*
    /dev-api/employee

    The validate against swagger will not work this way because of the base uri. (sw.baseUri is dev-api and sw.apiUri is dev-api/business/request) The gateway returns "11401 request path does not match any defined template: /dev-api/business/request "  . 

    How best can we leverage the swagger doc to validate paths when we have APIs published with wildcards. 

    If we didnt use swagger what is the best way protect APIs published with wildcards eg employee* and are using using the URI for input eg /employee/{id}. How do we validate the path where there is different possible requests including just /employee or /employee/001 or employee/001/department .