|
1 | | -from typing import Annotated, ClassVar, List, Optional, cast |
| 1 | +from typing import ClassVar, List, Optional, cast |
2 | 2 |
|
| 3 | +from cuenca_validations.types import HttpUrlString |
3 | 4 | from cuenca_validations.types.enums import WebhookEvent |
4 | 5 | from cuenca_validations.types.requests import ( |
5 | 6 | EndpointRequest, |
6 | 7 | EndpointUpdateRequest, |
7 | 8 | ) |
8 | | -from pydantic import AfterValidator, ConfigDict, Field, HttpUrl |
| 9 | +from pydantic import ConfigDict, Field, HttpUrl |
9 | 10 |
|
10 | 11 | from ..http import Session, session as global_session |
11 | 12 | from .base import Creatable, Deactivable, Queryable, Retrievable, Updateable |
12 | 13 |
|
13 | | -# In Pydantic v2, URL fields like `HttpUrl` are stored as internal objects |
14 | | -# instead of `str`, which can break compatibility with code expecting str. |
15 | | -# Using `HttpUrlString` ensures the field is validated as a URL but stored as |
16 | | -# a `str` for compatibility. |
17 | | -# https://github.com/pydantic/pydantic/discussions/6395 |
18 | | - |
19 | | -HttpUrlString = Annotated[HttpUrl, AfterValidator(str)] |
20 | | - |
21 | 14 |
|
22 | 15 | class Endpoint(Creatable, Deactivable, Retrievable, Queryable, Updateable): |
23 | 16 | _resource: ClassVar = 'endpoints' |
|
0 commit comments