Skip to content

Commit

Permalink
API response spec for both get and post
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Sep 12, 2024
1 parent fcd1835 commit 562caeb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions etc/apifunctions.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
{
"name": "comment", "paper": true, "post": true,
"function": "Comment_API::run",
"parameters": "c ?override ?=text ?=response ?=ready ?=topic ?=draft ?=blind ?=tags ?=visibility ?=:attachment ?=by_author ?=review_token ?delete"
"parameters": "c ?override ?=text ?=response ?=ready ?=topic ?=draft ?=blind ?=tags ?=visibility ?=:attachment ?=by_author ?=review_token ?delete",
"response": "comment",
"response_deprecated": "cmt"
},
{
"name": "declinereview", "post": true, "redirect": true,
Expand Down Expand Up @@ -224,7 +226,8 @@
{
"name": "revpref", "post": true,
"function": "Preference_API::pref_api",
"parameters": "p ?u =pref"
"parameters": "p ?u =pref",
"response": "value pref ?prefexp ?topic_score"
},
{
"name": "reviewpref", "alias": "revpref"
Expand Down
4 changes: 2 additions & 2 deletions src/api/api_specvalidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ static function response($uf, Qrequest $qreq, JsonResult $jr) {
}
$known = [];
$has_suffix = false;
foreach ($response as $i => $p) {
$t = $i < $nmandatory ? self::F_REQUIRED : self::F_DEPRECATED;
foreach ($response as $ri => $p) {
$t = $ri < $nmandatory ? self::F_REQUIRED : self::F_DEPRECATED;
for ($i = 0; $i !== strlen($p); ++$i) {
if ($p[$i] === "?") {
$t &= ~self::F_REQUIRED;
Expand Down

0 comments on commit 562caeb

Please sign in to comment.