GitXplorerGitXplorer
a

typeval

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
0382738842fd40037d5e21fc416c6f7651086f02

bump version to 0.1.1

aadriangb committed 2 years ago
Verified
0b6d615c3657960e4e6752a2dc6a91bf5c370824

use pydantic from pypi

aadriangb committed 2 years ago
Verified
549f256ceff3bb8519a4536d63718a5dcb2b4fd0

fix annotation

aadriangb committed 3 years ago
Verified
802691bd9c1282a527e29311a3272e9e3d5ca9b2

add example without model

aadriangb committed 3 years ago
Verified
ee128c7827db6031a70cee4779441bb5bce0af88

fix things

aadriangb committed 3 years ago
Verified
eb0822b27b49d1e90fc6aeed5709ca6d9d7babd7

add missing file

aadriangb committed 3 years ago

README

The README file for this repository.

typeval

A prototype for integrating annotated-types with pydantic-core.

This is purely for exploration, it is highly likely that this will not be maintained long term.

Example

from dataclasses import dataclass
from typing import Annotated

from annotated_types import Gt, Len
from typeval import Validator

Name = Annotated[str, Len(0)]
Age = Annotated[int, Gt(0)]

Students = dict[Name, Age]

@dataclass
class Classroom:
    teacher: Name
    students: Students

classroom = Validator(Classroom).validate_python(
    {
        "teacher": "Foo Bar",
        "students": {
            "Fizz": 3,
            "Buzz": 5,
        }
    }
)

students = Validator(Students).validate_python(
    {
        "Fizz": 3,
        "Buzz": 5,
    }
)