Disclaimer: This README was partially/fully generated with the assistance of AI.
SwagFluence is a Golang-based CLI tool that automatically converts a Swagger/OpenAPI specification into beautifully formatted Confluence documentation. It generates:
- A parent documentation hub
- Individual pages for each API endpoint
- Detailed request/response info
- Auto-generated example JSON
- Clean tables, layout macros, and status tags
SwagFluence supports Swagger 2.0 and OpenAPI 3.x, including $ref schema resolution.
-
Reads Swagger/OpenAPI JSON from any URL
-
Extracts operations, parameters, request bodies, schemas, tags
-
Supports both:
components/schemas(OpenAPI 3.x)definitions(Swagger 2.0)
SwagFluence creates or updates:
- A parent documentation page for the API
- A separate page for each endpoint
Each endpoint page includes:
- Method badges (GET/POST/etc.)
- Description, tags, operation ID
- Parameter tables
- Request body breakdown
- Schema tables with constraints
- Auto-generated Example JSON
- Confluence storage-format markup
- Layout macros for clean presentation
Endpoints use automatic title generation based on:
- Operation summary
- Operation ID
- Humanized path segments
If Confluence credentials are not set: SwagFluence simply prints all generated documentation to the terminal.
- Go 1.24+
- A reachable Swagger/OpenAPI endpoint
- Optional: Confluence REST API credentials
git clone <your-repo-url>
cd <repo>
go mod tidy
go build -o SwagFluence main.go
# Or cross-compile from another OS
GOOS=linux GOARCH=amd64 go build -o SwagFluence main.go./SwagFluence https://petstore.swagger.io/v2/swagger.jsonThis will:
- Fetch Swagger/OpenAPI JSON from:
https://petstore.swagger.io/v2/swagger.json - Generate full Confluence-ready documentation
- Print it to the terminal
Set the following environment variables:
export CONFLUENCE_BASE_URL="https://yourcompany.atlassian.net/wiki"
export CONFLUENCE_USERNAME="you@company.com"
export CONFLUENCE_API_TOKEN="API_TOKEN"
export CONFLUENCE_SPACE_KEY="ENG"
export CONFLUENCE_PARENT_PAGE_ID="123456" # optionalRun:
./SwagFluence https://petstore.swagger.io/v2/swagger.jsonSwagFluence will:
- Create/update the parent page
- Create/update one page per endpoint
- Output links to all generated pages
.
├── main.go
├── go.mod
└── README.md
-
Fetch Swagger/OpenAPI JSON
-
Parse paths, operations, and schemas
-
Generate Confluence-compatible markup, including:
- Tables
- Layout sections
- Status macros
- Auto-built Example JSON
-
Create or update Confluence pages using REST API
Contributions welcome! Ideas for enhancements:
- Response schema documentation
- YAML Swagger support
This software is licensed under the Apache License 2.0.