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

Add 'validate_unversioned_path' option, which is false by default #53

Merged
merged 7 commits into from
Jan 11, 2021

Conversation

ml-evs
Copy link
Member

@ml-evs ml-evs commented Jan 7, 2021

Closes #52.

Problems with this: no way to validate an implementation that only hosts the versions endpoint at its unversioned URL. This should probably be fixed upstream in the validator, at which point we can change the default value of this new setting to True.

@ml-evs ml-evs force-pushed the ml-evs/add_unversioned_option branch 3 times, most recently from f3b667e to 51ff94e Compare January 7, 2021 23:16
@ml-evs ml-evs force-pushed the ml-evs/add_unversioned_option branch from 51ff94e to de1e429 Compare January 7, 2021 23:24
@ml-evs ml-evs requested a review from CasperWA January 7, 2021 23:34
@ml-evs
Copy link
Member Author

ml-evs commented Jan 7, 2021

Your call @CasperWA whether you want to keep the current behaviour ("fully" validating the optional unversioned endpoint) as the default; I think it makes sense to disable it by default and handle the versions endpoint through my validator PR at Materials-Consortia/optimade-python-tools#665.

@CasperWA
Copy link
Member

CasperWA commented Jan 8, 2021

I think you're right about this. By default only validate the required minimum and then everything else can be added on with boolean options. Yeah.

.github/workflows/validator_action.yml Outdated Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
tests/test_unversioned_path.bats Show resolved Hide resolved
@rartino
Copy link

rartino commented Jan 8, 2021

Maybe it would be nice if the validator could separately report MUST and SHOULD-level violations? (And, formally, anything with 0 MUST validations "validates").

But serving the API on the unversioned endpoint is just on MAY level, so IMO not serving anything there should pass the validation without remarks. Nevertheless, IF something is served there, it would be useful to validate that it fulfills the specification. (But also note that there are options to HTTP-forward requests to unversioned endpoints - those need to also pass validation - I plan to add them to our implementation shortly...).

@ml-evs
Copy link
Member Author

ml-evs commented Jan 8, 2021

Maybe it would be nice if the validator could separately report MUST and SHOULD-level violations? (And, formally, anything with 0 MUST validations "validates").

Although it isn't quite so clear from the output, this should (lowercase) be what the validator is doing already, with the caveat that SHOULD-level violations get lumped in with the "optional" (again lowercase) tests. Of course, there might still be leftover bits that validate too harshly, but in terms of accommodating SHOULD when validating data and models there shouldn't be any problems.

But serving the API on the unversioned endpoint is just on MAY level, so IMO not serving anything there should pass the validation without remarks. Nevertheless, IF something is served there, it would be useful to validate that it fulfills the specification.

👍 The issue here is that unversioned endpoints have a slightly different specification (i.e. necessity of /versions etc) so they do need to be validated either way, I think we are consistent in our solution for this though.

(But also note that there are options to HTTP-forward requests to unversioned endpoints - those need to also pass validation - I plan to add them to our implementation shortly...).

I'm pretty sure the requests library follows some number of redirects by default, so this shouldn't cause a problem. Please let me know if it does...

@ml-evs ml-evs requested a review from CasperWA January 8, 2021 16:22
@ml-evs
Copy link
Member Author

ml-evs commented Jan 8, 2021

FYI, I have written the README expecting there to be a v2.3.0 release immediately after this PR.

@CasperWA
Copy link
Member

FYI, I have written the README expecting there to be a v2.3.0 release immediately after this PR.

No need. This will be updated by the publishing workflow (via the invoke task).

README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
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.

If you want to keep the premature version change, no worries. The invoke task shouldn't care. However, it (might) assume that it can always git commit ...

Edit: Ah, you just reverted it. Never mind :)

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
Co-authored-by: Casper Welzel Andersen <43357585+CasperWA@users.noreply.github.com>
README.md Outdated Show resolved Hide resolved
@ml-evs ml-evs requested a review from CasperWA January 11, 2021 10:40
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.

Cheers @ml-evs ! 🎉

@ml-evs ml-evs merged commit 6ded299 into master Jan 11, 2021
@CasperWA CasperWA deleted the ml-evs/add_unversioned_option branch January 11, 2021 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to disable validation of unversioned paths
3 participants