Skip to content

Commit fbbbf9a

Browse files
committed
Fix: consume
1 parent 9950d35 commit fbbbf9a

File tree

6 files changed

+36
-11
lines changed

6 files changed

+36
-11
lines changed

coderd/apidoc/docs.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ const docTemplate = `{
8484
"CoderSessionToken": []
8585
}
8686
],
87+
"consumes": [
88+
"application/json"
89+
],
8790
"produces": [
8891
"application/json"
8992
],
@@ -120,6 +123,9 @@ const docTemplate = `{
120123
"CoderSessionToken": []
121124
}
122125
],
126+
"consumes": [
127+
"application/json"
128+
],
123129
"produces": [
124130
"application/json"
125131
],
@@ -515,6 +521,9 @@ const docTemplate = `{
515521
"CoderSessionToken": []
516522
}
517523
],
524+
"consumes": [
525+
"application/json"
526+
],
518527
"produces": [
519528
"application/json"
520529
],
@@ -556,6 +565,9 @@ const docTemplate = `{
556565
"CoderSessionToken": []
557566
}
558567
],
568+
"consumes": [
569+
"application/json"
570+
],
559571
"produces": [
560572
"application/json"
561573
],
@@ -597,6 +609,9 @@ const docTemplate = `{
597609
"CoderSessionToken": []
598610
}
599611
],
612+
"consumes": [
613+
"application/json"
614+
],
600615
"produces": [
601616
"application/json"
602617
],
@@ -641,6 +656,9 @@ const docTemplate = `{
641656
"CoderSessionToken": []
642657
}
643658
],
659+
"consumes": [
660+
"application/json"
661+
],
644662
"produces": [
645663
"application/json"
646664
],
@@ -725,7 +743,7 @@ const docTemplate = `{
725743
]
726744
},
727745
"object": {
728-
"description": "Object can represent a \"set\" of objects, such as:\n\t- All workspaces in an organization\n\t- All workspaces owned by me\n\t- All workspaces across the entire product\nWhen defining an object, use the most specific language when possible to\nproduce the smallest set. Meaning to set as many fields on 'Object' as\nyou can. Example, if you want to check if you can update all workspaces\nowned by 'me', try to also add an 'OrganizationID' to the settings.\nOmitting the 'OrganizationID' could produce the incorrect value, as\nworkspaces have both ` + "`" + `user` + "`" + ` and ` + "`" + `organization` + "`" + ` owners.",
746+
"description": "Object can represent a \"set\" of objects, such as:\n- All workspaces in an organization\n- All workspaces owned by me\n- All workspaces across the entire product\nWhen defining an object, use the most specific language when possible to\nproduce the smallest set. Meaning to set as many fields on 'Object' as\nyou can. Example, if you want to check if you can update all workspaces\nowned by 'me', try to also add an 'OrganizationID' to the settings.\nOmitting the 'OrganizationID' could produce the incorrect value, as\nworkspaces have both ` + "`" + `user` + "`" + ` and ` + "`" + `organization` + "`" + ` owners.",
729747
"$ref": "#/definitions/codersdk.AuthorizationObject"
730748
}
731749
}

coderd/apidoc/swagger.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"CoderSessionToken": []
7171
}
7272
],
73+
"consumes": ["application/json"],
7374
"produces": ["application/json"],
7475
"tags": ["Authorization"],
7576
"summary": "Check authorization",
@@ -102,6 +103,7 @@
102103
"CoderSessionToken": []
103104
}
104105
],
106+
"consumes": ["application/json"],
105107
"produces": ["application/json"],
106108
"tags": ["Templates"],
107109
"summary": "Create template by organization",
@@ -456,6 +458,7 @@
456458
"CoderSessionToken": []
457459
}
458460
],
461+
"consumes": ["application/json"],
459462
"produces": ["application/json"],
460463
"tags": ["Workspaces"],
461464
"summary": "Update workspace metadata by ID",
@@ -493,6 +496,7 @@
493496
"CoderSessionToken": []
494497
}
495498
],
499+
"consumes": ["application/json"],
496500
"produces": ["application/json"],
497501
"tags": ["Workspaces"],
498502
"summary": "Update workspace autostart schedule by ID",
@@ -530,6 +534,7 @@
530534
"CoderSessionToken": []
531535
}
532536
],
537+
"consumes": ["application/json"],
533538
"produces": ["application/json"],
534539
"tags": ["Workspaces"],
535540
"summary": "Extend workspace deadline by ID",
@@ -570,6 +575,7 @@
570575
"CoderSessionToken": []
571576
}
572577
],
578+
"consumes": ["application/json"],
573579
"produces": ["application/json"],
574580
"tags": ["Workspaces"],
575581
"summary": "Update workspace TTL by ID",
@@ -641,7 +647,7 @@
641647
"enum": ["create", "read", "update", "delete"]
642648
},
643649
"object": {
644-
"description": "Object can represent a \"set\" of objects, such as:\n\t- All workspaces in an organization\n\t- All workspaces owned by me\n\t- All workspaces across the entire product\nWhen defining an object, use the most specific language when possible to\nproduce the smallest set. Meaning to set as many fields on 'Object' as\nyou can. Example, if you want to check if you can update all workspaces\nowned by 'me', try to also add an 'OrganizationID' to the settings.\nOmitting the 'OrganizationID' could produce the incorrect value, as\nworkspaces have both `user` and `organization` owners.",
650+
"description": "Object can represent a \"set\" of objects, such as:\n- All workspaces in an organization\n- All workspaces owned by me\n- All workspaces across the entire product\nWhen defining an object, use the most specific language when possible to\nproduce the smallest set. Meaning to set as many fields on 'Object' as\nyou can. Example, if you want to check if you can update all workspaces\nowned by 'me', try to also add an 'OrganizationID' to the settings.\nOmitting the 'OrganizationID' could produce the incorrect value, as\nworkspaces have both `user` and `organization` owners.",
645651
"$ref": "#/definitions/codersdk.AuthorizationObject"
646652
}
647653
}

coderd/authorize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func (h *HTTPAuthorizer) AuthorizeSQLFilter(r *http.Request, action rbac.Action,
107107
// @Summary Check authorization
108108
// @ID check-authorization
109109
// @Security CoderSessionToken
110-
// @Consume json
110+
// @Accept json
111111
// @Produce json
112112
// @Tags Authorization
113113
// @Param request body codersdk.AuthorizationRequest true "Authorization request"

coderd/templates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (api *API) deleteTemplate(rw http.ResponseWriter, r *http.Request) {
145145
// @Summary Create template by organization
146146
// @ID create-template-by-organization
147147
// @Security CoderSessionToken
148-
// @Consume json
148+
// @Accept json
149149
// @Produce json
150150
// @Tags Templates
151151
// @Param request body codersdk.CreateTemplateRequest true "Request body"

coderd/workspaces.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ func (api *API) postWorkspacesByOrganization(rw http.ResponseWriter, r *http.Req
564564
// @Summary Update workspace metadata by ID
565565
// @ID update-workspace-metadata-by-id
566566
// @Security CoderSessionToken
567-
// @Consume json
567+
// @Accept json
568568
// @Produce json
569569
// @Tags Workspaces
570570
// @Param workspace path string true "Workspace ID" format(uuid)
@@ -654,7 +654,7 @@ func (api *API) patchWorkspace(rw http.ResponseWriter, r *http.Request) {
654654
// @Summary Update workspace autostart schedule by ID
655655
// @ID update-workspace-autostart-schedule-by-id
656656
// @Security CoderSessionToken
657-
// @Consume json
657+
// @Accept json
658658
// @Produce json
659659
// @Tags Workspaces
660660
// @Param workspace path string true "Workspace ID" format(uuid)
@@ -717,7 +717,7 @@ func (api *API) putWorkspaceAutostart(rw http.ResponseWriter, r *http.Request) {
717717
// @Summary Update workspace TTL by ID
718718
// @ID update-workspace-ttl-by-id
719719
// @Security CoderSessionToken
720-
// @Consume json
720+
// @Accept json
721721
// @Produce json
722722
// @Tags Workspaces
723723
// @Param workspace path string true "Workspace ID" format(uuid)
@@ -793,7 +793,7 @@ func (api *API) putWorkspaceTTL(rw http.ResponseWriter, r *http.Request) {
793793
// @Summary Extend workspace deadline by ID
794794
// @ID extend-workspace-deadline-by-id
795795
// @Security CoderSessionToken
796-
// @Consume json
796+
// @Accept json
797797
// @Produce json
798798
// @Tags Workspaces
799799
// @Param workspace path string true "Workspace ID" format(uuid)

codersdk/authorization.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ type AuthorizationRequest struct {
2424
// the specified user) can do a given action to a given set of objects.
2525
type AuthorizationCheck struct {
2626
// Object can represent a "set" of objects, such as:
27-
// - All workspaces in an organization
28-
// - All workspaces owned by me
29-
// - All workspaces across the entire product
27+
// - All workspaces in an organization
28+
// - All workspaces owned by me
29+
// - All workspaces across the entire product
3030
// When defining an object, use the most specific language when possible to
3131
// produce the smallest set. Meaning to set as many fields on 'Object' as
3232
// you can. Example, if you want to check if you can update all workspaces
@@ -37,6 +37,7 @@ type AuthorizationCheck struct {
3737
Action string `json:"action" enums:"create,read,update,delete"`
3838
}
3939

40+
// AuthorizationObject can represent a "set" of objects, such as: all workspaces in an organization, all workspaces owned by me, all workspaces across the entire product.
4041
type AuthorizationObject struct {
4142
// ResourceType is the name of the resource.
4243
// `./coderd/rbac/object.go` has the list of valid resource types.

0 commit comments

Comments
 (0)