Additional '/' getting added in the operation when VS is created from Swagger specification

book

Article ID: 106052

calendar_today

Updated On:

Products

CA Application Test Service Virtualization CA Continuous Application Insight (PathFinder)

Issue/Introduction

When creating VS using Swagger document, the VSI is created with an extra '/' in the operation. For example, the transactions are shown as below:

GET //v2/{URLPARAM0}/{URLPARAM1}/
POST //v2/Test12/

Cause

Basepath defined in the Swagger doc causes the issue.

Environment

DevTest environments 10.2 and 10.3.

Resolution

. Removing the "basepath":"/" in the Swagger doc will resolve the issue. If the Swagger doc needed a base path as "/" or at the end like "/v2/" then please open a support case and refer DE374965.

Additional Information

Here is some information on basepath and host per Swagger specification: 

basepath: Per swagger 2 specification at "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swaggerBasePath", "A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the basepath in order to construct the full URL." 

host: Per swagger 2 specification at "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swaggerHost", "The base path on which the API is served, which is relative to the host. If it is not included, the API is served directly under the host. The value MUST start with a leading slash (/).  

For example, 
. If Swagger doc has the "basepath": "/v2" after the "host":"tmobile.cm", then /v2 is added to all the transactions like /v2/api/testcase/test12, /v2/api/testvi,.. 
. If Swagger doc has the "basepath": "/v2/" after the "host":"tmobile.cm", then /v2/ is added to all the transactions like //v2/api/testcase/test12, //v2/api/testvi,.. (This is the issue you have)