---?image=presentation/title.png&size=contain%&position=left
@snap[east headline text-white span-70] Approaches to REST API documentation @snapend
@snap[south-east byline text-white] Mathias Düsterhöft @snapend
---?color=#00A551
---?color=#0073BF
The different approaches are shown in the contexts of a spring boot 🍃 application.
@fa[github]mduesterhoeft/approaches-to-api-doc-talk
- introspection
- test-driven
- design first
---?color=#FFCD53
Automated JSON API documentation for APIs built with Spring
- SpringFox applies the usual Swagger approach
- generates OpenAPI specification using code introspection
---?image=presentation/demo.jpeg
@snap[north message-box]
@snapend@snap[north-west thumb]
@snapend@snap[north-east thumb]
@snapend- easy to apply
- API reference UI ships with code @ulend @snapend
- intrusive
- pollute code with
@
- model often is != API @ulend @snapend
---?color=#0073BF
Document RESTful services by combining hand-written documentation with auto-generated snippets produced with Spring MVC Test.
Spring REST Docs @fa[link] restdocs-openapi
---?image=presentation/demo.jpeg
@snap[north message-box]
@snapend@snap[north-west thumb]
@snapend@snap[north-east thumb]
@snapend- good guarantees in terms of accurateness
- combines assertions and documentation @ulend @snapend
- test code grows a lot @ulend @snapend
---?color=#00B369
@fa[pencil] Design your API first using an API specification.
@fa[recycle] Then verify that your API complies with the specification in your test code.
API design usually happens before starting to implement.
So why not starting with the API specification
A Java library for validating HTTP request/responses against an OpenAPI specification.
@fa[link] Swagger Request Validator
---?image=presentation/demo.jpeg
@snap[north message-box]
@snapend@snap[north-west thumb]
@snapend@snap[north-east thumb]
@snapend- supports the way teams (usually) work
- good tooling support
- easy tech-writer integration
- low impact on code @ulend @snapend
- sync between design tool and repository
- certainty limited by verification library @ulend @snapend
---?color=#FFCD53