@@ -298,12 +298,6 @@ impl From<ToJsonSchemaError> for ToJsonSchemaErrors {
298
298
}
299
299
}
300
300
301
- impl From < EAMapError > for ToJsonSchemaErrors {
302
- fn from ( e : EAMapError ) -> Self {
303
- Self :: from ( ToJsonSchemaError :: from ( e) )
304
- }
305
- }
306
-
307
301
impl Display for ToJsonSchemaErrors {
308
302
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
309
303
write ! ( f, "{}" , self . 0 . first( ) ) // intentionally showing only the first error; see #326 for discussion on a similar error type
@@ -405,10 +399,6 @@ pub enum ToJsonSchemaError {
405
399
#[ error( transparent) ]
406
400
#[ diagnostic( transparent) ]
407
401
ReservedSchemaKeyword ( #[ from] ReservedSchemaKeyword ) ,
408
- /// Errors relating to embedded attribute maps
409
- #[ error( transparent) ]
410
- #[ diagnostic( transparent) ]
411
- EAMap ( #[ from] EAMapError ) ,
412
402
}
413
403
414
404
impl ToJsonSchemaError {
@@ -521,86 +511,6 @@ impl Diagnostic for ReservedName {
521
511
}
522
512
}
523
513
524
- /// An embedded attribute map (RFC 68) was encountered where one is not allowed
525
- #[ derive( Debug , Clone , Error , PartialEq , Eq ) ]
526
- #[ error( "found an embedded attribute map type, but embedded attribute maps are not allowed in this position" ) ]
527
- pub struct EAMapNotAllowedHereError {
528
- /// Source location of the `EAMap`
529
- pub ( crate ) source_loc : Loc ,
530
- /// Context-dependent help text
531
- pub ( crate ) help : Option < EAMapNotAllowedHereHelp > ,
532
- }
533
-
534
- impl Diagnostic for EAMapNotAllowedHereError {
535
- impl_diagnostic_from_source_loc_field ! ( source_loc) ;
536
-
537
- fn help < ' a > ( & ' a self ) -> Option < Box < dyn Display + ' a > > {
538
- self . help . as_ref ( ) . map ( |help| Box :: new ( help) as _ )
539
- }
540
- }
541
-
542
- #[ derive( Debug , Clone , Error , PartialEq , Eq ) ]
543
- pub ( crate ) enum EAMapNotAllowedHereHelp {
544
- #[ error( "Embedded attribute maps are not allowed as the top-level descriptor of all attributes of an entity. Try making an entity attribute to hold the embedded attribute map. E.g., `attributes: {{ ?: someType }}`." ) ]
545
- TopLevelEAMap ,
546
- }
547
-
548
- /// Encountered a type like `{ foo: Long, ?: String }` that mixes concrete attributes with an `EAMap`.
549
- /// This is currently not allowed.
550
- #[ derive( Debug , Clone , Error , PartialEq , Eq ) ]
551
- #[ error( "this type contains both concrete attributes and an embedded attribute map (`?:`), which is not allowed" ) ]
552
- pub struct EAMapWithConcreteAttributesError {
553
- /// Source location of the `EAMap` declaration
554
- pub ( crate ) source_loc : Loc ,
555
- }
556
-
557
- impl Diagnostic for EAMapWithConcreteAttributesError {
558
- impl_diagnostic_from_source_loc_field ! ( source_loc) ;
559
- }
560
-
561
- /// Encountered a type like `{ ?: Long, ?: String }` that mixes two or more `EAMap` declarations.
562
- /// This is currently not allowed.
563
- #[ derive( Debug , Clone , Error , PartialEq , Eq ) ]
564
- #[ error( "this type contains two or more different embedded attribute map declarations (`?:`), which is not allowed" ) ]
565
- pub struct MultipleEAMapDeclarationsError {
566
- /// Source location of the first `EAMap` declaration
567
- pub ( crate ) source_loc_1 : Loc ,
568
- /// Source location of the second `EAMap` declaration
569
- pub ( crate ) source_loc_2 : Loc ,
570
- }
571
-
572
- impl Diagnostic for MultipleEAMapDeclarationsError {
573
- impl_diagnostic_from_two_source_loc_fields ! ( source_loc_1, source_loc_2) ;
574
-
575
- fn help < ' a > ( & ' a self ) -> Option < Box < dyn std:: fmt:: Display + ' a > > {
576
- Some ( Box :: new (
577
- "try separating this into two different attributes" ,
578
- ) )
579
- }
580
- }
581
-
582
- /// Errors relating to embedded attribute maps (`EAMap`s)
583
- //
584
- // This is NOT a publicly exported error type.
585
- #[ derive( Debug , Clone , Diagnostic , Error , PartialEq , Eq ) ]
586
- #[ non_exhaustive]
587
- pub enum EAMapError {
588
- /// An embedded attribute map (RFC 68) was encountered where one is not allowed
589
- #[ error( transparent) ]
590
- #[ diagnostic( transparent) ]
591
- NotAllowedHere ( #[ from] EAMapNotAllowedHereError ) ,
592
- /// Encountered a type like `{ foo: Long, ?: String }` that mixes concrete attributes with an `EAMap`.
593
- /// This is currently not allowed.
594
- #[ error( transparent) ]
595
- #[ diagnostic( transparent) ]
596
- WithConcreteAttributes ( #[ from] EAMapWithConcreteAttributesError ) ,
597
- /// Encountered a type like `{ ?: Long, ?: String }` that mixes two or more `EAMap` declarations.
598
- /// This is currently not allowed.
599
- #[ error( transparent) ]
600
- #[ diagnostic( transparent) ]
601
- MultipleEAMapDeclarations ( #[ from] MultipleEAMapDeclarationsError ) ,
602
- }
603
-
604
514
#[ derive( Debug , Clone , PartialEq , Eq , Error ) ]
605
515
#[ error( "unknown type name: `{name}`" ) ]
606
516
pub struct UnknownTypeName {
0 commit comments