Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/aws-cpp-sdk-core/include/smithy/client/schema/Schema.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <aws/core/utils/memory/stl/AWSString.h>
#include <smithy/client/schema/XmlTraits.h>

#include <cstdint>

Expand Down Expand Up @@ -48,13 +49,23 @@ class Schema {

uint16_t GetMemberCount() const { return m_memberCount; }

// XML traits accessor
const XmlTraits* GetXmlTraits() const { return m_xmlTraits; }

// Builder-style setter for XML traits pointer (used by codegen)
Schema& WithXmlTraits(const XmlTraits* traits) {
m_xmlTraits = traits;
return *this;
}

private:
const char* m_id = nullptr;
ShapeType m_type = ShapeType::Structure;
Aws::String m_memberName;
int m_memberIndex = 0;
const Schema* m_members = nullptr;
uint16_t m_memberCount = 0;
const XmlTraits* m_xmlTraits = nullptr;
};

} // namespace schema
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <aws/core/client/AWSError.h>
#include <aws/core/utils/memory/AWSMemory.h>
#include <smithy/Smithy_EXPORTS.h>
#include <smithy/client/schema/ShapeSerializer.h>
Expand All @@ -9,6 +10,7 @@ namespace schema {

class SMITHY_API XmlShapeSerializer final : public ShapeSerializer {
public:
using SerializerOutcome = Aws::Utils::Outcome<Aws::String, Aws::Client::AWSError<Aws::Client::CoreErrors>>;
XmlShapeSerializer();
~XmlShapeSerializer();

Expand All @@ -25,6 +27,8 @@ class SMITHY_API XmlShapeSerializer final : public ShapeSerializer {
void WriteEnum(const Schema& schema, int value) override;
void WriteNull(const Schema& schema) override;

void WriteAttribute(const Schema& schema, const Aws::String& value);

bool BeginList(const Schema& schema, size_t count) override;
void EndList() override;

Expand All @@ -35,7 +39,7 @@ class SMITHY_API XmlShapeSerializer final : public ShapeSerializer {
bool BeginNestedStructure(const Schema& schema) override;
void EndNestedStructure() override;

Aws::String GetPayload() const;
SerializerOutcome GetPayload();

private:
class Impl;
Expand Down
30 changes: 30 additions & 0 deletions src/aws-cpp-sdk-core/include/smithy/client/schema/XmlTraits.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once

#include <aws/core/utils/memory/stl/AWSString.h>

namespace smithy {
namespace schema {

/**
* XML-specific traits for a Schema member.
* Instances should be declared as static const and referenced via pointer from Schema.
* Zero cost for non-XML services (Schema just holds a null pointer).
*/
struct XmlTraits {
Aws::String xmlName; // @xmlName override (empty = use member name)
Aws::String listItemName; // element name for list items (default: "member")
Aws::String mapEntryName; // element name for map entries (default: "entry")
Aws::String mapKeyName; // element name for map keys (default: "key")
Aws::String mapValueName; // element name for map values (default: "value")
Aws::String namespaceUri; // @xmlNamespace URI
Aws::String namespacePrefix; // @xmlNamespace prefix (empty = default namespace)
bool flattened = false; // @xmlFlattened
bool isAttribute = false; // @xmlAttribute
};

} // namespace schema
} // namespace smithy
Loading
Loading