Swagger/OpenAPI definition:
{
"swagger": "2.0",
"securityDefinitions": {
"auth-token": {
"type": "apiKey",
"in": "header",
"name": "auth-token"
}
},
"security": {
"auth-token": []
},
"info": {
"title": "AdminAPI.proto",
"version": "version not set"
},
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/admin/api/v1/GetAllExecutionStats": {
"post": {
"summary": "ExecutionStats",
"operationId": "GetAllExecutionStats",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/AdminAPIGetAllExecutionStatsResp"
}
}
},
"parameters": [{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/AdminAPIGetAllExecutionStatsReq"
}
}],
"tags": [
"Admin"
]
}
},
...
}
Error
system.js:461 TypeError: v.forEach is not a function
at o (index.js:1)
at t.default (index.js:1)
at Object.o [as buildRequest] (index.js:1)
at actions.js:402
at utils.js:121
at bindActionCreators.js:3
at wrap-actions.js:30
at Object.r (system.js:173)
at Object.executeRequest (system.js:458)
at actions.js:442
I get this error when I have the anything set for the auth-token. It even happens if i make the auth-token "test". But, when nothing is set for auth-token, the api call goes through. I've looked at the swagger 2.0 doc, and I don't understand what's wrong. Could you please point me in the correct direction?
http://editor.swagger.io is a great tool to check for syntax errors. In your example, security must be an array. You need to change
"security": {
"auth-token": []
},
to
"security": [
{"auth-token": []}
],
Thank you. I appreciate it. That solved the issue. I didn't realize the array format in yaml and all the docs are in yaml only. I'll keep the editor in mind.
Most helpful comment
http://editor.swagger.io is a great tool to check for syntax errors. In your example,
securitymust be an array. You need to changeto