|
| 1 | +# PR 11.97 - Fix Asset Browser Schema Properly |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Update the Asset Browser schema so it matches the current flat manifest contract: |
| 5 | + |
| 6 | +- `asset-browser.assets` is the single source of truth for all asset kinds. |
| 7 | +- No nested `media` contract. |
| 8 | +- No generic asset keys like `preview`. |
| 9 | +- Asset ids must use a predictable namespaced form such as `image.sample1902.preview`, `image.asteroids.bezel`, `font.asteroids.vector-battle`, or `audio.asteroids.fire`. |
| 10 | + |
| 11 | +## Scope |
| 12 | +- Update `tools/schemas/tools/asset-browser.schema.json`. |
| 13 | +- Add an `assets` property under the asset-browser payload/model where this repo expects Asset Browser payload validation. |
| 14 | +- Validate each asset entry requires `path`, `kind`, and `source`. |
| 15 | +- Allow optional per-asset fields such as `stretchOverride` for bezel assets. |
| 16 | +- Align sample 1902 workspace usage to the flat asset-id model. |
| 17 | +- Do not restore `media`. |
| 18 | +- Do not move runtime loaders back to nested media. |
| 19 | + |
| 20 | +## Required schema behavior |
| 21 | +The schema must accept: |
| 22 | + |
| 23 | +```json |
| 24 | +"assets": { |
| 25 | + "image.sample1902.preview": { |
| 26 | + "path": "/samples/phase-19/1902/assets/images/preview.svg", |
| 27 | + "kind": "image", |
| 28 | + "source": "workspace-manager" |
| 29 | + }, |
| 30 | + "image.asteroids.bezel": { |
| 31 | + "path": "/games/Asteroids/assets/images/bezel.png", |
| 32 | + "kind": "image", |
| 33 | + "source": "workspace-manager", |
| 34 | + "stretchOverride": { |
| 35 | + "uniformEdgeStretchPx": 10 |
| 36 | + } |
| 37 | + } |
| 38 | +} |
| 39 | +``` |
| 40 | + |
| 41 | +The schema must reject or flag generic keys such as: |
| 42 | + |
| 43 | +```json |
| 44 | +"assets": { |
| 45 | + "preview": {} |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +## Asset id rule |
| 50 | +Use this shape: |
| 51 | + |
| 52 | +```text |
| 53 | +<kind>.<domain>.<name> |
| 54 | +``` |
| 55 | + |
| 56 | +Examples: |
| 57 | + |
| 58 | +```text |
| 59 | +image.sample1902.preview |
| 60 | +image.asteroids.bezel |
| 61 | +image.asteroids.background |
| 62 | +font.asteroids.vector-battle |
| 63 | +audio.asteroids.fire |
| 64 | +``` |
| 65 | + |
| 66 | +## Implementation notes for Codex |
| 67 | +1. Open `tools/schemas/tools/asset-browser.schema.json`. |
| 68 | +2. Add an `assets` property in the correct schema location used by asset-browser payload validation. |
| 69 | +3. Define `$defs.assetMap` and `$defs.assetEntry` rather than leaving `assets` as unconstrained `jsonValue`. |
| 70 | +4. Keep compatibility fields currently present unless they are explicitly obsolete. |
| 71 | +5. Do not remove `assetCatalog`, `assetBrowserPreset`, `approvedAssets`, or `importHubPreset` unless current code proves they are obsolete. |
| 72 | +6. Ensure `additionalProperties: false` does not block the new `assets` property. |
| 73 | +7. Update sample 1902 manifest/workspace data so its preview uses `image.sample1902.preview`, not `preview`. |
| 74 | +8. Search the repo for `"assets": { "preview"` and generic `"preview"` asset ids and fix them if they are Asset Browser asset entries. |
| 75 | + |
| 76 | +## Validation |
| 77 | +Run targeted validation only: |
| 78 | + |
| 79 | +```powershell |
| 80 | +# Schema parses |
| 81 | +Get-Content .\tools\schemas\tools\asset-browser.schema.json | ConvertFrom-Json | Out-Null |
| 82 | +
|
| 83 | +# No nested media contract in asset-browser assets |
| 84 | +Select-String -Path .\samples\**\*.json, .\games\**\*.json -Pattern '"media"' |
| 85 | +
|
| 86 | +# No generic preview asset id under asset-browser.assets |
| 87 | +Select-String -Path .\samples\**\*.json, .\games\**\*.json -Pattern '"preview"\s*:' |
| 88 | +
|
| 89 | +# Confirm sample 1902 preview asset id |
| 90 | +Select-String -Path .\samples\phase-19\1902\*.json -Pattern 'image.sample1902.preview' |
| 91 | +``` |
| 92 | + |
| 93 | +Do not run the full sample suite unless a shared loader/framework change requires it. |
| 94 | + |
| 95 | +## Acceptance |
| 96 | +- Asset Browser schema defines flat `assets`. |
| 97 | +- Asset entries require `path`, `kind`, and `source`. |
| 98 | +- Bezel `stretchOverride.uniformEdgeStretchPx` is valid only on asset entries such as `image.*.bezel`. |
| 99 | +- Sample 1902 uses `image.sample1902.preview`. |
| 100 | +- Runtime/tool loaders remain aligned to flat `asset-browser.assets`. |
| 101 | +- No `media` restoration. |
0 commit comments