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

Function extractEventVariants

scripts/codegen/csharp.ts:631–653  ·  view source on GitHub ↗
(schema: JSONSchema7)

Source from the content-addressed store, hash-verified

629}
630
631function extractEventVariants(schema: JSONSchema7): EventVariant[] {
632 const definitionCollections = collectDefinitionCollections(schema as Record<string, unknown>);
633 return getSessionEventVariantSchemas(schema, definitionCollections)
634 .map((variant) => {
635 const typeSchema = variant.properties!.type as JSONSchema7;
636 const typeName = typeSchema?.const as string;
637 if (!typeName) throw new Error("Variant must have type.const");
638 const baseName = typeToClassName(typeName);
639 const dataSchema =
640 resolveObjectSchema(variant.properties!.data as JSONSchema7, definitionCollections) ??
641 resolveSchema(variant.properties!.data as JSONSchema7, definitionCollections) ??
642 (variant.properties!.data as JSONSchema7);
643 return {
644 typeName,
645 className: `${baseName}Event`,
646 dataClassName: `${baseName}Data`,
647 dataSchema,
648 dataDescription: dataSchema?.description,
649 eventExperimental: isSchemaExperimental(variant),
650 dataExperimental: isSchemaExperimental(dataSchema),
651 };
652 });
653}
654
655interface DiscriminatorVariant {
656 value: unknown;

Callers 1

Calls 6

typeToClassNameFunction · 0.85
resolveObjectSchemaFunction · 0.85
resolveSchemaFunction · 0.85
isSchemaExperimentalFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…