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

fix(models:document): define creator attribute as optional #35

Merged
merged 1 commit into from
Jan 26, 2023

Conversation

OndraSlama
Copy link
Contributor

This created hard-to-debug problem because some of the documents being fetched had creator==None.

I think we should maybe consider less strict validation for our internal data models unless we are super confident all are always up to date and correct. Because this can cause quite annoying problems in client code.

@OndraSlama OndraSlama changed the title fix(models:document): define creator as optional fix(models:document): define creator attribute as optional Jan 25, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #35 (a4b8d57) into main (a1bc957) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #35   +/-   ##
=======================================
  Coverage   98.90%   98.90%           
=======================================
  Files          28       28           
  Lines        1648     1648           
=======================================
  Hits         1630     1630           
  Misses         18       18           
Impacted Files Coverage Δ
rossum_api/models/document.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@asgeirrr
Copy link
Collaborator

We were trying to find the sweet spot between useful validation of data returned from Elis backend and stability, i.e. we're not raising exceptions if the backend returns an extra attribute (attributes are added to endpoints quite often) but I believe it is very usefel to know the user is provided with the expected type when convering JSONs to dataclasses.

@asgeirrr
Copy link
Collaborator

btw. Document.creator is not marked as optional https://elis.rossum.ai/api/docs/#document. But I believe you so I'm merging it 😆

@asgeirrr asgeirrr merged commit d797e99 into rossumai:main Jan 26, 2023
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.

3 participants