chore: 清理macOS同步产生的重复文件
详细说明: - 删除了352个带数字后缀的重复文件 - 更新.gitignore防止未来产生此类文件 - 这些文件是由iCloud或其他同步服务冲突产生的 - 不影响项目功能,仅清理冗余文件
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
export type * from './types';
|
||||
export { jsonSchemaToZod } from './json-schema-to-zod';
|
||||
@@ -1,15 +0,0 @@
|
||||
import type { z } from 'zod';
|
||||
|
||||
import { parseSchema } from './parsers/parse-schema';
|
||||
import type { JsonSchemaToZodOptions, JsonSchema } from './types';
|
||||
|
||||
export const jsonSchemaToZod = <T extends z.ZodTypeAny = z.ZodTypeAny>(
|
||||
schema: JsonSchema,
|
||||
options: JsonSchemaToZodOptions = {},
|
||||
): T => {
|
||||
return parseSchema(schema, {
|
||||
path: [],
|
||||
seen: new Map(),
|
||||
...options,
|
||||
}) as T;
|
||||
};
|
||||
@@ -1,82 +0,0 @@
|
||||
import type { ZodTypeAny } from 'zod';
|
||||
|
||||
export type Serializable =
|
||||
| { [key: string]: Serializable }
|
||||
| Serializable[]
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null;
|
||||
|
||||
export type JsonSchema = JsonSchemaObject | boolean;
|
||||
export type JsonSchemaObject = {
|
||||
// left permissive by design
|
||||
type?: string | string[];
|
||||
|
||||
// object
|
||||
properties?: { [key: string]: JsonSchema };
|
||||
additionalProperties?: JsonSchema;
|
||||
unevaluatedProperties?: JsonSchema;
|
||||
patternProperties?: { [key: string]: JsonSchema };
|
||||
minProperties?: number;
|
||||
maxProperties?: number;
|
||||
required?: string[] | boolean;
|
||||
propertyNames?: JsonSchema;
|
||||
|
||||
// array
|
||||
items?: JsonSchema | JsonSchema[];
|
||||
additionalItems?: JsonSchema;
|
||||
minItems?: number;
|
||||
maxItems?: number;
|
||||
uniqueItems?: boolean;
|
||||
|
||||
// string
|
||||
minLength?: number;
|
||||
maxLength?: number;
|
||||
pattern?: string;
|
||||
format?: string;
|
||||
|
||||
// number
|
||||
minimum?: number;
|
||||
maximum?: number;
|
||||
exclusiveMinimum?: number | boolean;
|
||||
exclusiveMaximum?: number | boolean;
|
||||
multipleOf?: number;
|
||||
|
||||
// unions
|
||||
anyOf?: JsonSchema[];
|
||||
allOf?: JsonSchema[];
|
||||
oneOf?: JsonSchema[];
|
||||
|
||||
if?: JsonSchema;
|
||||
then?: JsonSchema;
|
||||
else?: JsonSchema;
|
||||
|
||||
// shared
|
||||
const?: Serializable;
|
||||
enum?: Serializable[];
|
||||
|
||||
errorMessage?: { [key: string]: string | undefined };
|
||||
|
||||
description?: string;
|
||||
default?: Serializable;
|
||||
readOnly?: boolean;
|
||||
not?: JsonSchema;
|
||||
contentEncoding?: string;
|
||||
nullable?: boolean;
|
||||
};
|
||||
|
||||
export type ParserSelector = (schema: JsonSchemaObject, refs: Refs) => ZodTypeAny;
|
||||
export type ParserOverride = (schema: JsonSchemaObject, refs: Refs) => ZodTypeAny | undefined;
|
||||
|
||||
export type JsonSchemaToZodOptions = {
|
||||
withoutDefaults?: boolean;
|
||||
withoutDescribes?: boolean;
|
||||
parserOverride?: ParserOverride;
|
||||
depth?: number;
|
||||
};
|
||||
|
||||
export type Refs = JsonSchemaToZodOptions & {
|
||||
path: Array<string | number>;
|
||||
seen: Map<object | boolean, { n: number; r: ZodTypeAny | undefined }>;
|
||||
};
|
||||
Reference in New Issue
Block a user