mirror of
https://github.com/Kong/insomnia.git
synced 2026-05-18 21:55:38 -04:00
* Add failing fixtures that repro #4432 * Add test for generateSlug * Fix #4432. Pin slugify to 1.6.5.
This commit is contained in:
16
packages/openapi-2-kong/package-lock.json
generated
16
packages/openapi-2-kong/package-lock.json
generated
@@ -10,7 +10,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"openapi-types": "^8.0.0",
|
||||
"slugify": "^1.3.6",
|
||||
"slugify": "1.6.5",
|
||||
"swagger-parser": "^10.0.3",
|
||||
"url-join": "^4.0.1",
|
||||
"yaml": "2.0.0-5"
|
||||
@@ -7015,11 +7015,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/slugify": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/slugify/-/slugify-1.3.6.tgz",
|
||||
"integrity": "sha512-wA9XS475ZmGNlEnYYLPReSfuz/c3VQsEMoU43mi6OnKMCdbnFXd4/Yg7J0lBv8jkPolacMpOrWEaoYxuE1+hoQ==",
|
||||
"version": "1.6.5",
|
||||
"resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.5.tgz",
|
||||
"integrity": "sha512-8mo9bslnBO3tr5PEVFzMPIWwWnipGS0xVbYf65zxDqfNwmzYn1LpiKNrR6DlClusuvo+hDHd1zKpmfAe83NQSQ==",
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
"node": ">=8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/snapdragon": {
|
||||
@@ -13693,9 +13693,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"slugify": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/slugify/-/slugify-1.3.6.tgz",
|
||||
"integrity": "sha512-wA9XS475ZmGNlEnYYLPReSfuz/c3VQsEMoU43mi6OnKMCdbnFXd4/Yg7J0lBv8jkPolacMpOrWEaoYxuE1+hoQ=="
|
||||
"version": "1.6.5",
|
||||
"resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.5.tgz",
|
||||
"integrity": "sha512-8mo9bslnBO3tr5PEVFzMPIWwWnipGS0xVbYf65zxDqfNwmzYn1LpiKNrR6DlClusuvo+hDHd1zKpmfAe83NQSQ=="
|
||||
},
|
||||
"snapdragon": {
|
||||
"version": "0.8.2",
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"openapi-types": "^8.0.0",
|
||||
"slugify": "^1.3.6",
|
||||
"slugify": "1.6.5",
|
||||
"swagger-parser": "^10.0.3",
|
||||
"url-join": "^4.0.1",
|
||||
"yaml": "2.0.0-5"
|
||||
|
||||
@@ -177,6 +177,7 @@ describe('common', () => {
|
||||
expect(generateSlug('foo bar')).toBe('foo_bar');
|
||||
expect(generateSlug('foo, bar')).toBe('foo_bar');
|
||||
expect(generateSlug('Foo Bar')).toBe('Foo_Bar');
|
||||
expect(generateSlug('Foo-Bar')).toBe('Foo-Bar');
|
||||
expect(
|
||||
generateSlug('foo bar', {
|
||||
replacement: '?',
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_api-with-examples.yaml"],
|
||||
"name": "Simple_API_overview-x_kong_name_override_at_method",
|
||||
"name": "Simple_API_overview-x-kong-name-override-at-method",
|
||||
"paths": ["/$"]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"_format_version": "1.1",
|
||||
"services": [
|
||||
{
|
||||
"name": "Sample-API",
|
||||
"protocol": "https",
|
||||
"host": "example.com",
|
||||
"port": 443,
|
||||
"path": "/",
|
||||
"plugins": [],
|
||||
"routes": [
|
||||
{
|
||||
"tags": [
|
||||
"OAS3_import",
|
||||
"OAS3file_dash-and-underscore.yaml"
|
||||
],
|
||||
"name": "Sample-API-list-get",
|
||||
"methods": [
|
||||
"GET"
|
||||
],
|
||||
"paths": [
|
||||
"/list$"
|
||||
],
|
||||
"strip_path": false
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"OAS3_import",
|
||||
"OAS3file_dash-and-underscore.yaml"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
version: 1.0.0
|
||||
title: Sample-API
|
||||
servers:
|
||||
- url: https://example.com
|
||||
paths:
|
||||
/list:
|
||||
get:
|
||||
description: Returns a list of stuff
|
||||
responses:
|
||||
'200':
|
||||
description: Successful response
|
||||
@@ -19,7 +19,7 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_httpbin.yaml"],
|
||||
"name": "httpbin-basic_auth_user_password-get",
|
||||
"name": "httpbin-basic-auth-user-password-get",
|
||||
"plugins": [
|
||||
{
|
||||
"config": { "hide_credentials": true },
|
||||
@@ -33,14 +33,14 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_httpbin.yaml"],
|
||||
"name": "httpbin-image_format-get",
|
||||
"name": "httpbin-image-format-get",
|
||||
"paths": ["/image/(?<format>[^\\/]+)$"]
|
||||
},
|
||||
{
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_httpbin.yaml"],
|
||||
"name": "httpbin-delay_n-get",
|
||||
"name": "httpbin-delay-n-get",
|
||||
"paths": ["/delay/(?<n>[^\\/]+)$"]
|
||||
},
|
||||
{
|
||||
@@ -54,49 +54,49 @@
|
||||
"methods": ["DELETE"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_httpbin.yaml"],
|
||||
"name": "httpbin-status_statusCode-delete",
|
||||
"name": "httpbin-status-statusCode-delete",
|
||||
"paths": ["/status/(?<statusCode>[^\\/]+)$"]
|
||||
},
|
||||
{
|
||||
"methods": ["PUT"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_httpbin.yaml"],
|
||||
"name": "httpbin-status_statusCode-put",
|
||||
"name": "httpbin-status-statusCode-put",
|
||||
"paths": ["/status/(?<statusCode>[^\\/]+)$"]
|
||||
},
|
||||
{
|
||||
"methods": ["PATCH"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_httpbin.yaml"],
|
||||
"name": "httpbin-status_statusCode-patch",
|
||||
"name": "httpbin-status-statusCode-patch",
|
||||
"paths": ["/status/(?<statusCode>[^\\/]+)$"]
|
||||
},
|
||||
{
|
||||
"methods": ["POST"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_httpbin.yaml"],
|
||||
"name": "httpbin-status_statusCode-post",
|
||||
"name": "httpbin-status-statusCode-post",
|
||||
"paths": ["/status/(?<statusCode>[^\\/]+)$"]
|
||||
},
|
||||
{
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_httpbin.yaml"],
|
||||
"name": "httpbin-status_statusCode-get",
|
||||
"name": "httpbin-status-statusCode-get",
|
||||
"paths": ["/status/(?<statusCode>[^\\/]+)$"]
|
||||
},
|
||||
{
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_httpbin.yaml"],
|
||||
"name": "httpbin-user_agent-get",
|
||||
"name": "httpbin-user-agent-get",
|
||||
"paths": ["/user-agent$"]
|
||||
},
|
||||
{
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_httpbin.yaml"],
|
||||
"name": "httpbin-hidden_basic_auth_user_password-get",
|
||||
"name": "httpbin-hidden-basic-auth-user-password-get",
|
||||
"plugins": [
|
||||
{
|
||||
"config": { "hide_credentials": true },
|
||||
@@ -146,7 +146,7 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_httpbin.yaml"],
|
||||
"name": "httpbin-cookies_delete-get",
|
||||
"name": "httpbin-cookies-delete-get",
|
||||
"paths": ["/cookies/delete$"]
|
||||
},
|
||||
{
|
||||
@@ -160,7 +160,7 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_httpbin.yaml"],
|
||||
"name": "httpbin-parse_machine_timestamp-get",
|
||||
"name": "httpbin-parse-machine_timestamp-get",
|
||||
"paths": ["/parse/(?<machine_timestamp>[^\\/]+)$"]
|
||||
},
|
||||
{
|
||||
@@ -188,7 +188,7 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_httpbin.yaml"],
|
||||
"name": "httpbin-when_human_timestamp-get",
|
||||
"name": "httpbin-when-human_timestamp-get",
|
||||
"plugins": [
|
||||
{
|
||||
"name": "request-validator",
|
||||
@@ -236,7 +236,7 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_httpbin.yaml"],
|
||||
"name": "httpbin-cookies_set-get",
|
||||
"name": "httpbin-cookies-set-get",
|
||||
"paths": ["/cookies/set$"]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_no-targets-example.yaml"],
|
||||
"name": "Simple_API_overview-x_kong_name_override_at_method",
|
||||
"name": "Simple_API_overview-x-kong-name-override-at-method",
|
||||
"paths": ["/$"]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -15,5 +15,4 @@
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
},
|
||||
{
|
||||
"methods": ["GET"],
|
||||
"name": "Example-params_pathid-get",
|
||||
"name": "Example-params-pathid-get",
|
||||
"paths": ["/params/(?<pathid>[^\\/]+)/$"],
|
||||
"plugins": [
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_security.yaml"],
|
||||
"name": "Security_Example-only_oath2-get",
|
||||
"name": "Security_Example-only-oath2-get",
|
||||
"plugins": [
|
||||
{
|
||||
"config": { "auth_methods": ["client_credentials"] },
|
||||
@@ -26,7 +26,7 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_security.yaml"],
|
||||
"name": "Security_Example-only_key-get",
|
||||
"name": "Security_Example-only-key-get",
|
||||
"plugins": [
|
||||
{
|
||||
"config": { "key_names": ["api_key_by_me"] },
|
||||
@@ -40,7 +40,7 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_security.yaml"],
|
||||
"name": "Security_Example-and_based_auth-get",
|
||||
"name": "Security_Example-and-based-auth-get",
|
||||
"plugins": [
|
||||
{
|
||||
"config": { "auth_methods": ["client_credentials"] },
|
||||
@@ -54,7 +54,7 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_security.yaml"],
|
||||
"name": "Security_Example-or_based_auth-get",
|
||||
"name": "Security_Example-or-based-auth-get",
|
||||
"plugins": [
|
||||
{
|
||||
"config": { "key_names": ["api_key_by_me"] },
|
||||
@@ -68,7 +68,7 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_security.yaml"],
|
||||
"name": "Security_Example-only_oidc-get",
|
||||
"name": "Security_Example-only-oidc-get",
|
||||
"plugins": [
|
||||
{
|
||||
"config": {
|
||||
@@ -85,7 +85,7 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_security.yaml"],
|
||||
"name": "Security_Example-only_basic-get",
|
||||
"name": "Security_Example-only-basic-get",
|
||||
"plugins": [
|
||||
{
|
||||
"name": "basic-auth",
|
||||
|
||||
@@ -12,21 +12,21 @@
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_uspto.yaml"],
|
||||
"name": "USPTO_Data_Set_API-list_data_sets",
|
||||
"name": "USPTO_Data_Set_API-list-data-sets",
|
||||
"paths": ["/$"]
|
||||
},
|
||||
{
|
||||
"methods": ["GET"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_uspto.yaml"],
|
||||
"name": "USPTO_Data_Set_API-list_searchable_fields",
|
||||
"name": "USPTO_Data_Set_API-list-searchable-fields",
|
||||
"paths": ["/(?<dataset>[^\\/]+)/(?<version>[^\\/]+)/fields$"]
|
||||
},
|
||||
{
|
||||
"methods": ["POST"],
|
||||
"strip_path": false,
|
||||
"tags": ["OAS3_import", "OAS3file_uspto.yaml"],
|
||||
"name": "USPTO_Data_Set_API-perform_search",
|
||||
"name": "USPTO_Data_Set_API-perform-search",
|
||||
"paths": ["/(?<dataset>[^\\/]+)/(?<version>[^\\/]+)/records$"]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -35,7 +35,7 @@ const compare = (expected: string, pathItem: OA3PathItem) => {
|
||||
|
||||
describe('names', () => {
|
||||
it("api.paths[path][method]['x-kong-name'] is highest priority", () => {
|
||||
compare('Nebulo_9-method_smash', {
|
||||
compare('Nebulo_9-method-smash', {
|
||||
[xKongName]: 'pathItem-smash',
|
||||
post: {
|
||||
[xKongName]: 'method-smash',
|
||||
@@ -45,7 +45,7 @@ describe('names', () => {
|
||||
});
|
||||
|
||||
it('api.paths[path][method].operationId is second priority (and not slugified)', () => {
|
||||
compare('Nebulo_9-operationId_smash', {
|
||||
compare('Nebulo_9-operationId-smash', {
|
||||
[xKongName]: 'pathItem-smash',
|
||||
post: {
|
||||
operationId: 'operationId-smash',
|
||||
@@ -54,14 +54,14 @@ describe('names', () => {
|
||||
});
|
||||
|
||||
it("api.paths[path]['x-kong-name'] is third priority", () => {
|
||||
compare('Nebulo_9-pathItem_smash-post', {
|
||||
compare('Nebulo_9-pathItem-smash-post', {
|
||||
[xKongName]: 'pathItem-smash',
|
||||
post: {},
|
||||
});
|
||||
});
|
||||
|
||||
it('purely generated is fourth priority', () => {
|
||||
compare('Nebulo_9-planet_smasher-post', {
|
||||
compare('Nebulo_9-planet-smasher-post', {
|
||||
post: {},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -38,7 +38,7 @@ const getSpecResult = (): DCService =>
|
||||
tags,
|
||||
},
|
||||
{
|
||||
name: 'My_API-birds_id-get',
|
||||
name: 'My_API-birds-id-get',
|
||||
strip_path: false,
|
||||
methods: ['GET'],
|
||||
paths: ['/birds/(?<id>[^\\/]+)$'],
|
||||
@@ -251,7 +251,7 @@ describe('services', () => {
|
||||
},
|
||||
{
|
||||
tags,
|
||||
name: 'My_API-birds_id-get',
|
||||
name: 'My_API-birds-id-get',
|
||||
methods: ['GET'],
|
||||
paths: ['/birds/(?<id>[^\\/]+)$'],
|
||||
strip_path: false,
|
||||
|
||||
Reference in New Issue
Block a user