Skip to content

Add Javalin OpenAPI documentation to all API endpoints#1890

Draft
Ghost-chu with Copilot wants to merge 2 commits into
dev-opendocfrom
copilot/javalin-openapi
Draft

Add Javalin OpenAPI documentation to all API endpoints#1890
Ghost-chu with Copilot wants to merge 2 commits into
dev-opendocfrom
copilot/javalin-openapi

Conversation

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Integrates the javalin-openapi compile-time annotation processor to generate a live OpenAPI 3.1 spec and Swagger UI for all REST endpoints, based on the existing API documentation at https://peerbanhelper.apifox.cn/llms.txt.

Dependencies (build.gradle.kts)

  • io.javalin.community.openapi:openapi-annotation-processor:7.2.2 — annotation processor
  • io.javalin.community.openapi:javalin-openapi-plugin:7.2.2 — spec served at /api/openapi
  • io.javalin.community.openapi:javalin-swagger-plugin:7.2.2 — Swagger UI at /swagger

Plugin registration (JavalinWebContainer.java)

c.registerPlugin(new OpenApiPlugin(cfg ->
    cfg.withDocumentationPath("/api/openapi")
       .withDefinitionConfiguration((v, b) ->
           b.info(i -> i.title("PeerBanHelper WebAPI").version("1.0.0")))));
c.registerPlugin(new SwaggerPlugin(cfg -> cfg.withDocumentationPath("/api/openapi")));

Endpoint annotations (~31 files)

@OpenApi added to every handler method across:

  • WebAPI controllers — auth, metadata, bans, downloaders, torrents, peers, charts, alerts, logs, plugins, PBH+, push, BTN, NAT/STUN, OOBE, rule subscriptions, laboratory, utilities, SSE background tasks, blocklists
  • Rule modulesAutoRangeBan, IPBlackList, ClientNameBlacklist, PeerIdBlacklist, ProgressCheatBlocker, MultiDialingBlocker, ExpressionRule
  • Monitor modulesSwarmTrackingModule

Each annotation documents path, HTTP method, Chinese summary/tags matching the apifox spec, path/query params, request body, and standard responses (200/400/403/500).

Total coverage: 123 operations, 102 paths, 29 tags.

Original prompt

深入研究 https://javalin.github.io/javalin-openapi/introduction/setup.html 此插件的用法,并为此项目中除了 JavalinWebContainer 的其它所有端点编写文档。文档内容可在 https://peerbanhelper.apifox.cn/llms.txt 查看

Copilot AI changed the title [WIP] Document endpoints for JavalinWebContainer excluding JavalinWebContainer Add Javalin OpenAPI documentation to all API endpoints Jul 10, 2026
Copilot AI requested a review from Ghost-chu July 10, 2026 13:19
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.

2 participants