Skip to content

Commit 5d6d7f0

Browse files
committed
feat: upgrade the apispec and generate code
1 parent 86bb5f0 commit 5d6d7f0

File tree

2 files changed

+79
-25
lines changed

2 files changed

+79
-25
lines changed

components/renku_data_services/notebooks/api.spec.yaml

Lines changed: 62 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,16 @@ paths:
2121
minLength: 1
2222
responses:
2323
'200':
24-
description: The Docker image is available.
25-
'404':
26-
description: The Docker image is not available.
24+
content:
25+
application/json:
26+
schema:
27+
"$ref": "#/components/schemas/ImageCheckResponse"
28+
'422':
29+
content:
30+
application/json:
31+
schema:
32+
"$ref": "#/components/schemas/ErrorResponse"
33+
description: The image url is malformed.
2734
tags:
2835
- notebooks
2936
"/notebooks/logs/{server_name}":
@@ -355,27 +362,28 @@ paths:
355362
tags:
356363
- sessions
357364
"/sessions/images":
358-
get:
359-
summary: Check if a session image exists
360-
parameters:
361-
- description: The Docker image URL (tag included) that should be fetched.
362-
in: query
363-
name: image_url
364-
required: true
365-
schema:
366-
type: string
367-
minLength: 1
368-
responses:
369-
"200":
370-
description: The docker image can be found
371-
"404":
372-
description: The docker image cannot be found or the user does not have permissions to access it
373-
content:
374-
application/json:
375-
schema:
376-
$ref: "#/components/schemas/ErrorResponse"
377-
default:
378-
$ref: "#/components/responses/Error"
365+
get:
366+
description: Check if a session image exists
367+
parameters:
368+
- description: The Docker image URL (tag included) that should be fetched.
369+
in: query
370+
name: image_url
371+
required: true
372+
schema:
373+
type: string
374+
minLength: 1
375+
responses:
376+
'200':
377+
content:
378+
application/json:
379+
schema:
380+
"$ref": "#/components/schemas/ImageCheckResponse"
381+
'422':
382+
content:
383+
application/json:
384+
schema:
385+
"$ref": "#/components/schemas/ErrorResponse"
386+
description: The image url is malformed.
379387
tags:
380388
- sessions
381389
components:
@@ -1036,7 +1044,37 @@ components:
10361044
maxLength: 50
10371045
pattern: '^[a-z]([-a-z0-9]*[a-z0-9])?$'
10381046
example: d185e68d-d43-renku-2-b9ac279a4e8a85ac28d08
1047+
ImageCheckResponse:
1048+
type: object
1049+
properties:
1050+
accessible:
1051+
type: boolean
1052+
description: Whether the image is accessible or not.
1053+
connection:
1054+
allOf:
1055+
- "$ref": "#/components/schemas/ImageConnectionStatus"
1056+
- description: Whether an oauth2 connection is or can be used to access the image. If null indicates that there is no oauth2 connection we can use to access the requested image.
1057+
required:
1058+
- accessible
1059+
ImageConnection:
1060+
type: object
1061+
properties:
1062+
id:
1063+
type: string
1064+
status:
1065+
"$ref": "#/components/schemas/ImageConnectionStatus"
1066+
required:
1067+
- id
1068+
- status
1069+
ImageConnectionStatus:
1070+
type: string
1071+
enum:
1072+
- connected
1073+
- pending
1074+
- disconnected
10391075
responses:
1076+
ImageCheckResponse:
1077+
description: Information about whether a docker image is available or not and if there is a connected service then which connected service can be used to access the image.
10401078
Error:
10411079
description: The schema for all 4xx and 5xx responses
10421080
content:

components/renku_data_services/notebooks/apispec.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: api.spec.yaml
3-
# timestamp: 2025-04-17T14:26:28+00:00
3+
# timestamp: 2025-08-26T12:05:22+00:00
44

55
from __future__ import annotations
66

@@ -281,6 +281,12 @@ class SessionCloudStoragePost(BaseAPISpec):
281281
)
282282

283283

284+
class ImageConnectionStatus(Enum):
285+
connected = "connected"
286+
pending = "pending"
287+
disconnected = "disconnected"
288+
289+
284290
class NotebooksImagesGetParametersQuery(BaseAPISpec):
285291
image_url: str = Field(..., min_length=1)
286292

@@ -356,6 +362,16 @@ class SessionResources(BaseAPISpec):
356362
requests: Optional[SessionResourcesRequests] = None
357363

358364

365+
class ImageCheckResponse(BaseAPISpec):
366+
accessible: bool = Field(..., description="Whether the image is accessible or not.")
367+
connection: Optional[ImageConnectionStatus] = None
368+
369+
370+
class ImageConnection(BaseAPISpec):
371+
id: str
372+
status: ImageConnectionStatus
373+
374+
359375
class NotebookResponse(BaseAPISpec):
360376
annotations: Optional[FieldUserPodAnnotations] = None
361377
cloudstorage: Optional[List[LaunchNotebookResponseCloudStorage]] = None

0 commit comments

Comments
 (0)