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

Function extractGoEventVariants

scripts/codegen/go.ts:565–585  ·  view source on GitHub ↗
(schema: JSONSchema7)

Source from the content-addressed store, hash-verified

563}
564
565function extractGoEventVariants(schema: JSONSchema7): GoEventVariant[] {
566 const definitionCollections = collectDefinitionCollections(schema as Record<string, unknown>);
567 return getSessionEventVariantSchemas(schema, definitionCollections)
568 .map((variant) => {
569 const typeSchema = variant.properties!.type as JSONSchema7;
570 const typeName = typeSchema?.const as string;
571 if (!typeName) throw new Error("Variant must have type.const");
572 const dataSchema =
573 resolveObjectSchema(variant.properties!.data as JSONSchema7, definitionCollections) ??
574 resolveSchema(variant.properties!.data as JSONSchema7, definitionCollections) ??
575 ((variant.properties!.data as JSONSchema7) || {});
576 return {
577 typeName,
578 dataClassName: `${toPascalCase(typeName)}Data`,
579 dataSchema,
580 dataDescription: dataSchema.description,
581 eventExperimental: isSchemaExperimental(variant),
582 dataExperimental: isSchemaExperimental(dataSchema),
583 };
584 });
585}
586
587function getGoSharedEventEnvelopeProperties(schema: JSONSchema7, ctx: GoCodegenCtx): GoEventEnvelopeProperty[] {
588 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…