Skip to content

chore(docs): auto-update Admin-API swagger#53

Open
drtechie wants to merge 1 commit into
mainfrom
auto/swagger-update-admin-api
Open

chore(docs): auto-update Admin-API swagger#53
drtechie wants to merge 1 commit into
mainfrom
auto/swagger-update-admin-api

Conversation

@drtechie
Copy link
Copy Markdown
Member

@drtechie drtechie commented May 22, 2026

This PR automatically updates Admin-API Swagger JSON
from the latest main branch build.

Summary by CodeRabbit

  • Documentation
    • Added new API endpoints for facility lookups, ASHA supervisor mappings, village mappings, and facility hierarchy management (create, delete, query)
    • Extended facility data model with hierarchical and regional fields
    • Clarified API request/response media types for improved consistency

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

Walkthrough

This PR extends the AMRIT admin API specification with facility hierarchy management, ASHA supervisor mappings, and facility/item lookup endpoints. New /userFacilityMapping operations enable ASHA management; facility query paths support hierarchical traversal; cascade operations manage facility creation/deactivation; and the M_Facility schema gains hierarchical properties. Existing operations are normalized to explicit application/json response types.

Changes

OpenAPI Admin Specification Update

Layer / File(s) Summary
ASHA and User-Facility Mapping Endpoints
docs/swagger/admin-api.json
Introduces /userFacilityMapping operations for facility lookup by mapping ID, fetching ASHAs by facility, and complete ASHA supervisor mapping CRUD (update atomically, save, restore, get-by-facility, delete) with explicit response type declarations.
Updates to Existing Operation Specifications
docs/swagger/admin-api.json
Normalizes response media-type declarations across email config, user role/language, provider operations, SNOMED, service-point, and signature operations from generic */* to explicit application/json; updates requestBody schema definitions for email, facility, calibration, and signature operations.
Facility, Village, and Item Mapping Lookups
docs/swagger/admin-api.json
Adds /getMappedVillageIDs, /getItemMappingsByFacility, /getItemBatchForStoreID, and /getmappingProviderAdmintoProvider endpoints for facility and inventory lookups with explicit request and response schemas.
Facility Query and Hierarchy Navigation
docs/swagger/admin-api.json
Introduces facility query endpoints for types (by state/rural-urban/block), hierarchical relationships (/getChildFacilitiesByParent, /getFacilitiesByBlockAndLevel), and facility listings (/getAllFacilitiesByBlock including deleted facilities).
Facility Lifecycle Cascade Operations
docs/swagger/admin-api.json
Adds /createFacilityWithHierarchy and /deleteFacilityWithHierarchy endpoints for hierarchical facility creation and deactivation with cascading effects on related entities.
Facility Type Validation and Level Configuration
docs/swagger/admin-api.json
Introduces /checkFacilityTypeName for type-name uniqueness validation and /getFacilityLevels for retrieving organizational facility levels.
M_Facility Schema Extension
docs/swagger/admin-api.json
Extends M_Facility schema with stateID, districtID, blockID, parentFacilityID, mainVillageID, and ruralUrban properties for hierarchical and regional facility classification.

🎯 4 (Complex) | ⏱️ ~45 minutes

🐰 A doc file grows deep and wide,
With facilities now organized with pride,
ASHAs mapped, hierarchies aligned,
The spec now mirrors the backend's design.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: an automatic update to the Admin-API Swagger documentation file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch auto/swagger-update-admin-api

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
Copy Markdown

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
docs/swagger/admin-api.json (2)

1382-1660: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Replace opaque string schemas with concrete JSON schemas for new ASHA mapping endpoints
In docs/swagger/admin-api.json (lines 1382–1660), these 7 operations set both requestBody.content.application/json.schema and responses.200.content.application/json.schema to {"type":"string"} (e.g., /userFacilityMapping/getFacilityByMappingID, /userFacilityMapping/getAshasByFacility, and all /userFacilityMapping/ashaSupervisorMapping/* operations). Update them to proper JSON object/array schemas (preferably via $ref) so client generation/validation reflects the real payloads.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/swagger/admin-api.json` around lines 1382 - 1660, The OpenAPI operations
use opaque {"type":"string"} schemas; replace those with concrete JSON
object/array schemas (prefer $ref entries) for both
requestBody.content.application/json.schema and
responses.200.content.application/json.schema for operationIds
getFacilityByMappingID, getAshasByFacility,
updateAshaSupervisorMappingAtomically, saveAshaSupervisorMapping,
restoreAshaSupervisorMapping, getSupervisorMappingByFacility, and
deleteAshaSupervisorMapping; add appropriate component schema definitions (e.g.,
FacilityByMappingRequest / FacilityResponse, AshasByFacilityRequest /
AshaListResponse, AshaSupervisorMappingRequest / AshaSupervisorMappingResponse
or AshaSupervisorMappingArray) and update each operation to point to those $ref
schemas so generated clients/validators get correct object/array types.

1662-1699: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Normalize 200 response content media types to application/json (remove */*)

  • docs/swagger/admin-api.json still uses responses["200"].content["*/*"] for POST /uptsu/submit/cdss (around line 1692) and POST /uptsu/saveFacility (around line 1733), unlike adjacent updates that specify application/json.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/swagger/admin-api.json` around lines 1662 - 1699, The 200 response for
POST /uptsu/submit/cdss uses a wildcard media type "*/*"; update
responses["200"].content to use "application/json" instead of "*/*" and keep the
existing schema (type: string) so tools expect JSON; adjust the same pattern for
the related endpoint (operationId saveCdssDetails and also check POST
/uptsu/saveFacility) to match the adjacent responses that use
"application/json".
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/swagger/admin-api.json`:
- Around line 1467-1468: The summary strings contain internal references like
"Fix 7" that should be removed and replaced with user-facing descriptions;
update the "summary" value for the operation with operationId
"updateAshaSupervisorMappingAtomically" to a concise description of behavior
(e.g., "Atomically replace old ASHA supervisor mappings with new mappings") and
similarly find and update any other summaries that include "Fix 8 + Fix 19" to
plain user-facing wording; ensure only the public-facing summary text is changed
and operationId values remain untouched.
- Around line 11068-11105: The POST operation for path
"/getItemMappingsByFacility" (operationId getItemMappingsByFacility) is missing
a summary; add a short summary property to the operation object (e.g. "summary":
"Retrieve item-facility mappings") so Swagger UI shows a human-friendly
description instead of falling back to operationId—place the summary at the same
level as tags and operationId inside the operation definition.

