diff --git a/packages/openapi-2-kong/src/__fixtures__/api-with-examples.expected.json b/packages/openapi-2-kong/src/__fixtures__/api-with-examples.expected.json index 92928b4e36..f77f2c668f 100644 --- a/packages/openapi-2-kong/src/__fixtures__/api-with-examples.expected.json +++ b/packages/openapi-2-kong/src/__fixtures__/api-with-examples.expected.json @@ -44,7 +44,12 @@ } } }, - "targets": [{"target": "backend.com:80"}] + "targets": [ + { + "target": "backend.com:80", + "tags": ["OAS3_import", "OAS3file_api-with-examples.yaml"] + } + ] } ], "_format_version": "1.1" diff --git a/packages/openapi-2-kong/src/__fixtures__/callback-example.expected.json b/packages/openapi-2-kong/src/__fixtures__/callback-example.expected.json index 2b9dbfa424..616daeb84d 100644 --- a/packages/openapi-2-kong/src/__fixtures__/callback-example.expected.json +++ b/packages/openapi-2-kong/src/__fixtures__/callback-example.expected.json @@ -23,7 +23,12 @@ { "tags": ["OAS3_import", "OAS3file_callback-example.yaml"], "name": "Callback_Example", - "targets": [{"target": "backend.com:80"}] + "targets": [ + { + "target": "backend.com:80", + "tags": ["OAS3_import", "OAS3file_callback-example.yaml"] + } + ] } ], "_format_version": "1.1" diff --git a/packages/openapi-2-kong/src/__fixtures__/httpbin.expected.json b/packages/openapi-2-kong/src/__fixtures__/httpbin.expected.json index 3969143499..178bc77c59 100644 --- a/packages/openapi-2-kong/src/__fixtures__/httpbin.expected.json +++ b/packages/openapi-2-kong/src/__fixtures__/httpbin.expected.json @@ -221,7 +221,15 @@ { "tags": ["OAS3_import", "OAS3file_httpbin.yaml"], "name": "httpbin", - "targets": [{"target": "httpbin.org:443"}, {"target": "eu.httpbin.org:443"}] + "targets": [ + { + "target": "httpbin.org:443", + "tags": ["OAS3_import", "OAS3file_httpbin.yaml"] + }, { + "target": "eu.httpbin.org:443", + "tags": ["OAS3_import", "OAS3file_httpbin.yaml"] + } + ] } ], "_format_version": "1.1" diff --git a/packages/openapi-2-kong/src/__fixtures__/link-example.expected.json b/packages/openapi-2-kong/src/__fixtures__/link-example.expected.json index cf0bba47d7..621c70df5b 100644 --- a/packages/openapi-2-kong/src/__fixtures__/link-example.expected.json +++ b/packages/openapi-2-kong/src/__fixtures__/link-example.expected.json @@ -62,7 +62,12 @@ { "tags": ["OAS3_import", "OAS3file_link-example.yaml"], "name": "Link_Example", - "targets": [{"target": "backend.com:80"}] + "targets": [ + { + "target": "backend.com:80", + "tags": ["OAS3_import", "OAS3file_link-example.yaml"] + } + ] } ], "_format_version": "1.1" diff --git a/packages/openapi-2-kong/src/__fixtures__/petstore-expanded.expected.json b/packages/openapi-2-kong/src/__fixtures__/petstore-expanded.expected.json index 4ec2ba2b55..3c0c164e46 100644 --- a/packages/openapi-2-kong/src/__fixtures__/petstore-expanded.expected.json +++ b/packages/openapi-2-kong/src/__fixtures__/petstore-expanded.expected.json @@ -44,7 +44,12 @@ { "tags": ["OAS3_import", "OAS3file_petstore-expanded.yaml"], "name": "Swagger_Petstore", - "targets": [{"target": "petstore.swagger.io:80"}] + "targets": [ + { + "target": "petstore.swagger.io:80", + "tags": ["OAS3_import", "OAS3file_petstore-expanded.yaml"] + } + ] } ], "_format_version": "1.1" diff --git a/packages/openapi-2-kong/src/__fixtures__/petstore.expected.json b/packages/openapi-2-kong/src/__fixtures__/petstore.expected.json index 9f94854e62..3a51f29e5c 100644 --- a/packages/openapi-2-kong/src/__fixtures__/petstore.expected.json +++ b/packages/openapi-2-kong/src/__fixtures__/petstore.expected.json @@ -37,7 +37,12 @@ { "tags": ["OAS3_import", "OAS3file_petstore.yaml"], "name": "Swagger_Petstore", - "targets": [{"target": "petstore.swagger.io:80"}] + "targets": [ + { + "target": "petstore.swagger.io:80", + "tags": ["OAS3_import", "OAS3file_petstore.yaml"] + } + ] } ], "_format_version": "1.1" diff --git a/packages/openapi-2-kong/src/__fixtures__/request-validator-plugin.expected.json b/packages/openapi-2-kong/src/__fixtures__/request-validator-plugin.expected.json index 62ce6a5f4c..1051338bfa 100644 --- a/packages/openapi-2-kong/src/__fixtures__/request-validator-plugin.expected.json +++ b/packages/openapi-2-kong/src/__fixtures__/request-validator-plugin.expected.json @@ -122,7 +122,11 @@ ], "targets": [ { - "target": "backend.com:80" + "target": "backend.com:80", + "tags": [ + "OAS3_import", + "OAS3file_request-validator-plugin.yaml" + ] } ] } diff --git a/packages/openapi-2-kong/src/__fixtures__/security.expected.json b/packages/openapi-2-kong/src/__fixtures__/security.expected.json index d2df533baf..44b48233ee 100644 --- a/packages/openapi-2-kong/src/__fixtures__/security.expected.json +++ b/packages/openapi-2-kong/src/__fixtures__/security.expected.json @@ -76,7 +76,12 @@ { "tags": ["OAS3_import", "OAS3file_security.yaml"], "name": "Security_Example", - "targets": [{"target": "backend.com:80"}] + "targets": [ + { + "target": "backend.com:80", + "tags": ["OAS3_import", "OAS3file_security.yaml"] + } + ] } ], "_format_version": "1.1" diff --git a/packages/openapi-2-kong/src/__fixtures__/uspto.expected.json b/packages/openapi-2-kong/src/__fixtures__/uspto.expected.json index d1a4369e6c..6a33526106 100644 --- a/packages/openapi-2-kong/src/__fixtures__/uspto.expected.json +++ b/packages/openapi-2-kong/src/__fixtures__/uspto.expected.json @@ -37,7 +37,12 @@ { "tags": ["OAS3_import", "OAS3file_uspto.yaml"], "name": "USPTO_Data_Set_API", - "targets": [{"target": "developer.uspto.gov:443"}] + "targets": [ + { + "target": "developer.uspto.gov:443", + "tags": ["OAS3_import", "OAS3file_uspto.yaml"] + } + ] } ], "_format_version": "1.1" diff --git a/packages/openapi-2-kong/src/declarative-config/__tests__/upstreams.test.js b/packages/openapi-2-kong/src/declarative-config/__tests__/upstreams.test.js index 6bbc9c9eec..b1437505d0 100644 --- a/packages/openapi-2-kong/src/declarative-config/__tests__/upstreams.test.js +++ b/packages/openapi-2-kong/src/declarative-config/__tests__/upstreams.test.js @@ -11,6 +11,7 @@ const getSpecResult = () => targets: [ { target: 'server1.com:443', + tags: ['Tag'], }, ], tags: ['Tag'], diff --git a/packages/openapi-2-kong/src/declarative-config/upstreams.js b/packages/openapi-2-kong/src/declarative-config/upstreams.js index aacf56afac..546e2becdd 100644 --- a/packages/openapi-2-kong/src/declarative-config/upstreams.js +++ b/packages/openapi-2-kong/src/declarative-config/upstreams.js @@ -32,6 +32,7 @@ export function generateUpstreams(api: OpenApi3Spec, tags: Array) { if (hostWithPort) { upstream.targets.push({ target: hostWithPort, + tags, }); } } diff --git a/packages/openapi-2-kong/types/declarative-config.flow.js b/packages/openapi-2-kong/types/declarative-config.flow.js index 3e291678c7..c13090bd01 100644 --- a/packages/openapi-2-kong/types/declarative-config.flow.js +++ b/packages/openapi-2-kong/types/declarative-config.flow.js @@ -31,6 +31,7 @@ declare type DCService = {| declare type DCTarget = {| target: string, + tags: Array, |}; declare type DCUpstream = {|