Copilot commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3431829237


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# 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.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document 
describing
+        datasets, fields, relationships, metrics, and AI context for a logical 
analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already 
exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'

Review Comment:
   The implementation currently returns HTTP 501 (Not Implemented) for this 
operation when ENABLE_SEMANTIC_MODELS is enabled, but the OpenAPI spec doesn’t 
document a 501 response. Adding it here will keep the spec aligned with the 
current stub behavior behind the feature flag.



##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# 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.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document 
describing
+        datasets, fields, relationships, metrics, and AI context for a logical 
analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already 
exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'

Review Comment:
   The implementation currently returns HTTP 501 (Not Implemented) for this 
operation when ENABLE_SEMANTIC_MODELS is enabled, but the OpenAPI spec doesn’t 
document a 501 response. Adding it here will keep the spec aligned with the 
current stub behavior behind the feature flag.



##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# 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.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document 
describing
+        datasets, fields, relationships, metrics, and AI context for a logical 
analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already 
exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  
/polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'

Review Comment:
   The implementation currently returns HTTP 501 (Not Implemented) for this 
operation when ENABLE_SEMANTIC_MODELS is enabled, but the OpenAPI spec doesn’t 
document a 501 response. Adding it here will keep the spec aligned with the 
current stub behavior behind the feature flag.



##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# 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.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document 
describing
+        datasets, fields, relationships, metrics, and AI context for a logical 
analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already 
exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  
/polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'

Review Comment:
   The implementation currently returns HTTP 501 (Not Implemented) for this 
operation when ENABLE_SEMANTIC_MODELS is enabled, but the OpenAPI spec doesn’t 
document a 501 response. Adding it here will keep the spec aligned with the 
current stub behavior behind the feature flag.



##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1446,6 +1446,7 @@ public ConfigResponse getConfig() {
                 .addAll(VIEW_ENDPOINTS)
                 
.addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 
.addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                
.addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   `getConfig()` now conditionally advertises semantic-model endpoints, but the 
runtime service’s existing config test coverage only asserts generic-table 
endpoints. Please add a corresponding assertion for ENABLE_SEMANTIC_MODELS 
(enabled/disabled) so this new advertised behavior is covered.



##########
polaris-core/src/main/java/org/apache/polaris/core/config/FeatureConfiguration.java:
##########
@@ -372,6 +372,13 @@ public static void enforceFeatureEnabledOrThrow(
           .defaultValue(true)
           .buildFeatureConfiguration();
 
+  public static final FeatureConfiguration<Boolean> ENABLE_SEMANTIC_MODELS =
+      PolarisConfiguration.<Boolean>builder()
+          .key("ENABLE_SEMANTIC_MODELS")
+          .description("If true, the semantic-model (OSI) endpoints are 
enabled")
+          .defaultValue(false) // keep it to false until the implementation is 
done
+          .buildFeatureConfiguration();

Review Comment:
   A new feature flag is introduced (ENABLE_SEMANTIC_MODELS). The repository’s 
configuration reference docs currently list 
ENABLE_GENERIC_TABLES/ENABLE_POLICY_STORE but not this new flag (e.g., 
site/content/in-dev/unreleased/configuration/config-sections/flags-polaris_features.md).
 Please check whether the config reference generator/source needs to be updated 
and the docs regenerated so users can discover and configure this flag.



##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# 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.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document 
describing
+        datasets, fields, relationships, metrics, and AI context for a logical 
analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already 
exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  
/polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'

Review Comment:
   The implementation currently returns HTTP 501 (Not Implemented) for this 
operation when ENABLE_SEMANTIC_MODELS is enabled, but the OpenAPI spec doesn’t 
document a 501 response. Adding it here will keep the spec aligned with the 
current stub behavior behind the feature flag.



-- 
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]


Reply via email to