Repository navigation
Conversation
Adds an open-content document value type to the schema-serde runtime and wires it through the JSON/CBOR/XML/Query serializers and deserializers. - smithy::schema::Document: a copyable value handle over a polymorphic, AWS_CORE_LOCAL DocumentImpl. The agnostic base serves serialize-built (and future CBOR) documents; JsonDocumentImpl adds JSON string->blob and string/number->timestamp coercion, parameterized by the protocol-default timestamp format threaded from JsonCodec. - Serialization: JSON and CBOR emit documents; REST-XML, AWS/Query, and EC2/Query reject with a SerializationException. - Deserialization: JSON builds the document tree; CBOR and XML reject (CBOR ReadDocument consumes the value so sibling members stay aligned). - JSON numeric safety: ReadLong's double fallback rejects non-finite / out-of-range doubles instead of casting them (undefined behavior), while a plain-integer overflow still clamps to INT64_MAX/MIN; open-content document integer overflow preserves magnitude as a double; Document::AsFloat rejects finite doubles beyond float range (out-of-range double->float is undefined behavior). - JSON floats and doubles serialize with shortest-round-trip precision (float precision for floats, not the double expansion of their imprecision) and a decimal marker, so a document float or double round-trips without losing precision or type. Deferred (documented): map insertion order, int/bigInteger reporting, unsigned 64-bit, a nesting depth cap of 64, and the tagged-union node layout.
pulimsr
reviewed
Oct 1, 2026
pulimsr
reviewed
Oct 1, 2026
pulimsr
reviewed
Oct 1, 2026
sbiscigl
reviewed
Oct 1, 2026
sbiscigl
reviewed
Oct 5, 2026
pulimsr
approved these changes
Oct 5, 2026
Document was shaped like a PIMPL but was not one: DocumentImpl was a public header, AsList/AsMap handed back pointers into its storage, and detail::MakeDocument let any caller build a Document over any impl. Coercion behavior was therefore smuggled through a hidden interface -- two documents could compare equal yet disagree on AsBlob(). Document is now a public abstract interface. AbstractDocument (internal, not installed) holds the tagged storage and the protocol-independent behavior, leaving AsBlob/AsTimestamp pure so a node cannot exist without a coercion rule. The concrete leaves live in Document.cpp's anonymous namespace: PlainDocument applies no reinterpretation and backs the From* factories, while JsonDocument base64-decodes strings and gates timestamp coercion on the configured format. The JSON deserializer builds its nodes through NewJsonDocument, so neither leaf is nameable outside that translation unit. ReadDocument now returns shared_ptr<const Document> and document collections carry shared_ptr<const Document>. Coercion, timestamp-format gating, CBOR trait-ignore adherence, and the numeric overflow guards are unchanged.
sbaluja
marked this pull request as ready for review
October 6, 2026 15:10
sbiscigl
approved these changes
Oct 6, 2026
sbiscigl
left a comment
Collaborator
There was a problem hiding this comment.
fix and or not, and ship
| public: | ||
| explicit CodecSettings(TimestampFormatTrait::Format defaultTimestampFormat) : m_defaultTimestampFormat(defaultTimestampFormat) {} | ||
|
|
||
| // Payload defaults per the SEP's codec-settings-by-protocol table. |
Collaborator
There was a problem hiding this comment.
per the SEP's
nit: language leaking in comments
| const Aws::String token = ReadNumberToken(); | ||
| char* end = nullptr; | ||
| if (token.find_first_of(".eE") != Aws::String::npos) { | ||
| const double d = std::strtod(token.c_str(), &end); |
Collaborator
There was a problem hiding this comment.
use StringUtils::ConvertToDouble instead to hide the std implementation and we already have that
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Description of changes:
Check all that applies:
Check which platforms you have built SDK on to verify the correctness of this PR.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.