-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(oas): make regex names inso compatible (#96)
- Loading branch information
Showing
10 changed files
with
391 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
208 changes: 208 additions & 0 deletions
208
openapi2kong/oas3_testfiles/02a-names-inso-compat.expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
{ | ||
"_format_version": "3.0", | ||
"services": [ | ||
{ | ||
"host": "somewhere", | ||
"id": "30e5c201-0b51-5880-a95d-014814c44d57", | ||
"name": "documentname", | ||
"path": "/", | ||
"plugins": [], | ||
"port": 80, | ||
"protocol": "http", | ||
"routes": [ | ||
{ | ||
"id": "0b8e9904-c8d8-504e-902c-773f7a39a466", | ||
"methods": [ | ||
"PUT" | ||
], | ||
"name": "documentname-put", | ||
"paths": [ | ||
"~/$" | ||
], | ||
"plugins": [], | ||
"regex_priority": 200, | ||
"strip_path": false, | ||
"tags": [ | ||
"OAS3_import", | ||
"OAS3file_02a-names-inso-compat.yaml" | ||
] | ||
}, | ||
{ | ||
"id": "fe2a90f4-707a-555c-a7d4-209102271d67", | ||
"methods": [ | ||
"GET" | ||
], | ||
"name": "documentname-Ops2", | ||
"paths": [ | ||
"~/named/path$" | ||
], | ||
"plugins": [], | ||
"regex_priority": 200, | ||
"strip_path": false, | ||
"tags": [ | ||
"OAS3_import", | ||
"OAS3file_02a-names-inso-compat.yaml" | ||
] | ||
}, | ||
{ | ||
"id": "afe41500-ce49-5eba-96d4-8eae0488da45", | ||
"methods": [ | ||
"POST" | ||
], | ||
"name": "documentname-x-kong-ops", | ||
"paths": [ | ||
"~/named/path$" | ||
], | ||
"plugins": [], | ||
"regex_priority": 200, | ||
"strip_path": false, | ||
"tags": [ | ||
"OAS3_import", | ||
"OAS3file_02a-names-inso-compat.yaml" | ||
] | ||
}, | ||
{ | ||
"id": "182d482c-e725-58b3-8f99-02d2e156d4cd", | ||
"methods": [ | ||
"PUT" | ||
], | ||
"name": "documentname-x-kong-path-put", | ||
"paths": [ | ||
"~/named/path$" | ||
], | ||
"plugins": [], | ||
"regex_priority": 200, | ||
"strip_path": false, | ||
"tags": [ | ||
"OAS3_import", | ||
"OAS3file_02a-names-inso-compat.yaml" | ||
] | ||
}, | ||
{ | ||
"id": "2fc8f8e6-c18c-5426-844d-03c19c1b2821", | ||
"methods": [ | ||
"GET" | ||
], | ||
"name": "documentname-Ops1", | ||
"paths": [ | ||
"~/plain/path$" | ||
], | ||
"plugins": [], | ||
"regex_priority": 200, | ||
"strip_path": false, | ||
"tags": [ | ||
"OAS3_import", | ||
"OAS3file_02a-names-inso-compat.yaml" | ||
] | ||
}, | ||
{ | ||
"id": "afe41500-ce49-5eba-96d4-8eae0488da45", | ||
"methods": [ | ||
"POST" | ||
], | ||
"name": "documentname-x-kong-ops", | ||
"paths": [ | ||
"~/plain/path$" | ||
], | ||
"plugins": [], | ||
"regex_priority": 200, | ||
"strip_path": false, | ||
"tags": [ | ||
"OAS3_import", | ||
"OAS3file_02a-names-inso-compat.yaml" | ||
] | ||
}, | ||
{ | ||
"id": "3672d50d-732d-5088-901d-0398f438f1b9", | ||
"methods": [ | ||
"PUT" | ||
], | ||
"name": "documentname-plain-path-put", | ||
"paths": [ | ||
"~/plain/path$" | ||
], | ||
"plugins": [], | ||
"regex_priority": 200, | ||
"strip_path": false, | ||
"tags": [ | ||
"OAS3_import", | ||
"OAS3file_02a-names-inso-compat.yaml" | ||
] | ||
}, | ||
{ | ||
"id": "a7c25823-da0f-569d-8c6d-a6a1237d81bc", | ||
"methods": [ | ||
"GET" | ||
], | ||
"name": "documentname-Ops3", | ||
"paths": [ | ||
"~/regex/path/(?<userid>[^#?/]+)$" | ||
], | ||
"plugins": [], | ||
"regex_priority": 100, | ||
"strip_path": false, | ||
"tags": [ | ||
"OAS3_import", | ||
"OAS3file_02a-names-inso-compat.yaml" | ||
] | ||
}, | ||
{ | ||
"id": "afe41500-ce49-5eba-96d4-8eae0488da45", | ||
"methods": [ | ||
"POST" | ||
], | ||
"name": "documentname-x-kong-ops", | ||
"paths": [ | ||
"~/regex/path/(?<userid>[^#?/]+)$" | ||
], | ||
"plugins": [], | ||
"regex_priority": 100, | ||
"strip_path": false, | ||
"tags": [ | ||
"OAS3_import", | ||
"OAS3file_02a-names-inso-compat.yaml" | ||
] | ||
}, | ||
{ | ||
"id": "6a9f90dd-78ef-5fab-928b-06a2ebf0d8b4", | ||
"methods": [ | ||
"PUT" | ||
], | ||
"name": "documentname-regex-path-userid-put", | ||
"paths": [ | ||
"~/regex/path/(?<userid>[^#?/]+)$" | ||
], | ||
"plugins": [], | ||
"regex_priority": 100, | ||
"strip_path": false, | ||
"tags": [ | ||
"OAS3_import", | ||
"OAS3file_02a-names-inso-compat.yaml" | ||
] | ||
}, | ||
{ | ||
"id": "8648ed96-027e-5d7f-b7d2-22d7709d1f93", | ||
"methods": [ | ||
"PUT" | ||
], | ||
"name": "documentname-weird-p-a_th-put", | ||
"paths": [ | ||
"~/weird/p-a_th$" | ||
], | ||
"plugins": [], | ||
"regex_priority": 200, | ||
"strip_path": false, | ||
"tags": [ | ||
"OAS3_import", | ||
"OAS3file_02a-names-inso-compat.yaml" | ||
] | ||
} | ||
], | ||
"tags": [ | ||
"OAS3_import", | ||
"OAS3file_02a-names-inso-compat.yaml" | ||
] | ||
} | ||
], | ||
"upstreams": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# top-name | ||
# - path | ||
# - x-kong-name set | ||
# - no x-kong-name (defaults to path) | ||
# - no x-kong-name + regex (defaults to path) | ||
# - Operation | ||
# - operationId set | ||
# - x-kong-name set | ||
# - neither set (defaults to method) | ||
|
||
|
||
openapi: 3.0.0 | ||
|
||
info: | ||
description: Learn service | ||
version: 1.0.0 | ||
title: Learn Service | ||
contact: {} | ||
|
||
servers: | ||
- url: http://somewhere | ||
|
||
x-kong-name: documentname | ||
|
||
paths: | ||
/: | ||
put: | ||
responses: | ||
'200': | ||
description: description | ||
|
||
/weird/p-a_th: | ||
put: | ||
responses: | ||
'200': | ||
description: description | ||
|
||
/plain/path: | ||
get: | ||
operationId: Ops1 | ||
responses: | ||
'200': | ||
description: description | ||
put: | ||
responses: | ||
'200': | ||
description: description | ||
post: | ||
x-kong-name: "x-kong-ops" | ||
responses: | ||
'200': | ||
description: description | ||
|
||
/named/path: | ||
x-kong-name: "x-kong-path" | ||
get: | ||
operationId: Ops2 | ||
responses: | ||
'200': | ||
description: description | ||
put: | ||
responses: | ||
'200': | ||
description: description | ||
post: | ||
x-kong-name: "x-kong-ops" | ||
responses: | ||
'200': | ||
description: description | ||
|
||
/regex/path/{userid}: | ||
get: | ||
operationId: Ops3 | ||
parameters: | ||
- name: userid | ||
in: path | ||
description: Id of the Track to delete | ||
required: true | ||
schema: {} | ||
responses: | ||
'200': | ||
description: description | ||
put: | ||
parameters: | ||
- name: userid | ||
in: path | ||
description: Id of the Track to delete | ||
required: true | ||
schema: {} | ||
responses: | ||
'200': | ||
description: description | ||
post: | ||
x-kong-name: "x-kong-ops" | ||
parameters: | ||
- name: userid | ||
in: path | ||
description: Id of the Track to delete | ||
required: true | ||
schema: {} | ||
responses: | ||
'200': | ||
description: description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,4 +86,4 @@ | |
} | ||
], | ||
"upstreams": [] | ||
} | ||
} |
Oops, something went wrong.