Swagger: annotate RoleType as enumeration (#47902)

This commit is contained in:
Sofia Papagiannaki
2022-04-20 10:27:25 +03:00
committed by GitHub
parent 70802447a5
commit e58a015baf
4 changed files with 114 additions and 66 deletions

View File

@@ -506,14 +506,6 @@
"summary": "Add a user role assignment.",
"operationId": "addUserRole",
"parameters": [
{
"type": "integer",
"format": "int64",
"x-go-name": "UserID",
"name": "user_id",
"in": "path",
"required": true
},
{
"x-go-name": "Body",
"name": "body",
@@ -522,6 +514,14 @@
"schema": {
"$ref": "#/definitions/AddUserRoleCommand"
}
},
{
"type": "integer",
"format": "int64",
"x-go-name": "UserID",
"name": "user_id",
"in": "path",
"required": true
}
],
"responses": {
@@ -547,14 +547,6 @@
"summary": "Remove a user role assignment.",
"operationId": "removeUserRole",
"parameters": [
{
"type": "integer",
"format": "int64",
"x-go-name": "UserID",
"name": "user_id",
"in": "path",
"required": true
},
{
"type": "string",
"x-go-name": "RoleUID",
@@ -568,6 +560,14 @@
"description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to remove assignment.",
"name": "global",
"in": "query"
},
{
"type": "integer",
"format": "int64",
"x-go-name": "UserID",
"name": "user_id",
"in": "path",
"required": true
}
],
"responses": {
@@ -3675,15 +3675,15 @@
"parameters": [
{
"type": "string",
"x-go-name": "DatasourceID",
"name": "datasource_id",
"x-go-name": "PermissionID",
"name": "permissionId",
"in": "path",
"required": true
},
{
"type": "string",
"x-go-name": "PermissionID",
"name": "permissionId",
"x-go-name": "DatasourceID",
"name": "datasource_id",
"in": "path",
"required": true
}
@@ -7797,7 +7797,10 @@
"x-go-name": "Name"
},
"role": {
"$ref": "#/definitions/RoleType"
"type": "string",
"enum": ["Viewer", "Editor", "Admin"],
"x-go-enum-desc": "Viewer ROLE_VIEWER\nEditor ROLE_EDITOR\nAdmin ROLE_ADMIN",
"x-go-name": "Role"
},
"secondsToLive": {
"type": "integer",
@@ -7907,7 +7910,10 @@
"x-go-name": "Name"
},
"role": {
"$ref": "#/definitions/RoleType"
"type": "string",
"enum": ["Viewer", "Editor", "Admin"],
"x-go-enum-desc": "Viewer ROLE_VIEWER\nEditor ROLE_EDITOR\nAdmin ROLE_ADMIN",
"x-go-name": "Role"
},
"sendEmail": {
"type": "boolean",
@@ -7924,7 +7930,10 @@
"x-go-name": "LoginOrEmail"
},
"role": {
"$ref": "#/definitions/RoleType"
"type": "string",
"enum": ["Viewer", "Editor", "Admin"],
"x-go-enum-desc": "Viewer ROLE_VIEWER\nEditor ROLE_EDITOR\nAdmin ROLE_ADMIN",
"x-go-name": "Role"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/models"
@@ -8553,7 +8562,10 @@
"x-go-name": "Name"
},
"role": {
"$ref": "#/definitions/RoleType"
"type": "string",
"enum": ["Viewer", "Editor", "Admin"],
"x-go-enum-desc": "Viewer ROLE_VIEWER\nEditor ROLE_EDITOR\nAdmin ROLE_ADMIN",
"x-go-name": "Role"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/models"
@@ -9047,7 +9059,10 @@
"x-go-name": "PermissionName"
},
"role": {
"$ref": "#/definitions/RoleType"
"type": "string",
"enum": ["Viewer", "Editor", "Admin"],
"x-go-enum-desc": "Viewer ROLE_VIEWER\nEditor ROLE_EDITOR\nAdmin ROLE_ADMIN",
"x-go-name": "Role"
},
"slug": {
"type": "string",
@@ -9114,7 +9129,10 @@
"$ref": "#/definitions/PermissionType"
},
"role": {
"$ref": "#/definitions/RoleType"
"type": "string",
"enum": ["Viewer", "Editor", "Admin"],
"x-go-enum-desc": "Viewer ROLE_VIEWER\nEditor ROLE_EDITOR\nAdmin ROLE_ADMIN",
"x-go-name": "Role"
},
"teamId": {
"type": "integer",
@@ -11254,10 +11272,6 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/services/accesscontrol"
},
"RoleType": {
"type": "string",
"x-go-package": "github.com/grafana/grafana/pkg/models"
},
"SaveDashboardCommand": {
"type": "object",
"properties": {
@@ -11709,7 +11723,10 @@
"x-go-name": "OrgId"
},
"role": {
"$ref": "#/definitions/RoleType"
"type": "string",
"enum": ["Viewer", "Editor", "Admin"],
"x-go-enum-desc": "Viewer ROLE_VIEWER\nEditor ROLE_EDITOR\nAdmin ROLE_ADMIN",
"x-go-name": "Role"
},
"status": {
"$ref": "#/definitions/TempUserStatus"
@@ -12181,7 +12198,10 @@
"type": "object",
"properties": {
"role": {
"$ref": "#/definitions/RoleType"
"type": "string",
"enum": ["Viewer", "Editor", "Admin"],
"x-go-enum-desc": "Viewer ROLE_VIEWER\nEditor ROLE_EDITOR\nAdmin ROLE_ADMIN",
"x-go-name": "Role"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/models"
@@ -12370,7 +12390,10 @@
"x-go-name": "OrgId"
},
"role": {
"$ref": "#/definitions/RoleType"
"type": "string",
"enum": ["Viewer", "Editor", "Admin"],
"x-go-enum-desc": "Viewer ROLE_VIEWER\nEditor ROLE_EDITOR\nAdmin ROLE_ADMIN",
"x-go-name": "Role"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/models"