File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { ClassSchema } from './5e-SRD-Classes' ; // Adjust path as needed
2+
3+ const barbarianData = {
4+ index : "barbarian" ,
5+ name : "Barbarian" ,
6+ hit_die : 12 ,
7+ primary_ability : {
8+ desc : "Strength" ,
9+ all_of : [ { index : "str" , name : "STR" , url : "/api/2024/ability-scores/str" } ]
10+ } ,
11+ class_levels : "/api/2024/classes/barbarian/levels" ,
12+ proficiency_choices : [ ] ,
13+ starting_equipment_options : [ ] ,
14+ url : "/api/2024/classes/barbarian"
15+ } ;
16+
17+ const result = ClassSchema . safeParse ( barbarianData ) ;
18+
19+ if ( result . success ) {
20+ console . log ( "✅ Schema is working perfectly!" ) ;
21+ } else {
22+ console . error ( "❌ Schema Validation Failed:" ) ;
23+ console . log ( JSON . stringify ( result . error . format ( ) , null , 2 ) ) ;
24+ }
Original file line number Diff line number Diff line change 11import { z } from 'zod' ;
2- import { APIReferenceSchema , ChoiceSchema } from '../../schemas/common' ;
2+ import { APIReferenceSchema , ChoiceSchema } from '../../src/ schemas/common' ;
33
44const SpellcastingInfoSchema = z . object ( {
55 name : z . string ( ) ,
You can’t perform that action at this time.
0 commit comments