MCPcopy Index your code
hub / github.com/coder/coder / assertPathParametersDefined

Function assertPathParametersDefined

coderd/coderdtest/swaggerparser.go:323–342  ·  view source on GitHub ↗
(t *testing.T, comment SwaggerComment)

Source from the content-addressed store, hash-verified

321var urlParameterRegexp = regexp.MustCompile(`{[^{}]*}`)
322
323func 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
344func assertSecurityDefined(t *testing.T, comment SwaggerComment) {
345 authorizedSecurityTags := []string{

Callers 1

VerifySwaggerDefinitionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected