Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
07dd0c3
Add result and request specific generation
sbaluja Jul 20, 2026
90c964a
Fix correctness bugs in model codegen plugin
sbaluja Jul 21, 2026
f3f7b14
Add ModelTransform interface and TransformPipeline
sbaluja Jul 21, 2026
083710b
Extract ShapeRenderer interface and per-classification renderers
sbaluja Jul 21, 2026
0fa83b5
Wire TransformPipeline into ModelCodegenPlugin
sbaluja Jul 21, 2026
d24ead4
Deduplicate MemberRenderer public section methods
sbaluja Jul 21, 2026
60892d9
Use FileManifest API in CppWriterDelegator
sbaluja Jul 21, 2026
423bcb7
Replace wildcard imports in ShapeClassifier with explicit imports
sbaluja Jul 21, 2026
2a767d4
Add enum NOT_SET case
sbaluja Jul 27, 2026
de07f1c
Add event stream detection helpers to ShapeClassifier
sbaluja Jul 29, 2026
97bbfd6
Add event-stream serde stub helpers to SerdeStub
sbaluja Jul 29, 2026
83fca43
Add EventStreamRenderer with handler generation
sbaluja Jul 29, 2026
3839e90
Add InitialResponse generation to EventStreamRenderer
sbaluja Jul 29, 2026
e037dc9
Add EventStream union generation to EventStreamRenderer
sbaluja Jul 29, 2026
767d0b8
Add event-stream augmentation to RequestRenderer
sbaluja Jul 29, 2026
b9e58f5
Generate event stream model artifacts in Smithy codegen
sbaluja Jul 30, 2026
4f2daea
Fix utf-8 bom
sbaluja Jul 30, 2026
29d03d1
Null checks -> Optional
sbaluja Jul 30, 2026
bdb4a0c
Add characterization tests pinning generated model output per protocol
sbaluja Aug 3, 2026
e3c44f1
Add ProtocolTraits interface and JSON implementation
sbaluja Aug 3, 2026
e1362a6
Add XML ProtocolTraits implementations and traitsFor selection point
sbaluja Aug 3, 2026
af927ae
Migrate SubObjectRenderer to ProtocolTraits
sbaluja Aug 3, 2026
d8b6285
Migrate ResultRenderer to ProtocolTraits
sbaluja Aug 3, 2026
9cfda06
Migrate RequestRenderer to ProtocolTraits
sbaluja Aug 3, 2026
648ef2a
Migrate EventStreamRenderer to ProtocolTraits
sbaluja Aug 3, 2026
56bcedf
Delete SerdeStub; retarget its tests onto ProtocolTraits
sbaluja Aug 3, 2026
d104cca
Thread resolved protocol into ShapeClassifier for a single resolution…
sbaluja Aug 3, 2026
2334d4d
Remove stale plan references from codegen comments
sbaluja Aug 3, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,8 @@ private void render(CppWriter writer) {
}

