Skip to content

Commit b4a25f5

Browse files
authored
spec: add 409 conflcit error for create and update operations (#51)
1 parent 42afbc8 commit b4a25f5

12 files changed

Lines changed: 105 additions & 4 deletions

File tree

java/lance-catalog-apache-client/api/openapi.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ paths:
8383
$ref: '#/components/responses/ForbiddenResponse'
8484
"406":
8585
$ref: '#/components/responses/UnsupportedOperationResponse'
86+
"409":
87+
$ref: '#/components/responses/ConflictErrorResponse'
8688
"503":
8789
$ref: '#/components/responses/ServiceUnavailableResponse'
8890
"5XX":
@@ -113,6 +115,8 @@ paths:
113115
$ref: '#/components/responses/ForbiddenResponse'
114116
"404":
115117
$ref: '#/components/responses/NotFoundResponse'
118+
"409":
119+
$ref: '#/components/responses/ConflictErrorResponse'
116120
"503":
117121
$ref: '#/components/responses/ServiceUnavailableResponse'
118122
"5XX":
@@ -196,6 +200,8 @@ paths:
196200
$ref: '#/components/responses/ForbiddenResponse'
197201
"406":
198202
$ref: '#/components/responses/UnsupportedOperationResponse'
203+
"409":
204+
$ref: '#/components/responses/ConflictErrorResponse'
199205
"503":
200206
$ref: '#/components/responses/ServiceUnavailableResponse'
201207
"5XX":
@@ -393,6 +399,18 @@ components:
393399
$ref: '#/components/schemas/ErrorModel'
394400
description: Not Acceptable / Unsupported Operation. The server does not support
395401
this operation.
402+
ConflictErrorResponse:
403+
content:
404+
application/json:
405+
example:
406+
type: /errors/conflict
407+
title: The namespace has been concurrently modified
408+
status: 409
409+
detail: ""
410+
instance: "/v1/namespaces/{ns}"
411+
schema:
412+
$ref: '#/components/schemas/ErrorModel'
413+
description: The request conflicts with the current state of the target resource.
396414
ServiceUnavailableResponse:
397415
content:
398416
application/json:

java/lance-catalog-apache-client/docs/NamespaceApi.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ No authorization required
7878
| **401** | Unauthorized. The request lacks valid authentication credentials for the operation. | - |
7979
| **403** | Forbidden. Authenticated user does not have the necessary permissions. | - |
8080
| **406** | Not Acceptable / Unsupported Operation. The server does not support this operation. | - |
81+
| **409** | The request conflicts with the current state of the target resource. | - |
8182
| **503** | The service is not ready to handle the request. The client should wait and retry. The service may additionally send a Retry-After header to indicate when to retry. | - |
8283
| **5XX** | A server-side problem that might not be addressable from the client side. Used for server 5xx errors without more specific documentation in individual routes. | - |
8384

@@ -147,6 +148,7 @@ No authorization required
147148
| **401** | Unauthorized. The request lacks valid authentication credentials for the operation. | - |
148149
| **403** | Forbidden. Authenticated user does not have the necessary permissions. | - |
149150
| **404** | A server-side problem that means can not find the specified resource. | - |
151+
| **409** | The request conflicts with the current state of the target resource. | - |
150152
| **503** | The service is not ready to handle the request. The client should wait and retry. The service may additionally send a Retry-After header to indicate when to retry. | - |
151153
| **5XX** | A server-side problem that might not be addressable from the client side. Used for server 5xx errors without more specific documentation in individual routes. | - |
152154

java/lance-catalog-apache-client/docs/TableApi.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ No authorization required
151151
| **401** | Unauthorized. The request lacks valid authentication credentials for the operation. | - |
152152
| **403** | Forbidden. Authenticated user does not have the necessary permissions. | - |
153153
| **406** | Not Acceptable / Unsupported Operation. The server does not support this operation. | - |
154+
| **409** | The request conflicts with the current state of the target resource. | - |
154155
| **503** | The service is not ready to handle the request. The client should wait and retry. The service may additionally send a Retry-After header to indicate when to retry. | - |
155156
| **5XX** | A server-side problem that might not be addressable from the client side. Used for server 5xx errors without more specific documentation in individual routes. | - |
156157

java/lance-catalog-springboot-server/src/main/java/com/lancedb/lance/catalog/server/springboot/api/NamespaceApi.java

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ default Optional<NativeWebRequest> getRequest() {
7171
* lacks valid authentication credentials for the operation. (status code 401) or Forbidden.
7272
* Authenticated user does not have the necessary permissions. (status code 403) or Not
7373
* Acceptable / Unsupported Operation. The server does not support this operation. (status
74-
* code 406) or The service is not ready to handle the request. The client should wait and
74+
* code 406) or The request conflicts with the current state of the target resource. (status
75+
* code 409) or The service is not ready to handle the request. The client should wait and
7576
* retry. The service may additionally send a Retry-After header to indicate when to retry.
7677
* (status code 503) or A server-side problem that might not be addressable from the client
7778
* side. Used for server 5xx errors without more specific documentation in individual routes.
@@ -127,6 +128,14 @@ default Optional<NativeWebRequest> getRequest() {
127128
mediaType = "application/json",
128129
schema = @Schema(implementation = ErrorModel.class))
129130
}),
131+
@ApiResponse(
132+
responseCode = "409",
133+
description = "The request conflicts with the current state of the target resource.",
134+
content = {
135+
@Content(
136+
mediaType = "application/json",
137+
schema = @Schema(implementation = ErrorModel.class))
138+
}),
130139
@ApiResponse(
131140
responseCode = "503",
132141
description =
@@ -202,6 +211,12 @@ default ResponseEntity<CreateNamespaceResponse> createNamespace(
202211
ApiUtil.setExampleResponse(request, "application/json", exampleString);
203212
break;
204213
}
214+
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
215+
String exampleString =
216+
"{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }";
217+
ApiUtil.setExampleResponse(request, "application/json", exampleString);
218+
break;
219+
}
205220
}
206221
});
207222
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@@ -218,7 +233,8 @@ default ResponseEntity<CreateNamespaceResponse> createNamespace(
218233
* 400) or Unauthorized. The request lacks valid authentication credentials for the operation.
219234
* (status code 401) or Forbidden. Authenticated user does not have the necessary permissions.
220235
* (status code 403) or A server-side problem that means can not find the specified resource.
221-
* (status code 404) or The service is not ready to handle the request. The client should wait
236+
* (status code 404) or The request conflicts with the current state of the target resource.
237+
* (status code 409) or The service is not ready to handle the request. The client should wait
222238
* and retry. The service may additionally send a Retry-After header to indicate when to
223239
* retry. (status code 503) or A server-side problem that might not be addressable from the
224240
* client side. Used for server 5xx errors without more specific documentation in individual
@@ -264,6 +280,14 @@ default ResponseEntity<CreateNamespaceResponse> createNamespace(
264280
mediaType = "application/json",
265281
schema = @Schema(implementation = ErrorModel.class))
266282
}),
283+
@ApiResponse(
284+
responseCode = "409",
285+
description = "The request conflicts with the current state of the target resource.",
286+
content = {
287+
@Content(
288+
mediaType = "application/json",
289+
schema = @Schema(implementation = ErrorModel.class))
290+
}),
267291
@ApiResponse(
268292
responseCode = "503",
269293
description =
@@ -335,6 +359,12 @@ default ResponseEntity<Void> dropNamespace(
335359
ApiUtil.setExampleResponse(request, "application/json", exampleString);
336360
break;
337361
}
362+
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
363+
String exampleString =
364+
"{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }";
365+
ApiUtil.setExampleResponse(request, "application/json", exampleString);
366+
break;
367+
}
338368
}
339369
});
340370
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);

java/lance-catalog-springboot-server/src/main/java/com/lancedb/lance/catalog/server/springboot/api/TableApi.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,9 @@ default ResponseEntity<GetTableResponse> getTable(
218218
* middleware. (status code 400) or Unauthorized. The request lacks valid authentication
219219
* credentials for the operation. (status code 401) or Forbidden. Authenticated user does not
220220
* have the necessary permissions. (status code 403) or Not Acceptable / Unsupported
221-
* Operation. The server does not support this operation. (status code 406) or The service is
222-
* not ready to handle the request. The client should wait and retry. The service may
221+
* Operation. The server does not support this operation. (status code 406) or The request
222+
* conflicts with the current state of the target resource. (status code 409) or The service
223+
* is not ready to handle the request. The client should wait and retry. The service may
223224
* additionally send a Retry-After header to indicate when to retry. (status code 503) or A
224225
* server-side problem that might not be addressable from the client side. Used for server 5xx
225226
* errors without more specific documentation in individual routes. (status code 5XX)
@@ -273,6 +274,14 @@ default ResponseEntity<GetTableResponse> getTable(
273274
mediaType = "application/json",
274275
schema = @Schema(implementation = ErrorModel.class))
275276
}),
277+
@ApiResponse(
278+
responseCode = "409",
279+
description = "The request conflicts with the current state of the target resource.",
280+
content = {
281+
@Content(
282+
mediaType = "application/json",
283+
schema = @Schema(implementation = ErrorModel.class))
284+
}),
276285
@ApiResponse(
277286
responseCode = "503",
278287
description =
@@ -355,6 +364,12 @@ default ResponseEntity<GetTableResponse> registerTable(
355364
ApiUtil.setExampleResponse(request, "application/json", exampleString);
356365
break;
357366
}
367+
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
368+
String exampleString =
369+
"{ \"instance\" : \"/login/log/abc123\", \"detail\" : \"Authentication failed due to incorrect username or password\", \"type\" : \"/errors/incorrect-user-pass\", \"title\" : \"Incorrect username or password\", \"status\" : 404 }";
370+
ApiUtil.setExampleResponse(request, "application/json", exampleString);
371+
break;
372+
}
358373
}
359374
});
360375
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);

