go-apiops version: v0.1.20
Running OS: windows 10 build 10.0.19045
Current behavior
key-auth
plugin not added.
Expected Behavior
key-auth
plugin should be added.
Steps To Reproduce
Source OAS file:
{
"openapi": "3.0.2",
"info": {
"title": "Test security",
"version": "1",
"description": "Test security plugin generation based on security/securitySchemes"
},
"paths": {
"/v1/secuire-path": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"summary": "Secuire path",
"responses": {
"204": {
"description": "Success case",
"content": {}
}
}
}
}
},
"components": {
"schemas": {},
"securitySchemes": {
"ApiKeyAuth": {
"type": "apiKey",
"name": "apikey",
"in": "header",
"x-kong-security-key-auth": {
"name": "key-auth",
"enabled": true,
"protocols": [
"http",
"https"
],
"config": {
"anonymous": null,
"hide_credentials": true,
"key_in_body": false,
"key_in_header": true,
"key_in_query": false,
"key_names": [
"apikey"
],
"run_on_preflight": true
}
}
}
}
},
"servers": [
{
"url": "http://localhost"
}
],
"security": [
{
"ApiKeyAuth": []
}
],
"x-kong-name": "security-test-service"
}
go-apiops command: go-apiops.exe openapi2kong --format json -s ./source.oas3.json -o ./kong.json --verbose 2
command logs:
2023/08/29 16:34:12 "level"=2 "msg"="received OpenAPI2Kong options" "options"={"Tags":[],"DocName":"","UUIDNamespace":"6ba7b810-9dad-11d1-80b4-00c04fd430c8"}
2023/08/29 16:34:12 "level"=1 "msg"="tags after parsing x-kong-tags" "tags"=[]
2023/08/29 16:34:12 "level"=2 "msg"="no document name specified, trying x-kong-name"
2023/08/29 16:34:12 "level"=1 "msg"="document name (namespace for UUID generation)" "name"="security-test-service"
2023/08/29 16:34:12 "level"=1 "msg"="processing path" "path"="/v1/secuire-path"
2023/08/29 16:34:12 "level"=2 "msg"="path name (namespace for UUID generation)" "name"="security-test-service_v1-secuire-path"
2023/08/29 16:34:12 "level"=1 "msg"="processing operation" "method"="GET" "path"="/v1/secuire-path" "id"=""
2023/08/29 16:34:12 "level"=2 "msg"="operation base name (namespace for UUID generation)" "name"="security-test-service_v1-secuire-path_get"
2023/08/29 16:34:12 "level"=2 "msg"="finished processing document"
generated file:
{
"_format_version": "3.0",
"services": [
{
"host": "localhost",
"id": "5419f3a2-2022-5fde-9fda-2ec6382459cc",
"name": "security-test-service",
"path": "/",
"plugins": [],
"port": 80,
"protocol": "http",
"routes": [
{
"id": "2e6d5170-acec-5d35-99da-e5f53ddb4aa0",
"methods": [
"GET"
],
"name": "security-test-service_v1-secuire-path_get",
"paths": [
"~/v1/secuire-path$"
],
"plugins": [],
"regex_priority": 200,
"strip_path": false,
"tags": []
}
],
"tags": []
}
],
"upstreams": []
}
Additional information
Using inso 3.16.0 on same file : inso generate config --format json -k 3 .\source.oas3.json -o .\kong.json
generates following content:
{
"_format_version": "3.0",
"services": [
{
"name": "security-test-service",
"protocol": "http",
"host": "localhost",
"port": 80,
"path": "/",
"plugins": [
{
"name": "key-auth",
"config": {
"key_names": [
"apikey"
],
"anonymous": null,
"hide_credentials": true,
"key_in_body": false,
"key_in_header": true,
"key_in_query": false,
"run_on_preflight": true
},
"tags": [
"OAS3_import",
"OAS3file_temp.oas3.json"
]
}
],
"routes": [
{
"tags": [
"OAS3_import",
"OAS3file_temp.oas3.json"
],
"name": "security-test-service-v1-secuire-path-get",
"methods": [
"GET"
],
"paths": [
"~/v1/secuire-path$"
],
"strip_path": false,
"plugins": [
{
"name": "key-auth",
"config": {
"key_names": [
"apikey"
],
"anonymous": null,
"hide_credentials": true,
"key_in_body": false,
"key_in_header": true,
"key_in_query": false,
"run_on_preflight": true
},
"tags": [
"OAS3_import",
"OAS3file_source.oas3.json"
]
}
]
}
],
"tags": [
"OAS3_import",
"OAS3file_source.oas3.json"
]
}
]
}