Swagger UI 3.x - Missing functionalities

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Swagger UI 3.x - Missing functionalities

Thilini Shanika
Hi,

When upgrading swagger-ui in APIM to 3.x, we found that some of the functionalities which have been supported by swagger 2.x are not available in swagger-ui 3.x. Swagger ui 3.x is a rewrite based on react and it seems like they haven't pushed some of the features from swagger 2.x to 3.x. Following are the features of swagger-ui 2.x, which we have been using in APIM 2.1 and now missing in swagger-ui 3.x.

1) Injecting Authorization header

We have been using bearer token-based authentication for the embedded swagger console in APIM 2.1 and following is how we injected the API token header into swagger-ui 2.x .

swaggerUi.api.clientAuthorizations.add("default", new SwaggerClient.ApiKeyAuthorization("Authorization", "Bearer "+ key, "header"));

But it seems like functionality is not supported in swagger 3.x [1] and still, they are working on the solution. 

2) onComplete and onFailure callback support

In swagger-ui 2.x, we had onComplete and onFailure callback function support and it is not supported by swagger 3.x [2].

Have we come across these issues before? Are there any alternative ways of achieving aforementioned requirements with swagger-ui 3.x?

Thanks
Thilini

[1] https://github.com/swagger-api/swagger-ui/issues/3215
[2] https://github.com/swagger-api/swagger-ui/issues/3028

--
Thilini Shanika
Senior Software Engineer

WSO2, Inc.; http://wso2.com
20, Palmgrove Avenue, Colombo 3



_______________________________________________
Dev mailing list
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Swagger UI 3.x - Missing functionalities

Praminda Jayawardana
Hi Thilini,

1. You can provide a requestInteceptor when initializing the swagger ui component. I used that to inject the access token.

Ex:
requestInterceptor: function(request) {
    request.headers.Authorization = "Bearer " + key;
    return request;
}

2. I haven't tried this but you should be able to provide a responseInteceptor same as above to handle the onComplete and onFailure events.

Thanks,
Praminda

On Thu, Dec 7, 2017 at 10:01 AM, Thilini Shanika <[hidden email]> wrote:
Hi,

When upgrading swagger-ui in APIM to 3.x, we found that some of the functionalities which have been supported by swagger 2.x are not available in swagger-ui 3.x. Swagger ui 3.x is a rewrite based on react and it seems like they haven't pushed some of the features from swagger 2.x to 3.x. Following are the features of swagger-ui 2.x, which we have been using in APIM 2.1 and now missing in swagger-ui 3.x.

1) Injecting Authorization header

We have been using bearer token-based authentication for the embedded swagger console in APIM 2.1 and following is how we injected the API token header into swagger-ui 2.x .

swaggerUi.api.clientAuthorizations.add("default", new SwaggerClient.ApiKeyAuthorization("Authorization", "Bearer "+ key, "header"));

But it seems like functionality is not supported in swagger 3.x [1] and still, they are working on the solution. 

2) onComplete and onFailure callback support

In swagger-ui 2.x, we had onComplete and onFailure callback function support and it is not supported by swagger 3.x [2].

Have we come across these issues before? Are there any alternative ways of achieving aforementioned requirements with swagger-ui 3.x?

Thanks
Thilini

[1] https://github.com/swagger-api/swagger-ui/issues/3215
[2] https://github.com/swagger-api/swagger-ui/issues/3028

--
Thilini Shanika
Senior Software Engineer

WSO2, Inc.; http://wso2.com
20, Palmgrove Avenue, Colombo 3



_______________________________________________
Dev mailing list
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/dev




--

Praminda Jayawardana

Software Engineer
WSO2 Inc.; http://wso2.com
Mobile : +94 (0) 716 590918

_______________________________________________
Dev mailing list
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/dev