Migration smithy initial setup#3861
Conversation
- Fix CRITICAL bug: getShapeCppName() now properly handles empty-string resolutions from HARDCODED_COLLISION_RESOLUTIONS map - Changed null-only check to check both null and empty string: resolved != null && !resolved.isEmpty() - Empty strings indicate shapes removed from model (e.g., medialive BatchUpdateScheduleResult) - Added test coverage: getHardcodedResolution and getShapeCppName for medialive empty-string case - Added ServiceNameUtil documentation comment explaining serviceMap parameter reserved for future use - Created ServiceNameUtilTest with capitalize tests
…schema-based serde)
…ub-object generation
- Register ModelCodegenPlugin in SPI file and build.gradle.kts projections - Fix CppWriter: set 2-space indent, enable trimTrailingSpaces - Fix CppWriterDelegator: add UTF-8 BOM to match C2J output - Fix CppTypeMapper: check enum before string (EnumShape extends StringShape), add default values for enum (NOT_SET), timestamp, and blob types - Fix EnumRenderer: use wire values as C++ constants (not member names), single/multi-line format based on line length - Fix MemberRenderer: non-templated setters for primitives and enums, enum-aware Add methods for lists, doc comment format escaping - Fix ModelGenerator: proper namespace structure, indent class body, class-level doc comments, Input->Request / Output->Result naming, conditional <utility> include - Fix SerdeStub: remove hardcoded indent (handled by writer) - Update EnumRendererTest for new format
| // Capital "Headers" is always renamed (no service exclusions) | ||
| return "headerValues"; | ||
| } | ||
| return null; |
There was a problem hiding this comment.
dont return null ever, return a Optional<String> to force the caller to check
| return "Aws::Utils::Document"; | ||
| } | ||
| // Fallback for unrecognized shapes | ||
| return "Aws::String"; |
There was a problem hiding this comment.
should we throw a exception if we dont recognize the shape instead of falling back to string?
| if (shape.isTimestampShape() || shape.isBlobShape()) { | ||
| return ""; // produces Type m_field{}; (value-initialization) | ||
| } | ||
| return null; |
There was a problem hiding this comment.
ditto about returning null
| if (shape.isDocumentShape()) { | ||
| return "<aws/core/utils/Document.h>"; | ||
| } | ||
| return null; |
| "throw", "true", "try", "typeid", "typename", "typeof", "union", | ||
| "unsigned", "using", "virtual", "void", "volatile", "wchar_t", "while", | ||
| "xor", "xor_eq", | ||
| // Platform macros |
There was a problem hiding this comment.
please throw "LINUX", "WINDOWS", "max" and "min" in here. they're just some of the ones i know dont work
| renderJsonStub(writer, className); | ||
| } else if (protocol == Protocol.REST_XML) { | ||
| renderXmlStub(writer, className); | ||
| } else { |
There was a problem hiding this comment.
noticing a lot of using a default when exausted, when in reality we likely should be throwing runtime exceptions when we know we havent reached a default, but in reality a known "bad" option. bad code gen should fail fast, not default
| * @param requestShape the operation's input structure | ||
| * @param resultShape the operation's output structure (contains the streaming union member) | ||
| */ | ||
| public record EventStreamInfo(String operationName, StructureShape requestShape, StructureShape resultShape) {} |
There was a problem hiding this comment.
public record what java version are we using? this has a hard requirement on java 16
There was a problem hiding this comment.
we use java 17 in our CI when we regenerate clients and run codegen. We also already use instanceof pattern matching in this project which is also java 16+. see here
| // Enum classification | ||
| if (shape.isEnumShape() || (shape.isStringShape() && shape.hasTrait(EnumTrait.class))) { | ||
| enums.add(shape); | ||
| continue; |
There was a problem hiding this comment.
feels like we should be doing a if else block instead of using continues
|
|
||
| class CppTypeMapperTest { | ||
|
|
||
| @Test |
There was a problem hiding this comment.
woah this is raising the bar for our codegen
Issue #, if available:
Description of changes:
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.