Skip to content

Commit

Permalink
Rename SetByIndex to ArraySet (#995)
Browse files Browse the repository at this point in the history
Related to #985
  • Loading branch information
hackerwins authored Sep 3, 2024
1 parent d07ce02 commit 2f93922
Show file tree
Hide file tree
Showing 11 changed files with 756 additions and 759 deletions.
8 changes: 4 additions & 4 deletions api/converter/from_pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ func FromOperations(pbOps []*api.Operation) ([]operations.Operation, error) {
op, err = fromTreeEdit(decoded.TreeEdit)
case *api.Operation_TreeStyle_:
op, err = fromTreeStyle(decoded.TreeStyle)
case *api.Operation_SetByIndex_:
op, err = fromSetByIndex(decoded.SetByIndex)
case *api.Operation_ArraySet_:
op, err = fromArraySet(decoded.ArraySet)
default:
return nil, ErrUnsupportedOperation
}
Expand Down Expand Up @@ -541,7 +541,7 @@ func fromTreeStyle(pbTreeStyle *api.Operation_TreeStyle) (*operations.TreeStyle,
), nil
}

func fromSetByIndex(pbSetByIndex *api.Operation_SetByIndex) (*operations.SetByIndex, error) {
func fromArraySet(pbSetByIndex *api.Operation_ArraySet) (*operations.ArraySet, error) {
parentCreatedAt, err := fromTimeTicket(pbSetByIndex.ParentCreatedAt)
if err != nil {
return nil, err
Expand All @@ -558,7 +558,7 @@ func fromSetByIndex(pbSetByIndex *api.Operation_SetByIndex) (*operations.SetByIn
if err != nil {
return nil, err
}
return operations.NewSetByIndex(
return operations.NewArraySet(
parentCreatedAt,
createdAt,
elem,
Expand Down
10 changes: 5 additions & 5 deletions api/converter/to_pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ func ToOperations(ops []operations.Operation) ([]*api.Operation, error) {
pbOperation.Body, err = toTreeEdit(op)
case *operations.TreeStyle:
pbOperation.Body, err = toTreeStyle(op)
case *operations.SetByIndex:
pbOperation.Body, err = toSetByIndex(op)
case *operations.ArraySet:
pbOperation.Body, err = toArraySet(op)
default:
return nil, ErrUnsupportedOperation
}
Expand Down Expand Up @@ -377,14 +377,14 @@ func toTreeStyle(style *operations.TreeStyle) (*api.Operation_TreeStyle_, error)
}, nil
}

func toSetByIndex(setByIndex *operations.SetByIndex) (*api.Operation_SetByIndex_, error) {
func toArraySet(setByIndex *operations.ArraySet) (*api.Operation_ArraySet_, error) {
pbElem, err := toJSONElementSimple(setByIndex.Value())
if err != nil {
return nil, err
}

return &api.Operation_SetByIndex_{
SetByIndex: &api.Operation_SetByIndex{
return &api.Operation_ArraySet_{
ArraySet: &api.Operation_ArraySet{
ParentCreatedAt: ToTimeTicket(setByIndex.ParentCreatedAt()),
CreatedAt: ToTimeTicket(setByIndex.CreatedAt()),
Value: pbElem,
Expand Down
72 changes: 36 additions & 36 deletions api/docs/yorkie/v1/admin.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,12 @@ components:
description: ""
title: add
type: object
arraySet:
$ref: '#/components/schemas/yorkie.v1.Operation.ArraySet'
additionalProperties: false
description: ""
title: array_set
type: object
edit:
$ref: '#/components/schemas/yorkie.v1.Operation.Edit'
additionalProperties: false
Expand Down Expand Up @@ -1207,12 +1213,6 @@ components:
description: ""
title: set
type: object
setByIndex:
$ref: '#/components/schemas/yorkie.v1.Operation.SetByIndex'
additionalProperties: false
description: ""
title: set_by_index
type: object
style:
$ref: '#/components/schemas/yorkie.v1.Operation.Style'
additionalProperties: false
Expand Down Expand Up @@ -1263,6 +1263,36 @@ components:
type: object
title: Add
type: object
yorkie.v1.Operation.ArraySet:
additionalProperties: false
description: ""
properties:
createdAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: created_at
type: object
executedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: executed_at
type: object
parentCreatedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: parent_created_at
type: object
value:
$ref: '#/components/schemas/yorkie.v1.JSONElementSimple'
additionalProperties: false
description: ""
title: value
type: object
title: ArraySet
type: object
yorkie.v1.Operation.Edit:
additionalProperties: false
description: ""
Expand Down Expand Up @@ -1482,36 +1512,6 @@ components:
type: object
title: Set
type: object
yorkie.v1.Operation.SetByIndex:
additionalProperties: false
description: 'NOTE(junseo): `value.created_at` is set to same as `created_at`'
properties:
createdAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: created_at
type: object
executedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: executed_at
type: object
parentCreatedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: parent_created_at
type: object
value:
$ref: '#/components/schemas/yorkie.v1.JSONElementSimple'
additionalProperties: false
description: ""
title: value
type: object
title: SetByIndex
type: object
yorkie.v1.Operation.Style:
additionalProperties: false
description: ""
Expand Down
72 changes: 36 additions & 36 deletions api/docs/yorkie/v1/resources.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,12 @@ components:
description: ""
title: add
type: object
arraySet:
$ref: '#/components/schemas/yorkie.v1.Operation.ArraySet'
additionalProperties: false
description: ""
title: array_set
type: object
edit:
$ref: '#/components/schemas/yorkie.v1.Operation.Edit'
additionalProperties: false
Expand Down Expand Up @@ -716,12 +722,6 @@ components:
description: ""
title: set
type: object
setByIndex:
$ref: '#/components/schemas/yorkie.v1.Operation.SetByIndex'
additionalProperties: false
description: ""
title: set_by_index
type: object
style:
$ref: '#/components/schemas/yorkie.v1.Operation.Style'
additionalProperties: false
Expand Down Expand Up @@ -772,6 +772,36 @@ components:
type: object
title: Add
type: object
yorkie.v1.Operation.ArraySet:
additionalProperties: false
description: ""
properties:
createdAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: created_at
type: object
executedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: executed_at
type: object
parentCreatedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: parent_created_at
type: object
value:
$ref: '#/components/schemas/yorkie.v1.JSONElementSimple'
additionalProperties: false
description: ""
title: value
type: object
title: ArraySet
type: object
yorkie.v1.Operation.Edit:
additionalProperties: false
description: ""
Expand Down Expand Up @@ -991,36 +1021,6 @@ components:
type: object
title: Set
type: object
yorkie.v1.Operation.SetByIndex:
additionalProperties: false
description: 'NOTE(junseo): `value.created_at` is set to same as `created_at`'
properties:
createdAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: created_at
type: object
executedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: executed_at
type: object
parentCreatedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: parent_created_at
type: object
value:
$ref: '#/components/schemas/yorkie.v1.JSONElementSimple'
additionalProperties: false
description: ""
title: value
type: object
title: SetByIndex
type: object
yorkie.v1.Operation.Style:
additionalProperties: false
description: ""
Expand Down
72 changes: 36 additions & 36 deletions api/docs/yorkie/v1/yorkie.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,12 @@ components:
description: ""
title: add
type: object
arraySet:
$ref: '#/components/schemas/yorkie.v1.Operation.ArraySet'
additionalProperties: false
description: ""
title: array_set
type: object
edit:
$ref: '#/components/schemas/yorkie.v1.Operation.Edit'
additionalProperties: false
Expand Down Expand Up @@ -700,12 +706,6 @@ components:
description: ""
title: set
type: object
setByIndex:
$ref: '#/components/schemas/yorkie.v1.Operation.SetByIndex'
additionalProperties: false
description: ""
title: set_by_index
type: object
style:
$ref: '#/components/schemas/yorkie.v1.Operation.Style'
additionalProperties: false
Expand Down Expand Up @@ -756,6 +756,36 @@ components:
type: object
title: Add
type: object
yorkie.v1.Operation.ArraySet:
additionalProperties: false
description: ""
properties:
createdAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: created_at
type: object
executedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: executed_at
type: object
parentCreatedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: parent_created_at
type: object
value:
$ref: '#/components/schemas/yorkie.v1.JSONElementSimple'
additionalProperties: false
description: ""
title: value
type: object
title: ArraySet
type: object
yorkie.v1.Operation.Edit:
additionalProperties: false
description: ""
Expand Down Expand Up @@ -975,36 +1005,6 @@ components:
type: object
title: Set
type: object
yorkie.v1.Operation.SetByIndex:
additionalProperties: false
description: 'NOTE(junseo): `value.created_at` is set to same as `created_at`'
properties:
createdAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: created_at
type: object
executedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: executed_at
type: object
parentCreatedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: parent_created_at
type: object
value:
$ref: '#/components/schemas/yorkie.v1.JSONElementSimple'
additionalProperties: false
description: ""
title: value
type: object
title: SetByIndex
type: object
yorkie.v1.Operation.Style:
additionalProperties: false
description: ""
Expand Down
Loading

0 comments on commit 2f93922

Please sign in to comment.