(schema: JSONSchema7)
| 563 | } |
| 564 | |
| 565 | function 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 | |
| 587 | function getGoSharedEventEnvelopeProperties(schema: JSONSchema7, ctx: GoCodegenCtx): GoEventEnvelopeProperty[] { |
| 588 | return getSharedSessionEventEnvelopeProperties(schema, ctx.definitions) |
no test coverage detected
searching dependent graphs…