Commit 19891e5
Fix Java codegen and build failures after @github/copilot update
The new @github/copilot schemas introduced cross-schema $ref references
in api.schema.json pointing to session-events.schema.json definitions:
- session-events.schema.json#/definitions/SessionEvent
- session-events.schema.json#/definitions/PermissionPromptRequest
The code generator only handled local #/definitions/ refs, causing invalid
Java type names to be emitted (the raw $ref string), which produced
compilation errors:
PendingPermissionRequest.java: illegal character '#'
SessionEventLogReadResult.java: '<identifier> expected', etc.
Fix in java/scripts/codegen/java.ts:
- Track generated session-events type names in generatedSessionEventsTypes
- Store session-events definitions in sessionEventsDefinitions
- In schemaTypeToJava, detect cross-schema refs and resolve them:
- If the type is already generated in the session-events package
(e.g. SessionEvent), emit it with the correct import
- Otherwise resolve inline using the external definitions
(anyOf unions like PermissionPromptRequest fall back to Object)
Regenerated affected files:
PendingPermissionRequest.java: request field now typed as Object
SessionEventLogReadResult.java: events field now typed as List<SessionEvent>
Automated fix applied by java-codegen-fix workflow.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent cb8a3fd commit 19891e5
3 files changed
Lines changed: 42 additions & 2 deletions
File tree
- java
- scripts/codegen
- src/generated/java/com/github/copilot/sdk/generated/rpc
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
105 | 112 | | |
106 | 113 | | |
107 | 114 | | |
| |||
131 | 138 | | |
132 | 139 | | |
133 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
134 | 163 | | |
135 | 164 | | |
136 | 165 | | |
| |||
314 | 343 | | |
315 | 344 | | |
316 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
317 | 350 | | |
318 | 351 | | |
319 | 352 | | |
320 | 353 | | |
321 | 354 | | |
322 | 355 | | |
| 356 | + | |
| 357 | + | |
323 | 358 | | |
324 | 359 | | |
325 | 360 | | |
326 | 361 | | |
| 362 | + | |
327 | 363 | | |
328 | 364 | | |
329 | 365 | | |
330 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
331 | 370 | | |
332 | 371 | | |
333 | 372 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
0 commit comments