From c8970b966b53dccc66059ec8f3f723f151238ba0 Mon Sep 17 00:00:00 2001 From: Samir Solanki Date: Wed, 1 May 2019 09:02:47 -0700 Subject: [PATCH 1/3] Fix support for Api Schema Create Or update --- .../stable/2019-01-01/apimapis.json | 2 +- .../stable/2019-01-01/definitions.json | 37 +++++++++++++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/apimapis.json b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/apimapis.json index 4be9ae56fea6..a48e9aaa738d 100644 --- a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/apimapis.json +++ b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/apimapis.json @@ -2296,7 +2296,7 @@ "in": "body", "required": true, "schema": { - "$ref": "./definitions.json#/definitions/SchemaContract" + "$ref": "./definitions.json#/definitions/SchemaCreateOrUpdateContract" }, "description": "The schema contents to apply." }, diff --git a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/definitions.json b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/definitions.json index a30b246295a7..3a115c235267 100644 --- a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/definitions.json +++ b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/definitions.json @@ -4209,6 +4209,21 @@ }, "description": "The response of the list schema operation." }, + "SchemaCreateOrUpdateContract": { + "properties": { + "properties": { + "x-ms-client-flatten": true, + "$ref": "#/definitions/SchemaCreateOrUpdateProperties", + "description": "Properties of the Schema." + } + }, + "allOf": [ + { + "$ref": "./apimanagement.json#/definitions/Resource" + } + ], + "description": "Schema Contract details." + }, "SchemaContract": { "properties": { "properties": { @@ -4228,11 +4243,10 @@ "properties": { "contentType": { "type": "string", - "description": "Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml)." + "description": "Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). - Swagger Schema use application/vnd.ms-azure-apim.swagger.definitions+json, - WSDL Schema use application/vnd.ms-azure-apim.xsd+xml, -OpenApi Schema use application/vnd.oai.openapi.components+json, -WADL Schema use application/vnd.ms-azure-apim.wadl.grammars+xml. " }, "document": { - "x-ms-client-flatten": true, - "$ref": "#/definitions/SchemaDocumentProperties", + "type": "object", "description": "Properties of the Schema Document." } }, @@ -4241,6 +4255,23 @@ ], "description": "Schema contract Properties." }, + "SchemaCreateOrUpdateProperties": { + "properties": { + "contentType": { + "type": "string", + "description": "Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). - Swagger Schema use application/vnd.ms-azure-apim.swagger.definitions+json, - WSDL Schema use application/vnd.ms-azure-apim.xsd+xml, -OpenApi Schema use application/vnd.oai.openapi.components+json, -WADL Schema use application/vnd.ms-azure-apim.wadl.grammars+xml." + }, + "document": { + "x-ms-client-flatten": true, + "$ref": "#/definitions/SchemaDocumentProperties", + "description": "Create or update Properties of the Schema Document." + } + }, + "required": [ + "contentType" + ], + "description": "API Schema create or update contract Properties." + }, "SchemaDocumentProperties": { "properties": { "value": { From fc2b834a69b907c626e186bf0b4e5629c69eaf83 Mon Sep 17 00:00:00 2001 From: Samir Solanki Date: Wed, 1 May 2019 10:00:22 -0700 Subject: [PATCH 2/3] add example for schemas --- .../stable/2019-01-01/apimapis.json | 3 + .../stable/2019-01-01/definitions.json | 4 +- .../ApiManagementCreateApiSchemaSwagger.json | 158 ++++++++++++++++++ 3 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/examples/ApiManagementCreateApiSchemaSwagger.json diff --git a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/apimapis.json b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/apimapis.json index a48e9aaa738d..ebaf0a1050ec 100644 --- a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/apimapis.json +++ b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/apimapis.json @@ -2276,6 +2276,9 @@ "x-ms-examples": { "ApiManagementCreateApiSchema": { "$ref": "./examples/ApiManagementCreateApiSchema.json" + }, + "ApiManagementCreateApiSchemaSwagger": { + "$ref": "./examples/ApiManagementCreateApiSchemaSwagger.json" } }, "parameters": [ diff --git a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/definitions.json b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/definitions.json index 3a115c235267..caddd83c3ee1 100644 --- a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/definitions.json +++ b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/definitions.json @@ -4243,7 +4243,7 @@ "properties": { "contentType": { "type": "string", - "description": "Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). - Swagger Schema use application/vnd.ms-azure-apim.swagger.definitions+json, - WSDL Schema use application/vnd.ms-azure-apim.xsd+xml, -OpenApi Schema use application/vnd.oai.openapi.components+json, -WADL Schema use application/vnd.ms-azure-apim.wadl.grammars+xml. " + "description": "Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml).
- `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json`
- `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml`
- `OpenApi` Schema use `application/vnd.oai.openapi.components+json`
- `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`. " }, "document": { "type": "object", @@ -4259,7 +4259,7 @@ "properties": { "contentType": { "type": "string", - "description": "Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). - Swagger Schema use application/vnd.ms-azure-apim.swagger.definitions+json, - WSDL Schema use application/vnd.ms-azure-apim.xsd+xml, -OpenApi Schema use application/vnd.oai.openapi.components+json, -WADL Schema use application/vnd.ms-azure-apim.wadl.grammars+xml." + "description": "Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml).
- `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json`
- `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml`
- `OpenApi` Schema use `application/vnd.oai.openapi.components+json`
- `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`." }, "document": { "x-ms-client-flatten": true, diff --git a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/examples/ApiManagementCreateApiSchemaSwagger.json b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/examples/ApiManagementCreateApiSchemaSwagger.json new file mode 100644 index 000000000000..521ec913b5c9 --- /dev/null +++ b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/examples/ApiManagementCreateApiSchemaSwagger.json @@ -0,0 +1,158 @@ +{ + "parameters": { + "serviceName": "apimService1", + "resourceGroupName": "rg1", + "api-version": "2019-01-01", + "subscriptionId": "subid", + "apiId": "swagger-petstore-extensive", + "schemaId": "5cc9cf67e6ed3b1154e638bd", + "parameters": { + "properties": { + "contentType": "application/vnd.ms-azure-apim.swagger.definitions+json", + "document": { + "value": "{\r\n \"pet\": {\r\n \"required\": [\"id\",\r\n \"name\"],\r\n \"externalDocs\": {\r\n \"description\": \"findmoreinfohere\",\r\n \"url\": \"https: //helloreverb.com/about\"\r\n },\r\n \"properties\": {\r\n \"id\": {\r\n \"type\": \"integer\",\r\n \"format\": \"int64\"\r\n },\r\n \"name\": {\r\n \"type\": \"string\"\r\n },\r\n \"tag\": {\r\n \"type\": \"string\"\r\n }\r\n }\r\n },\r\n \"newPet\": {\r\n \"allOf\": [{\r\n \"$ref\": \"pet\"\r\n },\r\n {\r\n \"required\": [\"name\"],\r\n \"id\": {\r\n \"properties\": {\r\n \"type\": \"integer\",\r\n \"format\": \"int64\"\r\n }\r\n }\r\n }]\r\n },\r\n \"errorModel\": {\r\n \"required\": [\"code\",\r\n \"message\"],\r\n \"properties\": {\r\n \"code\": {\r\n \"type\": \"integer\",\r\n \"format\": \"int32\"\r\n },\r\n \"message\": {\r\n \"type\": \"string\"\r\n }\r\n }\r\n }\r\n }" + } + } + } + }, + "responses": { + "201": { + "body": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/swagger-petstore-extensive/schemas/5cc9cf67e6ed3b1154e638bd", + "type": "Microsoft.ApiManagement/service/apis/schemas", + "name": "5cc9cf67e6ed3b1154e638bd", + "properties": { + "contentType": "application/vnd.ms-azure-apim.swagger.definitions+json", + "document": { + "definitions": { + "pet": { + "required": [ + "id", + "name" + ], + "externalDocs": { + "description": "findmoreinfohere", + "url": "https: //helloreverb.com/about" + }, + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + "newPet": { + "allOf": [ + { + "$ref": "pet" + }, + { + "required": [ + "name" + ], + "id": { + "properties": { + "type": "integer", + "format": "int64" + } + } + } + ] + }, + "errorModel": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } + } + } + } + }, + "200": { + "body": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/swagger-petstore-extensive/schemas/5cc9cf67e6ed3b1154e638bd", + "type": "Microsoft.ApiManagement/service/apis/schemas", + "name": "5cc9cf67e6ed3b1154e638bd", + "properties": { + "contentType": "application/vnd.ms-azure-apim.swagger.definitions+json", + "document": { + "definitions": { + "pet": { + "required": [ + "id", + "name" + ], + "externalDocs": { + "description": "findmoreinfohere", + "url": "https: //helloreverb.com/about" + }, + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + "newPet": { + "allOf": [ + { + "$ref": "pet" + }, + { + "required": [ + "name" + ], + "id": { + "properties": { + "type": "integer", + "format": "int64" + } + } + } + ] + }, + "errorModel": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } + } + } + } + } + } +} \ No newline at end of file From f9937fa8696c045834ae3ee9dab28637bc344f87 Mon Sep 17 00:00:00 2001 From: Samir Solanki Date: Wed, 1 May 2019 10:31:52 -0700 Subject: [PATCH 3/3] remove the example causing failures --- .../stable/2019-01-01/apimapis.json | 3 - .../ApiManagementCreateApiSchemaSwagger.json | 158 ------------------ 2 files changed, 161 deletions(-) delete mode 100644 specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/examples/ApiManagementCreateApiSchemaSwagger.json diff --git a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/apimapis.json b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/apimapis.json index ebaf0a1050ec..a48e9aaa738d 100644 --- a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/apimapis.json +++ b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/apimapis.json @@ -2276,9 +2276,6 @@ "x-ms-examples": { "ApiManagementCreateApiSchema": { "$ref": "./examples/ApiManagementCreateApiSchema.json" - }, - "ApiManagementCreateApiSchemaSwagger": { - "$ref": "./examples/ApiManagementCreateApiSchemaSwagger.json" } }, "parameters": [ diff --git a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/examples/ApiManagementCreateApiSchemaSwagger.json b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/examples/ApiManagementCreateApiSchemaSwagger.json deleted file mode 100644 index 521ec913b5c9..000000000000 --- a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/examples/ApiManagementCreateApiSchemaSwagger.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "parameters": { - "serviceName": "apimService1", - "resourceGroupName": "rg1", - "api-version": "2019-01-01", - "subscriptionId": "subid", - "apiId": "swagger-petstore-extensive", - "schemaId": "5cc9cf67e6ed3b1154e638bd", - "parameters": { - "properties": { - "contentType": "application/vnd.ms-azure-apim.swagger.definitions+json", - "document": { - "value": "{\r\n \"pet\": {\r\n \"required\": [\"id\",\r\n \"name\"],\r\n \"externalDocs\": {\r\n \"description\": \"findmoreinfohere\",\r\n \"url\": \"https: //helloreverb.com/about\"\r\n },\r\n \"properties\": {\r\n \"id\": {\r\n \"type\": \"integer\",\r\n \"format\": \"int64\"\r\n },\r\n \"name\": {\r\n \"type\": \"string\"\r\n },\r\n \"tag\": {\r\n \"type\": \"string\"\r\n }\r\n }\r\n },\r\n \"newPet\": {\r\n \"allOf\": [{\r\n \"$ref\": \"pet\"\r\n },\r\n {\r\n \"required\": [\"name\"],\r\n \"id\": {\r\n \"properties\": {\r\n \"type\": \"integer\",\r\n \"format\": \"int64\"\r\n }\r\n }\r\n }]\r\n },\r\n \"errorModel\": {\r\n \"required\": [\"code\",\r\n \"message\"],\r\n \"properties\": {\r\n \"code\": {\r\n \"type\": \"integer\",\r\n \"format\": \"int32\"\r\n },\r\n \"message\": {\r\n \"type\": \"string\"\r\n }\r\n }\r\n }\r\n }" - } - } - } - }, - "responses": { - "201": { - "body": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/swagger-petstore-extensive/schemas/5cc9cf67e6ed3b1154e638bd", - "type": "Microsoft.ApiManagement/service/apis/schemas", - "name": "5cc9cf67e6ed3b1154e638bd", - "properties": { - "contentType": "application/vnd.ms-azure-apim.swagger.definitions+json", - "document": { - "definitions": { - "pet": { - "required": [ - "id", - "name" - ], - "externalDocs": { - "description": "findmoreinfohere", - "url": "https: //helloreverb.com/about" - }, - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - }, - "newPet": { - "allOf": [ - { - "$ref": "pet" - }, - { - "required": [ - "name" - ], - "id": { - "properties": { - "type": "integer", - "format": "int64" - } - } - } - ] - }, - "errorModel": { - "required": [ - "code", - "message" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } - } - } - }, - "200": { - "body": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/swagger-petstore-extensive/schemas/5cc9cf67e6ed3b1154e638bd", - "type": "Microsoft.ApiManagement/service/apis/schemas", - "name": "5cc9cf67e6ed3b1154e638bd", - "properties": { - "contentType": "application/vnd.ms-azure-apim.swagger.definitions+json", - "document": { - "definitions": { - "pet": { - "required": [ - "id", - "name" - ], - "externalDocs": { - "description": "findmoreinfohere", - "url": "https: //helloreverb.com/about" - }, - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - }, - "newPet": { - "allOf": [ - { - "$ref": "pet" - }, - { - "required": [ - "name" - ], - "id": { - "properties": { - "type": "integer", - "format": "int64" - } - } - } - ] - }, - "errorModel": { - "required": [ - "code", - "message" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } - } - } - } - } -} \ No newline at end of file