Skip to content

Phase 9-D: I/O integration for JSON Schema v2 #87

@Pluglug

Description

@Pluglug

Summary

Integrate JSON Schema v2 I/O with the existing import/export operators.

Background

Updated 2026-01-13: The approach has changed per #89 decision.

  • Dataclass schemas are NOT required (pm.data + ParsedData suffices)
  • Focus on converter/serializer using existing infrastructure

Current State

Tasks

Import Integration

  • Modify WM_OT_pm_import to use infra/compat.py migration
  • Add v1/v2 format auto-detection (see validation.py W301 warning)
  • Show conversion warnings to user

Export Integration

  • Modify WM_OT_pm_export to support v2 format
  • Add export format selection UI (v1/v2)
  • Implement PMItem → JSON v2 dict conversion

Validation API (PR #99)

  • Implement full validation in api/validation.py
    • Currently stub: only format detection and basic checks
    • Need: field validation, reference checking per ERROR_CODES

Serializer Module

  • Create infra/serializer.py for high-level export/import
  • export_v2() - Export menus to PME2 JSON dict
  • import_json() - Import with auto-detection and migration

Related

Files

File Purpose
operators/io.py Import/export operators
infra/io.py File I/O utilities
infra/compat.py Migration functions
api/validation.py JSON validation (stub)

Notes

This is the main work remaining for 2.0.0 JSON Schema v2 support:

  • Users can export in new v2 format
  • Importing v1 files auto-converts to v2 internally
  • Round-trip (export v2 → import) is fully supported
  • pme.validate_json() provides pre-import validation

Out of Scope (2.0.1+)

Per #89 decision:

  • Dataclass schemas (core/schemas/) - NOT needed
  • Complex WM_OT state machine redesign

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions