-
Notifications
You must be signed in to change notification settings - Fork 77
feat(notifications): re-generates swagger and sdks #2268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2268 +/- ##
==========================================
- Coverage 47.64% 46.61% -1.04%
==========================================
Files 1034 1021 -13
Lines 29294 28406 -888
Branches 7624 7512 -112
==========================================
- Hits 13957 13241 -716
+ Misses 14857 14852 -5
+ Partials 480 313 -167
*This pull request uses carry forward flags. Click here to find out more. 🚀 New features to boost your workflow:
|
WalkthroughThe pull request restructures alert-related schemas across the Swagger JSON and React Query SDK by introducing two new notification types (WALLET_BALANCE and CHAIN_EVENT), replacing flat field structures with nested params and conditions objects, adding explicit type discriminators, and tightening field typings for balance-related branches while reorganizing existing alert variants. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/notifications/swagger/swagger.json (1)
4691-5150: Consider de-duplicating the conditions schema via shared$refin a follow-up
AlertPatchInput.data.conditions(and the other alert schemas) inline essentially the same nestedoperator/field/valuestructure multiple times, with only minor differences between generic and balance-only variants. This is correct but quite verbose and harder to maintain if condition semantics evolve.If you plan more alert types or condition operators, consider extracting:
- A generic
ConditionExpressionschema for string/number/boolean fields.- A
BalanceConditionExpressionschema forfield: "balance"+ numericvalue.and then referencing them via
$refin the variousoneOfbranches. That refactor should happen at the source that emits swagger and be tracked as a separate issue rather than in this regeneration PR.
Based on learnings
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/notifications/swagger/swagger.json(21 hunks)packages/react-query-sdk/src/notifications/schema.ts(5 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
🔇 Additional comments (4)
packages/react-query-sdk/src/notifications/schema.ts (2)
247-290: WALLET_BALANCE AlertCreateInput variant looks structurally consistentThe new
type: "WALLET_BALANCE"branch mirrors the existingDEPLOYMENT_BALANCEbalance-conditions shape (restrictedfield: "balance"and numericvalue) and introducesparamswith{ owner, denom, suppressedBySystem? }, which aligns with the swagger schema and the intended wallet-level semantics. No structural issues stand out here from the SDK consumer perspective.
341-387: Output and list unions correctly model CHAIN_EVENT and WALLET_BALANCE variantsThe added
CHAIN_EVENTandWALLET_BALANCEcases inAlertOutputResponse.dataandAlertListOutputResponse.dataare internally consistent and match the swagger definitions:
- Each variant has a clear discriminator via
type: "CHAIN_MESSAGE" | "CHAIN_EVENT" | "DEPLOYMENT_BALANCE" | "WALLET_BALANCE".- Balance-based variants (
DEPLOYMENT_BALANCE,WALLET_BALANCE) consistently restrict conditions tofield: "balance"withvalue: number.paramspayloads are specialized: deployment balance uses{ dseq, owner, suppressedBySystem? }, wallet balance uses{ owner, denom, suppressedBySystem? }, while chain-based variants keep the existing{ dseq, type, suppressedBySystem? }.This should give React Query consumers a clean discriminated-union surface over the regenerated API.
Also applies to: 453-487, 557-603, 669-702
apps/notifications/swagger/swagger.json (2)
1121-2211: AlertCreateInput: WALLET_BALANCE and extended alert variants are coherentWithin
components.schemas.AlertCreateInput.data.oneOf, the four variants (CHAIN_MESSAGE, CHAIN_EVENT, DEPLOYMENT_BALANCE, WALLET_BALANCE) are well-formed and mutually distinguishable via theirtypeenums. The WALLET balance branch:
- Constrains conditions to numeric
balancechecks (and/or + single condition).- Uses
params{ owner, denom, suppressedBySystem? }withowneranddenomrequired.- Mirrors the deployment-balance pattern while correctly omitting
dseq.This looks consistent with how the SDK types were generated and should be safe to expose as the canonical contract for creating wallet-balance alerts.
2212-4690: AlertOutputResponse & AlertListOutputResponse unions align across all alert typesThe new
AlertOutputResponseandAlertListOutputResponseschemas correctly:
- Standardize common metadata (
notificationChannelId,name,enabled,summary,description,id,userId,status,createdAt,updatedAt).- Discriminate per-alert behavior via
typeenums:"CHAIN_MESSAGE" | "CHAIN_EVENT" | "DEPLOYMENT_BALANCE" | "WALLET_BALANCE".- Keep chain-related branches on generic conditions (
field: string,value: string|number|boolean) and optionalparams { dseq, type, suppressedBySystem? }.- Restrict balance-based branches to
field: "balance"and numericvalue, with specializedparamsfor deployment vs wallet.These shapes match the generated TypeScript in
notifications/schema.tsand give clients a predictable discriminated union across list/read/delete responses as well as create.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.