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 union types validation with pydantic #193

Merged
merged 6 commits into from
Oct 17, 2023
Merged

add union types validation with pydantic #193

merged 6 commits into from
Oct 17, 2023

Conversation

felipao-mx
Copy link
Member

@felipao-mx felipao-mx commented Oct 13, 2023

  • it uses pydantic.validate_arguments
  • it is possible to define multiple validators for a task argument using pydantic. example:
@task(queue_url=QUEUE2_URL, region_name='us-east-1')
async def task_validator(message: Union[User, Company]) -> None:
    print(message.dict())
  • it removes validator argument

@felipao-mx felipao-mx changed the title add union types validation with pydantic logic add union types validation with pydantic Oct 13, 2023
@felipao-mx felipao-mx closed this Oct 13, 2023
@rogelioLpz
Copy link
Member

rogelioLpz commented Oct 17, 2023

Lo veo bien.
Solo puedes agregar un test en donde tenga validador y los datos incorrectos, creo que no hay test de eso

@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

Merging #193 (210d729) into main (570d811) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #193   +/-   ##
=======================================
  Coverage   99.46%   99.46%           
=======================================
  Files          10       10           
  Lines         371      371           
  Branches       52       52           
=======================================
  Hits          369      369           
  Misses          2        2           
Flag Coverage Δ
unittests 99.46% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
fast_agave/tasks/sqs_tasks.py 97.05% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@felipao-mx
Copy link
Member Author

si hay un test para cuando los datos son incorrectos: test_execute_tasks_with_validator

@felipao-mx felipao-mx merged commit ab48567 into main Oct 17, 2023
6 checks passed
@felipao-mx felipao-mx deleted the uniontypes branch October 17, 2023 19:59
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