Skip to content

Demo project with simple Spring-Boot Service with OpenAPI definition and integrated docToolchain

License

Notifications You must be signed in to change notification settings

silverdonkey/spring-boot-openapi-doctoolchain

Repository files navigation

Demo Integrated docToolchain

This demo project consist of

  • Spring Boot (v2.4.5) Service
  • OpenAPI definition for the Spring Boot Service src/docs/service-api.yaml
  • Asciidoc API documentation src/docs/service-api.adoc includes the OpenAPI (yaml) definition
  • OpenAPI definition for the Petstore example service to demonstrate the JSON format src/docs/petstore-api.json
  • Asciidoc API documentation src/docs/petstore-api.adoc includes the OpenAPI (json) definition
  • Config (Config.groovy) for docToolchain
  • Dockerfiles for the Spring-Boot-Service and baked-in docToolchain

My own Confluence instance 'nikonfluence'

The result is visible on my own Confluence instance.

Using the builder-alpine-doctoolchain image you can generate and publish your documentation (Asciidoc format) and OpenAPI-Definitions (yaml or json format) to Confluence. Her is the result in Confluence

The result as screenshot:

Build and Run the Spring-Boot service locally with Maven

From your command line:

HowTo build Docker images

  • Dockerfile: Crates an image for starting the HelloWorld-service locally

    • docker build --no-cache . -t spring-boot-openapi-demo:1.0.0
    • docker run -it --rm -p 8080:8080 spring-boot-openapi-demo:1.0.0
  • Dockerfile-doc-builder:

    • uses openjdk:13-jdk-alpine and docToolchain v2.0.2
    • installs libs to allow generating and publishing PlantUML diagrams
  • docker build --no-cache . -t builder-alpine-doctoolchain:2.0.2 -f Dockerfile-doc-builder

Run docToolchain-publishToConfluence locally using Docker (builder-alpine-doctoolchain:2.0.2 image)

Preconditions:

  • Confluence credentials with R/W-access

Then from your command line run the command (you can override -PinputPath=src/docs -PmainConfigFile=Config.groovy)

  • docker run -it --rm --entrypoint /bin/bash -v ${PWD}:/project builder-alpine-doctoolchain:2.0.2 -c "doctoolchain . publishToConfluence -PconfluenceUser='your-confluence-username' -PconfluencePass='your-confluence-api-token' && exit" OR Just run the local script my-doctoolchain.sh (you can override -PinputPath=src/docs -PmainConfigFile=Config.groovy) and pass your Confluence credentials:
  • ./my-doctoolchain.sh publishToConfluence -PconfluenceUser="your-confluence-username" -PconfluencePass="your-confluence-api-token"

Run docToolchain-publishToConfluence locally using docToolchain's own Docker image (rdmueller/doctoolchain:v2.0.2)

Find more detailed info in Github: docToolchain/docker-image

Just run the local script doctoolchain.sh (you can override -PinputPath=src/docs -PmainConfigFile=Config.groovy) and pass your Confluence credentials:

  • ./doctoolchain.sh publishToConfluence -PinputPath=src/docs -PmainConfigFile=Config.groovy -PconfluenceUser="your-confluence-username" -PconfluencePass="your-confluence-api-token"

Maven Reference Documentation

For further reference, please consider the following sections:

Spring Boot Guides

The following guides illustrate how to use some features concretely:

About

Demo project with simple Spring-Boot Service with OpenAPI definition and integrated docToolchain

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published