Skip to content

Add new workflow and server urls#129

Open
DurgaPrasad-54 wants to merge 8 commits intoPSMRI:mainfrom
DurgaPrasad-54:main
Open

Add new workflow and server urls#129
DurgaPrasad-54 wants to merge 8 commits intoPSMRI:mainfrom
DurgaPrasad-54:main

Conversation

@DurgaPrasad-54
Copy link
Contributor

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

Summary by CodeRabbit

  • New Features

    • API documentation now lists environment-specific server URLs (development, UAT, demo) with sensible defaults for each environment.
  • Chores

    • CI workflow for creating pull requests now uses a fixed branch name for consistent PR destinations.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

Adds environment-configured Swagger/OpenAPI server URLs (dev/uat/demo) by injecting Spring Environment into SwaggerConfig and reading new properties; updates application properties with three API URL entries; changes GitHub workflow PR branch naming to a fixed branch auto/swagger-update-tm-api.

Changes

Cohort / File(s) Summary
Workflow Configuration
\.github/workflows/swagger-json.yml
Changed Create Pull Request branch from dynamic auto/swagger-update-${{ github.run_id }}-${{ github.run_attempt }} to fixed auto/swagger-update-tm-api.
Swagger Config & Properties
src/main/java/com/iemr/tm/config/SwaggerConfig.java, src/main/resources/application-swagger.properties
Swapped no-arg OpenAPI bean for customOpenAPI(Environment env) that reads api.dev.url, api.uat.url, api.demo.url (with a DEFAULT_SERVER_URL fallback) and adds corresponding servers to the OpenAPI object; added three new api.*.url properties with defaults in application-swagger.properties.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I nibble docs and sip the dew,
Dev, UAT, Demo—URLs anew,
A steady branch to send my plea,
Swagger sings across the tree,
Hooray for tidy API view! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 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 (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add new workflow and server urls' accurately describes the main changes: modifications to the swagger workflow and addition of server URL configurations.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ 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/tm/config/SwaggerConfig.java (2)

30-34: Prefer importing Server instead of using fully qualified class names inline.

The repeated io.swagger.v3.oas.models.servers.Server hurts readability. Add an import and use the short name.

Proposed fix

Add the import at the top of the file:

import io.swagger.v3.oas.models.servers.Server;

Then simplify the builder:

             .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")
+                new Server().url(devUrl).description("Dev"),
+                new Server().url(uatUrl).description("UAT"),
+                new Server().url(demoUrl).description("Demo")
             ));

Similarly, java.util.Arrays.asList can be replaced with java.util.List.of (Java 9+) or you can add import java.util.List; / import java.util.Arrays;.


19-33: All three servers are always added, even when properties are unset.

If only one environment is configured (e.g., only api.dev.url), the other two servers will still appear in Swagger UI pointing to localhost:9090, which could be confusing. Consider conditionally adding servers only when their property is explicitly set.


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/main/java/com/iemr/tm/config/SwaggerConfig.java`:
- Around line 22-31: Replace the placeholder API version and mismatched
description in the OpenAPI builder: update the OpenAPI().info(...) call used in
SwaggerConfig (the OpenAPI() builder expression) to set a real version string
(e.g., "1.0.0") or wire it from a property/POM and change the description text
to accurately describe the TeleMedicine service rather than "creation and
management of beneficiaries"; ensure the change is applied to the Info()
instance used in the return statement so Swagger UI shows the correct version
and service description.
🧹 Nitpick comments (1)
src/main/java/com/iemr/tm/config/SwaggerConfig.java (1)

27-31: Use imports instead of inline fully-qualified class names.

io.swagger.v3.oas.models.servers.Server and java.util.Arrays are used via FQCNs 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 list construction:

-            .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")
             ));

Or use java.util.List.of(...) if on Java 9+ (Java 17 is used in CI):

-            .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(List.of(
+                new Server().url(devUrl).description("Dev"),
+                new Server().url(uatUrl).description("UAT"),
+                new Server().url(demoUrl).description("Demo")
+            ));

@sonarqubecloud
Copy link

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