MCPcopy Create free account
hub / github.com/apache/openwhisk-cli / generatePathParameters

Function generatePathParameters

commands/api.go:794–815  ·  view source on GitHub ↗
(relativePath string)

Source from the content-addressed store, hash-verified

792}
793
794func generatePathParameters(relativePath string) ([]whisk.ApiParameter, error) {
795 pathParams := []whisk.ApiParameter{}
796
797 pathParamNames, err := getPathParameterNames(relativePath)
798 if len(pathParamNames) > 0 && err == nil {
799 // Only create unique swagger entries
800 var uniqueParamNames []string
801 for _, name := range pathParamNames {
802 if !contains(uniqueParamNames, name) {
803 uniqueParamNames = append(uniqueParamNames, name)
804 }
805 }
806 for _, uniqueName := range uniqueParamNames {
807 whisk.Debug(whisk.DbgInfo, "Creating api parameter for '%s'\n", uniqueName)
808 param := whisk.ApiParameter{Name: uniqueName, In: "path", Required: true, Type: "string",
809 Description: wski18n.T("Default description for '{{.name}}'", map[string]interface{}{"name": uniqueName})}
810 pathParams = append(pathParams, param)
811 }
812 }
813
814 return pathParams, err
815}
816
817/*
818 * if # args = 4

Callers 1

parseApiFunction · 0.85

Calls 2

getPathParameterNamesFunction · 0.85
containsFunction · 0.85

Tested by

no test coverage detected