File tree Expand file tree Collapse file tree 3 files changed +9
-82
lines changed Expand file tree Collapse file tree 3 files changed +9
-82
lines changed Original file line number Diff line number Diff line change @@ -405,42 +405,13 @@ impl<T> JsonSchemaAs<T> for DisplayFromStr {
405
405
}
406
406
407
407
#[ cfg( feature = "hex" ) ]
408
- impl < T > JsonSchemaAs < T > for hex:: Hex < formats :: Lowercase > {
408
+ impl < T , F : formats :: Format > JsonSchemaAs < T > for hex:: Hex < F > {
409
409
fn schema_name ( ) -> String {
410
- "Hex<Lowercase >" . into ( )
410
+ "Hex<F >" . into ( )
411
411
}
412
412
413
413
fn schema_id ( ) -> Cow < ' static , str > {
414
- "serde_with::hex::Hex<Lowercase>" . into ( )
415
- }
416
-
417
- fn json_schema ( _: & mut SchemaGenerator ) -> Schema {
418
- use :: schemars_0_8:: schema:: StringValidation ;
419
-
420
- SchemaObject {
421
- instance_type : Some ( InstanceType :: String . into ( ) ) ,
422
- string : Some ( Box :: new ( StringValidation {
423
- pattern : Some ( r"^(?:[0-9A-Fa-f]{2})*$" . to_owned ( ) ) ,
424
- ..Default :: default ( )
425
- } ) ) ,
426
- ..Default :: default ( )
427
- }
428
- . into ( )
429
- }
430
-
431
- fn is_referenceable ( ) -> bool {
432
- false
433
- }
434
- }
435
-
436
- #[ cfg( feature = "hex" ) ]
437
- impl < T > JsonSchemaAs < T > for hex:: Hex < formats:: Uppercase > {
438
- fn schema_name ( ) -> String {
439
- "Hex<Uppercase>" . into ( )
440
- }
441
-
442
- fn schema_id ( ) -> Cow < ' static , str > {
443
- "serde_with::hex::Hex<Uppercase>" . into ( )
414
+ "serde_with::hex::Hex<F>" . into ( )
444
415
}
445
416
446
417
fn json_schema ( _: & mut SchemaGenerator ) -> Schema {
Original file line number Diff line number Diff line change @@ -407,35 +407,13 @@ impl<T> JsonSchemaAs<T> for DisplayFromStr {
407
407
}
408
408
409
409
#[ cfg( feature = "hex" ) ]
410
- impl < T > JsonSchemaAs < T > for hex:: Hex < formats :: Lowercase > {
410
+ impl < T , F : formats :: Format > JsonSchemaAs < T > for hex:: Hex < F > {
411
411
fn schema_name ( ) -> Cow < ' static , str > {
412
- "Hex<Lowercase >" . into ( )
412
+ "Hex<F >" . into ( )
413
413
}
414
414
415
415
fn schema_id ( ) -> Cow < ' static , str > {
416
- "serde_with::hex::Hex<Lowercase>" . into ( )
417
- }
418
-
419
- fn json_schema ( _: & mut SchemaGenerator ) -> Schema {
420
- json_schema ! ( {
421
- "type" : "string" ,
422
- "pattern" : r"^(?:[0-9A-Fa-f]{2})*$" ,
423
- } )
424
- }
425
-
426
- fn inline_schema ( ) -> bool {
427
- true
428
- }
429
- }
430
-
431
- #[ cfg( feature = "hex" ) ]
432
- impl < T > JsonSchemaAs < T > for hex:: Hex < formats:: Uppercase > {
433
- fn schema_name ( ) -> Cow < ' static , str > {
434
- "Hex<Uppercase>" . into ( )
435
- }
436
-
437
- fn schema_id ( ) -> Cow < ' static , str > {
438
- "serde_with::hex::Hex<Uppercase>" . into ( )
416
+ "serde_with::hex::Hex<F>" . into ( )
439
417
}
440
418
441
419
fn json_schema ( _: & mut SchemaGenerator ) -> Schema {
Original file line number Diff line number Diff line change @@ -409,35 +409,13 @@ impl<T> JsonSchemaAs<T> for DisplayFromStr {
409
409
}
410
410
411
411
#[ cfg( feature = "hex" ) ]
412
- impl < T > JsonSchemaAs < T > for hex:: Hex < formats :: Lowercase > {
412
+ impl < T , F : formats :: Format > JsonSchemaAs < T > for hex:: Hex < F > {
413
413
fn schema_name ( ) -> Cow < ' static , str > {
414
- "Hex<Lowercase >" . into ( )
414
+ "Hex<F >" . into ( )
415
415
}
416
416
417
417
fn schema_id ( ) -> Cow < ' static , str > {
418
- "serde_with::hex::Hex<Lowercase>" . into ( )
419
- }
420
-
421
- fn json_schema ( _: & mut SchemaGenerator ) -> Schema {
422
- json_schema ! ( {
423
- "type" : "string" ,
424
- "pattern" : r"^(?:[0-9A-Fa-f]{2})*$" ,
425
- } )
426
- }
427
-
428
- fn inline_schema ( ) -> bool {
429
- true
430
- }
431
- }
432
-
433
- #[ cfg( feature = "hex" ) ]
434
- impl < T > JsonSchemaAs < T > for hex:: Hex < formats:: Uppercase > {
435
- fn schema_name ( ) -> Cow < ' static , str > {
436
- "Hex<Uppercase>" . into ( )
437
- }
438
-
439
- fn schema_id ( ) -> Cow < ' static , str > {
440
- "serde_with::hex::Hex<Uppercase>" . into ( )
418
+ "serde_with::hex::Hex<F>" . into ( )
441
419
}
442
420
443
421
fn json_schema ( _: & mut SchemaGenerator ) -> Schema {
You can’t perform that action at this time.
0 commit comments