From aa9ab18eab813bcd06d7e57eef655c93b12a7f2e Mon Sep 17 00:00:00 2001 From: Eddie Kohler Date: Sun, 15 Sep 2024 13:31:47 -0400 Subject: [PATCH] Add tags to API spec, check in initial spec JSON --- batch/apispec.php | 314 ++- etc/apifunctions.json | 4 +- etc/openapi.json | 4168 +++++++++++++++++++++++++++++++++++++++ scripts/script.js | 2 +- src/api/api_session.php | 11 +- src/conference.php | 8 +- src/helpers.php | 13 +- src/pages/p_api.php | 2 +- src/xtparams.php | 2 + 9 files changed, 4463 insertions(+), 61 deletions(-) create mode 100644 etc/openapi.json diff --git a/batch/apispec.php b/batch/apispec.php index 2c2617f16a..7b0066d0f2 100644 --- a/batch/apispec.php +++ b/batch/apispec.php @@ -22,14 +22,53 @@ class APISpec_Batch { private $schemas; /** @var ?object */ private $parameters; + /** @var object */ + private $setj; + /** @var object */ + private $setj_schemas; + /** @var object */ + private $setj_parameters; /** @var string */ private $output_file = "-"; + /** @var bool */ + private $batch = false; + /** @var bool */ + private $override_ref; + /** @var bool */ + private $override_tags; + /** @var bool */ + private $override_schema; + /** @var bool */ + private $sort; + /** @var array */ + private $tag_order; + + static private $default_tag_order = [ + "Submissions", "Documents", "Submission administration", + "Search", "Tags", "Review preferences", "Reviews", "Comments", + "Meeting tracker", "Users", "Profile", "Notifications", + "Site information", "Site administration", "Settings", + "Session" + ]; function __construct(Conf $conf, $arg) { $this->conf = $conf; + if (isset($arg["x"])) { + $conf->set_opt("apiFunctions", null); + } $this->user = $conf->root_user(); - $this->api_map = $conf->api_map(); + + $this->api_map = $conf->expanded_api_map(); $this->j = (object) []; + $this->setj = (object) [ + "paths" => (object) [], + "components" => (object) [ + "schemas" => (object) [], + "parameters" => (object) [] + ] + ]; + $this->setj_schemas = $this->setj->components->schemas; + $this->setj_parameters = $this->setj->components->parameters; if (isset($arg["i"])) { if ($arg["i"] === "-") { @@ -41,10 +80,16 @@ function __construct(Conf $conf, $arg) { throw new CommandLineException($arg["i"] . ": Invalid input"); } $this->output_file = $arg["i"]; + $this->batch = true; } if (isset($arg["o"])) { $this->output_file = $arg["o"]; } + + $this->override_ref = isset($arg["override-ref"]); + $this->override_tags = isset($arg["override-tags"]); + $this->override_schema = isset($arg["override-schema"]); + $this->sort = isset($arg["sort"]); } /** @return int */ @@ -55,7 +100,13 @@ function run() { $info->title = $info->title ?? "HotCRP"; $info->version = $info->version ?? "0.1"; + // initialize paths $this->paths = $mj->paths = $mj->paths ?? (object) []; + foreach ($this->paths as $name => $pj) { + $pj->__path = $name; + } + + // expand paths $fns = array_keys($this->api_map); sort($fns); foreach ($fns as $fn) { @@ -69,6 +120,33 @@ function run() { } } + // warn about unreferenced paths + if ($this->batch) { + foreach ($this->paths as $name => $pj) { + if (!isset($this->setj->paths->$name)) { + fwrite(STDERR, "warning: input path {$name} unknown\n"); + } else { + foreach ($pj as $method => $x) { + if ($method !== "__path" + && !isset($this->setj->paths->$name->$method)) { + fwrite(STDERR, "warning: input operation {$method} {$name} unknown\n"); + } + } + } + } + } + + // maybe sort + if ($this->sort || !$this->batch) { + $this->sort(); + } + + // erase unwanted keys + foreach ($this->paths as $pj) { + unset($pj->__path); + } + + // print if (($this->output_file ?? "-") === "-") { $out = STDOUT; } else { @@ -84,6 +162,15 @@ function run() { return 0; } + static function path_first_tag($pj) { + foreach ($pj as $name => $oj) { + if (is_object($oj) && !empty($oj->tags)) { + return $oj->tags[0]; + } + } + return null; + } + const F_REQUIRED = 1; const F_BODY = 2; const F_FILE = 4; @@ -97,9 +184,6 @@ static private function parse_parameters($j) { if ($j->paper ?? false) { $known["p"] = self::F_REQUIRED; } - if ($j->redirect ?? false) { - $known["redirect"] = 0; - } $parameters = $j->parameters ?? []; if (is_string($parameters)) { $parameters = explode(" ", trim($parameters)); @@ -122,24 +206,29 @@ static private function parse_parameters($j) { $name = substr($p, $i); $known[$name] = $flags; } + if ($j->redirect ?? false) { + $known["redirect"] = 0; + } return $known; } /** @param string $fn */ private function expand_paths($fn) { + $getj = null; foreach (["GET", "POST"] as $method) { - if (!($j = $this->conf->api($fn, null, $method))) { + if (!($uf = $this->conf->api($fn, null, $method))) { continue; } - $known = self::parse_parameters($j); - $p = $known["p"] ?? null; - if ($p !== null) { - $known["p"] = self::F_REQUIRED | self::F_PATH; - $this->expand_path_method("/{p}/{$fn}", $method, $known, $j); + if ($method === "POST" && !($uf->post ?? false) && ($uf->get ?? false)) { + continue; } - if ($p !== self::F_REQUIRED) { - unset($known["p"]); - $this->expand_path_method("/{$fn}", $method, $known, $j); + $known = self::parse_parameters($uf); + $p = $known["p"] ?? 0; + if (($p & self::F_REQUIRED) !== 0) { + $known["p"] |= self::F_PATH; + $this->expand_path_method("/{p}/{$fn}", $method, $known, $uf); + } else { + $this->expand_path_method("/{$fn}", $method, $known, $uf); } } } @@ -147,13 +236,40 @@ private function expand_paths($fn) { /** @param string $path * @param 'GET'|'POST' $method * @param array $known - * @param object $j */ - private function expand_path_method($path, $method, $known, $j) { + * @param object $uf */ + private function expand_path_method($path, $method, $known, $uf) { $pathj = $this->paths->$path = $this->paths->$path ?? (object) []; + $pathj->__path = $path; + $this->setj->paths->$path = $this->setj->paths->$path ?? (object) []; $lmethod = strtolower($method); $xj = $pathj->$lmethod = $pathj->$lmethod ?? (object) []; - $this->expand_request($xj, $known, $j, "{$path}.{$lmethod}"); - $this->expand_response($xj, $j); + $this->setj->paths->$path->$lmethod = true; + $this->expand_metadata($xj, $uf, "{$path}.{$lmethod}"); + $this->expand_request($xj, $known, $uf, "{$path}.{$lmethod}"); + $this->expand_response($xj, $uf); + } + + /** @param object $x + * @param object $uf + * @param string $path */ + private function expand_metadata($xj, $uf, $path) { + if (isset($uf->tags) && (!isset($xj->tags) || $this->override_tags)) { + $xj->tags = $uf->tags; + } else if (isset($uf->tags) && $uf->tags !== $xj->tags) { + fwrite(STDERR, "{$path}: tags differ, expected " . json_encode($xj->tags) . "\n"); + } + foreach ($xj->tags ?? [] as $tag) { + $tags = $this->j->tags = $this->j->tags ?? []; + $i = 0; + while ($i !== count($tags) && $tags[$i]->name !== $tag) { + ++$i; + } + if ($i === count($tags)) { + $this->j->tags[] = (object) [ + "name" => $tag + ]; + } + } } /** @param string $name @@ -163,12 +279,15 @@ private function resolve_common_schema($name) { $compj = $this->j->components = $this->j->components ?? (object) []; $this->schemas = $compj->schemas = $compj->schemas ?? (object) []; } - if (!isset($this->schemas->$name)) { + if (!isset($this->schemas->$name) + || ($this->override_schema && !isset($this->setj_schemas->$name))) { if ($name === "pid") { $this->schemas->$name = (object) [ "type" => "integer", + "description" => "Submission ID", "minimum" => 1 ]; + $this->setj_schemas->$name = true; } else if ($name === "ok") { return (object) ["type" => "boolean"]; } else if ($name === "message_list") { @@ -176,6 +295,7 @@ private function resolve_common_schema($name) { "type" => "list", "items" => $this->resolve_common_schema("message") ]; + $this->setj_schemas->$name = true; } else if ($name === "message") { $this->schemas->$name = (object) [ "type" => "object", @@ -189,6 +309,28 @@ private function resolve_common_schema($name) { "pos2" => (object) ["type" => "integer"] ] ]; + $this->setj_schemas->$name = true; + } else if ($name === "minimal_response") { + $this->schemas->$name = (object) [ + "type" => "object", + "required" => ["ok"], + "properties" => (object) [ + "ok" => (object) ["type" => "boolean"], + "message_list" => $this->resolve_common_schema("message_list") + ] + ]; + $this->setj_schemas->$name = true; + } else if ($name === "error_response") { + $this->schemas->$name = (object) [ + "type" => "object", + "required" => ["ok"], + "properties" => (object) [ + "ok" => (object) ["type" => "boolean", "description" => "always false"], + "message_list" => $this->resolve_common_schema("message_list"), + "status_code" => (object) ["type" => "integer"] + ] + ]; + $this->setj_schemas->$name = true; } else { assert(false); } @@ -204,13 +346,22 @@ private function resolve_common_param($name) { $this->parameters = $compj->parameters = $compj->parameters ?? (object) []; } if (!isset($this->parameters->$name)) { - if ($name === "p") { - $this->parameters->p = (object) [ + if ($name === "p.path") { + $this->parameters->{"p.path"} = (object) [ "name" => "p", "in" => "path", "required" => true, "schema" => $this->resolve_common_schema("pid") ]; + $this->setj_parameters->{"p.path"} = true; + } else if ($name === "p") { + $this->parameters->p = (object) [ + "name" => "p", + "in" => "query", + "required" => false, + "schema" => $this->resolve_common_schema("pid") + ]; + $this->setj_parameters->p = true; } else if ($name === "redirect") { $this->parameters->redirect = (object) [ "name" => "redirect", @@ -218,6 +369,7 @@ private function resolve_common_param($name) { "required" => false, "schema" => (object) ["type" => "string"] ]; + $this->setj_parameters->redirect = true; } else { assert(false); } @@ -227,15 +379,17 @@ private function resolve_common_param($name) { /** @param object $x * @param array $known - * @param object $j + * @param object $uf * @param string $path */ - private function expand_request($x, $known, $j, $path) { - $params = $body_properties = $body_required = []; + private function expand_request($x, $known, $uf, $path) { + $params = $bprop = $breq = []; $has_file = false; foreach ($known as $name => $f) { if ($name === "*") { // skip } else if ($name === "p" && $f === (self::F_REQUIRED | self::F_PATH)) { + $params["p"] = $this->resolve_common_param("p.path"); + } else if ($name === "p") { $params["p"] = $this->resolve_common_param("p"); } else if ($name === "redirect" && $f === 0) { $params["redirect"] = $this->resolve_common_param("redirect"); @@ -247,11 +401,11 @@ private function expand_request($x, $known, $j, $path) { "schema" => (object) [] ]; } else { - $body_properties[$name] = (object) [ + $bprop[$name] = (object) [ "schema" => (object) [] ]; if (($f & self::F_REQUIRED) !== 0) { - $body_required[] = $name; + $breq[] = $name; } if (($f & self::F_FILE) !== 0) { $has_file = true; @@ -276,7 +430,9 @@ private function expand_request($x, $known, $j, $path) { continue; } $xpj = $x->parameters[$i]; - if (isset($xpj->{"\$ref"}) !== isset($npj->{"\$ref"})) { + if ($this->override_ref && isset($npj->{"\$ref"})) { + $x->parameters[$i] = $npj; + } else if (isset($xpj->{"\$ref"}) !== isset($npj->{"\$ref"})) { fwrite(STDERR, "{$path}.param[{$n}]: \$ref status differs\n"); } else if (isset($xpj->{"\$ref"})) { if ($xpj->{"\$ref"} !== $npj->{"\$ref"}) { @@ -293,13 +449,13 @@ private function expand_request($x, $known, $j, $path) { } } } - if (!empty($body_properties)) { + if (!empty($bprop)) { $schema = (object) [ "type" => "object", - "properties" => $body_properties + "properties" => $bprop ]; - if (!empty($body_required)) { - $schema->required = $body_required; + if (!empty($breq)) { + $schema->required = $breq; } $formtype = $has_file ? "multipart/form-data" : "application/x-www-form-urlencoded"; $x->requestBody = (object) [ @@ -314,16 +470,13 @@ private function expand_request($x, $known, $j, $path) { } /** @param object $x - * @param object $j */ - private function expand_response($x, $j) { - $body_properties = $body_required = []; - $response = $j->response ?? []; + * @param object $uf */ + private function expand_response($x, $uf) { + $bprop = $breq = []; + $response = $uf->response ?? []; if (is_string($response)) { $response = explode(" ", trim($response)); } - $body_properties["ok"] = $this->resolve_common_schema("ok"); - $body_required[] = "ok"; - $body_properties["message_list"] = $this->resolve_common_schema("message_list"); foreach ($response as $p) { $required = true; for ($i = 0; $i !== strlen($p); ++$i) { @@ -337,35 +490,108 @@ private function expand_response($x, $j) { if ($name === "*") { // skip } else { - $body_properties[$name] = (object) []; + $bprop[$name] = (object) []; if ($required) { - $body_required[] = $name; + $breq[] = $name; } } } + + $rschema = $this->resolve_common_schema("minimal_response"); + if (!empty($bprop)) { + $restschema = ["type" => "object"]; + if (!empty($breq)) { + $restschema["required"] = $breq; + } + $restschema["properties"] = $bprop; + $rschema = (object) [ + "allOf" => [$rschema, (object) $restschema] + ]; + } + $x->responses = (object) [ + "200" => (object) [ + "description" => "", + "content" => (object) [ + "application/json" => (object) [ + "schema" => $rschema + ] + ] + ], "default" => (object) [ "description" => "", "content" => (object) [ "application/json" => (object) [ - "schema" => (object) [ - "type" => "object", - "required" => $body_required, - "properties" => $body_properties - ] + "schema" => $this->resolve_common_schema("error_response") ] ] ] ]; } + private function sort() { + $this->tag_order = []; + foreach ($this->j->tags ?? [] as $i => $x) { + if (isset($x->name) && is_string($x->name)) { + $p = array_search(self::$default_tag_order, $x->name); + if ($p === false) { + $p = count(self::$default_tag_order) + $i; + } + $this->tag_order[$x->name] = $p; + } + } + if (isset($this->j->tags)) { + usort($this->j->tags, function ($a, $b) { + return $this->tag_order[$a->name] <=> $this->tag_order[$b->name]; + }); + } + + $paths = (array) $this->j->paths; + uasort($paths, [$this, "compare_paths"]); + $this->j->paths = (object) $paths; + } + + function compare_paths($a, $b) { + $atag = self::path_first_tag($a); + $btag = self::path_first_tag($b); + if ($atag !== $btag) { + if ($atag === null || $btag === null) { + return $atag === null ? 1 : -1; + } + $ato = $this->tag_order[$atag] ?? PHP_INT_MAX; + $bto = $this->tag_order[$btag] ?? PHP_INT_MAX; + return $ato <=> $bto ? : strcmp($atag, $btag); + } + $an = substr($a->__path, strrpos($a->__path, "/") + 1); + $bn = substr($b->__path, strrpos($b->__path, "/") + 1); + $auf = $this->conf->api($an, null, null); + $buf = $this->conf->api($bn, null, null); + if ($auf === null || $buf === null) { + if ($auf !== null || $buf !== null) { + return $auf === null ? 1 : -1; + } + } else { + $ao = $auf->order ?? PHP_INT_MAX; + $bo = $buf->order ?? PHP_INT_MAX; + if ($ao !== $bo) { + return $ao <=> $bo; + } + } + return strcmp($an, $bn); + } + /** @return APISpec_Batch */ static function make_args($argv) { $arg = (new Getopt)->long( "name:,n: !", "config: !", "help,h !", + "x,no-extensions Ignore extensions", "i:,input: =FILE Modify existing specification in FILE", + "override-ref Overwrite conflicting \$refs in input", + "override-tags", + "override-schema", + "sort", "o:,output: =FILE Write specification to FILE" )->description("Generate an OpenAPI specification. Usage: php batch/apispec.php") diff --git a/etc/apifunctions.json b/etc/apifunctions.json index e65e2484f0..e36bf257f9 100644 --- a/etc/apifunctions.json +++ b/etc/apifunctions.json @@ -261,13 +261,13 @@ { "name": "session", "get": true, "allow_disabled": true, "function": "Session_API::getsession", - "response": "postvalue sessioninfo" + "response": "sessioninfo" }, { "name": "session", "post": true, "function": "Session_API::setsession", "parameters": "v", - "response": "postvalue sessioninfo" + "response": "sessioninfo" }, { "name": "tags", "get": true, "paper": true, diff --git a/etc/openapi.json b/etc/openapi.json new file mode 100644 index 0000000000..cfa9530fe0 --- /dev/null +++ b/etc/openapi.json @@ -0,0 +1,4168 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "HotCRP", + "version": "0.1" + }, + "paths": { + "/paper": { + "get": { + "tags": [ + "Submissions" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Submissions" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/formatcheck": { + "get": { + "tags": [ + "Documents" + ], + "parameters": [ + { + "name": "doc", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "soft", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "dt", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "docid", + "in": "query", + "required": false, + "schema": {} + }, + { + "$ref": "#/components/parameters/p" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "npages", + "nwords", + "problem_fields", + "has_error", + "docid" + ], + "properties": { + "npages": {}, + "nwords": {}, + "problem_fields": {}, + "has_error": {}, + "docid": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/upload": { + "post": { + "tags": [ + "Documents" + ], + "parameters": [ + { + "name": "dtype", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "start", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "offset", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "finish", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "token", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "cancel", + "in": "query", + "required": false, + "schema": {} + }, + { + "$ref": "#/components/parameters/p" + } + ], + "requestBody": { + "description": "", + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "size": { + "schema": {} + }, + "mimetype": { + "schema": {} + }, + "filename": { + "schema": {} + }, + "blob": { + "schema": {} + } + } + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": {}, + "dtype": {}, + "filename": {}, + "mimetype": {}, + "size": {}, + "ranges": {}, + "hash": {}, + "server_progress_loaded": {}, + "server_progress_max": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/assign": { + "post": { + "tags": [ + "Submission administration" + ], + "parameters": [ + { + "$ref": "#/components/parameters/redirect" + }, + { + "$ref": "#/components/parameters/p" + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "assignments": { + "schema": {} + } + }, + "required": [ + "assignments" + ] + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/decision": { + "get": { + "tags": [ + "Submission administration" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "decision", + "decision_html" + ], + "properties": { + "decision": {}, + "decision_html": {}, + "editable": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Submission administration" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "decision": { + "schema": {} + } + }, + "required": [ + "decision" + ] + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "decision", + "decision_html" + ], + "properties": { + "decision": {}, + "decision_html": {}, + "editable": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/lead": { + "get": { + "tags": [ + "Submission administration" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "lead", + "lead_html" + ], + "properties": { + "lead": {}, + "lead_html": {}, + "color_classes": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Submission administration" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "lead": { + "schema": {} + } + }, + "required": [ + "lead" + ] + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "lead", + "lead_html" + ], + "properties": { + "lead": {}, + "lead_html": {}, + "color_classes": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/manager": { + "get": { + "tags": [ + "Submission administration" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "manager", + "manager_html" + ], + "properties": { + "manager": {}, + "manager_html": {}, + "color_classes": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Submission administration" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "manager": { + "schema": {} + } + }, + "required": [ + "manager" + ] + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "manager", + "manager_html" + ], + "properties": { + "manager": {}, + "manager_html": {}, + "color_classes": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/reviewround": { + "post": { + "tags": [ + "Submission administration" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/shepherd": { + "get": { + "tags": [ + "Submission administration" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "shepherd", + "shepherd_html" + ], + "properties": { + "shepherd": {}, + "shepherd_html": {}, + "color_classes": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Submission administration" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "shepherd": { + "schema": {} + } + }, + "required": [ + "shepherd" + ] + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "shepherd", + "shepherd_html" + ], + "properties": { + "shepherd": {}, + "shepherd_html": {}, + "color_classes": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/search": { + "get": { + "tags": [ + "Search" + ], + "parameters": [ + { + "name": "q", + "in": "query", + "required": true, + "schema": {} + }, + { + "name": "t", + "in": "query", + "required": true, + "schema": {} + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "report", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "scoresort", + "in": "query", + "required": false, + "schema": {} + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "ids", + "groups", + "hotlist", + "search_params" + ], + "properties": { + "ids": {}, + "groups": {}, + "hotlist": {}, + "search_params": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/fieldhtml": { + "get": { + "tags": [ + "Search" + ], + "parameters": [ + { + "name": "f", + "in": "query", + "required": true, + "schema": {} + }, + { + "name": "aufull", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "session", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "q", + "in": "query", + "required": true, + "schema": {} + }, + { + "name": "t", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": {} + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "fields", + "data" + ], + "properties": { + "fields": {}, + "data": {}, + "stat": {}, + "classes": {}, + "attr": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/fieldtext": { + "get": { + "tags": [ + "Search" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/graphdata": { + "get": { + "tags": [ + "Search" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/namedsearch": { + "get": { + "tags": [ + "Search" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "searches" + ], + "properties": { + "searches": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Search" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "searches" + ], + "properties": { + "searches": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/searchcompletion": { + "get": { + "tags": [ + "Search" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "searchcompletion" + ], + "properties": { + "searchcompletion": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/viewoptions": { + "get": { + "tags": [ + "Search" + ], + "parameters": [ + { + "name": "report", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "q", + "in": "query", + "required": false, + "schema": {} + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "report", + "display_current", + "display_default", + "display_difference", + "display_default_message_list" + ], + "properties": { + "report": {}, + "display_current": {}, + "display_default": {}, + "display_difference": {}, + "display_default_message_list": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Search" + ], + "parameters": [ + { + "name": "report", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "q", + "in": "query", + "required": false, + "schema": {} + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "display": { + "schema": {} + } + }, + "required": [ + "display" + ] + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "report", + "display_current", + "display_default", + "display_difference", + "display_default_message_list" + ], + "properties": { + "report": {}, + "display_current": {}, + "display_default": {}, + "display_difference": {}, + "display_default_message_list": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/tags": { + "get": { + "tags": [ + "Tags" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "pid", + "tags", + "tags_edit_text", + "tags_view_html", + "tag_decoration_html", + "color_classes" + ], + "properties": { + "pid": {}, + "tags": {}, + "tags_edit_text": {}, + "tags_view_html": {}, + "tag_decoration_html": {}, + "color_classes": {}, + "tags_conflicted": {}, + "color_classes_conflicted": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/tags": { + "post": { + "tags": [ + "Tags" + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "tags": { + "schema": {} + }, + "addtags": { + "schema": {} + }, + "deltags": { + "schema": {} + }, + "tagassignment": { + "schema": {} + }, + "search": { + "schema": {} + } + } + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "properties": { + "pid": {}, + "tags": {}, + "tags_edit_text": {}, + "tags_view_html": {}, + "tag_decoration_html": {}, + "color_classes": {}, + "tags_conflicted": {}, + "color_classes_conflicted": {}, + "p": {}, + "ids": {}, + "groups": {}, + "hotlist": {}, + "search_params": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/components/parameters/p" + } + ] + } + }, + "/alltags": { + "get": { + "tags": [ + "Tags" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "tags" + ], + "properties": { + "tags": {}, + "readonly_tagmap": {}, + "sitewide_tagmap": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/taganno": { + "get": { + "tags": [ + "Tags" + ], + "parameters": [ + { + "name": "tag", + "in": "query", + "required": true, + "schema": {} + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Tags" + ], + "parameters": [ + { + "name": "tag", + "in": "query", + "required": true, + "schema": {} + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/tagmessages": { + "get": { + "tags": [ + "Tags" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "pid" + ], + "properties": { + "pid": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/votereport": { + "get": { + "tags": [ + "Tags" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "name": "tag", + "in": "query", + "required": true, + "schema": {} + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "tag", + "report" + ], + "properties": { + "tag": {}, + "report": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/revpref": { + "get": { + "tags": [ + "Review preferences" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "name": "u", + "in": "query", + "required": false, + "schema": {} + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "value", + "pref" + ], + "properties": { + "value": {}, + "pref": {}, + "prefexp": {}, + "topic_score": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Review preferences" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "name": "u", + "in": "query", + "required": false, + "schema": {} + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "pref": { + "schema": {} + } + }, + "required": [ + "pref" + ] + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "value", + "pref" + ], + "properties": { + "value": {}, + "pref": {}, + "prefexp": {}, + "topic_score": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/review": { + "get": { + "tags": [ + "Reviews" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Reviews" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/reviewhistory": { + "get": { + "tags": [ + "Reviews" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/acceptreview": { + "post": { + "tags": [ + "Reviews" + ], + "parameters": [ + { + "$ref": "#/components/parameters/redirect" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "name": "r", + "in": "query", + "required": true, + "schema": {} + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "action", + "review_site_relative" + ], + "properties": { + "action": {}, + "review_site_relative": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/claimreview": { + "post": { + "tags": [ + "Reviews" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/redirect" + }, + { + "name": "r", + "in": "query", + "required": true, + "schema": {} + }, + { + "name": "email", + "in": "query", + "required": true, + "schema": {} + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "action", + "review_site_relative" + ], + "properties": { + "action": {}, + "review_site_relative": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/declinereview": { + "post": { + "tags": [ + "Reviews" + ], + "parameters": [ + { + "$ref": "#/components/parameters/redirect" + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "name": "r", + "in": "query", + "required": true, + "schema": {} + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "reason": { + "schema": {} + } + } + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "action", + "review_site_relative" + ], + "properties": { + "action": {}, + "reason": {}, + "review_site_relative": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/requestreview": { + "post": { + "tags": [ + "Reviews" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "name": "round", + "in": "query", + "required": false, + "schema": {} + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "email": { + "schema": {} + }, + "given_name": { + "schema": {} + }, + "family_name": { + "schema": {} + }, + "name": { + "schema": {} + }, + "affiliation": { + "schema": {} + }, + "override": { + "schema": {} + }, + "reason": { + "schema": {} + } + }, + "required": [ + "email" + ] + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/reviewrating": { + "get": { + "tags": [ + "Reviews" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "name": "r", + "in": "query", + "required": true, + "schema": {} + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "properties": { + "ratings": {}, + "user_rating": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Reviews" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "name": "r", + "in": "query", + "required": true, + "schema": {} + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "user_rating": { + "schema": {} + } + }, + "required": [ + "user_rating" + ] + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "properties": { + "ratings": {}, + "user_rating": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/reviewtoken": { + "get": { + "tags": [ + "Reviews" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Reviews" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/comment": { + "get": { + "tags": [ + "Comments" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "name": "c", + "in": "query", + "required": true, + "schema": {} + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "properties": { + "comment": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Comments" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "name": "c", + "in": "query", + "required": true, + "schema": {} + }, + { + "name": "override", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "delete", + "in": "query", + "required": false, + "schema": {} + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "text": { + "schema": {} + }, + "response": { + "schema": {} + }, + "ready": { + "schema": {} + }, + "topic": { + "schema": {} + }, + "draft": { + "schema": {} + }, + "blind": { + "schema": {} + }, + "tags": { + "schema": {} + }, + "visibility": { + "schema": {} + }, + "attachment": { + "schema": {} + }, + "by_author": { + "schema": {} + }, + "review_token": { + "schema": {} + } + } + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "properties": { + "comment": {}, + "conflict": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/mentioncompletion": { + "get": { + "tags": [ + "Comments" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "mentioncompletion" + ], + "properties": { + "mentioncompletion": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/components/parameters/p" + } + ] + } + }, + "/track": { + "post": { + "tags": [ + "Meeting tracker" + ], + "parameters": [ + { + "name": "track", + "in": "query", + "required": true, + "schema": {} + }, + { + "name": "tracker_start_at", + "in": "query", + "required": false, + "schema": {} + }, + { + "$ref": "#/components/parameters/p" + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "hotlist-info": { + "schema": {} + } + } + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/trackerstatus": { + "get": { + "tags": [ + "Meeting tracker" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/trackerconfig": { + "post": { + "tags": [ + "Meeting tracker" + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "stopall": { + "schema": {} + }, + "tr": { + "schema": {} + }, + "has_tr": { + "schema": {} + } + } + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "tracker_status_at", + "tracker_eventid" + ], + "properties": { + "tracker": {}, + "tracker_recent": {}, + "tracker_status": {}, + "now": {}, + "tracker_status_at": {}, + "tracker_eventid": {}, + "new_trackerid": {}, + "tracker_site": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/user": { + "get": { + "tags": [ + "Users" + ], + "parameters": [ + { + "name": "email", + "in": "query", + "required": true, + "schema": {} + }, + { + "name": "potential_conflict", + "in": "query", + "required": false, + "schema": {} + }, + { + "$ref": "#/components/parameters/p" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "found" + ], + "properties": { + "found": {}, + "email": {}, + "given_name": {}, + "family_name": {}, + "affiliation": {}, + "potential_conflict": {}, + "orcid": {}, + "country": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/pc": { + "get": { + "tags": [ + "Users" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "pc" + ], + "properties": { + "pc": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/clickthrough": { + "post": { + "tags": [ + "Profile" + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "accept": { + "schema": {} + }, + "clickthrough_id": { + "schema": {} + }, + "clickthrough_type": { + "schema": {} + }, + "clickthrough_time": { + "schema": {} + } + }, + "required": [ + "clickthrough_id", + "clickthrough_type", + "clickthrough_time" + ] + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/components/parameters/p" + } + ] + } + }, + "/events": { + "get": { + "tags": [ + "Notifications" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "required": false, + "schema": {} + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "from", + "to", + "rows", + "more" + ], + "properties": { + "from": {}, + "to": {}, + "rows": {}, + "more": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/{p}/follow": { + "post": { + "tags": [ + "Notifications" + ], + "parameters": [ + { + "$ref": "#/components/parameters/p.path" + }, + { + "name": "u", + "in": "query", + "required": false, + "schema": {} + }, + { + "$ref": "#/components/parameters/p.path" + }, + { + "$ref": "#/components/parameters/p.path" + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "following": { + "schema": {} + } + }, + "required": [ + "following" + ] + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "following" + ], + "properties": { + "following": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/mailtext": { + "get": { + "tags": [ + "Site information" + ], + "parameters": [ + { + "name": "template", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "r", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "email", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "given_name", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "family_name", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "affiliation", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "reason", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "width", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "text", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "subject", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "body", + "in": "query", + "required": false, + "schema": {} + }, + { + "$ref": "#/components/parameters/p" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "properties": { + "templates": {}, + "subject": {}, + "body": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/account": { + "get": { + "tags": [ + "Site administration" + ], + "parameters": [ + { + "name": "email", + "in": "query", + "required": true, + "schema": {} + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "email", + "disabled", + "placeholder" + ], + "properties": { + "email": {}, + "disabled": {}, + "placeholder": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Site administration" + ], + "parameters": [ + { + "name": "email", + "in": "query", + "required": true, + "schema": {} + }, + { + "name": "disable", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "enable", + "in": "query", + "required": false, + "schema": {} + }, + { + "name": "sendinfo", + "in": "query", + "required": false, + "schema": {} + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "email", + "disabled", + "placeholder" + ], + "properties": { + "email": {}, + "disabled": {}, + "placeholder": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/namedformula": { + "get": { + "tags": [ + "Site administration" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "formulas" + ], + "properties": { + "formulas": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Site administration" + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "formula": { + "schema": {} + } + }, + "required": [ + "formula" + ] + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "formulas" + ], + "properties": { + "formulas": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/settings": { + "get": { + "tags": [ + "Settings" + ], + "parameters": [ + { + "name": "dryrun", + "in": "query", + "required": false, + "schema": {} + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "settings": { + "schema": {} + } + } + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "properties": { + "dry_run": {}, + "changes": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Settings" + ], + "parameters": [ + { + "name": "dryrun", + "in": "query", + "required": false, + "schema": {} + } + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "settings": { + "schema": {} + } + } + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "properties": { + "dry_run": {}, + "changes": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/reviewfieldlibrary": { + "get": { + "tags": [ + "Settings" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "samples", + "types" + ], + "properties": { + "samples": {}, + "types": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/settingdescriptions": { + "get": { + "tags": [ + "Settings" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "setting_descriptions" + ], + "properties": { + "setting_descriptions": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/submissionfieldlibrary": { + "get": { + "tags": [ + "Settings" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "samples", + "types" + ], + "properties": { + "samples": {}, + "types": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/job": { + "get": { + "tags": [ + "Session" + ], + "parameters": [ + { + "name": "job", + "in": "query", + "required": true, + "schema": {} + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "update_at" + ], + "properties": { + "update_at": {}, + "status": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/jserror": { + "post": { + "tags": [ + "Session" + ], + "requestBody": { + "description": "", + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "error": { + "schema": {} + }, + "url": { + "schema": {} + }, + "lineno": { + "schema": {} + }, + "colno": { + "schema": {} + }, + "stack": { + "schema": {} + } + }, + "required": [ + "error" + ] + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/oauthtoken": { + "post": { + "tags": [ + "Session" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/minimal_response" + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/session": { + "get": { + "tags": [ + "Session" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "sessioninfo" + ], + "properties": { + "sessioninfo": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + }, + "post": { + "tags": [ + "Session" + ], + "parameters": [ + { + "name": "v", + "in": "query", + "required": true, + "schema": {} + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "required": [ + "sessioninfo" + ], + "properties": { + "sessioninfo": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + }, + "/whoami": { + "get": { + "tags": [ + "Session" + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/minimal_response" + }, + { + "type": "object", + "properties": { + "email": {}, + "given_name": {}, + "family_name": {}, + "affiliation": {} + } + } + ] + } + } + } + }, + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error_response" + } + } + } + } + } + } + } + }, + "components": { + "parameters": { + "redirect": { + "name": "redirect", + "in": "query", + "required": false, + "schema": { + "type": "string" + } + }, + "p.path": { + "name": "p", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/pid" + } + }, + "p": { + "name": "p", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/pid" + } + } + }, + "schemas": { + "pid": { + "type": "integer", + "minimum": 1 + }, + "message": { + "type": "object", + "required": [ + "status" + ], + "properties": { + "field": { + "type": "string" + }, + "message": { + "type": "string" + }, + "status": { + "type": "integer", + "minimum": -5, + "maximum": 3 + }, + "context": { + "type": "string" + }, + "pos1": { + "type": "integer" + }, + "pos2": { + "type": "integer" + } + } + }, + "message_list": { + "type": "list", + "items": { + "$ref": "#/components/schemas/message" + } + }, + "minimal_response": { + "type": "object", + "required": [ + "ok" + ], + "properties": { + "ok": { + "type": "boolean" + }, + "message_list": { + "$ref": "#/components/schemas/message_list" + } + } + }, + "error_response": { + "type": "object", + "required": [ + "ok" + ], + "properties": { + "ok": { + "type": "boolean", + "description": "always false" + }, + "message_list": { + "$ref": "#/components/schemas/message_list" + }, + "status_code": { + "type": "integer" + } + } + } + } + }, + "tags": [ + { + "name": "Submissions" + }, + { + "name": "Documents" + }, + { + "name": "Submission administration" + }, + { + "name": "Search" + }, + { + "name": "Tags" + }, + { + "name": "Review preferences" + }, + { + "name": "Reviews" + }, + { + "name": "Comments" + }, + { + "name": "Meeting tracker" + }, + { + "name": "Users" + }, + { + "name": "Profile" + }, + { + "name": "Notifications" + }, + { + "name": "Site information" + }, + { + "name": "Site administration" + }, + { + "name": "Settings" + }, + { + "name": "Session" + } + ] +} diff --git a/scripts/script.js b/scripts/script.js index 51ad230734..43a76efdb3 100644 --- a/scripts/script.js +++ b/scripts/script.js @@ -434,7 +434,7 @@ function check_message_list(data, options) { } function check_sessioninfo(data, options) { - if (siteinfo.user.uid == data.sessioninfo.uid) { + if (siteinfo.user.email == data.sessioninfo.email) { siteinfo.postvalue = data.sessioninfo.postvalue; let myuri = hoturl_absolute_base(); $("form").each(function () { diff --git a/src/api/api_session.php b/src/api/api_session.php index 0233764bb7..9e952f7dac 100644 --- a/src/api/api_session.php +++ b/src/api/api_session.php @@ -5,11 +5,16 @@ class Session_API { static private function session_result(Contact $user, Qrequest $qreq, $ok) { $si = ["postvalue" => $qreq->post_value()]; + if ($user->email) { + $si["email"] = $user->email; + } if ($user->contactId) { - $si["cid"] = $user->contactId; // XXX backward compat $si["uid"] = $user->contactId; } - return ["ok" => $ok, "postvalue" => $qreq->post_value(), "sessioninfo" => $si]; + return [ + "ok" => $ok, + "sessioninfo" => $si + ]; } static function getsession(Contact $user, Qrequest $qreq) { @@ -81,7 +86,7 @@ static function change_session($qreq, $v) { } /** @param Qrequest $qreq - * @return array{ok:bool,postvalue:string} */ + * @return array{ok:bool,sessioninfo:array} */ static function setsession(Contact $user, $qreq) { assert($user === $qreq->user()); $qreq->open_session(); diff --git a/src/conference.php b/src/conference.php index 7e93bf243f..7f21fc1cb7 100644 --- a/src/conference.php +++ b/src/conference.php @@ -5364,7 +5364,7 @@ function _xtbuild_add($j) { /** @param list $defaults * @param ?string $optname * @return array{array>,list} */ - private function _xtbuild($defaults, $optname) { + function _xtbuild($defaults, $optname) { $this->_xtbuild_map = $this->_xtbuild_factories = []; expand_json_includes_callback($defaults, [$this, "_xtbuild_add"]); if ($optname && ($olist = $this->opt($optname))) { @@ -5468,6 +5468,12 @@ function api_map() { } return $this->_api_map; } + /** @return array> */ + function expanded_api_map() { + list($this->_api_map, $unused) = + $this->_xtbuild(["etc/apifunctions.json", "etc/apiexpansions.json"], "apiFunctions"); + return $this->_api_map; + } function has_api($fn, ?Contact $user = null, $method = null) { return !!$this->api($fn, $user, $method); } diff --git a/src/helpers.php b/src/helpers.php index 9c51cb6bb0..09aacd37a2 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -246,15 +246,8 @@ function offsetUnset($offset) { /** @param ?Qrequest $qreq */ function emit($qreq = null) { - if ($this->status && !$this->minimal) { - if (!isset($this->content["ok"])) { - $this->content["ok"] = $this->status <= 299; - } - if (!isset($this->content["status"])) { - $this->content["status"] = $this->status; - } - } else if (isset($this->content["status"])) { - $this->status = $this->content["status"]; + if ($this->status && !$this->minimal && !isset($this->content["ok"])) { + $this->content["ok"] = $this->status <= 299; } if ($qreq && $qreq->valid_token()) { // Don’t set status on unvalidated requests, since that can leak @@ -265,6 +258,8 @@ function emit($qreq = null) { if (($origin = $qreq->header("Origin"))) { header("Access-Control-Allow-Origin: {$origin}"); } + } else if ($this->status > 299 && !isset($this->content["status_code"])) { + $this->content["status_code"] = $this->status; } header("Content-Type: application/json; charset=utf-8"); if ($qreq && isset($qreq->pretty)) { diff --git a/src/pages/p_api.php b/src/pages/p_api.php index fbc4424304..51e3a0e6cb 100644 --- a/src/pages/p_api.php +++ b/src/pages/p_api.php @@ -172,7 +172,7 @@ static function go_nav($nav, $conf) { } else if (isset($_GET["track"])) { $_GET["fn"] = "track"; } else { - http_response_code(404); + http_response_code(400); header("Content-Type: application/json; charset=utf-8"); echo '{"ok": false, "message_list": [{"field": "fn", "message": "<0>Parameter missing", "status": 2}]}', "\n"; exit(); diff --git a/src/xtparams.php b/src/xtparams.php index 3c1489bdeb..9d099c932b 100644 --- a/src/xtparams.php +++ b/src/xtparams.php @@ -324,6 +324,7 @@ function search_list($list) { if ($reqkey !== null && !($list[$i]->{$reqkey} ?? null)) { continue; } + // apply overlay ($xt) to new base ($nxt) $nxt = clone $list[$i]; foreach (get_object_vars($xt) as $k => $v) { if ($k === "merge" || $k === "__source_order") { @@ -336,6 +337,7 @@ function search_list($list) { object_replace_recursive($nxt->{$k}, $v); } } + // replace base $xt = $nxt; } if (isset($xt->deprecated) && $xt->deprecated) {