This talk gives an overview of the tools to put the documentation you create into your build. Use it to document Text, APIs, Diagrams, Tests, Code Snippets, etc.
| November 2017 | Continuous Lifecycle Mannheim | Continuous Delivery for your Documentation | Alexander Schwartz 7 Topics Technologies for Text, APIs, Tests, Diagrams Challenges and Choices Examples Markdown AsciiDoc Graphiz/Dot PlantUML JGiven RAML Swagger OpenAPI XSD/WSDL Spring REST Doc Write more tests or more documentation? API documentation from Code, Contract or Tests? Separate Code Base for Documentation? How to integrate non-tech contributors? Spell- and Grammar checking? Highlight changes in versions? Cucumber Vert.x Docs Spring Boot Docs Asciidoctor Saltstack Docs Gitbook Bean Validation 2.0 Spec Graylog reStructuredText
Mannheim | Continuous Delivery for your Documentation | Alexander Schwartz 9 Pro • Intuitive Text format • Easy to start Con: • Missing the full O‘Reilly/DocBook feature set • Different flavours of Markdown syntax • Different generators for HTML/PDF output # Title ## Headline Normal text. **Bold**, _italic_ and `monospace`. Empty lines separate paragraphs.
Mannheim | Continuous Delivery for your Documentation | Alexander Schwartz 10 Pro • Intuitive Text format • Full O‘Reilly/Docbook featureset • Very good support for tables and to include source code from live code • Asciidoctor Implementation supports HTML, DocBook and PDF output • Includes for files Con: • Moderate PDF styling available [source,txt] .Name of the file ---- This is a listing with highlighting ---- [cols="2*", options="header"] |=== |Heading |Another heading |Text in first column |Text in second column |===
Mannheim | Continuous Delivery for your Documentation | Alexander Schwartz 12 Pro • More flexible than PlantUML • Can be rendered via PlantUML pipeline Con: • Still auto layout can get messy digraph foo { node [style=rounded] node1 [shape=box] node2 [fillcolor=yellow, style="rounded,filled", shape=diamond] node3 [shape=record, label="{ a | b | c }"] node1 -> node2 -> node3 }
Mannheim | Continuous Delivery for your Documentation | Alexander Schwartz 13 Pro • Sequence Diagram • State Diagram • Activity-Diagrams (even with swim lanes) Con: • Component and Deployment Diagrams (can get messy if you have lots of items due to auto-layout) start :Hello world; :This is on defined on several **lines**; stop [Component] --> Interface1 [Component] -> Interface2
Continuous Lifecycle Mannheim | Continuous Delivery for your Documentation | Alexander Schwartz 15 Pro • Up to date with Implementation • Implementation: for example OpenAPI aka Swagger (swagger-doclet) Generated outputs: • Live-API, AsciiDoc Output, … Cons • Additional annotations necessary for complex return types • Changes in Implementation might break agreed API
Continuous Lifecycle Mannheim | Continuous Delivery for your Documentation | Alexander Schwartz 16 Pro • Writing technical specs is approachable to non-developers • Formats include: RAML, Swagger, OpenAPI, WSDL • Tests can check if they are compliant with the spec (see nidi3’s RAML Tester) Generated outputs: • HTML from WSDLs (using XS3P) • HTML from RAML • Live API for Swagger Cons • Swagger/RAML/OpenAPI don’t work for Hypermedia
Lifecycle Mannheim | Continuous Delivery for your Documentation | Alexander Schwartz 17 YAML files to describe resources (with parameters, examples, JSON Schema, etc.) /books: /{bookTitle} get: queryParameters: author: displayName: Author type: string description: An author's full name example: Mary Roach required: false /{songId}: description: Song entity get: description: Get the song with `songId = {songId}` responses: 200: ... 404: body: application/json: example: | {"message": "Song not found"}
| Continuous Lifecycle Mannheim | Continuous Delivery for your Documentation | Alexander Schwartz 18 Pro • Up to date with Implementation • Provides a step-by-step and how-to guide • Implementation: Spring REST Docs Generated outputs: • Online Documentation (Asciidoctor) Cons • Can’t be written by non-technical people, can’t be written in advance (Possible Solution: hand-written spec before implementation, step-by-step replacement as part of the implementation)
Continuous Lifecycle Mannheim | Continuous Delivery for your Documentation | Alexander Schwartz 19 Test case plus Documentation Stub… this.mockMvc.perform(get("/notes")) .andExpect(status().isOk()) .andDo(document("notes-list-example", links( linkWithRel("self") .description("Canonical link for this resource"), linkWithRel("profile") .description("The ALPS profile ...")), responseFields( subsectionWithPath("_embedded.notes") .description("An array of ..."), subsectionWithPath("_links") .description("... to other resources")))); [[resources-notes-list]] === Listing notes A `GET` request will list all of the service's notes. operation::notes-list-example [snippets='response-fields, curl-request,http-response,links']
Continuous Lifecycle Mannheim | Continuous Delivery for your Documentation | Alexander Schwartz 22 Pro • Write test cases as Java Code • Test reports readable by business owners • Developers understand the intention of a test (even when some other developer created it) • Refactoring of tests using IDE • Searchable HTML report, parse able JSON output. Con: • Can only be written by developer (but Given-When-Then test case can be part of the spec/user story provided by business) • Additional annotations and more code in your test cases
msg | November 2017 | Continuous Lifecycle Mannheim | Continuous Delivery for your Documentation | Alexander Schwartz 26 Usually you want to keep your software to be evolvable. This (among others) requires a reasonable amount of tests and documentation. • Too many, too few or the wrong tests can be a burden – the same is true for documentation. • Do you know what parts of your documentation you write is actually read by someone else? • Who is in the audience? Describe in the first paragraph who you are writing this document for! • What kind of additional documentation will make you faster? (example: train new team members) • Is there something you can automate, so you can afterwards delete the documentation for the manual process? • Are tests a kind of documentation? (especially BDD tests for business stakeholders)
2017 | Continuous Lifecycle Mannheim | Continuous Delivery for your Documentation | Alexander Schwartz 27 Asciidoctor/Markdown • Use a simple IDE like i.e. AsciidocFX (stand-alone editor?) • Use GitBook editor? Diagrams (SVG) • Use yEd as it has a better User Interface? • Alternatives to PlantUML with less autolayout? API • Anything that supports contract first (RAML, XSD, JSON Schema, …)?