我的 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('{rn "', variables('schema-v1-report-name'), '": {rn "type": "object",rn "required": [rn "Email",rn "LastName",rn "Zip",rn "Subject",rn "Message",rn "CategoryId",rn "SubcategoryId",rn "RequestTypeInt"rn ],rn "properties": {rn "FirstName": {rn "type": "string"rn },rn "LastName": {rn "type": "string"rn },rn "Email": {rn "type": "string"rn },rn "Phone": {rn "type": "string"rn },rn "Zip": {rn "type": "string"rn },rn "Subject": {rn "type": "string"rn },rn "Message": {rn "type": "string"rn },rn "CategoryId": {rn "type": "string"rn },rn "SubcategoryId": {rn "type": "string"rn },rn "RequestTypeInt": {rn "type": "number"rn },rn "WantsEmailResponse": {rn "type": "boolean"rn }rn }rn }rn}')]"
}
}
}
部署 ARM 模板时,架构未正确导入,并且在 Azure 门户的 OpenAPI 规范视图中看到以下错误:
x-ms-export-notes: ->- 导出的 API 包含不属于内容类型的架构 'application/vnd.ms-azure-apim.swagger.definitions+json',因此不是 导出为招摇定义。
我根据Joy Wang的链接遵循了ARM模板。这让我完成了90%的路程。问题是对于每个操作的 schemaId,我使用了定义名称(或类型名称(,但它应该是架构资源的 id。