Open jennydaman opened 7 months ago
Hello @SogoKato , if I give you a PR with support for NotRequired and Required, would you review it and merge if satisfied with it?
The issue is that sometimes the schema can be flexible, in that case one uses
from typing import NotRequired
class MySchema(TypedDict):
age: int
gender: NotRequired[str]
And in that case we could tell your library to also ignore this, or even give the option to enforce presence of NotRequired keys for testing purposes.
There is also Required
from typing import NotRequired
class MySchema(TypedDict, total=False):
name: Required[str]
age: int
gender: str
job: str
hobbies: list[str]
where we have a flexible schema, but only some keys are actually required
https://docs.python.org/3/library/typing.html#typing.Required
Hi @SebastianDix! Thank you for your suggestion.
That sounds great! I'd be happy to review your PR.
https://peps.python.org/pep-0655/