feat:Add payment and billing endpoints to OpenAPI spec#259
Conversation
WalkthroughThis pull request expands the OpenAPI specification with a comprehensive set of payment-related API endpoints and their supporting data schemas. The changes include new endpoints for payment configuration, billing portal access, usage metrics, and funds management, along with corresponding schema definitions to validate request and response payloads. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 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)
📝 Coding Plan
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: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/libs/DeepInfra/openapi.yaml`:
- Around line 4746-4749: Update the OpenAPI schema to forbid negative monetary
values: set AddFundsIn.amount to require a positive integer by adding minimum: 1
(so amount > 0), and set TopUpIn.amount and TopUpIn.threshold to require
non-negative integers by adding minimum: 0; locate and update the schema objects
named AddFundsIn, TopUpIn and their amount/threshold properties in openapi.yaml
(also apply the same minimum constraints to the duplicate definitions mentioned
around lines 5018-5027).
- Around line 4388-4390: The OpenAPI spec currently leaves the cookie parameter
"session" untyped (schema: {}), causing generators to treat it as object/any;
update every /payment/* operation where the parameter name is session to specify
its schema as a string (replace schema: {} with schema: { type: string } or add
type: string under schema) so the cookie is emitted as a string in generated
clients; ensure you update all occurrences referenced (the session parameter
blocks around the listed line groups) rather than adding new parameters.
- Around line 5004-5007: The TimeInterval schema's fr property is declared as a
plain integer which can overflow 32-bit clients; update the fr property (schema
name TimeInterval / property fr) to include format: int64 (matching the existing
to property) so the OpenAPI spec documents it as a 64-bit integer in
milliseconds.
- Around line 4855-4862: Remove server-assigned properties from the create input
model: edit the DeepStartApplicationIn schema to eliminate the id, uid,
created_at, and status properties (and any anyOf/null variants) so callers
cannot supply them; ensure they are not listed in required for
DeepStartApplicationIn. If those fields must be present in API docs for
responses, keep them on the corresponding output schema (e.g.,
DeepStartApplicationOut) or mark them readOnly in the shared schema instead.
Also apply the same removal/fix to the second occurrence referenced around lines
4878-4884.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ad76b732-7830-4cf6-a8fe-cc48bc563578
⛔ Files ignored due to path filters (108)
src/libs/DeepInfra/Generated/DeepInfra..JsonSerializerContext.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.AddFunds.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.BillingPortal.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.DeepstartApply.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.GetChecklist.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.GetConfig.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.SetConfig.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.SetupTopup.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.Usage.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.UsageApiToken.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.UsageRent.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.UsageTokens.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.AddFunds.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.BillingPortal.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.DeepstartApply.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.GetChecklist.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.GetConfig.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.SetConfig.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.SetupTopup.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.Usage.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.UsageApiToken.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.UsageRent.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.UsageTokens.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.AddFundsIn.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.AddFundsIn.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.AddFundsPaymentFundsPostResponse.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.AddFundsPaymentFundsPostResponse.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.AddFundsPaymentFundsPostSession.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.AddFundsPaymentFundsPostSession.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.BillingPortalOut.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.BillingPortalOut.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.BillingPortalPaymentBillingPortalGetReturnUrl.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.BillingPortalPaymentBillingPortalGetReturnUrl.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.BillingPortalPaymentBillingPortalGetSession.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.BillingPortalPaymentBillingPortalGetSession.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.ConfigIn.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.ConfigIn.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.ConfigInLimit.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.ConfigInLimit.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.ConfigOut.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.ConfigOut.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepStartApplicationIn.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepStartApplicationIn.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepStartApplicationInDeal.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepStartApplicationInDeal.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepStartApplicationInUid.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepStartApplicationInUid.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepStartApplicationOut.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepStartApplicationOut.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepStartApplicationOutDeal.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepStartApplicationOutDeal.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepStartApplicationOutEmail.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepStartApplicationOutEmail.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepStartApplicationOutUid.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepStartApplicationOutUid.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepstartApplyPaymentDeepstartApplicationPostSession.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DeepstartApplyPaymentDeepstartApplicationPostSession.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DiscountMeta.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DiscountMeta.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DiscountMetaDescription.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.DiscountMetaDescription.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.GetChecklistPaymentChecklistGetSession.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.GetChecklistPaymentChecklistGetSession.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.GetConfigPaymentConfigGetSession.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.GetConfigPaymentConfigGetSession.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.ModelMeta.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.ModelMeta.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.ModelMetaPlanId.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.ModelMetaPlanId.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.SetConfigPaymentConfigPostSession.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.SetConfigPaymentConfigPostSession.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.SetupTopupPaymentTopupPostResponse.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.SetupTopupPaymentTopupPostResponse.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.SetupTopupPaymentTopupPostSession.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.SetupTopupPaymentTopupPostSession.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.TimeInterval.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.TimeInterval.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.TopUpIn.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.TopUpIn.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageApiTokenPaymentUsageApiTokenGetSession.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageApiTokenPaymentUsageApiTokenGetSession.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageApiTokenPaymentUsageApiTokenGetTo.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageApiTokenPaymentUsageApiTokenGetTo.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageItem.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageItem.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageItemDiscount.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageItemDiscount.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageMonth.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageMonth.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageOut.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageOut.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsagePaymentUsageGetSession.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsagePaymentUsageGetSession.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsagePaymentUsageGetTo.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsagePaymentUsageGetTo.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageRentOut.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageRentOut.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageRentOutIdToDuration.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageRentOutIdToDuration.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageRentPaymentUsageRentGetSession.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageRentPaymentUsageRentGetSession.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageRentPaymentUsageRentGetTo.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageRentPaymentUsageRentGetTo.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageTokensPaymentUsageTokensGetSession.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageTokensPaymentUsageTokensGetSession.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageTokensPaymentUsageTokensGetTo.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.UsageTokensPaymentUsageTokensGetTo.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/DeepInfra/openapi.yaml
| - name: session | ||
| in: cookie | ||
| schema: { } |
There was a problem hiding this comment.
Type the session cookie as a string.
All of these parameters use schema: {}. That leaves the contract untyped, so many generators surface session as object/any instead of a normal cookie string. Please emit type: string for this parameter on every /payment/* operation.
Also applies to: 4411-4413, 4433-4435, 4469-4471, 4509-4511, 4549-4551, 4589-4591, 4635-4637, 4658-4660, 4687-4689, 4715-4717
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/libs/DeepInfra/openapi.yaml` around lines 4388 - 4390, The OpenAPI spec
currently leaves the cookie parameter "session" untyped (schema: {}), causing
generators to treat it as object/any; update every /payment/* operation where
the parameter name is session to specify its schema as a string (replace schema:
{} with schema: { type: string } or add type: string under schema) so the cookie
is emitted as a string in generated clients; ensure you update all occurrences
referenced (the session parameter blocks around the listed line groups) rather
than adding new parameters.
| amount: | ||
| title: Amount | ||
| type: integer | ||
| description: Amount to add in cents |
There was a problem hiding this comment.
Constrain the new monetary inputs at the schema layer.
AddFundsIn.amount and TopUpIn.amount / threshold currently allow negative values. For payment flows, that should be rejected by the contract itself instead of being left to backend validation. Use > 0 for add-funds and non-negative bounds for top-up values.
Also applies to: 5018-5027
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/libs/DeepInfra/openapi.yaml` around lines 4746 - 4749, Update the OpenAPI
schema to forbid negative monetary values: set AddFundsIn.amount to require a
positive integer by adding minimum: 1 (so amount > 0), and set TopUpIn.amount
and TopUpIn.threshold to require non-negative integers by adding minimum: 0;
locate and update the schema objects named AddFundsIn, TopUpIn and their
amount/threshold properties in openapi.yaml (also apply the same minimum
constraints to the duplicate definitions mentioned around lines 5018-5027).
| id: | ||
| title: Id | ||
| type: string | ||
| uid: | ||
| title: Uid | ||
| anyOf: | ||
| - type: string | ||
| - type: 'null' |
There was a problem hiding this comment.
Keep server-assigned fields out of DeepStartApplicationIn.
id, uid, created_at, and status look server-owned, but the create request model lets callers send them. Even if the backend ignores these today, the public contract is misleading and makes caller-controlled state possible if validation ever weakens.
Also applies to: 4878-4884
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/libs/DeepInfra/openapi.yaml` around lines 4855 - 4862, Remove
server-assigned properties from the create input model: edit the
DeepStartApplicationIn schema to eliminate the id, uid, created_at, and status
properties (and any anyOf/null variants) so callers cannot supply them; ensure
they are not listed in required for DeepStartApplicationIn. If those fields must
be present in API docs for responses, keep them on the corresponding output
schema (e.g., DeepStartApplicationOut) or mark them readOnly in the shared
schema instead. Also apply the same removal/fix to the second occurrence
referenced around lines 4878-4884.
| fr: | ||
| title: Fr | ||
| type: integer | ||
| default: 0 |
There was a problem hiding this comment.
TimeInterval.fr needs format: int64.
This schema is documented in milliseconds, so real start values are already around 1.7e12. Leaving fr as a plain integer will overflow 32-bit client types, while to is already correctly marked int64.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/libs/DeepInfra/openapi.yaml` around lines 5004 - 5007, The TimeInterval
schema's fr property is declared as a plain integer which can overflow 32-bit
clients; update the fr property (schema name TimeInterval / property fr) to
include format: int64 (matching the existing to property) so the OpenAPI spec
documents it as a 64-bit integer in milliseconds.
Summary by CodeRabbit