Building APIs with Swagger

Swagger分三個部分,Swagger editor、Swagger UI、Swagger Codegen。Swagger editor去定義api specification,Swagger UI把Swagger editor定義的api變成網站,方便寫程式的人看,Swagger codegen是將這些api definition變成code,讓我們之後去implement business logic。

Swagger基本內容先看 [1],[1] 很詳細說明Swagger UI,但沒有code generation的內容。

如果想要將swagger UI deploy到spring boot看 [2]。

Swagger code generation請看 [3],但 [3] 講的東西其實很少。其實用Maven將generated file產出之後,之後去implement即可,也不太需要學什麼。

避免部署Swagger UI的方式就是copy你的yaml file,past到swagger editor即可。

https://editor.swagger.io/

Prerequisites

  1. REST

  2. JSON

References

https://github.com/OAI

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#schema

Last updated