Skip to content

Add server urls and update swagger workflow#135

Merged
drtechie merged 8 commits intoPSMRI:mainfrom
DurgaPrasad-54:main
Feb 17, 2026
Merged

Add server urls and update swagger workflow#135
drtechie merged 8 commits intoPSMRI:mainfrom
DurgaPrasad-54:main

Conversation

@DurgaPrasad-54
Copy link
Contributor

@DurgaPrasad-54 DurgaPrasad-54 commented Feb 12, 2026

Summary by CodeRabbit

  • New Features
    • API documentation now displays server endpoints for multiple environments (Dev, UAT, and Demo).

@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

The changes update Swagger/OpenAPI configuration to support environment-specific server URLs (Dev, UAT, Demo) retrieved from application properties and modify the GitHub Actions workflow branch name from dynamic to static.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/swagger-json.yml
Changed Pull Request branch name from dynamic (using run ID and attempt) to static identifier auto/swagger-update-identity-api.
Swagger Configuration
src/main/java/com/iemr/common/identity/config/SwaggerConfig.java, src/main/resources/application-swagger.properties
Updated OpenAPI bean to accept Environment parameter and configure three servers (Dev, UAT, Demo) using URLs retrieved from properties. Added three new server URL properties with default fallbacks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hopping through servers—Dev, UAT, Demo bright,
Environment beans fetch configurations right,
Static branch names keep workflows precise,
Three URLs dancing, configured oh-so-nice!

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: adding server URLs to Swagger configuration and updating the GitHub workflow for swagger updates.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
src/main/java/com/iemr/common/identity/config/SwaggerConfig.java (2)

49-53: Prefer imports over inline fully-qualified class names.

java.util.Arrays and io.swagger.v3.oas.models.servers.Server are used inline. Adding proper imports improves readability.

♻️ Proposed fix

Add imports at the top of the file:

import java.util.Arrays;
import io.swagger.v3.oas.models.servers.Server;

Then simplify the server configuration:

-            .servers(java.util.Arrays.asList(
-                new io.swagger.v3.oas.models.servers.Server().url(devUrl).description("Dev"),
-                new io.swagger.v3.oas.models.servers.Server().url(uatUrl).description("UAT"),
-                new io.swagger.v3.oas.models.servers.Server().url(demoUrl).description("Demo")
+            .servers(Arrays.asList(
+                new Server().url(devUrl).description("Dev"),
+                new Server().url(uatUrl).description("UAT"),
+                new Server().url(demoUrl).description("Demo")
             ));

36-53: Consider using @Value annotation instead of manual Environment lookup.

Spring's @Value with default values is more idiomatic for injecting properties and keeps the bean method cleaner.

♻️ Sketch
`@Configuration`
public class SwaggerConfig {
    private static final String DEFAULT_SERVER_URL = "http://localhost:9090";

    `@Value`("${api.dev.url:" + DEFAULT_SERVER_URL + "}")
    private String devUrl;

    `@Value`("${api.uat.url:" + DEFAULT_SERVER_URL + "}")
    private String uatUrl;

    `@Value`("${api.demo.url:" + DEFAULT_SERVER_URL + "}")
    private String demoUrl;

    `@Bean`
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
            .info(new Info().title("Identity API").version("version")
                .description("A microservice for the creation and management of beneficiaries."))
            .addSecurityItem(new SecurityRequirement().addList("my security"))
            .components(new Components().addSecuritySchemes("my security",
                new SecurityScheme().name("my security").type(SecurityScheme.Type.HTTP).scheme("bearer")))
            .servers(Arrays.asList(
                new Server().url(devUrl).description("Dev"),
                new Server().url(uatUrl).description("UAT"),
                new Server().url(demoUrl).description("Demo")
            ));
    }
}

Note: @Value doesn't allow referencing static final fields in the default expression directly via string concatenation in the annotation. You'd need to hardcode the default or use a ${...} property placeholder default syntax:

`@Value`("${api.dev.url:http://localhost:9090}")

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

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

@sonarqubecloud
Copy link

@drtechie drtechie merged commit 7c91575 into PSMRI:main Feb 17, 2026
3 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.

2 participants