python/lance_catalog_urllib3_client/docs/NamespaceApi.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ No authorization required
7979
**401** | Unauthorized. The request lacks valid authentication credentials for the operation. | - |
8080
**403** | Forbidden. Authenticated user does not have the necessary permissions. | - |
8181
**406** | Not Acceptable / Unsupported Operation. The server does not support this operation. | - |
82+
**409** | The request conflicts with the current state of the target resource. | - |
8283
**503** | The service is not ready to handle the request. The client should wait and retry. The service may additionally send a Retry-After header to indicate when to retry. | - |
8384
**5XX** | A server-side problem that might not be addressable from the client side. Used for server 5xx errors without more specific documentation in individual routes. | - |
8485

@@ -148,6 +149,7 @@ No authorization required
148149
**401** | Unauthorized. The request lacks valid authentication credentials for the operation. | - |
149150
**403** | Forbidden. Authenticated user does not have the necessary permissions. | - |
150151
**404** | A server-side problem that means can not find the specified resource. | - |
152+
**409** | The request conflicts with the current state of the target resource. | - |
151153
**503** | The service is not ready to handle the request. The client should wait and retry. The service may additionally send a Retry-After header to indicate when to retry. | - |
152154
**5XX** | A server-side problem that might not be addressable from the client side. Used for server 5xx errors without more specific documentation in individual routes. | - |
153155

python/lance_catalog_urllib3_client/docs/TableApi.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ No authorization required
154154
**401** | Unauthorized. The request lacks valid authentication credentials for the operation. | - |
155155
**403** | Forbidden. Authenticated user does not have the necessary permissions. | - |
156156
**406** | Not Acceptable / Unsupported Operation. The server does not support this operation. | - |
157+
**409** | The request conflicts with the current state of the target resource. | - |
157158
**503** | The service is not ready to handle the request. The client should wait and retry. The service may additionally send a Retry-After header to indicate when to retry. | - |
158159
**5XX** | A server-side problem that might not be addressable from the client side. Used for server 5xx errors without more specific documentation in individual routes. | - |
159160

