Validate types of the fetched GitHub repository entities data
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
The following discussion from !103761 (merged) should be addressed:
-
@nmalcolm started a discussion:
Suggestion Either here or elsewhere, let's do some strong typing. That way if someone tries weird stuff with passing json objects or arrays we'll fail early.
For now, we trust the data type that is returned from GitHub in GitHub Project/GitHub Gists import and filter out properties we are interested in via representations
Proposal
Use Json schema validation to make sure incoming data is in expected format/expected type. There's JsonSchemaValidator we can extend and use to validate the input from GitHub before importing repository entities. We should define custom schema for each kind of importing entity (pull request, collaborator, note etc.) based on GitHub Response schema and put them in app/validators/json_schemas. The import should be failed/halted in case the validation failed.