Skip to content

docs(endpoints): generate HTTP endpoint docs with Spring REST Docs and publish to GitHub Pages - #6

Merged
randomvlad merged 2 commits into
masterfrom
docs/spring-rest-docs
Dec 4, 2026
Merged

randomvlad merged 2 commits into
masterfrom
docs/spring-rest-docs

Conversation

@randomvlad

@randomvlad randomvlad commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

Documents the app's HTTP endpoints with Spring REST Docs. The request and response examples come from tests, so they can't drift from the code: if a parameter is renamed or added without updating the docs, the test fails. The endpoints are browser routes (page loads and form posts), not a JSON API, so everything is named "HTTP endpoints" rather than "API".

  • GameControllerDocsTest (@WebMvcTest + @AutoConfigureRestDocs) documents GET /, POST /new-game and POST /mark-tile: form parameters, the Location redirect header, and curl/HTTP examples. Requests use the real /tictactoe context path, a JSESSIONID cookie and a _csrf parameter, so the examples match what a logged-in browser sends.
  • src/docs/asciidoc/index.adoc assembles the snippets, plus an overview (auth, CSRF, Post/Redirect/Get) and notes on the Spring Security /login and /logout endpoints.
  • build.gradle adds the org.asciidoctor.jvm.convert plugin. ./gradlew asciidoctor runs the tests and renders build/docs/asciidoc/index.html. AsciidoctorJ is pinned to 3.0.1 because spring-restdocs-asciidoctor 4.x fails with an AbstractMethodError on the plugin's default 2.x.
  • .github/workflows/endpoint-docs.yml ("Endpoint Docs") builds the docs on every PR and deploys them to GitHub Pages on pushes to master.
  • README gets a short "HTTP Endpoints" section that links to https://randomvlad.github.io/TicTacToe/.

Before merging

GitHub Pages isn't enabled for this repo yet. In Settings → Pages, set Source to GitHub Actions. Otherwise the deploy job fails and the README link returns 404.

Test plan

  • ./gradlew build: 32 tests pass, including the 3 new docs tests
  • ./gradlew asciidoctor renders index.html with no unresolved includes
  • docker build still succeeds (bootJar doesn't involve the docs)
  • After merge, the Endpoint Docs workflow deploys and the README link loads

🤖 Generated with Claude Code

…Hub Pages

- GameControllerApiDocsTest documents GET /, POST /new-game and POST /mark-tile
  (form parameters, Location header, curl and HTTP examples)
- src/docs/asciidoc/index.adoc assembles the snippets plus login/logout notes
- `./gradlew asciidoctor` renders build/docs/asciidoc/index.html
- api-docs workflow builds the docs on PRs and deploys them to Pages from master
- README gets an API Endpoints section linking to the hosted docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 5 complexity · 0 duplication

Metric Results
Complexity 5
Duplication 0

View in Codacy

🟢 Coverage ∅ diff coverage · +0.00% coverage variation

Metric Results
Coverage variation ✅ +0.00% coverage variation (-1.00%)
Diff coverage ✅ ∅ diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (c71b85a) 171 171 100.00%
Head commit (a1e3d22) 171 (+0) 171 (+0) 100.00% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#6) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Dec 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…rated docs

The endpoints are browser routes, not a JSON API, so "API" was misleading.
- README section shortened to a description plus a link to the generated docs
- docs page title, workflow ("Endpoint Docs") and test class
  (GameControllerDocsTest) renamed to match

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@randomvlad randomvlad changed the title docs(api): generate API docs with Spring REST Docs and publish to GitHub Pages docs(endpoints): generate HTTP endpoint docs with Spring REST Docs and publish to GitHub Pages Dec 4, 2026

@randomvlad randomvlad left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@randomvlad
randomvlad merged commit af48c2d into master Dec 4, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant