pub fn annotate(
schema: &Schema,
target: &str,
target_format: TargetFormat,
config: AnnotatorConfig,
) -> Result<String, AnnotatorError>Expand description
Annotate a target document with schema descriptions
§Arguments
schema- JSON Schema as aschemars::Schematarget- Target document as a string (TOML or YAML)target_format- Format of the target documentconfig- Annotation configuration options
§Example
use jsonschema_annotator::{annotate, TargetFormat, AnnotatorConfig};
use schemars::Schema;
let schema_json = r#"{"properties": {"port": {"title": "Port"}}}"#;
let schema: Schema = serde_json::from_str(schema_json).unwrap();
let annotated = annotate(
&schema,
"port = 8080",
TargetFormat::Toml,
AnnotatorConfig::default(),
).unwrap();
assert!(annotated.contains("# Port"));