Azure API管理导入API总是说:具有指定名称的API已经存在 [英] Azure API Management Import API always says: API with specified name already exists

查看:97
本文介绍了Azure API管理导入API总是说:具有指定名称的API已经存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用摇头把我拥有的API导入到Azure API管理中,应该相当简单,但是我总是会遇到相同的错误:

I am trying to import an API I have into Azure API Management using swagger, should be fairly simple but I always get the same error:

一个或多个字段包含不正确的值:具有指定名称的API 已经存在

One or more fields contain incorrect values: API with specified name already exists

我还没有在Azure API管理中进行任何设置,非常令人沮丧.

I do not have ANYTHING setup in Azure API management yet, very frustrating.

更新

我正在使用Swashbuckle( https://github.com/domaindrivendev/Swashbuckle )添加Swagger到我的WebAPI项目.

I am using Swashbuckle (https://github.com/domaindrivendev/Swashbuckle) to add Swagger to my WebAPI project.

它正在生成Swagger 2.0文档.

It is generating Swagger 2.0 docs.

这是Swagger Doc的信息元素:

Here is the info element of the Swagger Doc:

swagger: "2.0",
info: {
version: "v3",
title: "ShopZioAPIv3"
},

无论将其更改为什么,我始终会得到:

It does not matter what I change that to, I still always get:

一个或多个字段包含不正确的值:具有指定名称的API 已经存在

One or more fields contain incorrect values: API with specified name already exists

推荐答案

当您未指定唯一的API前缀时,将显示该错误消息.

That error message appears when you don't specify a unique API prefix.

我意识到您说过,如果您可以尝试在此字段中添加一些唯一值,则您尚未在API中设置任何内容:

I realize that you said that you don't have anything already already setup in the API however, if you could try putting some unique value in this field:

API管理服务实例旨在承载多个API,因此前缀用于通过使用路径的第一部分来区分这些API.

An API Management service instance is designed to host multiple APIs, so the prefix is used to differentiate between the APIs by using the first part of the path.

URL的子域部分用于标识服务.例如

The subdomain part of the URL is used to identify the service. e.g.

http://{servicename}.azure-api.net{/api-prefix}/path/segment?param=value


更新

基于提供的Swagger,问题来自具有相同OperationId的多个操作对象.这是无效的招摇.


Update

Based on the provided Swagger, the problem comes from multiple operation objects with the same OperationId. This is invalid swagger.

通常,在生成具有重复ID的操作之前,Swashbuckle将失败.有一个ResolveConflictingActions方法,允许您放置自己的代码来处理这些情况.在这种情况下,解决方案代码似乎没有做正确的事.

Usually Swashbuckle will fail before generating operations with duplicate Ids. There is a ResolveConflictingActions method that allow you to put your own code to deal with these cases. It seems like in this case the resolution code is not doing the right thing.

这篇关于Azure API管理导入API总是说:具有指定名称的API已经存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