Copilot commented on code in PR #12627: URL: https://github.com/apache/gravitino/pull/12627#discussion_r4231616192
########## docs/open-api/semantic-models.yaml: ########## @@ -0,0 +1,1588 @@ +# 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: + + /metalakes/{metalake}/catalogs/{catalog}/schemas/{schema}/semantic-models: + parameters: + - $ref: "./openapi.yaml#/components/parameters/metalake" + - $ref: "./openapi.yaml#/components/parameters/catalog" + - $ref: "./openapi.yaml#/components/parameters/schema" + + get: + tags: + - semantic-model + summary: List Semantic Models + description: >- + Lists the Semantic Models in a schema. Semantic Models are supported only for relational + catalogs. Each returned identifier uses the full metalake.catalog.schema.name namespace. + operationId: listSemanticModels + responses: + "200": + $ref: "#/components/responses/SemanticModelListResponse" + "400": + $ref: "#/components/responses/SemanticModelBadRequestResponse" + "403": + $ref: "#/components/responses/SemanticModelForbiddenResponse" + "404": + $ref: "#/components/responses/SemanticModelParentNotFoundResponse" + "405": + $ref: "#/components/responses/SemanticModelUnsupportedCatalogResponse" + "5xx": + $ref: "./openapi.yaml#/components/responses/ServerErrorResponse" Review Comment: The response code key `"5xx"` is not a valid OpenAPI response status code pattern. OpenAPI allows specific codes (e.g., `"500"`) and uppercase wildcard classes like `"5XX"` (or `default`). Please replace all occurrences of `"5xx"` in this file with `"5XX"` or `default` to keep the spec valid across tooling. ########## docs/open-api/semantic-models.yaml: ########## @@ -0,0 +1,1588 @@ +# 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: + + /metalakes/{metalake}/catalogs/{catalog}/schemas/{schema}/semantic-models: + parameters: + - $ref: "./openapi.yaml#/components/parameters/metalake" + - $ref: "./openapi.yaml#/components/parameters/catalog" + - $ref: "./openapi.yaml#/components/parameters/schema" + + get: + tags: + - semantic-model + summary: List Semantic Models + description: >- + Lists the Semantic Models in a schema. Semantic Models are supported only for relational + catalogs. Each returned identifier uses the full metalake.catalog.schema.name namespace. + operationId: listSemanticModels + responses: + "200": + $ref: "#/components/responses/SemanticModelListResponse" + "400": + $ref: "#/components/responses/SemanticModelBadRequestResponse" + "403": + $ref: "#/components/responses/SemanticModelForbiddenResponse" + "404": + $ref: "#/components/responses/SemanticModelParentNotFoundResponse" + "405": + $ref: "#/components/responses/SemanticModelUnsupportedCatalogResponse" + "5xx": + $ref: "./openapi.yaml#/components/responses/ServerErrorResponse" + + post: + tags: + - semantic-model + summary: Create a Semantic Model + description: >- + Creates a schema-scoped Semantic Model in a relational catalog. The complete definition is + validated before the model is stored, including source identifier shape. Source existence, + source columns, and source authorization checks are not yet implemented. + operationId: createSemanticModel + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/SemanticModelCreateRequest" + examples: + SemanticModelCreateRequest: + $ref: "#/components/examples/SemanticModelCreateRequest" + responses: + "200": + $ref: "#/components/responses/SemanticModelResponse" + "400": + $ref: "#/components/responses/SemanticModelBadRequestResponse" + "403": + $ref: "#/components/responses/SemanticModelForbiddenResponse" + "404": + $ref: "#/components/responses/SemanticModelParentNotFoundResponse" + "405": + $ref: "#/components/responses/SemanticModelUnsupportedCatalogResponse" + "409": + $ref: "#/components/responses/SemanticModelAlreadyExistsResponse" + "502": + $ref: "#/components/responses/SemanticModelConnectionFailedResponse" + "5xx": + $ref: "./openapi.yaml#/components/responses/ServerErrorResponse" + + /metalakes/{metalake}/catalogs/{catalog}/schemas/{schema}/semantic-models/ossie: + parameters: + - $ref: "./openapi.yaml#/components/parameters/metalake" + - $ref: "./openapi.yaml#/components/parameters/catalog" + - $ref: "./openapi.yaml#/components/parameters/schema" + + post: + tags: + - semantic-model + summary: Import an Apache Ossie Semantic Model + description: >- + Imports one standalone Apache Ossie document and creates the represented Semantic Model. + The request body is the raw JSON or YAML document, not a JSON-encoded string. Content-Type + selects the parser, and parsing does not fall back to another format. + operationId: importOssieDocument + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/OssieSemanticModelDocument" + examples: + OssieSemanticModelDocument: + $ref: "#/components/examples/OssieSemanticModelDocument" + application/yaml: + schema: + $ref: "#/components/schemas/OssieSemanticModelDocument" + examples: + OssieSemanticModelDocument: + $ref: "#/components/examples/OssieSemanticModelDocument" + application/x-yaml: + schema: + $ref: "#/components/schemas/OssieSemanticModelDocument" + examples: + OssieSemanticModelDocument: + $ref: "#/components/examples/OssieSemanticModelDocument" + text/yaml: + schema: + $ref: "#/components/schemas/OssieSemanticModelDocument" + examples: + OssieSemanticModelDocument: + $ref: "#/components/examples/OssieSemanticModelDocument" + responses: + "200": + $ref: "#/components/responses/SemanticModelResponse" + "400": + $ref: "#/components/responses/SemanticModelBadRequestResponse" + "403": + $ref: "#/components/responses/SemanticModelForbiddenResponse" + "404": + $ref: "#/components/responses/SemanticModelParentNotFoundResponse" + "405": + $ref: "#/components/responses/SemanticModelUnsupportedCatalogResponse" + "409": + $ref: "#/components/responses/SemanticModelAlreadyExistsResponse" + "415": + description: >- + Unsupported Media Type - Content-Type must be application/json, application/yaml, + application/x-yaml, or text/yaml + "502": + $ref: "#/components/responses/SemanticModelConnectionFailedResponse" + "5xx": + $ref: "./openapi.yaml#/components/responses/ServerErrorResponse" + + /metalakes/{metalake}/catalogs/{catalog}/schemas/{schema}/semantic-models/{semanticModel}: + parameters: + - $ref: "./openapi.yaml#/components/parameters/metalake" + - $ref: "./openapi.yaml#/components/parameters/catalog" + - $ref: "./openapi.yaml#/components/parameters/schema" + - $ref: "./openapi.yaml#/components/parameters/semanticModel" + + get: + tags: + - semantic-model + summary: Load a Semantic Model + description: Returns the specified Semantic Model with its nested definition and audit data. + operationId: loadSemanticModel + responses: + "200": + $ref: "#/components/responses/SemanticModelResponse" + "400": + $ref: "#/components/responses/SemanticModelBadRequestResponse" + "403": + $ref: "#/components/responses/SemanticModelForbiddenResponse" + "404": + $ref: "#/components/responses/SemanticModelNotFoundResponse" + "405": + $ref: "#/components/responses/SemanticModelUnsupportedCatalogResponse" + "5xx": + $ref: "./openapi.yaml#/components/responses/ServerErrorResponse" + + put: + tags: + - semantic-model + summary: Alter a Semantic Model + description: >- + Applies the ordered updates atomically. The server validates and converts the complete + update batch before dispatch; if any update or the resulting model is invalid, none of the + updates is applied. Only replaceDefinition revalidates the complete definition. Source + existence, source columns, and source authorization checks are not yet implemented. + operationId: alterSemanticModel + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/SemanticModelUpdatesRequest" + examples: + SemanticModelUpdatesRequest: + $ref: "#/components/examples/SemanticModelUpdatesRequest" + responses: + "200": + $ref: "#/components/responses/SemanticModelResponse" + "400": + $ref: "#/components/responses/SemanticModelBadRequestResponse" + "403": + $ref: "#/components/responses/SemanticModelForbiddenResponse" + "404": + $ref: "#/components/responses/SemanticModelNotFoundResponse" + "405": + $ref: "#/components/responses/SemanticModelUnsupportedCatalogResponse" + "409": + $ref: "#/components/responses/SemanticModelAlterConflictResponse" + "502": + $ref: "#/components/responses/SemanticModelConnectionFailedResponse" + "5xx": + $ref: "./openapi.yaml#/components/responses/ServerErrorResponse" + + delete: + tags: + - semantic-model + summary: Drop a Semantic Model + description: >- + Drops the specified Semantic Model. A missing schema or Semantic Model is reported as a + successful response with dropped set to false. + operationId: dropSemanticModel + responses: + "200": + $ref: "./openapi.yaml#/components/responses/DropResponse" + "400": + $ref: "#/components/responses/SemanticModelBadRequestResponse" + "403": + $ref: "#/components/responses/SemanticModelForbiddenResponse" + "404": + description: Not Found - The target metalake or catalog does not exist + content: + application/vnd.gravitino.v1+json: + schema: + $ref: "./openapi.yaml#/components/schemas/ErrorModel" + examples: + NoSuchMetalakeException: + $ref: "./metalakes.yaml#/components/examples/NoSuchMetalakeException" + NoSuchCatalogException: + $ref: "./catalogs.yaml#/components/examples/NoSuchCatalogException" + "405": + $ref: "#/components/responses/SemanticModelUnsupportedCatalogResponse" + "409": + $ref: "#/components/responses/SemanticModelOptimisticLockResponse" + "5xx": + $ref: "./openapi.yaml#/components/responses/ServerErrorResponse" + + /metalakes/{metalake}/catalogs/{catalog}/schemas/{schema}/semantic-models/{semanticModel}/ossie: + parameters: + - $ref: "./openapi.yaml#/components/parameters/metalake" + - $ref: "./openapi.yaml#/components/parameters/catalog" + - $ref: "./openapi.yaml#/components/parameters/schema" + - $ref: "./openapi.yaml#/components/parameters/semanticModel" + + get: + tags: + - semantic-model + summary: Export a Semantic Model as an Apache Ossie document + description: >- + Exports the specified Semantic Model as a standalone Apache Ossie YAML or JSON document. + The response is downloadable document content rather than the native Gravitino response + envelope. The format query parameter selects the representation independently of the + Accept header, and its value is case-insensitive. + operationId: exportOssieDocument + parameters: + - name: format + in: query + description: The serialized document format + required: false + schema: + type: string + enum: + - yaml + - json + default: yaml Review Comment: The description states the `format` query parameter is case-insensitive, but the OpenAPI schema restricts values to the lowercase enum (`yaml`, `json`), which is case-sensitive in OpenAPI/JSON Schema. Either adjust the description to match the stricter contract, or broaden the schema (e.g., via a regex pattern or expanded enum) so the spec reflects the documented server behavior. -- 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]
