HonahX commented on code in PR #906: URL: https://github.com/apache/polaris/pull/906#discussion_r1937717224
########## spec/README.md: ########## @@ -0,0 +1,29 @@ +# Polaris API Specifications +Polaris provides two sets of OpenAPI specifications: +- `polaris-management-service.yml` - Defines the management APIs for using Polaris to create and manage Iceberg catalogs and their principals Review Comment: I’m thinking of renaming the folder to `polaris-catalog-apis` to better reflect its purpose. I'd like to keep `polaris-management-api.yaml` in the root of `spec`, ensuring that every YAML file at the root is a complete OpenAPI spec, while those in subfolders serve as components or parts of specific endpoint groups. WDYT? ########## spec/README.md: ########## @@ -0,0 +1,29 @@ +# Polaris API Specifications +Polaris provides two sets of OpenAPI specifications: +- `polaris-management-service.yml` - Defines the management APIs for using Polaris to create and manage Iceberg catalogs and their principals +- `polaris-catalog-service.yaml` - Defines the specification for the Polaris Catalog API, which encompasses both the Iceberg REST Catalog API + and Polaris-native API. + - `polaris-apis` - Contains the specifications of Polaris-native API + - `rest-catalog-open-api.yaml` - Contains the specification for Iceberg Rest Catalog API Review Comment: Good point! I plan to do the rename in a follow-up PR because 1. The current `rest-catalog-open-api.yaml` is referenced in our hugo site setting 2. We need to extract additional stuff from `rest-catalog-open-api.yaml` to make it match a released version of API. I think we can do the above 2 together in one separate PR so the current one won't contain too many changes ########## spec/polaris-catalog-service.yaml: ########## @@ -0,0 +1,133 @@ +# +# 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 Polaris and 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 Polaris Catalog API, which encompasses both the Iceberg REST Catalog API + and Polaris-native API. + +# The server configuration is sourced from rest-catalog-open-api.yaml +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: "" + +# The security configuration is sourced from rest-catalog-open-api.yaml +# All routes are currently configured using an Authorization header. +security: + - OAuth2: [catalog] + - BearerAuth: [] + +paths: + + ############################ + # Iceberg REST Catalog API # + ############################ + + /v1/config: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1config' + + /v1/oauth/tokens: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1oauth~1tokens' + + /v1/{prefix}/namespaces: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces' + + /v1/{prefix}/namespaces/{namespace}: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}' + + /v1/{prefix}/namespaces/{namespace}/properties: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1properties' + + /v1/{prefix}/namespaces/{namespace}/tables: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1tables' + + /v1/{prefix}/namespaces/{namespace}/register: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1register' + + /v1/{prefix}/namespaces/{namespace}/tables/{table}: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1tables~1{table}' + + /v1/{prefix}/namespaces/{namespace}/tables/{table}/credentials: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1tables~1{table}~1credentials' + + /v1/{prefix}/tables/rename: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1tables~1rename' + + /v1/{prefix}/namespaces/{namespace}/tables/{table}/metrics: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1tables~1{table}~1metrics' + + /v1/{prefix}/transactions/commit: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1transactions~1commit' + + /v1/{prefix}/namespaces/{namespace}/views: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1views' + + /v1/{prefix}/namespaces/{namespace}/views/{view}: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1views~1{view}' + + /v1/{prefix}/views/rename: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1views~1rename' + + ###################### + # Polaris-native API # + ###################### + + /v1/{prefix}/namespaces/{namespace}/tables/{table}/notifications: Review Comment: The Management APIs and Catalog APIs have different scopes and are typically referenced separately for service/client generation, as seen here: https://github.com/HonahX/polaris/blob/4c7ae00b542806928dc05d1e4f56d51014dedac5/api/iceberg-service/build.gradle.kts#L51 https://github.com/HonahX/polaris/blob/4c7ae00b542806928dc05d1e4f56d51014dedac5/api/management-service/build.gradle.kts#L48 They also have different URL prefixes, security configurations, etc. Given these differences, I think it makes sense to keep them in separate YAML files for better flexibility. The goal of this PR is to clearly separate Polaris-specific catalog APIs from Iceberg catalog APIs. ########## spec/polaris-catalog-service.yaml: ########## @@ -0,0 +1,133 @@ +# +# 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 Polaris and 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 Polaris Catalog API, which encompasses both the Iceberg REST Catalog API + and Polaris-native API. + +# The server configuration is sourced from rest-catalog-open-api.yaml +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: "" + +# The security configuration is sourced from rest-catalog-open-api.yaml +# All routes are currently configured using an Authorization header. +security: + - OAuth2: [catalog] + - BearerAuth: [] + +paths: + + ############################ + # Iceberg REST Catalog API # + ############################ + + /v1/config: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1config' + + /v1/oauth/tokens: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1oauth~1tokens' + + /v1/{prefix}/namespaces: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces' + + /v1/{prefix}/namespaces/{namespace}: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}' + + /v1/{prefix}/namespaces/{namespace}/properties: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1properties' + + /v1/{prefix}/namespaces/{namespace}/tables: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1tables' + + /v1/{prefix}/namespaces/{namespace}/register: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1register' + + /v1/{prefix}/namespaces/{namespace}/tables/{table}: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1tables~1{table}' + + /v1/{prefix}/namespaces/{namespace}/tables/{table}/credentials: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1tables~1{table}~1credentials' + + /v1/{prefix}/tables/rename: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1tables~1rename' + + /v1/{prefix}/namespaces/{namespace}/tables/{table}/metrics: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1tables~1{table}~1metrics' + + /v1/{prefix}/transactions/commit: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1transactions~1commit' + + /v1/{prefix}/namespaces/{namespace}/views: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1views' + + /v1/{prefix}/namespaces/{namespace}/views/{view}: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1views~1{view}' + + /v1/{prefix}/views/rename: + $ref: './rest-catalog-open-api.yaml#/paths/~1v1~1{prefix}~1views~1rename' + + ###################### + # Polaris-native API # + ###################### + + /v1/{prefix}/namespaces/{namespace}/tables/{table}/notifications: + $ref: './polaris-apis/notifications-api.yaml#/paths/~1v1~1{prefix}~1namespaces~1{namespace}~1tables~1{table}~1notifications' + + +components: + securitySchemes: Review Comment: That’s a great point! Just to confirm my understanding: The OAuth2 scheme needs to be updated because it references the removed token endpoint. I’ll make this explicit and add a note to ensure that if we remove the token endpoint from Polaris or change it to a test-only endpoint: https://github.com/apache/polaris/issues/12, we remember to update the scheme as well. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
