Page MenuHomePhabricator

How to test Math check endpoint via swagger
Closed, InvalidPublicBUG REPORT

Description

With the old swagger web frontend, one could conveniently test the math check endpoint.
Steps to Reproduce:

and I wanted to test if the warning information generated by mathoid can be accessed via restbase.
Therefore I wanted to use the example from
https://gerrit.wikimedia.org/r/#/c/mediawiki/services/mathoid/+/447558/3/test/features/math/simple.js
with curl I would do

$ curl -X POST "https://en.wikipedia.org/api/rest_v1/media/math/check/chem" -d "type=chem&q=\ce {pH=-\log _{10}[H+]}"
{"success":true,"checked":"{\\ce {pH=-\\log _{10}[H]}}","requiredPackages":["mhchem"],"identifiers":["p","H","H"],"endsWithDot":false}

aka I do not see the warning field in restbase, which is another problem.

Actual Results:

  • I could not generate this curl request with the new swagger ui.

Expected Results:

  • A way to generate the curl request (like it was in the old version)

Event Timeline

I am not sure I understand your problem. When you open the Math docs section, there is a Try it out button. Once you press it and enter the formula to check, click on Execute and the full curl command is displayed, together with the request URL and the response returned by the REST API.

Sorry. Now it works. Not sure what happened yesterday. Probably I messed up the JSON syntax. For example, if you have an extra comma, like in

{
  "q": "a,
}

the generated request parses the input field character by character:

curl -X POST "https://en.wikipedia.org/api/rest_v1/media/math/check/tex" -H  "accept: application/json" -H  "Content-Type: multipart/form-data" -F "0={" -F "1=
" -F "2= " -F "3= " -F "4="" -F "5=q" -F "6="" -F "7=:" -F "8= " -F "9="" -F "10=\" -F "11=\" -F "12=s" -F "13=i" -F "14=n" -F "15= " -F "16=x" -F "17=^" -F "18=2" -F "19="" -F "20=," -F "21=
" -F "22=}"