Make nullable fields optional in CurseForge schemas
This commit is contained in:
parent
9a15a99ba1
commit
9658773fa2
@ -139,7 +139,7 @@ export const CurseForgeFileSchema = z.object({
|
||||
/** 父项目文件 ID,无则为 null 或被省略 */
|
||||
parentProjectFileId: z.number().int().nullable().optional(),
|
||||
/** 替代文件 ID,无则为 null */
|
||||
alternateFileId: z.number().int().nullable(),
|
||||
alternateFileId: z.number().int().nullable().optional(),
|
||||
/** 是否为服务端整合包 */
|
||||
isServerPack: z.boolean().nullable().optional(),
|
||||
/** 服务端整合包文件 ID,无则为 null 或被省略 */
|
||||
|
||||
@ -23,7 +23,7 @@ export const GameVersionSchema = z.object({
|
||||
/** 版本标识,如 "1-21-5" */
|
||||
slug: z.string(),
|
||||
/** API 版本号,无则为 null 或空字符串 */
|
||||
apiVersion: z.string().nullable(),
|
||||
apiVersion: z.string().nullable().optional(),
|
||||
});
|
||||
export type GameVersion = z.infer<typeof GameVersionSchema>;
|
||||
// endregion
|
||||
|
||||
@ -2,6 +2,7 @@ import { z } from "zod";
|
||||
import {
|
||||
FileReleaseTypeSchema,
|
||||
CurseForgeFileSchema,
|
||||
ModLoaderTypeSchema,
|
||||
} from "./files";
|
||||
|
||||
// region ModStatus — 项目状态
|
||||
@ -81,11 +82,11 @@ export const CategorySchema = z.object({
|
||||
/** 最后修改时间(ISO-8601) */
|
||||
dateModified: z.string(),
|
||||
/** 是否为顶层分类 */
|
||||
isClass: z.boolean().nullable(),
|
||||
isClass: z.boolean().nullable().optional(),
|
||||
/** 所属 class ID */
|
||||
classId: z.number().int().nullable(),
|
||||
classId: z.number().int().nullable().optional(),
|
||||
/** 父分类 ID */
|
||||
parentCategoryId: z.number().int().nullable(),
|
||||
parentCategoryId: z.number().int().nullable().optional(),
|
||||
/** 显示排序索引 */
|
||||
displayIndex: z.number().int().nullable().optional(),
|
||||
});
|
||||
@ -103,9 +104,9 @@ export const FileIndexSchema = z.object({
|
||||
/** 发布类型 */
|
||||
releaseType: FileReleaseTypeSchema,
|
||||
/** 版本类型 ID */
|
||||
gameVersionTypeId: z.number().int().nullable(),
|
||||
gameVersionTypeId: z.number().int().nullable().optional(),
|
||||
/** Mod Loader 类型(数值,API 可能返回未在文档中列出的值,也可能省略) */
|
||||
modLoader: z.number().int().optional(),
|
||||
modLoader: ModLoaderTypeSchema.optional(),
|
||||
});
|
||||
export type FileIndex = z.infer<typeof FileIndexSchema>;
|
||||
// endregion
|
||||
@ -135,7 +136,7 @@ export const ModSchema = z.object({
|
||||
/** 分类列表 */
|
||||
categories: z.array(CategorySchema),
|
||||
/** 所属 class ID,无则为 null */
|
||||
classId: z.number().int().nullable(),
|
||||
classId: z.number().int().nullable().optional(),
|
||||
/** 作者列表 */
|
||||
authors: z.array(ModAuthorSchema),
|
||||
/** Logo 资源 */
|
||||
@ -157,7 +158,7 @@ export const ModSchema = z.object({
|
||||
/** 发布时间(ISO-8601) */
|
||||
dateReleased: z.string(),
|
||||
/** 是否允许分发 */
|
||||
allowModDistribution: z.boolean().nullable(),
|
||||
allowModDistribution: z.boolean().nullable().optional(),
|
||||
/** 游戏内热门排名 */
|
||||
gamePopularityRank: z.number().int(),
|
||||
/** 是否可被搜索到 */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user