Metadata class to be used in Annotated types to provide information about a given type. For example: class MyParams(TypedDict): account_holder_name: Annotated[str, PropertyInfo(alias='accountHolderName')] This means that {'account_holder_name': 'Robert'} will be transformed to
| 40 | |
| 41 | |
| 42 | class PropertyInfo: |
| 43 | """Metadata class to be used in Annotated types to provide information about a given type. |
| 44 | |
| 45 | For example: |
| 46 | |
| 47 | class MyParams(TypedDict): |
| 48 | account_holder_name: Annotated[str, PropertyInfo(alias='accountHolderName')] |
| 49 | |
| 50 | This means that {'account_holder_name': 'Robert'} will be transformed to {'accountHolderName': 'Robert'} before being sent to the API. |
| 51 | """ |
| 52 | |
| 53 | alias: str | None |
| 54 | format: PropertyFormat | None |
| 55 | format_template: str | None |
| 56 | discriminator: str | None |
| 57 | |
| 58 | def __init__( |
| 59 | self, |
| 60 | *, |
| 61 | alias: str | None = None, |
| 62 | format: PropertyFormat | None = None, |
| 63 | format_template: str | None = None, |
| 64 | discriminator: str | None = None, |
| 65 | ) -> None: |
| 66 | self.alias = alias |
| 67 | self.format = format |
| 68 | self.format_template = format_template |
| 69 | self.discriminator = discriminator |
| 70 | |
| 71 | @override |
| 72 | def __repr__(self) -> str: |
| 73 | return f"{self.__class__.__name__}(alias='{self.alias}', format={self.format}, format_template='{self.format_template}', discriminator='{self.discriminator}')" |
| 74 | |
| 75 | |
| 76 | def maybe_transform( |
no outgoing calls