Skip to content

Commit 2e13a2c

Browse files
committed
refactor
1 parent cae4515 commit 2e13a2c

7 files changed

+17
-12
lines changed

constants.go

+5
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ const (
44
msgErrorInvalidSyntaxUnrecognizedInput string = `unrecognized input`
55
msgErrorInvalidSyntaxTwoCurrentNode string = `comparison between two current nodes is prohibited`
66
msgErrorInvalidSyntaxFilterValueGroup string = `JSONPath that returns a value group is prohibited`
7+
8+
msgTypeNull string = `null`
9+
msgTypeObject string = `object`
10+
msgTypeArray string = `array`
11+
msgTypeObjectOrArray string = `object/array`
712
)

syntax_node_identifier_child_multi.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ func (i *syntaxChildMultiIdentifier) retrieve(
2424

2525
srcMap, ok := current.(map[string]interface{})
2626
if !ok {
27-
foundType := `null`
27+
foundType := msgTypeNull
2828
if current != nil {
2929
foundType = reflect.TypeOf(current).String()
3030
}
3131
return ErrorTypeUnmatched{
3232
errorBasicRuntime: &errorBasicRuntime{
3333
node: i.syntaxBasicNode,
3434
},
35-
expectedType: `object`,
35+
expectedType: msgTypeObject,
3636
foundType: foundType,
3737
}
3838
}

syntax_node_identifier_child_single.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ func (i *syntaxChildSingleIdentifier) retrieve(
1313

1414
srcMap, ok := current.(map[string]interface{})
1515
if !ok {
16-
foundType := `null`
16+
foundType := msgTypeNull
1717
if current != nil {
1818
foundType = reflect.TypeOf(current).String()
1919
}
2020
return ErrorTypeUnmatched{
2121
errorBasicRuntime: &errorBasicRuntime{
2222
node: i.syntaxBasicNode,
2323
},
24-
expectedType: `object`,
24+
expectedType: msgTypeObject,
2525
foundType: foundType,
2626
}
2727
}

syntax_node_identifier_child_wildcard.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ func (i *syntaxChildWildcardIdentifier) retrieve(
2121
deepestErrors = i.retrieveList(root, typedNodes, container, deepestErrors)
2222

2323
default:
24-
foundType := `null`
24+
foundType := msgTypeNull
2525
if current != nil {
2626
foundType = reflect.TypeOf(current).String()
2727
}
2828
return ErrorTypeUnmatched{
2929
errorBasicRuntime: &errorBasicRuntime{
3030
node: i.syntaxBasicNode,
3131
},
32-
expectedType: `object/array`,
32+
expectedType: msgTypeObjectOrArray,
3333
foundType: foundType,
3434
}
3535
}

syntax_node_identifier_recursive_child.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ func (i *syntaxRecursiveChildIdentifier) retrieve(
1717
switch current.(type) {
1818
case map[string]interface{}, []interface{}:
1919
default:
20-
foundType := `null`
20+
foundType := msgTypeNull
2121
if current != nil {
2222
foundType = reflect.TypeOf(current).String()
2323
}
2424
return ErrorTypeUnmatched{
2525
errorBasicRuntime: &errorBasicRuntime{
2626
node: i.syntaxBasicNode,
2727
},
28-
expectedType: `object/array`,
28+
expectedType: msgTypeObjectOrArray,
2929
foundType: foundType,
3030
}
3131
}

syntax_node_qualifier_filter.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ func (f *syntaxFilterQualifier) retrieve(
2121
deepestErrors = f.retrieveList(root, typedNodes, container, deepestErrors)
2222

2323
default:
24-
foundType := `null`
24+
foundType := msgTypeNull
2525
if current != nil {
2626
foundType = reflect.TypeOf(current).String()
2727
}
2828
return ErrorTypeUnmatched{
2929
errorBasicRuntime: &errorBasicRuntime{
3030
node: f.syntaxBasicNode,
3131
},
32-
expectedType: `object/array`,
32+
expectedType: msgTypeObjectOrArray,
3333
foundType: foundType,
3434
}
3535
}

syntax_node_qualifier_union.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ func (u *syntaxUnionQualifier) retrieve(
1313

1414
srcArray, ok := current.([]interface{})
1515
if !ok {
16-
foundType := `null`
16+
foundType := msgTypeNull
1717
if current != nil {
1818
foundType = reflect.TypeOf(current).String()
1919
}
2020
return ErrorTypeUnmatched{
2121
errorBasicRuntime: &errorBasicRuntime{
2222
node: u.syntaxBasicNode,
2323
},
24-
expectedType: `array`,
24+
expectedType: msgTypeArray,
2525
foundType: foundType,
2626
}
2727
}

0 commit comments

Comments
 (0)