You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/01/19 20:07:34 UTC
[GitHub] dubeejw closed pull request #56: Add path param support
dubeejw closed pull request #56: Add path param support
URL: https://github.com/apache/incubator-openwhisk-client-go/pull/56
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/whisk/api.go b/whisk/api.go
index 6d695a68..e62f2dca 100644
--- a/whisk/api.go
+++ b/whisk/api.go
@@ -146,13 +146,51 @@ type ApiSwagger struct {
SwaggerName string `json:"swagger,omitempty"`
BasePath string `json:"basePath,omitempty"`
Info *ApiSwaggerInfo `json:"info,omitempty"`
- Paths map[string]map[string]*ApiSwaggerOperation `json:"paths,omitempty"` // Paths["/a/path"]["get"] -> a generic object
+ Paths map[string]*ApiSwaggerPath `json:"paths,omitempty"`
SecurityDef interface{} `json:"securityDefinitions,omitempty"`
Security interface{} `json:"security,omitempty"`
XConfig interface{} `json:"x-ibm-configuration,omitempty"`
XRateLimit interface{} `json:"x-ibm-rate-limit,omitempty"`
}
+type ApiSwaggerPath struct{
+ Get *ApiSwaggerOperation `json:"get,omitempty"`
+ Put *ApiSwaggerOperation `json:"put,omitempty"`
+ Post *ApiSwaggerOperation `json:"post,omitempty"`
+ Delete *ApiSwaggerOperation `json:"delete,omitempty"`
+ Options *ApiSwaggerOperation `json:"options,omitempty"`
+ Head *ApiSwaggerOperation `json:"head,omitempty"`
+ Patch *ApiSwaggerOperation `json:"patch,omitempty"`
+ Parameters []ApiParameter `json:"parameters,omitempty"`
+}
+
+func (asp *ApiSwaggerPath) MakeOperationMap() map[string]*ApiSwaggerOperation {
+ var opMap map[string]*ApiSwaggerOperation = make(map[string]*ApiSwaggerOperation)
+ if asp.Get != nil {
+ opMap["get"] = asp.Get
+ }
+ if asp.Put != nil {
+ opMap["put"] = asp.Put
+ }
+ if asp.Post != nil {
+ opMap["post"] = asp.Post
+ }
+ if asp.Delete != nil {
+ opMap["delete"] = asp.Delete
+ }
+ if asp.Options != nil {
+ opMap["options"] = asp.Options
+ }
+ if asp.Head != nil {
+ opMap["head"] = asp.Head
+ }
+ if asp.Patch != nil {
+ opMap["patch"] = asp.Patch
+ }
+ return opMap
+}
+
+
type ApiSwaggerInfo struct {
Title string `json:"title,omitempty"`
Version string `json:"version,omitempty"`
@@ -463,8 +501,8 @@ func validateApiSwaggerResponse(swagger *ApiSwagger) error {
return nil
}
-func validateApiPath(path map[string]*ApiSwaggerOperation) error {
- for op, opv := range path {
+func validateApiPath(path *ApiSwaggerPath) error {
+ for op, opv := range path.MakeOperationMap() {
err := validateApiOperation(op, opv)
if err != nil {
Debug(DbgError, "validateApiPath: Invalid Api operation object: %v\n", opv)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services