Skip to content

"Integrate OpenAPI/Swagger for API documentation with springdoc dep…#45

Merged
mattknatt merged 2 commits into
mainfrom
feat/springdoc
Apr 30, 2026
Merged

"Integrate OpenAPI/Swagger for API documentation with springdoc dep…#45
mattknatt merged 2 commits into
mainfrom
feat/springdoc

Conversation

@mattknatt

@mattknatt mattknatt commented Apr 29, 2026

Copy link
Copy Markdown
Owner

…endency and annotations across controllers; update security settings and properties to expose Swagger UI."

Summary by CodeRabbit

  • New Features
    • Swagger UI documentation interface now available for exploring API endpoints
    • API endpoints organized and documented under logical categories (Bookings, Gyms, Classes, Auth, Users, Admin)
    • OpenAPI specification accessible for developer tools and integrations

…endency and annotations across controllers; update security settings and properties to expose Swagger UI."
@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@mattknatt has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 51 minutes and 6 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 88be4e55-9047-45a2-9480-46531e764997

📥 Commits

Reviewing files that changed from the base of the PR and between 4adaa56 and d2ad8d7.

📒 Files selected for processing (2)
  • src/main/java/com/example/boka/config/OpenApiConfig.java
  • src/main/resources/application.properties
📝 Walkthrough

Walkthrough

This pull request integrates OpenAPI/Swagger documentation support into the Spring Boot application by adding the Springdoc dependency, annotating controllers for API documentation grouping, configuring security to permit public access to documentation endpoints, and adding OpenAPI configuration properties.

Changes

Cohort / File(s) Summary
OpenAPI Dependency Setup
pom.xml
Added Springdoc OpenAPI WebMVC UI starter dependency (v3.0.3) to enable Swagger UI and OpenAPI schema generation.
Controller Documentation Tags
src/main/java/com/example/boka/booking/infrastructure/BookingController.java, src/main/java/com/example/boka/gym/infrastructure/GymController.java, src/main/java/com/example/boka/gymclass/infrastructure/AdminGymClassController.java, src/main/java/com/example/boka/gymclass/infrastructure/ClassSearchController.java, src/main/java/com/example/boka/security/AuthController.java, src/main/java/com/example/boka/user/infrastructure/UserController.java
Applied @Tag annotations to six controllers for OpenAPI documentation grouping (Bookings, Gyms, Admin, Classes, Auth, and Users categories).
Security Configuration
src/main/java/com/example/boka/security/SecurityConfig.java
Added permit-all authorization rules for Swagger UI and OpenAPI documentation endpoints (/swagger-ui.html, /swagger-ui/**, /v3/api-docs/**) to allow unauthenticated access.
OpenAPI Configuration
src/main/resources/application.properties
Configured Springdoc OpenAPI endpoints, Swagger UI exposure, and API metadata (title, description, version) with "Try it out" feature enabled.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and accurately summarizes the main objective: integrating OpenAPI/Swagger documentation using springdoc dependency and annotations across controllers.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/springdoc

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 51 minutes and 6 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai Bot previously requested changes Apr 29, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/java/com/example/boka/gymclass/infrastructure/AdminGymClassController.java (1)

21-21: Good: class-level @Tag correctly groups /api/admin endpoints under “Admin”.

@Tag(name = "Admin", description = ...) at the controller level should provide the expected grouping in the generated OpenAPI UI.

Please verify in your running Swagger UI / OpenAPI JSON that:

  1. springdoc is scanning this controller package, and
  2. the tag appears as expected (e.g., operations under this controller show up under the “Admin” tag rather than “default”).

If you already standardize tags across controllers (as the PR summary suggests), consider keeping tag names/descriptions consistent via shared constants/enums to avoid drift over time.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/example/boka/gymclass/infrastructure/AdminGymClassController.java`
at line 21, Verify that springdoc is scanning the package containing
AdminGymClassController and that the `@Tag`(name = "Admin", description = "...")
on AdminGymClassController appears in the generated OpenAPI JSON/Swagger UI
(operations from this controller should be grouped under the "Admin" tag, not
"default"); if it does not, update your springdoc configuration to include this
package (or ensure component scanning of controllers) and reload the OpenAPI
JSON to confirm. After verification, standardize tag usage by extracting the
literal tag name/description into a shared constant or enum (e.g.,
ApiTags.ADMIN) and replace inline `@Tag` values on AdminGymClassController (and
other controllers) to avoid drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/resources/application.properties`:
- Around line 42-44: Remove the undocumented springdoc.info.* properties from
application.properties (springdoc.info.title, springdoc.info.description,
springdoc.info.version) and instead define OpenAPI metadata via an
`@OpenAPIDefinition` annotated configuration class; create a config class (e.g.,
OpenApiConfig) annotated with `@Configuration` and `@OpenAPIDefinition`(info =
`@Info`(...)) setting title, description and version so Springdoc v3 picks them up
correctly.

---

Nitpick comments:
In
`@src/main/java/com/example/boka/gymclass/infrastructure/AdminGymClassController.java`:
- Line 21: Verify that springdoc is scanning the package containing
AdminGymClassController and that the `@Tag`(name = "Admin", description = "...")
on AdminGymClassController appears in the generated OpenAPI JSON/Swagger UI
(operations from this controller should be grouped under the "Admin" tag, not
"default"); if it does not, update your springdoc configuration to include this
package (or ensure component scanning of controllers) and reload the OpenAPI
JSON to confirm. After verification, standardize tag usage by extracting the
literal tag name/description into a shared constant or enum (e.g.,
ApiTags.ADMIN) and replace inline `@Tag` values on AdminGymClassController (and
other controllers) to avoid drift.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 214d4c65-860d-4342-903e-f144e0f9a63d

📥 Commits

Reviewing files that changed from the base of the PR and between 58a3d3b and 4adaa56.

📒 Files selected for processing (9)
  • pom.xml
  • src/main/java/com/example/boka/booking/infrastructure/BookingController.java
  • src/main/java/com/example/boka/gym/infrastructure/GymController.java
  • src/main/java/com/example/boka/gymclass/infrastructure/AdminGymClassController.java
  • src/main/java/com/example/boka/gymclass/infrastructure/ClassSearchController.java
  • src/main/java/com/example/boka/security/AuthController.java
  • src/main/java/com/example/boka/security/SecurityConfig.java
  • src/main/java/com/example/boka/user/infrastructure/UserController.java
  • src/main/resources/application.properties

Comment thread src/main/resources/application.properties Outdated
… `OpenApiConfig` class using annotations for cleaner API documentation setup.
@mattknatt
mattknatt merged commit 7739ddf into main Apr 30, 2026
2 checks passed
@mattknatt
mattknatt deleted the feat/springdoc branch April 30, 2026 06:46
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