fix(openapi): correct schema references and semantics for v1 openApi spec (#8127)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
AkshayaFoiger
2025-06-20 18:21:27 +05:30
committed by GitHub
parent a721d90c6b
commit 02dee9c581
19 changed files with 305 additions and 483 deletions

View File

@ -467,6 +467,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::PazeWalletData,
api_models::payments::SessionToken,
api_models::payments::ApplePaySessionResponse,
api_models::payments::NullObject,
api_models::payments::ThirdPartySdkSessionResponse,
api_models::payments::NoThirdPartySdkSessionResponse,
api_models::payments::SecretInfoToInitiateSdk,
@ -798,7 +799,9 @@ struct SecurityAddon;
impl utoipa::Modify for SecurityAddon {
fn modify(&self, openapi: &mut utoipa::openapi::OpenApi) {
use utoipa::openapi::security::{ApiKey, ApiKeyValue, SecurityScheme};
use utoipa::openapi::security::{
ApiKey, ApiKeyValue, HttpAuthScheme, HttpBuilder, SecurityScheme,
};
if let Some(components) = openapi.components.as_mut() {
components.add_security_schemes_from_iter([
@ -833,6 +836,10 @@ impl utoipa::Modify for SecurityAddon {
to a single customer object for a short period of time."
))),
),
(
"jwt_key",
SecurityScheme::Http(HttpBuilder::new().scheme(HttpAuthScheme::Bearer).bearer_format("JWT").build())
)
]);
}
}

View File

@ -346,6 +346,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::gsm::GsmDeleteResponse,
api_models::gsm::GsmResponse,
api_models::gsm::GsmDecision,
api_models::payments::NullObject,
api_models::payments::AddressDetails,
api_models::payments::BankDebitData,
api_models::payments::AliPayQr,

View File

