Skip to content

Commit b22fcd8

Browse files
committed
fix: simplify describe AP response
1 parent 140cc0e commit b22fcd8

File tree

4 files changed

+60
-46
lines changed

4 files changed

+60
-46
lines changed

.github/workflows/lint.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@ jobs:
1515
go-version: '1.17.6'
1616
- name: Install dependencies
1717
run: /bin/bash scripts/install_build_deps.sh
18-
- name: make lint
18+
- name: Check OpenAPI generated
19+
run: |
20+
make generate
21+
git diff --quiet HEAD || (echo -e "\nRun 'make clean && make generate' and check-in OpenAPI specification" && exit 1)
22+
- name: Make lint
1923
run: make lint

scripts/fix_openapi.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ yq_fix_object CreateOrUpdateCollectionRequest schema
7070
yq_fix_timestamp ResponseMetadata created_at
7171
yq_fix_timestamp ResponseMetadata updated_at
7272

73+
yq_fix_object DescribeCollectionResponse schema
74+
yq_fix_object CollectionDescription schema
7375

7476
for i in InsertRequest ReplaceRequest UpdateRequest DeleteRequest ReadRequest \
7577
CreateOrUpdateCollectionRequest DropCollectionRequest \

server/v1/api.proto

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -385,42 +385,45 @@ message DescribeCollectionRequest {
385385
CollectionOptions options = 3;
386386
}
387387

388+
// A detailed description about the database and all associated collections.
389+
// Description of the collection includes schema details as well.
388390
message DescribeDatabaseResponse {
389-
// A detailed description about the database and all associated collections. Description of the collection
390-
// includes schema details as well.
391-
DatabaseDescription description = 1;
392-
}
393-
394-
message DescribeCollectionResponse {
395-
// A detailed description about the collection. The description returns collection metadata and the schema.
396-
CollectionDescription description = 1;
397-
}
398-
399-
message DatabaseDescription {
400391
// Name of the database.
401392
string db = 1;
402393

403394
// Metadata about the database.
404395
DatabaseMetadata metadata = 2;
405396

406-
// A detailed description about all the collections. The description returns collection metadata and the schema.
407-
repeated CollectionDescription collections_description = 3;
397+
// A detailed description about all the collections.
398+
// The description returns collection metadata and the schema.
399+
repeated CollectionDescription collections = 3;
408400
}
409401

410-
message CollectionDescription {
402+
// A detailed description about the collection.
403+
// The description returns collection metadata and the schema.
404+
message DescribeCollectionResponse {
411405
// Name of the collection.
412406
string collection = 1;
413407

414408
// Metadata about the collection.
415409
CollectionMetadata metadata = 2;
416410

417-
// A detailed description about the collection. The description returns collection metadata and the schema.
418-
SchemaInfo schema_info = 3;
411+
// Collections schema
412+
bytes schema = 3;
413+
}
414+
415+
message DatabaseDescription {
419416
}
420417

421-
message SchemaInfo {
422-
// The schema of the collection.
423-
bytes schema = 1;
418+
message CollectionDescription {
419+
// Name of the collection.
420+
string collection = 1;
421+
422+
// Metadata about the collection.
423+
CollectionMetadata metadata = 2;
424+
425+
// Collections schema
426+
bytes schema = 3;
424427
}
425428

426429
message DatabaseMetadata {

server/v1/api_openapi.yaml

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,9 @@ components:
515515
description: Name of the collection.
516516
metadata:
517517
$ref: '#/components/schemas/CollectionMetadata'
518-
schema_info:
519-
$ref: '#/components/schemas/SchemaInfo'
518+
schema:
519+
type: object
520+
description: Collections schema
520521
CollectionInfo:
521522
type: object
522523
properties:
@@ -542,7 +543,10 @@ components:
542543
description: Commit transaction with the given ID
543544
CommitTransactionResponse:
544545
type: object
545-
properties: {}
546+
properties:
547+
status:
548+
type: string
549+
description: Status of commit transaction operation.
546550
CreateDatabaseRequest:
547551
type: object
548552
properties:
@@ -576,19 +580,6 @@ components:
576580
status:
577581
type: string
578582
description: An enum with value set as "created" or "updated"
579-
DatabaseDescription:
580-
type: object
581-
properties:
582-
db:
583-
type: string
584-
description: Name of the database.
585-
metadata:
586-
$ref: '#/components/schemas/DatabaseMetadata'
587-
collections_description:
588-
type: array
589-
items:
590-
$ref: '#/components/schemas/CollectionDescription'
591-
description: A detailed description about all the collections. The description returns collection metadata and the schema.
592583
DatabaseInfo:
593584
type: object
594585
properties:
@@ -635,11 +626,20 @@ components:
635626
collection:
636627
type: string
637628
description: Name of the collection.
629+
options:
630+
$ref: '#/components/schemas/CollectionOptions'
638631
DescribeCollectionResponse:
639632
type: object
640633
properties:
641-
description:
642-
$ref: '#/components/schemas/CollectionDescription'
634+
collection:
635+
type: string
636+
description: Name of the collection.
637+
metadata:
638+
$ref: '#/components/schemas/CollectionMetadata'
639+
schema:
640+
type: object
641+
description: Collections schema
642+
description: A detailed description about the collection. The description returns collection metadata and the schema.
643643
DescribeDatabaseRequest:
644644
type: object
645645
properties:
@@ -649,8 +649,17 @@ components:
649649
DescribeDatabaseResponse:
650650
type: object
651651
properties:
652-
description:
653-
$ref: '#/components/schemas/DatabaseDescription'
652+
db:
653+
type: string
654+
description: Name of the database.
655+
metadata:
656+
$ref: '#/components/schemas/DatabaseMetadata'
657+
collections:
658+
type: array
659+
items:
660+
$ref: '#/components/schemas/CollectionDescription'
661+
description: A detailed description about all the collections. The description returns collection metadata and the schema.
662+
description: A detailed description about the database and all associated collections. Description of the collection includes schema details as well.
654663
DropCollectionRequest:
655664
type: object
656665
properties:
@@ -811,15 +820,11 @@ components:
811820
$ref: '#/components/schemas/TransactionCtx'
812821
description: Rollback transaction with the given ID
813822
RollbackTransactionResponse:
814-
type: object
815-
properties: {}
816-
SchemaInfo:
817823
type: object
818824
properties:
819-
schema:
825+
status:
820826
type: string
821-
description: The schema of the collection.
822-
format: byte
827+
description: Status of rollback transaction operation.
823828
StreamChange:
824829
type: object
825830
properties:

0 commit comments

Comments
 (0)