From 69020e87beb00fccef7ffd71b21f9b627754be74 Mon Sep 17 00:00:00 2001 From: Dominic Kim Date: Tue, 24 Mar 2020 17:19:42 +0900 Subject: [PATCH 1/3] Remove misleading web-export key --- .../manifest_hello_world_apigateway.yaml | 3 +- .../manifest_hello_world_apigateway_http.yaml | 6 +- ..._hello_world_apigateway_open_api_spec.yaml | 1 + docs/export.md | 4 +- docs/wskdeploy_apigateway_helloworld.md | 5 +- docs/wskdeploy_apigateway_open_api_spec.md | 1 + parsers/yamlparser.go | 3 - specification/html/spec_actions.md | 4 +- specification/html/spec_apis.md | 3 +- ..._data_compose_actions_for_invalid_web.yaml | 3 +- ...manifest_data_compose_actions_for_web.yaml | 15 ++-- ...ompose_actions_for_web_and_web_export.yaml | 12 ++- .../manifest_data_compose_api_records.yaml | 3 +- tests/src/integration/apigateway/manifest.yml | 3 +- .../defaultpackage/manifest-with-project.yaml | 6 +- .../integration/defaultpackage/manifest.yaml | 6 +- .../integration/export/manifest_apiexp.yaml | 3 +- .../src/integration/flagstests/manifest.yaml | 3 +- tests/src/integration/flagstests/manifest.yml | 3 +- .../integration/runtimetests/manifest.yaml | 78 ++++++++++++------- tests/src/integration/webaction/manifest.yml | 15 ++-- 21 files changed, 117 insertions(+), 63 deletions(-) diff --git a/docs/examples/manifest_hello_world_apigateway.yaml b/docs/examples/manifest_hello_world_apigateway.yaml index 44e49ca7e..1861a780c 100644 --- a/docs/examples/manifest_hello_world_apigateway.yaml +++ b/docs/examples/manifest_hello_world_apigateway.yaml @@ -23,7 +23,8 @@ packages: actions: hello_world: function: src/hello.js - web-export: true + annotations: + web-export: true apis: hello-world: hello: diff --git a/docs/examples/manifest_hello_world_apigateway_http.yaml b/docs/examples/manifest_hello_world_apigateway_http.yaml index afe96a472..c6900218f 100644 --- a/docs/examples/manifest_hello_world_apigateway_http.yaml +++ b/docs/examples/manifest_hello_world_apigateway_http.yaml @@ -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: diff --git a/docs/examples/manifest_hello_world_apigateway_open_api_spec.yaml b/docs/examples/manifest_hello_world_apigateway_open_api_spec.yaml index 26826e967..31a01714d 100644 --- a/docs/examples/manifest_hello_world_apigateway_open_api_spec.yaml +++ b/docs/examples/manifest_hello_world_apigateway_open_api_spec.yaml @@ -25,4 +25,5 @@ project: actions: hello_world: function: src/hello.js + annotations: web-export: true diff --git a/docs/export.md b/docs/export.md index 296ae7d2e..a06c252c7 100644 --- a/docs/export.md +++ b/docs/export.md @@ -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: "" @@ -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: "" diff --git a/docs/wskdeploy_apigateway_helloworld.md b/docs/wskdeploy_apigateway_helloworld.md index 4bcefe958..19ceaa7d5 100644 --- a/docs/wskdeploy_apigateway_helloworld.md +++ b/docs/wskdeploy_apigateway_helloworld.md @@ -37,7 +37,8 @@ packages: actions: hello_world: function: src/hello.js - web-export: true + annotations: + web-export: true apis: hello-world: hello: @@ -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. diff --git a/docs/wskdeploy_apigateway_open_api_spec.md b/docs/wskdeploy_apigateway_open_api_spec.md index 4942ed2ef..b7f8341ac 100644 --- a/docs/wskdeploy_apigateway_open_api_spec.md +++ b/docs/wskdeploy_apigateway_open_api_spec.md @@ -39,6 +39,7 @@ project: actions: hello_world: function: src/hello.js + annotations: web-export: true ``` ### Open API Specification diff --git a/parsers/yamlparser.go b/parsers/yamlparser.go index 7b29ab91f..a1e3c2f1c 100644 --- a/parsers/yamlparser.go +++ b/parsers/yamlparser.go @@ -255,9 +255,6 @@ type PackageInputs struct { // function to return web-export or web depending on what is specified // in manifest and deployment files. Web flag takes precedence. func (action *Action) GetWeb() string { - if len(action.Web) == 0 && len(action.WebExport) != 0 { - return action.WebExport - } return action.Web } diff --git a/specification/html/spec_actions.md b/specification/html/spec_actions.md index 66502aa3c..56920c6da 100644 --- a/specification/html/spec_actions.md +++ b/specification/html/spec_actions.md @@ -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.
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 | web-export | no | string | true | false | yes | no | raw | The optional flag that makes the action accessible to REST calls without authentication.

For details on all types of Web Actions, see: [Web Actions](https://github.com/apache/openwhisk/blob/master/docs/webactions.md).

| +| web | no | string | true | false | yes | no | raw | The optional flag that makes the action accessible to REST calls without authentication.

For details on all types of Web Actions, see: [Web Actions](https://github.com/apache/openwhisk/blob/master/docs/webactions.md).

| | 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.

Note: this option is ONLY valid if "web" or "web-export" is set to ‘true’.

| | 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). | @@ -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`. diff --git a/specification/html/spec_apis.md b/specification/html/spec_apis.md index 2873d5686..b26d02c6f 100644 --- a/specification/html/spec_apis.md +++ b/specification/html/spec_apis.md @@ -79,7 +79,8 @@ packages: actions: hello_world: function: src/hello.js - web-export: true + annotations: + web-export: true apis: hello-world: hello: diff --git a/tests/dat/manifest_data_compose_actions_for_invalid_web.yaml b/tests/dat/manifest_data_compose_actions_for_invalid_web.yaml index 368731ab4..4c0b4e970 100644 --- a/tests/dat/manifest_data_compose_actions_for_invalid_web.yaml +++ b/tests/dat/manifest_data_compose_actions_for_invalid_web.yaml @@ -20,4 +20,5 @@ packages: actions: hello: function: ../tests/src/integration/helloworld/actions/hello.js - web-export: raw123 + annotations: + web-export: raw123 diff --git a/tests/dat/manifest_data_compose_actions_for_web.yaml b/tests/dat/manifest_data_compose_actions_for_web.yaml index 94607a8c3..2d82b3251 100644 --- a/tests/dat/manifest_data_compose_actions_for_web.yaml +++ b/tests/dat/manifest_data_compose_actions_for_web.yaml @@ -20,16 +20,21 @@ packages: actions: hello1: function: ../src/integration/helloworld/actions/hello.js - web-export: true + annotations: + web-export: true hello2: function: ../src/integration/helloworld/actions/hello.js - web-export: yes + annotations: + web-export: yes hello3: function: ../src/integration/helloworld/actions/hello.js - web-export: raw + annotations: + web-export: raw hello4: function: ../src/integration/helloworld/actions/hello.js - web-export: false + annotations: + web-export: false hello5: function: ../src/integration/helloworld/actions/hello.js - web-export: no + annotations: + web-export: no diff --git a/tests/dat/manifest_data_compose_actions_for_web_and_web_export.yaml b/tests/dat/manifest_data_compose_actions_for_web_and_web_export.yaml index 2145eb9dc..7adbcda86 100644 --- a/tests/dat/manifest_data_compose_actions_for_web_and_web_export.yaml +++ b/tests/dat/manifest_data_compose_actions_for_web_and_web_export.yaml @@ -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 diff --git a/tests/dat/manifest_data_compose_api_records.yaml b/tests/dat/manifest_data_compose_api_records.yaml index 14f95def2..e75d3c710 100644 --- a/tests/dat/manifest_data_compose_api_records.yaml +++ b/tests/dat/manifest_data_compose_api_records.yaml @@ -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: diff --git a/tests/src/integration/apigateway/manifest.yml b/tests/src/integration/apigateway/manifest.yml index dba6e315c..502650467 100644 --- a/tests/src/integration/apigateway/manifest.yml +++ b/tests/src/integration/apigateway/manifest.yml @@ -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 diff --git a/tests/src/integration/defaultpackage/manifest-with-project.yaml b/tests/src/integration/defaultpackage/manifest-with-project.yaml index b4209798c..40fe2b189 100644 --- a/tests/src/integration/defaultpackage/manifest-with-project.yaml +++ b/tests/src/integration/defaultpackage/manifest-with-project.yaml @@ -23,7 +23,8 @@ project: helloInDefaultPackage: function: actions/hello.js runtime: nodejs:default - web-export: true + annotations: + web-export: true inputs: name: type: string @@ -82,7 +83,8 @@ project: greetingInsidePackage: function: actions/hello.js runtime: nodejs:default - web-export: true + annotations: + web-export: true inputs: name: type: string diff --git a/tests/src/integration/defaultpackage/manifest.yaml b/tests/src/integration/defaultpackage/manifest.yaml index d0c2429ae..283123384 100644 --- a/tests/src/integration/defaultpackage/manifest.yaml +++ b/tests/src/integration/defaultpackage/manifest.yaml @@ -21,7 +21,8 @@ packages: helloInDefaultPackage: function: actions/hello.js runtime: nodejs:default - web-export: true + annotations: + web-export: true inputs: name: type: string @@ -80,7 +81,8 @@ packages: greetingInsidePackage: function: actions/hello.js runtime: nodejs:default - web-export: true + annotations: + web-export: true inputs: name: type: string diff --git a/tests/src/integration/export/manifest_apiexp.yaml b/tests/src/integration/export/manifest_apiexp.yaml index b377b9a5f..53b0441db 100644 --- a/tests/src/integration/export/manifest_apiexp.yaml +++ b/tests/src/integration/export/manifest_apiexp.yaml @@ -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 diff --git a/tests/src/integration/flagstests/manifest.yaml b/tests/src/integration/flagstests/manifest.yaml index caabdc554..eff21253c 100644 --- a/tests/src/integration/flagstests/manifest.yaml +++ b/tests/src/integration/flagstests/manifest.yaml @@ -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 diff --git a/tests/src/integration/flagstests/manifest.yml b/tests/src/integration/flagstests/manifest.yml index 25b7c1736..b14a79f98 100644 --- a/tests/src/integration/flagstests/manifest.yml +++ b/tests/src/integration/flagstests/manifest.yml @@ -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 diff --git a/tests/src/integration/runtimetests/manifest.yaml b/tests/src/integration/runtimetests/manifest.yaml index 8c65d48ca..7cbf18957 100644 --- a/tests/src/integration/runtimetests/manifest.yaml +++ b/tests/src/integration/runtimetests/manifest.yaml @@ -21,7 +21,8 @@ packages: license: Apache-1.0 actions: greetingnodejs6-with-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/greeting.js runtime: nodejs:default @@ -31,7 +32,8 @@ packages: outputs: payload: string greetingnodejs8-with-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/greeting.js runtime: nodejs:8 @@ -41,7 +43,8 @@ packages: outputs: payload: string greetingnodejs10-with-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/greeting.js runtime: nodejs:10 @@ -51,7 +54,8 @@ packages: outputs: payload: string greetingphp71-with-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.php runtime: php:7.1 @@ -61,7 +65,8 @@ packages: outputs: payload: string greetingphp72-with-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.php runtime: php:7.2 @@ -71,7 +76,8 @@ packages: outputs: payload: string greetingphp73-with-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.php runtime: php:7.3 @@ -81,7 +87,8 @@ packages: outputs: payload: string greetingpython-with-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.py runtime: python @@ -91,7 +98,8 @@ packages: outputs: payload: string greetingpython2-with-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.py runtime: python:2 @@ -101,7 +109,8 @@ packages: outputs: payload: string greetingpython3-with-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.py runtime: python:3 @@ -111,7 +120,8 @@ packages: outputs: payload: string greetingruby25-with-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.rb runtime: ruby:2.5 @@ -121,7 +131,8 @@ packages: outputs: payload: string greetingswift42-with-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.swift runtime: swift:4.2 @@ -149,7 +160,8 @@ packages: TestImplicitRuntimes: actions: greetingnodejs-without-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/greeting.js inputs: @@ -158,7 +170,8 @@ packages: outputs: payload: string greetingphp-without-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.php inputs: @@ -167,7 +180,8 @@ packages: outputs: payload: string greetingpython-without-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.py inputs: @@ -176,7 +190,8 @@ packages: outputs: payload: string greetingruby-without-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.rb inputs: @@ -185,7 +200,8 @@ packages: outputs: payload: string greetingswift-without-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.swift inputs: @@ -199,7 +215,8 @@ packages: TestInvalidExplicitRuntimes: actions: greetingnodejs-with-java-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/greeting.js runtime: java @@ -209,7 +226,8 @@ packages: outputs: payload: string greetingnodejs-with-random-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/greeting.js runtime: random @@ -219,7 +237,8 @@ packages: outputs: payload: string greetingphp-with-nodejs-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.php runtime: nodejs:default @@ -229,7 +248,8 @@ packages: outputs: payload: string greetingphp-with-random-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.php runtime: random @@ -239,7 +259,8 @@ packages: outputs: payload: string greetingpython-with-php-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.py runtime: php @@ -249,7 +270,8 @@ packages: outputs: payload: string greetingpython-with-random-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.py runtime: random @@ -259,7 +281,8 @@ packages: outputs: payload: string greetingruby-with-php-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.rb runtime: php @@ -269,7 +292,8 @@ packages: outputs: payload: string greetingruby-with-random-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.rb runtime: random @@ -279,7 +303,8 @@ packages: outputs: payload: string greetingswift-with-nodejs-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.swift runtime: nodejs:default @@ -289,7 +314,8 @@ packages: outputs: payload: string greetingswift-with-random-explicit-runtime: - web-export: true + annotations: + web-export: true version: 1.0 function: src/hello.swift runtime: random diff --git a/tests/src/integration/webaction/manifest.yml b/tests/src/integration/webaction/manifest.yml index 395e382b8..7c6c55011 100644 --- a/tests/src/integration/webaction/manifest.yml +++ b/tests/src/integration/webaction/manifest.yml @@ -20,7 +20,8 @@ packages: IntegrationTestWebAction: actions: greeting-web-action: - web-export: true + annotations: + web-export: true version: 1.0 function: src/greeting.js runtime: nodejs:default @@ -30,7 +31,8 @@ packages: outputs: payload: string greeting-web-action-1: - web-export: yes + annotations: + web-export: yes version: 1.0 function: src/greeting.js runtime: nodejs:default @@ -40,19 +42,22 @@ packages: outputs: payload: string greeting-with-raw-http: - web-export: raw + annotations: + web-export: raw version: 1.0 function: src/greeting.js runtime: nodejs:default greeting-web-action-final: - web-export: true + annotations: + web-export: true version: 1.0 function: src/greeting.js runtime: nodejs:default annotations: final: true greeting-web-action-with-custom-options: - web-export: true + annotations: + web-export: true version: 1.0 function: src/greeting.js runtime: nodejs:default From 58e47a8b0658d2910113f144462751f85f6db125 Mon Sep 17 00:00:00 2001 From: Dominic Kim Date: Mon, 13 Apr 2020 21:21:01 +0900 Subject: [PATCH 2/3] Support the top-level web-export field. --- parsers/yamlparser.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parsers/yamlparser.go b/parsers/yamlparser.go index a1e3c2f1c..770bac658 100644 --- a/parsers/yamlparser.go +++ b/parsers/yamlparser.go @@ -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"` @@ -255,6 +255,9 @@ type PackageInputs struct { // function to return web-export or web depending on what is specified // in manifest and deployment files. Web flag takes precedence. func (action *Action) GetWeb() string { + if len(action.Web) == 0 && len(action.WebExport) != 0 { + return action.WebExport + } return action.Web } From b197d7fd1ed46d0fc66574af43e84fc9ae5b4d55 Mon Sep 17 00:00:00 2001 From: Dominic Kim Date: Mon, 27 Apr 2020 14:53:37 +0900 Subject: [PATCH 3/3] Revert changes on test data to keep the sanity check for the top-level web-export field. --- .../manifest_data_compose_actions_for_web.yaml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/dat/manifest_data_compose_actions_for_web.yaml b/tests/dat/manifest_data_compose_actions_for_web.yaml index 2d82b3251..9ecb95baa 100644 --- a/tests/dat/manifest_data_compose_actions_for_web.yaml +++ b/tests/dat/manifest_data_compose_actions_for_web.yaml @@ -20,21 +20,17 @@ packages: actions: hello1: function: ../src/integration/helloworld/actions/hello.js - annotations: - web-export: true + web-export: true hello2: function: ../src/integration/helloworld/actions/hello.js - annotations: - web-export: yes + web-export: yes hello3: function: ../src/integration/helloworld/actions/hello.js - annotations: - web-export: raw + web-export: raw hello4: function: ../src/integration/helloworld/actions/hello.js - annotations: - web-export: false + web-export: false hello5: function: ../src/integration/helloworld/actions/hello.js - annotations: - web-export: no + web-export: no +