|
1 | 1 | import re |
2 | 2 | import urllib.parse |
3 | | -from typing import Annotated, Any, TypeAlias |
| 3 | +from typing import Annotated, TypeAlias |
4 | 4 |
|
5 | | -from pydantic import BaseModel, Field, TypeAdapter |
| 5 | +from pydantic import Field, TypeAdapter |
6 | 6 | from pydantic.types import StringConstraints |
7 | 7 |
|
8 | 8 | # RESOURCE NAMES https://cloud.google.com/apis/design/resource_names |
@@ -56,20 +56,3 @@ def compose_resource_name(*collection_or_resource_ids) -> RelativeResourceName: |
56 | 56 | def split_resource_name(resource_name: RelativeResourceName) -> list[str]: |
57 | 57 | quoted_parts = resource_name.split("/") |
58 | 58 | return [f"{urllib.parse.unquote_plus(p)}" for p in quoted_parts] |
59 | | - |
60 | | - |
61 | | -# |
62 | | -# For resource definitions, the first field should be a string field for the resource name, |
63 | | -# and it should be called *name* |
64 | | -# Resource IDs must be clearly documented whether they are assigned by the client, the server, or either |
65 | | -# |
66 | | -class BaseResource(BaseModel): |
67 | | - name: RelativeResourceName = Field(None, examples=["solvers/isolve/releases/1.2.3"]) |
68 | | - id: Any = Field(None, description="Resource ID", examples=["1.2.3"]) # noqa: A003 |
69 | | - |
70 | | - |
71 | | -class BaseCollection(BaseModel): |
72 | | - name: RelativeResourceName = Field(None, examples=["solvers/isolve/releases"]) |
73 | | - id: Any = Field( |
74 | | - None, description="Collection ID", examples=["releases"] |
75 | | - ) # noqa: A003 |
0 commit comments