Skip to content

Conversation

@rjgildea
Copy link

  • Use dict-like parameter mapping based on ChainMap rather than passing around an inner function
  • Declare pydantic models for all trigger service methods. These automatically handle validation and type conversion from a dictionary-type mapping, e.g. using the ChainMap-based approach above
  • Use pydantic.validate_arguments decorator to enable automatic validation and conversion to the pydantic model

This removes a lot of boiler plate type conversions (e.g. removes 11 x bool(parameters("automatic"))) or parameter validation/error handling, and means allows us to clearly define up front exactly what message parameters a given trigger requires.

Copy link
Contributor

@Anthchirp Anthchirp left a comment

Choose a reason for hiding this comment

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

Just a few comments

@rjgildea rjgildea merged commit 634b005 into master Sep 30, 2021
@rjgildea rjgildea deleted the pydantic-trigger branch September 30, 2021 12:38
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