Skip to content

Validate towards type hinted function signature without calling the function #2127

@anders-kiaer

Description

@anders-kiaer

Checks

  • I added a descriptive title to this issue
  • I have searched (google, github) for similar issues and couldn't find anything
  • I have read and followed the docs and couldn't find an answer
  • After submitting this, I commit to one of:
    • Look through open issues and helped at least one other person
    • Hit the "watch" button on this repo to receive notifications and I commit to help at least 2 people that ask questions in the future
    • Implement a Pull Request for a confirmed bug

Question

Is there a way to validate data input compared to type hinted function signature, without calling the function? I've seen https://pydantic-docs.helpmanual.io/usage/validation_decorator/ but that appears to do the validation check when calling the function.

Example use case/context:
User input (e.g. from a configuration file) is used to call different functions and/or initiate different classes. It would be nice to quickly provide the user with a collection of validation feedback in one go, and not having to wait on e.g. the first X function calls to be successful while X+1 turns out to have invalid data input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions