Download presentation
Presentation is loading. Please wait.
Published byRandolf Fowler Modified over 8 years ago
1
Documenting your API with Swagger Ruben de Jong
2
Introducing Swagger Free and open source framework Define a standard, language-agnostic interface to a REST API Allow both humans and computers to discover and understand the capabilities of the service
3
Introducing Swagger Specification donated to Open API Initiative (OAI) per 1-1-2016 Linux Foundation Collaboration Project
4
Introducing Swagger {specification} json, yaml Swagger Codegen Swagger CoreSwagger Editor Swagger UI
5
Webserver /api-docs Swagger UI HTML CSS JS {specification} json, yaml
6
Specification {specification 1.2} json Resource listing API declaration {specification 2.0} json, yaml swagger.json
7
Specification Demo
8
Frontend Backend Specification webservices {specification} webservices api-docs API CRUD Interpretation Validation Database
9
Document generation api_doc Resource listing No webservice Webservice doc Webservice /servoy-service/rest_ws/ /api_doc/ / {specification}
10
Webservice generation contact (cloned form) api_webservice (base form) country (cloned form) /servoy-service/rest_ws/ / / {specification} onSolutionOpen “contact” webservice “country” webservice ws_create ws_read ws_update ws_delete For each defined webservice
11
URL Rewrite API docs /servoy-service/rest_ws/ /api_doc/ / /api-doc/ / API /servoy-service/rest_ws/ / /apiKey /api/ /
12
URL Rewrite Tuckey’s UrlRewriteFilter Add urlrewritefilter-4.0.3.jar to \server\webapps\ROOT\WEB-INF Add snippet to \server\webapps\ROOT\WEB-INF\web.xml: UrlRewriteFilter org.tuckey.web.filters.urlrewrite.UrlRewriteFilter UrlRewriteFilter /* REQUEST FORWARD
13
URL Rewrite Add rules to \server\webapps\ROOT\WEB-INF\rewrite.xml /api/** /servoy-service/rest_ws/mSTB_api/$1 /api-doc/** /servoy-service/rest_ws/mSTB_api/api_doc/$1 Velocity: /api-doc/** /servoy-service/velocity/mSTB_api/api_doc/$1 /api/** /servoy-service/velocity/mSTB_api/api_webservice/$1
14
Questions
15
Resources Swagger http://swagger.io/ http://swagger.io/ Eclipse JSON Tools https://bitbucket.org/denmiroch/jsontools/wiki/Home https://bitbucket.org/denmiroch/jsontools/wiki/Home Tuckey’s UrlRewriteFilter http://tuckey.org/urlrewrite/ http://tuckey.org/urlrewrite/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.