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

default types for expressions #27

Open
VianneyMI opened this issue Nov 22, 2022 · 0 comments
Open

default types for expressions #27

VianneyMI opened this issue Nov 22, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request typing Improve typing for static type checkers

Comments

@VianneyMI
Copy link
Owner

For attributes that are typed as being expressions, we should provide an alternative type for simple cases and to enforce validation.
Ex:

class Limit(BaseModel):
   value : Expression = 0

cannot have a constraint on value because of the Expression type
however, this should work

class Limit(BaseModel):
   value : int | Expression = Field(gt=0) 
@VianneyMI VianneyMI self-assigned this Aug 8, 2023
@VianneyMI VianneyMI added enhancement New feature or request typing Improve typing for static type checkers labels Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request typing Improve typing for static type checkers
Projects
None yet
Development

No branches or pull requests

1 participant