diff --git a/bases/renku_data_services/data_api/app.py b/bases/renku_data_services/data_api/app.py index b2af98684..2765aa542 100644 --- a/bases/renku_data_services/data_api/app.py +++ b/bases/renku_data_services/data_api/app.py @@ -26,7 +26,7 @@ def register_all_handlers(app: Sanic, config: Config) -> Sanic: """Register all handlers on the application.""" - app.router.register_pattern("ulid", ULID.from_str, r"^[0-9A-HJKMNP-TV-Z]{26}$") + app.router.register_pattern("ulid", ULID.from_str, r"^[0-7][0-9A-HJKMNP-TV-Z]{25}$") app.router.register_pattern("renku_slug", str, r"^[a-zA-Z0-9][a-zA-Z0-9\-_.]*$") url_prefix = "/api/data" diff --git a/components/renku_data_services/connected_services/api.spec.yaml b/components/renku_data_services/connected_services/api.spec.yaml index 9eb716627..7699262b8 100644 --- a/components/renku_data_services/connected_services/api.spec.yaml +++ b/components/renku_data_services/connected_services/api.spec.yaml @@ -309,7 +309,7 @@ components: type: string minLength: 26 maxLength: 26 - pattern: "^[A-Z0-9]{26}$" # This is case-insensitive + pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" # This is case-insensitive ProviderId: description: ID of a OAuth2 provider, e.g. "gitlab.com". type: string diff --git a/components/renku_data_services/connected_services/apispec.py b/components/renku_data_services/connected_services/apispec.py index 884edbf5b..519a07ec3 100644 --- a/components/renku_data_services/connected_services/apispec.py +++ b/components/renku_data_services/connected_services/apispec.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: api.spec.yaml -# timestamp: 2024-08-06T05:55:35+00:00 +# timestamp: 2024-08-12T06:46:18+00:00 from __future__ import annotations @@ -153,7 +153,7 @@ class Connection(BaseAPISpec): description="ULID identifier", max_length=26, min_length=26, - pattern="^[A-Z0-9]{26}$", + pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$", ) provider_id: str = Field( ..., diff --git a/components/renku_data_services/namespace/api.spec.yaml b/components/renku_data_services/namespace/api.spec.yaml index 2646d6bb4..e7acd3490 100644 --- a/components/renku_data_services/namespace/api.spec.yaml +++ b/components/renku_data_services/namespace/api.spec.yaml @@ -365,7 +365,7 @@ components: type: string minLength: 26 maxLength: 26 - pattern: "^[A-Z0-9]{26}$" # This is case-insensitive + pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" # This is case-insensitive NamespaceName: description: Renku group or namespace name type: string diff --git a/components/renku_data_services/namespace/apispec.py b/components/renku_data_services/namespace/apispec.py index cb7162856..a28579b87 100644 --- a/components/renku_data_services/namespace/apispec.py +++ b/components/renku_data_services/namespace/apispec.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: api.spec.yaml -# timestamp: 2024-08-06T08:46:00+00:00 +# timestamp: 2024-08-12T06:46:16+00:00 from __future__ import annotations @@ -29,7 +29,7 @@ class NamespaceResponse(BaseAPISpec): description="ULID identifier", max_length=26, min_length=26, - pattern="^[A-Z0-9]{26}$", + pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$", ) name: Optional[str] = Field( None, @@ -93,7 +93,7 @@ class GroupResponse(BaseAPISpec): description="ULID identifier", max_length=26, min_length=26, - pattern="^[A-Z0-9]{26}$", + pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$", ) name: str = Field( ..., diff --git a/components/renku_data_services/project/api.spec.yaml b/components/renku_data_services/project/api.spec.yaml index 2471bb2b5..98434f856 100644 --- a/components/renku_data_services/project/api.spec.yaml +++ b/components/renku_data_services/project/api.spec.yaml @@ -360,7 +360,7 @@ components: type: string minLength: 26 maxLength: 26 - pattern: "^[A-Z0-9]{26}$" # This is case-insensitive + pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" # This is case-insensitive ProjectName: description: Renku project name type: string diff --git a/components/renku_data_services/project/apispec.py b/components/renku_data_services/project/apispec.py index 7e01ab2b1..c9b57db17 100644 --- a/components/renku_data_services/project/apispec.py +++ b/components/renku_data_services/project/apispec.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: api.spec.yaml -# timestamp: 2024-08-06T05:55:31+00:00 +# timestamp: 2024-08-12T06:46:15+00:00 from __future__ import annotations @@ -112,7 +112,7 @@ class Project(BaseAPISpec): description="ULID identifier", max_length=26, min_length=26, - pattern="^[A-Z0-9]{26}$", + pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$", ) name: str = Field( ..., diff --git a/components/renku_data_services/repositories/api.spec.yaml b/components/renku_data_services/repositories/api.spec.yaml index 5af8857a4..e02c0960e 100644 --- a/components/renku_data_services/repositories/api.spec.yaml +++ b/components/renku_data_services/repositories/api.spec.yaml @@ -103,7 +103,7 @@ components: type: string minLength: 26 maxLength: 26 - pattern: "^[A-Z0-9]{26}$" # This is case-insensitive + pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" # This is case-insensitive ProviderId: description: ID of a OAuth2 provider, e.g. "gitlab.com". type: string diff --git a/components/renku_data_services/repositories/apispec.py b/components/renku_data_services/repositories/apispec.py index 13dccc8bf..e8e651f29 100644 --- a/components/renku_data_services/repositories/apispec.py +++ b/components/renku_data_services/repositories/apispec.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: api.spec.yaml -# timestamp: 2024-08-06T05:55:37+00:00 +# timestamp: 2024-08-12T06:46:19+00:00 from __future__ import annotations @@ -61,6 +61,6 @@ class RepositoryProviderMatch(BaseAPISpec): description="ULID identifier", max_length=26, min_length=26, - pattern="^[A-Z0-9]{26}$", + pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$", ) repository_metadata: Optional[RepositoryMetadata] = None diff --git a/components/renku_data_services/secrets/api.spec.yaml b/components/renku_data_services/secrets/api.spec.yaml index 7056d8766..de8b632d8 100644 --- a/components/renku_data_services/secrets/api.spec.yaml +++ b/components/renku_data_services/secrets/api.spec.yaml @@ -89,7 +89,7 @@ components: type: string minLength: 26 maxLength: 26 - pattern: "^[A-Z0-9]{26}$" # This is case-insensitive + pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" # This is case-insensitive ErrorResponse: type: object properties: diff --git a/components/renku_data_services/secrets/apispec.py b/components/renku_data_services/secrets/apispec.py index 672c60fdf..812598384 100644 --- a/components/renku_data_services/secrets/apispec.py +++ b/components/renku_data_services/secrets/apispec.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: api.spec.yaml -# timestamp: 2024-08-06T05:55:34+00:00 +# timestamp: 2024-08-12T06:46:17+00:00 from __future__ import annotations @@ -20,7 +20,7 @@ class Ulid(RootModel[str]): description="ULID identifier", max_length=26, min_length=26, - pattern="^[A-Z0-9]{26}$", + pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$", ) diff --git a/components/renku_data_services/session/api.spec.yaml b/components/renku_data_services/session/api.spec.yaml index fcb908e17..529499035 100644 --- a/components/renku_data_services/session/api.spec.yaml +++ b/components/renku_data_services/session/api.spec.yaml @@ -430,7 +430,7 @@ components: type: string minLength: 26 maxLength: 26 - pattern: "^[A-Z0-9]{26}$" # This is case-insensitive + pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" # This is case-insensitive SessionName: description: Renku session name type: string diff --git a/components/renku_data_services/storage/api.spec.yaml b/components/renku_data_services/storage/api.spec.yaml index 514edb7ab..ecdd1f9a7 100644 --- a/components/renku_data_services/storage/api.spec.yaml +++ b/components/renku_data_services/storage/api.spec.yaml @@ -16,7 +16,7 @@ paths: name: storage_id required: true schema: - $ref: "#/components/schemas/UlidId" + $ref: "#/components/schemas/Ulid" description: the id of the storage get: summary: get cloud storage details @@ -73,7 +73,7 @@ paths: additionalProperties: false properties: project_id: - $ref: "#/components/schemas/UlidId" + $ref: "#/components/schemas/Ulid" required: - project_id responses: @@ -122,7 +122,7 @@ paths: name: storage_id required: true schema: - $ref: "#/components/schemas/UlidId" + $ref: "#/components/schemas/Ulid" description: the id of the storage get: summary: get cloud storage details @@ -331,7 +331,7 @@ components: project_id: oneOf: - $ref: "#/components/schemas/GitlabProjectId" - - $ref: "#/components/schemas/UlidId" + - $ref: "#/components/schemas/Ulid" required: - project_id example: @@ -413,7 +413,7 @@ components: project_id: oneOf: - $ref: "#/components/schemas/GitlabProjectId" - - $ref: "#/components/schemas/UlidId" + - $ref: "#/components/schemas/Ulid" storage_type: $ref: "#/components/schemas/StorageType" name: @@ -437,7 +437,7 @@ components: - storage_id properties: storage_id: - $ref: "#/components/schemas/UlidId" + $ref: "#/components/schemas/Ulid" CloudStorageGet: type: object description: Get response for a cloud storage. Contains storage and information about fields that are required if the storage is private. @@ -532,12 +532,12 @@ components: type: string description: data type of option value. RClone has more options but they map to the ones listed here. enum: ["int", "bool", "string", "Time"] - UlidId: + Ulid: description: ULID identifier of an object type: string minLength: 26 maxLength: 26 - pattern: "^[A-Z0-9]+$" + pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" GitlabProjectId: description: Project id of a gitlab project (only int project id allowed, encoded as string for future-proofing) type: string diff --git a/components/renku_data_services/storage/apispec.py b/components/renku_data_services/storage/apispec.py index 1ee806776..7046cd04e 100644 --- a/components/renku_data_services/storage/apispec.py +++ b/components/renku_data_services/storage/apispec.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: api.spec.yaml -# timestamp: 2024-08-09T12:39:58+00:00 +# timestamp: 2024-08-12T06:46:13+00:00 from __future__ import annotations @@ -76,13 +76,13 @@ class RCloneOption(BaseAPISpec): ) -class UlidId(RootModel[str]): +class Ulid(RootModel[str]): root: str = Field( ..., description="ULID identifier of an object", max_length=26, min_length=26, - pattern="^[A-Z0-9]+$", + pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$", ) @@ -116,7 +116,7 @@ class StorageV2Params(BaseAPISpec): description="ULID identifier of an object", max_length=26, min_length=26, - pattern="^[A-Z0-9]+$", + pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$", ) @@ -154,7 +154,7 @@ class StorageSchemaObscurePostRequest(BaseAPISpec): class GitRequest(BaseAPISpec): - project_id: Union[GitlabProjectId, UlidId] + project_id: Union[GitlabProjectId, Ulid] class CloudStorageUrl(GitRequest): @@ -197,7 +197,7 @@ class CloudStorage(GitRequest): class CloudStoragePatch(BaseAPISpec): - project_id: Optional[Union[GitlabProjectId, UlidId]] = None + project_id: Optional[Union[GitlabProjectId, Ulid]] = None storage_type: Optional[str] = Field( None, description="same as rclone prefix/ rclone config type. Ignored in requests, but returned in responses for convenience.", @@ -232,7 +232,7 @@ class CloudStorageWithId(CloudStorage): description="ULID identifier of an object", max_length=26, min_length=26, - pattern="^[A-Z0-9]+$", + pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$", ) diff --git a/components/renku_data_services/users/api.spec.yaml b/components/renku_data_services/users/api.spec.yaml index 4c4dd4af5..65999fe80 100644 --- a/components/renku_data_services/users/api.spec.yaml +++ b/components/renku_data_services/users/api.spec.yaml @@ -430,7 +430,7 @@ components: type: string minLength: 26 maxLength: 26 - pattern: "^[A-Z0-9]{26}$" # This is case-insensitive + pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" # This is case-insensitive ModificationDate: description: The date and time the secret was created or modified (this is always in UTC) type: string diff --git a/components/renku_data_services/users/apispec.py b/components/renku_data_services/users/apispec.py index 9c1697bc1..4d7f9f2ab 100644 --- a/components/renku_data_services/users/apispec.py +++ b/components/renku_data_services/users/apispec.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: api.spec.yaml -# timestamp: 2024-08-06T11:43:01+00:00 +# timestamp: 2024-08-12T06:46:14+00:00 from __future__ import annotations @@ -149,7 +149,7 @@ class SecretWithId(BaseAPISpec): description="ULID identifier", max_length=26, min_length=26, - pattern="^[A-Z0-9]{26}$", + pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$", ) name: str = Field( ...,