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

Make document_role optional - as per db schema #53

Merged
merged 2 commits into from
Dec 6, 2023

Conversation

diversemix
Copy link
Contributor

@diversemix diversemix commented Dec 6, 2023

Description

This fix is the result of seeing this error:

 File \"/usr/src/app/api/api_v1/routers/document.py\", line 81, 
    in search_document
    documents = document_service.search(q)
  
File \"/usr/local/lib/python3.9/site-packages/pydantic/_internal/_validate_call.py\", line 100, 
    in __call__
    res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs))

File \"/usr/src/app/service/document.py\", line 66, 
    in search
    return document_repo.search(db, search_term)

File \"/usr/src/app/repository/document.py\", line 175, 
   in search
    return [DocumentReadDTO(**dict(r)) for r in result]

File \"/usr/src/app/repository/document.py\", line 175, 
    in <listcomp>
    return [DocumentReadDTO(**dict(r)) for r in result]

File \"/usr/local/lib/python3.9/site-packages/pydantic/main.py\", line 164, 
    in __init__
    __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
    pydantic_core._pydantic_core.ValidationError: 1 validation error for DocumentReadDTO
   role
   Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.4/v/string_type\n",

Type of change

Please select the option(s) below that are most relevant:

  • Bug fix
  • New feature
  • Breaking change

How Has This Been Tested?

Please describe the tests that you added to verify your changes.

Reviewer Checklist

  • The PR represents a single feature (small drive-by fixes are also ok)
  • The PR includes tests that are sufficient for the level of risk
  • The code is sufficiently commented, particularly in hard-to-understand areas
  • Any required documentation updates have been made
  • Any TODOs added are captured in future tickets
  • No FIXMEs remain

@diversemix diversemix requested a review from katybaulch December 6, 2023 10:03
Copy link
Contributor

@katybaulch katybaulch left a comment

Choose a reason for hiding this comment

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

Lgtm 👍

@diversemix diversemix merged commit 6c9562a into main Dec 6, 2023
2 checks passed
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.

2 participants