Ensure Swagger docs are semantically and structurally correct (#3390)

* Remove "delete" method from "/api/v1/stores/{storeId}/invoices/{invoiceId}/payment-methods" docs

* Remove "requestBody" from "delete" method of "/api/v1/stores/{storeId}/webhooks/{webhookId}"

* Rename "API Key" to "API_Key"

* Remove "scheme" from API_Key security scheme

* Remove "name" and "in" properties from "Basic"security scheme
This commit is contained in:
Umar Bolatov
2022-02-02 03:12:48 -08:00
committed by GitHub
parent c07fcc171c
commit aab1eb0d36
18 changed files with 89 additions and 160 deletions

View File

@@ -193,7 +193,7 @@ namespace BTCPayServer.Tests
JObject json = JObject.Parse(sresp);
Assert.Equal(description, json["components"]["securitySchemes"]["API Key"]["description"].Value<string>());
Assert.Equal(description, json["components"]["securitySchemes"]["API_Key"]["description"].Value<string>());
}
private async Task CheckDeadLinks(Regex regex, HttpClient httpClient, string file)

View File

@@ -26,7 +26,7 @@
},
"security": [
{
"API Key": [ "unrestricted" ],
"API_Key": [ "unrestricted" ],
"Basic": []
}
]
@@ -53,7 +53,7 @@
},
"security": [
{
"API Key": []
"API_Key": []
}
]
},
@@ -77,7 +77,7 @@
},
"security": [
{
"API Key": []
"API_Key": []
}
]
}
@@ -129,7 +129,7 @@
},
"security": [
{
"API Key": [ "unrestricted" ],
"API_Key": [ "unrestricted" ],
"Basic": []
}
]

View File

@@ -96,7 +96,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canviewinvoices"
],
"Basic": []
@@ -158,7 +158,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.cancreateinvoice"
],
"Basic": []
@@ -214,7 +214,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canviewinvoices"
],
"Basic": []
@@ -271,7 +271,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifyinvoices"
],
"Basic": []
@@ -345,7 +345,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifyinvoices"
],
"Basic": []
@@ -415,69 +415,12 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canviewinvoices"
],
"Basic": []
}
]
},
"delete": {
"tags": [
"Invoices"
],
"summary": "Archive invoice",
"description": "Archives the specified invoice.",
"operationId": "Invoices_ArchiveInvoice",
"parameters": [
{
"name": "storeId",
"in": "path",
"required": true,
"description": "The store the invoice belongs to",
"schema": {
"type": "string"
}
},
{
"name": "invoiceId",
"in": "path",
"required": true,
"description": "The invoice to remove",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "The invoice has been archived"
},
"400": {
"description": "A list of errors that occurred when archiving the invoice",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ValidationProblemDetails"
}
}
}
},
"403": {
"description": "If you are authenticated but forbidden to archive the specified invoice"
},
"404": {
"description": "The key is not found for this invoice"
}
},
"security": [
{
"API Key": [
"btcpay.store.canmodifyinvoices"
],
"Basic": []
}
]
}
},
"/api/v1/stores/{storeId}/invoices/{invoiceId}/status": {
@@ -545,7 +488,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifyinvoices"
],
"Basic": []
@@ -608,7 +551,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifyinvoices"
],
"Basic": []
@@ -673,7 +616,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canviewinvoices"
],
"Basic": []

View File

@@ -74,25 +74,22 @@
}
},
"securitySchemes": {
"API Key": {
"API_Key": {
"type": "apiKey",
"description": "BTCPay Server supports authenticating and authorizing users through an API Key that is generated by them. Send the API Key as a header value to Authorization with the format: `token {token}`. For a smoother experience, you can generate a url that redirects users to an API key creation screen.\n\n The following permissions are available to the context of the user creating the API Key:\n\n* `unrestricted`: Unrestricted access\n* `btcpay.user.candeleteuser`: Delete user\n* `btcpay.user.canviewprofile`: View your profile\n* `btcpay.user.canmodifyprofile`: Manage your profile\n* `btcpay.user.canmanagenotificationsforuser`: Manage your notifications\n* `btcpay.user.canviewnotificationsforuser`: View your notifications\n\nThe following permissions are available if the user is an administrator:\n\n* `btcpay.server.cancreateuser`: Create new users\n* `btcpay.server.canmodifyserversettings`: Manage your server\n* `btcpay.server.canuseinternallightningnode`: Use the internal lightning node\n* `btcpay.server.cancreatelightninginvoiceinternalnode`: Create invoices with internal lightning node\n\nThe following permissions applies to all stores of the user, you can limit to a specific store with the following format: `btcpay.store.cancreateinvoice:6HSHAEU4iYWtjxtyRs9KyPjM9GAQp8kw2T9VWbGG1FnZ`:\n\n* `btcpay.store.canmodifystoresettings`: Modify your stores\n* `btcpay.store.webhooks.canmodifywebhooks`: Modify stores webhooks\n* `btcpay.store.canviewstoresettings`: View your stores\n* `btcpay.store.cancreateinvoice`: Create an invoice\n* `btcpay.store.canviewinvoices`: View invoices\n* `btcpay.store.canmodifyinvoices`: Modify invoices\n* `btcpay.store.canmodifypaymentrequests`: Modify your payment requests\n* `btcpay.store.canviewpaymentrequests`: View your payment requests\n* `btcpay.store.canuselightningnode`: Use the lightning nodes associated with your stores\n* `btcpay.store.cancreatelightninginvoice`: Create invoices the lightning nodes associated with your stores\n\nNote that API Keys only limits permission of a user and can never expand it. If an API Key has the permission `btcpay.server.canmodifyserversettings` but that the user account creating this API Key is not administrator, the API Key will not be able to modify the server settings.\nSome permissions may include other permissions, see [this operation](#operation/permissionsMetadata).\n",
"name": "Authorization",
"in": "header",
"scheme": "token"
"in": "header"
},
"Basic": {
"type": "http",
"description": "BTCPay Server supports authenticating and authorizing users through the Basic HTTP authentication scheme. Send the user and password encoded in base64 with the format `Basic {base64(username:password)}`. Using this authentication method implicitly provides you with the `unrestricted` permission",
"name": "Authorization",
"in": "header",
"scheme": "Basic"
}
}
},
"security": [
{
"API Key": [],
"API_Key": [],
"Basic": []
}
],

View File

@@ -40,7 +40,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.server.canuseinternallightningnode"
],
"Basic": []
@@ -111,7 +111,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.server.canuseinternallightningnode"
],
"Basic": []
@@ -159,7 +159,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.server.canuseinternallightningnode"
],
"Basic": []
@@ -225,7 +225,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.server.canuseinternallightningnode"
],
"Basic": []
@@ -274,7 +274,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.server.canuseinternallightningnode"
],
"Basic": []
@@ -331,7 +331,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.server.canuseinternallightningnode"
],
"Basic": []
@@ -402,7 +402,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.server.canuseinternallightningnode"
],
"Basic": []
@@ -470,7 +470,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.server.cancreatelightninginvoiceinternalnode"
],
"Basic": []

View File

@@ -49,7 +49,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.cancreatelightninginvoice"
],
"Basic": []
@@ -129,7 +129,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.cancreatelightninginvoice"
],
"Basic": []
@@ -186,7 +186,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.cancreatelightninginvoice"
],
"Basic": []
@@ -264,7 +264,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.cancreatelightninginvoice"
],
"Basic": []
@@ -322,7 +322,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.cancreatelightninginvoice"
],
"Basic": []
@@ -389,7 +389,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.cancreatelightninginvoice"
],
"Basic": []
@@ -469,7 +469,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.cancreatelightninginvoice"
],
"Basic": []
@@ -546,7 +546,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.server.cancreatelightninginvoiceinternalnode"
],
"Basic": []

View File

@@ -54,7 +54,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.user.canmanagenotificationsforuser",
"btcpay.user.canviewnotificationsforuser"
],
@@ -102,7 +102,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.user.canmanagenotificationsforuser",
"btcpay.user.canviewnotificationsforuser"
],
@@ -148,7 +148,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.user.canmanagenotificationsforuser"
],
"Basic": []
@@ -196,7 +196,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.user.canmanagenotificationsforuser"
],
"Basic": []

View File

