From d1e42e976762361993baf466dbc5a2c8ab5af7af Mon Sep 17 00:00:00 2001 From: Ruoxuan Wang <52271048+ruowan@users.noreply.github.com> Date: Tue, 23 Nov 2021 11:13:34 +0800 Subject: [PATCH] fix url encoding issue (#706) * fix url encoding issue * new URL add base host * fix URL based * fix unittest * rename function * renmae * update changelog * update test and remove unused readme * fix data-plane regex * update liveValidator --- ChangeLog.md | 1 + lib/liveValidation/liveValidator.ts | 20 +- lib/liveValidation/operationSearcher.ts | 19 +- lib/templates/httpTemplate.ts | 6 +- lib/util/utils.ts | 9 + lib/xMsExampleExtractor.ts | 8 +- .../dataplane/deleteCosmosTable_input.json | 35 + .../2019-02-02/examples/TableCreate.json | 22 + .../2019-02-02/examples/TableDelete.json | 10 + .../examples/TableDeleteEntity.json | 14 + .../preview/2019-02-02/examples/TableGet.json | 23 + .../examples/TableInsertEntity.json | 48 + .../2019-02-02/examples/TableMergeEntity.json | 27 + .../examples/TableQueryEntities.json | 30 + ...ableQueryEntityWithPartitionAndRowKey.json | 27 + .../examples/TableUpdateEntity.json | 27 + .../preview/2019-02-02/table.json | 1913 +++++++++++++++++ .../cosmos-db/data-plane/readme.md | 248 +++ test/liveValidatorDataPlaneTests.ts | 26 + test/liveValidatorTests.ts | 7 + 20 files changed, 2503 insertions(+), 17 deletions(-) create mode 100644 test/liveValidation/payloads/dataplane/deleteCosmosTable_input.json create mode 100644 test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableCreate.json create mode 100644 test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableDelete.json create mode 100644 test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableDeleteEntity.json create mode 100644 test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableGet.json create mode 100644 test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableInsertEntity.json create mode 100644 test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableMergeEntity.json create mode 100644 test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableQueryEntities.json create mode 100644 test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableQueryEntityWithPartitionAndRowKey.json create mode 100644 test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableUpdateEntity.json create mode 100644 test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/table.json create mode 100644 test/liveValidation/swaggers/specification/cosmos-db/data-plane/readme.md create mode 100644 test/liveValidatorDataPlaneTests.ts diff --git a/ChangeLog.md b/ChangeLog.md index 1d7d5fac..5eee4517 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -7,6 +7,7 @@ - LiveValidator - ignore LRO header check if using 201/200+ provisioningState - SemanticValidator - Fix false alarm for MISSING_PATH_PARAMETER_DEFINITION - ModelValidator/SemanticValidator - support suppression on error code +- Use `new URL` instead of `url.parse`. Since url.parse will encode url and will be deprecated. - SemanticValidator - Add new rules of 'INVALID_XMS_DISCRIMINATOR_VALUE' and 'DISCRIMINATOR_PROPERTY_NOT_FOUND' ## 11/04/2021 2.10.2 diff --git a/lib/liveValidation/liveValidator.ts b/lib/liveValidation/liveValidator.ts index 4590c39a..c1c9e0f4 100644 --- a/lib/liveValidation/liveValidator.ts +++ b/lib/liveValidation/liveValidator.ts @@ -6,8 +6,8 @@ import * as os from "os"; import * as path from "path"; import { resolve as pathResolve } from "path"; import { ParsedUrlQuery } from "querystring"; -import * as url from "url"; import * as util from "util"; +import { URL } from "url"; import * as _ from "lodash"; import * as models from "../models"; import { requestResponseDefinition } from "../models/requestResponse"; @@ -24,6 +24,7 @@ import { RuntimeException } from "../util/validationError"; import { inversifyGetContainer, inversifyGetInstance, TYPES } from "../inversifyUtils"; import { setDefaultOpts } from "../swagger/loader"; import { apiValidationErrors, ApiValidationErrorCode } from "../util/errorDefinitions"; +import { kvPairsToObject } from "../util/utils"; import { LiveValidatorLoader, LiveValidatorLoaderOption } from "./liveValidatorLoader"; import { getProviderFromPathTemplate, OperationSearcher } from "./operationSearcher"; import { @@ -382,7 +383,9 @@ export class LiveValidator { }; } if (!liveRequest.query) { - liveRequest.query = url.parse(liveRequest.url, true).query; + liveRequest.query = kvPairsToObject( + new URL(liveRequest.url, "https://management.azure.com").searchParams + ); } let errors: LiveValidationIssue[] = []; let runtimeException; @@ -715,6 +718,7 @@ export class LiveValidator { const startTimeAddSpecToCache = Date.now(); this.operationSearcher.addSpecToCache(spec); + // TODO: add data-plane RP to cache. this.logging( `Add spec to cache ${swaggerPath}`, LiveValidatorLoggingLevels.info, @@ -834,15 +838,15 @@ export const parseValidationRequest = ( let resourceType = ""; let providerNamespace = ""; - const parsedUrl = url.parse(requestUrl, true); + const parsedUrl = new URL(requestUrl, "https://management.azure.com"); const pathStr = parsedUrl.pathname || ""; if (pathStr !== "") { // Lower all the keys and values of query parameters before searching for `api-version` - const queryObject = _.transform( - parsedUrl.query, - (obj: ParsedUrlQuery, value, key) => - (obj[key.toLowerCase()] = _.isString(value) ? value.toLowerCase() : value) - ); + const queryObject: ParsedUrlQuery = {}; + parsedUrl.searchParams.forEach((value, key) => { + queryObject[key.toLowerCase()] = value.toLowerCase(); + }); + apiVersion = (queryObject["api-version"] || C.unknownApiVersion) as string; providerNamespace = getProviderFromPathTemplate(pathStr) || C.unknownResourceProvider; resourceType = utils.getResourceType(pathStr, providerNamespace); diff --git a/lib/liveValidation/operationSearcher.ts b/lib/liveValidation/operationSearcher.ts index 7f01de7c..548ea968 100644 --- a/lib/liveValidation/operationSearcher.ts +++ b/lib/liveValidation/operationSearcher.ts @@ -343,11 +343,22 @@ export function getProviderFromPathTemplate(pathStr?: string | null): string | u } const providerRegEx = new RegExp("/providers/(:?[^{/]+)", "gi"); -export function getProviderFromSpecPath(specPath: string): string | undefined { - const match = providerInSpecPathRegEx.exec(specPath); - return match === null ? undefined : match[1]; +export interface PathProvider { + provider: string; + type: "resource-manager" | "data-plane"; } -const providerInSpecPathRegEx = new RegExp("/resource-manager/(:?[^{/]+)", "gi"); + +export function getProviderFromSpecPath(specPath: string): PathProvider | undefined { + const manageManagementMatch = managementPlaneProviderInSpecPathRegEx.exec(specPath); + const dataPlaneMatch = dataPlaneProviderInSpecPathRegEx.exec(specPath); + return manageManagementMatch === null + ? dataPlaneMatch === null + ? undefined + : { provider: dataPlaneMatch[1], type: "data-plane" } + : { provider: manageManagementMatch[1], type: "resource-manager" }; +} +const managementPlaneProviderInSpecPathRegEx = new RegExp("/(resource-manager)/(:?[^{/]+)", "gi"); +const dataPlaneProviderInSpecPathRegEx = new RegExp("/(data-plane)/(:?[^{/]+)", "gi"); /** * Gets list of matched operations objects for given url. diff --git a/lib/templates/httpTemplate.ts b/lib/templates/httpTemplate.ts index ea237f8b..aaf80337 100644 --- a/lib/templates/httpTemplate.ts +++ b/lib/templates/httpTemplate.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -import * as url from "url"; +import { URL } from "url"; import { mapEntries, MutableStringMap } from "@azure-tools/openapi-tools-common"; import * as msRest from "ms-rest"; @@ -30,7 +30,9 @@ export class HttpTemplate { protected getHost(): string | undefined { const requestUrl = this.request.url; - return requestUrl ? url.parse(requestUrl).host : "management.azure.com"; + return requestUrl + ? new URL(requestUrl, "https://management.azure.com").host + : "management.azure.com"; } protected getCurlRequestHeaders(padding?: string): string { diff --git a/lib/util/utils.ts b/lib/util/utils.ts index 8a5f2685..dc9cef77 100644 --- a/lib/util/utils.ts +++ b/lib/util/utils.ts @@ -489,6 +489,15 @@ export function isUrlEncoded(str: string): boolean { } } +export function kvPairsToObject(entries: any) { + const result: any = {}; + for (const [key, value] of entries) { + // each 'entry' is a [key, value] tupple + result[key] = value; + } + return result; +} + /** * Determines whether the given model is a pure (free-form) object candidate (i.e. equivalent of the * C# Object type). diff --git a/lib/xMsExampleExtractor.ts b/lib/xMsExampleExtractor.ts index 09259169..5fa88d5a 100644 --- a/lib/xMsExampleExtractor.ts +++ b/lib/xMsExampleExtractor.ts @@ -3,7 +3,7 @@ import * as fs from "fs"; import * as pathlib from "path"; -import * as url from "url"; +import { URL } from "url"; import { MutableStringMap, StringMap, @@ -14,6 +14,7 @@ import { } from "@azure-tools/openapi-tools-common"; import swaggerParser from "swagger-parser"; import { log } from "./util/logging"; +import { kvPairsToObject } from "./util/utils"; interface Options { output?: string; @@ -142,9 +143,10 @@ export class XMsExampleExtractor { let queryParams: any = {}; for (const recordingEntry of values(recordingEntries)) { entryIndex++; - const parsedUrl = url.parse(recordingEntry.RequestUri, true); + const parsedUrl = new URL(recordingEntry.RequestUri, "https://management.azure.com"); let recordingPath = parsedUrl.href || ""; - queryParams = parsedUrl.query || {}; + + queryParams = kvPairsToObject(parsedUrl.searchParams) || {}; const hostUrl = parsedUrl ? parsedUrl.protocol! + "//" + parsedUrl.hostname! : undefined; const headerParams = recordingEntry.RequestHeaders; diff --git a/test/liveValidation/payloads/dataplane/deleteCosmosTable_input.json b/test/liveValidation/payloads/dataplane/deleteCosmosTable_input.json new file mode 100644 index 00000000..4e3397af --- /dev/null +++ b/test/liveValidation/payloads/dataplane/deleteCosmosTable_input.json @@ -0,0 +1,35 @@ +{ + "liveRequest": { + "url": "https://fakeendpoint.table.core.windows.net/Tables('uttableb8e52e37')?api-version=2019-02-02", + "headers": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate", + "Authorization": "Sanitized", + "Content-Length": "0", + "Date": "Mon, 18 Oct 2021 21:58:36 GMT", + "User-Agent": "azsdk-python-data-tables/12.1.1 Python/3.9.2 (Windows-10-10.0.19041-SP0)", + "x-ms-client-request-id": "8b35094a-305e-11ec-9e2a-5cf37093a909", + "x-ms-date": "Mon, 18 Oct 2021 21:58:36 GMT", + "x-ms-version": "2019-02-02" + }, + "body": null, + "method": "DELETE" + }, + "liveResponse": { + "body": null, + "statusCode": "204", + "headers": { + "Cache-Control": "no-cache", + "Content-Length": "0", + "Date": "Mon, 18 Oct 2021 21:58:29 GMT", + "Server": [ + "Windows-Azure-Table/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "X-Content-Type-Options": "nosniff", + "x-ms-client-request-id": "8b35094a-305e-11ec-9e2a-5cf37093a909", + "x-ms-request-id": "57627185-2002-0015-6a6b-c4666e000000", + "x-ms-version": "2019-02-02" + } + } +} \ No newline at end of file diff --git a/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableCreate.json b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableCreate.json new file mode 100644 index 00000000..803e06fd --- /dev/null +++ b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableCreate.json @@ -0,0 +1,22 @@ +{ + "parameters": { + "x-ms-version": "2019-02-02", + "DataServiceVersion": "3.0", + "url": "myaccount.table.core.windows.net", + "tableProperties": { + "TableName": "mytable" + } + }, + "responses": { + "201": { + "body": { + "odata.metadata": "https://myaccount.table.core.windows.net/$metadata#Tables/@Element", + "odata.type": " myaccount.Tables", + "odata.id": "https://myaccount.table.core.windows.net/Tables('mytable')", + "odata.editLink": "Tables('mytable')", + "TableName": "mytable" + } + }, + "204": {} + } +} diff --git a/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableDelete.json b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableDelete.json new file mode 100644 index 00000000..0cc1f4bb --- /dev/null +++ b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableDelete.json @@ -0,0 +1,10 @@ +{ + "parameters": { + "x-ms-version": "2019-02-02", + "url": "myaccount.table.core.windows.net", + "table": "mytable" + }, + "responses": { + "204": {} + } +} diff --git a/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableDeleteEntity.json b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableDeleteEntity.json new file mode 100644 index 00000000..2d0f7a9a --- /dev/null +++ b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableDeleteEntity.json @@ -0,0 +1,14 @@ +{ + "parameters": { + "x-ms-version": "2019-02-02", + "DataServiceVersion": "3.0", + "If-Match": "*", + "url": "myaccount.table.core.windows.net", + "table": "Customers", + "partitionKey": "mypartitionkey", + "rowKey": "myrowkey" + }, + "responses": { + "204": {} + } +} diff --git a/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableGet.json b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableGet.json new file mode 100644 index 00000000..01885915 --- /dev/null +++ b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableGet.json @@ -0,0 +1,23 @@ +{ + "parameters": { + "x-ms-version": "2019-02-02", + "DataServiceVersion": "3.0", + "$top": 1, + "url": "myaccount.table.core.windows.net" + }, + "responses": { + "200": { + "body": { + "odata.metadata": "https://myaccount.table.core.windows.net/$metadata#Tables", + "value": [ + { + "odata.type": "myaccount.Tables", + "odata.id": "https://myaccount.table.core.windows.net/Tables('mytable')", + "odata.editLink": "Tables('mytable')", + "TableName": "mytable" + } + ] + } + } + } +} diff --git a/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableInsertEntity.json b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableInsertEntity.json new file mode 100644 index 00000000..749a5ac0 --- /dev/null +++ b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableInsertEntity.json @@ -0,0 +1,48 @@ +{ + "parameters": { + "x-ms-version": "2019-02-02", + "DataServiceVersion": "3.0", + "table": "Customer", + "url": "myaccount.table.core.windows.net", + "tableEntityProperties": { + "Address": "Mountain View", + "Age": 23, + "AmountDue": 200.23, + "CustomerCode@odata.type": "Edm.Guid", + "CustomerCode": "c9da6455-213d-42c9-9a79-3e9149a57833", + "CustomerSince@odata.type": "Edm.DateTime", + "CustomerSince": "2008-07-10T00:00:00", + "IsActive": true, + "NumberOfOrders@odata.type": "Edm.Int64", + "NumberOfOrders": "255", + "PartitionKey": "mypartitionkey", + "RowKey": "myrowkey" + } + }, + "responses": { + "201": { + "body": { + "odata.metadata": "https://myaccount.table.core.windows.net/Customer/$metadata#Customers/@Element", + "odata.type": "myaccount.Customers", + "odata.id": " https://myaccount.table.core.windows.net/Customers(PartitionKey='mypartitionkey',RowKey='myrowkey')", + "odata.etag": "W/\"0x5B168C7B6E589D2\"", + "odata.editLink": "Customers(PartitionKey='mypartitionkey',RowKey='myrowkey')", + "PartitionKey": "mypartitionkey", + "RowKey": "myrowkey", + "Timestamp@odata.type": "Edm.DateTime", + "Timestamp": "2013-08-22T01:12:06.2608595Z", + "Address": "Mountain View", + "Age": 23, + "AmountDue": 200.23, + "CustomerCode@odata.type": "Edm.Guid", + "CustomerCode": "c9da6455-213d-42c9-9a79-3e9149a57833", + "CustomerSince@odata.type": "Edm.DateTime", + "CustomerSince": "2008-07-10T00:00:00", + "IsActive": true, + "NumberOfOrders@odata.type": "Edm.Int64", + "NumberOfOrders": "255" + } + }, + "204": {} + } +} diff --git a/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableMergeEntity.json b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableMergeEntity.json new file mode 100644 index 00000000..24e71afe --- /dev/null +++ b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableMergeEntity.json @@ -0,0 +1,27 @@ +{ + "parameters": { + "x-ms-version": "2019-02-02", + "DataServiceVersion": "3.0", + "url": "myaccount.table.core.windows.net", + "table": "Customers", + "partitionKey": "mypartitionkey", + "rowKey": "myrowkey", + "tableEntityProperties": { + "Address": "Santa Clara", + "Age": 23, + "AmountDue": 200.23, + "CustomerCode@odata.type": "Edm.Guid", + "CustomerCode": "c9da6455-213d-42c9-9a79-3e9149a57833", + "CustomerSince@odata.type": "Edm.DateTime", + "CustomerSince": "2008-07-10T00:00:00", + "IsActive": false, + "NumberOfOrders@odata.type": "Edm.Int64", + "NumberOfOrders": "255", + "PartitionKey": "mypartitionkey", + "RowKey": "myrowkey" + } + }, + "responses": { + "204": {} + } +} diff --git a/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableQueryEntities.json b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableQueryEntities.json new file mode 100644 index 00000000..2daab5a9 --- /dev/null +++ b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableQueryEntities.json @@ -0,0 +1,30 @@ +{ + "parameters": { + "x-ms-version": "2019-02-02", + "DataServiceVersion": "3.0", + "url": "myaccount.table.core.windows.net", + "$top": 1, + "table": "Customer" + }, + "responses": { + "200": { + "body": { + "odata.metadata": " https://myaccount.table.core.windows.net/metadata#Customers", + "value": [ + { + "PartitionKey": "Customer", + "RowKey": "Name", + "odata.type": "myaccount.Customers", + "odata.id": "https://myaccount.table.core.windows.net/Customers(PartitionKey=Customer',RowKey='Name')", + "odata.etag": "W/\"0x5B168C7B6E589D2\"", + "odata.editLink": "Customers(PartitionKey=Customer',RowKey='Name')", + "Timestamp@odata.type": "Edm.DateTime", + "Timestamp": "2013-08-22T00:20:16.3134645Z", + "CustomerSince@odata.type": "Edm.DateTime", + "CustomerSince": "2008-10-01T15:25:05.2852025Z" + } + ] + } + } + } +} diff --git a/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableQueryEntityWithPartitionAndRowKey.json b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableQueryEntityWithPartitionAndRowKey.json new file mode 100644 index 00000000..665f5b83 --- /dev/null +++ b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableQueryEntityWithPartitionAndRowKey.json @@ -0,0 +1,27 @@ +{ + "parameters": { + "x-ms-version": "2019-02-02", + "DataServiceVersion": "3.0", + "url": "myaccount.table.core.windows.net", + "table": "Customers", + "partitionKey": "Customer", + "rowKey": "Name" + }, + "responses": { + "200": { + "body": { + "odata.metadata": " https://myaccount.table.core.windows.net/metadata#Customers", + "odata.type": "myaccount.Customers", + "odata.id": "https://myaccount.table.core.windows.net/Customers(PartitionKey=Customer',RowKey='Name')", + "odata.etag": "W/\"0x5B168C7B6E589D2\"", + "odata.editLink": "Customers(PartitionKey=Customer',RowKey='Name')", + "PartitionKey": "Customer", + "RowKey": "Name", + "Timestamp@odata.type": "Edm.DateTime", + "Timestamp": "2013-08-22T00:20:16.3134645Z", + "CustomerSince@odata.type": "Edm.DateTime", + "CustomerSince": "2008-10-01T15:25:05.2852025Z" + } + } + } +} diff --git a/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableUpdateEntity.json b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableUpdateEntity.json new file mode 100644 index 00000000..24e71afe --- /dev/null +++ b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/examples/TableUpdateEntity.json @@ -0,0 +1,27 @@ +{ + "parameters": { + "x-ms-version": "2019-02-02", + "DataServiceVersion": "3.0", + "url": "myaccount.table.core.windows.net", + "table": "Customers", + "partitionKey": "mypartitionkey", + "rowKey": "myrowkey", + "tableEntityProperties": { + "Address": "Santa Clara", + "Age": 23, + "AmountDue": 200.23, + "CustomerCode@odata.type": "Edm.Guid", + "CustomerCode": "c9da6455-213d-42c9-9a79-3e9149a57833", + "CustomerSince@odata.type": "Edm.DateTime", + "CustomerSince": "2008-07-10T00:00:00", + "IsActive": false, + "NumberOfOrders@odata.type": "Edm.Int64", + "NumberOfOrders": "255", + "PartitionKey": "mypartitionkey", + "RowKey": "myrowkey" + } + }, + "responses": { + "204": {} + } +} diff --git a/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/table.json b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/table.json new file mode 100644 index 00000000..d275ffa2 --- /dev/null +++ b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/table.json @@ -0,0 +1,1913 @@ +{ + "swagger": "2.0", + "info": { + "title": "Azure Table", + "version": "2019-02-02", + "x-ms-code-generation-settings": { + "header": "MIT", + "strictSpecAdherence": false + } + }, + "x-ms-parameterized-host": { + "hostTemplate": "{url}", + "useSchemePrefix": false, + "positionInOperation": "first", + "parameters": [ + { + "$ref": "#/parameters/Url" + } + ] + }, + "securityDefinitions": { + "table_shared_key": { + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + }, + "schemes": [ + "https" + ], + "consumes": [ + "application/json;odata=nometadata" + ], + "produces": [ + "application/json;odata=minimalmetadata" + ], + "paths": { + "/Tables": { + "get": { + "tags": [ + "table" + ], + "operationId": "Table_Query", + "x-ms-examples": { + "TableGet": { + "$ref": "./examples/TableGet.json" + } + }, + "description": "Queries tables under the given account.", + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ClientRequestId" + }, + { + "$ref": "#/parameters/DataServiceVersionParameter" + }, + { + "$ref": "#/parameters/formatParameter" + }, + { + "$ref": "#/parameters/topParameter" + }, + { + "$ref": "#/parameters/selectParameter" + }, + { + "$ref": "#/parameters/filterParameter" + }, + { + "name": "NextTableName", + "in": "query", + "required": false, + "type": "string", + "description": "A table query continuation token from a previous call." + } + ], + "responses": { + "200": { + "description": "Success, table query completed.", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + }, + "Date": { + "type": "string", + "format": "date-time-rfc1123", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." + }, + "x-ms-continuation-NextTableName": { + "type": "string", + "description": "This header contains the continuation token value." + } + }, + "schema": { + "$ref": "#/definitions/TableQueryResponse" + } + } + } + }, + "post": { + "tags": [ + "table" + ], + "operationId": "Table_Create", + "x-ms-examples": { + "TableCreate": { + "$ref": "./examples/TableCreate.json" + } + }, + "description": "Creates a new table under the given account.", + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ClientRequestId" + }, + { + "$ref": "#/parameters/DataServiceVersionParameter" + }, + { + "$ref": "#/parameters/formatParameter" + }, + { + "$ref": "#/parameters/TableProperties" + }, + { + "$ref": "#/parameters/PreferParameter" + } + ], + "responses": { + "201": { + "description": "Success, table created.", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + }, + "Date": { + "type": "string", + "format": "date-time-rfc1123", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." + }, + "Preference-Applied": { + "type": "string", + "description": "Indicates whether the Prefer request header was honored. If the response does not include this header, then the Prefer header was not honored. If this header is returned, its value will either be return-content or return-no-content." + } + }, + "schema": { + "$ref": "#/definitions/TableResponse" + } + }, + "204": { + "description": "Success, table created.", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + }, + "Date": { + "type": "string", + "format": "date-time-rfc1123", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." + }, + "Preference-Applied": { + "type": "string", + "description": "Indicates whether the Prefer request header was honored. If the response does not include this header, then the Prefer header was not honored. If this header is returned, its value will either be return-content or return-no-content." + } + } + }, + "default": { + "description": "Failure", + "headers": { + "x-ms-error-code": { + "x-ms-client-name": "ErrorCode", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/TableServiceError" + } + } + } + } + }, + "/Tables('{table}')": { + "delete": { + "tags": [ + "table" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "operationId": "Table_Delete", + "x-ms-examples": { + "TableDelete": { + "$ref": "./examples/TableDelete.json" + } + }, + "description": "Operation permanently deletes the specified table.", + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ClientRequestId" + }, + { + "$ref": "#/parameters/tableNameParameter" + } + ], + "responses": { + "204": { + "description": "No Content", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + }, + "Date": { + "type": "string", + "format": "date-time-rfc1123", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." + } + } + }, + "default": { + "description": "Failure", + "headers": { + "x-ms-error-code": { + "x-ms-client-name": "ErrorCode", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/TableServiceError" + } + } + } + } + }, + "/{table}()": { + "get": { + "tags": [ + "table" + ], + "operationId": "Table_QueryEntities", + "x-ms-examples": { + "TableQueryEntities": { + "$ref": "./examples/TableQueryEntities.json" + } + }, + "description": "Queries entities in a table.", + "parameters": [ + { + "$ref": "#/parameters/Timeout" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ClientRequestId" + }, + { + "$ref": "#/parameters/DataServiceVersionParameter" + }, + { + "$ref": "#/parameters/formatParameter" + }, + { + "$ref": "#/parameters/topParameter" + }, + { + "$ref": "#/parameters/selectParameter" + }, + { + "$ref": "#/parameters/filterParameter" + }, + { + "$ref": "#/parameters/tableNameParameter" + }, + { + "name": "NextPartitionKey", + "in": "query", + "required": false, + "type": "string", + "description": "An entity query continuation token from a previous call." + }, + { + "name": "NextRowKey", + "in": "query", + "required": false, + "type": "string", + "description": "An entity query continuation token from a previous call." + } + ], + "responses": { + "200": { + "description": "Success.", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + }, + "Date": { + "type": "string", + "format": "date-time-rfc1123", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." + }, + "x-ms-continuation-NextPartitionKey": { + "type": "string", + "description": "This header contains the continuation token value for partition key." + }, + "x-ms-continuation-NextRowKey": { + "type": "string", + "description": "This header contains the continuation token value for row key." + } + }, + "schema": { + "$ref": "#/definitions/TableEntityQueryResponse" + } + }, + "default": { + "description": "Failure", + "headers": { + "x-ms-error-code": { + "x-ms-client-name": "ErrorCode", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/TableServiceError" + } + } + } + } + }, + "/{table}(PartitionKey='{partitionKey}',RowKey='{rowKey}')": { + "get": { + "tags": [ + "table" + ], + "operationId": "Table_QueryEntityWithPartitionAndRowKey", + "x-ms-examples": { + "TableQueryEntitiesWithPartitionAndRowKey": { + "$ref": "./examples/TableQueryEntityWithPartitionAndRowKey.json" + } + }, + "description": "Queries a single entity in a table.", + "parameters": [ + { + "$ref": "#/parameters/Timeout" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ClientRequestId" + }, + { + "$ref": "#/parameters/DataServiceVersionParameter" + }, + { + "$ref": "#/parameters/formatParameter" + }, + { + "$ref": "#/parameters/selectParameter" + }, + { + "$ref": "#/parameters/filterParameter" + }, + { + "$ref": "#/parameters/tableNameParameter" + }, + { + "$ref": "#/parameters/partitionKeyParameter" + }, + { + "$ref": "#/parameters/rowKeyParameter" + } + ], + "responses": { + "200": { + "description": "Success.", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + }, + "Date": { + "type": "string", + "format": "date-time-rfc1123", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." + }, + "ETag": { + "type": "string", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" + }, + "x-ms-continuation-NextPartitionKey": { + "type": "string", + "description": "This header contains the continuation token value for partition key." + }, + "x-ms-continuation-NextRowKey": { + "type": "string", + "description": "This header contains the continuation token value for row key." + } + }, + "schema": { + "$ref": "#/definitions/TableEntityProperties" + } + }, + "default": { + "description": "Failure", + "headers": { + "x-ms-error-code": { + "x-ms-client-name": "ErrorCode", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/TableServiceError" + } + } + } + }, + "put": { + "tags": [ + "table" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "operationId": "Table_UpdateEntity", + "x-ms-examples": { + "TableUpdateEntity": { + "$ref": "./examples/TableUpdateEntity.json" + } + }, + "description": "Update entity in a table.", + "parameters": [ + { + "$ref": "#/parameters/Timeout" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ClientRequestId" + }, + { + "$ref": "#/parameters/DataServiceVersionParameter" + }, + { + "$ref": "#/parameters/formatParameter" + }, + { + "$ref": "#/parameters/TableEntityProperties" + }, + { + "$ref": "#/parameters/tableNameParameter" + }, + { + "$ref": "#/parameters/partitionKeyParameter" + }, + { + "$ref": "#/parameters/rowKeyParameter" + }, + { + "name": "If-Match", + "in": "header", + "required": false, + "type": "string", + "description": "Match condition for an entity to be updated. If specified and a matching entity is not found, an error will be raised. To force an unconditional update, set to the wildcard character (*). If not specified, an insert will be performed when no existing entity is found to update and a replace will be performed if an existing entity is found.", + "x-ms-client-name": "IfMatch" + } + ], + "responses": { + "204": { + "description": "Success.", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + }, + "Date": { + "type": "string", + "format": "date-time-rfc1123", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." + }, + "ETag": { + "type": "string", + "description": "UTC date/time value generated by the service that indicates the time at which the entity was last updated." + } + } + }, + "default": { + "description": "Failure", + "headers": { + "x-ms-error-code": { + "x-ms-client-name": "ErrorCode", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/TableServiceError" + } + } + } + }, + "patch": { + "tags": [ + "table" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "operationId": "Table_MergeEntity", + "x-ms-examples": { + "TableMergeEntity": { + "$ref": "./examples/TableMergeEntity.json" + } + }, + "description": "Merge entity in a table.", + "parameters": [ + { + "$ref": "#/parameters/Timeout" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ClientRequestId" + }, + { + "$ref": "#/parameters/DataServiceVersionParameter" + }, + { + "$ref": "#/parameters/formatParameter" + }, + { + "$ref": "#/parameters/TableEntityProperties" + }, + { + "$ref": "#/parameters/tableNameParameter" + }, + { + "$ref": "#/parameters/partitionKeyParameter" + }, + { + "$ref": "#/parameters/rowKeyParameter" + }, + { + "name": "If-Match", + "in": "header", + "required": false, + "type": "string", + "description": "Match condition for an entity to be updated. If specified and a matching entity is not found, an error will be raised. To force an unconditional update, set to the wildcard character (*). If not specified, an insert will be performed when no existing entity is found to update and a merge will be performed if an existing entity is found.", + "x-ms-client-name": "IfMatch" + } + ], + "responses": { + "204": { + "description": "Success.", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + }, + "Date": { + "type": "string", + "format": "date-time-rfc1123", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." + }, + "ETag": { + "type": "string", + "description": "UTC date/time value generated by the service that indicates the time at which the entity was last updated." + } + } + }, + "default": { + "description": "Failure", + "headers": { + "x-ms-error-code": { + "x-ms-client-name": "ErrorCode", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/TableServiceError" + } + } + } + }, + "delete": { + "tags": [ + "table" + ], + "operationId": "Table_DeleteEntity", + "x-ms-examples": { + "TableDeleteEntity": { + "$ref": "./examples/TableDeleteEntity.json" + } + }, + "description": "Deletes the specified entity in a table.", + "parameters": [ + { + "$ref": "#/parameters/Timeout" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ClientRequestId" + }, + { + "$ref": "#/parameters/DataServiceVersionParameter" + }, + { + "$ref": "#/parameters/formatParameter" + }, + { + "$ref": "#/parameters/tableNameParameter" + }, + { + "$ref": "#/parameters/partitionKeyParameter" + }, + { + "$ref": "#/parameters/rowKeyParameter" + }, + { + "name": "If-Match", + "in": "header", + "required": true, + "type": "string", + "description": "Match condition for an entity to be deleted. If specified and a matching entity is not found, an error will be raised. To force an unconditional delete, set to the wildcard character (*).", + "x-ms-client-name": "IfMatch" + } + ], + "responses": { + "204": { + "description": "Success.", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + }, + "Date": { + "type": "string", + "format": "date-time-rfc1123", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." + } + } + }, + "default": { + "description": "Failure", + "headers": { + "x-ms-error-code": { + "x-ms-client-name": "ErrorCode", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/TableServiceError" + } + } + } + } + }, + "/{table}": { + "post": { + "tags": [ + "table" + ], + "operationId": "Table_InsertEntity", + "x-ms-examples": { + "TableInsertEntity": { + "$ref": "./examples/TableInsertEntity.json" + } + }, + "description": "Insert entity in a table.", + "parameters": [ + { + "$ref": "#/parameters/Timeout" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ClientRequestId" + }, + { + "$ref": "#/parameters/DataServiceVersionParameter" + }, + { + "$ref": "#/parameters/formatParameter" + }, + { + "$ref": "#/parameters/TableEntityProperties" + }, + { + "$ref": "#/parameters/tableNameParameter" + }, + { + "$ref": "#/parameters/PreferParameter" + } + ], + "responses": { + "201": { + "description": "Success.", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + }, + "Date": { + "type": "string", + "format": "date-time-rfc1123", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." + }, + "ETag": { + "type": "string", + "description": "UTC date/time value generated by the service that indicates the time at which the entity was last updated." + }, + "Preference-Applied": { + "type": "string", + "description": "Indicates whether the Prefer request header was honored. If the response does not include this header, then the Prefer header was not honored. If this header is returned, its value will either be return-content or return-no-content." + }, + "Content-Type": { + "type": "string", + "description": "Indicates the content type of the payload. The value depends on the value specified for the Accept request header." + } + }, + "schema": { + "$ref": "#/definitions/TableEntityProperties" + } + }, + "204": { + "description": "No Content.", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + }, + "Date": { + "type": "string", + "format": "date-time-rfc1123", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." + }, + "ETag": { + "type": "string", + "description": "UTC date/time value generated by the service that indicates the time at which the entity was last updated." + }, + "Preference-Applied": { + "type": "string", + "description": "Indicates whether the Prefer request header was honored. If the response does not include this header, then the Prefer header was not honored. If this header is returned, its value will either be return-content or return-no-content." + }, + "Content-Type": { + "type": "string", + "description": "Indicates the content type of the payload. The value depends on the value specified for the Accept request header." + } + } + }, + "default": { + "description": "Failure", + "headers": { + "x-ms-error-code": { + "x-ms-client-name": "ErrorCode", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/TableServiceError" + } + } + } + }, + "get": { + "tags": [ + "table" + ], + "consumes": [ + "application/xml" + ], + "produces": [ + "application/xml" + ], + "operationId": "Table_GetAccessPolicy", + "description": "Retrieves details about any stored access policies specified on the table that may be used with Shared Access Signatures.", + "parameters": [ + { + "$ref": "#/parameters/Timeout" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ClientRequestId" + }, + { + "$ref": "#/parameters/tableNameParameter" + }, + { + "$ref": "#/parameters/compAclParameter" + } + ], + "responses": { + "200": { + "description": "Success.", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + }, + "Date": { + "type": "string", + "format": "date-time-rfc1123", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." + } + }, + "schema": { + "$ref": "#/definitions/SignedIdentifiers" + } + }, + "default": { + "description": "Failure", + "headers": { + "x-ms-error-code": { + "x-ms-client-name": "ErrorCode", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/TableServiceError" + } + } + } + }, + "put": { + "tags": [ + "table" + ], + "consumes": [ + "application/xml" + ], + "produces": [ + "application/xml" + ], + "operationId": "Table_SetAccessPolicy", + "description": "Sets stored access policies for the table that may be used with Shared Access Signatures.", + "parameters": [ + { + "$ref": "#/parameters/TableAcl" + }, + { + "$ref": "#/parameters/Timeout" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ClientRequestId" + }, + { + "$ref": "#/parameters/tableNameParameter" + }, + { + "$ref": "#/parameters/compAclParameter" + } + ], + "responses": { + "204": { + "description": "No Content", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + }, + "Date": { + "type": "string", + "format": "date-time-rfc1123", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." + } + } + }, + "default": { + "description": "Failure", + "headers": { + "x-ms-error-code": { + "x-ms-client-name": "ErrorCode", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/TableServiceError" + } + } + } + } + } + }, + "x-ms-paths": { + "/?ServiceProperties": { + "parameters": [ + { + "name": "restype", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "service" + ], + "description": "Required query string to set the service properties." + }, + { + "name": "comp", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "properties" + ], + "description": "Required query string to set the service properties." + } + ], + "put": { + "tags": [ + "service" + ], + "consumes": [ + "application/xml" + ], + "produces": [ + "application/xml" + ], + "operationId": "Service_SetProperties", + "description": "Sets properties for an account's Table service endpoint, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules.", + "parameters": [ + { + "$ref": "#/parameters/TableServiceProperties" + }, + { + "$ref": "#/parameters/Timeout" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ClientRequestId" + } + ], + "responses": { + "202": { + "description": "Success (Accepted)", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + } + } + }, + "default": { + "description": "Failure", + "headers": { + "x-ms-error-code": { + "x-ms-client-name": "ErrorCode", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/TableServiceError" + } + } + } + }, + "get": { + "tags": [ + "service" + ], + "consumes": [ + "application/xml" + ], + "produces": [ + "application/xml" + ], + "operationId": "Service_GetProperties", + "description": "Gets the properties of an account's Table service, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules.", + "parameters": [ + { + "$ref": "#/parameters/Timeout" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ClientRequestId" + } + ], + "responses": { + "200": { + "description": "Success.", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + } + }, + "schema": { + "$ref": "#/definitions/TableServiceProperties" + } + }, + "default": { + "description": "Failure", + "headers": { + "x-ms-error-code": { + "x-ms-client-name": "ErrorCode", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/TableServiceError" + } + } + } + } + }, + "/?ServiceStats": { + "parameters": [ + { + "name": "restype", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "service" + ], + "description": "Required query string to get service stats." + }, + { + "name": "comp", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "stats" + ], + "description": "Required query string to get service stats." + } + ], + "get": { + "tags": [ + "service" + ], + "consumes": [ + "application/xml" + ], + "produces": [ + "application/xml" + ], + "operationId": "Service_GetStatistics", + "description": "Retrieves statistics related to replication for the Table service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the account.", + "parameters": [ + { + "$ref": "#/parameters/Timeout" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/ClientRequestId" + } + ], + "responses": { + "200": { + "description": "Success.", + "headers": { + "x-ms-client-request-id": { + "x-ms-client-name": "ClientRequestId", + "type": "string", + "description": "If a client request id header is sent in the request, this header will be present in the response with the same value." + }, + "x-ms-request-id": { + "x-ms-client-name": "RequestId", + "type": "string", + "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." + }, + "x-ms-version": { + "x-ms-client-name": "Version", + "type": "string", + "description": "Indicates the version of the Table service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." + }, + "Date": { + "type": "string", + "format": "date-time-rfc1123", + "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." + } + }, + "schema": { + "$ref": "#/definitions/TableServiceStats" + } + }, + "default": { + "description": "Failure", + "headers": { + "x-ms-error-code": { + "x-ms-client-name": "ErrorCode", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/TableServiceError" + } + } + } + } + } + }, + "definitions": { + "TableServiceError": { + "description": "Table Service error.", + "type": "object", + "xml": {}, + "properties": { + "Message": { + "description": "The error message.", + "type": "string", + "xml": { + "name": "Message" + } + } + } + }, + "TableServiceProperties": { + "description": "Table Service Properties.", + "type": "object", + "xml": { + "name": "StorageServiceProperties" + }, + "properties": { + "Logging": { + "description": "Azure Analytics Logging settings.", + "$ref": "#/definitions/Logging" + }, + "HourMetrics": { + "description": "A summary of request statistics grouped by API in hourly aggregates for tables.", + "$ref": "#/definitions/Metrics" + }, + "MinuteMetrics": { + "description": "A summary of request statistics grouped by API in minute aggregates for tables.", + "$ref": "#/definitions/Metrics" + }, + "Cors": { + "description": "The set of CORS rules.", + "type": "array", + "items": { + "$ref": "#/definitions/CorsRule" + }, + "xml": { + "wrapped": true, + "name": "Cors" + } + } + } + }, + "Logging": { + "xml": { + "name": "Logging" + }, + "description": "Azure Analytics Logging settings.", + "type": "object", + "required": [ + "Version", + "Delete", + "Read", + "Write", + "RetentionPolicy" + ], + "properties": { + "Version": { + "description": "The version of Analytics to configure.", + "type": "string", + "xml": { + "name": "Version" + } + }, + "Delete": { + "description": "Indicates whether all delete requests should be logged.", + "type": "boolean", + "xml": { + "name": "Delete" + } + }, + "Read": { + "description": "Indicates whether all read requests should be logged.", + "type": "boolean", + "xml": { + "name": "Read" + } + }, + "Write": { + "description": "Indicates whether all write requests should be logged.", + "type": "boolean", + "xml": { + "name": "Write" + } + }, + "RetentionPolicy": { + "$ref": "#/definitions/RetentionPolicy" + } + } + }, + "Metrics": { + "xml": {}, + "description": "", + "required": [ + "Enabled" + ], + "properties": { + "Version": { + "description": "The version of Analytics to configure.", + "type": "string", + "xml": { + "name": "Version" + } + }, + "Enabled": { + "description": "Indicates whether metrics are enabled for the Table service.", + "type": "boolean", + "xml": { + "name": "Enabled" + } + }, + "IncludeAPIs": { + "description": "Indicates whether metrics should generate summary statistics for called API operations.", + "type": "boolean", + "xml": { + "name": "IncludeAPIs" + } + }, + "RetentionPolicy": { + "$ref": "#/definitions/RetentionPolicy" + } + } + }, + "CorsRule": { + "xml": { + "name": "CorsRule" + }, + "description": "CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain.", + "type": "object", + "required": [ + "AllowedOrigins", + "AllowedMethods", + "AllowedHeaders", + "ExposedHeaders", + "MaxAgeInSeconds" + ], + "properties": { + "AllowedOrigins": { + "description": "The origin domains that are permitted to make a request against the service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS.", + "type": "string", + "xml": { + "name": "AllowedOrigins" + } + }, + "AllowedMethods": { + "description": "The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated)", + "type": "string", + "xml": { + "name": "AllowedMethods" + } + }, + "AllowedHeaders": { + "description": "The request headers that the origin domain may specify on the CORS request.", + "type": "string", + "xml": { + "name": "AllowedHeaders" + } + }, + "ExposedHeaders": { + "description": "The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer.", + "type": "string", + "xml": { + "name": "ExposedHeaders" + } + }, + "MaxAgeInSeconds": { + "description": "The maximum amount time that a browser should cache the preflight OPTIONS request.", + "type": "integer", + "minimum": 0, + "xml": { + "name": "MaxAgeInSeconds" + } + } + } + }, + "RetentionPolicy": { + "xml": { + "name": "RetentionPolicy" + }, + "description": "The retention policy.", + "type": "object", + "required": [ + "Enabled" + ], + "properties": { + "Enabled": { + "description": "Indicates whether a retention policy is enabled for the service.", + "type": "boolean", + "xml": { + "name": "Enabled" + } + }, + "Days": { + "description": "Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted.", + "type": "integer", + "minimum": 1, + "xml": { + "name": "Days" + } + } + } + }, + "TableServiceStats": { + "description": "Stats for the service.", + "type": "object", + "xml": { + "name": "StorageServiceStats" + }, + "properties": { + "GeoReplication": { + "description": "Geo-Replication information for the Secondary Storage Service.", + "$ref": "#/definitions/GeoReplication" + } + } + }, + "GeoReplication": { + "xml": { + "name": "GeoReplication" + }, + "type": "object", + "required": [ + "Status", + "LastSyncTime" + ], + "properties": { + "Status": { + "description": "The status of the secondary location.", + "type": "string", + "enum": [ + "live", + "bootstrap", + "unavailable" + ], + "x-ms-enum": { + "name": "GeoReplicationStatusType", + "modelAsString": true + }, + "xml": { + "name": "Status" + } + }, + "LastSyncTime": { + "description": "A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads.", + "type": "string", + "format": "date-time-rfc1123", + "xml": { + "name": "LastSyncTime" + } + } + } + }, + "TableProperties": { + "description": "The properties for creating a table.", + "type": "object", + "properties": { + "TableName": { + "description": "The name of the table to create.", + "type": "string" + } + } + }, + "TableResponse": { + "description": "The response for a single table.", + "type": "object", + "properties": { + "odata.metadata": { + "description": "The metadata response of the table.", + "type": "string" + } + }, + "allOf": [ + { + "$ref": "#/definitions/TableResponseProperties" + } + ] + }, + "TableQueryResponse": { + "description": "The properties for the table query response.", + "type": "object", + "properties": { + "odata.metadata": { + "description": "The metadata response of the table.", + "type": "string" + }, + "value": { + "description": "List of tables.", + "type": "array", + "items": { + "$ref": "#/definitions/TableResponseProperties" + } + } + } + }, + "TableResponseProperties": { + "description": "The properties for the table response.", + "type": "object", + "properties": { + "TableName": { + "description": "The name of the table.", + "type": "string" + }, + "odata.type": { + "description": "The odata type of the table.", + "type": "string" + }, + "odata.id": { + "description": "The id of the table.", + "type": "string" + }, + "odata.editLink": { + "description": "The edit link of the table.", + "type": "string" + } + } + }, + "SignedIdentifier": { + "xml": { + "name": "SignedIdentifier" + }, + "description": "A signed identifier.", + "type": "object", + "required": [ + "Id", + "AccessPolicy" + ], + "properties": { + "Id": { + "type": "string", + "description": "A unique id.", + "xml": { + "name": "Id" + } + }, + "AccessPolicy": { + "description": "The access policy.", + "$ref": "#/definitions/AccessPolicy" + } + } + }, + "SignedIdentifiers": { + "description": "A collection of signed identifiers.", + "type": "array", + "items": { + "$ref": "#/definitions/SignedIdentifier", + "xml": { + "name": "SignedIdentifier" + } + }, + "xml": { + "wrapped": true, + "name": "SignedIdentifiers" + } + }, + "AccessPolicy": { + "xml": { + "name": "AccessPolicy" + }, + "type": "object", + "required": [ + "Start", + "Expiry", + "Permission" + ], + "description": "An Access policy.", + "properties": { + "Start": { + "description": "The start datetime from which the policy is active.", + "type": "string", + "format": "date-time", + "xml": { + "name": "Start" + } + }, + "Expiry": { + "description": "The datetime that the policy expires.", + "type": "string", + "format": "date-time", + "xml": { + "name": "Expiry" + } + }, + "Permission": { + "description": "The permissions for the acl policy.", + "type": "string", + "xml": { + "name": "Permission" + } + } + } + }, + "TableEntityQueryResponse": { + "description": "The properties for the table entity query response.", + "type": "object", + "properties": { + "odata.metadata": { + "description": "The metadata response of the table.", + "type": "string" + }, + "value": { + "description": "List of table entities.", + "type": "array", + "items": { + "$ref": "#/definitions/TableEntityProperties" + } + } + } + }, + "TableEntityProperties": { + "description": "The other properties of the table entity.", + "type": "object", + "additionalProperties": true + } + }, + "parameters": { + "Url": { + "name": "url", + "x-ms-parameter-location": "client", + "description": "The URL of the service account or table that is the target of the desired operation.", + "required": true, + "type": "string", + "in": "path", + "x-ms-skip-url-encoding": true + }, + "TableServiceProperties": { + "name": "tableServiceProperties", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TableServiceProperties" + }, + "x-ms-parameter-location": "method", + "description": "The Table Service properties." + }, + "Timeout": { + "name": "timeout", + "in": "query", + "required": false, + "type": "integer", + "minimum": 0, + "x-ms-parameter-location": "method", + "description": "The timeout parameter is expressed in seconds." + }, + "ApiVersionParameter": { + "name": "x-ms-version", + "x-ms-parameter-location": "client", + "x-ms-client-name": "version", + "in": "header", + "required": true, + "type": "string", + "description": "Specifies the version of the operation to use for this request.", + "enum": [ + "2019-02-02" + ] + }, + "ClientRequestId": { + "name": "x-ms-client-request-id", + "x-ms-client-name": "requestId", + "in": "header", + "required": false, + "type": "string", + "x-ms-parameter-location": "method", + "description": "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled." + }, + "DataServiceVersionParameter": { + "name": "DataServiceVersion", + "in": "header", + "required": true, + "type": "string", + "description": "Specifies the data service version.", + "x-ms-parameter-location": "method", + "enum": [ + "3.0" + ] + }, + "TableProperties": { + "name": "tableProperties", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TableProperties" + }, + "x-ms-parameter-location": "method", + "description": "The Table properties." + }, + "formatParameter": { + "name": "$format", + "in": "query", + "required": false, + "type": "string", + "description": "Specifies the media type for the response.", + "x-ms-parameter-location": "method", + "x-ms-parameter-grouping": { + "name": "QueryOptions" + }, + "x-ms-client-name": "Format", + "enum": [ + "application/json;odata=nometadata", + "application/json;odata=minimalmetadata", + "application/json;odata=fullmetadata" + ], + "x-ms-enum": { + "name": "OdataMetadataFormat", + "modelAsString": true + } + }, + "topParameter": { + "name": "$top", + "in": "query", + "required": false, + "type": "integer", + "format": "int32", + "minimum": 0, + "description": "Maximum number of records to return.", + "x-ms-parameter-location": "method", + "x-ms-parameter-grouping": { + "name": "QueryOptions" + }, + "x-ms-client-name": "Top" + }, + "selectParameter": { + "name": "$select", + "in": "query", + "required": false, + "type": "string", + "description": "Select expression using OData notation. Limits the columns on each record to just those requested, e.g. \"$select=PolicyAssignmentId, ResourceId\".", + "x-ms-parameter-location": "method", + "x-ms-parameter-grouping": { + "name": "QueryOptions" + }, + "x-ms-client-name": "Select" + }, + "filterParameter": { + "name": "$filter", + "in": "query", + "required": false, + "type": "string", + "description": "OData filter expression.", + "x-ms-parameter-location": "method", + "x-ms-parameter-grouping": { + "name": "QueryOptions" + }, + "x-ms-client-name": "Filter" + }, + "PreferParameter": { + "name": "Prefer", + "in": "header", + "required": false, + "type": "string", + "description": "Specifies whether the response should include the inserted entity in the payload. Possible values are return-no-content and return-content.", + "x-ms-parameter-location": "method", + "x-ms-client-name": "ResponsePreference", + "enum": [ + "return-no-content", + "return-content" + ], + "x-ms-enum": { + "name": "ResponseFormat", + "modelAsString": true + } + }, + "compAclParameter": { + "name": "comp", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "acl" + ], + "x-ms-parameter-location": "method", + "description": "Required query string to handle stored access policies for the table that may be used with Shared Access Signatures." + }, + "TableAcl": { + "name": "tableAcl", + "in": "body", + "schema": { + "$ref": "#/definitions/SignedIdentifiers" + }, + "x-ms-parameter-location": "method", + "description": "The acls for the table." + }, + "TableEntityProperties": { + "name": "tableEntityProperties", + "in": "body", + "schema": { + "$ref": "#/definitions/TableEntityProperties" + }, + "x-ms-parameter-location": "method", + "description": "The properties for the table entity." + }, + "tableNameParameter": { + "name": "table", + "in": "path", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "description": "The name of the table." + }, + "partitionKeyParameter": { + "name": "partitionKey", + "in": "path", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "description": "The partition key of the entity." + }, + "rowKeyParameter": { + "name": "rowKey", + "in": "path", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "description": "The row key of the entity." + } + } +} diff --git a/test/liveValidation/swaggers/specification/cosmos-db/data-plane/readme.md b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/readme.md new file mode 100644 index 00000000..ba1ff2a9 --- /dev/null +++ b/test/liveValidation/swaggers/specification/cosmos-db/data-plane/readme.md @@ -0,0 +1,248 @@ +# Table Dataplane + +> see https://aka.ms/autorest + +This is the AutoRest configuration file for Tables. + + + +--- +## Getting Started +To build the SDK for Tables, simply [Install AutoRest](https://aka.ms/autorest/install) and in this folder, run: + +> `autorest` + +To see additional help and options, run: + +> `autorest --help` +--- + +## Configuration + + + +### Basic Information +These are the global settings for the Tables API. + +``` yaml +azure-validator: true +openapi-type: data-plane +tag: package-2019-02 +``` + +### Tag: package-2019-02 + +These settings apply only when `--tag=package-2019-02` is specified on the command line. + +``` yaml $(tag) == 'package-2019-02' +input-file: +- Microsoft.Tables/preview/2019-02-02/table.json +``` + +--- +# Suppressions + +``` yaml +directive: + - suppress: D5001 + where: $["x-ms-paths"]["/?ServiceProperties"].put + reason: The path only supports XML input/outputm which is not supported + - suppress: D5001 + where: $["x-ms-paths"]["/?ServiceProperties"].get + reason: The path only supports XML input/outputm which is not supported + - suppress: D5001 + where: $["x-ms-paths"]["/?ServiceStats"].get + reason: The path only supports XML input/outputm which is not supported + - suppress: D5001 + where: $.paths["/{table}"].get + reason: The path only supports XML input/outputm which is not supported + - suppress: D5001 + where: $.paths["/{table}"].put + reason: The path only supports XML input/outputm which is not supported + - suppress: R3016 + where: $.definitions.TableServiceError.properties.Message + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.TableServiceProperties.properties.Logging + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.TableServiceProperties.properties.HourMetrics + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.TableServiceProperties.properties.MinuteMetrics + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.TableServiceProperties.properties.Cors + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.Logging.properties.Version + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.Logging.properties.Delete + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.Logging.properties.Read + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.Logging.properties.Write + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.Logging.properties.RetentionPolicy + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.Metrics.properties.Version + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.Metrics.properties.Enabled + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.Metrics.properties.IncludeAPIs + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.Metrics.properties.RetentionPolicy + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.CorsRule.properties.AllowedOrigins + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.CorsRule.properties.AllowedMethods + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.CorsRule.properties.AllowedHeaders + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.CorsRule.properties.ExposedHeaders + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.CorsRule.properties.MaxAgeInSeconds + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.RetentionPolicy.properties.Enabled + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.RetentionPolicy.properties.Days + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.TableServiceStats.properties.GeoReplication + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.GeoReplication.properties.Status + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.GeoReplication.properties.LastSyncTime + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.TableProperties.properties.TableName + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.TableResponse.properties["odata.metadata"] + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.TableQueryResponse.properties["odata.metadata"] + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.TableResponseProperties.properties.TableName + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.TableResponseProperties.properties["odata.type"] + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.TableResponseProperties.properties["odata.id"] + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.TableResponseProperties.properties["odata.editLink"] + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.SignedIdentifier.properties.Id + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.SignedIdentifier.properties.AccessPolicy + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.AccessPolicy.properties.Start + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.AccessPolicy.properties.Expiry + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.AccessPolicy.properties.Permission + reason: Response from service is not camel case + - suppress: R3016 + where: $.definitions.TableEntityQueryResponse.properties["odata.metadata"] + reason: Response from service is not camel case + - suppress: R2058 + where: $["x-ms-paths"]["/?ServiceStats"] + reason: Cannot provide operation in "paths" + - suppress: R2058 + where: $["x-ms-paths"]["/?ServiceProperties"] + reason: Cannot provide operation in "paths" +``` + +--- +# Code Generation + + +## Swagger to SDK + +Swagger to SDK has been intentionally disabled for this spec. + +## C# + +These settings apply only when `--csharp` is specified on the command line. +Please also specify `--csharp-sdks-folder=`. + +``` yaml $(csharp) +csharp: + azure-arm: true + license-header: MICROSOFT_MIT_NO_VERSION + namespace: Microsoft.Azure.Storage.Tables + output-folder: $(csharp-sdks-folder)/Storage/Tables/Generated + clear-output-folder: true +``` + + +## Python + +See configuration in [readme.python.md](./readme.python.md) + +## Go + +See configuration in [readme.go.md](./readme.go.md) + +## Java + +These settings apply only when `--java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(java) +java: + azure-arm: true + namespace: com.microsoft.azure.storage.tables + license-header: MICROSOFT_MIT_NO_CODEGEN + output-folder: $(azure-libraries-for-java-folder)/azure-storage-tables +``` + +## Multi-API/Profile support for AutoRest v3 generators + +AutoRest V3 generators require the use of `--tag=all-api-versions` to select api files. + +This block is updated by an automatic script. Edits may be lost! + +``` yaml $(tag) == 'all-api-versions' /* autogenerated */ +# include the azure profile definitions from the standard location +require: $(this-folder)/../../../profiles/readme.md + +# all the input files across all versions +input-file: + - $(this-folder)/Microsoft.Tables/preview/2019-02-02/table.json + +``` + +If there are files that should not be in the `all-api-versions` set, +uncomment the `exclude-file` section below and add the file paths. + +``` yaml $(tag) == 'all-api-versions' +#exclude-file: +# - $(this-folder)/Microsoft.Example/stable/2010-01-01/somefile.json +``` + diff --git a/test/liveValidatorDataPlaneTests.ts b/test/liveValidatorDataPlaneTests.ts new file mode 100644 index 00000000..fa83a203 --- /dev/null +++ b/test/liveValidatorDataPlaneTests.ts @@ -0,0 +1,26 @@ +// Copyright (c) 2021 Microsoft Corporation +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +import { LiveValidator } from "../lib/liveValidation/liveValidator"; + +describe("LiveValidator for data-plane", () => { + describe("Initialization", () => { + it("should initialize data-plane swagger without errors", async () => { + const tableSwaggerFilePath = + "cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/table.json"; + + const options = { + swaggerPathsPattern: [tableSwaggerFilePath], + directory: "./test/liveValidation/swaggers/specification", + }; + const liveValidator = new LiveValidator(options); + await liveValidator.initialize(); + expect(liveValidator.operationSearcher.cache.size).toEqual(1); + expect(Array.from(liveValidator.operationSearcher.cache.keys())).toEqual([ + "microsoft.unknown", + ]); + }); + }); +}); diff --git a/test/liveValidatorTests.ts b/test/liveValidatorTests.ts index fa587bbb..1d493fd4 100644 --- a/test/liveValidatorTests.ts +++ b/test/liveValidatorTests.ts @@ -249,6 +249,13 @@ describe("Live Validator", () => { "get": 2, "put": 1, }, + "2019-02-02": Object { + "delete": 2, + "get": 6, + "patch": 1, + "post": 2, + "put": 3, + }, } `); assert.strictEqual(numberOfSpecs, cache.size);