openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From daisy...@apache.org
Subject [incubator-openwhisk-client-go] branch master updated: wsk CLI should tolerate APIs that do not yet have a mapped action (#2458) (#18)
Date Tue, 11 Jul 2017 03:05:38 GMT
This is an automated email from the ASF dual-hosted git repository.

daisyguo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new c997fa3  wsk CLI should tolerate APIs that do not yet have a mapped action (#2458)
(#18)
c997fa3 is described below

commit c997fa3bc91903113eeee087a13f2a0b27fe1f6a
Author: Vincent <shou@us.ibm.com>
AuthorDate: Mon Jul 10 23:05:36 2017 -0400

    wsk CLI should tolerate APIs that do not yet have a mapped action (#2458) (#18)
    
    * wsk CLI should tolerate APIs that do not yet have a mapped action
    - bump API GW version so that action-less APIs can be created via cli/swagger
    
    * Add `wsk api list --full` test for action-less apis
---
 whisk/api.go | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/whisk/api.go b/whisk/api.go
index 5985fa3..6408367 100644
--- a/whisk/api.go
+++ b/whisk/api.go
@@ -545,21 +545,15 @@ func validateApiPath(path map[string]*ApiSwaggerOperationV2) error {
 }
 
 func validateApiOperation(opName string, op *ApiSwaggerOperationV2) error {
-    if len(op.OperationId) == 0 {
-        Debug(DbgError, "validateApiResponse: No operationId field in operation %v\n", op)
+    if (op.XOpenWhisk != nil && len(op.OperationId) == 0) {
+        Debug(DbgError, "validateApiOperation: No operationId field in operation %v\n", op)
         errMsg := wski18n.T("Missing operationId field in API configuration for operation
{{.op}}",
             map[string]interface{}{"op": opName})
         whiskErr := MakeWskError(errors.New(errMsg), EXITCODE_ERR_NETWORK, DISPLAY_MSG, NO_DISPLAY_USAGE)
         return whiskErr
     }
-    if op.XOpenWhisk == nil {
-        Debug(DbgError, "validateApiResponse: No x-openwhisk stanza in operation %v\n", op)
-        errMsg := wski18n.T("Missing x-openwhisk stanza in API configuration for operation
{{.op}}",
-            map[string]interface{}{"op": opName})
-        whiskErr := MakeWskError(errors.New(errMsg), EXITCODE_ERR_NETWORK, DISPLAY_MSG, NO_DISPLAY_USAGE)
-        return whiskErr
-    }
-    if len(op.XOpenWhisk.Namespace) == 0 {
+
+    if (op.XOpenWhisk != nil && len(op.XOpenWhisk.Namespace) == 0) {
         Debug(DbgError, "validateApiOperation: no x-openwhisk.namespace stanza in operation
%v\n", op)
         errMsg := wski18n.T("Missing x-openwhisk.namespace field in API configuration for
operation {{.op}}",
             map[string]interface{}{"op": opName})
@@ -569,14 +563,14 @@ func validateApiOperation(opName string, op *ApiSwaggerOperationV2)
error {
 
     // Note: The op.XOpenWhisk.Package field can have a value of "", so don't enforce a value
 
-    if len(op.XOpenWhisk.ActionName) == 0 {
+    if (op.XOpenWhisk != nil && len(op.XOpenWhisk.ActionName) == 0) {
         Debug(DbgError, "validateApiOperation: no x-openwhisk.action stanza in operation
%v\n", op)
         errMsg := wski18n.T("Missing x-openwhisk.action field in API configuration for operation
{{.op}}",
             map[string]interface{}{"op": opName})
         whiskErr := MakeWskError(errors.New(errMsg), EXITCODE_ERR_NETWORK, DISPLAY_MSG, NO_DISPLAY_USAGE)
         return whiskErr
     }
-    if len(op.XOpenWhisk.ApiUrl) == 0 {
+    if (op.XOpenWhisk != nil && len(op.XOpenWhisk.ApiUrl) == 0) {
         Debug(DbgError, "validateApiOperation: no x-openwhisk.url stanza in operation %v\n",
op)
         errMsg := wski18n.T("Missing x-openwhisk.url field in API configuration for operation
{{.op}}",
             map[string]interface{}{"op": opName})

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <commits@openwhisk.apache.org>'].

Mime
View raw message