Skip to content

Commit 4c9327e

Browse files
Remove redundant event type exclusion now it's handled on the runtime side
Co-Authored-By: SteveSandersonMS <1101362+SteveSandersonMS@users.noreply.github.com>
1 parent d5dbff0 commit 4c9327e

3 files changed

Lines changed: 6 additions & 22 deletions

File tree

scripts/codegen/csharp.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
getSessionEventsSchemaPath,
1919
isNodeFullyExperimental,
2020
isRpcMethod,
21-
EXCLUDED_EVENT_TYPES,
2221
REPO_ROOT,
2322
writeGeneratedFile,
2423
type ApiSchema,
@@ -240,8 +239,7 @@ function extractEventVariants(schema: JSONSchema7): EventVariant[] {
240239
dataSchema,
241240
dataDescription: dataSchema?.description,
242241
};
243-
})
244-
.filter((v) => !EXCLUDED_EVENT_TYPES.has(v.typeName));
242+
});
245243
}
246244

247245
/**

scripts/codegen/go.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { FetchingJSONSchemaStore, InputData, JSONSchemaInput, quicktype } from "
1313
import { promisify } from "util";
1414
import {
1515
applyTitleSuggestions,
16-
EXCLUDED_EVENT_TYPES,
1716
getApiSchemaPath,
1817
getRpcSchemaTypeName,
1918
getSessionEventsSchemaPath,
@@ -181,8 +180,7 @@ function extractGoEventVariants(schema: JSONSchema7): GoEventVariant[] {
181180
dataSchema,
182181
dataDescription: dataSchema.description,
183182
};
184-
})
185-
.filter((v) => !EXCLUDED_EVENT_TYPES.has(v.typeName));
183+
});
186184
}
187185

188186
/**

scripts/codegen/utils.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ const __dirname = path.dirname(__filename);
2121
/** Root of the copilot-sdk repo */
2222
export const REPO_ROOT = path.resolve(__dirname, "../..");
2323

24-
/** Event types to exclude from generation (internal/legacy types) */
25-
export const EXCLUDED_EVENT_TYPES = new Set(["session.import_legacy"]);
26-
2724
// ── Schema paths ────────────────────────────────────────────────────────────
2825

2926
export async function getSessionEventsSchemaPath(): Promise<string> {
@@ -49,7 +46,7 @@ export async function getApiSchemaPath(cliArg?: string): Promise<string> {
4946

5047
/**
5148
* Post-process JSON Schema for quicktype compatibility.
52-
* Converts boolean const values to enum, filters excluded event types.
49+
* Converts boolean const values to enum.
5350
*/
5451
export function postProcessSchema(schema: JSONSchema7): JSONSchema7 {
5552
if (typeof schema !== "object" || schema === null) return schema;
@@ -81,18 +78,9 @@ export function postProcessSchema(schema: JSONSchema7): JSONSchema7 {
8178

8279
for (const combiner of ["anyOf", "allOf", "oneOf"] as const) {
8380
if (processed[combiner]) {
84-
processed[combiner] = processed[combiner]!
85-
.filter((item) => {
86-
if (typeof item !== "object") return true;
87-
const typeConst = (item as JSONSchema7).properties?.type;
88-
if (typeof typeConst === "object" && "const" in typeConst) {
89-
return !EXCLUDED_EVENT_TYPES.has(typeConst.const as string);
90-
}
91-
return true;
92-
})
93-
.map((item) =>
94-
typeof item === "object" ? postProcessSchema(item as JSONSchema7) : item
95-
) as JSONSchema7Definition[];
81+
processed[combiner] = processed[combiner]!.map((item) =>
82+
typeof item === "object" ? postProcessSchema(item as JSONSchema7) : item
83+
) as JSONSchema7Definition[];
9684
}
9785
}
9886

0 commit comments

Comments
 (0)