docgen: improve regex format

This commit is contained in:
Dietmar Maurer 2021-02-21 16:14:11 +01:00
parent 8616a4afe5
commit aa30663ca5

View File

@ -128,7 +128,8 @@ pub fn dump_schema(schema: &Schema) -> Value {
match string_schema.format { match string_schema.format {
None | Some(ApiStringFormat::VerifyFn(_)) => { /* do nothing */ } None | Some(ApiStringFormat::VerifyFn(_)) => { /* do nothing */ }
Some(ApiStringFormat::Pattern(const_regex)) => { Some(ApiStringFormat::Pattern(const_regex)) => {
data["pattern"] = const_regex.regex_string.into(); data["pattern"] = format!("/{}/", const_regex.regex_string)
.into();
} }
Some(ApiStringFormat::Enum(variants)) => { Some(ApiStringFormat::Enum(variants)) => {
let variants: Vec<String> = variants let variants: Vec<String> = variants