Skip to content

splitting Schema into a base class with a builder and factories - #3895

Open
pulimsr wants to merge 4 commits into
mainfrom
schema-serde
Open

splitting Schema into a base class with a builder and factories#3895
pulimsr wants to merge 4 commits into
mainfrom
schema-serde

Conversation

@pulimsr

@pulimsr pulimsr commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

virtual bool IsMember() const { return false; }
virtual Aws::String GetMemberName() const { return {}; }
virtual int GetMemberIndex() const { return 0; }
virtual const Schema* GetMemberTarget() const { return nullptr; }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returning a pointer, especially when the default case is nullptr is sketchy, lets return a optoinal of a shared pointer. to represent that it is missing, and to lifetime extend the pointer being returned.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

Comment thread src/aws-cpp-sdk-core/include/smithy/client/schema/SchemaBuilder.h
if (it == m_nameToIndex.end()) {
return nullptr;
}
return m_members[it->second].get();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont use the [] operator on a map, it has surprising results

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow, alright

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The [] in GetMember is vector indexing, but switched the map operator[] in AddMember to .emplace()

// element boundaries). Aggregates hand control back through a consumer callback
// so nesting is expressed by re-entrancy rather than begin/end bookkeeping.
//
// smithy-java parameterizes the list/map consumers on a caller-supplied state

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, lets not reference smithy-java directly in here, also in general lets get of overly verbose comments

Aws::Schema::WriteQuotedJsonString(m_buf, value);
void WriteList(const Schema& /*schema*/, size_t, const std::function<void(ShapeSerializer&)>& consumer) override {
if (!OpenContainer('[')) {
return;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does the caller know it error-ed?

m_errorMessage = "Maximum nesting depth exceeded";
return false;
SerializerOutcome GetPayload() {
if (m_finalized || !m_errorMessage.empty()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhhhhhh on get playload we return the error, i like that

@pulimsr
pulimsr marked this pull request as ready for review August 18, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants