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

Function extractPyEventVariants

scripts/codegen/python.ts:1650–1673  ·  view source on GitHub ↗
(schema: JSONSchema7)

Source from the content-addressed store, hash-verified

1648}
1649
1650function extractPyEventVariants(schema: JSONSchema7): PyEventVariant[] {
1651 const definitionCollections = collectDefinitionCollections(schema as Record<string, unknown>);
1652 return getSessionEventVariantSchemas(schema, definitionCollections)
1653 .map((variant) => {
1654 const typeSchema = variant.properties!.type as JSONSchema7;
1655 const typeName = typeSchema?.const as string;
1656 if (!typeName) {
1657 throw new Error("Event variant must define type.const");
1658 }
1659
1660 const dataSchema =
1661 resolveObjectSchema(variant.properties!.data as JSONSchema7, definitionCollections) ??
1662 resolveSchema(variant.properties!.data as JSONSchema7, definitionCollections) ??
1663 ((variant.properties!.data as JSONSchema7) || {});
1664 return {
1665 typeName,
1666 dataClassName: `${toPascalCase(typeName)}Data`,
1667 dataSchema,
1668 dataDescription: dataSchema.description,
1669 eventExperimental: isSchemaExperimental(variant),
1670 dataExperimental: isSchemaExperimental(dataSchema),
1671 };
1672 });
1673}
1674
1675function getPySharedEventEnvelopeProperties(schema: JSONSchema7, ctx: PyCodegenCtx): PyEventEnvelopeProperty[] {
1676 return getSharedSessionEventEnvelopeProperties(schema, ctx.definitions)

Callers 1

Calls 6

resolveObjectSchemaFunction · 0.85
resolveSchemaFunction · 0.85
isSchemaExperimentalFunction · 0.85
toPascalCaseFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…