From 3f00802ace3744035c295076c8472dda8dab2276 Mon Sep 17 00:00:00 2001 From: Augustus Mayo Date: Fri, 23 Aug 2024 13:42:00 -0500 Subject: [PATCH] Installer and initial data fixes --- .gitignore | 1 + Cargo.lock | 26 +- Cargo.toml | 2 + rfd-api-spec.json | 4654 ++++------------------------------- rfd-api/src/initial_data.rs | 2 +- rfd-installer/Cargo.toml | 20 + rfd-installer/src/lib.rs | 31 + rfd-installer/src/main.rs | 13 + 8 files changed, 533 insertions(+), 4216 deletions(-) create mode 100644 rfd-installer/Cargo.toml create mode 100644 rfd-installer/src/lib.rs create mode 100644 rfd-installer/src/main.rs diff --git a/.gitignore b/.gitignore index d132886..c88223d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,6 @@ mappers.toml spec.toml key.json test-key.json +gcp.json node_modules diff --git a/Cargo.lock b/Cargo.lock index a7143fd..8d79a63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -755,7 +755,7 @@ dependencies = [ [[package]] name = "dropshot-authorization-header" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/v-api#0598b4b04444fc0bbb5cd0ba000fbb1ff2a8ac76" +source = "git+https://github.com/oxidecomputer/v-api#25f27051375cbb1b4b82a3605a54efd52bdd6c7e" dependencies = [ "async-trait", "base64 0.22.1", @@ -2701,6 +2701,15 @@ dependencies = [ "tracing", ] +[[package]] +name = "rfd-installer" +version = "0.1.0" +dependencies = [ + "diesel", + "diesel_migrations", + "v-api-installer", +] + [[package]] name = "rfd-model" version = "0.1.0" @@ -4043,7 +4052,7 @@ dependencies = [ [[package]] name = "v-api" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/v-api#0598b4b04444fc0bbb5cd0ba000fbb1ff2a8ac76" +source = "git+https://github.com/oxidecomputer/v-api#25f27051375cbb1b4b82a3605a54efd52bdd6c7e" dependencies = [ "async-trait", "base64 0.22.1", @@ -4083,10 +4092,19 @@ dependencies = [ "yup-oauth2", ] +[[package]] +name = "v-api-installer" +version = "0.1.0" +source = "git+https://github.com/oxidecomputer/v-api#25f27051375cbb1b4b82a3605a54efd52bdd6c7e" +dependencies = [ + "diesel", + "diesel_migrations", +] + [[package]] name = "v-api-permission-derive" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/v-api#0598b4b04444fc0bbb5cd0ba000fbb1ff2a8ac76" +source = "git+https://github.com/oxidecomputer/v-api#25f27051375cbb1b4b82a3605a54efd52bdd6c7e" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -4097,7 +4115,7 @@ dependencies = [ [[package]] name = "v-model" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/v-api#0598b4b04444fc0bbb5cd0ba000fbb1ff2a8ac76" +source = "git+https://github.com/oxidecomputer/v-api#25f27051375cbb1b4b82a3605a54efd52bdd6c7e" dependencies = [ "async-bb8-diesel", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index b6a6f21..29accdc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ members = [ "rfd-cli", "rfd-data", "rfd-github", + "rfd-installer", "rfd-model", "rfd-processor", "rfd-sdk", @@ -26,6 +27,7 @@ config = { version = "0.14.0", features = ["toml"] } cookie = { version = "0.18.1" } crc32c = "0.6.8" diesel = { version = "2.2.2", features = ["postgres"] } +diesel_migrations = { version = "2.2.0" } dirs = "5.0.1" dropshot = "0.10.1" dropshot-verified-body = { git = "https://github.com/oxidecomputer/dropshot-verified-body" } diff --git a/rfd-api-spec.json b/rfd-api-spec.json index ba21a1a..bf21bde 100644 --- a/rfd-api-spec.json +++ b/rfd-api-spec.json @@ -10,16 +10,33 @@ "version": "" }, "paths": { - "/.well-known/jwks.json": { - "get": { - "operationId": "jwks_json", + "/github": { + "post": { + "tags": [ + "hidden" + ], + "operationId": "github_webhook", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GitHubCommitPayload" + } + } + }, + "required": true + }, "responses": { - "200": { - "description": "successful operation", + "202": { + "description": "successfully enqueued operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Jwks" + "title": "Null", + "type": "string", + "enum": [ + null + ] } } } @@ -33,16 +50,21 @@ } } }, - "/.well-known/openid-configuration": { + "/rfd": { "get": { - "operationId": "openid_configuration", + "summary": "List all available RFDs", + "operationId": "get_rfds", "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OpenIdConfiguration" + "title": "Array_of_ListRfd", + "type": "array", + "items": { + "$ref": "#/components/schemas/ListRfd" + } } } } @@ -54,29 +76,27 @@ "$ref": "#/components/responses/Error" } } - } - }, - "/api-user": { + }, "post": { - "summary": "Create a new user with a given set of permissions", - "operationId": "create_api_user", + "summary": "Create a new RFD", + "operationId": "reserve_rfd", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ApiUserUpdateParams" + "$ref": "#/components/schemas/ReserveRfdBody" } } }, "required": true }, "responses": { - "201": { - "description": "successful creation", + "202": { + "description": "successfully enqueued operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ApiUser_for_ApiPermissionResponse" + "$ref": "#/components/schemas/ReserveRfdResponse" } } } @@ -90,18 +110,18 @@ } } }, - "/api-user/{identifier}": { + "/rfd/{number}": { "get": { - "summary": "Get user information for a given user id", - "operationId": "get_api_user", + "summary": "Get the latest representation of a RFD", + "operationId": "get_rfd", "parameters": [ { "in": "path", - "name": "identifier", + "name": "number", + "description": "The RFD number (examples: 1 or 123)", "required": true, "schema": { - "type": "string", - "format": "uuid" + "type": "string" } } ], @@ -111,7 +131,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GetUserResponse" + "$ref": "#/components/schemas/FullRfd" } } } @@ -125,16 +145,16 @@ } }, "post": { - "summary": "Update the permissions assigned to a given user", - "operationId": "update_api_user", + "summary": "Replace the full document of a RFD", + "operationId": "set_rfd_document", "parameters": [ { "in": "path", - "name": "identifier", + "name": "number", + "description": "The RFD number (examples: 1 or 123)", "required": true, "schema": { - "type": "string", - "format": "uuid" + "type": "string" } } ], @@ -142,19 +162,23 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ApiUserUpdateParams" + "$ref": "#/components/schemas/RfdUpdateBody" } } }, "required": true }, "responses": { - "200": { - "description": "successful operation", + "202": { + "description": "successfully enqueued operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ApiUser_for_ApiPermissionResponse" + "title": "Null", + "type": "string", + "enum": [ + null + ] } } } @@ -168,37 +192,35 @@ } } }, - "/api-user/{identifier}/group": { - "post": { - "operationId": "add_api_user_to_group", + "/rfd/{number}/attr/{attr}": { + "get": { + "summary": "Get an attribute of a RFD", + "operationId": "get_rfd_attr", "parameters": [ { "in": "path", - "name": "identifier", + "name": "attr", + "required": true, + "schema": { + "$ref": "#/components/schemas/RfdAttrName" + } + }, + { + "in": "path", + "name": "number", "required": true, "schema": { - "type": "string", - "format": "uuid" + "type": "string" } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AddGroupBody" - } - } - }, - "required": true - }, "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ApiUser_for_ApiPermissionResponse" + "$ref": "#/components/schemas/RfdAttr" } } } @@ -210,77 +232,45 @@ "$ref": "#/components/responses/Error" } } - } - }, - "/api-user/{identifier}/group/{group_id}": { - "delete": { - "operationId": "remove_api_user_from_group", + }, + "post": { + "summary": "Set an attribute of a RFD", + "operationId": "set_rfd_attr", "parameters": [ { "in": "path", - "name": "group_id", + "name": "attr", "required": true, "schema": { - "type": "string", - "format": "uuid" + "$ref": "#/components/schemas/RfdAttrName" } }, { "in": "path", - "name": "identifier", + "name": "number", "required": true, "schema": { - "type": "string", - "format": "uuid" + "type": "string" } } ], - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiUser_for_ApiPermissionResponse" - } + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RfdAttrValue" } } }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/api-user/{identifier}/token": { - "get": { - "summary": "List the active and expired API tokens for a given user", - "operationId": "list_api_user_tokens", - "parameters": [ - { - "in": "path", - "name": "identifier", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - } - ], + "required": true + }, "responses": { - "200": { - "description": "successful operation", + "202": { + "description": "successfully enqueued operation", "content": { "application/json": { "schema": { - "title": "Array_of_ApiKeyResponse", - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiKeyResponse" - } + "$ref": "#/components/schemas/RfdAttr" } } } @@ -292,17 +282,20 @@ "$ref": "#/components/responses/Error" } } - }, + } + }, + "/rfd/{number}/content": { "post": { - "operationId": "create_api_user_token", + "summary": "Replace the contents of a RFD", + "operationId": "set_rfd_content", "parameters": [ { "in": "path", - "name": "identifier", + "name": "number", + "description": "The RFD number (examples: 1 or 123)", "required": true, "schema": { - "type": "string", - "format": "uuid" + "type": "string" } } ], @@ -310,19 +303,23 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ApiKeyCreateParams" + "$ref": "#/components/schemas/RfdUpdateContentBody" } } }, "required": true }, "responses": { - "201": { - "description": "successful creation", + "202": { + "description": "successfully enqueued operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/InitialApiKeyResponse" + "title": "Null", + "type": "string", + "enum": [ + null + ] } } } @@ -336,36 +333,28 @@ } } }, - "/api-user/{identifier}/token/{token_identifier}": { - "get": { - "operationId": "get_api_user_token", + "/rfd/{number}/discuss": { + "post": { + "summary": "Open a RFD for discussion", + "operationId": "discuss_rfd", "parameters": [ { "in": "path", - "name": "identifier", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - }, - { - "in": "path", - "name": "token_identifier", + "name": "number", + "description": "The RFD number (examples: 1 or 123)", "required": true, "schema": { - "type": "string", - "format": "uuid" + "type": "string" } } ], "responses": { - "200": { - "description": "successful operation", + "202": { + "description": "successfully enqueued operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ApiKeyResponse" + "$ref": "#/components/schemas/RfdAttr" } } } @@ -377,36 +366,30 @@ "$ref": "#/components/responses/Error" } } - }, - "delete": { - "operationId": "delete_api_user_token", + } + }, + "/rfd/{number}/publish": { + "post": { + "summary": "Publish a RFD", + "operationId": "publish_rfd", "parameters": [ { "in": "path", - "name": "identifier", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - }, - { - "in": "path", - "name": "token_identifier", + "name": "number", + "description": "The RFD number (examples: 1 or 123)", "required": true, "schema": { - "type": "string", - "format": "uuid" + "type": "string" } } ], "responses": { - "200": { - "description": "successful operation", + "202": { + "description": "successfully enqueued operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ApiKeyResponse" + "$ref": "#/components/schemas/RfdAttr" } } } @@ -420,33 +403,38 @@ } } }, - "/github": { + "/rfd/{number}/visibility": { "post": { - "tags": [ - "hidden" + "summary": "Modify the visibility of a RFD", + "operationId": "update_rfd_visibility", + "parameters": [ + { + "in": "path", + "name": "number", + "description": "The RFD number (examples: 1 or 123)", + "required": true, + "schema": { + "type": "string" + } + } ], - "operationId": "github_webhook", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GitHubCommitPayload" + "$ref": "#/components/schemas/RfdVisibility" } } }, "required": true }, "responses": { - "202": { - "description": "successfully enqueued operation", + "200": { + "description": "successful operation", "content": { "application/json": { "schema": { - "title": "Null", - "type": "string", - "enum": [ - null - ] + "$ref": "#/components/schemas/Rfd" } } } @@ -460,206 +448,30 @@ } } }, - "/group": { + "/rfd-search": { "get": { - "operationId": "get_groups", - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "title": "Array_of_AccessGroup_for_ApiPermissionResponse", - "type": "array", - "items": { - "$ref": "#/components/schemas/AccessGroup_for_ApiPermissionResponse" - } - } - } + "summary": "Search the RFD index and get a list of results", + "operationId": "search_rfds", + "parameters": [ + { + "in": "query", + "name": "attributes_to_crop", + "schema": { + "nullable": true, + "type": "string" } }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - }, - "post": { - "operationId": "create_group", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AccessGroupUpdateParams" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "successful creation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AccessGroup_for_ApiPermissionResponse" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/group/{group_id}": { - "put": { - "operationId": "update_group", - "parameters": [ - { - "in": "path", - "name": "group_id", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AccessGroupUpdateParams" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AccessGroup_for_ApiPermissionResponse" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - }, - "delete": { - "operationId": "delete_group", - "parameters": [ - { - "in": "path", - "name": "group_id", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - } - ], - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AccessGroup_for_ApiPermissionResponse" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/login/local": { - "post": { - "operationId": "local_login", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LocalLogin" - } - } - }, - "required": true - }, - "responses": { - "default": { - "description": "", - "content": { - "*/*": { - "schema": {} - } - } - } - } - } - }, - "/login/oauth/{provider}/code/authorize": { - "get": { - "summary": "Generate the remote provider login url and redirect the user", - "operationId": "authz_code_redirect", - "parameters": [ - { - "in": "path", - "name": "provider", - "required": true, - "schema": { - "$ref": "#/components/schemas/OAuthProviderName" - } - }, - { - "in": "query", - "name": "client_id", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - }, - { - "in": "query", - "name": "redirect_uri", - "required": true, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "response_type", - "required": true, - "schema": { - "type": "string" - } + { + "in": "query", + "name": "highlight_post_tag", + "schema": { + "nullable": true, + "type": "string" + } }, { "in": "query", - "name": "scope", + "name": "highlight_pre_tag", "schema": { "nullable": true, "type": "string" @@ -667,117 +479,40 @@ }, { "in": "query", - "name": "state", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "default": { - "description": "", - "content": { - "*/*": { - "schema": {} - } - } - } - } - } - }, - "/login/oauth/{provider}/code/callback": { - "get": { - "summary": "Handle return calls from a remote OAuth provider", - "operationId": "authz_code_callback", - "parameters": [ - { - "in": "path", - "name": "provider", - "required": true, - "schema": { - "$ref": "#/components/schemas/OAuthProviderName" - } - }, - { - "in": "query", - "name": "code", + "name": "limit", "schema": { "nullable": true, - "type": "string" + "type": "integer", + "format": "uint32", + "minimum": 0 } }, { "in": "query", - "name": "error", + "name": "offset", "schema": { "nullable": true, - "type": "string" + "type": "integer", + "format": "uint32", + "minimum": 0 } }, { "in": "query", - "name": "state", - "schema": { - "nullable": true, - "type": "string" - } - } - ], - "responses": { - "307": { - "description": "redirect (temporary redirect)", - "headers": { - "location": { - "description": "HTTP \"Location\" header", - "style": "simple", - "required": true, - "schema": { - "type": "string" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/login/oauth/{provider}/code/token": { - "post": { - "summary": "Exchange an authorization code for an access token", - "operationId": "authz_code_exchange", - "parameters": [ - { - "in": "path", - "name": "provider", + "name": "q", "required": true, "schema": { - "$ref": "#/components/schemas/OAuthProviderName" + "type": "string" } } ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/OAuthAuthzCodeExchangeBody" - } - } - }, - "required": true - }, "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OAuthAuthzCodeExchangeResponse" + "$ref": "#/components/schemas/SearchResults" } } } @@ -790,3899 +525,396 @@ } } } - }, - "/login/oauth/{provider}/device": { - "get": { - "operationId": "get_device_provider", - "parameters": [ - { - "in": "path", - "name": "provider", - "required": true, - "schema": { - "$ref": "#/components/schemas/OAuthProviderName" - } - } - ], - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OAuthProviderInfo" - } - } - } + } + }, + "components": { + "schemas": { + "CommitSha": { + "type": "string" + }, + "ContentFormat": { + "type": "string", + "enum": [ + "asciidoc", + "markdown" + ] + }, + "Error": { + "description": "Error information from a response.", + "type": "object", + "properties": { + "error_code": { + "type": "string" }, - "4XX": { - "$ref": "#/components/responses/Error" + "message": { + "type": "string" }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/login/oauth/{provider}/device/exchange": { - "post": { - "operationId": "exchange_device_token", - "parameters": [ - { - "in": "path", - "name": "provider", - "required": true, - "schema": { - "$ref": "#/components/schemas/OAuthProviderName" - } - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/AccessTokenExchangeRequest" - } - } - }, - "required": true - }, - "responses": { - "default": { - "description": "", - "content": { - "*/*": { - "schema": {} - } - } - } - } - } - }, - "/mapper": { - "get": { - "operationId": "get_mappers", - "parameters": [ - { - "in": "query", - "name": "include_depleted", - "description": "Include depleted mappers in the returned results", - "schema": { - "nullable": true, - "type": "boolean" - } - } - ], - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "title": "Array_of_Mapper", - "type": "array", - "items": { - "$ref": "#/components/schemas/Mapper" - } - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - }, - "post": { - "operationId": "create_mapper", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateMapper" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "successful creation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Mapper" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/mapper/{identifier}": { - "delete": { - "operationId": "delete_mapper", - "parameters": [ - { - "in": "path", - "name": "identifier", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - } - ], - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Mapper" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/oauth/client": { - "get": { - "summary": "List OAuth clients", - "operationId": "list_oauth_clients", - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "title": "Array_of_OAuthClient", - "type": "array", - "items": { - "$ref": "#/components/schemas/OAuthClient" - } - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - }, - "post": { - "summary": "Create a new OAuth Client", - "operationId": "create_oauth_client", - "responses": { - "201": { - "description": "successful creation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OAuthClient" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/oauth/client/{client_id}": { - "get": { - "summary": "Get an new OAuth Client", - "operationId": "get_oauth_client", - "parameters": [ - { - "in": "path", - "name": "client_id", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - } - ], - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OAuthClient" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/oauth/client/{client_id}/redirect_uri": { - "post": { - "summary": "Add an OAuth client redirect uri", - "operationId": "create_oauth_client_redirect_uri", - "parameters": [ - { - "in": "path", - "name": "client_id", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AddOAuthClientRedirectBody" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OAuthClientRedirectUri" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/oauth/client/{client_id}/redirect_uri/{redirect_uri_id}": { - "delete": { - "summary": "Delete an OAuth client redirect uri", - "operationId": "delete_oauth_client_redirect_uri", - "parameters": [ - { - "in": "path", - "name": "client_id", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - }, - { - "in": "path", - "name": "redirect_uri_id", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - } - ], - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OAuthClientRedirectUri" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/oauth/client/{client_id}/secret": { - "post": { - "summary": "Add an OAuth client secret", - "operationId": "create_oauth_client_secret", - "parameters": [ - { - "in": "path", - "name": "client_id", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - } - ], - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InitialOAuthClientSecretResponse" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/oauth/client/{client_id}/secret/{secret_id}": { - "delete": { - "summary": "Delete an OAuth client secret", - "operationId": "delete_oauth_client_secret", - "parameters": [ - { - "in": "path", - "name": "client_id", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - }, - { - "in": "path", - "name": "secret_id", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - } - ], - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OAuthClientSecret" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/rfd": { - "get": { - "summary": "List all available RFDs", - "operationId": "get_rfds", - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "title": "Array_of_ListRfd", - "type": "array", - "items": { - "$ref": "#/components/schemas/ListRfd" - } - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - }, - "post": { - "summary": "Create a new RFD", - "operationId": "reserve_rfd", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ReserveRfdBody" - } - } - }, - "required": true - }, - "responses": { - "202": { - "description": "successfully enqueued operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ReserveRfdResponse" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/rfd/{number}": { - "get": { - "summary": "Get the latest representation of a RFD", - "operationId": "get_rfd", - "parameters": [ - { - "in": "path", - "name": "number", - "description": "The RFD number (examples: 1 or 123)", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/FullRfd" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - }, - "post": { - "summary": "Replace the full document of a RFD", - "operationId": "set_rfd_document", - "parameters": [ - { - "in": "path", - "name": "number", - "description": "The RFD number (examples: 1 or 123)", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RfdUpdateBody" - } - } - }, - "required": true - }, - "responses": { - "202": { - "description": "successfully enqueued operation", - "content": { - "application/json": { - "schema": { - "title": "Null", - "type": "string", - "enum": [ - null - ] - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/rfd/{number}/attr/{attr}": { - "get": { - "summary": "Get an attribute of a RFD", - "operationId": "get_rfd_attr", - "parameters": [ - { - "in": "path", - "name": "attr", - "required": true, - "schema": { - "$ref": "#/components/schemas/RfdAttrName" - } - }, - { - "in": "path", - "name": "number", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RfdAttr" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - }, - "post": { - "summary": "Set an attribute of a RFD", - "operationId": "set_rfd_attr", - "parameters": [ - { - "in": "path", - "name": "attr", - "required": true, - "schema": { - "$ref": "#/components/schemas/RfdAttrName" - } - }, - { - "in": "path", - "name": "number", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RfdAttrValue" - } - } - }, - "required": true - }, - "responses": { - "202": { - "description": "successfully enqueued operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RfdAttr" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/rfd/{number}/content": { - "post": { - "summary": "Replace the contents of a RFD", - "operationId": "set_rfd_content", - "parameters": [ - { - "in": "path", - "name": "number", - "description": "The RFD number (examples: 1 or 123)", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RfdUpdateContentBody" - } - } - }, - "required": true - }, - "responses": { - "202": { - "description": "successfully enqueued operation", - "content": { - "application/json": { - "schema": { - "title": "Null", - "type": "string", - "enum": [ - null - ] - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/rfd/{number}/discuss": { - "post": { - "summary": "Open a RFD for discussion", - "operationId": "discuss_rfd", - "parameters": [ - { - "in": "path", - "name": "number", - "description": "The RFD number (examples: 1 or 123)", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "202": { - "description": "successfully enqueued operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RfdAttr" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/rfd/{number}/publish": { - "post": { - "summary": "Publish a RFD", - "operationId": "publish_rfd", - "parameters": [ - { - "in": "path", - "name": "number", - "description": "The RFD number (examples: 1 or 123)", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "202": { - "description": "successfully enqueued operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RfdAttr" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/rfd/{number}/visibility": { - "post": { - "summary": "Modify the visibility of a RFD", - "operationId": "update_rfd_visibility", - "parameters": [ - { - "in": "path", - "name": "number", - "description": "The RFD number (examples: 1 or 123)", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RfdVisibility" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Rfd" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/rfd-search": { - "get": { - "summary": "Search the RFD index and get a list of results", - "operationId": "search_rfds", - "parameters": [ - { - "in": "query", - "name": "attributes_to_crop", - "schema": { - "nullable": true, - "type": "string" - } - }, - { - "in": "query", - "name": "highlight_post_tag", - "schema": { - "nullable": true, - "type": "string" - } - }, - { - "in": "query", - "name": "highlight_pre_tag", - "schema": { - "nullable": true, - "type": "string" - } - }, - { - "in": "query", - "name": "limit", - "schema": { - "nullable": true, - "type": "integer", - "format": "uint32", - "minimum": 0 - } - }, - { - "in": "query", - "name": "offset", - "schema": { - "nullable": true, - "type": "integer", - "format": "uint32", - "minimum": 0 - } - }, - { - "in": "query", - "name": "q", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SearchResults" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - }, - "/self": { - "get": { - "summary": "Retrieve the user information of the calling user", - "operationId": "get_self", - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetUserResponse" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } - } - }, - "components": { - "schemas": { - "AccessGroupUpdateParams": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "permissions": { - "$ref": "#/components/schemas/Permissions_for_ApiPermission" - } - }, - "required": [ - "name", - "permissions" - ] - }, - "AccessGroup_for_ApiPermissionResponse": { - "type": "object", - "properties": { - "created_at": { - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "nullable": true, - "type": "string", - "format": "date-time" - }, - "id": { - "type": "string", - "format": "uuid" - }, - "name": { - "type": "string" - }, - "permissions": { - "$ref": "#/components/schemas/Permissions_for_ApiPermissionResponse" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - }, - "required": [ - "created_at", - "id", - "name", - "permissions", - "updated_at" - ] - }, - "AccessTokenExchangeRequest": { - "type": "object", - "properties": { - "device_code": { - "type": "string" - }, - "expires_at": { - "nullable": true, - "type": "string", - "format": "date-time" - }, - "grant_type": { - "type": "string" - } - }, - "required": [ - "device_code", - "grant_type" - ] - }, - "AddGroupBody": { - "type": "object", - "properties": { - "group_id": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "group_id" - ] - }, - "AddOAuthClientRedirectBody": { - "type": "object", - "properties": { - "redirect_uri": { - "type": "string" - } - }, - "required": [ - "redirect_uri" - ] - }, - "ApiKeyCreateParams": { - "type": "object", - "properties": { - "expires_at": { - "type": "string", - "format": "date-time" - }, - "permissions": { - "nullable": true, - "allOf": [ - { - "$ref": "#/components/schemas/Permissions_for_ApiPermissionResponse" - } - ] - } - }, - "required": [ - "expires_at" - ] - }, - "ApiKeyResponse": { - "type": "object", - "properties": { - "created_at": { - "type": "string", - "format": "date-time" - }, - "id": { - "type": "string", - "format": "uuid" - }, - "permissions": { - "nullable": true, - "allOf": [ - { - "$ref": "#/components/schemas/Permissions_for_ApiPermissionResponse" - } - ] - } - }, - "required": [ - "created_at", - "id" - ] - }, - "ApiPermission": { - "oneOf": [ - { - "type": "string", - "enum": [ - "CreateApiUserTokenSelf", - "CreateApiUserTokenAssigned", - "CreateApiUserTokenAll", - "GetApiUserSelf", - "GetApiUserAssigned", - "GetApiUserAll", - "GetApiUserTokenSelf", - "GetApiUserTokenAssigned", - "GetApiUserTokenAll", - "DeleteApiUserTokenSelf", - "DeleteApiUserTokenAssigned", - "DeleteApiUserTokenAll", - "CreateApiUser", - "UpdateApiUserSelf", - "UpdateApiUserAssigned", - "UpdateApiUserAll", - "CreateUserApiProviderLinkToken", - "GetGroupsJoined", - "GetGroupsAll", - "CreateGroup", - "ManageGroupMembershipAssigned", - "ManageGroupMembershipAll", - "ManageGroupsAssigned", - "ManageGroupsAll", - "ListMappers", - "CreateMapper", - "ManageMappersAssigned", - "ManageMappersAll", - "GetRfdsAssigned", - "GetRfdsAll", - "CreateRfd", - "UpdateRfdsAssigned", - "UpdateRfdsAll", - "ManageRfdsVisibilityAssigned", - "ManageRfdsVisibilityAll", - "GetDiscussionsAssigned", - "GetDiscussionsAll", - "SearchRfds", - "CreateOAuthClient", - "GetOAuthClientsAssigned", - "GetOAuthClientsAll", - "UpdateOAuthClientsAssigned", - "UpdateOAuthClientsAll", - "DeleteOAuthClientsAssigned", - "DeleteOAuthClientsAll", - "CreateAccessToken", - "Removed" - ] - }, - { - "type": "object", - "properties": { - "CreateApiUserToken": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "CreateApiUserToken" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "GetApiUser": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "GetApiUser" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "GetApiUserToken": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "GetApiUserToken" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "DeleteApiUserToken": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "DeleteApiUserToken" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "UpdateApiUser": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "UpdateApiUser" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "UpdateGroup": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "UpdateGroup" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "AddToGroup": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "AddToGroup" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "RemoveFromGroup": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "RemoveFromGroup" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "ManageGroupMembership": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "ManageGroupMembership" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "ManageGroupMemberships": { - "type": "array", - "items": { - "type": "string", - "format": "uuid" - }, - "uniqueItems": true - } - }, - "required": [ - "ManageGroupMemberships" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "DeleteGroup": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "DeleteGroup" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "ManageGroup": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "ManageGroup" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "ManageGroups": { - "type": "array", - "items": { - "type": "string", - "format": "uuid" - }, - "uniqueItems": true - } - }, - "required": [ - "ManageGroups" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "UpdateMapper": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "UpdateMapper" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "DeleteMapper": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "DeleteMapper" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "ManageMapper": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "ManageMapper" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "ManageMappers": { - "type": "array", - "items": { - "type": "string", - "format": "uuid" - }, - "uniqueItems": true - } - }, - "required": [ - "ManageMappers" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "GetRfd": { - "type": "integer", - "format": "int32" - } - }, - "required": [ - "GetRfd" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "GetRfds": { - "type": "array", - "items": { - "type": "integer", - "format": "int32" - }, - "uniqueItems": true - } - }, - "required": [ - "GetRfds" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "UpdateRfd": { - "type": "integer", - "format": "int32" - } - }, - "required": [ - "UpdateRfd" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "UpdateRfds": { - "type": "array", - "items": { - "type": "integer", - "format": "int32" - }, - "uniqueItems": true - } - }, - "required": [ - "UpdateRfds" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "ManageRfdVisibility": { - "type": "integer", - "format": "int32" - } - }, - "required": [ - "ManageRfdVisibility" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "ManageRfdsVisibility": { - "type": "array", - "items": { - "type": "integer", - "format": "int32" - }, - "uniqueItems": true - } - }, - "required": [ - "ManageRfdsVisibility" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "GetDiscussion": { - "type": "integer", - "format": "int32" - } - }, - "required": [ - "GetDiscussion" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "GetDiscussions": { - "type": "array", - "items": { - "type": "integer", - "format": "int32" - }, - "uniqueItems": true - } - }, - "required": [ - "GetDiscussions" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "GetOAuthClient": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "GetOAuthClient" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "GetOAuthClients": { - "type": "array", - "items": { - "type": "string", - "format": "uuid" - }, - "uniqueItems": true - } - }, - "required": [ - "GetOAuthClients" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "UpdateOAuthClient": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "UpdateOAuthClient" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "UpdateOAuthClients": { - "type": "array", - "items": { - "type": "string", - "format": "uuid" - }, - "uniqueItems": true - } - }, - "required": [ - "UpdateOAuthClients" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "DeleteOAuthClient": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "DeleteOAuthClient" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "DeleteOAuthClients": { - "type": "array", - "items": { - "type": "string", - "format": "uuid" - }, - "uniqueItems": true - } - }, - "required": [ - "DeleteOAuthClients" - ], - "additionalProperties": false - } - ] - }, - "ApiPermissionResponse": { - "oneOf": [ - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "CreateApiUserToken" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "CreateApiUserTokenSelf" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "CreateApiUserTokenAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "CreateApiUserTokenAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetApiUser" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetApiUserSelf" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetApiUserAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetApiUserAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetApiUserToken" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetApiUserTokenSelf" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetApiUserTokenAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetApiUserTokenAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "DeleteApiUserToken" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "DeleteApiUserTokenSelf" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "DeleteApiUserTokenAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "DeleteApiUserTokenAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "CreateApiUser" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "UpdateApiUser" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "UpdateApiUserSelf" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "UpdateApiUserAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "UpdateApiUserAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "CreateUserApiProviderLinkToken" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetGroupsJoined" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetGroupsAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "CreateGroup" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "UpdateGroup" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "AddToGroup" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "RemoveFromGroup" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageGroupMembership" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageGroupMemberships" - ] - }, - "value": { - "type": "array", - "items": { - "type": "string", - "format": "uuid" - }, - "uniqueItems": true - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageGroupMembershipAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageGroupMembershipAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "DeleteGroup" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageGroup" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageGroups" - ] - }, - "value": { - "type": "array", - "items": { - "type": "string", - "format": "uuid" - }, - "uniqueItems": true - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageGroupsAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageGroupsAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ListMappers" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "CreateMapper" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "UpdateMapper" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "DeleteMapper" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageMapper" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageMappers" - ] - }, - "value": { - "type": "array", - "items": { - "type": "string", - "format": "uuid" - }, - "uniqueItems": true - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageMappersAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageMappersAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetRfd" - ] - }, - "value": { - "type": "integer", - "format": "int32" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetRfds" - ] - }, - "value": { - "type": "array", - "items": { - "type": "integer", - "format": "int32" - }, - "uniqueItems": true - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetRfdsAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetRfdsAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "CreateRfd" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "UpdateRfd" - ] - }, - "value": { - "type": "integer", - "format": "int32" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "UpdateRfds" - ] - }, - "value": { - "type": "array", - "items": { - "type": "integer", - "format": "int32" - }, - "uniqueItems": true - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "UpdateRfdsAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "UpdateRfdsAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageRfdVisibility" - ] - }, - "value": { - "type": "integer", - "format": "int32" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageRfdsVisibility" - ] - }, - "value": { - "type": "array", - "items": { - "type": "integer", - "format": "int32" - }, - "uniqueItems": true - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageRfdsVisibilityAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "ManageRfdsVisibilityAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetDiscussion" - ] - }, - "value": { - "type": "integer", - "format": "int32" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetDiscussions" - ] - }, - "value": { - "type": "array", - "items": { - "type": "integer", - "format": "int32" - }, - "uniqueItems": true - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetDiscussionsAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetDiscussionsAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "SearchRfds" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "CreateOAuthClient" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetOAuthClient" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetOAuthClients" - ] - }, - "value": { - "type": "array", - "items": { - "type": "string", - "format": "uuid" - }, - "uniqueItems": true - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetOAuthClientsAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "GetOAuthClientsAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "UpdateOAuthClient" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "UpdateOAuthClients" - ] - }, - "value": { - "type": "array", - "items": { - "type": "string", - "format": "uuid" - }, - "uniqueItems": true - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "UpdateOAuthClientsAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "UpdateOAuthClientsAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "DeleteOAuthClient" - ] - }, - "value": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "DeleteOAuthClients" - ] - }, - "value": { - "type": "array", - "items": { - "type": "string", - "format": "uuid" - }, - "uniqueItems": true - } - }, - "required": [ - "kind", - "value" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "DeleteOAuthClientsAssigned" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "DeleteOAuthClientsAll" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "CreateAccessToken" - ] - } - }, - "required": [ - "kind" - ] - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": [ - "Removed" - ] - } - }, - "required": [ - "kind" - ] - } - ] - }, - "ApiUserProvider": { - "type": "object", - "properties": { - "api_user_id": { - "type": "string", - "format": "uuid" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "nullable": true, - "type": "string", - "format": "date-time" - }, - "display_names": { - "type": "array", - "items": { - "type": "string" - } - }, - "emails": { - "type": "array", - "items": { - "type": "string" - } - }, - "id": { - "type": "string", - "format": "uuid" - }, - "provider": { - "type": "string" - }, - "provider_id": { - "type": "string" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - }, - "required": [ - "api_user_id", - "created_at", - "display_names", - "emails", - "id", - "provider", - "provider_id", - "updated_at" - ] - }, - "ApiUserUpdateParams": { - "type": "object", - "properties": { - "groups": { - "type": "array", - "items": { - "type": "string", - "format": "uuid" - }, - "uniqueItems": true - }, - "permissions": { - "$ref": "#/components/schemas/Permissions_for_ApiPermission" - } - }, - "required": [ - "groups", - "permissions" - ] - }, - "ApiUser_for_ApiPermissionResponse": { - "type": "object", - "properties": { - "created_at": { - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "nullable": true, - "type": "string", - "format": "date-time" - }, - "groups": { - "type": "array", - "items": { - "type": "string", - "format": "uuid" - }, - "uniqueItems": true - }, - "id": { - "type": "string", - "format": "uuid" - }, - "permissions": { - "$ref": "#/components/schemas/Permissions_for_ApiPermissionResponse" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - }, - "required": [ - "created_at", - "groups", - "id", - "permissions", - "updated_at" - ] - }, - "CommitSha": { - "type": "string" - }, - "ContentFormat": { - "type": "string", - "enum": [ - "asciidoc", - "markdown" - ] - }, - "CreateMapper": { - "type": "object", - "properties": { - "max_activations": { - "nullable": true, - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - }, - "rule": { - "$ref": "#/components/schemas/MappingRules" - } - }, - "required": [ - "name", - "rule" - ] - }, - "Error": { - "description": "Error information from a response.", - "type": "object", - "properties": { - "error_code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "request_id": { - "type": "string" - } - }, - "required": [ - "message", - "request_id" - ] - }, - "FileSha": { - "type": "string" - }, - "FormattedSearchResultHit": { - "type": "object", - "properties": { - "anchor": { - "nullable": true, - "type": "string" - }, - "content": { - "nullable": true, - "type": "string" - }, - "hierarchy": { - "type": "array", - "items": { - "nullable": true, - "type": "string" - }, - "minItems": 6, - "maxItems": 6 - }, - "hierarchy_radio": { - "type": "array", - "items": { - "nullable": true, - "type": "string" - }, - "minItems": 6, - "maxItems": 6 - }, - "object_id": { - "type": "string" - }, - "rfd_number": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "url": { - "nullable": true, - "type": "string" - } - }, - "required": [ - "hierarchy", - "hierarchy_radio", - "object_id", - "rfd_number" - ] - }, - "FullRfd": { - "type": "object", - "properties": { - "authors": { - "nullable": true, - "type": "string" - }, - "commit": { - "$ref": "#/components/schemas/CommitSha" - }, - "committed_at": { - "type": "string", - "format": "date-time" - }, - "content": { - "type": "string" - }, - "discussion": { - "nullable": true, - "type": "string" - }, - "format": { - "$ref": "#/components/schemas/ContentFormat" - }, - "id": { - "type": "string", - "format": "uuid" - }, - "labels": { - "nullable": true, - "type": "string" - }, - "link": { - "nullable": true, - "type": "string" - }, - "pdfs": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FullRfdPdfEntry" - } - }, - "rfd_number": { - "type": "integer", - "format": "int32" - }, - "sha": { - "$ref": "#/components/schemas/FileSha" - }, - "state": { - "nullable": true, - "type": "string" - }, - "title": { - "type": "string" - }, - "visibility": { - "$ref": "#/components/schemas/Visibility" - } - }, - "required": [ - "commit", - "committed_at", - "content", - "format", - "id", - "pdfs", - "rfd_number", - "sha", - "title", - "visibility" - ] - }, - "FullRfdPdfEntry": { - "type": "object", - "properties": { - "link": { - "type": "string" - }, - "source": { - "type": "string" - } - }, - "required": [ - "link", - "source" - ] - }, - "GetUserResponse": { - "type": "object", - "properties": { - "info": { - "$ref": "#/components/schemas/ApiUser_for_ApiPermissionResponse" - }, - "providers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiUserProvider" - } - } - }, - "required": [ - "info", - "providers" - ] - }, - "GitHubCommit": { - "type": "object", - "properties": { - "added": { - "type": "array", - "items": { - "type": "string" - } - }, - "id": { - "type": "string" - }, - "modified": { - "type": "array", - "items": { - "type": "string" - } - }, - "removed": { - "type": "array", - "items": { - "type": "string" - } - }, - "timestamp": { - "type": "string", - "format": "date-time" - } - }, - "required": [ - "added", - "id", - "modified", - "removed", - "timestamp" - ] - }, - "GitHubCommitPayload": { - "type": "object", - "properties": { - "commits": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GitHubCommit" - } - }, - "head_commit": { - "nullable": true, - "allOf": [ - { - "$ref": "#/components/schemas/GitHubCommit" - } - ] - }, - "installation": { - "$ref": "#/components/schemas/GitHubInstallation" - }, - "ref": { - "type": "string" - }, - "repository": { - "$ref": "#/components/schemas/GitHubRepository" - }, - "sender": { - "$ref": "#/components/schemas/GitHubSender" - } - }, - "required": [ - "commits", - "installation", - "ref", - "repository", - "sender" - ] - }, - "GitHubInstallation": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "node_id": { - "type": "string" - } - }, - "required": [ - "id", - "node_id" - ] - }, - "GitHubRepository": { - "type": "object", - "properties": { - "default_branch": { - "type": "string" - }, - "id": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "name": { - "type": "string" - }, - "node_id": { - "type": "string" - }, - "owner": { - "$ref": "#/components/schemas/GitHubRepositoryOwner" - } - }, - "required": [ - "default_branch", - "id", - "name", - "node_id", - "owner" - ] - }, - "GitHubRepositoryOwner": { - "type": "object", - "properties": { - "login": { + "request_id": { "type": "string" } }, "required": [ - "login" + "message", + "request_id" ] }, - "GitHubSender": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "login": { - "type": "string" - }, - "node_id": { - "type": "string" - }, - "type": { - "type": "string" - } - }, - "required": [ - "id", - "login", - "node_id", - "type" - ] + "FileSha": { + "type": "string" }, - "InitialApiKeyResponse": { + "FormattedSearchResultHit": { "type": "object", "properties": { - "created_at": { - "type": "string", - "format": "date-time" - }, - "id": { - "type": "string", - "format": "uuid" - }, - "key": { - "$ref": "#/components/schemas/SecretString" - }, - "permissions": { + "anchor": { "nullable": true, - "allOf": [ - { - "$ref": "#/components/schemas/Permissions_for_ApiPermissionResponse" - } - ] - } - }, - "required": [ - "created_at", - "id", - "key" - ] - }, - "InitialOAuthClientSecretResponse": { - "type": "object", - "properties": { - "created_at": { - "type": "string", - "format": "date-time" - }, - "id": { - "type": "string", - "format": "uuid" - }, - "key": { - "$ref": "#/components/schemas/SecretString" - } - }, - "required": [ - "created_at", - "id", - "key" - ] - }, - "Jwk": { - "type": "object", - "properties": { - "e": { - "type": "string" - }, - "kid": { - "type": "string" - }, - "kty": { "type": "string" }, - "n": { + "content": { + "nullable": true, "type": "string" }, - "use": { - "type": "string" - } - }, - "required": [ - "e", - "kid", - "kty", - "n", - "use" - ] - }, - "Jwks": { - "type": "object", - "properties": { - "keys": { + "hierarchy": { "type": "array", "items": { - "$ref": "#/components/schemas/Jwk" - } - } - }, - "required": [ - "keys" - ] - }, - "ListRfd": { - "type": "object", - "properties": { - "authors": { - "nullable": true, - "type": "string" - }, - "commit": { - "$ref": "#/components/schemas/CommitSha" - }, - "committed_at": { - "type": "string", - "format": "date-time" - }, - "discussion": { - "nullable": true, - "type": "string" - }, - "format": { - "$ref": "#/components/schemas/ContentFormat" - }, - "id": { - "type": "string", - "format": "uuid" + "nullable": true, + "type": "string" + }, + "minItems": 6, + "maxItems": 6 }, - "labels": { - "nullable": true, - "type": "string" + "hierarchy_radio": { + "type": "array", + "items": { + "nullable": true, + "type": "string" + }, + "minItems": 6, + "maxItems": 6 }, - "link": { - "nullable": true, + "object_id": { "type": "string" }, "rfd_number": { "type": "integer", - "format": "int32" - }, - "sha": { - "$ref": "#/components/schemas/FileSha" + "format": "uint64", + "minimum": 0 }, - "state": { + "url": { "nullable": true, "type": "string" - }, - "title": { - "type": "string" - }, - "visibility": { - "$ref": "#/components/schemas/Visibility" - } - }, - "required": [ - "commit", - "committed_at", - "format", - "id", - "rfd_number", - "sha", - "title", - "visibility" - ] - }, - "LocalLogin": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "external_id": { - "type": "string" } }, "required": [ - "email", - "external_id" - ] - }, - "Mapper": { - "type": "object", - "properties": { - "activations": { - "nullable": true, - "type": "integer", - "format": "int32" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "nullable": true, - "type": "string", - "format": "date-time" - }, - "depleted_at": { - "nullable": true, - "type": "string", - "format": "date-time" - }, - "id": { - "type": "string", - "format": "uuid" - }, - "max_activations": { - "nullable": true, - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - }, - "rule": {} - }, - "required": [ - "created_at", - "id", - "name", - "rule" - ] - }, - "MappingRules": { - "oneOf": [ - { - "type": "object", - "properties": { - "groups": { - "default": [], - "type": "array", - "items": { - "type": "string" - } - }, - "permissions": { - "default": [], - "allOf": [ - { - "$ref": "#/components/schemas/Permissions_for_ApiPermission" - } - ] - }, - "rule": { - "type": "string", - "enum": [ - "default" - ] - } - }, - "required": [ - "rule" - ] - }, - { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "groups": { - "default": [], - "type": "array", - "items": { - "type": "string" - } - }, - "permissions": { - "default": [], - "allOf": [ - { - "$ref": "#/components/schemas/Permissions_for_ApiPermission" - } - ] - }, - "rule": { - "type": "string", - "enum": [ - "email_address" - ] - } - }, - "required": [ - "email", - "rule" - ] - }, - { - "type": "object", - "properties": { - "domain": { - "type": "string" - }, - "groups": { - "default": [], - "type": "array", - "items": { - "type": "string" - } - }, - "permissions": { - "default": [], - "allOf": [ - { - "$ref": "#/components/schemas/Permissions_for_ApiPermission" - } - ] - }, - "rule": { - "type": "string", - "enum": [ - "email_domain" - ] - } - }, - "required": [ - "domain", - "rule" - ] - }, - { - "type": "object", - "properties": { - "github_username": { - "type": "string" - }, - "groups": { - "default": [], - "type": "array", - "items": { - "type": "string" - } - }, - "permissions": { - "default": [], - "allOf": [ - { - "$ref": "#/components/schemas/Permissions_for_ApiPermission" - } - ] - }, - "rule": { - "type": "string", - "enum": [ - "github_username" - ] - } - }, - "required": [ - "github_username", - "rule" - ] - } + "hierarchy", + "hierarchy_radio", + "object_id", + "rfd_number" ] }, - "OAuthAuthzCodeExchangeBody": { + "FullRfd": { "type": "object", "properties": { - "client_id": { + "authors": { + "nullable": true, + "type": "string" + }, + "commit": { + "$ref": "#/components/schemas/CommitSha" + }, + "committed_at": { "type": "string", - "format": "uuid" + "format": "date-time" + }, + "content": { + "type": "string" + }, + "discussion": { + "nullable": true, + "type": "string" + }, + "format": { + "$ref": "#/components/schemas/ContentFormat" }, - "client_secret": { - "$ref": "#/components/schemas/SecretString" + "id": { + "$ref": "#/components/schemas/TypedUuidForRfdId" }, - "code": { + "labels": { + "nullable": true, "type": "string" }, - "grant_type": { + "link": { + "nullable": true, "type": "string" }, - "pkce_verifier": { + "pdfs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FullRfdPdfEntry" + } + }, + "rfd_number": { + "type": "integer", + "format": "int32" + }, + "sha": { + "$ref": "#/components/schemas/FileSha" + }, + "state": { "nullable": true, "type": "string" }, - "redirect_uri": { + "title": { "type": "string" + }, + "visibility": { + "$ref": "#/components/schemas/Visibility" } }, "required": [ - "client_id", - "client_secret", - "code", - "grant_type", - "redirect_uri" + "commit", + "committed_at", + "content", + "format", + "id", + "pdfs", + "rfd_number", + "sha", + "title", + "visibility" ] }, - "OAuthAuthzCodeExchangeResponse": { + "FullRfdPdfEntry": { "type": "object", "properties": { - "access_token": { + "link": { "type": "string" }, - "expires_in": { - "type": "integer", - "format": "int64" - }, - "token_type": { + "source": { "type": "string" } }, "required": [ - "access_token", - "expires_in", - "token_type" + "link", + "source" ] }, - "OAuthClient": { + "GitHubCommit": { "type": "object", "properties": { - "created_at": { - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "nullable": true, - "type": "string", - "format": "date-time" + "added": { + "type": "array", + "items": { + "type": "string" + } }, "id": { - "type": "string", - "format": "uuid" + "type": "string" }, - "redirect_uris": { + "modified": { "type": "array", "items": { - "$ref": "#/components/schemas/OAuthClientRedirectUri" + "type": "string" } }, - "secrets": { + "removed": { "type": "array", "items": { - "$ref": "#/components/schemas/OAuthClientSecret" + "type": "string" } + }, + "timestamp": { + "type": "string", + "format": "date-time" } }, "required": [ - "created_at", + "added", "id", - "redirect_uris", - "secrets" + "modified", + "removed", + "timestamp" ] }, - "OAuthClientRedirectUri": { + "GitHubCommitPayload": { "type": "object", "properties": { - "created_at": { - "type": "string", - "format": "date-time" + "commits": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GitHubCommit" + } }, - "deleted_at": { + "head_commit": { "nullable": true, - "type": "string", - "format": "date-time" + "allOf": [ + { + "$ref": "#/components/schemas/GitHubCommit" + } + ] }, - "id": { - "type": "string", - "format": "uuid" + "installation": { + "$ref": "#/components/schemas/GitHubInstallation" }, - "oauth_client_id": { - "type": "string", - "format": "uuid" + "ref": { + "type": "string" + }, + "repository": { + "$ref": "#/components/schemas/GitHubRepository" + }, + "sender": { + "$ref": "#/components/schemas/GitHubSender" + } + }, + "required": [ + "commits", + "installation", + "ref", + "repository", + "sender" + ] + }, + "GitHubInstallation": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "redirect_uri": { + "node_id": { "type": "string" } }, "required": [ - "created_at", "id", - "oauth_client_id", - "redirect_uri" + "node_id" ] }, - "OAuthClientSecret": { + "GitHubRepository": { "type": "object", "properties": { - "created_at": { - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "nullable": true, - "type": "string", - "format": "date-time" + "default_branch": { + "type": "string" }, "id": { - "type": "string", - "format": "uuid" + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "oauth_client_id": { - "type": "string", - "format": "uuid" + "name": { + "type": "string" }, - "secret_signature": { + "node_id": { "type": "string" + }, + "owner": { + "$ref": "#/components/schemas/GitHubRepositoryOwner" } }, "required": [ - "created_at", + "default_branch", "id", - "oauth_client_id", - "secret_signature" + "name", + "node_id", + "owner" ] }, - "OAuthProviderInfo": { + "GitHubRepositoryOwner": { "type": "object", "properties": { - "auth_url_endpoint": { + "login": { "type": "string" + } + }, + "required": [ + "login" + ] + }, + "GitHubSender": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "client_id": { + "login": { "type": "string" }, - "device_code_endpoint": { + "node_id": { "type": "string" }, - "provider": { - "$ref": "#/components/schemas/OAuthProviderName" - }, - "scopes": { - "type": "array", - "items": { - "type": "string" - } - }, - "token_endpoint": { + "type": { "type": "string" } }, "required": [ - "auth_url_endpoint", - "client_id", - "device_code_endpoint", - "provider", - "scopes", - "token_endpoint" - ] - }, - "OAuthProviderName": { - "type": "string", - "enum": [ - "github", - "google" + "id", + "login", + "node_id", + "type" ] }, - "OpenIdConfiguration": { + "ListRfd": { "type": "object", "properties": { - "jwks_uri": { + "authors": { + "nullable": true, + "type": "string" + }, + "commit": { + "$ref": "#/components/schemas/CommitSha" + }, + "committed_at": { + "type": "string", + "format": "date-time" + }, + "discussion": { + "nullable": true, + "type": "string" + }, + "format": { + "$ref": "#/components/schemas/ContentFormat" + }, + "id": { + "$ref": "#/components/schemas/TypedUuidForRfdId" + }, + "labels": { + "nullable": true, + "type": "string" + }, + "link": { + "nullable": true, "type": "string" + }, + "rfd_number": { + "type": "integer", + "format": "int32" + }, + "sha": { + "$ref": "#/components/schemas/FileSha" + }, + "state": { + "nullable": true, + "type": "string" + }, + "title": { + "type": "string" + }, + "visibility": { + "$ref": "#/components/schemas/Visibility" } }, "required": [ - "jwks_uri" + "commit", + "committed_at", + "format", + "id", + "rfd_number", + "sha", + "title", + "visibility" ] }, - "Permissions_for_ApiPermission": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiPermission" - }, - "uniqueItems": true - }, - "Permissions_for_ApiPermissionResponse": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiPermissionResponse" - }, - "uniqueItems": true - }, "ReserveRfdBody": { "type": "object", "properties": { @@ -4725,8 +957,7 @@ "format": "date-time" }, "id": { - "type": "string", - "format": "uuid" + "$ref": "#/components/schemas/TypedUuidForRfdId" }, "link": { "nullable": true, @@ -4952,8 +1183,9 @@ "query" ] }, - "SecretString": { - "type": "string" + "TypedUuidForRfdId": { + "type": "string", + "format": "uuid" }, "Visibility": { "type": "string", @@ -4990,4 +1222,4 @@ "description": "Internal endpoints" } ] -} \ No newline at end of file +} diff --git a/rfd-api/src/initial_data.rs b/rfd-api/src/initial_data.rs index e26e257..7c93f27 100644 --- a/rfd-api/src/initial_data.rs +++ b/rfd-api/src/initial_data.rs @@ -49,7 +49,7 @@ impl InitialData { pub fn new(config_sources: Option>) -> Result { let mut config = Config::builder() .add_source(File::with_name("mappers.toml").required(false)) - .add_source(File::with_name("turnstile-api/mappers.toml").required(false)); + .add_source(File::with_name("rfd-api/mappers.toml").required(false)); for source in config_sources.unwrap_or_default() { config = config.add_source(File::with_name(&source).required(false)); diff --git a/rfd-installer/Cargo.toml b/rfd-installer/Cargo.toml new file mode 100644 index 0000000..0664dce --- /dev/null +++ b/rfd-installer/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "rfd-installer" +version = "0.1.0" +edition = "2021" + +[lib] +name = "rfd_installer" +path = "src/lib.rs" + +[[bin]] +name = "rfd-installer" +path = "src/main.rs" + +[dependencies] +diesel = { workspace = true, features = ["postgres", "r2d2"] } +diesel_migrations = { workspace = true, features = ["postgres"] } +v-api-installer = { workspace = true } + +[package.metadata.dist] +targets = [] diff --git a/rfd-installer/src/lib.rs b/rfd-installer/src/lib.rs new file mode 100644 index 0000000..a961b87 --- /dev/null +++ b/rfd-installer/src/lib.rs @@ -0,0 +1,31 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +use diesel::{ + migration::{Migration, MigrationSource}, + pg::Pg, + r2d2::{ConnectionManager, ManageConnection}, + PgConnection, +}; +use diesel_migrations::{embed_migrations, EmbeddedMigrations}; + +const MIGRATIONS: EmbeddedMigrations = embed_migrations!("../rfd-model/migrations"); + +pub fn run_migrations(url: &str, v_only: bool) { + v_api_installer::run_migrations(&url); + + if !v_only { + let mut conn = db_conn(&url); + let migrations: Vec>> = MIGRATIONS.migrations().unwrap(); + + for migration in migrations { + migration.run(&mut conn).unwrap(); + } + } +} + +fn db_conn(url: &str) -> PgConnection { + let conn: ConnectionManager = ConnectionManager::new(url); + conn.connect().unwrap() +} diff --git a/rfd-installer/src/main.rs b/rfd-installer/src/main.rs new file mode 100644 index 0000000..1def2a2 --- /dev/null +++ b/rfd-installer/src/main.rs @@ -0,0 +1,13 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +use rfd_installer::run_migrations; + +fn main() { + if let Ok(url) = std::env::var("DATABASE_URL") { + run_migrations(&url, std::env::var("V_ONLY").is_ok()); + } else { + println!("DATABASE_URL environment variable must be specified to run migrations and must be in the form of a connection string") + } +}