====== Swagger ====== * http://swagger.io/ * [[programming:documentation:swagger:codegen|Swagger Code Generation]] * -> [[programming:documentation:openapi_spec|Open API Specification]]로 표준화됨. * [[springframework:springfox|SpringFox]] - Spring & Swagger * [[https://github.com/swagger-api/swagger-core/wiki/Annotations|Swagger Annotations]] * [[https://dzone.com/articles/why-is-swagger-json-better-than-swagger-java-clien|Why Is Swagger JSON Better Than Swagger Java Client? - DZone Java]] ===== ReDoc ===== * [[https://github.com/Rebilly/ReDoc|ReDoc]] : Swagger API 문서화. * [[https://webhookrelay.com/blog/2018/11/05/openapi-redoc-tutorial/|Documenting your API with OpenAPI (Swagger) and Redoc — Web Relay]] * 페이지 내 검색과 더 유려한 UI를 제공해줌. ===== RapiDoc ===== * https://rapidocweb.com/ ===== Swagger2MarkUp ===== * [[https://github.com/Swagger2Markup/swagger2markup|Swagger2Markup/swagger2markup]] A Swagger to AsciiDoc or Markdown converter to simplify the generation of an up-to-date RESTful API documentation by combining documentation that’s been hand-written with auto-generated API documentation. * [[https://github.com/Swagger2Markup/swagger2markup-gradle-plugin|Swagger2Markup/swagger2markup-gradle-plugin]] A Swagger2Markup Gradle Plugin. * [[https://github.com/Swagger2Markup/spring-swagger2markup-demo|Swagger2Markup/spring-swagger2markup-demo]] [[springframework:springfox|SpringFox]] 로 Spring Boot 문서를 test 시에 ''swagger.json'' 으로 생성하고, 이를 가지고 [[:asciidoc|AsciiDoc]]을 생성한뒤 [[asciidoc:asciidoctor|AsciiDoctor]] 를 통해서 다시 HTML/PDF 문서로 바꾼다. * [[https://dzone.com/articles/static-api-documentation-with-spring-and-swagger|Static API Documentation With Spring and Swagger - DZone Integration]] // Spring / Swagger 에서 swagger.json 을 파일로 뽑아내는 예제 @WebAppConfiguration @RunWith(SpringJUnit4ClassRunner.class) @AutoConfigureRestDocs(outputDir = "build/asciidoc/snippets") @SpringBootTest(classes = {Application.class, SwaggerConfig.class}) @AutoConfigureMockMvc public class Swagger2MarkupTest { private static final Logger LOG = LoggerFactory.getLogger(Swagger2MarkupTest.class); @Autowired private MockMvc mockMvc; ... @Test public void createSpringfoxSwaggerJson() throws Exception { //String designFirstSwaggerLocation = Swagger2MarkupTest.class.getResource("/swagger.yaml").getPath(); String outputDir = System.getProperty("io.springfox.staticdocs.outputDir"); MvcResult mvcResult = this.mockMvc.perform(get("/v2/api-docs") .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); MockHttpServletResponse response = mvcResult.getResponse(); String swaggerJson = response.getContentAsString(); Files.createDirectories(Paths.get(outputDir)); try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(outputDir, "swagger.json"), StandardCharsets.UTF_8)){ writer.write(swaggerJson); } } ... } ===== 기타 ===== * https://github.com/sourcey/spectacle * [[https://www.baeldung.com/swagger-generate-pdf|Generate PDF from Swagger API Documentation | Baeldung]]