Swagger Search is an application that aggregates the Swagger/OpenAPI documentation of your microservice architecture in one place, where your can browse it or search endpoints based on their url, documentation, the parameters it accepts or their types.
Swagger Search also provides a Swagger UI for those microservices that haven't their own Swagger UI embedded.
Integrated with Etcd and Consul for service discovery, or your can plug your own.
The search is powered by Lucene, so you can use the Lucene's query syntax. An English analyzer is used.
The available fields are:
If no field is specified, all of them will be used.
For each service, Swagger Search will try to find if that service comes with its own Swagger UI.
If it does, Swagger Search will use that UI when you click on a search result for that particular service.
If it does not, Swagger Search will use its own Swagger UI and a proxy to forward the requests.
Note that this proxy is very naive, so do not expose it outside your trusted network as it does not do any validations.
First you need to create a configuration file. Look at the example, which contains all the configuration options.
Copy or make the swagger.config.edn avaible in /config inside the container, something like:
docker run -p 7878:3000 -v `pwd`/examples:/config danlebrero/swagger-search
Open a browser at http://localhost:7878/
See DockerHub for the latest version.
Instead of Docker, you can just run the application manually as a JVM application:
java -jar swaggersearch-vXXXX.jar
Open a browser at http://localhost:$whatever-port-you-specified-in-the-config-file/
Swagger Search needs to find out what services you are running. The built-in options are:
The configuration example file has more details about each of them.
It is quite possible that none of these suits you, in which case next are the possible options to user your own service discovery
Your best option is to learn Clojure. It will do you a lot of good :stuck_out_tongue_winking_eye:.
Failing that, use the :uri-or-file provider and have a process that updates the file or write some HTTP server that is able to return the list of services.
To create your own service discovery mechanism:
If you don't want to run Docker or Uberjar, Swagger Search is also available as a library in Clojars.
See the uberjar code as guide about how you can use it as a library.
Go to examples/etcd and run:
docker-compose up
This should start a whole developer environment, including an application with a sample Swagger API.
Swagger Search will be available at http://localhost:8504/ and a Clojure REPL at localhost:8503
Copyright © 2017 IG Group
Distributed under Apache Licence 2.0.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close