指定的 Swagger 版本未知。 Azure APIM ARM 模板

The Swagger version specified is unknown. Azure APIM ARM Template

只有当我通过 ARM 模板部署时,我才遇到这个问题,当我从门户尝试成功时。我认为问题可能出在我使用的版本上,所以我更改了模板中的最后 3 个版本 (https://docs.microsoft.com/en-us/azure/templates/microsoft.apimanagement/service/apis),仍然是同样的问题。有人可以指出我这里出了什么问题吗?我添加了最小复制。

大摇大摆:

{
  "openapi": "3.0.1",
  "info": {
    "title": "Test",
    "description": "Test",
    "version": "1.0"
  },
  "paths": {
    "/api/v1/test": {
      "get": {
        "tags": [
          "Test"
        ],
        "summary": "Test",
        "parameters": [
          {
            "name": "TestName",
            "in": "query",
            "schema": {
              "minLength": 3,
              "type": "string",
              "nullable": true
            }
          }
        ],
        "responses": {
          "500": {
            "description": "Server Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {

      "Error": {
        "type": "object",
        "properties": {
          "errorCode": {
            "type": "string",
            "nullable": true
          },
          "errorDescription": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      }

    }
  }
}

ARM 模板

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "ApimServiceName": {
      "type": "string"
    }
  },
  "resources": [
    {
      "properties": {
        "serviceUrl": "https://test.url",
        "path": "projects",
        "value": ***"swaggerstorageaccounturl.json",***
        "format": "swagger-link-json"
      },
      "name": "[concat(parameters('ApimServiceName'), '/Test')]",
      "type": "Microsoft.ApiManagement/service/apis",
      "apiVersion": "2020-06-01-preview",
      "dependsOn": []
    }
  ]
}

当我尝试这里提到的宠物店示例时 https://github.com/Azure/azure-quickstart-templates/blob/master/201-api-management-create-all-resources/azuredeploy.json#L139,它从模板和门户网站上都成功了。

我已经开始工作了。问题是,对于 open API 3.0.1,我们应该将格式指定为 openapi-link 而不是 swagger-json-link。这里提到, https://github.com/pulumi/pulumi-azure-nextgen/issues/160

 "properties": {
                "serviceUrl": "https;//test.url",
                "path": "test",
                "value": "https://storageaccurl.json",
                "format": "openapi-link"
            }