Skip to content

Commit 1e3e4b4

Browse files
chore(docs): sync OpenAPI spec (#70)
Co-authored-by: prrao87 <35005448+prrao87@users.noreply.github.com>
1 parent 351c9ff commit 1e3e4b4

File tree

2 files changed

+127
-32
lines changed

2 files changed

+127
-32
lines changed

docs/api-reference/rest/openapi.yml

Lines changed: 126 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ paths:
439439
440440
For DirectoryNamespace implementation, a table exists if either:
441441
- The table has Lance data versions (regular table created with CreateTable)
442-
- A `.lance-reserved` file exists in the table directory (empty table created with CreateEmptyTable)
442+
- A `.lance-reserved` file exists in the table directory (declared table created with DeclareTable)
443443
requestBody:
444444
required: true
445445
content:
@@ -1529,6 +1529,46 @@ paths:
15291529
5XX:
15301530
$ref: '#/components/responses/ServerErrorResponse'
15311531

1532+
/v1/table/{id}/declare:
1533+
parameters:
1534+
- $ref: '#/components/parameters/id'
1535+
- $ref: '#/components/parameters/delimiter'
1536+
post:
1537+
tags:
1538+
- Table
1539+
- Metadata
1540+
summary: Declare a table
1541+
operationId: DeclareTable
1542+
description: |
1543+
Declare a table with the given name without touching storage.
1544+
This is a metadata-only operation that records the table existence and sets up aspects like access control.
1545+
1546+
For DirectoryNamespace implementation, this creates a `.lance-reserved` file in the table directory
1547+
to mark the table's existence without creating actual Lance data files.
1548+
requestBody:
1549+
required: true
1550+
content:
1551+
application/json:
1552+
schema:
1553+
$ref: '#/components/schemas/DeclareTableRequest'
1554+
responses:
1555+
200:
1556+
$ref: '#/components/responses/DeclareTableResponse'
1557+
400:
1558+
$ref: '#/components/responses/BadRequestErrorResponse'
1559+
401:
1560+
$ref: '#/components/responses/UnauthorizedErrorResponse'
1561+
403:
1562+
$ref: '#/components/responses/ForbiddenErrorResponse'
1563+
404:
1564+
$ref: '#/components/responses/NotFoundErrorResponse'
1565+
409:
1566+
$ref: '#/components/responses/ConflictErrorResponse'
1567+
503:
1568+
$ref: '#/components/responses/ServiceUnavailableErrorResponse'
1569+
5XX:
1570+
$ref: '#/components/responses/ServerErrorResponse'
1571+
15321572
/v1/table/{id}/create-empty:
15331573
parameters:
15341574
- $ref: '#/components/parameters/id'
@@ -1539,12 +1579,15 @@ paths:
15391579
- Metadata
15401580
summary: Create an empty table
15411581
operationId: CreateEmptyTable
1582+
deprecated: true
15421583
description: |
15431584
Create an empty table with the given name without touching storage.
15441585
This is a metadata-only operation that records the table existence and sets up aspects like access control.
1545-
1586+
15461587
For DirectoryNamespace implementation, this creates a `.lance-reserved` file in the table directory
15471588
to mark the table's existence without creating actual Lance data files.
1589+
1590+
**Deprecated**: Use `DeclareTable` instead.
15481591
requestBody:
15491592
required: true
15501593
content:
@@ -1797,43 +1840,55 @@ components:
17971840
ErrorResponse:
17981841
type: object
17991842
description: Common JSON error response model
1843+
required:
1844+
- code
18001845
properties:
18011846
error:
18021847
type: string
1803-
description: a brief, human-readable message about the error
1804-
example: Incorrect username or password
1848+
description: A brief, human-readable message about the error.
1849+
example: Table 'users' not found in namespace 'production'
18051850
code:
18061851
type: integer
1807-
minimum: 400
1808-
maximum: 600
1809-
description: |
1810-
HTTP style response code, where 4XX represents client side errors
1811-
and 5XX represents server side errors.
1812-
1813-
For implementations that uses HTTP (e.g. REST namespace),
1814-
this field can be optional in favor of the HTTP response status code.
1815-
In case both values exist and do not match, the HTTP response status code should be used.
1816-
example: 404
1817-
type:
1818-
type: string
1852+
minimum: 0
18191853
description: |
1820-
An optional type identifier string for the error.
1821-
This allows the implementation to specify their internal error type,
1822-
which could be more detailed than the HTTP standard status code.
1823-
example: /errors/incorrect-user-pass
1854+
Lance Namespace error code identifying the error type.
1855+
1856+
Error codes:
1857+
0 - Unsupported: Operation not supported by this backend
1858+
1 - NamespaceNotFound: The specified namespace does not exist
1859+
2 - NamespaceAlreadyExists: A namespace with this name already exists
1860+
3 - NamespaceNotEmpty: Namespace contains tables or child namespaces
1861+
4 - TableNotFound: The specified table does not exist
1862+
5 - TableAlreadyExists: A table with this name already exists
1863+
6 - TableIndexNotFound: The specified table index does not exist
1864+
7 - TableIndexAlreadyExists: A table index with this name already exists
1865+
8 - TableTagNotFound: The specified table tag does not exist
1866+
9 - TableTagAlreadyExists: A table tag with this name already exists
1867+
10 - TransactionNotFound: The specified transaction does not exist
1868+
11 - TableVersionNotFound: The specified table version does not exist
1869+
12 - TableColumnNotFound: The specified table column does not exist
1870+
13 - InvalidInput: Malformed request or invalid parameters
1871+
14 - ConcurrentModification: Optimistic concurrency conflict
1872+
15 - PermissionDenied: User lacks permission for this operation
1873+
16 - Unauthenticated: Authentication credentials are missing or invalid
1874+
17 - ServiceUnavailable: Service is temporarily unavailable
1875+
18 - Internal: Unexpected server/implementation error
1876+
19 - InvalidTableState: Table is in an invalid state for the operation
1877+
20 - TableSchemaValidationError: Table schema validation failed
1878+
example: 4
18241879
detail:
18251880
type: string
18261881
description: |
1827-
an optional human-readable explanation of the error.
1828-
This can be used to record information such as stack trace.
1829-
example: Authentication failed due to incorrect username or password
1882+
An optional human-readable explanation of the error.
1883+
This can be used to record additional information such as stack trace.
1884+
example: The table may have been dropped or renamed
18301885
instance:
18311886
type: string
18321887
description: |
1833-
a string that identifies the specific occurrence of the error.
1834-
This can be a URI, a request or response ID,
1888+
A string that identifies the specific occurrence of the error.
1889+
This can be a URI, a request or response ID,
18351890
or anything that the implementation can recognize to trace specific occurrence of the error.
1836-
example: /login/log/abc123
1891+
example: /v1/table/production$users/describe
18371892

18381893
CreateNamespaceRequest:
18391894
type: object
@@ -2717,8 +2772,11 @@ components:
27172772

27182773
CreateEmptyTableRequest:
27192774
type: object
2775+
deprecated: true
27202776
description: |
27212777
Request for creating an empty table.
2778+
2779+
**Deprecated**: Use `DeclareTableRequest` instead.
27222780
properties:
27232781
id:
27242782
type: array
@@ -2729,25 +2787,54 @@ components:
27292787
description: |
27302788
Optional storage location for the table.
27312789
If not provided, the namespace implementation should determine the table location.
2732-
properties:
2733-
type: object
2734-
additionalProperties:
2735-
type: string
27362790
27372791
CreateEmptyTableResponse:
27382792
type: object
2793+
deprecated: true
27392794
description: |
27402795
Response for creating an empty table.
2796+
2797+
**Deprecated**: Use `DeclareTableResponse` instead.
27412798
properties:
27422799
transaction_id:
27432800
type: string
27442801
description: Optional transaction identifier
27452802
location:
27462803
type: string
2747-
properties:
2804+
storage_options:
27482805
type: object
2806+
description: |
2807+
Configuration options to be used to access storage. The available
2808+
options depend on the type of storage in use. These will be
2809+
passed directly to Lance to initialize storage access.
27492810
additionalProperties:
27502811
type: string
2812+
2813+
DeclareTableRequest:
2814+
type: object
2815+
description: |
2816+
Request for declaring a table.
2817+
properties:
2818+
id:
2819+
type: array
2820+
items:
2821+
type: string
2822+
location:
2823+
type: string
2824+
description: |
2825+
Optional storage location for the table.
2826+
If not provided, the namespace implementation should determine the table location.
2827+
2828+
DeclareTableResponse:
2829+
type: object
2830+
description: |
2831+
Response for declaring a table.
2832+
properties:
2833+
transaction_id:
2834+
type: string
2835+
description: Optional transaction identifier
2836+
location:
2837+
type: string
27512838
storage_options:
27522839
type: object
27532840
description: |
@@ -4084,6 +4171,13 @@ components:
40844171
schema:
40854172
$ref: '#/components/schemas/DropTableIndexResponse'
40864173

4174+
DeclareTableResponse:
4175+
description: Table properties result when declaring a table
4176+
content:
4177+
application/json:
4178+
schema:
4179+
$ref: '#/components/schemas/DeclareTableResponse'
4180+
40874181
CreateEmptyTableResponse:
40884182
description: Table properties result when creating an empty table
40894183
content:
@@ -4244,4 +4338,4 @@ components:
42444338
ApiKeyAuth:
42454339
type: apiKey
42464340
in: header
4247-
name: x-api-key
4341+
name: x-api-key

lance-namespace

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 6e6e8336fceec1cd36b3cfcd04ce4ec438c1819b

0 commit comments

Comments
 (0)