Skip to content

Commit 8bedbf5

Browse files
committed
Change schema to be case-insensitive
1 parent e05dae7 commit 8bedbf5

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

serde_with/src/schemars_0_8.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ impl<T> JsonSchemaAs<T> for hex::Hex<formats::Lowercase> {
420420
SchemaObject {
421421
instance_type: Some(InstanceType::String.into()),
422422
string: Some(Box::new(StringValidation {
423-
pattern: Some(r"^(?:[0-9a-f]{2})*$".to_owned()),
423+
pattern: Some(r"^(?:[0-9A-Fa-f]{2})*$".to_owned()),
424424
..Default::default()
425425
})),
426426
..Default::default()
@@ -449,7 +449,7 @@ impl<T> JsonSchemaAs<T> for hex::Hex<formats::Uppercase> {
449449
SchemaObject {
450450
instance_type: Some(InstanceType::String.into()),
451451
string: Some(Box::new(StringValidation {
452-
pattern: Some(r"^(?:[0-9A-F]{2})*$".to_owned()),
452+
pattern: Some(r"^(?:[0-9A-Fa-f]{2})*$".to_owned()),
453453
..Default::default()
454454
})),
455455
..Default::default()

serde_with/src/schemars_0_9.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ impl<T> JsonSchemaAs<T> for hex::Hex<formats::Lowercase> {
419419
fn json_schema(_: &mut SchemaGenerator) -> Schema {
420420
json_schema!({
421421
"type": "string",
422-
"pattern": r"^(?:[0-9a-f]{2})*$",
422+
"pattern": r"^(?:[0-9A-Fa-f]{2})*$",
423423
})
424424
}
425425

@@ -441,7 +441,7 @@ impl<T> JsonSchemaAs<T> for hex::Hex<formats::Uppercase> {
441441
fn json_schema(_: &mut SchemaGenerator) -> Schema {
442442
json_schema!({
443443
"type": "string",
444-
"pattern": r"^(?:[0-9A-F]{2})*$",
444+
"pattern": r"^(?:[0-9A-Fa-f]{2})*$",
445445
})
446446
}
447447

serde_with/src/schemars_1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ impl<T> JsonSchemaAs<T> for hex::Hex<formats::Lowercase> {
421421
fn json_schema(_: &mut SchemaGenerator) -> Schema {
422422
json_schema!({
423423
"type": "string",
424-
"pattern": r"^(?:[0-9a-f]{2})*$",
424+
"pattern": r"^(?:[0-9A-Fa-f]{2})*$",
425425
})
426426
}
427427

@@ -443,7 +443,7 @@ impl<T> JsonSchemaAs<T> for hex::Hex<formats::Uppercase> {
443443
fn json_schema(_: &mut SchemaGenerator) -> Schema {
444444
json_schema!({
445445
"type": "string",
446-
"pattern": r"^(?:[0-9A-F]{2})*$",
446+
"pattern": r"^(?:[0-9A-Fa-f]{2})*$",
447447
})
448448
}
449449

serde_with/tests/schemars_0_8/schemars_basic.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"lowercase_hex": {
3232
"description": "A vector of bytes that's serialized as a lowercase hex string.",
3333
"type": "string",
34-
"pattern": "^(?:[0-9a-f]{2})*$"
34+
"pattern": "^(?:[0-9A-Fa-f]{2})*$"
3535
},
3636
"same": {
3737
"description": "Same does not implement `JsonSchema` directly so this checks that the correct schemars attribute was injected.",
@@ -42,7 +42,7 @@
4242
"uppercase_hex": {
4343
"description": "A vector of bytes that's serialized as an uppercase hex string.",
4444
"type": "string",
45-
"pattern": "^(?:[0-9A-F]{2})*$"
45+
"pattern": "^(?:[0-9A-Fa-f]{2})*$"
4646
},
4747
"vec_same": {
4848
"description": "Same thing, but with a Vec this time.",

serde_with/tests/schemars_0_9/schemars_basic.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
"lowercase_hex": {
3838
"description": "A vector of bytes that's serialized as a lowercase hex string.",
3939
"type": "string",
40-
"pattern": "^(?:[0-9a-f]{2})*$"
40+
"pattern": "^(?:[0-9A-Fa-f]{2})*$"
4141
},
4242
"uppercase_hex": {
4343
"description": "A vector of bytes that's serialized as an uppercase hex string.",
4444
"type": "string",
45-
"pattern": "^(?:[0-9A-F]{2})*$"
45+
"pattern": "^(?:[0-9A-Fa-f]{2})*$"
4646
}
4747
},
4848
"required": [

serde_with/tests/schemars_1/schemars_basic.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
"lowercase_hex": {
3838
"description": "A vector of bytes that's serialized as a lowercase hex string.",
3939
"type": "string",
40-
"pattern": "^(?:[0-9a-f]{2})*$"
40+
"pattern": "^(?:[0-9A-Fa-f]{2})*$"
4141
},
4242
"uppercase_hex": {
4343
"description": "A vector of bytes that's serialized as an uppercase hex string.",
4444
"type": "string",
45-
"pattern": "^(?:[0-9A-F]{2})*$"
45+
"pattern": "^(?:[0-9A-Fa-f]{2})*$"
4646
}
4747
},
4848
"required": [

0 commit comments

Comments
 (0)