@@ -31,7 +31,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canviewpaymentrequests"
],
"Basic": []
@@ -91,7 +91,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifypaymentrequests"
],
"Basic": []
@@ -143,7 +143,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canviewpaymentrequests"
],
"Basic": []
@@ -196,7 +196,7 @@
},
"security": [
{
"API Key": [ "btcpay.store.canmodifypaymentrequests"],
"API_Key": [ "btcpay.store.canmodifypaymentrequests"],
"Basic": []
}
]
@@ -261,7 +261,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifypaymentrequests"
],
"Basic": []

View File

@@ -41,7 +41,7 @@
"tags": [ "Pull payments (Management)" ],
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmanagepullpayments"
],
"Basic": []
@@ -140,7 +140,7 @@
"tags": [ "Pull payments (Management)" ],
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmanagepullpayments"
],
"Basic": []
@@ -213,7 +213,7 @@
"tags": [ "Pull payments (Management)" ],
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmanagepullpayments"
],
"Basic": []
@@ -441,7 +441,7 @@
"tags": [ "Pull payments (Management)" ],
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmanagepullpayments"
],
"Basic": []
@@ -463,7 +463,7 @@
"tags": [ "Pull payments (Management)" ],
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmanagepullpayments"
],
"Basic": []
@@ -524,7 +524,7 @@
"tags": [ "Pull payments (Management)" ],
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmanagepullpayments"
],
"Basic": []

View File

@@ -22,7 +22,7 @@
},
"security": [
{
"API Key": [],
"API_Key": [],
"Basic": []
}
]

View File

@@ -45,7 +45,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canviewstoresettings"
],
"Basic": []

View File

@@ -42,7 +42,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -99,7 +99,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -176,7 +176,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -233,7 +233,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []

View File

@@ -42,7 +42,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -99,7 +99,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -176,7 +176,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -233,7 +233,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []

View File

@@ -42,7 +42,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canviewstoresettings"
],
"Basic": []
@@ -99,7 +99,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canviewstoresettings"
],
"Basic": []
@@ -176,7 +176,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -233,7 +233,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -308,7 +308,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canviewstoresettings"
],
"Basic": []
@@ -400,7 +400,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canviewstoresettings"
],
"Basic": []

View File

@@ -49,7 +49,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -116,7 +116,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canviewstoresettings"
],
"Basic": []
@@ -183,7 +183,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -231,7 +231,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -324,7 +324,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -397,7 +397,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -463,7 +463,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -523,7 +523,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []

View File

@@ -22,7 +22,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canviewstoresettings"
],
"Basic": []
@@ -74,7 +74,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -121,7 +121,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canviewstoresettings"
],
"Basic": []
@@ -188,7 +188,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []
@@ -235,7 +235,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.canmodifystoresettings"
],
"Basic": []

View File

@@ -22,7 +22,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.user.canviewprofile"
],
"Basic": []
@@ -43,7 +43,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.user.candeleteuser"
],
"Basic": []
@@ -121,7 +121,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.server.cancreateuser"
],
"Basic": []

View File

@@ -33,7 +33,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.webhooks.canmodifywebhooks"
],
"Basic": []
@@ -82,7 +82,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.webhooks.canmodifywebhooks"
],
"Basic": []
@@ -135,7 +135,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.webhooks.canmodifywebhooks"
],
"Basic": []
@@ -183,7 +183,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.webhooks.canmodifywebhooks"
],
"Basic": []
@@ -196,17 +196,6 @@
],
"summary": "Delete a webhook",
"description": "Delete a webhook",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/WebhookDataBase"
}
}
},
"required": true,
"x-position": 1
},
"responses": {
"200": {
"description": "The webhook has been deleted"
@@ -217,7 +206,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.webhooks.canmodifywebhooks"
],
"Basic": []
@@ -277,7 +266,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.webhooks.canmodifywebhooks"
],
"Basic": []
@@ -338,7 +327,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.webhooks.canmodifywebhooks"
],
"Basic": []
@@ -400,7 +389,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.webhooks.canmodifywebhooks"
],
"Basic": []
@@ -461,7 +450,7 @@
},
"security": [
{
"API Key": [
"API_Key": [
"btcpay.store.webhooks.canmodifywebhooks"
],
"Basic": []