Skip to content

Commit

Permalink
Remove misleading web-export key (#1092)
Browse files Browse the repository at this point in the history
* Remove misleading web-export key

* Support the top-level web-export field.

* Revert changes on test data to keep the sanity check for the top-level web-export field.
  • Loading branch information
style95 authored Apr 30, 2020
1 parent 9e02625 commit 5073943
Show file tree
Hide file tree
Showing 21 changed files with 109 additions and 56 deletions.
3 changes: 2 additions & 1 deletion docs/examples/manifest_hello_world_apigateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ packages:
actions:
hello_world:
function: src/hello.js
web-export: true
annotations:
web-export: true
apis:
hello-world:
hello:
Expand Down
6 changes: 4 additions & 2 deletions docs/examples/manifest_hello_world_apigateway_http.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ packages:
actions:
hello_world:
function: src/hello_http.js
web-export: true
annotations:
web-export: true
hello_world_promise:
function: src/hello_http_promise.js
web-export: true
annotations:
web-export: true
apis:
hello-world:
hello:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ project:
actions:
hello_world:
function: src/hello.js
annotations:
web-export: true
4 changes: 2 additions & 2 deletions docs/export.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ packages:
namespace: your_namespace/lib1_package
credential: ""
exposedUrl: ""
web-export: ""
main: ""
limits: null
inputs: {}
outputs: {}
annotations:
exec: nodejs:default
web-export: ""
lib1_greeting2:
name: lib1_greeting2
location: ""
Expand All @@ -208,13 +208,13 @@ packages:
namespace: your_namespace/lib1_package
credential: ""
exposedUrl: ""
web-export: ""
main: ""
limits: null
inputs: {}
outputs: {}
annotations:
exec: nodejs:default
web-export: ""
lib1_greeting3:
name: lib1_greeting3
location: ""
Expand Down
5 changes: 3 additions & 2 deletions docs/wskdeploy_apigateway_helloworld.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ packages:
actions:
hello_world:
function: src/hello.js
web-export: true
annotations:
web-export: true
apis:
hello-world:
hello:
Expand All @@ -47,7 +48,7 @@ packages:
```
There are two key changes to this file:
- the `hello_world` action now has the `web-export` flag set to `true`.
- the `hello_world` action now has the `web-export` annotation set to `true`.
- a new `apis` block has been created.

The `apis` block contains a number of groups of API endpoint. Each endpoint is then defined by the hierarchy. In this case, we are creating the `hello/world` endpoint. The leaf in the structure specifies the action to trigger when the given HTTP verb is sent to that endpoint, in this case, when the HTTP verb `GET` is used on the `hello/world` endpoint, trigger the `hello_world` action.
Expand Down
1 change: 1 addition & 0 deletions docs/wskdeploy_apigateway_open_api_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ project:
actions:
hello_world:
function: src/hello.js
annotations:
web-export: true
```
### Open API Specification
Expand Down
2 changes: 1 addition & 1 deletion parsers/yamlparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ type Action struct {
Main string `yaml:"main"`
Docker string `yaml:"docker,omitempty"`
Native bool `yaml:"native,omitempty"`
Conductor bool `yaml:"conductor,omitempty"`
Conductor bool `yaml:"conductor,omitempty"`
Limits *Limits `yaml:"limits"`
Inputs map[string]Parameter `yaml:"inputs"`
Outputs map[string]Parameter `yaml:"outputs"`
Expand Down
4 changes: 2 additions & 2 deletions specification/html/spec_actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The Action entity schema contains the necessary information to deploy an OpenWhi
| outputs | no | list of [parameter](spec_parameters.md) | N/A | The optional outputs from the Action. |
| limits | no | map of [limit keys and values](#valid-limit-keys) | N/A | Optional map of limit keys and their values.</br>See section "[Valid limit keys](#valid-limit-keys)" (below) for a listing of recognized keys and values. |
| feed | no | boolean | false | Optional indicator that the Action supports the required parameters (and operations) to be run as a Feed Action. |
| web&nbsp;&#124; web-export | no | string | true&nbsp;&#124; false&nbsp;&#124; yes&nbsp;&#124; no&nbsp;&#124; raw | The optional flag that makes the action accessible to REST calls without authentication.<p>For details on all types of Web Actions, see: [Web Actions](https://github.com/apache/openwhisk/blob/master/docs/webactions.md).</p>|
| web | no | string | true&nbsp;&#124; false&nbsp;&#124; yes&nbsp;&#124; no&nbsp;&#124; raw | The optional flag that makes the action accessible to REST calls without authentication.<p>For details on all types of Web Actions, see: [Web Actions](https://github.com/apache/openwhisk/blob/master/docs/webactions.md).</p>|
| raw-http | no | boolean | false | The optional flag (annotation) to indicate if a Web Action is able to consume the raw contents within the body of an HTTP request.<p><b>Note</b>: this option is ONLY valid if <em>"web"</em> or <em>"web-export"</em> is set to <em>‘true’</em>.<p> |
| docker | no | string | N/A | The optional key that references a Docker image (e.g., openwhisk/skeleton). |
| native | no | boolean | false | The optional key (flag) that indicates the Action is should use the Docker skeleton image for OpenWhisk (i.e., short-form for docker: openwhisk/skeleton). |
Expand Down Expand Up @@ -78,7 +78,7 @@ The following annotations have special meanings for Actions:
- When the `code` key-value is specified, the `runtime` **SHALL** be a required field.

#### Annotation requirements
- The annotation `require-whisk-auth` **SHALL** only be valid for web actions (i.e., if the `web` or `web-export` key (or `web-export` annotation) is set to `true`).
- The annotation `require-whisk-auth` **SHALL** only be valid for web actions (i.e., if the `web` key or `web-export` annotation is set to `true`).
- If the value of the `require-whisk-auth` annotation is an `integer` its value **MUST** be a positive integer less than or equal to the `MAX_INT` value of `9007199254740991`.
- When the `web` or `web-export` key is present and set to `true` the web action's **MUST** also be marked `final`. This happens automatically when the `web` or `web-export` keys are present and set to `true`.

Expand Down
3 changes: 2 additions & 1 deletion specification/html/spec_apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ packages:
actions:
hello_world:
function: src/hello.js
web-export: true
annotations:
web-export: true
apis:
hello-world:
hello:
Expand Down
3 changes: 2 additions & 1 deletion tests/dat/manifest_data_compose_actions_for_invalid_web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ packages:
actions:
hello:
function: ../tests/src/integration/helloworld/actions/hello.js
web-export: raw123
annotations:
web-export: raw123
1 change: 1 addition & 0 deletions tests/dat/manifest_data_compose_actions_for_web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ packages:
hello5:
function: ../src/integration/helloworld/actions/hello.js
web-export: no

Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,23 @@ packages:
function: ../src/integration/helloworld/actions/hello.js
runtime: nodejs
web: true
web-export: true
annotations:
web-export: true
hello2:
function: ../src/integration/helloworld/actions/hello.js
runtime: nodejs
web: true
web-export: false
annotations:
web-export: false
hello3:
function: ../src/integration/helloworld/actions/hello.js
runtime: nodejs
web: false
web-export: true
annotations:
web-export: true
hello4:
function: ../src/integration/helloworld/actions/hello.js
runtime: nodejs
web: raw
web-export: true
annotations:
web-export: true
3 changes: 2 additions & 1 deletion tests/dat/manifest_data_compose_api_records.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ packages:
actions:
putBooks:
function: ../tests/src/integration/helloworld/actions/hello.js
web-export: true
annotations:
web-export: true
deleteBooks:
function: ../tests/src/integration/helloworld/actions/hello.js
listMembers:
Expand Down
3 changes: 2 additions & 1 deletion tests/src/integration/apigateway/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ packages:
license: Apache-2.0
actions:
greeting:
web-export: true
annotations:
web-export: true
version: 1.0
function: src/greeting.js
runtime: nodejs:default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ project:
helloInDefaultPackage:
function: actions/hello.js
runtime: nodejs:default
web-export: true
annotations:
web-export: true
inputs:
name:
type: string
Expand Down Expand Up @@ -82,7 +83,8 @@ project:
greetingInsidePackage:
function: actions/hello.js
runtime: nodejs:default
web-export: true
annotations:
web-export: true
inputs:
name:
type: string
Expand Down
6 changes: 4 additions & 2 deletions tests/src/integration/defaultpackage/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ packages:
helloInDefaultPackage:
function: actions/hello.js
runtime: nodejs:default
web-export: true
annotations:
web-export: true
inputs:
name:
type: string
Expand Down Expand Up @@ -80,7 +81,8 @@ packages:
greetingInsidePackage:
function: actions/hello.js
runtime: nodejs:default
web-export: true
annotations:
web-export: true
inputs:
name:
type: string
Expand Down
3 changes: 2 additions & 1 deletion tests/src/integration/export/manifest_apiexp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ packages:
license: Apache-2.0
actions:
greeting:
web-export: true
annotations:
web-export: true
version: 1.0
function: src/greeting.js
runtime: nodejs:default
Expand Down
3 changes: 2 additions & 1 deletion tests/src/integration/flagstests/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ packages:
license: Apache-2.0
actions:
greeting:
web-export: true
annotations:
web-export: true
version: 1.0
function: src/greeting.js
runtime: nodejs:default
Expand Down
3 changes: 2 additions & 1 deletion tests/src/integration/flagstests/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ packages:
license: Apache-2.0
actions:
greeting:
web-export: true
annotations:
web-export: true
version: 1.0
function: src/greeting.js
runtime: nodejs:default
Expand Down
Loading

0 comments on commit 5073943

Please sign in to comment.