Skip to content

Commit 5bdae83

Browse files
committed
improve swaggerparser
1 parent 60ddcf5 commit 5bdae83

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

coderd/coderdtest/swaggerparser.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ func assertPathParametersDefined(t *testing.T, comment SwaggerComment) {
300300
}
301301

302302
func assertSecurityDefined(t *testing.T, comment SwaggerComment) {
303+
var authorizedSecurityTags = []string{
304+
"CoderSessionToken",
305+
"ProvisionerKey",
306+
}
307+
303308
if comment.router == "/updatecheck" ||
304309
comment.router == "/buildinfo" ||
305310
comment.router == "/" ||
@@ -308,7 +313,7 @@ func assertSecurityDefined(t *testing.T, comment SwaggerComment) {
308313
comment.router == "/users/otp/change-password" {
309314
return // endpoints do not require authorization
310315
}
311-
assert.Equal(t, "CoderSessionToken", comment.security, "@Security must be equal CoderSessionToken")
316+
assert.Containsf(t, authorizedSecurityTags, comment.security, "@Security must be in %v", authorizedSecurityTags)
312317
}
313318

314319
func assertAccept(t *testing.T, comment SwaggerComment) {

enterprise/coderd/provisionerkeys.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func (api *API) deleteProvisionerKey(rw http.ResponseWriter, r *http.Request) {
202202

203203
// @Summary Fetch provisioner key details
204204
// @ID fetch-provisioner-key-details
205-
// @Security CoderSessionToken
205+
// @Security ProvisionerKey
206206
// @Produce json
207207
// @Tags Enterprise
208208
// @Param provisionerkey path string true "Provisioner Key"

0 commit comments

Comments
 (0)