Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes for versions endpoint validation #591

Merged
merged 1 commit into from Nov 16, 2020

Conversation

ml-evs
Copy link
Member

@ml-evs ml-evs commented Nov 11, 2020

- fix regexp for versioned endpoints with additional URL path, e.g.
detect "/optimade/v1" as versioned as well as "/v1"
- allow return code to be 400 when requesting dodgy version from an
already versioned endpoint
@ml-evs ml-evs requested a review from CasperWA November 11, 2020 01:57
@ml-evs ml-evs added priority/high Issue or PR with a consensus of high priority validator Related to the OPTIMADE validator labels Nov 11, 2020
@codecov
Copy link

codecov bot commented Nov 11, 2020

Codecov Report

Merging #591 (27c35d9) into master (7e932df) will not change coverage.
The diff coverage is 50.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #591   +/-   ##
=======================================
  Coverage   92.11%   92.11%           
=======================================
  Files          61       61           
  Lines        3210     3210           
=======================================
  Hits         2957     2957           
  Misses        253      253           
Flag Coverage Δ
project 92.11% <50.00%> (ø)
validator 64.95% <50.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
optimade/validator/validator.py 82.26% <50.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7e932df...27c35d9. Read the comment docs.

Copy link
Member

@CasperWA CasperWA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but where is the motivation for adding 400 to the expected status codes?

@ml-evs
Copy link
Member Author

ml-evs commented Nov 16, 2020

Looks good, but where is the motivation for adding 400 to the expected status codes?

Basically just that 404 isn't mandated in the specification, and I'd noticed that a few implementations were returning 400 Bad Request which seems fine to me.

It only depends on what the underlying web framework returns when an invalid endpoint is requested (i.e. the endpoint being v123123 in the case of optimade.example.org/v1/v123123).

You could probably argue any 4** error code should also be allowed...

@ml-evs ml-evs merged commit 18bebb8 into master Nov 16, 2020
@ml-evs ml-evs deleted the ml-evs/add_version_fallback branch November 16, 2020 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/high Issue or PR with a consensus of high priority validator Related to the OPTIMADE validator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants