Update the swagger json github workflow#359
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughGitHub Actions workflow for generating/validating Swagger JSON was hardened and PR creation updated; OpenAPI config now adds Dev/UAT/Demo servers sourced from environment properties. (49 words) Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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 |
| run: | | ||
| mkdir -p amrit-docs/docs/swagger | ||
| cp common-api.json amrit-docs/docs/swagger/common-api.json | ||
| cp tm-api.json amrit-docs/docs/swagger/tm-api.json |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/swagger-json.yml:
- Around line 96-104: The workflow currently generates unique branches per run
via the create-pull-request step (uses: peter-evans/create-pull-request@v8)
using branch: auto/swagger-update-${{ github.run_id }}-${{ github.run_attempt
}}, which causes many stale PRs; change this to a fixed branch name (e.g.,
branch: auto/swagger-update) so the action will update/force-push the same
branch and keep a single PR open, retaining delete-branch: true for cleanup
after merge.
🧹 Nitpick comments (2)
.github/workflows/swagger-json.yml (2)
67-80: Misleading comments and unconditionalsleep 5before the PID check.Two concerns:
Comment–code mismatch: The "Graceful shutdown" comment (Line 70) annotates the bare
sleep 5, while the actual graceful signal (SIGTERM, Line 75) sits under the "Force kill" comment (Line 72). This will confuse future maintainers.Process-group kill may be a no-op:
kill -- -"$PID"treats$PIDas a PGID. The$!captured on Line 36 is the Maven wrapper PID, which is not guaranteed to be a process-group leader in the Actions runner shell. If it isn't, bothkillcalls silently fail and onlyfuseron Line 80 actually cleans up — so the logic is safe, but the intermediate steps would be dead code.Minor: The unconditional
sleep 5(Line 71) runs even whenapi_pid.txtdoesn't exist. Move it inside theifblock.Proposed cleanup
- name: Stop API if: always() run: | - # Graceful shutdown of the process group - sleep 5 - # Force kill the process group if still running if [ -f api_pid.txt ]; then - PID=$(cat api_pid.txt) - kill -TERM -- -"$PID" 2>/dev/null || true - sleep 2 - kill -9 -- -"$PID" 2>/dev/null || true - fi - # Fallback: kill any remaining java process on port 9090 - fuser -k 9090/tcp 2>/dev/null || true + PID=$(cat api_pid.txt) + # Graceful SIGTERM, then wait + kill -TERM "$PID" 2>/dev/null || true + sleep 5 + # Force SIGKILL if still running + kill -9 "$PID" 2>/dev/null || true + sleep 1 + fi + # Fallback: kill anything still on port 9090 + fuser -k 9090/tcp 2>/dev/null || true
30-36: Consider usingsetsidto guarantee a new process group for reliable group-kill in the Stop step.The PID captured by
$!on Line 36 may not be a process-group leader (relevant to thekill -- -"$PID"calls in the Stop step). If you want the process-group kill pattern to work reliably, launch withsetsid:- mvn spring-boot:run \ + setsid mvn spring-boot:run \ -Dspring-boot.run.profiles=swagger \ -Dspring-boot.run.arguments=--server.port=9090 \ > app.log 2>&1 &This ensures the Maven process is a session/group leader, making
kill -- -"$PID"effective and cleaning up all child processes (including the forked Java process).
✅ Actions performedFull review triggered. |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/main/java/com/iemr/common/config/SwaggerConfig.java`:
- Around line 23-25: The SwaggerConfig currently adds Server entries with
hardcoded internal default URLs via System.getenv().getOrDefault(...) for
API_DEV_URL, API_UAT_URL and API_DEMO_URL which exposes internal hostnames when
env vars are missing; update the logic in SwaggerConfig where the new
io.swagger.v3.oas.models.servers.Server() instances are created (the three
Server(...) url(...) calls) so that if the environment variable is unset you
either (a) use a safe default like "http://localhost" or (b) skip adding that
Server entry entirely — choose one approach consistently and implement it by
checking System.getenv("API_*_URL") for null/empty before constructing/adding
the Server or by changing getOrDefault(...) to a safe localhost value.
🧹 Nitpick comments (2)
src/main/java/com/iemr/common/config/SwaggerConfig.java (2)
22-26: Prefer@Valueinjection over rawSystem.getenv()for Spring configuration.Using
System.getenv()bypasses Spring's property resolution, meaning these values can't be overridden viaapplication.properties, profiles, or test configurations. Spring's@Valuewith${ENV_VAR:default}syntax resolves environment variables, system properties, and config files uniformly.♻️ Suggested refactor
Inject the URLs as constructor/field parameters:
`@Configuration` public class SwaggerConfig { `@Value`("${API_DEV_URL:https://amritwprdev.piramalswasthya.org}") private String devUrl; `@Value`("${API_UAT_URL:https://uatamrit.piramalswasthya.org}") private String uatUrl; `@Value`("${API_DEMO_URL:https://amritdemo.piramalswasthya.org}") private String demoUrl; `@Bean` public OpenAPI customOpenAPI() { return new OpenAPI() .info(new Info().title("Common 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(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") )); } }
22-26: Inline fully-qualified class names — consider adding imports instead.
java.util.Arraysandio.swagger.v3.oas.models.servers.Serverare used with their FQCNs inline. Adding them as imports at the top of the file would improve readability and consistency with the existing import style.
|
* Update application.properties * add column in create BeneficiaryModel * Elasticsearch implementation for Beneficiary Search (#324) * fix: implement functionality to search beneficiaries with Elasticsearch * fix: remove unwanted import * fix: update pom.xml * fix: change the response code * variable added * update language * update language * Downgrade version from 3.6.1 to 3.6.0 * Elastic Search Implementation for Advanced Search (#327) * fix: cherry-pick commits for advanced search * fix: cherry-pick commit for token issue - mobile application * fix: add the missing properties * fix: add function to retrieve userid * fix: move the fetch Userid to jwtUtil * Remove empty line in application.properties * fix:signature check for mmu * Update application.properties * Update application.properties * fix: retrive any user without deleted * implement state wise hide un hide form fields * implement state wise hide un hide form fields * implement state wise hide un hide form fields * enhance welcome sms code * fix hide unhide form issue * docs: add DeepWiki badge and documentation link * Add DeepWiki badge to README Added DeepWiki badge to README for better visibility. * fix hide unhide form issue * fix hide unhide form issue * fix hide unhide form issue * fix hide unhide form issue * fix hide unhide form issue * fix hide unhide form issue * fix hide unhide form issue * fix hide unhide form issue * fix hide unhide form issue * fix hide unhide form issue * fix hide unhide form issue * fix hide unhide form issue * fix hide unhide form issue * fix hide unhide form issue * fix hide unhide form issue * fix hide unhide form issue * chore(swagger): automate swagger sync to amrit-docs (#354) * chore(swagger): automate swagger sync to amrit-docs * chore(swagger): automate swagger sync to amrit-docs * chore(swagger): automate swagger sync to amrit-docs * Update the swagger json github workflow (#359) * chore(swagger): automate swagger sync to amrit-docs * chore(swagger): automate swagger sync to amrit-docs * chore(swagger): automate swagger sync to amrit-docs * fix(swagger): update the workflow and fix the running issue * fix(swagger): fix the swagger json workflow * chore(swagger): add fixed branch name in workflow * chore(ci): prevent multiple swagger sync PRs by using fixed branch * chore(swagger): add Dev/UAT/Demo servers to OpenAPI config * chore(swagger): avoid default server URLs * chore(swagger): remove field injection and inject URLs into OpenAPI bean * Add /health endpoint and standardize /version response (#331) * Add /health endpoint and standardize /version response * Add license headers and Javadocs to health and version controllers * Enhance /health endpoint to check Database and Redis connectivity * Improve /health endpoint HTTP status handling and logging * Enhance database health check with validation query * Refactor health controller to constructor injection and constants * Refactor: Extract business logic to HealthService to keep controller lean * Refactor: Extract business logic to HealthService to keep controller lean * Fix: Use ObjectProvider for optional health dependencies * Add advance health check for database (#361) * chore(swagger): automate swagger sync to amrit-docs * chore(swagger): automate swagger sync to amrit-docs * chore(swagger): automate swagger sync to amrit-docs * fix(swagger): update the workflow and fix the running issue * fix(swagger): fix the swagger json workflow * chore(swagger): add fixed branch name in workflow * chore(ci): prevent multiple swagger sync PRs by using fixed branch * chore(swagger): add Dev/UAT/Demo servers to OpenAPI config * chore(swagger): avoid default server URLs * chore(swagger): remove field injection and inject URLs into OpenAPI bean * feat(health,version): update version and health endpoints and add advance check for database * fix(health): normalize severity and fix slow query false positives * fix(health): avoid false CRITICAL on single long-running MySQL transaction * fix(health): enforce 3s DB connection timeout via HikariCP * Merge Release-3.8.0 (3.6.1) to Main (#379) * Move code to 3.6.1 to 3.8.0 (#372) * fix: cors spell fixes and import of packages updates * fix: deployment issue fix * feat: amm-1959 dhis token for cho report re-direction * fix: beneficiary history on revisit (#320) * fix: call type mapper (#322) * Elasticsearch implementation for Beneficiary Search (#324) * fix: implement functionality to search beneficiaries with Elasticsearch * fix: remove unwanted import * fix: update pom.xml * fix: change the response code * variable added * Elastic Search Implementation for Advanced Search (#327) * fix: cherry-pick commits for advanced search * fix: cherry-pick commit for token issue - mobile application * fix: add the missing properties * fix: add function to retrieve userid * fix: move the fetch Userid to jwtUtil * fix:signature check for mmu * fix: retrive any user without deleted * fix: update KM filepath * FLW-713 Remove All File Upload Options (#350) * FLW-713 Remove All File Upload Options * Fix UserServiceRoleRepo dependency issue and codeRabit comment * fixed coderabit comment * fix userMappingId issue * Add SMS functionality in release-3.6.1 (#358) * Enable SMS Functionality in MMU App to Send Prescriptions (#325) * fix: sms template save and map mmu (#306) * Vb/sms (#307) * fix: sms template save and map mmu * fix: enable mms for mmu prescription * Enable SMS Functionality in MMU App to Send Prescriptions (#325) * fix: sms template save and map mmu (#306) * Vb/sms (#307) * fix: sms template save and map mmu * fix: enable mms for mmu prescription --------- Co-authored-by: Vishwanath Balkur <118195001+vishwab1@users.noreply.github.com> --------- Co-authored-by: 5Amogh <amoghavarsh@navadhiti.com> Co-authored-by: Vanitha S <116701245+vanitha1822@users.noreply.github.com> Co-authored-by: Sachin Kadam <152252767+sac2kadam@users.noreply.github.com> Co-authored-by: vanitha1822 <vanitha@navadhiti.com> Co-authored-by: Saurav Mishra <80103738+SauravBizbRolly@users.noreply.github.com> * fix: add OTP rate limiting to prevent OTP flooding on sendConsent endpoint (#373) - Add OtpRateLimiterService with Redis-backed per-mobile rate limits (3/min, 10/hr, 20/day) - Add OtpRateLimitException for 429 responses - Integrate rate limiter in BeneficiaryOTPHandlerImpl and BeneficiaryConsentController - Add otp.ratelimit.* properties to common_ci and common_docker profiles - Update common_example.properties with new OTP rate limit config Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> * Health api (#376) * Cherry-pick health and version API enhancements to release-3.6.1 (#371) * feat(health,version): update version and health endpoints and add advance check for database * fix(health): normalize severity and fix slow query false positives * fix(health): avoid false CRITICAL on single long-running MySQL transaction * fix(health): enforce 3s DB connection timeout via HikariCP * Release 3.6.1 (#374) * feat(health,version): update version and health endpoints and add advance check for database * fix(health): normalize severity and fix slow query false positives * fix(health): avoid false CRITICAL on single long-running MySQL transaction * fix(health): enforce 3s DB connection timeout via HikariCP * feat(health): add healthcontroller and fix versioncontroller issues * fix: build error (#375) --------- Co-authored-by: KOPPIREDDY DURGA PRASAD <144464542+DurgaPrasad-54@users.noreply.github.com> Co-authored-by: Vanitha S <116701245+vanitha1822@users.noreply.github.com> --------- Co-authored-by: Vishwanath Balkur <118195001+vishwab1@users.noreply.github.com> Co-authored-by: 5Amogh <amoghavarsh@navadhiti.com> Co-authored-by: Sachin Kadam <152252767+sac2kadam@users.noreply.github.com> Co-authored-by: Saurav Mishra <80103738+SauravBizbRolly@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: KOPPIREDDY DURGA PRASAD <144464542+DurgaPrasad-54@users.noreply.github.com> * fix: video consultation functionality * fix: pom version update * fix: add cti-server-ip * fix: comment unwanted code * fix: update videocall url property * fix: update cti-server-ip * docs: add CLAUDE.md for Claude Code guidance Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: KM issue * fix: KM issue * fix: remove unwanted imports * fix: conflicts * fix: update the temp path * Fix the OpenKM Issue (#389) * fix: remove km in application.properties * fix: update all the properties to fetch from env * fix: update path * fix: KM issue * fix: get file from km * fix: build issue * fix: build issue * fix: remove unwanted imports * fix: build issue * fix: remove commented line * Enable KM configuration in common_example.properties Uncomment KM configuration properties for OpenKM. * Fix ConfigProperties to resolve env variable placeholders via Spring Environment (#390) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: update sms issue * fix: build issue * fix: update condition * fix: edit ben issue * fix: phone number issue for sms * fix: update the url with jwt token * fix: jitsi authorization issue * fix: skip auth * fix: hash key updation * fix: jwt type in header for authorization * fix: update file path * fix: vc recording path updation * fix: update video call recording functionality * fix: remove unwanted codes * fix: coderabbit comments --------- Co-authored-by: Saurav Mishra <80103738+SauravBizbRolly@users.noreply.github.com> Co-authored-by: Saurav Mishra <saurav.mishra@bizbrolly.com> Co-authored-by: Sachin Kadam <152252767+sac2kadam@users.noreply.github.com> Co-authored-by: Mithun James <drtechie@users.noreply.github.com> Co-authored-by: Amoghavarsh <93114621+5Amogh@users.noreply.github.com> Co-authored-by: vishwab1 <vishwanath@navadhiti.com> Co-authored-by: SnehaRH <77656297+snehar-nd@users.noreply.github.com> Co-authored-by: DurgaPrasad-54 <prasad8790237@gmail.com> Co-authored-by: KOPPIREDDY DURGA PRASAD <144464542+DurgaPrasad-54@users.noreply.github.com> Co-authored-by: Vaishnav Bhosale <vaishnavbharatbhosale@gmail.com> Co-authored-by: Vishwanath Balkur <118195001+vishwab1@users.noreply.github.com> Co-authored-by: 5Amogh <amoghavarsh@navadhiti.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: SnehaRH <sneha@navadhiti.com>



Summary by CodeRabbit
New Features
Bug Fixes
Chores