Skip to content

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

Draft
pulimsr wants to merge 1 commit into
mainfrom
schema-serde
Draft

splitting Schema into a base class with a builder and factories#3895
pulimsr wants to merge 1 commit 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

// spent. Move-only; obtained from Schema::StructureBuilder and friends.
class SMITHY_API SchemaBuilder {
public:
~SchemaBuilder();

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: needs virutal

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

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