@ -95,6 +95,8 @@ pub async fn customers_delete() {}
#[utoipa::path(
get,
path = "/customers/list",
params (("offset" = Option<u32>, Query, description = "Offset for pagination"),
("limit" = Option<u16>, Query, description = "Limit for pagination")),
responses(
(status = 200, description = "Customers retrieved", body = Vec<CustomerResponse>),
(status = 400, description = "Invalid Data"),

View File

@ -64,7 +64,7 @@ pub async fn retrieve_mandates_list() {}
///
/// Lists all the mandates for a particular customer id.
#[utoipa::path(
post,
get,
path = "/customers/{customer_id}/mandates",
params(
("customer_id" = String, Path, description = "The unique identifier for the customer")

View File

@ -4,7 +4,7 @@
#[cfg(feature = "v1")]
#[utoipa::path(
post,
path = "/accounts/{account_id}/connectors",
path = "/account/{account_id}/connectors",
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account")
),
@ -133,10 +133,10 @@ pub async fn connector_create() {}
#[cfg(feature = "v1")]
#[utoipa::path(
get,
path = "/accounts/{account_id}/connectors/{connector_id}",
path = "/account/{account_id}/connectors/{merchant_connector_id}",
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
("connector_id" = i32, Path, description = "The unique identifier for the Merchant Connector")
("merchant_connector_id" = String, Path, description = "The unique identifier for the Merchant Connector")
),
responses(
(status = 200, description = "Merchant Connector retrieved successfully", body = MerchantConnectorResponse),
@ -175,7 +175,7 @@ pub async fn connector_retrieve() {}
/// List Merchant Connector Details for the merchant
#[utoipa::path(
get,
path = "/accounts/{account_id}/connectors",
path = "/account/{account_id}/connectors",
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
),
@ -196,7 +196,7 @@ pub async fn connector_list() {}
#[cfg(feature = "v1")]
#[utoipa::path(
post,
path = "/accounts/{account_id}/connectors/{connector_id}",
path = "/account/{account_id}/connectors/{merchant_connector_id}",
request_body(
content = MerchantConnectorUpdate,
examples(
@ -225,7 +225,7 @@ pub async fn connector_list() {}
),
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
("connector_id" = i32, Path, description = "The unique identifier for the Merchant Connector")
("merchant_connector_id" = String, Path, description = "The unique identifier for the Merchant Connector")
),
responses(
(status = 200, description = "Merchant Connector Updated", body = MerchantConnectorResponse),
@ -291,10 +291,10 @@ pub async fn connector_update() {}
#[cfg(feature = "v1")]
#[utoipa::path(
delete,
path = "/accounts/{account_id}/connectors/{connector_id}",
path = "/account/{account_id}/connectors/{merchant_connector_id}",
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
("connector_id" = i32, Path, description = "The unique identifier for the Merchant Connector")
("merchant_connector_id" = String, Path, description = "The unique identifier for the Merchant Connector")
),
responses(
(status = 200, description = "Merchant Connector Deleted", body = MerchantConnectorDeleteResponse),

View File

@ -5,9 +5,9 @@
get,
path = "/payment_link/{payment_link_id}",
params(
("payment_link_id" = String, Path, description = "The identifier for payment link")
("payment_link_id" = String, Path, description = "The identifier for payment link"),
("client_secret" = Option<String>, Query, description = "This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK"),
),
request_body=RetrievePaymentLinkRequest,
responses(
(status = 200, description = "Gets details regarding payment link", body = RetrievePaymentLinkResponse),
(status = 404, description = "No payment link found")

View File

@ -42,13 +42,14 @@ pub async fn create_payment_method_api() {}
get,
path = "/account/payment_methods",
params (
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
("accepted_country" = Vec<String>, Query, description = "The two-letter ISO currency code"),
("accepted_currency" = Vec<Currency>, Path, description = "The three-letter ISO currency code"),
("minimum_amount" = i64, Query, description = "The minimum amount accepted for processing by the particular payment method."),
("maximum_amount" = i64, Query, description = "The maximum amount accepted for processing by the particular payment method."),
("recurring_payment_enabled" = bool, Query, description = "Indicates whether the payment method is eligible for recurring payments"),
("installment_payment_enabled" = bool, Query, description = "Indicates whether the payment method is eligible for installment payments"),
("client_secret" = Option<String>, Query, description = "This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK"),
("accepted_countries" = Option<Vec<CountryAlpha2>>, Query, description = "The two-letter ISO currency code"),
("accepted_currencies" = Option<Vec<Currency>>, Query, description = "The three-letter ISO currency code"),
("amount" = Option<i64>, Query, description = "The amount accepted for processing by the particular payment method."),
("recurring_enabled" = Option<bool>, Query, description = "Indicates whether the payment method is eligible for recurring payments"),
("installment_payment_enabled" = Option<bool>, Query, description = "Indicates whether the payment method is eligible for installment payments"),
("limit" = Option<i64>, Query, description = "Indicates the limit of last used payment methods"),
("card_networks" = Option<Vec<CardNetwork>>, Query, description = "Indicates whether the payment method is eligible for card netwotks"),
),
responses(
(status = 200, description = "Payment Methods retrieved", body = PaymentMethodListResponse),
@ -69,12 +70,14 @@ pub async fn list_payment_method_api() {}
path = "/customers/{customer_id}/payment_methods",
params (
("customer_id" = String, Path, description = "The unique identifier for the customer account"),
("accepted_country" = Vec<String>, Query, description = "The two-letter ISO currency code"),
("accepted_currency" = Vec<Currency>, Path, description = "The three-letter ISO currency code"),
("minimum_amount" = i64, Query, description = "The minimum amount accepted for processing by the particular payment method."),
("maximum_amount" = i64, Query, description = "The maximum amount accepted for processing by the particular payment method."),
("recurring_payment_enabled" = bool, Query, description = "Indicates whether the payment method is eligible for recurring payments"),
("installment_payment_enabled" = bool, Query, description = "Indicates whether the payment method is eligible for installment payments"),
("client_secret" = Option<String>, Query, description = "This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK"),
("accepted_countries" = Option<Vec<CountryAlpha2>>, Query, description = "The two-letter ISO currency code"),
("accepted_currencies" = Option<Vec<Currency>>, Query, description = "The three-letter ISO currency code"),
("amount" = Option<i64>, Query, description = "The amount accepted for processing by the particular payment method."),
("recurring_enabled" = Option<bool>, Query, description = "Indicates whether the payment method is eligible for recurring payments"),
("installment_payment_enabled" = Option<bool>, Query, description = "Indicates whether the payment method is eligible for installment payments"),
("limit" = Option<i64>, Query, description = "Indicates the limit of last used payment methods"),
("card_networks" = Option<Vec<CardNetwork>>, Query, description = "Indicates whether the payment method is eligible for card netwotks"),
),
responses(
(status = 200, description = "Payment Methods retrieved", body = CustomerPaymentMethodsListResponse),
@ -95,14 +98,14 @@ pub async fn list_customer_payment_method_api() {}
get,
path = "/customers/payment_methods",
params (
("client-secret" = String, Path, description = "A secret known only to your client and the authorization server. Used for client side authentication"),
("customer_id" = String, Path, description = "The unique identifier for the customer account"),
("accepted_country" = Vec<String>, Query, description = "The two-letter ISO currency code"),
("accepted_currency" = Vec<Currency>, Path, description = "The three-letter ISO currency code"),
("minimum_amount" = i64, Query, description = "The minimum amount accepted for processing by the particular payment method."),
("maximum_amount" = i64, Query, description = "The maximum amount accepted for processing by the particular payment method."),
("recurring_payment_enabled" = bool, Query, description = "Indicates whether the payment method is eligible for recurring payments"),
("installment_payment_enabled" = bool, Query, description = "Indicates whether the payment method is eligible for installment payments"),
("client_secret" = Option<String>, Query, description = "This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK"),
("accepted_countries" = Option<Vec<CountryAlpha2>>, Query, description = "The two-letter ISO currency code"),
("accepted_currencies" = Option<Vec<Currency>>, Query, description = "The three-letter ISO currency code"),
("amount" = Option<i64>, Query, description = "The amount accepted for processing by the particular payment method."),
("recurring_enabled" = Option<bool>, Query, description = "Indicates whether the payment method is eligible for recurring payments"),
("installment_payment_enabled" = Option<bool>, Query, description = "Indicates whether the payment method is eligible for installment payments"),
("limit" = Option<i64>, Query, description = "Indicates the limit of last used payment methods"),
("card_networks" = Option<Vec<CardNetwork>>, Query, description = "Indicates whether the payment method is eligible for card netwotks"),
),
responses(
(status = 200, description = "Payment Methods retrieved for customer tied to its respective client-secret passed in the param", body = CustomerPaymentMethodsListResponse),

View File

@ -757,7 +757,7 @@ pub fn payments_external_authentication() {}
/// Payments - Complete Authorize
#[utoipa::path(
post,
path = "/{payment_id}/complete_authorize",
path = "/payments/{payment_id}/complete_authorize",
request_body=PaymentsCompleteAuthorizeRequest,
params(
("payment_id" =String, Path, description = "The identifier for payment")

View File

@ -339,7 +339,7 @@ pub async fn toggle_elimination_routing() {}
/// Create a Contract based dynamic routing algorithm
#[utoipa::path(
post,
path = "/account/:account_id/business_profile/:profile_id/dynamic_routing/contracts/toggle",
path = "/account/{account_id}/business_profile/{profile_id}/dynamic_routing/contracts/toggle",
params(
("account_id" = String, Path, description = "Merchant id"),
("profile_id" = String, Path, description = "Profile id under which Dynamic routing needs to be toggled"),