From 407888b5fdb86394eadfc1d3e9dfc82c1856213c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 14 Sep 2021 07:41:13 +0000 Subject: [PATCH] CodeGen from PR 15971 in Azure/azure-rest-api-specs [CosmosDB] Fixing bugs in Services APIs (#15971) * test * try1 * fixing services discriminator * prettier and readme * revert additional changes * fixing model validation errors * model validation fix * nit Co-authored-by: Meha Kaushik --- .../Microsoft.DocumentDB.json | 84 ++++---------- .../Microsoft.DocumentDB.json | 107 ++++-------------- 2 files changed, 41 insertions(+), 150 deletions(-) diff --git a/schemas/2021-04-01-preview/Microsoft.DocumentDB.json b/schemas/2021-04-01-preview/Microsoft.DocumentDB.json index a2979ebfe1..eb275791db 100644 --- a/schemas/2021-04-01-preview/Microsoft.DocumentDB.json +++ b/schemas/2021-04-01-preview/Microsoft.DocumentDB.json @@ -1305,13 +1305,13 @@ "properties": { "oneOf": [ { - "$ref": "#/definitions/ServiceResourceProperties" + "$ref": "#/definitions/ServiceResourceCreateUpdateProperties" }, { "$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression" } ], - "description": "Services response resource." + "description": "Properties in ServiceResourceCreateUpdateParameters." }, "type": { "type": "string", @@ -4041,13 +4041,13 @@ "properties": { "oneOf": [ { - "$ref": "#/definitions/ServiceResourceProperties" + "$ref": "#/definitions/ServiceResourceCreateUpdateProperties" }, { "$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression" } ], - "description": "Services response resource." + "description": "Properties in ServiceResourceCreateUpdateParameters." }, "type": { "type": "string", @@ -4840,21 +4840,6 @@ }, "description": "Properties of a managed Cassandra data center." }, - "DataTransferServiceResourceProperties": { - "type": "object", - "properties": { - "serviceType": { - "type": "string", - "enum": [ - "DataTransferServiceResourceProperties" - ] - } - }, - "required": [ - "serviceType" - ], - "description": "Properties for DataTransferServiceResource." - }, "DefaultRequestDatabaseAccountCreateUpdateProperties": { "type": "object", "properties": { @@ -5723,33 +5708,9 @@ } } }, - "ServiceResourceProperties": { + "ServiceResourceCreateUpdateProperties": { "type": "object", - "oneOf": [ - { - "$ref": "#/definitions/DataTransferServiceResourceProperties" - }, - { - "$ref": "#/definitions/SqlDedicatedGatewayServiceResourceProperties" - } - ], "properties": { - "additionalProperties": { - "oneOf": [ - { - "type": "object", - "additionalProperties": { - "type": "object", - "properties": {} - }, - "properties": {} - }, - { - "$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression" - } - ], - "description": "Unmatched properties from the message are deserialized this collection" - }, "instanceCount": { "oneOf": [ { @@ -5776,9 +5737,23 @@ "$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression" } ] + }, + "serviceType": { + "oneOf": [ + { + "type": "string", + "enum": [ + "SqlDedicatedGateway", + "DataTransfer" + ] + }, + { + "$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression" + } + ] } }, - "description": "Services response resource." + "description": "Properties in ServiceResourceCreateUpdateParameters." }, "SpatialSpec": { "type": "object", @@ -5963,25 +5938,6 @@ ], "description": "Cosmos DB SQL database resource object" }, - "SqlDedicatedGatewayServiceResourceProperties": { - "type": "object", - "properties": { - "serviceType": { - "type": "string", - "enum": [ - "SqlDedicatedGatewayServiceResourceProperties" - ] - }, - "sqlDedicatedGatewayEndpoint": { - "type": "string", - "description": "SqlDedicatedGateway endpoint for the service." - } - }, - "required": [ - "serviceType" - ], - "description": "Properties for SqlDedicatedGatewayServiceResource." - }, "SqlRoleAssignmentResource": { "type": "object", "properties": { diff --git a/schemas/2021-07-01-preview/Microsoft.DocumentDB.json b/schemas/2021-07-01-preview/Microsoft.DocumentDB.json index b97dcd6f72..3446b11e6c 100644 --- a/schemas/2021-07-01-preview/Microsoft.DocumentDB.json +++ b/schemas/2021-07-01-preview/Microsoft.DocumentDB.json @@ -1535,13 +1535,13 @@ "properties": { "oneOf": [ { - "$ref": "#/definitions/ServiceResourceProperties" + "$ref": "#/definitions/ServiceResourceCreateUpdateProperties" }, { "$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression" } ], - "description": "Services response resource." + "description": "Properties in ServiceResourceCreateUpdateParameters." }, "type": { "type": "string", @@ -4644,13 +4644,13 @@ "properties": { "oneOf": [ { - "$ref": "#/definitions/ServiceResourceProperties" + "$ref": "#/definitions/ServiceResourceCreateUpdateProperties" }, { "$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression" } ], - "description": "Services response resource." + "description": "Properties in ServiceResourceCreateUpdateParameters." }, "type": { "type": "string", @@ -5443,21 +5443,6 @@ }, "description": "Properties of a managed Cassandra data center." }, - "DataTransferServiceResourceProperties": { - "type": "object", - "properties": { - "serviceType": { - "type": "string", - "enum": [ - "DataTransferServiceResourceProperties" - ] - } - }, - "required": [ - "serviceType" - ], - "description": "Properties for DataTransferServiceResource." - }, "DefaultRequestDatabaseAccountCreateUpdateProperties": { "type": "object", "properties": { @@ -5504,25 +5489,6 @@ } } }, - "GraphAPIComputeServiceResourceProperties": { - "type": "object", - "properties": { - "graphApiComputeEndpoint": { - "type": "string", - "description": "GraphAPICompute endpoint for the service." - }, - "serviceType": { - "type": "string", - "enum": [ - "GraphAPIComputeServiceResourceProperties" - ] - } - }, - "required": [ - "serviceType" - ], - "description": "Properties for GraphAPIComputeServiceResource." - }, "GraphResource": { "type": "object", "properties": { @@ -6385,36 +6351,9 @@ } } }, - "ServiceResourceProperties": { + "ServiceResourceCreateUpdateProperties": { "type": "object", - "oneOf": [ - { - "$ref": "#/definitions/DataTransferServiceResourceProperties" - }, - { - "$ref": "#/definitions/SqlDedicatedGatewayServiceResourceProperties" - }, - { - "$ref": "#/definitions/GraphAPIComputeServiceResourceProperties" - } - ], "properties": { - "additionalProperties": { - "oneOf": [ - { - "type": "object", - "additionalProperties": { - "type": "object", - "properties": {} - }, - "properties": {} - }, - { - "$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression" - } - ], - "description": "Unmatched properties from the message are deserialized this collection" - }, "instanceCount": { "oneOf": [ { @@ -6441,9 +6380,24 @@ "$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression" } ] + }, + "serviceType": { + "oneOf": [ + { + "type": "string", + "enum": [ + "SqlDedicatedGateway", + "DataTransfer", + "GraphAPICompute" + ] + }, + { + "$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression" + } + ] } }, - "description": "Services response resource." + "description": "Properties in ServiceResourceCreateUpdateParameters." }, "SpatialSpec": { "type": "object", @@ -6628,25 +6582,6 @@ ], "description": "Cosmos DB SQL database resource object" }, - "SqlDedicatedGatewayServiceResourceProperties": { - "type": "object", - "properties": { - "serviceType": { - "type": "string", - "enum": [ - "SqlDedicatedGatewayServiceResourceProperties" - ] - }, - "sqlDedicatedGatewayEndpoint": { - "type": "string", - "description": "SqlDedicatedGateway endpoint for the service." - } - }, - "required": [ - "serviceType" - ], - "description": "Properties for SqlDedicatedGatewayServiceResource." - }, "SqlRoleAssignmentResource": { "type": "object", "properties": {