Skip to content

Commit ea965f1

Browse files
committed
spec: get table under ns
1 parent 0a76dc2 commit ea965f1

10 files changed

Lines changed: 119 additions & 14 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ paths:
184184
$ref: '#/components/responses/GetTableResponse'
185185
"400":
186186
$ref: '#/components/responses/BadRequestErrorResponse'
187+
"401":
188+
$ref: '#/components/responses/UnauthorizedResponse'
187189
"403":
188190
$ref: '#/components/responses/ForbiddenResponse'
189191
"404":
@@ -477,15 +479,19 @@ components:
477479
description: |
478480
Result used when a table is successfully loaded.
479481
example:
482+
name: name
480483
location: location
481484
properties:
482485
key: properties
483486
properties:
487+
name:
488+
type: string
484489
location:
485490
type: string
486491
properties:
487492
additionalProperties:
488493
type: string
489494
required:
490495
- location
496+
- name
491497

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Result used when a table is successfully loaded.
88

99
| Name | Type | Description | Notes |
1010
|------------ | ------------- | ------------- | -------------|
11+
|**name** | **String** | | |
1112
|**location** | **String** | | |
1213
|**properties** | **Map<String, String>** | | [optional] |
1314

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ No authorization required
291291
|-------------|-------------|------------------|
292292
| **200** | Table properties result when loading a table | - |
293293
| **400** | Indicates a bad request error. It could be caused by an unexpected request body format or other forms of request validation failure, such as invalid json. Usually serves application/json content, although in some cases simple text/plain content might be returned by the server's middleware. | - |
294+
| **401** | Unauthorized. The request lacks valid authentication credentials for the operation. | - |
294295
| **403** | Forbidden. Authenticated user does not have the necessary permissions. | - |
295296
| **404** | A server-side problem that means can not find the specified resource. | - |
296297
| **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. | - |

java/lance-catalog-apache-client/src/main/java/com/lancedb/lance/catalog/client/apache/model/GetTableResponse.java

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@
2626

