chore(swagger): automate swagger sync to amrit-docs#63
chore(swagger): automate swagger sync to amrit-docs#63DurgaPrasad-54 wants to merge 5 commits intoPSMRI:mainfrom
Conversation
Added a badge for DeepWiki to the README.
|
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. WalkthroughThis pull request introduces automated Swagger documentation synchronization for the scheduler API. A new GitHub Actions workflow generates Swagger JSON during API builds and creates pull requests to sync the documentation to the AMRIT-Docs repository. Supporting changes include adding H2 database runtime dependency, a Swagger profile configuration file, and a documentation badge. Changes
Sequence DiagramsequenceDiagram
participant GitHub as GitHub<br/>(Trigger)
participant Actions as GitHub Actions<br/>(Runner)
participant Maven as Maven
participant API as API Server
participant Swagger as Swagger<br/>Endpoint
participant Validation as Validation<br/>(jq)
participant Docs as AMRIT-Docs<br/>Repo
participant PullRequest as GitHub API<br/>(PR Creation)
GitHub->>Actions: Push to main / Manual dispatch
Actions->>Maven: Build API (package, skip tests)
Maven-->>Actions: Build artifacts
Actions->>API: Start API (swagger profile, port 9090)
API-->>Actions: Started
loop Poll until valid
Actions->>Swagger: GET /swagger-json
Swagger-->>Actions: JSON response
Actions->>Validation: Validate JSON paths
Validation-->>Actions: Validation result
end
Actions->>API: Stop API process
API-->>Actions: Stopped
Actions->>Docs: Checkout AMRIT-Docs repo
Docs-->>Actions: Repository cloned
Actions->>Actions: Copy scheduler-api.json
Actions->>Docs: Update docs/swagger/scheduler-api.json
Actions->>PullRequest: Create PR with auto-generated commit
PullRequest-->>GitHub: PR created
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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: 3
🤖 Fix all issues with AI agents
In @.github/workflows/swagger-json.yml:
- Around line 89-100: Update the Create Pull Request step: change the action
reference from "peter-evans/create-pull-request@v6" to the latest v8 (e.g.,
"@v8") and add the input "delete-branch: true" to the step inputs so branches
are removed when there is no remaining diff; locate the step using the "Create
Pull Request" name and the "peter-evans/create-pull-request" usage in the
workflow and add the new input alongside existing keys like token, path, branch,
base, commit-message, title and body.
In `@src/main/resources/application-swagger.properties`:
- Around line 15-16: Fix the typo and remove the weak hardcoded fallback for the
JWT secret: correct `defualt-key` to `default-key` if you must keep a documented
placeholder, but preferably remove the static fallback from the `jwt.secret`
property so the app/profile fails when `JWT_SECRET_KEY` is unset (change to use
no default or throw on missing env), or replace it with a long
cryptographically-random value if you absolutely need a reproducible default for
CI; also add a short comment that any static default is only for doc/CI
generation and not for production. Ensure you update the `jwt.secret` property
reference and the `JWT_SECRET_KEY` handling consistently so the value cannot
silently fall back to a guessable string.
- Around line 6-8: Update the swagger profile properties to use the Spring Boot
3.2 Redis property namespace and explicitly disable the session store: replace
occurrences of spring.redis.host and spring.redis.port with
spring.data.redis.host and spring.data.redis.port, and add
spring.session.store-type=none so the swagger profile does not inherit a Redis
session store; adjust any references in the file that mention spring.redis.* to
spring.data.redis.* and ensure spring.session.store-type is set to "none" for
the swagger profile.
🧹 Nitpick comments (5)
pom.xml (1)
254-258: Consider scoping H2 to a Maven profile to avoid shipping it in the production WAR.With
<scope>runtime</scope>, H2 will be bundled into the final WAR deployed to production. Since it's only needed for the CI swagger-generation step, you could wrap it in a Maven<profile>(e.g.,swagger) and activate it only during the workflow build. This avoids enlarging the production artifact with an unused in-memory database driver.♻️ Example: isolate H2 in a Maven profile
- <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <scope>runtime</scope> - </dependency>Add a Maven profile at the bottom of
pom.xml:<profiles> <profile> <id>swagger</id> <dependencies> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> </dependency> </dependencies> </profile> </profiles>Then in the workflow, build and run with
-Pswagger:- name: Build API (skip tests) run: mvn -B clean package -DskipTests -Pswagger - name: Run API in swagger profile run: | nohup mvn spring-boot:run \ -Pswagger \ -Dspring-boot.run.profiles=swagger \ ....github/workflows/swagger-json.yml (4)
3-6: Consider adding a path filter to avoid unnecessary runs.Every push to
maintriggers this workflow, including documentation-only or CI config changes. Adding a path filter prevents wasted CI minutes when no API code has changed.♻️ Suggested path filter
on: push: branches: [ main ] + paths: + - 'src/**' + - 'pom.xml' workflow_dispatch:
26-38: Double build:mvn packagethenmvn spring-boot:runrecompiles the project.
spring-boot:runforks a new build lifecycle, so the project is effectively built twice. Consider running the already-built WAR directly:♻️ Run the built artifact instead
- name: Build API (skip tests) - run: mvn -B clean package -DskipTests + run: mvn -B clean package -DskipTests -Dspring-boot.run.skip=true - name: Run API in swagger profile run: | - nohup mvn spring-boot:run \ - -Dspring-boot.run.profiles=swagger \ - -Dspring-boot.run.arguments=--server.port=9090 \ - > app.log 2>&1 & + WAR_FILE=$(find target -name '*.war' -type f | head -1) + nohup java -jar "$WAR_FILE" \ + --spring.profiles.active=swagger \ + --server.port=9090 \ + > app.log 2>&1 & echo $! > api_pid.txtThis also improves PID tracking —
$!will capture the actual Java process PID rather than anohup mvnshell wrapper, making the kill in the cleanup step more reliable.
14-17:fetch-depth: 0is unnecessary for this use case.Full git history isn't needed to build the project. The default shallow clone (
fetch-depth: 1) would speed up checkout.- name: Checkout API repo (full history) uses: actions/checkout@v4 - with: - fetch-depth: 0
29-30:jqis pre-installed on GitHub-hostedubuntu-latestrunners.Remove this step to save CI time.
Remove unnecessary step
- - name: Install jq - run: sudo apt-get update && sudo apt-get install -y jq
| - name: Create Pull Request | ||
| uses: peter-evans/create-pull-request@v6 | ||
| with: | ||
| token: ${{ secrets.DOCS_REPO_TOKEN }} | ||
| path: amrit-docs | ||
| branch: auto/swagger-update-${{ github.run_id }}-${{ github.run_attempt }} | ||
| base: main | ||
| commit-message: "chore(docs): auto-update Scheduler-API swagger" | ||
| title: "chore(docs): auto-update Scheduler-API swagger" | ||
| body: | | ||
| This PR automatically updates Scheduler-API Swagger JSON | ||
| from the latest main branch build. |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
peter-evans create-pull-request latest version 2026
💡 Result:
Latest peter-evans/create-pull-request version (as of Feb 6, 2026) is v8.1.0 (released Jan 21, 2026). [1]
Recommended usage (major pin):
- uses: peter-evans/create-pull-request@v8[2]
Exact pin:
- uses: peter-evans/create-pull-request@v8.1.0[1]
Sources: [1] [2]
🌐 Web query:
peter-evans create-pull-request delete-branch option
💡 Result:
In peter-evans/create-pull-request, the delete-branch input controls whether the action will delete the PR branch when it determines the branch is no longer needed.
- Set it like this:
- uses: peter-evans/create-pull-request@v8
with:
branch: my-auto-branch
delete-branch: true- What it does:
- If a PR becomes unnecessary (no diff remains), the action will close the PR and delete the branch.
- If a PR was merged but the branch wasn’t deleted, then the next time the action runs, it will delete the branch if there’s still no diff.
- What it does not do: it doesn’t delete the branch immediately on merge (that would require the merge event to trigger the action). If you want immediate deletion on merge, use GitHub’s repo setting “Automatically delete head branches”. [1]
🌐 Web query:
peter-evans create-pull-request@v6 2025 2026 current version
💡 Result:
As of February 6, 2026, the current major version of peter-evans/create-pull-request is v8, with the latest release shown as v8.0.0 (Dec 9, 2025). [1]
So peter-evans/create-pull-request@v6 is not current; update to:
uses: peter-evans/create-pull-request@v8(recommended major pin), oruses: peter-evans/create-pull-request@v8.0.0(exact pin)
The GitHub Marketplace usage example also reflects @v8. [2]
Sources: [1] [2]
Upgrade to peter-evans/create-pull-request@v8 and add delete-branch: true with additional configuration.
peter-evans/create-pull-request@v6 is outdated (latest is v8.1.0 as of Jan 2026). The delete-branch: true option should be added, but note it only deletes branches when the action detects no remaining diff—it does not immediately clean up merged branches. To fully prevent stale branch accumulation, also enable GitHub's repository setting "Automatically delete head branches" so merged branches are deleted immediately.
♻️ Update action version and add delete-branch option
- name: Create Pull Request
- uses: peter-evans/create-pull-request@v6
+ uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.DOCS_REPO_TOKEN }}
path: amrit-docs
branch: auto/swagger-update-${{ github.run_id }}-${{ github.run_attempt }}
base: main
commit-message: "chore(docs): auto-update Scheduler-API swagger"
title: "chore(docs): auto-update Scheduler-API swagger"
+ delete-branch: true
body: |
This PR automatically updates Scheduler-API Swagger JSON
from the latest main branch build.🤖 Prompt for AI Agents
In @.github/workflows/swagger-json.yml around lines 89 - 100, Update the Create
Pull Request step: change the action reference from
"peter-evans/create-pull-request@v6" to the latest v8 (e.g., "@v8") and add the
input "delete-branch: true" to the step inputs so branches are removed when
there is no remaining diff; locate the step using the "Create Pull Request" name
and the "peter-evans/create-pull-request" usage in the workflow and add the new
input alongside existing keys like token, path, branch, base, commit-message,
title and body.
| # Disable Redis if not needed for docs (optional) | ||
| spring.redis.host=${REDIS_HOST:localhost} | ||
| spring.redis.port=${REDIS_PORT:6379} |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Find build configuration files to determine Spring Boot version
find . -maxdepth 2 -type f \( -name "pom.xml" -o -name "build.gradle" -o -name "build.gradle.kts" \) | head -5Repository: PSMRI/Scheduler-API
Length of output: 72
🏁 Script executed:
# Check application properties files to understand configuration patterns
fd "application.*\.properties$" | head -20Repository: PSMRI/Scheduler-API
Length of output: 154
🏁 Script executed:
# Look for Redis or session configuration in the codebase
rg "spring\.redis|spring\.data\.redis|redis.*host|redis.*port" -t properties --max-count 20Repository: PSMRI/Scheduler-API
Length of output: 97
🏁 Script executed:
# Read pom.xml to determine Spring Boot version
head -100 pom.xml | grep -i "spring.boot\|spring-boot"Repository: PSMRI/Scheduler-API
Length of output: 431
🏁 Script executed:
# Read the swagger properties file
cat -n src/main/resources/application-swagger.propertiesRepository: PSMRI/Scheduler-API
Length of output: 887
🏁 Script executed:
# Read the main properties file
cat -n src/main/resources/application.propertiesRepository: PSMRI/Scheduler-API
Length of output: 1504
🏁 Script executed:
# Search for Redis configuration patterns in properties files
rg "spring\.(redis|data\.redis|session|autoconfigure)" src/main/resources/Repository: PSMRI/Scheduler-API
Length of output: 445
🏁 Script executed:
# Get the Spring Boot version from pom.xml
rg "spring-boot-starter-parent" -A 2 pom.xml | head -10Repository: PSMRI/Scheduler-API
Length of output: 201
🏁 Script executed:
# Search for version info in pom.xml
grep -i "version" pom.xml | head -10Repository: PSMRI/Scheduler-API
Length of output: 448
🌐 Web query:
Spring Boot 3.x spring.redis vs spring.data.redis property names RedisAutoConfiguration
💡 Result:
In Spring Boot 3.x, the Redis properties used by RedisAutoConfiguration moved from the spring.redis.* prefix to spring.data.redis.* because Redis auto-configuration is now aligned with (and requires) Spring Data Redis on the classpath. This follows the prefix on RedisProperties, which is what RedisAutoConfiguration binds to. (docs.spring.io)
What changed
- Spring Boot 2.x:
RedisPropertiesis bound with@ConfigurationProperties(prefix="spring.redis")(docs.enterprise.spring.io) - Spring Boot 3.x:
RedisPropertiesis bound with@ConfigurationProperties(prefix="spring.data.redis")(docs.enterprise.spring.io)
So, for Boot 3.x, you should use:
spring.data.redis.host=localhost
spring.data.redis.port=6379
spring.data.redis.password=...
spring.data.redis.database=0
spring.data.redis.timeout=60sExample confirmation (Boot 3.x uses spring.data.redis.*): (baeldung.com)
Migration rule of thumb
Replace:
spring.redis.*→spring.data.redis.*(lightrun.com)
This applies to the whole Redis property set (including things like url, ssl, client-type, lettuce.*, jedis.*, cluster/sentinel, etc.), since they’re all under RedisProperties which RedisAutoConfiguration enables. (docs.spring.io)
Citations:
- 1: https://docs.spring.io/spring-boot/docs/3.2.7/api/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.html?utm_source=openai
- 2: https://docs.enterprise.spring.io/spring-boot/docs/2.7.25/api/org/springframework/boot/autoconfigure/data/redis/RedisProperties.html?utm_source=openai
- 3: https://docs.enterprise.spring.io/spring-boot/docs/3.0.16/api/org/springframework/boot/autoconfigure/data/redis/RedisProperties.html?utm_source=openai
- 4: https://www.baeldung.com/spring-data-redis-properties?utm_source=openai
- 5: https://lightrun.com/answers/spring-projects-experimental-spring-boot-migrator-300-m5-redis-properties?utm_source=openai
- 6: https://docs.spring.io/spring-boot/docs/3.2.7/api/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.html?utm_source=openai
🏁 Script executed:
# Verify which properties are actually recognized in Spring Boot 3.2.2 by checking if spring.redis.* properties are deprecated
rg "RedisProperties" pom.xmlRepository: PSMRI/Scheduler-API
Length of output: 45
🏁 Script executed:
# Check if there are any other configuration files or test configs that show proper usage
fd "application.*\.properties$|application.*\.yml$" src/test/ 2>/dev/null | head -10Repository: PSMRI/Scheduler-API
Length of output: 45
🌐 Web query:
Spring Boot 3.2 spring.redis properties deprecated or removed compatibility
💡 Result:
In Spring Boot 3.2, the spring.redis.* property namespace is no longer used for Redis auto-configuration. Redis configuration properties are now bound under spring.data.redis.* (this change happened in Spring Boot 3.0+, so it applies to 3.2 as well). In the Spring Boot 3.2 API, RedisProperties is explicitly annotated with @ConfigurationProperties(prefix="spring.data.redis"). [1] (In older Spring Boot versions, it used spring.redis.) [2]
What to do (migration / compatibility)
- Rename your properties from
spring.redis.*→spring.data.redis.*(same property names after the prefix in most cases). This is the recommended migration step noted in Boot 3.0 migration guidance/notes. [3]- Example:
spring.redis.host→spring.data.redis.hostspring.redis.port→spring.data.redis.portspring.redis.password→spring.data.redis.passwordspring.redis.ssl→spring.data.redis.ssl.enabled(see current docs for SSL structure) [4]
- Example:
Related (often confused) namespace
- Redis cache settings are separate and use
spring.cache.redis.*(e.g., TTL), notspring.data.redis.*. [5]
Sources:
[1] Spring Boot 3.2 RedisProperties API (prefix = spring.data.redis) (docs.enterprise.spring.io)
[2] Spring Boot 2.x RedisProperties API (prefix = spring.redis) (docs.spring.io)
[3] Boot migrator / release-note excerpt describing spring.redis → spring.data.redis move (lightrun.com)
[4] Spring Boot 3.2 reference docs showing spring.data.redis.* usage (docs.enterprise.spring.io)
[5] Spring Boot 3.2 reference docs showing spring.cache.redis.* properties (docs.spring.io)
Citations:
- 1: https://docs.enterprise.spring.io/spring-boot/docs/3.2.15.1/api/org/springframework/boot/autoconfigure/data/redis/RedisProperties.html?utm_source=openai
- 2: https://docs.spring.io/spring-boot/docs/2.4.5/api/org/springframework/boot/autoconfigure/data/redis/RedisProperties.html?utm_source=openai
- 3: https://lightrun.com/answers/spring-projects-experimental-spring-boot-migrator-300-m5-redis-properties?utm_source=openai
- 4: https://docs.enterprise.spring.io/spring-boot/docs/3.2.14/reference/html/data.html?utm_source=openai
- 5: https://docs.spring.io/spring-boot/docs/3.2.0-SNAPSHOT/reference/htmlsingle/index.html?utm_source=openai
Update property prefix from spring.redis.* to spring.data.redis.* and explicitly disable Redis session store for the swagger profile.
The current configuration has two issues:
-
Wrong property prefix for Spring Boot 3.2: The code uses
spring.redis.*, but Spring Boot 3.2 requiresspring.data.redis.*. Thespring.redis.*namespace is no longer recognized byRedisAutoConfigurationin Boot 3.x. -
Redis session store is not disabled: The swagger profile doesn't override
spring.session.store-type, so it inherits the production setting (spring.session.store-type=redisfrom application.properties). This means the app will fail to start in CI if no Redis instance is available.
Fix:
Suggested changes
# Disable Redis if not needed for docs (optional)
-spring.redis.host=${REDIS_HOST:localhost}
-spring.redis.port=${REDIS_PORT:6379}
+spring.data.redis.host=${REDIS_HOST:localhost}
+spring.data.redis.port=${REDIS_PORT:6379}
+spring.session.store-type=none
+spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration,org.springframework.boot.autoconfigure.session.SessionAutoConfiguration🤖 Prompt for AI Agents
In `@src/main/resources/application-swagger.properties` around lines 6 - 8, Update
the swagger profile properties to use the Spring Boot 3.2 Redis property
namespace and explicitly disable the session store: replace occurrences of
spring.redis.host and spring.redis.port with spring.data.redis.host and
spring.data.redis.port, and add spring.session.store-type=none so the swagger
profile does not inherit a Redis session store; adjust any references in the
file that mention spring.redis.* to spring.data.redis.* and ensure
spring.session.store-type is set to "none" for the swagger profile.
|



Summary by CodeRabbit
New Features
Documentation