(t *testing.T, comment SwaggerComment)
| 321 | var urlParameterRegexp = regexp.MustCompile(`{[^{}]*}`) |
| 322 | |
| 323 | func assertPathParametersDefined(t *testing.T, comment SwaggerComment) { |
| 324 | matches := urlParameterRegexp.FindAllString(comment.router, -1) |
| 325 | if matches == nil { |
| 326 | return // router does not require any parameters |
| 327 | } |
| 328 | |
| 329 | for _, m := range matches { |
| 330 | var matched bool |
| 331 | for _, p := range comment.parameters { |
| 332 | if p.kind == "path" && "{"+p.name+"}" == m { |
| 333 | matched = true |
| 334 | break |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | if !matched { |
| 339 | assert.Failf(t, "Missing @Param annotation", "Path parameter: %s", m) |
| 340 | } |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | func assertSecurityDefined(t *testing.T, comment SwaggerComment) { |
| 345 | authorizedSecurityTags := []string{ |
no outgoing calls
no test coverage detected