---

Outside diff comments:
In `@docs/swagger/admin-api.json`:
- Around line 1382-1660: The OpenAPI operations use opaque {"type":"string"}
schemas; replace those with concrete JSON object/array schemas (prefer $ref
entries) for both requestBody.content.application/json.schema and
responses.200.content.application/json.schema for operationIds
getFacilityByMappingID, getAshasByFacility,
updateAshaSupervisorMappingAtomically, saveAshaSupervisorMapping,
restoreAshaSupervisorMapping, getSupervisorMappingByFacility, and
deleteAshaSupervisorMapping; add appropriate component schema definitions (e.g.,
FacilityByMappingRequest / FacilityResponse, AshasByFacilityRequest /
AshaListResponse, AshaSupervisorMappingRequest / AshaSupervisorMappingResponse
or AshaSupervisorMappingArray) and update each operation to point to those $ref
schemas so generated clients/validators get correct object/array types.
- Around line 1662-1699: The 200 response for POST /uptsu/submit/cdss uses a
wildcard media type "*/*"; update responses["200"].content to use
"application/json" instead of "*/*" and keep the existing schema (type: string)
so tools expect JSON; adjust the same pattern for the related endpoint
(operationId saveCdssDetails and also check POST /uptsu/saveFacility) to match
the adjacent responses that use "application/json".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c0411d09-7ef0-4f79-8931-63653e891abd

📥 Commits

Reviewing files that changed from the base of the PR and between 93e5398 and 80445f4.

📒 Files selected for processing (1)
  • docs/swagger/admin-api.json

Comment on lines +1467 to +1468
"summary": "Atomically delete old and save new ASHA supervisor mappings (Fix 7)",
"operationId": "updateAshaSupervisorMappingAtomically",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Remove internal fix references from public summaries.

Fix 7 and Fix 8 + Fix 19 will surface in Swagger UI and generated docs, but they do not tell API consumers anything about behavior. Please replace them with user-facing wording only.

Also applies to: 13979-13980

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/swagger/admin-api.json` around lines 1467 - 1468, The summary strings
contain internal references like "Fix 7" that should be removed and replaced
with user-facing descriptions; update the "summary" value for the operation with
operationId "updateAshaSupervisorMappingAtomically" to a concise description of
behavior (e.g., "Atomically replace old ASHA supervisor mappings with new
mappings") and similarly find and update any other summaries that include "Fix 8
+ Fix 19" to plain user-facing wording; ensure only the public-facing summary
text is changed and operationId values remain untouched.

Comment on lines +11068 to +11105
"/getItemMappingsByFacility": {
"post": {
"tags": [
"m-item-facility-mapping-controller"
],
"operationId": "getItemMappingsByFacility",
"parameters": [
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a summary for this new operation.

This endpoint is missing summary, so Swagger UI will fall back to operationId. Add a short description to keep the new lookup endpoints documented consistently.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/swagger/admin-api.json` around lines 11068 - 11105, The POST operation
for path "/getItemMappingsByFacility" (operationId getItemMappingsByFacility) is
missing a summary; add a short summary property to the operation object (e.g.
"summary": "Retrieve item-facility mappings") so Swagger UI shows a
human-friendly description instead of falling back to operationId—place the
summary at the same level as tags and operationId inside the operation
definition.

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