فهرست منبع

Moved definitions to bottom of spell book schema.
Added scoping/namespace for casting styles.

Samuel Jaffe 8 سال پیش
والد
کامیت
d1bac7b880
1فایلهای تغییر یافته به همراه51 افزوده شده و 49 حذف شده
  1. 51 49
      schema/spellbook.json

+ 51 - 49
schema/spellbook.json

@@ -1,49 +1,5 @@
 {
   "$schema": "http://json-schema.org/draft-06/schema#",
-  "definitions": {
-    "names": {
-      "items": {"type": "string"},
-      "type": "array"
-    },
-    "Inspired": {
-      "patternProperties": {
-        "^[0-9]$": {
-          "properties": {
-            "spellsPerDayRemaining": false,
-            "spellsKnown": false
-          }
-        }
-      }
-    },
-    "Spontaneous": {
-      "patternProperties": {
-        "^[0-9]$": {
-          "properties": {
-            "spellsPrepared": false,
-            "spellsPreparedPreviously": false
-          }
-        }
-      }
-    },
-    "Researched": {
-      "patternProperties": {
-        "^[0-9]$": {
-          "properties": {
-            "spellsPerDayRemaining": false
-          }
-        }
-      }
-    },
-    "Retrieved": {
-      "patternProperties": {
-        "^[0-9]$": {
-          "properties": {
-            "spellsKnown": false
-          }
-        }
-      }
-    }
-  },
   "properties": {
     "@class": {"type": "string"},
     "classRef": {"type": "string"},
@@ -75,26 +31,26 @@
     {
       "properties": {
         "@class": {"const": "org.leumasjaffe.charsheet.model.magic.impl.Inspired"},
-        "spellInfo": {"$ref": "#/definitions/Inspired"}
+        "spellInfo": {"$ref": "#/definitions/castingType/Inspired"}
       },
       "required": ["classRef"]
     },
     {
       "properties": {
         "@class": {"const": "org.leumasjaffe.charsheet.model.magic.impl.Spontaneous"},
-        "spellInfo": {"$ref": "#/definitions/Spontaneous"}
+        "spellInfo": {"$ref": "#/definitions/castingType/Spontaneous"}
       }
     },
     {
       "properties": {
         "@class": {"const": "org.leumasjaffe.charsheet.model.magic.impl.Researched"},
-        "spellInfo": {"$ref": "#/definitions/Researched"}
+        "spellInfo": {"$ref": "#/definitions/castingType/Researched"}
       }
     },
     {
       "properties": {
         "@class": {"const": "org.leumasjaffe.charsheet.model.magic.impl.Retrieved"},
-        "spellInfo": {"$ref": "#/definitions/Retrieved"}
+        "spellInfo": {"$ref": "#/definitions/castingType/Retrieved"}
       },
       "required": ["classRef"]
     }
@@ -104,5 +60,51 @@
     "spellInfo"
   ],
   "type": "object",
-  "additionalProperties": false
+  "additionalProperties": false,
+  "definitions": {
+    "names": {
+      "items": {"type": "string"},
+      "type": "array"
+    },
+    "castingType": {
+      "Inspired": {
+        "patternProperties": {
+          "^[0-9]$": {
+            "properties": {
+              "spellsPerDayRemaining": false,
+              "spellsKnown": false
+            }
+          }
+        }
+      },
+      "Spontaneous": {
+        "patternProperties": {
+          "^[0-9]$": {
+            "properties": {
+              "spellsPrepared": false,
+              "spellsPreparedPreviously": false
+            }
+          }
+        }
+      },
+      "Researched": {
+        "patternProperties": {
+          "^[0-9]$": {
+            "properties": {
+              "spellsPerDayRemaining": false
+            }
+          }
+        }
+      },
+      "Retrieved": {
+        "patternProperties": {
+          "^[0-9]$": {
+            "properties": {
+              "spellsKnown": false
+            }
+          }
+        }
+      }
+    }
+  }
 }