Page MenuHomeSoftware Heritage

REST server: add validation for PID parameters
ClosedPublic

Authored by zack on Nov 8 2019, 8:36 PM.

Details

Reviewers
seirl
Summary

This is still very basic and can be improved.

For one thing, the try/except blocks are repeated, but I'm not sure what's the
best way to refactor this stuff in aiohttp. (Is there a notion of global
excepton handler for routes?)

Second, I'm only validating PID parameters here, while others are given, such
as directions, edge restrictions, etc. They should all be checked for validity
and trigger bad request return codes rather then making the REST server explode
in the backend.

Third, tests for the returned HTTP status codes are missing, but it's not clear
to me yet how we're currently testing the HTTP layer of the REST server.

I'm also pushing this to the branch feature/param-validation, feel free to give
me feedback here but also make improvements directly in that branch.

Diff Detail

Repository
rDGRPH Compressed graph representation
Branch
feature/param-validation
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 8944
Build 13064: tox-on-jenkinsJenkins
Build 13063: arc lint + arc unit

Event Timeline

This looks good, I agree more stuff needs to be generalized in the whole aiohttp side anyway... And I'm also not sure how to do it properly, so I think this is good for now.

This revision is now accepted and ready to land.Nov 12 2019, 1:15 AM

REST server: add validation for PID parameters

  • REST server: validate all query parameters and refactor validators

Closed in cc712446e8ef1e6aa7bf23488108778d5f847897