func generatePathParameters()

in commands/api.go [794:815]


func generatePathParameters(relativePath string) ([]whisk.ApiParameter, error) {
	pathParams := []whisk.ApiParameter{}

	pathParamNames, err := getPathParameterNames(relativePath)
	if len(pathParamNames) > 0 && err == nil {
		// Only create unique swagger entries
		var uniqueParamNames []string
		for _, name := range pathParamNames {
			if !contains(uniqueParamNames, name) {
				uniqueParamNames = append(uniqueParamNames, name)
			}
		}
		for _, uniqueName := range uniqueParamNames {
			whisk.Debug(whisk.DbgInfo, "Creating api parameter for '%s'\n", uniqueName)
			param := whisk.ApiParameter{Name: uniqueName, In: "path", Required: true, Type: "string",
				Description: wski18n.T("Default description for '{{.name}}'", map[string]interface{}{"name": uniqueName})}
			pathParams = append(pathParams, param)
		}
	}

	return pathParams, err
}