(dsc: &mut DscManager, resource_type: &FullyQualifiedTypeName, version: Option<&ResourceVersionReq>, format: Option<&OutputFormat>)
| 299 | } |
| 300 | |
| 301 | pub fn schema(dsc: &mut DscManager, resource_type: &FullyQualifiedTypeName, version: Option<&ResourceVersionReq>, format: Option<&OutputFormat>) { |
| 302 | let Some(resource) = get_resource(dsc, resource_type, version) else { |
| 303 | error!("{}", DscError::ResourceNotFound(resource_type.to_string(), version.map_or(String::new(), |v| v.to_string()))); |
| 304 | exit(EXIT_DSC_RESOURCE_NOT_FOUND); |
| 305 | }; |
| 306 | if resource.kind == Kind::Adapter { |
| 307 | error!("{}: {}", t!("resource_command.invalidOperationOnAdapter"), resource.type_name); |
| 308 | exit(EXIT_DSC_ERROR); |
| 309 | } |
| 310 | |
| 311 | match resource.schema() { |
| 312 | Ok(json) => { |
| 313 | // verify is json |
| 314 | match serde_json::from_str::<serde_json::Value>(json.as_str()) { |
| 315 | Ok(_) => (), |
| 316 | Err(err) => { |
| 317 | error!("{err}"); |
| 318 | exit(EXIT_JSON_ERROR); |
| 319 | } |
| 320 | } |
| 321 | write_object(&json, format, false); |
| 322 | } |
| 323 | Err(err) => { |
| 324 | error!("{err}"); |
| 325 | exit(EXIT_DSC_ERROR); |
| 326 | } |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | pub fn export(dsc: &mut DscManager, resource_type: &FullyQualifiedTypeName, version: Option<&ResourceVersionReq>, input: &str, format: Option<&OutputFormat>) { |
| 331 | let Some(dsc_resource) = get_resource(dsc, resource_type, version) else { |
no test coverage detected