private void writeHeader(CppWriter writer, String serviceName) {
writer.write("/**")
.write(" * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.")
.write(" * SPDX-License-Identifier: Apache-2.0.")
.write(" */")
.write("")
.write("// Header compilation test for " + serviceName + " " + getTestType().toLowerCase() + " headers")
// Copyright/SPDX header is emitted by CppWriterDelegator when the file is created.
writer.write("// Header compilation test for " + serviceName + " " + getTestType().toLowerCase() + " headers")
.write("// " + getTestDescription())
.write("");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ public final void render(CppWriter writer) {
}

private void writeHeader(CppWriter writer) {
writer.write("/**")
.write(" * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.")
.write(" * SPDX-License-Identifier: Apache-2.0.")
.write(" */")
.write("")
.write("#pragma once");
// Copyright/SPDX header is emitted by CppWriterDelegator when the file is created.
writer.write("#pragma once");
}

private void writeNamespaceOpen(CppWriter writer, String serviceName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ public final void write() {
}

private void writeHeader(CppWriter writer) {
writer.write("/**")
.write(" * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.")
.write(" * SPDX-License-Identifier: Apache-2.0.")
.write(" */")
.write("")
.write("#pragma once");
// Copyright/SPDX header is emitted by CppWriterDelegator when the file is created.
writer.write("#pragma once");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ public CppWriter writeInclude(String header) {
write("#include <$L>", header);
return this;
}

/**
* Writes the standard Amazon copyright / SPDX license header that begins every
* generated file, followed by a blank line.
*/
public CppWriter writeCopyright() {
write("/**");
write(" * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.");
write(" * SPDX-License-Identifier: Apache-2.0.");
write(" */");
write("");
return this;
}

public CppWriter writeNamespaceOpen(String namespace) {
openBlock("namespace $L\n{", namespace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
package com.amazonaws.util.awsclientsmithygenerator.generators;

import software.amazon.smithy.build.FileManifest;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;

public class CppWriterDelegator {
/** UTF-8 byte order mark (U+FEFF), prepended to every file to match C2J-generated output. */
private static final String UTF8_BOM = "\uFEFF";

private final FileManifest fileManifest;
private final Map<String, CppWriter> writers = new HashMap<>();

Expand All @@ -19,21 +21,18 @@ public CppWriterDelegator(FileManifest fileManifest) {
}

public void useFileWriter(String filename, Consumer<CppWriter> writerConsumer) {
CppWriter writer = writers.computeIfAbsent(filename, k -> new CppWriter());
// Every generated file begins with the standard copyright/SPDX header. Emit it once,
// when the writer is first created, so callers don't repeat it (and reopening a file
// for appending does not duplicate it).
CppWriter writer = writers.computeIfAbsent(filename, k -> new CppWriter().writeCopyright());
writerConsumer.accept(writer);
}

public void flushWriters() {
writers.forEach((filename, writer) -> {
try {
Path outputPath = fileManifest.getBaseDir().resolve(filename);
java.nio.file.Files.createDirectories(outputPath.getParent());
// Add UTF-8 BOM to match C2J-generated file format
String content = "" + writer.toString();
java.nio.file.Files.writeString(outputPath, content);
} catch (Exception e) {
throw new RuntimeException("Failed to write file: " + filename, e);
}
// Add UTF-8 BOM to match C2J-generated file format
String content = UTF8_BOM + writer.toString();
fileManifest.writeFile(filename, content);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static String capitalize(String str) {
}

// Match C2jModelToGeneratorModelTransformer.sanitizeServiceAbbreviation() exactly
private static String sanitizeServiceAbbreviation(String serviceAbbreviation) {
public static String sanitizeServiceAbbreviation(String serviceAbbreviation) {
return serviceAbbreviation.replace(" ", "").replace("-", "").replace("_", "").replace("Amazon", "").replace("AWS", "").replace("/", "");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ public static Optional<String> getDefaultValue(Shape shape) {
return Optional.empty();
}

/**
* Returns true if the shape maps to a C++ primitive type (int, long long, bool, double).
*
* @param shape the shape to check
* @return true if the shape is a primitive type
*/
public static boolean isPrimitive(Shape shape) {
return shape.isIntegerShape() || shape.isLongShape()
|| shape.isBooleanShape() || shape.isDoubleShape() || shape.isFloatShape();
}

/**
* Returns true if the shape type requires a "has been set" tracking flag.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ public static void renderHeader(CppWriter writer, Shape enumShape, String servic
String enumName = enumShape.getId().getName();
List<String> values = getEnumValues(enumShape);

writer.write("/**");
writer.write(" * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.");
writer.write(" * SPDX-License-Identifier: Apache-2.0.");
writer.write(" */");
writer.write("");
writer.write("#pragma once");
writer.write("#include <aws/core/utils/memory/stl/AWSString.h>");
writer.write("#include <aws/$1L/$2L_EXPORTS.h>",
Expand Down Expand Up @@ -107,11 +102,6 @@ public static void renderSource(CppWriter writer, Shape enumShape, String servic
List<String> values = getEnumValues(enumShape);
List<String> wireValues = getEnumWireValues(enumShape);

writer.write("/**");
writer.write(" * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.");
writer.write(" * SPDX-License-Identifier: Apache-2.0.");
writer.write(" */");
writer.write("");
writer.write("#include <aws/$1L/model/$2L.h>", projectName, enumName);
writer.write("#include <aws/core/utils/HashingUtils.h>");
writer.write("#include <aws/core/Globals.h>");
Expand Down Expand Up @@ -151,16 +141,18 @@ public static void renderSource(CppWriter writer, Shape enumShape, String servic
writer.write("");

// GetNameFor
writer.write(" Aws::String GetNameFor$1L($1L value) {", enumName);
writer.write(" switch (value) {");
writer.write(" Aws::String GetNameFor$1L($1L enumValue) {", enumName);
writer.write(" switch (enumValue) {");
writer.write(" case $1L::NOT_SET:", enumName);
writer.write(" return {};");
for (int i = 0; i < values.size(); i++) {
writer.write(" case $1L::$2L:", enumName, values.get(i));
writer.write(" return \"$L\";", wireValues.get(i));
}
writer.write(" default:");
writer.write(" EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();");
writer.write(" if (overflowContainer) {");
writer.write(" return overflowContainer->RetrieveOverflow(static_cast<int>(value));");
writer.write(" return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));");
writer.write(" }");
writer.write(" return {};");
writer.write(" }");
Expand Down Expand Up @@ -215,11 +207,11 @@ private static List<String> getEnumWireValues(Shape enumShape) {
"atomic_cancel", "atomic_commit", "atomic_noexcept", "auto",
"bitand", "bitor", "bool", "break", "case", "catch", "char",
"char16_t", "char32_t", "class", "compl", "concept", "const",
"constexpr", "const_cast", "continue", "co_await", "co_return", "co_yeild",
"constexpr", "const_cast", "continue", "co_await", "co_return", "co_yield",
"decltype", "default", "delete", "do", "double", "dynamic_cast",
"else", "enum", "explicit", "export", "extern", "false", "float",
"for", "friend", "goto", "if", "import", "inline", "int", "long",
"moduel", "mutable", "namespace", "new", "noexcept", "not", "not_eq",
"module", "mutable", "namespace", "new", "noexcept", "not", "not_eq",
"nullptr", "operator", "or", "or_eq", "private", "protected", "public",
"reflexpr", "register", "reinterpret_cast", "requires", "return",
"short", "signed", "sizeof", "static", "static_assert", "static_cast",
Expand Down
Loading
Loading