2727
/** Result used when a table is successfully loaded. */
2828
@JsonPropertyOrder({
29+
GetTableResponse.JSON_PROPERTY_NAME,
2930
GetTableResponse.JSON_PROPERTY_LOCATION,
3031
GetTableResponse.JSON_PROPERTY_PROPERTIES
3132
})
3233
@javax.annotation.Generated(
3334
value = "org.openapitools.codegen.languages.JavaClientCodegen",
3435
comments = "Generator version: 7.12.0")
3536
public class GetTableResponse {
37+
public static final String JSON_PROPERTY_NAME = "name";
38+
@javax.annotation.Nonnull private String name;
39+
3640
public static final String JSON_PROPERTY_LOCATION = "location";
3741
@javax.annotation.Nonnull private String location;
3842

@@ -41,6 +45,30 @@ public class GetTableResponse {
4145

4246
public GetTableResponse() {}
4347

48+
public GetTableResponse name(@javax.annotation.Nonnull String name) {
49+
50+
this.name = name;
51+
return this;
52+
}
53+
54+
/**
55+
* Get name
56+
*
57+
* @return name
58+
*/
59+
@javax.annotation.Nonnull
60+
@JsonProperty(JSON_PROPERTY_NAME)
61+
@JsonInclude(value = JsonInclude.Include.ALWAYS)
62+
public String getName() {
63+
return name;
64+
}
65+
66+
@JsonProperty(JSON_PROPERTY_NAME)
67+
@JsonInclude(value = JsonInclude.Include.ALWAYS)
68+
public void setName(@javax.annotation.Nonnull String name) {
69+
this.name = name;
70+
}
71+
4472
public GetTableResponse location(@javax.annotation.Nonnull String location) {
4573

4674
this.location = location;
@@ -106,19 +134,21 @@ public boolean equals(Object o) {
106134
return false;
107135
}
108136
GetTableResponse getTableResponse = (GetTableResponse) o;
109-
return Objects.equals(this.location, getTableResponse.location)
137+
return Objects.equals(this.name, getTableResponse.name)
138+
&& Objects.equals(this.location, getTableResponse.location)
110139
&& Objects.equals(this.properties, getTableResponse.properties);
111140
}
112141

113142
@Override
114143
public int hashCode() {
115-
return Objects.hash(location, properties);
144+
return Objects.hash(name, location, properties);
116145
}
117146

118147
@Override
119148
public String toString() {
120149
StringBuilder sb = new StringBuilder();
121150
sb.append("class GetTableResponse {\n");
151+
sb.append(" name: ").append(toIndentedString(name)).append("\n");
122152
sb.append(" location: ").append(toIndentedString(location)).append("\n");
123153
sb.append(" properties: ").append(toIndentedString(properties)).append("\n");
124154
sb.append("}");
@@ -167,6 +197,21 @@ public String toUrlQueryString(String prefix) {
167197

168198
StringJoiner joiner = new StringJoiner("&");
169199

200+
// add `name` to the URL query string
201+
if (getName() != null) {
202+
try {
203+
joiner.add(
204+
String.format(
205+
"%sname%s=%s",
206+
prefix,
207+
suffix,
208+
URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20")));
209+
} catch (UnsupportedEncodingException e) {
210+
// Should never happen, UTF-8 is always supported
211+
throw new RuntimeException(e);
212+
}
213+
}
214+
170215
// add `location` to the URL query string
171216
if (getLocation() != null) {
172217
try {

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

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -501,13 +501,14 @@ default ResponseEntity<GetNamespaceResponse> getNamespace(
501501
* request error. It could be caused by an unexpected request body format or other forms of
502502
* request validation failure, such as invalid json. Usually serves application/json content,
503503
* although in some cases simple text/plain content might be returned by the server&#39;s
504-
* middleware. (status code 400) or Forbidden. Authenticated user does not have the necessary
505-
* permissions. (status code 403) or A server-side problem that means can not find the
506-
* specified resource. (status code 404) or The service is not ready to handle the request.
507-
* The client should wait and retry. The service may additionally send a Retry-After header to
508-
* indicate when to retry. (status code 503) or A server-side problem that might not be
509-
* addressable from the client side. Used for server 5xx errors without more specific
510-
* documentation in individual routes. (status code 5XX)
504+
* middleware. (status code 400) or Unauthorized. The request lacks valid authentication
505+
* credentials for the operation. (status code 401) or Forbidden. Authenticated user does not
506+
* have the necessary permissions. (status code 403) or A server-side problem that means can
507+
* not find the specified resource. (status code 404) or The service is not ready to handle
508+
* the request. The client should wait and retry. The service may additionally send a
509+
* Retry-After header to indicate when to retry. (status code 503) or A server-side problem
510+
* that might not be addressable from the client side. Used for server 5xx errors without more
511+
* specific documentation in individual routes. (status code 5XX)
511512
*/
512513
@Operation(
513514
operationId = "getTable",
@@ -533,6 +534,15 @@ default ResponseEntity<GetNamespaceResponse> getNamespace(
533534
mediaType = "application/json",
534535
schema = @Schema(implementation = ErrorModel.class))
535536
}),
537+
@ApiResponse(
538+
responseCode = "401",
539+
description =
540+
"Unauthorized. The request lacks valid authentication credentials for the operation.",
541+
content = {
542+
@Content(
543+
mediaType = "application/json",
544+
schema = @Schema(implementation = ErrorModel.class))
545+
}),
536546
@ApiResponse(
537547
responseCode = "403",
538548
description = "Forbidden. Authenticated user does not have the necessary permissions.",
@@ -593,7 +603,13 @@ default ResponseEntity<GetTableResponse> getTable(
593603
for (MediaType mediaType : MediaType.parseMediaTypes(request.getHeader("Accept"))) {
594604
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
595605
String exampleString =
596-
"{ \"location\" : \"location\", \"properties\" : { \"key\" : \"properties\" } }";
606+
"{ \"name\" : \"name\", \"location\" : \"location\", \"properties\" : { \"key\" : \"properties\" } }";
607+
ApiUtil.setExampleResponse(request, "application/json", exampleString);
608+
break;
609+
}
610+
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
611+
String exampleString =
612+
"{ \"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 }";
597613
ApiUtil.setExampleResponse(request, "application/json", exampleString);
598614
break;
599615
}

java/lance-catalog-springboot-server/src/main/java/com/lancedb/lance/catalog/server/springboot/model/GetTableResponse.java

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
comments = "Generator version: 7.12.0")
3535
public class GetTableResponse {
3636

37+
private String name;
38+
3739
private String location;
3840

3941
@Valid private Map<String, String> properties = new HashMap<>();
@@ -43,10 +45,32 @@ public GetTableResponse() {
4345
}
4446

4547
/** Constructor with only required parameters */
46-
public GetTableResponse(String location) {
48+
public GetTableResponse(String name, String location) {
49+
this.name = name;
4750
this.location = location;
4851
}
4952

53+
public GetTableResponse name(String name) {
54+
this.name = name;
55+
return this;
56+
}
57+
58+
/**
59+
* Get name
60+
*
61+
* @return name
62+
*/
63+
@NotNull
64+
@Schema(name = "name", requiredMode = Schema.RequiredMode.REQUIRED)
65+
@JsonProperty("name")
66+
public String getName() {
67+
return name;
68+
}
69+
70+
public void setName(String name) {
71+
this.name = name;
72+
}
73+
5074
public GetTableResponse location(String location) {
5175
this.location = location;
5276
return this;
@@ -105,19 +129,21 @@ public boolean equals(Object o) {
105129
return false;
106130
}
107131
GetTableResponse getTableResponse = (GetTableResponse) o;
108-
return Objects.equals(this.location, getTableResponse.location)
132+
return Objects.equals(this.name, getTableResponse.name)
133+
&& Objects.equals(this.location, getTableResponse.location)
109134
&& Objects.equals(this.properties, getTableResponse.properties);
110135
}
111136

112137
@Override
113138
public int hashCode() {
114-
return Objects.hash(location, properties);
139+
return Objects.hash(name, location, properties);
115140
}
116141

117142
@Override
118143
public String toString() {
119144
StringBuilder sb = new StringBuilder();
120145
sb.append("class GetTableResponse {\n");
146+
sb.append(" name: ").append(toIndentedString(name)).append("\n");
121147
sb.append(" location: ").append(toIndentedString(location)).append("\n");
122148
sb.append(" properties: ").append(toIndentedString(properties)).append("\n");
123149
sb.append("}");

rust/lance-catalog-reqwest-client/docs/GetTableResponse.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7+
**name** | **String** | |
78
**location** | **String** | |
89
**properties** | Option<**std::collections::HashMap<String, String>**> | | [optional]
910

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ pub enum GetNamespaceError {
5959
#[serde(untagged)]
6060
pub enum GetTableError {
6161
Status400(models::ErrorModel),
62+
Status401(models::ErrorModel),
6263
Status403(models::ErrorModel),
6364
Status404(models::ErrorModel),
6465
Status503(models::ErrorModel),

rust/lance-catalog-reqwest-client/src/models/get_table_response.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ use serde::{Deserialize, Serialize};
1414
/// GetTableResponse : Result used when a table is successfully loaded.
1515
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
1616
pub struct GetTableResponse {
17+
#[serde(rename = "name")]
18+
pub name: String,
1719
#[serde(rename = "location")]
1820
pub location: String,
1921
#[serde(rename = "properties", skip_serializing_if = "Option::is_none")]
@@ -22,8 +24,9 @@ pub struct GetTableResponse {
2224

2325
impl GetTableResponse {
2426
/// Result used when a table is successfully loaded.
25-
pub fn new(location: String) -> GetTableResponse {
27+
pub fn new(name: String, location: String) -> GetTableResponse {
2628
GetTableResponse {
29+
name,
2730
location,
2831
properties: None,
2932
}

spec/catalog.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ paths:
189189
$ref: '#/components/responses/GetTableResponse'
190190
400:
191191
$ref: '#/components/responses/BadRequestErrorResponse'
192+
401:
193+
$ref: '#/components/responses/UnauthorizedResponse'
192194
403:
193195
$ref: '#/components/responses/ForbiddenResponse'
194196
404:
@@ -310,8 +312,11 @@ components:
310312
Result used when a table is successfully loaded.
311313
type: object
312314
required:
315+
- name
313316
- location
314317
properties:
318+
name:
319+
type: string
315320
location:
316321
type: string
317322
properties:

0 commit comments

Comments
 (0)