From b6149f8572ed706641ceaf1e620bf7ecb6c07c0c Mon Sep 17 00:00:00 2001 From: Kirill Mokevnin Date: Fri, 26 Jun 2026 12:05:19 +0300 Subject: [PATCH] fix: allow null for SubscriptionModel.MaxPeriods in responses The CloudPayments subscription API returns "MaxPeriods": null for subscriptions created without a payment limit (unlimited recurring payments). The response model typed MaxPeriods as a non-nullable int32, so generated SDKs mistype a value the API actually returns as null. Mark MaxPeriods nullable on the response model only. The request models (SubscriptionCreateRequest / SubscriptionUpdateRequest) are intentionally left non-nullable: per the API docs maxPeriods is optional and "no limit" is expressed by omitting the field, not by sending null. Co-Authored-By: Claude Opus 4.8 (1M context) --- models/subscription.tsp | 2 +- tsp-output/schema/openapi.1.0.0.yaml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/models/subscription.tsp b/models/subscription.tsp index 42c0b7f..806263b 100644 --- a/models/subscription.tsp +++ b/models/subscription.tsp @@ -49,7 +49,7 @@ model SubscriptionModel { Period: int32; /** Максимальное количество платежей */ - MaxPeriods?: int32; + MaxPeriods?: int32 | null; /** Язык */ CultureName: string; diff --git a/tsp-output/schema/openapi.1.0.0.yaml b/tsp-output/schema/openapi.1.0.0.yaml index 0dd4bd0..9c7eb6b 100644 --- a/tsp-output/schema/openapi.1.0.0.yaml +++ b/tsp-output/schema/openapi.1.0.0.yaml @@ -1071,8 +1071,10 @@ components: format: int32 description: Период MaxPeriods: - type: integer - format: int32 + anyOf: + - type: integer + format: int32 + - type: 'null' description: Максимальное количество платежей CultureName: type: string