Debian Codegraph @

src/json_schema_impls/semver1.rs

raw symbols SCIP
1 use craterust-analyzer cargo schemars 1.2.2 crate/::SchemaGeneratorrust-analyzer cargo schemars 1.2.2 generate/SchemaGenerator#;
2 use craterust-analyzer cargo schemars 1.2.2 crate/::{json_schemarust-analyzer cargo schemars 1.2.2 macros/json_schema!, JsonSchemarust-analyzer cargo schemars 1.2.2 JsonSchema#, Schemarust-analyzer cargo schemars 1.2.2 schema/Schema#};
3 use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#;
4 use semver1rust-analyzer cargo semver 1.0.28 crate/::Versionrust-analyzer cargo semver 1.0.28 Version#;
5
6 impl JsonSchemarust-analyzer cargo schemars 1.2.2 JsonSchema# for Versionrust-analyzer cargo semver 1.0.28 Version# {
7 fn schema_namerust-analyzer cargo schemars 1.2.2 json_schema_impls/semver1/impl#[Version][JsonSchema]schema_name().() -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str> {
8 "SemVer".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
9 }
10
11 fn schema_idrust-analyzer cargo schemars 1.2.2 json_schema_impls/semver1/impl#[Version][JsonSchema]schema_id().() -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str> {
12 "semver::Version".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
13 }
14
15 fn json_schemarust-analyzer cargo schemars 1.2.2 json_schema_impls/semver1/impl#[Version][JsonSchema]json_schema().(_: &mut SchemaGeneratorrust-analyzer cargo schemars 1.2.2 generate/SchemaGenerator#) -> Schemarust-analyzer cargo schemars 1.2.2 schema/Schema# {
16 json_schemarust-analyzer cargo schemars 1.2.2 macros/json_schema!!({
17 "type": "string",
18 // https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
19 "pattern": r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"
20 })
21 }
22 }