Skip to content

chore(swagger): automate swagger sync to amrit-docs#113

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

chore(swagger): automate swagger sync to amrit-docs#113
DurgaPrasad-54 wants to merge 5 commits intoPSMRI:mainfrom
DurgaPrasad-54:main

Conversation

@DurgaPrasad-54
Copy link
Contributor

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

Add Swagger Json Automation file swagger-json.yml and application-swagger.properties

Summary by CodeRabbit

  • New Features

    • Automated Swagger documentation generation and synchronization to the documentation repository via pull requests.
    • Added runtime configuration to support generating Swagger/OpenAPI docs during builds.
  • Chores

    • Added H2 database runtime support.
    • Updated README with an additional branding badge.

@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

Warning

Rate limit exceeded

@DurgaPrasad-54 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 26 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📝 Walkthrough
📝 Walkthrough
🚥 Pre-merge checks | ✅ 3
✅ 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 clearly and concisely summarizes the main change: automating Swagger documentation synchronization to the AMRIT-Docs repository via a new workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

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

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

@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/resources/application-swagger.properties`:
- Around line 6-9: The swagger profile currently sets
spring.data.redis.host/port but does not disable Redis auto-configuration;
update the application-swagger properties to explicitly exclude Redis
auto-configuration by adding the spring.autoconfigure.exclude property
referencing
org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration (and
optionally
org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration)
so Spring Boot won't attempt to connect to Redis during the swagger profile.
🧹 Nitpick comments (2)
src/main/resources/application-swagger.properties (1)

15-16: Avoid committing a default JWT secret.

The fallback secret can be reused accidentally in shared environments. Prefer requiring JWT_SECRET_KEY (and set it in the workflow) or generate a per-run secret.

🔐 Suggested update
-jwt.secret=${JWT_SECRET_KEY:default-swagger-secret-change-me}
+jwt.secret=${JWT_SECRET_KEY}
.github/workflows/swagger-json.yml (1)

69-74: Prefer graceful shutdown before SIGKILL.

SIGKILL skips cleanup; a brief SIGTERM attempt is safer and still deterministic.

🛠️ Suggested change
-          if [ -f api_pid.txt ]; then
-            kill -9 $(cat api_pid.txt) || true
-          fi
+          if [ -f api_pid.txt ]; then
+            PID=$(cat api_pid.txt)
+            kill "$PID" || true
+            sleep 5
+            kill -9 "$PID" || true
+          fi

Comment on lines 6 to 9
# Disable Redis if not needed for docs (optional)
spring.data.redis.host=localhost
spring.data.redis.port=6379

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, find and examine the swagger properties file
find . -name "application-swagger.properties" -type f

Repository: PSMRI/Inventory-API

Length of output: 114


🏁 Script executed:

# Also check for other application properties files to understand the context
find . -name "application*.properties" -type f | head -20

Repository: PSMRI/Inventory-API

Length of output: 158


🏁 Script executed:

# Read the full swagger properties file to see the complete configuration
cat -n ./src/main/resources/application-swagger.properties

Repository: PSMRI/Inventory-API

Length of output: 992


🏁 Script executed:

# Also check the main application.properties to understand the full context
cat -n ./src/main/resources/application.properties

Repository: PSMRI/Inventory-API

Length of output: 1454


🌐 Web query:

Spring Boot 3.2 Redis auto-configuration disable spring.autoconfigure.exclude

💡 Result:

To disable Spring Boot 3.2 Redis auto-configuration via spring.autoconfigure.exclude, exclude the Redis auto-config classes by fully-qualified name (FQCN): RedisAutoConfiguration (core), plus reactive and repositories if you use those starters. [1]

application.properties

spring.autoconfigure.exclude=\
org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration,\
org.springframework.boot.autoconfigure.data.redis.RedisReactiveAutoConfiguration,\
org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration

application.yml

spring:
  autoconfigure:
    exclude:
      - org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
      - org.springframework.boot.autoconfigure.data.redis.RedisReactiveAutoConfiguration
      - org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration

Class names used above come from Spring Boot’s Redis auto-configurations:

  • org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration [2]
  • org.springframework.boot.autoconfigure.data.redis.RedisReactiveAutoConfiguration [3]
  • org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration [4]

(Alternative: you can also exclude via @SpringBootApplication(exclude = …); Spring Boot documents both approaches, including spring.autoconfigure.exclude.) [1]

If you only want to disable Redis repositories (not the connection factory/templates):

spring.data.redis.repositories.enabled=false

(RedisRepositoriesAutoConfiguration is conditional on that property.) [4]

Note: If you’re excluding Redis just to remove the Actuator Redis health indicator, that’s a different auto-config (RedisHealthContributorAutoConfiguration / RedisReactiveHealthContributorAutoConfiguration). [5]

References:
[1] Spring Boot Reference: Disabling specific auto-configuration classes (spring.autoconfigure.exclude)
[2] Spring Boot 3.2.x API: RedisAutoConfiguration
[3] Spring Boot 3.2.x API: RedisReactiveAutoConfiguration
[4] Spring Boot API: RedisRepositoriesAutoConfiguration (same FQCN in 3.x)
[5] Spring Boot Actuator API: Redis health contributor auto-configurations


🌐 Web query:

Spring Boot RedisAutoConfiguration RedisRepositoriesAutoConfiguration property exclusion

💡 Result:

To exclude those Redis auto-configurations via properties, use spring.autoconfigure.exclude with the fully-qualified auto-config class names:

application.properties

spring.autoconfigure.exclude=\
org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration,\
org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration

Spring Boot explicitly supports excluding auto-configurations via the spring.autoconfigure.exclude property (same effect as @SpringBootApplication(exclude=...)). (docs.spring.io)

application.yml

spring:
  autoconfigure:
    exclude:
      - org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
      - org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration

(docs.spring.io)

If your goal is only to stop Spring Data Redis repositories (but keep Redis connectivity/templates), you can instead disable repositories with:

spring.data.redis.repositories.enabled=false

RedisRepositoriesAutoConfiguration is conditional on spring.data.redis.repositories.enabled (defaults to enabled if missing). (docs.enterprise.spring.io)

Citations:


Swagger profile still enables Redis; explicitly disable auto-configuration to avoid CI failures.

Setting spring.data.redis.host and spring.data.redis.port configures the Redis connection but does not disable Redis auto-configuration. With spring-boot-starter-data-redis on the classpath, Spring Boot's RedisAutoConfiguration will still trigger and attempt to connect, which breaks CI if Redis isn't running. Since the swagger profile uses an in-memory H2 database and is intended for documentation only, explicitly disable Redis auto-configuration.

💡 Suggested update
-# Disable Redis if not needed for docs (optional)
-spring.data.redis.host=localhost
-spring.data.redis.port=6379
+# Explicitly disable Redis for swagger profile to avoid external dependency in CI
+spring.session.store-type=none
+spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration,org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration
🤖 Prompt for AI Agents
In `@src/main/resources/application-swagger.properties` around lines 6 - 9, The
swagger profile currently sets spring.data.redis.host/port but does not disable
Redis auto-configuration; update the application-swagger properties to
explicitly exclude Redis auto-configuration by adding the
spring.autoconfigure.exclude property referencing
org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration (and
optionally
org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration)
so Spring Boot won't attempt to connect to Redis during the swagger profile.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

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