diff --git a/api/src/executor/routes.js b/api/src/executor/routes.js index 2bcd0d7..8943a9a 100644 --- a/api/src/executor/routes.js +++ b/api/src/executor/routes.js @@ -22,16 +22,6 @@ module.exports = { .contains('/'), body('files.*.content') .isString(), - body('compile_timeout') - .isNumeric(), - body('run_timeout') - .isNumeric(), - body('stdin') - .isString(), - body('args') - .isArray(), - body('args.*') - .isString() ], // POST /jobs @@ -50,11 +40,11 @@ module.exports = { runtime, alias: req.body.language, files: req.body.files, - args: req.body.args, - stdin: req.body.stdin, + args: req.body.args || [], + stdin: req.body.stdin || "", timeouts: { - run: req.body.run_timeout, - compile: req.body.compile_timeout + run: req.body.run_timeout || 3000, + compile: req.body.compile_timeout || 10000 } }); diff --git a/readme.md b/readme.md index 08f15da..26bae26 100644 --- a/readme.md +++ b/readme.md @@ -197,10 +197,10 @@ This endpoint requests execution of some arbitrary code. - `files` (**required**) An array of files containing code or other data that should be used for execution. The first file in this array is considered the main file. - `files[].name` (**required**) The name of the file to upload, must be a string containing no path. - `files[].content` (**required**) The content of the files to upload, must be a string containing text to write. -- `stdin` (**required**) The text to pass as stdin to the program. Must be a string, can be left blank. -- `args` (**required**) The arguments to pass to the program. Must be an array. -- `compile_timeout` (**required**) The maximum time allowed for the compile stage to finish before bailing out in milliseconds. Must be a number. -- `run_timeout` (**required**) The maximum time allowed for the run stage to finish before bailing out in milliseconds. Must be a number. +- `stdin` (**optional**) The text to pass as stdin to the program. Must be a string, can be left blank. +- `args` (**optional**) The arguments to pass to the program. Must be an array. +- `compile_timeout` (**optional**) The maximum time allowed for the compile stage to finish before bailing out in milliseconds. Must be a number. +- `run_timeout` (**optional**) The maximum time allowed for the run stage to finish before bailing out in milliseconds. Must be a number. ```json {