feat: add resource schemas and validation scripts
- Introduced new resource schemas for maps, scenarios, unit sets, and turn commands using Zod. - Implemented a script to generate JSON schemas from Zod schemas. - Added a validation script to ensure resource JSON files conform to their respective schemas. - Updated the logic package to export new resource schemas. - Added new dependencies for schema generation and validation. - Created a tools-scripts package for resource management tasks.
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
asStringArray,
|
||||
isRecord,
|
||||
} from '@sammo-ts/common';
|
||||
import { UnitSetDefinitionInputSchema } from '../resources/unitSetSchema.js';
|
||||
|
||||
const DEFAULT_REGION_MAP: Record<string, number> = {
|
||||
하북: 1,
|
||||
@@ -114,7 +115,7 @@ const parseCrewType = (value: unknown): CrewTypeDefinition | null => {
|
||||
};
|
||||
|
||||
export const parseUnitSetDefinition = (value: unknown): UnitSetDefinition => {
|
||||
const data = asRecord(value);
|
||||
const data = UnitSetDefinitionInputSchema.parse(value);
|
||||
const id = asString(data.id, 'unknown');
|
||||
const name = asString(data.name, id);
|
||||
const defaultCrewTypeId =
|
||||
|
||||
Reference in New Issue
Block a user