rdblue commented on a change in pull request #3770: URL: https://github.com/apache/iceberg/pull/3770#discussion_r771757347
########## File path: rest_docs/rest-catalog-open-api.yaml ########## @@ -0,0 +1,696 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +--- +openapi: 3.0.3 +info: + title: Apache Iceberg REST Catalog API + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + version: 0.0.1 + description: + Defines the specification for the first version of the REST Catalog API. + Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2. +servers: + - url: "{scheme}://{host}/{basePath}" + description: Server URL when the port can be inferred from the scheme + variables: + scheme: + description: The scheme of the URI, either http or https. + default: https + host: + description: The host address for the specified server + default: localhost + basePath: + description: Optional prefix to be appended to all routes + default: "" + - url: "{scheme}://{host}:{port}/{basePath}" + description: Generic base server URL, with all parts configurable + variables: + scheme: + description: The scheme of the URI, either http or https. + default: https + host: + description: The host address for the specified server + default: localhost + port: + description: The port used when addressing the host + default: "443" + basePath: + description: Optional prefix to be appended to all routes + default: "" +# All routes are currently configured using an Authorization header. +security: + - BearerAuth: [] +paths: + /v1/config: + get: + tags: + - Configuration API + summary: List all catalog configuration settings + operationId: getConfig + description: + " + All REST clients should first call this route to get catalog configuration + properties from the server to configure the catalog and its HTTP client. + Configuration from the server consists of two sets of key/value pairs. + + - defaults - properties that should be used as default configuration; applied before client configuration + + - overrides - properties that should be used to override client configuration; applied after defaults and client configuration + + + Catalog configuration is constructed by setting the defaults, then client- + provided configuration, and finally overrides. The final property set is then + used to configure the catalog. + + + For example, a default configuration property might set the size of the + client pool, which can be replaced with a client-specific setting. An + override might be used to set the warehouse location, which is stored + on the server rather than in client configuration. + + + Common catalog configuration settings are documented at + https://iceberg.apache.org/configuration/#catalog-properties + " + responses: + 200: + description: Server specified configuration values. + content: + application/json: + schema: + $ref: '#/components/schemas/CatalogConfiguration' + example: { + "data": { + "overrides": { + "warehouse": "s3://bucket/warehouse/" + }, + "defaults": { + "clients": "4" + } + } + } + 401: + description: Unauthorized + /v1/namespaces: + get: + tags: + - Catalog API + summary: List namespaces, optionally providing a parent namespace to list underneath + description: + List all namespaces at a certain level, optionally starting from a given parent namespace. + For example, if table a.b.t exists, using 'SELECT NAMESPACE IN a' this would translate into + `GET /namespaces?parent=a` and must return a namespace, ["a", "b"]. + operationId: listNamespaces + parameters: + - $ref: '#/components/parameters/parent' + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + properties: + namespaces: + type: array + items: + $ref: '#/components/schemas/Namespace' + 401: + description: Unauthorized + 404: + description: Not Found - Parent namespace does not exist + post: + tags: + - Catalog API + summary: Create a namespace + description: + Create a namespace, with an optional set of properties. + The server might also add properties, such as last_modified_time etc. + operationId: createNamespace + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateNamespaceRequest' + required: true + responses: + 200: + description: OK + 401: + description: Unauthorized + 409: + description: Conflict - The namespace already exists. + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseErrorObject' + examples: + NamespaceAlreadyExists: + $ref: '#/components/examples/NamespaceAlreadyExistsError' + + /v1/namespaces/{namespace}: + parameters: + - $ref: '#/components/parameters/namespace' + get: + tags: + - Catalog API + summary: Load the metadata properties for a namespace + operationId: loadNamespaceMetadata + description: Return all stored metadata properties for a given namespace + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/responses/GetNamespaceResponse' + 404: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseErrorObject' + examples: + NoSuchNamespaceExample: + $ref: '#/components/examples/NoSuchNamespaceError' + head: + tags: + - Catalog API + summary: Check if a namespace exists + operationId: namespaceExists + description: Check if a namespace exists. + responses: + '200': + description: Namesapce exists + '401': + description: Unauthorized + '404': + description: Not Found + delete: + tags: + - Catalog API + summary: Drop a namespace from the catalog. Namespace must be empty. + operationId: dropNamespace + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/responses/IcebergResponseObject' + example: { "data": { "dropped": true } } + '401': + description: Unauthorized + '404': + description: Not Found + + + /v1/namespaces/{namespace}/properties: + parameters: + - $ref: '#/components/parameters/namespace' + post: + tags: + - Catalog API + summary: Set or remove properties on a namespace + operationId: updateProperties + description: + Set and/or remove a collection or properties on a namespae. + The request body specifies a list of properties to remove and a map + of key value pairs to update. + + Properties that are not in the request are not modified or removed by this call. + Server implementations are not required to support namespace properties. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdatePropertiesRequest' + example: + { "removables": [ "foo", "bar" ], "updates": { "owner": "Raoul" } } + required: true + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/responses/UpdatePropertiesResponse' + example: { + "updated": [ "owner" ], + "removed": [ "foo" ], + "missing": [ "bar" ] + } + 404: + description: Not Found + 406: + description: Not Acceptable - Unsupported Operation + 422: + description: Unprocessable Entity - A property key was included in both removables and updates + + /v1/namespaces/{namespace}/tables: + parameters: + - $ref: '#/components/parameters/namespace' + get: + tags: + - Catalog API + summary: List all table identifiers underneath a given namespace + description: Return all table identifiers under this namespace + operationId: listTables + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + properties: + identifiers: + type: array + items: + $ref: '#/components/schemas/TableIdentifier' + examples: + TableIdentifierListExample: + $ref: '#/components/examples/ListTablesExample' + 404: + description: Not Found - Either the namespace or the table does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseErrorObject' + examples: + NamespaceNotFound: + $ref: '#/components/examples/NoSuchNamespaceError' + TableNotFound: + $ref: '#/components/examples/NoSuchTableError' + + /v1/namespaces/{namespace}/tables/{table}: + parameters: + - $ref: '#/components/parameters/namespace' + - $ref: '#/components/parameters/table' + delete: + tags: + - Catalog API + summary: Drop a table from the catalog + operationId: dropTable + description: Remove a table from the catalog + parameters: + - name: purgeRequested + in: query + required: false + description: Whether the user requested to purge the underlying table's data and metadata + schema: + type: boolean + default: false + responses: + 200: + description: OK + content: + 'application/json': + schema: + $ref: '#/components/responses/DropTableResponse' + example: { "dropped": true, "purged": false } + 202: + description: Accepted - for use if purgeRequested is implemented as an asynchronous action. + 404: + $ref: '#/components/schemas/ResponseErrorObject' + head: + tags: + - Catalog API + summary: Check if a table exists + operationId: tableExists + description: + Check if a table exists within a given namespace. + responses: + 200: + description: OK - Table Exists + 401: + description: Unauthorized + 404: + description: Not Found + + /v1/tables/rename: + post: + tags: + - Catalog API + summary: Rename a table from its current name to a new name + description: + Rename a table from one identifier to another. It's valid to move a table + across namespaces, but the server implementation doesn't need to support it. + operationId: renameTable + requestBody: + description: Current table identifier to rename and new table identifier to rename to + content: + application/json: + schema: + $ref: '#/components/schemas/RenameTableRequest' + required: true + responses: + 200: + description: OK + 401: + description: Unauthorized + 404: + description: + Not Found + - NoSuchTableException, Table to rename does not exist + - NoSuchNamespaceException, The target namespace of the new table identifier does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseErrorObject' + examples: + TableToRenameDoesNotExist: + $ref: '#/components/examples/NoSuchTableError' + NamespaceToRenameToDoesNotExist: + $ref: '#/components/examples/NoSuchNamespaceError' + 406: + description: Not Acceptable - Unsupported Operation + 409: + description: Conflict - The target table identifier to rename to already exists + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseErrorObject' + example: + $ref: '#/components/examples/TableAlreadyExistsError' + +components: + ####################################################### + # Common Parameter Definitions Used In Several Routes # + ####################################################### + parameters: + namespace: + name: namespace + in: path + required: true + description: + A namespace identifier as a single string. + Multipart namespace parts should be separated by the null byte, %00. + schema: + type: string + examples: + singlepart_namespace: + value: "accounting" + multipart_namespace: + value: "accounting%00tax" + + table: + name: table + in: path + description: A table name + required: true + schema: + type: string + example: "sales" + + parent: + name: parent + in: query + description: + Optional parent namespace under which to list namespaces. + If parent is a multipart namespace, the parts must be separated by the null byte, %00. + When empty, list top-level namespaces. + required: false + schema: + type: string + example: "accounting%00tax" + + ############################## + # Application Schema Objects # + ############################## + schemas: + + ResponseDataObject: + type: object + description: JSON data payload returned in a successful response body + properties: + data: + type: object + description: Wrapper for the response of a successful request + example: { "data": { ... } } + + ResponseErrorObject: + type: object + description: JSON error payload returned in a response with further details on the error + required: + - message + - type + - code + properties: + message: + type: string + description: Human-readable error message + type: + type: string + description: Internal type definition of the error + example: NoSuchNamespaceException + code: + type: integer + minimum: 400 + maximum: 600 + description: HTTP response code + example: 404 + + CatalogConfiguration: + type: object + description: Server-provided configuration for the catalog. + required: + - properties Review comment: I don't see anything under `properties:` in the YAML that is named `properties`. Did you mean for `overrides` and `defaults` to both be required? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org