(
schema: JSONSchema7,
definitionCollections: DefinitionCollections = collectDefinitionCollections(schema as Record<string, unknown>)
)
| 1151 | } |
| 1152 | |
| 1153 | export 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 | |
| 1172 | export function getSharedSessionEventEnvelopeProperties( |
| 1173 | schema: JSONSchema7, |
no test coverage detected
searching dependent graphs…