MCPcopy Index your code
hub / github.com/gavv/httpexpect / jsonPath

Function jsonPath

json.go:13–46  ·  view source on GitHub ↗
(opChain *chain, value interface{}, path string)

Source from the content-addressed store, hash-verified

11)
12
13func jsonPath(opChain *chain, value interface{}, path string) *Value {
14 if opChain.failed() {
15 return newValue(opChain, nil)
16 }
17
18 filterFn, err := jsonpath.Prepare(path)
19 if err != nil {
20 opChain.fail(AssertionFailure{
21 Type: AssertValid,
22 Actual: &AssertionValue{path},
23 Errors: []error{
24 errors.New("expected: valid json path"),
25 err,
26 },
27 })
28 return newValue(opChain, nil)
29 }
30
31 result, err := filterFn(value)
32 if err != nil {
33 opChain.fail(AssertionFailure{
34 Type: AssertMatchPath,
35 Actual: &AssertionValue{value},
36 Expected: &AssertionValue{path},
37 Errors: []error{
38 errors.New("expected: value matches given json path"),
39 err,
40 },
41 })
42 return newValue(opChain, nil)
43 }
44
45 return newValue(opChain, result)
46}
47
48func jsonSchema(opChain *chain, value, schema interface{}) {
49 if opChain.failed() {

Callers 6

PathMethod · 0.85
PathMethod · 0.85
PathMethod · 0.85
PathMethod · 0.85
PathMethod · 0.85
PathMethod · 0.85

Calls 3

newValueFunction · 0.85
failedMethod · 0.80
failMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…