chore(api): add the base OpenAPI metadata config#423
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
📝 WalkthroughWalkthroughA new Spring configuration class conditionally registers an OpenAPI bean when Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@booklore-api/src/test/java/org/booklore/config/openapi/OpenApiConfigIntegrationTest.java`:
- Around line 26-29: The test assertions in OpenApiConfigIntegrationTest refer
to values that don't match the OpenApiConfig implementation: update either the
test expectations or the OpenApiConfig values so they align. Specifically,
reconcile openAPI.getInfo().getDescription() (test expects "REST API for
managing..." but OpenApiConfig currently sets "REST API documentation for
managing...") and openAPI.getInfo().getContact().getName() (test expects
"Grimmory Maintainers" but OpenApiConfig sets "Grimmory"); choose one approach
and make both description and contact name consistent between OpenApiConfig and
the assertions (or update the assert strings in OpenApiConfigIntegrationTest to
match OpenApiConfig), keeping the version assertion unchanged.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 48b2665b-1d7a-4f6c-9852-57f712bd5c79
📒 Files selected for processing (4)
README.mdbooklore-api/src/main/java/org/booklore/config/openapi/OpenApiConfig.javabooklore-api/src/test/java/org/booklore/config/openapi/OpenApiConfigIntegrationTest.javabooklore-api/src/test/java/org/booklore/config/openapi/OpenApiDocsDisabledIntegrationTest.java
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
booklore-api/src/**/*.java
📄 CodeRabbit inference engine (AGENTS.md)
booklore-api/src/**/*.java: Use 4-space indentation in Java files and match surrounding Java style
Prefer constructor injection via Lombok patterns already used in the codebase. Do not introduce@Autowiredfield injection
Use MapStruct for entity/DTO mapping
Files:
booklore-api/src/main/java/org/booklore/config/openapi/OpenApiConfig.javabooklore-api/src/test/java/org/booklore/config/openapi/OpenApiDocsDisabledIntegrationTest.javabooklore-api/src/test/java/org/booklore/config/openapi/OpenApiConfigIntegrationTest.java
booklore-api/src/test/**/*.java
📄 CodeRabbit inference engine (AGENTS.md)
Prefer focused unit tests; use
@SpringBootTestonly when the Spring context is required
Files:
booklore-api/src/test/java/org/booklore/config/openapi/OpenApiDocsDisabledIntegrationTest.javabooklore-api/src/test/java/org/booklore/config/openapi/OpenApiConfigIntegrationTest.java
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: grimmory-tools/grimmory PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-26T01:46:48.863Z
Learning: Applies to booklore-api/src/test/**/*.java : Prefer focused unit tests; use `SpringBootTest` only when the Spring context is required
📚 Learning: 2026-03-26T01:46:48.863Z
Learnt from: CR
Repo: grimmory-tools/grimmory PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-26T01:46:48.863Z
Learning: Applies to booklore-api/src/test/**/*.java : Prefer focused unit tests; use `SpringBootTest` only when the Spring context is required
Applied to files:
booklore-api/src/test/java/org/booklore/config/openapi/OpenApiDocsDisabledIntegrationTest.javabooklore-api/src/test/java/org/booklore/config/openapi/OpenApiConfigIntegrationTest.java
🔇 Additional comments (4)
README.md (1)
200-202: LGTM!The documentation clearly explains the conditional availability of API docs based on
API_DOCS_ENABLED, which aligns with the implementation inOpenApiConfig.java.booklore-api/src/main/java/org/booklore/config/openapi/OpenApiConfig.java (1)
13-33: Well-structured conditional configuration.Good use of
@RequiredArgsConstructorfor constructor injection (per coding guidelines), and@ConditionalOnPropertycorrectly guards the bean registration. ThematchIfMissing = falseensures the OpenAPI bean is only created when explicitly enabled.booklore-api/src/test/java/org/booklore/config/openapi/OpenApiDocsDisabledIntegrationTest.java (1)
12-34: LGTM!Good use of
ApplicationContextRunnerfor a focused test without spinning up the full Spring context. The test correctly verifies that theOpenAPIbean is not registered when docs are disabled. Based on learnings: "Prefer focused unit tests; useSpringBootTestonly when the Spring context is required."booklore-api/src/test/java/org/booklore/config/openapi/OpenApiConfigIntegrationTest.java (1)
14-15: Good test structure usingApplicationContextRunner.The use of
ApplicationContextRunnerwith a minimalTestConfigurationproviding the requiredAppPropertiesdependency is the right approach for testing conditional configuration without a full Spring context.Also applies to: 38-47
Description
This PR adds the base metadata config in for the
openapi.jsongeneration. This is the first step in adding more rich config details to our API docs. Now that #361 is in, we can begin refactoringSecurityConfigto surface auth schemes.Linked Issue: #290
Changes
OpenApiConfigto handle base config setup. Will be expanded on in a future commit to establish auth schemesSummary by CodeRabbit
New Features
Documentation
Tests