Skip to content

Commit

Permalink
fix: change ulid regex to validate correct range
Browse files Browse the repository at this point in the history
  • Loading branch information
Panaetius committed Aug 14, 2024
1 parent 56462f6 commit 8dbfc73
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: api.spec.yaml
# timestamp: 2024-08-13T13:29:50+00:00
# timestamp: 2024-08-12T06:46:18+00:00

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion components/renku_data_services/namespace/apispec.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: api.spec.yaml
# timestamp: 2024-08-13T13:29:48+00:00
# timestamp: 2024-08-12T06:46:16+00:00

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion components/renku_data_services/project/apispec.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: api.spec.yaml
# timestamp: 2024-08-13T13:29:47+00:00
# timestamp: 2024-08-12T06:46:15+00:00

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion components/renku_data_services/repositories/apispec.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: api.spec.yaml
# timestamp: 2024-08-13T13:29:50+00:00
# timestamp: 2024-08-12T06:46:19+00:00

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion components/renku_data_services/secrets/apispec.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: api.spec.yaml
# timestamp: 2024-08-13T13:29:49+00:00
# timestamp: 2024-08-12T06:46:17+00:00

from __future__ import annotations

Expand Down
18 changes: 9 additions & 9 deletions components/renku_data_services/storage/api.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -73,7 +73,7 @@ paths:
additionalProperties: false
properties:
project_id:
$ref: "#/components/schemas/UlidId"
$ref: "#/components/schemas/Ulid"
required:
- project_id
responses:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -331,7 +331,7 @@ components:
project_id:
oneOf:
- $ref: "#/components/schemas/GitlabProjectId"
- $ref: "#/components/schemas/UlidId"
- $ref: "#/components/schemas/Ulid"
required:
- project_id
example:
Expand Down Expand Up @@ -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:
Expand All @@ -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.
Expand Down Expand Up @@ -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:
description: ULID identifier of an object
Ulid:
description: ULID identifier
type: string
minLength: 26
maxLength: 26
pattern: "^[A-Z0-9]+$"
pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" # This is case-insensitive
GitlabProjectId:
description: Project id of a gitlab project (only int project id allowed, encoded as string for future-proofing)
type: string
Expand Down
20 changes: 10 additions & 10 deletions components/renku_data_services/storage/apispec.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: api.spec.yaml
# timestamp: 2024-08-09T12:39:58+00:00
# timestamp: 2024-08-12T07:20:07+00:00

from __future__ import annotations

Expand Down Expand Up @@ -76,13 +76,13 @@ class RCloneOption(BaseAPISpec):
)


class UlidId(RootModel[str]):
class Ulid(RootModel[str]):
root: str = Field(
...,
description="ULID identifier of an object",
description="ULID identifier",
max_length=26,
min_length=26,
pattern="^[A-Z0-9]+$",
pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
)


Expand Down Expand Up @@ -113,10 +113,10 @@ class StorageV2Params(BaseAPISpec):
)
project_id: str = Field(
...,
description="ULID identifier of an object",
description="ULID identifier",
max_length=26,
min_length=26,
pattern="^[A-Z0-9]+$",
pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
)


Expand Down Expand Up @@ -154,7 +154,7 @@ class StorageSchemaObscurePostRequest(BaseAPISpec):


class GitRequest(BaseAPISpec):
project_id: Union[GitlabProjectId, UlidId]
project_id: Union[GitlabProjectId, Ulid]


class CloudStorageUrl(GitRequest):
Expand Down Expand Up @@ -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.",
Expand Down Expand Up @@ -229,10 +229,10 @@ class CloudStoragePatch(BaseAPISpec):
class CloudStorageWithId(CloudStorage):
storage_id: str = Field(
...,
description="ULID identifier of an object",
description="ULID identifier",
max_length=26,
min_length=26,
pattern="^[A-Z0-9]+$",
pattern="^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
)


Expand Down
2 changes: 1 addition & 1 deletion components/renku_data_services/users/apispec.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: api.spec.yaml
# timestamp: 2024-08-13T13:29:47+00:00
# timestamp: 2024-08-12T06:46:14+00:00

from __future__ import annotations

Expand Down

0 comments on commit 8dbfc73

Please sign in to comment.