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

error response #17

Merged
merged 2 commits into from
Jun 13, 2019
Merged

error response #17

merged 2 commits into from
Jun 13, 2019

Conversation

fawzi
Copy link
Contributor

@fawzi fawzi commented Jun 12, 2019

Adding error response

@@ -55,3 +56,9 @@ class OptimadeStructureResponse1(OptimadeResponse1):

class OptimadeStructureResponseMany(OptimadeResponseMany):
data: List[StructureResource]


class OptimadeErrorResponse(BaseModel):
Copy link
Member

Choose a reason for hiding this comment

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

The spec says:

If there were errors in producing the response all other fields MAY be skipped, and the following field MUST be present: errors

So, I guess, meta would also be optional.
And there's also included that's missing from above, right?
Do we actually need a subclass for this?
Can't we simply add errors as an optional field in OptimadeResponse1 and OptimadeResponseMany?

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, meta would be optional as well. I'm not sure we need a subclass either. I would like to merge just so we get optimade/server/models/errors.py in and then follow-up PRs can refactor / correct misreadings of the spec.

dwinston
dwinston previously approved these changes Jun 13, 2019
Copy link
Contributor

@dwinston dwinston left a comment

Choose a reason for hiding this comment

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

I think it's worth merging this in now for the error models and we can refactor their inclusion in follow-up PRs.

@@ -55,3 +56,9 @@ class OptimadeStructureResponse1(OptimadeResponse1):

class OptimadeStructureResponseMany(OptimadeResponseMany):
data: List[StructureResource]


class OptimadeErrorResponse(BaseModel):
Copy link
Contributor

Choose a reason for hiding this comment

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

Right, meta would be optional as well. I'm not sure we need a subclass either. I would like to merge just so we get optimade/server/models/errors.py in and then follow-up PRs can refactor / correct misreadings of the spec.

@dwinston dwinston self-requested a review June 13, 2019 08:27
Copy link
Contributor

@dwinston dwinston left a comment

Choose a reason for hiding this comment

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

I fixed conflicts. Again, I think this is worth merging and then correcting with followup PRs.

@dwinston dwinston merged commit 2a10c23 into master Jun 13, 2019
@CasperWA CasperWA deleted the error_response branch November 8, 2019 14:36
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.

4 participants