MCPcopy Index your code
hub / github.com/github/copilot-sdk / getSessionEventVariantSchemas

Function getSessionEventVariantSchemas

scripts/codegen/utils.ts:1153–1170  ·  view source on GitHub ↗
(
    schema: JSONSchema7,
    definitionCollections: DefinitionCollections = collectDefinitionCollections(schema as Record<string, unknown>)
)

Source from the content-addressed store, hash-verified

1151}
1152
1153export function getSessionEventVariantSchemas(
1154 schema: JSONSchema7,
1155 definitionCollections: DefinitionCollections = collectDefinitionCollections(schema as Record<string, unknown>)
1156): JSONSchema7[] {
1157 const sessionEvent =
1158 resolveSchema({ $ref: "#/definitions/SessionEvent" }, definitionCollections) ??
1159 resolveSchema({ $ref: "#/$defs/SessionEvent" }, definitionCollections);
1160 if (!sessionEvent?.anyOf) throw new Error("Schema must have SessionEvent definition with anyOf");
1161
1162 return (sessionEvent.anyOf as JSONSchema7[]).map((variant) => {
1163 const resolvedVariant =
1164 resolveObjectSchema(variant, definitionCollections) ??
1165 resolveSchema(variant, definitionCollections) ??
1166 variant;
1167 if (typeof resolvedVariant !== "object" || !resolvedVariant.properties) throw new Error("Invalid event variant");
1168 return resolvedVariant;
1169 });
1170}
1171
1172export function getSharedSessionEventEnvelopeProperties(
1173 schema: JSONSchema7,

Callers 4

extractEventVariantsFunction · 0.85
extractGoEventVariantsFunction · 0.85
extractPyEventVariantsFunction · 0.85

Calls 3

resolveSchemaFunction · 0.85
resolveObjectSchemaFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…