iodide-project / iodide-project/iodide
validate _all_ API args, break out API arg validation in #1703 into a little library that we can use to
- Dominant language
- JavaScript
- Stars
- 1.5k
- Forks
- 145
- PR merge metrics
- No merged PRs in 30d
Description
following from @hamilton's nice file API argument validation in #1703, we should apply argument validation to all of the iodide API. in the process, we should break the argument validation into proptypes-style helper function
see: https://github.com/iodide-project/iodide/pull/1703#discussion_r274200088
```
export function loadFile(fileName, fetchType, variableName = undefined) {
argType.validate({
fileName: [fileName, argType.string],
fetchType: [fetchType, argType.enum(FETCH_RETURN_TYPES)],
variableName: [variableName, argType.string.optional]
})
return sendFileRequestToEditor(fileName, "LOAD_FILE", {
fetchType
}).request.then(handleResourceLoad(fetchType, variableName));
}
```
Contributor guide
Research direction
Start with the argument validation approach in pull request #1703 and the loadFile example in this issue. Identify the remaining Iodide API entry points and determine how the validation can be extracted into reusable proptypes-style helpers. Done means all API arguments are validated through the shared helper library.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100