splitting Schema into a base class with a builder and factories - #3895
splitting Schema into a base class with a builder and factories#3895pulimsr wants to merge 4 commits into
Conversation
| 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; } |
There was a problem hiding this comment.
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.
| if (it == m_nameToIndex.end()) { | ||
| return nullptr; | ||
| } | ||
| return m_members[it->second].get(); |
There was a problem hiding this comment.
dont use the [] operator on a map, it has surprising results
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
how does the caller know it error-ed?
| m_errorMessage = "Maximum nesting depth exceeded"; | ||
| return false; | ||
| SerializerOutcome GetPayload() { | ||
| if (m_finalized || !m_errorMessage.empty()) { |
There was a problem hiding this comment.
ohhhhhhh on get playload we return the error, i like that
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.