botbook/node_modules/json-schema-library/lib/schema/createOneOfSchemaResult.ts

18 lines
410 B
TypeScript
Raw Normal View History

2024-09-04 13:13:15 -03:00
import { JsonSchema } from "../types";
export function createOneOfSchemaResult(
schema: JsonSchema,
oneOfSchema: JsonSchema,
oneOfIndex: number
) {
const childSchema = { ...oneOfSchema };
Object.defineProperty(childSchema, "getOneOfOrigin", {
enumerable: false,
value: () => ({
index: oneOfIndex,
schema
})
});
return childSchema;
}