Skip to main content

JsonCodecSettingsBuilder

Struct JsonCodecSettingsBuilder 

Source
pub struct JsonCodecSettingsBuilder { /* private fields */ }
Expand description

Builder for JsonCodecSettings.

Implementations§

Source§

impl JsonCodecSettingsBuilder

Source

pub fn enforce_strictness(self, value: bool) -> Self

Enforces JSON grammar and request document validity. Disabled by default.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn use_json_name(self, value: bool) -> Self

Whether to use the @jsonName trait for member names.

Source

pub fn default_timestamp_format(self, value: TimestampFormat) -> Self

Default timestamp format when not specified by @timestampFormat trait.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

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.

Source

pub fn build(self) -> JsonCodecSettings

Builds the settings.

Trait Implementations§

Source§

impl Clone for JsonCodecSettingsBuilder

Source§

fn clone(&self) -> JsonCodecSettingsBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for JsonCodecSettingsBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for JsonCodecSettingsBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more