Commit add35a6
committed
Apply Copilot review comments.
modified: scripts/codegen/java.ts
### 18:24 Prompt
Consider these Copilot review comments, all about `java.ts`
- Lines 167 - 178
> The generator passes required=true when generating container element/value types (List<T>, Map<String, V>). This can produce illegal Java generic types like List<long> / Map<String, boolean> when the schema item type is integer/boolean/number, causing generated code not to compile. Fix by ensuring container element/value types are always boxed (e.g., call schemaTypeToJava(..., false, ...) for items and additionalProperties value schemas, or add a dedicated “box primitives in generics” step).
### 18:29 Prompt
Consider these Copilot review comments, all about `java.ts`
- Lines 193 - 201
> The generator passes required=true when generating container element/value types (List<T>, Map<String, V>). This can produce illegal Java generic types like List<long> / Map<String, boolean> when the schema item type is integer/boolean/number, causing generated code not to compile. Fix by ensuring container element/value types are always boxed (e.g., call schemaTypeToJava(..., false, ...) for items and additionalProperties value schemas, or add a dedicated “box primitives in generics” step).
### 18:31 Prompt
Consider these Copilot review comments, all about `java.ts`
- Lines 1258 - 1261
> RpcMapper.INSTANCE is a plain new ObjectMapper() with no modules. Generated RPC DTOs can include OffsetDateTime (your type mapping emits it for format: date-time), and ObjectMapper.valueToTree(...) used by session wrappers can fail without JavaTimeModule registered. Fix by configuring this shared mapper consistently (e.g., register com.fasterxml.jackson.datatype.jsr310.JavaTimeModule, and align any other ObjectMapper features needed by the SDK).
### 18:34 Prompt
Consider these Copilot review comments, all about `java.ts`
- Lines 1202 - 1207
> This comment is likely incorrect/misleading: Java lambdas can generally target a functional interface whose single abstract method is generic (the compiler can still infer the type parameter from the call site). Consider removing this claim or rephrasing it to a neutral recommendation (e.g., “method reference is typical/clear”) so consumers aren’t discouraged from valid usage.
Copilot suggests:
```typescript
lines.push(` * (e.g., a {@code JsonRpcClient} instance). A method reference is typically the clearest`);
lines.push(` * way to adapt a generic {@code invoke} method to this interface:`);
lines.push(` * <pre>{@code`);
lines.push(` * RpcCaller caller = jsonRpcClient::invoke;`);
lines.push(` * }</pre>`);
```
What can we do about this?
### 18:36 Prompt
Consider these Copilot review comments, all about `java.ts`
- Lines 848 - 854
> For session-scoped RPC methods with additional params, the generated *Params records still include a sessionId field (because they’re generated directly from the schema), but the wrapper then overwrites sessionId via _p.put("sessionId", this.sessionId). This duplication is confusing for API consumers and makes the param records look “callable” with arbitrary session IDs when they are not. Consider adjusting generation so sessionId is omitted from session-scoped params records (and only injected by SessionRpc), or documenting clearly in the generated Javadoc that any provided sessionId is ignored/overridden.
Copilot suggests:
```typescript
* Return the wrapper-visible parameter property names for a method.
* For session-scoped wrappers, sessionId is injected by SessionRpc and is not
* considered a user-supplied parameter.
*/
function wrapperParamPropertyNames(method: RpcMethodNode, isSession: boolean): string[] {
if (!method.params || typeof method.params !== "object") return [];
const props = method.params.properties ?? {};
return Object.keys(props).filter((k) => !(isSession && k === "sessionId"));
}
/**
* Return the params class name if the method has wrapper-visible properties
* (i.e. user-supplied parameters after filtering out injected sessionId for
* session-scoped wrappers).
*/
function wrapperParamsClassName(method: RpcMethodNode, isSession: boolean): string | null {
const userProps = wrapperParamPropertyNames(method, isSession);
```
What can we do about this?
### 18:40 Prompt
Consider these Copilot review comments, all about `java.ts`
- Lines 903 - 915
> For session-scoped RPC methods with additional params, the generated *Params records still include a sessionId field (because they’re generated directly from the schema), but the wrapper then overwrites sessionId via _p.put("sessionId", this.sessionId). This duplication is confusing for API consumers and makes the param records look “callable” with arbitrary session IDs when they are not. Consider adjusting generation so sessionId is omitted from session-scoped params records (and only injected by SessionRpc), or documenting clearly in the generated Javadoc that any provided sessionId is ignored/overridden.
What can we do about this? This seems the same as the previous comment. No?
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/RpcCaller.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/RpcMapper.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentApi.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsApi.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsApi.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFleetApi.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryApi.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpApi.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModeApi.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelApi.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsApi.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanApi.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRpc.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellApi.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsApi.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsApi.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiApi.java
modified: src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspaceApi.java
- Regenerated.
Signed-off-by: Ed Burns <edburns@microsoft.com>1 parent 0beb1d8 commit add35a6
File tree
19 files changed
+81
-10
lines changed- scripts/codegen
- src/generated/java/com/github/copilot/sdk/generated/rpc
19 files changed
+81
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
| 171 | + | |
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
| |||
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
197 | | - | |
| 198 | + | |
| 199 | + | |
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
| |||
885 | 887 | | |
886 | 888 | | |
887 | 889 | | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
888 | 895 | | |
889 | 896 | | |
890 | 897 | | |
| |||
1199 | 1206 | | |
1200 | 1207 | | |
1201 | 1208 | | |
1202 | | - | |
| 1209 | + | |
| 1210 | + | |
1203 | 1211 | | |
1204 | 1212 | | |
1205 | 1213 | | |
1206 | | - | |
1207 | | - | |
1208 | 1214 | | |
1209 | 1215 | | |
1210 | 1216 | | |
| |||
1256 | 1262 | | |
1257 | 1263 | | |
1258 | 1264 | | |
1259 | | - | |
| 1265 | + | |
1260 | 1266 | | |
1261 | 1267 | | |
1262 | 1268 | | |
| |||
Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments