Skip to content

feat(mapdb): integrate proto-generated Zod schemas for map content#7963

Merged
h0lybyte merged 4 commits intodevfrom
trunk/mapdb-integration
Mar 14, 2026
Merged

feat(mapdb): integrate proto-generated Zod schemas for map content#7963
h0lybyte merged 4 commits intodevfrom
trunk/mapdb-integration

Conversation

@h0lybyte
Copy link
Member

Summary

  • Replace hand-written IMapSchema.ts with proto-generated WorldObjectDefSchema as the single source of truth for mapdb content validation
  • Extend mapdb.proto with 14 new fields (resource stats, structure stats, spawn hints, visual/metadata) and regenerate all Zod schemas
  • Migrate all 15 MDX content files from camelCase/discriminated-union format to proto snake_case field names
  • Rewrite ServiceMapDB, MapDBPanel.astro, and ReactMapDBPanel.tsx to use unified WorldObjectDef instead of IResource/IStructure discriminated union
  • Update API routes (mapdb.json, resources.json, structures.json) to filter by field presence instead of type discrimination

Test plan

  • Verify npx astro build succeeds with updated content collection schema
  • Confirm all 15 mapdb MDX pages render correctly at /mapdb/<slug>/
  • Verify /api/mapdb.json, /api/resources.json, /api/structures.json return valid JSON with correct index keys
  • Check tooltips and interactive elements work on mapdb panels
  • Validate proto regeneration: npx tsx packages/data/codegen/gen-all.mjs produces same output

Single source of truth for world geography across all games. Covers
zones with biomes and terrain generation, tile-based dungeons with room
types and hazards, world objects (trees, rocks, flowers, ores), points
of interest, spawn points with conditional rules, and region grouping.

Auto-generated 517-line mapdb-schema.ts via gen-all.mjs pipeline.
… schemas

Migrate astro-kbve mapdb content collection to use WorldObjectDefSchema
from the proto-to-Zod codegen pipeline as the single source of truth.

- Extend mapdb.proto with resource, structure, spawn, and visual fields
- Regenerate mapdb-schema.ts with new field refinements
- Rewrite IMapSchema.ts to merge WorldObjectDefSchema + Astro rendering fields
- Migrate all 15 MDX content files to proto field names (snake_case)
- Replace discriminated resource/structure union with field-presence checks
- Update ServiceMapDB, MapDBPanel, ReactMapDBPanel for unified WorldObjectDef
- Update API routes (mapdb, resources, structures) for new schema shape
@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

- Fix relative import from IMapSchema.ts to generated mapdb-schema.ts
  (was 4 levels up, needs 6 to reach repo root)
- Add title field to all 15 MDX files (required by Starlight docsLoader)
@h0lybyte h0lybyte merged commit 5c7738f into dev Mar 14, 2026
5 checks passed
@h0lybyte h0lybyte deleted the trunk/mapdb-integration branch March 14, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant