Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions open-api/rest-catalog-open-api.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,11 @@ class RegisterTableRequest(BaseModel):
)


class RegisterViewRequest(BaseModel):
name: str
metadata_location: str = Field(..., alias='metadata-location')


class TokenType(BaseModel):
__root__: Literal[
'urn:ietf:params:oauth:token-type:access_token',
Expand Down
65 changes: 65 additions & 0 deletions open-api/rest-catalog-open-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,60 @@ paths:
5XX:
$ref: '#/components/responses/ServerErrorResponse'

/v1/{prefix}/namespaces/{namespace}/register-view:
parameters:
- $ref: '#/components/parameters/prefix'
- $ref: '#/components/parameters/namespace'

post:
tags:
- Catalog API
summary: Register a view in the catalog
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the summary of registerTable Register a table in the given namespace using given metadata file location
I think we should be in line with this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally changed it as summary should be shorter than description. I don't think we should follow everything. We should do what is right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of them are pretty short, so I don't think it matters which one is somewhat longer. I'd value consistency across the table and view functionality but that might be just my personal preference.

parameters:
- $ref: '#/components/parameters/idempotency-key'
description:
Register a view in the given namespace using given metadata file location.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Register a view using given metadata file location." to be in line with registerTable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above


operationId: registerView
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RegisterViewRequest'
responses:
200:
$ref: '#/components/responses/LoadViewResponse'
400:
$ref: '#/components/responses/BadRequestErrorResponse'
401:
$ref: '#/components/responses/UnauthorizedResponse'
403:
$ref: '#/components/responses/ForbiddenResponse'
404:
description: Not Found - The namespace specified does not exist
content:
application/json:
schema:
$ref: '#/components/schemas/IcebergErrorResponse'
examples:
NamespaceNotFound:
$ref: '#/components/examples/NoSuchNamespaceError'
409:
description: Conflict - The view already exists
content:
application/json:
schema:
$ref: '#/components/schemas/IcebergErrorResponse'
examples:
ViewAlreadyExists:
$ref: '#/components/examples/ViewAlreadyExistsError'
419:
$ref: '#/components/responses/AuthenticationTimeoutResponse'
503:
$ref: '#/components/responses/ServiceUnavailableResponse'
5XX:
$ref: '#/components/responses/ServerErrorResponse'

components:
#######################################################
Expand Down Expand Up @@ -3687,6 +3741,17 @@ components:
additionalProperties:
type: string

RegisterViewRequest:
type: object
required:
- name
- metadata-location
properties:
name:
type: string
metadata-location:
type: string

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RegisterTableRequest also has an overwrite property. Do you plan to add that too to have a full functionality match with table registration.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did see this. But the java functionality in Catalog.java was not having the overwrite functionality. Only the REST was enforcing it. Plus my main usecase for register view is for migration and it doesn't require overwrite. So, I left it. Users can add it in the future if there a strong usecase.

TokenType:
type: string
enum:
Expand Down