Skip to content

Commit

Permalink
Use enum for op in patch Operations
Browse files Browse the repository at this point in the history
  • Loading branch information
RangerMauve committed May 12, 2022
1 parent 0f7c3d1 commit dfa7373
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion traversal/patch/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,22 @@ var ts = func() *schema.TypeSystem {
// but if so, we'd still replicate it here,
// because as a rule, we don't require the specs repo submodule be present for the source to compile (just for all the tests to run).
[]byte(`
# Op represents the kind of operation to perfrom
# The current set is based on the JSON Patch specification
# We may end up adding more operations in the future
type Op enum {
| Op_Add ("add")
| Op_Remove ("remove")
| Op_Replace ("replace")
| Op_Move ("move")
| Op_Copy ("copy")
| Op_Test ("test")
}
# Operation and OperationSequence are the types that describe operations (but not what to apply them on).
# See the Instruction type for describing both operations and what to apply them on.
type Operation struct {
op String
op Op
path String
value optional Any
from optional String
Expand Down

0 comments on commit dfa7373

Please sign in to comment.