Azure / Azure/apim-lab

Creating an API from OpenAPI specification results in false "duplicate signature" error.

Open
#129 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
89
Forks
111
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
When importing the following OpenApi spec with the OpenApi importer in Azure Api Management, an error is returned:

'Importing API has duplicate signature operations: 2 operations with signature 'GET /api/group-users/{id}'

**To Reproduce**
Steps to reproduce the behavior:
1. Go to Azure Api Management in portal.azure.com
2. Click on Apis
3. Click on Add Api
4. Click on Create definition from OpenAPI
5. Use the following OpenApi spec:

```
{
"x-generator": "NSwag v14.0.2.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))",
"openapi": "3.0.0",
"info": {
"title": "Test web API",
"description": "Test web API",
"version": "1.0.0"
},
"servers": [
{
"url": "https://testwebapi.com"
}
],
"paths": {
"/api/group-users/{id}": {
"get": {
"tags": [
"GroupUsers"
],
"operationId": "GroupUsers_GetById",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
},
"x-position": 1
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/groupUser"
}
}
}
},
}
}
},
"/api/group-users/{guidId}": {
"get": {
"tags": [
"GroupUsers"
],
"operationId": "GroupUsers_GetByguidId",
"parameters": [
{
"name": "guidId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "guid"
},
"x-position": 1
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/groupUser"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"groupUser": {
"readOnly": true,
"nullable": true,
"oneOf": [
{
"$ref": "#/components/schemas/GroupUser"
}
]
},"GroupUser": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "integer",
"readOnly": true,
"format": "int32"
}
}
},
}
}
}
```

**Expected behavior**
I expect the Import to succeed. There isn't a duplicate endpoint. While the definition is the same, it differs in datatype and OperationId. This is a valid open API spec.

**Screenshots**
![image](https://github.com/Azure/apim-lab/assets/14272584/8d45d023-c3cc-4a4f-98f2-6252d17754fe)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.