Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#984] docs: add OAS of catalog REST APIs (#1031)

mchades4ec6ecc344f5
diff --git a/docs/open-api/catalogs.yaml b/docs/open-api/catalogs.yaml
new file mode 100644
index 0000000000..aa059ea3ff
--- /dev/null
+++ b/docs/open-api/catalogs.yaml
@@ -0,0 +1,451 @@
+#
+# Copyright 2023 Datastrato.
+# This software is licensed under the Apache License version 2.
+#
+
+---
+
+paths:
+
+ /metalakes/{metalake}/catalogs:
+ parameters:
+ - name: metalake
+ in: path
+ description: The name of the metalake to operate on
+ required: true
+ schema:
+ type: string
+ get:
+ tags:
+ - catalog
+ summary: List all catalogs in the specified metalake
+ operationId: listCatalogs
+ responses:
+ "200":
+ $ref: "#/components/responses/EntityListResponse"
+ "400":
+ $ref: "./openapi.yaml#/components/responses/BadRequestErrorResponse"
+ "5xx":
+ $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
+
+ post:
+ tags:
+ - catalog
+ summary: Create a new catalog in the specified metalake
+ operationId: createCatalog
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/CatalogCreateRequest"
+ examples:
+ CatalogCreate:
+ $ref: "#/components/examples/CatalogCreate"
+
+ responses:
+ "200":
+ $ref: "#/components/responses/CatalogResponse"
+ "409":
+ description: Conflict - The target catalog already exists in the specified metalake
+ content:
+ application/vnd.gravitino.v1+json:
+ schema:
+ $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+ examples:
+ CatalogAlreadyExistsException:
+ $ref: "#/components/examples/CatalogAlreadyExistsException"
+ "5xx":
+ $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
+
+ /metalakes/{metalake}/catalogs/{catalog}:
+ parameters:
+ - name: metalake
+ in: path
+ description: The name of the metalake to operate on
+ required: true
+ schema:
+ type: string
+ - name: catalog
+ in: path
+ description: The name of the catalog to operate on
+ required: true
+ schema:
+ type: string
+
+ get:
+ tags:
+ - catalog
+ summary: Get the specified catalog in the specified metalake
+ operationId: loadCatalog
+ description: Returns the specified catalog information in the specified metalake
+ responses:
+ "200":
+ $ref: "#/components/responses/CatalogResponse"
+ "404":
+ description: Not Found - The specified catalog does not exist in the specified metalake
+ content:
+ application/vnd.gravitino.v1+json:
+ schema:
+ $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+ examples:
+ NoSuchMetalakeException:
+ $ref: "./metalakes.yaml#/components/examples/NoSuchMetalakeException"
+ NoSuchCatalogException:
+ $ref: "#/components/examples/NoSuchCatalogException"
+ "5xx":
+ $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
+
+ put:
+ tags:
+ - catalog
+ summary: Update the specified catalog in the specified metalake
+ operationId: alterCatalog
+ description: Alters the specified catalog information in the specified metalake
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/CatalogUpdatesRequest"
+ responses:
+ "200":
+ $ref: "#/components/responses/CatalogResponse"
+ "404":
+ description: Not Found - The specified catalog does not exist in the specified metalake
+ content:
+ application/vnd.gravitino.v1+json:
+ schema:
+ $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+ examples:
+ NoSuchMetalakeException:
+ $ref: "./metalakes.yaml#/components/examples/NoSuchMetalakeException"
+ NoSuchCatalogException:
+ $ref: "#/components/examples/NoSuchCatalogException"
+ "409":
+ description: Conflict - The target catalog already exists in the specified metalake
+ content:
+ application/vnd.gravitino.v1+json:
+ schema:
+ $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+ examples:
+ CatalogAlreadyExistsException:
+ $ref: "#/components/examples/CatalogAlreadyExistsException"
+ "5xx":
+ $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
+
+ delete:
+ tags:
+ - catalog
+ summary: Drop the specified catalog in the specified metalake
+ operationId: dropCatalog
+ responses:
+ "200":
+ $ref: "./openapi.yaml#/components/responses/DropResponse"
+ "5xx":
+ $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
+
+
+
+components:
+
+ schemas:
+ NameIdentifier:
+ type: object
+ description: A identifier for an entity
+ required:
+ - namespace
+ - name
+ properties:
+ namespace:
+ type: array
+ description: The namespace of the entity may be with multiple levels
+ items:
+ type: string
+ name:
+ type: string
+ description: The name of the entity
+
+ Catalog:
+ type: object
+ description: A catalog
+ required:
+ - name
+ - type
+ - provider
+ - audit
+ properties:
+ name:
+ type: string
+ description: The name of the catalog
+ type:
+ type: string
+ description: The type of the catalog
+ enum:
+ - relational
+ - file
+ - stream
+ provider:
+ type: string
+ description: The provider of the catalog
+ enum:
+ - hive
+ - lakehouse-iceberg
+ - jdbc-mysql
+ - jdbc-postgresql
+ comment:
+ type: string
+ description: A comment about the catalog
+ nullable: true
+ audit:
+ $ref: "./openapi.yaml#/components/schemas/Audit"
+ properties:
+ type: object
+ description: Configured string to string map of properties for the catalog
+ default: { }
+ additionalProperties:
+ type: string
+
+ CatalogCreateRequest:
+ type: object
+ required:
+ - name
+ - type
+ - provider
+ properties:
+ name:
+ type: string
+ description: The name of the catalog
+ type:
+ type: string
+ description: The type of the catalog
+ enum:
+ - relational
+ - file
+ - stream
+ provider:
+ type: string
+ description: The provider of the catalog
+ enum:
+ - hive
+ - lakehouse-iceberg
+ - jdbc-mysql
+ - jdbc-postgresql
+ comment:
+ type: string
+ description: A comment for the catalog
+ nullable: true
+ properties:
+ type: object
+ description: A map of properties for the catalog
+ nullable: true
+ default: { }
+ additionalProperties:
+ type: string
+
+ CatalogUpdatesRequest:
+ type: object
+ required:
+ - updates
+ properties:
+ updates:
+ type: array
+ items:
+ $ref: "#/components/schemas/CatalogUpdateRequest"
+
+ CatalogUpdateRequest:
+ oneOf:
+ - $ref: "#/components/schemas/RenameCatalogRequest"
+ - $ref: "#/components/schemas/UpdateCatalogCommentRequest"
+ - $ref: "#/components/schemas/SetCatalogPropertyRequest"
+ - $ref: "#/components/schemas/RemoveCatalogPropertyRequest"
+ discriminator:
+ propertyName: "@type"
+ mapping:
+ rename: "#/components/schemas/RenameCatalogRequest"
+ updateComment: "#/components/schemas/UpdateCatalogCommentRequest"
+ setProperty: "#/components/schemas/SetCatalogPropertyRequest"
+ removeProperty: "#/components/schemas/RemoveCatalogPropertyRequest"
+
+ RenameCatalogRequest:
+ type: object
+ required:
+ - "@type"
+ - newName
+ properties:
+ "@type":
+ type: string
+ enum:
+ - rename
+ newName:
+ type: string
+ description: The new name of the catalog
+ example: {
+ "@type": "rename",
+ "newName": "my_catalog_new"
+ }
+
+ UpdateCatalogCommentRequest:
+ type: object
+ required:
+ - "@type"
+ - newComment
+ properties:
+ "@type":
+ type: string
+ enum:
+ - updateComment
+ newComment:
+ type: string
+ description: The new comment of the catalog
+ example: {
+ "@type": "updateComment",
+ "newComment": "This is my new catalog comment"
+ }
+
+ SetCatalogPropertyRequest:
+ type: object
+ required:
+ - "@type"
+ - property
+ - value
+ properties:
+ "@type":
+ type: string
+ enum:
+ - setProperty
+ property:
+ type: string
+ description: The property to set
+ value:
+ type: string
+ description: The value to set
+ example: {
+ "@type": "setProperty",
+ "property": "key1",
+ "value": "value1"
+ }
+
+ RemoveCatalogPropertyRequest:
+ type: object
+ required:
+ - "@type"
+ - property
+ properties:
+ "@type":
+ type: string
+ enum:
+ - removeProperty
+ property:
+ type: string
+ description: The property to remove
+ example: {
+ "@type": "removeProperty",
+ "property": "key2"
+ }
+
+
+ responses:
+ EntityListResponse:
+ description: A list of entities
+ content:
+ application/vnd.gravitino.v1+json:
+ schema:
+ type: object
+ properties:
+ code:
+ type: integer
+ format: int32
+ description: Status code of the response
+ enum:
+ - 0
+ example: 0
+ identifiers:
+ type: array
+ description: A list of NameIdentifier objects
+ items:
+ $ref: "#/components/schemas/NameIdentifier"
+ example: {
+ "code": 0,
+ "identifiers": [
+ {
+ "namespace": [
+ "my_metalake"
+ ],
+ "name": "my_hive_catalog"
+ }
+ ]
+ }
+
+ CatalogResponse:
+ description: Returns included catalog object
+ content:
+ application/vnd.gravitino.v1+json:
+ schema:
+ type: object
+ properties:
+ code:
+ type: integer
+ format: int32
+ description: Status code of the response
+ enum:
+ - 0
+ catalog:
+ $ref: "#/components/schemas/Catalog"
+ examples:
+ CatalogResponse:
+ $ref: "#/components/examples/CatalogResponse"
+
+
+ examples:
+ CatalogCreate:
+ value: {
+ "name": "my_hive_catalog",
+ "type": "relational",
+ "provider": "hive",
+ "comment": "This is my hive catalog",
+ "properties": {
+ "metastore.uris": "thrift://127.0.0.1:9083",
+ "key1": "value1"
+ }
+ }
+
+ CatalogResponse:
+ value: {
+ "code": 0,
+ "catalog": {
+ "name": "my_hive_catalog",
+ "type": "relational",
+ "provider": "hive",
+ "comment": "This is my hive catalog",
+ "properties": {
+ "key1": "value1",
+ "gravitino.bypass.hive.metastore.client.capability.check": "false",
+ "metastore.uris": "thrift://127.0.0.1:9083"
+ },
+ "audit": {
+ "creator": "gravitino",
+ "createTime": "2023-12-08T03:41:25.595Z"
+ }
+ }
+ }
+
+ CatalogAlreadyExistsException:
+ value: {
+ "code": 1004,
+ "type": "CatalogAlreadyExistsException",
+ "message": "Failed to operate catalog(s) [my_catalog] operation [CREATE], reason [CatalogAlreadyExistsException]",
+ "stack": [
+ "com.datastrato.gravitino.exceptions.CatalogAlreadyExistsException: Catalog my_catalog already exists",
+ "..."
+ ]
+ }
+
+ NoSuchCatalogException:
+ value: {
+ "code": 1003,
+ "type": "NoSuchCatalogException",
+ "message": "Failed to operate catalog(s) [test] operation [LOAD] under metalake [my_test_metalake], reason [NoSuchCatalogException]",
+ "stack": [
+ "com.datastrato.gravitino.exceptions.NoSuchCatalogException: Catalog my_test_metalake.test does not exist",
+ "..."
+ ]
+ }
\ No newline at end of file
diff --git a/docs/open-api/metalakes.yaml b/docs/open-api/metalakes.yaml
index 7a44ee49cc..f95c0489ce 100644
--- a/docs/open-api/metalakes.yaml
+++ b/docs/open-api/metalakes.yaml
@@ -19,9 +19,9 @@ paths:
"200":
$ref: "#/components/responses/ListMetalakesResponse"
"400":
- $ref: "#/components/responses/BadRequestErrorResponse"
+ $ref: "./openapi.yaml#/components/responses/BadRequestErrorResponse"
"5xx":
- $ref: "#/components/responses/ServerErrorResponse"
+ $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
post:
tags:
@@ -51,7 +51,7 @@ paths:
MetalakeAlreadyExistsException:
$ref: "#/components/examples/MetalakeAlreadyExistsException"
"5xx":
- $ref: "#/components/responses/ServerErrorResponse"
+ $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
/metalakes/{name}:
parameters:
@@ -80,7 +80,7 @@ paths:
NoSuchMetalakeException:
$ref: "#/components/examples/NoSuchMetalakeException"
"5xx":
- $ref: "#/components/responses/ServerErrorResponse"
+ $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
put:
tags:
@@ -131,24 +131,9 @@ paths:
description: Drops a specified metalake
responses:
"200":
- $ref: "#/components/responses/DropResponse"
- "404":
- description: Not Found - The metalake does not exist
- content:
- application/vnd.gravitino.v1+json:
- schema:
- $ref: "./openapi.yaml#/components/schemas/ErrorModel"
- examples:
- NoSuchMetalakeException:
- $ref: "#/components/examples/NoSuchMetalakeException"
+ $ref: "./openapi.yaml#/components/responses/DropResponse"
"5xx":
- description:
- Internal server error. It is possible that the server
- encountered a storage issue.
- content:
- application/vnd.gravitino.v1+json:
- schema:
- $ref: "./openapi.yaml#/components/schemas/ErrorModel"
+ $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
components:
@@ -170,7 +155,7 @@ components:
type: object
description: Configured string to string map of properties for the metalake
nullable: true
- default: { }
+ default: {}
additionalProperties:
type: string
@@ -263,7 +248,7 @@ components:
- "@type"
- property
properties:
- type:
+ "@type":
type: string
enum:
- removeProperty
@@ -300,6 +285,19 @@ components:
default: { }
additionalProperties:
type: string
+ example: {
+ "name": "my_metalake",
+ "comment": "This is my metalake",
+ "properties": {
+ "key1": "value1",
+ "key2": "value2",
+ "gravitino.identifier": "gravitino.v1.uid4516733622157792920"
+ },
+ "audit": {
+ "creator": "gravitino",
+ "createTime": "2023-12-07T14:04:17.349Z"
+ }
+ }
responses:
@@ -323,22 +321,6 @@ components:
items:
$ref: "#/components/schemas/Metalake"
- BadRequestErrorResponse:
- description:
- 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/vnd.gravitino.v1+json content, although in some cases simple text/plain content might
- be returned by the server's middleware.
- content:
- application/vnd.gravitino.v1+json:
- schema:
- $ref: './openapi.yaml#/components/schemas/ErrorModel'
- example: {
- "code": 1003,
- "type": "BadRequestException",
- "message": "Malformed request"
- }
-
MetalakeResponse:
description: Returns included metalake object.
content:
@@ -358,41 +340,6 @@ components:
MetalakeResponse:
$ref: "#/components/examples/MetalakeResponse"
- DropResponse:
- description: Represents a response for a drop operation
- content:
- application/vnd.gravitino.v1+json:
- schema:
- type: object
- properties:
- code:
- type: integer
- format: int32
- description: Status code of the response
- enum:
- - 0
- dropped:
- type: boolean
- description: Whether the drop operation was successful
-
- ServerErrorResponse:
- description:
- 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.
- content:
- application/vnd.gravitino.v1+json:
- schema:
- $ref: "./openapi.yaml#/components/schemas/ErrorModel"
- example: {
- "code": 1002,
- "type": "RuntimeException",
- "message": "Internal Server Error",
- "stack": [
- "java.lang.RuntimeException: Internal Server Error"
- ]
- }
-
examples:
MetalakeAlreadyExistsException:
diff --git a/docs/open-api/openapi.yaml b/docs/open-api/openapi.yaml
index eae6882e1e..4c6428afd8 100644
--- a/docs/open-api/openapi.yaml
+++ b/docs/open-api/openapi.yaml
@@ -43,6 +43,12 @@ paths:
# escape the path name by replacing `{ }` with `%7B %7D`
$ref: "./metalakes.yaml#/paths/~1metalakes~1%7Bname%7D"
+ /metalakes/{metalake}/catalogs:
+ $ref: "./catalogs.yaml#/paths/~1metalakes~1%7Bmetalake%7D~1catalogs"
+
+ /metalakes/{metalake}/catalogs/{catalog}:
+ $ref: "./catalogs.yaml#/paths/~1metalakes~1%7Bmetalake%7D~1catalogs~1%7Bcatalog%7D"
+
components:
schemas:
@@ -91,6 +97,59 @@ components:
items:
type: string
+ responses:
+
+ BadRequestErrorResponse:
+ description:
+ 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.
+ content:
+ application/vnd.gravitino.v1+json:
+ schema:
+ $ref: '#/components/schemas/ErrorModel'
+ example: {
+ "code": 1003,
+ "type": "BadRequestException",
+ "message": "Malformed request"
+ }
+
+ ServerErrorResponse:
+ description:
+ 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.
+ content:
+ application/vnd.gravitino.v1+json:
+ schema:
+ $ref: "#/components/schemas/ErrorModel"
+ example: {
+ "code": 1002,
+ "type": "RuntimeException",
+ "message": "Internal Server Error",
+ "stack": [
+ "java.lang.RuntimeException: Internal Server Error"
+ ]
+ }
+
+ DropResponse:
+ description: Represents a response for a drop operation
+ content:
+ application/vnd.gravitino.v1+json:
+ schema:
+ type: object
+ properties:
+ code:
+ type: integer
+ format: int32
+ description: Status code of the response
+ enum:
+ - 0
+ dropped:
+ type: boolean
+ description: Whether the drop operation was successful
+
securitySchemes:
# todo: add OAuth2 security schema
BearerAuth: