From 9bf3df1e87ab4c2dc0950afba15e6a8610f1eeb3 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Thu, 21 Apr 2022 12:12:30 +0900 Subject: [PATCH] Fix Swagger, replacing additionalProperties by allOf --- .../v1/swagger.template.payment-requests.json | 52 +++++++------- ...agger.template.stores-payment-methods.json | 6 +- ...res-payment-methods.lightning-network.json | 58 ++++++++------- ...template.stores-payment-methods.lnurl.json | 28 ++++---- ...plate.stores-payment-methods.on-chain.json | 72 +++++++++++-------- ...agger.template.stores-wallet.on-chain.json | 8 +-- 6 files changed, 126 insertions(+), 98 deletions(-) diff --git a/BTCPayServer/wwwroot/swagger/v1/swagger.template.payment-requests.json b/BTCPayServer/wwwroot/swagger/v1/swagger.template.payment-requests.json index 606abd8ae..79b0708fd 100644 --- a/BTCPayServer/wwwroot/swagger/v1/swagger.template.payment-requests.json +++ b/BTCPayServer/wwwroot/swagger/v1/swagger.template.payment-requests.json @@ -279,32 +279,36 @@ } }, "PaymentRequestData": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/PaymentRequestBaseData" - }, - "properties": { - "id": { - "type": "string", - "description": "The id of the payment request", - "nullable": false + "allOf": [ + { + "$ref": "#/components/schemas/PaymentRequestBaseData" }, - "storeId": { - "type": "string", - "description": "The store identifier that the payment request belongs to" - }, - "status": { - "type": "string", - "enum": [ "Pending", "Completed" ,"Expired"], - "description": "The status of the payment request", - "nullable": false - }, - "createdTime": { - "description": "The creation date of the payment request", - "allOf": [ {"$ref": "#/components/schemas/UnixTimestamp"}], - "nullable": false + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The id of the payment request", + "nullable": false + }, + "storeId": { + "type": "string", + "description": "The store identifier that the payment request belongs to" + }, + "status": { + "type": "string", + "enum": [ "Pending", "Completed", "Expired" ], + "description": "The status of the payment request", + "nullable": false + }, + "createdTime": { + "description": "The creation date of the payment request", + "allOf": [ { "$ref": "#/components/schemas/UnixTimestamp" } ], + "nullable": false + } + } } - } + ] }, "PaymentRequestBaseData":{ "type": "object", diff --git a/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.json b/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.json index 1f08f8677..734d77b73 100644 --- a/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.json +++ b/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.json @@ -30,12 +30,12 @@ ], "responses": { "200": { - "description": "list of payment methods", + "description": "List of payment methods", "content": { "application/json": { "schema": { - "type": "object", - "additionalProperties": { + "type": "array", + "items": { "$ref": "#/components/schemas/GenericPaymentMethodData" } } diff --git a/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.lightning-network.json b/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.lightning-network.json index ea4136cd3..17e376039 100644 --- a/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.lightning-network.json +++ b/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.lightning-network.json @@ -267,36 +267,44 @@ } }, "LightningNetworkPaymentMethodData": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/LightningNetworkPaymentMethodBaseData" - }, - "properties": { - "enabled": { - "type": "boolean", - "description": "Whether the payment method is enabled" + "allOf": [ + { + "$ref": "#/components/schemas/LightningNetworkPaymentMethodBaseData" }, - "cryptoCode": { - "type": "string", - "description": "Crypto code of the payment method" - }, - "paymentMethod": { - "type": "string", - "description": "The payment method" + { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether the payment method is enabled" + }, + "cryptoCode": { + "type": "string", + "description": "Crypto code of the payment method" + }, + "paymentMethod": { + "type": "string", + "description": "The payment method" + } + } } - } + ] }, "UpdateLightningNetworkPaymentMethodRequest": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/LightningNetworkPaymentMethodBaseData" - }, - "properties": { - "enabled": { - "type": "boolean", - "description": "Whether the payment method is enabled" + "allOf": [ + { + "$ref": "#/components/schemas/LightningNetworkPaymentMethodBaseData" + }, + { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether the payment method is enabled" + } + } } - } + ] } } }, diff --git a/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.lnurl.json b/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.lnurl.json index 944d3dc74..b808b2f71 100644 --- a/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.lnurl.json +++ b/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.lnurl.json @@ -269,20 +269,24 @@ } }, "LNURLPayPaymentMethodData": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/LNURLPayPaymentMethodBaseData" - }, - "properties": { - "enabled": { - "type": "boolean", - "description": "Whether the payment method is enabled. Note that this can only enabled when a Lightning Network payment method is available and enabled" + "allOf": [ + { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether the payment method is enabled. Note that this can only enabled when a Lightning Network payment method is available and enabled" + }, + "cryptoCode": { + "type": "string", + "description": "Crypto code of the payment method" + } + } }, - "cryptoCode": { - "type": "string", - "description": "Crypto code of the payment method" + { + "$ref": "#/components/schemas/LNURLPayPaymentMethodBaseData" } - } + ] } } }, diff --git a/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.on-chain.json b/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.on-chain.json index 3ca3cf808..bd3892f94 100644 --- a/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.on-chain.json +++ b/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-payment-methods.on-chain.json @@ -534,44 +534,56 @@ } }, "UpdateOnChainPaymentMethodRequest": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/OnChainPaymentMethodBaseData" - }, - "properties": { - "enabled": { - "type": "boolean", - "description": "Whether the payment method is enabled" + "allOf": [ + { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether the payment method is enabled" + } + } + }, + { + "$ref": "#/components/schemas/OnChainPaymentMethodBaseData" } - } + ] }, "OnChainPaymentMethodData": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/OnChainPaymentMethodDataPreview" - }, - "properties": { - "enabled": { - "type": "boolean", - "description": "Whether the payment method is enabled" + "allOf": [ + { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether the payment method is enabled" + }, + "paymentMethod": { + "type": "string", + "description": "The payment method" + } + } }, - "paymentMethod": { - "type": "string", - "description": "The payment method" + { + "$ref": "#/components/schemas/OnChainPaymentMethodDataPreview" } - } + ] }, "OnChainPaymentMethodDataPreview": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/OnChainPaymentMethodBaseData" - }, - "properties": { - "cryptoCode": { - "type": "string", - "description": "Crypto code of the payment method" + "allOf": [ + { + "$ref": "#/components/schemas/OnChainPaymentMethodBaseData" + }, + { + "type": "object", + "properties": { + "cryptoCode": { + "type": "string", + "description": "Crypto code of the payment method" + } + } } - } + ] }, "OnChainPaymentMethodPreviewResultData": { "type": "object", diff --git a/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-wallet.on-chain.json b/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-wallet.on-chain.json index 16ff32124..e74684b8c 100644 --- a/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-wallet.on-chain.json +++ b/BTCPayServer/wwwroot/swagger/v1/swagger.template.stores-wallet.on-chain.json @@ -755,8 +755,8 @@ }, "labels": { "description": "Labels linked to this transaction", - "type": "object", - "additionalProperties": { + "type": "array", + "items": { "$ref": "#/components/schemas/LabelData" } } @@ -803,8 +803,8 @@ }, "labels": { "description": "Labels linked to this transaction", - "type": "object", - "additionalProperties": { + "type": "array", + "items": { "$ref": "#/components/schemas/LabelData" } }