How to use own swagger-ui with Liberty JSON generated content - swagger

There is an internal Liberty swagger-ui and it is working fine for me, but actually we need to make our own swagger layout, I mean putting our logo and our company name ... etc.
This is what we get when calling https://localhost:9443/ibm/api/docs with basic swagger-ui
But when we use the browser url and paste https://localhost:9443/ibm/api/docs we got the json content for our services
This is how it working with ibm liberty swagger-ui
And this how we need to show it to our clients

Currently there's no way to alter the "look & feel" of the built-in Liberty Swagger UI, but there is a Request For Enhancement that you can vote for: https://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=87860
If you want to have your own Swagger UI totally independent of Liberty's UI, you can still pull from /ibm/api/docs like your first screenshot showed - the only thing you're missing is to setup CORS support on that Liberty instance, so that your custom Swagger UI is allowed to call it.
Here's the doc for setting up CORS in Liberty: https://www.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/twlp_webcontainer_cors_config.html?cp=SSEQTP_8.5.5%2F1-8-1-1-21-1
Main sample from the link:
<cors domain="/ibm/api/collective"
allowedOrigins="https://alice.com:8090"
allowedMethods="GET, DELETE, POST"
allowedHeaders="accept, MyRequestHeader1"
exposeHeaders="MyResponseHeader1"
allowCredentials="true"
maxAge="3600" />

Related

separate swagger UI URLs for ASPNETCORE 1.1

We have a .NET core 1.1 webapi project. We have two controller files and I've been able to generate separate swagger JSON files for each controller by decorating methods with GroupName.
When I browser the swagger UI (/swagger) I see that it has a drop down on top right corner that allows us to select the group.
Our requirement is to have a separate URL itself for swagger UI (not just JSON file) so that we can send a URL dedicated to a controller to our customers that doesn't confuse them. Is there a way to tell swashbuckle/swagger UI to use a specific URL for given JSON file/group name?
I tried checking if there's any query string parameter that swagger UI uses on change of dropdown but unfortunately it uses referer http header...
Yes swagger-ui has the url param that does exactly that.
Here are a few examples:
http://petstore.swagger.io/?url=http://heldersepu.github.io/hs-scripts/swagger/4134_swagger.json
http://offleaseonly.azurewebsites.net/swagger/ui/index?url=https://raw.githubusercontent.com/oasis-tcs/odata-openapi/master/examples/People.openapi3.json
http://swagger-net-test.azurewebsites.net/swagger/ui/index?url=http://heldersepu.github.io/hs-scripts/swagger/DiegoGuidi.json

ASPNetBoilerPlate and Swagger UI All API Calls Return 400 Error

I have created a new application using the ASPNetBoilerplate MVC 5x template. I have integrated Swagger UI according to the link:
https://aspnetboilerplate.com/Pages/Documents/Swagger-UI-Integration
Again using the MVC 5x version
When I run the app and use http://localhost:/swagger to access the API and try to run any of the GetAll methods, I get a 400 error.
I have modified the .cs file and created the .js files by cutting the code directly from the documentation and made the required changes.
What am I missing?
Thanks
I hope you are not navigating to http://localhost:/swagger because there's a typo error. Correct url is http://localhost/swagger
There's no official support for bearer token for Swagger UI Api calls. But you can checkout the link below. A developer achieves what you want
https://github.com/aspnetboilerplate/module-zero-core-template/pull/87

Integrate the swagger ui into hammock

I am building up a CDI/REST Environment as basis for several projects by using hammock. What I would like to have besides CDI and REST is also json schema for generating payload classes and an automatically generated REST API documentation via swagger ui.
I am now at the point where everything works (Weld3, Resteasy, Undertow, Swagger Core, Json Schema). The only thing missing is the integration of swagger UI into my hammock stack.
In another project I already worked with swagger UI. As far as I know it is based on HTML + JS with an entry point index.hml. How do I integrate this into my hammock stack. How to tell the undertow that there is a index.html and where to find it ?
I think my question is not only related to swagger, but to the idea to have the hammock stack with additional static html content.
John Ament has added a swagger module for Swagger 2.0-rc3 to Hammock 2.1-SNAPHOT (will be released as part of Hammock 2.1):
https://github.com/hammock-project/hammock/tree/master/swagger
As for hosting Swagger UI inside a Hammock app, you can add a few files from swagger-ui/dist/* to Hammock's static resources path:
https://github.com/hammock-project/hammock/wiki/Native-Filters#static-resources

Swagger-ui - Not able to figure out how some features are functioning for Petstore

I have downloaded and browsed to the Swagger-UI dist/index.html file and it has loaded the sample Petstore APIs. However, I am not able to figure out how some features are functioning and hence not able to bring that to my own definition.
The sample Petstore shows a "VALID {...}" button at the bottom right hand side. However I don't see that when I navigate to my own API definitions. How do I enable it?
When I look up the petstore API specifications being rendered by Swagger-UI http://petstore.swagger.io/v2/swagger.jsonI am not able to figure out how are they plugging in the section below the Swagger Petstore description.
Contact the developer
This is a mailto link with an email address and subject line
Find out more about Swagger http://swagger.io doesn't show up either in the petstore json definition or the one that I am using.
Where is the sample picking this up from?
When I use the Swagger editor, it interprets the specification in a different way - most significantly showcasing the terms of use and license information appropriately. Does Swagger-UI not support those properties? Do I need to enable something in Swagger-UI to make them appear?
You need to be using the latest version of Swagger, Swagger Core 1.5 at least, to have these neat features in your own Swagger project.
The UI at version > 2.0 comes with the schema validation (the VALID button on the bottom of the page) built-in.
2+3. The Info object contains all the information needed for rendering Contact the developer, license and "More Info" links by the UI.

How to do restful search in Apache Sling

i am evaluating Apache Sling as a potential backend CMS. I like how easy it is to push / get new content via rest. However, I also need to be able to search the content via REST. I compiled all the source code and am running their standalone jar. There are like 100 bundles installed, but I can't find a single rest query.
Some old documentation says you can do /content/mynode.query.json?
But this is not working, and there is no help on whether its supported or not. Honestly the only search option I found was in the console via /.explore.search.html/ which returns web pages.
How can you do restful search using sling?
The JsonQueryServlet, which provides an HTTP search interface was moved to a separate bundle as part of SLING-2226. See that issue's page for how to use it, and there's a related blog post at http://in-the-sling.blogspot.ch/2008/09/how-to-use-json-query-servlet.html

Resources