Test case
1 generated file · +0 −65test/inputs/schema/rust-cycle-breaker-union.schema
Dschema-pikedefault / TopLevel.pmod+0 −65
| @@ -1,65 +0,0 @@ | ||
| 1 | -// This source has been automatically generated by quicktype. | |
| 2 | -// ( https://github.com/quicktype/quicktype ) | |
| 3 | -// | |
| 4 | -// To use this code, simply import it into your project as a Pike module. | |
| 5 | -// To JSON-encode your object, you can pass it to `Standards.JSON.encode` | |
| 6 | -// or call `encode_json` on it. | |
| 7 | -// | |
| 8 | -// To decode a JSON string, first pass it to `Standards.JSON.decode`, | |
| 9 | -// and then pass the result to `<YourClass>_from_JSON`. | |
| 10 | -// It will return an instance of <YourClass>. | |
| 11 | -// Bear in mind that these functions have unexpected behavior, | |
| 12 | -// and will likely throw an error, if the JSON string does not | |
| 13 | -// match the expected interface, even if the JSON itself is valid. | |
| 14 | - | |
| 15 | -class TopLevel { | |
| 16 | - Next next; // json: "next" | |
| 17 | - string value; // json: "value" | |
| 18 | - | |
| 19 | - string encode_json() { | |
| 20 | - mapping(string:mixed) json = ([ | |
| 21 | - "next" : next, | |
| 22 | - "value" : value, | |
| 23 | - ]); | |
| 24 | - | |
| 25 | - return Standards.JSON.encode(json); | |
| 26 | - } | |
| 27 | -} | |
| 28 | - | |
| 29 | -TopLevel TopLevel_from_JSON(mixed json) { | |
| 30 | - TopLevel retval = TopLevel(); | |
| 31 | - | |
| 32 | - retval.next = json["next"]; | |
| 33 | - retval.value = json["value"]; | |
| 34 | - | |
| 35 | - return retval; | |
| 36 | -} | |
| 37 | - | |
| 38 | -class Node { | |
| 39 | - Next next; // json: "next" | |
| 40 | - string value; // json: "value" | |
| 41 | - | |
| 42 | - string encode_json() { | |
| 43 | - mapping(string:mixed) json = ([ | |
| 44 | - "next" : next, | |
| 45 | - "value" : value, | |
| 46 | - ]); | |
| 47 | - | |
| 48 | - return Standards.JSON.encode(json); | |
| 49 | - } | |
| 50 | -} | |
| 51 | - | |
| 52 | -Node Node_from_JSON(mixed json) { | |
| 53 | - Node retval = Node(); | |
| 54 | - | |
| 55 | - retval.next = json["next"]; | |
| 56 | - retval.value = json["value"]; | |
| 57 | - | |
| 58 | - return retval; | |
| 59 | -} | |
| 60 | - | |
| 61 | -typedef Node|string Next; | |
| 62 | - | |
| 63 | -Next Next_from_JSON(mixed json) { | |
| 64 | - return json; | |
| 65 | -} |
No generated files match these filters.