Skip to content

Commit 553e290

Browse files
committed
refactor: add test for path parameter name path fragment collision
1 parent a2e9b76 commit 553e290

File tree

4 files changed

+83
-2
lines changed

4 files changed

+83
-2
lines changed

src/apitypes/graphql/graphql.operations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import type { VersionGraphQLOperation } from './graphql.types'
1818
import { removeComponents, slugify } from '../../utils'
1919
import type { OperationsBuilder } from '../../types'
2020
import { GRAPHQL_TYPE, GRAPHQL_TYPE_KEYS } from './graphql.consts'
21-
import { INLINE_REFS_FLAG, MESSAGE_SEVERITY, NORMALIZE_OPTIONS, ORIGINS_SYMBOL } from '../../consts'
21+
import { INLINE_REFS_FLAG, NORMALIZE_OPTIONS, ORIGINS_SYMBOL } from '../../consts'
2222
import { GraphApiSchema } from '@netcracker/qubership-apihub-graphapi'
2323
import { buildGraphQLOperation } from './graphql.operation'
2424
import { asyncFunction } from '../../utils/async'

src/apitypes/rest/rest.operations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
removeComponents,
2525
} from '../../utils'
2626
import type * as TYPE from './rest.types'
27-
import { HASH_FLAG, INLINE_REFS_FLAG, MESSAGE_SEVERITY, NORMALIZE_OPTIONS, ORIGINS_SYMBOL } from '../../consts'
27+
import { HASH_FLAG, INLINE_REFS_FLAG, NORMALIZE_OPTIONS, ORIGINS_SYMBOL } from '../../consts'
2828
import { asyncFunction } from '../../utils/async'
2929
import { logLongBuild, syncDebugPerformance } from '../../utils/logs'
3030
import { normalize, RefErrorType } from '@netcracker/qubership-apihub-api-unifier'

test/bugs.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,4 +384,17 @@ describe('Operation Bugs', () => {
384384
],
385385
})).rejects.toThrow('Duplicated operation with operationId \'res-data-post\' found')
386386
})
387+
388+
//TODO: need to decide how to handle this case, this affects how operationIds are calculated
389+
test.skip('Should build operations if there is a path parameter path collision', async () => {
390+
const pkg = LocalRegistry.openPackage('path-parameter-path-collision')
391+
392+
const result = await pkg.publish(pkg.packageId, {
393+
packageId: pkg.packageId,
394+
version: 'v1',
395+
files: [
396+
{ fileId: 'spec.json' },
397+
],
398+
})
399+
})
387400
})
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"openapi": "3.0.1",
3+
"info": {
4+
"title": "REST",
5+
"description": "",
6+
"version": "1.0"
7+
},
8+
"paths": {
9+
"/api/v1/provider/{entities}": {
10+
"delete": {
11+
"summary": "Delete entities",
12+
"operationId": "deleteEntities",
13+
"parameters": [
14+
{
15+
"name": "entities",
16+
"in": "path",
17+
"description": "Entities",
18+
"required": true,
19+
"schema": {
20+
"type": "string"
21+
}
22+
}
23+
],
24+
"responses": {
25+
"200": {
26+
"description": "Entities were deleted successfully",
27+
"content": {
28+
"application/json": {
29+
"schema": {
30+
"type": "object"
31+
}
32+
}
33+
}
34+
}
35+
}
36+
}
37+
},
38+
"/api/v1/provider/entities": {
39+
"delete": {
40+
"summary": "Delete entities by key",
41+
"operationId": "deleteEntitiesByKey",
42+
"parameters": [
43+
{
44+
"name": "Key",
45+
"in": "query",
46+
"description": "key",
47+
"required": true,
48+
"schema": {
49+
"type": "string"
50+
}
51+
}
52+
],
53+
"responses": {
54+
"200": {
55+
"description": "Entities were deleted successfully",
56+
"content": {
57+
"*/*": {
58+
"schema": {
59+
"type": "object"
60+
}
61+
}
62+
}
63+
}
64+
}
65+
}
66+
}
67+
}
68+
}

0 commit comments

Comments
 (0)