我在ARM模板中定义了以下架构:
{
"name": "[concat(variables('api-v1-operation-prefix'), '/', variables('schema-v1-report-name'))]",
"type": "Microsoft.ApiManagement/service/apis/schemas",
"apiVersion": "2018-01-01",
"properties": {
"contentType": "application/json",
"document": {
"value": "[concat('{\r\n \"', variables('schema-v1-report-name'), '\": {\r\n \"type\": \"object\",\r\n \"required\": [\r\n \"Email\",\r\n \"LastName\",\r\n \"Zip\",\r\n \"Subject\",\r\n \"Message\",\r\n \"CategoryId\",\r\n \"SubcategoryId\",\r\n \"RequestTypeInt\"\r\n ],\r\n \"properties\": {\r\n \"FirstName\": {\r\n \"type\": \"string\"\r\n },\r\n \"LastName\": {\r\n \"type\": \"string\"\r\n },\r\n \"Email\": {\r\n \"type\": \"string\"\r\n },\r\n \"Phone\": {\r\n \"type\": \"string\"\r\n },\r\n \"Zip\": {\r\n \"type\": \"string\"\r\n },\r\n \"Subject\": {\r\n \"type\": \"string\"\r\n },\r\n \"Message\": {\r\n \"type\": \"string\"\r\n },\r\n \"CategoryId\": {\r\n \"type\": \"string\"\r\n },\r\n \"SubcategoryId\": {\r\n \"type\": \"string\"\r\n },\r\n \"RequestTypeInt\": {\r\n \"type\": \"number\"\r\n },\r\n \"WantsEmailResponse\": {\r\n \"type\": \"boolean\"\r\n }\r\n }\r\n }\r\n}')]"
}
}
}
当我部署ARM模板时,无法正确导入架构,并且在Azure门户的OpenAPI规范视图中看到以下错误:
x-ms-export-notes: ->- 导出的API包含非内容类型的架构 'application / vnd.ms-azure-apim.swagger.definitions + json',因此不是 导出为Swagger定义。
答案 0 :(得分:0)
我遵循基于Joy Wang链接的ARM模板。这让我有90%的路途。问题在于,对于每个操作的schemaId,我都使用了定义名称(或类型名称),但它应该是架构资源的ID。