MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / path_json

Function path_json

atomic-shacl/src/lib.rs:118–132  ·  view source on GitHub ↗
(path: &ShapePath)

Source from the content-addressed store, hash-verified

116}
117
118fn path_json(path: &ShapePath) -> Value {
119 match path {
120 ShapePath::Predicate(iri) => json!({"predicate": iri.as_str()}),
121 ShapePath::Inverse(path) => json!({"inverse": path_json(path)}),
122 ShapePath::Sequence(paths) => {
123 json!({"sequence": paths.iter().map(path_json).collect::<Vec<_>>()})
124 }
125 ShapePath::Alternative(paths) => {
126 json!({"alternative": paths.iter().map(path_json).collect::<Vec<_>>()})
127 }
128 ShapePath::ZeroOrMore(path) => json!({"zero_or_more": path_json(path)}),
129 ShapePath::OneOrMore(path) => json!({"one_or_more": path_json(path)}),
130 ShapePath::ZeroOrOne(path) => json!({"zero_or_one": path_json(path)}),
131 }
132}
133
134fn result_json(result: &ValidationResult) -> Value {
135 json!({

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected