MCPcopy Create free account
hub / github.com/cedar-policy/cedar-java / get_components

Method get_components

CedarJavaFFI/src/helpers.rs:103–137  ·  view source on GitHub ↗
(
        self,
    )

Source from the content-addressed store, hash-verified

101
102impl LevelValidationCall {
103 fn get_components(
104 self,
105 ) -> WithWarnings<Result<(PolicySet, Schema, ValidationSettings, u32), Vec<miette::Report>>>
106 {
107 let mut errs = vec![];
108 let policies = match self.policies.parse() {
109 Ok(policies) => policies,
110 Err(e) => {
111 errs.extend(e);
112 PolicySet::new()
113 }
114 };
115 let pair = match self.schema.parse() {
116 Ok((schema, warnings)) => Some((schema, warnings)),
117 Err(e) => {
118 errs.push(e);
119 None
120 }
121 };
122 match (errs.is_empty(), pair) {
123 (true, Some((schema, warnings))) => WithWarnings {
124 t: Ok((
125 policies,
126 schema,
127 self.validation_settings,
128 self.max_deref_level,
129 )),
130 warnings: warnings.map(miette::Report::new).collect(),
131 },
132 _ => WithWarnings {
133 t: Err(errs),
134 warnings: vec![],
135 },
136 }
137 }
138}
139
140pub fn validate_with_level_json_str(json: &str) -> Result<String, serde_json::Error> {

Callers 1

validate_with_levelFunction · 0.80

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected