apache / apache/openwhisk-apigateway

When updating an existing API, a null resource is added

Open
#60 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Lua
Stars
65
Forks
43
PR merge metrics
No merged PRs in 30d

Description

1. Create an initial api under an existing tenant. POST /apis
```{
"name": "/mwd_api2_bp",
"basePath": "/mwd_api2_bp",
"tenantId": "YOUR TENANT ID",
"resources": {
"/rp": {
"operations": {
"get": {
"backendMethod": "POST",
"backendUrl": "https://172.17.0.1/api/v1/namespaces/whisk.system/actions/newaction",
"policies": [
{
"type": "reqMapping",
"value": [
{
"action": "transform",
"from": {
"name": "*",
"location": "query"
},
"to": {
"name": "*",
"location": "body"
}
},
{
"action": "insert",
"from": {
"value": "Basic AUTHCODE"
},
"to": {
"name": "Authorization",
"location": "header"
}
},
{
"action": "insert",
"from": {
"value": "application/json"
},
"to": {
"name": "Content-Type",
"location": "header"
}
},
{
"action": "insert",
"from": {
"value": "true"
},
"to": {
"name": "blocking",
"location": "query"
}
},
{
"action": "insert",
"from": {
"value": "true"
},
"to": {
"name": "result",
"location": "query"
}
}
]
}
]
}
}
}
}
}
```
2. Note the API id.
3. Add a new path or operation. in this case i just added a new operation. PUT /apis/{apiid}
```
{
"id": "YOUR APP ID",
"name": "/mwd_api2_bp",
"basePath": "/mwd_api2_bp",
"tenantId": "YOUR TENANT ID",
"resources": {
"/rp": {
"operations": {
"get": {
"backendMethod": "POST",
"backendUrl": "https://172.17.0.1/api/v1/namespaces/whisk.system/actions/newaction",
"policies": [
{
"type": "reqMapping",
"value": [
{
"action": "transform",
"from": {
"name": "*",
"location": "query"
},
"to": {
"name": "*",
"location": "body"
}
},
{
"action": "insert",
"from": {
"value": "Basic AUTHCODE"
},
"to": {
"name": "Authorization",
"location": "header"
}
},
{
"action": "insert",
"from": {
"value": "application/json"
},
"to": {
"name": "Content-Type",
"location": "header"
}
},
{
"action": "insert",
"from": {
"value": "true"
},
"to": {
"name": "blocking",
"location": "query"
}
},
{
"action": "insert",
"from": {
"value": "true"
},
"to": {
"name": "result",
"location": "query"
}
}
]
}
]
},
"delete": {
"backendMethod": "POST",
"backendUrl": "https://172.17.0.1/api/v1/namespaces/whisk.system/actions/newaction",
"policies": [
{
"type": "reqMapping",
"value": [
{
"action": "transform",
"from": {
"name": "*",
"location": "query"
},
"to": {
"name": "*",
"location": "body"
}
},
{
"action": "insert",
"from": {
"value": "Basic AUTHCODE"
},
"to": {
"name": "Authorization",
"location": "header"
}
},
{
"action": "insert",
"from": {
"value": "application/json"
},
"to": {
"name": "Content-Type",
"location": "header"
}
},
{
"action": "insert",
"from": {
"value": "true"
},
"to": {
"name": "blocking",
"location": "query"
}
},
{
"action": "insert",
"from": {
"value": "true"
},
"to": {
"name": "result",
"location": "query"
}
}
]
}
]
}
}
}
}
}
```
4. Note the response from the gw looks fine
5. Issue GET /apis/{apiid}. Look for `"path":null`
```
"tenantId": "YOUR TENANT ID",
"resources": {
"path": null,
"/rp": {
"operations": {
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.