Change Jsonable types' naming convention
This commit is contained in:
@@ -7,4 +7,4 @@ import haxe.Json;
|
||||
import haxe.DynamicAccess;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class JsonableArray<T:Jsonable<T>> {}
|
||||
class JsonArray<T:Jsonable<T>> {}
|
@@ -3,7 +3,7 @@
|
||||
|
||||
(method parse [:String representation]
|
||||
(let [:Array<String> arr (Json.parse representation)]
|
||||
(new JsonableArray<T>
|
||||
(new JsonArray<T>
|
||||
(for elem arr
|
||||
(defaultVal.parse elem))
|
||||
defaultVal)))
|
@@ -17,7 +17,7 @@ typedef Jsonable<T> = {
|
||||
function parse(s:String):T;
|
||||
}
|
||||
|
||||
typedef JsonStringMap = JsonMap<JsonableString>;
|
||||
typedef JsonStringMap = JsonMap<JsonString>;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class JsonMap<T:Jsonable<T>> {}
|
||||
|
@@ -5,4 +5,4 @@ import kiss.List;
|
||||
import haxe.Json;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class JsonableString {}
|
||||
class JsonString {}
|
@@ -1,7 +1,7 @@
|
||||
(defNew [&prop :String value])
|
||||
|
||||
(method parse [:String representation]
|
||||
(new JsonableString (Json.parse representation)))
|
||||
(new JsonString (Json.parse representation)))
|
||||
|
||||
(method stringify []
|
||||
(Json.stringify value))
|
@@ -1,7 +1,7 @@
|
||||
(import sys.io.File)
|
||||
(import sys.FileSystem)
|
||||
(import kiss_tools.JsonMap)
|
||||
(import kiss_tools.JsonableArray)
|
||||
(import kiss_tools.JsonArray)
|
||||
|
||||
// Test FuzzyJson
|
||||
(loadFrom "kiss-tools" "src/kiss_tools/FuzzyJson.kiss")
|
||||
@@ -18,11 +18,11 @@
|
||||
(assertThrowsAtCompileTime (getFuzzyJson "dogs" "Rangie"))
|
||||
|
||||
|
||||
// Test JsonMap<JsonableArray>
|
||||
// Test JsonMap<JsonArray>
|
||||
(var TEST_JSON_FILE "testJsonFile.json")
|
||||
|
||||
(File.saveContent TEST_JSON_FILE (File.getContent "test/map-start.json"))
|
||||
(let [jsonMap (new JsonMap<JsonableArray<TestJsonable>> TEST_JSON_FILE (new JsonableArray<TestJsonable>> [] (new TestJsonable "")))
|
||||
(let [jsonMap (new JsonMap<JsonArray<TestJsonable>> TEST_JSON_FILE (new JsonArray<TestJsonable>> [] (new TestJsonable "")))
|
||||
a (jsonMap.get "a")
|
||||
aString (a.elements.toString)
|
||||
b (jsonMap.get "b")
|
||||
|
Reference in New Issue
Block a user