python/lance_catalog_urllib3_client/lance_catalog_urllib3_client/api/namespace_api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def create_namespace(
100100
'401': "ErrorModel",
101101
'403': "ErrorModel",
102102
'406': "ErrorModel",
103+
'409': "ErrorModel",
103104
'503': "ErrorModel",
104105
'5XX': "ErrorModel",
105106
}
@@ -172,6 +173,7 @@ def create_namespace_with_http_info(
172173
'401': "ErrorModel",
173174
'403': "ErrorModel",
174175
'406': "ErrorModel",
176+
'409': "ErrorModel",
175177
'503': "ErrorModel",
176178
'5XX': "ErrorModel",
177179
}
@@ -244,6 +246,7 @@ def create_namespace_without_preload_content(
244246
'401': "ErrorModel",
245247
'403': "ErrorModel",
246248
'406': "ErrorModel",
249+
'409': "ErrorModel",
247250
'503': "ErrorModel",
248251
'5XX': "ErrorModel",
249252
}
@@ -388,6 +391,7 @@ def drop_namespace(
388391
'401': "ErrorModel",
389392
'403': "ErrorModel",
390393
'404': "ErrorModel",
394+
'409': "ErrorModel",
391395
'503': "ErrorModel",
392396
'5XX': "ErrorModel",
393397
}
@@ -460,6 +464,7 @@ def drop_namespace_with_http_info(
460464
'401': "ErrorModel",
461465
'403': "ErrorModel",
462466
'404': "ErrorModel",
467+
'409': "ErrorModel",
463468
'503': "ErrorModel",
464469
'5XX': "ErrorModel",
465470
}
@@ -532,6 +537,7 @@ def drop_namespace_without_preload_content(
532537
'401': "ErrorModel",
533538
'403': "ErrorModel",
534539
'404': "ErrorModel",
540+
'409': "ErrorModel",
535541
'503': "ErrorModel",
536542
'5XX': "ErrorModel",
537543
}

python/lance_catalog_urllib3_client/lance_catalog_urllib3_client/api/table_api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ def register_table(
394394
'401': "ErrorModel",
395395
'403': "ErrorModel",
396396
'406': "ErrorModel",
397+
'409': "ErrorModel",
397398
'503': "ErrorModel",
398399
'5XX': "ErrorModel",
399400
}
@@ -470,6 +471,7 @@ def register_table_with_http_info(
470471
'401': "ErrorModel",
471472
'403': "ErrorModel",
472473
'406': "ErrorModel",
474+
'409': "ErrorModel",
473475
'503': "ErrorModel",
474476
'5XX': "ErrorModel",
475477
}
@@ -546,6 +548,7 @@ def register_table_without_preload_content(
546548
'401': "ErrorModel",
547549
'403': "ErrorModel",
548550
'406': "ErrorModel",
551+
'409': "ErrorModel",
549552
'503': "ErrorModel",
550553
'5XX': "ErrorModel",
551554
}

rust/lance-catalog-reqwest-client/src/apis/namespace_api.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub enum CreateNamespaceError {
2323
Status401(models::ErrorModel),
2424
Status403(models::ErrorModel),
2525
Status406(models::ErrorModel),
26+
Status409(models::ErrorModel),
2627
Status503(models::ErrorModel),
2728
Status5XX(models::ErrorModel),
2829
UnknownValue(serde_json::Value),
@@ -36,6 +37,7 @@ pub enum DropNamespaceError {
3637
Status401(models::ErrorModel),
3738
Status403(models::ErrorModel),
3839
Status404(models::ErrorModel),
40+
Status409(models::ErrorModel),
3941
Status503(models::ErrorModel),
4042
Status5XX(models::ErrorModel),
4143
UnknownValue(serde_json::Value),

0 commit comments

Comments
 (0)