|
| 1 | +{ |
| 2 | + "arazzo": "1.0.1", |
| 3 | + "info": { |
| 4 | + "title": "Wikimedia Math API", |
| 5 | + "version": "1.0.0", |
| 6 | + "description": "Based on Jentic automatically generated Arazzo specification but adapted by humans to make it actually work" |
| 7 | + }, |
| 8 | + "sourceDescriptions": [ |
| 9 | + { |
| 10 | + "name": "openapi_source", |
| 11 | + "url": "./wikimedia/openapi.json", |
| 12 | + "type": "openapi" |
| 13 | + } |
| 14 | + ], |
| 15 | + "workflows": [ |
| 16 | + { |
| 17 | + "workflowId": "render-mathematical-formula", |
| 18 | + "summary": "Checks a TeX formula for validity and correctness, then renders it into a specified visual format (SVG, MML, or PNG). This is useful for displaying mathematical notation dynamically.", |
| 19 | + "description": "Checks a TeX formula for validity and correctness, then renders it into a specified visual format (SVG, MML, or PNG). This is useful for displaying mathematical notation dynamically.", |
| 20 | + "inputs": { |
| 21 | + "type": "object", |
| 22 | + "properties": { |
| 23 | + "type": { |
| 24 | + "type": "string", |
| 25 | + "enum": ["tex", "inline-tex", "chem"], |
| 26 | + "default": "tex" |
| 27 | + }, |
| 28 | + "formula": { |
| 29 | + "type": "string" |
| 30 | + }, |
| 31 | + "format": { |
| 32 | + "type": "string", |
| 33 | + "enum": ["svg", "mml", "png"], |
| 34 | + "default": "svg" |
| 35 | + }, |
| 36 | + "email": { |
| 37 | + "type": "string", |
| 38 | + "description": "Wikimedia API usage policy asks for an email or url to prevent abuse. Please use this fairly. https://foundation.wikimedia.org/wiki/Policy:Wikimedia_Foundation_User-Agent_Policy" |
| 39 | + } |
| 40 | + } |
| 41 | + }, |
| 42 | + "steps": [ |
| 43 | + { |
| 44 | + "stepId": "check-formula", |
| 45 | + "description": "Submits a TeX or inline-TeX formula for validation and normalization. Returns formula information and a hash identifier in the 'x-resource-location' header for rendering.", |
| 46 | + "operationPath": "openapi_source#/paths/~1media~1math~1check~1{type}/post", |
| 47 | + "parameters": [ |
| 48 | + { |
| 49 | + "name": "type", |
| 50 | + "in": "path", |
| 51 | + "value": "$inputs.type" |
| 52 | + }, |
| 53 | + { |
| 54 | + "name": "User-Agent", |
| 55 | + "in": "header", |
| 56 | + "value": "Arazzo Workflow (From:$inputs.email)" |
| 57 | + } |
| 58 | + ], |
| 59 | + "requestBody": { |
| 60 | + "contentType": "multipart/form-data", |
| 61 | + "payload": { |
| 62 | + "q": "$inputs.formula" |
| 63 | + } |
| 64 | + }, |
| 65 | + "successCriteria": [ |
| 66 | + { |
| 67 | + "condition": "$statusCode == 200" |
| 68 | + }, |
| 69 | + { |
| 70 | + "condition": "$response.body#/success == true" |
| 71 | + } |
| 72 | + ], |
| 73 | + "outputs": { |
| 74 | + "formula_info": "$response.body", |
| 75 | + "formula_hash": "$response.header.x-resource-location" |
| 76 | + } |
| 77 | + }, |
| 78 | + { |
| 79 | + "stepId": "render-formula", |
| 80 | + "description": "Retrieves the rendered representation (SVG, MML, or PNG) of a previously checked formula using its hash.", |
| 81 | + "operationPath": "openapi_source#/paths/~1media~1math~1render~1{format}~1{hash}/get", |
| 82 | + "parameters": [ |
| 83 | + { |
| 84 | + "name": "format", |
| 85 | + "in": "path", |
| 86 | + "value": "$inputs.format" |
| 87 | + }, |
| 88 | + { |
| 89 | + "name": "hash", |
| 90 | + "in": "path", |
| 91 | + "value": "$steps.check-formula.outputs.formula_hash" |
| 92 | + } |
| 93 | + ], |
| 94 | + "successCriteria": [ |
| 95 | + { |
| 96 | + "condition": "$statusCode == 200" |
| 97 | + } |
| 98 | + ], |
| 99 | + "outputs": { |
| 100 | + "rendered_formula": "$response.body" |
| 101 | + } |
| 102 | + } |
| 103 | + ], |
| 104 | + "outputs": { |
| 105 | + "formula_info": "$steps.check-formula.outputs.formula_info", |
| 106 | + "formula_hash": "$steps.check-formula.outputs.formula_hash", |
| 107 | + "rendered_formula": "$steps.render-formula.outputs.rendered_formula" |
| 108 | + } |
| 109 | + } |
| 110 | + ] |
| 111 | +} |
0 commit comments