439 397 | /// Creates a new builder-style object to manufacture [`MalformedRangeInput`](crate::input::MalformedRangeInput).
|
440 398 | pub fn builder() -> crate::input::malformed_range_input::Builder {
|
441 399 | crate::input::malformed_range_input::Builder::default()
|
442 400 | }
|
443 401 | }
|
444 402 | impl crate::constrained::Constrained for crate::input::MalformedRangeInput {
|
445 403 | type Unconstrained = crate::input::malformed_range_input::Builder;
|
446 404 | }
|
447 405 |
|
448 406 | #[allow(missing_docs)] // documentation missing in model
|
449 - | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
450 - | pub struct MalformedPatternOverrideInput {
|
407 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
408 + | pub struct MalformedRangeOverrideInput {
|
451 409 | #[allow(missing_docs)] // documentation missing in model
|
452 - | pub string: ::std::option::Option<crate::input::malformed_pattern_override_input::String>,
|
410 + | pub byte: ::std::option::Option<crate::input::malformed_range_override_input::Byte>,
|
453 411 | #[allow(missing_docs)] // documentation missing in model
|
454 - | pub list: ::std::option::Option<::std::vec::Vec<crate::model::pattern_list_override::Member>>,
|
412 + | pub min_byte: ::std::option::Option<crate::input::malformed_range_override_input::MinByte>,
|
455 413 | #[allow(missing_docs)] // documentation missing in model
|
456 - | pub map: ::std::option::Option<
|
457 - | ::std::collections::HashMap<
|
458 - | crate::model::pattern_map_override::Key,
|
459 - | crate::model::pattern_map_override::Value,
|
460 - | >,
|
461 - | >,
|
414 + | pub max_byte: ::std::option::Option<crate::input::malformed_range_override_input::MaxByte>,
|
462 415 | #[allow(missing_docs)] // documentation missing in model
|
463 - | pub union: ::std::option::Option<crate::model::PatternUnionOverride>,
|
464 - | }
|
465 - | impl MalformedPatternOverrideInput {
|
416 + | pub short: ::std::option::Option<crate::input::malformed_range_override_input::Short>,
|
466 417 | #[allow(missing_docs)] // documentation missing in model
|
467 - | pub fn string(
|
468 - | &self,
|
469 - | ) -> ::std::option::Option<&crate::input::malformed_pattern_override_input::String> {
|
470 - | self.string.as_ref()
|
471 - | }
|
418 + | pub min_short: ::std::option::Option<crate::input::malformed_range_override_input::MinShort>,
|
472 419 | #[allow(missing_docs)] // documentation missing in model
|
473 - | pub fn list(&self) -> ::std::option::Option<&[crate::model::pattern_list_override::Member]> {
|
474 - | self.list.as_deref()
|
475 - | }
|
420 + | pub max_short: ::std::option::Option<crate::input::malformed_range_override_input::MaxShort>,
|
476 421 | #[allow(missing_docs)] // documentation missing in model
|
477 - | pub fn map(
|
478 - | &self,
|
479 - | ) -> ::std::option::Option<
|
480 - | &::std::collections::HashMap<
|
481 - | crate::model::pattern_map_override::Key,
|
482 - | crate::model::pattern_map_override::Value,
|
483 - | >,
|
484 - | > {
|
485 - | self.map.as_ref()
|
486 - | }
|
422 + | pub integer: ::std::option::Option<crate::input::malformed_range_override_input::Integer>,
|
487 423 | #[allow(missing_docs)] // documentation missing in model
|
488 - | pub fn union(&self) -> ::std::option::Option<&crate::model::PatternUnionOverride> {
|
489 - | self.union.as_ref()
|
490 - | }
|
491 - | }
|
492 - | impl MalformedPatternOverrideInput {
|
493 - | /// Creates a new builder-style object to manufacture [`MalformedPatternOverrideInput`](crate::input::MalformedPatternOverrideInput).
|
494 - | pub fn builder() -> crate::input::malformed_pattern_override_input::Builder {
|
495 - | crate::input::malformed_pattern_override_input::Builder::default()
|
496 - | }
|
497 - | }
|
498 - | impl crate::constrained::Constrained for crate::input::MalformedPatternOverrideInput {
|
499 - | type Unconstrained = crate::input::malformed_pattern_override_input::Builder;
|
500 - | }
|
501 - |
|
502 - | #[allow(missing_docs)] // documentation missing in model
|
503 - | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
504 - | pub struct MalformedPatternInput {
|
424 + | pub min_integer:
|
425 + | ::std::option::Option<crate::input::malformed_range_override_input::MinInteger>,
|
505 426 | #[allow(missing_docs)] // documentation missing in model
|
506 - | pub string: ::std::option::Option<crate::model::PatternString>,
|
427 + | pub max_integer:
|
428 + | ::std::option::Option<crate::input::malformed_range_override_input::MaxInteger>,
|
507 429 | #[allow(missing_docs)] // documentation missing in model
|
508 - | pub evil_string: ::std::option::Option<crate::model::EvilString>,
|
430 + | pub long: ::std::option::Option<crate::input::malformed_range_override_input::Long>,
|
509 431 | #[allow(missing_docs)] // documentation missing in model
|
510 - | pub list: ::std::option::Option<::std::vec::Vec<crate::model::PatternString>>,
|
432 + | pub min_long: ::std::option::Option<crate::input::malformed_range_override_input::MinLong>,
|
511 433 | #[allow(missing_docs)] // documentation missing in model
|
512 - | pub map: ::std::option::Option<
|
513 - | ::std::collections::HashMap<crate::model::PatternString, crate::model::PatternString>,
|
514 - | >,
|
434 + | pub max_long: ::std::option::Option<crate::input::malformed_range_override_input::MaxLong>,
|
515 435 | #[allow(missing_docs)] // documentation missing in model
|
516 - | pub union: ::std::option::Option<crate::model::PatternUnion>,
|
517 - | }
|
518 - | impl MalformedPatternInput {
|
436 + | pub float: ::std::option::Option<f32>,
|
519 437 | #[allow(missing_docs)] // documentation missing in model
|
520 - | pub fn string(&self) -> ::std::option::Option<&crate::model::PatternString> {
|
521 - | self.string.as_ref()
|
522 - | }
|
438 + | pub min_float: ::std::option::Option<f32>,
|
523 439 | #[allow(missing_docs)] // documentation missing in model
|
524 - | pub fn evil_string(&self) -> ::std::option::Option<&crate::model::EvilString> {
|
525 - | self.evil_string.as_ref()
|
526 - | }
|
440 + | pub max_float: ::std::option::Option<f32>,
|
441 + | }
|
442 + | impl MalformedRangeOverrideInput {
|
527 443 | #[allow(missing_docs)] // documentation missing in model
|
528 - | pub fn list(&self) -> ::std::option::Option<&[crate::model::PatternString]> {
|
529 - | self.list.as_deref()
|
444 + | pub fn byte(
|
445 + | &self,
|
446 + | ) -> ::std::option::Option<&crate::input::malformed_range_override_input::Byte> {
|
447 + | self.byte.as_ref()
|
530 448 | }
|
531 449 | #[allow(missing_docs)] // documentation missing in model
|
532 - | pub fn map(
|
450 + | pub fn min_byte(
|
533 451 | &self,
|
534 - | ) -> ::std::option::Option<
|
535 - | &::std::collections::HashMap<crate::model::PatternString, crate::model::PatternString>,
|
536 - | > {
|
537 - | self.map.as_ref()
|
452 + | ) -> ::std::option::Option<&crate::input::malformed_range_override_input::MinByte> {
|
453 + | self.min_byte.as_ref()
|
538 454 | }
|
539 455 | #[allow(missing_docs)] // documentation missing in model
|
540 - | pub fn union(&self) -> ::std::option::Option<&crate::model::PatternUnion> {
|
541 - | self.union.as_ref()
|
542 - | }
|
543 - | }
|
544 - | impl MalformedPatternInput {
|
545 - | /// Creates a new builder-style object to manufacture [`MalformedPatternInput`](crate::input::MalformedPatternInput).
|
546 - | pub fn builder() -> crate::input::malformed_pattern_input::Builder {
|
547 - | crate::input::malformed_pattern_input::Builder::default()
|
456 + | pub fn max_byte(
|
457 + | &self,
|
458 + | ) -> ::std::option::Option<&crate::input::malformed_range_override_input::MaxByte> {
|
459 + | self.max_byte.as_ref()
|
548 460 | }
|
549 - | }
|
550 - | impl crate::constrained::Constrained for crate::input::MalformedPatternInput {
|
551 - | type Unconstrained = crate::input::malformed_pattern_input::Builder;
|
552 - | }
|
553 - |
|
554 - | #[allow(missing_docs)] // documentation missing in model
|
555 - | #[derive(
|
556 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
557 - | )]
|
558 - | pub struct MalformedLengthQueryStringInput {
|
559 - | #[allow(missing_docs)] // documentation missing in model
|
560 - | pub string: ::std::option::Option<crate::model::LengthString>,
|
561 - | }
|
562 - | impl MalformedLengthQueryStringInput {
|
563 461 | #[allow(missing_docs)] // documentation missing in model
|
564 - | pub fn string(&self) -> ::std::option::Option<&crate::model::LengthString> {
|
565 - | self.string.as_ref()
|
566 - | }
|
567 - | }
|
568 - | impl MalformedLengthQueryStringInput {
|
569 - | /// Creates a new builder-style object to manufacture [`MalformedLengthQueryStringInput`](crate::input::MalformedLengthQueryStringInput).
|
570 - | pub fn builder() -> crate::input::malformed_length_query_string_input::Builder {
|
571 - | crate::input::malformed_length_query_string_input::Builder::default()
|
462 + | pub fn short(
|
463 + | &self,
|
464 + | ) -> ::std::option::Option<&crate::input::malformed_range_override_input::Short> {
|
465 + | self.short.as_ref()
|
572 466 | }
|
573 - | }
|
574 - | impl crate::constrained::Constrained for crate::input::MalformedLengthQueryStringInput {
|
575 - | type Unconstrained = crate::input::malformed_length_query_string_input::Builder;
|
576 - | }
|
577 - |
|
578 - | #[allow(missing_docs)] // documentation missing in model
|
579 - | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
580 - | pub struct MalformedLengthOverrideInput {
|
581 - | #[allow(missing_docs)] // documentation missing in model
|
582 - | pub blob: ::std::option::Option<crate::input::malformed_length_override_input::Blob>,
|
583 - | #[allow(missing_docs)] // documentation missing in model
|
584 - | pub string: ::std::option::Option<crate::input::malformed_length_override_input::String>,
|
585 467 | #[allow(missing_docs)] // documentation missing in model
|
586 - | pub min_string: ::std::option::Option<crate::input::malformed_length_override_input::MinString>,
|
587 - | #[allow(missing_docs)] // documentation missing in model
|
588 - | pub max_string: ::std::option::Option<crate::input::malformed_length_override_input::MaxString>,
|
589 - | #[allow(missing_docs)] // documentation missing in model
|
590 - | pub list: ::std::option::Option<crate::input::malformed_length_override_input::List>,
|
468 + | pub fn min_short(
|
469 + | &self,
|
470 + | ) -> ::std::option::Option<&crate::input::malformed_range_override_input::MinShort> {
|
471 + | self.min_short.as_ref()
|
472 + | }
|
591 473 | #[allow(missing_docs)] // documentation missing in model
|
592 - | pub map: ::std::option::Option<crate::input::malformed_length_override_input::Map>,
|
593 - | }
|
594 - | impl MalformedLengthOverrideInput {
|
474 + | pub fn max_short(
|
475 + | &self,
|
476 + | ) -> ::std::option::Option<&crate::input::malformed_range_override_input::MaxShort> {
|
477 + | self.max_short.as_ref()
|
478 + | }
|
595 479 | #[allow(missing_docs)] // documentation missing in model
|
596 - | pub fn blob(
|
480 + | pub fn integer(
|
597 481 | &self,
|
598 - | ) -> ::std::option::Option<&crate::input::malformed_length_override_input::Blob> {
|
599 - | self.blob.as_ref()
|
482 + | ) -> ::std::option::Option<&crate::input::malformed_range_override_input::Integer> {
|
483 + | self.integer.as_ref()
|
600 484 | }
|
601 485 | #[allow(missing_docs)] // documentation missing in model
|
602 - | pub fn string(
|
486 + | pub fn min_integer(
|
603 487 | &self,
|
604 - | ) -> ::std::option::Option<&crate::input::malformed_length_override_input::String> {
|
605 - | self.string.as_ref()
|
488 + | ) -> ::std::option::Option<&crate::input::malformed_range_override_input::MinInteger> {
|
489 + | self.min_integer.as_ref()
|
606 490 | }
|
607 491 | #[allow(missing_docs)] // documentation missing in model
|
608 - | pub fn min_string(
|
492 + | pub fn max_integer(
|
609 493 | &self,
|
610 - | ) -> ::std::option::Option<&crate::input::malformed_length_override_input::MinString> {
|
611 - | self.min_string.as_ref()
|
494 + | ) -> ::std::option::Option<&crate::input::malformed_range_override_input::MaxInteger> {
|
495 + | self.max_integer.as_ref()
|
612 496 | }
|
613 497 | #[allow(missing_docs)] // documentation missing in model
|
614 - | pub fn max_string(
|
498 + | pub fn long(
|
615 499 | &self,
|
616 - | ) -> ::std::option::Option<&crate::input::malformed_length_override_input::MaxString> {
|
617 - | self.max_string.as_ref()
|
500 + | ) -> ::std::option::Option<&crate::input::malformed_range_override_input::Long> {
|
501 + | self.long.as_ref()
|
618 502 | }
|
619 503 | #[allow(missing_docs)] // documentation missing in model
|
620 - | pub fn list(
|
504 + | pub fn min_long(
|
621 505 | &self,
|
622 - | ) -> ::std::option::Option<&crate::input::malformed_length_override_input::List> {
|
623 - | self.list.as_ref()
|
506 + | ) -> ::std::option::Option<&crate::input::malformed_range_override_input::MinLong> {
|
507 + | self.min_long.as_ref()
|
624 508 | }
|
625 509 | #[allow(missing_docs)] // documentation missing in model
|
626 - | pub fn map(
|
510 + | pub fn max_long(
|
627 511 | &self,
|
628 - | ) -> ::std::option::Option<&crate::input::malformed_length_override_input::Map> {
|
629 - | self.map.as_ref()
|
512 + | ) -> ::std::option::Option<&crate::input::malformed_range_override_input::MaxLong> {
|
513 + | self.max_long.as_ref()
|
514 + | }
|
515 + | #[allow(missing_docs)] // documentation missing in model
|
516 + | pub fn float(&self) -> ::std::option::Option<f32> {
|
517 + | self.float
|
518 + | }
|
519 + | #[allow(missing_docs)] // documentation missing in model
|
520 + | pub fn min_float(&self) -> ::std::option::Option<f32> {
|
521 + | self.min_float
|
522 + | }
|
523 + | #[allow(missing_docs)] // documentation missing in model
|
524 + | pub fn max_float(&self) -> ::std::option::Option<f32> {
|
525 + | self.max_float
|
630 526 | }
|
631 527 | }
|
632 - | impl MalformedLengthOverrideInput {
|
633 - | /// Creates a new builder-style object to manufacture [`MalformedLengthOverrideInput`](crate::input::MalformedLengthOverrideInput).
|
634 - | pub fn builder() -> crate::input::malformed_length_override_input::Builder {
|
635 - | crate::input::malformed_length_override_input::Builder::default()
|
528 + | impl MalformedRangeOverrideInput {
|
529 + | /// Creates a new builder-style object to manufacture [`MalformedRangeOverrideInput`](crate::input::MalformedRangeOverrideInput).
|
530 + | pub fn builder() -> crate::input::malformed_range_override_input::Builder {
|
531 + | crate::input::malformed_range_override_input::Builder::default()
|
636 532 | }
|
637 533 | }
|
638 - | impl crate::constrained::Constrained for crate::input::MalformedLengthOverrideInput {
|
639 - | type Unconstrained = crate::input::malformed_length_override_input::Builder;
|
534 + | impl crate::constrained::Constrained for crate::input::MalformedRangeOverrideInput {
|
535 + | type Unconstrained = crate::input::malformed_range_override_input::Builder;
|
640 536 | }
|
641 537 |
|
642 538 | #[allow(missing_docs)] // documentation missing in model
|
643 - | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
644 - | pub struct MalformedLengthInput {
|
645 - | #[allow(missing_docs)] // documentation missing in model
|
646 - | pub blob: ::std::option::Option<crate::model::LengthBlob>,
|
647 - | #[allow(missing_docs)] // documentation missing in model
|
648 - | pub string: ::std::option::Option<crate::model::LengthString>,
|
649 - | #[allow(missing_docs)] // documentation missing in model
|
650 - | pub min_string: ::std::option::Option<crate::model::MinLengthString>,
|
539 + | #[derive(
|
540 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
541 + | )]
|
542 + | pub struct MalformedRequiredInput {
|
651 543 | #[allow(missing_docs)] // documentation missing in model
|
652 - | pub max_string: ::std::option::Option<crate::model::MaxLengthString>,
|
544 + | pub string: ::std::string::String,
|
653 545 | #[allow(missing_docs)] // documentation missing in model
|
654 - | pub list: ::std::option::Option<crate::model::LengthList>,
|
546 + | pub string_in_query: ::std::string::String,
|
655 547 | #[allow(missing_docs)] // documentation missing in model
|
656 - | pub map: ::std::option::Option<crate::model::LengthMap>,
|
548 + | pub string_in_header: ::std::string::String,
|
657 549 | }
|
658 - | impl MalformedLengthInput {
|
659 - | #[allow(missing_docs)] // documentation missing in model
|
660 - | pub fn blob(&self) -> ::std::option::Option<&crate::model::LengthBlob> {
|
661 - | self.blob.as_ref()
|
662 - | }
|
663 - | #[allow(missing_docs)] // documentation missing in model
|
664 - | pub fn string(&self) -> ::std::option::Option<&crate::model::LengthString> {
|
665 - | self.string.as_ref()
|
666 - | }
|
667 - | #[allow(missing_docs)] // documentation missing in model
|
668 - | pub fn min_string(&self) -> ::std::option::Option<&crate::model::MinLengthString> {
|
669 - | self.min_string.as_ref()
|
670 - | }
|
550 + | impl MalformedRequiredInput {
|
671 551 | #[allow(missing_docs)] // documentation missing in model
|
672 - | pub fn max_string(&self) -> ::std::option::Option<&crate::model::MaxLengthString> {
|
673 - | self.max_string.as_ref()
|
552 + | pub fn string(&self) -> &str {
|
553 + | use std::ops::Deref;
|
554 + | self.string.deref()
|
674 555 | }
|
675 556 | #[allow(missing_docs)] // documentation missing in model
|
676 - | pub fn list(&self) -> ::std::option::Option<&crate::model::LengthList> {
|
677 - | self.list.as_ref()
|
557 + | pub fn string_in_query(&self) -> &str {
|
558 + | use std::ops::Deref;
|
559 + | self.string_in_query.deref()
|
678 560 | }
|
679 561 | #[allow(missing_docs)] // documentation missing in model
|
680 - | pub fn map(&self) -> ::std::option::Option<&crate::model::LengthMap> {
|
681 - | self.map.as_ref()
|
562 + | pub fn string_in_header(&self) -> &str {
|
563 + | use std::ops::Deref;
|
564 + | self.string_in_header.deref()
|
682 565 | }
|
683 566 | }
|
684 - | impl MalformedLengthInput {
|
685 - | /// Creates a new builder-style object to manufacture [`MalformedLengthInput`](crate::input::MalformedLengthInput).
|
686 - | pub fn builder() -> crate::input::malformed_length_input::Builder {
|
687 - | crate::input::malformed_length_input::Builder::default()
|
567 + | impl MalformedRequiredInput {
|
568 + | /// Creates a new builder-style object to manufacture [`MalformedRequiredInput`](crate::input::MalformedRequiredInput).
|
569 + | pub fn builder() -> crate::input::malformed_required_input::Builder {
|
570 + | crate::input::malformed_required_input::Builder::default()
|
688 571 | }
|
689 572 | }
|
690 - | impl crate::constrained::Constrained for crate::input::MalformedLengthInput {
|
691 - | type Unconstrained = crate::input::malformed_length_input::Builder;
|
573 + | impl crate::constrained::Constrained for crate::input::MalformedRequiredInput {
|
574 + | type Unconstrained = crate::input::malformed_required_input::Builder;
|
692 575 | }
|
693 576 |
|
694 577 | #[allow(missing_docs)] // documentation missing in model
|
695 - | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
696 - | pub struct MalformedEnumInput {
|
578 + | #[derive(
|
579 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
580 + | )]
|
581 + | pub struct MalformedUniqueItemsInput {
|
697 582 | #[allow(missing_docs)] // documentation missing in model
|
698 - | pub string: ::std::option::Option<crate::model::EnumString>,
|
583 + | pub blob_list: ::std::option::Option<crate::model::BlobSet>,
|
699 584 | #[allow(missing_docs)] // documentation missing in model
|
700 - | pub string_with_enum_trait: ::std::option::Option<crate::model::EnumTraitString>,
|
585 + | pub boolean_list: ::std::option::Option<crate::model::BooleanSet>,
|
701 586 | #[allow(missing_docs)] // documentation missing in model
|
702 - | pub list: ::std::option::Option<::std::vec::Vec<crate::model::EnumString>>,
|
587 + | pub string_list: ::std::option::Option<crate::model::StringSet>,
|
703 588 | #[allow(missing_docs)] // documentation missing in model
|
704 - | pub map: ::std::option::Option<
|
705 - | ::std::collections::HashMap<crate::model::EnumString, crate::model::EnumString>,
|
706 - | >,
|
589 + | pub byte_list: ::std::option::Option<crate::model::ByteSet>,
|
707 590 | #[allow(missing_docs)] // documentation missing in model
|
708 - | pub union: ::std::option::Option<crate::model::EnumUnion>,
|
591 + | pub short_list: ::std::option::Option<crate::model::ShortSet>,
|
592 + | #[allow(missing_docs)] // documentation missing in model
|
593 + | pub integer_list: ::std::option::Option<crate::model::IntegerSet>,
|
594 + | #[allow(missing_docs)] // documentation missing in model
|
595 + | pub long_list: ::std::option::Option<crate::model::LongSet>,
|
596 + | #[allow(missing_docs)] // documentation missing in model
|
597 + | pub timestamp_list: ::std::option::Option<crate::model::TimestampSet>,
|
598 + | #[allow(missing_docs)] // documentation missing in model
|
599 + | pub date_time_list: ::std::option::Option<crate::model::DateTimeSet>,
|
600 + | #[allow(missing_docs)] // documentation missing in model
|
601 + | pub http_date_list: ::std::option::Option<crate::model::HttpDateSet>,
|
602 + | #[allow(missing_docs)] // documentation missing in model
|
603 + | pub enum_list: ::std::option::Option<crate::model::FooEnumSet>,
|
604 + | #[allow(missing_docs)] // documentation missing in model
|
605 + | pub int_enum_list: ::std::option::Option<crate::model::IntegerEnumSet>,
|
606 + | #[allow(missing_docs)] // documentation missing in model
|
607 + | pub list_list: ::std::option::Option<crate::model::ListSet>,
|
608 + | #[allow(missing_docs)] // documentation missing in model
|
609 + | pub structure_list: ::std::option::Option<crate::model::StructureSet>,
|
610 + | #[allow(missing_docs)] // documentation missing in model
|
611 + | pub structure_list_with_no_key: ::std::option::Option<crate::model::StructureSetWithNoKey>,
|
612 + | #[allow(missing_docs)] // documentation missing in model
|
613 + | pub union_list: ::std::option::Option<crate::model::UnionSet>,
|
709 614 | }
|
710 - | impl MalformedEnumInput {
|
615 + | impl MalformedUniqueItemsInput {
|
711 616 | #[allow(missing_docs)] // documentation missing in model
|
712 - | pub fn string(&self) -> ::std::option::Option<&crate::model::EnumString> {
|
713 - | self.string.as_ref()
|
617 + | pub fn blob_list(&self) -> ::std::option::Option<&crate::model::BlobSet> {
|
618 + | self.blob_list.as_ref()
|
714 619 | }
|
715 620 | #[allow(missing_docs)] // documentation missing in model
|
716 - | pub fn string_with_enum_trait(&self) -> ::std::option::Option<&crate::model::EnumTraitString> {
|
717 - | self.string_with_enum_trait.as_ref()
|
621 + | pub fn boolean_list(&self) -> ::std::option::Option<&crate::model::BooleanSet> {
|
622 + | self.boolean_list.as_ref()
|
718 623 | }
|
719 624 | #[allow(missing_docs)] // documentation missing in model
|
720 - | pub fn list(&self) -> ::std::option::Option<&[crate::model::EnumString]> {
|
721 - | self.list.as_deref()
|
625 + | pub fn string_list(&self) -> ::std::option::Option<&crate::model::StringSet> {
|
626 + | self.string_list.as_ref()
|
722 627 | }
|
723 628 | #[allow(missing_docs)] // documentation missing in model
|
724 - | pub fn map(
|
725 - | &self,
|
726 - | ) -> ::std::option::Option<
|
727 - | &::std::collections::HashMap<crate::model::EnumString, crate::model::EnumString>,
|
728 - | > {
|
729 - | self.map.as_ref()
|
629 + | pub fn byte_list(&self) -> ::std::option::Option<&crate::model::ByteSet> {
|
630 + | self.byte_list.as_ref()
|
730 631 | }
|
731 632 | #[allow(missing_docs)] // documentation missing in model
|
732 - | pub fn union(&self) -> ::std::option::Option<&crate::model::EnumUnion> {
|
633 + | pub fn short_list(&self) -> ::std::option::Option<&crate::model::ShortSet> {
|
634 + | self.short_list.as_ref()
|
635 + | }
|
636 + | #[allow(missing_docs)] // documentation missing in model
|
637 + | pub fn integer_list(&self) -> ::std::option::Option<&crate::model::IntegerSet> {
|
638 + | self.integer_list.as_ref()
|
639 + | }
|
640 + | #[allow(missing_docs)] // documentation missing in model
|
641 + | pub fn long_list(&self) -> ::std::option::Option<&crate::model::LongSet> {
|
642 + | self.long_list.as_ref()
|
643 + | }
|
644 + | #[allow(missing_docs)] // documentation missing in model
|
645 + | pub fn timestamp_list(&self) -> ::std::option::Option<&crate::model::TimestampSet> {
|
646 + | self.timestamp_list.as_ref()
|
647 + | }
|
648 + | #[allow(missing_docs)] // documentation missing in model
|
649 + | pub fn date_time_list(&self) -> ::std::option::Option<&crate::model::DateTimeSet> {
|
650 + | self.date_time_list.as_ref()
|
651 + | }
|
652 + | #[allow(missing_docs)] // documentation missing in model
|
653 + | pub fn http_date_list(&self) -> ::std::option::Option<&crate::model::HttpDateSet> {
|
654 + | self.http_date_list.as_ref()
|
655 + | }
|
656 + | #[allow(missing_docs)] // documentation missing in model
|
657 + | pub fn enum_list(&self) -> ::std::option::Option<&crate::model::FooEnumSet> {
|
658 + | self.enum_list.as_ref()
|
659 + | }
|
660 + | #[allow(missing_docs)] // documentation missing in model
|
661 + | pub fn int_enum_list(&self) -> ::std::option::Option<&crate::model::IntegerEnumSet> {
|
662 + | self.int_enum_list.as_ref()
|
663 + | }
|
664 + | #[allow(missing_docs)] // documentation missing in model
|
665 + | pub fn list_list(&self) -> ::std::option::Option<&crate::model::ListSet> {
|
666 + | self.list_list.as_ref()
|
667 + | }
|
668 + | #[allow(missing_docs)] // documentation missing in model
|
669 + | pub fn structure_list(&self) -> ::std::option::Option<&crate::model::StructureSet> {
|
670 + | self.structure_list.as_ref()
|
671 + | }
|
672 + | #[allow(missing_docs)] // documentation missing in model
|
673 + | pub fn structure_list_with_no_key(
|
674 + | &self,
|
675 + | ) -> ::std::option::Option<&crate::model::StructureSetWithNoKey> {
|
676 + | self.structure_list_with_no_key.as_ref()
|
677 + | }
|
678 + | #[allow(missing_docs)] // documentation missing in model
|
679 + | pub fn union_list(&self) -> ::std::option::Option<&crate::model::UnionSet> {
|
680 + | self.union_list.as_ref()
|
681 + | }
|
682 + | }
|
683 + | impl MalformedUniqueItemsInput {
|
684 + | /// Creates a new builder-style object to manufacture [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
|
685 + | pub fn builder() -> crate::input::malformed_unique_items_input::Builder {
|
686 + | crate::input::malformed_unique_items_input::Builder::default()
|
687 + | }
|
688 + | }
|
689 + | impl crate::constrained::Constrained for crate::input::MalformedUniqueItemsInput {
|
690 + | type Unconstrained = crate::input::malformed_unique_items_input::Builder;
|
691 + | }
|
692 + |
|
693 + | #[allow(missing_docs)] // documentation missing in model
|
694 + | #[derive(
|
695 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
696 + | )]
|
697 + | pub struct RecursiveStructuresInput {
|
698 + | #[allow(missing_docs)] // documentation missing in model
|
699 + | pub union: ::std::option::Option<crate::model::RecursiveUnionOne>,
|
700 + | }
|
701 + | impl RecursiveStructuresInput {
|
702 + | #[allow(missing_docs)] // documentation missing in model
|
703 + | pub fn union(&self) -> ::std::option::Option<&crate::model::RecursiveUnionOne> {
|
733 704 | self.union.as_ref()
|
734 705 | }
|
735 706 | }
|
736 - | impl MalformedEnumInput {
|
737 - | /// Creates a new builder-style object to manufacture [`MalformedEnumInput`](crate::input::MalformedEnumInput).
|
738 - | pub fn builder() -> crate::input::malformed_enum_input::Builder {
|
739 - | crate::input::malformed_enum_input::Builder::default()
|
707 + | impl RecursiveStructuresInput {
|
708 + | /// Creates a new builder-style object to manufacture [`RecursiveStructuresInput`](crate::input::RecursiveStructuresInput).
|
709 + | pub fn builder() -> crate::input::recursive_structures_input::Builder {
|
710 + | crate::input::recursive_structures_input::Builder::default()
|
740 711 | }
|
741 712 | }
|
742 - | impl crate::constrained::Constrained for crate::input::MalformedEnumInput {
|
743 - | type Unconstrained = crate::input::malformed_enum_input::Builder;
|
713 + | impl crate::constrained::Constrained for crate::input::RecursiveStructuresInput {
|
714 + | type Unconstrained = crate::input::recursive_structures_input::Builder;
|
744 715 | }
|
745 - | /// See [`SensitiveValidationInput`](crate::input::SensitiveValidationInput).
|
746 - | pub mod sensitive_validation_input {
|
716 + |
|
717 + | #[allow(missing_docs)] // documentation missing in model
|
718 + | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::hash::Hash)]
|
719 + | pub struct SensitiveValidationInput {
|
720 + | #[allow(missing_docs)] // documentation missing in model
|
721 + | pub string: ::std::option::Option<crate::model::SensitivePatternString>,
|
722 + | }
|
723 + | impl SensitiveValidationInput {
|
724 + | #[allow(missing_docs)] // documentation missing in model
|
725 + | pub fn string(&self) -> ::std::option::Option<&crate::model::SensitivePatternString> {
|
726 + | self.string.as_ref()
|
727 + | }
|
728 + | }
|
729 + | impl ::std::fmt::Debug for SensitiveValidationInput {
|
730 + | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
731 + | let mut formatter = f.debug_struct("SensitiveValidationInput");
|
732 + | formatter.field("string", &"*** Sensitive Data Redacted ***");
|
733 + | formatter.finish()
|
734 + | }
|
735 + | }
|
736 + | impl SensitiveValidationInput {
|
737 + | /// Creates a new builder-style object to manufacture [`SensitiveValidationInput`](crate::input::SensitiveValidationInput).
|
738 + | pub fn builder() -> crate::input::sensitive_validation_input::Builder {
|
739 + | crate::input::sensitive_validation_input::Builder::default()
|
740 + | }
|
741 + | }
|
742 + | impl crate::constrained::Constrained for crate::input::SensitiveValidationInput {
|
743 + | type Unconstrained = crate::input::sensitive_validation_input::Builder;
|
744 + | }
|
745 + |
|
746 + | /// See [`MalformedEnumInput`](crate::input::MalformedEnumInput).
|
747 + | pub mod malformed_enum_input {
|
747 748 |
|
748 749 | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
749 750 | /// Holds one variant for each of the ways the builder can fail.
|
750 751 | #[non_exhaustive]
|
751 752 | #[allow(clippy::enum_variant_names)]
|
752 753 | pub enum ConstraintViolation {
|
753 - | /// Constraint violation occurred building member `string` when building `SensitiveValidationInput`.
|
754 + | /// Constraint violation occurred building member `string` when building `MalformedEnumInput`.
|
754 755 | #[doc(hidden)]
|
755 - | String(crate::model::sensitive_pattern_string::ConstraintViolation),
|
756 + | String(crate::model::enum_string::ConstraintViolation),
|
757 + | /// Constraint violation occurred building member `string_with_enum_trait` when building `MalformedEnumInput`.
|
758 + | #[doc(hidden)]
|
759 + | StringWithEnumTrait(crate::model::enum_trait_string::ConstraintViolation),
|
760 + | /// Constraint violation occurred building member `list` when building `MalformedEnumInput`.
|
761 + | #[doc(hidden)]
|
762 + | List(crate::model::enum_list::ConstraintViolation),
|
763 + | /// Constraint violation occurred building member `map` when building `MalformedEnumInput`.
|
764 + | #[doc(hidden)]
|
765 + | Map(crate::model::enum_map::ConstraintViolation),
|
766 + | /// Constraint violation occurred building member `union` when building `MalformedEnumInput`.
|
767 + | #[doc(hidden)]
|
768 + | Union(crate::model::enum_union::ConstraintViolation),
|
756 769 | }
|
757 770 | impl ::std::fmt::Display for ConstraintViolation {
|
758 771 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
759 772 | match self {
|
760 - | ConstraintViolation::String(_) => write!(f, "constraint violation occurred building member `string` when building `SensitiveValidationInput`"),
|
773 + | ConstraintViolation::String(_) => write!(f, "constraint violation occurred building member `string` when building `MalformedEnumInput`"),
|
774 + | ConstraintViolation::StringWithEnumTrait(_) => write!(f, "constraint violation occurred building member `string_with_enum_trait` when building `MalformedEnumInput`"),
|
775 + | ConstraintViolation::List(_) => write!(f, "constraint violation occurred building member `list` when building `MalformedEnumInput`"),
|
776 + | ConstraintViolation::Map(_) => write!(f, "constraint violation occurred building member `map` when building `MalformedEnumInput`"),
|
777 + | ConstraintViolation::Union(_) => write!(f, "constraint violation occurred building member `union` when building `MalformedEnumInput`"),
|
761 778 | }
|
762 779 | }
|
763 780 | }
|
764 781 | impl ::std::error::Error for ConstraintViolation {}
|
765 782 | impl ConstraintViolation {
|
766 783 | pub(crate) fn as_validation_exception_field(
|
767 784 | self,
|
768 785 | path: ::std::string::String,
|
769 786 | ) -> crate::model::ValidationExceptionField {
|
770 787 | match self {
|
771 788 | ConstraintViolation::String(inner) => {
|
772 789 | inner.as_validation_exception_field(path + "/string")
|
773 790 | }
|
791 + | ConstraintViolation::StringWithEnumTrait(inner) => {
|
792 + | inner.as_validation_exception_field(path + "/stringWithEnumTrait")
|
793 + | }
|
794 + | ConstraintViolation::List(inner) => {
|
795 + | inner.as_validation_exception_field(path + "/list")
|
796 + | }
|
797 + | ConstraintViolation::Map(inner) => {
|
798 + | inner.as_validation_exception_field(path + "/map")
|
799 + | }
|
800 + | ConstraintViolation::Union(inner) => {
|
801 + | inner.as_validation_exception_field(path + "/union")
|
802 + | }
|
774 803 | }
|
775 804 | }
|
776 805 | }
|
777 806 | impl ::std::convert::From<ConstraintViolation>
|
778 807 | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
779 808 | {
|
780 809 | fn from(constraint_violation: ConstraintViolation) -> Self {
|
781 810 | let first_validation_exception_field =
|
782 811 | constraint_violation.as_validation_exception_field("".to_owned());
|
783 812 | let validation_exception = crate::error::ValidationException {
|
784 813 | message: format!(
|
785 814 | "1 validation error detected. {}",
|
786 815 | &first_validation_exception_field.message
|
787 816 | ),
|
788 817 | field_list: Some(vec![first_validation_exception_field]),
|
789 818 | };
|
790 819 | Self::ConstraintViolation(
|
791 820 | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
792 821 | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
793 822 | )
|
794 823 | }
|
795 824 | }
|
796 825 | impl ::std::convert::From<Builder>
|
797 - | for crate::constrained::MaybeConstrained<crate::input::SensitiveValidationInput>
|
826 + | for crate::constrained::MaybeConstrained<crate::input::MalformedEnumInput>
|
798 827 | {
|
799 828 | fn from(builder: Builder) -> Self {
|
800 829 | Self::Unconstrained(builder)
|
801 830 | }
|
802 831 | }
|
803 - | impl ::std::convert::TryFrom<Builder> for crate::input::SensitiveValidationInput {
|
832 + | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedEnumInput {
|
804 833 | type Error = ConstraintViolation;
|
805 834 |
|
806 835 | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
807 836 | builder.build()
|
808 837 | }
|
809 838 | }
|
810 - | /// A builder for [`SensitiveValidationInput`](crate::input::SensitiveValidationInput).
|
811 - | #[derive(::std::clone::Clone, ::std::default::Default)]
|
839 + | /// A builder for [`MalformedEnumInput`](crate::input::MalformedEnumInput).
|
840 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
812 841 | pub struct Builder {
|
813 - | pub(crate) string: ::std::option::Option<
|
814 - | crate::constrained::MaybeConstrained<crate::model::SensitivePatternString>,
|
842 + | pub(crate) string:
|
843 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::EnumString>>,
|
844 + | pub(crate) string_with_enum_trait: ::std::option::Option<
|
845 + | crate::constrained::MaybeConstrained<crate::model::EnumTraitString>,
|
846 + | >,
|
847 + | pub(crate) list: ::std::option::Option<
|
848 + | crate::constrained::MaybeConstrained<
|
849 + | crate::constrained::enum_list_constrained::EnumListConstrained,
|
850 + | >,
|
851 + | >,
|
852 + | pub(crate) map: ::std::option::Option<
|
853 + | crate::constrained::MaybeConstrained<
|
854 + | crate::constrained::enum_map_constrained::EnumMapConstrained,
|
855 + | >,
|
815 856 | >,
|
857 + | pub(crate) union:
|
858 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::EnumUnion>>,
|
816 859 | }
|
817 860 | impl Builder {
|
818 861 | #[allow(missing_docs)] // documentation missing in model
|
819 - | pub fn string(
|
820 - | mut self,
|
821 - | input: ::std::option::Option<crate::model::SensitivePatternString>,
|
822 - | ) -> Self {
|
862 + | pub fn string(mut self, input: ::std::option::Option<crate::model::EnumString>) -> Self {
|
823 863 | self.string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
824 864 | self
|
825 865 | }
|
826 866 | #[allow(missing_docs)] // documentation missing in model
|
827 867 | pub(crate) fn set_string(
|
828 868 | mut self,
|
829 869 | input: Option<
|
830 870 | impl ::std::convert::Into<
|
831 - | crate::constrained::MaybeConstrained<crate::model::SensitivePatternString>,
|
871 + | crate::constrained::MaybeConstrained<crate::model::EnumString>,
|
832 872 | >,
|
833 873 | >,
|
834 874 | ) -> Self {
|
835 875 | self.string = input.map(|v| v.into());
|
836 876 | self
|
837 877 | }
|
838 - | /// Consumes the builder and constructs a [`SensitiveValidationInput`](crate::input::SensitiveValidationInput).
|
839 - | ///
|
840 - | /// The builder fails to construct a [`SensitiveValidationInput`](crate::input::SensitiveValidationInput) if a [`ConstraintViolation`] occurs.
|
841 - | ///
|
842 - | pub fn build(self) -> Result<crate::input::SensitiveValidationInput, ConstraintViolation> {
|
843 - | self.build_enforcing_all_constraints()
|
844 - | }
|
845 - | fn build_enforcing_all_constraints(
|
846 - | self,
|
847 - | ) -> Result<crate::input::SensitiveValidationInput, ConstraintViolation> {
|
848 - | Ok(crate::input::SensitiveValidationInput {
|
849 - | string: self
|
850 - | .string
|
851 - | .map(|v| match v {
|
852 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
853 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
854 - | })
|
855 - | .map(|res| res.map_err(ConstraintViolation::String))
|
856 - | .transpose()?,
|
857 - | })
|
878 + | #[allow(missing_docs)] // documentation missing in model
|
879 + | pub fn string_with_enum_trait(
|
880 + | mut self,
|
881 + | input: ::std::option::Option<crate::model::EnumTraitString>,
|
882 + | ) -> Self {
|
883 + | self.string_with_enum_trait =
|
884 + | input.map(crate::constrained::MaybeConstrained::Constrained);
|
885 + | self
|
858 886 | }
|
859 - | }
|
860 - | impl ::std::fmt::Debug for Builder {
|
861 - | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
862 - | let mut formatter = f.debug_struct("Builder");
|
863 - | formatter.field("string", &"*** Sensitive Data Redacted ***");
|
864 - | formatter.finish()
|
887 + | #[allow(missing_docs)] // documentation missing in model
|
888 + | pub(crate) fn set_string_with_enum_trait(
|
889 + | mut self,
|
890 + | input: Option<
|
891 + | impl ::std::convert::Into<
|
892 + | crate::constrained::MaybeConstrained<crate::model::EnumTraitString>,
|
893 + | >,
|
894 + | >,
|
895 + | ) -> Self {
|
896 + | self.string_with_enum_trait = input.map(|v| v.into());
|
897 + | self
|
865 898 | }
|
866 - | }
|
867 - | }
|
868 - | /// See [`RecursiveStructuresInput`](crate::input::RecursiveStructuresInput).
|
869 - | pub mod recursive_structures_input {
|
870 - |
|
871 - | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
872 - | /// Holds one variant for each of the ways the builder can fail.
|
873 - | #[non_exhaustive]
|
874 - | #[allow(clippy::enum_variant_names)]
|
875 - | pub enum ConstraintViolation {
|
876 - | /// Constraint violation occurred building member `union` when building `RecursiveStructuresInput`.
|
877 - | #[doc(hidden)]
|
878 - | Union(crate::model::recursive_union_one::ConstraintViolation),
|
879 - | }
|
880 - | impl ::std::fmt::Display for ConstraintViolation {
|
881 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
882 - | match self {
|
883 - | ConstraintViolation::Union(_) => write!(f, "constraint violation occurred building member `union` when building `RecursiveStructuresInput`"),
|
884 - | }
|
899 + | #[allow(missing_docs)] // documentation missing in model
|
900 + | pub fn list(
|
901 + | mut self,
|
902 + | input: ::std::option::Option<::std::vec::Vec<crate::model::EnumString>>,
|
903 + | ) -> Self {
|
904 + | self.list =
|
905 + | input.map(|v| crate::constrained::MaybeConstrained::Constrained((v).into()));
|
906 + | self
|
885 907 | }
|
886 - | }
|
887 - | impl ::std::error::Error for ConstraintViolation {}
|
888 - | impl ConstraintViolation {
|
889 - | pub(crate) fn as_validation_exception_field(
|
890 - | self,
|
891 - | path: ::std::string::String,
|
892 - | ) -> crate::model::ValidationExceptionField {
|
893 - | match self {
|
894 - | ConstraintViolation::Union(inner) => {
|
895 - | inner.as_validation_exception_field(path + "/union")
|
896 - | }
|
897 - | }
|
898 - | }
|
899 - | }
|
900 - | impl ::std::convert::From<ConstraintViolation>
|
901 - | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
902 - | {
|
903 - | fn from(constraint_violation: ConstraintViolation) -> Self {
|
904 - | let first_validation_exception_field =
|
905 - | constraint_violation.as_validation_exception_field("".to_owned());
|
906 - | let validation_exception = crate::error::ValidationException {
|
907 - | message: format!(
|
908 - | "1 validation error detected. {}",
|
909 - | &first_validation_exception_field.message
|
910 - | ),
|
911 - | field_list: Some(vec![first_validation_exception_field]),
|
912 - | };
|
913 - | Self::ConstraintViolation(
|
914 - | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
915 - | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
916 - | )
|
917 - | }
|
918 - | }
|
919 - | impl ::std::convert::From<Builder>
|
920 - | for crate::constrained::MaybeConstrained<crate::input::RecursiveStructuresInput>
|
921 - | {
|
922 - | fn from(builder: Builder) -> Self {
|
923 - | Self::Unconstrained(builder)
|
908 + | #[allow(missing_docs)] // documentation missing in model
|
909 + | pub(crate) fn set_list(
|
910 + | mut self,
|
911 + | input: Option<
|
912 + | impl ::std::convert::Into<
|
913 + | crate::constrained::MaybeConstrained<
|
914 + | crate::constrained::enum_list_constrained::EnumListConstrained,
|
915 + | >,
|
916 + | >,
|
917 + | >,
|
918 + | ) -> Self {
|
919 + | self.list = input.map(|v| v.into());
|
920 + | self
|
924 921 | }
|
925 - | }
|
926 - | impl ::std::convert::TryFrom<Builder> for crate::input::RecursiveStructuresInput {
|
927 - | type Error = ConstraintViolation;
|
928 - |
|
929 - | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
930 - | builder.build()
|
922 + | #[allow(missing_docs)] // documentation missing in model
|
923 + | pub fn map(
|
924 + | mut self,
|
925 + | input: ::std::option::Option<
|
926 + | ::std::collections::HashMap<crate::model::EnumString, crate::model::EnumString>,
|
927 + | >,
|
928 + | ) -> Self {
|
929 + | self.map = input.map(|v| crate::constrained::MaybeConstrained::Constrained((v).into()));
|
930 + | self
|
931 931 | }
|
932 - | }
|
933 - | /// A builder for [`RecursiveStructuresInput`](crate::input::RecursiveStructuresInput).
|
934 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
935 - | pub struct Builder {
|
936 - | pub(crate) union: ::std::option::Option<
|
937 - | crate::constrained::MaybeConstrained<crate::model::RecursiveUnionOne>,
|
938 - | >,
|
939 - | }
|
940 - | impl Builder {
|
941 932 | #[allow(missing_docs)] // documentation missing in model
|
942 - | pub fn union(
|
933 + | pub(crate) fn set_map(
|
943 934 | mut self,
|
944 - | input: ::std::option::Option<crate::model::RecursiveUnionOne>,
|
935 + | input: Option<
|
936 + | impl ::std::convert::Into<
|
937 + | crate::constrained::MaybeConstrained<
|
938 + | crate::constrained::enum_map_constrained::EnumMapConstrained,
|
939 + | >,
|
940 + | >,
|
941 + | >,
|
945 942 | ) -> Self {
|
943 + | self.map = input.map(|v| v.into());
|
944 + | self
|
945 + | }
|
946 + | #[allow(missing_docs)] // documentation missing in model
|
947 + | pub fn union(mut self, input: ::std::option::Option<crate::model::EnumUnion>) -> Self {
|
946 948 | self.union = input.map(crate::constrained::MaybeConstrained::Constrained);
|
947 949 | self
|
948 950 | }
|
949 951 | #[allow(missing_docs)] // documentation missing in model
|
950 952 | pub(crate) fn set_union(
|
951 953 | mut self,
|
952 954 | input: Option<
|
953 - | impl ::std::convert::Into<
|
954 - | crate::constrained::MaybeConstrained<crate::model::RecursiveUnionOne>,
|
955 - | >,
|
955 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::EnumUnion>>,
|
956 956 | >,
|
957 957 | ) -> Self {
|
958 958 | self.union = input.map(|v| v.into());
|
959 959 | self
|
960 960 | }
|
961 - | /// Consumes the builder and constructs a [`RecursiveStructuresInput`](crate::input::RecursiveStructuresInput).
|
961 + | /// Consumes the builder and constructs a [`MalformedEnumInput`](crate::input::MalformedEnumInput).
|
962 962 | ///
|
963 - | /// The builder fails to construct a [`RecursiveStructuresInput`](crate::input::RecursiveStructuresInput) if a [`ConstraintViolation`] occurs.
|
963 + | /// The builder fails to construct a [`MalformedEnumInput`](crate::input::MalformedEnumInput) if a [`ConstraintViolation`] occurs.
|
964 964 | ///
|
965 - | pub fn build(self) -> Result<crate::input::RecursiveStructuresInput, ConstraintViolation> {
|
965 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
966 + | pub fn build(self) -> Result<crate::input::MalformedEnumInput, ConstraintViolation> {
|
966 967 | self.build_enforcing_all_constraints()
|
967 968 | }
|
968 969 | fn build_enforcing_all_constraints(
|
969 970 | self,
|
970 - | ) -> Result<crate::input::RecursiveStructuresInput, ConstraintViolation> {
|
971 - | Ok(crate::input::RecursiveStructuresInput {
|
971 + | ) -> Result<crate::input::MalformedEnumInput, ConstraintViolation> {
|
972 + | Ok(crate::input::MalformedEnumInput {
|
973 + | string: self
|
974 + | .string
|
975 + | .map(|v| match v {
|
976 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
977 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
978 + | })
|
979 + | .map(|res| res.map_err(ConstraintViolation::String))
|
980 + | .transpose()?,
|
981 + | string_with_enum_trait: self
|
982 + | .string_with_enum_trait
|
983 + | .map(|v| match v {
|
984 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
985 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
986 + | })
|
987 + | .map(|res| res.map_err(ConstraintViolation::StringWithEnumTrait))
|
988 + | .transpose()?,
|
989 + | list: self
|
990 + | .list
|
991 + | .map(|v| match v {
|
992 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
993 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
994 + | })
|
995 + | .map(|res| res.map(|v| v.into()).map_err(ConstraintViolation::List))
|
996 + | .transpose()?,
|
997 + | map: self
|
998 + | .map
|
999 + | .map(|v| match v {
|
1000 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1001 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1002 + | })
|
1003 + | .map(|res| res.map(|v| v.into()).map_err(ConstraintViolation::Map))
|
1004 + | .transpose()?,
|
972 1005 | union: self
|
973 1006 | .union
|
974 1007 | .map(|v| match v {
|
975 1008 | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
976 1009 | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
977 1010 | })
|
978 1011 | .map(|res| res.map_err(ConstraintViolation::Union))
|
979 1012 | .transpose()?,
|
980 1013 | })
|
981 1014 | }
|
982 1015 | }
|
983 1016 | }
|
984 - | /// See [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
|
985 - | pub mod malformed_unique_items_input {
|
1017 + | /// See [`MalformedLengthInput`](crate::input::MalformedLengthInput).
|
1018 + | pub mod malformed_length_input {
|
986 1019 |
|
987 1020 | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
988 1021 | /// Holds one variant for each of the ways the builder can fail.
|
989 1022 | #[non_exhaustive]
|
990 1023 | #[allow(clippy::enum_variant_names)]
|
991 1024 | pub enum ConstraintViolation {
|
992 - | /// Constraint violation occurred building member `blob_list` when building `MalformedUniqueItemsInput`.
|
993 - | #[doc(hidden)]
|
994 - | BlobList(crate::model::blob_set::ConstraintViolation),
|
995 - | /// Constraint violation occurred building member `boolean_list` when building `MalformedUniqueItemsInput`.
|
996 - | #[doc(hidden)]
|
997 - | BooleanList(crate::model::boolean_set::ConstraintViolation),
|
998 - | /// Constraint violation occurred building member `string_list` when building `MalformedUniqueItemsInput`.
|
999 - | #[doc(hidden)]
|
1000 - | StringList(crate::model::string_set::ConstraintViolation),
|
1001 - | /// Constraint violation occurred building member `byte_list` when building `MalformedUniqueItemsInput`.
|
1002 - | #[doc(hidden)]
|
1003 - | ByteList(crate::model::byte_set::ConstraintViolation),
|
1004 - | /// Constraint violation occurred building member `short_list` when building `MalformedUniqueItemsInput`.
|
1005 - | #[doc(hidden)]
|
1006 - | ShortList(crate::model::short_set::ConstraintViolation),
|
1007 - | /// Constraint violation occurred building member `integer_list` when building `MalformedUniqueItemsInput`.
|
1008 - | #[doc(hidden)]
|
1009 - | IntegerList(crate::model::integer_set::ConstraintViolation),
|
1010 - | /// Constraint violation occurred building member `long_list` when building `MalformedUniqueItemsInput`.
|
1011 - | #[doc(hidden)]
|
1012 - | LongList(crate::model::long_set::ConstraintViolation),
|
1013 - | /// Constraint violation occurred building member `timestamp_list` when building `MalformedUniqueItemsInput`.
|
1014 - | #[doc(hidden)]
|
1015 - | TimestampList(crate::model::timestamp_set::ConstraintViolation),
|
1016 - | /// Constraint violation occurred building member `date_time_list` when building `MalformedUniqueItemsInput`.
|
1017 - | #[doc(hidden)]
|
1018 - | DateTimeList(crate::model::date_time_set::ConstraintViolation),
|
1019 - | /// Constraint violation occurred building member `http_date_list` when building `MalformedUniqueItemsInput`.
|
1020 - | #[doc(hidden)]
|
1021 - | HttpDateList(crate::model::http_date_set::ConstraintViolation),
|
1022 - | /// Constraint violation occurred building member `enum_list` when building `MalformedUniqueItemsInput`.
|
1025 + | /// Constraint violation occurred building member `blob` when building `MalformedLengthInput`.
|
1023 1026 | #[doc(hidden)]
|
1024 - | EnumList(crate::model::foo_enum_set::ConstraintViolation),
|
1025 - | /// Constraint violation occurred building member `int_enum_list` when building `MalformedUniqueItemsInput`.
|
1027 + | Blob(crate::model::length_blob::ConstraintViolation),
|
1028 + | /// Constraint violation occurred building member `string` when building `MalformedLengthInput`.
|
1026 1029 | #[doc(hidden)]
|
1027 - | IntEnumList(crate::model::integer_enum_set::ConstraintViolation),
|
1028 - | /// Constraint violation occurred building member `list_list` when building `MalformedUniqueItemsInput`.
|
1030 + | String(crate::model::length_string::ConstraintViolation),
|
1031 + | /// Constraint violation occurred building member `min_string` when building `MalformedLengthInput`.
|
1029 1032 | #[doc(hidden)]
|
1030 - | ListList(crate::model::list_set::ConstraintViolation),
|
1031 - | /// Constraint violation occurred building member `structure_list` when building `MalformedUniqueItemsInput`.
|
1033 + | MinString(crate::model::min_length_string::ConstraintViolation),
|
1034 + | /// Constraint violation occurred building member `max_string` when building `MalformedLengthInput`.
|
1032 1035 | #[doc(hidden)]
|
1033 - | StructureList(crate::model::structure_set::ConstraintViolation),
|
1034 - | /// Constraint violation occurred building member `structure_list_with_no_key` when building `MalformedUniqueItemsInput`.
|
1036 + | MaxString(crate::model::max_length_string::ConstraintViolation),
|
1037 + | /// Constraint violation occurred building member `list` when building `MalformedLengthInput`.
|
1035 1038 | #[doc(hidden)]
|
1036 - | StructureListWithNoKey(crate::model::structure_set_with_no_key::ConstraintViolation),
|
1037 - | /// Constraint violation occurred building member `union_list` when building `MalformedUniqueItemsInput`.
|
1039 + | List(crate::model::length_list::ConstraintViolation),
|
1040 + | /// Constraint violation occurred building member `map` when building `MalformedLengthInput`.
|
1038 1041 | #[doc(hidden)]
|
1039 - | UnionList(crate::model::union_set::ConstraintViolation),
|
1042 + | Map(crate::model::length_map::ConstraintViolation),
|
1040 1043 | }
|
1041 1044 | impl ::std::fmt::Display for ConstraintViolation {
|
1042 1045 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1043 1046 | match self {
|
1044 - | ConstraintViolation::BlobList(_) => write!(f, "constraint violation occurred building member `blob_list` when building `MalformedUniqueItemsInput`"),
|
1045 - | ConstraintViolation::BooleanList(_) => write!(f, "constraint violation occurred building member `boolean_list` when building `MalformedUniqueItemsInput`"),
|
1046 - | ConstraintViolation::StringList(_) => write!(f, "constraint violation occurred building member `string_list` when building `MalformedUniqueItemsInput`"),
|
1047 - | ConstraintViolation::ByteList(_) => write!(f, "constraint violation occurred building member `byte_list` when building `MalformedUniqueItemsInput`"),
|
1048 - | ConstraintViolation::ShortList(_) => write!(f, "constraint violation occurred building member `short_list` when building `MalformedUniqueItemsInput`"),
|
1049 - | ConstraintViolation::IntegerList(_) => write!(f, "constraint violation occurred building member `integer_list` when building `MalformedUniqueItemsInput`"),
|
1050 - | ConstraintViolation::LongList(_) => write!(f, "constraint violation occurred building member `long_list` when building `MalformedUniqueItemsInput`"),
|
1051 - | ConstraintViolation::TimestampList(_) => write!(f, "constraint violation occurred building member `timestamp_list` when building `MalformedUniqueItemsInput`"),
|
1052 - | ConstraintViolation::DateTimeList(_) => write!(f, "constraint violation occurred building member `date_time_list` when building `MalformedUniqueItemsInput`"),
|
1053 - | ConstraintViolation::HttpDateList(_) => write!(f, "constraint violation occurred building member `http_date_list` when building `MalformedUniqueItemsInput`"),
|
1054 - | ConstraintViolation::EnumList(_) => write!(f, "constraint violation occurred building member `enum_list` when building `MalformedUniqueItemsInput`"),
|
1055 - | ConstraintViolation::IntEnumList(_) => write!(f, "constraint violation occurred building member `int_enum_list` when building `MalformedUniqueItemsInput`"),
|
1056 - | ConstraintViolation::ListList(_) => write!(f, "constraint violation occurred building member `list_list` when building `MalformedUniqueItemsInput`"),
|
1057 - | ConstraintViolation::StructureList(_) => write!(f, "constraint violation occurred building member `structure_list` when building `MalformedUniqueItemsInput`"),
|
1058 - | ConstraintViolation::StructureListWithNoKey(_) => write!(f, "constraint violation occurred building member `structure_list_with_no_key` when building `MalformedUniqueItemsInput`"),
|
1059 - | ConstraintViolation::UnionList(_) => write!(f, "constraint violation occurred building member `union_list` when building `MalformedUniqueItemsInput`"),
|
1047 + | ConstraintViolation::Blob(_) => write!(f, "constraint violation occurred building member `blob` when building `MalformedLengthInput`"),
|
1048 + | ConstraintViolation::String(_) => write!(f, "constraint violation occurred building member `string` when building `MalformedLengthInput`"),
|
1049 + | ConstraintViolation::MinString(_) => write!(f, "constraint violation occurred building member `min_string` when building `MalformedLengthInput`"),
|
1050 + | ConstraintViolation::MaxString(_) => write!(f, "constraint violation occurred building member `max_string` when building `MalformedLengthInput`"),
|
1051 + | ConstraintViolation::List(_) => write!(f, "constraint violation occurred building member `list` when building `MalformedLengthInput`"),
|
1052 + | ConstraintViolation::Map(_) => write!(f, "constraint violation occurred building member `map` when building `MalformedLengthInput`"),
|
1060 1053 | }
|
1061 1054 | }
|
1062 1055 | }
|
1063 1056 | impl ::std::error::Error for ConstraintViolation {}
|
1064 1057 | impl ConstraintViolation {
|
1065 1058 | pub(crate) fn as_validation_exception_field(
|
1066 1059 | self,
|
1067 1060 | path: ::std::string::String,
|
1068 1061 | ) -> crate::model::ValidationExceptionField {
|
1069 1062 | match self {
|
1070 - | ConstraintViolation::BlobList(inner) => {
|
1071 - | inner.as_validation_exception_field(path + "/blobList")
|
1072 - | }
|
1073 - | ConstraintViolation::BooleanList(inner) => {
|
1074 - | inner.as_validation_exception_field(path + "/booleanList")
|
1075 - | }
|
1076 - | ConstraintViolation::StringList(inner) => {
|
1077 - | inner.as_validation_exception_field(path + "/stringList")
|
1078 - | }
|
1079 - | ConstraintViolation::ByteList(inner) => {
|
1080 - | inner.as_validation_exception_field(path + "/byteList")
|
1081 - | }
|
1082 - | ConstraintViolation::ShortList(inner) => {
|
1083 - | inner.as_validation_exception_field(path + "/shortList")
|
1084 - | }
|
1085 - | ConstraintViolation::IntegerList(inner) => {
|
1086 - | inner.as_validation_exception_field(path + "/integerList")
|
1063 + | ConstraintViolation::Blob(inner) => {
|
1064 + | inner.as_validation_exception_field(path + "/blob")
|
1087 1065 | }
|
1088 - | ConstraintViolation::LongList(inner) => {
|
1089 - | inner.as_validation_exception_field(path + "/longList")
|
1066 + | ConstraintViolation::String(inner) => {
|
1067 + | inner.as_validation_exception_field(path + "/string")
|
1090 1068 | }
|
1091 - | ConstraintViolation::TimestampList(inner) => {
|
1092 - | inner.as_validation_exception_field(path + "/timestampList")
|
1069 + | ConstraintViolation::MinString(inner) => {
|
1070 + | inner.as_validation_exception_field(path + "/minString")
|
1093 1071 | }
|
1094 - | ConstraintViolation::DateTimeList(inner) => {
|
1095 - | inner.as_validation_exception_field(path + "/dateTimeList")
|
1072 + | ConstraintViolation::MaxString(inner) => {
|
1073 + | inner.as_validation_exception_field(path + "/maxString")
|
1096 1074 | }
|
1097 - | ConstraintViolation::HttpDateList(inner) => {
|
1098 - | inner.as_validation_exception_field(path + "/httpDateList")
|
1075 + | ConstraintViolation::List(inner) => {
|
1076 + | inner.as_validation_exception_field(path + "/list")
|
1099 1077 | }
|
1100 - | ConstraintViolation::EnumList(inner) => {
|
1101 - | inner.as_validation_exception_field(path + "/enumList")
|
1102 - | }
|
1103 - | ConstraintViolation::IntEnumList(inner) => {
|
1104 - | inner.as_validation_exception_field(path + "/intEnumList")
|
1105 - | }
|
1106 - | ConstraintViolation::ListList(inner) => {
|
1107 - | inner.as_validation_exception_field(path + "/listList")
|
1108 - | }
|
1109 - | ConstraintViolation::StructureList(inner) => {
|
1110 - | inner.as_validation_exception_field(path + "/structureList")
|
1111 - | }
|
1112 - | ConstraintViolation::StructureListWithNoKey(inner) => {
|
1113 - | inner.as_validation_exception_field(path + "/structureListWithNoKey")
|
1114 - | }
|
1115 - | ConstraintViolation::UnionList(inner) => {
|
1116 - | inner.as_validation_exception_field(path + "/unionList")
|
1078 + | ConstraintViolation::Map(inner) => {
|
1079 + | inner.as_validation_exception_field(path + "/map")
|
1117 1080 | }
|
1118 1081 | }
|
1119 1082 | }
|
1120 1083 | }
|
1121 1084 | impl ::std::convert::From<ConstraintViolation>
|
1122 1085 | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
1123 1086 | {
|
1124 1087 | fn from(constraint_violation: ConstraintViolation) -> Self {
|
1125 1088 | let first_validation_exception_field =
|
1126 1089 | constraint_violation.as_validation_exception_field("".to_owned());
|
1127 1090 | let validation_exception = crate::error::ValidationException {
|
1128 1091 | message: format!(
|
1129 1092 | "1 validation error detected. {}",
|
1130 1093 | &first_validation_exception_field.message
|
1131 1094 | ),
|
1132 1095 | field_list: Some(vec![first_validation_exception_field]),
|
1133 1096 | };
|
1134 1097 | Self::ConstraintViolation(
|
1135 1098 | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
1136 1099 | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
1137 1100 | )
|
1138 1101 | }
|
1139 1102 | }
|
1140 1103 | impl ::std::convert::From<Builder>
|
1141 - | for crate::constrained::MaybeConstrained<crate::input::MalformedUniqueItemsInput>
|
1104 + | for crate::constrained::MaybeConstrained<crate::input::MalformedLengthInput>
|
1142 1105 | {
|
1143 1106 | fn from(builder: Builder) -> Self {
|
1144 1107 | Self::Unconstrained(builder)
|
1145 1108 | }
|
1146 1109 | }
|
1147 - | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedUniqueItemsInput {
|
1110 + | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedLengthInput {
|
1148 1111 | type Error = ConstraintViolation;
|
1149 1112 |
|
1150 1113 | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
1151 1114 | builder.build()
|
1152 1115 | }
|
1153 1116 | }
|
1154 - | /// A builder for [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
|
1117 + | /// A builder for [`MalformedLengthInput`](crate::input::MalformedLengthInput).
|
1155 1118 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1156 1119 | pub struct Builder {
|
1157 - | pub(crate) blob_list:
|
1158 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::BlobSet>>,
|
1159 - | pub(crate) boolean_list:
|
1160 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::BooleanSet>>,
|
1161 - | pub(crate) string_list:
|
1162 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::StringSet>>,
|
1163 - | pub(crate) byte_list:
|
1164 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::ByteSet>>,
|
1165 - | pub(crate) short_list:
|
1166 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::ShortSet>>,
|
1167 - | pub(crate) integer_list:
|
1168 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::IntegerSet>>,
|
1169 - | pub(crate) long_list:
|
1170 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::LongSet>>,
|
1171 - | pub(crate) timestamp_list:
|
1172 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::TimestampSet>>,
|
1173 - | pub(crate) date_time_list:
|
1174 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::DateTimeSet>>,
|
1175 - | pub(crate) http_date_list:
|
1176 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::HttpDateSet>>,
|
1177 - | pub(crate) enum_list:
|
1178 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::FooEnumSet>>,
|
1179 - | pub(crate) int_enum_list: ::std::option::Option<
|
1180 - | crate::constrained::MaybeConstrained<crate::model::IntegerEnumSet>,
|
1120 + | pub(crate) blob:
|
1121 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::LengthBlob>>,
|
1122 + | pub(crate) string:
|
1123 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::LengthString>>,
|
1124 + | pub(crate) min_string: ::std::option::Option<
|
1125 + | crate::constrained::MaybeConstrained<crate::model::MinLengthString>,
|
1181 1126 | >,
|
1182 - | pub(crate) list_list:
|
1183 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::ListSet>>,
|
1184 - | pub(crate) structure_list:
|
1185 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::StructureSet>>,
|
1186 - | pub(crate) structure_list_with_no_key: ::std::option::Option<
|
1187 - | crate::constrained::MaybeConstrained<crate::model::StructureSetWithNoKey>,
|
1127 + | pub(crate) max_string: ::std::option::Option<
|
1128 + | crate::constrained::MaybeConstrained<crate::model::MaxLengthString>,
|
1188 1129 | >,
|
1189 - | pub(crate) union_list:
|
1190 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::UnionSet>>,
|
1130 + | pub(crate) list:
|
1131 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::LengthList>>,
|
1132 + | pub(crate) map:
|
1133 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::LengthMap>>,
|
1191 1134 | }
|
1192 1135 | impl Builder {
|
1193 1136 | #[allow(missing_docs)] // documentation missing in model
|
1194 - | pub fn blob_list(mut self, input: ::std::option::Option<crate::model::BlobSet>) -> Self {
|
1195 - | self.blob_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1196 - | self
|
1197 - | }
|
1198 - | #[allow(missing_docs)] // documentation missing in model
|
1199 - | pub(crate) fn set_blob_list(
|
1200 - | mut self,
|
1201 - | input: Option<
|
1202 - | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::BlobSet>>,
|
1203 - | >,
|
1204 - | ) -> Self {
|
1205 - | self.blob_list = input.map(|v| v.into());
|
1206 - | self
|
1207 - | }
|
1208 - | #[allow(missing_docs)] // documentation missing in model
|
1209 - | pub fn boolean_list(
|
1210 - | mut self,
|
1211 - | input: ::std::option::Option<crate::model::BooleanSet>,
|
1212 - | ) -> Self {
|
1213 - | self.boolean_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1214 - | self
|
1215 - | }
|
1216 - | #[allow(missing_docs)] // documentation missing in model
|
1217 - | pub(crate) fn set_boolean_list(
|
1218 - | mut self,
|
1219 - | input: Option<
|
1220 - | impl ::std::convert::Into<
|
1221 - | crate::constrained::MaybeConstrained<crate::model::BooleanSet>,
|
1222 - | >,
|
1223 - | >,
|
1224 - | ) -> Self {
|
1225 - | self.boolean_list = input.map(|v| v.into());
|
1226 - | self
|
1227 - | }
|
1228 - | #[allow(missing_docs)] // documentation missing in model
|
1229 - | pub fn string_list(
|
1230 - | mut self,
|
1231 - | input: ::std::option::Option<crate::model::StringSet>,
|
1232 - | ) -> Self {
|
1233 - | self.string_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1234 - | self
|
1235 - | }
|
1236 - | #[allow(missing_docs)] // documentation missing in model
|
1237 - | pub(crate) fn set_string_list(
|
1238 - | mut self,
|
1239 - | input: Option<
|
1240 - | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::StringSet>>,
|
1241 - | >,
|
1242 - | ) -> Self {
|
1243 - | self.string_list = input.map(|v| v.into());
|
1244 - | self
|
1245 - | }
|
1246 - | #[allow(missing_docs)] // documentation missing in model
|
1247 - | pub fn byte_list(mut self, input: ::std::option::Option<crate::model::ByteSet>) -> Self {
|
1248 - | self.byte_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1249 - | self
|
1250 - | }
|
1251 - | #[allow(missing_docs)] // documentation missing in model
|
1252 - | pub(crate) fn set_byte_list(
|
1253 - | mut self,
|
1254 - | input: Option<
|
1255 - | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::ByteSet>>,
|
1256 - | >,
|
1257 - | ) -> Self {
|
1258 - | self.byte_list = input.map(|v| v.into());
|
1259 - | self
|
1260 - | }
|
1261 - | #[allow(missing_docs)] // documentation missing in model
|
1262 - | pub fn short_list(mut self, input: ::std::option::Option<crate::model::ShortSet>) -> Self {
|
1263 - | self.short_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1264 - | self
|
1265 - | }
|
1266 - | #[allow(missing_docs)] // documentation missing in model
|
1267 - | pub(crate) fn set_short_list(
|
1268 - | mut self,
|
1269 - | input: Option<
|
1270 - | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::ShortSet>>,
|
1271 - | >,
|
1272 - | ) -> Self {
|
1273 - | self.short_list = input.map(|v| v.into());
|
1274 - | self
|
1275 - | }
|
1276 - | #[allow(missing_docs)] // documentation missing in model
|
1277 - | pub fn integer_list(
|
1278 - | mut self,
|
1279 - | input: ::std::option::Option<crate::model::IntegerSet>,
|
1280 - | ) -> Self {
|
1281 - | self.integer_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1137 + | pub fn blob(mut self, input: ::std::option::Option<crate::model::LengthBlob>) -> Self {
|
1138 + | self.blob = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1282 1139 | self
|
1283 1140 | }
|
1284 1141 | #[allow(missing_docs)] // documentation missing in model
|
1285 - | pub(crate) fn set_integer_list(
|
1142 + | pub(crate) fn set_blob(
|
1286 1143 | mut self,
|
1287 1144 | input: Option<
|
1288 1145 | impl ::std::convert::Into<
|
1289 - | crate::constrained::MaybeConstrained<crate::model::IntegerSet>,
|
1146 + | crate::constrained::MaybeConstrained<crate::model::LengthBlob>,
|
1290 1147 | >,
|
1291 1148 | >,
|
1292 1149 | ) -> Self {
|
1293 - | self.integer_list = input.map(|v| v.into());
|
1294 - | self
|
1295 - | }
|
1296 - | #[allow(missing_docs)] // documentation missing in model
|
1297 - | pub fn long_list(mut self, input: ::std::option::Option<crate::model::LongSet>) -> Self {
|
1298 - | self.long_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1299 - | self
|
1300 - | }
|
1301 - | #[allow(missing_docs)] // documentation missing in model
|
1302 - | pub(crate) fn set_long_list(
|
1303 - | mut self,
|
1304 - | input: Option<
|
1305 - | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::LongSet>>,
|
1306 - | >,
|
1307 - | ) -> Self {
|
1308 - | self.long_list = input.map(|v| v.into());
|
1150 + | self.blob = input.map(|v| v.into());
|
1309 1151 | self
|
1310 1152 | }
|
1311 1153 | #[allow(missing_docs)] // documentation missing in model
|
1312 - | pub fn timestamp_list(
|
1313 - | mut self,
|
1314 - | input: ::std::option::Option<crate::model::TimestampSet>,
|
1315 - | ) -> Self {
|
1316 - | self.timestamp_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1154 + | pub fn string(mut self, input: ::std::option::Option<crate::model::LengthString>) -> Self {
|
1155 + | self.string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1317 1156 | self
|
1318 1157 | }
|
1319 1158 | #[allow(missing_docs)] // documentation missing in model
|
1320 - | pub(crate) fn set_timestamp_list(
|
1159 + | pub(crate) fn set_string(
|
1321 1160 | mut self,
|
1322 1161 | input: Option<
|
1323 1162 | impl ::std::convert::Into<
|
1324 - | crate::constrained::MaybeConstrained<crate::model::TimestampSet>,
|
1163 + | crate::constrained::MaybeConstrained<crate::model::LengthString>,
|
1325 1164 | >,
|
1326 1165 | >,
|
1327 1166 | ) -> Self {
|
1328 - | self.timestamp_list = input.map(|v| v.into());
|
1167 + | self.string = input.map(|v| v.into());
|
1329 1168 | self
|
1330 1169 | }
|
1331 1170 | #[allow(missing_docs)] // documentation missing in model
|
1332 - | pub fn date_time_list(
|
1171 + | pub fn min_string(
|
1333 1172 | mut self,
|
1334 - | input: ::std::option::Option<crate::model::DateTimeSet>,
|
1173 + | input: ::std::option::Option<crate::model::MinLengthString>,
|
1335 1174 | ) -> Self {
|
1336 - | self.date_time_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1175 + | self.min_string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1337 1176 | self
|
1338 1177 | }
|
1339 1178 | #[allow(missing_docs)] // documentation missing in model
|
1340 - | pub(crate) fn set_date_time_list(
|
1179 + | pub(crate) fn set_min_string(
|
1341 1180 | mut self,
|
1342 1181 | input: Option<
|
1343 1182 | impl ::std::convert::Into<
|
1344 - | crate::constrained::MaybeConstrained<crate::model::DateTimeSet>,
|
1183 + | crate::constrained::MaybeConstrained<crate::model::MinLengthString>,
|
1345 1184 | >,
|
1346 1185 | >,
|
1347 1186 | ) -> Self {
|
1348 - | self.date_time_list = input.map(|v| v.into());
|
1187 + | self.min_string = input.map(|v| v.into());
|
1349 1188 | self
|
1350 1189 | }
|
1351 1190 | #[allow(missing_docs)] // documentation missing in model
|
1352 - | pub fn http_date_list(
|
1191 + | pub fn max_string(
|
1353 1192 | mut self,
|
1354 - | input: ::std::option::Option<crate::model::HttpDateSet>,
|
1193 + | input: ::std::option::Option<crate::model::MaxLengthString>,
|
1355 1194 | ) -> Self {
|
1356 - | self.http_date_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1195 + | self.max_string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1357 1196 | self
|
1358 1197 | }
|
1359 1198 | #[allow(missing_docs)] // documentation missing in model
|
1360 - | pub(crate) fn set_http_date_list(
|
1199 + | pub(crate) fn set_max_string(
|
1361 1200 | mut self,
|
1362 1201 | input: Option<
|
1363 1202 | impl ::std::convert::Into<
|
1364 - | crate::constrained::MaybeConstrained<crate::model::HttpDateSet>,
|
1203 + | crate::constrained::MaybeConstrained<crate::model::MaxLengthString>,
|
1365 1204 | >,
|
1366 1205 | >,
|
1367 1206 | ) -> Self {
|
1368 - | self.http_date_list = input.map(|v| v.into());
|
1207 + | self.max_string = input.map(|v| v.into());
|
1369 1208 | self
|
1370 1209 | }
|
1371 1210 | #[allow(missing_docs)] // documentation missing in model
|
1372 - | pub fn enum_list(mut self, input: ::std::option::Option<crate::model::FooEnumSet>) -> Self {
|
1373 - | self.enum_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1211 + | pub fn list(mut self, input: ::std::option::Option<crate::model::LengthList>) -> Self {
|
1212 + | self.list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1374 1213 | self
|
1375 1214 | }
|
1376 1215 | #[allow(missing_docs)] // documentation missing in model
|
1377 - | pub(crate) fn set_enum_list(
|
1216 + | pub(crate) fn set_list(
|
1378 1217 | mut self,
|
1379 1218 | input: Option<
|
1380 1219 | impl ::std::convert::Into<
|
1381 - | crate::constrained::MaybeConstrained<crate::model::FooEnumSet>,
|
1220 + | crate::constrained::MaybeConstrained<crate::model::LengthList>,
|
1382 1221 | >,
|
1383 1222 | >,
|
1384 1223 | ) -> Self {
|
1385 - | self.enum_list = input.map(|v| v.into());
|
1224 + | self.list = input.map(|v| v.into());
|
1386 1225 | self
|
1387 1226 | }
|
1388 1227 | #[allow(missing_docs)] // documentation missing in model
|
1389 - | pub fn int_enum_list(
|
1390 - | mut self,
|
1391 - | input: ::std::option::Option<crate::model::IntegerEnumSet>,
|
1392 - | ) -> Self {
|
1393 - | self.int_enum_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1228 + | pub fn map(mut self, input: ::std::option::Option<crate::model::LengthMap>) -> Self {
|
1229 + | self.map = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1394 1230 | self
|
1395 1231 | }
|
1396 1232 | #[allow(missing_docs)] // documentation missing in model
|
1397 - | pub(crate) fn set_int_enum_list(
|
1233 + | pub(crate) fn set_map(
|
1398 1234 | mut self,
|
1399 1235 | input: Option<
|
1400 - | impl ::std::convert::Into<
|
1401 - | crate::constrained::MaybeConstrained<crate::model::IntegerEnumSet>,
|
1402 - | >,
|
1236 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::LengthMap>>,
|
1403 1237 | >,
|
1404 1238 | ) -> Self {
|
1405 - | self.int_enum_list = input.map(|v| v.into());
|
1239 + | self.map = input.map(|v| v.into());
|
1406 1240 | self
|
1407 1241 | }
|
1408 - | #[allow(missing_docs)] // documentation missing in model
|
1409 - | pub fn list_list(mut self, input: ::std::option::Option<crate::model::ListSet>) -> Self {
|
1410 - | self.list_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1411 - | self
|
1412 - | }
|
1413 - | #[allow(missing_docs)] // documentation missing in model
|
1414 - | pub(crate) fn set_list_list(
|
1415 - | mut self,
|
1416 - | input: Option<
|
1417 - | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::ListSet>>,
|
1418 - | >,
|
1419 - | ) -> Self {
|
1420 - | self.list_list = input.map(|v| v.into());
|
1421 - | self
|
1422 - | }
|
1423 - | #[allow(missing_docs)] // documentation missing in model
|
1424 - | pub fn structure_list(
|
1425 - | mut self,
|
1426 - | input: ::std::option::Option<crate::model::StructureSet>,
|
1427 - | ) -> Self {
|
1428 - | self.structure_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1429 - | self
|
1430 - | }
|
1431 - | #[allow(missing_docs)] // documentation missing in model
|
1432 - | pub(crate) fn set_structure_list(
|
1433 - | mut self,
|
1434 - | input: Option<
|
1435 - | impl ::std::convert::Into<
|
1436 - | crate::constrained::MaybeConstrained<crate::model::StructureSet>,
|
1437 - | >,
|
1438 - | >,
|
1439 - | ) -> Self {
|
1440 - | self.structure_list = input.map(|v| v.into());
|
1441 - | self
|
1442 - | }
|
1443 - | #[allow(missing_docs)] // documentation missing in model
|
1444 - | pub fn structure_list_with_no_key(
|
1445 - | mut self,
|
1446 - | input: ::std::option::Option<crate::model::StructureSetWithNoKey>,
|
1447 - | ) -> Self {
|
1448 - | self.structure_list_with_no_key =
|
1449 - | input.map(crate::constrained::MaybeConstrained::Constrained);
|
1450 - | self
|
1451 - | }
|
1452 - | #[allow(missing_docs)] // documentation missing in model
|
1453 - | pub(crate) fn set_structure_list_with_no_key(
|
1454 - | mut self,
|
1455 - | input: Option<
|
1456 - | impl ::std::convert::Into<
|
1457 - | crate::constrained::MaybeConstrained<crate::model::StructureSetWithNoKey>,
|
1458 - | >,
|
1459 - | >,
|
1460 - | ) -> Self {
|
1461 - | self.structure_list_with_no_key = input.map(|v| v.into());
|
1462 - | self
|
1463 - | }
|
1464 - | #[allow(missing_docs)] // documentation missing in model
|
1465 - | pub fn union_list(mut self, input: ::std::option::Option<crate::model::UnionSet>) -> Self {
|
1466 - | self.union_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1467 - | self
|
1468 - | }
|
1469 - | #[allow(missing_docs)] // documentation missing in model
|
1470 - | pub(crate) fn set_union_list(
|
1471 - | mut self,
|
1472 - | input: Option<
|
1473 - | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::UnionSet>>,
|
1474 - | >,
|
1475 - | ) -> Self {
|
1476 - | self.union_list = input.map(|v| v.into());
|
1477 - | self
|
1478 - | }
|
1479 - | /// Consumes the builder and constructs a [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
|
1480 - | ///
|
1481 - | /// The builder fails to construct a [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput) if a [`ConstraintViolation`] occurs.
|
1482 - | ///
|
1483 - | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
1484 - | pub fn build(self) -> Result<crate::input::MalformedUniqueItemsInput, ConstraintViolation> {
|
1485 - | self.build_enforcing_all_constraints()
|
1242 + | /// Consumes the builder and constructs a [`MalformedLengthInput`](crate::input::MalformedLengthInput).
|
1243 + | ///
|
1244 + | /// The builder fails to construct a [`MalformedLengthInput`](crate::input::MalformedLengthInput) if a [`ConstraintViolation`] occurs.
|
1245 + | ///
|
1246 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
1247 + | pub fn build(self) -> Result<crate::input::MalformedLengthInput, ConstraintViolation> {
|
1248 + | self.build_enforcing_all_constraints()
|
1486 1249 | }
|
1487 1250 | fn build_enforcing_all_constraints(
|
1488 1251 | self,
|
1489 - | ) -> Result<crate::input::MalformedUniqueItemsInput, ConstraintViolation> {
|
1490 - | Ok(crate::input::MalformedUniqueItemsInput {
|
1491 - | blob_list: self
|
1492 - | .blob_list
|
1493 - | .map(|v| match v {
|
1494 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1495 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1496 - | })
|
1497 - | .map(|res| res.map_err(ConstraintViolation::BlobList))
|
1498 - | .transpose()?,
|
1499 - | boolean_list: self
|
1500 - | .boolean_list
|
1501 - | .map(|v| match v {
|
1502 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1503 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1504 - | })
|
1505 - | .map(|res| res.map_err(ConstraintViolation::BooleanList))
|
1506 - | .transpose()?,
|
1507 - | string_list: self
|
1508 - | .string_list
|
1509 - | .map(|v| match v {
|
1510 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1511 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1512 - | })
|
1513 - | .map(|res| res.map_err(ConstraintViolation::StringList))
|
1514 - | .transpose()?,
|
1515 - | byte_list: self
|
1516 - | .byte_list
|
1517 - | .map(|v| match v {
|
1518 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1519 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1520 - | })
|
1521 - | .map(|res| res.map_err(ConstraintViolation::ByteList))
|
1522 - | .transpose()?,
|
1523 - | short_list: self
|
1524 - | .short_list
|
1525 - | .map(|v| match v {
|
1526 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1527 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1528 - | })
|
1529 - | .map(|res| res.map_err(ConstraintViolation::ShortList))
|
1530 - | .transpose()?,
|
1531 - | integer_list: self
|
1532 - | .integer_list
|
1533 - | .map(|v| match v {
|
1534 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1535 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1536 - | })
|
1537 - | .map(|res| res.map_err(ConstraintViolation::IntegerList))
|
1538 - | .transpose()?,
|
1539 - | long_list: self
|
1540 - | .long_list
|
1541 - | .map(|v| match v {
|
1542 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1543 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1544 - | })
|
1545 - | .map(|res| res.map_err(ConstraintViolation::LongList))
|
1546 - | .transpose()?,
|
1547 - | timestamp_list: self
|
1548 - | .timestamp_list
|
1549 - | .map(|v| match v {
|
1550 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1551 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1552 - | })
|
1553 - | .map(|res| res.map_err(ConstraintViolation::TimestampList))
|
1554 - | .transpose()?,
|
1555 - | date_time_list: self
|
1556 - | .date_time_list
|
1557 - | .map(|v| match v {
|
1558 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1559 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1560 - | })
|
1561 - | .map(|res| res.map_err(ConstraintViolation::DateTimeList))
|
1562 - | .transpose()?,
|
1563 - | http_date_list: self
|
1564 - | .http_date_list
|
1565 - | .map(|v| match v {
|
1566 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1567 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1568 - | })
|
1569 - | .map(|res| res.map_err(ConstraintViolation::HttpDateList))
|
1570 - | .transpose()?,
|
1571 - | enum_list: self
|
1572 - | .enum_list
|
1252 + | ) -> Result<crate::input::MalformedLengthInput, ConstraintViolation> {
|
1253 + | Ok(crate::input::MalformedLengthInput {
|
1254 + | blob: self
|
1255 + | .blob
|
1573 1256 | .map(|v| match v {
|
1574 1257 | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1575 1258 | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1576 1259 | })
|
1577 - | .map(|res| res.map_err(ConstraintViolation::EnumList))
|
1260 + | .map(|res| res.map_err(ConstraintViolation::Blob))
|
1578 1261 | .transpose()?,
|
1579 - | int_enum_list: self
|
1580 - | .int_enum_list
|
1262 + | string: self
|
1263 + | .string
|
1581 1264 | .map(|v| match v {
|
1582 1265 | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1583 1266 | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1584 1267 | })
|
1585 - | .map(|res| res.map_err(ConstraintViolation::IntEnumList))
|
1268 + | .map(|res| res.map_err(ConstraintViolation::String))
|
1586 1269 | .transpose()?,
|
1587 - | list_list: self
|
1588 - | .list_list
|
1270 + | min_string: self
|
1271 + | .min_string
|
1589 1272 | .map(|v| match v {
|
1590 1273 | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1591 1274 | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1592 1275 | })
|
1593 - | .map(|res| res.map_err(ConstraintViolation::ListList))
|
1276 + | .map(|res| res.map_err(ConstraintViolation::MinString))
|
1594 1277 | .transpose()?,
|
1595 - | structure_list: self
|
1596 - | .structure_list
|
1278 + | max_string: self
|
1279 + | .max_string
|
1597 1280 | .map(|v| match v {
|
1598 1281 | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1599 1282 | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1600 1283 | })
|
1601 - | .map(|res| res.map_err(ConstraintViolation::StructureList))
|
1284 + | .map(|res| res.map_err(ConstraintViolation::MaxString))
|
1602 1285 | .transpose()?,
|
1603 - | structure_list_with_no_key: self
|
1604 - | .structure_list_with_no_key
|
1286 + | list: self
|
1287 + | .list
|
1605 1288 | .map(|v| match v {
|
1606 1289 | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1607 1290 | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1608 1291 | })
|
1609 - | .map(|res| res.map_err(ConstraintViolation::StructureListWithNoKey))
|
1292 + | .map(|res| res.map_err(ConstraintViolation::List))
|
1610 1293 | .transpose()?,
|
1611 - | union_list: self
|
1612 - | .union_list
|
1294 + | map: self
|
1295 + | .map
|
1613 1296 | .map(|v| match v {
|
1614 1297 | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1615 1298 | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1616 1299 | })
|
1617 - | .map(|res| res.map_err(ConstraintViolation::UnionList))
|
1300 + | .map(|res| res.map_err(ConstraintViolation::Map))
|
1618 1301 | .transpose()?,
|
1619 1302 | })
|
1620 1303 | }
|
1621 1304 | }
|
1622 1305 | }
|
1623 - | /// See [`MalformedRequiredInput`](crate::input::MalformedRequiredInput).
|
1624 - | pub mod malformed_required_input {
|
1306 + | /// See [`MalformedLengthOverrideInput`](crate::input::MalformedLengthOverrideInput).
|
1307 + | pub mod malformed_length_override_input {
|
1625 1308 |
|
1626 1309 | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1627 1310 | /// Holds one variant for each of the ways the builder can fail.
|
1628 1311 | #[non_exhaustive]
|
1629 1312 | #[allow(clippy::enum_variant_names)]
|
1630 1313 | pub enum ConstraintViolation {
|
1631 - | /// `string` was not provided but it is required when building `MalformedRequiredInput`.
|
1632 - | MissingString,
|
1633 - | /// `string_in_query` was not provided but it is required when building `MalformedRequiredInput`.
|
1634 - | MissingStringInQuery,
|
1635 - | /// `string_in_header` was not provided but it is required when building `MalformedRequiredInput`.
|
1636 - | MissingStringInHeader,
|
1314 + | /// Constraint violation occurred building member `blob` when building `MalformedLengthOverrideInput`.
|
1315 + | #[doc(hidden)]
|
1316 + | Blob(crate::input::malformed_length_override_input::blob::ConstraintViolation),
|
1317 + | /// Constraint violation occurred building member `string` when building `MalformedLengthOverrideInput`.
|
1318 + | #[doc(hidden)]
|
1319 + | String(crate::input::malformed_length_override_input::string::ConstraintViolation),
|
1320 + | /// Constraint violation occurred building member `min_string` when building `MalformedLengthOverrideInput`.
|
1321 + | #[doc(hidden)]
|
1322 + | MinString(crate::input::malformed_length_override_input::min_string::ConstraintViolation),
|
1323 + | /// Constraint violation occurred building member `max_string` when building `MalformedLengthOverrideInput`.
|
1324 + | #[doc(hidden)]
|
1325 + | MaxString(crate::input::malformed_length_override_input::max_string::ConstraintViolation),
|
1326 + | /// Constraint violation occurred building member `list` when building `MalformedLengthOverrideInput`.
|
1327 + | #[doc(hidden)]
|
1328 + | List(crate::input::malformed_length_override_input::list::ConstraintViolation),
|
1329 + | /// Constraint violation occurred building member `map` when building `MalformedLengthOverrideInput`.
|
1330 + | #[doc(hidden)]
|
1331 + | Map(crate::input::malformed_length_override_input::map::ConstraintViolation),
|
1637 1332 | }
|
1638 1333 | impl ::std::fmt::Display for ConstraintViolation {
|
1639 1334 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1640 1335 | match self {
|
1641 - | ConstraintViolation::MissingString => write!(f, "`string` was not provided but it is required when building `MalformedRequiredInput`"),
|
1642 - | ConstraintViolation::MissingStringInQuery => write!(f, "`string_in_query` was not provided but it is required when building `MalformedRequiredInput`"),
|
1643 - | ConstraintViolation::MissingStringInHeader => write!(f, "`string_in_header` was not provided but it is required when building `MalformedRequiredInput`"),
|
1336 + | ConstraintViolation::Blob(_) => write!(f, "constraint violation occurred building member `blob` when building `MalformedLengthOverrideInput`"),
|
1337 + | ConstraintViolation::String(_) => write!(f, "constraint violation occurred building member `string` when building `MalformedLengthOverrideInput`"),
|
1338 + | ConstraintViolation::MinString(_) => write!(f, "constraint violation occurred building member `min_string` when building `MalformedLengthOverrideInput`"),
|
1339 + | ConstraintViolation::MaxString(_) => write!(f, "constraint violation occurred building member `max_string` when building `MalformedLengthOverrideInput`"),
|
1340 + | ConstraintViolation::List(_) => write!(f, "constraint violation occurred building member `list` when building `MalformedLengthOverrideInput`"),
|
1341 + | ConstraintViolation::Map(_) => write!(f, "constraint violation occurred building member `map` when building `MalformedLengthOverrideInput`"),
|
1644 1342 | }
|
1645 1343 | }
|
1646 1344 | }
|
1647 1345 | impl ::std::error::Error for ConstraintViolation {}
|
1648 1346 | impl ConstraintViolation {
|
1649 1347 | pub(crate) fn as_validation_exception_field(
|
1650 1348 | self,
|
1651 1349 | path: ::std::string::String,
|
1652 1350 | ) -> crate::model::ValidationExceptionField {
|
1653 1351 | match self {
|
1654 - | ConstraintViolation::MissingString => crate::model::ValidationExceptionField {
|
1655 - | message: format!("Value at '{}/string' failed to satisfy constraint: Member must not be null", path),
|
1656 - | path: path + "/string",
|
1657 - | },
|
1658 - | ConstraintViolation::MissingStringInQuery => crate::model::ValidationExceptionField {
|
1659 - | message: format!("Value at '{}/stringInQuery' failed to satisfy constraint: Member must not be null", path),
|
1660 - | path: path + "/stringInQuery",
|
1661 - | },
|
1662 - | ConstraintViolation::MissingStringInHeader => crate::model::ValidationExceptionField {
|
1663 - | message: format!("Value at '{}/stringInHeader' failed to satisfy constraint: Member must not be null", path),
|
1664 - | path: path + "/stringInHeader",
|
1665 - | },
|
1666 - | }
|
1352 + | ConstraintViolation::Blob(inner) => {
|
1353 + | inner.as_validation_exception_field(path + "/blob")
|
1354 + | }
|
1355 + | ConstraintViolation::String(inner) => {
|
1356 + | inner.as_validation_exception_field(path + "/string")
|
1357 + | }
|
1358 + | ConstraintViolation::MinString(inner) => {
|
1359 + | inner.as_validation_exception_field(path + "/minString")
|
1360 + | }
|
1361 + | ConstraintViolation::MaxString(inner) => {
|
1362 + | inner.as_validation_exception_field(path + "/maxString")
|
1363 + | }
|
1364 + | ConstraintViolation::List(inner) => {
|
1365 + | inner.as_validation_exception_field(path + "/list")
|
1366 + | }
|
1367 + | ConstraintViolation::Map(inner) => {
|
1368 + | inner.as_validation_exception_field(path + "/map")
|
1369 + | }
|
1370 + | }
|
1667 1371 | }
|
1668 1372 | }
|
1669 1373 | impl ::std::convert::From<ConstraintViolation>
|
1670 1374 | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
1671 1375 | {
|
1672 1376 | fn from(constraint_violation: ConstraintViolation) -> Self {
|
1673 1377 | let first_validation_exception_field =
|
1674 1378 | constraint_violation.as_validation_exception_field("".to_owned());
|
1675 1379 | let validation_exception = crate::error::ValidationException {
|
1676 1380 | message: format!(
|
1677 1381 | "1 validation error detected. {}",
|
1678 1382 | &first_validation_exception_field.message
|
1679 1383 | ),
|
1680 1384 | field_list: Some(vec![first_validation_exception_field]),
|
1681 1385 | };
|
1682 1386 | Self::ConstraintViolation(
|
1683 1387 | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
1684 1388 | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
1685 1389 | )
|
1686 1390 | }
|
1687 1391 | }
|
1688 1392 | impl ::std::convert::From<Builder>
|
1689 - | for crate::constrained::MaybeConstrained<crate::input::MalformedRequiredInput>
|
1393 + | for crate::constrained::MaybeConstrained<crate::input::MalformedLengthOverrideInput>
|
1690 1394 | {
|
1691 1395 | fn from(builder: Builder) -> Self {
|
1692 1396 | Self::Unconstrained(builder)
|
1693 1397 | }
|
1694 1398 | }
|
1695 - | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedRequiredInput {
|
1399 + | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedLengthOverrideInput {
|
1696 1400 | type Error = ConstraintViolation;
|
1697 1401 |
|
1698 1402 | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
1699 1403 | builder.build()
|
1700 1404 | }
|
1701 1405 | }
|
1702 - | /// A builder for [`MalformedRequiredInput`](crate::input::MalformedRequiredInput).
|
1406 + | /// A builder for [`MalformedLengthOverrideInput`](crate::input::MalformedLengthOverrideInput).
|
1703 1407 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1704 1408 | pub struct Builder {
|
1705 - | pub(crate) string: ::std::option::Option<::std::string::String>,
|
1706 - | pub(crate) string_in_query: ::std::option::Option<::std::string::String>,
|
1707 - | pub(crate) string_in_header: ::std::option::Option<::std::string::String>,
|
1409 + | pub(crate) blob: ::std::option::Option<
|
1410 + | crate::constrained::MaybeConstrained<
|
1411 + | crate::input::malformed_length_override_input::Blob,
|
1412 + | >,
|
1413 + | >,
|
1414 + | pub(crate) string: ::std::option::Option<
|
1415 + | crate::constrained::MaybeConstrained<
|
1416 + | crate::input::malformed_length_override_input::String,
|
1417 + | >,
|
1418 + | >,
|
1419 + | pub(crate) min_string: ::std::option::Option<
|
1420 + | crate::constrained::MaybeConstrained<
|
1421 + | crate::input::malformed_length_override_input::MinString,
|
1422 + | >,
|
1423 + | >,
|
1424 + | pub(crate) max_string: ::std::option::Option<
|
1425 + | crate::constrained::MaybeConstrained<
|
1426 + | crate::input::malformed_length_override_input::MaxString,
|
1427 + | >,
|
1428 + | >,
|
1429 + | pub(crate) list: ::std::option::Option<
|
1430 + | crate::constrained::MaybeConstrained<
|
1431 + | crate::input::malformed_length_override_input::List,
|
1432 + | >,
|
1433 + | >,
|
1434 + | pub(crate) map: ::std::option::Option<
|
1435 + | crate::constrained::MaybeConstrained<
|
1436 + | crate::input::malformed_length_override_input::Map,
|
1437 + | >,
|
1438 + | >,
|
1708 1439 | }
|
1709 1440 | impl Builder {
|
1710 1441 | #[allow(missing_docs)] // documentation missing in model
|
1711 - | pub fn string(mut self, input: ::std::string::String) -> Self {
|
1712 - | self.string = Some(input);
|
1442 + | pub fn blob(
|
1443 + | mut self,
|
1444 + | input: ::std::option::Option<crate::input::malformed_length_override_input::Blob>,
|
1445 + | ) -> Self {
|
1446 + | self.blob = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1447 + | self
|
1448 + | }
|
1449 + | #[allow(missing_docs)] // documentation missing in model
|
1450 + | pub(crate) fn set_blob(
|
1451 + | mut self,
|
1452 + | input: Option<
|
1453 + | impl ::std::convert::Into<
|
1454 + | crate::constrained::MaybeConstrained<
|
1455 + | crate::input::malformed_length_override_input::Blob,
|
1456 + | >,
|
1457 + | >,
|
1458 + | >,
|
1459 + | ) -> Self {
|
1460 + | self.blob = input.map(|v| v.into());
|
1461 + | self
|
1462 + | }
|
1463 + | #[allow(missing_docs)] // documentation missing in model
|
1464 + | pub fn string(
|
1465 + | mut self,
|
1466 + | input: ::std::option::Option<crate::input::malformed_length_override_input::String>,
|
1467 + | ) -> Self {
|
1468 + | self.string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1713 1469 | self
|
1714 1470 | }
|
1715 1471 | #[allow(missing_docs)] // documentation missing in model
|
1716 1472 | pub(crate) fn set_string(
|
1717 1473 | mut self,
|
1718 - | input: impl ::std::convert::Into<::std::string::String>,
|
1474 + | input: Option<
|
1475 + | impl ::std::convert::Into<
|
1476 + | crate::constrained::MaybeConstrained<
|
1477 + | crate::input::malformed_length_override_input::String,
|
1478 + | >,
|
1479 + | >,
|
1480 + | >,
|
1719 1481 | ) -> Self {
|
1720 - | self.string = Some(input.into());
|
1482 + | self.string = input.map(|v| v.into());
|
1721 1483 | self
|
1722 1484 | }
|
1723 1485 | #[allow(missing_docs)] // documentation missing in model
|
1724 - | pub fn string_in_query(mut self, input: ::std::string::String) -> Self {
|
1725 - | self.string_in_query = Some(input);
|
1486 + | pub fn min_string(
|
1487 + | mut self,
|
1488 + | input: ::std::option::Option<crate::input::malformed_length_override_input::MinString>,
|
1489 + | ) -> Self {
|
1490 + | self.min_string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1726 1491 | self
|
1727 1492 | }
|
1728 1493 | #[allow(missing_docs)] // documentation missing in model
|
1729 - | pub(crate) fn set_string_in_query(
|
1494 + | pub(crate) fn set_min_string(
|
1730 1495 | mut self,
|
1731 - | input: impl ::std::convert::Into<::std::string::String>,
|
1496 + | input: Option<
|
1497 + | impl ::std::convert::Into<
|
1498 + | crate::constrained::MaybeConstrained<
|
1499 + | crate::input::malformed_length_override_input::MinString,
|
1500 + | >,
|
1501 + | >,
|
1502 + | >,
|
1732 1503 | ) -> Self {
|
1733 - | self.string_in_query = Some(input.into());
|
1504 + | self.min_string = input.map(|v| v.into());
|
1734 1505 | self
|
1735 1506 | }
|
1736 1507 | #[allow(missing_docs)] // documentation missing in model
|
1737 - | pub fn string_in_header(mut self, input: ::std::string::String) -> Self {
|
1738 - | self.string_in_header = Some(input);
|
1508 + | pub fn max_string(
|
1509 + | mut self,
|
1510 + | input: ::std::option::Option<crate::input::malformed_length_override_input::MaxString>,
|
1511 + | ) -> Self {
|
1512 + | self.max_string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1739 1513 | self
|
1740 1514 | }
|
1741 1515 | #[allow(missing_docs)] // documentation missing in model
|
1742 - | pub(crate) fn set_string_in_header(
|
1516 + | pub(crate) fn set_max_string(
|
1743 1517 | mut self,
|
1744 - | input: impl ::std::convert::Into<::std::string::String>,
|
1518 + | input: Option<
|
1519 + | impl ::std::convert::Into<
|
1520 + | crate::constrained::MaybeConstrained<
|
1521 + | crate::input::malformed_length_override_input::MaxString,
|
1522 + | >,
|
1523 + | >,
|
1524 + | >,
|
1745 1525 | ) -> Self {
|
1746 - | self.string_in_header = Some(input.into());
|
1526 + | self.max_string = input.map(|v| v.into());
|
1747 1527 | self
|
1748 1528 | }
|
1749 - | /// Consumes the builder and constructs a [`MalformedRequiredInput`](crate::input::MalformedRequiredInput).
|
1529 + | #[allow(missing_docs)] // documentation missing in model
|
1530 + | pub fn list(
|
1531 + | mut self,
|
1532 + | input: ::std::option::Option<crate::input::malformed_length_override_input::List>,
|
1533 + | ) -> Self {
|
1534 + | self.list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1535 + | self
|
1536 + | }
|
1537 + | #[allow(missing_docs)] // documentation missing in model
|
1538 + | pub(crate) fn set_list(
|
1539 + | mut self,
|
1540 + | input: Option<
|
1541 + | impl ::std::convert::Into<
|
1542 + | crate::constrained::MaybeConstrained<
|
1543 + | crate::input::malformed_length_override_input::List,
|
1544 + | >,
|
1545 + | >,
|
1546 + | >,
|
1547 + | ) -> Self {
|
1548 + | self.list = input.map(|v| v.into());
|
1549 + | self
|
1550 + | }
|
1551 + | #[allow(missing_docs)] // documentation missing in model
|
1552 + | pub fn map(
|
1553 + | mut self,
|
1554 + | input: ::std::option::Option<crate::input::malformed_length_override_input::Map>,
|
1555 + | ) -> Self {
|
1556 + | self.map = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1557 + | self
|
1558 + | }
|
1559 + | #[allow(missing_docs)] // documentation missing in model
|
1560 + | pub(crate) fn set_map(
|
1561 + | mut self,
|
1562 + | input: Option<
|
1563 + | impl ::std::convert::Into<
|
1564 + | crate::constrained::MaybeConstrained<
|
1565 + | crate::input::malformed_length_override_input::Map,
|
1566 + | >,
|
1567 + | >,
|
1568 + | >,
|
1569 + | ) -> Self {
|
1570 + | self.map = input.map(|v| v.into());
|
1571 + | self
|
1572 + | }
|
1573 + | /// Consumes the builder and constructs a [`MalformedLengthOverrideInput`](crate::input::MalformedLengthOverrideInput).
|
1750 1574 | ///
|
1751 - | /// The builder fails to construct a [`MalformedRequiredInput`](crate::input::MalformedRequiredInput) if a [`ConstraintViolation`] occurs.
|
1575 + | /// The builder fails to construct a [`MalformedLengthOverrideInput`](crate::input::MalformedLengthOverrideInput) if a [`ConstraintViolation`] occurs.
|
1752 1576 | ///
|
1753 1577 | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
1754 - | pub fn build(self) -> Result<crate::input::MalformedRequiredInput, ConstraintViolation> {
|
1578 + | pub fn build(
|
1579 + | self,
|
1580 + | ) -> Result<crate::input::MalformedLengthOverrideInput, ConstraintViolation> {
|
1755 1581 | self.build_enforcing_all_constraints()
|
1756 1582 | }
|
1757 1583 | fn build_enforcing_all_constraints(
|
1758 1584 | self,
|
1759 - | ) -> Result<crate::input::MalformedRequiredInput, ConstraintViolation> {
|
1760 - | Ok(crate::input::MalformedRequiredInput {
|
1761 - | string: self.string.ok_or(ConstraintViolation::MissingString)?,
|
1762 - | string_in_query: self
|
1763 - | .string_in_query
|
1764 - | .ok_or(ConstraintViolation::MissingStringInQuery)?,
|
1765 - | string_in_header: self
|
1766 - | .string_in_header
|
1767 - | .ok_or(ConstraintViolation::MissingStringInHeader)?,
|
1585 + | ) -> Result<crate::input::MalformedLengthOverrideInput, ConstraintViolation> {
|
1586 + | Ok(crate::input::MalformedLengthOverrideInput {
|
1587 + | blob: self
|
1588 + | .blob
|
1589 + | .map(|v| match v {
|
1590 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1591 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1592 + | })
|
1593 + | .map(|res| res.map_err(ConstraintViolation::Blob))
|
1594 + | .transpose()?,
|
1595 + | string: self
|
1596 + | .string
|
1597 + | .map(|v| match v {
|
1598 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1599 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1600 + | })
|
1601 + | .map(|res| res.map_err(ConstraintViolation::String))
|
1602 + | .transpose()?,
|
1603 + | min_string: self
|
1604 + | .min_string
|
1605 + | .map(|v| match v {
|
1606 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1607 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1608 + | })
|
1609 + | .map(|res| res.map_err(ConstraintViolation::MinString))
|
1610 + | .transpose()?,
|
1611 + | max_string: self
|
1612 + | .max_string
|
1613 + | .map(|v| match v {
|
1614 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1615 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1616 + | })
|
1617 + | .map(|res| res.map_err(ConstraintViolation::MaxString))
|
1618 + | .transpose()?,
|
1619 + | list: self
|
1620 + | .list
|
1621 + | .map(|v| match v {
|
1622 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1623 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1624 + | })
|
1625 + | .map(|res| res.map_err(ConstraintViolation::List))
|
1626 + | .transpose()?,
|
1627 + | map: self
|
1628 + | .map
|
1629 + | .map(|v| match v {
|
1630 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
1631 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
1632 + | })
|
1633 + | .map(|res| res.map_err(ConstraintViolation::Map))
|
1634 + | .transpose()?,
|
1768 1635 | })
|
1769 1636 | }
|
1770 1637 | }
|
1771 - | }
|
1772 - | /// See [`MalformedRangeOverrideInput`](crate::input::MalformedRangeOverrideInput).
|
1773 - | pub mod malformed_range_override_input {
|
1774 - |
|
1775 - | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1776 - | /// Holds one variant for each of the ways the builder can fail.
|
1777 - | #[non_exhaustive]
|
1778 - | #[allow(clippy::enum_variant_names)]
|
1779 - | pub enum ConstraintViolation {
|
1780 - | /// Constraint violation occurred building member `byte` when building `MalformedRangeOverrideInput`.
|
1781 - | #[doc(hidden)]
|
1782 - | Byte(crate::input::malformed_range_override_input::byte::ConstraintViolation),
|
1783 - | /// Constraint violation occurred building member `min_byte` when building `MalformedRangeOverrideInput`.
|
1784 - | #[doc(hidden)]
|
1785 - | MinByte(crate::input::malformed_range_override_input::min_byte::ConstraintViolation),
|
1786 - | /// Constraint violation occurred building member `max_byte` when building `MalformedRangeOverrideInput`.
|
1787 - | #[doc(hidden)]
|
1788 - | MaxByte(crate::input::malformed_range_override_input::max_byte::ConstraintViolation),
|
1789 - | /// Constraint violation occurred building member `short` when building `MalformedRangeOverrideInput`.
|
1790 - | #[doc(hidden)]
|
1791 - | Short(crate::input::malformed_range_override_input::short::ConstraintViolation),
|
1792 - | /// Constraint violation occurred building member `min_short` when building `MalformedRangeOverrideInput`.
|
1793 - | #[doc(hidden)]
|
1794 - | MinShort(crate::input::malformed_range_override_input::min_short::ConstraintViolation),
|
1795 - | /// Constraint violation occurred building member `max_short` when building `MalformedRangeOverrideInput`.
|
1796 - | #[doc(hidden)]
|
1797 - | MaxShort(crate::input::malformed_range_override_input::max_short::ConstraintViolation),
|
1798 - | /// Constraint violation occurred building member `integer` when building `MalformedRangeOverrideInput`.
|
1799 - | #[doc(hidden)]
|
1800 - | Integer(crate::input::malformed_range_override_input::integer::ConstraintViolation),
|
1801 - | /// Constraint violation occurred building member `min_integer` when building `MalformedRangeOverrideInput`.
|
1802 - | #[doc(hidden)]
|
1803 - | MinInteger(crate::input::malformed_range_override_input::min_integer::ConstraintViolation),
|
1804 - | /// Constraint violation occurred building member `max_integer` when building `MalformedRangeOverrideInput`.
|
1805 - | #[doc(hidden)]
|
1806 - | MaxInteger(crate::input::malformed_range_override_input::max_integer::ConstraintViolation),
|
1807 - | /// Constraint violation occurred building member `long` when building `MalformedRangeOverrideInput`.
|
1808 - | #[doc(hidden)]
|
1809 - | Long(crate::input::malformed_range_override_input::long::ConstraintViolation),
|
1810 - | /// Constraint violation occurred building member `min_long` when building `MalformedRangeOverrideInput`.
|
1811 - | #[doc(hidden)]
|
1812 - | MinLong(crate::input::malformed_range_override_input::min_long::ConstraintViolation),
|
1813 - | /// Constraint violation occurred building member `max_long` when building `MalformedRangeOverrideInput`.
|
1814 - | #[doc(hidden)]
|
1815 - | MaxLong(crate::input::malformed_range_override_input::max_long::ConstraintViolation),
|
1638 + | #[allow(missing_docs)] // documentation missing in model
|
1639 + | ///
|
1640 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
1641 + | /// [constraint traits]. Use [`Blob::try_from`] to construct values of this type.
|
1642 + | ///
|
1643 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
1644 + | ///
|
1645 + | #[derive(
|
1646 + | ::std::clone::Clone,
|
1647 + | ::std::cmp::Eq,
|
1648 + | ::std::cmp::PartialEq,
|
1649 + | ::std::fmt::Debug,
|
1650 + | ::std::hash::Hash,
|
1651 + | )]
|
1652 + | pub struct Blob(pub(crate) ::aws_smithy_types::Blob);
|
1653 + | impl Blob {
|
1654 + | /// Returns an immutable reference to the underlying [`::aws_smithy_types::Blob`].
|
1655 + | pub fn inner(&self) -> &::aws_smithy_types::Blob {
|
1656 + | &self.0
|
1657 + | }
|
1658 + | /// Consumes the value, returning the underlying [`::aws_smithy_types::Blob`].
|
1659 + | pub fn into_inner(self) -> ::aws_smithy_types::Blob {
|
1660 + | self.0
|
1661 + | }
|
1816 1662 | }
|
1817 - | impl ::std::fmt::Display for ConstraintViolation {
|
1818 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1819 - | match self {
|
1820 - | ConstraintViolation::Byte(_) => write!(f, "constraint violation occurred building member `byte` when building `MalformedRangeOverrideInput`"),
|
1821 - | ConstraintViolation::MinByte(_) => write!(f, "constraint violation occurred building member `min_byte` when building `MalformedRangeOverrideInput`"),
|
1822 - | ConstraintViolation::MaxByte(_) => write!(f, "constraint violation occurred building member `max_byte` when building `MalformedRangeOverrideInput`"),
|
1823 - | ConstraintViolation::Short(_) => write!(f, "constraint violation occurred building member `short` when building `MalformedRangeOverrideInput`"),
|
1824 - | ConstraintViolation::MinShort(_) => write!(f, "constraint violation occurred building member `min_short` when building `MalformedRangeOverrideInput`"),
|
1825 - | ConstraintViolation::MaxShort(_) => write!(f, "constraint violation occurred building member `max_short` when building `MalformedRangeOverrideInput`"),
|
1826 - | ConstraintViolation::Integer(_) => write!(f, "constraint violation occurred building member `integer` when building `MalformedRangeOverrideInput`"),
|
1827 - | ConstraintViolation::MinInteger(_) => write!(f, "constraint violation occurred building member `min_integer` when building `MalformedRangeOverrideInput`"),
|
1828 - | ConstraintViolation::MaxInteger(_) => write!(f, "constraint violation occurred building member `max_integer` when building `MalformedRangeOverrideInput`"),
|
1829 - | ConstraintViolation::Long(_) => write!(f, "constraint violation occurred building member `long` when building `MalformedRangeOverrideInput`"),
|
1830 - | ConstraintViolation::MinLong(_) => write!(f, "constraint violation occurred building member `min_long` when building `MalformedRangeOverrideInput`"),
|
1831 - | ConstraintViolation::MaxLong(_) => write!(f, "constraint violation occurred building member `max_long` when building `MalformedRangeOverrideInput`"),
|
1663 + | impl Blob {
|
1664 + | fn check_length(
|
1665 + | blob: &::aws_smithy_types::Blob,
|
1666 + | ) -> ::std::result::Result<
|
1667 + | (),
|
1668 + | crate::input::malformed_length_override_input::blob::ConstraintViolation,
|
1669 + | > {
|
1670 + | let length = blob.as_ref().len();
|
1671 + |
|
1672 + | if (4..=6).contains(&length) {
|
1673 + | Ok(())
|
1674 + | } else {
|
1675 + | Err(crate::input::malformed_length_override_input::blob::ConstraintViolation::Length(length))
|
1832 1676 | }
|
1833 1677 | }
|
1834 1678 | }
|
1835 - | impl ::std::error::Error for ConstraintViolation {}
|
1836 - | impl ConstraintViolation {
|
1837 - | pub(crate) fn as_validation_exception_field(
|
1838 - | self,
|
1839 - | path: ::std::string::String,
|
1840 - | ) -> crate::model::ValidationExceptionField {
|
1841 - | match self {
|
1842 - | ConstraintViolation::Byte(inner) => {
|
1843 - | inner.as_validation_exception_field(path + "/byte")
|
1844 - | }
|
1845 - | ConstraintViolation::MinByte(inner) => {
|
1846 - | inner.as_validation_exception_field(path + "/minByte")
|
1847 - | }
|
1848 - | ConstraintViolation::MaxByte(inner) => {
|
1849 - | inner.as_validation_exception_field(path + "/maxByte")
|
1850 - | }
|
1851 - | ConstraintViolation::Short(inner) => {
|
1852 - | inner.as_validation_exception_field(path + "/short")
|
1853 - | }
|
1854 - | ConstraintViolation::MinShort(inner) => {
|
1855 - | inner.as_validation_exception_field(path + "/minShort")
|
1856 - | }
|
1857 - | ConstraintViolation::MaxShort(inner) => {
|
1858 - | inner.as_validation_exception_field(path + "/maxShort")
|
1859 - | }
|
1860 - | ConstraintViolation::Integer(inner) => {
|
1861 - | inner.as_validation_exception_field(path + "/integer")
|
1862 - | }
|
1863 - | ConstraintViolation::MinInteger(inner) => {
|
1864 - | inner.as_validation_exception_field(path + "/minInteger")
|
1865 - | }
|
1866 - | ConstraintViolation::MaxInteger(inner) => {
|
1867 - | inner.as_validation_exception_field(path + "/maxInteger")
|
1868 - | }
|
1869 - | ConstraintViolation::Long(inner) => {
|
1870 - | inner.as_validation_exception_field(path + "/long")
|
1871 - | }
|
1872 - | ConstraintViolation::MinLong(inner) => {
|
1873 - | inner.as_validation_exception_field(path + "/minLong")
|
1874 - | }
|
1875 - | ConstraintViolation::MaxLong(inner) => {
|
1876 - | inner.as_validation_exception_field(path + "/maxLong")
|
1877 - | }
|
1878 - | }
|
1679 + | impl ::std::convert::TryFrom<::aws_smithy_types::Blob> for Blob {
|
1680 + | type Error = crate::input::malformed_length_override_input::blob::ConstraintViolation;
|
1681 + |
|
1682 + | /// Constructs a `Blob` from an [`::aws_smithy_types::Blob`], failing when the provided value does not satisfy the modeled constraints.
|
1683 + | fn try_from(value: ::aws_smithy_types::Blob) -> ::std::result::Result<Self, Self::Error> {
|
1684 + | Self::check_length(&value)?;
|
1685 + |
|
1686 + | Ok(Self(value))
|
1879 1687 | }
|
1880 1688 | }
|
1881 - | impl ::std::convert::From<ConstraintViolation>
|
1882 - | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
1689 + | impl crate::constrained::Constrained for Blob {
|
1690 + | type Unconstrained = ::aws_smithy_types::Blob;
|
1691 + | }
|
1692 + |
|
1693 + | impl ::std::convert::From<::aws_smithy_types::Blob>
|
1694 + | for crate::constrained::MaybeConstrained<
|
1695 + | crate::input::malformed_length_override_input::Blob,
|
1696 + | >
|
1883 1697 | {
|
1884 - | fn from(constraint_violation: ConstraintViolation) -> Self {
|
1885 - | let first_validation_exception_field =
|
1886 - | constraint_violation.as_validation_exception_field("".to_owned());
|
1887 - | let validation_exception = crate::error::ValidationException {
|
1888 - | message: format!(
|
1889 - | "1 validation error detected. {}",
|
1890 - | &first_validation_exception_field.message
|
1891 - | ),
|
1892 - | field_list: Some(vec![first_validation_exception_field]),
|
1893 - | };
|
1894 - | Self::ConstraintViolation(
|
1895 - | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
1896 - | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
1897 - | )
|
1698 + | fn from(value: ::aws_smithy_types::Blob) -> Self {
|
1699 + | Self::Unconstrained(value)
|
1898 1700 | }
|
1899 1701 | }
|
1900 - | impl ::std::convert::From<Builder>
|
1901 - | for crate::constrained::MaybeConstrained<crate::input::MalformedRangeOverrideInput>
|
1702 + |
|
1703 + | impl ::std::convert::From<Blob> for ::aws_smithy_types::Blob {
|
1704 + | fn from(value: Blob) -> Self {
|
1705 + | value.into_inner()
|
1706 + | }
|
1707 + | }
|
1708 + | #[allow(missing_docs)] // documentation missing in model
|
1709 + | ///
|
1710 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
1711 + | /// [constraint traits]. Use [`String::try_from`] to construct values of this type.
|
1712 + | ///
|
1713 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
1714 + | ///
|
1715 + | #[derive(
|
1716 + | ::std::clone::Clone,
|
1717 + | ::std::cmp::Eq,
|
1718 + | ::std::cmp::PartialEq,
|
1719 + | ::std::fmt::Debug,
|
1720 + | ::std::hash::Hash,
|
1721 + | )]
|
1722 + | pub struct String(pub(crate) ::std::string::String);
|
1723 + | impl String {
|
1724 + | /// Extracts a string slice containing the entire underlying `String`.
|
1725 + | pub fn as_str(&self) -> &str {
|
1726 + | &self.0
|
1727 + | }
|
1728 + |
|
1729 + | /// Returns an immutable reference to the underlying [`::std::string::String`].
|
1730 + | pub fn inner(&self) -> &::std::string::String {
|
1731 + | &self.0
|
1732 + | }
|
1733 + |
|
1734 + | /// Consumes the value, returning the underlying [`::std::string::String`].
|
1735 + | pub fn into_inner(self) -> ::std::string::String {
|
1736 + | self.0
|
1737 + | }
|
1738 + | }
|
1739 + | impl String {
|
1740 + | fn check_length(
|
1741 + | string: &str,
|
1742 + | ) -> ::std::result::Result<
|
1743 + | (),
|
1744 + | crate::input::malformed_length_override_input::string::ConstraintViolation,
|
1745 + | > {
|
1746 + | let length = string.chars().count();
|
1747 + |
|
1748 + | if (4..=6).contains(&length) {
|
1749 + | Ok(())
|
1750 + | } else {
|
1751 + | Err(crate::input::malformed_length_override_input::string::ConstraintViolation::Length(length))
|
1752 + | }
|
1753 + | }
|
1754 + | }
|
1755 + | impl ::std::convert::TryFrom<::std::string::String> for String {
|
1756 + | type Error = crate::input::malformed_length_override_input::string::ConstraintViolation;
|
1757 + |
|
1758 + | /// Constructs a `String` from an [`::std::string::String`], failing when the provided value does not satisfy the modeled constraints.
|
1759 + | fn try_from(value: ::std::string::String) -> ::std::result::Result<Self, Self::Error> {
|
1760 + | Self::check_length(&value)?;
|
1761 + |
|
1762 + | Ok(Self(value))
|
1763 + | }
|
1764 + | }
|
1765 + | impl crate::constrained::Constrained for String {
|
1766 + | type Unconstrained = ::std::string::String;
|
1767 + | }
|
1768 + |
|
1769 + | impl ::std::convert::From<::std::string::String>
|
1770 + | for crate::constrained::MaybeConstrained<
|
1771 + | crate::input::malformed_length_override_input::String,
|
1772 + | >
|
1902 1773 | {
|
1903 - | fn from(builder: Builder) -> Self {
|
1904 - | Self::Unconstrained(builder)
|
1774 + | fn from(value: ::std::string::String) -> Self {
|
1775 + | Self::Unconstrained(value)
|
1905 1776 | }
|
1906 1777 | }
|
1907 - | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedRangeOverrideInput {
|
1908 - | type Error = ConstraintViolation;
|
1909 1778 |
|
1910 - | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
1911 - | builder.build()
|
1779 + | impl ::std::fmt::Display for String {
|
1780 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1781 + | self.0.fmt(f)
|
1912 1782 | }
|
1913 1783 | }
|
1914 - | /// A builder for [`MalformedRangeOverrideInput`](crate::input::MalformedRangeOverrideInput).
|
1915 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1916 - | pub struct Builder {
|
1917 - | pub(crate) byte: ::std::option::Option<
|
1918 - | crate::constrained::MaybeConstrained<
|
1919 - | crate::input::malformed_range_override_input::Byte,
|
1920 - | >,
|
1921 - | >,
|
1922 - | pub(crate) min_byte: ::std::option::Option<
|
1923 - | crate::constrained::MaybeConstrained<
|
1924 - | crate::input::malformed_range_override_input::MinByte,
|
1925 - | >,
|
1926 - | >,
|
1927 - | pub(crate) max_byte: ::std::option::Option<
|
1928 - | crate::constrained::MaybeConstrained<
|
1929 - | crate::input::malformed_range_override_input::MaxByte,
|
1930 - | >,
|
1931 - | >,
|
1932 - | pub(crate) short: ::std::option::Option<
|
1933 - | crate::constrained::MaybeConstrained<
|
1934 - | crate::input::malformed_range_override_input::Short,
|
1935 - | >,
|
1936 - | >,
|
1937 - | pub(crate) min_short: ::std::option::Option<
|
1938 - | crate::constrained::MaybeConstrained<
|
1939 - | crate::input::malformed_range_override_input::MinShort,
|
1940 - | >,
|
1941 - | >,
|
1942 - | pub(crate) max_short: ::std::option::Option<
|
1943 - | crate::constrained::MaybeConstrained<
|
1944 - | crate::input::malformed_range_override_input::MaxShort,
|
1945 - | >,
|
1946 - | >,
|
1947 - | pub(crate) integer: ::std::option::Option<
|
1948 - | crate::constrained::MaybeConstrained<
|
1949 - | crate::input::malformed_range_override_input::Integer,
|
1950 - | >,
|
1951 - | >,
|
1952 - | pub(crate) min_integer: ::std::option::Option<
|
1953 - | crate::constrained::MaybeConstrained<
|
1954 - | crate::input::malformed_range_override_input::MinInteger,
|
1955 - | >,
|
1956 - | >,
|
1957 - | pub(crate) max_integer: ::std::option::Option<
|
1958 - | crate::constrained::MaybeConstrained<
|
1959 - | crate::input::malformed_range_override_input::MaxInteger,
|
1960 - | >,
|
1961 - | >,
|
1962 - | pub(crate) long: ::std::option::Option<
|
1963 - | crate::constrained::MaybeConstrained<
|
1964 - | crate::input::malformed_range_override_input::Long,
|
1965 - | >,
|
1966 - | >,
|
1967 - | pub(crate) min_long: ::std::option::Option<
|
1968 - | crate::constrained::MaybeConstrained<
|
1969 - | crate::input::malformed_range_override_input::MinLong,
|
1970 - | >,
|
1971 - | >,
|
1972 - | pub(crate) max_long: ::std::option::Option<
|
1973 - | crate::constrained::MaybeConstrained<
|
1974 - | crate::input::malformed_range_override_input::MaxLong,
|
1975 - | >,
|
1976 - | >,
|
1977 - | pub(crate) float: ::std::option::Option<f32>,
|
1978 - | pub(crate) min_float: ::std::option::Option<f32>,
|
1979 - | pub(crate) max_float: ::std::option::Option<f32>,
|
1784 + |
|
1785 + | impl ::std::convert::From<String> for ::std::string::String {
|
1786 + | fn from(value: String) -> Self {
|
1787 + | value.into_inner()
|
1788 + | }
|
1980 1789 | }
|
1981 - | impl Builder {
|
1982 - | #[allow(missing_docs)] // documentation missing in model
|
1983 - | pub fn byte(
|
1984 - | mut self,
|
1985 - | input: ::std::option::Option<crate::input::malformed_range_override_input::Byte>,
|
1986 - | ) -> Self {
|
1987 - | self.byte = input.map(crate::constrained::MaybeConstrained::Constrained);
|
1988 - | self
|
1790 + | #[allow(missing_docs)] // documentation missing in model
|
1791 + | ///
|
1792 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
1793 + | /// [constraint traits]. Use [`MinString::try_from`] to construct values of this type.
|
1794 + | ///
|
1795 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
1796 + | ///
|
1797 + | #[derive(
|
1798 + | ::std::clone::Clone,
|
1799 + | ::std::cmp::Eq,
|
1800 + | ::std::cmp::PartialEq,
|
1801 + | ::std::fmt::Debug,
|
1802 + | ::std::hash::Hash,
|
1803 + | )]
|
1804 + | pub struct MinString(pub(crate) ::std::string::String);
|
1805 + | impl MinString {
|
1806 + | /// Extracts a string slice containing the entire underlying `String`.
|
1807 + | pub fn as_str(&self) -> &str {
|
1808 + | &self.0
|
1989 1809 | }
|
1990 - | #[allow(missing_docs)] // documentation missing in model
|
1991 - | pub(crate) fn set_byte(
|
1992 - | mut self,
|
1993 - | input: Option<
|
1994 - | impl ::std::convert::Into<
|
1995 - | crate::constrained::MaybeConstrained<
|
1996 - | crate::input::malformed_range_override_input::Byte,
|
1997 - | >,
|
1998 - | >,
|
1999 - | >,
|
2000 - | ) -> Self {
|
2001 - | self.byte = input.map(|v| v.into());
|
2002 - | self
|
1810 + |
|
1811 + | /// Returns an immutable reference to the underlying [`::std::string::String`].
|
1812 + | pub fn inner(&self) -> &::std::string::String {
|
1813 + | &self.0
|
2003 1814 | }
|
2004 - | #[allow(missing_docs)] // documentation missing in model
|
2005 - | pub fn min_byte(
|
2006 - | mut self,
|
2007 - | input: ::std::option::Option<crate::input::malformed_range_override_input::MinByte>,
|
2008 - | ) -> Self {
|
2009 - | self.min_byte = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2010 - | self
|
1815 + |
|
1816 + | /// Consumes the value, returning the underlying [`::std::string::String`].
|
1817 + | pub fn into_inner(self) -> ::std::string::String {
|
1818 + | self.0
|
2011 1819 | }
|
2012 - | #[allow(missing_docs)] // documentation missing in model
|
2013 - | pub(crate) fn set_min_byte(
|
2014 - | mut self,
|
2015 - | input: Option<
|
2016 - | impl ::std::convert::Into<
|
2017 - | crate::constrained::MaybeConstrained<
|
2018 - | crate::input::malformed_range_override_input::MinByte,
|
2019 - | >,
|
2020 - | >,
|
2021 - | >,
|
2022 - | ) -> Self {
|
2023 - | self.min_byte = input.map(|v| v.into());
|
2024 - | self
|
1820 + | }
|
1821 + | impl MinString {
|
1822 + | fn check_length(
|
1823 + | string: &str,
|
1824 + | ) -> ::std::result::Result<
|
1825 + | (),
|
1826 + | crate::input::malformed_length_override_input::min_string::ConstraintViolation,
|
1827 + | > {
|
1828 + | let length = string.chars().count();
|
1829 + |
|
1830 + | if 4 <= length {
|
1831 + | Ok(())
|
1832 + | } else {
|
1833 + | Err(crate::input::malformed_length_override_input::min_string::ConstraintViolation::Length(length))
|
1834 + | }
|
2025 1835 | }
|
2026 - | #[allow(missing_docs)] // documentation missing in model
|
2027 - | pub fn max_byte(
|
2028 - | mut self,
|
2029 - | input: ::std::option::Option<crate::input::malformed_range_override_input::MaxByte>,
|
2030 - | ) -> Self {
|
2031 - | self.max_byte = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2032 - | self
|
1836 + | }
|
1837 + | impl ::std::convert::TryFrom<::std::string::String> for MinString {
|
1838 + | type Error = crate::input::malformed_length_override_input::min_string::ConstraintViolation;
|
1839 + |
|
1840 + | /// Constructs a `MinString` from an [`::std::string::String`], failing when the provided value does not satisfy the modeled constraints.
|
1841 + | fn try_from(value: ::std::string::String) -> ::std::result::Result<Self, Self::Error> {
|
1842 + | Self::check_length(&value)?;
|
1843 + |
|
1844 + | Ok(Self(value))
|
2033 1845 | }
|
2034 - | #[allow(missing_docs)] // documentation missing in model
|
2035 - | pub(crate) fn set_max_byte(
|
2036 - | mut self,
|
2037 - | input: Option<
|
2038 - | impl ::std::convert::Into<
|
2039 - | crate::constrained::MaybeConstrained<
|
2040 - | crate::input::malformed_range_override_input::MaxByte,
|
2041 - | >,
|
2042 - | >,
|
2043 - | >,
|
2044 - | ) -> Self {
|
2045 - | self.max_byte = input.map(|v| v.into());
|
2046 - | self
|
1846 + | }
|
1847 + | impl crate::constrained::Constrained for MinString {
|
1848 + | type Unconstrained = ::std::string::String;
|
1849 + | }
|
1850 + |
|
1851 + | impl ::std::convert::From<::std::string::String>
|
1852 + | for crate::constrained::MaybeConstrained<
|
1853 + | crate::input::malformed_length_override_input::MinString,
|
1854 + | >
|
1855 + | {
|
1856 + | fn from(value: ::std::string::String) -> Self {
|
1857 + | Self::Unconstrained(value)
|
2047 1858 | }
|
2048 - | #[allow(missing_docs)] // documentation missing in model
|
2049 - | pub fn short(
|
2050 - | mut self,
|
2051 - | input: ::std::option::Option<crate::input::malformed_range_override_input::Short>,
|
2052 - | ) -> Self {
|
2053 - | self.short = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2054 - | self
|
1859 + | }
|
1860 + |
|
1861 + | impl ::std::fmt::Display for MinString {
|
1862 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1863 + | self.0.fmt(f)
|
2055 1864 | }
|
2056 - | #[allow(missing_docs)] // documentation missing in model
|
2057 - | pub(crate) fn set_short(
|
2058 - | mut self,
|
2059 - | input: Option<
|
2060 - | impl ::std::convert::Into<
|
2061 - | crate::constrained::MaybeConstrained<
|
2062 - | crate::input::malformed_range_override_input::Short,
|
2063 - | >,
|
2064 - | >,
|
2065 - | >,
|
2066 - | ) -> Self {
|
2067 - | self.short = input.map(|v| v.into());
|
2068 - | self
|
1865 + | }
|
1866 + |
|
1867 + | impl ::std::convert::From<MinString> for ::std::string::String {
|
1868 + | fn from(value: MinString) -> Self {
|
1869 + | value.into_inner()
|
2069 1870 | }
|
2070 - | #[allow(missing_docs)] // documentation missing in model
|
2071 - | pub fn min_short(
|
2072 - | mut self,
|
2073 - | input: ::std::option::Option<crate::input::malformed_range_override_input::MinShort>,
|
2074 - | ) -> Self {
|
2075 - | self.min_short = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2076 - | self
|
1871 + | }
|
1872 + | #[allow(missing_docs)] // documentation missing in model
|
1873 + | ///
|
1874 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
1875 + | /// [constraint traits]. Use [`MaxString::try_from`] to construct values of this type.
|
1876 + | ///
|
1877 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
1878 + | ///
|
1879 + | #[derive(
|
1880 + | ::std::clone::Clone,
|
1881 + | ::std::cmp::Eq,
|
1882 + | ::std::cmp::PartialEq,
|
1883 + | ::std::fmt::Debug,
|
1884 + | ::std::hash::Hash,
|
1885 + | )]
|
1886 + | pub struct MaxString(pub(crate) ::std::string::String);
|
1887 + | impl MaxString {
|
1888 + | /// Extracts a string slice containing the entire underlying `String`.
|
1889 + | pub fn as_str(&self) -> &str {
|
1890 + | &self.0
|
2077 1891 | }
|
2078 - | #[allow(missing_docs)] // documentation missing in model
|
2079 - | pub(crate) fn set_min_short(
|
2080 - | mut self,
|
2081 - | input: Option<
|
2082 - | impl ::std::convert::Into<
|
2083 - | crate::constrained::MaybeConstrained<
|
2084 - | crate::input::malformed_range_override_input::MinShort,
|
2085 - | >,
|
2086 - | >,
|
2087 - | >,
|
2088 - | ) -> Self {
|
2089 - | self.min_short = input.map(|v| v.into());
|
2090 - | self
|
1892 + |
|
1893 + | /// Returns an immutable reference to the underlying [`::std::string::String`].
|
1894 + | pub fn inner(&self) -> &::std::string::String {
|
1895 + | &self.0
|
2091 1896 | }
|
2092 - | #[allow(missing_docs)] // documentation missing in model
|
2093 - | pub fn max_short(
|
2094 - | mut self,
|
2095 - | input: ::std::option::Option<crate::input::malformed_range_override_input::MaxShort>,
|
2096 - | ) -> Self {
|
2097 - | self.max_short = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2098 - | self
|
1897 + |
|
1898 + | /// Consumes the value, returning the underlying [`::std::string::String`].
|
1899 + | pub fn into_inner(self) -> ::std::string::String {
|
1900 + | self.0
|
2099 1901 | }
|
2100 - | #[allow(missing_docs)] // documentation missing in model
|
2101 - | pub(crate) fn set_max_short(
|
2102 - | mut self,
|
2103 - | input: Option<
|
2104 - | impl ::std::convert::Into<
|
2105 - | crate::constrained::MaybeConstrained<
|
2106 - | crate::input::malformed_range_override_input::MaxShort,
|
2107 - | >,
|
2108 - | >,
|
2109 - | >,
|
2110 - | ) -> Self {
|
2111 - | self.max_short = input.map(|v| v.into());
|
2112 - | self
|
1902 + | }
|
1903 + | impl MaxString {
|
1904 + | fn check_length(
|
1905 + | string: &str,
|
1906 + | ) -> ::std::result::Result<
|
1907 + | (),
|
1908 + | crate::input::malformed_length_override_input::max_string::ConstraintViolation,
|
1909 + | > {
|
1910 + | let length = string.chars().count();
|
1911 + |
|
1912 + | if length <= 6 {
|
1913 + | Ok(())
|
1914 + | } else {
|
1915 + | Err(crate::input::malformed_length_override_input::max_string::ConstraintViolation::Length(length))
|
1916 + | }
|
2113 1917 | }
|
2114 - | #[allow(missing_docs)] // documentation missing in model
|
2115 - | pub fn integer(
|
2116 - | mut self,
|
2117 - | input: ::std::option::Option<crate::input::malformed_range_override_input::Integer>,
|
2118 - | ) -> Self {
|
2119 - | self.integer = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2120 - | self
|
1918 + | }
|
1919 + | impl ::std::convert::TryFrom<::std::string::String> for MaxString {
|
1920 + | type Error = crate::input::malformed_length_override_input::max_string::ConstraintViolation;
|
1921 + |
|
1922 + | /// Constructs a `MaxString` from an [`::std::string::String`], failing when the provided value does not satisfy the modeled constraints.
|
1923 + | fn try_from(value: ::std::string::String) -> ::std::result::Result<Self, Self::Error> {
|
1924 + | Self::check_length(&value)?;
|
1925 + |
|
1926 + | Ok(Self(value))
|
2121 1927 | }
|
2122 - | #[allow(missing_docs)] // documentation missing in model
|
2123 - | pub(crate) fn set_integer(
|
2124 - | mut self,
|
2125 - | input: Option<
|
2126 - | impl ::std::convert::Into<
|
2127 - | crate::constrained::MaybeConstrained<
|
2128 - | crate::input::malformed_range_override_input::Integer,
|
2129 - | >,
|
2130 - | >,
|
2131 - | >,
|
2132 - | ) -> Self {
|
2133 - | self.integer = input.map(|v| v.into());
|
2134 - | self
|
1928 + | }
|
1929 + | impl crate::constrained::Constrained for MaxString {
|
1930 + | type Unconstrained = ::std::string::String;
|
1931 + | }
|
1932 + |
|
1933 + | impl ::std::convert::From<::std::string::String>
|
1934 + | for crate::constrained::MaybeConstrained<
|
1935 + | crate::input::malformed_length_override_input::MaxString,
|
1936 + | >
|
1937 + | {
|
1938 + | fn from(value: ::std::string::String) -> Self {
|
1939 + | Self::Unconstrained(value)
|
2135 1940 | }
|
2136 - | #[allow(missing_docs)] // documentation missing in model
|
2137 - | pub fn min_integer(
|
2138 - | mut self,
|
2139 - | input: ::std::option::Option<crate::input::malformed_range_override_input::MinInteger>,
|
2140 - | ) -> Self {
|
2141 - | self.min_integer = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2142 - | self
|
1941 + | }
|
1942 + |
|
1943 + | impl ::std::fmt::Display for MaxString {
|
1944 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1945 + | self.0.fmt(f)
|
2143 1946 | }
|
2144 - | #[allow(missing_docs)] // documentation missing in model
|
2145 - | pub(crate) fn set_min_integer(
|
2146 - | mut self,
|
2147 - | input: Option<
|
2148 - | impl ::std::convert::Into<
|
2149 - | crate::constrained::MaybeConstrained<
|
2150 - | crate::input::malformed_range_override_input::MinInteger,
|
2151 - | >,
|
2152 - | >,
|
2153 - | >,
|
2154 - | ) -> Self {
|
2155 - | self.min_integer = input.map(|v| v.into());
|
2156 - | self
|
1947 + | }
|
1948 + |
|
1949 + | impl ::std::convert::From<MaxString> for ::std::string::String {
|
1950 + | fn from(value: MaxString) -> Self {
|
1951 + | value.into_inner()
|
2157 1952 | }
|
2158 - | #[allow(missing_docs)] // documentation missing in model
|
2159 - | pub fn max_integer(
|
2160 - | mut self,
|
2161 - | input: ::std::option::Option<crate::input::malformed_range_override_input::MaxInteger>,
|
2162 - | ) -> Self {
|
2163 - | self.max_integer = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2164 - | self
|
1953 + | }
|
1954 + | #[allow(missing_docs)] // documentation missing in model
|
1955 + | ///
|
1956 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
1957 + | /// [constraint traits]. Use [`List::try_from`] to construct values of this type.
|
1958 + | ///
|
1959 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
1960 + | ///
|
1961 + | #[derive(
|
1962 + | ::std::clone::Clone,
|
1963 + | ::std::cmp::Eq,
|
1964 + | ::std::cmp::PartialEq,
|
1965 + | ::std::fmt::Debug,
|
1966 + | ::std::hash::Hash,
|
1967 + | )]
|
1968 + | pub struct List(pub(crate) ::std::vec::Vec<crate::model::LengthString>);
|
1969 + | impl List {
|
1970 + | /// Returns an immutable reference to the underlying [`::std::vec::Vec<crate::model::LengthString>`].
|
1971 + | pub fn inner(&self) -> &::std::vec::Vec<crate::model::LengthString> {
|
1972 + | &self.0
|
2165 1973 | }
|
2166 - | #[allow(missing_docs)] // documentation missing in model
|
2167 - | pub(crate) fn set_max_integer(
|
2168 - | mut self,
|
2169 - | input: Option<
|
2170 - | impl ::std::convert::Into<
|
2171 - | crate::constrained::MaybeConstrained<
|
2172 - | crate::input::malformed_range_override_input::MaxInteger,
|
2173 - | >,
|
2174 - | >,
|
2175 - | >,
|
2176 - | ) -> Self {
|
2177 - | self.max_integer = input.map(|v| v.into());
|
2178 - | self
|
1974 + | /// Consumes the value, returning the underlying [`::std::vec::Vec<crate::model::LengthString>`].
|
1975 + | pub fn into_inner(self) -> ::std::vec::Vec<crate::model::LengthString> {
|
1976 + | self.0
|
2179 1977 | }
|
2180 - | #[allow(missing_docs)] // documentation missing in model
|
2181 - | pub fn long(
|
2182 - | mut self,
|
2183 - | input: ::std::option::Option<crate::input::malformed_range_override_input::Long>,
|
2184 - | ) -> Self {
|
2185 - | self.long = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2186 - | self
|
1978 + |
|
1979 + | fn check_length(
|
1980 + | length: usize,
|
1981 + | ) -> ::std::result::Result<
|
1982 + | (),
|
1983 + | crate::input::malformed_length_override_input::list::ConstraintViolation,
|
1984 + | > {
|
1985 + | if (4..=6).contains(&length) {
|
1986 + | Ok(())
|
1987 + | } else {
|
1988 + | Err(crate::input::malformed_length_override_input::list::ConstraintViolation::Length(length))
|
1989 + | }
|
2187 1990 | }
|
2188 - | #[allow(missing_docs)] // documentation missing in model
|
2189 - | pub(crate) fn set_long(
|
2190 - | mut self,
|
2191 - | input: Option<
|
2192 - | impl ::std::convert::Into<
|
2193 - | crate::constrained::MaybeConstrained<
|
2194 - | crate::input::malformed_range_override_input::Long,
|
2195 - | >,
|
2196 - | >,
|
2197 - | >,
|
2198 - | ) -> Self {
|
2199 - | self.long = input.map(|v| v.into());
|
2200 - | self
|
1991 + | }
|
1992 + | impl ::std::convert::TryFrom<::std::vec::Vec<crate::model::LengthString>> for List {
|
1993 + | type Error = crate::input::malformed_length_override_input::list::ConstraintViolation;
|
1994 + |
|
1995 + | /// Constructs a `List` from an [`::std::vec::Vec<crate::model::LengthString>`], failing when the provided value does not satisfy the modeled constraints.
|
1996 + | fn try_from(
|
1997 + | value: ::std::vec::Vec<crate::model::LengthString>,
|
1998 + | ) -> ::std::result::Result<Self, Self::Error> {
|
1999 + | Self::check_length(value.len())?;
|
2000 + |
|
2001 + | Ok(Self(value))
|
2201 2002 | }
|
2202 - | #[allow(missing_docs)] // documentation missing in model
|
2203 - | pub fn min_long(
|
2204 - | mut self,
|
2205 - | input: ::std::option::Option<crate::input::malformed_range_override_input::MinLong>,
|
2206 - | ) -> Self {
|
2207 - | self.min_long = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2208 - | self
|
2003 + | }
|
2004 + |
|
2005 + | impl ::std::convert::From<List> for ::std::vec::Vec<crate::model::LengthString> {
|
2006 + | fn from(value: List) -> Self {
|
2007 + | value.into_inner()
|
2209 2008 | }
|
2210 - | #[allow(missing_docs)] // documentation missing in model
|
2211 - | pub(crate) fn set_min_long(
|
2212 - | mut self,
|
2213 - | input: Option<
|
2214 - | impl ::std::convert::Into<
|
2215 - | crate::constrained::MaybeConstrained<
|
2216 - | crate::input::malformed_range_override_input::MinLong,
|
2217 - | >,
|
2218 - | >,
|
2219 - | >,
|
2220 - | ) -> Self {
|
2221 - | self.min_long = input.map(|v| v.into());
|
2222 - | self
|
2009 + | }
|
2010 + | impl crate::constrained::Constrained for List {
|
2011 + | type Unconstrained = crate::input::malformed_length_override_input::malformed_length_override_input_list_unconstrained::MalformedLengthOverrideInputListUnconstrained;
|
2012 + | }
|
2013 + | #[allow(missing_docs)] // documentation missing in model
|
2014 + | ///
|
2015 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
2016 + | /// [constraint traits]. Use [`Map::try_from`] to construct values of this type.
|
2017 + | ///
|
2018 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
2019 + | ///
|
2020 + | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
2021 + | pub struct Map(
|
2022 + | pub(crate) ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>,
|
2023 + | );
|
2024 + | impl Map {
|
2025 + | /// Returns an immutable reference to the underlying [`::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>`].
|
2026 + | pub fn inner(
|
2027 + | &self,
|
2028 + | ) -> &::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>
|
2029 + | {
|
2030 + | &self.0
|
2223 2031 | }
|
2224 - | #[allow(missing_docs)] // documentation missing in model
|
2225 - | pub fn max_long(
|
2226 - | mut self,
|
2227 - | input: ::std::option::Option<crate::input::malformed_range_override_input::MaxLong>,
|
2228 - | ) -> Self {
|
2229 - | self.max_long = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2230 - | self
|
2231 - | }
|
2232 - | #[allow(missing_docs)] // documentation missing in model
|
2233 - | pub(crate) fn set_max_long(
|
2234 - | mut self,
|
2235 - | input: Option<
|
2236 - | impl ::std::convert::Into<
|
2237 - | crate::constrained::MaybeConstrained<
|
2238 - | crate::input::malformed_range_override_input::MaxLong,
|
2239 - | >,
|
2240 - | >,
|
2241 - | >,
|
2242 - | ) -> Self {
|
2243 - | self.max_long = input.map(|v| v.into());
|
2244 - | self
|
2245 - | }
|
2246 - | #[allow(missing_docs)] // documentation missing in model
|
2247 - | pub fn float(mut self, input: ::std::option::Option<f32>) -> Self {
|
2248 - | self.float = input;
|
2249 - | self
|
2250 - | }
|
2251 - | #[allow(missing_docs)] // documentation missing in model
|
2252 - | pub(crate) fn set_float(mut self, input: Option<impl ::std::convert::Into<f32>>) -> Self {
|
2253 - | self.float = input.map(|v| v.into());
|
2254 - | self
|
2255 - | }
|
2256 - | #[allow(missing_docs)] // documentation missing in model
|
2257 - | pub fn min_float(mut self, input: ::std::option::Option<f32>) -> Self {
|
2258 - | self.min_float = input;
|
2259 - | self
|
2260 - | }
|
2261 - | #[allow(missing_docs)] // documentation missing in model
|
2262 - | pub(crate) fn set_min_float(
|
2263 - | mut self,
|
2264 - | input: Option<impl ::std::convert::Into<f32>>,
|
2265 - | ) -> Self {
|
2266 - | self.min_float = input.map(|v| v.into());
|
2267 - | self
|
2268 - | }
|
2269 - | #[allow(missing_docs)] // documentation missing in model
|
2270 - | pub fn max_float(mut self, input: ::std::option::Option<f32>) -> Self {
|
2271 - | self.max_float = input;
|
2272 - | self
|
2273 - | }
|
2274 - | #[allow(missing_docs)] // documentation missing in model
|
2275 - | pub(crate) fn set_max_float(
|
2276 - | mut self,
|
2277 - | input: Option<impl ::std::convert::Into<f32>>,
|
2278 - | ) -> Self {
|
2279 - | self.max_float = input.map(|v| v.into());
|
2280 - | self
|
2281 - | }
|
2282 - | /// Consumes the builder and constructs a [`MalformedRangeOverrideInput`](crate::input::MalformedRangeOverrideInput).
|
2283 - | ///
|
2284 - | /// The builder fails to construct a [`MalformedRangeOverrideInput`](crate::input::MalformedRangeOverrideInput) if a [`ConstraintViolation`] occurs.
|
2285 - | ///
|
2286 - | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
2287 - | pub fn build(
|
2288 - | self,
|
2289 - | ) -> Result<crate::input::MalformedRangeOverrideInput, ConstraintViolation> {
|
2290 - | self.build_enforcing_all_constraints()
|
2291 - | }
|
2292 - | fn build_enforcing_all_constraints(
|
2293 - | self,
|
2294 - | ) -> Result<crate::input::MalformedRangeOverrideInput, ConstraintViolation> {
|
2295 - | Ok(crate::input::MalformedRangeOverrideInput {
|
2296 - | byte: self
|
2297 - | .byte
|
2298 - | .map(|v| match v {
|
2299 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2300 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2301 - | })
|
2302 - | .map(|res| res.map_err(ConstraintViolation::Byte))
|
2303 - | .transpose()?,
|
2304 - | min_byte: self
|
2305 - | .min_byte
|
2306 - | .map(|v| match v {
|
2307 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2308 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2309 - | })
|
2310 - | .map(|res| res.map_err(ConstraintViolation::MinByte))
|
2311 - | .transpose()?,
|
2312 - | max_byte: self
|
2313 - | .max_byte
|
2314 - | .map(|v| match v {
|
2315 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2316 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2317 - | })
|
2318 - | .map(|res| res.map_err(ConstraintViolation::MaxByte))
|
2319 - | .transpose()?,
|
2320 - | short: self
|
2321 - | .short
|
2322 - | .map(|v| match v {
|
2323 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2324 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2325 - | })
|
2326 - | .map(|res| res.map_err(ConstraintViolation::Short))
|
2327 - | .transpose()?,
|
2328 - | min_short: self
|
2329 - | .min_short
|
2330 - | .map(|v| match v {
|
2331 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2332 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2333 - | })
|
2334 - | .map(|res| res.map_err(ConstraintViolation::MinShort))
|
2335 - | .transpose()?,
|
2336 - | max_short: self
|
2337 - | .max_short
|
2338 - | .map(|v| match v {
|
2339 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2340 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2341 - | })
|
2342 - | .map(|res| res.map_err(ConstraintViolation::MaxShort))
|
2343 - | .transpose()?,
|
2344 - | integer: self
|
2345 - | .integer
|
2346 - | .map(|v| match v {
|
2347 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2348 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2349 - | })
|
2350 - | .map(|res| res.map_err(ConstraintViolation::Integer))
|
2351 - | .transpose()?,
|
2352 - | min_integer: self
|
2353 - | .min_integer
|
2354 - | .map(|v| match v {
|
2355 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2356 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2357 - | })
|
2358 - | .map(|res| res.map_err(ConstraintViolation::MinInteger))
|
2359 - | .transpose()?,
|
2360 - | max_integer: self
|
2361 - | .max_integer
|
2362 - | .map(|v| match v {
|
2363 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2364 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2365 - | })
|
2366 - | .map(|res| res.map_err(ConstraintViolation::MaxInteger))
|
2367 - | .transpose()?,
|
2368 - | long: self
|
2369 - | .long
|
2370 - | .map(|v| match v {
|
2371 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2372 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2373 - | })
|
2374 - | .map(|res| res.map_err(ConstraintViolation::Long))
|
2375 - | .transpose()?,
|
2376 - | min_long: self
|
2377 - | .min_long
|
2378 - | .map(|v| match v {
|
2379 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2380 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2381 - | })
|
2382 - | .map(|res| res.map_err(ConstraintViolation::MinLong))
|
2383 - | .transpose()?,
|
2384 - | max_long: self
|
2385 - | .max_long
|
2386 - | .map(|v| match v {
|
2387 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2388 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2389 - | })
|
2390 - | .map(|res| res.map_err(ConstraintViolation::MaxLong))
|
2391 - | .transpose()?,
|
2392 - | float: self.float,
|
2393 - | min_float: self.min_float,
|
2394 - | max_float: self.max_float,
|
2395 - | })
|
2032 + | /// Consumes the value, returning the underlying [`::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>`].
|
2033 + | pub fn into_inner(
|
2034 + | self,
|
2035 + | ) -> ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>
|
2036 + | {
|
2037 + | self.0
|
2396 2038 | }
|
2397 2039 | }
|
2398 - | #[allow(missing_docs)] // documentation missing in model
|
2399 - | ///
|
2400 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
2401 - | /// [constraint traits]. Use [`MaxLong::try_from`] to construct values of this type.
|
2402 - | ///
|
2403 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
2404 - | ///
|
2405 - | #[derive(
|
2406 - | ::std::clone::Clone,
|
2407 - | ::std::cmp::Eq,
|
2408 - | ::std::cmp::PartialEq,
|
2409 - | ::std::fmt::Debug,
|
2410 - | ::std::hash::Hash,
|
2411 - | )]
|
2412 - | pub struct MaxLong(pub(crate) i64);
|
2413 - | impl MaxLong {
|
2414 - | /// Returns an immutable reference to the underlying [`i64`].
|
2415 - | pub fn inner(&self) -> &i64 {
|
2416 - | &self.0
|
2417 - | }
|
2040 + | impl
|
2041 + | ::std::convert::TryFrom<
|
2042 + | ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>,
|
2043 + | > for Map
|
2044 + | {
|
2045 + | type Error = crate::input::malformed_length_override_input::map::ConstraintViolation;
|
2418 2046 |
|
2419 - | /// Consumes the value, returning the underlying [`i64`].
|
2420 - | pub fn into_inner(self) -> i64 {
|
2421 - | self.0
|
2047 + | /// Constructs a `Map` from an [`::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>`], failing when the provided value does not satisfy the modeled constraints.
|
2048 + | fn try_from(
|
2049 + | value: ::std::collections::HashMap<
|
2050 + | crate::model::LengthString,
|
2051 + | crate::model::LengthList,
|
2052 + | >,
|
2053 + | ) -> ::std::result::Result<Self, Self::Error> {
|
2054 + | let length = value.len();
|
2055 + | if (4..=6).contains(&length) {
|
2056 + | Ok(Self(value))
|
2057 + | } else {
|
2058 + | Err(
|
2059 + | crate::input::malformed_length_override_input::map::ConstraintViolation::Length(
|
2060 + | length,
|
2061 + | ),
|
2062 + | )
|
2063 + | }
|
2422 2064 | }
|
2423 2065 | }
|
2424 2066 |
|
2425 - | impl crate::constrained::Constrained for MaxLong {
|
2426 - | type Unconstrained = i64;
|
2427 - | }
|
2428 - |
|
2429 - | impl ::std::convert::From<i64>
|
2430 - | for crate::constrained::MaybeConstrained<
|
2431 - | crate::input::malformed_range_override_input::MaxLong,
|
2432 - | >
|
2067 + | impl ::std::convert::From<Map>
|
2068 + | for ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>
|
2433 2069 | {
|
2434 - | fn from(value: i64) -> Self {
|
2435 - | Self::Unconstrained(value)
|
2070 + | fn from(value: Map) -> Self {
|
2071 + | value.into_inner()
|
2436 2072 | }
|
2437 2073 | }
|
2438 - |
|
2439 - | impl ::std::fmt::Display for MaxLong {
|
2440 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2441 - | self.0.fmt(f)
|
2442 - | }
|
2074 + | impl crate::constrained::Constrained for Map {
|
2075 + | type Unconstrained = crate::input::malformed_length_override_input::malformed_length_override_input_map_unconstrained::MalformedLengthOverrideInputMapUnconstrained;
|
2443 2076 | }
|
2444 2077 |
|
2445 - | impl ::std::convert::From<MaxLong> for i64 {
|
2446 - | fn from(value: MaxLong) -> Self {
|
2447 - | value.into_inner()
|
2078 + | /// See [`MalformedLengthOverrideInputBlob`](crate::input::malformed_length_override_input::Blob).
|
2079 + | pub mod blob {
|
2080 + |
|
2081 + | #[derive(Debug, PartialEq)]
|
2082 + | pub enum ConstraintViolation {
|
2083 + | /// Error when a blob doesn't satisfy its `@length` requirements.
|
2084 + | Length(usize),
|
2448 2085 | }
|
2449 - | }
|
2450 - | impl MaxLong {
|
2451 - | fn check_range(
|
2452 - | value: i64,
|
2453 - | ) -> ::std::result::Result<
|
2454 - | (),
|
2455 - | crate::input::malformed_range_override_input::max_long::ConstraintViolation,
|
2456 - | > {
|
2457 - | if value <= 6 {
|
2458 - | Ok(())
|
2459 - | } else {
|
2460 - | Err(crate::input::malformed_range_override_input::max_long::ConstraintViolation::Range(value))
|
2086 + |
|
2087 + | impl ::std::fmt::Display for ConstraintViolation {
|
2088 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2089 + | let message = match self {
|
2090 + | Self::Length(length) => {
|
2091 + | format!("Value with length {} provided for 'aws.protocoltests.restjson.validation.synthetic#MalformedLengthOverrideInputBlob' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length)
|
2092 + | }
|
2093 + | };
|
2094 + | write!(f, "{message}")
|
2461 2095 | }
|
2462 2096 | }
|
2463 - | }
|
2464 - | impl ::std::convert::TryFrom<i64> for MaxLong {
|
2465 - | type Error = crate::input::malformed_range_override_input::max_long::ConstraintViolation;
|
2466 2097 |
|
2467 - | /// Constructs a `MaxLong` from an [`i64`], failing when the provided value does not satisfy the modeled constraints.
|
2468 - | fn try_from(value: i64) -> ::std::result::Result<Self, Self::Error> {
|
2469 - | Self::check_range(value)?;
|
2470 - |
|
2471 - | Ok(Self(value))
|
2098 + | impl ::std::error::Error for ConstraintViolation {}
|
2099 + | impl ConstraintViolation {
|
2100 + | pub(crate) fn as_validation_exception_field(
|
2101 + | self,
|
2102 + | path: ::std::string::String,
|
2103 + | ) -> crate::model::ValidationExceptionField {
|
2104 + | match self {
|
2105 + | Self::Length(length) => crate::model::ValidationExceptionField {
|
2106 + | message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length, &path),
|
2107 + | path,
|
2108 + | },
|
2109 + | }
|
2110 + | }
|
2472 2111 | }
|
2473 2112 | }
|
2474 - | #[allow(missing_docs)] // documentation missing in model
|
2475 - | ///
|
2476 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
2477 - | /// [constraint traits]. Use [`MinLong::try_from`] to construct values of this type.
|
2478 - | ///
|
2479 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
2480 - | ///
|
2481 - | #[derive(
|
2482 - | ::std::clone::Clone,
|
2483 - | ::std::cmp::Eq,
|
2484 - | ::std::cmp::PartialEq,
|
2485 - | ::std::fmt::Debug,
|
2486 - | ::std::hash::Hash,
|
2487 - | )]
|
2488 - | pub struct MinLong(pub(crate) i64);
|
2489 - | impl MinLong {
|
2490 - | /// Returns an immutable reference to the underlying [`i64`].
|
2491 - | pub fn inner(&self) -> &i64 {
|
2492 - | &self.0
|
2493 - | }
|
2113 + | /// See [`MalformedLengthOverrideInputString`](crate::input::malformed_length_override_input::String).
|
2114 + | pub mod string {
|
2494 2115 |
|
2495 - | /// Consumes the value, returning the underlying [`i64`].
|
2496 - | pub fn into_inner(self) -> i64 {
|
2497 - | self.0
|
2116 + | #[derive(Debug, PartialEq)]
|
2117 + | pub enum ConstraintViolation {
|
2118 + | /// Error when a string doesn't satisfy its `@length` requirements.
|
2119 + | Length(usize),
|
2498 2120 | }
|
2499 - | }
|
2500 - |
|
2501 - | impl crate::constrained::Constrained for MinLong {
|
2502 - | type Unconstrained = i64;
|
2503 - | }
|
2504 2121 |
|
2505 - | impl ::std::convert::From<i64>
|
2506 - | for crate::constrained::MaybeConstrained<
|
2507 - | crate::input::malformed_range_override_input::MinLong,
|
2508 - | >
|
2509 - | {
|
2510 - | fn from(value: i64) -> Self {
|
2511 - | Self::Unconstrained(value)
|
2122 + | impl ::std::fmt::Display for ConstraintViolation {
|
2123 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2124 + | let message = match self {
|
2125 + | Self::Length(length) => {
|
2126 + | format!("Value with length {} provided for 'aws.protocoltests.restjson.validation.synthetic#MalformedLengthOverrideInputString' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length)
|
2127 + | }
|
2128 + | };
|
2129 + | write!(f, "{message}")
|
2130 + | }
|
2512 2131 | }
|
2513 - | }
|
2514 2132 |
|
2515 - | impl ::std::fmt::Display for MinLong {
|
2516 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2517 - | self.0.fmt(f)
|
2133 + | impl ::std::error::Error for ConstraintViolation {}
|
2134 + | impl ConstraintViolation {
|
2135 + | pub(crate) fn as_validation_exception_field(
|
2136 + | self,
|
2137 + | path: ::std::string::String,
|
2138 + | ) -> crate::model::ValidationExceptionField {
|
2139 + | match self {
|
2140 + | Self::Length(length) => crate::model::ValidationExceptionField {
|
2141 + | message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length, &path),
|
2142 + | path,
|
2143 + | },
|
2144 + | }
|
2145 + | }
|
2518 2146 | }
|
2519 2147 | }
|
2148 + | /// See [`MalformedLengthOverrideInputMinString`](crate::input::malformed_length_override_input::MinString).
|
2149 + | pub mod min_string {
|
2520 2150 |
|
2521 - | impl ::std::convert::From<MinLong> for i64 {
|
2522 - | fn from(value: MinLong) -> Self {
|
2523 - | value.into_inner()
|
2151 + | #[derive(Debug, PartialEq)]
|
2152 + | pub enum ConstraintViolation {
|
2153 + | /// Error when a string doesn't satisfy its `@length` requirements.
|
2154 + | Length(usize),
|
2524 2155 | }
|
2525 - | }
|
2526 - | impl MinLong {
|
2527 - | fn check_range(
|
2528 - | value: i64,
|
2529 - | ) -> ::std::result::Result<
|
2530 - | (),
|
2531 - | crate::input::malformed_range_override_input::min_long::ConstraintViolation,
|
2532 - | > {
|
2533 - | if 4 <= value {
|
2534 - | Ok(())
|
2535 - | } else {
|
2536 - | Err(crate::input::malformed_range_override_input::min_long::ConstraintViolation::Range(value))
|
2156 + |
|
2157 + | impl ::std::fmt::Display for ConstraintViolation {
|
2158 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2159 + | let message = match self {
|
2160 + | Self::Length(length) => {
|
2161 + | format!("Value with length {} provided for 'aws.protocoltests.restjson.validation.synthetic#MalformedLengthOverrideInputMinString' failed to satisfy constraint: Member must have length greater than or equal to 4", length)
|
2162 + | }
|
2163 + | };
|
2164 + | write!(f, "{message}")
|
2537 2165 | }
|
2538 2166 | }
|
2539 - | }
|
2540 - | impl ::std::convert::TryFrom<i64> for MinLong {
|
2541 - | type Error = crate::input::malformed_range_override_input::min_long::ConstraintViolation;
|
2542 - |
|
2543 - | /// Constructs a `MinLong` from an [`i64`], failing when the provided value does not satisfy the modeled constraints.
|
2544 - | fn try_from(value: i64) -> ::std::result::Result<Self, Self::Error> {
|
2545 - | Self::check_range(value)?;
|
2546 2167 |
|
2547 - | Ok(Self(value))
|
2168 + | impl ::std::error::Error for ConstraintViolation {}
|
2169 + | impl ConstraintViolation {
|
2170 + | pub(crate) fn as_validation_exception_field(
|
2171 + | self,
|
2172 + | path: ::std::string::String,
|
2173 + | ) -> crate::model::ValidationExceptionField {
|
2174 + | match self {
|
2175 + | Self::Length(length) => crate::model::ValidationExceptionField {
|
2176 + | message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length greater than or equal to 4", length, &path),
|
2177 + | path,
|
2178 + | },
|
2179 + | }
|
2180 + | }
|
2548 2181 | }
|
2549 2182 | }
|
2550 - | #[allow(missing_docs)] // documentation missing in model
|
2551 - | ///
|
2552 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
2553 - | /// [constraint traits]. Use [`Long::try_from`] to construct values of this type.
|
2554 - | ///
|
2555 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
2556 - | ///
|
2557 - | #[derive(
|
2558 - | ::std::clone::Clone,
|
2559 - | ::std::cmp::Eq,
|
2560 - | ::std::cmp::PartialEq,
|
2561 - | ::std::fmt::Debug,
|
2562 - | ::std::hash::Hash,
|
2563 - | )]
|
2564 - | pub struct Long(pub(crate) i64);
|
2565 - | impl Long {
|
2566 - | /// Returns an immutable reference to the underlying [`i64`].
|
2567 - | pub fn inner(&self) -> &i64 {
|
2568 - | &self.0
|
2569 - | }
|
2183 + | /// See [`MalformedLengthOverrideInputMaxString`](crate::input::malformed_length_override_input::MaxString).
|
2184 + | pub mod max_string {
|
2570 2185 |
|
2571 - | /// Consumes the value, returning the underlying [`i64`].
|
2572 - | pub fn into_inner(self) -> i64 {
|
2573 - | self.0
|
2186 + | #[derive(Debug, PartialEq)]
|
2187 + | pub enum ConstraintViolation {
|
2188 + | /// Error when a string doesn't satisfy its `@length` requirements.
|
2189 + | Length(usize),
|
2574 2190 | }
|
2575 - | }
|
2576 - |
|
2577 - | impl crate::constrained::Constrained for Long {
|
2578 - | type Unconstrained = i64;
|
2579 - | }
|
2580 2191 |
|
2581 - | impl ::std::convert::From<i64>
|
2582 - | for crate::constrained::MaybeConstrained<crate::input::malformed_range_override_input::Long>
|
2583 - | {
|
2584 - | fn from(value: i64) -> Self {
|
2585 - | Self::Unconstrained(value)
|
2192 + | impl ::std::fmt::Display for ConstraintViolation {
|
2193 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2194 + | let message = match self {
|
2195 + | Self::Length(length) => {
|
2196 + | format!("Value with length {} provided for 'aws.protocoltests.restjson.validation.synthetic#MalformedLengthOverrideInputMaxString' failed to satisfy constraint: Member must have length less than or equal to 6", length)
|
2197 + | }
|
2198 + | };
|
2199 + | write!(f, "{message}")
|
2200 + | }
|
2586 2201 | }
|
2587 - | }
|
2588 2202 |
|
2589 - | impl ::std::fmt::Display for Long {
|
2590 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2591 - | self.0.fmt(f)
|
2203 + | impl ::std::error::Error for ConstraintViolation {}
|
2204 + | impl ConstraintViolation {
|
2205 + | pub(crate) fn as_validation_exception_field(
|
2206 + | self,
|
2207 + | path: ::std::string::String,
|
2208 + | ) -> crate::model::ValidationExceptionField {
|
2209 + | match self {
|
2210 + | Self::Length(length) => crate::model::ValidationExceptionField {
|
2211 + | message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length less than or equal to 6", length, &path),
|
2212 + | path,
|
2213 + | },
|
2214 + | }
|
2215 + | }
|
2592 2216 | }
|
2593 2217 | }
|
2218 + | pub(crate) mod malformed_length_override_input_list_unconstrained {
|
2594 2219 |
|
2595 - | impl ::std::convert::From<Long> for i64 {
|
2596 - | fn from(value: Long) -> Self {
|
2597 - | value.into_inner()
|
2220 + | #[derive(Debug, Clone)]
|
2221 + | pub(crate) struct MalformedLengthOverrideInputListUnconstrained(
|
2222 + | pub(crate) std::vec::Vec<::std::string::String>,
|
2223 + | );
|
2224 + |
|
2225 + | impl From<MalformedLengthOverrideInputListUnconstrained>
|
2226 + | for crate::constrained::MaybeConstrained<
|
2227 + | crate::input::malformed_length_override_input::List,
|
2228 + | >
|
2229 + | {
|
2230 + | fn from(value: MalformedLengthOverrideInputListUnconstrained) -> Self {
|
2231 + | Self::Unconstrained(value)
|
2232 + | }
|
2598 2233 | }
|
2599 - | }
|
2600 - | impl Long {
|
2601 - | fn check_range(
|
2602 - | value: i64,
|
2603 - | ) -> ::std::result::Result<
|
2604 - | (),
|
2605 - | crate::input::malformed_range_override_input::long::ConstraintViolation,
|
2606 - | > {
|
2607 - | if (4..=6).contains(&value) {
|
2608 - | Ok(())
|
2609 - | } else {
|
2610 - | Err(
|
2611 - | crate::input::malformed_range_override_input::long::ConstraintViolation::Range(
|
2612 - | value,
|
2613 - | ),
|
2614 - | )
|
2234 + | impl std::convert::TryFrom<MalformedLengthOverrideInputListUnconstrained>
|
2235 + | for crate::input::malformed_length_override_input::List
|
2236 + | {
|
2237 + | type Error = crate::input::malformed_length_override_input::list::ConstraintViolation;
|
2238 + | fn try_from(
|
2239 + | value: MalformedLengthOverrideInputListUnconstrained,
|
2240 + | ) -> std::result::Result<Self, Self::Error> {
|
2241 + | let res: ::std::result::Result<
|
2242 + | ::std::vec::Vec<crate::model::LengthString>,
|
2243 + | (usize, crate::model::length_string::ConstraintViolation),
|
2244 + | > = value
|
2245 + | .0
|
2246 + | .into_iter()
|
2247 + | .enumerate()
|
2248 + | .map(|(idx, inner)| {
|
2249 + | inner
|
2250 + | .try_into()
|
2251 + | .map_err(|inner_violation| (idx, inner_violation))
|
2252 + | })
|
2253 + | .collect();
|
2254 + | let inner = res
|
2255 + | .map_err(|(idx, inner_violation)| Self::Error::Member(idx, inner_violation))?;
|
2256 + | Self::try_from(inner)
|
2615 2257 | }
|
2616 2258 | }
|
2617 2259 | }
|
2618 - | impl ::std::convert::TryFrom<i64> for Long {
|
2619 - | type Error = crate::input::malformed_range_override_input::long::ConstraintViolation;
|
2620 - |
|
2621 - | /// Constructs a `Long` from an [`i64`], failing when the provided value does not satisfy the modeled constraints.
|
2622 - | fn try_from(value: i64) -> ::std::result::Result<Self, Self::Error> {
|
2623 - | Self::check_range(value)?;
|
2260 + | /// See [`MalformedLengthOverrideInputList`](crate::input::malformed_length_override_input::List).
|
2261 + | pub mod list {
|
2624 2262 |
|
2625 - | Ok(Self(value))
|
2626 - | }
|
2627 - | }
|
2628 - | #[allow(missing_docs)] // documentation missing in model
|
2629 - | ///
|
2630 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
2631 - | /// [constraint traits]. Use [`MaxInteger::try_from`] to construct values of this type.
|
2632 - | ///
|
2633 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
2634 - | ///
|
2635 - | #[derive(
|
2636 - | ::std::clone::Clone,
|
2637 - | ::std::cmp::Eq,
|
2638 - | ::std::cmp::PartialEq,
|
2639 - | ::std::fmt::Debug,
|
2640 - | ::std::hash::Hash,
|
2641 - | )]
|
2642 - | pub struct MaxInteger(pub(crate) i32);
|
2643 - | impl MaxInteger {
|
2644 - | /// Returns an immutable reference to the underlying [`i32`].
|
2645 - | pub fn inner(&self) -> &i32 {
|
2646 - | &self.0
|
2263 + | #[allow(clippy::enum_variant_names)]
|
2264 + | #[derive(Debug, PartialEq)]
|
2265 + | pub enum ConstraintViolation {
|
2266 + | /// Constraint violation error when the list doesn't have the required length
|
2267 + | Length(usize),
|
2268 + | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
2269 + | /// The first component of the tuple is the index in the collection where the
|
2270 + | /// first constraint violation was found.
|
2271 + | #[doc(hidden)]
|
2272 + | Member(usize, crate::model::length_string::ConstraintViolation),
|
2647 2273 | }
|
2648 2274 |
|
2649 - | /// Consumes the value, returning the underlying [`i32`].
|
2650 - | pub fn into_inner(self) -> i32 {
|
2651 - | self.0
|
2275 + | impl ::std::fmt::Display for ConstraintViolation {
|
2276 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2277 + | let message = match self {
|
2278 + | Self::Length(length) => {
|
2279 + | format!("Value with length {} provided for 'aws.protocoltests.restjson.validation.synthetic#MalformedLengthOverrideInputList' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length)
|
2280 + | }
|
2281 + | Self::Member(index, failing_member) => format!(
|
2282 + | "Value at index {index} failed to satisfy constraint. {}",
|
2283 + | failing_member
|
2284 + | ),
|
2285 + | };
|
2286 + | write!(f, "{message}")
|
2287 + | }
|
2652 2288 | }
|
2653 - | }
|
2654 - |
|
2655 - | impl crate::constrained::Constrained for MaxInteger {
|
2656 - | type Unconstrained = i32;
|
2657 - | }
|
2658 2289 |
|
2659 - | impl ::std::convert::From<i32>
|
2660 - | for crate::constrained::MaybeConstrained<
|
2661 - | crate::input::malformed_range_override_input::MaxInteger,
|
2662 - | >
|
2663 - | {
|
2664 - | fn from(value: i32) -> Self {
|
2665 - | Self::Unconstrained(value)
|
2290 + | impl ::std::error::Error for ConstraintViolation {}
|
2291 + | impl ConstraintViolation {
|
2292 + | pub(crate) fn as_validation_exception_field(
|
2293 + | self,
|
2294 + | path: ::std::string::String,
|
2295 + | ) -> crate::model::ValidationExceptionField {
|
2296 + | match self {
|
2297 + | Self::Length(length) => crate::model::ValidationExceptionField {
|
2298 + | message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length, &path),
|
2299 + | path,
|
2300 + | },
|
2301 + | Self::Member(index, member_constraint_violation) =>
|
2302 + | member_constraint_violation.as_validation_exception_field(path + "/" + &index.to_string())
|
2303 + | }
|
2304 + | }
|
2666 2305 | }
|
2667 2306 | }
|
2307 + | pub(crate) mod malformed_length_override_input_map_unconstrained {
|
2668 2308 |
|
2669 - | impl ::std::fmt::Display for MaxInteger {
|
2670 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2671 - | self.0.fmt(f)
|
2672 - | }
|
2673 - | }
|
2309 + | #[derive(Debug, Clone)]
|
2310 + | pub(crate) struct MalformedLengthOverrideInputMapUnconstrained(
|
2311 + | pub(crate) std::collections::HashMap<
|
2312 + | ::std::string::String,
|
2313 + | crate::unconstrained::length_list_unconstrained::LengthListUnconstrained,
|
2314 + | >,
|
2315 + | );
|
2674 2316 |
|
2675 - | impl ::std::convert::From<MaxInteger> for i32 {
|
2676 - | fn from(value: MaxInteger) -> Self {
|
2677 - | value.into_inner()
|
2678 - | }
|
2679 - | }
|
2680 - | impl MaxInteger {
|
2681 - | fn check_range(
|
2682 - | value: i32,
|
2683 - | ) -> ::std::result::Result<
|
2684 - | (),
|
2685 - | crate::input::malformed_range_override_input::max_integer::ConstraintViolation,
|
2686 - | > {
|
2687 - | if value <= 6 {
|
2688 - | Ok(())
|
2689 - | } else {
|
2690 - | Err(crate::input::malformed_range_override_input::max_integer::ConstraintViolation::Range(value))
|
2317 + | impl From<MalformedLengthOverrideInputMapUnconstrained>
|
2318 + | for crate::constrained::MaybeConstrained<
|
2319 + | crate::input::malformed_length_override_input::Map,
|
2320 + | >
|
2321 + | {
|
2322 + | fn from(value: MalformedLengthOverrideInputMapUnconstrained) -> Self {
|
2323 + | Self::Unconstrained(value)
|
2691 2324 | }
|
2692 2325 | }
|
2693 - | }
|
2694 - | impl ::std::convert::TryFrom<i32> for MaxInteger {
|
2695 - | type Error = crate::input::malformed_range_override_input::max_integer::ConstraintViolation;
|
2696 - |
|
2697 - | /// Constructs a `MaxInteger` from an [`i32`], failing when the provided value does not satisfy the modeled constraints.
|
2698 - | fn try_from(value: i32) -> ::std::result::Result<Self, Self::Error> {
|
2699 - | Self::check_range(value)?;
|
2326 + | impl std::convert::TryFrom<MalformedLengthOverrideInputMapUnconstrained>
|
2327 + | for crate::input::malformed_length_override_input::Map
|
2328 + | {
|
2329 + | type Error = crate::input::malformed_length_override_input::map::ConstraintViolation;
|
2330 + | fn try_from(
|
2331 + | value: MalformedLengthOverrideInputMapUnconstrained,
|
2332 + | ) -> std::result::Result<Self, Self::Error> {
|
2333 + | let res: ::std::result::Result<
|
2334 + | ::std::collections::HashMap<
|
2335 + | crate::model::LengthString,
|
2336 + | crate::model::LengthList,
|
2337 + | >,
|
2338 + | Self::Error,
|
2339 + | > = value
|
2340 + | .0
|
2341 + | .into_iter()
|
2342 + | .map(|(k, v)| {
|
2343 + | let k: crate::model::LengthString =
|
2344 + | k.try_into().map_err(Self::Error::Key)?;
|
2700 2345 |
|
2701 - | Ok(Self(value))
|
2346 + | match crate::model::LengthList::try_from(v) {
|
2347 + | Ok(v) => Ok((k, v)),
|
2348 + | Err(inner_constraint_violation) => {
|
2349 + | Err(Self::Error::Value(k, inner_constraint_violation))
|
2350 + | }
|
2351 + | }
|
2352 + | })
|
2353 + | .collect();
|
2354 + | let hm = res?;
|
2355 + | Self::try_from(hm)
|
2356 + | }
|
2702 2357 | }
|
2703 2358 | }
|
2704 - | #[allow(missing_docs)] // documentation missing in model
|
2705 - | ///
|
2706 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
2707 - | /// [constraint traits]. Use [`MinInteger::try_from`] to construct values of this type.
|
2708 - | ///
|
2709 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
2710 - | ///
|
2711 - | #[derive(
|
2712 - | ::std::clone::Clone,
|
2713 - | ::std::cmp::Eq,
|
2714 - | ::std::cmp::PartialEq,
|
2715 - | ::std::fmt::Debug,
|
2716 - | ::std::hash::Hash,
|
2717 - | )]
|
2718 - | pub struct MinInteger(pub(crate) i32);
|
2719 - | impl MinInteger {
|
2720 - | /// Returns an immutable reference to the underlying [`i32`].
|
2721 - | pub fn inner(&self) -> &i32 {
|
2722 - | &self.0
|
2723 - | }
|
2359 + | /// See [`MalformedLengthOverrideInputMap`](crate::input::malformed_length_override_input::Map).
|
2360 + | pub mod map {
|
2724 2361 |
|
2725 - | /// Consumes the value, returning the underlying [`i32`].
|
2726 - | pub fn into_inner(self) -> i32 {
|
2727 - | self.0
|
2362 + | #[allow(clippy::enum_variant_names)]
|
2363 + | #[derive(Debug, PartialEq)]
|
2364 + | pub enum ConstraintViolation {
|
2365 + | Length(usize),
|
2366 + | #[doc(hidden)]
|
2367 + | Key(crate::model::length_string::ConstraintViolation),
|
2368 + | #[doc(hidden)]
|
2369 + | Value(
|
2370 + | crate::model::LengthString,
|
2371 + | crate::model::length_list::ConstraintViolation,
|
2372 + | ),
|
2728 2373 | }
|
2729 - | }
|
2730 2374 |
|
2731 - | impl crate::constrained::Constrained for MinInteger {
|
2732 - | type Unconstrained = i32;
|
2733 - | }
|
2734 - |
|
2735 - | impl ::std::convert::From<i32>
|
2736 - | for crate::constrained::MaybeConstrained<
|
2737 - | crate::input::malformed_range_override_input::MinInteger,
|
2738 - | >
|
2739 - | {
|
2740 - | fn from(value: i32) -> Self {
|
2741 - | Self::Unconstrained(value)
|
2375 + | impl ::std::fmt::Display for ConstraintViolation {
|
2376 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2377 + | match self {
|
2378 + | Self::Length(length) => {
|
2379 + | write!(f, "Value with length {} provided for 'aws.protocoltests.restjson.validation.synthetic#MalformedLengthOverrideInputMap' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length)
|
2380 + | }
|
2381 + | Self::Key(key_constraint_violation) => {
|
2382 + | write!(f, "{}", key_constraint_violation)
|
2383 + | }
|
2384 + | Self::Value(_, value_constraint_violation) => {
|
2385 + | write!(f, "{}", value_constraint_violation)
|
2386 + | }
|
2387 + | }
|
2388 + | }
|
2742 2389 | }
|
2743 - | }
|
2744 2390 |
|
2745 - | impl ::std::fmt::Display for MinInteger {
|
2746 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2747 - | self.0.fmt(f)
|
2391 + | impl ::std::error::Error for ConstraintViolation {}
|
2392 + | impl ConstraintViolation {
|
2393 + | pub(crate) fn as_validation_exception_field(
|
2394 + | self,
|
2395 + | path: ::std::string::String,
|
2396 + | ) -> crate::model::ValidationExceptionField {
|
2397 + | match self {
|
2398 + | Self::Length(length) => crate::model::ValidationExceptionField {
|
2399 + | message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length, &path),
|
2400 + | path,
|
2401 + | },
|
2402 + | Self::Key(key_constraint_violation) => key_constraint_violation.as_validation_exception_field(path),
|
2403 + | Self::Value(key, value_constraint_violation) => value_constraint_violation.as_validation_exception_field(path + "/" + key.as_str()),
|
2404 + | }
|
2405 + | }
|
2748 2406 | }
|
2749 2407 | }
|
2408 + | }
|
2409 + | /// See [`MalformedLengthQueryStringInput`](crate::input::MalformedLengthQueryStringInput).
|
2410 + | pub mod malformed_length_query_string_input {
|
2750 2411 |
|
2751 - | impl ::std::convert::From<MinInteger> for i32 {
|
2752 - | fn from(value: MinInteger) -> Self {
|
2753 - | value.into_inner()
|
2412 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
2413 + | /// Holds one variant for each of the ways the builder can fail.
|
2414 + | #[non_exhaustive]
|
2415 + | #[allow(clippy::enum_variant_names)]
|
2416 + | pub enum ConstraintViolation {
|
2417 + | /// Constraint violation occurred building member `string` when building `MalformedLengthQueryStringInput`.
|
2418 + | #[doc(hidden)]
|
2419 + | String(crate::model::length_string::ConstraintViolation),
|
2420 + | }
|
2421 + | impl ::std::fmt::Display for ConstraintViolation {
|
2422 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2423 + | match self {
|
2424 + | ConstraintViolation::String(_) => write!(f, "constraint violation occurred building member `string` when building `MalformedLengthQueryStringInput`"),
|
2425 + | }
|
2754 2426 | }
|
2755 2427 | }
|
2756 - | impl MinInteger {
|
2757 - | fn check_range(
|
2758 - | value: i32,
|
2759 - | ) -> ::std::result::Result<
|
2760 - | (),
|
2761 - | crate::input::malformed_range_override_input::min_integer::ConstraintViolation,
|
2762 - | > {
|
2763 - | if 4 <= value {
|
2764 - | Ok(())
|
2765 - | } else {
|
2766 - | Err(crate::input::malformed_range_override_input::min_integer::ConstraintViolation::Range(value))
|
2428 + | impl ::std::error::Error for ConstraintViolation {}
|
2429 + | impl ConstraintViolation {
|
2430 + | pub(crate) fn as_validation_exception_field(
|
2431 + | self,
|
2432 + | path: ::std::string::String,
|
2433 + | ) -> crate::model::ValidationExceptionField {
|
2434 + | match self {
|
2435 + | ConstraintViolation::String(inner) => {
|
2436 + | inner.as_validation_exception_field(path + "/string")
|
2437 + | }
|
2767 2438 | }
|
2768 2439 | }
|
2769 2440 | }
|
2770 - | impl ::std::convert::TryFrom<i32> for MinInteger {
|
2771 - | type Error = crate::input::malformed_range_override_input::min_integer::ConstraintViolation;
|
2772 - |
|
2773 - | /// Constructs a `MinInteger` from an [`i32`], failing when the provided value does not satisfy the modeled constraints.
|
2774 - | fn try_from(value: i32) -> ::std::result::Result<Self, Self::Error> {
|
2775 - | Self::check_range(value)?;
|
2776 - |
|
2777 - | Ok(Self(value))
|
2778 - | }
|
2779 - | }
|
2780 - | #[allow(missing_docs)] // documentation missing in model
|
2781 - | ///
|
2782 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
2783 - | /// [constraint traits]. Use [`Integer::try_from`] to construct values of this type.
|
2784 - | ///
|
2785 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
2786 - | ///
|
2787 - | #[derive(
|
2788 - | ::std::clone::Clone,
|
2789 - | ::std::cmp::Eq,
|
2790 - | ::std::cmp::PartialEq,
|
2791 - | ::std::fmt::Debug,
|
2792 - | ::std::hash::Hash,
|
2793 - | )]
|
2794 - | pub struct Integer(pub(crate) i32);
|
2795 - | impl Integer {
|
2796 - | /// Returns an immutable reference to the underlying [`i32`].
|
2797 - | pub fn inner(&self) -> &i32 {
|
2798 - | &self.0
|
2799 - | }
|
2800 - |
|
2801 - | /// Consumes the value, returning the underlying [`i32`].
|
2802 - | pub fn into_inner(self) -> i32 {
|
2803 - | self.0
|
2441 + | impl ::std::convert::From<ConstraintViolation>
|
2442 + | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
2443 + | {
|
2444 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
2445 + | let first_validation_exception_field =
|
2446 + | constraint_violation.as_validation_exception_field("".to_owned());
|
2447 + | let validation_exception = crate::error::ValidationException {
|
2448 + | message: format!(
|
2449 + | "1 validation error detected. {}",
|
2450 + | &first_validation_exception_field.message
|
2451 + | ),
|
2452 + | field_list: Some(vec![first_validation_exception_field]),
|
2453 + | };
|
2454 + | Self::ConstraintViolation(
|
2455 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
2456 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
2457 + | )
|
2804 2458 | }
|
2805 2459 | }
|
2806 - |
|
2807 - | impl crate::constrained::Constrained for Integer {
|
2808 - | type Unconstrained = i32;
|
2809 - | }
|
2810 - |
|
2811 - | impl ::std::convert::From<i32>
|
2812 - | for crate::constrained::MaybeConstrained<
|
2813 - | crate::input::malformed_range_override_input::Integer,
|
2814 - | >
|
2460 + | impl ::std::convert::From<Builder>
|
2461 + | for crate::constrained::MaybeConstrained<crate::input::MalformedLengthQueryStringInput>
|
2815 2462 | {
|
2816 - | fn from(value: i32) -> Self {
|
2817 - | Self::Unconstrained(value)
|
2463 + | fn from(builder: Builder) -> Self {
|
2464 + | Self::Unconstrained(builder)
|
2818 2465 | }
|
2819 2466 | }
|
2467 + | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedLengthQueryStringInput {
|
2468 + | type Error = ConstraintViolation;
|
2820 2469 |
|
2821 - | impl ::std::fmt::Display for Integer {
|
2822 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2823 - | self.0.fmt(f)
|
2470 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
2471 + | builder.build()
|
2824 2472 | }
|
2825 2473 | }
|
2826 - |
|
2827 - | impl ::std::convert::From<Integer> for i32 {
|
2828 - | fn from(value: Integer) -> Self {
|
2829 - | value.into_inner()
|
2830 - | }
|
2474 + | /// A builder for [`MalformedLengthQueryStringInput`](crate::input::MalformedLengthQueryStringInput).
|
2475 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2476 + | pub struct Builder {
|
2477 + | pub(crate) string:
|
2478 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::LengthString>>,
|
2831 2479 | }
|
2832 - | impl Integer {
|
2833 - | fn check_range(
|
2834 - | value: i32,
|
2835 - | ) -> ::std::result::Result<
|
2836 - | (),
|
2837 - | crate::input::malformed_range_override_input::integer::ConstraintViolation,
|
2838 - | > {
|
2839 - | if (4..=6).contains(&value) {
|
2840 - | Ok(())
|
2841 - | } else {
|
2842 - | Err(crate::input::malformed_range_override_input::integer::ConstraintViolation::Range(value))
|
2843 - | }
|
2480 + | impl Builder {
|
2481 + | #[allow(missing_docs)] // documentation missing in model
|
2482 + | pub fn string(mut self, input: ::std::option::Option<crate::model::LengthString>) -> Self {
|
2483 + | self.string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2484 + | self
|
2844 2485 | }
|
2845 - | }
|
2846 - | impl ::std::convert::TryFrom<i32> for Integer {
|
2847 - | type Error = crate::input::malformed_range_override_input::integer::ConstraintViolation;
|
2848 - |
|
2849 - | /// Constructs a `Integer` from an [`i32`], failing when the provided value does not satisfy the modeled constraints.
|
2850 - | fn try_from(value: i32) -> ::std::result::Result<Self, Self::Error> {
|
2851 - | Self::check_range(value)?;
|
2852 - |
|
2853 - | Ok(Self(value))
|
2486 + | #[allow(missing_docs)] // documentation missing in model
|
2487 + | pub(crate) fn set_string(
|
2488 + | mut self,
|
2489 + | input: Option<
|
2490 + | impl ::std::convert::Into<
|
2491 + | crate::constrained::MaybeConstrained<crate::model::LengthString>,
|
2492 + | >,
|
2493 + | >,
|
2494 + | ) -> Self {
|
2495 + | self.string = input.map(|v| v.into());
|
2496 + | self
|
2854 2497 | }
|
2855 - | }
|
2856 - | #[allow(missing_docs)] // documentation missing in model
|
2857 - | ///
|
2858 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
2859 - | /// [constraint traits]. Use [`MaxShort::try_from`] to construct values of this type.
|
2860 - | ///
|
2861 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
2862 - | ///
|
2863 - | #[derive(
|
2864 - | ::std::clone::Clone,
|
2865 - | ::std::cmp::Eq,
|
2866 - | ::std::cmp::PartialEq,
|
2867 - | ::std::fmt::Debug,
|
2868 - | ::std::hash::Hash,
|
2869 - | )]
|
2870 - | pub struct MaxShort(pub(crate) i16);
|
2871 - | impl MaxShort {
|
2872 - | /// Returns an immutable reference to the underlying [`i16`].
|
2873 - | pub fn inner(&self) -> &i16 {
|
2874 - | &self.0
|
2498 + | /// Consumes the builder and constructs a [`MalformedLengthQueryStringInput`](crate::input::MalformedLengthQueryStringInput).
|
2499 + | ///
|
2500 + | /// The builder fails to construct a [`MalformedLengthQueryStringInput`](crate::input::MalformedLengthQueryStringInput) if a [`ConstraintViolation`] occurs.
|
2501 + | ///
|
2502 + | pub fn build(
|
2503 + | self,
|
2504 + | ) -> Result<crate::input::MalformedLengthQueryStringInput, ConstraintViolation> {
|
2505 + | self.build_enforcing_all_constraints()
|
2875 2506 | }
|
2876 - |
|
2877 - | /// Consumes the value, returning the underlying [`i16`].
|
2878 - | pub fn into_inner(self) -> i16 {
|
2879 - | self.0
|
2507 + | fn build_enforcing_all_constraints(
|
2508 + | self,
|
2509 + | ) -> Result<crate::input::MalformedLengthQueryStringInput, ConstraintViolation> {
|
2510 + | Ok(crate::input::MalformedLengthQueryStringInput {
|
2511 + | string: self
|
2512 + | .string
|
2513 + | .map(|v| match v {
|
2514 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2515 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2516 + | })
|
2517 + | .map(|res| res.map_err(ConstraintViolation::String))
|
2518 + | .transpose()?,
|
2519 + | })
|
2880 2520 | }
|
2881 2521 | }
|
2522 + | }
|
2523 + | /// See [`MalformedPatternInput`](crate::input::MalformedPatternInput).
|
2524 + | pub mod malformed_pattern_input {
|
2882 2525 |
|
2883 - | impl crate::constrained::Constrained for MaxShort {
|
2884 - | type Unconstrained = i16;
|
2885 - | }
|
2886 - |
|
2887 - | impl ::std::convert::From<i16>
|
2888 - | for crate::constrained::MaybeConstrained<
|
2889 - | crate::input::malformed_range_override_input::MaxShort,
|
2890 - | >
|
2891 - | {
|
2892 - | fn from(value: i16) -> Self {
|
2893 - | Self::Unconstrained(value)
|
2894 - | }
|
2526 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
2527 + | /// Holds one variant for each of the ways the builder can fail.
|
2528 + | #[non_exhaustive]
|
2529 + | #[allow(clippy::enum_variant_names)]
|
2530 + | pub enum ConstraintViolation {
|
2531 + | /// Constraint violation occurred building member `string` when building `MalformedPatternInput`.
|
2532 + | #[doc(hidden)]
|
2533 + | String(crate::model::pattern_string::ConstraintViolation),
|
2534 + | /// Constraint violation occurred building member `evil_string` when building `MalformedPatternInput`.
|
2535 + | #[doc(hidden)]
|
2536 + | EvilString(crate::model::evil_string::ConstraintViolation),
|
2537 + | /// Constraint violation occurred building member `list` when building `MalformedPatternInput`.
|
2538 + | #[doc(hidden)]
|
2539 + | List(crate::model::pattern_list::ConstraintViolation),
|
2540 + | /// Constraint violation occurred building member `map` when building `MalformedPatternInput`.
|
2541 + | #[doc(hidden)]
|
2542 + | Map(crate::model::pattern_map::ConstraintViolation),
|
2543 + | /// Constraint violation occurred building member `union` when building `MalformedPatternInput`.
|
2544 + | #[doc(hidden)]
|
2545 + | Union(crate::model::pattern_union::ConstraintViolation),
|
2895 2546 | }
|
2896 - |
|
2897 - | impl ::std::fmt::Display for MaxShort {
|
2547 + | impl ::std::fmt::Display for ConstraintViolation {
|
2898 2548 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2899 - | self.0.fmt(f)
|
2900 - | }
|
2901 - | }
|
2902 - |
|
2903 - | impl ::std::convert::From<MaxShort> for i16 {
|
2904 - | fn from(value: MaxShort) -> Self {
|
2905 - | value.into_inner()
|
2906 - | }
|
2907 - | }
|
2908 - | impl MaxShort {
|
2909 - | fn check_range(
|
2910 - | value: i16,
|
2911 - | ) -> ::std::result::Result<
|
2912 - | (),
|
2913 - | crate::input::malformed_range_override_input::max_short::ConstraintViolation,
|
2914 - | > {
|
2915 - | if value <= 6 {
|
2916 - | Ok(())
|
2917 - | } else {
|
2918 - | Err(crate::input::malformed_range_override_input::max_short::ConstraintViolation::Range(value))
|
2549 + | match self {
|
2550 + | ConstraintViolation::String(_) => write!(f, "constraint violation occurred building member `string` when building `MalformedPatternInput`"),
|
2551 + | ConstraintViolation::EvilString(_) => write!(f, "constraint violation occurred building member `evil_string` when building `MalformedPatternInput`"),
|
2552 + | ConstraintViolation::List(_) => write!(f, "constraint violation occurred building member `list` when building `MalformedPatternInput`"),
|
2553 + | ConstraintViolation::Map(_) => write!(f, "constraint violation occurred building member `map` when building `MalformedPatternInput`"),
|
2554 + | ConstraintViolation::Union(_) => write!(f, "constraint violation occurred building member `union` when building `MalformedPatternInput`"),
|
2919 2555 | }
|
2920 2556 | }
|
2921 2557 | }
|
2922 - | impl ::std::convert::TryFrom<i16> for MaxShort {
|
2923 - | type Error = crate::input::malformed_range_override_input::max_short::ConstraintViolation;
|
2924 - |
|
2925 - | /// Constructs a `MaxShort` from an [`i16`], failing when the provided value does not satisfy the modeled constraints.
|
2926 - | fn try_from(value: i16) -> ::std::result::Result<Self, Self::Error> {
|
2927 - | Self::check_range(value)?;
|
2928 - |
|
2929 - | Ok(Self(value))
|
2558 + | impl ::std::error::Error for ConstraintViolation {}
|
2559 + | impl ConstraintViolation {
|
2560 + | pub(crate) fn as_validation_exception_field(
|
2561 + | self,
|
2562 + | path: ::std::string::String,
|
2563 + | ) -> crate::model::ValidationExceptionField {
|
2564 + | match self {
|
2565 + | ConstraintViolation::String(inner) => {
|
2566 + | inner.as_validation_exception_field(path + "/string")
|
2567 + | }
|
2568 + | ConstraintViolation::EvilString(inner) => {
|
2569 + | inner.as_validation_exception_field(path + "/evilString")
|
2570 + | }
|
2571 + | ConstraintViolation::List(inner) => {
|
2572 + | inner.as_validation_exception_field(path + "/list")
|
2573 + | }
|
2574 + | ConstraintViolation::Map(inner) => {
|
2575 + | inner.as_validation_exception_field(path + "/map")
|
2576 + | }
|
2577 + | ConstraintViolation::Union(inner) => {
|
2578 + | inner.as_validation_exception_field(path + "/union")
|
2579 + | }
|
2580 + | }
|
2930 2581 | }
|
2931 2582 | }
|
2932 - | #[allow(missing_docs)] // documentation missing in model
|
2933 - | ///
|
2934 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
2935 - | /// [constraint traits]. Use [`MinShort::try_from`] to construct values of this type.
|
2936 - | ///
|
2937 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
2938 - | ///
|
2939 - | #[derive(
|
2940 - | ::std::clone::Clone,
|
2941 - | ::std::cmp::Eq,
|
2942 - | ::std::cmp::PartialEq,
|
2943 - | ::std::fmt::Debug,
|
2944 - | ::std::hash::Hash,
|
2945 - | )]
|
2946 - | pub struct MinShort(pub(crate) i16);
|
2947 - | impl MinShort {
|
2948 - | /// Returns an immutable reference to the underlying [`i16`].
|
2949 - | pub fn inner(&self) -> &i16 {
|
2950 - | &self.0
|
2951 - | }
|
2952 - |
|
2953 - | /// Consumes the value, returning the underlying [`i16`].
|
2954 - | pub fn into_inner(self) -> i16 {
|
2955 - | self.0
|
2583 + | impl ::std::convert::From<ConstraintViolation>
|
2584 + | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
2585 + | {
|
2586 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
2587 + | let first_validation_exception_field =
|
2588 + | constraint_violation.as_validation_exception_field("".to_owned());
|
2589 + | let validation_exception = crate::error::ValidationException {
|
2590 + | message: format!(
|
2591 + | "1 validation error detected. {}",
|
2592 + | &first_validation_exception_field.message
|
2593 + | ),
|
2594 + | field_list: Some(vec![first_validation_exception_field]),
|
2595 + | };
|
2596 + | Self::ConstraintViolation(
|
2597 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
2598 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
2599 + | )
|
2956 2600 | }
|
2957 2601 | }
|
2958 - |
|
2959 - | impl crate::constrained::Constrained for MinShort {
|
2960 - | type Unconstrained = i16;
|
2961 - | }
|
2962 - |
|
2963 - | impl ::std::convert::From<i16>
|
2964 - | for crate::constrained::MaybeConstrained<
|
2965 - | crate::input::malformed_range_override_input::MinShort,
|
2966 - | >
|
2602 + | impl ::std::convert::From<Builder>
|
2603 + | for crate::constrained::MaybeConstrained<crate::input::MalformedPatternInput>
|
2967 2604 | {
|
2968 - | fn from(value: i16) -> Self {
|
2969 - | Self::Unconstrained(value)
|
2605 + | fn from(builder: Builder) -> Self {
|
2606 + | Self::Unconstrained(builder)
|
2970 2607 | }
|
2971 2608 | }
|
2609 + | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedPatternInput {
|
2610 + | type Error = ConstraintViolation;
|
2972 2611 |
|
2973 - | impl ::std::fmt::Display for MinShort {
|
2974 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2975 - | self.0.fmt(f)
|
2612 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
2613 + | builder.build()
|
2976 2614 | }
|
2977 2615 | }
|
2978 - |
|
2979 - | impl ::std::convert::From<MinShort> for i16 {
|
2980 - | fn from(value: MinShort) -> Self {
|
2981 - | value.into_inner()
|
2982 - | }
|
2616 + | /// A builder for [`MalformedPatternInput`](crate::input::MalformedPatternInput).
|
2617 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2618 + | pub struct Builder {
|
2619 + | pub(crate) string: ::std::option::Option<
|
2620 + | crate::constrained::MaybeConstrained<crate::model::PatternString>,
|
2621 + | >,
|
2622 + | pub(crate) evil_string:
|
2623 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::EvilString>>,
|
2624 + | pub(crate) list: ::std::option::Option<
|
2625 + | crate::constrained::MaybeConstrained<
|
2626 + | crate::constrained::pattern_list_constrained::PatternListConstrained,
|
2627 + | >,
|
2628 + | >,
|
2629 + | pub(crate) map: ::std::option::Option<
|
2630 + | crate::constrained::MaybeConstrained<
|
2631 + | crate::constrained::pattern_map_constrained::PatternMapConstrained,
|
2632 + | >,
|
2633 + | >,
|
2634 + | pub(crate) union:
|
2635 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::PatternUnion>>,
|
2983 2636 | }
|
2984 - | impl MinShort {
|
2985 - | fn check_range(
|
2986 - | value: i16,
|
2987 - | ) -> ::std::result::Result<
|
2988 - | (),
|
2989 - | crate::input::malformed_range_override_input::min_short::ConstraintViolation,
|
2990 - | > {
|
2991 - | if 4 <= value {
|
2992 - | Ok(())
|
2993 - | } else {
|
2994 - | Err(crate::input::malformed_range_override_input::min_short::ConstraintViolation::Range(value))
|
2995 - | }
|
2637 + | impl Builder {
|
2638 + | #[allow(missing_docs)] // documentation missing in model
|
2639 + | pub fn string(mut self, input: ::std::option::Option<crate::model::PatternString>) -> Self {
|
2640 + | self.string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2641 + | self
|
2996 2642 | }
|
2997 - | }
|
2998 - | impl ::std::convert::TryFrom<i16> for MinShort {
|
2999 - | type Error = crate::input::malformed_range_override_input::min_short::ConstraintViolation;
|
3000 - |
|
3001 - | /// Constructs a `MinShort` from an [`i16`], failing when the provided value does not satisfy the modeled constraints.
|
3002 - | fn try_from(value: i16) -> ::std::result::Result<Self, Self::Error> {
|
3003 - | Self::check_range(value)?;
|
3004 - |
|
3005 - | Ok(Self(value))
|
2643 + | #[allow(missing_docs)] // documentation missing in model
|
2644 + | pub(crate) fn set_string(
|
2645 + | mut self,
|
2646 + | input: Option<
|
2647 + | impl ::std::convert::Into<
|
2648 + | crate::constrained::MaybeConstrained<crate::model::PatternString>,
|
2649 + | >,
|
2650 + | >,
|
2651 + | ) -> Self {
|
2652 + | self.string = input.map(|v| v.into());
|
2653 + | self
|
3006 2654 | }
|
3007 - | }
|
3008 - | #[allow(missing_docs)] // documentation missing in model
|
3009 - | ///
|
3010 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
3011 - | /// [constraint traits]. Use [`Short::try_from`] to construct values of this type.
|
3012 - | ///
|
3013 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
3014 - | ///
|
3015 - | #[derive(
|
3016 - | ::std::clone::Clone,
|
3017 - | ::std::cmp::Eq,
|
3018 - | ::std::cmp::PartialEq,
|
3019 - | ::std::fmt::Debug,
|
3020 - | ::std::hash::Hash,
|
3021 - | )]
|
3022 - | pub struct Short(pub(crate) i16);
|
3023 - | impl Short {
|
3024 - | /// Returns an immutable reference to the underlying [`i16`].
|
3025 - | pub fn inner(&self) -> &i16 {
|
3026 - | &self.0
|
2655 + | #[allow(missing_docs)] // documentation missing in model
|
2656 + | pub fn evil_string(
|
2657 + | mut self,
|
2658 + | input: ::std::option::Option<crate::model::EvilString>,
|
2659 + | ) -> Self {
|
2660 + | self.evil_string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2661 + | self
|
3027 2662 | }
|
3028 - |
|
3029 - | /// Consumes the value, returning the underlying [`i16`].
|
3030 - | pub fn into_inner(self) -> i16 {
|
3031 - | self.0
|
2663 + | #[allow(missing_docs)] // documentation missing in model
|
2664 + | pub(crate) fn set_evil_string(
|
2665 + | mut self,
|
2666 + | input: Option<
|
2667 + | impl ::std::convert::Into<
|
2668 + | crate::constrained::MaybeConstrained<crate::model::EvilString>,
|
2669 + | >,
|
2670 + | >,
|
2671 + | ) -> Self {
|
2672 + | self.evil_string = input.map(|v| v.into());
|
2673 + | self
|
3032 2674 | }
|
3033 - | }
|
3034 - |
|
3035 - | impl crate::constrained::Constrained for Short {
|
3036 - | type Unconstrained = i16;
|
3037 - | }
|
3038 - |
|
3039 - | impl ::std::convert::From<i16>
|
3040 - | for crate::constrained::MaybeConstrained<
|
3041 - | crate::input::malformed_range_override_input::Short,
|
3042 - | >
|
3043 - | {
|
3044 - | fn from(value: i16) -> Self {
|
3045 - | Self::Unconstrained(value)
|
2675 + | #[allow(missing_docs)] // documentation missing in model
|
2676 + | pub fn list(
|
2677 + | mut self,
|
2678 + | input: ::std::option::Option<::std::vec::Vec<crate::model::PatternString>>,
|
2679 + | ) -> Self {
|
2680 + | self.list =
|
2681 + | input.map(|v| crate::constrained::MaybeConstrained::Constrained((v).into()));
|
2682 + | self
|
3046 2683 | }
|
3047 - | }
|
3048 - |
|
3049 - | impl ::std::fmt::Display for Short {
|
3050 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3051 - | self.0.fmt(f)
|
2684 + | #[allow(missing_docs)] // documentation missing in model
|
2685 + | pub(crate) fn set_list(
|
2686 + | mut self,
|
2687 + | input: Option<
|
2688 + | impl ::std::convert::Into<
|
2689 + | crate::constrained::MaybeConstrained<
|
2690 + | crate::constrained::pattern_list_constrained::PatternListConstrained,
|
2691 + | >,
|
2692 + | >,
|
2693 + | >,
|
2694 + | ) -> Self {
|
2695 + | self.list = input.map(|v| v.into());
|
2696 + | self
|
3052 2697 | }
|
3053 - | }
|
3054 - |
|
3055 - | impl ::std::convert::From<Short> for i16 {
|
3056 - | fn from(value: Short) -> Self {
|
3057 - | value.into_inner()
|
2698 + | #[allow(missing_docs)] // documentation missing in model
|
2699 + | pub fn map(
|
2700 + | mut self,
|
2701 + | input: ::std::option::Option<
|
2702 + | ::std::collections::HashMap<
|
2703 + | crate::model::PatternString,
|
2704 + | crate::model::PatternString,
|
2705 + | >,
|
2706 + | >,
|
2707 + | ) -> Self {
|
2708 + | self.map = input.map(|v| crate::constrained::MaybeConstrained::Constrained((v).into()));
|
2709 + | self
|
3058 2710 | }
|
3059 - | }
|
3060 - | impl Short {
|
3061 - | fn check_range(
|
3062 - | value: i16,
|
3063 - | ) -> ::std::result::Result<
|
3064 - | (),
|
3065 - | crate::input::malformed_range_override_input::short::ConstraintViolation,
|
3066 - | > {
|
3067 - | if (4..=6).contains(&value) {
|
3068 - | Ok(())
|
3069 - | } else {
|
3070 - | Err(
|
3071 - | crate::input::malformed_range_override_input::short::ConstraintViolation::Range(
|
3072 - | value,
|
3073 - | ),
|
3074 - | )
|
3075 - | }
|
2711 + | #[allow(missing_docs)] // documentation missing in model
|
2712 + | pub(crate) fn set_map(
|
2713 + | mut self,
|
2714 + | input: Option<
|
2715 + | impl ::std::convert::Into<
|
2716 + | crate::constrained::MaybeConstrained<
|
2717 + | crate::constrained::pattern_map_constrained::PatternMapConstrained,
|
2718 + | >,
|
2719 + | >,
|
2720 + | >,
|
2721 + | ) -> Self {
|
2722 + | self.map = input.map(|v| v.into());
|
2723 + | self
|
3076 2724 | }
|
3077 - | }
|
3078 - | impl ::std::convert::TryFrom<i16> for Short {
|
3079 - | type Error = crate::input::malformed_range_override_input::short::ConstraintViolation;
|
3080 - |
|
3081 - | /// Constructs a `Short` from an [`i16`], failing when the provided value does not satisfy the modeled constraints.
|
3082 - | fn try_from(value: i16) -> ::std::result::Result<Self, Self::Error> {
|
3083 - | Self::check_range(value)?;
|
3084 - |
|
3085 - | Ok(Self(value))
|
2725 + | #[allow(missing_docs)] // documentation missing in model
|
2726 + | pub fn union(mut self, input: ::std::option::Option<crate::model::PatternUnion>) -> Self {
|
2727 + | self.union = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2728 + | self
|
3086 2729 | }
|
3087 - | }
|
3088 - | #[allow(missing_docs)] // documentation missing in model
|
3089 - | ///
|
3090 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
3091 - | /// [constraint traits]. Use [`MaxByte::try_from`] to construct values of this type.
|
3092 - | ///
|
3093 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
3094 - | ///
|
3095 - | #[derive(
|
3096 - | ::std::clone::Clone,
|
3097 - | ::std::cmp::Eq,
|
3098 - | ::std::cmp::PartialEq,
|
3099 - | ::std::fmt::Debug,
|
3100 - | ::std::hash::Hash,
|
3101 - | )]
|
3102 - | pub struct MaxByte(pub(crate) i8);
|
3103 - | impl MaxByte {
|
3104 - | /// Returns an immutable reference to the underlying [`i8`].
|
3105 - | pub fn inner(&self) -> &i8 {
|
3106 - | &self.0
|
2730 + | #[allow(missing_docs)] // documentation missing in model
|
2731 + | pub(crate) fn set_union(
|
2732 + | mut self,
|
2733 + | input: Option<
|
2734 + | impl ::std::convert::Into<
|
2735 + | crate::constrained::MaybeConstrained<crate::model::PatternUnion>,
|
2736 + | >,
|
2737 + | >,
|
2738 + | ) -> Self {
|
2739 + | self.union = input.map(|v| v.into());
|
2740 + | self
|
3107 2741 | }
|
3108 - |
|
3109 - | /// Consumes the value, returning the underlying [`i8`].
|
3110 - | pub fn into_inner(self) -> i8 {
|
3111 - | self.0
|
2742 + | /// Consumes the builder and constructs a [`MalformedPatternInput`](crate::input::MalformedPatternInput).
|
2743 + | ///
|
2744 + | /// The builder fails to construct a [`MalformedPatternInput`](crate::input::MalformedPatternInput) if a [`ConstraintViolation`] occurs.
|
2745 + | ///
|
2746 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
2747 + | pub fn build(self) -> Result<crate::input::MalformedPatternInput, ConstraintViolation> {
|
2748 + | self.build_enforcing_all_constraints()
|
2749 + | }
|
2750 + | fn build_enforcing_all_constraints(
|
2751 + | self,
|
2752 + | ) -> Result<crate::input::MalformedPatternInput, ConstraintViolation> {
|
2753 + | Ok(crate::input::MalformedPatternInput {
|
2754 + | string: self
|
2755 + | .string
|
2756 + | .map(|v| match v {
|
2757 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2758 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2759 + | })
|
2760 + | .map(|res| res.map_err(ConstraintViolation::String))
|
2761 + | .transpose()?,
|
2762 + | evil_string: self
|
2763 + | .evil_string
|
2764 + | .map(|v| match v {
|
2765 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2766 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2767 + | })
|
2768 + | .map(|res| res.map_err(ConstraintViolation::EvilString))
|
2769 + | .transpose()?,
|
2770 + | list: self
|
2771 + | .list
|
2772 + | .map(|v| match v {
|
2773 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2774 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2775 + | })
|
2776 + | .map(|res| res.map(|v| v.into()).map_err(ConstraintViolation::List))
|
2777 + | .transpose()?,
|
2778 + | map: self
|
2779 + | .map
|
2780 + | .map(|v| match v {
|
2781 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2782 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2783 + | })
|
2784 + | .map(|res| res.map(|v| v.into()).map_err(ConstraintViolation::Map))
|
2785 + | .transpose()?,
|
2786 + | union: self
|
2787 + | .union
|
2788 + | .map(|v| match v {
|
2789 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2790 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2791 + | })
|
2792 + | .map(|res| res.map_err(ConstraintViolation::Union))
|
2793 + | .transpose()?,
|
2794 + | })
|
3112 2795 | }
|
3113 2796 | }
|
2797 + | }
|
2798 + | /// See [`MalformedPatternOverrideInput`](crate::input::MalformedPatternOverrideInput).
|
2799 + | pub mod malformed_pattern_override_input {
|
3114 2800 |
|
3115 - | impl crate::constrained::Constrained for MaxByte {
|
3116 - | type Unconstrained = i8;
|
2801 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
2802 + | /// Holds one variant for each of the ways the builder can fail.
|
2803 + | #[non_exhaustive]
|
2804 + | #[allow(clippy::enum_variant_names)]
|
2805 + | pub enum ConstraintViolation {
|
2806 + | /// Constraint violation occurred building member `string` when building `MalformedPatternOverrideInput`.
|
2807 + | #[doc(hidden)]
|
2808 + | String(crate::input::malformed_pattern_override_input::string::ConstraintViolation),
|
2809 + | /// Constraint violation occurred building member `list` when building `MalformedPatternOverrideInput`.
|
2810 + | #[doc(hidden)]
|
2811 + | List(crate::model::pattern_list_override::ConstraintViolation),
|
2812 + | /// Constraint violation occurred building member `map` when building `MalformedPatternOverrideInput`.
|
2813 + | #[doc(hidden)]
|
2814 + | Map(crate::model::pattern_map_override::ConstraintViolation),
|
2815 + | /// Constraint violation occurred building member `union` when building `MalformedPatternOverrideInput`.
|
2816 + | #[doc(hidden)]
|
2817 + | Union(crate::model::pattern_union_override::ConstraintViolation),
|
3117 2818 | }
|
3118 - |
|
3119 - | impl ::std::convert::From<i8>
|
3120 - | for crate::constrained::MaybeConstrained<
|
3121 - | crate::input::malformed_range_override_input::MaxByte,
|
3122 - | >
|
3123 - | {
|
3124 - | fn from(value: i8) -> Self {
|
3125 - | Self::Unconstrained(value)
|
2819 + | impl ::std::fmt::Display for ConstraintViolation {
|
2820 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2821 + | match self {
|
2822 + | ConstraintViolation::String(_) => write!(f, "constraint violation occurred building member `string` when building `MalformedPatternOverrideInput`"),
|
2823 + | ConstraintViolation::List(_) => write!(f, "constraint violation occurred building member `list` when building `MalformedPatternOverrideInput`"),
|
2824 + | ConstraintViolation::Map(_) => write!(f, "constraint violation occurred building member `map` when building `MalformedPatternOverrideInput`"),
|
2825 + | ConstraintViolation::Union(_) => write!(f, "constraint violation occurred building member `union` when building `MalformedPatternOverrideInput`"),
|
2826 + | }
|
3126 2827 | }
|
3127 2828 | }
|
3128 - |
|
3129 - | impl ::std::fmt::Display for MaxByte {
|
3130 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3131 - | self.0.fmt(f)
|
2829 + | impl ::std::error::Error for ConstraintViolation {}
|
2830 + | impl ConstraintViolation {
|
2831 + | pub(crate) fn as_validation_exception_field(
|
2832 + | self,
|
2833 + | path: ::std::string::String,
|
2834 + | ) -> crate::model::ValidationExceptionField {
|
2835 + | match self {
|
2836 + | ConstraintViolation::String(inner) => {
|
2837 + | inner.as_validation_exception_field(path + "/string")
|
2838 + | }
|
2839 + | ConstraintViolation::List(inner) => {
|
2840 + | inner.as_validation_exception_field(path + "/list")
|
2841 + | }
|
2842 + | ConstraintViolation::Map(inner) => {
|
2843 + | inner.as_validation_exception_field(path + "/map")
|
2844 + | }
|
2845 + | ConstraintViolation::Union(inner) => {
|
2846 + | inner.as_validation_exception_field(path + "/union")
|
2847 + | }
|
2848 + | }
|
3132 2849 | }
|
3133 2850 | }
|
3134 - |
|
3135 - | impl ::std::convert::From<MaxByte> for i8 {
|
3136 - | fn from(value: MaxByte) -> Self {
|
3137 - | value.into_inner()
|
2851 + | impl ::std::convert::From<ConstraintViolation>
|
2852 + | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
2853 + | {
|
2854 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
2855 + | let first_validation_exception_field =
|
2856 + | constraint_violation.as_validation_exception_field("".to_owned());
|
2857 + | let validation_exception = crate::error::ValidationException {
|
2858 + | message: format!(
|
2859 + | "1 validation error detected. {}",
|
2860 + | &first_validation_exception_field.message
|
2861 + | ),
|
2862 + | field_list: Some(vec![first_validation_exception_field]),
|
2863 + | };
|
2864 + | Self::ConstraintViolation(
|
2865 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
2866 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
2867 + | )
|
3138 2868 | }
|
3139 2869 | }
|
3140 - | impl MaxByte {
|
3141 - | fn check_range(
|
3142 - | value: i8,
|
3143 - | ) -> ::std::result::Result<
|
3144 - | (),
|
3145 - | crate::input::malformed_range_override_input::max_byte::ConstraintViolation,
|
3146 - | > {
|
3147 - | if value <= 6 {
|
3148 - | Ok(())
|
3149 - | } else {
|
3150 - | Err(crate::input::malformed_range_override_input::max_byte::ConstraintViolation::Range(value))
|
3151 - | }
|
2870 + | impl ::std::convert::From<Builder>
|
2871 + | for crate::constrained::MaybeConstrained<crate::input::MalformedPatternOverrideInput>
|
2872 + | {
|
2873 + | fn from(builder: Builder) -> Self {
|
2874 + | Self::Unconstrained(builder)
|
3152 2875 | }
|
3153 2876 | }
|
3154 - | impl ::std::convert::TryFrom<i8> for MaxByte {
|
3155 - | type Error = crate::input::malformed_range_override_input::max_byte::ConstraintViolation;
|
3156 - |
|
3157 - | /// Constructs a `MaxByte` from an [`i8`], failing when the provided value does not satisfy the modeled constraints.
|
3158 - | fn try_from(value: i8) -> ::std::result::Result<Self, Self::Error> {
|
3159 - | Self::check_range(value)?;
|
2877 + | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedPatternOverrideInput {
|
2878 + | type Error = ConstraintViolation;
|
3160 2879 |
|
3161 - | Ok(Self(value))
|
2880 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
2881 + | builder.build()
|
3162 2882 | }
|
3163 2883 | }
|
3164 - | #[allow(missing_docs)] // documentation missing in model
|
3165 - | ///
|
3166 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
3167 - | /// [constraint traits]. Use [`MinByte::try_from`] to construct values of this type.
|
3168 - | ///
|
3169 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
3170 - | ///
|
3171 - | #[derive(
|
3172 - | ::std::clone::Clone,
|
3173 - | ::std::cmp::Eq,
|
3174 - | ::std::cmp::PartialEq,
|
3175 - | ::std::fmt::Debug,
|
3176 - | ::std::hash::Hash,
|
3177 - | )]
|
3178 - | pub struct MinByte(pub(crate) i8);
|
3179 - | impl MinByte {
|
3180 - | /// Returns an immutable reference to the underlying [`i8`].
|
3181 - | pub fn inner(&self) -> &i8 {
|
3182 - | &self.0
|
3183 - | }
|
3184 - |
|
3185 - | /// Consumes the value, returning the underlying [`i8`].
|
3186 - | pub fn into_inner(self) -> i8 {
|
3187 - | self.0
|
3188 - | }
|
3189 - | }
|
3190 - |
|
3191 - | impl crate::constrained::Constrained for MinByte {
|
3192 - | type Unconstrained = i8;
|
2884 + | /// A builder for [`MalformedPatternOverrideInput`](crate::input::MalformedPatternOverrideInput).
|
2885 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2886 + | pub struct Builder {
|
2887 + | pub(crate) string: ::std::option::Option<crate::constrained::MaybeConstrained<crate::input::malformed_pattern_override_input::String>>,
|
2888 + | pub(crate) list: ::std::option::Option<crate::constrained::MaybeConstrained<crate::constrained::pattern_list_override_constrained::PatternListOverrideConstrained>>,
|
2889 + | pub(crate) map: ::std::option::Option<crate::constrained::MaybeConstrained<crate::constrained::pattern_map_override_constrained::PatternMapOverrideConstrained>>,
|
2890 + | pub(crate) union: ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::PatternUnionOverride>>,
|
3193 2891 | }
|
3194 - |
|
3195 - | impl ::std::convert::From<i8>
|
3196 - | for crate::constrained::MaybeConstrained<
|
3197 - | crate::input::malformed_range_override_input::MinByte,
|
3198 - | >
|
3199 - | {
|
3200 - | fn from(value: i8) -> Self {
|
3201 - | Self::Unconstrained(value)
|
2892 + | impl Builder {
|
2893 + | #[allow(missing_docs)] // documentation missing in model
|
2894 + | pub fn string(
|
2895 + | mut self,
|
2896 + | input: ::std::option::Option<crate::input::malformed_pattern_override_input::String>,
|
2897 + | ) -> Self {
|
2898 + | self.string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2899 + | self
|
3202 2900 | }
|
3203 - | }
|
3204 - |
|
3205 - | impl ::std::fmt::Display for MinByte {
|
3206 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3207 - | self.0.fmt(f)
|
2901 + | #[allow(missing_docs)] // documentation missing in model
|
2902 + | pub(crate) fn set_string(
|
2903 + | mut self,
|
2904 + | input: Option<
|
2905 + | impl ::std::convert::Into<
|
2906 + | crate::constrained::MaybeConstrained<
|
2907 + | crate::input::malformed_pattern_override_input::String,
|
2908 + | >,
|
2909 + | >,
|
2910 + | >,
|
2911 + | ) -> Self {
|
2912 + | self.string = input.map(|v| v.into());
|
2913 + | self
|
3208 2914 | }
|
3209 - | }
|
3210 - |
|
3211 - | impl ::std::convert::From<MinByte> for i8 {
|
3212 - | fn from(value: MinByte) -> Self {
|
3213 - | value.into_inner()
|
2915 + | #[allow(missing_docs)] // documentation missing in model
|
2916 + | pub fn list(
|
2917 + | mut self,
|
2918 + | input: ::std::option::Option<
|
2919 + | ::std::vec::Vec<crate::model::pattern_list_override::Member>,
|
2920 + | >,
|
2921 + | ) -> Self {
|
2922 + | self.list =
|
2923 + | input.map(|v| crate::constrained::MaybeConstrained::Constrained((v).into()));
|
2924 + | self
|
3214 2925 | }
|
3215 - | }
|
3216 - | impl MinByte {
|
3217 - | fn check_range(
|
3218 - | value: i8,
|
3219 - | ) -> ::std::result::Result<
|
3220 - | (),
|
3221 - | crate::input::malformed_range_override_input::min_byte::ConstraintViolation,
|
3222 - | > {
|
3223 - | if 4 <= value {
|
3224 - | Ok(())
|
3225 - | } else {
|
3226 - | Err(crate::input::malformed_range_override_input::min_byte::ConstraintViolation::Range(value))
|
3227 - | }
|
2926 + | #[allow(missing_docs)] // documentation missing in model
|
2927 + | pub(crate) fn set_list(
|
2928 + | mut self,
|
2929 + | input: Option<impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::constrained::pattern_list_override_constrained::PatternListOverrideConstrained>>>,
|
2930 + | ) -> Self {
|
2931 + | self.list = input.map(|v| v.into());
|
2932 + | self
|
3228 2933 | }
|
3229 - | }
|
3230 - | impl ::std::convert::TryFrom<i8> for MinByte {
|
3231 - | type Error = crate::input::malformed_range_override_input::min_byte::ConstraintViolation;
|
3232 - |
|
3233 - | /// Constructs a `MinByte` from an [`i8`], failing when the provided value does not satisfy the modeled constraints.
|
3234 - | fn try_from(value: i8) -> ::std::result::Result<Self, Self::Error> {
|
3235 - | Self::check_range(value)?;
|
3236 - |
|
3237 - | Ok(Self(value))
|
2934 + | #[allow(missing_docs)] // documentation missing in model
|
2935 + | pub fn map(
|
2936 + | mut self,
|
2937 + | input: ::std::option::Option<
|
2938 + | ::std::collections::HashMap<
|
2939 + | crate::model::pattern_map_override::Key,
|
2940 + | crate::model::pattern_map_override::Value,
|
2941 + | >,
|
2942 + | >,
|
2943 + | ) -> Self {
|
2944 + | self.map = input.map(|v| crate::constrained::MaybeConstrained::Constrained((v).into()));
|
2945 + | self
|
2946 + | }
|
2947 + | #[allow(missing_docs)] // documentation missing in model
|
2948 + | pub(crate) fn set_map(
|
2949 + | mut self,
|
2950 + | input: Option<impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::constrained::pattern_map_override_constrained::PatternMapOverrideConstrained>>>,
|
2951 + | ) -> Self {
|
2952 + | self.map = input.map(|v| v.into());
|
2953 + | self
|
2954 + | }
|
2955 + | #[allow(missing_docs)] // documentation missing in model
|
2956 + | pub fn union(
|
2957 + | mut self,
|
2958 + | input: ::std::option::Option<crate::model::PatternUnionOverride>,
|
2959 + | ) -> Self {
|
2960 + | self.union = input.map(crate::constrained::MaybeConstrained::Constrained);
|
2961 + | self
|
2962 + | }
|
2963 + | #[allow(missing_docs)] // documentation missing in model
|
2964 + | pub(crate) fn set_union(
|
2965 + | mut self,
|
2966 + | input: Option<
|
2967 + | impl ::std::convert::Into<
|
2968 + | crate::constrained::MaybeConstrained<crate::model::PatternUnionOverride>,
|
2969 + | >,
|
2970 + | >,
|
2971 + | ) -> Self {
|
2972 + | self.union = input.map(|v| v.into());
|
2973 + | self
|
2974 + | }
|
2975 + | /// Consumes the builder and constructs a [`MalformedPatternOverrideInput`](crate::input::MalformedPatternOverrideInput).
|
2976 + | ///
|
2977 + | /// The builder fails to construct a [`MalformedPatternOverrideInput`](crate::input::MalformedPatternOverrideInput) if a [`ConstraintViolation`] occurs.
|
2978 + | ///
|
2979 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
2980 + | pub fn build(
|
2981 + | self,
|
2982 + | ) -> Result<crate::input::MalformedPatternOverrideInput, ConstraintViolation> {
|
2983 + | self.build_enforcing_all_constraints()
|
2984 + | }
|
2985 + | fn build_enforcing_all_constraints(
|
2986 + | self,
|
2987 + | ) -> Result<crate::input::MalformedPatternOverrideInput, ConstraintViolation> {
|
2988 + | Ok(crate::input::MalformedPatternOverrideInput {
|
2989 + | string: self
|
2990 + | .string
|
2991 + | .map(|v| match v {
|
2992 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
2993 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
2994 + | })
|
2995 + | .map(|res| res.map_err(ConstraintViolation::String))
|
2996 + | .transpose()?,
|
2997 + | list: self
|
2998 + | .list
|
2999 + | .map(|v| match v {
|
3000 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3001 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3002 + | })
|
3003 + | .map(|res| res.map(|v| v.into()).map_err(ConstraintViolation::List))
|
3004 + | .transpose()?,
|
3005 + | map: self
|
3006 + | .map
|
3007 + | .map(|v| match v {
|
3008 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3009 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3010 + | })
|
3011 + | .map(|res| res.map(|v| v.into()).map_err(ConstraintViolation::Map))
|
3012 + | .transpose()?,
|
3013 + | union: self
|
3014 + | .union
|
3015 + | .map(|v| match v {
|
3016 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3017 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3018 + | })
|
3019 + | .map(|res| res.map_err(ConstraintViolation::Union))
|
3020 + | .transpose()?,
|
3021 + | })
|
3238 3022 | }
|
3239 3023 | }
|
3240 3024 | #[allow(missing_docs)] // documentation missing in model
|
3241 3025 | ///
|
3242 3026 | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
3243 - | /// [constraint traits]. Use [`Byte::try_from`] to construct values of this type.
|
3027 + | /// [constraint traits]. Use [`String::try_from`] to construct values of this type.
|
3244 3028 | ///
|
3245 3029 | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
3246 3030 | ///
|
3247 3031 | #[derive(
|
3248 3032 | ::std::clone::Clone,
|
3249 3033 | ::std::cmp::Eq,
|
3250 3034 | ::std::cmp::PartialEq,
|
3251 3035 | ::std::fmt::Debug,
|
3252 3036 | ::std::hash::Hash,
|
3253 3037 | )]
|
3254 - | pub struct Byte(pub(crate) i8);
|
3255 - | impl Byte {
|
3256 - | /// Returns an immutable reference to the underlying [`i8`].
|
3257 - | pub fn inner(&self) -> &i8 {
|
3038 + | pub struct String(pub(crate) ::std::string::String);
|
3039 + | impl String {
|
3040 + | /// Extracts a string slice containing the entire underlying `String`.
|
3041 + | pub fn as_str(&self) -> &str {
|
3258 3042 | &self.0
|
3259 3043 | }
|
3260 3044 |
|
3261 - | /// Consumes the value, returning the underlying [`i8`].
|
3262 - | pub fn into_inner(self) -> i8 {
|
3045 + | /// Returns an immutable reference to the underlying [`::std::string::String`].
|
3046 + | pub fn inner(&self) -> &::std::string::String {
|
3047 + | &self.0
|
3048 + | }
|
3049 + |
|
3050 + | /// Consumes the value, returning the underlying [`::std::string::String`].
|
3051 + | pub fn into_inner(self) -> ::std::string::String {
|
3263 3052 | self.0
|
3264 3053 | }
|
3265 3054 | }
|
3055 + | impl String {
|
3056 + | fn check_pattern(
|
3057 + | string: ::std::string::String,
|
3058 + | ) -> ::std::result::Result<
|
3059 + | ::std::string::String,
|
3060 + | crate::input::malformed_pattern_override_input::string::ConstraintViolation,
|
3061 + | > {
|
3062 + | let regex = Self::compile_regex();
|
3266 3063 |
|
3267 - | impl crate::constrained::Constrained for Byte {
|
3268 - | type Unconstrained = i8;
|
3064 + | if regex.is_match(&string) {
|
3065 + | Ok(string)
|
3066 + | } else {
|
3067 + | Err(crate::input::malformed_pattern_override_input::string::ConstraintViolation::Pattern(string))
|
3068 + | }
|
3069 + | }
|
3070 + |
|
3071 + | /// Attempts to compile the regex for this constrained type's `@pattern`.
|
3072 + | /// This can fail if the specified regex is not supported by the `::regex` crate.
|
3073 + | pub fn compile_regex() -> &'static ::regex::Regex {
|
3074 + | static REGEX: std::sync::LazyLock<::regex::Regex> = std::sync::LazyLock::new(|| {
|
3075 + | ::regex::Regex::new(r#"^[g-m]+$"#).expect(r#"The regular expression ^[g-m]+$ is not supported by the `regex` crate; feel free to file an issue under https://github.com/smithy-lang/smithy-rs/issues for support"#)
|
3076 + | });
|
3077 + |
|
3078 + | ®EX
|
3079 + | }
|
3269 3080 | }
|
3081 + | impl ::std::convert::TryFrom<::std::string::String> for String {
|
3082 + | type Error = crate::input::malformed_pattern_override_input::string::ConstraintViolation;
|
3270 3083 |
|
3271 - | impl ::std::convert::From<i8>
|
3272 - | for crate::constrained::MaybeConstrained<crate::input::malformed_range_override_input::Byte>
|
3084 + | /// Constructs a `String` from an [`::std::string::String`], failing when the provided value does not satisfy the modeled constraints.
|
3085 + | fn try_from(value: ::std::string::String) -> ::std::result::Result<Self, Self::Error> {
|
3086 + | let value = Self::check_pattern(value)?;
|
3087 + |
|
3088 + | Ok(Self(value))
|
3089 + | }
|
3090 + | }
|
3091 + | impl crate::constrained::Constrained for String {
|
3092 + | type Unconstrained = ::std::string::String;
|
3093 + | }
|
3094 + |
|
3095 + | impl ::std::convert::From<::std::string::String>
|
3096 + | for crate::constrained::MaybeConstrained<
|
3097 + | crate::input::malformed_pattern_override_input::String,
|
3098 + | >
|
3273 3099 | {
|
3274 - | fn from(value: i8) -> Self {
|
3100 + | fn from(value: ::std::string::String) -> Self {
|
3275 3101 | Self::Unconstrained(value)
|
3276 3102 | }
|
3277 3103 | }
|
3278 3104 |
|
3279 - | impl ::std::fmt::Display for Byte {
|
3105 + | impl ::std::fmt::Display for String {
|
3280 3106 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3281 3107 | self.0.fmt(f)
|
3282 3108 | }
|
3283 3109 | }
|
3284 3110 |
|
3285 - | impl ::std::convert::From<Byte> for i8 {
|
3286 - | fn from(value: Byte) -> Self {
|
3111 + | impl ::std::convert::From<String> for ::std::string::String {
|
3112 + | fn from(value: String) -> Self {
|
3287 3113 | value.into_inner()
|
3288 3114 | }
|
3289 3115 | }
|
3290 - | impl Byte {
|
3291 - | fn check_range(
|
3292 - | value: i8,
|
3293 - | ) -> ::std::result::Result<
|
3294 - | (),
|
3295 - | crate::input::malformed_range_override_input::byte::ConstraintViolation,
|
3296 - | > {
|
3297 - | if (4..=6).contains(&value) {
|
3298 - | Ok(())
|
3299 - | } else {
|
3300 - | Err(
|
3301 - | crate::input::malformed_range_override_input::byte::ConstraintViolation::Range(
|
3302 - | value,
|
3303 - | ),
|
3304 - | )
|
3305 - | }
|
3306 - | }
|
3307 - | }
|
3308 - | impl ::std::convert::TryFrom<i8> for Byte {
|
3309 - | type Error = crate::input::malformed_range_override_input::byte::ConstraintViolation;
|
3310 - |
|
3311 - | /// Constructs a `Byte` from an [`i8`], failing when the provided value does not satisfy the modeled constraints.
|
3312 - | fn try_from(value: i8) -> ::std::result::Result<Self, Self::Error> {
|
3313 - | Self::check_range(value)?;
|
3314 - |
|
3315 - | Ok(Self(value))
|
3116 + | #[cfg(test)]
|
3117 + | mod test_string {
|
3118 + | #[test]
|
3119 + | fn regex_compiles() {
|
3120 + | crate::input::malformed_pattern_override_input::String::compile_regex();
|
3316 3121 | }
|
3317 3122 | }
|
3318 3123 |
|
3319 - | /// See [`MalformedRangeOverrideInputMaxLong`](crate::input::malformed_range_override_input::MaxLong).
|
3320 - | pub mod max_long {
|
3124 + | /// See [`MalformedPatternOverrideInputString`](crate::input::malformed_pattern_override_input::String).
|
3125 + | pub mod string {
|
3321 3126 |
|
3322 3127 | #[derive(Debug, PartialEq)]
|
3323 3128 | pub enum ConstraintViolation {
|
3324 - | Range(i64),
|
3129 + | /// Error when a string doesn't satisfy its `@pattern`.
|
3130 + | /// Contains the String that failed the pattern.
|
3131 + | Pattern(String),
|
3325 3132 | }
|
3326 3133 |
|
3327 3134 | impl ::std::fmt::Display for ConstraintViolation {
|
3328 3135 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3329 - | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMaxLong`failed to satisfy constraint: Member must be less than or equal to 6")
|
3136 + | let message = match self {
|
3137 + | Self::Pattern(_) => {
|
3138 + | format!(
|
3139 + | r#"Value provided for `aws.protocoltests.restjson.validation.synthetic#MalformedPatternOverrideInputString` failed to satisfy the constraint: Member must match the regular expression pattern: {}"#,
|
3140 + | r#"^[g-m]+$"#
|
3141 + | )
|
3142 + | }
|
3143 + | };
|
3144 + | write!(f, "{message}")
|
3330 3145 | }
|
3331 3146 | }
|
3332 3147 |
|
3333 3148 | impl ::std::error::Error for ConstraintViolation {}
|
3334 3149 | impl ConstraintViolation {
|
3335 3150 | pub(crate) fn as_validation_exception_field(
|
3336 3151 | self,
|
3337 3152 | path: ::std::string::String,
|
3338 3153 | ) -> crate::model::ValidationExceptionField {
|
3339 3154 | match self {
|
3340 - | Self::Range(_) => crate::model::ValidationExceptionField {
|
3341 - | message: format!("Value at '{}' failed to satisfy constraint: Member must be less than or equal to 6", &path),
|
3342 - | path,
|
3155 + | #[allow(unused_variables)]
|
3156 + | Self::Pattern(_) => crate::model::ValidationExceptionField {
|
3157 + | message: format!("Value at '{}' failed to satisfy constraint: Member must satisfy regular expression pattern: {}", &path, r#"^[g-m]+$"#),
|
3158 + | path
|
3343 3159 | },
|
3344 3160 | }
|
3345 3161 | }
|
3346 3162 | }
|
3347 3163 | }
|
3348 - | /// See [`MalformedRangeOverrideInputMinLong`](crate::input::malformed_range_override_input::MinLong).
|
3349 - | pub mod min_long {
|
3350 - |
|
3351 - | #[derive(Debug, PartialEq)]
|
3352 - | pub enum ConstraintViolation {
|
3353 - | Range(i64),
|
3354 - | }
|
3355 - |
|
3356 - | impl ::std::fmt::Display for ConstraintViolation {
|
3357 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3358 - | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMinLong`failed to satisfy constraint: Member must be greater than or equal to 4")
|
3359 - | }
|
3360 - | }
|
3164 + | }
|
3165 + | /// See [`MalformedRangeInput`](crate::input::MalformedRangeInput).
|
3166 + | pub mod malformed_range_input {
|
3361 3167 |
|
3362 - | impl ::std::error::Error for ConstraintViolation {}
|
3363 - | impl ConstraintViolation {
|
3364 - | pub(crate) fn as_validation_exception_field(
|
3365 - | self,
|
3366 - | path: ::std::string::String,
|
3367 - | ) -> crate::model::ValidationExceptionField {
|
3368 - | match self {
|
3369 - | Self::Range(_) => crate::model::ValidationExceptionField {
|
3370 - | message: format!("Value at '{}' failed to satisfy constraint: Member must be greater than or equal to 4", &path),
|
3371 - | path,
|
3372 - | },
|
3373 - | }
|
3168 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
3169 + | /// Holds one variant for each of the ways the builder can fail.
|
3170 + | #[non_exhaustive]
|
3171 + | #[allow(clippy::enum_variant_names)]
|
3172 + | pub enum ConstraintViolation {
|
3173 + | /// Constraint violation occurred building member `byte` when building `MalformedRangeInput`.
|
3174 + | #[doc(hidden)]
|
3175 + | Byte(crate::model::range_byte::ConstraintViolation),
|
3176 + | /// Constraint violation occurred building member `min_byte` when building `MalformedRangeInput`.
|
3177 + | #[doc(hidden)]
|
3178 + | MinByte(crate::model::min_byte::ConstraintViolation),
|
3179 + | /// Constraint violation occurred building member `max_byte` when building `MalformedRangeInput`.
|
3180 + | #[doc(hidden)]
|
3181 + | MaxByte(crate::model::max_byte::ConstraintViolation),
|
3182 + | /// Constraint violation occurred building member `short` when building `MalformedRangeInput`.
|
3183 + | #[doc(hidden)]
|
3184 + | Short(crate::model::range_short::ConstraintViolation),
|
3185 + | /// Constraint violation occurred building member `min_short` when building `MalformedRangeInput`.
|
3186 + | #[doc(hidden)]
|
3187 + | MinShort(crate::model::min_short::ConstraintViolation),
|
3188 + | /// Constraint violation occurred building member `max_short` when building `MalformedRangeInput`.
|
3189 + | #[doc(hidden)]
|
3190 + | MaxShort(crate::model::max_short::ConstraintViolation),
|
3191 + | /// Constraint violation occurred building member `integer` when building `MalformedRangeInput`.
|
3192 + | #[doc(hidden)]
|
3193 + | Integer(crate::model::range_integer::ConstraintViolation),
|
3194 + | /// Constraint violation occurred building member `min_integer` when building `MalformedRangeInput`.
|
3195 + | #[doc(hidden)]
|
3196 + | MinInteger(crate::model::min_integer::ConstraintViolation),
|
3197 + | /// Constraint violation occurred building member `max_integer` when building `MalformedRangeInput`.
|
3198 + | #[doc(hidden)]
|
3199 + | MaxInteger(crate::model::max_integer::ConstraintViolation),
|
3200 + | /// Constraint violation occurred building member `long` when building `MalformedRangeInput`.
|
3201 + | #[doc(hidden)]
|
3202 + | Long(crate::model::range_long::ConstraintViolation),
|
3203 + | /// Constraint violation occurred building member `min_long` when building `MalformedRangeInput`.
|
3204 + | #[doc(hidden)]
|
3205 + | MinLong(crate::model::min_long::ConstraintViolation),
|
3206 + | /// Constraint violation occurred building member `max_long` when building `MalformedRangeInput`.
|
3207 + | #[doc(hidden)]
|
3208 + | MaxLong(crate::model::max_long::ConstraintViolation),
|
3209 + | }
|
3210 + | impl ::std::fmt::Display for ConstraintViolation {
|
3211 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3212 + | match self {
|
3213 + | ConstraintViolation::Byte(_) => write!(f, "constraint violation occurred building member `byte` when building `MalformedRangeInput`"),
|
3214 + | ConstraintViolation::MinByte(_) => write!(f, "constraint violation occurred building member `min_byte` when building `MalformedRangeInput`"),
|
3215 + | ConstraintViolation::MaxByte(_) => write!(f, "constraint violation occurred building member `max_byte` when building `MalformedRangeInput`"),
|
3216 + | ConstraintViolation::Short(_) => write!(f, "constraint violation occurred building member `short` when building `MalformedRangeInput`"),
|
3217 + | ConstraintViolation::MinShort(_) => write!(f, "constraint violation occurred building member `min_short` when building `MalformedRangeInput`"),
|
3218 + | ConstraintViolation::MaxShort(_) => write!(f, "constraint violation occurred building member `max_short` when building `MalformedRangeInput`"),
|
3219 + | ConstraintViolation::Integer(_) => write!(f, "constraint violation occurred building member `integer` when building `MalformedRangeInput`"),
|
3220 + | ConstraintViolation::MinInteger(_) => write!(f, "constraint violation occurred building member `min_integer` when building `MalformedRangeInput`"),
|
3221 + | ConstraintViolation::MaxInteger(_) => write!(f, "constraint violation occurred building member `max_integer` when building `MalformedRangeInput`"),
|
3222 + | ConstraintViolation::Long(_) => write!(f, "constraint violation occurred building member `long` when building `MalformedRangeInput`"),
|
3223 + | ConstraintViolation::MinLong(_) => write!(f, "constraint violation occurred building member `min_long` when building `MalformedRangeInput`"),
|
3224 + | ConstraintViolation::MaxLong(_) => write!(f, "constraint violation occurred building member `max_long` when building `MalformedRangeInput`"),
|
3374 3225 | }
|
3375 3226 | }
|
3376 3227 | }
|
3377 - | /// See [`MalformedRangeOverrideInputLong`](crate::input::malformed_range_override_input::Long).
|
3378 - | pub mod long {
|
3379 - |
|
3380 - | #[derive(Debug, PartialEq)]
|
3381 - | pub enum ConstraintViolation {
|
3382 - | Range(i64),
|
3383 - | }
|
3384 - |
|
3385 - | impl ::std::fmt::Display for ConstraintViolation {
|
3386 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3387 - | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputLong`failed to satisfy constraint: Member must be between 4 and 6, inclusive")
|
3228 + | impl ::std::error::Error for ConstraintViolation {}
|
3229 + | impl ConstraintViolation {
|
3230 + | pub(crate) fn as_validation_exception_field(
|
3231 + | self,
|
3232 + | path: ::std::string::String,
|
3233 + | ) -> crate::model::ValidationExceptionField {
|
3234 + | match self {
|
3235 + | ConstraintViolation::Byte(inner) => {
|
3236 + | inner.as_validation_exception_field(path + "/byte")
|
3237 + | }
|
3238 + | ConstraintViolation::MinByte(inner) => {
|
3239 + | inner.as_validation_exception_field(path + "/minByte")
|
3240 + | }
|
3241 + | ConstraintViolation::MaxByte(inner) => {
|
3242 + | inner.as_validation_exception_field(path + "/maxByte")
|
3243 + | }
|
3244 + | ConstraintViolation::Short(inner) => {
|
3245 + | inner.as_validation_exception_field(path + "/short")
|
3246 + | }
|
3247 + | ConstraintViolation::MinShort(inner) => {
|
3248 + | inner.as_validation_exception_field(path + "/minShort")
|
3249 + | }
|
3250 + | ConstraintViolation::MaxShort(inner) => {
|
3251 + | inner.as_validation_exception_field(path + "/maxShort")
|
3252 + | }
|
3253 + | ConstraintViolation::Integer(inner) => {
|
3254 + | inner.as_validation_exception_field(path + "/integer")
|
3255 + | }
|
3256 + | ConstraintViolation::MinInteger(inner) => {
|
3257 + | inner.as_validation_exception_field(path + "/minInteger")
|
3258 + | }
|
3259 + | ConstraintViolation::MaxInteger(inner) => {
|
3260 + | inner.as_validation_exception_field(path + "/maxInteger")
|
3261 + | }
|
3262 + | ConstraintViolation::Long(inner) => {
|
3263 + | inner.as_validation_exception_field(path + "/long")
|
3264 + | }
|
3265 + | ConstraintViolation::MinLong(inner) => {
|
3266 + | inner.as_validation_exception_field(path + "/minLong")
|
3267 + | }
|
3268 + | ConstraintViolation::MaxLong(inner) => {
|
3269 + | inner.as_validation_exception_field(path + "/maxLong")
|
3270 + | }
|
3388 3271 | }
|
3389 3272 | }
|
3390 - |
|
3391 - | impl ::std::error::Error for ConstraintViolation {}
|
3392 - | impl ConstraintViolation {
|
3393 - | pub(crate) fn as_validation_exception_field(
|
3394 - | self,
|
3395 - | path: ::std::string::String,
|
3396 - | ) -> crate::model::ValidationExceptionField {
|
3397 - | match self {
|
3398 - | Self::Range(_) => crate::model::ValidationExceptionField {
|
3399 - | message: format!("Value at '{}' failed to satisfy constraint: Member must be between 4 and 6, inclusive", &path),
|
3400 - | path,
|
3401 - | },
|
3402 - | }
|
3403 - | }
|
3273 + | }
|
3274 + | impl ::std::convert::From<ConstraintViolation>
|
3275 + | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
3276 + | {
|
3277 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
3278 + | let first_validation_exception_field =
|
3279 + | constraint_violation.as_validation_exception_field("".to_owned());
|
3280 + | let validation_exception = crate::error::ValidationException {
|
3281 + | message: format!(
|
3282 + | "1 validation error detected. {}",
|
3283 + | &first_validation_exception_field.message
|
3284 + | ),
|
3285 + | field_list: Some(vec![first_validation_exception_field]),
|
3286 + | };
|
3287 + | Self::ConstraintViolation(
|
3288 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
3289 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
3290 + | )
|
3404 3291 | }
|
3405 3292 | }
|
3406 - | /// See [`MalformedRangeOverrideInputMaxInteger`](crate::input::malformed_range_override_input::MaxInteger).
|
3407 - | pub mod max_integer {
|
3408 - |
|
3409 - | #[derive(Debug, PartialEq)]
|
3410 - | pub enum ConstraintViolation {
|
3411 - | Range(i32),
|
3293 + | impl ::std::convert::From<Builder>
|
3294 + | for crate::constrained::MaybeConstrained<crate::input::MalformedRangeInput>
|
3295 + | {
|
3296 + | fn from(builder: Builder) -> Self {
|
3297 + | Self::Unconstrained(builder)
|
3412 3298 | }
|
3299 + | }
|
3300 + | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedRangeInput {
|
3301 + | type Error = ConstraintViolation;
|
3413 3302 |
|
3414 - | impl ::std::fmt::Display for ConstraintViolation {
|
3415 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3416 - | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMaxInteger`failed to satisfy constraint: Member must be less than or equal to 6")
|
3417 - | }
|
3418 - | }
|
3419 - |
|
3420 - | impl ::std::error::Error for ConstraintViolation {}
|
3421 - | impl ConstraintViolation {
|
3422 - | pub(crate) fn as_validation_exception_field(
|
3423 - | self,
|
3424 - | path: ::std::string::String,
|
3425 - | ) -> crate::model::ValidationExceptionField {
|
3426 - | match self {
|
3427 - | Self::Range(_) => crate::model::ValidationExceptionField {
|
3428 - | message: format!("Value at '{}' failed to satisfy constraint: Member must be less than or equal to 6", &path),
|
3429 - | path,
|
3430 - | },
|
3431 - | }
|
3432 - | }
|
3303 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
3304 + | builder.build()
|
3433 3305 | }
|
3434 3306 | }
|
3435 - | /// See [`MalformedRangeOverrideInputMinInteger`](crate::input::malformed_range_override_input::MinInteger).
|
3436 - | pub mod min_integer {
|
3437 - |
|
3438 - | #[derive(Debug, PartialEq)]
|
3439 - | pub enum ConstraintViolation {
|
3440 - | Range(i32),
|
3441 - | }
|
3442 - |
|
3443 - | impl ::std::fmt::Display for ConstraintViolation {
|
3444 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3445 - | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMinInteger`failed to satisfy constraint: Member must be greater than or equal to 4")
|
3446 - | }
|
3447 - | }
|
3448 - |
|
3449 - | impl ::std::error::Error for ConstraintViolation {}
|
3450 - | impl ConstraintViolation {
|
3451 - | pub(crate) fn as_validation_exception_field(
|
3452 - | self,
|
3453 - | path: ::std::string::String,
|
3454 - | ) -> crate::model::ValidationExceptionField {
|
3455 - | match self {
|
3456 - | Self::Range(_) => crate::model::ValidationExceptionField {
|
3457 - | message: format!("Value at '{}' failed to satisfy constraint: Member must be greater than or equal to 4", &path),
|
3458 - | path,
|
3459 - | },
|
3460 - | }
|
3461 - | }
|
3462 - | }
|
3307 + | /// A builder for [`MalformedRangeInput`](crate::input::MalformedRangeInput).
|
3308 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
3309 + | pub struct Builder {
|
3310 + | pub(crate) byte:
|
3311 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::RangeByte>>,
|
3312 + | pub(crate) min_byte:
|
3313 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::MinByte>>,
|
3314 + | pub(crate) max_byte:
|
3315 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::MaxByte>>,
|
3316 + | pub(crate) short:
|
3317 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::RangeShort>>,
|
3318 + | pub(crate) min_short:
|
3319 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::MinShort>>,
|
3320 + | pub(crate) max_short:
|
3321 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::MaxShort>>,
|
3322 + | pub(crate) integer:
|
3323 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::RangeInteger>>,
|
3324 + | pub(crate) min_integer:
|
3325 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::MinInteger>>,
|
3326 + | pub(crate) max_integer:
|
3327 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::MaxInteger>>,
|
3328 + | pub(crate) long:
|
3329 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::RangeLong>>,
|
3330 + | pub(crate) min_long:
|
3331 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::MinLong>>,
|
3332 + | pub(crate) max_long:
|
3333 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::MaxLong>>,
|
3334 + | pub(crate) float: ::std::option::Option<f32>,
|
3335 + | pub(crate) min_float: ::std::option::Option<f32>,
|
3336 + | pub(crate) max_float: ::std::option::Option<f32>,
|
3463 3337 | }
|
3464 - | /// See [`MalformedRangeOverrideInputInteger`](crate::input::malformed_range_override_input::Integer).
|
3465 - | pub mod integer {
|
3466 - |
|
3467 - | #[derive(Debug, PartialEq)]
|
3468 - | pub enum ConstraintViolation {
|
3469 - | Range(i32),
|
3338 + | impl Builder {
|
3339 + | #[allow(missing_docs)] // documentation missing in model
|
3340 + | pub fn byte(mut self, input: ::std::option::Option<crate::model::RangeByte>) -> Self {
|
3341 + | self.byte = input.map(crate::constrained::MaybeConstrained::Constrained);
|
3342 + | self
|
3470 3343 | }
|
3471 - |
|
3472 - | impl ::std::fmt::Display for ConstraintViolation {
|
3473 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3474 - | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputInteger`failed to satisfy constraint: Member must be between 4 and 6, inclusive")
|
3475 - | }
|
3344 + | #[allow(missing_docs)] // documentation missing in model
|
3345 + | pub(crate) fn set_byte(
|
3346 + | mut self,
|
3347 + | input: Option<
|
3348 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::RangeByte>>,
|
3349 + | >,
|
3350 + | ) -> Self {
|
3351 + | self.byte = input.map(|v| v.into());
|
3352 + | self
|
3476 3353 | }
|
3477 - |
|
3478 - | impl ::std::error::Error for ConstraintViolation {}
|
3479 - | impl ConstraintViolation {
|
3480 - | pub(crate) fn as_validation_exception_field(
|
3481 - | self,
|
3482 - | path: ::std::string::String,
|
3483 - | ) -> crate::model::ValidationExceptionField {
|
3484 - | match self {
|
3485 - | Self::Range(_) => crate::model::ValidationExceptionField {
|
3486 - | message: format!("Value at '{}' failed to satisfy constraint: Member must be between 4 and 6, inclusive", &path),
|
3487 - | path,
|
3488 - | },
|
3489 - | }
|
3490 - | }
|
3354 + | #[allow(missing_docs)] // documentation missing in model
|
3355 + | pub fn min_byte(mut self, input: ::std::option::Option<crate::model::MinByte>) -> Self {
|
3356 + | self.min_byte = input.map(crate::constrained::MaybeConstrained::Constrained);
|
3357 + | self
|
3491 3358 | }
|
3492 - | }
|
3493 - | /// See [`MalformedRangeOverrideInputMaxShort`](crate::input::malformed_range_override_input::MaxShort).
|
3494 - | pub mod max_short {
|
3495 - |
|
3496 - | #[derive(Debug, PartialEq)]
|
3497 - | pub enum ConstraintViolation {
|
3498 - | Range(i16),
|
3359 + | #[allow(missing_docs)] // documentation missing in model
|
3360 + | pub(crate) fn set_min_byte(
|
3361 + | mut self,
|
3362 + | input: Option<
|
3363 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::MinByte>>,
|
3364 + | >,
|
3365 + | ) -> Self {
|
3366 + | self.min_byte = input.map(|v| v.into());
|
3367 + | self
|
3499 3368 | }
|
3500 - |
|
3501 - | impl ::std::fmt::Display for ConstraintViolation {
|
3502 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3503 - | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMaxShort`failed to satisfy constraint: Member must be less than or equal to 6")
|
3504 - | }
|
3369 + | #[allow(missing_docs)] // documentation missing in model
|
3370 + | pub fn max_byte(mut self, input: ::std::option::Option<crate::model::MaxByte>) -> Self {
|
3371 + | self.max_byte = input.map(crate::constrained::MaybeConstrained::Constrained);
|
3372 + | self
|
3505 3373 | }
|
3506 - |
|
3507 - | impl ::std::error::Error for ConstraintViolation {}
|
3508 - | impl ConstraintViolation {
|
3509 - | pub(crate) fn as_validation_exception_field(
|
3510 - | self,
|
3511 - | path: ::std::string::String,
|
3512 - | ) -> crate::model::ValidationExceptionField {
|
3513 - | match self {
|
3514 - | Self::Range(_) => crate::model::ValidationExceptionField {
|
3515 - | message: format!("Value at '{}' failed to satisfy constraint: Member must be less than or equal to 6", &path),
|
3516 - | path,
|
3517 - | },
|
3518 - | }
|
3519 - | }
|
3374 + | #[allow(missing_docs)] // documentation missing in model
|
3375 + | pub(crate) fn set_max_byte(
|
3376 + | mut self,
|
3377 + | input: Option<
|
3378 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::MaxByte>>,
|
3379 + | >,
|
3380 + | ) -> Self {
|
3381 + | self.max_byte = input.map(|v| v.into());
|
3382 + | self
|
3520 3383 | }
|
3521 - | }
|
3522 - | /// See [`MalformedRangeOverrideInputMinShort`](crate::input::malformed_range_override_input::MinShort).
|
3523 - | pub mod min_short {
|
3524 - |
|
3525 - | #[derive(Debug, PartialEq)]
|
3526 - | pub enum ConstraintViolation {
|
3527 - | Range(i16),
|
3384 + | #[allow(missing_docs)] // documentation missing in model
|
3385 + | pub fn short(mut self, input: ::std::option::Option<crate::model::RangeShort>) -> Self {
|
3386 + | self.short = input.map(crate::constrained::MaybeConstrained::Constrained);
|
3387 + | self
|
3528 3388 | }
|
3529 - |
|
3530 - | impl ::std::fmt::Display for ConstraintViolation {
|
3531 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3532 - | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMinShort`failed to satisfy constraint: Member must be greater than or equal to 4")
|
3533 - | }
|
3389 + | #[allow(missing_docs)] // documentation missing in model
|
3390 + | pub(crate) fn set_short(
|
3391 + | mut self,
|
3392 + | input: Option<
|
3393 + | impl ::std::convert::Into<
|
3394 + | crate::constrained::MaybeConstrained<crate::model::RangeShort>,
|
3395 + | >,
|
3396 + | >,
|
3397 + | ) -> Self {
|
3398 + | self.short = input.map(|v| v.into());
|
3399 + | self
|
3534 3400 | }
|
3535 - |
|
3536 - | impl ::std::error::Error for ConstraintViolation {}
|
3537 - | impl ConstraintViolation {
|
3538 - | pub(crate) fn as_validation_exception_field(
|
3539 - | self,
|
3540 - | path: ::std::string::String,
|
3541 - | ) -> crate::model::ValidationExceptionField {
|
3542 - | match self {
|
3543 - | Self::Range(_) => crate::model::ValidationExceptionField {
|
3544 - | message: format!("Value at '{}' failed to satisfy constraint: Member must be greater than or equal to 4", &path),
|
3545 - | path,
|
3546 - | },
|
3547 - | }
|
3548 - | }
|
3401 + | #[allow(missing_docs)] // documentation missing in model
|
3402 + | pub fn min_short(mut self, input: ::std::option::Option<crate::model::MinShort>) -> Self {
|
3403 + | self.min_short = input.map(crate::constrained::MaybeConstrained::Constrained);
|
3404 + | self
|
3549 3405 | }
|
3550 - | }
|
3551 - | /// See [`MalformedRangeOverrideInputShort`](crate::input::malformed_range_override_input::Short).
|
3552 - | pub mod short {
|
3553 - |
|
3554 - | #[derive(Debug, PartialEq)]
|
3555 - | pub enum ConstraintViolation {
|
3556 - | Range(i16),
|
3406 + | #[allow(missing_docs)] // documentation missing in model
|
3407 + | pub(crate) fn set_min_short(
|
3408 + | mut self,
|
3409 + | input: Option<
|
3410 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::MinShort>>,
|
3411 + | >,
|
3412 + | ) -> Self {
|
3413 + | self.min_short = input.map(|v| v.into());
|
3414 + | self
|
3557 3415 | }
|
3558 - |
|
3559 - | impl ::std::fmt::Display for ConstraintViolation {
|
3560 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3561 - | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputShort`failed to satisfy constraint: Member must be between 4 and 6, inclusive")
|
3562 - | }
|
3416 + | #[allow(missing_docs)] // documentation missing in model
|
3417 + | pub fn max_short(mut self, input: ::std::option::Option<crate::model::MaxShort>) -> Self {
|
3418 + | self.max_short = input.map(crate::constrained::MaybeConstrained::Constrained);
|
3419 + | self
|
3563 3420 | }
|
3564 - |
|
3565 - | impl ::std::error::Error for ConstraintViolation {}
|
3566 - | impl ConstraintViolation {
|
3567 - | pub(crate) fn as_validation_exception_field(
|
3568 - | self,
|
3569 - | path: ::std::string::String,
|
3570 - | ) -> crate::model::ValidationExceptionField {
|
3571 - | match self {
|
3572 - | Self::Range(_) => crate::model::ValidationExceptionField {
|
3573 - | message: format!("Value at '{}' failed to satisfy constraint: Member must be between 4 and 6, inclusive", &path),
|
3574 - | path,
|
3575 - | },
|
3576 - | }
|
3577 - | }
|
3421 + | #[allow(missing_docs)] // documentation missing in model
|
3422 + | pub(crate) fn set_max_short(
|
3423 + | mut self,
|
3424 + | input: Option<
|
3425 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::MaxShort>>,
|
3426 + | >,
|
3427 + | ) -> Self {
|
3428 + | self.max_short = input.map(|v| v.into());
|
3429 + | self
|
3578 3430 | }
|
3579 - | }
|
3580 - | /// See [`MalformedRangeOverrideInputMaxByte`](crate::input::malformed_range_override_input::MaxByte).
|
3581 - | pub mod max_byte {
|
3582 - |
|
3583 - | #[derive(Debug, PartialEq)]
|
3584 - | pub enum ConstraintViolation {
|
3585 - | Range(i8),
|
3431 + | #[allow(missing_docs)] // documentation missing in model
|
3432 + | pub fn integer(mut self, input: ::std::option::Option<crate::model::RangeInteger>) -> Self {
|
3433 + | self.integer = input.map(crate::constrained::MaybeConstrained::Constrained);
|
3434 + | self
|
3586 3435 | }
|
3587 - |
|
3588 - | impl ::std::fmt::Display for ConstraintViolation {
|
3589 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3590 - | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMaxByte`failed to satisfy constraint: Member must be less than or equal to 6")
|
3591 - | }
|
3436 + | #[allow(missing_docs)] // documentation missing in model
|
3437 + | pub(crate) fn set_integer(
|
3438 + | mut self,
|
3439 + | input: Option<
|
3440 + | impl ::std::convert::Into<
|
3441 + | crate::constrained::MaybeConstrained<crate::model::RangeInteger>,
|
3442 + | >,
|
3443 + | >,
|
3444 + | ) -> Self {
|
3445 + | self.integer = input.map(|v| v.into());
|
3446 + | self
|
3592 3447 | }
|
3593 - |
|
3594 - | impl ::std::error::Error for ConstraintViolation {}
|
3595 - | impl ConstraintViolation {
|
3596 - | pub(crate) fn as_validation_exception_field(
|
3597 - | self,
|
3598 - | path: ::std::string::String,
|
3599 - | ) -> crate::model::ValidationExceptionField {
|
3600 - | match self {
|
3601 - | Self::Range(_) => crate::model::ValidationExceptionField {
|
3602 - | message: format!("Value at '{}' failed to satisfy constraint: Member must be less than or equal to 6", &path),
|
3603 - | path,
|
3604 - | },
|
3605 - | }
|
3606 - | }
|
3448 + | #[allow(missing_docs)] // documentation missing in model
|
3449 + | pub fn min_integer(
|
3450 + | mut self,
|
3451 + | input: ::std::option::Option<crate::model::MinInteger>,
|
3452 + | ) -> Self {
|
3453 + | self.min_integer = input.map(crate::constrained::MaybeConstrained::Constrained);
|
3454 + | self
|
3607 3455 | }
|
3608 - | }
|
3609 - | /// See [`MalformedRangeOverrideInputMinByte`](crate::input::malformed_range_override_input::MinByte).
|
3610 - | pub mod min_byte {
|
3611 - |
|
3612 - | #[derive(Debug, PartialEq)]
|
3613 - | pub enum ConstraintViolation {
|
3614 - | Range(i8),
|
3456 + | #[allow(missing_docs)] // documentation missing in model
|
3457 + | pub(crate) fn set_min_integer(
|
3458 + | mut self,
|
3459 + | input: Option<
|
3460 + | impl ::std::convert::Into<
|
3461 + | crate::constrained::MaybeConstrained<crate::model::MinInteger>,
|
3462 + | >,
|
3463 + | >,
|
3464 + | ) -> Self {
|
3465 + | self.min_integer = input.map(|v| v.into());
|
3466 + | self
|
3615 3467 | }
|
3616 - |
|
3617 - | impl ::std::fmt::Display for ConstraintViolation {
|
3618 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3619 - | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMinByte`failed to satisfy constraint: Member must be greater than or equal to 4")
|
3620 - | }
|
3468 + | #[allow(missing_docs)] // documentation missing in model
|
3469 + | pub fn max_integer(
|
3470 + | mut self,
|
3471 + | input: ::std::option::Option<crate::model::MaxInteger>,
|
3472 + | ) -> Self {
|
3473 + | self.max_integer = input.map(crate::constrained::MaybeConstrained::Constrained);
|
3474 + | self
|
3621 3475 | }
|
3622 - |
|
3623 - | impl ::std::error::Error for ConstraintViolation {}
|
3624 - | impl ConstraintViolation {
|
3625 - | pub(crate) fn as_validation_exception_field(
|
3626 - | self,
|
3627 - | path: ::std::string::String,
|
3628 - | ) -> crate::model::ValidationExceptionField {
|
3629 - | match self {
|
3630 - | Self::Range(_) => crate::model::ValidationExceptionField {
|
3631 - | message: format!("Value at '{}' failed to satisfy constraint: Member must be greater than or equal to 4", &path),
|
3632 - | path,
|
3633 - | },
|
3634 - | }
|
3635 - | }
|
3476 + | #[allow(missing_docs)] // documentation missing in model
|
3477 + | pub(crate) fn set_max_integer(
|
3478 + | mut self,
|
3479 + | input: Option<
|
3480 + | impl ::std::convert::Into<
|
3481 + | crate::constrained::MaybeConstrained<crate::model::MaxInteger>,
|
3482 + | >,
|
3483 + | >,
|
3484 + | ) -> Self {
|
3485 + | self.max_integer = input.map(|v| v.into());
|
3486 + | self
|
3636 3487 | }
|
3637 - | }
|
3638 - | /// See [`MalformedRangeOverrideInputByte`](crate::input::malformed_range_override_input::Byte).
|
3639 - | pub mod byte {
|
3640 - |
|
3641 - | #[derive(Debug, PartialEq)]
|
3642 - | pub enum ConstraintViolation {
|
3643 - | Range(i8),
|
3488 + | #[allow(missing_docs)] // documentation missing in model
|
3489 + | pub fn long(mut self, input: ::std::option::Option<crate::model::RangeLong>) -> Self {
|
3490 + | self.long = input.map(crate::constrained::MaybeConstrained::Constrained);
|
3491 + | self
|
3644 3492 | }
|
3645 - |
|
3646 - | impl ::std::fmt::Display for ConstraintViolation {
|
3647 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3648 - | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputByte`failed to satisfy constraint: Member must be between 4 and 6, inclusive")
|
3649 - | }
|
3493 + | #[allow(missing_docs)] // documentation missing in model
|
3494 + | pub(crate) fn set_long(
|
3495 + | mut self,
|
3496 + | input: Option<
|
3497 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::RangeLong>>,
|
3498 + | >,
|
3499 + | ) -> Self {
|
3500 + | self.long = input.map(|v| v.into());
|
3501 + | self
|
3650 3502 | }
|
3651 - |
|
3652 - | impl ::std::error::Error for ConstraintViolation {}
|
3653 - | impl ConstraintViolation {
|
3654 - | pub(crate) fn as_validation_exception_field(
|
3655 - | self,
|
3656 - | path: ::std::string::String,
|
3657 - | ) -> crate::model::ValidationExceptionField {
|
3658 - | match self {
|
3659 - | Self::Range(_) => crate::model::ValidationExceptionField {
|
3660 - | message: format!("Value at '{}' failed to satisfy constraint: Member must be between 4 and 6, inclusive", &path),
|
3661 - | path,
|
3662 - | },
|
3663 - | }
|
3664 - | }
|
3503 + | #[allow(missing_docs)] // documentation missing in model
|
3504 + | pub fn min_long(mut self, input: ::std::option::Option<crate::model::MinLong>) -> Self {
|
3505 + | self.min_long = input.map(crate::constrained::MaybeConstrained::Constrained);
|
3506 + | self
|
3507 + | }
|
3508 + | #[allow(missing_docs)] // documentation missing in model
|
3509 + | pub(crate) fn set_min_long(
|
3510 + | mut self,
|
3511 + | input: Option<
|
3512 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::MinLong>>,
|
3513 + | >,
|
3514 + | ) -> Self {
|
3515 + | self.min_long = input.map(|v| v.into());
|
3516 + | self
|
3517 + | }
|
3518 + | #[allow(missing_docs)] // documentation missing in model
|
3519 + | pub fn max_long(mut self, input: ::std::option::Option<crate::model::MaxLong>) -> Self {
|
3520 + | self.max_long = input.map(crate::constrained::MaybeConstrained::Constrained);
|
3521 + | self
|
3522 + | }
|
3523 + | #[allow(missing_docs)] // documentation missing in model
|
3524 + | pub(crate) fn set_max_long(
|
3525 + | mut self,
|
3526 + | input: Option<
|
3527 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::MaxLong>>,
|
3528 + | >,
|
3529 + | ) -> Self {
|
3530 + | self.max_long = input.map(|v| v.into());
|
3531 + | self
|
3532 + | }
|
3533 + | #[allow(missing_docs)] // documentation missing in model
|
3534 + | pub fn float(mut self, input: ::std::option::Option<f32>) -> Self {
|
3535 + | self.float = input;
|
3536 + | self
|
3537 + | }
|
3538 + | #[allow(missing_docs)] // documentation missing in model
|
3539 + | pub(crate) fn set_float(mut self, input: Option<impl ::std::convert::Into<f32>>) -> Self {
|
3540 + | self.float = input.map(|v| v.into());
|
3541 + | self
|
3542 + | }
|
3543 + | #[allow(missing_docs)] // documentation missing in model
|
3544 + | pub fn min_float(mut self, input: ::std::option::Option<f32>) -> Self {
|
3545 + | self.min_float = input;
|
3546 + | self
|
3547 + | }
|
3548 + | #[allow(missing_docs)] // documentation missing in model
|
3549 + | pub(crate) fn set_min_float(
|
3550 + | mut self,
|
3551 + | input: Option<impl ::std::convert::Into<f32>>,
|
3552 + | ) -> Self {
|
3553 + | self.min_float = input.map(|v| v.into());
|
3554 + | self
|
3555 + | }
|
3556 + | #[allow(missing_docs)] // documentation missing in model
|
3557 + | pub fn max_float(mut self, input: ::std::option::Option<f32>) -> Self {
|
3558 + | self.max_float = input;
|
3559 + | self
|
3560 + | }
|
3561 + | #[allow(missing_docs)] // documentation missing in model
|
3562 + | pub(crate) fn set_max_float(
|
3563 + | mut self,
|
3564 + | input: Option<impl ::std::convert::Into<f32>>,
|
3565 + | ) -> Self {
|
3566 + | self.max_float = input.map(|v| v.into());
|
3567 + | self
|
3568 + | }
|
3569 + | /// Consumes the builder and constructs a [`MalformedRangeInput`](crate::input::MalformedRangeInput).
|
3570 + | ///
|
3571 + | /// The builder fails to construct a [`MalformedRangeInput`](crate::input::MalformedRangeInput) if a [`ConstraintViolation`] occurs.
|
3572 + | ///
|
3573 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
3574 + | pub fn build(self) -> Result<crate::input::MalformedRangeInput, ConstraintViolation> {
|
3575 + | self.build_enforcing_all_constraints()
|
3576 + | }
|
3577 + | fn build_enforcing_all_constraints(
|
3578 + | self,
|
3579 + | ) -> Result<crate::input::MalformedRangeInput, ConstraintViolation> {
|
3580 + | Ok(crate::input::MalformedRangeInput {
|
3581 + | byte: self
|
3582 + | .byte
|
3583 + | .map(|v| match v {
|
3584 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3585 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3586 + | })
|
3587 + | .map(|res| res.map_err(ConstraintViolation::Byte))
|
3588 + | .transpose()?,
|
3589 + | min_byte: self
|
3590 + | .min_byte
|
3591 + | .map(|v| match v {
|
3592 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3593 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3594 + | })
|
3595 + | .map(|res| res.map_err(ConstraintViolation::MinByte))
|
3596 + | .transpose()?,
|
3597 + | max_byte: self
|
3598 + | .max_byte
|
3599 + | .map(|v| match v {
|
3600 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3601 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3602 + | })
|
3603 + | .map(|res| res.map_err(ConstraintViolation::MaxByte))
|
3604 + | .transpose()?,
|
3605 + | short: self
|
3606 + | .short
|
3607 + | .map(|v| match v {
|
3608 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3609 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3610 + | })
|
3611 + | .map(|res| res.map_err(ConstraintViolation::Short))
|
3612 + | .transpose()?,
|
3613 + | min_short: self
|
3614 + | .min_short
|
3615 + | .map(|v| match v {
|
3616 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3617 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3618 + | })
|
3619 + | .map(|res| res.map_err(ConstraintViolation::MinShort))
|
3620 + | .transpose()?,
|
3621 + | max_short: self
|
3622 + | .max_short
|
3623 + | .map(|v| match v {
|
3624 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3625 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3626 + | })
|
3627 + | .map(|res| res.map_err(ConstraintViolation::MaxShort))
|
3628 + | .transpose()?,
|
3629 + | integer: self
|
3630 + | .integer
|
3631 + | .map(|v| match v {
|
3632 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3633 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3634 + | })
|
3635 + | .map(|res| res.map_err(ConstraintViolation::Integer))
|
3636 + | .transpose()?,
|
3637 + | min_integer: self
|
3638 + | .min_integer
|
3639 + | .map(|v| match v {
|
3640 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3641 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3642 + | })
|
3643 + | .map(|res| res.map_err(ConstraintViolation::MinInteger))
|
3644 + | .transpose()?,
|
3645 + | max_integer: self
|
3646 + | .max_integer
|
3647 + | .map(|v| match v {
|
3648 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3649 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3650 + | })
|
3651 + | .map(|res| res.map_err(ConstraintViolation::MaxInteger))
|
3652 + | .transpose()?,
|
3653 + | long: self
|
3654 + | .long
|
3655 + | .map(|v| match v {
|
3656 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3657 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3658 + | })
|
3659 + | .map(|res| res.map_err(ConstraintViolation::Long))
|
3660 + | .transpose()?,
|
3661 + | min_long: self
|
3662 + | .min_long
|
3663 + | .map(|v| match v {
|
3664 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3665 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3666 + | })
|
3667 + | .map(|res| res.map_err(ConstraintViolation::MinLong))
|
3668 + | .transpose()?,
|
3669 + | max_long: self
|
3670 + | .max_long
|
3671 + | .map(|v| match v {
|
3672 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
3673 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
3674 + | })
|
3675 + | .map(|res| res.map_err(ConstraintViolation::MaxLong))
|
3676 + | .transpose()?,
|
3677 + | float: self.float,
|
3678 + | min_float: self.min_float,
|
3679 + | max_float: self.max_float,
|
3680 + | })
|
3665 3681 | }
|
3666 3682 | }
|
3667 3683 | }
|
3668 - | /// See [`MalformedRangeInput`](crate::input::MalformedRangeInput).
|
3669 - | pub mod malformed_range_input {
|
3684 + | /// See [`MalformedRangeOverrideInput`](crate::input::MalformedRangeOverrideInput).
|
3685 + | pub mod malformed_range_override_input {
|
3670 3686 |
|
3671 3687 | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
3672 3688 | /// Holds one variant for each of the ways the builder can fail.
|
3673 3689 | #[non_exhaustive]
|
3674 3690 | #[allow(clippy::enum_variant_names)]
|
3675 3691 | pub enum ConstraintViolation {
|
3676 - | /// Constraint violation occurred building member `byte` when building `MalformedRangeInput`.
|
3677 - | #[doc(hidden)]
|
3678 - | Byte(crate::model::range_byte::ConstraintViolation),
|
3679 - | /// Constraint violation occurred building member `min_byte` when building `MalformedRangeInput`.
|
3692 + | /// Constraint violation occurred building member `byte` when building `MalformedRangeOverrideInput`.
|
3680 3693 | #[doc(hidden)]
|
3681 - | MinByte(crate::model::min_byte::ConstraintViolation),
|
3682 - | /// Constraint violation occurred building member `max_byte` when building `MalformedRangeInput`.
|
3694 + | Byte(crate::input::malformed_range_override_input::byte::ConstraintViolation),
|
3695 + | /// Constraint violation occurred building member `min_byte` when building `MalformedRangeOverrideInput`.
|
3683 3696 | #[doc(hidden)]
|
3684 - | MaxByte(crate::model::max_byte::ConstraintViolation),
|
3685 - | /// Constraint violation occurred building member `short` when building `MalformedRangeInput`.
|
3697 + | MinByte(crate::input::malformed_range_override_input::min_byte::ConstraintViolation),
|
3698 + | /// Constraint violation occurred building member `max_byte` when building `MalformedRangeOverrideInput`.
|
3686 3699 | #[doc(hidden)]
|
3687 - | Short(crate::model::range_short::ConstraintViolation),
|
3688 - | /// Constraint violation occurred building member `min_short` when building `MalformedRangeInput`.
|
3700 + | MaxByte(crate::input::malformed_range_override_input::max_byte::ConstraintViolation),
|
3701 + | /// Constraint violation occurred building member `short` when building `MalformedRangeOverrideInput`.
|
3689 3702 | #[doc(hidden)]
|
3690 - | MinShort(crate::model::min_short::ConstraintViolation),
|
3691 - | /// Constraint violation occurred building member `max_short` when building `MalformedRangeInput`.
|
3703 + | Short(crate::input::malformed_range_override_input::short::ConstraintViolation),
|
3704 + | /// Constraint violation occurred building member `min_short` when building `MalformedRangeOverrideInput`.
|
3692 3705 | #[doc(hidden)]
|
3693 - | MaxShort(crate::model::max_short::ConstraintViolation),
|
3694 - | /// Constraint violation occurred building member `integer` when building `MalformedRangeInput`.
|
3706 + | MinShort(crate::input::malformed_range_override_input::min_short::ConstraintViolation),
|
3707 + | /// Constraint violation occurred building member `max_short` when building `MalformedRangeOverrideInput`.
|
3695 3708 | #[doc(hidden)]
|
3696 - | Integer(crate::model::range_integer::ConstraintViolation),
|
3697 - | /// Constraint violation occurred building member `min_integer` when building `MalformedRangeInput`.
|
3709 + | MaxShort(crate::input::malformed_range_override_input::max_short::ConstraintViolation),
|
3710 + | /// Constraint violation occurred building member `integer` when building `MalformedRangeOverrideInput`.
|
3698 3711 | #[doc(hidden)]
|
3699 - | MinInteger(crate::model::min_integer::ConstraintViolation),
|
3700 - | /// Constraint violation occurred building member `max_integer` when building `MalformedRangeInput`.
|
3712 + | Integer(crate::input::malformed_range_override_input::integer::ConstraintViolation),
|
3713 + | /// Constraint violation occurred building member `min_integer` when building `MalformedRangeOverrideInput`.
|
3701 3714 | #[doc(hidden)]
|
3702 - | MaxInteger(crate::model::max_integer::ConstraintViolation),
|
3703 - | /// Constraint violation occurred building member `long` when building `MalformedRangeInput`.
|
3715 + | MinInteger(crate::input::malformed_range_override_input::min_integer::ConstraintViolation),
|
3716 + | /// Constraint violation occurred building member `max_integer` when building `MalformedRangeOverrideInput`.
|
3704 3717 | #[doc(hidden)]
|
3705 - | Long(crate::model::range_long::ConstraintViolation),
|
3706 - | /// Constraint violation occurred building member `min_long` when building `MalformedRangeInput`.
|
3718 + | MaxInteger(crate::input::malformed_range_override_input::max_integer::ConstraintViolation),
|
3719 + | /// Constraint violation occurred building member `long` when building `MalformedRangeOverrideInput`.
|
3707 3720 | #[doc(hidden)]
|
3708 - | MinLong(crate::model::min_long::ConstraintViolation),
|
3709 - | /// Constraint violation occurred building member `max_long` when building `MalformedRangeInput`.
|
3721 + | Long(crate::input::malformed_range_override_input::long::ConstraintViolation),
|
3722 + | /// Constraint violation occurred building member `min_long` when building `MalformedRangeOverrideInput`.
|
3710 3723 | #[doc(hidden)]
|
3711 - | MaxLong(crate::model::max_long::ConstraintViolation),
|
3724 + | MinLong(crate::input::malformed_range_override_input::min_long::ConstraintViolation),
|
3725 + | /// Constraint violation occurred building member `max_long` when building `MalformedRangeOverrideInput`.
|
3726 + | #[doc(hidden)]
|
3727 + | MaxLong(crate::input::malformed_range_override_input::max_long::ConstraintViolation),
|
3712 3728 | }
|
3713 3729 | impl ::std::fmt::Display for ConstraintViolation {
|
3714 3730 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
3715 3731 | match self {
|
3716 - | ConstraintViolation::Byte(_) => write!(f, "constraint violation occurred building member `byte` when building `MalformedRangeInput`"),
|
3717 - | ConstraintViolation::MinByte(_) => write!(f, "constraint violation occurred building member `min_byte` when building `MalformedRangeInput`"),
|
3718 - | ConstraintViolation::MaxByte(_) => write!(f, "constraint violation occurred building member `max_byte` when building `MalformedRangeInput`"),
|
3719 - | ConstraintViolation::Short(_) => write!(f, "constraint violation occurred building member `short` when building `MalformedRangeInput`"),
|
3720 - | ConstraintViolation::MinShort(_) => write!(f, "constraint violation occurred building member `min_short` when building `MalformedRangeInput`"),
|
3721 - | ConstraintViolation::MaxShort(_) => write!(f, "constraint violation occurred building member `max_short` when building `MalformedRangeInput`"),
|
3722 - | ConstraintViolation::Integer(_) => write!(f, "constraint violation occurred building member `integer` when building `MalformedRangeInput`"),
|
3723 - | ConstraintViolation::MinInteger(_) => write!(f, "constraint violation occurred building member `min_integer` when building `MalformedRangeInput`"),
|
3724 - | ConstraintViolation::MaxInteger(_) => write!(f, "constraint violation occurred building member `max_integer` when building `MalformedRangeInput`"),
|
3725 - | ConstraintViolation::Long(_) => write!(f, "constraint violation occurred building member `long` when building `MalformedRangeInput`"),
|
3726 - | ConstraintViolation::MinLong(_) => write!(f, "constraint violation occurred building member `min_long` when building `MalformedRangeInput`"),
|
3727 - | ConstraintViolation::MaxLong(_) => write!(f, "constraint violation occurred building member `max_long` when building `MalformedRangeInput`"),
|
3732 + | ConstraintViolation::Byte(_) => write!(f, "constraint violation occurred building member `byte` when building `MalformedRangeOverrideInput`"),
|
3733 + | ConstraintViolation::MinByte(_) => write!(f, "constraint violation occurred building member `min_byte` when building `MalformedRangeOverrideInput`"),
|
3734 + | ConstraintViolation::MaxByte(_) => write!(f, "constraint violation occurred building member `max_byte` when building `MalformedRangeOverrideInput`"),
|
3735 + | ConstraintViolation::Short(_) => write!(f, "constraint violation occurred building member `short` when building `MalformedRangeOverrideInput`"),
|
3736 + | ConstraintViolation::MinShort(_) => write!(f, "constraint violation occurred building member `min_short` when building `MalformedRangeOverrideInput`"),
|
3737 + | ConstraintViolation::MaxShort(_) => write!(f, "constraint violation occurred building member `max_short` when building `MalformedRangeOverrideInput`"),
|
3738 + | ConstraintViolation::Integer(_) => write!(f, "constraint violation occurred building member `integer` when building `MalformedRangeOverrideInput`"),
|
3739 + | ConstraintViolation::MinInteger(_) => write!(f, "constraint violation occurred building member `min_integer` when building `MalformedRangeOverrideInput`"),
|
3740 + | ConstraintViolation::MaxInteger(_) => write!(f, "constraint violation occurred building member `max_integer` when building `MalformedRangeOverrideInput`"),
|
3741 + | ConstraintViolation::Long(_) => write!(f, "constraint violation occurred building member `long` when building `MalformedRangeOverrideInput`"),
|
3742 + | ConstraintViolation::MinLong(_) => write!(f, "constraint violation occurred building member `min_long` when building `MalformedRangeOverrideInput`"),
|
3743 + | ConstraintViolation::MaxLong(_) => write!(f, "constraint violation occurred building member `max_long` when building `MalformedRangeOverrideInput`"),
|
3728 3744 | }
|
3729 3745 | }
|
3730 3746 | }
|
3731 3747 | impl ::std::error::Error for ConstraintViolation {}
|
3732 3748 | impl ConstraintViolation {
|
3733 3749 | pub(crate) fn as_validation_exception_field(
|
3734 3750 | self,
|
3735 3751 | path: ::std::string::String,
|
3736 3752 | ) -> crate::model::ValidationExceptionField {
|
3737 3753 | match self {
|
4176 4300 | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
4177 4301 | })
|
4178 4302 | .map(|res| res.map_err(ConstraintViolation::MaxLong))
|
4179 4303 | .transpose()?,
|
4180 4304 | float: self.float,
|
4181 4305 | min_float: self.min_float,
|
4182 4306 | max_float: self.max_float,
|
4183 4307 | })
|
4184 4308 | }
|
4185 4309 | }
|
4186 - | }
|
4187 - | /// See [`MalformedPatternOverrideInput`](crate::input::MalformedPatternOverrideInput).
|
4188 - | pub mod malformed_pattern_override_input {
|
4310 + | #[allow(missing_docs)] // documentation missing in model
|
4311 + | ///
|
4312 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
4313 + | /// [constraint traits]. Use [`Byte::try_from`] to construct values of this type.
|
4314 + | ///
|
4315 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
4316 + | ///
|
4317 + | #[derive(
|
4318 + | ::std::clone::Clone,
|
4319 + | ::std::cmp::Eq,
|
4320 + | ::std::cmp::PartialEq,
|
4321 + | ::std::fmt::Debug,
|
4322 + | ::std::hash::Hash,
|
4323 + | )]
|
4324 + | pub struct Byte(pub(crate) i8);
|
4325 + | impl Byte {
|
4326 + | /// Returns an immutable reference to the underlying [`i8`].
|
4327 + | pub fn inner(&self) -> &i8 {
|
4328 + | &self.0
|
4329 + | }
|
4189 4330 |
|
4190 - | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
4191 - | /// Holds one variant for each of the ways the builder can fail.
|
4192 - | #[non_exhaustive]
|
4193 - | #[allow(clippy::enum_variant_names)]
|
4194 - | pub enum ConstraintViolation {
|
4195 - | /// Constraint violation occurred building member `string` when building `MalformedPatternOverrideInput`.
|
4196 - | #[doc(hidden)]
|
4197 - | String(crate::input::malformed_pattern_override_input::string::ConstraintViolation),
|
4198 - | /// Constraint violation occurred building member `list` when building `MalformedPatternOverrideInput`.
|
4199 - | #[doc(hidden)]
|
4200 - | List(crate::model::pattern_list_override::ConstraintViolation),
|
4201 - | /// Constraint violation occurred building member `map` when building `MalformedPatternOverrideInput`.
|
4202 - | #[doc(hidden)]
|
4203 - | Map(crate::model::pattern_map_override::ConstraintViolation),
|
4204 - | /// Constraint violation occurred building member `union` when building `MalformedPatternOverrideInput`.
|
4205 - | #[doc(hidden)]
|
4206 - | Union(crate::model::pattern_union_override::ConstraintViolation),
|
4331 + | /// Consumes the value, returning the underlying [`i8`].
|
4332 + | pub fn into_inner(self) -> i8 {
|
4333 + | self.0
|
4334 + | }
|
4207 4335 | }
|
4208 - | impl ::std::fmt::Display for ConstraintViolation {
|
4336 + |
|
4337 + | impl crate::constrained::Constrained for Byte {
|
4338 + | type Unconstrained = i8;
|
4339 + | }
|
4340 + |
|
4341 + | impl ::std::convert::From<i8>
|
4342 + | for crate::constrained::MaybeConstrained<crate::input::malformed_range_override_input::Byte>
|
4343 + | {
|
4344 + | fn from(value: i8) -> Self {
|
4345 + | Self::Unconstrained(value)
|
4346 + | }
|
4347 + | }
|
4348 + |
|
4349 + | impl ::std::fmt::Display for Byte {
|
4209 4350 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
4210 - | match self {
|
4211 - | ConstraintViolation::String(_) => write!(f, "constraint violation occurred building member `string` when building `MalformedPatternOverrideInput`"),
|
4212 - | ConstraintViolation::List(_) => write!(f, "constraint violation occurred building member `list` when building `MalformedPatternOverrideInput`"),
|
4213 - | ConstraintViolation::Map(_) => write!(f, "constraint violation occurred building member `map` when building `MalformedPatternOverrideInput`"),
|
4214 - | ConstraintViolation::Union(_) => write!(f, "constraint violation occurred building member `union` when building `MalformedPatternOverrideInput`"),
|
4351 + | self.0.fmt(f)
|
4352 + | }
|
4353 + | }
|
4354 + |
|
4355 + | impl ::std::convert::From<Byte> for i8 {
|
4356 + | fn from(value: Byte) -> Self {
|
4357 + | value.into_inner()
|
4358 + | }
|
4359 + | }
|
4360 + | impl Byte {
|
4361 + | fn check_range(
|
4362 + | value: i8,
|
4363 + | ) -> ::std::result::Result<
|
4364 + | (),
|
4365 + | crate::input::malformed_range_override_input::byte::ConstraintViolation,
|
4366 + | > {
|
4367 + | if (4..=6).contains(&value) {
|
4368 + | Ok(())
|
4369 + | } else {
|
4370 + | Err(
|
4371 + | crate::input::malformed_range_override_input::byte::ConstraintViolation::Range(
|
4372 + | value,
|
4373 + | ),
|
4374 + | )
|
4215 4375 | }
|
4216 4376 | }
|
4217 4377 | }
|
4218 - | impl ::std::error::Error for ConstraintViolation {}
|
4219 - | impl ConstraintViolation {
|
4220 - | pub(crate) fn as_validation_exception_field(
|
4221 - | self,
|
4222 - | path: ::std::string::String,
|
4223 - | ) -> crate::model::ValidationExceptionField {
|
4224 - | match self {
|
4225 - | ConstraintViolation::String(inner) => {
|
4226 - | inner.as_validation_exception_field(path + "/string")
|
4227 - | }
|
4228 - | ConstraintViolation::List(inner) => {
|
4229 - | inner.as_validation_exception_field(path + "/list")
|
4230 - | }
|
4231 - | ConstraintViolation::Map(inner) => {
|
4232 - | inner.as_validation_exception_field(path + "/map")
|
4233 - | }
|
4234 - | ConstraintViolation::Union(inner) => {
|
4235 - | inner.as_validation_exception_field(path + "/union")
|
4236 - | }
|
4378 + | impl ::std::convert::TryFrom<i8> for Byte {
|
4379 + | type Error = crate::input::malformed_range_override_input::byte::ConstraintViolation;
|
4380 + |
|
4381 + | /// Constructs a `Byte` from an [`i8`], failing when the provided value does not satisfy the modeled constraints.
|
4382 + | fn try_from(value: i8) -> ::std::result::Result<Self, Self::Error> {
|
4383 + | Self::check_range(value)?;
|
4384 + |
|
4385 + | Ok(Self(value))
|
4386 + | }
|
4387 + | }
|
4388 + | #[allow(missing_docs)] // documentation missing in model
|
4389 + | ///
|
4390 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
4391 + | /// [constraint traits]. Use [`MinByte::try_from`] to construct values of this type.
|
4392 + | ///
|
4393 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
4394 + | ///
|
4395 + | #[derive(
|
4396 + | ::std::clone::Clone,
|
4397 + | ::std::cmp::Eq,
|
4398 + | ::std::cmp::PartialEq,
|
4399 + | ::std::fmt::Debug,
|
4400 + | ::std::hash::Hash,
|
4401 + | )]
|
4402 + | pub struct MinByte(pub(crate) i8);
|
4403 + | impl MinByte {
|
4404 + | /// Returns an immutable reference to the underlying [`i8`].
|
4405 + | pub fn inner(&self) -> &i8 {
|
4406 + | &self.0
|
4407 + | }
|
4408 + |
|
4409 + | /// Consumes the value, returning the underlying [`i8`].
|
4410 + | pub fn into_inner(self) -> i8 {
|
4411 + | self.0
|
4412 + | }
|
4413 + | }
|
4414 + |
|
4415 + | impl crate::constrained::Constrained for MinByte {
|
4416 + | type Unconstrained = i8;
|
4417 + | }
|
4418 + |
|
4419 + | impl ::std::convert::From<i8>
|
4420 + | for crate::constrained::MaybeConstrained<
|
4421 + | crate::input::malformed_range_override_input::MinByte,
|
4422 + | >
|
4423 + | {
|
4424 + | fn from(value: i8) -> Self {
|
4425 + | Self::Unconstrained(value)
|
4426 + | }
|
4427 + | }
|
4428 + |
|
4429 + | impl ::std::fmt::Display for MinByte {
|
4430 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
4431 + | self.0.fmt(f)
|
4432 + | }
|
4433 + | }
|
4434 + |
|
4435 + | impl ::std::convert::From<MinByte> for i8 {
|
4436 + | fn from(value: MinByte) -> Self {
|
4437 + | value.into_inner()
|
4438 + | }
|
4439 + | }
|
4440 + | impl MinByte {
|
4441 + | fn check_range(
|
4442 + | value: i8,
|
4443 + | ) -> ::std::result::Result<
|
4444 + | (),
|
4445 + | crate::input::malformed_range_override_input::min_byte::ConstraintViolation,
|
4446 + | > {
|
4447 + | if 4 <= value {
|
4448 + | Ok(())
|
4449 + | } else {
|
4450 + | Err(crate::input::malformed_range_override_input::min_byte::ConstraintViolation::Range(value))
|
4451 + | }
|
4452 + | }
|
4453 + | }
|
4454 + | impl ::std::convert::TryFrom<i8> for MinByte {
|
4455 + | type Error = crate::input::malformed_range_override_input::min_byte::ConstraintViolation;
|
4456 + |
|
4457 + | /// Constructs a `MinByte` from an [`i8`], failing when the provided value does not satisfy the modeled constraints.
|
4458 + | fn try_from(value: i8) -> ::std::result::Result<Self, Self::Error> {
|
4459 + | Self::check_range(value)?;
|
4460 + |
|
4461 + | Ok(Self(value))
|
4462 + | }
|
4463 + | }
|
4464 + | #[allow(missing_docs)] // documentation missing in model
|
4465 + | ///
|
4466 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
4467 + | /// [constraint traits]. Use [`MaxByte::try_from`] to construct values of this type.
|
4468 + | ///
|
4469 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
4470 + | ///
|
4471 + | #[derive(
|
4472 + | ::std::clone::Clone,
|
4473 + | ::std::cmp::Eq,
|
4474 + | ::std::cmp::PartialEq,
|
4475 + | ::std::fmt::Debug,
|
4476 + | ::std::hash::Hash,
|
4477 + | )]
|
4478 + | pub struct MaxByte(pub(crate) i8);
|
4479 + | impl MaxByte {
|
4480 + | /// Returns an immutable reference to the underlying [`i8`].
|
4481 + | pub fn inner(&self) -> &i8 {
|
4482 + | &self.0
|
4483 + | }
|
4484 + |
|
4485 + | /// Consumes the value, returning the underlying [`i8`].
|
4486 + | pub fn into_inner(self) -> i8 {
|
4487 + | self.0
|
4488 + | }
|
4489 + | }
|
4490 + |
|
4491 + | impl crate::constrained::Constrained for MaxByte {
|
4492 + | type Unconstrained = i8;
|
4493 + | }
|
4494 + |
|
4495 + | impl ::std::convert::From<i8>
|
4496 + | for crate::constrained::MaybeConstrained<
|
4497 + | crate::input::malformed_range_override_input::MaxByte,
|
4498 + | >
|
4499 + | {
|
4500 + | fn from(value: i8) -> Self {
|
4501 + | Self::Unconstrained(value)
|
4502 + | }
|
4503 + | }
|
4504 + |
|
4505 + | impl ::std::fmt::Display for MaxByte {
|
4506 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
4507 + | self.0.fmt(f)
|
4508 + | }
|
4509 + | }
|
4510 + |
|
4511 + | impl ::std::convert::From<MaxByte> for i8 {
|
4512 + | fn from(value: MaxByte) -> Self {
|
4513 + | value.into_inner()
|
4514 + | }
|
4515 + | }
|
4516 + | impl MaxByte {
|
4517 + | fn check_range(
|
4518 + | value: i8,
|
4519 + | ) -> ::std::result::Result<
|
4520 + | (),
|
4521 + | crate::input::malformed_range_override_input::max_byte::ConstraintViolation,
|
4522 + | > {
|
4523 + | if value <= 6 {
|
4524 + | Ok(())
|
4525 + | } else {
|
4526 + | Err(crate::input::malformed_range_override_input::max_byte::ConstraintViolation::Range(value))
|
4237 4527 | }
|
4238 4528 | }
|
4239 4529 | }
|
4240 - | impl ::std::convert::From<ConstraintViolation>
|
4241 - | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
4242 - | {
|
4243 - | fn from(constraint_violation: ConstraintViolation) -> Self {
|
4244 - | let first_validation_exception_field =
|
4245 - | constraint_violation.as_validation_exception_field("".to_owned());
|
4246 - | let validation_exception = crate::error::ValidationException {
|
4247 - | message: format!(
|
4248 - | "1 validation error detected. {}",
|
4249 - | &first_validation_exception_field.message
|
4250 - | ),
|
4251 - | field_list: Some(vec![first_validation_exception_field]),
|
4252 - | };
|
4253 - | Self::ConstraintViolation(
|
4254 - | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
4255 - | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
4256 - | )
|
4530 + | impl ::std::convert::TryFrom<i8> for MaxByte {
|
4531 + | type Error = crate::input::malformed_range_override_input::max_byte::ConstraintViolation;
|
4532 + |
|
4533 + | /// Constructs a `MaxByte` from an [`i8`], failing when the provided value does not satisfy the modeled constraints.
|
4534 + | fn try_from(value: i8) -> ::std::result::Result<Self, Self::Error> {
|
4535 + | Self::check_range(value)?;
|
4536 + |
|
4537 + | Ok(Self(value))
|
4257 4538 | }
|
4258 4539 | }
|
4259 - | impl ::std::convert::From<Builder>
|
4260 - | for crate::constrained::MaybeConstrained<crate::input::MalformedPatternOverrideInput>
|
4261 - | {
|
4262 - | fn from(builder: Builder) -> Self {
|
4263 - | Self::Unconstrained(builder)
|
4540 + | #[allow(missing_docs)] // documentation missing in model
|
4541 + | ///
|
4542 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
4543 + | /// [constraint traits]. Use [`Short::try_from`] to construct values of this type.
|
4544 + | ///
|
4545 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
4546 + | ///
|
4547 + | #[derive(
|
4548 + | ::std::clone::Clone,
|
4549 + | ::std::cmp::Eq,
|
4550 + | ::std::cmp::PartialEq,
|
4551 + | ::std::fmt::Debug,
|
4552 + | ::std::hash::Hash,
|
4553 + | )]
|
4554 + | pub struct Short(pub(crate) i16);
|
4555 + | impl Short {
|
4556 + | /// Returns an immutable reference to the underlying [`i16`].
|
4557 + | pub fn inner(&self) -> &i16 {
|
4558 + | &self.0
|
4559 + | }
|
4560 + |
|
4561 + | /// Consumes the value, returning the underlying [`i16`].
|
4562 + | pub fn into_inner(self) -> i16 {
|
4563 + | self.0
|
4264 4564 | }
|
4265 4565 | }
|
4266 - | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedPatternOverrideInput {
|
4267 - | type Error = ConstraintViolation;
|
4268 4566 |
|
4269 - | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
4270 - | builder.build()
|
4567 + | impl crate::constrained::Constrained for Short {
|
4568 + | type Unconstrained = i16;
|
4569 + | }
|
4570 + |
|
4571 + | impl ::std::convert::From<i16>
|
4572 + | for crate::constrained::MaybeConstrained<
|
4573 + | crate::input::malformed_range_override_input::Short,
|
4574 + | >
|
4575 + | {
|
4576 + | fn from(value: i16) -> Self {
|
4577 + | Self::Unconstrained(value)
|
4271 4578 | }
|
4272 4579 | }
|
4273 - | /// A builder for [`MalformedPatternOverrideInput`](crate::input::MalformedPatternOverrideInput).
|
4274 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
4275 - | pub struct Builder {
|
4276 - | pub(crate) string: ::std::option::Option<crate::constrained::MaybeConstrained<crate::input::malformed_pattern_override_input::String>>,
|
4277 - | pub(crate) list: ::std::option::Option<crate::constrained::MaybeConstrained<crate::constrained::pattern_list_override_constrained::PatternListOverrideConstrained>>,
|
4278 - | pub(crate) map: ::std::option::Option<crate::constrained::MaybeConstrained<crate::constrained::pattern_map_override_constrained::PatternMapOverrideConstrained>>,
|
4279 - | pub(crate) union: ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::PatternUnionOverride>>,
|
4580 + |
|
4581 + | impl ::std::fmt::Display for Short {
|
4582 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
4583 + | self.0.fmt(f)
|
4584 + | }
|
4280 4585 | }
|
4281 - | impl Builder {
|
4282 - | #[allow(missing_docs)] // documentation missing in model
|
4283 - | pub fn string(
|
4284 - | mut self,
|
4285 - | input: ::std::option::Option<crate::input::malformed_pattern_override_input::String>,
|
4286 - | ) -> Self {
|
4287 - | self.string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
4288 - | self
|
4586 + |
|
4587 + | impl ::std::convert::From<Short> for i16 {
|
4588 + | fn from(value: Short) -> Self {
|
4589 + | value.into_inner()
|
4289 4590 | }
|
4290 - | #[allow(missing_docs)] // documentation missing in model
|
4291 - | pub(crate) fn set_string(
|
4292 - | mut self,
|
4293 - | input: Option<
|
4294 - | impl ::std::convert::Into<
|
4295 - | crate::constrained::MaybeConstrained<
|
4296 - | crate::input::malformed_pattern_override_input::String,
|
4297 - | >,
|
4298 - | >,
|
4299 - | >,
|
4300 - | ) -> Self {
|
4301 - | self.string = input.map(|v| v.into());
|
4302 - | self
|
4591 + | }
|
4592 + | impl Short {
|
4593 + | fn check_range(
|
4594 + | value: i16,
|
4595 + | ) -> ::std::result::Result<
|
4596 + | (),
|
4597 + | crate::input::malformed_range_override_input::short::ConstraintViolation,
|
4598 + | > {
|
4599 + | if (4..=6).contains(&value) {
|
4600 + | Ok(())
|
4601 + | } else {
|
4602 + | Err(
|
4603 + | crate::input::malformed_range_override_input::short::ConstraintViolation::Range(
|
4604 + | value,
|
4605 + | ),
|
4606 + | )
|
4607 + | }
|
4303 4608 | }
|
4304 - | #[allow(missing_docs)] // documentation missing in model
|
4305 - | pub fn list(
|
4306 - | mut self,
|
4307 - | input: ::std::option::Option<
|
4308 - | ::std::vec::Vec<crate::model::pattern_list_override::Member>,
|
4309 - | >,
|
4310 - | ) -> Self {
|
4311 - | self.list =
|
4312 - | input.map(|v| crate::constrained::MaybeConstrained::Constrained((v).into()));
|
4313 - | self
|
4609 + | }
|
4610 + | impl ::std::convert::TryFrom<i16> for Short {
|
4611 + | type Error = crate::input::malformed_range_override_input::short::ConstraintViolation;
|
4612 + |
|
4613 + | /// Constructs a `Short` from an [`i16`], failing when the provided value does not satisfy the modeled constraints.
|
4614 + | fn try_from(value: i16) -> ::std::result::Result<Self, Self::Error> {
|
4615 + | Self::check_range(value)?;
|
4616 + |
|
4617 + | Ok(Self(value))
|
4314 4618 | }
|
4315 - | #[allow(missing_docs)] // documentation missing in model
|
4316 - | pub(crate) fn set_list(
|
4317 - | mut self,
|
4318 - | input: Option<impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::constrained::pattern_list_override_constrained::PatternListOverrideConstrained>>>,
|
4319 - | ) -> Self {
|
4320 - | self.list = input.map(|v| v.into());
|
4321 - | self
|
4619 + | }
|
4620 + | #[allow(missing_docs)] // documentation missing in model
|
4621 + | ///
|
4622 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
4623 + | /// [constraint traits]. Use [`MinShort::try_from`] to construct values of this type.
|
4624 + | ///
|
4625 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
4626 + | ///
|
4627 + | #[derive(
|
4628 + | ::std::clone::Clone,
|
4629 + | ::std::cmp::Eq,
|
4630 + | ::std::cmp::PartialEq,
|
4631 + | ::std::fmt::Debug,
|
4632 + | ::std::hash::Hash,
|
4633 + | )]
|
4634 + | pub struct MinShort(pub(crate) i16);
|
4635 + | impl MinShort {
|
4636 + | /// Returns an immutable reference to the underlying [`i16`].
|
4637 + | pub fn inner(&self) -> &i16 {
|
4638 + | &self.0
|
4322 4639 | }
|
4323 - | #[allow(missing_docs)] // documentation missing in model
|
4324 - | pub fn map(
|
4325 - | mut self,
|
4326 - | input: ::std::option::Option<
|
4327 - | ::std::collections::HashMap<
|
4328 - | crate::model::pattern_map_override::Key,
|
4329 - | crate::model::pattern_map_override::Value,
|
4330 - | >,
|
4331 - | >,
|
4332 - | ) -> Self {
|
4333 - | self.map = input.map(|v| crate::constrained::MaybeConstrained::Constrained((v).into()));
|
4334 - | self
|
4640 + |
|
4641 + | /// Consumes the value, returning the underlying [`i16`].
|
4642 + | pub fn into_inner(self) -> i16 {
|
4643 + | self.0
|
4335 4644 | }
|
4336 - | #[allow(missing_docs)] // documentation missing in model
|
4337 - | pub(crate) fn set_map(
|
4338 - | mut self,
|
4339 - | input: Option<impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::constrained::pattern_map_override_constrained::PatternMapOverrideConstrained>>>,
|
4340 - | ) -> Self {
|
4341 - | self.map = input.map(|v| v.into());
|
4342 - | self
|
4645 + | }
|
4646 + |
|
4647 + | impl crate::constrained::Constrained for MinShort {
|
4648 + | type Unconstrained = i16;
|
4649 + | }
|
4650 + |
|
4651 + | impl ::std::convert::From<i16>
|
4652 + | for crate::constrained::MaybeConstrained<
|
4653 + | crate::input::malformed_range_override_input::MinShort,
|
4654 + | >
|
4655 + | {
|
4656 + | fn from(value: i16) -> Self {
|
4657 + | Self::Unconstrained(value)
|
4343 4658 | }
|
4344 - | #[allow(missing_docs)] // documentation missing in model
|
4345 - | pub fn union(
|
4346 - | mut self,
|
4347 - | input: ::std::option::Option<crate::model::PatternUnionOverride>,
|
4348 - | ) -> Self {
|
4349 - | self.union = input.map(crate::constrained::MaybeConstrained::Constrained);
|
4350 - | self
|
4659 + | }
|
4660 + |
|
4661 + | impl ::std::fmt::Display for MinShort {
|
4662 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
4663 + | self.0.fmt(f)
|
4351 4664 | }
|
4352 - | #[allow(missing_docs)] // documentation missing in model
|
4353 - | pub(crate) fn set_union(
|
4354 - | mut self,
|
4355 - | input: Option<
|
4356 - | impl ::std::convert::Into<
|
4357 - | crate::constrained::MaybeConstrained<crate::model::PatternUnionOverride>,
|
4358 - | >,
|
4359 - | >,
|
4360 - | ) -> Self {
|
4361 - | self.union = input.map(|v| v.into());
|
4362 - | self
|
4665 + | }
|
4666 + |
|
4667 + | impl ::std::convert::From<MinShort> for i16 {
|
4668 + | fn from(value: MinShort) -> Self {
|
4669 + | value.into_inner()
|
4363 4670 | }
|
4364 - | /// Consumes the builder and constructs a [`MalformedPatternOverrideInput`](crate::input::MalformedPatternOverrideInput).
|
4365 - | ///
|
4366 - | /// The builder fails to construct a [`MalformedPatternOverrideInput`](crate::input::MalformedPatternOverrideInput) if a [`ConstraintViolation`] occurs.
|
4367 - | ///
|
4368 - | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
4369 - | pub fn build(
|
4370 - | self,
|
4371 - | ) -> Result<crate::input::MalformedPatternOverrideInput, ConstraintViolation> {
|
4372 - | self.build_enforcing_all_constraints()
|
4671 + | }
|
4672 + | impl MinShort {
|
4673 + | fn check_range(
|
4674 + | value: i16,
|
4675 + | ) -> ::std::result::Result<
|
4676 + | (),
|
4677 + | crate::input::malformed_range_override_input::min_short::ConstraintViolation,
|
4678 + | > {
|
4679 + | if 4 <= value {
|
4680 + | Ok(())
|
4681 + | } else {
|
4682 + | Err(crate::input::malformed_range_override_input::min_short::ConstraintViolation::Range(value))
|
4683 + | }
|
4373 4684 | }
|
4374 - | fn build_enforcing_all_constraints(
|
4375 - | self,
|
4376 - | ) -> Result<crate::input::MalformedPatternOverrideInput, ConstraintViolation> {
|
4377 - | Ok(crate::input::MalformedPatternOverrideInput {
|
4378 - | string: self
|
4379 - | .string
|
4380 - | .map(|v| match v {
|
4381 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
4382 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
4383 - | })
|
4384 - | .map(|res| res.map_err(ConstraintViolation::String))
|
4385 - | .transpose()?,
|
4386 - | list: self
|
4387 - | .list
|
4388 - | .map(|v| match v {
|
4389 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
4390 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
4391 - | })
|
4392 - | .map(|res| res.map(|v| v.into()).map_err(ConstraintViolation::List))
|
4393 - | .transpose()?,
|
4394 - | map: self
|
4395 - | .map
|
4396 - | .map(|v| match v {
|
4397 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
4398 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
4399 - | })
|
4400 - | .map(|res| res.map(|v| v.into()).map_err(ConstraintViolation::Map))
|
4401 - | .transpose()?,
|
4402 - | union: self
|
4403 - | .union
|
4404 - | .map(|v| match v {
|
4405 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
4406 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
4407 - | })
|
4408 - | .map(|res| res.map_err(ConstraintViolation::Union))
|
4409 - | .transpose()?,
|
4410 - | })
|
4685 + | }
|
4686 + | impl ::std::convert::TryFrom<i16> for MinShort {
|
4687 + | type Error = crate::input::malformed_range_override_input::min_short::ConstraintViolation;
|
4688 + |
|
4689 + | /// Constructs a `MinShort` from an [`i16`], failing when the provided value does not satisfy the modeled constraints.
|
4690 + | fn try_from(value: i16) -> ::std::result::Result<Self, Self::Error> {
|
4691 + | Self::check_range(value)?;
|
4692 + |
|
4693 + | Ok(Self(value))
|
4411 4694 | }
|
4412 4695 | }
|
4413 4696 | #[allow(missing_docs)] // documentation missing in model
|
4414 4697 | ///
|
4415 4698 | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
4416 - | /// [constraint traits]. Use [`String::try_from`] to construct values of this type.
|
4699 + | /// [constraint traits]. Use [`MaxShort::try_from`] to construct values of this type.
|
4417 4700 | ///
|
4418 4701 | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
4419 4702 | ///
|
4420 4703 | #[derive(
|
4421 4704 | ::std::clone::Clone,
|
4422 4705 | ::std::cmp::Eq,
|
4423 4706 | ::std::cmp::PartialEq,
|
4424 4707 | ::std::fmt::Debug,
|
4425 4708 | ::std::hash::Hash,
|
4426 4709 | )]
|
4427 - | pub struct String(pub(crate) ::std::string::String);
|
4428 - | impl String {
|
4429 - | /// Extracts a string slice containing the entire underlying `String`.
|
4430 - | pub fn as_str(&self) -> &str {
|
4431 - | &self.0
|
4432 - | }
|
4433 - |
|
4434 - | /// Returns an immutable reference to the underlying [`::std::string::String`].
|
4435 - | pub fn inner(&self) -> &::std::string::String {
|
4710 + | pub struct MaxShort(pub(crate) i16);
|
4711 + | impl MaxShort {
|
4712 + | /// Returns an immutable reference to the underlying [`i16`].
|
4713 + | pub fn inner(&self) -> &i16 {
|
4436 4714 | &self.0
|
4437 4715 | }
|
4438 4716 |
|
4439 - | /// Consumes the value, returning the underlying [`::std::string::String`].
|
4440 - | pub fn into_inner(self) -> ::std::string::String {
|
4717 + | /// Consumes the value, returning the underlying [`i16`].
|
4718 + | pub fn into_inner(self) -> i16 {
|
4441 4719 | self.0
|
4442 4720 | }
|
4443 4721 | }
|
4444 - | impl String {
|
4445 - | fn check_pattern(
|
4446 - | string: ::std::string::String,
|
4447 - | ) -> ::std::result::Result<
|
4448 - | ::std::string::String,
|
4449 - | crate::input::malformed_pattern_override_input::string::ConstraintViolation,
|
4450 - | > {
|
4451 - | let regex = Self::compile_regex();
|
4452 - |
|
4453 - | if regex.is_match(&string) {
|
4454 - | Ok(string)
|
4455 - | } else {
|
4456 - | Err(crate::input::malformed_pattern_override_input::string::ConstraintViolation::Pattern(string))
|
4457 - | }
|
4458 - | }
|
4459 - |
|
4460 - | /// Attempts to compile the regex for this constrained type's `@pattern`.
|
4461 - | /// This can fail if the specified regex is not supported by the `::regex` crate.
|
4462 - | pub fn compile_regex() -> &'static ::regex::Regex {
|
4463 - | static REGEX: std::sync::LazyLock<::regex::Regex> = std::sync::LazyLock::new(|| {
|
4464 - | ::regex::Regex::new(r#"^[g-m]+$"#).expect(r#"The regular expression ^[g-m]+$ is not supported by the `regex` crate; feel free to file an issue under https://github.com/smithy-lang/smithy-rs/issues for support"#)
|
4465 - | });
|
4466 - |
|
4467 - | ®EX
|
4468 - | }
|
4469 - | }
|
4470 - | impl ::std::convert::TryFrom<::std::string::String> for String {
|
4471 - | type Error = crate::input::malformed_pattern_override_input::string::ConstraintViolation;
|
4472 - |
|
4473 - | /// Constructs a `String` from an [`::std::string::String`], failing when the provided value does not satisfy the modeled constraints.
|
4474 - | fn try_from(value: ::std::string::String) -> ::std::result::Result<Self, Self::Error> {
|
4475 - | let value = Self::check_pattern(value)?;
|
4476 4722 |
|
4477 - | Ok(Self(value))
|
4478 - | }
|
4479 - | }
|
4480 - | impl crate::constrained::Constrained for String {
|
4481 - | type Unconstrained = ::std::string::String;
|
4723 + | impl crate::constrained::Constrained for MaxShort {
|
4724 + | type Unconstrained = i16;
|
4482 4725 | }
|
4483 4726 |
|
4484 - | impl ::std::convert::From<::std::string::String>
|
4727 + | impl ::std::convert::From<i16>
|
4485 4728 | for crate::constrained::MaybeConstrained<
|
4486 - | crate::input::malformed_pattern_override_input::String,
|
4729 + | crate::input::malformed_range_override_input::MaxShort,
|
4487 4730 | >
|
4488 4731 | {
|
4489 - | fn from(value: ::std::string::String) -> Self {
|
4732 + | fn from(value: i16) -> Self {
|
4490 4733 | Self::Unconstrained(value)
|
4491 4734 | }
|
4492 4735 | }
|
4493 4736 |
|
4494 - | impl ::std::fmt::Display for String {
|
4737 + | impl ::std::fmt::Display for MaxShort {
|
4495 4738 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
4496 4739 | self.0.fmt(f)
|
4497 4740 | }
|
4498 4741 | }
|
4499 4742 |
|
4500 - | impl ::std::convert::From<String> for ::std::string::String {
|
4501 - | fn from(value: String) -> Self {
|
4743 + | impl ::std::convert::From<MaxShort> for i16 {
|
4744 + | fn from(value: MaxShort) -> Self {
|
4502 4745 | value.into_inner()
|
4503 4746 | }
|
4504 4747 | }
|
4505 - | #[cfg(test)]
|
4506 - | mod test_string {
|
4507 - | #[test]
|
4508 - | fn regex_compiles() {
|
4509 - | crate::input::malformed_pattern_override_input::String::compile_regex();
|
4748 + | impl MaxShort {
|
4749 + | fn check_range(
|
4750 + | value: i16,
|
4751 + | ) -> ::std::result::Result<
|
4752 + | (),
|
4753 + | crate::input::malformed_range_override_input::max_short::ConstraintViolation,
|
4754 + | > {
|
4755 + | if value <= 6 {
|
4756 + | Ok(())
|
4757 + | } else {
|
4758 + | Err(crate::input::malformed_range_override_input::max_short::ConstraintViolation::Range(value))
|
4759 + | }
|
4510 4760 | }
|
4511 4761 | }
|
4762 + | impl ::std::convert::TryFrom<i16> for MaxShort {
|
4763 + | type Error = crate::input::malformed_range_override_input::max_short::ConstraintViolation;
|
4512 4764 |
|
4513 - | /// See [`MalformedPatternOverrideInputString`](crate::input::malformed_pattern_override_input::String).
|
4514 - | pub mod string {
|
4515 - |
|
4516 - | #[derive(Debug, PartialEq)]
|
4517 - | pub enum ConstraintViolation {
|
4518 - | /// Error when a string doesn't satisfy its `@pattern`.
|
4519 - | /// Contains the String that failed the pattern.
|
4520 - | Pattern(String),
|
4521 - | }
|
4522 - |
|
4523 - | impl ::std::fmt::Display for ConstraintViolation {
|
4524 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
4525 - | let message = match self {
|
4526 - | Self::Pattern(_) => {
|
4527 - | format!(
|
4528 - | r#"Value provided for `aws.protocoltests.restjson.validation.synthetic#MalformedPatternOverrideInputString` failed to satisfy the constraint: Member must match the regular expression pattern: {}"#,
|
4529 - | r#"^[g-m]+$"#
|
4530 - | )
|
4531 - | }
|
4532 - | };
|
4533 - | write!(f, "{message}")
|
4534 - | }
|
4535 - | }
|
4765 + | /// Constructs a `MaxShort` from an [`i16`], failing when the provided value does not satisfy the modeled constraints.
|
4766 + | fn try_from(value: i16) -> ::std::result::Result<Self, Self::Error> {
|
4767 + | Self::check_range(value)?;
|
4536 4768 |
|
4537 - | impl ::std::error::Error for ConstraintViolation {}
|
4538 - | impl ConstraintViolation {
|
4539 - | pub(crate) fn as_validation_exception_field(
|
4540 - | self,
|
4541 - | path: ::std::string::String,
|
4542 - | ) -> crate::model::ValidationExceptionField {
|
4543 - | match self {
|
4544 - | #[allow(unused_variables)]
|
4545 - | Self::Pattern(_) => crate::model::ValidationExceptionField {
|
4546 - | message: format!("Value at '{}' failed to satisfy constraint: Member must satisfy regular expression pattern: {}", &path, r#"^[g-m]+$"#),
|
4547 - | path
|
4548 - | },
|
4549 - | }
|
4550 - | }
|
4769 + | Ok(Self(value))
|
4551 4770 | }
|
4552 4771 | }
|
4553 - | }
|
4554 - | /// See [`MalformedPatternInput`](crate::input::MalformedPatternInput).
|
4555 - | pub mod malformed_pattern_input {
|
4556 - |
|
4557 - | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
4558 - | /// Holds one variant for each of the ways the builder can fail.
|
4559 - | #[non_exhaustive]
|
4560 - | #[allow(clippy::enum_variant_names)]
|
4561 - | pub enum ConstraintViolation {
|
4562 - | /// Constraint violation occurred building member `string` when building `MalformedPatternInput`.
|
4563 - | #[doc(hidden)]
|
4564 - | String(crate::model::pattern_string::ConstraintViolation),
|
4565 - | /// Constraint violation occurred building member `evil_string` when building `MalformedPatternInput`.
|
4566 - | #[doc(hidden)]
|
4567 - | EvilString(crate::model::evil_string::ConstraintViolation),
|
4568 - | /// Constraint violation occurred building member `list` when building `MalformedPatternInput`.
|
4569 - | #[doc(hidden)]
|
4570 - | List(crate::model::pattern_list::ConstraintViolation),
|
4571 - | /// Constraint violation occurred building member `map` when building `MalformedPatternInput`.
|
4572 - | #[doc(hidden)]
|
4573 - | Map(crate::model::pattern_map::ConstraintViolation),
|
4574 - | /// Constraint violation occurred building member `union` when building `MalformedPatternInput`.
|
4575 - | #[doc(hidden)]
|
4576 - | Union(crate::model::pattern_union::ConstraintViolation),
|
4577 - | }
|
4578 - | impl ::std::fmt::Display for ConstraintViolation {
|
4579 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
4580 - | match self {
|
4581 - | ConstraintViolation::String(_) => write!(f, "constraint violation occurred building member `string` when building `MalformedPatternInput`"),
|
4582 - | ConstraintViolation::EvilString(_) => write!(f, "constraint violation occurred building member `evil_string` when building `MalformedPatternInput`"),
|
4583 - | ConstraintViolation::List(_) => write!(f, "constraint violation occurred building member `list` when building `MalformedPatternInput`"),
|
4584 - | ConstraintViolation::Map(_) => write!(f, "constraint violation occurred building member `map` when building `MalformedPatternInput`"),
|
4585 - | ConstraintViolation::Union(_) => write!(f, "constraint violation occurred building member `union` when building `MalformedPatternInput`"),
|
4586 - | }
|
4772 + | #[allow(missing_docs)] // documentation missing in model
|
4773 + | ///
|
4774 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
4775 + | /// [constraint traits]. Use [`Integer::try_from`] to construct values of this type.
|
4776 + | ///
|
4777 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
4778 + | ///
|
4779 + | #[derive(
|
4780 + | ::std::clone::Clone,
|
4781 + | ::std::cmp::Eq,
|
4782 + | ::std::cmp::PartialEq,
|
4783 + | ::std::fmt::Debug,
|
4784 + | ::std::hash::Hash,
|
4785 + | )]
|
4786 + | pub struct Integer(pub(crate) i32);
|
4787 + | impl Integer {
|
4788 + | /// Returns an immutable reference to the underlying [`i32`].
|
4789 + | pub fn inner(&self) -> &i32 {
|
4790 + | &self.0
|
4587 4791 | }
|
4588 - | }
|
4589 - | impl ::std::error::Error for ConstraintViolation {}
|
4590 - | impl ConstraintViolation {
|
4591 - | pub(crate) fn as_validation_exception_field(
|
4592 - | self,
|
4593 - | path: ::std::string::String,
|
4594 - | ) -> crate::model::ValidationExceptionField {
|
4595 - | match self {
|
4596 - | ConstraintViolation::String(inner) => {
|
4597 - | inner.as_validation_exception_field(path + "/string")
|
4598 - | }
|
4599 - | ConstraintViolation::EvilString(inner) => {
|
4600 - | inner.as_validation_exception_field(path + "/evilString")
|
4601 - | }
|
4602 - | ConstraintViolation::List(inner) => {
|
4603 - | inner.as_validation_exception_field(path + "/list")
|
4604 - | }
|
4605 - | ConstraintViolation::Map(inner) => {
|
4606 - | inner.as_validation_exception_field(path + "/map")
|
4607 - | }
|
4608 - | ConstraintViolation::Union(inner) => {
|
4609 - | inner.as_validation_exception_field(path + "/union")
|
4610 - | }
|
4611 - | }
|
4792 + |
|
4793 + | /// Consumes the value, returning the underlying [`i32`].
|
4794 + | pub fn into_inner(self) -> i32 {
|
4795 + | self.0
|
4612 4796 | }
|
4613 4797 | }
|
4614 - | impl ::std::convert::From<ConstraintViolation>
|
4615 - | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
4798 + |
|
4799 + | impl crate::constrained::Constrained for Integer {
|
4800 + | type Unconstrained = i32;
|
4801 + | }
|
4802 + |
|
4803 + | impl ::std::convert::From<i32>
|
4804 + | for crate::constrained::MaybeConstrained<
|
4805 + | crate::input::malformed_range_override_input::Integer,
|
4806 + | >
|
4616 4807 | {
|
4617 - | fn from(constraint_violation: ConstraintViolation) -> Self {
|
4618 - | let first_validation_exception_field =
|
4619 - | constraint_violation.as_validation_exception_field("".to_owned());
|
4620 - | let validation_exception = crate::error::ValidationException {
|
4621 - | message: format!(
|
4622 - | "1 validation error detected. {}",
|
4623 - | &first_validation_exception_field.message
|
4624 - | ),
|
4625 - | field_list: Some(vec![first_validation_exception_field]),
|
4626 - | };
|
4627 - | Self::ConstraintViolation(
|
4628 - | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
4629 - | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
4630 - | )
|
4808 + | fn from(value: i32) -> Self {
|
4809 + | Self::Unconstrained(value)
|
4631 4810 | }
|
4632 4811 | }
|
4633 - | impl ::std::convert::From<Builder>
|
4634 - | for crate::constrained::MaybeConstrained<crate::input::MalformedPatternInput>
|
4635 - | {
|
4636 - | fn from(builder: Builder) -> Self {
|
4637 - | Self::Unconstrained(builder)
|
4812 + |
|
4813 + | impl ::std::fmt::Display for Integer {
|
4814 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
4815 + | self.0.fmt(f)
|
4638 4816 | }
|
4639 4817 | }
|
4640 - | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedPatternInput {
|
4641 - | type Error = ConstraintViolation;
|
4642 4818 |
|
4643 - | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
4644 - | builder.build()
|
4819 + | impl ::std::convert::From<Integer> for i32 {
|
4820 + | fn from(value: Integer) -> Self {
|
4821 + | value.into_inner()
|
4645 4822 | }
|
4646 4823 | }
|
4647 - | /// A builder for [`MalformedPatternInput`](crate::input::MalformedPatternInput).
|
4648 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
4649 - | pub struct Builder {
|
4650 - | pub(crate) string: ::std::option::Option<
|
4651 - | crate::constrained::MaybeConstrained<crate::model::PatternString>,
|
4652 - | >,
|
4653 - | pub(crate) evil_string:
|
4654 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::EvilString>>,
|
4655 - | pub(crate) list: ::std::option::Option<
|
4656 - | crate::constrained::MaybeConstrained<
|
4657 - | crate::constrained::pattern_list_constrained::PatternListConstrained,
|
4658 - | >,
|
4659 - | >,
|
4660 - | pub(crate) map: ::std::option::Option<
|
4661 - | crate::constrained::MaybeConstrained<
|
4662 - | crate::constrained::pattern_map_constrained::PatternMapConstrained,
|
4663 - | >,
|
4664 - | >,
|
4665 - | pub(crate) union:
|
4666 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::PatternUnion>>,
|
4824 + | impl Integer {
|
4825 + | fn check_range(
|
4826 + | value: i32,
|
4827 + | ) -> ::std::result::Result<
|
4828 + | (),
|
4829 + | crate::input::malformed_range_override_input::integer::ConstraintViolation,
|
4830 + | > {
|
4831 + | if (4..=6).contains(&value) {
|
4832 + | Ok(())
|
4833 + | } else {
|
4834 + | Err(crate::input::malformed_range_override_input::integer::ConstraintViolation::Range(value))
|
4835 + | }
|
4836 + | }
|
4667 4837 | }
|
4668 - | impl Builder {
|
4669 - | #[allow(missing_docs)] // documentation missing in model
|
4670 - | pub fn string(mut self, input: ::std::option::Option<crate::model::PatternString>) -> Self {
|
4671 - | self.string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
4672 - | self
|
4838 + | impl ::std::convert::TryFrom<i32> for Integer {
|
4839 + | type Error = crate::input::malformed_range_override_input::integer::ConstraintViolation;
|
4840 + |
|
4841 + | /// Constructs a `Integer` from an [`i32`], failing when the provided value does not satisfy the modeled constraints.
|
4842 + | fn try_from(value: i32) -> ::std::result::Result<Self, Self::Error> {
|
4843 + | Self::check_range(value)?;
|
4844 + |
|
4845 + | Ok(Self(value))
|
4673 4846 | }
|
4674 - | #[allow(missing_docs)] // documentation missing in model
|
4675 - | pub(crate) fn set_string(
|
4676 - | mut self,
|
4677 - | input: Option<
|
4678 - | impl ::std::convert::Into<
|
4679 - | crate::constrained::MaybeConstrained<crate::model::PatternString>,
|
4680 - | >,
|
4681 - | >,
|
4682 - | ) -> Self {
|
4683 - | self.string = input.map(|v| v.into());
|
4684 - | self
|
4847 + | }
|
4848 + | #[allow(missing_docs)] // documentation missing in model
|
4849 + | ///
|
4850 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
4851 + | /// [constraint traits]. Use [`MinInteger::try_from`] to construct values of this type.
|
4852 + | ///
|
4853 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
4854 + | ///
|
4855 + | #[derive(
|
4856 + | ::std::clone::Clone,
|
4857 + | ::std::cmp::Eq,
|
4858 + | ::std::cmp::PartialEq,
|
4859 + | ::std::fmt::Debug,
|
4860 + | ::std::hash::Hash,
|
4861 + | )]
|
4862 + | pub struct MinInteger(pub(crate) i32);
|
4863 + | impl MinInteger {
|
4864 + | /// Returns an immutable reference to the underlying [`i32`].
|
4865 + | pub fn inner(&self) -> &i32 {
|
4866 + | &self.0
|
4685 4867 | }
|
4686 - | #[allow(missing_docs)] // documentation missing in model
|
4687 - | pub fn evil_string(
|
4688 - | mut self,
|
4689 - | input: ::std::option::Option<crate::model::EvilString>,
|
4690 - | ) -> Self {
|
4691 - | self.evil_string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
4692 - | self
|
4868 + |
|
4869 + | /// Consumes the value, returning the underlying [`i32`].
|
4870 + | pub fn into_inner(self) -> i32 {
|
4871 + | self.0
|
4693 4872 | }
|
4694 - | #[allow(missing_docs)] // documentation missing in model
|
4695 - | pub(crate) fn set_evil_string(
|
4696 - | mut self,
|
4697 - | input: Option<
|
4698 - | impl ::std::convert::Into<
|
4699 - | crate::constrained::MaybeConstrained<crate::model::EvilString>,
|
4700 - | >,
|
4701 - | >,
|
4702 - | ) -> Self {
|
4703 - | self.evil_string = input.map(|v| v.into());
|
4704 - | self
|
4873 + | }
|
4874 + |
|
4875 + | impl crate::constrained::Constrained for MinInteger {
|
4876 + | type Unconstrained = i32;
|
4877 + | }
|
4878 + |
|
4879 + | impl ::std::convert::From<i32>
|
4880 + | for crate::constrained::MaybeConstrained<
|
4881 + | crate::input::malformed_range_override_input::MinInteger,
|
4882 + | >
|
4883 + | {
|
4884 + | fn from(value: i32) -> Self {
|
4885 + | Self::Unconstrained(value)
|
4705 4886 | }
|
4706 - | #[allow(missing_docs)] // documentation missing in model
|
4707 - | pub fn list(
|
4708 - | mut self,
|
4709 - | input: ::std::option::Option<::std::vec::Vec<crate::model::PatternString>>,
|
4710 - | ) -> Self {
|
4711 - | self.list =
|
4712 - | input.map(|v| crate::constrained::MaybeConstrained::Constrained((v).into()));
|
4713 - | self
|
4887 + | }
|
4888 + |
|
4889 + | impl ::std::fmt::Display for MinInteger {
|
4890 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
4891 + | self.0.fmt(f)
|
4714 4892 | }
|
4715 - | #[allow(missing_docs)] // documentation missing in model
|
4716 - | pub(crate) fn set_list(
|
4717 - | mut self,
|
4718 - | input: Option<
|
4719 - | impl ::std::convert::Into<
|
4720 - | crate::constrained::MaybeConstrained<
|
4721 - | crate::constrained::pattern_list_constrained::PatternListConstrained,
|
4722 - | >,
|
4723 - | >,
|
4724 - | >,
|
4725 - | ) -> Self {
|
4726 - | self.list = input.map(|v| v.into());
|
4727 - | self
|
4893 + | }
|
4894 + |
|
4895 + | impl ::std::convert::From<MinInteger> for i32 {
|
4896 + | fn from(value: MinInteger) -> Self {
|
4897 + | value.into_inner()
|
4728 4898 | }
|
4729 - | #[allow(missing_docs)] // documentation missing in model
|
4730 - | pub fn map(
|
4731 - | mut self,
|
4732 - | input: ::std::option::Option<
|
4733 - | ::std::collections::HashMap<
|
4734 - | crate::model::PatternString,
|
4735 - | crate::model::PatternString,
|
4736 - | >,
|
4737 - | >,
|
4738 - | ) -> Self {
|
4739 - | self.map = input.map(|v| crate::constrained::MaybeConstrained::Constrained((v).into()));
|
4740 - | self
|
4899 + | }
|
4900 + | impl MinInteger {
|
4901 + | fn check_range(
|
4902 + | value: i32,
|
4903 + | ) -> ::std::result::Result<
|
4904 + | (),
|
4905 + | crate::input::malformed_range_override_input::min_integer::ConstraintViolation,
|
4906 + | > {
|
4907 + | if 4 <= value {
|
4908 + | Ok(())
|
4909 + | } else {
|
4910 + | Err(crate::input::malformed_range_override_input::min_integer::ConstraintViolation::Range(value))
|
4911 + | }
|
4741 4912 | }
|
4742 - | #[allow(missing_docs)] // documentation missing in model
|
4743 - | pub(crate) fn set_map(
|
4744 - | mut self,
|
4745 - | input: Option<
|
4746 - | impl ::std::convert::Into<
|
4747 - | crate::constrained::MaybeConstrained<
|
4748 - | crate::constrained::pattern_map_constrained::PatternMapConstrained,
|
4749 - | >,
|
4750 - | >,
|
4751 - | >,
|
4752 - | ) -> Self {
|
4753 - | self.map = input.map(|v| v.into());
|
4754 - | self
|
4913 + | }
|
4914 + | impl ::std::convert::TryFrom<i32> for MinInteger {
|
4915 + | type Error = crate::input::malformed_range_override_input::min_integer::ConstraintViolation;
|
4916 + |
|
4917 + | /// Constructs a `MinInteger` from an [`i32`], failing when the provided value does not satisfy the modeled constraints.
|
4918 + | fn try_from(value: i32) -> ::std::result::Result<Self, Self::Error> {
|
4919 + | Self::check_range(value)?;
|
4920 + |
|
4921 + | Ok(Self(value))
|
4755 4922 | }
|
4756 - | #[allow(missing_docs)] // documentation missing in model
|
4757 - | pub fn union(mut self, input: ::std::option::Option<crate::model::PatternUnion>) -> Self {
|
4758 - | self.union = input.map(crate::constrained::MaybeConstrained::Constrained);
|
4759 - | self
|
4923 + | }
|
4924 + | #[allow(missing_docs)] // documentation missing in model
|
4925 + | ///
|
4926 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
4927 + | /// [constraint traits]. Use [`MaxInteger::try_from`] to construct values of this type.
|
4928 + | ///
|
4929 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
4930 + | ///
|
4931 + | #[derive(
|
4932 + | ::std::clone::Clone,
|
4933 + | ::std::cmp::Eq,
|
4934 + | ::std::cmp::PartialEq,
|
4935 + | ::std::fmt::Debug,
|
4936 + | ::std::hash::Hash,
|
4937 + | )]
|
4938 + | pub struct MaxInteger(pub(crate) i32);
|
4939 + | impl MaxInteger {
|
4940 + | /// Returns an immutable reference to the underlying [`i32`].
|
4941 + | pub fn inner(&self) -> &i32 {
|
4942 + | &self.0
|
4760 4943 | }
|
4761 - | #[allow(missing_docs)] // documentation missing in model
|
4762 - | pub(crate) fn set_union(
|
4763 - | mut self,
|
4764 - | input: Option<
|
4765 - | impl ::std::convert::Into<
|
4766 - | crate::constrained::MaybeConstrained<crate::model::PatternUnion>,
|
4767 - | >,
|
4768 - | >,
|
4769 - | ) -> Self {
|
4770 - | self.union = input.map(|v| v.into());
|
4771 - | self
|
4944 + |
|
4945 + | /// Consumes the value, returning the underlying [`i32`].
|
4946 + | pub fn into_inner(self) -> i32 {
|
4947 + | self.0
|
4772 4948 | }
|
4773 - | /// Consumes the builder and constructs a [`MalformedPatternInput`](crate::input::MalformedPatternInput).
|
4774 - | ///
|
4775 - | /// The builder fails to construct a [`MalformedPatternInput`](crate::input::MalformedPatternInput) if a [`ConstraintViolation`] occurs.
|
4776 - | ///
|
4777 - | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
4778 - | pub fn build(self) -> Result<crate::input::MalformedPatternInput, ConstraintViolation> {
|
4779 - | self.build_enforcing_all_constraints()
|
4949 + | }
|
4950 + |
|
4951 + | impl crate::constrained::Constrained for MaxInteger {
|
4952 + | type Unconstrained = i32;
|
4953 + | }
|
4954 + |
|
4955 + | impl ::std::convert::From<i32>
|
4956 + | for crate::constrained::MaybeConstrained<
|
4957 + | crate::input::malformed_range_override_input::MaxInteger,
|
4958 + | >
|
4959 + | {
|
4960 + | fn from(value: i32) -> Self {
|
4961 + | Self::Unconstrained(value)
|
4780 4962 | }
|
4781 - | fn build_enforcing_all_constraints(
|
4782 - | self,
|
4783 - | ) -> Result<crate::input::MalformedPatternInput, ConstraintViolation> {
|
4784 - | Ok(crate::input::MalformedPatternInput {
|
4785 - | string: self
|
4786 - | .string
|
4787 - | .map(|v| match v {
|
4788 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
4789 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
4790 - | })
|
4791 - | .map(|res| res.map_err(ConstraintViolation::String))
|
4792 - | .transpose()?,
|
4793 - | evil_string: self
|
4794 - | .evil_string
|
4795 - | .map(|v| match v {
|
4796 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
4797 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
4798 - | })
|
4799 - | .map(|res| res.map_err(ConstraintViolation::EvilString))
|
4800 - | .transpose()?,
|
4801 - | list: self
|
4802 - | .list
|
4803 - | .map(|v| match v {
|
4804 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
4805 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
4806 - | })
|
4807 - | .map(|res| res.map(|v| v.into()).map_err(ConstraintViolation::List))
|
4808 - | .transpose()?,
|
4809 - | map: self
|
4810 - | .map
|
4811 - | .map(|v| match v {
|
4812 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
4813 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
4814 - | })
|
4815 - | .map(|res| res.map(|v| v.into()).map_err(ConstraintViolation::Map))
|
4816 - | .transpose()?,
|
4817 - | union: self
|
4818 - | .union
|
4819 - | .map(|v| match v {
|
4820 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
4821 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
4822 - | })
|
4823 - | .map(|res| res.map_err(ConstraintViolation::Union))
|
4824 - | .transpose()?,
|
4825 - | })
|
4963 + | }
|
4964 + |
|
4965 + | impl ::std::fmt::Display for MaxInteger {
|
4966 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
4967 + | self.0.fmt(f)
|
4826 4968 | }
|
4827 4969 | }
|
4828 - | }
|
4829 - | /// See [`MalformedLengthQueryStringInput`](crate::input::MalformedLengthQueryStringInput).
|
4830 - | pub mod malformed_length_query_string_input {
|
4831 4970 |
|
4832 - | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
4833 - | /// Holds one variant for each of the ways the builder can fail.
|
4834 - | #[non_exhaustive]
|
4835 - | #[allow(clippy::enum_variant_names)]
|
4836 - | pub enum ConstraintViolation {
|
4837 - | /// Constraint violation occurred building member `string` when building `MalformedLengthQueryStringInput`.
|
4838 - | #[doc(hidden)]
|
4839 - | String(crate::model::length_string::ConstraintViolation),
|
4971 + | impl ::std::convert::From<MaxInteger> for i32 {
|
4972 + | fn from(value: MaxInteger) -> Self {
|
4973 + | value.into_inner()
|
4974 + | }
|
4840 4975 | }
|
4841 - | impl ::std::fmt::Display for ConstraintViolation {
|
4842 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
4843 - | match self {
|
4844 - | ConstraintViolation::String(_) => write!(f, "constraint violation occurred building member `string` when building `MalformedLengthQueryStringInput`"),
|
4976 + | impl MaxInteger {
|
4977 + | fn check_range(
|
4978 + | value: i32,
|
4979 + | ) -> ::std::result::Result<
|
4980 + | (),
|
4981 + | crate::input::malformed_range_override_input::max_integer::ConstraintViolation,
|
4982 + | > {
|
4983 + | if value <= 6 {
|
4984 + | Ok(())
|
4985 + | } else {
|
4986 + | Err(crate::input::malformed_range_override_input::max_integer::ConstraintViolation::Range(value))
|
4845 4987 | }
|
4846 4988 | }
|
4847 4989 | }
|
4848 - | impl ::std::error::Error for ConstraintViolation {}
|
4849 - | impl ConstraintViolation {
|
4850 - | pub(crate) fn as_validation_exception_field(
|
4851 - | self,
|
4852 - | path: ::std::string::String,
|
4853 - | ) -> crate::model::ValidationExceptionField {
|
4854 - | match self {
|
4855 - | ConstraintViolation::String(inner) => {
|
4856 - | inner.as_validation_exception_field(path + "/string")
|
4857 - | }
|
4858 - | }
|
4990 + | impl ::std::convert::TryFrom<i32> for MaxInteger {
|
4991 + | type Error = crate::input::malformed_range_override_input::max_integer::ConstraintViolation;
|
4992 + |
|
4993 + | /// Constructs a `MaxInteger` from an [`i32`], failing when the provided value does not satisfy the modeled constraints.
|
4994 + | fn try_from(value: i32) -> ::std::result::Result<Self, Self::Error> {
|
4995 + | Self::check_range(value)?;
|
4996 + |
|
4997 + | Ok(Self(value))
|
4859 4998 | }
|
4860 4999 | }
|
4861 - | impl ::std::convert::From<ConstraintViolation>
|
4862 - | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
4863 - | {
|
4864 - | fn from(constraint_violation: ConstraintViolation) -> Self {
|
4865 - | let first_validation_exception_field =
|
4866 - | constraint_violation.as_validation_exception_field("".to_owned());
|
4867 - | let validation_exception = crate::error::ValidationException {
|
4868 - | message: format!(
|
4869 - | "1 validation error detected. {}",
|
4870 - | &first_validation_exception_field.message
|
4871 - | ),
|
4872 - | field_list: Some(vec![first_validation_exception_field]),
|
4873 - | };
|
4874 - | Self::ConstraintViolation(
|
4875 - | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
4876 - | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
4877 - | )
|
5000 + | #[allow(missing_docs)] // documentation missing in model
|
5001 + | ///
|
5002 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
5003 + | /// [constraint traits]. Use [`Long::try_from`] to construct values of this type.
|
5004 + | ///
|
5005 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
5006 + | ///
|
5007 + | #[derive(
|
5008 + | ::std::clone::Clone,
|
5009 + | ::std::cmp::Eq,
|
5010 + | ::std::cmp::PartialEq,
|
5011 + | ::std::fmt::Debug,
|
5012 + | ::std::hash::Hash,
|
5013 + | )]
|
5014 + | pub struct Long(pub(crate) i64);
|
5015 + | impl Long {
|
5016 + | /// Returns an immutable reference to the underlying [`i64`].
|
5017 + | pub fn inner(&self) -> &i64 {
|
5018 + | &self.0
|
5019 + | }
|
5020 + |
|
5021 + | /// Consumes the value, returning the underlying [`i64`].
|
5022 + | pub fn into_inner(self) -> i64 {
|
5023 + | self.0
|
4878 5024 | }
|
4879 5025 | }
|
4880 - | impl ::std::convert::From<Builder>
|
4881 - | for crate::constrained::MaybeConstrained<crate::input::MalformedLengthQueryStringInput>
|
5026 + |
|
5027 + | impl crate::constrained::Constrained for Long {
|
5028 + | type Unconstrained = i64;
|
5029 + | }
|
5030 + |
|
5031 + | impl ::std::convert::From<i64>
|
5032 + | for crate::constrained::MaybeConstrained<crate::input::malformed_range_override_input::Long>
|
4882 5033 | {
|
4883 - | fn from(builder: Builder) -> Self {
|
4884 - | Self::Unconstrained(builder)
|
5034 + | fn from(value: i64) -> Self {
|
5035 + | Self::Unconstrained(value)
|
4885 5036 | }
|
4886 5037 | }
|
4887 - | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedLengthQueryStringInput {
|
4888 - | type Error = ConstraintViolation;
|
4889 5038 |
|
4890 - | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
4891 - | builder.build()
|
5039 + | impl ::std::fmt::Display for Long {
|
5040 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5041 + | self.0.fmt(f)
|
4892 5042 | }
|
4893 5043 | }
|
4894 - | /// A builder for [`MalformedLengthQueryStringInput`](crate::input::MalformedLengthQueryStringInput).
|
4895 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
4896 - | pub struct Builder {
|
4897 - | pub(crate) string:
|
4898 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::LengthString>>,
|
4899 - | }
|
4900 - | impl Builder {
|
4901 - | #[allow(missing_docs)] // documentation missing in model
|
4902 - | pub fn string(mut self, input: ::std::option::Option<crate::model::LengthString>) -> Self {
|
4903 - | self.string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
4904 - | self
|
5044 + |
|
5045 + | impl ::std::convert::From<Long> for i64 {
|
5046 + | fn from(value: Long) -> Self {
|
5047 + | value.into_inner()
|
4905 5048 | }
|
4906 - | #[allow(missing_docs)] // documentation missing in model
|
4907 - | pub(crate) fn set_string(
|
4908 - | mut self,
|
4909 - | input: Option<
|
4910 - | impl ::std::convert::Into<
|
4911 - | crate::constrained::MaybeConstrained<crate::model::LengthString>,
|
4912 - | >,
|
4913 - | >,
|
4914 - | ) -> Self {
|
4915 - | self.string = input.map(|v| v.into());
|
4916 - | self
|
5049 + | }
|
5050 + | impl Long {
|
5051 + | fn check_range(
|
5052 + | value: i64,
|
5053 + | ) -> ::std::result::Result<
|
5054 + | (),
|
5055 + | crate::input::malformed_range_override_input::long::ConstraintViolation,
|
5056 + | > {
|
5057 + | if (4..=6).contains(&value) {
|
5058 + | Ok(())
|
5059 + | } else {
|
5060 + | Err(
|
5061 + | crate::input::malformed_range_override_input::long::ConstraintViolation::Range(
|
5062 + | value,
|
5063 + | ),
|
5064 + | )
|
5065 + | }
|
4917 5066 | }
|
4918 - | /// Consumes the builder and constructs a [`MalformedLengthQueryStringInput`](crate::input::MalformedLengthQueryStringInput).
|
4919 - | ///
|
4920 - | /// The builder fails to construct a [`MalformedLengthQueryStringInput`](crate::input::MalformedLengthQueryStringInput) if a [`ConstraintViolation`] occurs.
|
4921 - | ///
|
4922 - | pub fn build(
|
4923 - | self,
|
4924 - | ) -> Result<crate::input::MalformedLengthQueryStringInput, ConstraintViolation> {
|
4925 - | self.build_enforcing_all_constraints()
|
5067 + | }
|
5068 + | impl ::std::convert::TryFrom<i64> for Long {
|
5069 + | type Error = crate::input::malformed_range_override_input::long::ConstraintViolation;
|
5070 + |
|
5071 + | /// Constructs a `Long` from an [`i64`], failing when the provided value does not satisfy the modeled constraints.
|
5072 + | fn try_from(value: i64) -> ::std::result::Result<Self, Self::Error> {
|
5073 + | Self::check_range(value)?;
|
5074 + |
|
5075 + | Ok(Self(value))
|
4926 5076 | }
|
4927 - | fn build_enforcing_all_constraints(
|
4928 - | self,
|
4929 - | ) -> Result<crate::input::MalformedLengthQueryStringInput, ConstraintViolation> {
|
4930 - | Ok(crate::input::MalformedLengthQueryStringInput {
|
4931 - | string: self
|
4932 - | .string
|
4933 - | .map(|v| match v {
|
4934 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
4935 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
4936 - | })
|
4937 - | .map(|res| res.map_err(ConstraintViolation::String))
|
4938 - | .transpose()?,
|
4939 - | })
|
5077 + | }
|
5078 + | #[allow(missing_docs)] // documentation missing in model
|
5079 + | ///
|
5080 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
5081 + | /// [constraint traits]. Use [`MinLong::try_from`] to construct values of this type.
|
5082 + | ///
|
5083 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
5084 + | ///
|
5085 + | #[derive(
|
5086 + | ::std::clone::Clone,
|
5087 + | ::std::cmp::Eq,
|
5088 + | ::std::cmp::PartialEq,
|
5089 + | ::std::fmt::Debug,
|
5090 + | ::std::hash::Hash,
|
5091 + | )]
|
5092 + | pub struct MinLong(pub(crate) i64);
|
5093 + | impl MinLong {
|
5094 + | /// Returns an immutable reference to the underlying [`i64`].
|
5095 + | pub fn inner(&self) -> &i64 {
|
5096 + | &self.0
|
5097 + | }
|
5098 + |
|
5099 + | /// Consumes the value, returning the underlying [`i64`].
|
5100 + | pub fn into_inner(self) -> i64 {
|
5101 + | self.0
|
4940 5102 | }
|
4941 5103 | }
|
4942 - | }
|
4943 - | /// See [`MalformedLengthOverrideInput`](crate::input::MalformedLengthOverrideInput).
|
4944 - | pub mod malformed_length_override_input {
|
4945 5104 |
|
4946 - | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
4947 - | /// Holds one variant for each of the ways the builder can fail.
|
4948 - | #[non_exhaustive]
|
4949 - | #[allow(clippy::enum_variant_names)]
|
4950 - | pub enum ConstraintViolation {
|
4951 - | /// Constraint violation occurred building member `blob` when building `MalformedLengthOverrideInput`.
|
4952 - | #[doc(hidden)]
|
4953 - | Blob(crate::input::malformed_length_override_input::blob::ConstraintViolation),
|
4954 - | /// Constraint violation occurred building member `string` when building `MalformedLengthOverrideInput`.
|
4955 - | #[doc(hidden)]
|
4956 - | String(crate::input::malformed_length_override_input::string::ConstraintViolation),
|
4957 - | /// Constraint violation occurred building member `min_string` when building `MalformedLengthOverrideInput`.
|
4958 - | #[doc(hidden)]
|
4959 - | MinString(crate::input::malformed_length_override_input::min_string::ConstraintViolation),
|
4960 - | /// Constraint violation occurred building member `max_string` when building `MalformedLengthOverrideInput`.
|
4961 - | #[doc(hidden)]
|
4962 - | MaxString(crate::input::malformed_length_override_input::max_string::ConstraintViolation),
|
4963 - | /// Constraint violation occurred building member `list` when building `MalformedLengthOverrideInput`.
|
4964 - | #[doc(hidden)]
|
4965 - | List(crate::input::malformed_length_override_input::list::ConstraintViolation),
|
4966 - | /// Constraint violation occurred building member `map` when building `MalformedLengthOverrideInput`.
|
4967 - | #[doc(hidden)]
|
4968 - | Map(crate::input::malformed_length_override_input::map::ConstraintViolation),
|
5105 + | impl crate::constrained::Constrained for MinLong {
|
5106 + | type Unconstrained = i64;
|
4969 5107 | }
|
4970 - | impl ::std::fmt::Display for ConstraintViolation {
|
5108 + |
|
5109 + | impl ::std::convert::From<i64>
|
5110 + | for crate::constrained::MaybeConstrained<
|
5111 + | crate::input::malformed_range_override_input::MinLong,
|
5112 + | >
|
5113 + | {
|
5114 + | fn from(value: i64) -> Self {
|
5115 + | Self::Unconstrained(value)
|
5116 + | }
|
5117 + | }
|
5118 + |
|
5119 + | impl ::std::fmt::Display for MinLong {
|
4971 5120 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
4972 - | match self {
|
4973 - | ConstraintViolation::Blob(_) => write!(f, "constraint violation occurred building member `blob` when building `MalformedLengthOverrideInput`"),
|
4974 - | ConstraintViolation::String(_) => write!(f, "constraint violation occurred building member `string` when building `MalformedLengthOverrideInput`"),
|
4975 - | ConstraintViolation::MinString(_) => write!(f, "constraint violation occurred building member `min_string` when building `MalformedLengthOverrideInput`"),
|
4976 - | ConstraintViolation::MaxString(_) => write!(f, "constraint violation occurred building member `max_string` when building `MalformedLengthOverrideInput`"),
|
4977 - | ConstraintViolation::List(_) => write!(f, "constraint violation occurred building member `list` when building `MalformedLengthOverrideInput`"),
|
4978 - | ConstraintViolation::Map(_) => write!(f, "constraint violation occurred building member `map` when building `MalformedLengthOverrideInput`"),
|
4979 - | }
|
5121 + | self.0.fmt(f)
|
4980 5122 | }
|
4981 5123 | }
|
4982 - | impl ::std::error::Error for ConstraintViolation {}
|
4983 - | impl ConstraintViolation {
|
4984 - | pub(crate) fn as_validation_exception_field(
|
4985 - | self,
|
4986 - | path: ::std::string::String,
|
4987 - | ) -> crate::model::ValidationExceptionField {
|
4988 - | match self {
|
4989 - | ConstraintViolation::Blob(inner) => {
|
4990 - | inner.as_validation_exception_field(path + "/blob")
|
4991 - | }
|
4992 - | ConstraintViolation::String(inner) => {
|
4993 - | inner.as_validation_exception_field(path + "/string")
|
4994 - | }
|
4995 - | ConstraintViolation::MinString(inner) => {
|
4996 - | inner.as_validation_exception_field(path + "/minString")
|
4997 - | }
|
4998 - | ConstraintViolation::MaxString(inner) => {
|
4999 - | inner.as_validation_exception_field(path + "/maxString")
|
5000 - | }
|
5001 - | ConstraintViolation::List(inner) => {
|
5002 - | inner.as_validation_exception_field(path + "/list")
|
5003 - | }
|
5004 - | ConstraintViolation::Map(inner) => {
|
5005 - | inner.as_validation_exception_field(path + "/map")
|
5006 - | }
|
5007 - | }
|
5124 + |
|
5125 + | impl ::std::convert::From<MinLong> for i64 {
|
5126 + | fn from(value: MinLong) -> Self {
|
5127 + | value.into_inner()
|
5008 5128 | }
|
5009 5129 | }
|
5010 - | impl ::std::convert::From<ConstraintViolation>
|
5011 - | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
5012 - | {
|
5013 - | fn from(constraint_violation: ConstraintViolation) -> Self {
|
5014 - | let first_validation_exception_field =
|
5015 - | constraint_violation.as_validation_exception_field("".to_owned());
|
5016 - | let validation_exception = crate::error::ValidationException {
|
5017 - | message: format!(
|
5018 - | "1 validation error detected. {}",
|
5019 - | &first_validation_exception_field.message
|
5020 - | ),
|
5021 - | field_list: Some(vec![first_validation_exception_field]),
|
5022 - | };
|
5023 - | Self::ConstraintViolation(
|
5024 - | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
5025 - | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
5026 - | )
|
5130 + | impl MinLong {
|
5131 + | fn check_range(
|
5132 + | value: i64,
|
5133 + | ) -> ::std::result::Result<
|
5134 + | (),
|
5135 + | crate::input::malformed_range_override_input::min_long::ConstraintViolation,
|
5136 + | > {
|
5137 + | if 4 <= value {
|
5138 + | Ok(())
|
5139 + | } else {
|
5140 + | Err(crate::input::malformed_range_override_input::min_long::ConstraintViolation::Range(value))
|
5141 + | }
|
5027 5142 | }
|
5028 5143 | }
|
5029 - | impl ::std::convert::From<Builder>
|
5030 - | for crate::constrained::MaybeConstrained<crate::input::MalformedLengthOverrideInput>
|
5031 - | {
|
5032 - | fn from(builder: Builder) -> Self {
|
5033 - | Self::Unconstrained(builder)
|
5144 + | impl ::std::convert::TryFrom<i64> for MinLong {
|
5145 + | type Error = crate::input::malformed_range_override_input::min_long::ConstraintViolation;
|
5146 + |
|
5147 + | /// Constructs a `MinLong` from an [`i64`], failing when the provided value does not satisfy the modeled constraints.
|
5148 + | fn try_from(value: i64) -> ::std::result::Result<Self, Self::Error> {
|
5149 + | Self::check_range(value)?;
|
5150 + |
|
5151 + | Ok(Self(value))
|
5034 5152 | }
|
5035 5153 | }
|
5036 - | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedLengthOverrideInput {
|
5037 - | type Error = ConstraintViolation;
|
5154 + | #[allow(missing_docs)] // documentation missing in model
|
5155 + | ///
|
5156 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
5157 + | /// [constraint traits]. Use [`MaxLong::try_from`] to construct values of this type.
|
5158 + | ///
|
5159 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
5160 + | ///
|
5161 + | #[derive(
|
5162 + | ::std::clone::Clone,
|
5163 + | ::std::cmp::Eq,
|
5164 + | ::std::cmp::PartialEq,
|
5165 + | ::std::fmt::Debug,
|
5166 + | ::std::hash::Hash,
|
5167 + | )]
|
5168 + | pub struct MaxLong(pub(crate) i64);
|
5169 + | impl MaxLong {
|
5170 + | /// Returns an immutable reference to the underlying [`i64`].
|
5171 + | pub fn inner(&self) -> &i64 {
|
5172 + | &self.0
|
5173 + | }
|
5038 5174 |
|
5039 - | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
5040 - | builder.build()
|
5175 + | /// Consumes the value, returning the underlying [`i64`].
|
5176 + | pub fn into_inner(self) -> i64 {
|
5177 + | self.0
|
5041 5178 | }
|
5042 5179 | }
|
5043 - | /// A builder for [`MalformedLengthOverrideInput`](crate::input::MalformedLengthOverrideInput).
|
5044 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
5045 - | pub struct Builder {
|
5046 - | pub(crate) blob: ::std::option::Option<
|
5047 - | crate::constrained::MaybeConstrained<
|
5048 - | crate::input::malformed_length_override_input::Blob,
|
5049 - | >,
|
5050 - | >,
|
5051 - | pub(crate) string: ::std::option::Option<
|
5052 - | crate::constrained::MaybeConstrained<
|
5053 - | crate::input::malformed_length_override_input::String,
|
5054 - | >,
|
5055 - | >,
|
5056 - | pub(crate) min_string: ::std::option::Option<
|
5057 - | crate::constrained::MaybeConstrained<
|
5058 - | crate::input::malformed_length_override_input::MinString,
|
5059 - | >,
|
5060 - | >,
|
5061 - | pub(crate) max_string: ::std::option::Option<
|
5062 - | crate::constrained::MaybeConstrained<
|
5063 - | crate::input::malformed_length_override_input::MaxString,
|
5064 - | >,
|
5065 - | >,
|
5066 - | pub(crate) list: ::std::option::Option<
|
5067 - | crate::constrained::MaybeConstrained<
|
5068 - | crate::input::malformed_length_override_input::List,
|
5069 - | >,
|
5070 - | >,
|
5071 - | pub(crate) map: ::std::option::Option<
|
5072 - | crate::constrained::MaybeConstrained<
|
5073 - | crate::input::malformed_length_override_input::Map,
|
5074 - | >,
|
5075 - | >,
|
5180 + |
|
5181 + | impl crate::constrained::Constrained for MaxLong {
|
5182 + | type Unconstrained = i64;
|
5076 5183 | }
|
5077 - | impl Builder {
|
5078 - | #[allow(missing_docs)] // documentation missing in model
|
5079 - | pub fn blob(
|
5080 - | mut self,
|
5081 - | input: ::std::option::Option<crate::input::malformed_length_override_input::Blob>,
|
5082 - | ) -> Self {
|
5083 - | self.blob = input.map(crate::constrained::MaybeConstrained::Constrained);
|
5084 - | self
|
5184 + |
|
5185 + | impl ::std::convert::From<i64>
|
5186 + | for crate::constrained::MaybeConstrained<
|
5187 + | crate::input::malformed_range_override_input::MaxLong,
|
5188 + | >
|
5189 + | {
|
5190 + | fn from(value: i64) -> Self {
|
5191 + | Self::Unconstrained(value)
|
5085 5192 | }
|
5086 - | #[allow(missing_docs)] // documentation missing in model
|
5087 - | pub(crate) fn set_blob(
|
5088 - | mut self,
|
5089 - | input: Option<
|
5090 - | impl ::std::convert::Into<
|
5091 - | crate::constrained::MaybeConstrained<
|
5092 - | crate::input::malformed_length_override_input::Blob,
|
5093 - | >,
|
5094 - | >,
|
5095 - | >,
|
5096 - | ) -> Self {
|
5097 - | self.blob = input.map(|v| v.into());
|
5098 - | self
|
5193 + | }
|
5194 + |
|
5195 + | impl ::std::fmt::Display for MaxLong {
|
5196 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5197 + | self.0.fmt(f)
|
5099 5198 | }
|
5100 - | #[allow(missing_docs)] // documentation missing in model
|
5101 - | pub fn string(
|
5102 - | mut self,
|
5103 - | input: ::std::option::Option<crate::input::malformed_length_override_input::String>,
|
5104 - | ) -> Self {
|
5105 - | self.string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
5106 - | self
|
5199 + | }
|
5200 + |
|
5201 + | impl ::std::convert::From<MaxLong> for i64 {
|
5202 + | fn from(value: MaxLong) -> Self {
|
5203 + | value.into_inner()
|
5107 5204 | }
|
5108 - | #[allow(missing_docs)] // documentation missing in model
|
5109 - | pub(crate) fn set_string(
|
5110 - | mut self,
|
5111 - | input: Option<
|
5112 - | impl ::std::convert::Into<
|
5113 - | crate::constrained::MaybeConstrained<
|
5114 - | crate::input::malformed_length_override_input::String,
|
5115 - | >,
|
5116 - | >,
|
5117 - | >,
|
5118 - | ) -> Self {
|
5119 - | self.string = input.map(|v| v.into());
|
5120 - | self
|
5205 + | }
|
5206 + | impl MaxLong {
|
5207 + | fn check_range(
|
5208 + | value: i64,
|
5209 + | ) -> ::std::result::Result<
|
5210 + | (),
|
5211 + | crate::input::malformed_range_override_input::max_long::ConstraintViolation,
|
5212 + | > {
|
5213 + | if value <= 6 {
|
5214 + | Ok(())
|
5215 + | } else {
|
5216 + | Err(crate::input::malformed_range_override_input::max_long::ConstraintViolation::Range(value))
|
5217 + | }
|
5121 5218 | }
|
5122 - | #[allow(missing_docs)] // documentation missing in model
|
5123 - | pub fn min_string(
|
5124 - | mut self,
|
5125 - | input: ::std::option::Option<crate::input::malformed_length_override_input::MinString>,
|
5126 - | ) -> Self {
|
5127 - | self.min_string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
5128 - | self
|
5219 + | }
|
5220 + | impl ::std::convert::TryFrom<i64> for MaxLong {
|
5221 + | type Error = crate::input::malformed_range_override_input::max_long::ConstraintViolation;
|
5222 + |
|
5223 + | /// Constructs a `MaxLong` from an [`i64`], failing when the provided value does not satisfy the modeled constraints.
|
5224 + | fn try_from(value: i64) -> ::std::result::Result<Self, Self::Error> {
|
5225 + | Self::check_range(value)?;
|
5226 + |
|
5227 + | Ok(Self(value))
|
5129 5228 | }
|
5130 - | #[allow(missing_docs)] // documentation missing in model
|
5131 - | pub(crate) fn set_min_string(
|
5132 - | mut self,
|
5133 - | input: Option<
|
5134 - | impl ::std::convert::Into<
|
5135 - | crate::constrained::MaybeConstrained<
|
5136 - | crate::input::malformed_length_override_input::MinString,
|
5137 - | >,
|
5138 - | >,
|
5139 - | >,
|
5140 - | ) -> Self {
|
5141 - | self.min_string = input.map(|v| v.into());
|
5142 - | self
|
5229 + | }
|
5230 + |
|
5231 + | /// See [`MalformedRangeOverrideInputByte`](crate::input::malformed_range_override_input::Byte).
|
5232 + | pub mod byte {
|
5233 + |
|
5234 + | #[derive(Debug, PartialEq)]
|
5235 + | pub enum ConstraintViolation {
|
5236 + | Range(i8),
|
5143 5237 | }
|
5144 - | #[allow(missing_docs)] // documentation missing in model
|
5145 - | pub fn max_string(
|
5146 - | mut self,
|
5147 - | input: ::std::option::Option<crate::input::malformed_length_override_input::MaxString>,
|
5148 - | ) -> Self {
|
5149 - | self.max_string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
5150 - | self
|
5238 + |
|
5239 + | impl ::std::fmt::Display for ConstraintViolation {
|
5240 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5241 + | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputByte`failed to satisfy constraint: Member must be between 4 and 6, inclusive")
|
5242 + | }
|
5151 5243 | }
|
5152 - | #[allow(missing_docs)] // documentation missing in model
|
5153 - | pub(crate) fn set_max_string(
|
5154 - | mut self,
|
5155 - | input: Option<
|
5156 - | impl ::std::convert::Into<
|
5157 - | crate::constrained::MaybeConstrained<
|
5158 - | crate::input::malformed_length_override_input::MaxString,
|
5159 - | >,
|
5160 - | >,
|
5161 - | >,
|
5162 - | ) -> Self {
|
5163 - | self.max_string = input.map(|v| v.into());
|
5164 - | self
|
5244 + |
|
5245 + | impl ::std::error::Error for ConstraintViolation {}
|
5246 + | impl ConstraintViolation {
|
5247 + | pub(crate) fn as_validation_exception_field(
|
5248 + | self,
|
5249 + | path: ::std::string::String,
|
5250 + | ) -> crate::model::ValidationExceptionField {
|
5251 + | match self {
|
5252 + | Self::Range(_) => crate::model::ValidationExceptionField {
|
5253 + | message: format!("Value at '{}' failed to satisfy constraint: Member must be between 4 and 6, inclusive", &path),
|
5254 + | path,
|
5255 + | },
|
5256 + | }
|
5257 + | }
|
5165 5258 | }
|
5166 - | #[allow(missing_docs)] // documentation missing in model
|
5167 - | pub fn list(
|
5168 - | mut self,
|
5169 - | input: ::std::option::Option<crate::input::malformed_length_override_input::List>,
|
5170 - | ) -> Self {
|
5171 - | self.list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
5172 - | self
|
5259 + | }
|
5260 + | /// See [`MalformedRangeOverrideInputMinByte`](crate::input::malformed_range_override_input::MinByte).
|
5261 + | pub mod min_byte {
|
5262 + |
|
5263 + | #[derive(Debug, PartialEq)]
|
5264 + | pub enum ConstraintViolation {
|
5265 + | Range(i8),
|
5173 5266 | }
|
5174 - | #[allow(missing_docs)] // documentation missing in model
|
5175 - | pub(crate) fn set_list(
|
5176 - | mut self,
|
5177 - | input: Option<
|
5178 - | impl ::std::convert::Into<
|
5179 - | crate::constrained::MaybeConstrained<
|
5180 - | crate::input::malformed_length_override_input::List,
|
5181 - | >,
|
5182 - | >,
|
5183 - | >,
|
5184 - | ) -> Self {
|
5185 - | self.list = input.map(|v| v.into());
|
5186 - | self
|
5267 + |
|
5268 + | impl ::std::fmt::Display for ConstraintViolation {
|
5269 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5270 + | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMinByte`failed to satisfy constraint: Member must be greater than or equal to 4")
|
5271 + | }
|
5187 5272 | }
|
5188 - | #[allow(missing_docs)] // documentation missing in model
|
5189 - | pub fn map(
|
5190 - | mut self,
|
5191 - | input: ::std::option::Option<crate::input::malformed_length_override_input::Map>,
|
5192 - | ) -> Self {
|
5193 - | self.map = input.map(crate::constrained::MaybeConstrained::Constrained);
|
5194 - | self
|
5273 + |
|
5274 + | impl ::std::error::Error for ConstraintViolation {}
|
5275 + | impl ConstraintViolation {
|
5276 + | pub(crate) fn as_validation_exception_field(
|
5277 + | self,
|
5278 + | path: ::std::string::String,
|
5279 + | ) -> crate::model::ValidationExceptionField {
|
5280 + | match self {
|
5281 + | Self::Range(_) => crate::model::ValidationExceptionField {
|
5282 + | message: format!("Value at '{}' failed to satisfy constraint: Member must be greater than or equal to 4", &path),
|
5283 + | path,
|
5284 + | },
|
5285 + | }
|
5286 + | }
|
5195 5287 | }
|
5196 - | #[allow(missing_docs)] // documentation missing in model
|
5197 - | pub(crate) fn set_map(
|
5198 - | mut self,
|
5199 - | input: Option<
|
5200 - | impl ::std::convert::Into<
|
5201 - | crate::constrained::MaybeConstrained<
|
5202 - | crate::input::malformed_length_override_input::Map,
|
5203 - | >,
|
5204 - | >,
|
5205 - | >,
|
5206 - | ) -> Self {
|
5207 - | self.map = input.map(|v| v.into());
|
5208 - | self
|
5288 + | }
|
5289 + | /// See [`MalformedRangeOverrideInputMaxByte`](crate::input::malformed_range_override_input::MaxByte).
|
5290 + | pub mod max_byte {
|
5291 + |
|
5292 + | #[derive(Debug, PartialEq)]
|
5293 + | pub enum ConstraintViolation {
|
5294 + | Range(i8),
|
5209 5295 | }
|
5210 - | /// Consumes the builder and constructs a [`MalformedLengthOverrideInput`](crate::input::MalformedLengthOverrideInput).
|
5211 - | ///
|
5212 - | /// The builder fails to construct a [`MalformedLengthOverrideInput`](crate::input::MalformedLengthOverrideInput) if a [`ConstraintViolation`] occurs.
|
5213 - | ///
|
5214 - | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
5215 - | pub fn build(
|
5216 - | self,
|
5217 - | ) -> Result<crate::input::MalformedLengthOverrideInput, ConstraintViolation> {
|
5218 - | self.build_enforcing_all_constraints()
|
5296 + |
|
5297 + | impl ::std::fmt::Display for ConstraintViolation {
|
5298 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5299 + | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMaxByte`failed to satisfy constraint: Member must be less than or equal to 6")
|
5300 + | }
|
5219 5301 | }
|
5220 - | fn build_enforcing_all_constraints(
|
5221 - | self,
|
5222 - | ) -> Result<crate::input::MalformedLengthOverrideInput, ConstraintViolation> {
|
5223 - | Ok(crate::input::MalformedLengthOverrideInput {
|
5224 - | blob: self
|
5225 - | .blob
|
5226 - | .map(|v| match v {
|
5227 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
5228 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
5229 - | })
|
5230 - | .map(|res| res.map_err(ConstraintViolation::Blob))
|
5231 - | .transpose()?,
|
5232 - | string: self
|
5233 - | .string
|
5234 - | .map(|v| match v {
|
5235 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
5236 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
5237 - | })
|
5238 - | .map(|res| res.map_err(ConstraintViolation::String))
|
5239 - | .transpose()?,
|
5240 - | min_string: self
|
5241 - | .min_string
|
5242 - | .map(|v| match v {
|
5243 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
5244 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
5245 - | })
|
5246 - | .map(|res| res.map_err(ConstraintViolation::MinString))
|
5247 - | .transpose()?,
|
5248 - | max_string: self
|
5249 - | .max_string
|
5250 - | .map(|v| match v {
|
5251 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
5252 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
5253 - | })
|
5254 - | .map(|res| res.map_err(ConstraintViolation::MaxString))
|
5255 - | .transpose()?,
|
5256 - | list: self
|
5257 - | .list
|
5258 - | .map(|v| match v {
|
5259 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
5260 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
5261 - | })
|
5262 - | .map(|res| res.map_err(ConstraintViolation::List))
|
5263 - | .transpose()?,
|
5264 - | map: self
|
5265 - | .map
|
5266 - | .map(|v| match v {
|
5267 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
5268 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
5269 - | })
|
5270 - | .map(|res| res.map_err(ConstraintViolation::Map))
|
5271 - | .transpose()?,
|
5272 - | })
|
5302 + |
|
5303 + | impl ::std::error::Error for ConstraintViolation {}
|
5304 + | impl ConstraintViolation {
|
5305 + | pub(crate) fn as_validation_exception_field(
|
5306 + | self,
|
5307 + | path: ::std::string::String,
|
5308 + | ) -> crate::model::ValidationExceptionField {
|
5309 + | match self {
|
5310 + | Self::Range(_) => crate::model::ValidationExceptionField {
|
5311 + | message: format!("Value at '{}' failed to satisfy constraint: Member must be less than or equal to 6", &path),
|
5312 + | path,
|
5313 + | },
|
5314 + | }
|
5315 + | }
|
5273 5316 | }
|
5274 5317 | }
|
5275 - | #[allow(missing_docs)] // documentation missing in model
|
5276 - | ///
|
5277 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
5278 - | /// [constraint traits]. Use [`Map::try_from`] to construct values of this type.
|
5279 - | ///
|
5280 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
5281 - | ///
|
5282 - | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
5283 - | pub struct Map(
|
5284 - | pub(crate) ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>,
|
5285 - | );
|
5286 - | impl Map {
|
5287 - | /// Returns an immutable reference to the underlying [`::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>`].
|
5288 - | pub fn inner(
|
5289 - | &self,
|
5290 - | ) -> &::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>
|
5291 - | {
|
5292 - | &self.0
|
5318 + | /// See [`MalformedRangeOverrideInputShort`](crate::input::malformed_range_override_input::Short).
|
5319 + | pub mod short {
|
5320 + |
|
5321 + | #[derive(Debug, PartialEq)]
|
5322 + | pub enum ConstraintViolation {
|
5323 + | Range(i16),
|
5293 5324 | }
|
5294 - | /// Consumes the value, returning the underlying [`::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>`].
|
5295 - | pub fn into_inner(
|
5296 - | self,
|
5297 - | ) -> ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>
|
5298 - | {
|
5299 - | self.0
|
5325 + |
|
5326 + | impl ::std::fmt::Display for ConstraintViolation {
|
5327 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5328 + | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputShort`failed to satisfy constraint: Member must be between 4 and 6, inclusive")
|
5329 + | }
|
5300 5330 | }
|
5301 - | }
|
5302 - | impl
|
5303 - | ::std::convert::TryFrom<
|
5304 - | ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>,
|
5305 - | > for Map
|
5306 - | {
|
5307 - | type Error = crate::input::malformed_length_override_input::map::ConstraintViolation;
|
5308 5331 |
|
5309 - | /// Constructs a `Map` from an [`::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>`], failing when the provided value does not satisfy the modeled constraints.
|
5310 - | fn try_from(
|
5311 - | value: ::std::collections::HashMap<
|
5312 - | crate::model::LengthString,
|
5313 - | crate::model::LengthList,
|
5314 - | >,
|
5315 - | ) -> ::std::result::Result<Self, Self::Error> {
|
5316 - | let length = value.len();
|
5317 - | if (4..=6).contains(&length) {
|
5318 - | Ok(Self(value))
|
5319 - | } else {
|
5320 - | Err(
|
5321 - | crate::input::malformed_length_override_input::map::ConstraintViolation::Length(
|
5322 - | length,
|
5323 - | ),
|
5324 - | )
|
5332 + | impl ::std::error::Error for ConstraintViolation {}
|
5333 + | impl ConstraintViolation {
|
5334 + | pub(crate) fn as_validation_exception_field(
|
5335 + | self,
|
5336 + | path: ::std::string::String,
|
5337 + | ) -> crate::model::ValidationExceptionField {
|
5338 + | match self {
|
5339 + | Self::Range(_) => crate::model::ValidationExceptionField {
|
5340 + | message: format!("Value at '{}' failed to satisfy constraint: Member must be between 4 and 6, inclusive", &path),
|
5341 + | path,
|
5342 + | },
|
5343 + | }
|
5325 5344 | }
|
5326 5345 | }
|
5327 5346 | }
|
5347 + | /// See [`MalformedRangeOverrideInputMinShort`](crate::input::malformed_range_override_input::MinShort).
|
5348 + | pub mod min_short {
|
5328 5349 |
|
5329 - | impl ::std::convert::From<Map>
|
5330 - | for ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthList>
|
5331 - | {
|
5332 - | fn from(value: Map) -> Self {
|
5333 - | value.into_inner()
|
5350 + | #[derive(Debug, PartialEq)]
|
5351 + | pub enum ConstraintViolation {
|
5352 + | Range(i16),
|
5353 + | }
|
5354 + |
|
5355 + | impl ::std::fmt::Display for ConstraintViolation {
|
5356 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5357 + | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMinShort`failed to satisfy constraint: Member must be greater than or equal to 4")
|
5358 + | }
|
5359 + | }
|
5360 + |
|
5361 + | impl ::std::error::Error for ConstraintViolation {}
|
5362 + | impl ConstraintViolation {
|
5363 + | pub(crate) fn as_validation_exception_field(
|
5364 + | self,
|
5365 + | path: ::std::string::String,
|
5366 + | ) -> crate::model::ValidationExceptionField {
|
5367 + | match self {
|
5368 + | Self::Range(_) => crate::model::ValidationExceptionField {
|
5369 + | message: format!("Value at '{}' failed to satisfy constraint: Member must be greater than or equal to 4", &path),
|
5370 + | path,
|
5371 + | },
|
5372 + | }
|
5373 + | }
|
5334 5374 | }
|
5335 5375 | }
|
5336 - | impl crate::constrained::Constrained for Map {
|
5337 - | type Unconstrained = crate::input::malformed_length_override_input::malformed_length_override_input_map_unconstrained::MalformedLengthOverrideInputMapUnconstrained;
|
5338 - | }
|
5339 - | #[allow(missing_docs)] // documentation missing in model
|
5340 - | ///
|
5341 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
5342 - | /// [constraint traits]. Use [`List::try_from`] to construct values of this type.
|
5343 - | ///
|
5344 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
5345 - | ///
|
5346 - | #[derive(
|
5347 - | ::std::clone::Clone,
|
5348 - | ::std::cmp::Eq,
|
5349 - | ::std::cmp::PartialEq,
|
5350 - | ::std::fmt::Debug,
|
5351 - | ::std::hash::Hash,
|
5352 - | )]
|
5353 - | pub struct List(pub(crate) ::std::vec::Vec<crate::model::LengthString>);
|
5354 - | impl List {
|
5355 - | /// Returns an immutable reference to the underlying [`::std::vec::Vec<crate::model::LengthString>`].
|
5356 - | pub fn inner(&self) -> &::std::vec::Vec<crate::model::LengthString> {
|
5357 - | &self.0
|
5376 + | /// See [`MalformedRangeOverrideInputMaxShort`](crate::input::malformed_range_override_input::MaxShort).
|
5377 + | pub mod max_short {
|
5378 + |
|
5379 + | #[derive(Debug, PartialEq)]
|
5380 + | pub enum ConstraintViolation {
|
5381 + | Range(i16),
|
5358 5382 | }
|
5359 - | /// Consumes the value, returning the underlying [`::std::vec::Vec<crate::model::LengthString>`].
|
5360 - | pub fn into_inner(self) -> ::std::vec::Vec<crate::model::LengthString> {
|
5361 - | self.0
|
5383 + |
|
5384 + | impl ::std::fmt::Display for ConstraintViolation {
|
5385 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5386 + | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMaxShort`failed to satisfy constraint: Member must be less than or equal to 6")
|
5387 + | }
|
5362 5388 | }
|
5363 5389 |
|
5364 - | fn check_length(
|
5365 - | length: usize,
|
5366 - | ) -> ::std::result::Result<
|
5367 - | (),
|
5368 - | crate::input::malformed_length_override_input::list::ConstraintViolation,
|
5369 - | > {
|
5370 - | if (4..=6).contains(&length) {
|
5371 - | Ok(())
|
5372 - | } else {
|
5373 - | Err(crate::input::malformed_length_override_input::list::ConstraintViolation::Length(length))
|
5390 + | impl ::std::error::Error for ConstraintViolation {}
|
5391 + | impl ConstraintViolation {
|
5392 + | pub(crate) fn as_validation_exception_field(
|
5393 + | self,
|
5394 + | path: ::std::string::String,
|
5395 + | ) -> crate::model::ValidationExceptionField {
|
5396 + | match self {
|
5397 + | Self::Range(_) => crate::model::ValidationExceptionField {
|
5398 + | message: format!("Value at '{}' failed to satisfy constraint: Member must be less than or equal to 6", &path),
|
5399 + | path,
|
5400 + | },
|
5401 + | }
|
5374 5402 | }
|
5375 5403 | }
|
5376 5404 | }
|
5377 - | impl ::std::convert::TryFrom<::std::vec::Vec<crate::model::LengthString>> for List {
|
5378 - | type Error = crate::input::malformed_length_override_input::list::ConstraintViolation;
|
5405 + | /// See [`MalformedRangeOverrideInputInteger`](crate::input::malformed_range_override_input::Integer).
|
5406 + | pub mod integer {
|
5379 5407 |
|
5380 - | /// Constructs a `List` from an [`::std::vec::Vec<crate::model::LengthString>`], failing when the provided value does not satisfy the modeled constraints.
|
5381 - | fn try_from(
|
5382 - | value: ::std::vec::Vec<crate::model::LengthString>,
|
5383 - | ) -> ::std::result::Result<Self, Self::Error> {
|
5384 - | Self::check_length(value.len())?;
|
5408 + | #[derive(Debug, PartialEq)]
|
5409 + | pub enum ConstraintViolation {
|
5410 + | Range(i32),
|
5411 + | }
|
5385 5412 |
|
5386 - | Ok(Self(value))
|
5413 + | impl ::std::fmt::Display for ConstraintViolation {
|
5414 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5415 + | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputInteger`failed to satisfy constraint: Member must be between 4 and 6, inclusive")
|
5416 + | }
|
5387 5417 | }
|
5388 - | }
|
5389 5418 |
|
5390 - | impl ::std::convert::From<List> for ::std::vec::Vec<crate::model::LengthString> {
|
5391 - | fn from(value: List) -> Self {
|
5392 - | value.into_inner()
|
5419 + | impl ::std::error::Error for ConstraintViolation {}
|
5420 + | impl ConstraintViolation {
|
5421 + | pub(crate) fn as_validation_exception_field(
|
5422 + | self,
|
5423 + | path: ::std::string::String,
|
5424 + | ) -> crate::model::ValidationExceptionField {
|
5425 + | match self {
|
5426 + | Self::Range(_) => crate::model::ValidationExceptionField {
|
5427 + | message: format!("Value at '{}' failed to satisfy constraint: Member must be between 4 and 6, inclusive", &path),
|
5428 + | path,
|
5429 + | },
|
5430 + | }
|
5431 + | }
|
5393 5432 | }
|
5394 5433 | }
|
5395 - | impl crate::constrained::Constrained for List {
|
5396 - | type Unconstrained = crate::input::malformed_length_override_input::malformed_length_override_input_list_unconstrained::MalformedLengthOverrideInputListUnconstrained;
|
5397 - | }
|
5398 - | #[allow(missing_docs)] // documentation missing in model
|
5399 - | ///
|
5400 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
5401 - | /// [constraint traits]. Use [`MaxString::try_from`] to construct values of this type.
|
5402 - | ///
|
5403 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
5404 - | ///
|
5405 - | #[derive(
|
5406 - | ::std::clone::Clone,
|
5407 - | ::std::cmp::Eq,
|
5408 - | ::std::cmp::PartialEq,
|
5409 - | ::std::fmt::Debug,
|
5410 - | ::std::hash::Hash,
|
5411 - | )]
|
5412 - | pub struct MaxString(pub(crate) ::std::string::String);
|
5413 - | impl MaxString {
|
5414 - | /// Extracts a string slice containing the entire underlying `String`.
|
5415 - | pub fn as_str(&self) -> &str {
|
5416 - | &self.0
|
5434 + | /// See [`MalformedRangeOverrideInputMinInteger`](crate::input::malformed_range_override_input::MinInteger).
|
5435 + | pub mod min_integer {
|
5436 + |
|
5437 + | #[derive(Debug, PartialEq)]
|
5438 + | pub enum ConstraintViolation {
|
5439 + | Range(i32),
|
5440 + | }
|
5441 + |
|
5442 + | impl ::std::fmt::Display for ConstraintViolation {
|
5443 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5444 + | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMinInteger`failed to satisfy constraint: Member must be greater than or equal to 4")
|
5445 + | }
|
5446 + | }
|
5447 + |
|
5448 + | impl ::std::error::Error for ConstraintViolation {}
|
5449 + | impl ConstraintViolation {
|
5450 + | pub(crate) fn as_validation_exception_field(
|
5451 + | self,
|
5452 + | path: ::std::string::String,
|
5453 + | ) -> crate::model::ValidationExceptionField {
|
5454 + | match self {
|
5455 + | Self::Range(_) => crate::model::ValidationExceptionField {
|
5456 + | message: format!("Value at '{}' failed to satisfy constraint: Member must be greater than or equal to 4", &path),
|
5457 + | path,
|
5458 + | },
|
5459 + | }
|
5460 + | }
|
5417 5461 | }
|
5462 + | }
|
5463 + | /// See [`MalformedRangeOverrideInputMaxInteger`](crate::input::malformed_range_override_input::MaxInteger).
|
5464 + | pub mod max_integer {
|
5418 5465 |
|
5419 - | /// Returns an immutable reference to the underlying [`::std::string::String`].
|
5420 - | pub fn inner(&self) -> &::std::string::String {
|
5421 - | &self.0
|
5466 + | #[derive(Debug, PartialEq)]
|
5467 + | pub enum ConstraintViolation {
|
5468 + | Range(i32),
|
5422 5469 | }
|
5423 5470 |
|
5424 - | /// Consumes the value, returning the underlying [`::std::string::String`].
|
5425 - | pub fn into_inner(self) -> ::std::string::String {
|
5426 - | self.0
|
5471 + | impl ::std::fmt::Display for ConstraintViolation {
|
5472 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5473 + | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMaxInteger`failed to satisfy constraint: Member must be less than or equal to 6")
|
5474 + | }
|
5427 5475 | }
|
5428 - | }
|
5429 - | impl MaxString {
|
5430 - | fn check_length(
|
5431 - | string: &str,
|
5432 - | ) -> ::std::result::Result<
|
5433 - | (),
|
5434 - | crate::input::malformed_length_override_input::max_string::ConstraintViolation,
|
5435 - | > {
|
5436 - | let length = string.chars().count();
|
5437 5476 |
|
5438 - | if length <= 6 {
|
5439 - | Ok(())
|
5440 - | } else {
|
5441 - | Err(crate::input::malformed_length_override_input::max_string::ConstraintViolation::Length(length))
|
5477 + | impl ::std::error::Error for ConstraintViolation {}
|
5478 + | impl ConstraintViolation {
|
5479 + | pub(crate) fn as_validation_exception_field(
|
5480 + | self,
|
5481 + | path: ::std::string::String,
|
5482 + | ) -> crate::model::ValidationExceptionField {
|
5483 + | match self {
|
5484 + | Self::Range(_) => crate::model::ValidationExceptionField {
|
5485 + | message: format!("Value at '{}' failed to satisfy constraint: Member must be less than or equal to 6", &path),
|
5486 + | path,
|
5487 + | },
|
5488 + | }
|
5442 5489 | }
|
5443 5490 | }
|
5444 5491 | }
|
5445 - | impl ::std::convert::TryFrom<::std::string::String> for MaxString {
|
5446 - | type Error = crate::input::malformed_length_override_input::max_string::ConstraintViolation;
|
5492 + | /// See [`MalformedRangeOverrideInputLong`](crate::input::malformed_range_override_input::Long).
|
5493 + | pub mod long {
|
5447 5494 |
|
5448 - | /// Constructs a `MaxString` from an [`::std::string::String`], failing when the provided value does not satisfy the modeled constraints.
|
5449 - | fn try_from(value: ::std::string::String) -> ::std::result::Result<Self, Self::Error> {
|
5450 - | Self::check_length(&value)?;
|
5495 + | #[derive(Debug, PartialEq)]
|
5496 + | pub enum ConstraintViolation {
|
5497 + | Range(i64),
|
5498 + | }
|
5451 5499 |
|
5452 - | Ok(Self(value))
|
5500 + | impl ::std::fmt::Display for ConstraintViolation {
|
5501 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5502 + | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputLong`failed to satisfy constraint: Member must be between 4 and 6, inclusive")
|
5503 + | }
|
5453 5504 | }
|
5454 - | }
|
5455 - | impl crate::constrained::Constrained for MaxString {
|
5456 - | type Unconstrained = ::std::string::String;
|
5457 - | }
|
5458 5505 |
|
5459 - | impl ::std::convert::From<::std::string::String>
|
5460 - | for crate::constrained::MaybeConstrained<
|
5461 - | crate::input::malformed_length_override_input::MaxString,
|
5462 - | >
|
5463 - | {
|
5464 - | fn from(value: ::std::string::String) -> Self {
|
5465 - | Self::Unconstrained(value)
|
5506 + | impl ::std::error::Error for ConstraintViolation {}
|
5507 + | impl ConstraintViolation {
|
5508 + | pub(crate) fn as_validation_exception_field(
|
5509 + | self,
|
5510 + | path: ::std::string::String,
|
5511 + | ) -> crate::model::ValidationExceptionField {
|
5512 + | match self {
|
5513 + | Self::Range(_) => crate::model::ValidationExceptionField {
|
5514 + | message: format!("Value at '{}' failed to satisfy constraint: Member must be between 4 and 6, inclusive", &path),
|
5515 + | path,
|
5516 + | },
|
5517 + | }
|
5518 + | }
|
5466 5519 | }
|
5467 5520 | }
|
5521 + | /// See [`MalformedRangeOverrideInputMinLong`](crate::input::malformed_range_override_input::MinLong).
|
5522 + | pub mod min_long {
|
5468 5523 |
|
5469 - | impl ::std::fmt::Display for MaxString {
|
5470 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5471 - | self.0.fmt(f)
|
5524 + | #[derive(Debug, PartialEq)]
|
5525 + | pub enum ConstraintViolation {
|
5526 + | Range(i64),
|
5472 5527 | }
|
5473 - | }
|
5474 5528 |
|
5475 - | impl ::std::convert::From<MaxString> for ::std::string::String {
|
5476 - | fn from(value: MaxString) -> Self {
|
5477 - | value.into_inner()
|
5529 + | impl ::std::fmt::Display for ConstraintViolation {
|
5530 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5531 + | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMinLong`failed to satisfy constraint: Member must be greater than or equal to 4")
|
5532 + | }
|
5478 5533 | }
|
5479 - | }
|
5480 - | #[allow(missing_docs)] // documentation missing in model
|
5481 - | ///
|
5482 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
5483 - | /// [constraint traits]. Use [`MinString::try_from`] to construct values of this type.
|
5484 - | ///
|
5485 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
5486 - | ///
|
5487 - | #[derive(
|
5488 - | ::std::clone::Clone,
|
5489 - | ::std::cmp::Eq,
|
5490 - | ::std::cmp::PartialEq,
|
5491 - | ::std::fmt::Debug,
|
5492 - | ::std::hash::Hash,
|
5493 - | )]
|
5494 - | pub struct MinString(pub(crate) ::std::string::String);
|
5495 - | impl MinString {
|
5496 - | /// Extracts a string slice containing the entire underlying `String`.
|
5497 - | pub fn as_str(&self) -> &str {
|
5498 - | &self.0
|
5534 + |
|
5535 + | impl ::std::error::Error for ConstraintViolation {}
|
5536 + | impl ConstraintViolation {
|
5537 + | pub(crate) fn as_validation_exception_field(
|
5538 + | self,
|
5539 + | path: ::std::string::String,
|
5540 + | ) -> crate::model::ValidationExceptionField {
|
5541 + | match self {
|
5542 + | Self::Range(_) => crate::model::ValidationExceptionField {
|
5543 + | message: format!("Value at '{}' failed to satisfy constraint: Member must be greater than or equal to 4", &path),
|
5544 + | path,
|
5545 + | },
|
5546 + | }
|
5547 + | }
|
5499 5548 | }
|
5549 + | }
|
5550 + | /// See [`MalformedRangeOverrideInputMaxLong`](crate::input::malformed_range_override_input::MaxLong).
|
5551 + | pub mod max_long {
|
5500 5552 |
|
5501 - | /// Returns an immutable reference to the underlying [`::std::string::String`].
|
5502 - | pub fn inner(&self) -> &::std::string::String {
|
5503 - | &self.0
|
5553 + | #[derive(Debug, PartialEq)]
|
5554 + | pub enum ConstraintViolation {
|
5555 + | Range(i64),
|
5504 5556 | }
|
5505 5557 |
|
5506 - | /// Consumes the value, returning the underlying [`::std::string::String`].
|
5507 - | pub fn into_inner(self) -> ::std::string::String {
|
5508 - | self.0
|
5558 + | impl ::std::fmt::Display for ConstraintViolation {
|
5559 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5560 + | write!(f, "Value for `aws.protocoltests.restjson.validation.synthetic#MalformedRangeOverrideInputMaxLong`failed to satisfy constraint: Member must be less than or equal to 6")
|
5561 + | }
|
5509 5562 | }
|
5510 - | }
|
5511 - | impl MinString {
|
5512 - | fn check_length(
|
5513 - | string: &str,
|
5514 - | ) -> ::std::result::Result<
|
5515 - | (),
|
5516 - | crate::input::malformed_length_override_input::min_string::ConstraintViolation,
|
5517 - | > {
|
5518 - | let length = string.chars().count();
|
5519 5563 |
|
5520 - | if 4 <= length {
|
5521 - | Ok(())
|
5522 - | } else {
|
5523 - | Err(crate::input::malformed_length_override_input::min_string::ConstraintViolation::Length(length))
|
5564 + | impl ::std::error::Error for ConstraintViolation {}
|
5565 + | impl ConstraintViolation {
|
5566 + | pub(crate) fn as_validation_exception_field(
|
5567 + | self,
|
5568 + | path: ::std::string::String,
|
5569 + | ) -> crate::model::ValidationExceptionField {
|
5570 + | match self {
|
5571 + | Self::Range(_) => crate::model::ValidationExceptionField {
|
5572 + | message: format!("Value at '{}' failed to satisfy constraint: Member must be less than or equal to 6", &path),
|
5573 + | path,
|
5574 + | },
|
5575 + | }
|
5524 5576 | }
|
5525 5577 | }
|
5526 5578 | }
|
5527 - | impl ::std::convert::TryFrom<::std::string::String> for MinString {
|
5528 - | type Error = crate::input::malformed_length_override_input::min_string::ConstraintViolation;
|
5529 - |
|
5530 - | /// Constructs a `MinString` from an [`::std::string::String`], failing when the provided value does not satisfy the modeled constraints.
|
5531 - | fn try_from(value: ::std::string::String) -> ::std::result::Result<Self, Self::Error> {
|
5532 - | Self::check_length(&value)?;
|
5579 + | }
|
5580 + | /// See [`MalformedRequiredInput`](crate::input::MalformedRequiredInput).
|
5581 + | pub mod malformed_required_input {
|
5533 5582 |
|
5534 - | Ok(Self(value))
|
5583 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
5584 + | /// Holds one variant for each of the ways the builder can fail.
|
5585 + | #[non_exhaustive]
|
5586 + | #[allow(clippy::enum_variant_names)]
|
5587 + | pub enum ConstraintViolation {
|
5588 + | /// `string` was not provided but it is required when building `MalformedRequiredInput`.
|
5589 + | MissingString,
|
5590 + | /// `string_in_query` was not provided but it is required when building `MalformedRequiredInput`.
|
5591 + | MissingStringInQuery,
|
5592 + | /// `string_in_header` was not provided but it is required when building `MalformedRequiredInput`.
|
5593 + | MissingStringInHeader,
|
5594 + | }
|
5595 + | impl ::std::fmt::Display for ConstraintViolation {
|
5596 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5597 + | match self {
|
5598 + | ConstraintViolation::MissingString => write!(f, "`string` was not provided but it is required when building `MalformedRequiredInput`"),
|
5599 + | ConstraintViolation::MissingStringInQuery => write!(f, "`string_in_query` was not provided but it is required when building `MalformedRequiredInput`"),
|
5600 + | ConstraintViolation::MissingStringInHeader => write!(f, "`string_in_header` was not provided but it is required when building `MalformedRequiredInput`"),
|
5601 + | }
|
5535 5602 | }
|
5536 5603 | }
|
5537 - | impl crate::constrained::Constrained for MinString {
|
5538 - | type Unconstrained = ::std::string::String;
|
5604 + | impl ::std::error::Error for ConstraintViolation {}
|
5605 + | impl ConstraintViolation {
|
5606 + | pub(crate) fn as_validation_exception_field(
|
5607 + | self,
|
5608 + | path: ::std::string::String,
|
5609 + | ) -> crate::model::ValidationExceptionField {
|
5610 + | match self {
|
5611 + | ConstraintViolation::MissingString => crate::model::ValidationExceptionField {
|
5612 + | message: format!("Value at '{}/string' failed to satisfy constraint: Member must not be null", path),
|
5613 + | path: path + "/string",
|
5614 + | },
|
5615 + | ConstraintViolation::MissingStringInQuery => crate::model::ValidationExceptionField {
|
5616 + | message: format!("Value at '{}/stringInQuery' failed to satisfy constraint: Member must not be null", path),
|
5617 + | path: path + "/stringInQuery",
|
5618 + | },
|
5619 + | ConstraintViolation::MissingStringInHeader => crate::model::ValidationExceptionField {
|
5620 + | message: format!("Value at '{}/stringInHeader' failed to satisfy constraint: Member must not be null", path),
|
5621 + | path: path + "/stringInHeader",
|
5622 + | },
|
5623 + | }
|
5624 + | }
|
5539 5625 | }
|
5540 - |
|
5541 - | impl ::std::convert::From<::std::string::String>
|
5542 - | for crate::constrained::MaybeConstrained<
|
5543 - | crate::input::malformed_length_override_input::MinString,
|
5544 - | >
|
5626 + | impl ::std::convert::From<ConstraintViolation>
|
5627 + | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
5545 5628 | {
|
5546 - | fn from(value: ::std::string::String) -> Self {
|
5547 - | Self::Unconstrained(value)
|
5629 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
5630 + | let first_validation_exception_field =
|
5631 + | constraint_violation.as_validation_exception_field("".to_owned());
|
5632 + | let validation_exception = crate::error::ValidationException {
|
5633 + | message: format!(
|
5634 + | "1 validation error detected. {}",
|
5635 + | &first_validation_exception_field.message
|
5636 + | ),
|
5637 + | field_list: Some(vec![first_validation_exception_field]),
|
5638 + | };
|
5639 + | Self::ConstraintViolation(
|
5640 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
5641 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
5642 + | )
|
5548 5643 | }
|
5549 5644 | }
|
5550 - |
|
5551 - | impl ::std::fmt::Display for MinString {
|
5552 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5553 - | self.0.fmt(f)
|
5645 + | impl ::std::convert::From<Builder>
|
5646 + | for crate::constrained::MaybeConstrained<crate::input::MalformedRequiredInput>
|
5647 + | {
|
5648 + | fn from(builder: Builder) -> Self {
|
5649 + | Self::Unconstrained(builder)
|
5554 5650 | }
|
5555 5651 | }
|
5652 + | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedRequiredInput {
|
5653 + | type Error = ConstraintViolation;
|
5556 5654 |
|
5557 - | impl ::std::convert::From<MinString> for ::std::string::String {
|
5558 - | fn from(value: MinString) -> Self {
|
5559 - | value.into_inner()
|
5655 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
5656 + | builder.build()
|
5560 5657 | }
|
5561 5658 | }
|
5562 - | #[allow(missing_docs)] // documentation missing in model
|
5563 - | ///
|
5564 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
5565 - | /// [constraint traits]. Use [`String::try_from`] to construct values of this type.
|
5566 - | ///
|
5567 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
5568 - | ///
|
5569 - | #[derive(
|
5570 - | ::std::clone::Clone,
|
5571 - | ::std::cmp::Eq,
|
5572 - | ::std::cmp::PartialEq,
|
5573 - | ::std::fmt::Debug,
|
5574 - | ::std::hash::Hash,
|
5575 - | )]
|
5576 - | pub struct String(pub(crate) ::std::string::String);
|
5577 - | impl String {
|
5578 - | /// Extracts a string slice containing the entire underlying `String`.
|
5579 - | pub fn as_str(&self) -> &str {
|
5580 - | &self.0
|
5659 + | /// A builder for [`MalformedRequiredInput`](crate::input::MalformedRequiredInput).
|
5660 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
5661 + | pub struct Builder {
|
5662 + | pub(crate) string: ::std::option::Option<::std::string::String>,
|
5663 + | pub(crate) string_in_query: ::std::option::Option<::std::string::String>,
|
5664 + | pub(crate) string_in_header: ::std::option::Option<::std::string::String>,
|
5665 + | }
|
5666 + | impl Builder {
|
5667 + | #[allow(missing_docs)] // documentation missing in model
|
5668 + | pub fn string(mut self, input: ::std::string::String) -> Self {
|
5669 + | self.string = Some(input);
|
5670 + | self
|
5581 5671 | }
|
5582 - |
|
5583 - | /// Returns an immutable reference to the underlying [`::std::string::String`].
|
5584 - | pub fn inner(&self) -> &::std::string::String {
|
5585 - | &self.0
|
5672 + | #[allow(missing_docs)] // documentation missing in model
|
5673 + | pub(crate) fn set_string(
|
5674 + | mut self,
|
5675 + | input: impl ::std::convert::Into<::std::string::String>,
|
5676 + | ) -> Self {
|
5677 + | self.string = Some(input.into());
|
5678 + | self
|
5586 5679 | }
|
5587 - |
|
5588 - | /// Consumes the value, returning the underlying [`::std::string::String`].
|
5589 - | pub fn into_inner(self) -> ::std::string::String {
|
5590 - | self.0
|
5680 + | #[allow(missing_docs)] // documentation missing in model
|
5681 + | pub fn string_in_query(mut self, input: ::std::string::String) -> Self {
|
5682 + | self.string_in_query = Some(input);
|
5683 + | self
|
5591 5684 | }
|
5592 - | }
|
5593 - | impl String {
|
5594 - | fn check_length(
|
5595 - | string: &str,
|
5596 - | ) -> ::std::result::Result<
|
5597 - | (),
|
5598 - | crate::input::malformed_length_override_input::string::ConstraintViolation,
|
5599 - | > {
|
5600 - | let length = string.chars().count();
|
5601 - |
|
5602 - | if (4..=6).contains(&length) {
|
5603 - | Ok(())
|
5604 - | } else {
|
5605 - | Err(crate::input::malformed_length_override_input::string::ConstraintViolation::Length(length))
|
5606 - | }
|
5685 + | #[allow(missing_docs)] // documentation missing in model
|
5686 + | pub(crate) fn set_string_in_query(
|
5687 + | mut self,
|
5688 + | input: impl ::std::convert::Into<::std::string::String>,
|
5689 + | ) -> Self {
|
5690 + | self.string_in_query = Some(input.into());
|
5691 + | self
|
5692 + | }
|
5693 + | #[allow(missing_docs)] // documentation missing in model
|
5694 + | pub fn string_in_header(mut self, input: ::std::string::String) -> Self {
|
5695 + | self.string_in_header = Some(input);
|
5696 + | self
|
5697 + | }
|
5698 + | #[allow(missing_docs)] // documentation missing in model
|
5699 + | pub(crate) fn set_string_in_header(
|
5700 + | mut self,
|
5701 + | input: impl ::std::convert::Into<::std::string::String>,
|
5702 + | ) -> Self {
|
5703 + | self.string_in_header = Some(input.into());
|
5704 + | self
|
5705 + | }
|
5706 + | /// Consumes the builder and constructs a [`MalformedRequiredInput`](crate::input::MalformedRequiredInput).
|
5707 + | ///
|
5708 + | /// The builder fails to construct a [`MalformedRequiredInput`](crate::input::MalformedRequiredInput) if a [`ConstraintViolation`] occurs.
|
5709 + | ///
|
5710 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
5711 + | pub fn build(self) -> Result<crate::input::MalformedRequiredInput, ConstraintViolation> {
|
5712 + | self.build_enforcing_all_constraints()
|
5713 + | }
|
5714 + | fn build_enforcing_all_constraints(
|
5715 + | self,
|
5716 + | ) -> Result<crate::input::MalformedRequiredInput, ConstraintViolation> {
|
5717 + | Ok(crate::input::MalformedRequiredInput {
|
5718 + | string: self.string.ok_or(ConstraintViolation::MissingString)?,
|
5719 + | string_in_query: self
|
5720 + | .string_in_query
|
5721 + | .ok_or(ConstraintViolation::MissingStringInQuery)?,
|
5722 + | string_in_header: self
|
5723 + | .string_in_header
|
5724 + | .ok_or(ConstraintViolation::MissingStringInHeader)?,
|
5725 + | })
|
5607 5726 | }
|
5608 5727 | }
|
5609 - | impl ::std::convert::TryFrom<::std::string::String> for String {
|
5610 - | type Error = crate::input::malformed_length_override_input::string::ConstraintViolation;
|
5611 - |
|
5612 - | /// Constructs a `String` from an [`::std::string::String`], failing when the provided value does not satisfy the modeled constraints.
|
5613 - | fn try_from(value: ::std::string::String) -> ::std::result::Result<Self, Self::Error> {
|
5614 - | Self::check_length(&value)?;
|
5728 + | }
|
5729 + | /// See [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
|
5730 + | pub mod malformed_unique_items_input {
|
5615 5731 |
|
5616 - | Ok(Self(value))
|
5732 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
5733 + | /// Holds one variant for each of the ways the builder can fail.
|
5734 + | #[non_exhaustive]
|
5735 + | #[allow(clippy::enum_variant_names)]
|
5736 + | pub enum ConstraintViolation {
|
5737 + | /// Constraint violation occurred building member `blob_list` when building `MalformedUniqueItemsInput`.
|
5738 + | #[doc(hidden)]
|
5739 + | BlobList(crate::model::blob_set::ConstraintViolation),
|
5740 + | /// Constraint violation occurred building member `boolean_list` when building `MalformedUniqueItemsInput`.
|
5741 + | #[doc(hidden)]
|
5742 + | BooleanList(crate::model::boolean_set::ConstraintViolation),
|
5743 + | /// Constraint violation occurred building member `string_list` when building `MalformedUniqueItemsInput`.
|
5744 + | #[doc(hidden)]
|
5745 + | StringList(crate::model::string_set::ConstraintViolation),
|
5746 + | /// Constraint violation occurred building member `byte_list` when building `MalformedUniqueItemsInput`.
|
5747 + | #[doc(hidden)]
|
5748 + | ByteList(crate::model::byte_set::ConstraintViolation),
|
5749 + | /// Constraint violation occurred building member `short_list` when building `MalformedUniqueItemsInput`.
|
5750 + | #[doc(hidden)]
|
5751 + | ShortList(crate::model::short_set::ConstraintViolation),
|
5752 + | /// Constraint violation occurred building member `integer_list` when building `MalformedUniqueItemsInput`.
|
5753 + | #[doc(hidden)]
|
5754 + | IntegerList(crate::model::integer_set::ConstraintViolation),
|
5755 + | /// Constraint violation occurred building member `long_list` when building `MalformedUniqueItemsInput`.
|
5756 + | #[doc(hidden)]
|
5757 + | LongList(crate::model::long_set::ConstraintViolation),
|
5758 + | /// Constraint violation occurred building member `timestamp_list` when building `MalformedUniqueItemsInput`.
|
5759 + | #[doc(hidden)]
|
5760 + | TimestampList(crate::model::timestamp_set::ConstraintViolation),
|
5761 + | /// Constraint violation occurred building member `date_time_list` when building `MalformedUniqueItemsInput`.
|
5762 + | #[doc(hidden)]
|
5763 + | DateTimeList(crate::model::date_time_set::ConstraintViolation),
|
5764 + | /// Constraint violation occurred building member `http_date_list` when building `MalformedUniqueItemsInput`.
|
5765 + | #[doc(hidden)]
|
5766 + | HttpDateList(crate::model::http_date_set::ConstraintViolation),
|
5767 + | /// Constraint violation occurred building member `enum_list` when building `MalformedUniqueItemsInput`.
|
5768 + | #[doc(hidden)]
|
5769 + | EnumList(crate::model::foo_enum_set::ConstraintViolation),
|
5770 + | /// Constraint violation occurred building member `int_enum_list` when building `MalformedUniqueItemsInput`.
|
5771 + | #[doc(hidden)]
|
5772 + | IntEnumList(crate::model::integer_enum_set::ConstraintViolation),
|
5773 + | /// Constraint violation occurred building member `list_list` when building `MalformedUniqueItemsInput`.
|
5774 + | #[doc(hidden)]
|
5775 + | ListList(crate::model::list_set::ConstraintViolation),
|
5776 + | /// Constraint violation occurred building member `structure_list` when building `MalformedUniqueItemsInput`.
|
5777 + | #[doc(hidden)]
|
5778 + | StructureList(crate::model::structure_set::ConstraintViolation),
|
5779 + | /// Constraint violation occurred building member `structure_list_with_no_key` when building `MalformedUniqueItemsInput`.
|
5780 + | #[doc(hidden)]
|
5781 + | StructureListWithNoKey(crate::model::structure_set_with_no_key::ConstraintViolation),
|
5782 + | /// Constraint violation occurred building member `union_list` when building `MalformedUniqueItemsInput`.
|
5783 + | #[doc(hidden)]
|
5784 + | UnionList(crate::model::union_set::ConstraintViolation),
|
5785 + | }
|
5786 + | impl ::std::fmt::Display for ConstraintViolation {
|
5787 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5788 + | match self {
|
5789 + | ConstraintViolation::BlobList(_) => write!(f, "constraint violation occurred building member `blob_list` when building `MalformedUniqueItemsInput`"),
|
5790 + | ConstraintViolation::BooleanList(_) => write!(f, "constraint violation occurred building member `boolean_list` when building `MalformedUniqueItemsInput`"),
|
5791 + | ConstraintViolation::StringList(_) => write!(f, "constraint violation occurred building member `string_list` when building `MalformedUniqueItemsInput`"),
|
5792 + | ConstraintViolation::ByteList(_) => write!(f, "constraint violation occurred building member `byte_list` when building `MalformedUniqueItemsInput`"),
|
5793 + | ConstraintViolation::ShortList(_) => write!(f, "constraint violation occurred building member `short_list` when building `MalformedUniqueItemsInput`"),
|
5794 + | ConstraintViolation::IntegerList(_) => write!(f, "constraint violation occurred building member `integer_list` when building `MalformedUniqueItemsInput`"),
|
5795 + | ConstraintViolation::LongList(_) => write!(f, "constraint violation occurred building member `long_list` when building `MalformedUniqueItemsInput`"),
|
5796 + | ConstraintViolation::TimestampList(_) => write!(f, "constraint violation occurred building member `timestamp_list` when building `MalformedUniqueItemsInput`"),
|
5797 + | ConstraintViolation::DateTimeList(_) => write!(f, "constraint violation occurred building member `date_time_list` when building `MalformedUniqueItemsInput`"),
|
5798 + | ConstraintViolation::HttpDateList(_) => write!(f, "constraint violation occurred building member `http_date_list` when building `MalformedUniqueItemsInput`"),
|
5799 + | ConstraintViolation::EnumList(_) => write!(f, "constraint violation occurred building member `enum_list` when building `MalformedUniqueItemsInput`"),
|
5800 + | ConstraintViolation::IntEnumList(_) => write!(f, "constraint violation occurred building member `int_enum_list` when building `MalformedUniqueItemsInput`"),
|
5801 + | ConstraintViolation::ListList(_) => write!(f, "constraint violation occurred building member `list_list` when building `MalformedUniqueItemsInput`"),
|
5802 + | ConstraintViolation::StructureList(_) => write!(f, "constraint violation occurred building member `structure_list` when building `MalformedUniqueItemsInput`"),
|
5803 + | ConstraintViolation::StructureListWithNoKey(_) => write!(f, "constraint violation occurred building member `structure_list_with_no_key` when building `MalformedUniqueItemsInput`"),
|
5804 + | ConstraintViolation::UnionList(_) => write!(f, "constraint violation occurred building member `union_list` when building `MalformedUniqueItemsInput`"),
|
5805 + | }
|
5617 5806 | }
|
5618 5807 | }
|
5619 - | impl crate::constrained::Constrained for String {
|
5620 - | type Unconstrained = ::std::string::String;
|
5808 + | impl ::std::error::Error for ConstraintViolation {}
|
5809 + | impl ConstraintViolation {
|
5810 + | pub(crate) fn as_validation_exception_field(
|
5811 + | self,
|
5812 + | path: ::std::string::String,
|
5813 + | ) -> crate::model::ValidationExceptionField {
|
5814 + | match self {
|
5815 + | ConstraintViolation::BlobList(inner) => {
|
5816 + | inner.as_validation_exception_field(path + "/blobList")
|
5817 + | }
|
5818 + | ConstraintViolation::BooleanList(inner) => {
|
5819 + | inner.as_validation_exception_field(path + "/booleanList")
|
5820 + | }
|
5821 + | ConstraintViolation::StringList(inner) => {
|
5822 + | inner.as_validation_exception_field(path + "/stringList")
|
5823 + | }
|
5824 + | ConstraintViolation::ByteList(inner) => {
|
5825 + | inner.as_validation_exception_field(path + "/byteList")
|
5826 + | }
|
5827 + | ConstraintViolation::ShortList(inner) => {
|
5828 + | inner.as_validation_exception_field(path + "/shortList")
|
5829 + | }
|
5830 + | ConstraintViolation::IntegerList(inner) => {
|
5831 + | inner.as_validation_exception_field(path + "/integerList")
|
5832 + | }
|
5833 + | ConstraintViolation::LongList(inner) => {
|
5834 + | inner.as_validation_exception_field(path + "/longList")
|
5835 + | }
|
5836 + | ConstraintViolation::TimestampList(inner) => {
|
5837 + | inner.as_validation_exception_field(path + "/timestampList")
|
5838 + | }
|
5839 + | ConstraintViolation::DateTimeList(inner) => {
|
5840 + | inner.as_validation_exception_field(path + "/dateTimeList")
|
5841 + | }
|
5842 + | ConstraintViolation::HttpDateList(inner) => {
|
5843 + | inner.as_validation_exception_field(path + "/httpDateList")
|
5844 + | }
|
5845 + | ConstraintViolation::EnumList(inner) => {
|
5846 + | inner.as_validation_exception_field(path + "/enumList")
|
5847 + | }
|
5848 + | ConstraintViolation::IntEnumList(inner) => {
|
5849 + | inner.as_validation_exception_field(path + "/intEnumList")
|
5850 + | }
|
5851 + | ConstraintViolation::ListList(inner) => {
|
5852 + | inner.as_validation_exception_field(path + "/listList")
|
5853 + | }
|
5854 + | ConstraintViolation::StructureList(inner) => {
|
5855 + | inner.as_validation_exception_field(path + "/structureList")
|
5856 + | }
|
5857 + | ConstraintViolation::StructureListWithNoKey(inner) => {
|
5858 + | inner.as_validation_exception_field(path + "/structureListWithNoKey")
|
5859 + | }
|
5860 + | ConstraintViolation::UnionList(inner) => {
|
5861 + | inner.as_validation_exception_field(path + "/unionList")
|
5862 + | }
|
5863 + | }
|
5864 + | }
|
5621 5865 | }
|
5622 - |
|
5623 - | impl ::std::convert::From<::std::string::String>
|
5624 - | for crate::constrained::MaybeConstrained<
|
5625 - | crate::input::malformed_length_override_input::String,
|
5626 - | >
|
5866 + | impl ::std::convert::From<ConstraintViolation>
|
5867 + | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
5627 5868 | {
|
5628 - | fn from(value: ::std::string::String) -> Self {
|
5629 - | Self::Unconstrained(value)
|
5869 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
5870 + | let first_validation_exception_field =
|
5871 + | constraint_violation.as_validation_exception_field("".to_owned());
|
5872 + | let validation_exception = crate::error::ValidationException {
|
5873 + | message: format!(
|
5874 + | "1 validation error detected. {}",
|
5875 + | &first_validation_exception_field.message
|
5876 + | ),
|
5877 + | field_list: Some(vec![first_validation_exception_field]),
|
5878 + | };
|
5879 + | Self::ConstraintViolation(
|
5880 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
5881 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
5882 + | )
|
5630 5883 | }
|
5631 5884 | }
|
5632 - |
|
5633 - | impl ::std::fmt::Display for String {
|
5634 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5635 - | self.0.fmt(f)
|
5885 + | impl ::std::convert::From<Builder>
|
5886 + | for crate::constrained::MaybeConstrained<crate::input::MalformedUniqueItemsInput>
|
5887 + | {
|
5888 + | fn from(builder: Builder) -> Self {
|
5889 + | Self::Unconstrained(builder)
|
5636 5890 | }
|
5637 5891 | }
|
5892 + | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedUniqueItemsInput {
|
5893 + | type Error = ConstraintViolation;
|
5638 5894 |
|
5639 - | impl ::std::convert::From<String> for ::std::string::String {
|
5640 - | fn from(value: String) -> Self {
|
5641 - | value.into_inner()
|
5895 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
5896 + | builder.build()
|
5642 5897 | }
|
5643 5898 | }
|
5644 - | #[allow(missing_docs)] // documentation missing in model
|
5645 - | ///
|
5646 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
5647 - | /// [constraint traits]. Use [`Blob::try_from`] to construct values of this type.
|
5648 - | ///
|
5649 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
5650 - | ///
|
5651 - | #[derive(
|
5652 - | ::std::clone::Clone,
|
5653 - | ::std::cmp::Eq,
|
5654 - | ::std::cmp::PartialEq,
|
5655 - | ::std::fmt::Debug,
|
5656 - | ::std::hash::Hash,
|
5657 - | )]
|
5658 - | pub struct Blob(pub(crate) ::aws_smithy_types::Blob);
|
5659 - | impl Blob {
|
5660 - | /// Returns an immutable reference to the underlying [`::aws_smithy_types::Blob`].
|
5661 - | pub fn inner(&self) -> &::aws_smithy_types::Blob {
|
5662 - | &self.0
|
5899 + | /// A builder for [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
|
5900 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
5901 + | pub struct Builder {
|
5902 + | pub(crate) blob_list:
|
5903 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::BlobSet>>,
|
5904 + | pub(crate) boolean_list:
|
5905 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::BooleanSet>>,
|
5906 + | pub(crate) string_list:
|
5907 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::StringSet>>,
|
5908 + | pub(crate) byte_list:
|
5909 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::ByteSet>>,
|
5910 + | pub(crate) short_list:
|
5911 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::ShortSet>>,
|
5912 + | pub(crate) integer_list:
|
5913 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::IntegerSet>>,
|
5914 + | pub(crate) long_list:
|
5915 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::LongSet>>,
|
5916 + | pub(crate) timestamp_list:
|
5917 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::TimestampSet>>,
|
5918 + | pub(crate) date_time_list:
|
5919 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::DateTimeSet>>,
|
5920 + | pub(crate) http_date_list:
|
5921 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::HttpDateSet>>,
|
5922 + | pub(crate) enum_list:
|
5923 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::FooEnumSet>>,
|
5924 + | pub(crate) int_enum_list: ::std::option::Option<
|
5925 + | crate::constrained::MaybeConstrained<crate::model::IntegerEnumSet>,
|
5926 + | >,
|
5927 + | pub(crate) list_list:
|
5928 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::ListSet>>,
|
5929 + | pub(crate) structure_list:
|
5930 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::StructureSet>>,
|
5931 + | pub(crate) structure_list_with_no_key: ::std::option::Option<
|
5932 + | crate::constrained::MaybeConstrained<crate::model::StructureSetWithNoKey>,
|
5933 + | >,
|
5934 + | pub(crate) union_list:
|
5935 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::UnionSet>>,
|
5936 + | }
|
5937 + | impl Builder {
|
5938 + | #[allow(missing_docs)] // documentation missing in model
|
5939 + | pub fn blob_list(mut self, input: ::std::option::Option<crate::model::BlobSet>) -> Self {
|
5940 + | self.blob_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
5941 + | self
|
5663 5942 | }
|
5664 - | /// Consumes the value, returning the underlying [`::aws_smithy_types::Blob`].
|
5665 - | pub fn into_inner(self) -> ::aws_smithy_types::Blob {
|
5666 - | self.0
|
5943 + | #[allow(missing_docs)] // documentation missing in model
|
5944 + | pub(crate) fn set_blob_list(
|
5945 + | mut self,
|
5946 + | input: Option<
|
5947 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::BlobSet>>,
|
5948 + | >,
|
5949 + | ) -> Self {
|
5950 + | self.blob_list = input.map(|v| v.into());
|
5951 + | self
|
5667 5952 | }
|
5668 - | }
|
5669 - | impl Blob {
|
5670 - | fn check_length(
|
5671 - | blob: &::aws_smithy_types::Blob,
|
5672 - | ) -> ::std::result::Result<
|
5673 - | (),
|
5674 - | crate::input::malformed_length_override_input::blob::ConstraintViolation,
|
5675 - | > {
|
5676 - | let length = blob.as_ref().len();
|
5677 - |
|
5678 - | if (4..=6).contains(&length) {
|
5679 - | Ok(())
|
5680 - | } else {
|
5681 - | Err(crate::input::malformed_length_override_input::blob::ConstraintViolation::Length(length))
|
5682 - | }
|
5953 + | #[allow(missing_docs)] // documentation missing in model
|
5954 + | pub fn boolean_list(
|
5955 + | mut self,
|
5956 + | input: ::std::option::Option<crate::model::BooleanSet>,
|
5957 + | ) -> Self {
|
5958 + | self.boolean_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
5959 + | self
|
5683 5960 | }
|
5684 - | }
|
5685 - | impl ::std::convert::TryFrom<::aws_smithy_types::Blob> for Blob {
|
5686 - | type Error = crate::input::malformed_length_override_input::blob::ConstraintViolation;
|
5687 - |
|
5688 - | /// Constructs a `Blob` from an [`::aws_smithy_types::Blob`], failing when the provided value does not satisfy the modeled constraints.
|
5689 - | fn try_from(value: ::aws_smithy_types::Blob) -> ::std::result::Result<Self, Self::Error> {
|
5690 - | Self::check_length(&value)?;
|
5691 - |
|
5692 - | Ok(Self(value))
|
5961 + | #[allow(missing_docs)] // documentation missing in model
|
5962 + | pub(crate) fn set_boolean_list(
|
5963 + | mut self,
|
5964 + | input: Option<
|
5965 + | impl ::std::convert::Into<
|
5966 + | crate::constrained::MaybeConstrained<crate::model::BooleanSet>,
|
5967 + | >,
|
5968 + | >,
|
5969 + | ) -> Self {
|
5970 + | self.boolean_list = input.map(|v| v.into());
|
5971 + | self
|
5693 5972 | }
|
5694 - | }
|
5695 - | impl crate::constrained::Constrained for Blob {
|
5696 - | type Unconstrained = ::aws_smithy_types::Blob;
|
5697 - | }
|
5698 - |
|
5699 - | impl ::std::convert::From<::aws_smithy_types::Blob>
|
5700 - | for crate::constrained::MaybeConstrained<
|
5701 - | crate::input::malformed_length_override_input::Blob,
|
5702 - | >
|
5703 - | {
|
5704 - | fn from(value: ::aws_smithy_types::Blob) -> Self {
|
5705 - | Self::Unconstrained(value)
|
5973 + | #[allow(missing_docs)] // documentation missing in model
|
5974 + | pub fn string_list(
|
5975 + | mut self,
|
5976 + | input: ::std::option::Option<crate::model::StringSet>,
|
5977 + | ) -> Self {
|
5978 + | self.string_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
5979 + | self
|
5706 5980 | }
|
5707 - | }
|
5708 - |
|
5709 - | impl ::std::convert::From<Blob> for ::aws_smithy_types::Blob {
|
5710 - | fn from(value: Blob) -> Self {
|
5711 - | value.into_inner()
|
5981 + | #[allow(missing_docs)] // documentation missing in model
|
5982 + | pub(crate) fn set_string_list(
|
5983 + | mut self,
|
5984 + | input: Option<
|
5985 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::StringSet>>,
|
5986 + | >,
|
5987 + | ) -> Self {
|
5988 + | self.string_list = input.map(|v| v.into());
|
5989 + | self
|
5712 5990 | }
|
5713 - | }
|
5714 - |
|
5715 - | pub(crate) mod malformed_length_override_input_map_unconstrained {
|
5716 - |
|
5717 - | #[derive(Debug, Clone)]
|
5718 - | pub(crate) struct MalformedLengthOverrideInputMapUnconstrained(
|
5719 - | pub(crate) std::collections::HashMap<
|
5720 - | ::std::string::String,
|
5721 - | crate::unconstrained::length_list_unconstrained::LengthListUnconstrained,
|
5991 + | #[allow(missing_docs)] // documentation missing in model
|
5992 + | pub fn byte_list(mut self, input: ::std::option::Option<crate::model::ByteSet>) -> Self {
|
5993 + | self.byte_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
5994 + | self
|
5995 + | }
|
5996 + | #[allow(missing_docs)] // documentation missing in model
|
5997 + | pub(crate) fn set_byte_list(
|
5998 + | mut self,
|
5999 + | input: Option<
|
6000 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::ByteSet>>,
|
5722 6001 | >,
|
5723 - | );
|
5724 - |
|
5725 - | impl From<MalformedLengthOverrideInputMapUnconstrained>
|
5726 - | for crate::constrained::MaybeConstrained<
|
5727 - | crate::input::malformed_length_override_input::Map,
|
5728 - | >
|
5729 - | {
|
5730 - | fn from(value: MalformedLengthOverrideInputMapUnconstrained) -> Self {
|
5731 - | Self::Unconstrained(value)
|
5732 - | }
|
6002 + | ) -> Self {
|
6003 + | self.byte_list = input.map(|v| v.into());
|
6004 + | self
|
6005 + | }
|
6006 + | #[allow(missing_docs)] // documentation missing in model
|
6007 + | pub fn short_list(mut self, input: ::std::option::Option<crate::model::ShortSet>) -> Self {
|
6008 + | self.short_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6009 + | self
|
6010 + | }
|
6011 + | #[allow(missing_docs)] // documentation missing in model
|
6012 + | pub(crate) fn set_short_list(
|
6013 + | mut self,
|
6014 + | input: Option<
|
6015 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::ShortSet>>,
|
6016 + | >,
|
6017 + | ) -> Self {
|
6018 + | self.short_list = input.map(|v| v.into());
|
6019 + | self
|
6020 + | }
|
6021 + | #[allow(missing_docs)] // documentation missing in model
|
6022 + | pub fn integer_list(
|
6023 + | mut self,
|
6024 + | input: ::std::option::Option<crate::model::IntegerSet>,
|
6025 + | ) -> Self {
|
6026 + | self.integer_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6027 + | self
|
6028 + | }
|
6029 + | #[allow(missing_docs)] // documentation missing in model
|
6030 + | pub(crate) fn set_integer_list(
|
6031 + | mut self,
|
6032 + | input: Option<
|
6033 + | impl ::std::convert::Into<
|
6034 + | crate::constrained::MaybeConstrained<crate::model::IntegerSet>,
|
6035 + | >,
|
6036 + | >,
|
6037 + | ) -> Self {
|
6038 + | self.integer_list = input.map(|v| v.into());
|
6039 + | self
|
5733 6040 | }
|
5734 - | impl std::convert::TryFrom<MalformedLengthOverrideInputMapUnconstrained>
|
5735 - | for crate::input::malformed_length_override_input::Map
|
5736 - | {
|
5737 - | type Error = crate::input::malformed_length_override_input::map::ConstraintViolation;
|
5738 - | fn try_from(
|
5739 - | value: MalformedLengthOverrideInputMapUnconstrained,
|
5740 - | ) -> std::result::Result<Self, Self::Error> {
|
5741 - | let res: ::std::result::Result<
|
5742 - | ::std::collections::HashMap<
|
5743 - | crate::model::LengthString,
|
5744 - | crate::model::LengthList,
|
5745 - | >,
|
5746 - | Self::Error,
|
5747 - | > = value
|
5748 - | .0
|
5749 - | .into_iter()
|
5750 - | .map(|(k, v)| {
|
5751 - | let k: crate::model::LengthString =
|
5752 - | k.try_into().map_err(Self::Error::Key)?;
|
5753 - |
|
5754 - | match crate::model::LengthList::try_from(v) {
|
5755 - | Ok(v) => Ok((k, v)),
|
5756 - | Err(inner_constraint_violation) => {
|
5757 - | Err(Self::Error::Value(k, inner_constraint_violation))
|
5758 - | }
|
5759 - | }
|
5760 - | })
|
5761 - | .collect();
|
5762 - | let hm = res?;
|
5763 - | Self::try_from(hm)
|
5764 - | }
|
6041 + | #[allow(missing_docs)] // documentation missing in model
|
6042 + | pub fn long_list(mut self, input: ::std::option::Option<crate::model::LongSet>) -> Self {
|
6043 + | self.long_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6044 + | self
|
5765 6045 | }
|
5766 - | }
|
5767 - | /// See [`MalformedLengthOverrideInputMap`](crate::input::malformed_length_override_input::Map).
|
5768 - | pub mod map {
|
5769 - |
|
5770 - | #[allow(clippy::enum_variant_names)]
|
5771 - | #[derive(Debug, PartialEq)]
|
5772 - | pub enum ConstraintViolation {
|
5773 - | Length(usize),
|
5774 - | #[doc(hidden)]
|
5775 - | Key(crate::model::length_string::ConstraintViolation),
|
5776 - | #[doc(hidden)]
|
5777 - | Value(
|
5778 - | crate::model::LengthString,
|
5779 - | crate::model::length_list::ConstraintViolation,
|
5780 - | ),
|
6046 + | #[allow(missing_docs)] // documentation missing in model
|
6047 + | pub(crate) fn set_long_list(
|
6048 + | mut self,
|
6049 + | input: Option<
|
6050 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::LongSet>>,
|
6051 + | >,
|
6052 + | ) -> Self {
|
6053 + | self.long_list = input.map(|v| v.into());
|
6054 + | self
|
5781 6055 | }
|
5782 - |
|
5783 - | impl ::std::fmt::Display for ConstraintViolation {
|
5784 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5785 - | match self {
|
5786 - | Self::Length(length) => {
|
5787 - | write!(f, "Value with length {} provided for 'aws.protocoltests.restjson.validation.synthetic#MalformedLengthOverrideInputMap' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length)
|
5788 - | }
|
5789 - | Self::Key(key_constraint_violation) => {
|
5790 - | write!(f, "{}", key_constraint_violation)
|
5791 - | }
|
5792 - | Self::Value(_, value_constraint_violation) => {
|
5793 - | write!(f, "{}", value_constraint_violation)
|
5794 - | }
|
5795 - | }
|
5796 - | }
|
6056 + | #[allow(missing_docs)] // documentation missing in model
|
6057 + | pub fn timestamp_list(
|
6058 + | mut self,
|
6059 + | input: ::std::option::Option<crate::model::TimestampSet>,
|
6060 + | ) -> Self {
|
6061 + | self.timestamp_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6062 + | self
|
5797 6063 | }
|
5798 - |
|
5799 - | impl ::std::error::Error for ConstraintViolation {}
|
5800 - | impl ConstraintViolation {
|
5801 - | pub(crate) fn as_validation_exception_field(
|
5802 - | self,
|
5803 - | path: ::std::string::String,
|
5804 - | ) -> crate::model::ValidationExceptionField {
|
5805 - | match self {
|
5806 - | Self::Length(length) => crate::model::ValidationExceptionField {
|
5807 - | message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length, &path),
|
5808 - | path,
|
5809 - | },
|
5810 - | Self::Key(key_constraint_violation) => key_constraint_violation.as_validation_exception_field(path),
|
5811 - | Self::Value(key, value_constraint_violation) => value_constraint_violation.as_validation_exception_field(path + "/" + key.as_str()),
|
5812 - | }
|
5813 - | }
|
6064 + | #[allow(missing_docs)] // documentation missing in model
|
6065 + | pub(crate) fn set_timestamp_list(
|
6066 + | mut self,
|
6067 + | input: Option<
|
6068 + | impl ::std::convert::Into<
|
6069 + | crate::constrained::MaybeConstrained<crate::model::TimestampSet>,
|
6070 + | >,
|
6071 + | >,
|
6072 + | ) -> Self {
|
6073 + | self.timestamp_list = input.map(|v| v.into());
|
6074 + | self
|
5814 6075 | }
|
5815 - | }
|
5816 - | pub(crate) mod malformed_length_override_input_list_unconstrained {
|
5817 - |
|
5818 - | #[derive(Debug, Clone)]
|
5819 - | pub(crate) struct MalformedLengthOverrideInputListUnconstrained(
|
5820 - | pub(crate) std::vec::Vec<::std::string::String>,
|
5821 - | );
|
5822 - |
|
5823 - | impl From<MalformedLengthOverrideInputListUnconstrained>
|
5824 - | for crate::constrained::MaybeConstrained<
|
5825 - | crate::input::malformed_length_override_input::List,
|
5826 - | >
|
5827 - | {
|
5828 - | fn from(value: MalformedLengthOverrideInputListUnconstrained) -> Self {
|
5829 - | Self::Unconstrained(value)
|
5830 - | }
|
6076 + | #[allow(missing_docs)] // documentation missing in model
|
6077 + | pub fn date_time_list(
|
6078 + | mut self,
|
6079 + | input: ::std::option::Option<crate::model::DateTimeSet>,
|
6080 + | ) -> Self {
|
6081 + | self.date_time_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6082 + | self
|
5831 6083 | }
|
5832 - | impl std::convert::TryFrom<MalformedLengthOverrideInputListUnconstrained>
|
5833 - | for crate::input::malformed_length_override_input::List
|
5834 - | {
|
5835 - | type Error = crate::input::malformed_length_override_input::list::ConstraintViolation;
|
5836 - | fn try_from(
|
5837 - | value: MalformedLengthOverrideInputListUnconstrained,
|
5838 - | ) -> std::result::Result<Self, Self::Error> {
|
5839 - | let res: ::std::result::Result<
|
5840 - | ::std::vec::Vec<crate::model::LengthString>,
|
5841 - | (usize, crate::model::length_string::ConstraintViolation),
|
5842 - | > = value
|
5843 - | .0
|
5844 - | .into_iter()
|
5845 - | .enumerate()
|
5846 - | .map(|(idx, inner)| {
|
5847 - | inner
|
5848 - | .try_into()
|
5849 - | .map_err(|inner_violation| (idx, inner_violation))
|
5850 - | })
|
5851 - | .collect();
|
5852 - | let inner = res
|
5853 - | .map_err(|(idx, inner_violation)| Self::Error::Member(idx, inner_violation))?;
|
5854 - | Self::try_from(inner)
|
5855 - | }
|
6084 + | #[allow(missing_docs)] // documentation missing in model
|
6085 + | pub(crate) fn set_date_time_list(
|
6086 + | mut self,
|
6087 + | input: Option<
|
6088 + | impl ::std::convert::Into<
|
6089 + | crate::constrained::MaybeConstrained<crate::model::DateTimeSet>,
|
6090 + | >,
|
6091 + | >,
|
6092 + | ) -> Self {
|
6093 + | self.date_time_list = input.map(|v| v.into());
|
6094 + | self
|
5856 6095 | }
|
5857 - | }
|
5858 - | /// See [`MalformedLengthOverrideInputList`](crate::input::malformed_length_override_input::List).
|
5859 - | pub mod list {
|
5860 - |
|
5861 - | #[allow(clippy::enum_variant_names)]
|
5862 - | #[derive(Debug, PartialEq)]
|
5863 - | pub enum ConstraintViolation {
|
5864 - | /// Constraint violation error when the list doesn't have the required length
|
5865 - | Length(usize),
|
5866 - | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
5867 - | /// The first component of the tuple is the index in the collection where the
|
5868 - | /// first constraint violation was found.
|
5869 - | #[doc(hidden)]
|
5870 - | Member(usize, crate::model::length_string::ConstraintViolation),
|
6096 + | #[allow(missing_docs)] // documentation missing in model
|
6097 + | pub fn http_date_list(
|
6098 + | mut self,
|
6099 + | input: ::std::option::Option<crate::model::HttpDateSet>,
|
6100 + | ) -> Self {
|
6101 + | self.http_date_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6102 + | self
|
5871 6103 | }
|
5872 - |
|
5873 - | impl ::std::fmt::Display for ConstraintViolation {
|
5874 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5875 - | let message = match self {
|
5876 - | Self::Length(length) => {
|
5877 - | format!("Value with length {} provided for 'aws.protocoltests.restjson.validation.synthetic#MalformedLengthOverrideInputList' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length)
|
5878 - | }
|
5879 - | Self::Member(index, failing_member) => format!(
|
5880 - | "Value at index {index} failed to satisfy constraint. {}",
|
5881 - | failing_member
|
5882 - | ),
|
5883 - | };
|
5884 - | write!(f, "{message}")
|
5885 - | }
|
6104 + | #[allow(missing_docs)] // documentation missing in model
|
6105 + | pub(crate) fn set_http_date_list(
|
6106 + | mut self,
|
6107 + | input: Option<
|
6108 + | impl ::std::convert::Into<
|
6109 + | crate::constrained::MaybeConstrained<crate::model::HttpDateSet>,
|
6110 + | >,
|
6111 + | >,
|
6112 + | ) -> Self {
|
6113 + | self.http_date_list = input.map(|v| v.into());
|
6114 + | self
|
5886 6115 | }
|
5887 - |
|
5888 - | impl ::std::error::Error for ConstraintViolation {}
|
5889 - | impl ConstraintViolation {
|
5890 - | pub(crate) fn as_validation_exception_field(
|
5891 - | self,
|
5892 - | path: ::std::string::String,
|
5893 - | ) -> crate::model::ValidationExceptionField {
|
5894 - | match self {
|
5895 - | Self::Length(length) => crate::model::ValidationExceptionField {
|
5896 - | message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length, &path),
|
5897 - | path,
|
5898 - | },
|
5899 - | Self::Member(index, member_constraint_violation) =>
|
5900 - | member_constraint_violation.as_validation_exception_field(path + "/" + &index.to_string())
|
5901 - | }
|
5902 - | }
|
6116 + | #[allow(missing_docs)] // documentation missing in model
|
6117 + | pub fn enum_list(mut self, input: ::std::option::Option<crate::model::FooEnumSet>) -> Self {
|
6118 + | self.enum_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6119 + | self
|
5903 6120 | }
|
5904 - | }
|
5905 - | /// See [`MalformedLengthOverrideInputMaxString`](crate::input::malformed_length_override_input::MaxString).
|
5906 - | pub mod max_string {
|
5907 - |
|
5908 - | #[derive(Debug, PartialEq)]
|
5909 - | pub enum ConstraintViolation {
|
5910 - | /// Error when a string doesn't satisfy its `@length` requirements.
|
5911 - | Length(usize),
|
6121 + | #[allow(missing_docs)] // documentation missing in model
|
6122 + | pub(crate) fn set_enum_list(
|
6123 + | mut self,
|
6124 + | input: Option<
|
6125 + | impl ::std::convert::Into<
|
6126 + | crate::constrained::MaybeConstrained<crate::model::FooEnumSet>,
|
6127 + | >,
|
6128 + | >,
|
6129 + | ) -> Self {
|
6130 + | self.enum_list = input.map(|v| v.into());
|
6131 + | self
|
6132 + | }
|
6133 + | #[allow(missing_docs)] // documentation missing in model
|
6134 + | pub fn int_enum_list(
|
6135 + | mut self,
|
6136 + | input: ::std::option::Option<crate::model::IntegerEnumSet>,
|
6137 + | ) -> Self {
|
6138 + | self.int_enum_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6139 + | self
|
5912 6140 | }
|
5913 - |
|
5914 - | impl ::std::fmt::Display for ConstraintViolation {
|
5915 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5916 - | let message = match self {
|
5917 - | Self::Length(length) => {
|
5918 - | format!("Value with length {} provided for 'aws.protocoltests.restjson.validation.synthetic#MalformedLengthOverrideInputMaxString' failed to satisfy constraint: Member must have length less than or equal to 6", length)
|
5919 - | }
|
5920 - | };
|
5921 - | write!(f, "{message}")
|
5922 - | }
|
6141 + | #[allow(missing_docs)] // documentation missing in model
|
6142 + | pub(crate) fn set_int_enum_list(
|
6143 + | mut self,
|
6144 + | input: Option<
|
6145 + | impl ::std::convert::Into<
|
6146 + | crate::constrained::MaybeConstrained<crate::model::IntegerEnumSet>,
|
6147 + | >,
|
6148 + | >,
|
6149 + | ) -> Self {
|
6150 + | self.int_enum_list = input.map(|v| v.into());
|
6151 + | self
|
5923 6152 | }
|
5924 - |
|
5925 - | impl ::std::error::Error for ConstraintViolation {}
|
5926 - | impl ConstraintViolation {
|
5927 - | pub(crate) fn as_validation_exception_field(
|
5928 - | self,
|
5929 - | path: ::std::string::String,
|
5930 - | ) -> crate::model::ValidationExceptionField {
|
5931 - | match self {
|
5932 - | Self::Length(length) => crate::model::ValidationExceptionField {
|
5933 - | message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length less than or equal to 6", length, &path),
|
5934 - | path,
|
5935 - | },
|
5936 - | }
|
5937 - | }
|
6153 + | #[allow(missing_docs)] // documentation missing in model
|
6154 + | pub fn list_list(mut self, input: ::std::option::Option<crate::model::ListSet>) -> Self {
|
6155 + | self.list_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6156 + | self
|
5938 6157 | }
|
5939 - | }
|
5940 - | /// See [`MalformedLengthOverrideInputMinString`](crate::input::malformed_length_override_input::MinString).
|
5941 - | pub mod min_string {
|
5942 - |
|
5943 - | #[derive(Debug, PartialEq)]
|
5944 - | pub enum ConstraintViolation {
|
5945 - | /// Error when a string doesn't satisfy its `@length` requirements.
|
5946 - | Length(usize),
|
6158 + | #[allow(missing_docs)] // documentation missing in model
|
6159 + | pub(crate) fn set_list_list(
|
6160 + | mut self,
|
6161 + | input: Option<
|
6162 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::ListSet>>,
|
6163 + | >,
|
6164 + | ) -> Self {
|
6165 + | self.list_list = input.map(|v| v.into());
|
6166 + | self
|
5947 6167 | }
|
5948 - |
|
5949 - | impl ::std::fmt::Display for ConstraintViolation {
|
5950 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5951 - | let message = match self {
|
5952 - | Self::Length(length) => {
|
5953 - | format!("Value with length {} provided for 'aws.protocoltests.restjson.validation.synthetic#MalformedLengthOverrideInputMinString' failed to satisfy constraint: Member must have length greater than or equal to 4", length)
|
5954 - | }
|
5955 - | };
|
5956 - | write!(f, "{message}")
|
5957 - | }
|
6168 + | #[allow(missing_docs)] // documentation missing in model
|
6169 + | pub fn structure_list(
|
6170 + | mut self,
|
6171 + | input: ::std::option::Option<crate::model::StructureSet>,
|
6172 + | ) -> Self {
|
6173 + | self.structure_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6174 + | self
|
5958 6175 | }
|
5959 - |
|
5960 - | impl ::std::error::Error for ConstraintViolation {}
|
5961 - | impl ConstraintViolation {
|
5962 - | pub(crate) fn as_validation_exception_field(
|
5963 - | self,
|
5964 - | path: ::std::string::String,
|
5965 - | ) -> crate::model::ValidationExceptionField {
|
5966 - | match self {
|
5967 - | Self::Length(length) => crate::model::ValidationExceptionField {
|
5968 - | message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length greater than or equal to 4", length, &path),
|
5969 - | path,
|
5970 - | },
|
5971 - | }
|
5972 - | }
|
6176 + | #[allow(missing_docs)] // documentation missing in model
|
6177 + | pub(crate) fn set_structure_list(
|
6178 + | mut self,
|
6179 + | input: Option<
|
6180 + | impl ::std::convert::Into<
|
6181 + | crate::constrained::MaybeConstrained<crate::model::StructureSet>,
|
6182 + | >,
|
6183 + | >,
|
6184 + | ) -> Self {
|
6185 + | self.structure_list = input.map(|v| v.into());
|
6186 + | self
|
5973 6187 | }
|
5974 - | }
|
5975 - | /// See [`MalformedLengthOverrideInputString`](crate::input::malformed_length_override_input::String).
|
5976 - | pub mod string {
|
5977 - |
|
5978 - | #[derive(Debug, PartialEq)]
|
5979 - | pub enum ConstraintViolation {
|
5980 - | /// Error when a string doesn't satisfy its `@length` requirements.
|
5981 - | Length(usize),
|
6188 + | #[allow(missing_docs)] // documentation missing in model
|
6189 + | pub fn structure_list_with_no_key(
|
6190 + | mut self,
|
6191 + | input: ::std::option::Option<crate::model::StructureSetWithNoKey>,
|
6192 + | ) -> Self {
|
6193 + | self.structure_list_with_no_key =
|
6194 + | input.map(crate::constrained::MaybeConstrained::Constrained);
|
6195 + | self
|
5982 6196 | }
|
5983 - |
|
5984 - | impl ::std::fmt::Display for ConstraintViolation {
|
5985 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
5986 - | let message = match self {
|
5987 - | Self::Length(length) => {
|
5988 - | format!("Value with length {} provided for 'aws.protocoltests.restjson.validation.synthetic#MalformedLengthOverrideInputString' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length)
|
5989 - | }
|
5990 - | };
|
5991 - | write!(f, "{message}")
|
5992 - | }
|
6197 + | #[allow(missing_docs)] // documentation missing in model
|
6198 + | pub(crate) fn set_structure_list_with_no_key(
|
6199 + | mut self,
|
6200 + | input: Option<
|
6201 + | impl ::std::convert::Into<
|
6202 + | crate::constrained::MaybeConstrained<crate::model::StructureSetWithNoKey>,
|
6203 + | >,
|
6204 + | >,
|
6205 + | ) -> Self {
|
6206 + | self.structure_list_with_no_key = input.map(|v| v.into());
|
6207 + | self
|
5993 6208 | }
|
5994 - |
|
5995 - | impl ::std::error::Error for ConstraintViolation {}
|
5996 - | impl ConstraintViolation {
|
5997 - | pub(crate) fn as_validation_exception_field(
|
5998 - | self,
|
5999 - | path: ::std::string::String,
|
6000 - | ) -> crate::model::ValidationExceptionField {
|
6001 - | match self {
|
6002 - | Self::Length(length) => crate::model::ValidationExceptionField {
|
6003 - | message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length, &path),
|
6004 - | path,
|
6005 - | },
|
6006 - | }
|
6007 - | }
|
6209 + | #[allow(missing_docs)] // documentation missing in model
|
6210 + | pub fn union_list(mut self, input: ::std::option::Option<crate::model::UnionSet>) -> Self {
|
6211 + | self.union_list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6212 + | self
|
6008 6213 | }
|
6009 - | }
|
6010 - | /// See [`MalformedLengthOverrideInputBlob`](crate::input::malformed_length_override_input::Blob).
|
6011 - | pub mod blob {
|
6012 - |
|
6013 - | #[derive(Debug, PartialEq)]
|
6014 - | pub enum ConstraintViolation {
|
6015 - | /// Error when a blob doesn't satisfy its `@length` requirements.
|
6016 - | Length(usize),
|
6214 + | #[allow(missing_docs)] // documentation missing in model
|
6215 + | pub(crate) fn set_union_list(
|
6216 + | mut self,
|
6217 + | input: Option<
|
6218 + | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::UnionSet>>,
|
6219 + | >,
|
6220 + | ) -> Self {
|
6221 + | self.union_list = input.map(|v| v.into());
|
6222 + | self
|
6017 6223 | }
|
6018 - |
|
6019 - | impl ::std::fmt::Display for ConstraintViolation {
|
6020 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
6021 - | let message = match self {
|
6022 - | Self::Length(length) => {
|
6023 - | format!("Value with length {} provided for 'aws.protocoltests.restjson.validation.synthetic#MalformedLengthOverrideInputBlob' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length)
|
6024 - | }
|
6025 - | };
|
6026 - | write!(f, "{message}")
|
6027 - | }
|
6224 + | /// Consumes the builder and constructs a [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
|
6225 + | ///
|
6226 + | /// The builder fails to construct a [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput) if a [`ConstraintViolation`] occurs.
|
6227 + | ///
|
6228 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
6229 + | pub fn build(self) -> Result<crate::input::MalformedUniqueItemsInput, ConstraintViolation> {
|
6230 + | self.build_enforcing_all_constraints()
|
6028 6231 | }
|
6029 - |
|
6030 - | impl ::std::error::Error for ConstraintViolation {}
|
6031 - | impl ConstraintViolation {
|
6032 - | pub(crate) fn as_validation_exception_field(
|
6033 - | self,
|
6034 - | path: ::std::string::String,
|
6035 - | ) -> crate::model::ValidationExceptionField {
|
6036 - | match self {
|
6037 - | Self::Length(length) => crate::model::ValidationExceptionField {
|
6038 - | message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length between 4 and 6, inclusive", length, &path),
|
6039 - | path,
|
6040 - | },
|
6041 - | }
|
6042 - | }
|
6232 + | fn build_enforcing_all_constraints(
|
6233 + | self,
|
6234 + | ) -> Result<crate::input::MalformedUniqueItemsInput, ConstraintViolation> {
|
6235 + | Ok(crate::input::MalformedUniqueItemsInput {
|
6236 + | blob_list: self
|
6237 + | .blob_list
|
6238 + | .map(|v| match v {
|
6239 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6240 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6241 + | })
|
6242 + | .map(|res| res.map_err(ConstraintViolation::BlobList))
|
6243 + | .transpose()?,
|
6244 + | boolean_list: self
|
6245 + | .boolean_list
|
6246 + | .map(|v| match v {
|
6247 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6248 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6249 + | })
|
6250 + | .map(|res| res.map_err(ConstraintViolation::BooleanList))
|
6251 + | .transpose()?,
|
6252 + | string_list: self
|
6253 + | .string_list
|
6254 + | .map(|v| match v {
|
6255 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6256 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6257 + | })
|
6258 + | .map(|res| res.map_err(ConstraintViolation::StringList))
|
6259 + | .transpose()?,
|
6260 + | byte_list: self
|
6261 + | .byte_list
|
6262 + | .map(|v| match v {
|
6263 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6264 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6265 + | })
|
6266 + | .map(|res| res.map_err(ConstraintViolation::ByteList))
|
6267 + | .transpose()?,
|
6268 + | short_list: self
|
6269 + | .short_list
|
6270 + | .map(|v| match v {
|
6271 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6272 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6273 + | })
|
6274 + | .map(|res| res.map_err(ConstraintViolation::ShortList))
|
6275 + | .transpose()?,
|
6276 + | integer_list: self
|
6277 + | .integer_list
|
6278 + | .map(|v| match v {
|
6279 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6280 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6281 + | })
|
6282 + | .map(|res| res.map_err(ConstraintViolation::IntegerList))
|
6283 + | .transpose()?,
|
6284 + | long_list: self
|
6285 + | .long_list
|
6286 + | .map(|v| match v {
|
6287 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6288 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6289 + | })
|
6290 + | .map(|res| res.map_err(ConstraintViolation::LongList))
|
6291 + | .transpose()?,
|
6292 + | timestamp_list: self
|
6293 + | .timestamp_list
|
6294 + | .map(|v| match v {
|
6295 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6296 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6297 + | })
|
6298 + | .map(|res| res.map_err(ConstraintViolation::TimestampList))
|
6299 + | .transpose()?,
|
6300 + | date_time_list: self
|
6301 + | .date_time_list
|
6302 + | .map(|v| match v {
|
6303 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6304 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6305 + | })
|
6306 + | .map(|res| res.map_err(ConstraintViolation::DateTimeList))
|
6307 + | .transpose()?,
|
6308 + | http_date_list: self
|
6309 + | .http_date_list
|
6310 + | .map(|v| match v {
|
6311 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6312 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6313 + | })
|
6314 + | .map(|res| res.map_err(ConstraintViolation::HttpDateList))
|
6315 + | .transpose()?,
|
6316 + | enum_list: self
|
6317 + | .enum_list
|
6318 + | .map(|v| match v {
|
6319 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6320 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6321 + | })
|
6322 + | .map(|res| res.map_err(ConstraintViolation::EnumList))
|
6323 + | .transpose()?,
|
6324 + | int_enum_list: self
|
6325 + | .int_enum_list
|
6326 + | .map(|v| match v {
|
6327 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6328 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6329 + | })
|
6330 + | .map(|res| res.map_err(ConstraintViolation::IntEnumList))
|
6331 + | .transpose()?,
|
6332 + | list_list: self
|
6333 + | .list_list
|
6334 + | .map(|v| match v {
|
6335 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6336 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6337 + | })
|
6338 + | .map(|res| res.map_err(ConstraintViolation::ListList))
|
6339 + | .transpose()?,
|
6340 + | structure_list: self
|
6341 + | .structure_list
|
6342 + | .map(|v| match v {
|
6343 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6344 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6345 + | })
|
6346 + | .map(|res| res.map_err(ConstraintViolation::StructureList))
|
6347 + | .transpose()?,
|
6348 + | structure_list_with_no_key: self
|
6349 + | .structure_list_with_no_key
|
6350 + | .map(|v| match v {
|
6351 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6352 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6353 + | })
|
6354 + | .map(|res| res.map_err(ConstraintViolation::StructureListWithNoKey))
|
6355 + | .transpose()?,
|
6356 + | union_list: self
|
6357 + | .union_list
|
6358 + | .map(|v| match v {
|
6359 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6360 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6361 + | })
|
6362 + | .map(|res| res.map_err(ConstraintViolation::UnionList))
|
6363 + | .transpose()?,
|
6364 + | })
|
6043 6365 | }
|
6044 6366 | }
|
6045 6367 | }
|
6046 - | /// See [`MalformedLengthInput`](crate::input::MalformedLengthInput).
|
6047 - | pub mod malformed_length_input {
|
6368 + | /// See [`RecursiveStructuresInput`](crate::input::RecursiveStructuresInput).
|
6369 + | pub mod recursive_structures_input {
|
6048 6370 |
|
6049 6371 | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
6050 6372 | /// Holds one variant for each of the ways the builder can fail.
|
6051 6373 | #[non_exhaustive]
|
6052 6374 | #[allow(clippy::enum_variant_names)]
|
6053 6375 | pub enum ConstraintViolation {
|
6054 - | /// Constraint violation occurred building member `blob` when building `MalformedLengthInput`.
|
6055 - | #[doc(hidden)]
|
6056 - | Blob(crate::model::length_blob::ConstraintViolation),
|
6057 - | /// Constraint violation occurred building member `string` when building `MalformedLengthInput`.
|
6058 - | #[doc(hidden)]
|
6059 - | String(crate::model::length_string::ConstraintViolation),
|
6060 - | /// Constraint violation occurred building member `min_string` when building `MalformedLengthInput`.
|
6061 - | #[doc(hidden)]
|
6062 - | MinString(crate::model::min_length_string::ConstraintViolation),
|
6063 - | /// Constraint violation occurred building member `max_string` when building `MalformedLengthInput`.
|
6064 - | #[doc(hidden)]
|
6065 - | MaxString(crate::model::max_length_string::ConstraintViolation),
|
6066 - | /// Constraint violation occurred building member `list` when building `MalformedLengthInput`.
|
6067 - | #[doc(hidden)]
|
6068 - | List(crate::model::length_list::ConstraintViolation),
|
6069 - | /// Constraint violation occurred building member `map` when building `MalformedLengthInput`.
|
6376 + | /// Constraint violation occurred building member `union` when building `RecursiveStructuresInput`.
|
6070 6377 | #[doc(hidden)]
|
6071 - | Map(crate::model::length_map::ConstraintViolation),
|
6378 + | Union(crate::model::recursive_union_one::ConstraintViolation),
|
6072 6379 | }
|
6073 6380 | impl ::std::fmt::Display for ConstraintViolation {
|
6074 6381 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
6075 6382 | match self {
|
6076 - | ConstraintViolation::Blob(_) => write!(f, "constraint violation occurred building member `blob` when building `MalformedLengthInput`"),
|
6077 - | ConstraintViolation::String(_) => write!(f, "constraint violation occurred building member `string` when building `MalformedLengthInput`"),
|
6078 - | ConstraintViolation::MinString(_) => write!(f, "constraint violation occurred building member `min_string` when building `MalformedLengthInput`"),
|
6079 - | ConstraintViolation::MaxString(_) => write!(f, "constraint violation occurred building member `max_string` when building `MalformedLengthInput`"),
|
6080 - | ConstraintViolation::List(_) => write!(f, "constraint violation occurred building member `list` when building `MalformedLengthInput`"),
|
6081 - | ConstraintViolation::Map(_) => write!(f, "constraint violation occurred building member `map` when building `MalformedLengthInput`"),
|
6383 + | ConstraintViolation::Union(_) => write!(f, "constraint violation occurred building member `union` when building `RecursiveStructuresInput`"),
|
6082 6384 | }
|
6083 6385 | }
|
6084 6386 | }
|
6085 6387 | impl ::std::error::Error for ConstraintViolation {}
|
6086 6388 | impl ConstraintViolation {
|
6087 6389 | pub(crate) fn as_validation_exception_field(
|
6088 6390 | self,
|
6089 6391 | path: ::std::string::String,
|
6090 6392 | ) -> crate::model::ValidationExceptionField {
|
6091 6393 | match self {
|
6092 - | ConstraintViolation::Blob(inner) => {
|
6093 - | inner.as_validation_exception_field(path + "/blob")
|
6094 - | }
|
6095 - | ConstraintViolation::String(inner) => {
|
6096 - | inner.as_validation_exception_field(path + "/string")
|
6097 - | }
|
6098 - | ConstraintViolation::MinString(inner) => {
|
6099 - | inner.as_validation_exception_field(path + "/minString")
|
6100 - | }
|
6101 - | ConstraintViolation::MaxString(inner) => {
|
6102 - | inner.as_validation_exception_field(path + "/maxString")
|
6103 - | }
|
6104 - | ConstraintViolation::List(inner) => {
|
6105 - | inner.as_validation_exception_field(path + "/list")
|
6106 - | }
|
6107 - | ConstraintViolation::Map(inner) => {
|
6108 - | inner.as_validation_exception_field(path + "/map")
|
6394 + | ConstraintViolation::Union(inner) => {
|
6395 + | inner.as_validation_exception_field(path + "/union")
|
6109 6396 | }
|
6110 6397 | }
|
6111 6398 | }
|
6112 6399 | }
|
6113 6400 | impl ::std::convert::From<ConstraintViolation>
|
6114 6401 | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
6115 6402 | {
|
6116 6403 | fn from(constraint_violation: ConstraintViolation) -> Self {
|
6117 6404 | let first_validation_exception_field =
|
6118 6405 | constraint_violation.as_validation_exception_field("".to_owned());
|
6119 6406 | let validation_exception = crate::error::ValidationException {
|
6120 6407 | message: format!(
|
6121 6408 | "1 validation error detected. {}",
|
6122 6409 | &first_validation_exception_field.message
|
6123 6410 | ),
|
6124 6411 | field_list: Some(vec![first_validation_exception_field]),
|
6125 6412 | };
|
6126 6413 | Self::ConstraintViolation(
|
6127 6414 | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
6128 6415 | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
6129 6416 | )
|
6130 6417 | }
|
6131 6418 | }
|
6132 6419 | impl ::std::convert::From<Builder>
|
6133 - | for crate::constrained::MaybeConstrained<crate::input::MalformedLengthInput>
|
6420 + | for crate::constrained::MaybeConstrained<crate::input::RecursiveStructuresInput>
|
6134 6421 | {
|
6135 6422 | fn from(builder: Builder) -> Self {
|
6136 6423 | Self::Unconstrained(builder)
|
6137 6424 | }
|
6138 6425 | }
|
6139 - | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedLengthInput {
|
6426 + | impl ::std::convert::TryFrom<Builder> for crate::input::RecursiveStructuresInput {
|
6140 6427 | type Error = ConstraintViolation;
|
6141 6428 |
|
6142 6429 | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
6143 6430 | builder.build()
|
6144 6431 | }
|
6145 6432 | }
|
6146 - | /// A builder for [`MalformedLengthInput`](crate::input::MalformedLengthInput).
|
6433 + | /// A builder for [`RecursiveStructuresInput`](crate::input::RecursiveStructuresInput).
|
6147 6434 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
6148 6435 | pub struct Builder {
|
6149 - | pub(crate) blob:
|
6150 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::LengthBlob>>,
|
6151 - | pub(crate) string:
|
6152 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::LengthString>>,
|
6153 - | pub(crate) min_string: ::std::option::Option<
|
6154 - | crate::constrained::MaybeConstrained<crate::model::MinLengthString>,
|
6155 - | >,
|
6156 - | pub(crate) max_string: ::std::option::Option<
|
6157 - | crate::constrained::MaybeConstrained<crate::model::MaxLengthString>,
|
6436 + | pub(crate) union: ::std::option::Option<
|
6437 + | crate::constrained::MaybeConstrained<crate::model::RecursiveUnionOne>,
|
6158 6438 | >,
|
6159 - | pub(crate) list:
|
6160 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::LengthList>>,
|
6161 - | pub(crate) map:
|
6162 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::LengthMap>>,
|
6163 6439 | }
|
6164 6440 | impl Builder {
|
6165 6441 | #[allow(missing_docs)] // documentation missing in model
|
6166 - | pub fn blob(mut self, input: ::std::option::Option<crate::model::LengthBlob>) -> Self {
|
6167 - | self.blob = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6168 - | self
|
6169 - | }
|
6170 - | #[allow(missing_docs)] // documentation missing in model
|
6171 - | pub(crate) fn set_blob(
|
6172 - | mut self,
|
6173 - | input: Option<
|
6174 - | impl ::std::convert::Into<
|
6175 - | crate::constrained::MaybeConstrained<crate::model::LengthBlob>,
|
6176 - | >,
|
6177 - | >,
|
6178 - | ) -> Self {
|
6179 - | self.blob = input.map(|v| v.into());
|
6180 - | self
|
6181 - | }
|
6182 - | #[allow(missing_docs)] // documentation missing in model
|
6183 - | pub fn string(mut self, input: ::std::option::Option<crate::model::LengthString>) -> Self {
|
6184 - | self.string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6185 - | self
|
6186 - | }
|
6187 - | #[allow(missing_docs)] // documentation missing in model
|
6188 - | pub(crate) fn set_string(
|
6189 - | mut self,
|
6190 - | input: Option<
|
6191 - | impl ::std::convert::Into<
|
6192 - | crate::constrained::MaybeConstrained<crate::model::LengthString>,
|
6193 - | >,
|
6194 - | >,
|
6195 - | ) -> Self {
|
6196 - | self.string = input.map(|v| v.into());
|
6197 - | self
|
6198 - | }
|
6199 - | #[allow(missing_docs)] // documentation missing in model
|
6200 - | pub fn min_string(
|
6201 - | mut self,
|
6202 - | input: ::std::option::Option<crate::model::MinLengthString>,
|
6203 - | ) -> Self {
|
6204 - | self.min_string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6205 - | self
|
6206 - | }
|
6207 - | #[allow(missing_docs)] // documentation missing in model
|
6208 - | pub(crate) fn set_min_string(
|
6209 - | mut self,
|
6210 - | input: Option<
|
6211 - | impl ::std::convert::Into<
|
6212 - | crate::constrained::MaybeConstrained<crate::model::MinLengthString>,
|
6213 - | >,
|
6214 - | >,
|
6215 - | ) -> Self {
|
6216 - | self.min_string = input.map(|v| v.into());
|
6217 - | self
|
6218 - | }
|
6219 - | #[allow(missing_docs)] // documentation missing in model
|
6220 - | pub fn max_string(
|
6221 - | mut self,
|
6222 - | input: ::std::option::Option<crate::model::MaxLengthString>,
|
6223 - | ) -> Self {
|
6224 - | self.max_string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6225 - | self
|
6226 - | }
|
6227 - | #[allow(missing_docs)] // documentation missing in model
|
6228 - | pub(crate) fn set_max_string(
|
6442 + | pub fn union(
|
6229 6443 | mut self,
|
6230 - | input: Option<
|
6231 - | impl ::std::convert::Into<
|
6232 - | crate::constrained::MaybeConstrained<crate::model::MaxLengthString>,
|
6233 - | >,
|
6234 - | >,
|
6444 + | input: ::std::option::Option<crate::model::RecursiveUnionOne>,
|
6235 6445 | ) -> Self {
|
6236 - | self.max_string = input.map(|v| v.into());
|
6237 - | self
|
6238 - | }
|
6239 - | #[allow(missing_docs)] // documentation missing in model
|
6240 - | pub fn list(mut self, input: ::std::option::Option<crate::model::LengthList>) -> Self {
|
6241 - | self.list = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6446 + | self.union = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6242 6447 | self
|
6243 6448 | }
|
6244 6449 | #[allow(missing_docs)] // documentation missing in model
|
6245 - | pub(crate) fn set_list(
|
6450 + | pub(crate) fn set_union(
|
6246 6451 | mut self,
|
6247 6452 | input: Option<
|
6248 6453 | impl ::std::convert::Into<
|
6249 - | crate::constrained::MaybeConstrained<crate::model::LengthList>,
|
6454 + | crate::constrained::MaybeConstrained<crate::model::RecursiveUnionOne>,
|
6250 6455 | >,
|
6251 6456 | >,
|
6252 6457 | ) -> Self {
|
6253 - | self.list = input.map(|v| v.into());
|
6254 - | self
|
6255 - | }
|
6256 - | #[allow(missing_docs)] // documentation missing in model
|
6257 - | pub fn map(mut self, input: ::std::option::Option<crate::model::LengthMap>) -> Self {
|
6258 - | self.map = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6259 - | self
|
6260 - | }
|
6261 - | #[allow(missing_docs)] // documentation missing in model
|
6262 - | pub(crate) fn set_map(
|
6263 - | mut self,
|
6264 - | input: Option<
|
6265 - | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::LengthMap>>,
|
6266 - | >,
|
6267 - | ) -> Self {
|
6268 - | self.map = input.map(|v| v.into());
|
6458 + | self.union = input.map(|v| v.into());
|
6269 6459 | self
|
6270 6460 | }
|
6271 - | /// Consumes the builder and constructs a [`MalformedLengthInput`](crate::input::MalformedLengthInput).
|
6272 - | ///
|
6273 - | /// The builder fails to construct a [`MalformedLengthInput`](crate::input::MalformedLengthInput) if a [`ConstraintViolation`] occurs.
|
6461 + | /// Consumes the builder and constructs a [`RecursiveStructuresInput`](crate::input::RecursiveStructuresInput).
|
6274 6462 | ///
|
6275 - | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
6276 - | pub fn build(self) -> Result<crate::input::MalformedLengthInput, ConstraintViolation> {
|
6463 + | /// The builder fails to construct a [`RecursiveStructuresInput`](crate::input::RecursiveStructuresInput) if a [`ConstraintViolation`] occurs.
|
6464 + | ///
|
6465 + | pub fn build(self) -> Result<crate::input::RecursiveStructuresInput, ConstraintViolation> {
|
6277 6466 | self.build_enforcing_all_constraints()
|
6278 6467 | }
|
6279 6468 | fn build_enforcing_all_constraints(
|
6280 6469 | self,
|
6281 - | ) -> Result<crate::input::MalformedLengthInput, ConstraintViolation> {
|
6282 - | Ok(crate::input::MalformedLengthInput {
|
6283 - | blob: self
|
6284 - | .blob
|
6285 - | .map(|v| match v {
|
6286 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6287 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6288 - | })
|
6289 - | .map(|res| res.map_err(ConstraintViolation::Blob))
|
6290 - | .transpose()?,
|
6291 - | string: self
|
6292 - | .string
|
6293 - | .map(|v| match v {
|
6294 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6295 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6296 - | })
|
6297 - | .map(|res| res.map_err(ConstraintViolation::String))
|
6298 - | .transpose()?,
|
6299 - | min_string: self
|
6300 - | .min_string
|
6301 - | .map(|v| match v {
|
6302 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6303 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6304 - | })
|
6305 - | .map(|res| res.map_err(ConstraintViolation::MinString))
|
6306 - | .transpose()?,
|
6307 - | max_string: self
|
6308 - | .max_string
|
6309 - | .map(|v| match v {
|
6310 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6311 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6312 - | })
|
6313 - | .map(|res| res.map_err(ConstraintViolation::MaxString))
|
6314 - | .transpose()?,
|
6315 - | list: self
|
6316 - | .list
|
6317 - | .map(|v| match v {
|
6318 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6319 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6320 - | })
|
6321 - | .map(|res| res.map_err(ConstraintViolation::List))
|
6322 - | .transpose()?,
|
6323 - | map: self
|
6324 - | .map
|
6470 + | ) -> Result<crate::input::RecursiveStructuresInput, ConstraintViolation> {
|
6471 + | Ok(crate::input::RecursiveStructuresInput {
|
6472 + | union: self
|
6473 + | .union
|
6325 6474 | .map(|v| match v {
|
6326 6475 | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6327 6476 | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6328 6477 | })
|
6329 - | .map(|res| res.map_err(ConstraintViolation::Map))
|
6478 + | .map(|res| res.map_err(ConstraintViolation::Union))
|
6330 6479 | .transpose()?,
|
6331 6480 | })
|
6332 6481 | }
|
6333 6482 | }
|
6334 6483 | }
|
6335 - | /// See [`MalformedEnumInput`](crate::input::MalformedEnumInput).
|
6336 - | pub mod malformed_enum_input {
|
6484 + | /// See [`SensitiveValidationInput`](crate::input::SensitiveValidationInput).
|
6485 + | pub mod sensitive_validation_input {
|
6337 6486 |
|
6338 6487 | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
6339 6488 | /// Holds one variant for each of the ways the builder can fail.
|
6340 6489 | #[non_exhaustive]
|
6341 6490 | #[allow(clippy::enum_variant_names)]
|
6342 6491 | pub enum ConstraintViolation {
|
6343 - | /// Constraint violation occurred building member `string` when building `MalformedEnumInput`.
|
6344 - | #[doc(hidden)]
|
6345 - | String(crate::model::enum_string::ConstraintViolation),
|
6346 - | /// Constraint violation occurred building member `string_with_enum_trait` when building `MalformedEnumInput`.
|
6347 - | #[doc(hidden)]
|
6348 - | StringWithEnumTrait(crate::model::enum_trait_string::ConstraintViolation),
|
6349 - | /// Constraint violation occurred building member `list` when building `MalformedEnumInput`.
|
6350 - | #[doc(hidden)]
|
6351 - | List(crate::model::enum_list::ConstraintViolation),
|
6352 - | /// Constraint violation occurred building member `map` when building `MalformedEnumInput`.
|
6353 - | #[doc(hidden)]
|
6354 - | Map(crate::model::enum_map::ConstraintViolation),
|
6355 - | /// Constraint violation occurred building member `union` when building `MalformedEnumInput`.
|
6492 + | /// Constraint violation occurred building member `string` when building `SensitiveValidationInput`.
|
6356 6493 | #[doc(hidden)]
|
6357 - | Union(crate::model::enum_union::ConstraintViolation),
|
6494 + | String(crate::model::sensitive_pattern_string::ConstraintViolation),
|
6358 6495 | }
|
6359 6496 | impl ::std::fmt::Display for ConstraintViolation {
|
6360 6497 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
6361 6498 | match self {
|
6362 - | ConstraintViolation::String(_) => write!(f, "constraint violation occurred building member `string` when building `MalformedEnumInput`"),
|
6363 - | ConstraintViolation::StringWithEnumTrait(_) => write!(f, "constraint violation occurred building member `string_with_enum_trait` when building `MalformedEnumInput`"),
|
6364 - | ConstraintViolation::List(_) => write!(f, "constraint violation occurred building member `list` when building `MalformedEnumInput`"),
|
6365 - | ConstraintViolation::Map(_) => write!(f, "constraint violation occurred building member `map` when building `MalformedEnumInput`"),
|
6366 - | ConstraintViolation::Union(_) => write!(f, "constraint violation occurred building member `union` when building `MalformedEnumInput`"),
|
6499 + | ConstraintViolation::String(_) => write!(f, "constraint violation occurred building member `string` when building `SensitiveValidationInput`"),
|
6367 6500 | }
|
6368 6501 | }
|
6369 6502 | }
|
6370 6503 | impl ::std::error::Error for ConstraintViolation {}
|
6371 6504 | impl ConstraintViolation {
|
6372 6505 | pub(crate) fn as_validation_exception_field(
|
6373 6506 | self,
|
6374 6507 | path: ::std::string::String,
|
6375 6508 | ) -> crate::model::ValidationExceptionField {
|
6376 6509 | match self {
|
6377 6510 | ConstraintViolation::String(inner) => {
|
6378 6511 | inner.as_validation_exception_field(path + "/string")
|
6379 6512 | }
|
6380 - | ConstraintViolation::StringWithEnumTrait(inner) => {
|
6381 - | inner.as_validation_exception_field(path + "/stringWithEnumTrait")
|
6382 - | }
|
6383 - | ConstraintViolation::List(inner) => {
|
6384 - | inner.as_validation_exception_field(path + "/list")
|
6385 - | }
|
6386 - | ConstraintViolation::Map(inner) => {
|
6387 - | inner.as_validation_exception_field(path + "/map")
|
6388 - | }
|
6389 - | ConstraintViolation::Union(inner) => {
|
6390 - | inner.as_validation_exception_field(path + "/union")
|
6391 - | }
|
6392 6513 | }
|
6393 6514 | }
|
6394 6515 | }
|
6395 6516 | impl ::std::convert::From<ConstraintViolation>
|
6396 6517 | for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
6397 6518 | {
|
6398 6519 | fn from(constraint_violation: ConstraintViolation) -> Self {
|
6399 6520 | let first_validation_exception_field =
|
6400 6521 | constraint_violation.as_validation_exception_field("".to_owned());
|
6401 6522 | let validation_exception = crate::error::ValidationException {
|
6402 6523 | message: format!(
|
6403 6524 | "1 validation error detected. {}",
|
6404 6525 | &first_validation_exception_field.message
|
6405 6526 | ),
|
6406 6527 | field_list: Some(vec![first_validation_exception_field]),
|
6407 6528 | };
|
6408 6529 | Self::ConstraintViolation(
|
6409 6530 | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
6410 6531 | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
6411 6532 | )
|
6412 6533 | }
|
6413 6534 | }
|
6414 6535 | impl ::std::convert::From<Builder>
|
6415 - | for crate::constrained::MaybeConstrained<crate::input::MalformedEnumInput>
|
6536 + | for crate::constrained::MaybeConstrained<crate::input::SensitiveValidationInput>
|
6416 6537 | {
|
6417 6538 | fn from(builder: Builder) -> Self {
|
6418 6539 | Self::Unconstrained(builder)
|
6419 6540 | }
|
6420 6541 | }
|
6421 - | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedEnumInput {
|
6542 + | impl ::std::convert::TryFrom<Builder> for crate::input::SensitiveValidationInput {
|
6422 6543 | type Error = ConstraintViolation;
|
6423 6544 |
|
6424 6545 | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
6425 6546 | builder.build()
|
6426 6547 | }
|
6427 6548 | }
|
6428 - | /// A builder for [`MalformedEnumInput`](crate::input::MalformedEnumInput).
|
6429 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
6549 + | /// A builder for [`SensitiveValidationInput`](crate::input::SensitiveValidationInput).
|
6550 + | #[derive(::std::clone::Clone, ::std::default::Default)]
|
6430 6551 | pub struct Builder {
|
6431 - | pub(crate) string:
|
6432 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::EnumString>>,
|
6433 - | pub(crate) string_with_enum_trait: ::std::option::Option<
|
6434 - | crate::constrained::MaybeConstrained<crate::model::EnumTraitString>,
|
6435 - | >,
|
6436 - | pub(crate) list: ::std::option::Option<
|
6437 - | crate::constrained::MaybeConstrained<
|
6438 - | crate::constrained::enum_list_constrained::EnumListConstrained,
|
6439 - | >,
|
6440 - | >,
|
6441 - | pub(crate) map: ::std::option::Option<
|
6442 - | crate::constrained::MaybeConstrained<
|
6443 - | crate::constrained::enum_map_constrained::EnumMapConstrained,
|
6444 - | >,
|
6552 + | pub(crate) string: ::std::option::Option<
|
6553 + | crate::constrained::MaybeConstrained<crate::model::SensitivePatternString>,
|
6445 6554 | >,
|
6446 - | pub(crate) union:
|
6447 - | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::EnumUnion>>,
|
6448 6555 | }
|
6449 6556 | impl Builder {
|
6450 6557 | #[allow(missing_docs)] // documentation missing in model
|
6451 - | pub fn string(mut self, input: ::std::option::Option<crate::model::EnumString>) -> Self {
|
6558 + | pub fn string(
|
6559 + | mut self,
|
6560 + | input: ::std::option::Option<crate::model::SensitivePatternString>,
|
6561 + | ) -> Self {
|
6452 6562 | self.string = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6453 6563 | self
|
6454 6564 | }
|
6455 6565 | #[allow(missing_docs)] // documentation missing in model
|
6456 6566 | pub(crate) fn set_string(
|
6457 6567 | mut self,
|
6458 6568 | input: Option<
|
6459 6569 | impl ::std::convert::Into<
|
6460 - | crate::constrained::MaybeConstrained<crate::model::EnumString>,
|
6570 + | crate::constrained::MaybeConstrained<crate::model::SensitivePatternString>,
|
6461 6571 | >,
|
6462 6572 | >,
|
6463 6573 | ) -> Self {
|
6464 6574 | self.string = input.map(|v| v.into());
|
6465 6575 | self
|
6466 6576 | }
|
6467 - | #[allow(missing_docs)] // documentation missing in model
|
6468 - | pub fn string_with_enum_trait(
|
6469 - | mut self,
|
6470 - | input: ::std::option::Option<crate::model::EnumTraitString>,
|
6471 - | ) -> Self {
|
6472 - | self.string_with_enum_trait =
|
6473 - | input.map(crate::constrained::MaybeConstrained::Constrained);
|
6474 - | self
|
6475 - | }
|
6476 - | #[allow(missing_docs)] // documentation missing in model
|
6477 - | pub(crate) fn set_string_with_enum_trait(
|
6478 - | mut self,
|
6479 - | input: Option<
|
6480 - | impl ::std::convert::Into<
|
6481 - | crate::constrained::MaybeConstrained<crate::model::EnumTraitString>,
|
6482 - | >,
|
6483 - | >,
|
6484 - | ) -> Self {
|
6485 - | self.string_with_enum_trait = input.map(|v| v.into());
|
6486 - | self
|
6487 - | }
|
6488 - | #[allow(missing_docs)] // documentation missing in model
|
6489 - | pub fn list(
|
6490 - | mut self,
|
6491 - | input: ::std::option::Option<::std::vec::Vec<crate::model::EnumString>>,
|
6492 - | ) -> Self {
|
6493 - | self.list =
|
6494 - | input.map(|v| crate::constrained::MaybeConstrained::Constrained((v).into()));
|
6495 - | self
|
6496 - | }
|
6497 - | #[allow(missing_docs)] // documentation missing in model
|
6498 - | pub(crate) fn set_list(
|
6499 - | mut self,
|
6500 - | input: Option<
|
6501 - | impl ::std::convert::Into<
|
6502 - | crate::constrained::MaybeConstrained<
|
6503 - | crate::constrained::enum_list_constrained::EnumListConstrained,
|
6504 - | >,
|
6505 - | >,
|
6506 - | >,
|
6507 - | ) -> Self {
|
6508 - | self.list = input.map(|v| v.into());
|
6509 - | self
|
6510 - | }
|
6511 - | #[allow(missing_docs)] // documentation missing in model
|
6512 - | pub fn map(
|
6513 - | mut self,
|
6514 - | input: ::std::option::Option<
|
6515 - | ::std::collections::HashMap<crate::model::EnumString, crate::model::EnumString>,
|
6516 - | >,
|
6517 - | ) -> Self {
|
6518 - | self.map = input.map(|v| crate::constrained::MaybeConstrained::Constrained((v).into()));
|
6519 - | self
|
6520 - | }
|
6521 - | #[allow(missing_docs)] // documentation missing in model
|
6522 - | pub(crate) fn set_map(
|
6523 - | mut self,
|
6524 - | input: Option<
|
6525 - | impl ::std::convert::Into<
|
6526 - | crate::constrained::MaybeConstrained<
|
6527 - | crate::constrained::enum_map_constrained::EnumMapConstrained,
|
6528 - | >,
|
6529 - | >,
|
6530 - | >,
|
6531 - | ) -> Self {
|
6532 - | self.map = input.map(|v| v.into());
|
6533 - | self
|
6534 - | }
|
6535 - | #[allow(missing_docs)] // documentation missing in model
|
6536 - | pub fn union(mut self, input: ::std::option::Option<crate::model::EnumUnion>) -> Self {
|
6537 - | self.union = input.map(crate::constrained::MaybeConstrained::Constrained);
|
6538 - | self
|
6539 - | }
|
6540 - | #[allow(missing_docs)] // documentation missing in model
|
6541 - | pub(crate) fn set_union(
|
6542 - | mut self,
|
6543 - | input: Option<
|
6544 - | impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::EnumUnion>>,
|
6545 - | >,
|
6546 - | ) -> Self {
|
6547 - | self.union = input.map(|v| v.into());
|
6548 - | self
|
6549 - | }
|
6550 - | /// Consumes the builder and constructs a [`MalformedEnumInput`](crate::input::MalformedEnumInput).
|
6577 + | /// Consumes the builder and constructs a [`SensitiveValidationInput`](crate::input::SensitiveValidationInput).
|
6551 6578 | ///
|
6552 - | /// The builder fails to construct a [`MalformedEnumInput`](crate::input::MalformedEnumInput) if a [`ConstraintViolation`] occurs.
|
6579 + | /// The builder fails to construct a [`SensitiveValidationInput`](crate::input::SensitiveValidationInput) if a [`ConstraintViolation`] occurs.
|
6553 6580 | ///
|
6554 - | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
6555 - | pub fn build(self) -> Result<crate::input::MalformedEnumInput, ConstraintViolation> {
|
6581 + | pub fn build(self) -> Result<crate::input::SensitiveValidationInput, ConstraintViolation> {
|
6556 6582 | self.build_enforcing_all_constraints()
|
6557 6583 | }
|
6558 6584 | fn build_enforcing_all_constraints(
|
6559 6585 | self,
|
6560 - | ) -> Result<crate::input::MalformedEnumInput, ConstraintViolation> {
|
6561 - | Ok(crate::input::MalformedEnumInput {
|
6586 + | ) -> Result<crate::input::SensitiveValidationInput, ConstraintViolation> {
|
6587 + | Ok(crate::input::SensitiveValidationInput {
|
6562 6588 | string: self
|
6563 6589 | .string
|
6564 6590 | .map(|v| match v {
|
6565 6591 | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6566 6592 | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6567 6593 | })
|
6568 6594 | .map(|res| res.map_err(ConstraintViolation::String))
|
6569 6595 | .transpose()?,
|
6570 - | string_with_enum_trait: self
|
6571 - | .string_with_enum_trait
|
6572 - | .map(|v| match v {
|
6573 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6574 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6575 - | })
|
6576 - | .map(|res| res.map_err(ConstraintViolation::StringWithEnumTrait))
|
6577 - | .transpose()?,
|
6578 - | list: self
|
6579 - | .list
|
6580 - | .map(|v| match v {
|
6581 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6582 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6583 - | })
|
6584 - | .map(|res| res.map(|v| v.into()).map_err(ConstraintViolation::List))
|
6585 - | .transpose()?,
|
6586 - | map: self
|
6587 - | .map
|
6588 - | .map(|v| match v {
|
6589 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6590 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6591 - | })
|
6592 - | .map(|res| res.map(|v| v.into()).map_err(ConstraintViolation::Map))
|
6593 - | .transpose()?,
|
6594 - | union: self
|
6595 - | .union
|
6596 - | .map(|v| match v {
|
6597 - | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
6598 - | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
6599 - | })
|
6600 - | .map(|res| res.map_err(ConstraintViolation::Union))
|
6601 - | .transpose()?,
|
6602 6596 | })
|
6603 6597 | }
|
6604 6598 | }
|
6599 + | impl ::std::fmt::Debug for Builder {
|
6600 + | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
6601 + | let mut formatter = f.debug_struct("Builder");
|
6602 + | formatter.field("string", &"*** Sensitive Data Redacted ***");
|
6603 + | formatter.finish()
|
6604 + | }
|
6605 + | }
|
6605 6606 | }
|