Skip to content

Refactor OpenAPI spec: deduplicate into shared components#2

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1782936963-refactor-openapi-shared-utils
Open

Refactor OpenAPI spec: deduplicate into shared components#2
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1782936963-refactor-openapi-shared-utils

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Eliminates pervasive duplication in the BankWeb OpenAPI spec by extracting repeated patterns into reusable components/ definitions. Net reduction: 123 lines (1211 → 1088), replacing 356 lines of inline duplication with 233 lines of shared definitions.

Shared responses (components/responses/)

  • UnauthorizedResponse — replaces 16 inline 401 blocks
  • BadRequestResponse — replaces 13 inline 400 blocks
  • EmptyResultResponse — replaces 9 inline 200 + EmptyResult blocks
  • StoreItemListResponse — shared by AdminStore/GetStoreItems and Store/GetStoreItems
  • NotFoundResponse — replaces inline 404 block

Shared request bodies (components/requestBodies/)

  • UserModelBody — used by 5 endpoints (Login, Register, PasswordRecovery, Recover, ContactUs)
  • StoreItemBody — used by 3 endpoints (Create, Edit, DeleteStoreItem)
  • BuyProductReqBody, TransactionDBModelBody, NewImageModelBody

Each eliminates the repeated application/json + text/json + application/*+json content-type triplet.

Shared parameter (components/parameters/)

  • PathId{id} path param shared by AdminStore/Get/{id}, AdminStore/Edit/{id}, Transaction/Get/{id}

Schema consolidation

+DataTableResp           // base: { recordsTotal, recordsFiltered }
  TransactionRespDataTableResp    // allOf: DataTableResp + { data: TransactionResp[] }
  AdminUserInfoRespDataTableResp  // allOf: DataTableResp + { data: AdminUserInfoResp[] }

Previously these two schemas duplicated the recordsTotal/recordsFiltered wrapper; now they compose via allOf from a shared DataTableResp base.

Link to Devin session: https://app.devin.ai/sessions/e02d6a21c64e466aa756e4f36c06d313
Requested by: @wsh92

…meters, and schemas

- Extract 5 shared responses (UnauthorizedResponse, BadRequestResponse,
  NotFoundResponse, EmptyResultResponse, StoreItemListResponse) replacing
  16 inline 401, 13 inline 400, and 9 inline EmptyResult response blocks
- Extract 5 shared request bodies (UserModelBody, StoreItemBody,
  BuyProductReqBody, TransactionDBModelBody, NewImageModelBody)
  eliminating 11 repeated content-type triplets
- Extract shared PathId parameter used by 3 endpoints
- Consolidate DataTableResp base schema using allOf composition,
  deduplicating recordsTotal/recordsFiltered across
  TransactionRespDataTableResp and AdminUserInfoRespDataTableResp
- Extract StoreItemListResponse shared by AdminStore and Store endpoints

Net reduction: 123 lines (1211 -> 1088), removing 356 lines of duplication
and adding 233 lines of shared component definitions.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@wsh92 wsh92 self-assigned this Jul 1, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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