Skip to content

Commit e3598b5

Browse files
committed
Fix compilation failure.
modified: scripts/codegen/java.ts modified: src/generated/java/com/github/copilot/sdk/generated/rpc/RpcMapper.java Clean run. The fix was: RpcMapper now constructs its own ObjectMapper with the same configuration as JsonRpcClient's mapper, instead of trying to call JsonRpcClient.getObjectMapper() across packages (which failed because JsonRpcClient is package-private). Signed-off-by: Ed Burns <edburns@microsoft.com>
1 parent add35a6 commit e3598b5

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

scripts/codegen/java.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,14 +1255,24 @@ async function generateRpcMapperClass(packageName: string, packageDir: string):
12551255
lines.push(` * <p>`);
12561256
lines.push(` * {@link com.fasterxml.jackson.databind.ObjectMapper} is thread-safe and expensive to`);
12571257
lines.push(` * instantiate, so a single shared instance is used across all generated API classes.`);
1258+
lines.push(` * The configuration mirrors {@code JsonRpcClient}'s mapper (JavaTimeModule, lenient`);
1259+
lines.push(` * unknown-property handling, ISO date format, NON_NULL inclusion).`);
12581260
lines.push(` *`);
12591261
lines.push(` * @since 1.0.0`);
12601262
lines.push(` */`);
12611263
lines.push(GENERATED_ANNOTATION);
12621264
lines.push(`final class RpcMapper {`);
12631265
lines.push(``);
1264-
lines.push(` static final com.fasterxml.jackson.databind.ObjectMapper INSTANCE =`);
1265-
lines.push(` com.github.copilot.sdk.JsonRpcClient.getObjectMapper();`);
1266+
lines.push(` static final com.fasterxml.jackson.databind.ObjectMapper INSTANCE = createMapper();`);
1267+
lines.push(``);
1268+
lines.push(` private static com.fasterxml.jackson.databind.ObjectMapper createMapper() {`);
1269+
lines.push(` com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();`);
1270+
lines.push(` mapper.registerModule(new com.fasterxml.jackson.datatype.jsr310.JavaTimeModule());`);
1271+
lines.push(` mapper.configure(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);`);
1272+
lines.push(` mapper.configure(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);`);
1273+
lines.push(` mapper.setDefaultPropertyInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL);`);
1274+
lines.push(` return mapper;`);
1275+
lines.push(` }`);
12661276
lines.push(``);
12671277
lines.push(` private RpcMapper() {}`);
12681278
lines.push(`}`);

src/generated/java/com/github/copilot/sdk/generated/rpc/RpcMapper.java

Lines changed: 12 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)