pub struct JsonCodecSettingsBuilder { /* private fields */ }Expand description
Builder for JsonCodecSettings.
Implementations§
Source§impl JsonCodecSettingsBuilder
impl JsonCodecSettingsBuilder
Sourcepub fn enforce_strictness(self, value: bool) -> Self
pub fn enforce_strictness(self, value: bool) -> Self
Enforces JSON grammar and request document validity. Disabled by default.
Sourcepub fn validate_skipped_values(self, value: bool) -> Self
pub fn validate_skipped_values(self, value: bool) -> Self
Whether discarded string contents are validated. Enabled by default.
When enabled, escape syntax is checked without decoding Unicode escapes.
enforce_strictness applies only to values read. When disabled, strings and keys inside
discarded objects are scanned without decoding or validating escapes.
Container syntax, number/literal grammar, truncation, and depth limits
are still checked. Values actually read are unaffected.
Sourcepub fn validate_skipped_string_encoding(self, value: bool) -> Self
pub fn validate_skipped_string_encoding(self, value: bool) -> Self
Checks discarded strings for UTF-8 and unescaped control characters without decoding or validating their escape sequences. Disabled by default.
Sourcepub fn allow_integral_float_numbers(self, value: bool) -> Self
pub fn allow_integral_float_numbers(self, value: bool) -> Self
Accepts exactly integral decimal/exponent numbers for integer members. Disabled by default; ordinary integer spellings retain exact parsing.
Sourcepub fn allow_leading_zeros(self, value: bool) -> Self
pub fn allow_leading_zeros(self, value: bool) -> Self
Permits leading zeros in JSON numbers even with enforce_strictness(true).
Disabled by default. This matches the legacy JSON parser without relaxing
other grammar checks. Applies to read and skipped numbers alike.
Sourcepub fn allow_trailing_decimal_point(self, value: bool) -> Self
pub fn allow_trailing_decimal_point(self, value: bool) -> Self
Permits an empty fraction after a decimal point, such as 12. or 12.e2,
even with enforce_strictness(true). Disabled by default. Integer members
additionally require allow_integral_float_numbers(true) and a whole value.
Applies to read and skipped numbers alike.
Sourcepub fn allow_empty_integer_part(self, value: bool) -> Self
pub fn allow_empty_integer_part(self, value: bool) -> Self
Permits negative fractions with no integer digits, such as -.123 or
-.123e2, even with enforce_strictness(true). Disabled by default.
Under strict number validation, .123, -., and -.e2 remain invalid.
Applies to read and skipped numbers alike.
Sourcepub fn use_json_name(self, value: bool) -> Self
pub fn use_json_name(self, value: bool) -> Self
Whether to use the @jsonName trait for member names.
Sourcepub fn default_timestamp_format(self, value: TimestampFormat) -> Self
pub fn default_timestamp_format(self, value: TimestampFormat) -> Self
Default timestamp format when not specified by @timestampFormat trait.
Sourcepub fn max_depth(self, value: u32) -> Self
pub fn max_depth(self, value: u32) -> Self
Sets the maximum aggregate nesting depth the deserializer will accept before returning an error. Defaults to 128.
Sourcepub fn strict_timestamp_formats(self, value: bool) -> Self
pub fn strict_timestamp_formats(self, value: bool) -> Self
Require timestamps to use exactly the wire form their resolved format
prescribes: a JSON number for epoch-seconds, an RFC 3339 string without
a UTC offset for date-time, an IMF-fixdate string for http-date.
Off by default; when enabled, any other form is rejected.
Sourcepub fn dispatch_null_members(self, value: bool) -> Self
pub fn dispatch_null_members(self, value: bool) -> Self
Pass null structure members to the consumer. Defaults to false, preserving existing codec callers; schema server readers decide how each null affects their builders.
Sourcepub fn protocol_id(self, value: ShapeId<'static>) -> Self
pub fn protocol_id(self, value: ShapeId<'static>) -> Self
Sets the protocol id surfaced in DocumentSettings
diagnostics. Defaults to aws.smithy.json#JsonCodec. AWS
protocols (awsJson1_0, awsJson1_1, restJson1) supply their own
shape id so coercion errors point at the originating protocol.
Sourcepub fn use_string_for_arbitrary_precision(self, value: bool) -> Self
pub fn use_string_for_arbitrary_precision(self, value: bool) -> Self
Configures whether bigInteger and bigDecimal shapes
serialize as JSON strings (when true) or as raw JSON numbers
(when false, the default).
This is schema-driven: a Document carries no schema and has no
arbitrary-precision variant, so write_document is unaffected.
Set to true for interop with receivers using f64-routed
JSON parsers that would otherwise lose precision on large
integers or decimals. The read path always accepts both forms.
Sourcepub fn normalize_arbitrary_precision(self, value: bool) -> Self
pub fn normalize_arbitrary_precision(self, value: bool) -> Self
Rewrites arbitrary-precision text that is a decimal but not a JSON number (+007, .5,
1.) to the equivalent JSON number instead of rejecting it. Defaults to false, so
existing callers keep rejecting it; AWS servers set it to true, matching their lenient
handling of such numbers on the read path (allow_leading_zeros,
allow_trailing_decimal_point).
Sourcepub fn default_namespace(self, namespace: impl Into<String>) -> Self
pub fn default_namespace(self, namespace: impl Into<String>) -> Self
Sets the default Smithy namespace used to resolve relative shape
IDs in JSON __type discriminator fields. When set, a relative
__type: "Capacity" is lifted to <namespace>#Capacity on the
resulting DiscriminatedDocument. Absolute __type values
(already containing #) are taken as-is regardless.
Defaults to None — relative names are not lifted.
Sourcepub fn build(self) -> JsonCodecSettings
pub fn build(self) -> JsonCodecSettings
Builds the settings.
Trait Implementations§
Source§impl Clone for JsonCodecSettingsBuilder
impl Clone for JsonCodecSettingsBuilder
Source§fn clone(&self) -> JsonCodecSettingsBuilder
fn clone(&self) -> JsonCodecSettingsBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for JsonCodecSettingsBuilder
impl Debug for JsonCodecSettingsBuilder
Auto Trait Implementations§
impl Freeze for JsonCodecSettingsBuilder
impl RefUnwindSafe for JsonCodecSettingsBuilder
impl Send for JsonCodecSettingsBuilder
impl Sync for JsonCodecSettingsBuilder
impl Unpin for JsonCodecSettingsBuilder
impl UnsafeUnpin for JsonCodecSettingsBuilder
impl UnwindSafe for JsonCodecSettingsBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more