将 .Net Core API 导入并部署到 Azure API 管理

Importing and Deploying .Net Core API to Azure API Managment

我一直在尝试创建 .Net Core API 并将其发布到 Azure。我按照 this example to create the API. Once the API is created, I followed this 示例将其发布到 Azure。我能够成功调用 API。我正在尝试将此 API 导入到我的 API 管理中,但我一直收到错误消息

One or more fields contain incorrect values: Parsing error(s): Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1.

我是不是漏掉了什么?既然我已经将 API 发布到 Azure,为什么我还需要将其导入并发布到我的 API 管理?

这是 azure api 管理中错误消息的屏幕截图:

如果您在导入 OpenAPI 文档时遇到错误,确保您已对其进行验证 - 使用 Azure 门户中的设计器(设计 - 前端 -打开API 规范编辑器),或使用 third-party 工具,例如 Swagger Editor.

·OpenAPI只支持JSON格式。

·路径和查询中的必需参数必须具有唯一的名称。 (在 OpenAPI 中,参数名称只需要在一个位置内是唯一的,例如路径、查询、header。但是,在 API 管理中,我们允许通过路径和查询参数(OpenAPI 不支持)。因此我们要求参数名称在整个 URL 模板中是唯一的。)

·使用 $ref 属性引用的模式不能包含其他 $ref 属性。

·$ref 指针不能引用外部文件。

·x-ms-pathsx-servers 是唯一支持的扩展。

·自定义扩展名在导入时被忽略,并且不保存或保留以供导出。

更多详情,您可以参考这篇article