Skip to content

Commit

Permalink
Fix order
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko committed Oct 30, 2023
1 parent 5553dcd commit 9f6323a
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 91 deletions.
144 changes: 72 additions & 72 deletions open-api/rest-catalog-open-api.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,78 @@ class TableRequirement(BaseModel):
type: str


class AssertCreate(TableRequirement):
"""
The table must not already exist; used for create transactions
"""

type: Literal['assert-create']


class AssertTableUUID(TableRequirement):
"""
The table UUID must match the requirement's `uuid`
"""

type: Literal['assert-table-uuid']
uuid: str


class AssertRefSnapshotId(TableRequirement):
"""
The table branch or tag identified by the requirement's `ref` must reference the requirement's `snapshot-id`; if `snapshot-id` is `null` or missing, the ref must not already exist
"""

type: Literal['assert-ref-snapshot-id']
ref: str
snapshot_id: int = Field(..., alias='snapshot-id')


class AssertLastAssignedFieldId(TableRequirement):
"""
The table's last assigned column id must match the requirement's `last-assigned-field-id`
"""

type: Literal['assert-last-assigned-field-id']
last_assigned_field_id: int = Field(..., alias='last-assigned-field-id')


class AssertCurrentSchemaId(TableRequirement):
"""
The table's current schema id must match the requirement's `current-schema-id`
"""

type: Literal['assert-current-schema-id']
current_schema_id: int = Field(..., alias='current-schema-id')


class AssertLastAssignedPartitionId(TableRequirement):
"""
The table's last assigned partition id must match the requirement's `last-assigned-partition-id`
"""

type: Literal['assert-last-assigned-partition-id']
last_assigned_partition_id: int = Field(..., alias='last-assigned-partition-id')


class AssertDefaultSpecId(TableRequirement):
"""
The table's default spec id must match the requirement's `default-spec-id`
"""

type: Literal['assert-default-spec-id']
default_spec_id: int = Field(..., alias='default-spec-id')


class AssertDefaultSortOrderId(TableRequirement):
"""
The table's default sort order id must match the requirement's `default-sort-order-id`
"""

type: Literal['assert-default-sort-order-id']
default_sort_order_id: int = Field(..., alias='default-sort-order-id')


class RegisterTableRequest(BaseModel):
name: str
metadata_location: str = Field(..., alias='metadata-location')
Expand Down Expand Up @@ -486,78 +558,6 @@ class TransformTerm(BaseModel):
term: Reference


class AssertCreate(TableRequirement):
"""
The table must not already exist; used for create transactions
"""

type: Literal['assert-create']


class AssertTableUUID(TableRequirement):
"""
The table UUID must match the requirement's `uuid`
"""

type: Literal['assert-table-uuid']
uuid: str


class AssertRefSnapshotId(TableRequirement):
"""
The table branch or tag identified by the requirement's `ref` must reference the requirement's `snapshot-id`; if `snapshot-id` is `null` or missing, the ref must not already exist
"""

type: Literal['assert-ref-snapshot-id']
ref: str
snapshot_id: int = Field(..., alias='snapshot-id')


class AssertLastAssignedFieldId(TableRequirement):
"""
The table's last assigned column id must match the requirement's `last-assigned-field-id`
"""

type: Literal['assert-last-assigned-field-id']
last_assigned_field_id: int = Field(..., alias='last-assigned-field-id')


class AssertCurrentSchemaId(TableRequirement):
"""
The table's current schema id must match the requirement's `current-schema-id`
"""

type: Literal['assert-current-schema-id']
current_schema_id: int = Field(..., alias='current-schema-id')


class AssertLastAssignedPartitionId(TableRequirement):
"""
The table's last assigned partition id must match the requirement's `last-assigned-partition-id`
"""

type: Literal['assert-last-assigned-partition-id']
last_assigned_partition_id: int = Field(..., alias='last-assigned-partition-id')


class AssertDefaultSpecId(TableRequirement):
"""
The table's default spec id must match the requirement's `default-spec-id`
"""

type: Literal['assert-default-spec-id']
default_spec_id: int = Field(..., alias='default-spec-id')


class AssertDefaultSortOrderId(TableRequirement):
"""
The table's default sort order id must match the requirement's `default-sort-order-id`
"""

type: Literal['assert-default-sort-order-id']
default_sort_order_id: int = Field(..., alias='default-sort-order-id')


class ReportMetricsRequest1(CommitReport):
report_type: str = Field(..., alias='report-type')

Expand Down
38 changes: 19 additions & 19 deletions open-api/rest-catalog-open-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1824,6 +1824,25 @@ components:
- $ref: '#/components/schemas/SetPropertiesUpdate'
- $ref: '#/components/schemas/RemovePropertiesUpdate'

TableRequirement:
discriminator:
propertyName: type
mapping:
assert-create: '#/components/schemas/AssertCreate'
assert-table-uuid: '#/components/schemas/AssertTableUUID'
assert-ref-snapshot-id: '#/components/schemas/AssertRefSnapshotId'
assert-last-assigned-field-id: '#/components/schemas/AssertLastAssignedFieldId'
assert-current-schema-id: '#/components/schemas/AssertCurrentSchemaId'
assert-last-assigned-partition-id: '#/components/schemas/AssertLastAssignedPartitionId'
assert-default-spec-id: '#/components/schemas/AssertDefaultSpecId'
assert-default-sort-order-id: '#/components/schemas/AssertDefaultSortOrderId'
type: object
required:
- type
properties:
type:
type: "string"

AssertCreate:
allOf:
- $ref: "#/components/schemas/TableRequirement"
Expand Down Expand Up @@ -1945,25 +1964,6 @@ components:
default-sort-order-id:
type: integer

TableRequirement:
discriminator:
propertyName: type
mapping:
assert-create: '#/components/schemas/AssertCreate'
assert-table-uuid: '#/components/schemas/AssertTableUUID'
assert-ref-snapshot-id: '#/components/schemas/AssertRefSnapshotId'
assert-last-assigned-field-id: '#/components/schemas/AssertLastAssignedFieldId'
assert-current-schema-id: '#/components/schemas/AssertCurrentSchemaId'
assert-last-assigned-partition-id: '#/components/schemas/AssertLastAssignedPartitionId'
assert-default-spec-id: '#/components/schemas/AssertDefaultSpecId'
assert-default-sort-order-id: '#/components/schemas/AssertDefaultSortOrderId'
type: object
required:
- type
properties:
type:
type: "string"

LoadTableResult:
description: |
Result used when a table is successfully loaded.
Expand Down

0 comments on commit 9f6323a

Please sign in to comment.