In APIM-3.0.0 we couldn't get the context value from the openapi 3.0.0(swagger 3.0.0) while importing it in the publisher portal to create an API. The context got retrieved from swagger 2.0.
The issue was reproduced in wso2am-3.0.0+1581697020500. The name and version were fetched from the openapi 3.0.0 file but not the context.
The basic difference between swagger 2.0 and openapi 3.0.0 (aka swagger 3.0.0) that is relevant to this ticket is as follows.
In terms of the content architecture of these two versions, several components in swagger 2.0 have been combined as individual units in openapi 3.0.0. One such unit is "servers" in openapi 3.0.0. The host, basepath, and schemes in swagger 2.0 have been combined into one unit and names as "servers" in openapi 3.0.0. The "servers" component is an optional field in openapi 3.0.0.
Servers = schemes + host + basepath
Since the "servers" field is an optional field in openapi 3.0.0 it could be classified into mainly 4 cases as follows.
Case 1: Without Servers field
Case 2: Servers field with an empty array
"servers": []
Case 3: Servers field with complete URL
This could be a single URL or multiple URLs.
Case 4: Servers field with variable mapping
This is applicable not only for scheme elements but also for host and basepath. This will result in multiple URLs.
"servers": [
{
"url": "{scheme}://developer.uspto.gov/{base}",
"variables": {
"scheme": {
"description": "The Data Set API is accessible via https and http",
"enum": ["https", "http"],
"default": "https"
},
"base": {
"description": "The base paths are ds-api and ds-apiiiwow",
"enum": ["ds-api", "ds-apiiwow"],
"default": "ds-api"
}
}
}
]
Openapi 3.0.0 is based on OAS3 specifications. Getting context value from the openapi 3.0.0 is a limitation in wso2am-3.0.0 due to the above-mentioned combinations in generating a URL. In several cases, we have multiple URLs with different context and in some other cases, we don't have any URLs at all. Due to this complex scenario, the context is not getting imported from openapi 3.0.0 in wso2am-3.0.0.
Describe your solution
If the servers element has only one complete URL, then by splitting the URL by "/" can retrieve the context
If there are multiple base paths in the servers element they can have dropdown options just like in swagger UI to select the context from available values and generate the URL.
Describe your problem(s)
In APIM-3.0.0 we couldn't get the context value from the openapi 3.0.0(swagger 3.0.0) while importing it in the publisher portal to create an API. The context got retrieved from swagger 2.0. The issue was reproduced in wso2am-3.0.0+1581697020500. The name and version were fetched from the openapi 3.0.0 file but not the context. The basic difference between swagger 2.0 and openapi 3.0.0 (aka swagger 3.0.0) that is relevant to this ticket is as follows. In terms of the content architecture of these two versions, several components in swagger 2.0 have been combined as individual units in openapi 3.0.0. One such unit is "servers" in openapi 3.0.0. The host, basepath, and schemes in swagger 2.0 have been combined into one unit and names as "servers" in openapi 3.0.0. The "servers" component is an optional field in openapi 3.0.0.
Since the "servers" field is an optional field in openapi 3.0.0 it could be classified into mainly 4 cases as follows. Case 1: Without Servers field Case 2: Servers field with an empty array
Case 3: Servers field with complete URL This could be a single URL or multiple URLs.
Case 4: Servers field with variable mapping This is applicable not only for scheme elements but also for host and basepath. This will result in multiple URLs.
Openapi 3.0.0 is based on OAS3 specifications. Getting context value from the openapi 3.0.0 is a limitation in wso2am-3.0.0 due to the above-mentioned combinations in generating a URL. In several cases, we have multiple URLs with different context and in some other cases, we don't have any URLs at all. Due to this complex scenario, the context is not getting imported from openapi 3.0.0 in wso2am-3.0.0.
Describe your solution
If the servers element has only one complete URL, then by splitting the URL by "/" can retrieve the context
If there are multiple base paths in the servers element they can have dropdown options just like in swagger UI to select the context from available values and generate the URL.
Suggested Labels:
wso2am-3.0.0