initial refactor

This commit is contained in:
dswbx
2025-06-21 13:35:58 +02:00
parent b2086c4da7
commit 42edce904f
93 changed files with 1021 additions and 1216 deletions
+5 -5
View File
@@ -1,11 +1,11 @@
import type { Static, TObject } from "core/utils";
import type { JSONSchema7 } from "json-schema";
import { cloneDeep, omit, pick } from "lodash-es";
import type { s } from "core/object/schema";
export function extractSchema<
Schema extends TObject,
Schema extends s.ObjectSchema,
Keys extends keyof Schema["properties"],
Config extends Static<Schema>,
Config extends s.Static<Schema>,
>(
schema: Schema,
config: Config,
@@ -22,12 +22,12 @@ export function extractSchema<
},
] {
if (!schema.properties) {
return [{ ...schema }, config, {} as any];
return [{ ...schema.toJSON() }, config, {} as any];
}
const newSchema = cloneDeep(schema);
const updated = {
...newSchema,
...newSchema.toJSON(),
properties: omit(newSchema.properties, keys),
};
if (updated.required) {