Skip to content

Commit

Permalink
Merge pull request #154 from tigrisdata/main
Browse files Browse the repository at this point in the history
Beta release
  • Loading branch information
efirs authored Oct 28, 2022
2 parents b6291ba + 452d3c5 commit 7c20549
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 2 deletions.
7 changes: 7 additions & 0 deletions scripts/fix_openapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ main() {
# Do not expose "events" endpint in openapi
# TODO: Remove it once events endpoint is fixed
yq_cmd 'del(.paths."/v1/databases/{db}/collections/{collection}/events")'
yq_fix_access_token_request
}

fix_bytes() {
Expand Down Expand Up @@ -171,4 +172,10 @@ yq_update_description() {
yq -i '.info.description|=load("server/v1/desc.yaml")' "$IN_FILE"
}

## openapi extension for proto doesn't support x-www-form-urlencoded
# content-type - this is to manually stich the openapi yaml file for
# get-access-token request
yq_fix_access_token_request() {
yq_cmd ".paths./v1/auth/token.post.requestBody.content.x-www-form-urlencoded = .paths./v1/auth/token.post.requestBody.content.application/json | del(.paths./v1/auth/token.post.requestBody.content.application/json)"
}
main
14 changes: 13 additions & 1 deletion server/v1/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ message ReadRequest {
// Options that can be used to modify the results, for example `limit` to control the number of documents
// returned by the server.
ReadRequestOptions options = 5;
// Array of fields and corresponding sort orders to order the results. Ex: 1 `[{ "salary": "$desc" }]`, Ex: 2 `[{ "salary": "$asc"}]`
bytes sort = 6;
}

message ReadResponse {
Expand Down Expand Up @@ -573,6 +575,11 @@ message ListCollectionsResponse {
message DescribeDatabaseRequest {
// Name of the database.
string db = 1;

// Return schema in the requested format.
// Format can be JSON, Go, TypeScript, Java.
// Default is JSON.
string schema_format = 2;
}

message DescribeCollectionRequest {
Expand All @@ -582,8 +589,13 @@ message DescribeCollectionRequest {
// Name of the collection.
string collection = 2;

// Return schema in the requested format.
// Format can be JSON, Go, TypeScript, Java.
// Default is JSON.
string schema_format = 3;

// Collection options.
CollectionOptions options = 3;
CollectionOptions options = 4;
}

// A detailed description of the database and all the associated collections.
Expand Down
22 changes: 22 additions & 0 deletions server/v1/management.proto
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,23 @@ message NamespaceInfo {
string name = 3;
}

message DescribeNamespacesData {
string details = 1;
}

message ListNamespacesRequest {
}

message ListNamespacesResponse {
repeated NamespaceInfo namespaces = 1;
}

message DescribeNamespacesRequest {
}

message DescribeNamespacesResponse {
DescribeNamespacesData data = 1;
}

// Request creation of user application
message CreateApplicationRequest {
Expand Down Expand Up @@ -195,6 +205,18 @@ service Management {
};
}

// Get details for all namespaces
rpc DescribeNamespaces(DescribeNamespacesRequest) returns
(DescribeNamespacesResponse) {
option (google.api.http) = {
post : "/v1/management/namespaces/describe"
};
option(openapi.v3.operation) = {
summary: "Describe the details of all namespaces"
tags: "Namespaces"
};
}

// List all namespace
rpc ListNamespaces(ListNamespacesRequest) returns
(ListNamespacesResponse) {
Expand Down
42 changes: 41 additions & 1 deletion server/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ paths:
operationId: Auth_GetAccessToken
requestBody:
content:
application/json:
x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/GetAccessTokenRequest'
required: true
Expand Down Expand Up @@ -928,6 +928,26 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
/v1/management/namespaces/describe:
post:
tags:
- Namespaces
summary: Describe the details of all namespaces
description: Get details for all namespaces
operationId: Management_DescribeNamespaces
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/DescribeNamespacesResponse'
default:
description: Default error response
content:
application/json:
schema:
$ref: '#/components/schemas/Status'
/v1/management/namespaces/list:
post:
tags:
Expand Down Expand Up @@ -1388,6 +1408,9 @@ components:
collection:
type: string
description: Name of the collection.
schema_format:
type: string
description: Return schema in the requested format. Format can be JSON, Go, TypeScript, Java. Default is JSON.
options:
$ref: '#/components/schemas/CollectionOptions'
DescribeCollectionResponse:
Expand All @@ -1412,6 +1435,9 @@ components:
db:
type: string
description: Name of the database.
schema_format:
type: string
description: Return schema in the requested format. Format can be JSON, Go, TypeScript, Java. Default is JSON.
DescribeDatabaseResponse:
type: object
properties:
Expand All @@ -1430,6 +1456,16 @@ components:
description: Sum of all the collections sizes present in this database
format: int64
description: A detailed description of the database and all the associated collections. Description of the collection includes schema details as well.
DescribeNamespacesData:
type: object
properties:
details:
type: string
DescribeNamespacesResponse:
type: object
properties:
data:
$ref: '#/components/schemas/DescribeNamespacesData'
DropCollectionRequest:
type: object
properties:
Expand Down Expand Up @@ -1903,6 +1939,10 @@ components:
description: To read specific fields from a document. Default is all.
options:
$ref: '#/components/schemas/ReadRequestOptions'
sort:
type: string
description: 'Array of fields and corresponding sort orders to order the results. Ex: 1 `[{ "salary": "$desc" }]`, Ex: 2 `[{ "salary": "$asc"}]`'
format: byte
ReadRequestOptions:
type: object
properties:
Expand Down

0 comments on commit 7c20549

Please sign in to comment.