feat: update schemas to support nullish values for optional fields
Gitea Auto Deploy / Deploy-Container (push) Successful in 56s
Gitea Auto Deploy / Deploy-Container (push) Successful in 56s
This commit is contained in:
@@ -93,7 +93,7 @@ export default function CharacterInfoCard({ character, selectedCharacters, onCha
|
||||
)}
|
||||
|
||||
{/* Light Cone */}
|
||||
{character.lightcone.item_id && (
|
||||
{character.lightcone.item_id !== 0 && (
|
||||
<div className="">
|
||||
<div className="rounded-lg h-42 flex items-center justify-center">
|
||||
<Image
|
||||
|
||||
@@ -25,11 +25,11 @@ export interface LightconeJson {
|
||||
export interface AvatarData {
|
||||
rank: number,
|
||||
skills: Record<string, number>
|
||||
skills_by_anchor_type?: Record<string,number>
|
||||
skills_by_anchor_type?: Record<string, number> | null;
|
||||
}
|
||||
|
||||
export interface AvatarJson {
|
||||
owner_uid?: number;
|
||||
owner_uid?: number | null;
|
||||
avatar_id: number;
|
||||
data: AvatarData;
|
||||
level: number;
|
||||
@@ -37,12 +37,12 @@ export interface AvatarJson {
|
||||
techniques: number[];
|
||||
sp_value: number;
|
||||
sp_max: number;
|
||||
enhanced_id?: number;
|
||||
enhanced_id?: number | null;
|
||||
}
|
||||
export interface MonsterJson {
|
||||
monster_id: number;
|
||||
level: number;
|
||||
amount: number;
|
||||
amount?: number | null;
|
||||
}
|
||||
|
||||
export interface DynamicKeyJson {
|
||||
@@ -53,7 +53,7 @@ export interface DynamicKeyJson {
|
||||
export interface BattleBuffJson {
|
||||
level: number;
|
||||
id: number;
|
||||
dynamic_key?: DynamicKeyJson;
|
||||
dynamic_key?: DynamicKeyJson | null;
|
||||
}
|
||||
|
||||
export interface BattleConfigJson {
|
||||
@@ -71,12 +71,12 @@ type LoadoutJson = {
|
||||
relic_list: string[]
|
||||
}
|
||||
export interface FreeSRJson {
|
||||
key?: string;
|
||||
key?: string | null;
|
||||
lightcones: LightconeJson[];
|
||||
relics: RelicJson[];
|
||||
avatars: Record<string, AvatarJson>;
|
||||
battle_config: BattleConfigJson;
|
||||
loadout?: LoadoutJson[];
|
||||
loadout?: LoadoutJson[] | null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@ export const lightconeJsonSchema = z.object({
|
||||
export const avatarDataSchema = z.object({
|
||||
rank: z.number(),
|
||||
skills: z.record(z.string(), z.number()),
|
||||
skills_by_anchor_type: z.record(z.string(), z.number()).optional()
|
||||
skills_by_anchor_type: z.record(z.string(), z.number()).nullish()
|
||||
});
|
||||
|
||||
export const avatarJsonSchema = z.object({
|
||||
owner_uid: z.number().optional(),
|
||||
owner_uid: z.number().nullish(),
|
||||
avatar_id: z.number(),
|
||||
data: avatarDataSchema,
|
||||
level: z.number(),
|
||||
@@ -41,13 +41,13 @@ export const avatarJsonSchema = z.object({
|
||||
techniques: z.array(z.number()),
|
||||
sp_value: z.number(),
|
||||
sp_max: z.number(),
|
||||
enhanced_id: z.number().optional()
|
||||
enhanced_id: z.number().nullish()
|
||||
});
|
||||
|
||||
export const monsterJsonSchema = z.object({
|
||||
monster_id: z.number(),
|
||||
level: z.number(),
|
||||
amount: z.number()
|
||||
amount: z.number().nullish()
|
||||
});
|
||||
|
||||
export const dynamicKeyJsonSchema = z.object({
|
||||
@@ -58,7 +58,7 @@ export const dynamicKeyJsonSchema = z.object({
|
||||
export const battleBuffJsonSchema = z.object({
|
||||
level: z.number(),
|
||||
id: z.number(),
|
||||
dynamic_key: dynamicKeyJsonSchema.optional()
|
||||
dynamic_key: dynamicKeyJsonSchema.nullish()
|
||||
});
|
||||
|
||||
export const battleConfigJsonSchema = z.object({
|
||||
@@ -78,12 +78,12 @@ const loadoutJsonSchema = z.object({
|
||||
});
|
||||
|
||||
export const freeSrJsonSchema = z.object({
|
||||
key: z.string().optional(),
|
||||
key: z.string().nullish(),
|
||||
lightcones: z.array(lightconeJsonSchema),
|
||||
relics: z.array(relicJsonSchema),
|
||||
avatars: z.record(z.string(), avatarJsonSchema),
|
||||
battle_config: battleConfigJsonSchema,
|
||||
loadout: z.array(loadoutJsonSchema).optional()
|
||||
loadout: z.array(loadoutJsonSchema).nullish()
|
||||
});
|
||||
|
||||
const extraDataSchema = z.any();
|
||||
@@ -91,5 +91,5 @@ const extraDataSchema = z.any();
|
||||
export const psResponseSchema = z.object({
|
||||
status: z.number(),
|
||||
message: z.string(),
|
||||
extra_data: extraDataSchema.optional()
|
||||
extra_data: extraDataSchema.nullish()
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user