chore(swagger): add env-driven Dev/UAT/Demo servers, update and uncomment the SwaggerConfig.java#60
Conversation
…ment the SwaggerConfig.java
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📝 WalkthroughWalkthroughMigration from Swagger 2 (Springfox Docket) to OpenAPI 3 configuration across the codebase, including updates to GitHub workflow CI/CD branch naming, SwaggerConfig class refactoring, and new API server URL properties with environment-driven configuration. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 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 unit tests (beta)
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
🤖 Fix all issues with AI agents
In `@src/main/resources/application-swagger.properties`:
- Line 26: The jwt.secret property in application-swagger.properties currently
uses a SpEL fallback that calls T(java.util.UUID).randomUUID().toString(),
causing a new JWT secret on every restart and invalidating tokens; replace this
dynamic fallback so the application does not auto-generate a secret at runtime —
instead require a real secret be provided (remove the randomUUID SpEL fallback
from jwt.secret) or set the property to a fixed placeholder used only for CI,
and ensure the swagger profile/file is excluded from real deployments (do not
activate application-swagger.properties in production).
🧹 Nitpick comments (3)
src/main/java/com/iemr/common/bengen/config/SwaggerConfig.java (3)
39-39: Rename the security scheme to something more descriptive.
"my security"will appear in the generated OpenAPI spec and Swagger UI. A conventional name like"bearerAuth"or"Authorization"would be more professional and self-documenting.Proposed fix
- private static final String SECURITY_SCHEME_NAME = "my security"; + private static final String SECURITY_SCHEME_NAME = "bearerAuth";
52-53: AddbearerFormat("JWT")to the security scheme.This is optional per the OpenAPI spec but helps Swagger UI indicate the expected token format to consumers.
Proposed fix
- new SecurityScheme().name(SECURITY_SCHEME_NAME).type(SecurityScheme.Type.HTTP).scheme("bearer"))) + new SecurityScheme().name(SECURITY_SCHEME_NAME).type(SecurityScheme.Type.HTTP).scheme("bearer").bearerFormat("JWT")))
54-58: PreferList.ofoverjava.util.Arrays.asList(Java 17+).The project targets Java 17 (per the CI workflow).
List.ofis more concise, returns an unmodifiable list, and avoids the inline fully-qualifiedjava.util.Arraysreference.Proposed fix
- .servers(java.util.Arrays.asList( - new Server().url(devUrl).description("Dev"), - new Server().url(uatUrl).description("UAT"), - new Server().url(demoUrl).description("Demo") - )); + .servers(java.util.List.of( + new Server().url(devUrl).description("Dev"), + new Server().url(uatUrl).description("UAT"), + new Server().url(demoUrl).description("Demo") + ));Or better yet, add
import java.util.List;to the imports and useList.of(...).
|



Summary by CodeRabbit