Skip to main content

schema_identity

Function schema_identity 

Source
pub fn schema_identity(relative: &str) -> Option<String>
Expand description

The identity a schema path carries: majordomus/adr/adr.v1.schema.json is majordomus.adr/v1. A path of another shape yields nothing.

use majordomus_cli::share::schema_identity;
assert_eq!(
    schema_identity("majordomus/adr/adr.v1.schema.json").as_deref(),
    Some("majordomus.adr/v1")
);
assert_eq!(schema_identity("adr.schema.json"), None);
assert_eq!(schema_identity("majordomus/adr/other.v1.schema.json"), None);