Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
docs(api-reference): mark deprecated fields in OpenAPI schema and reference (#12534)
Ayush Anand35f6a9c1245a
diff --git a/api-reference/docs.json b/api-reference/docs.jsonindex 408aeb57e2..31bc32493f 100644--- a/api-reference/docs.json+++ b/api-reference/docs.json@@ -96,14 +96,6 @@"v2/payment-method-session/payment-method-session--delete-a-saved-payment-method-v1"]},- {- "group": "Mandates",- "pages": [- "v1/mandates/mandates--revoke-mandate",- "v1/mandates/mandates--retrieve-mandate",- "v1/mandates/mandates--customer-mandates-list"- ]- },{"group": "Refunds","pages": [@@ -147,6 +139,14 @@{"group": "Deprecated APIs","pages": [+ {+ "group": "Mandates",+ "pages": [+ "v1/mandates/mandates--revoke-mandate",+ "v1/mandates/mandates--retrieve-mandate",+ "v1/mandates/mandates--customer-mandates-list"+ ]+ },{"group": "Customers","pages": [diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex 786557da15..d7267ebbcf 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -21473,6 +21473,7 @@"$ref": "#/components/schemas/FrmPaymentMethodType"},"description": "payment method types(credit, debit) that can be used in the payment. This field is deprecated. It has not been removed to provide backward compatibility.",+ "deprecated": true,"nullable": true},"flow": {@@ -24573,11 +24574,13 @@"business_label": {"type": "string","description": "The business label to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead",+ "deprecated": true,"nullable": true},"business_sub_label": {"type": "string","description": "The business sublabel to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead",+ "deprecated": true,"example": "chase","nullable": true},@@ -24805,12 +24808,14 @@"business_label": {"type": "string","description": "The business label to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead",+ "deprecated": true,"example": "travel","nullable": true},"business_sub_label": {"type": "string","description": "The business sublabel to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead",+ "deprecated": true,"example": "chase","nullable": true},@@ -24964,12 +24969,14 @@"business_label": {"type": "string","description": "The business label to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead",+ "deprecated": true,"example": "travel","nullable": true},"business_sub_label": {"type": "string","description": "The business sublabel to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead",+ "deprecated": true,"example": "chase","nullable": true},@@ -30568,6 +30575,7 @@"mandate_id": {"type": "string","description": "A unique identifier to link the payment to a mandate. To do Recurring payments after a mandate has been created, pass the mandate_id instead of payment_method_data",+ "deprecated": true,"example": "mandate_iwer89rnjef349dni3","nullable": true,"maxLength": 64@@ -31092,6 +31100,7 @@"mandate_id": {"type": "string","description": "A unique identifier to link the payment to a mandate. To do Recurring payments after a mandate has been created, pass the mandate_id instead of payment_method_data",+ "deprecated": true,"example": "mandate_iwer89rnjef349dni3","nullable": true,"maxLength": 64@@ -31131,6 +31140,7 @@"business_label": {"type": "string","description": "Business label of the merchant for this payment.\nTo be deprecated soon. Pass the profile_id instead",+ "deprecated": true,"example": "food","nullable": true},@@ -31609,6 +31619,7 @@"mandate_id": {"type": "string","description": "A unique identifier to link the payment to a mandate, can be used instead of payment_method_data, in case of setting up recurring payments",+ "deprecated": true,"example": "mandate_iwer89rnjef349dni3","nullable": true,"maxLength": 255@@ -32743,6 +32754,7 @@"mandate_id": {"type": "string","description": "A unique identifier to link the payment to a mandate. To do Recurring payments after a mandate has been created, pass the mandate_id instead of payment_method_data",+ "deprecated": true,"example": "mandate_iwer89rnjef349dni3","nullable": true,"maxLength": 64@@ -32782,6 +32794,7 @@"business_label": {"type": "string","description": "Business label of the merchant for this payment.\nTo be deprecated soon. Pass the profile_id instead",+ "deprecated": true,"example": "food","nullable": true},@@ -33290,6 +33303,7 @@"mandate_id": {"type": "string","description": "A unique identifier to link the payment to a mandate, can be used instead of payment_method_data, in case of setting up recurring payments",+ "deprecated": true,"example": "mandate_iwer89rnjef349dni3","nullable": true,"maxLength": 255diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex 528fe56d17..4100e62582 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -15139,6 +15139,7 @@"$ref": "#/components/schemas/FrmPaymentMethodType"},"description": "payment method types(credit, debit) that can be used in the payment. This field is deprecated. It has not been removed to provide backward compatibility.",+ "deprecated": true,"nullable": true},"flow": {diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rsindex c108295a42..e1bdd8a631 100644--- a/crates/api_models/src/admin.rs+++ b/crates/api_models/src/admin.rs@@ -1091,14 +1091,15 @@ pub struct MerchantConnectorCreate {pub frm_configs: Option<Vec<FrmConfigs>>,/// The business country to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead- #[schema(value_type = Option<CountryAlpha2>, example = "US")]+ #[schema(value_type = Option<CountryAlpha2>, example = "US", deprecated)]pub business_country: Option<api_enums::CountryAlpha2>,/// The business label to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead+ #[schema(deprecated)]pub business_label: Option<String>,/// The business sublabel to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead- #[schema(example = "chase")]+ #[schema(example = "chase", deprecated)]pub business_sub_label: Option<String>,/// Unique ID of the connector@@ -1546,15 +1547,15 @@ pub struct MerchantConnectorResponse {pub frm_configs: Option<Vec<FrmConfigs>>,/// The business country to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead- #[schema(value_type = Option<CountryAlpha2>, example = "US")]+ #[schema(value_type = Option<CountryAlpha2>, example = "US", deprecated)]pub business_country: Option<api_enums::CountryAlpha2>,///The business label to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead- #[schema(example = "travel")]+ #[schema(example = "travel", deprecated)]pub business_label: Option<String>,/// The business sublabel to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead- #[schema(example = "chase")]+ #[schema(example = "chase", deprecated)]pub business_sub_label: Option<String>,/// identifier for the verified domains of a particular connector account@@ -1658,15 +1659,15 @@ pub struct MerchantConnectorListResponse {pub frm_configs: Option<Vec<FrmConfigs>>,/// The business country to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead- #[schema(value_type = Option<CountryAlpha2>, example = "US")]+ #[schema(value_type = Option<CountryAlpha2>, example = "US", deprecated)]pub business_country: Option<api_enums::CountryAlpha2>,///The business label to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead- #[schema(example = "travel")]+ #[schema(example = "travel", deprecated)]pub business_label: Option<String>,/// The business sublabel to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead- #[schema(example = "chase")]+ #[schema(example = "chase", deprecated)]pub business_sub_label: Option<String>,/// identifier for the verified domains of a particular connector account@@ -1971,6 +1972,7 @@ pub struct FrmPaymentMethod {#[schema(value_type = PaymentMethod,example = "card")]pub payment_method: Option<common_enums::PaymentMethod>,///payment method types(credit, debit) that can be used in the payment. This field is deprecated. It has not been removed to provide backward compatibility.+ #[schema(deprecated)]pub payment_method_types: Option<Vec<FrmPaymentMethodType>>,///frm flow type to be used, can be pre/post#[schema(value_type = Option<FrmPreferredFlowTypes>)]diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex 09047466c2..ad82f87d7d 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -1327,6 +1327,7 @@ pub struct PaymentsRequest {pub client_secret: Option<String>,/// Passing this object during payments creates a mandate. The mandate_type sub object is passed by the server.+ #[schema(deprecated)]#[smithy(value_type = "Option<MandateData>")]pub mandate_data: Option<MandateData>,@@ -1336,7 +1337,7 @@ pub struct PaymentsRequest {pub customer_acceptance: Option<common_payments_types::CustomerAcceptance>,/// A unique identifier to link the payment to a mandate. To do Recurring payments after a mandate has been created, pass the mandate_id instead of payment_method_data- #[schema(max_length = 64, example = "mandate_iwer89rnjef349dni3")]+ #[schema(max_length = 64, example = "mandate_iwer89rnjef349dni3", deprecated)]#[remove_in(PaymentsUpdateRequest)]#[smithy(value_type = "Option<String>")]pub mandate_id: Option<String>,@@ -1368,14 +1369,14 @@ pub struct PaymentsRequest {/// Business country of the merchant for this payment./// To be deprecated soon. Pass the profile_id instead- #[schema(value_type = Option<CountryAlpha2>, example = "US")]+ #[schema(value_type = Option<CountryAlpha2>, example = "US", deprecated)]#[remove_in(PaymentsUpdateRequest, PaymentsConfirmRequest)]#[smithy(value_type = "Option<CountryAlpha2>")]pub business_country: Option<api_enums::CountryAlpha2>,/// Business label of the merchant for this payment./// To be deprecated soon. Pass the profile_id instead- #[schema(example = "food")]+ #[schema(example = "food", deprecated)]#[remove_in(PaymentsUpdateRequest, PaymentsConfirmRequest)]#[smithy(value_type = "Option<String>")]pub business_label: Option<String>,@@ -7217,11 +7218,12 @@ pub struct PaymentsResponse {pub captures: Option<Vec<CaptureResponse>>,/// A unique identifier to link the payment to a mandate, can be used instead of payment_method_data, in case of setting up recurring payments- #[schema(max_length = 255, example = "mandate_iwer89rnjef349dni3")]+ #[schema(max_length = 255, example = "mandate_iwer89rnjef349dni3", deprecated)]#[smithy(value_type = "Option<String>")]pub mandate_id: Option<String>,/// Provided mandate information for creating a mandate+ #[schema(deprecated)]#[smithy(value_type = "Option<MandateData>")]pub mandate_data: Option<MandateData>,diff --git a/crates/router_derive/src/macros/schema/helpers.rs b/crates/router_derive/src/macros/schema/helpers.rsindex 54954e24d6..b909511604 100644--- a/crates/router_derive/src/macros/schema/helpers.rs+++ b/crates/router_derive/src/macros/schema/helpers.rs@@ -12,6 +12,7 @@ mod keyword {custom_keyword!(min_length);custom_keyword!(max_length);custom_keyword!(example);+ custom_keyword!(deprecated);}pub enum SchemaParameterVariant {@@ -31,6 +32,9 @@ pub enum SchemaParameterVariant {keyword: keyword::example,value: LitStr,},+ Deprecated {+ keyword: keyword::deprecated,+ },}impl Parse for SchemaParameterVariant {@@ -56,6 +60,9 @@ impl Parse for SchemaParameterVariant {input.parse::<Token![=]>()?;let value = input.parse()?;Ok(Self::Example { keyword, value })+ } else if lookahead.peek(keyword::deprecated) {+ let keyword = input.parse()?;+ Ok(Self::Deprecated { keyword })} else {Err(lookahead.error())}@@ -69,6 +76,7 @@ impl ToTokens for SchemaParameterVariant {Self::MinLength { keyword, .. } => keyword.to_tokens(tokens),Self::MaxLength { keyword, .. } => keyword.to_tokens(tokens),Self::Example { keyword, .. } => keyword.to_tokens(tokens),+ Self::Deprecated { keyword } => keyword.to_tokens(tokens),}}}@@ -141,6 +149,7 @@ impl HasSchemaParameters for Field {example_keyword = Some(keyword);output.example = Some(value.value());}+ SchemaParameterVariant::Deprecated { .. } => {}}}