Skip to content

Commit

Permalink
give up on localservice
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmcdonald3 committed Aug 9, 2024
1 parent ed14e47 commit 6c3e6d2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@

public class AwsSdkCodegenConstants {
public static String AWS_SDK_CODEGEN_SYMBOLWRITER_DUMP_FILE_FILENAME = "awssdk_codegen_todelete.tmp";

// boto3 models `Timestamp` Smithy objects as `datetime.datetime` objects
// with millisecond precision masquerading as microsecond precision;
// e.x. datetime.datetime(2024, 6, 14, 16, 40, 15, 761000, tzinfo=tzlocal())
// --> 761000 is actually just 761 ms, but boto3 reports it with microsecond precision.
public static String BOTO3_TIMESTAMP_STRING_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ";
}
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@ public String enumShape(EnumShape shape) {

@Override
public String timestampShape(TimestampShape shape) {
throw new UnsupportedOperationException("TimestampShape from within a LocalService not supported");
writer.addStdlibImport("datetime", "datetime");
return "datetime.fromisoformat(%1$s.VerbatimString(False))".formatted(
dataSource
);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,13 @@ public String enumShape(EnumShape shape) {
);
}

@Override
public String timestampShape(TimestampShape shape) {
throw new UnsupportedOperationException("TimestampShape from within a LocalService not supported");
}
@Override
public String timestampShape(TimestampShape shape) {
writer.addStdlibImport("_dafny");
return "_dafny.Seq(%1$s.isoformat())".formatted(
dataSource
);
}

@Override
public String unionShape(UnionShape unionShape) {
Expand Down

0 comments on commit 6c3e6d2

Please sign in to comment.