-
Notifications
You must be signed in to change notification settings - Fork 44
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
Change default MIME type to "application/vnd.api+json" #877
Conversation
Codecov Report
@@ Coverage Diff @@
## master #877 +/- ##
==========================================
+ Coverage 92.67% 92.74% +0.06%
==========================================
Files 67 67
Lines 3768 3763 -5
==========================================
- Hits 3492 3490 -2
+ Misses 276 273 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
- This is to follow the JSON:API spec requirement on Content Negotiation https://jsonapi.org/format/#content-negotiation.
4887d3d
to
52d4f4f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Only very minor things.
optimade/server/exceptions.py
Outdated
def __init__(self, detail: str = None, headers: dict = None) -> None: | ||
super().__init__(status_code=self.status_code, detail=detail, headers=headers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should set a standard status_code
, e.g., 500
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe just define it and set it to None
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is it already defined by the parent class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was toying with being a bit more defensive here, so happy to add it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well the issue is that it's referring to a parameter it doesn't have?
449c790
to
06f45be
Compare
Wondering if merging this into the spec repo will cause any issues... of course we implicitly had this constraint via JSON:API, but no-one is following it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work all that repeated code in "exceptions.py" was begging for a rewrite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor thing, it's essentially good to go.
Co-authored-by: Casper Welzel Andersen <[email protected]>
Won't go through another review... will merge here once the tests pass |
Closes #875, so that we can adhere to the JSON:API spec on content negotiation. This also has an effect on the OpenAPI schemas.
Also:
HTTPException
.