Test case
27 generated files · +243 −243test/inputs/schema/accessors.schema
Mschema-cjsondefault / TopLevel.c+20 −20
| @@ -81,13 +81,8 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 81 | 81 | if (NULL != j) { |
| 82 | 82 | if (NULL != (x = cJSON_malloc(sizeof(struct TopLevel)))) { |
| 83 | 83 | memset(x, 0, sizeof(struct TopLevel)); |
| 84 | - if (cJSON_HasObjectItem(j, "bar")) { | |
| 85 | - x->barre = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "bar"))); | |
| 86 | - } | |
| 87 | - else { | |
| 88 | - if (NULL != (x->barre = cJSON_malloc(sizeof(char)))) { | |
| 89 | - x->barre[0] = '\0'; | |
| 90 | - } | |
| 84 | + if (cJSON_HasObjectItem(j, "union")) { | |
| 85 | + x->unionization = cJSON_GetUnionValue(cJSON_GetObjectItemCaseSensitive(j, "union")); | |
| 91 | 86 | } |
| 92 | 87 | if (cJSON_HasObjectItem(j, "enum")) { |
| 93 | 88 | x->enumerification = cJSON_GetEnumValue(cJSON_GetObjectItemCaseSensitive(j, "enum")); |
| @@ -100,8 +95,13 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 100 | 95 | x->foo[0] = '\0'; |
| 101 | 96 | } |
| 102 | 97 | } |
| 103 | - if (cJSON_HasObjectItem(j, "union")) { | |
| 104 | - x->unionization = cJSON_GetUnionValue(cJSON_GetObjectItemCaseSensitive(j, "union")); | |
| 98 | + if (cJSON_HasObjectItem(j, "bar")) { | |
| 99 | + x->barre = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "bar"))); | |
| 100 | + } | |
| 101 | + else { | |
| 102 | + if (NULL != (x->barre = cJSON_malloc(sizeof(char)))) { | |
| 103 | + x->barre[0] = '\0'; | |
| 104 | + } | |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | } |
| @@ -112,12 +112,7 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 112 | 112 | cJSON * j = NULL; |
| 113 | 113 | if (NULL != x) { |
| 114 | 114 | if (NULL != (j = cJSON_CreateObject())) { |
| 115 | - if (NULL != x->barre) { | |
| 116 | - cJSON_AddStringToObject(j, "bar", x->barre); | |
| 117 | - } | |
| 118 | - else { | |
| 119 | - cJSON_AddStringToObject(j, "bar", ""); | |
| 120 | - } | |
| 115 | + cJSON_AddItemToObject(j, "union", cJSON_CreateUnion(x->unionization)); | |
| 121 | 116 | cJSON_AddItemToObject(j, "enum", cJSON_CreateEnum(x->enumerification)); |
| 122 | 117 | if (NULL != x->foo) { |
| 123 | 118 | cJSON_AddStringToObject(j, "foo", x->foo); |
| @@ -125,7 +120,12 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 125 | 120 | else { |
| 126 | 121 | cJSON_AddStringToObject(j, "foo", ""); |
| 127 | 122 | } |
| 128 | - cJSON_AddItemToObject(j, "union", cJSON_CreateUnion(x->unionization)); | |
| 123 | + if (NULL != x->barre) { | |
| 124 | + cJSON_AddStringToObject(j, "bar", x->barre); | |
| 125 | + } | |
| 126 | + else { | |
| 127 | + cJSON_AddStringToObject(j, "bar", ""); | |
| 128 | + } | |
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | return j; |
| @@ -145,14 +145,14 @@ char * cJSON_PrintTopLevel(const struct TopLevel * x) { | ||
| 145 | 145 | |
| 146 | 146 | void cJSON_DeleteTopLevel(struct TopLevel * x) { |
| 147 | 147 | if (NULL != x) { |
| 148 | - if (NULL != x->barre) { | |
| 149 | - cJSON_free(x->barre); | |
| 148 | + if (NULL != x->unionization) { | |
| 149 | + cJSON_DeleteUnion(x->unionization); | |
| 150 | 150 | } |
| 151 | 151 | if (NULL != x->foo) { |
| 152 | 152 | cJSON_free(x->foo); |
| 153 | 153 | } |
| 154 | - if (NULL != x->unionization) { | |
| 155 | - cJSON_DeleteUnion(x->unionization); | |
| 154 | + if (NULL != x->barre) { | |
| 155 | + cJSON_free(x->barre); | |
| 156 | 156 | } |
| 157 | 157 | cJSON_free(x); |
| 158 | 158 | } |
Mschema-cjsondefault / TopLevel.h+2 −2
| @@ -49,10 +49,10 @@ struct Union { | ||
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | 51 | struct TopLevel { |
| 52 | - char * barre; | |
| 52 | + struct Union * unionization; | |
| 53 | 53 | enum Enum enumerification; |
| 54 | 54 | char * foo; |
| 55 | - struct Union * unionization; | |
| 55 | + char * barre; | |
| 56 | 56 | }; |
| 57 | 57 | |
| 58 | 58 | enum Enum cJSON_GetEnumValue(const cJSON * j); |
Mschema-cplusplusdefault / quicktype.hpp+12 −12
| @@ -98,15 +98,15 @@ namespace quicktype { | ||
| 98 | 98 | virtual ~TopLevel() = default; |
| 99 | 99 | |
| 100 | 100 | private: |
| 101 | - std::string barre; | |
| 101 | + Union unionization; | |
| 102 | 102 | Enum enumerification; |
| 103 | 103 | std::string foo; |
| 104 | - Union unionization; | |
| 104 | + std::string barre; | |
| 105 | 105 | |
| 106 | 106 | public: |
| 107 | - const std::string & get_barre() const { return barre; } | |
| 108 | - std::string & get_mutable_barre() { return barre; } | |
| 109 | - void set_barre(const std::string & value) { this->barre = value; } | |
| 107 | + const Union & get_unionization() const { return unionization; } | |
| 108 | + Union & get_mutable_unionization() { return unionization; } | |
| 109 | + void set_unionization(const Union & value) { this->unionization = value; } | |
| 110 | 110 | |
| 111 | 111 | const Enum & get_enumerification() const { return enumerification; } |
| 112 | 112 | Enum & get_mutable_enumerification() { return enumerification; } |
| @@ -116,9 +116,9 @@ namespace quicktype { | ||
| 116 | 116 | std::string & get_mutable_foo() { return foo; } |
| 117 | 117 | void set_foo(const std::string & value) { this->foo = value; } |
| 118 | 118 | |
| 119 | - const Union & get_unionization() const { return unionization; } | |
| 120 | - Union & get_mutable_unionization() { return unionization; } | |
| 121 | - void set_unionization(const Union & value) { this->unionization = value; } | |
| 119 | + const std::string & get_barre() const { return barre; } | |
| 120 | + std::string & get_mutable_barre() { return barre; } | |
| 121 | + void set_barre(const std::string & value) { this->barre = value; } | |
| 122 | 122 | }; |
| 123 | 123 | } |
| 124 | 124 | |
| @@ -138,18 +138,18 @@ struct adl_serializer<std::variant<bool, double>> { | ||
| 138 | 138 | } |
| 139 | 139 | namespace quicktype { |
| 140 | 140 | inline void from_json(const json & j, TopLevel& x) { |
| 141 | - x.set_barre(j.at("bar").get<std::string>()); | |
| 141 | + x.set_unionization(j.at("union").get<Union>()); | |
| 142 | 142 | x.set_enumerification(j.at("enum").get<Enum>()); |
| 143 | 143 | x.set_foo(j.at("foo").get<std::string>()); |
| 144 | - x.set_unionization(j.at("union").get<Union>()); | |
| 144 | + x.set_barre(j.at("bar").get<std::string>()); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | inline void to_json(json & j, const TopLevel & x) { |
| 148 | 148 | j = json::object(); |
| 149 | - j["bar"] = x.get_barre(); | |
| 149 | + j["union"] = x.get_unionization(); | |
| 150 | 150 | j["enum"] = x.get_enumerification(); |
| 151 | 151 | j["foo"] = x.get_foo(); |
| 152 | - j["union"] = x.get_unionization(); | |
| 152 | + j["bar"] = x.get_barre(); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | inline void from_json(const json & j, Enum & x) { |
Mschema-csharp-recordsdefault / QuickType.cs+4 −4
| @@ -25,8 +25,8 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("bar", Required = Required.Always)] | |
| 29 | - public string Barre { get; set; } | |
| 28 | + [JsonProperty("union", Required = Required.Always)] | |
| 29 | + public Union Unionization { get; set; } | |
| 30 | 30 | |
| 31 | 31 | [JsonProperty("enum", Required = Required.Always)] |
| 32 | 32 | public Enum Enumerification { get; set; } |
| @@ -34,8 +34,8 @@ namespace QuickType | ||
| 34 | 34 | [JsonProperty("foo", Required = Required.Always)] |
| 35 | 35 | public string Fu_uu { get; set; } |
| 36 | 36 | |
| 37 | - [JsonProperty("union", Required = Required.Always)] | |
| 38 | - public Union Unionization { get; set; } | |
| 37 | + [JsonProperty("bar", Required = Required.Always)] | |
| 38 | + public string Barre { get; set; } | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public enum Enum { Fire, Grass, Blue }; |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+4 −4
| @@ -23,8 +23,8 @@ namespace QuickType | ||
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | 25 | [JsonRequired] |
| 26 | - [JsonPropertyName("bar")] | |
| 27 | - public string Barre { get; set; } | |
| 26 | + [JsonPropertyName("union")] | |
| 27 | + public Union Unionization { get; set; } | |
| 28 | 28 | |
| 29 | 29 | [JsonRequired] |
| 30 | 30 | [JsonPropertyName("enum")] |
| @@ -35,8 +35,8 @@ namespace QuickType | ||
| 35 | 35 | public string Fu_uu { get; set; } |
| 36 | 36 | |
| 37 | 37 | [JsonRequired] |
| 38 | - [JsonPropertyName("union")] | |
| 39 | - public Union Unionization { get; set; } | |
| 38 | + [JsonPropertyName("bar")] | |
| 39 | + public string Barre { get; set; } | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public enum Enum { Fire, Grass, Blue }; |
Mschema-csharpdefault / QuickType.cs+4 −4
| @@ -25,8 +25,8 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("bar", Required = Required.Always)] | |
| 29 | - public string Barre { get; set; } | |
| 28 | + [JsonProperty("union", Required = Required.Always)] | |
| 29 | + public Union Unionization { get; set; } | |
| 30 | 30 | |
| 31 | 31 | [JsonProperty("enum", Required = Required.Always)] |
| 32 | 32 | public Enum Enumerification { get; set; } |
| @@ -34,8 +34,8 @@ namespace QuickType | ||
| 34 | 34 | [JsonProperty("foo", Required = Required.Always)] |
| 35 | 35 | public string Fu_uu { get; set; } |
| 36 | 36 | |
| 37 | - [JsonProperty("union", Required = Required.Always)] | |
| 38 | - public Union Unionization { get; set; } | |
| 37 | + [JsonProperty("bar", Required = Required.Always)] | |
| 38 | + public string Barre { get; set; } | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public enum Enum { Fire, Grass, Blue }; |
Mschema-dartdefault / TopLevel.dart+8 −8
| @@ -9,30 +9,30 @@ TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | ||
| 9 | 9 | String topLevelToJson(TopLevel data) => json.encode(data.toJson()); |
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | - final String barre; | |
| 12 | + final dynamic unionization; | |
| 13 | 13 | final Enum enumerification; |
| 14 | 14 | final String foo; |
| 15 | - final dynamic unionization; | |
| 15 | + final String barre; | |
| 16 | 16 | |
| 17 | 17 | TopLevel({ |
| 18 | - required this.barre, | |
| 18 | + required this.unionization, | |
| 19 | 19 | required this.enumerification, |
| 20 | 20 | required this.foo, |
| 21 | - required this.unionization, | |
| 21 | + required this.barre, | |
| 22 | 22 | }); |
| 23 | 23 | |
| 24 | 24 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 25 | - barre: json["bar"], | |
| 25 | + unionization: json["union"], | |
| 26 | 26 | enumerification: enumValues.map[json["enum"]]!, |
| 27 | 27 | foo: json["foo"], |
| 28 | - unionization: json["union"], | |
| 28 | + barre: json["bar"], | |
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | 31 | Map<String, dynamic> toJson() => { |
| 32 | - "bar": barre, | |
| 32 | + "union": unionization, | |
| 33 | 33 | "enum": enumValues.reverse[enumerification], |
| 34 | 34 | "foo": foo, |
| 35 | - "union": unionization, | |
| 35 | + "bar": barre, | |
| 36 | 36 | }; |
| 37 | 37 | } |
Mschema-elixirdefault / QuickType.ex+8 −8
| @@ -53,22 +53,22 @@ defmodule EnumEnum do | ||
| 53 | 53 | end |
| 54 | 54 | |
| 55 | 55 | defmodule TopLevel do |
| 56 | - @enforce_keys [:barre, :enumerification, :foo, :unionization] | |
| 57 | - defstruct [:barre, :enumerification, :foo, :unionization] | |
| 56 | + @enforce_keys [:unionization, :enumerification, :foo, :barre] | |
| 57 | + defstruct [:unionization, :enumerification, :foo, :barre] | |
| 58 | 58 | |
| 59 | 59 | @type t :: %__MODULE__{ |
| 60 | - barre: String.t(), | |
| 60 | + unionization: boolean() | float(), | |
| 61 | 61 | enumerification: EnumEnum.t(), |
| 62 | 62 | foo: String.t(), |
| 63 | - unionization: boolean() | float() | |
| 63 | + barre: String.t() | |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | def from_map(m) do |
| 67 | 67 | %TopLevel{ |
| 68 | - barre: m["bar"], | |
| 68 | + unionization: m["union"], | |
| 69 | 69 | enumerification: EnumEnum.decode(m["enum"]), |
| 70 | 70 | foo: m["foo"], |
| 71 | - unionization: m["union"], | |
| 71 | + barre: m["bar"], | |
| 72 | 72 | } |
| 73 | 73 | end |
| 74 | 74 | |
| @@ -80,10 +80,10 @@ defmodule TopLevel do | ||
| 80 | 80 | |
| 81 | 81 | def to_map(struct) do |
| 82 | 82 | %{ |
| 83 | - "bar" => struct.barre, | |
| 83 | + "union" => struct.unionization, | |
| 84 | 84 | "enum" => EnumEnum.encode(struct.enumerification), |
| 85 | 85 | "foo" => struct.foo, |
| 86 | - "union" => struct.unionization, | |
| 86 | + "bar" => struct.barre, | |
| 87 | 87 | } |
| 88 | 88 | end |
Mschema-elmdefault / QuickType.elm+6 −6
| @@ -25,10 +25,10 @@ import Json.Encode as Jenc | ||
| 25 | 25 | import Dict exposing (Dict) |
| 26 | 26 | |
| 27 | 27 | type alias QuickType = |
| 28 | - { barre : String | |
| 28 | + { unionization : Union | |
| 29 | 29 | , enumerification : Enum |
| 30 | 30 | , foo : String |
| 31 | - , unionization : Union | |
| 31 | + , barre : String | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | type Enum |
| @@ -48,18 +48,18 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 48 | 48 | quickType : Jdec.Decoder QuickType |
| 49 | 49 | quickType = |
| 50 | 50 | Jdec.succeed QuickType |
| 51 | - |> Jpipe.required "bar" Jdec.string | |
| 51 | + |> Jpipe.required "union" union | |
| 52 | 52 | |> Jpipe.required "enum" enum |
| 53 | 53 | |> Jpipe.required "foo" Jdec.string |
| 54 | - |> Jpipe.required "union" union | |
| 54 | + |> Jpipe.required "bar" Jdec.string | |
| 55 | 55 | |
| 56 | 56 | encodeQuickType : QuickType -> Jenc.Value |
| 57 | 57 | encodeQuickType x = |
| 58 | 58 | Jenc.object |
| 59 | - [ ("bar", Jenc.string x.barre) | |
| 59 | + [ ("union", encodeUnion x.unionization) | |
| 60 | 60 | , ("enum", encodeEnum x.enumerification) |
| 61 | 61 | , ("foo", Jenc.string x.foo) |
| 62 | - , ("union", encodeUnion x.unionization) | |
| 62 | + , ("bar", Jenc.string x.barre) | |
| 63 | 63 | ] |
| 64 | 64 | |
| 65 | 65 | enum : Jdec.Decoder Enum |
Mschema-flowdefault / TopLevel.js+4 −4
| @@ -10,10 +10,10 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - bar: string; | |
| 13 | + union: Union; | |
| 14 | 14 | enum: Enum; |
| 15 | 15 | foo: string; |
| 16 | - union: Union; | |
| 16 | + bar: string; | |
| 17 | 17 | }; |
| 18 | 18 | |
| 19 | 19 | export type Enum = |
| @@ -188,10 +188,10 @@ function r(name: string) { | ||
| 188 | 188 | |
| 189 | 189 | const typeMap: any = { |
| 190 | 190 | "TopLevel": o([ |
| 191 | - { json: "bar", js: "bar", typ: "" }, | |
| 191 | + { json: "union", js: "union", typ: u(true, 3.14) }, | |
| 192 | 192 | { json: "enum", js: "enum", typ: r("Enum") }, |
| 193 | 193 | { json: "foo", js: "foo", typ: "" }, |
| 194 | - { json: "union", js: "union", typ: u(true, 3.14) }, | |
| 194 | + { json: "bar", js: "bar", typ: "" }, | |
| 195 | 195 | ], false), |
| 196 | 196 | "Enum": [ |
| 197 | 197 | "red", |
Mschema-golangdefault / quicktype.go+2 −2
| @@ -22,10 +22,10 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | type TopLevel struct { |
| 25 | - Bah string `json:"bar"` | |
| 25 | + Unionization *Union `json:"union"` | |
| 26 | 26 | Enumerification Enum `json:"enum"` |
| 27 | 27 | Foo string `json:"foo"` |
| 28 | - Unionization *Union `json:"union"` | |
| 28 | + Bah string `json:"bar"` | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | type Enum string |
Mschema-haskelldefault / QuickType.hs+7 −7
| @@ -15,10 +15,10 @@ import Data.HashMap.Strict (HashMap) | ||
| 15 | 15 | import Data.Text (Text) |
| 16 | 16 | |
| 17 | 17 | data QuickType = QuickType |
| 18 | - { barreQuickType :: Text | |
| 18 | + { unionizationQuickType :: Union | |
| 19 | 19 | , enumerificationQuickType :: EnumEnum |
| 20 | 20 | , fooQuickType :: Text |
| 21 | - , unionizationQuickType :: Union | |
| 21 | + , barreQuickType :: Text | |
| 22 | 22 | } deriving (Show) |
| 23 | 23 | |
| 24 | 24 | data EnumEnum |
| @@ -36,20 +36,20 @@ decodeTopLevel :: ByteString -> Maybe QuickType | ||
| 36 | 36 | decodeTopLevel = decode |
| 37 | 37 | |
| 38 | 38 | instance ToJSON QuickType where |
| 39 | - toJSON (QuickType barreQuickType enumerificationQuickType fooQuickType unionizationQuickType) = | |
| 39 | + toJSON (QuickType unionizationQuickType enumerificationQuickType fooQuickType barreQuickType) = | |
| 40 | 40 | object |
| 41 | - [ "bar" .= barreQuickType | |
| 41 | + [ "union" .= unionizationQuickType | |
| 42 | 42 | , "enum" .= enumerificationQuickType |
| 43 | 43 | , "foo" .= fooQuickType |
| 44 | - , "union" .= unionizationQuickType | |
| 44 | + , "bar" .= barreQuickType | |
| 45 | 45 | ] |
| 46 | 46 | |
| 47 | 47 | instance FromJSON QuickType where |
| 48 | 48 | parseJSON (Object v) = QuickType |
| 49 | - <$> v .: "bar" | |
| 49 | + <$> v .: "union" | |
| 50 | 50 | <*> v .: "enum" |
| 51 | 51 | <*> v .: "foo" |
| 52 | - <*> v .: "union" | |
| 52 | + <*> v .: "bar" | |
| 53 | 53 | |
| 54 | 54 | instance ToJSON EnumEnum where |
| 55 | 55 | toJSON FireEnumEnum = "red" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+10 −10
| @@ -3,15 +3,15 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private String barre; | |
| 6 | + private Union unionization; | |
| 7 | 7 | private Enum enumerification; |
| 8 | 8 | private String Goo; |
| 9 | - private Union unionization; | |
| 9 | + private String barre; | |
| 10 | 10 | |
| 11 | - @JsonProperty("bar") | |
| 12 | - public String getBarre() { return barre; } | |
| 13 | - @JsonProperty("bar") | |
| 14 | - public void setBarre(String value) { this.barre = value; } | |
| 11 | + @JsonProperty("union") | |
| 12 | + public Union getUnionization() { return unionization; } | |
| 13 | + @JsonProperty("union") | |
| 14 | + public void setUnionization(Union value) { this.unionization = value; } | |
| 15 | 15 | |
| 16 | 16 | @JsonProperty("enum") |
| 17 | 17 | public Enum getEnumerification() { return enumerification; } |
| @@ -23,8 +23,8 @@ public class TopLevel { | ||
| 23 | 23 | @JsonProperty("foo") |
| 24 | 24 | public void setGoo(String value) { this.Goo = value; } |
| 25 | 25 | |
| 26 | - @JsonProperty("union") | |
| 27 | - public Union getUnionization() { return unionization; } | |
| 28 | - @JsonProperty("union") | |
| 29 | - public void setUnionization(Union value) { this.unionization = value; } | |
| 26 | + @JsonProperty("bar") | |
| 27 | + public String getBarre() { return barre; } | |
| 28 | + @JsonProperty("bar") | |
| 29 | + public void setBarre(String value) { this.barre = value; } | |
| 30 | 30 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+10 −10
| @@ -3,15 +3,15 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private String barre; | |
| 6 | + private Union unionization; | |
| 7 | 7 | private Enum enumerification; |
| 8 | 8 | private String Goo; |
| 9 | - private Union unionization; | |
| 9 | + private String barre; | |
| 10 | 10 | |
| 11 | - @JsonProperty("bar") | |
| 12 | - public String getBarre() { return barre; } | |
| 13 | - @JsonProperty("bar") | |
| 14 | - public void setBarre(String value) { this.barre = value; } | |
| 11 | + @JsonProperty("union") | |
| 12 | + public Union getUnionization() { return unionization; } | |
| 13 | + @JsonProperty("union") | |
| 14 | + public void setUnionization(Union value) { this.unionization = value; } | |
| 15 | 15 | |
| 16 | 16 | @JsonProperty("enum") |
| 17 | 17 | public Enum getEnumerification() { return enumerification; } |
| @@ -23,8 +23,8 @@ public class TopLevel { | ||
| 23 | 23 | @JsonProperty("foo") |
| 24 | 24 | public void setGoo(String value) { this.Goo = value; } |
| 25 | 25 | |
| 26 | - @JsonProperty("union") | |
| 27 | - public Union getUnionization() { return unionization; } | |
| 28 | - @JsonProperty("union") | |
| 29 | - public void setUnionization(Union value) { this.unionization = value; } | |
| 26 | + @JsonProperty("bar") | |
| 27 | + public String getBarre() { return barre; } | |
| 28 | + @JsonProperty("bar") | |
| 29 | + public void setBarre(String value) { this.barre = value; } | |
| 30 | 30 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+10 −10
| @@ -3,15 +3,15 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private String barre; | |
| 6 | + private Union unionization; | |
| 7 | 7 | private Enum enumerification; |
| 8 | 8 | private String Goo; |
| 9 | - private Union unionization; | |
| 9 | + private String barre; | |
| 10 | 10 | |
| 11 | - @JsonProperty("bar") | |
| 12 | - public String getBarre() { return barre; } | |
| 13 | - @JsonProperty("bar") | |
| 14 | - public void setBarre(String value) { this.barre = value; } | |
| 11 | + @JsonProperty("union") | |
| 12 | + public Union getUnionization() { return unionization; } | |
| 13 | + @JsonProperty("union") | |
| 14 | + public void setUnionization(Union value) { this.unionization = value; } | |
| 15 | 15 | |
| 16 | 16 | @JsonProperty("enum") |
| 17 | 17 | public Enum getEnumerification() { return enumerification; } |
| @@ -23,8 +23,8 @@ public class TopLevel { | ||
| 23 | 23 | @JsonProperty("foo") |
| 24 | 24 | public void setGoo(String value) { this.Goo = value; } |
| 25 | 25 | |
| 26 | - @JsonProperty("union") | |
| 27 | - public Union getUnionization() { return unionization; } | |
| 28 | - @JsonProperty("union") | |
| 29 | - public void setUnionization(Union value) { this.unionization = value; } | |
| 26 | + @JsonProperty("bar") | |
| 27 | + public String getBarre() { return barre; } | |
| 28 | + @JsonProperty("bar") | |
| 29 | + public void setBarre(String value) { this.barre = value; } | |
| 30 | 30 | } |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -172,10 +172,10 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "bar", js: "bar", typ: "" }, | |
| 175 | + { json: "union", js: "union", typ: u(true, 3.14) }, | |
| 176 | 176 | { json: "enum", js: "enum", typ: r("Enum") }, |
| 177 | 177 | { json: "foo", js: "foo", typ: "" }, |
| 178 | - { json: "union", js: "union", typ: u(true, 3.14) }, | |
| 178 | + { json: "bar", js: "bar", typ: "" }, | |
| 179 | 179 | ], false), |
| 180 | 180 | "Enum": [ |
| 181 | 181 | "red", |
Mschema-phpdefault / TopLevel.php+76 −76
| @@ -4,69 +4,92 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private string $barre; // json:bar Required | |
| 7 | + private bool|float $unionization; // json:union Required | |
| 8 | 8 | private EnumEnum $enumerification; // json:enum Required |
| 9 | 9 | private string $foo; // json:foo Required |
| 10 | - private bool|float $unionization; // json:union Required | |
| 10 | + private string $barre; // json:bar Required | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | - * @param string $barre | |
| 13 | + * @param bool|float $unionization | |
| 14 | 14 | * @param EnumEnum $enumerification |
| 15 | 15 | * @param string $foo |
| 16 | - * @param bool|float $unionization | |
| 16 | + * @param string $barre | |
| 17 | 17 | */ |
| 18 | - public function __construct(string $barre, EnumEnum $enumerification, string $foo, bool|float $unionization) { | |
| 19 | - $this->barre = $barre; | |
| 18 | + public function __construct(bool|float $unionization, EnumEnum $enumerification, string $foo, string $barre) { | |
| 19 | + $this->unionization = $unionization; | |
| 20 | 20 | $this->enumerification = $enumerification; |
| 21 | 21 | $this->foo = $foo; |
| 22 | - $this->unionization = $unionization; | |
| 22 | + $this->barre = $barre; | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * @param string $value | |
| 26 | + * @param bool|float $value | |
| 27 | 27 | * @throws Exception |
| 28 | - * @return string | |
| 28 | + * @return bool|float | |
| 29 | 29 | */ |
| 30 | - public static function fromBarre(string $value): string { | |
| 31 | - return $value; /*string*/ | |
| 30 | + public static function fromUnionization(bool|float $value): bool|float { | |
| 31 | + if (is_bool($value)) { | |
| 32 | + return $value; /*bool*/ | |
| 33 | + } elseif (is_float($value) || is_int($value)) { | |
| 34 | + return $value; /*float*/ | |
| 35 | + } else { | |
| 36 | + throw new Exception('Cannot deserialize union value in TopLevel'); | |
| 37 | + } | |
| 32 | 38 | } |
| 33 | 39 | |
| 34 | 40 | /** |
| 35 | 41 | * @throws Exception |
| 36 | - * @return string | |
| 42 | + * @return bool|float | |
| 37 | 43 | */ |
| 38 | - public function toBarre(): string { | |
| 39 | - if (TopLevel::validateBarre($this->barre)) { | |
| 40 | - return $this->barre; /*string*/ | |
| 44 | + public function toUnionization(): bool|float { | |
| 45 | + if (TopLevel::validateUnionization($this->unionization)) { | |
| 46 | + if (is_bool($this->unionization)) { | |
| 47 | + return $this->unionization; /*bool*/ | |
| 48 | + } elseif (is_float($this->unionization) || is_int($this->unionization)) { | |
| 49 | + return $this->unionization; /*float*/ | |
| 50 | + } else { | |
| 51 | + throw new Exception('Union value has no matching member in TopLevel'); | |
| 52 | + } | |
| 41 | 53 | } |
| 42 | - throw new Exception('never get to this TopLevel::barre'); | |
| 54 | + throw new Exception('never get to this TopLevel::unionization'); | |
| 43 | 55 | } |
| 44 | 56 | |
| 45 | 57 | /** |
| 46 | - * @param string | |
| 58 | + * @param bool|float | |
| 47 | 59 | * @return bool |
| 48 | 60 | * @throws Exception |
| 49 | 61 | */ |
| 50 | - public static function validateBarre(string $value): bool { | |
| 62 | + public static function validateUnionization(bool|float $value): bool { | |
| 63 | + if (is_bool($value)) { | |
| 64 | + if (!is_bool($value)) { | |
| 65 | + throw new Exception("Attribute Error:TopLevel::unionization"); | |
| 66 | + } | |
| 67 | + } elseif (is_float($value) || is_int($value)) { | |
| 68 | + if (!is_float($value) && !is_int($value)) { | |
| 69 | + throw new Exception("Attribute Error:TopLevel::unionization"); | |
| 70 | + } | |
| 71 | + } else { | |
| 72 | + throw new Exception("Attribute Error:TopLevel::unionization"); | |
| 73 | + } | |
| 51 | 74 | return true; |
| 52 | 75 | } |
| 53 | 76 | |
| 54 | 77 | /** |
| 55 | 78 | * @throws Exception |
| 56 | - * @return string | |
| 79 | + * @return bool|float | |
| 57 | 80 | */ |
| 58 | - public function getBarre(): string { | |
| 59 | - if (TopLevel::validateBarre($this->barre)) { | |
| 60 | - return $this->barre; | |
| 81 | + public function getUnionization(): bool|float { | |
| 82 | + if (TopLevel::validateUnionization($this->unionization)) { | |
| 83 | + return $this->unionization; | |
| 61 | 84 | } |
| 62 | - throw new Exception('never get to getBarre TopLevel::barre'); | |
| 85 | + throw new Exception('never get to getUnionization TopLevel::unionization'); | |
| 63 | 86 | } |
| 64 | 87 | |
| 65 | 88 | /** |
| 66 | - * @return string | |
| 89 | + * @return bool|float | |
| 67 | 90 | */ |
| 68 | - public static function sampleBarre(): string { | |
| 69 | - return 'TopLevel::barre::31'; /*31:barre*/ | |
| 91 | + public static function sampleUnionization(): bool|float { | |
| 92 | + return true; /*31:unionization*/ | |
| 70 | 93 | } |
| 71 | 94 | |
| 72 | 95 | /** |
| @@ -165,73 +188,50 @@ class TopLevel { | ||
| 165 | 188 | } |
| 166 | 189 | |
| 167 | 190 | /** |
| 168 | - * @param bool|float $value | |
| 191 | + * @param string $value | |
| 169 | 192 | * @throws Exception |
| 170 | - * @return bool|float | |
| 193 | + * @return string | |
| 171 | 194 | */ |
| 172 | - public static function fromUnionization(bool|float $value): bool|float { | |
| 173 | - if (is_bool($value)) { | |
| 174 | - return $value; /*bool*/ | |
| 175 | - } elseif (is_float($value) || is_int($value)) { | |
| 176 | - return $value; /*float*/ | |
| 177 | - } else { | |
| 178 | - throw new Exception('Cannot deserialize union value in TopLevel'); | |
| 179 | - } | |
| 195 | + public static function fromBarre(string $value): string { | |
| 196 | + return $value; /*string*/ | |
| 180 | 197 | } |
| 181 | 198 | |
| 182 | 199 | /** |
| 183 | 200 | * @throws Exception |
| 184 | - * @return bool|float | |
| 201 | + * @return string | |
| 185 | 202 | */ |
| 186 | - public function toUnionization(): bool|float { | |
| 187 | - if (TopLevel::validateUnionization($this->unionization)) { | |
| 188 | - if (is_bool($this->unionization)) { | |
| 189 | - return $this->unionization; /*bool*/ | |
| 190 | - } elseif (is_float($this->unionization) || is_int($this->unionization)) { | |
| 191 | - return $this->unionization; /*float*/ | |
| 192 | - } else { | |
| 193 | - throw new Exception('Union value has no matching member in TopLevel'); | |
| 194 | - } | |
| 203 | + public function toBarre(): string { | |
| 204 | + if (TopLevel::validateBarre($this->barre)) { | |
| 205 | + return $this->barre; /*string*/ | |
| 195 | 206 | } |
| 196 | - throw new Exception('never get to this TopLevel::unionization'); | |
| 207 | + throw new Exception('never get to this TopLevel::barre'); | |
| 197 | 208 | } |
| 198 | 209 | |
| 199 | 210 | /** |
| 200 | - * @param bool|float | |
| 211 | + * @param string | |
| 201 | 212 | * @return bool |
| 202 | 213 | * @throws Exception |
| 203 | 214 | */ |
| 204 | - public static function validateUnionization(bool|float $value): bool { | |
| 205 | - if (is_bool($value)) { | |
| 206 | - if (!is_bool($value)) { | |
| 207 | - throw new Exception("Attribute Error:TopLevel::unionization"); | |
| 208 | - } | |
| 209 | - } elseif (is_float($value) || is_int($value)) { | |
| 210 | - if (!is_float($value) && !is_int($value)) { | |
| 211 | - throw new Exception("Attribute Error:TopLevel::unionization"); | |
| 212 | - } | |
| 213 | - } else { | |
| 214 | - throw new Exception("Attribute Error:TopLevel::unionization"); | |
| 215 | - } | |
| 215 | + public static function validateBarre(string $value): bool { | |
| 216 | 216 | return true; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
| 220 | 220 | * @throws Exception |
| 221 | - * @return bool|float | |
| 221 | + * @return string | |
| 222 | 222 | */ |
| 223 | - public function getUnionization(): bool|float { | |
| 224 | - if (TopLevel::validateUnionization($this->unionization)) { | |
| 225 | - return $this->unionization; | |
| 223 | + public function getBarre(): string { | |
| 224 | + if (TopLevel::validateBarre($this->barre)) { | |
| 225 | + return $this->barre; | |
| 226 | 226 | } |
| 227 | - throw new Exception('never get to getUnionization TopLevel::unionization'); | |
| 227 | + throw new Exception('never get to getBarre TopLevel::barre'); | |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /** |
| 231 | - * @return bool|float | |
| 231 | + * @return string | |
| 232 | 232 | */ |
| 233 | - public static function sampleUnionization(): bool|float { | |
| 234 | - return true; /*34:unionization*/ | |
| 233 | + public static function sampleBarre(): string { | |
| 234 | + return 'TopLevel::barre::34'; /*34:barre*/ | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
| @@ -239,10 +239,10 @@ class TopLevel { | ||
| 239 | 239 | * @return bool |
| 240 | 240 | */ |
| 241 | 241 | public function validate(): bool { |
| 242 | - return TopLevel::validateBarre($this->barre) | |
| 242 | + return TopLevel::validateUnionization($this->unionization) | |
| 243 | 243 | || TopLevel::validateEnumerification($this->enumerification) |
| 244 | 244 | || TopLevel::validateFoo($this->foo) |
| 245 | - || TopLevel::validateUnionization($this->unionization); | |
| 245 | + || TopLevel::validateBarre($this->barre); | |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |
| @@ -251,10 +251,10 @@ class TopLevel { | ||
| 251 | 251 | */ |
| 252 | 252 | public function to(): stdClass { |
| 253 | 253 | $out = new stdClass(); |
| 254 | - $out->{'bar'} = $this->toBarre(); | |
| 254 | + $out->{'union'} = $this->toUnionization(); | |
| 255 | 255 | $out->{'enum'} = $this->toEnumerification(); |
| 256 | 256 | $out->{'foo'} = $this->toFoo(); |
| 257 | - $out->{'union'} = $this->toUnionization(); | |
| 257 | + $out->{'bar'} = $this->toBarre(); | |
| 258 | 258 | return $out; |
| 259 | 259 | } |
| 260 | 260 | |
| @@ -265,10 +265,10 @@ class TopLevel { | ||
| 265 | 265 | */ |
| 266 | 266 | public static function from(stdClass $obj): TopLevel { |
| 267 | 267 | return new TopLevel( |
| 268 | - TopLevel::fromBarre($obj->{'bar'}) | |
| 268 | + TopLevel::fromUnionization($obj->{'union'}) | |
| 269 | 269 | ,TopLevel::fromEnumerification($obj->{'enum'}) |
| 270 | 270 | ,TopLevel::fromFoo($obj->{'foo'}) |
| 271 | - ,TopLevel::fromUnionization($obj->{'union'}) | |
| 271 | + ,TopLevel::fromBarre($obj->{'bar'}) | |
| 272 | 272 | ); |
| 273 | 273 | } |
| 274 | 274 | |
| @@ -277,10 +277,10 @@ class TopLevel { | ||
| 277 | 277 | */ |
| 278 | 278 | public static function sample(): TopLevel { |
| 279 | 279 | return new TopLevel( |
| 280 | - TopLevel::sampleBarre() | |
| 280 | + TopLevel::sampleUnionization() | |
| 281 | 281 | ,TopLevel::sampleEnumerification() |
| 282 | 282 | ,TopLevel::sampleFoo() |
| 283 | - ,TopLevel::sampleUnionization() | |
| 283 | + ,TopLevel::sampleBarre() | |
| 284 | 284 | ); |
| 285 | 285 | } |
| 286 | 286 | } |
Mschema-pikedefault / TopLevel.pmod+6 −6
| @@ -13,17 +13,17 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - string barre; // json: "bar" | |
| 16 | + Union unionization; // json: "union" | |
| 17 | 17 | Enum enumerification; // json: "enum" |
| 18 | 18 | string foo; // json: "foo" |
| 19 | - Union unionization; // json: "union" | |
| 19 | + string barre; // json: "bar" | |
| 20 | 20 | |
| 21 | 21 | string encode_json() { |
| 22 | 22 | mapping(string:mixed) json = ([ |
| 23 | - "bar" : barre, | |
| 23 | + "union" : unionization, | |
| 24 | 24 | "enum" : enumerification, |
| 25 | 25 | "foo" : foo, |
| 26 | - "union" : unionization, | |
| 26 | + "bar" : barre, | |
| 27 | 27 | ]); |
| 28 | 28 | |
| 29 | 29 | return Standards.JSON.encode(json); |
| @@ -33,10 +33,10 @@ class TopLevel { | ||
| 33 | 33 | TopLevel TopLevel_from_JSON(mixed json) { |
| 34 | 34 | TopLevel retval = TopLevel(); |
| 35 | 35 | |
| 36 | - retval.barre = json["bar"]; | |
| 36 | + retval.unionization = json["union"]; | |
| 37 | 37 | retval.enumerification = json["enum"]; |
| 38 | 38 | retval.foo = json["foo"]; |
| 39 | - retval.unionization = json["union"]; | |
| 39 | + retval.barre = json["bar"]; | |
| 40 | 40 | |
| 41 | 41 | return retval; |
| 42 | 42 | } |
Mschema-pythondefault / quicktype.py+15 −15
| @@ -7,11 +7,6 @@ T = TypeVar("T") | ||
| 7 | 7 | EnumT = TypeVar("EnumT", bound=Enum) |
| 8 | 8 | |
| 9 | 9 | |
| 10 | -def from_str(x: Any) -> str: | |
| 11 | - assert isinstance(x, str) | |
| 12 | - return x | |
| 13 | - | |
| 14 | - | |
| 15 | 10 | def from_bool(x: Any) -> bool: |
| 16 | 11 | assert isinstance(x, bool) |
| 17 | 12 | return x |
| @@ -31,9 +26,9 @@ def from_union(fs, x): | ||
| 31 | 26 | assert False |
| 32 | 27 | |
| 33 | 28 | |
| 34 | -def to_enum(c: Type[EnumT], x: Any) -> EnumT: | |
| 35 | - assert isinstance(x, c) | |
| 36 | - return x.value | |
| 29 | +def from_str(x: Any) -> str: | |
| 30 | + assert isinstance(x, str) | |
| 31 | + return x | |
| 37 | 32 | |
| 38 | 33 | |
| 39 | 34 | def to_float(x: Any) -> float: |
| @@ -41,6 +36,11 @@ def to_float(x: Any) -> float: | ||
| 41 | 36 | return x |
| 42 | 37 | |
| 43 | 38 | |
| 39 | +def to_enum(c: Type[EnumT], x: Any) -> EnumT: | |
| 40 | + assert isinstance(x, c) | |
| 41 | + return x.value | |
| 42 | + | |
| 43 | + | |
| 44 | 44 | def to_class(c: Type[T], x: Any) -> dict: |
| 45 | 45 | assert isinstance(x, c) |
| 46 | 46 | return cast(Any, x).to_dict() |
| @@ -54,26 +54,26 @@ class EnumEnum(Enum): | ||
| 54 | 54 | |
| 55 | 55 | @dataclass |
| 56 | 56 | class TopLevel: |
| 57 | - barre: str | |
| 57 | + unionization: bool | float | |
| 58 | 58 | enumerification: EnumEnum |
| 59 | 59 | foo: str |
| 60 | - unionization: bool | float | |
| 60 | + barre: str | |
| 61 | 61 | |
| 62 | 62 | @staticmethod |
| 63 | 63 | def from_dict(obj: Any) -> 'TopLevel': |
| 64 | 64 | assert isinstance(obj, dict) |
| 65 | - barre = from_str(obj.get("bar")) | |
| 65 | + unionization = from_union([from_bool, from_float], obj.get("union")) | |
| 66 | 66 | enumerification = EnumEnum(obj.get("enum")) |
| 67 | 67 | foo = from_str(obj.get("foo")) |
| 68 | - unionization = from_union([from_bool, from_float], obj.get("union")) | |
| 69 | - return TopLevel(barre, enumerification, foo, unionization) | |
| 68 | + barre = from_str(obj.get("bar")) | |
| 69 | + return TopLevel(unionization, enumerification, foo, barre) | |
| 70 | 70 | |
| 71 | 71 | def to_dict(self) -> dict: |
| 72 | 72 | result: dict = {} |
| 73 | - result["bar"] = from_str(self.barre) | |
| 73 | + result["union"] = from_union([from_bool, to_float], self.unionization) | |
| 74 | 74 | result["enum"] = to_enum(EnumEnum, self.enumerification) |
| 75 | 75 | result["foo"] = from_str(self.foo) |
| 76 | - result["union"] = from_union([from_bool, to_float], self.unionization) | |
| 76 | + result["bar"] = from_str(self.barre) | |
| 77 | 77 | return result |
Mschema-rubydefault / TopLevel.rb+7 −7
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.barre | |
| 7 | +# puts top_level.unionization | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -60,18 +60,18 @@ class Union < Dry::Struct | ||
| 60 | 60 | end |
| 61 | 61 | |
| 62 | 62 | class TopLevel < Dry::Struct |
| 63 | - attribute :barre, Types::String | |
| 63 | + attribute :unionization, Types.Instance(Union) | |
| 64 | 64 | attribute :enumerification, Types::Enum |
| 65 | 65 | attribute :foo, Types::String |
| 66 | - attribute :unionization, Types.Instance(Union) | |
| 66 | + attribute :barre, Types::String | |
| 67 | 67 | |
| 68 | 68 | def self.from_dynamic!(d) |
| 69 | 69 | d = Types::Hash[d] |
| 70 | 70 | new( |
| 71 | - barre: d.fetch("bar"), | |
| 71 | + unionization: Union.from_dynamic!(d.fetch("union")), | |
| 72 | 72 | enumerification: d.fetch("enum"), |
| 73 | 73 | foo: d.fetch("foo"), |
| 74 | - unionization: Union.from_dynamic!(d.fetch("union")), | |
| 74 | + barre: d.fetch("bar"), | |
| 75 | 75 | ) |
| 76 | 76 | end |
| 77 | 77 | |
| @@ -81,10 +81,10 @@ class TopLevel < Dry::Struct | ||
| 81 | 81 | |
| 82 | 82 | def to_dynamic |
| 83 | 83 | { |
| 84 | - "bar" => barre, | |
| 84 | + "union" => unionization.to_dynamic, | |
| 85 | 85 | "enum" => enumerification, |
| 86 | 86 | "foo" => foo, |
| 87 | - "union" => unionization.to_dynamic, | |
| 87 | + "bar" => barre, | |
| 88 | 88 | } |
| 89 | 89 | end |
Mschema-rustdefault / module_under_test.rs+4 −4
| @@ -15,16 +15,16 @@ use serde::{Serialize, Deserialize}; | ||
| 15 | 15 | |
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | pub struct TopLevel { |
| 18 | - #[serde(rename = "bar")] | |
| 19 | - pub barre: String, | |
| 18 | + #[serde(rename = "union")] | |
| 19 | + pub unionization: Union, | |
| 20 | 20 | |
| 21 | 21 | #[serde(rename = "enum")] |
| 22 | 22 | pub enumerification: Enum, |
| 23 | 23 | |
| 24 | 24 | pub foo: String, |
| 25 | 25 | |
| 26 | - #[serde(rename = "union")] | |
| 27 | - pub unionization: Union, | |
| 26 | + #[serde(rename = "bar")] | |
| 27 | + pub barre: String, | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | #[derive(Debug, Clone, Serialize, Deserialize)] |
Mschema-scala3-upickledefault / TopLevel.scala+2 −2
| @@ -66,10 +66,10 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val bar : String, | |
| 69 | + val union : Union, | |
| 70 | 70 | val `enum` : EnumEnum, |
| 71 | 71 | val foo : String, |
| 72 | - val union : Union | |
| 72 | + val bar : String | |
| 73 | 73 | ) derives OptionPickler.ReadWriter |
| 74 | 74 | |
| 75 | 75 | enum EnumEnum : |
Mschema-scala3default / TopLevel.scala+2 −2
| @@ -8,10 +8,10 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val bar : String, | |
| 11 | + val union : Union, | |
| 12 | 12 | val `enum` : EnumEnum, |
| 13 | 13 | val foo : String, |
| 14 | - val union : Union | |
| 14 | + val bar : String | |
| 15 | 15 | ) derives Encoder.AsObject, Decoder |
| 16 | 16 | |
| 17 | 17 | enum EnumEnum : |
Mschema-schemadefault / TopLevel.schema+4 −4
| @@ -6,8 +6,8 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": false, |
| 8 | 8 | "properties": { |
| 9 | - "bar": { | |
| 10 | - "type": "string" | |
| 9 | + "union": { | |
| 10 | + "$ref": "#/definitions/Union" | |
| 11 | 11 | }, |
| 12 | 12 | "enum": { |
| 13 | 13 | "$ref": "#/definitions/Enum" |
| @@ -15,8 +15,8 @@ | ||
| 15 | 15 | "foo": { |
| 16 | 16 | "type": "string" |
| 17 | 17 | }, |
| 18 | - "union": { | |
| 19 | - "$ref": "#/definitions/Union" | |
| 18 | + "bar": { | |
| 19 | + "type": "string" | |
| 20 | 20 | } |
| 21 | 21 | }, |
| 22 | 22 | "required": [ |
Mschema-swiftdefault / quicktype.swift+8 −8
| @@ -7,16 +7,16 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | - let barre: String | |
| 10 | + let unionization: Union | |
| 11 | 11 | let enumerification: Enum |
| 12 | 12 | let foo: String |
| 13 | - let unionization: Union | |
| 13 | + let barre: String | |
| 14 | 14 | |
| 15 | 15 | enum CodingKeys: String, CodingKey { |
| 16 | - case barre = "bar" | |
| 16 | + case unionization = "union" | |
| 17 | 17 | case enumerification = "enum" |
| 18 | 18 | case foo = "foo" |
| 19 | - case unionization = "union" | |
| 19 | + case barre = "bar" | |
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
| @@ -39,16 +39,16 @@ extension TopLevel { | ||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | func with( |
| 42 | - barre: String? = nil, | |
| 42 | + unionization: Union? = nil, | |
| 43 | 43 | enumerification: Enum? = nil, |
| 44 | 44 | foo: String? = nil, |
| 45 | - unionization: Union? = nil | |
| 45 | + barre: String? = nil | |
| 46 | 46 | ) -> TopLevel { |
| 47 | 47 | return TopLevel( |
| 48 | - barre: barre ?? self.barre, | |
| 48 | + unionization: unionization ?? self.unionization, | |
| 49 | 49 | enumerification: enumerification ?? self.enumerification, |
| 50 | 50 | foo: foo ?? self.foo, |
| 51 | - unionization: unionization ?? self.unionization | |
| 51 | + barre: barre ?? self.barre | |
| 52 | 52 | ) |
| 53 | 53 | } |
Mschema-typescript-zoddefault / TopLevel.ts+2 −2
| @@ -9,9 +9,9 @@ export const EnumSchema = z.enum([ | ||
| 9 | 9 | export type Enum = z.infer<typeof EnumSchema>; |
| 10 | 10 | |
| 11 | 11 | export const TopLevelSchema = z.object({ |
| 12 | - "bar": z.string(), | |
| 12 | + "union": z.union([z.boolean(), z.number()]), | |
| 13 | 13 | "enum": EnumSchema, |
| 14 | 14 | "foo": z.string(), |
| 15 | - "union": z.union([z.boolean(), z.number()]), | |
| 15 | + "bar": z.string(), | |
| 16 | 16 | }); |
| 17 | 17 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+4 −4
| @@ -8,10 +8,10 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - bar: string; | |
| 11 | + union: Union; | |
| 12 | 12 | enum: Enum; |
| 13 | 13 | foo: string; |
| 14 | - union: Union; | |
| 14 | + bar: string; | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | export type Enum = "red" | "green" | "blue"; |
| @@ -185,10 +185,10 @@ function r(name: string) { | ||
| 185 | 185 | |
| 186 | 186 | const typeMap: any = { |
| 187 | 187 | "TopLevel": o([ |
| 188 | - { json: "bar", js: "bar", typ: "" }, | |
| 188 | + { json: "union", js: "union", typ: u(true, 3.14) }, | |
| 189 | 189 | { json: "enum", js: "enum", typ: r("Enum") }, |
| 190 | 190 | { json: "foo", js: "foo", typ: "" }, |
| 191 | - { json: "union", js: "union", typ: u(true, 3.14) }, | |
| 191 | + { json: "bar", js: "bar", typ: "" }, | |
| 192 | 192 | ], false), |
| 193 | 193 | "Enum": [ |
| 194 | 194 | "red", |
Test case
24 generated files · +133 −133test/inputs/schema/all-of-additional-properties-false.schema
Mschema-cplusplusdefault / quicktype.hpp+7 −7
| @@ -100,8 +100,8 @@ namespace quicktype { | ||
| 100 | 100 | private: |
| 101 | 101 | double amount; |
| 102 | 102 | Frequency frequency; |
| 103 | - std::optional<std::string> description; | |
| 104 | 103 | Type type; |
| 104 | + std::optional<std::string> description; | |
| 105 | 105 | |
| 106 | 106 | public: |
| 107 | 107 | const double & get_amount() const { return amount; } |
| @@ -112,13 +112,13 @@ namespace quicktype { | ||
| 112 | 112 | Frequency & get_mutable_frequency() { return frequency; } |
| 113 | 113 | void set_frequency(const Frequency & value) { this->frequency = value; } |
| 114 | 114 | |
| 115 | - const std::optional<std::string> & get_description() const { return description; } | |
| 116 | - std::optional<std::string> & get_mutable_description() { return description; } | |
| 117 | - void set_description(const std::optional<std::string> & value) { this->description = value; } | |
| 118 | - | |
| 119 | 115 | const Type & get_type() const { return type; } |
| 120 | 116 | Type & get_mutable_type() { return type; } |
| 121 | 117 | void set_type(const Type & value) { this->type = value; } |
| 118 | + | |
| 119 | + const std::optional<std::string> & get_description() const { return description; } | |
| 120 | + std::optional<std::string> & get_mutable_description() { return description; } | |
| 121 | + void set_description(const std::optional<std::string> & value) { this->description = value; } | |
| 122 | 122 | }; |
| 123 | 123 | } |
| 124 | 124 | |
| @@ -135,16 +135,16 @@ namespace quicktype { | ||
| 135 | 135 | inline void from_json(const json & j, TopLevel& x) { |
| 136 | 136 | x.set_amount(j.at("amount").get<double>()); |
| 137 | 137 | x.set_frequency(j.at("frequency").get<Frequency>()); |
| 138 | - x.set_description(get_stack_optional<std::string>(j, "description")); | |
| 139 | 138 | x.set_type(j.at("type").get<Type>()); |
| 139 | + x.set_description(get_stack_optional<std::string>(j, "description")); | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | inline void to_json(json & j, const TopLevel & x) { |
| 143 | 143 | j = json::object(); |
| 144 | 144 | j["amount"] = x.get_amount(); |
| 145 | 145 | j["frequency"] = x.get_frequency(); |
| 146 | - j["description"] = x.get_description(); | |
| 147 | 146 | j["type"] = x.get_type(); |
| 147 | + j["description"] = x.get_description(); | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | inline void from_json(const json & j, Frequency & x) { |
Mschema-csharp-recordsdefault / QuickType.cs+3 −3
| @@ -31,11 +31,11 @@ namespace QuickType | ||
| 31 | 31 | [JsonProperty("frequency", Required = Required.Always)] |
| 32 | 32 | public Frequency Frequency { get; set; } |
| 33 | 33 | |
| 34 | - [JsonProperty("description", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 35 | - public string? Description { get; set; } | |
| 36 | - | |
| 37 | 34 | [JsonProperty("type", Required = Required.Always)] |
| 38 | 35 | public TypeEnum Type { get; set; } |
| 36 | + | |
| 37 | + [JsonProperty("description", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 38 | + public string? Description { get; set; } | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public enum Frequency { Weekly, Monthly, Annually }; |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+4 −4
| @@ -30,13 +30,13 @@ namespace QuickType | ||
| 30 | 30 | [JsonPropertyName("frequency")] |
| 31 | 31 | public Frequency Frequency { get; set; } |
| 32 | 32 | |
| 33 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 34 | - [JsonPropertyName("description")] | |
| 35 | - public string? Description { get; set; } | |
| 36 | - | |
| 37 | 33 | [JsonRequired] |
| 38 | 34 | [JsonPropertyName("type")] |
| 39 | 35 | public TypeEnum Type { get; set; } |
| 36 | + | |
| 37 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 38 | + [JsonPropertyName("description")] | |
| 39 | + public string? Description { get; set; } | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public enum Frequency { Weekly, Monthly, Annually }; |
Mschema-csharpdefault / QuickType.cs+3 −3
| @@ -31,11 +31,11 @@ namespace QuickType | ||
| 31 | 31 | [JsonProperty("frequency", Required = Required.Always)] |
| 32 | 32 | public Frequency Frequency { get; set; } |
| 33 | 33 | |
| 34 | - [JsonProperty("description", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 35 | - public string? Description { get; set; } | |
| 36 | - | |
| 37 | 34 | [JsonProperty("type", Required = Required.Always)] |
| 38 | 35 | public TypeEnum Type { get; set; } |
| 36 | + | |
| 37 | + [JsonProperty("description", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 38 | + public string? Description { get; set; } | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public enum Frequency { Weekly, Monthly, Annually }; |
Mschema-dartdefault / TopLevel.dart+4 −4
| @@ -11,28 +11,28 @@ String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | ||
| 11 | 11 | class TopLevel { |
| 12 | 12 | final double amount; |
| 13 | 13 | final Frequency frequency; |
| 14 | - final String? description; | |
| 15 | 14 | final Type type; |
| 15 | + final String? description; | |
| 16 | 16 | |
| 17 | 17 | TopLevel({ |
| 18 | 18 | required this.amount, |
| 19 | 19 | required this.frequency, |
| 20 | - this.description, | |
| 21 | 20 | required this.type, |
| 21 | + this.description, | |
| 22 | 22 | }); |
| 23 | 23 | |
| 24 | 24 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 25 | 25 | amount: json["amount"]?.toDouble(), |
| 26 | 26 | frequency: frequencyValues.map[json["frequency"]]!, |
| 27 | - description: json["description"], | |
| 28 | 27 | type: typeValues.map[json["type"]]!, |
| 28 | + description: json["description"], | |
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | 31 | Map<String, dynamic> toJson() => { |
| 32 | 32 | "amount": amount, |
| 33 | 33 | "frequency": frequencyValues.reverse[frequency], |
| 34 | - "description": description, | |
| 35 | 34 | "type": typeValues.reverse[type], |
| 35 | + "description": description, | |
| 36 | 36 | }; |
| 37 | 37 | } |
Mschema-elixirdefault / QuickType.ex+5 −5
| @@ -100,21 +100,21 @@ end | ||
| 100 | 100 | |
| 101 | 101 | defmodule TopLevel do |
| 102 | 102 | @enforce_keys [:amount, :frequency, :type] |
| 103 | - defstruct [:amount, :frequency, :description, :type] | |
| 103 | + defstruct [:amount, :frequency, :type, :description] | |
| 104 | 104 | |
| 105 | 105 | @type t :: %__MODULE__{ |
| 106 | 106 | amount: float(), |
| 107 | 107 | frequency: Frequency.t(), |
| 108 | - description: String.t() | nil, | |
| 109 | - type: Type.t() | |
| 108 | + type: Type.t(), | |
| 109 | + description: String.t() | nil | |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | def from_map(m) do |
| 113 | 113 | %TopLevel{ |
| 114 | 114 | amount: m["amount"], |
| 115 | 115 | frequency: Frequency.decode(m["frequency"]), |
| 116 | - description: m["description"], | |
| 117 | 116 | type: Type.decode(m["type"]), |
| 117 | + description: m["description"], | |
| 118 | 118 | } |
| 119 | 119 | end |
| 120 | 120 | |
| @@ -128,8 +128,8 @@ defmodule TopLevel do | ||
| 128 | 128 | %{ |
| 129 | 129 | "amount" => struct.amount, |
| 130 | 130 | "frequency" => Frequency.encode(struct.frequency), |
| 131 | - "description" => struct.description, | |
| 132 | 131 | "type" => Type.encode(struct.type), |
| 132 | + "description" => struct.description, | |
| 133 | 133 | } |
| 134 | 134 | end |
Mschema-elmdefault / QuickType.elm+3 −3
| @@ -27,8 +27,8 @@ import Dict exposing (Dict) | ||
| 27 | 27 | type alias QuickType = |
| 28 | 28 | { amount : Float |
| 29 | 29 | , frequency : Frequency |
| 30 | - , description : Maybe String | |
| 31 | 30 | , quickTypeType : Type |
| 31 | + , description : Maybe String | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | type Frequency |
| @@ -50,16 +50,16 @@ quickType = | ||
| 50 | 50 | Jdec.succeed QuickType |
| 51 | 51 | |> Jpipe.required "amount" Jdec.float |
| 52 | 52 | |> Jpipe.required "frequency" frequency |
| 53 | - |> Jpipe.optional "description" (Jdec.nullable Jdec.string) Nothing | |
| 54 | 53 | |> Jpipe.required "type" purpleType |
| 54 | + |> Jpipe.optional "description" (Jdec.nullable Jdec.string) Nothing | |
| 55 | 55 | |
| 56 | 56 | encodeQuickType : QuickType -> Jenc.Value |
| 57 | 57 | encodeQuickType x = |
| 58 | 58 | Jenc.object |
| 59 | 59 | [ ("amount", Jenc.float x.amount) |
| 60 | 60 | , ("frequency", encodeFrequency x.frequency) |
| 61 | - , ("description", makeNullableEncoder Jenc.string x.description) | |
| 62 | 61 | , ("type", encodeType x.quickTypeType) |
| 62 | + , ("description", makeNullableEncoder Jenc.string x.description) | |
| 63 | 63 | ] |
| 64 | 64 | |
| 65 | 65 | frequency : Jdec.Decoder Frequency |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -12,8 +12,8 @@ | ||
| 12 | 12 | export type TopLevel = { |
| 13 | 13 | amount: number; |
| 14 | 14 | frequency: Frequency; |
| 15 | - description?: string; | |
| 16 | 15 | type: Type; |
| 16 | + description?: string; | |
| 17 | 17 | }; |
| 18 | 18 | |
| 19 | 19 | export type Frequency = |
| @@ -192,8 +192,8 @@ const typeMap: any = { | ||
| 192 | 192 | "TopLevel": o([ |
| 193 | 193 | { json: "amount", js: "amount", typ: 3.14 }, |
| 194 | 194 | { json: "frequency", js: "frequency", typ: r("Frequency") }, |
| 195 | - { json: "description", js: "description", typ: u(undefined, "") }, | |
| 196 | 195 | { json: "type", js: "type", typ: r("Type") }, |
| 196 | + { json: "description", js: "description", typ: u(undefined, "") }, | |
| 197 | 197 | ], false), |
| 198 | 198 | "Frequency": [ |
| 199 | 199 | "Weekly", |
Mschema-golangdefault / quicktype.go+1 −1
| @@ -21,8 +21,8 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 21 | 21 | type TopLevel struct { |
| 22 | 22 | Amount float64 `json:"amount"` |
| 23 | 23 | Frequency Frequency `json:"frequency"` |
| 24 | - Description *string `json:"description,omitempty"` | |
| 25 | 24 | Type Type `json:"type"` |
| 25 | + Description *string `json:"description,omitempty"` | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | type Frequency string |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -5,8 +5,8 @@ import com.fasterxml.jackson.annotation.*; | ||
| 5 | 5 | public class TopLevel { |
| 6 | 6 | private double amount; |
| 7 | 7 | private Frequency frequency; |
| 8 | - private String description; | |
| 9 | 8 | private Type type; |
| 9 | + private String description; | |
| 10 | 10 | |
| 11 | 11 | @JsonProperty("amount") |
| 12 | 12 | public double getAmount() { return amount; } |
| @@ -18,13 +18,13 @@ public class TopLevel { | ||
| 18 | 18 | @JsonProperty("frequency") |
| 19 | 19 | public void setFrequency(Frequency value) { this.frequency = value; } |
| 20 | 20 | |
| 21 | - @JsonProperty("description") | |
| 22 | - public String getDescription() { return description; } | |
| 23 | - @JsonProperty("description") | |
| 24 | - public void setDescription(String value) { this.description = value; } | |
| 25 | - | |
| 26 | 21 | @JsonProperty("type") |
| 27 | 22 | public Type getType() { return type; } |
| 28 | 23 | @JsonProperty("type") |
| 29 | 24 | public void setType(Type value) { this.type = value; } |
| 25 | + | |
| 26 | + @JsonProperty("description") | |
| 27 | + public String getDescription() { return description; } | |
| 28 | + @JsonProperty("description") | |
| 29 | + public void setDescription(String value) { this.description = value; } | |
| 30 | 30 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -5,8 +5,8 @@ import com.fasterxml.jackson.annotation.*; | ||
| 5 | 5 | public class TopLevel { |
| 6 | 6 | private double amount; |
| 7 | 7 | private Frequency frequency; |
| 8 | - private String description; | |
| 9 | 8 | private Type type; |
| 9 | + private String description; | |
| 10 | 10 | |
| 11 | 11 | @JsonProperty("amount") |
| 12 | 12 | public double getAmount() { return amount; } |
| @@ -18,13 +18,13 @@ public class TopLevel { | ||
| 18 | 18 | @JsonProperty("frequency") |
| 19 | 19 | public void setFrequency(Frequency value) { this.frequency = value; } |
| 20 | 20 | |
| 21 | - @JsonProperty("description") | |
| 22 | - public String getDescription() { return description; } | |
| 23 | - @JsonProperty("description") | |
| 24 | - public void setDescription(String value) { this.description = value; } | |
| 25 | - | |
| 26 | 21 | @JsonProperty("type") |
| 27 | 22 | public Type getType() { return type; } |
| 28 | 23 | @JsonProperty("type") |
| 29 | 24 | public void setType(Type value) { this.type = value; } |
| 25 | + | |
| 26 | + @JsonProperty("description") | |
| 27 | + public String getDescription() { return description; } | |
| 28 | + @JsonProperty("description") | |
| 29 | + public void setDescription(String value) { this.description = value; } | |
| 30 | 30 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -5,8 +5,8 @@ import com.fasterxml.jackson.annotation.*; | ||
| 5 | 5 | public class TopLevel { |
| 6 | 6 | private double amount; |
| 7 | 7 | private Frequency frequency; |
| 8 | - private String description; | |
| 9 | 8 | private Type type; |
| 9 | + private String description; | |
| 10 | 10 | |
| 11 | 11 | @JsonProperty("amount") |
| 12 | 12 | public double getAmount() { return amount; } |
| @@ -18,13 +18,13 @@ public class TopLevel { | ||
| 18 | 18 | @JsonProperty("frequency") |
| 19 | 19 | public void setFrequency(Frequency value) { this.frequency = value; } |
| 20 | 20 | |
| 21 | - @JsonProperty("description") | |
| 22 | - public String getDescription() { return description; } | |
| 23 | - @JsonProperty("description") | |
| 24 | - public void setDescription(String value) { this.description = value; } | |
| 25 | - | |
| 26 | 21 | @JsonProperty("type") |
| 27 | 22 | public Type getType() { return type; } |
| 28 | 23 | @JsonProperty("type") |
| 29 | 24 | public void setType(Type value) { this.type = value; } |
| 25 | + | |
| 26 | + @JsonProperty("description") | |
| 27 | + public String getDescription() { return description; } | |
| 28 | + @JsonProperty("description") | |
| 29 | + public void setDescription(String value) { this.description = value; } | |
| 30 | 30 | } |
Mschema-javascriptdefault / TopLevel.js+1 −1
| @@ -174,8 +174,8 @@ const typeMap = { | ||
| 174 | 174 | "TopLevel": o([ |
| 175 | 175 | { json: "amount", js: "amount", typ: 3.14 }, |
| 176 | 176 | { json: "frequency", js: "frequency", typ: r("Frequency") }, |
| 177 | - { json: "description", js: "description", typ: u(undefined, "") }, | |
| 178 | 177 | { json: "type", js: "type", typ: r("Type") }, |
| 178 | + { json: "description", js: "description", typ: u(undefined, "") }, | |
| 179 | 179 | ], false), |
| 180 | 180 | "Frequency": [ |
| 181 | 181 | "Weekly", |
Mschema-kotlin-jacksondefault / TopLevel.kt+3 −3
| @@ -38,10 +38,10 @@ data class TopLevel ( | ||
| 38 | 38 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 39 | 39 | val frequency: Frequency, |
| 40 | 40 | |
| 41 | - val description: String? = null, | |
| 42 | - | |
| 43 | 41 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 44 | - val type: Type | |
| 42 | + val type: Type, | |
| 43 | + | |
| 44 | + val description: String? = null | |
| 45 | 45 | ) { |
| 46 | 46 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+2 −2
| @@ -21,8 +21,8 @@ private val klaxon = Klaxon() | ||
| 21 | 21 | data class TopLevel ( |
| 22 | 22 | val amount: Double, |
| 23 | 23 | val frequency: Frequency, |
| 24 | - val description: String? = null, | |
| 25 | - val type: Type | |
| 24 | + val type: Type, | |
| 25 | + val description: String? = null | |
| 26 | 26 | ) { |
| 27 | 27 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-kotlinxdefault / TopLevel.kt+2 −2
| @@ -14,8 +14,8 @@ import kotlinx.serialization.encoding.* | ||
| 14 | 14 | data class TopLevel ( |
| 15 | 15 | val amount: Double, |
| 16 | 16 | val frequency: Frequency, |
| 17 | - val description: String? = null, | |
| 18 | - val type: Type | |
| 17 | + val type: Type, | |
| 18 | + val description: String? = null | |
| 19 | 19 | ) |
| 20 | 20 | |
| 21 | 21 | @Serializable |
Mschema-phpdefault / TopLevel.php+58 −58
| @@ -6,20 +6,20 @@ declare(strict_types=1); | ||
| 6 | 6 | class TopLevel { |
| 7 | 7 | private float $amount; // json:amount Required |
| 8 | 8 | private Frequency $frequency; // json:frequency Required |
| 9 | - private ?string $description; // json:description Optional | |
| 10 | 9 | private Type $type; // json:type Required |
| 10 | + private ?string $description; // json:description Optional | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @param float $amount |
| 14 | 14 | * @param Frequency $frequency |
| 15 | - * @param string|null $description | |
| 16 | 15 | * @param Type $type |
| 16 | + * @param string|null $description | |
| 17 | 17 | */ |
| 18 | - public function __construct(float $amount, Frequency $frequency, ?string $description, Type $type) { | |
| 18 | + public function __construct(float $amount, Frequency $frequency, Type $type, ?string $description) { | |
| 19 | 19 | $this->amount = $amount; |
| 20 | 20 | $this->frequency = $frequency; |
| 21 | - $this->description = $description; | |
| 22 | 21 | $this->type = $type; |
| 22 | + $this->description = $description; | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
| @@ -118,108 +118,108 @@ class TopLevel { | ||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | - * @param ?string $value | |
| 121 | + * @param string $value | |
| 122 | 122 | * @throws Exception |
| 123 | - * @return ?string | |
| 123 | + * @return Type | |
| 124 | 124 | */ |
| 125 | - public static function fromDescription(?string $value): ?string { | |
| 126 | - if (!is_null($value)) { | |
| 127 | - return $value; /*string*/ | |
| 128 | - } else { | |
| 129 | - return null; | |
| 130 | - } | |
| 125 | + public static function fromType(string $value): Type { | |
| 126 | + return Type::from($value); /*enum*/ | |
| 131 | 127 | } |
| 132 | 128 | |
| 133 | 129 | /** |
| 134 | 130 | * @throws Exception |
| 135 | - * @return ?string | |
| 131 | + * @return string | |
| 136 | 132 | */ |
| 137 | - public function toDescription(): ?string { | |
| 138 | - if (TopLevel::validateDescription($this->description)) { | |
| 139 | - if (!is_null($this->description)) { | |
| 140 | - return $this->description; /*string*/ | |
| 141 | - } else { | |
| 142 | - return null; | |
| 143 | - } | |
| 133 | + public function toType(): string { | |
| 134 | + if (TopLevel::validateType($this->type)) { | |
| 135 | + return Type::to($this->type); /*enum*/ | |
| 144 | 136 | } |
| 145 | - throw new Exception('never get to this TopLevel::description'); | |
| 137 | + throw new Exception('never get to this TopLevel::type'); | |
| 146 | 138 | } |
| 147 | 139 | |
| 148 | 140 | /** |
| 149 | - * @param string|null | |
| 141 | + * @param Type | |
| 150 | 142 | * @return bool |
| 151 | 143 | * @throws Exception |
| 152 | 144 | */ |
| 153 | - public static function validateDescription(?string $value): bool { | |
| 154 | - if (!is_null($value)) { | |
| 155 | - } | |
| 145 | + public static function validateType(Type $value): bool { | |
| 146 | + Type::to($value); | |
| 156 | 147 | return true; |
| 157 | 148 | } |
| 158 | 149 | |
| 159 | 150 | /** |
| 160 | 151 | * @throws Exception |
| 161 | - * @return ?string | |
| 152 | + * @return Type | |
| 162 | 153 | */ |
| 163 | - public function getDescription(): ?string { | |
| 164 | - if (TopLevel::validateDescription($this->description)) { | |
| 165 | - return $this->description; | |
| 154 | + public function getType(): Type { | |
| 155 | + if (TopLevel::validateType($this->type)) { | |
| 156 | + return $this->type; | |
| 166 | 157 | } |
| 167 | - throw new Exception('never get to getDescription TopLevel::description'); | |
| 158 | + throw new Exception('never get to getType TopLevel::type'); | |
| 168 | 159 | } |
| 169 | 160 | |
| 170 | 161 | /** |
| 171 | - * @return ?string | |
| 162 | + * @return Type | |
| 172 | 163 | */ |
| 173 | - public static function sampleDescription(): ?string { | |
| 174 | - return 'TopLevel::description::33'; /*33:description*/ | |
| 164 | + public static function sampleType(): Type { | |
| 165 | + return Type::sample(); /*enum*/ | |
| 175 | 166 | } |
| 176 | 167 | |
| 177 | 168 | /** |
| 178 | - * @param string $value | |
| 169 | + * @param ?string $value | |
| 179 | 170 | * @throws Exception |
| 180 | - * @return Type | |
| 171 | + * @return ?string | |
| 181 | 172 | */ |
| 182 | - public static function fromType(string $value): Type { | |
| 183 | - return Type::from($value); /*enum*/ | |
| 173 | + public static function fromDescription(?string $value): ?string { | |
| 174 | + if (!is_null($value)) { | |
| 175 | + return $value; /*string*/ | |
| 176 | + } else { | |
| 177 | + return null; | |
| 178 | + } | |
| 184 | 179 | } |
| 185 | 180 | |
| 186 | 181 | /** |
| 187 | 182 | * @throws Exception |
| 188 | - * @return string | |
| 183 | + * @return ?string | |
| 189 | 184 | */ |
| 190 | - public function toType(): string { | |
| 191 | - if (TopLevel::validateType($this->type)) { | |
| 192 | - return Type::to($this->type); /*enum*/ | |
| 185 | + public function toDescription(): ?string { | |
| 186 | + if (TopLevel::validateDescription($this->description)) { | |
| 187 | + if (!is_null($this->description)) { | |
| 188 | + return $this->description; /*string*/ | |
| 189 | + } else { | |
| 190 | + return null; | |
| 191 | + } | |
| 193 | 192 | } |
| 194 | - throw new Exception('never get to this TopLevel::type'); | |
| 193 | + throw new Exception('never get to this TopLevel::description'); | |
| 195 | 194 | } |
| 196 | 195 | |
| 197 | 196 | /** |
| 198 | - * @param Type | |
| 197 | + * @param string|null | |
| 199 | 198 | * @return bool |
| 200 | 199 | * @throws Exception |
| 201 | 200 | */ |
| 202 | - public static function validateType(Type $value): bool { | |
| 203 | - Type::to($value); | |
| 201 | + public static function validateDescription(?string $value): bool { | |
| 202 | + if (!is_null($value)) { | |
| 203 | + } | |
| 204 | 204 | return true; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
| 208 | 208 | * @throws Exception |
| 209 | - * @return Type | |
| 209 | + * @return ?string | |
| 210 | 210 | */ |
| 211 | - public function getType(): Type { | |
| 212 | - if (TopLevel::validateType($this->type)) { | |
| 213 | - return $this->type; | |
| 211 | + public function getDescription(): ?string { | |
| 212 | + if (TopLevel::validateDescription($this->description)) { | |
| 213 | + return $this->description; | |
| 214 | 214 | } |
| 215 | - throw new Exception('never get to getType TopLevel::type'); | |
| 215 | + throw new Exception('never get to getDescription TopLevel::description'); | |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
| 219 | - * @return Type | |
| 219 | + * @return ?string | |
| 220 | 220 | */ |
| 221 | - public static function sampleType(): Type { | |
| 222 | - return Type::sample(); /*enum*/ | |
| 221 | + public static function sampleDescription(): ?string { | |
| 222 | + return 'TopLevel::description::34'; /*34:description*/ | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
| @@ -229,8 +229,8 @@ class TopLevel { | ||
| 229 | 229 | public function validate(): bool { |
| 230 | 230 | return TopLevel::validateAmount($this->amount) |
| 231 | 231 | || TopLevel::validateFrequency($this->frequency) |
| 232 | - || TopLevel::validateDescription($this->description) | |
| 233 | - || TopLevel::validateType($this->type); | |
| 232 | + || TopLevel::validateType($this->type) | |
| 233 | + || TopLevel::validateDescription($this->description); | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
| @@ -241,8 +241,8 @@ class TopLevel { | ||
| 241 | 241 | $out = new stdClass(); |
| 242 | 242 | $out->{'amount'} = $this->toAmount(); |
| 243 | 243 | $out->{'frequency'} = $this->toFrequency(); |
| 244 | - $out->{'description'} = $this->toDescription(); | |
| 245 | 244 | $out->{'type'} = $this->toType(); |
| 245 | + $out->{'description'} = $this->toDescription(); | |
| 246 | 246 | return $out; |
| 247 | 247 | } |
| 248 | 248 | |
| @@ -255,8 +255,8 @@ class TopLevel { | ||
| 255 | 255 | return new TopLevel( |
| 256 | 256 | TopLevel::fromAmount($obj->{'amount'}) |
| 257 | 257 | ,TopLevel::fromFrequency($obj->{'frequency'}) |
| 258 | - ,TopLevel::fromDescription($obj->{'description'}) | |
| 259 | 258 | ,TopLevel::fromType($obj->{'type'}) |
| 259 | + ,TopLevel::fromDescription($obj->{'description'}) | |
| 260 | 260 | ); |
| 261 | 261 | } |
| 262 | 262 | |
| @@ -267,8 +267,8 @@ class TopLevel { | ||
| 267 | 267 | return new TopLevel( |
| 268 | 268 | TopLevel::sampleAmount() |
| 269 | 269 | ,TopLevel::sampleFrequency() |
| 270 | - ,TopLevel::sampleDescription() | |
| 271 | 270 | ,TopLevel::sampleType() |
| 271 | + ,TopLevel::sampleDescription() | |
| 272 | 272 | ); |
| 273 | 273 | } |
| 274 | 274 | } |
Mschema-pikedefault / TopLevel.pmod+3 −3
| @@ -15,15 +15,15 @@ | ||
| 15 | 15 | class TopLevel { |
| 16 | 16 | float amount; // json: "amount" |
| 17 | 17 | Frequency frequency; // json: "frequency" |
| 18 | - mixed|string description; // json: "description" | |
| 19 | 18 | Type type; // json: "type" |
| 19 | + mixed|string description; // json: "description" | |
| 20 | 20 | |
| 21 | 21 | string encode_json() { |
| 22 | 22 | mapping(string:mixed) json = ([ |
| 23 | 23 | "amount" : amount, |
| 24 | 24 | "frequency" : frequency, |
| 25 | - "description" : description, | |
| 26 | 25 | "type" : type, |
| 26 | + "description" : description, | |
| 27 | 27 | ]); |
| 28 | 28 | |
| 29 | 29 | return Standards.JSON.encode(json); |
| @@ -35,8 +35,8 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 35 | 35 | |
| 36 | 36 | retval.amount = json["amount"]; |
| 37 | 37 | retval.frequency = json["frequency"]; |
| 38 | - retval.description = json["description"]; | |
| 39 | 38 | retval.type = json["type"]; |
| 39 | + retval.description = json["description"]; | |
| 40 | 40 | |
| 41 | 41 | return retval; |
| 42 | 42 | } |
Mschema-rubydefault / TopLevel.rb+3 −3
| @@ -36,16 +36,16 @@ end | ||
| 36 | 36 | class TopLevel < Dry::Struct |
| 37 | 37 | attribute :amount, Types::Double |
| 38 | 38 | attribute :frequency, Types::Frequency |
| 39 | - attribute :description, Types::String.optional | |
| 40 | 39 | attribute :top_level_type, Types::Type |
| 40 | + attribute :description, Types::String.optional | |
| 41 | 41 | |
| 42 | 42 | def self.from_dynamic!(d) |
| 43 | 43 | d = Types::Hash[d] |
| 44 | 44 | new( |
| 45 | 45 | amount: d.fetch("amount"), |
| 46 | 46 | frequency: d.fetch("frequency"), |
| 47 | - description: d["description"], | |
| 48 | 47 | top_level_type: d.fetch("type"), |
| 48 | + description: d["description"], | |
| 49 | 49 | ) |
| 50 | 50 | end |
| 51 | 51 | |
| @@ -57,8 +57,8 @@ class TopLevel < Dry::Struct | ||
| 57 | 57 | { |
| 58 | 58 | "amount" => amount, |
| 59 | 59 | "frequency" => frequency, |
| 60 | - "description" => description, | |
| 61 | 60 | "type" => top_level_type, |
| 61 | + "description" => description, | |
| 62 | 62 | } |
| 63 | 63 | end |
Mschema-rustdefault / module_under_test.rs+2 −2
| @@ -19,10 +19,10 @@ pub struct TopLevel { | ||
| 19 | 19 | |
| 20 | 20 | pub frequency: Frequency, |
| 21 | 21 | |
| 22 | - pub description: Option<String>, | |
| 23 | - | |
| 24 | 22 | #[serde(rename = "type")] |
| 25 | 23 | pub top_level_type: Type, |
| 24 | + | |
| 25 | + pub description: Option<String>, | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | #[derive(Debug, Clone, Serialize, Deserialize)] |
Mschema-scala3-upickledefault / TopLevel.scala+2 −2
| @@ -68,8 +68,8 @@ end JsonExt | ||
| 68 | 68 | case class TopLevel ( |
| 69 | 69 | val amount : Double, |
| 70 | 70 | val frequency : Frequency, |
| 71 | - val description : Option[String] = None, | |
| 72 | - val `type` : Type | |
| 71 | + val `type` : Type, | |
| 72 | + val description : Option[String] = None | |
| 73 | 73 | ) derives OptionPickler.ReadWriter |
| 74 | 74 | |
| 75 | 75 | enum Frequency : |
Mschema-scala3default / TopLevel.scala+2 −2
| @@ -10,8 +10,8 @@ type NullValue = None.type | ||
| 10 | 10 | case class TopLevel ( |
| 11 | 11 | val amount : Double, |
| 12 | 12 | val frequency : Frequency, |
| 13 | - val description : Option[String] = None, | |
| 14 | - val `type` : Type | |
| 13 | + val `type` : Type, | |
| 14 | + val description : Option[String] = None | |
| 15 | 15 | ) derives Encoder.AsObject, Decoder |
| 16 | 16 | |
| 17 | 17 | enum Frequency : |
Mschema-schemadefault / TopLevel.schema+3 −3
| @@ -12,11 +12,11 @@ | ||
| 12 | 12 | "frequency": { |
| 13 | 13 | "$ref": "#/definitions/Frequency" |
| 14 | 14 | }, |
| 15 | - "description": { | |
| 16 | - "type": "string" | |
| 17 | - }, | |
| 18 | 15 | "type": { |
| 19 | 16 | "$ref": "#/definitions/Type" |
| 17 | + }, | |
| 18 | + "description": { | |
| 19 | + "type": "string" | |
| 20 | 20 | } |
| 21 | 21 | }, |
| 22 | 22 | "required": [ |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -10,8 +10,8 @@ | ||
| 10 | 10 | export interface TopLevel { |
| 11 | 11 | amount: number; |
| 12 | 12 | frequency: Frequency; |
| 13 | - description?: string; | |
| 14 | 13 | type: Type; |
| 14 | + description?: string; | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | export type Frequency = "Weekly" | "Monthly" | "Annually"; |
| @@ -187,8 +187,8 @@ const typeMap: any = { | ||
| 187 | 187 | "TopLevel": o([ |
| 188 | 188 | { json: "amount", js: "amount", typ: 3.14 }, |
| 189 | 189 | { json: "frequency", js: "frequency", typ: r("Frequency") }, |
| 190 | - { json: "description", js: "description", typ: u(undefined, "") }, | |
| 191 | 190 | { json: "type", js: "type", typ: r("Type") }, |
| 191 | + { json: "description", js: "description", typ: u(undefined, "") }, | |
| 192 | 192 | ], false), |
| 193 | 193 | "Frequency": [ |
| 194 | 194 | "Weekly", |
Test case
26 generated files · +472 −472test/inputs/schema/bool-string.schema
Mschema-cjsondefault / TopLevel.c+67 −67
| @@ -62,6 +62,31 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 62 | 62 | if (NULL != j) { |
| 63 | 63 | if (NULL != (x = cJSON_malloc(sizeof(struct TopLevel)))) { |
| 64 | 64 | memset(x, 0, sizeof(struct TopLevel)); |
| 65 | + if (cJSON_HasObjectItem(j, "one")) { | |
| 66 | + x->one = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "one"))); | |
| 67 | + } | |
| 68 | + else { | |
| 69 | + if (NULL != (x->one = cJSON_malloc(sizeof(char)))) { | |
| 70 | + x->one[0] = '\0'; | |
| 71 | + } | |
| 72 | + } | |
| 73 | + if (cJSON_HasObjectItem(j, "optional")) { | |
| 74 | + x->optional = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "optional"))); | |
| 75 | + } | |
| 76 | + if ((cJSON_HasObjectItem(j, "nullable")) && (!cJSON_IsNull(cJSON_GetObjectItemCaseSensitive(j, "nullable")))) { | |
| 77 | + x->nullable = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "nullable"))); | |
| 78 | + } | |
| 79 | + if (cJSON_HasObjectItem(j, "arrOne")) { | |
| 80 | + list_t * x1 = list_create(false, NULL); | |
| 81 | + if (NULL != x1) { | |
| 82 | + cJSON * e1 = NULL; | |
| 83 | + cJSON * j1 = cJSON_GetObjectItemCaseSensitive(j, "arrOne"); | |
| 84 | + cJSON_ArrayForEach(e1, j1) { | |
| 85 | + list_add_tail(x1, strdup(cJSON_GetStringValue(e1)), sizeof(char *)); | |
| 86 | + } | |
| 87 | + x->arr_one = x1; | |
| 88 | + } | |
| 89 | + } | |
| 65 | 90 | if (cJSON_HasObjectItem(j, "arrNullable")) { |
| 66 | 91 | list_t * x1 = list_create(false, NULL); |
| 67 | 92 | if (NULL != x1) { |
| @@ -78,31 +103,6 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 78 | 103 | x->arr_nullable = x1; |
| 79 | 104 | } |
| 80 | 105 | } |
| 81 | - if (cJSON_HasObjectItem(j, "arrOne")) { | |
| 82 | - list_t * x1 = list_create(false, NULL); | |
| 83 | - if (NULL != x1) { | |
| 84 | - cJSON * e1 = NULL; | |
| 85 | - cJSON * j1 = cJSON_GetObjectItemCaseSensitive(j, "arrOne"); | |
| 86 | - cJSON_ArrayForEach(e1, j1) { | |
| 87 | - list_add_tail(x1, strdup(cJSON_GetStringValue(e1)), sizeof(char *)); | |
| 88 | - } | |
| 89 | - x->arr_one = x1; | |
| 90 | - } | |
| 91 | - } | |
| 92 | - if ((cJSON_HasObjectItem(j, "nullable")) && (!cJSON_IsNull(cJSON_GetObjectItemCaseSensitive(j, "nullable")))) { | |
| 93 | - x->nullable = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "nullable"))); | |
| 94 | - } | |
| 95 | - if (cJSON_HasObjectItem(j, "one")) { | |
| 96 | - x->one = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "one"))); | |
| 97 | - } | |
| 98 | - else { | |
| 99 | - if (NULL != (x->one = cJSON_malloc(sizeof(char)))) { | |
| 100 | - x->one[0] = '\0'; | |
| 101 | - } | |
| 102 | - } | |
| 103 | - if (cJSON_HasObjectItem(j, "optional")) { | |
| 104 | - x->optional = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "optional"))); | |
| 105 | - } | |
| 106 | 106 | if (cJSON_HasObjectItem(j, "unionWithBool")) { |
| 107 | 107 | x->union_with_bool = cJSON_GetUnionWithBoolValue(cJSON_GetObjectItemCaseSensitive(j, "unionWithBool")); |
| 108 | 108 | } |
| @@ -118,6 +118,31 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 118 | 118 | cJSON * j = NULL; |
| 119 | 119 | if (NULL != x) { |
| 120 | 120 | if (NULL != (j = cJSON_CreateObject())) { |
| 121 | + if (NULL != x->one) { | |
| 122 | + cJSON_AddStringToObject(j, "one", x->one); | |
| 123 | + } | |
| 124 | + else { | |
| 125 | + cJSON_AddStringToObject(j, "one", ""); | |
| 126 | + } | |
| 127 | + if (NULL != x->optional) { | |
| 128 | + cJSON_AddStringToObject(j, "optional", x->optional); | |
| 129 | + } | |
| 130 | + if (NULL != x->nullable) { | |
| 131 | + cJSON_AddStringToObject(j, "nullable", x->nullable); | |
| 132 | + } | |
| 133 | + else { | |
| 134 | + cJSON_AddNullToObject(j, "nullable"); | |
| 135 | + } | |
| 136 | + if (NULL != x->arr_one) { | |
| 137 | + cJSON * j1 = cJSON_AddArrayToObject(j, "arrOne"); | |
| 138 | + if (NULL != j1) { | |
| 139 | + char * x1 = list_get_head(x->arr_one); | |
| 140 | + while (NULL != x1) { | |
| 141 | + cJSON_AddItemToArray(j1, cJSON_CreateString(x1)); | |
| 142 | + x1 = list_get_next(x->arr_one); | |
| 143 | + } | |
| 144 | + } | |
| 145 | + } | |
| 121 | 146 | if (NULL != x->arr_nullable) { |
| 122 | 147 | cJSON * j1 = cJSON_AddArrayToObject(j, "arrNullable"); |
| 123 | 148 | if (NULL != j1) { |
| @@ -133,31 +158,6 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 133 | 158 | } |
| 134 | 159 | } |
| 135 | 160 | } |
| 136 | - if (NULL != x->arr_one) { | |
| 137 | - cJSON * j1 = cJSON_AddArrayToObject(j, "arrOne"); | |
| 138 | - if (NULL != j1) { | |
| 139 | - char * x1 = list_get_head(x->arr_one); | |
| 140 | - while (NULL != x1) { | |
| 141 | - cJSON_AddItemToArray(j1, cJSON_CreateString(x1)); | |
| 142 | - x1 = list_get_next(x->arr_one); | |
| 143 | - } | |
| 144 | - } | |
| 145 | - } | |
| 146 | - if (NULL != x->nullable) { | |
| 147 | - cJSON_AddStringToObject(j, "nullable", x->nullable); | |
| 148 | - } | |
| 149 | - else { | |
| 150 | - cJSON_AddNullToObject(j, "nullable"); | |
| 151 | - } | |
| 152 | - if (NULL != x->one) { | |
| 153 | - cJSON_AddStringToObject(j, "one", x->one); | |
| 154 | - } | |
| 155 | - else { | |
| 156 | - cJSON_AddStringToObject(j, "one", ""); | |
| 157 | - } | |
| 158 | - if (NULL != x->optional) { | |
| 159 | - cJSON_AddStringToObject(j, "optional", x->optional); | |
| 160 | - } | |
| 161 | 161 | cJSON_AddItemToObject(j, "unionWithBool", cJSON_CreateUnionWithBool(x->union_with_bool)); |
| 162 | 162 | cJSON_AddItemToObject(j, "unionWithBoolAndEnum", cJSON_CreateUnionWithBool(x->union_with_bool_and_enum)); |
| 163 | 163 | } |
| @@ -179,15 +179,14 @@ char * cJSON_PrintTopLevel(const struct TopLevel * x) { | ||
| 179 | 179 | |
| 180 | 180 | void cJSON_DeleteTopLevel(struct TopLevel * x) { |
| 181 | 181 | if (NULL != x) { |
| 182 | - if (NULL != x->arr_nullable) { | |
| 183 | - char * x1 = list_get_head(x->arr_nullable); | |
| 184 | - while (NULL != x1) { | |
| 185 | - if ((void *)0xDEADBEEF != x1) { | |
| 186 | - cJSON_free(x1); | |
| 187 | - } | |
| 188 | - x1 = list_get_next(x->arr_nullable); | |
| 189 | - } | |
| 190 | - list_release(x->arr_nullable); | |
| 182 | + if (NULL != x->one) { | |
| 183 | + cJSON_free(x->one); | |
| 184 | + } | |
| 185 | + if (NULL != x->optional) { | |
| 186 | + cJSON_free(x->optional); | |
| 187 | + } | |
| 188 | + if (NULL != x->nullable) { | |
| 189 | + cJSON_free(x->nullable); | |
| 191 | 190 | } |
| 192 | 191 | if (NULL != x->arr_one) { |
| 193 | 192 | char * x1 = list_get_head(x->arr_one); |
| @@ -197,14 +196,15 @@ void cJSON_DeleteTopLevel(struct TopLevel * x) { | ||
| 197 | 196 | } |
| 198 | 197 | list_release(x->arr_one); |
| 199 | 198 | } |
| 200 | - if (NULL != x->nullable) { | |
| 201 | - cJSON_free(x->nullable); | |
| 202 | - } | |
| 203 | - if (NULL != x->one) { | |
| 204 | - cJSON_free(x->one); | |
| 205 | - } | |
| 206 | - if (NULL != x->optional) { | |
| 207 | - cJSON_free(x->optional); | |
| 199 | + if (NULL != x->arr_nullable) { | |
| 200 | + char * x1 = list_get_head(x->arr_nullable); | |
| 201 | + while (NULL != x1) { | |
| 202 | + if ((void *)0xDEADBEEF != x1) { | |
| 203 | + cJSON_free(x1); | |
| 204 | + } | |
| 205 | + x1 = list_get_next(x->arr_nullable); | |
| 206 | + } | |
| 207 | + list_release(x->arr_nullable); | |
| 208 | 208 | } |
| 209 | 209 | if (NULL != x->union_with_bool) { |
| 210 | 210 | cJSON_DeleteUnionWithBool(x->union_with_bool); |
Mschema-cjsondefault / TopLevel.h+3 −3
| @@ -43,11 +43,11 @@ struct UnionWithBool { | ||
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | 45 | struct TopLevel { |
| 46 | - list_t * arr_nullable; | |
| 47 | - list_t * arr_one; | |
| 48 | - char * nullable; | |
| 49 | 46 | char * one; |
| 50 | 47 | char * optional; |
| 48 | + char * nullable; | |
| 49 | + list_t * arr_one; | |
| 50 | + list_t * arr_nullable; | |
| 51 | 51 | struct UnionWithBool * union_with_bool; |
| 52 | 52 | struct UnionWithBool * union_with_bool_and_enum; |
| 53 | 53 | }; |
Mschema-cplusplusdefault / quicktype.hpp+20 −20
| @@ -97,26 +97,15 @@ namespace quicktype { | ||
| 97 | 97 | virtual ~TopLevel() = default; |
| 98 | 98 | |
| 99 | 99 | private: |
| 100 | - std::optional<std::vector<std::optional<std::string>>> arr_nullable; | |
| 101 | - std::optional<std::vector<std::string>> arr_one; | |
| 102 | - std::optional<std::string> nullable; | |
| 103 | 100 | std::string one; |
| 104 | 101 | std::optional<std::string> optional; |
| 102 | + std::optional<std::string> nullable; | |
| 103 | + std::optional<std::vector<std::string>> arr_one; | |
| 104 | + std::optional<std::vector<std::optional<std::string>>> arr_nullable; | |
| 105 | 105 | UnionWithBool union_with_bool; |
| 106 | 106 | UnionWithBool union_with_bool_and_enum; |
| 107 | 107 | |
| 108 | 108 | public: |
| 109 | - const std::optional<std::vector<std::optional<std::string>>> & get_arr_nullable() const { return arr_nullable; } | |
| 110 | - std::optional<std::vector<std::optional<std::string>>> & get_mutable_arr_nullable() { return arr_nullable; } | |
| 111 | - void set_arr_nullable(const std::optional<std::vector<std::optional<std::string>>> & value) { this->arr_nullable = value; } | |
| 112 | - | |
| 113 | - const std::optional<std::vector<std::string>> & get_arr_one() const { return arr_one; } | |
| 114 | - std::optional<std::vector<std::string>> & get_mutable_arr_one() { return arr_one; } | |
| 115 | - void set_arr_one(const std::optional<std::vector<std::string>> & value) { this->arr_one = value; } | |
| 116 | - | |
| 117 | - std::optional<std::string> get_nullable() const { return nullable; } | |
| 118 | - void set_nullable(std::optional<std::string> value) { this->nullable = value; } | |
| 119 | - | |
| 120 | 109 | const std::string & get_one() const { return one; } |
| 121 | 110 | std::string & get_mutable_one() { return one; } |
| 122 | 111 | void set_one(const std::string & value) { this->one = value; } |
| @@ -125,6 +114,17 @@ namespace quicktype { | ||
| 125 | 114 | std::optional<std::string> & get_mutable_optional() { return optional; } |
| 126 | 115 | void set_optional(const std::optional<std::string> & value) { this->optional = value; } |
| 127 | 116 | |
| 117 | + std::optional<std::string> get_nullable() const { return nullable; } | |
| 118 | + void set_nullable(std::optional<std::string> value) { this->nullable = value; } | |
| 119 | + | |
| 120 | + const std::optional<std::vector<std::string>> & get_arr_one() const { return arr_one; } | |
| 121 | + std::optional<std::vector<std::string>> & get_mutable_arr_one() { return arr_one; } | |
| 122 | + void set_arr_one(const std::optional<std::vector<std::string>> & value) { this->arr_one = value; } | |
| 123 | + | |
| 124 | + const std::optional<std::vector<std::optional<std::string>>> & get_arr_nullable() const { return arr_nullable; } | |
| 125 | + std::optional<std::vector<std::optional<std::string>>> & get_mutable_arr_nullable() { return arr_nullable; } | |
| 126 | + void set_arr_nullable(const std::optional<std::vector<std::optional<std::string>>> & value) { this->arr_nullable = value; } | |
| 127 | + | |
| 128 | 128 | const UnionWithBool & get_union_with_bool() const { return union_with_bool; } |
| 129 | 129 | UnionWithBool & get_mutable_union_with_bool() { return union_with_bool; } |
| 130 | 130 | void set_union_with_bool(const UnionWithBool & value) { this->union_with_bool = value; } |
| @@ -148,22 +148,22 @@ struct adl_serializer<std::variant<bool, std::string>> { | ||
| 148 | 148 | } |
| 149 | 149 | namespace quicktype { |
| 150 | 150 | inline void from_json(const json & j, TopLevel& x) { |
| 151 | - x.set_arr_nullable(get_stack_optional<std::vector<std::optional<std::string>>>(j, "arrNullable")); | |
| 152 | - x.set_arr_one(get_stack_optional<std::vector<std::string>>(j, "arrOne")); | |
| 153 | - x.set_nullable(get_stack_optional<std::string>(j, "nullable")); | |
| 154 | 151 | x.set_one(j.at("one").get<std::string>()); |
| 155 | 152 | x.set_optional(get_stack_optional<std::string>(j, "optional")); |
| 153 | + x.set_nullable(get_stack_optional<std::string>(j, "nullable")); | |
| 154 | + x.set_arr_one(get_stack_optional<std::vector<std::string>>(j, "arrOne")); | |
| 155 | + x.set_arr_nullable(get_stack_optional<std::vector<std::optional<std::string>>>(j, "arrNullable")); | |
| 156 | 156 | x.set_union_with_bool(j.at("unionWithBool").get<UnionWithBool>()); |
| 157 | 157 | x.set_union_with_bool_and_enum(j.at("unionWithBoolAndEnum").get<UnionWithBool>()); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | inline void to_json(json & j, const TopLevel & x) { |
| 161 | 161 | j = json::object(); |
| 162 | - j["arrNullable"] = x.get_arr_nullable(); | |
| 163 | - j["arrOne"] = x.get_arr_one(); | |
| 164 | - j["nullable"] = x.get_nullable(); | |
| 165 | 162 | j["one"] = x.get_one(); |
| 166 | 163 | j["optional"] = x.get_optional(); |
| 164 | + j["nullable"] = x.get_nullable(); | |
| 165 | + j["arrOne"] = x.get_arr_one(); | |
| 166 | + j["arrNullable"] = x.get_arr_nullable(); | |
| 167 | 167 | j["unionWithBool"] = x.get_union_with_bool(); |
| 168 | 168 | j["unionWithBoolAndEnum"] = x.get_union_with_bool_and_enum(); |
| 169 | 169 | } |
Mschema-csharp-recordsdefault / QuickType.cs+12 −12
| @@ -25,18 +25,6 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("arrNullable", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 29 | - [JsonConverter(typeof(PurpleDecodeArrayConverter))] | |
| 30 | - public bool?[]? ArrNullable { get; set; } | |
| 31 | - | |
| 32 | - [JsonProperty("arrOne", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 33 | - [JsonConverter(typeof(FluffyDecodeArrayConverter))] | |
| 34 | - public bool[]? ArrOne { get; set; } | |
| 35 | - | |
| 36 | - [JsonProperty("nullable", Required = Required.AllowNull)] | |
| 37 | - [JsonConverter(typeof(ParseStringConverter))] | |
| 38 | - public bool? Nullable { get; set; } | |
| 39 | - | |
| 40 | 28 | [JsonProperty("one", Required = Required.Always)] |
| 41 | 29 | [JsonConverter(typeof(ParseStringConverter))] |
| 42 | 30 | public bool One { get; set; } |
| @@ -45,6 +33,18 @@ namespace QuickType | ||
| 45 | 33 | [JsonConverter(typeof(ParseStringConverter))] |
| 46 | 34 | public bool? Optional { get; set; } |
| 47 | 35 | |
| 36 | + [JsonProperty("nullable", Required = Required.AllowNull)] | |
| 37 | + [JsonConverter(typeof(ParseStringConverter))] | |
| 38 | + public bool? Nullable { get; set; } | |
| 39 | + | |
| 40 | + [JsonProperty("arrOne", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 41 | + [JsonConverter(typeof(FluffyDecodeArrayConverter))] | |
| 42 | + public bool[]? ArrOne { get; set; } | |
| 43 | + | |
| 44 | + [JsonProperty("arrNullable", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 45 | + [JsonConverter(typeof(PurpleDecodeArrayConverter))] | |
| 46 | + public bool?[]? ArrNullable { get; set; } | |
| 47 | + | |
| 48 | 48 | [JsonProperty("unionWithBool", Required = Required.Always)] |
| 49 | 49 | [JsonConverter(typeof(DecodingChoiceConverter))] |
| 50 | 50 | public bool UnionWithBool { get; set; } |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+14 −14
| @@ -22,30 +22,30 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 26 | - [JsonPropertyName("arrNullable")] | |
| 27 | - [JsonConverter(typeof(PurpleDecodeArrayConverter))] | |
| 28 | - public bool?[]? ArrNullable { get; set; } | |
| 25 | + [JsonRequired] | |
| 26 | + [JsonPropertyName("one")] | |
| 27 | + [JsonConverter(typeof(ParseStringConverter))] | |
| 28 | + public bool One { get; set; } | |
| 29 | 29 | |
| 30 | 30 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 31 | - [JsonPropertyName("arrOne")] | |
| 32 | - [JsonConverter(typeof(FluffyDecodeArrayConverter))] | |
| 33 | - public bool[]? ArrOne { get; set; } | |
| 31 | + [JsonPropertyName("optional")] | |
| 32 | + [JsonConverter(typeof(ParseStringConverter))] | |
| 33 | + public bool? Optional { get; set; } | |
| 34 | 34 | |
| 35 | 35 | [JsonRequired] |
| 36 | 36 | [JsonPropertyName("nullable")] |
| 37 | 37 | [JsonConverter(typeof(ParseStringConverter))] |
| 38 | 38 | public bool? Nullable { get; set; } |
| 39 | 39 | |
| 40 | - [JsonRequired] | |
| 41 | - [JsonPropertyName("one")] | |
| 42 | - [JsonConverter(typeof(ParseStringConverter))] | |
| 43 | - public bool One { get; set; } | |
| 40 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 41 | + [JsonPropertyName("arrOne")] | |
| 42 | + [JsonConverter(typeof(FluffyDecodeArrayConverter))] | |
| 43 | + public bool[]? ArrOne { get; set; } | |
| 44 | 44 | |
| 45 | 45 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 46 | - [JsonPropertyName("optional")] | |
| 47 | - [JsonConverter(typeof(ParseStringConverter))] | |
| 48 | - public bool? Optional { get; set; } | |
| 46 | + [JsonPropertyName("arrNullable")] | |
| 47 | + [JsonConverter(typeof(PurpleDecodeArrayConverter))] | |
| 48 | + public bool?[]? ArrNullable { get; set; } | |
| 49 | 49 | |
| 50 | 50 | [JsonRequired] |
| 51 | 51 | [JsonPropertyName("unionWithBool")] |
Mschema-csharpdefault / QuickType.cs+12 −12
| @@ -25,18 +25,6 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("arrNullable", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 29 | - [JsonConverter(typeof(PurpleDecodeArrayConverter))] | |
| 30 | - public bool?[]? ArrNullable { get; set; } | |
| 31 | - | |
| 32 | - [JsonProperty("arrOne", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 33 | - [JsonConverter(typeof(FluffyDecodeArrayConverter))] | |
| 34 | - public bool[]? ArrOne { get; set; } | |
| 35 | - | |
| 36 | - [JsonProperty("nullable", Required = Required.AllowNull)] | |
| 37 | - [JsonConverter(typeof(ParseStringConverter))] | |
| 38 | - public bool? Nullable { get; set; } | |
| 39 | - | |
| 40 | 28 | [JsonProperty("one", Required = Required.Always)] |
| 41 | 29 | [JsonConverter(typeof(ParseStringConverter))] |
| 42 | 30 | public bool One { get; set; } |
| @@ -45,6 +33,18 @@ namespace QuickType | ||
| 45 | 33 | [JsonConverter(typeof(ParseStringConverter))] |
| 46 | 34 | public bool? Optional { get; set; } |
| 47 | 35 | |
| 36 | + [JsonProperty("nullable", Required = Required.AllowNull)] | |
| 37 | + [JsonConverter(typeof(ParseStringConverter))] | |
| 38 | + public bool? Nullable { get; set; } | |
| 39 | + | |
| 40 | + [JsonProperty("arrOne", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 41 | + [JsonConverter(typeof(FluffyDecodeArrayConverter))] | |
| 42 | + public bool[]? ArrOne { get; set; } | |
| 43 | + | |
| 44 | + [JsonProperty("arrNullable", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 45 | + [JsonConverter(typeof(PurpleDecodeArrayConverter))] | |
| 46 | + public bool?[]? ArrNullable { get; set; } | |
| 47 | + | |
| 48 | 48 | [JsonProperty("unionWithBool", Required = Required.Always)] |
| 49 | 49 | [JsonConverter(typeof(DecodingChoiceConverter))] |
| 50 | 50 | public bool UnionWithBool { get; set; } |
Mschema-elixirdefault / QuickType.ex+11 −11
| @@ -6,15 +6,15 @@ | ||
| 6 | 6 | # Encode into a JSON string: TopLevel.to_json(struct) |
| 7 | 7 | |
| 8 | 8 | defmodule TopLevel do |
| 9 | - @enforce_keys [:nullable, :one, :union_with_bool, :union_with_bool_and_enum] | |
| 10 | - defstruct [:arr_nullable, :arr_one, :nullable, :one, :optional, :union_with_bool, :union_with_bool_and_enum] | |
| 9 | + @enforce_keys [:one, :nullable, :union_with_bool, :union_with_bool_and_enum] | |
| 10 | + defstruct [:one, :optional, :nullable, :arr_one, :arr_nullable, :union_with_bool, :union_with_bool_and_enum] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | - arr_nullable: [nil | String.t()] | nil, | |
| 14 | - arr_one: [String.t()] | nil, | |
| 15 | - nullable: nil | String.t(), | |
| 16 | 13 | one: String.t(), |
| 17 | 14 | optional: String.t() | nil, |
| 15 | + nullable: nil | String.t(), | |
| 16 | + arr_one: [String.t()] | nil, | |
| 17 | + arr_nullable: [nil | String.t()] | nil, | |
| 18 | 18 | union_with_bool: boolean() | String.t(), |
| 19 | 19 | union_with_bool_and_enum: boolean() | String.t() |
| 20 | 20 | } |
| @@ -29,11 +29,11 @@ defmodule TopLevel do | ||
| 29 | 29 | |
| 30 | 30 | def from_map(m) do |
| 31 | 31 | %TopLevel{ |
| 32 | - arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1), | |
| 33 | - arr_one: m["arrOne"], | |
| 34 | - nullable: m["nullable"], | |
| 35 | 32 | one: m["one"], |
| 36 | 33 | optional: m["optional"], |
| 34 | + nullable: m["nullable"], | |
| 35 | + arr_one: m["arrOne"], | |
| 36 | + arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1), | |
| 37 | 37 | union_with_bool: m["unionWithBool"], |
| 38 | 38 | union_with_bool_and_enum: m["unionWithBoolAndEnum"], |
| 39 | 39 | } |
| @@ -47,11 +47,11 @@ defmodule TopLevel do | ||
| 47 | 47 | |
| 48 | 48 | def to_map(struct) do |
| 49 | 49 | %{ |
| 50 | - "arrNullable" => struct.arr_nullable && Enum.map(struct.arr_nullable, &encode_arr_nullable_element/1), | |
| 51 | - "arrOne" => struct.arr_one, | |
| 52 | - "nullable" => struct.nullable, | |
| 53 | 50 | "one" => struct.one, |
| 54 | 51 | "optional" => struct.optional, |
| 52 | + "nullable" => struct.nullable, | |
| 53 | + "arrOne" => struct.arr_one, | |
| 54 | + "arrNullable" => struct.arr_nullable && Enum.map(struct.arr_nullable, &encode_arr_nullable_element/1), | |
| 55 | 55 | "unionWithBool" => struct.union_with_bool, |
| 56 | 56 | "unionWithBoolAndEnum" => struct.union_with_bool_and_enum, |
| 57 | 57 | } |
Mschema-elmdefault / QuickType.elm+11 −11
| @@ -24,11 +24,11 @@ import Json.Encode as Jenc | ||
| 24 | 24 | import Dict exposing (Dict) |
| 25 | 25 | |
| 26 | 26 | type alias QuickType = |
| 27 | - { arrNullable : Maybe (List (Maybe String)) | |
| 28 | - , arrOne : Maybe (List String) | |
| 29 | - , nullable : Maybe String | |
| 30 | - , one : String | |
| 27 | + { one : String | |
| 31 | 28 | , optional : Maybe String |
| 29 | + , nullable : Maybe String | |
| 30 | + , arrOne : Maybe (List String) | |
| 31 | + , arrNullable : Maybe (List (Maybe String)) | |
| 32 | 32 | , unionWithBool : UnionWithBool |
| 33 | 33 | , unionWithBoolAndEnum : UnionWithBool |
| 34 | 34 | } |
| @@ -45,22 +45,22 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 45 | 45 | quickType : Jdec.Decoder QuickType |
| 46 | 46 | quickType = |
| 47 | 47 | Jdec.succeed QuickType |
| 48 | - |> Jpipe.optional "arrNullable" (Jdec.nullable (Jdec.list (Jdec.nullable Jdec.string))) Nothing | |
| 49 | - |> Jpipe.optional "arrOne" (Jdec.nullable (Jdec.list Jdec.string)) Nothing | |
| 50 | - |> Jpipe.optional "nullable" (Jdec.nullable Jdec.string) Nothing | |
| 51 | 48 | |> Jpipe.required "one" Jdec.string |
| 52 | 49 | |> Jpipe.optional "optional" (Jdec.nullable Jdec.string) Nothing |
| 50 | + |> Jpipe.optional "nullable" (Jdec.nullable Jdec.string) Nothing | |
| 51 | + |> Jpipe.optional "arrOne" (Jdec.nullable (Jdec.list Jdec.string)) Nothing | |
| 52 | + |> Jpipe.optional "arrNullable" (Jdec.nullable (Jdec.list (Jdec.nullable Jdec.string))) Nothing | |
| 53 | 53 | |> Jpipe.required "unionWithBool" unionWithBool |
| 54 | 54 | |> Jpipe.required "unionWithBoolAndEnum" unionWithBool |
| 55 | 55 | |
| 56 | 56 | encodeQuickType : QuickType -> Jenc.Value |
| 57 | 57 | encodeQuickType x = |
| 58 | 58 | Jenc.object |
| 59 | - [ ("arrNullable", makeNullableEncoder (Jenc.list (makeNullableEncoder Jenc.string)) x.arrNullable) | |
| 60 | - , ("arrOne", makeNullableEncoder (Jenc.list Jenc.string) x.arrOne) | |
| 61 | - , ("nullable", makeNullableEncoder Jenc.string x.nullable) | |
| 62 | - , ("one", Jenc.string x.one) | |
| 59 | + [ ("one", Jenc.string x.one) | |
| 63 | 60 | , ("optional", makeNullableEncoder Jenc.string x.optional) |
| 61 | + , ("nullable", makeNullableEncoder Jenc.string x.nullable) | |
| 62 | + , ("arrOne", makeNullableEncoder (Jenc.list Jenc.string) x.arrOne) | |
| 63 | + , ("arrNullable", makeNullableEncoder (Jenc.list (makeNullableEncoder Jenc.string)) x.arrNullable) | |
| 64 | 64 | , ("unionWithBool", encodeUnionWithBool x.unionWithBool) |
| 65 | 65 | , ("unionWithBoolAndEnum", encodeUnionWithBool x.unionWithBoolAndEnum) |
| 66 | 66 | ] |
Mschema-flowdefault / TopLevel.js+6 −6
| @@ -10,11 +10,11 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - arrNullable?: (null | string)[]; | |
| 14 | - arrOne?: string[]; | |
| 15 | - nullable: null | string; | |
| 16 | 13 | one: string; |
| 17 | 14 | optional?: string; |
| 15 | + nullable: null | string; | |
| 16 | + arrOne?: string[]; | |
| 17 | + arrNullable?: (null | string)[]; | |
| 18 | 18 | unionWithBool: UnionWithBool; |
| 19 | 19 | unionWithBoolAndEnum: UnionWithBool; |
| 20 | 20 | [property: string]: mixed; |
| @@ -187,11 +187,11 @@ function r(name: string) { | ||
| 187 | 187 | |
| 188 | 188 | const typeMap: any = { |
| 189 | 189 | "TopLevel": o([ |
| 190 | - { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 191 | - { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 192 | - { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 193 | 190 | { json: "one", js: "one", typ: "" }, |
| 194 | 191 | { json: "optional", js: "optional", typ: u(undefined, "") }, |
| 192 | + { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 193 | + { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 194 | + { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 195 | 195 | { json: "unionWithBool", js: "unionWithBool", typ: u(true, "") }, |
| 196 | 196 | { json: "unionWithBoolAndEnum", js: "unionWithBoolAndEnum", typ: u(true, "") }, |
| 197 | 197 | ], "any"), |
Mschema-golangdefault / quicktype.go+3 −3
| @@ -22,11 +22,11 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | type TopLevel struct { |
| 25 | - ArrNullable []*string `json:"arrNullable,omitempty"` | |
| 26 | - ArrOne []string `json:"arrOne,omitempty"` | |
| 27 | - Nullable *string `json:"nullable"` | |
| 28 | 25 | One string `json:"one"` |
| 29 | 26 | Optional *string `json:"optional,omitempty"` |
| 27 | + Nullable *string `json:"nullable"` | |
| 28 | + ArrOne []string `json:"arrOne,omitempty"` | |
| 29 | + ArrNullable []*string `json:"arrNullable,omitempty"` | |
| 30 | 30 | UnionWithBool *UnionWithBool `json:"unionWithBool"` |
| 31 | 31 | UnionWithBoolAndEnum *UnionWithBool `json:"unionWithBoolAndEnum"` |
| 32 | 32 | } |
Mschema-haskelldefault / QuickType.hs+13 −13
| @@ -14,11 +14,11 @@ import Data.HashMap.Strict (HashMap) | ||
| 14 | 14 | import Data.Text (Text) |
| 15 | 15 | |
| 16 | 16 | data QuickType = QuickType |
| 17 | - { arrNullableQuickType :: Maybe ([(Maybe Text)]) | |
| 18 | - , arrOneQuickType :: Maybe ([Text]) | |
| 19 | - , nullableQuickType :: Maybe Text | |
| 20 | - , oneQuickType :: Text | |
| 17 | + { oneQuickType :: Text | |
| 21 | 18 | , optionalQuickType :: Maybe Text |
| 19 | + , nullableQuickType :: Maybe Text | |
| 20 | + , arrOneQuickType :: Maybe ([Text]) | |
| 21 | + , arrNullableQuickType :: Maybe ([(Maybe Text)]) | |
| 22 | 22 | , unionWithBoolQuickType :: UnionWithBool |
| 23 | 23 | , unionWithBoolAndEnumQuickType :: UnionWithBool |
| 24 | 24 | } deriving (Show) |
| @@ -32,24 +32,24 @@ decodeTopLevel :: ByteString -> Maybe QuickType | ||
| 32 | 32 | decodeTopLevel = decode |
| 33 | 33 | |
| 34 | 34 | instance ToJSON QuickType where |
| 35 | - toJSON (QuickType arrNullableQuickType arrOneQuickType nullableQuickType oneQuickType optionalQuickType unionWithBoolQuickType unionWithBoolAndEnumQuickType) = | |
| 35 | + toJSON (QuickType oneQuickType optionalQuickType nullableQuickType arrOneQuickType arrNullableQuickType unionWithBoolQuickType unionWithBoolAndEnumQuickType) = | |
| 36 | 36 | object |
| 37 | - [ "arrNullable" .= arrNullableQuickType | |
| 38 | - , "arrOne" .= arrOneQuickType | |
| 39 | - , "nullable" .= nullableQuickType | |
| 40 | - , "one" .= oneQuickType | |
| 37 | + [ "one" .= oneQuickType | |
| 41 | 38 | , "optional" .= optionalQuickType |
| 39 | + , "nullable" .= nullableQuickType | |
| 40 | + , "arrOne" .= arrOneQuickType | |
| 41 | + , "arrNullable" .= arrNullableQuickType | |
| 42 | 42 | , "unionWithBool" .= unionWithBoolQuickType |
| 43 | 43 | , "unionWithBoolAndEnum" .= unionWithBoolAndEnumQuickType |
| 44 | 44 | ] |
| 45 | 45 | |
| 46 | 46 | instance FromJSON QuickType where |
| 47 | 47 | parseJSON (Object v) = QuickType |
| 48 | - <$> v .:? "arrNullable" | |
| 49 | - <*> v .:? "arrOne" | |
| 50 | - <*> v .: "nullable" | |
| 51 | - <*> v .: "one" | |
| 48 | + <$> v .: "one" | |
| 52 | 49 | <*> v .:? "optional" |
| 50 | + <*> v .: "nullable" | |
| 51 | + <*> v .:? "arrOne" | |
| 52 | + <*> v .:? "arrNullable" | |
| 53 | 53 | <*> v .: "unionWithBool" |
| 54 | 54 | <*> v .: "unionWithBoolAndEnum" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+18 −18
| @@ -4,29 +4,14 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private List<String> arrNullable; | |
| 8 | - private List<String> arrOne; | |
| 9 | - private String nullable; | |
| 10 | 7 | private String one; |
| 11 | 8 | private String optional; |
| 9 | + private String nullable; | |
| 10 | + private List<String> arrOne; | |
| 11 | + private List<String> arrNullable; | |
| 12 | 12 | private UnionWithBool unionWithBool; |
| 13 | 13 | private UnionWithBool unionWithBoolAndEnum; |
| 14 | 14 | |
| 15 | - @JsonProperty("arrNullable") | |
| 16 | - public List<String> getArrNullable() { return arrNullable; } | |
| 17 | - @JsonProperty("arrNullable") | |
| 18 | - public void setArrNullable(List<String> value) { this.arrNullable = value; } | |
| 19 | - | |
| 20 | - @JsonProperty("arrOne") | |
| 21 | - public List<String> getArrOne() { return arrOne; } | |
| 22 | - @JsonProperty("arrOne") | |
| 23 | - public void setArrOne(List<String> value) { this.arrOne = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("nullable") | |
| 26 | - public String getNullable() { return nullable; } | |
| 27 | - @JsonProperty("nullable") | |
| 28 | - public void setNullable(String value) { this.nullable = value; } | |
| 29 | - | |
| 30 | 15 | @JsonProperty("one") |
| 31 | 16 | public String getOne() { return one; } |
| 32 | 17 | @JsonProperty("one") |
| @@ -37,6 +22,21 @@ public class TopLevel { | ||
| 37 | 22 | @JsonProperty("optional") |
| 38 | 23 | public void setOptional(String value) { this.optional = value; } |
| 39 | 24 | |
| 25 | + @JsonProperty("nullable") | |
| 26 | + public String getNullable() { return nullable; } | |
| 27 | + @JsonProperty("nullable") | |
| 28 | + public void setNullable(String value) { this.nullable = value; } | |
| 29 | + | |
| 30 | + @JsonProperty("arrOne") | |
| 31 | + public List<String> getArrOne() { return arrOne; } | |
| 32 | + @JsonProperty("arrOne") | |
| 33 | + public void setArrOne(List<String> value) { this.arrOne = value; } | |
| 34 | + | |
| 35 | + @JsonProperty("arrNullable") | |
| 36 | + public List<String> getArrNullable() { return arrNullable; } | |
| 37 | + @JsonProperty("arrNullable") | |
| 38 | + public void setArrNullable(List<String> value) { this.arrNullable = value; } | |
| 39 | + | |
| 40 | 40 | @JsonProperty("unionWithBool") |
| 41 | 41 | public UnionWithBool getUnionWithBool() { return unionWithBool; } |
| 42 | 42 | @JsonProperty("unionWithBool") |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+18 −18
| @@ -4,29 +4,14 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private List<String> arrNullable; | |
| 8 | - private List<String> arrOne; | |
| 9 | - private String nullable; | |
| 10 | 7 | private String one; |
| 11 | 8 | private String optional; |
| 9 | + private String nullable; | |
| 10 | + private List<String> arrOne; | |
| 11 | + private List<String> arrNullable; | |
| 12 | 12 | private UnionWithBool unionWithBool; |
| 13 | 13 | private UnionWithBool unionWithBoolAndEnum; |
| 14 | 14 | |
| 15 | - @JsonProperty("arrNullable") | |
| 16 | - public List<String> getArrNullable() { return arrNullable; } | |
| 17 | - @JsonProperty("arrNullable") | |
| 18 | - public void setArrNullable(List<String> value) { this.arrNullable = value; } | |
| 19 | - | |
| 20 | - @JsonProperty("arrOne") | |
| 21 | - public List<String> getArrOne() { return arrOne; } | |
| 22 | - @JsonProperty("arrOne") | |
| 23 | - public void setArrOne(List<String> value) { this.arrOne = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("nullable") | |
| 26 | - public String getNullable() { return nullable; } | |
| 27 | - @JsonProperty("nullable") | |
| 28 | - public void setNullable(String value) { this.nullable = value; } | |
| 29 | - | |
| 30 | 15 | @JsonProperty("one") |
| 31 | 16 | public String getOne() { return one; } |
| 32 | 17 | @JsonProperty("one") |
| @@ -37,6 +22,21 @@ public class TopLevel { | ||
| 37 | 22 | @JsonProperty("optional") |
| 38 | 23 | public void setOptional(String value) { this.optional = value; } |
| 39 | 24 | |
| 25 | + @JsonProperty("nullable") | |
| 26 | + public String getNullable() { return nullable; } | |
| 27 | + @JsonProperty("nullable") | |
| 28 | + public void setNullable(String value) { this.nullable = value; } | |
| 29 | + | |
| 30 | + @JsonProperty("arrOne") | |
| 31 | + public List<String> getArrOne() { return arrOne; } | |
| 32 | + @JsonProperty("arrOne") | |
| 33 | + public void setArrOne(List<String> value) { this.arrOne = value; } | |
| 34 | + | |
| 35 | + @JsonProperty("arrNullable") | |
| 36 | + public List<String> getArrNullable() { return arrNullable; } | |
| 37 | + @JsonProperty("arrNullable") | |
| 38 | + public void setArrNullable(List<String> value) { this.arrNullable = value; } | |
| 39 | + | |
| 40 | 40 | @JsonProperty("unionWithBool") |
| 41 | 41 | public UnionWithBool getUnionWithBool() { return unionWithBool; } |
| 42 | 42 | @JsonProperty("unionWithBool") |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+18 −18
| @@ -4,29 +4,14 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private List<String> arrNullable; | |
| 8 | - private List<String> arrOne; | |
| 9 | - private String nullable; | |
| 10 | 7 | private String one; |
| 11 | 8 | private String optional; |
| 9 | + private String nullable; | |
| 10 | + private List<String> arrOne; | |
| 11 | + private List<String> arrNullable; | |
| 12 | 12 | private UnionWithBool unionWithBool; |
| 13 | 13 | private UnionWithBool unionWithBoolAndEnum; |
| 14 | 14 | |
| 15 | - @JsonProperty("arrNullable") | |
| 16 | - public List<String> getArrNullable() { return arrNullable; } | |
| 17 | - @JsonProperty("arrNullable") | |
| 18 | - public void setArrNullable(List<String> value) { this.arrNullable = value; } | |
| 19 | - | |
| 20 | - @JsonProperty("arrOne") | |
| 21 | - public List<String> getArrOne() { return arrOne; } | |
| 22 | - @JsonProperty("arrOne") | |
| 23 | - public void setArrOne(List<String> value) { this.arrOne = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("nullable") | |
| 26 | - public String getNullable() { return nullable; } | |
| 27 | - @JsonProperty("nullable") | |
| 28 | - public void setNullable(String value) { this.nullable = value; } | |
| 29 | - | |
| 30 | 15 | @JsonProperty("one") |
| 31 | 16 | public String getOne() { return one; } |
| 32 | 17 | @JsonProperty("one") |
| @@ -37,6 +22,21 @@ public class TopLevel { | ||
| 37 | 22 | @JsonProperty("optional") |
| 38 | 23 | public void setOptional(String value) { this.optional = value; } |
| 39 | 24 | |
| 25 | + @JsonProperty("nullable") | |
| 26 | + public String getNullable() { return nullable; } | |
| 27 | + @JsonProperty("nullable") | |
| 28 | + public void setNullable(String value) { this.nullable = value; } | |
| 29 | + | |
| 30 | + @JsonProperty("arrOne") | |
| 31 | + public List<String> getArrOne() { return arrOne; } | |
| 32 | + @JsonProperty("arrOne") | |
| 33 | + public void setArrOne(List<String> value) { this.arrOne = value; } | |
| 34 | + | |
| 35 | + @JsonProperty("arrNullable") | |
| 36 | + public List<String> getArrNullable() { return arrNullable; } | |
| 37 | + @JsonProperty("arrNullable") | |
| 38 | + public void setArrNullable(List<String> value) { this.arrNullable = value; } | |
| 39 | + | |
| 40 | 40 | @JsonProperty("unionWithBool") |
| 41 | 41 | public UnionWithBool getUnionWithBool() { return unionWithBool; } |
| 42 | 42 | @JsonProperty("unionWithBool") |
Mschema-javascriptdefault / TopLevel.js+3 −3
| @@ -172,11 +172,11 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 176 | - { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 177 | - { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 178 | 175 | { json: "one", js: "one", typ: "" }, |
| 179 | 176 | { json: "optional", js: "optional", typ: u(undefined, "") }, |
| 177 | + { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 178 | + { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 179 | + { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 180 | 180 | { json: "unionWithBool", js: "unionWithBool", typ: u(true, "") }, |
| 181 | 181 | { json: "unionWithBoolAndEnum", js: "unionWithBoolAndEnum", typ: u(true, "") }, |
| 182 | 182 | ], "any"), |
Mschema-phpdefault / TopLevel.php+151 −151
| @@ -4,124 +4,88 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private ?array $arrNullable; // json:arrNullable Optional | |
| 8 | - private ?array $arrOne; // json:arrOne Optional | |
| 9 | - private ?string $nullable; // json:nullable Optional | |
| 10 | 7 | private string $one; // json:one Required |
| 11 | 8 | private ?string $optional; // json:optional Optional |
| 9 | + private ?string $nullable; // json:nullable Optional | |
| 10 | + private ?array $arrOne; // json:arrOne Optional | |
| 11 | + private ?array $arrNullable; // json:arrNullable Optional | |
| 12 | 12 | private bool|string $unionWithBool; // json:unionWithBool Required |
| 13 | 13 | private bool|string $unionWithBoolAndEnum; // json:unionWithBoolAndEnum Required |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * @param array|null $arrNullable | |
| 17 | - * @param array|null $arrOne | |
| 18 | - * @param string|null $nullable | |
| 19 | 16 | * @param string $one |
| 20 | 17 | * @param string|null $optional |
| 18 | + * @param string|null $nullable | |
| 19 | + * @param array|null $arrOne | |
| 20 | + * @param array|null $arrNullable | |
| 21 | 21 | * @param bool|string $unionWithBool |
| 22 | 22 | * @param bool|string $unionWithBoolAndEnum |
| 23 | 23 | */ |
| 24 | - public function __construct(?array $arrNullable, ?array $arrOne, ?string $nullable, string $one, ?string $optional, bool|string $unionWithBool, bool|string $unionWithBoolAndEnum) { | |
| 25 | - $this->arrNullable = $arrNullable; | |
| 26 | - $this->arrOne = $arrOne; | |
| 27 | - $this->nullable = $nullable; | |
| 24 | + public function __construct(string $one, ?string $optional, ?string $nullable, ?array $arrOne, ?array $arrNullable, bool|string $unionWithBool, bool|string $unionWithBoolAndEnum) { | |
| 28 | 25 | $this->one = $one; |
| 29 | 26 | $this->optional = $optional; |
| 27 | + $this->nullable = $nullable; | |
| 28 | + $this->arrOne = $arrOne; | |
| 29 | + $this->arrNullable = $arrNullable; | |
| 30 | 30 | $this->unionWithBool = $unionWithBool; |
| 31 | 31 | $this->unionWithBoolAndEnum = $unionWithBoolAndEnum; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * @param ?array $value | |
| 35 | + * @param string $value | |
| 36 | 36 | * @throws Exception |
| 37 | - * @return ?array | |
| 37 | + * @return string | |
| 38 | 38 | */ |
| 39 | - public static function fromArrNullable(?array $value): ?array { | |
| 40 | - if (!is_null($value)) { | |
| 41 | - return array_map(function ($value) { | |
| 42 | - if (!is_null($value)) { | |
| 43 | - return $value; /*string*/ | |
| 44 | - } else { | |
| 45 | - return null; | |
| 46 | - } | |
| 47 | - }, $value); | |
| 48 | - } else { | |
| 49 | - return null; | |
| 50 | - } | |
| 39 | + public static function fromOne(string $value): string { | |
| 40 | + return $value; /*string*/ | |
| 51 | 41 | } |
| 52 | 42 | |
| 53 | 43 | /** |
| 54 | 44 | * @throws Exception |
| 55 | - * @return ?array | |
| 45 | + * @return string | |
| 56 | 46 | */ |
| 57 | - public function toArrNullable(): ?array { | |
| 58 | - if (TopLevel::validateArrNullable($this->arrNullable)) { | |
| 59 | - if (!is_null($this->arrNullable)) { | |
| 60 | - return array_map(function ($value) { | |
| 61 | - if (!is_null($value)) { | |
| 62 | - return $value; /*string*/ | |
| 63 | - } else { | |
| 64 | - return null; | |
| 65 | - } | |
| 66 | - }, $this->arrNullable); | |
| 67 | - } else { | |
| 68 | - return null; | |
| 69 | - } | |
| 47 | + public function toOne(): string { | |
| 48 | + if (TopLevel::validateOne($this->one)) { | |
| 49 | + return $this->one; /*string*/ | |
| 70 | 50 | } |
| 71 | - throw new Exception('never get to this TopLevel::arrNullable'); | |
| 51 | + throw new Exception('never get to this TopLevel::one'); | |
| 72 | 52 | } |
| 73 | 53 | |
| 74 | 54 | /** |
| 75 | - * @param array|null | |
| 55 | + * @param string | |
| 76 | 56 | * @return bool |
| 77 | 57 | * @throws Exception |
| 78 | 58 | */ |
| 79 | - public static function validateArrNullable(?array $value): bool { | |
| 80 | - if (!is_null($value)) { | |
| 81 | - if (!is_array($value)) { | |
| 82 | - throw new Exception("Attribute Error:TopLevel::arrNullable"); | |
| 83 | - } | |
| 84 | - array_walk($value, function($value_v) { | |
| 85 | - if (!is_null($value_v)) { | |
| 86 | - if (!is_string($value_v)) { | |
| 87 | - throw new Exception("Attribute Error:TopLevel::arrNullable"); | |
| 88 | - } | |
| 89 | - } | |
| 90 | - }); | |
| 91 | - } | |
| 59 | + public static function validateOne(string $value): bool { | |
| 92 | 60 | return true; |
| 93 | 61 | } |
| 94 | 62 | |
| 95 | 63 | /** |
| 96 | 64 | * @throws Exception |
| 97 | - * @return ?array | |
| 65 | + * @return string | |
| 98 | 66 | */ |
| 99 | - public function getArrNullable(): ?array { | |
| 100 | - if (TopLevel::validateArrNullable($this->arrNullable)) { | |
| 101 | - return $this->arrNullable; | |
| 67 | + public function getOne(): string { | |
| 68 | + if (TopLevel::validateOne($this->one)) { | |
| 69 | + return $this->one; | |
| 102 | 70 | } |
| 103 | - throw new Exception('never get to getArrNullable TopLevel::arrNullable'); | |
| 71 | + throw new Exception('never get to getOne TopLevel::one'); | |
| 104 | 72 | } |
| 105 | 73 | |
| 106 | 74 | /** |
| 107 | - * @return ?array | |
| 75 | + * @return string | |
| 108 | 76 | */ |
| 109 | - public static function sampleArrNullable(): ?array { | |
| 110 | - return array( | |
| 111 | - 'TopLevel::::31' /*31:*/ | |
| 112 | - ); /* 31:arrNullable*/ | |
| 77 | + public static function sampleOne(): string { | |
| 78 | + return 'TopLevel::one::31'; /*31:one*/ | |
| 113 | 79 | } |
| 114 | 80 | |
| 115 | 81 | /** |
| 116 | - * @param ?array $value | |
| 82 | + * @param ?string $value | |
| 117 | 83 | * @throws Exception |
| 118 | - * @return ?array | |
| 84 | + * @return ?string | |
| 119 | 85 | */ |
| 120 | - public static function fromArrOne(?array $value): ?array { | |
| 86 | + public static function fromOptional(?string $value): ?string { | |
| 121 | 87 | if (!is_null($value)) { |
| 122 | - return array_map(function ($value) { | |
| 123 | - return $value; /*string*/ | |
| 124 | - }, $value); | |
| 88 | + return $value; /*string*/ | |
| 125 | 89 | } else { |
| 126 | 90 | return null; |
| 127 | 91 | } |
| @@ -129,58 +93,46 @@ class TopLevel { | ||
| 129 | 93 | |
| 130 | 94 | /** |
| 131 | 95 | * @throws Exception |
| 132 | - * @return ?array | |
| 96 | + * @return ?string | |
| 133 | 97 | */ |
| 134 | - public function toArrOne(): ?array { | |
| 135 | - if (TopLevel::validateArrOne($this->arrOne)) { | |
| 136 | - if (!is_null($this->arrOne)) { | |
| 137 | - return array_map(function ($value) { | |
| 138 | - return $value; /*string*/ | |
| 139 | - }, $this->arrOne); | |
| 98 | + public function toOptional(): ?string { | |
| 99 | + if (TopLevel::validateOptional($this->optional)) { | |
| 100 | + if (!is_null($this->optional)) { | |
| 101 | + return $this->optional; /*string*/ | |
| 140 | 102 | } else { |
| 141 | 103 | return null; |
| 142 | 104 | } |
| 143 | 105 | } |
| 144 | - throw new Exception('never get to this TopLevel::arrOne'); | |
| 106 | + throw new Exception('never get to this TopLevel::optional'); | |
| 145 | 107 | } |
| 146 | 108 | |
| 147 | 109 | /** |
| 148 | - * @param array|null | |
| 110 | + * @param string|null | |
| 149 | 111 | * @return bool |
| 150 | 112 | * @throws Exception |
| 151 | 113 | */ |
| 152 | - public static function validateArrOne(?array $value): bool { | |
| 114 | + public static function validateOptional(?string $value): bool { | |
| 153 | 115 | if (!is_null($value)) { |
| 154 | - if (!is_array($value)) { | |
| 155 | - throw new Exception("Attribute Error:TopLevel::arrOne"); | |
| 156 | - } | |
| 157 | - array_walk($value, function($value_v) { | |
| 158 | - if (!is_string($value_v)) { | |
| 159 | - throw new Exception("Attribute Error:TopLevel::arrOne"); | |
| 160 | - } | |
| 161 | - }); | |
| 162 | 116 | } |
| 163 | 117 | return true; |
| 164 | 118 | } |
| 165 | 119 | |
| 166 | 120 | /** |
| 167 | 121 | * @throws Exception |
| 168 | - * @return ?array | |
| 122 | + * @return ?string | |
| 169 | 123 | */ |
| 170 | - public function getArrOne(): ?array { | |
| 171 | - if (TopLevel::validateArrOne($this->arrOne)) { | |
| 172 | - return $this->arrOne; | |
| 124 | + public function getOptional(): ?string { | |
| 125 | + if (TopLevel::validateOptional($this->optional)) { | |
| 126 | + return $this->optional; | |
| 173 | 127 | } |
| 174 | - throw new Exception('never get to getArrOne TopLevel::arrOne'); | |
| 128 | + throw new Exception('never get to getOptional TopLevel::optional'); | |
| 175 | 129 | } |
| 176 | 130 | |
| 177 | 131 | /** |
| 178 | - * @return ?array | |
| 132 | + * @return ?string | |
| 179 | 133 | */ |
| 180 | - public static function sampleArrOne(): ?array { | |
| 181 | - return array( | |
| 182 | - 'TopLevel::::32' /*32:*/ | |
| 183 | - ); /* 32:arrOne*/ | |
| 134 | + public static function sampleOptional(): ?string { | |
| 135 | + return 'TopLevel::optional::32'; /*32:optional*/ | |
| 184 | 136 | } |
| 185 | 137 | |
| 186 | 138 | /** |
| @@ -241,60 +193,90 @@ class TopLevel { | ||
| 241 | 193 | } |
| 242 | 194 | |
| 243 | 195 | /** |
| 244 | - * @param string $value | |
| 196 | + * @param ?array $value | |
| 245 | 197 | * @throws Exception |
| 246 | - * @return string | |
| 198 | + * @return ?array | |
| 247 | 199 | */ |
| 248 | - public static function fromOne(string $value): string { | |
| 249 | - return $value; /*string*/ | |
| 200 | + public static function fromArrOne(?array $value): ?array { | |
| 201 | + if (!is_null($value)) { | |
| 202 | + return array_map(function ($value) { | |
| 203 | + return $value; /*string*/ | |
| 204 | + }, $value); | |
| 205 | + } else { | |
| 206 | + return null; | |
| 207 | + } | |
| 250 | 208 | } |
| 251 | 209 | |
| 252 | 210 | /** |
| 253 | 211 | * @throws Exception |
| 254 | - * @return string | |
| 212 | + * @return ?array | |
| 255 | 213 | */ |
| 256 | - public function toOne(): string { | |
| 257 | - if (TopLevel::validateOne($this->one)) { | |
| 258 | - return $this->one; /*string*/ | |
| 214 | + public function toArrOne(): ?array { | |
| 215 | + if (TopLevel::validateArrOne($this->arrOne)) { | |
| 216 | + if (!is_null($this->arrOne)) { | |
| 217 | + return array_map(function ($value) { | |
| 218 | + return $value; /*string*/ | |
| 219 | + }, $this->arrOne); | |
| 220 | + } else { | |
| 221 | + return null; | |
| 222 | + } | |
| 259 | 223 | } |
| 260 | - throw new Exception('never get to this TopLevel::one'); | |
| 224 | + throw new Exception('never get to this TopLevel::arrOne'); | |
| 261 | 225 | } |
| 262 | 226 | |
| 263 | 227 | /** |
| 264 | - * @param string | |
| 228 | + * @param array|null | |
| 265 | 229 | * @return bool |
| 266 | 230 | * @throws Exception |
| 267 | 231 | */ |
| 268 | - public static function validateOne(string $value): bool { | |
| 232 | + public static function validateArrOne(?array $value): bool { | |
| 233 | + if (!is_null($value)) { | |
| 234 | + if (!is_array($value)) { | |
| 235 | + throw new Exception("Attribute Error:TopLevel::arrOne"); | |
| 236 | + } | |
| 237 | + array_walk($value, function($value_v) { | |
| 238 | + if (!is_string($value_v)) { | |
| 239 | + throw new Exception("Attribute Error:TopLevel::arrOne"); | |
| 240 | + } | |
| 241 | + }); | |
| 242 | + } | |
| 269 | 243 | return true; |
| 270 | 244 | } |
| 271 | 245 | |
| 272 | 246 | /** |
| 273 | 247 | * @throws Exception |
| 274 | - * @return string | |
| 248 | + * @return ?array | |
| 275 | 249 | */ |
| 276 | - public function getOne(): string { | |
| 277 | - if (TopLevel::validateOne($this->one)) { | |
| 278 | - return $this->one; | |
| 250 | + public function getArrOne(): ?array { | |
| 251 | + if (TopLevel::validateArrOne($this->arrOne)) { | |
| 252 | + return $this->arrOne; | |
| 279 | 253 | } |
| 280 | - throw new Exception('never get to getOne TopLevel::one'); | |
| 254 | + throw new Exception('never get to getArrOne TopLevel::arrOne'); | |
| 281 | 255 | } |
| 282 | 256 | |
| 283 | 257 | /** |
| 284 | - * @return string | |
| 258 | + * @return ?array | |
| 285 | 259 | */ |
| 286 | - public static function sampleOne(): string { | |
| 287 | - return 'TopLevel::one::34'; /*34:one*/ | |
| 260 | + public static function sampleArrOne(): ?array { | |
| 261 | + return array( | |
| 262 | + 'TopLevel::::34' /*34:*/ | |
| 263 | + ); /* 34:arrOne*/ | |
| 288 | 264 | } |
| 289 | 265 | |
| 290 | 266 | /** |
| 291 | - * @param ?string $value | |
| 267 | + * @param ?array $value | |
| 292 | 268 | * @throws Exception |
| 293 | - * @return ?string | |
| 269 | + * @return ?array | |
| 294 | 270 | */ |
| 295 | - public static function fromOptional(?string $value): ?string { | |
| 271 | + public static function fromArrNullable(?array $value): ?array { | |
| 296 | 272 | if (!is_null($value)) { |
| 297 | - return $value; /*string*/ | |
| 273 | + return array_map(function ($value) { | |
| 274 | + if (!is_null($value)) { | |
| 275 | + return $value; /*string*/ | |
| 276 | + } else { | |
| 277 | + return null; | |
| 278 | + } | |
| 279 | + }, $value); | |
| 298 | 280 | } else { |
| 299 | 281 | return null; |
| 300 | 282 | } |
| @@ -302,46 +284,64 @@ class TopLevel { | ||
| 302 | 284 | |
| 303 | 285 | /** |
| 304 | 286 | * @throws Exception |
| 305 | - * @return ?string | |
| 287 | + * @return ?array | |
| 306 | 288 | */ |
| 307 | - public function toOptional(): ?string { | |
| 308 | - if (TopLevel::validateOptional($this->optional)) { | |
| 309 | - if (!is_null($this->optional)) { | |
| 310 | - return $this->optional; /*string*/ | |
| 289 | + public function toArrNullable(): ?array { | |
| 290 | + if (TopLevel::validateArrNullable($this->arrNullable)) { | |
| 291 | + if (!is_null($this->arrNullable)) { | |
| 292 | + return array_map(function ($value) { | |
| 293 | + if (!is_null($value)) { | |
| 294 | + return $value; /*string*/ | |
| 295 | + } else { | |
| 296 | + return null; | |
| 297 | + } | |
| 298 | + }, $this->arrNullable); | |
| 311 | 299 | } else { |
| 312 | 300 | return null; |
| 313 | 301 | } |
| 314 | 302 | } |
| 315 | - throw new Exception('never get to this TopLevel::optional'); | |
| 303 | + throw new Exception('never get to this TopLevel::arrNullable'); | |
| 316 | 304 | } |
| 317 | 305 | |
| 318 | 306 | /** |
| 319 | - * @param string|null | |
| 307 | + * @param array|null | |
| 320 | 308 | * @return bool |
| 321 | 309 | * @throws Exception |
| 322 | 310 | */ |
| 323 | - public static function validateOptional(?string $value): bool { | |
| 311 | + public static function validateArrNullable(?array $value): bool { | |
| 324 | 312 | if (!is_null($value)) { |
| 313 | + if (!is_array($value)) { | |
| 314 | + throw new Exception("Attribute Error:TopLevel::arrNullable"); | |
| 315 | + } | |
| 316 | + array_walk($value, function($value_v) { | |
| 317 | + if (!is_null($value_v)) { | |
| 318 | + if (!is_string($value_v)) { | |
| 319 | + throw new Exception("Attribute Error:TopLevel::arrNullable"); | |
| 320 | + } | |
| 321 | + } | |
| 322 | + }); | |
| 325 | 323 | } |
| 326 | 324 | return true; |
| 327 | 325 | } |
| 328 | 326 | |
| 329 | 327 | /** |
| 330 | 328 | * @throws Exception |
| 331 | - * @return ?string | |
| 329 | + * @return ?array | |
| 332 | 330 | */ |
| 333 | - public function getOptional(): ?string { | |
| 334 | - if (TopLevel::validateOptional($this->optional)) { | |
| 335 | - return $this->optional; | |
| 331 | + public function getArrNullable(): ?array { | |
| 332 | + if (TopLevel::validateArrNullable($this->arrNullable)) { | |
| 333 | + return $this->arrNullable; | |
| 336 | 334 | } |
| 337 | - throw new Exception('never get to getOptional TopLevel::optional'); | |
| 335 | + throw new Exception('never get to getArrNullable TopLevel::arrNullable'); | |
| 338 | 336 | } |
| 339 | 337 | |
| 340 | 338 | /** |
| 341 | - * @return ?string | |
| 339 | + * @return ?array | |
| 342 | 340 | */ |
| 343 | - public static function sampleOptional(): ?string { | |
| 344 | - return 'TopLevel::optional::35'; /*35:optional*/ | |
| 341 | + public static function sampleArrNullable(): ?array { | |
| 342 | + return array( | |
| 343 | + 'TopLevel::::35' /*35:*/ | |
| 344 | + ); /* 35:arrNullable*/ | |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
| @@ -489,11 +489,11 @@ class TopLevel { | ||
| 489 | 489 | * @return bool |
| 490 | 490 | */ |
| 491 | 491 | public function validate(): bool { |
| 492 | - return TopLevel::validateArrNullable($this->arrNullable) | |
| 493 | - || TopLevel::validateArrOne($this->arrOne) | |
| 494 | - || TopLevel::validateNullable($this->nullable) | |
| 495 | - || TopLevel::validateOne($this->one) | |
| 492 | + return TopLevel::validateOne($this->one) | |
| 496 | 493 | || TopLevel::validateOptional($this->optional) |
| 494 | + || TopLevel::validateNullable($this->nullable) | |
| 495 | + || TopLevel::validateArrOne($this->arrOne) | |
| 496 | + || TopLevel::validateArrNullable($this->arrNullable) | |
| 497 | 497 | || TopLevel::validateUnionWithBool($this->unionWithBool) |
| 498 | 498 | || TopLevel::validateUnionWithBoolAndEnum($this->unionWithBoolAndEnum); |
| 499 | 499 | } |
| @@ -504,11 +504,11 @@ class TopLevel { | ||
| 504 | 504 | */ |
| 505 | 505 | public function to(): stdClass { |
| 506 | 506 | $out = new stdClass(); |
| 507 | - $out->{'arrNullable'} = $this->toArrNullable(); | |
| 508 | - $out->{'arrOne'} = $this->toArrOne(); | |
| 509 | - $out->{'nullable'} = $this->toNullable(); | |
| 510 | 507 | $out->{'one'} = $this->toOne(); |
| 511 | 508 | $out->{'optional'} = $this->toOptional(); |
| 509 | + $out->{'nullable'} = $this->toNullable(); | |
| 510 | + $out->{'arrOne'} = $this->toArrOne(); | |
| 511 | + $out->{'arrNullable'} = $this->toArrNullable(); | |
| 512 | 512 | $out->{'unionWithBool'} = $this->toUnionWithBool(); |
| 513 | 513 | $out->{'unionWithBoolAndEnum'} = $this->toUnionWithBoolAndEnum(); |
| 514 | 514 | return $out; |
| @@ -521,11 +521,11 @@ class TopLevel { | ||
| 521 | 521 | */ |
| 522 | 522 | public static function from(stdClass $obj): TopLevel { |
| 523 | 523 | return new TopLevel( |
| 524 | - TopLevel::fromArrNullable($obj->{'arrNullable'}) | |
| 525 | - ,TopLevel::fromArrOne($obj->{'arrOne'}) | |
| 526 | - ,TopLevel::fromNullable($obj->{'nullable'}) | |
| 527 | - ,TopLevel::fromOne($obj->{'one'}) | |
| 524 | + TopLevel::fromOne($obj->{'one'}) | |
| 528 | 525 | ,TopLevel::fromOptional($obj->{'optional'}) |
| 526 | + ,TopLevel::fromNullable($obj->{'nullable'}) | |
| 527 | + ,TopLevel::fromArrOne($obj->{'arrOne'}) | |
| 528 | + ,TopLevel::fromArrNullable($obj->{'arrNullable'}) | |
| 529 | 529 | ,TopLevel::fromUnionWithBool($obj->{'unionWithBool'}) |
| 530 | 530 | ,TopLevel::fromUnionWithBoolAndEnum($obj->{'unionWithBoolAndEnum'}) |
| 531 | 531 | ); |
| @@ -536,11 +536,11 @@ class TopLevel { | ||
| 536 | 536 | */ |
| 537 | 537 | public static function sample(): TopLevel { |
| 538 | 538 | return new TopLevel( |
| 539 | - TopLevel::sampleArrNullable() | |
| 540 | - ,TopLevel::sampleArrOne() | |
| 541 | - ,TopLevel::sampleNullable() | |
| 542 | - ,TopLevel::sampleOne() | |
| 539 | + TopLevel::sampleOne() | |
| 543 | 540 | ,TopLevel::sampleOptional() |
| 541 | + ,TopLevel::sampleNullable() | |
| 542 | + ,TopLevel::sampleArrOne() | |
| 543 | + ,TopLevel::sampleArrNullable() | |
| 544 | 544 | ,TopLevel::sampleUnionWithBool() |
| 545 | 545 | ,TopLevel::sampleUnionWithBoolAndEnum() |
| 546 | 546 | ); |
Mschema-pikedefault / TopLevel.pmod+9 −9
| @@ -13,21 +13,21 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - array(mixed|string)|mixed arr_nullable; // json: "arrNullable" | |
| 17 | - array(string)|mixed arr_one; // json: "arrOne" | |
| 18 | - mixed|string nullable; // json: "nullable" | |
| 19 | 16 | string one; // json: "one" |
| 20 | 17 | mixed|string top_level_optional; // json: "optional" |
| 18 | + mixed|string nullable; // json: "nullable" | |
| 19 | + array(string)|mixed arr_one; // json: "arrOne" | |
| 20 | + array(mixed|string)|mixed arr_nullable; // json: "arrNullable" | |
| 21 | 21 | UnionWithBool union_with_bool; // json: "unionWithBool" |
| 22 | 22 | UnionWithBool union_with_bool_and_enum; // json: "unionWithBoolAndEnum" |
| 23 | 23 | |
| 24 | 24 | string encode_json() { |
| 25 | 25 | mapping(string:mixed) json = ([ |
| 26 | - "arrNullable" : arr_nullable, | |
| 27 | - "arrOne" : arr_one, | |
| 28 | - "nullable" : nullable, | |
| 29 | 26 | "one" : one, |
| 30 | 27 | "optional" : top_level_optional, |
| 28 | + "nullable" : nullable, | |
| 29 | + "arrOne" : arr_one, | |
| 30 | + "arrNullable" : arr_nullable, | |
| 31 | 31 | "unionWithBool" : union_with_bool, |
| 32 | 32 | "unionWithBoolAndEnum" : union_with_bool_and_enum, |
| 33 | 33 | ]); |
| @@ -39,11 +39,11 @@ class TopLevel { | ||
| 39 | 39 | TopLevel TopLevel_from_JSON(mixed json) { |
| 40 | 40 | TopLevel retval = TopLevel(); |
| 41 | 41 | |
| 42 | - retval.arr_nullable = json["arrNullable"]; | |
| 43 | - retval.arr_one = json["arrOne"]; | |
| 44 | - retval.nullable = json["nullable"]; | |
| 45 | 42 | retval.one = json["one"]; |
| 46 | 43 | retval.top_level_optional = json["optional"]; |
| 44 | + retval.nullable = json["nullable"]; | |
| 45 | + retval.arr_one = json["arrOne"]; | |
| 46 | + retval.arr_nullable = json["arrNullable"]; | |
| 47 | 47 | retval.union_with_bool = json["unionWithBool"]; |
| 48 | 48 | retval.union_with_bool_and_enum = json["unionWithBoolAndEnum"]; |
Mschema-pythondefault / quicktype.py+17 −17
| @@ -34,16 +34,16 @@ def from_union(fs, x): | ||
| 34 | 34 | assert False |
| 35 | 35 | |
| 36 | 36 | |
| 37 | -def from_list(f: Callable[[Any], T], x: Any) -> list[T]: | |
| 38 | - assert isinstance(x, list) | |
| 39 | - return [f(y) for y in x] | |
| 40 | - | |
| 41 | - | |
| 42 | 37 | def from_none(x: Any) -> Any: |
| 43 | 38 | assert x is None |
| 44 | 39 | return x |
| 45 | 40 | |
| 46 | 41 | |
| 42 | +def from_list(f: Callable[[Any], T], x: Any) -> list[T]: | |
| 43 | + assert isinstance(x, list) | |
| 44 | + return [f(y) for y in x] | |
| 45 | + | |
| 46 | + | |
| 47 | 47 | def is_type(t: Type[T], x: Any) -> T: |
| 48 | 48 | assert isinstance(x, t) |
| 49 | 49 | return x |
| @@ -68,10 +68,10 @@ class TopLevel: | ||
| 68 | 68 | one: bool |
| 69 | 69 | union_with_bool: bool |
| 70 | 70 | union_with_bool_and_enum: bool | UnionWithBoolAndEnumEnum |
| 71 | - arr_nullable: list[bool | None] | None = None | |
| 72 | - arr_one: list[bool] | None = None | |
| 73 | - nullable: bool | None = None | |
| 74 | 71 | optional: bool | None = None |
| 72 | + nullable: bool | None = None | |
| 73 | + arr_one: list[bool] | None = None | |
| 74 | + arr_nullable: list[bool | None] | None = None | |
| 75 | 75 | |
| 76 | 76 | @staticmethod |
| 77 | 77 | def from_dict(obj: Any) -> 'TopLevel': |
| @@ -79,24 +79,24 @@ class TopLevel: | ||
| 79 | 79 | one = from_stringified_bool(from_str(obj.get("one"))) |
| 80 | 80 | union_with_bool = from_union([from_bool, lambda x: from_stringified_bool(from_str(x))], obj.get("unionWithBool")) |
| 81 | 81 | union_with_bool_and_enum = from_union([from_bool, lambda x: from_union([from_stringified_bool, UnionWithBoolAndEnumEnum], from_str(x))], obj.get("unionWithBoolAndEnum")) |
| 82 | - arr_nullable = from_union([lambda x: from_list(lambda x: from_union([from_none, lambda x: from_stringified_bool(from_str(x))], x), x), from_none], obj.get("arrNullable")) | |
| 83 | - arr_one = from_union([lambda x: from_list(lambda x: from_stringified_bool(from_str(x)), x), from_none], obj.get("arrOne")) | |
| 84 | - nullable = from_union([from_none, lambda x: from_stringified_bool(from_str(x))], obj.get("nullable")) | |
| 85 | 82 | optional = from_union([from_none, lambda x: from_stringified_bool(from_str(x))], obj.get("optional")) |
| 86 | - return TopLevel(one, union_with_bool, union_with_bool_and_enum, arr_nullable, arr_one, nullable, optional) | |
| 83 | + nullable = from_union([from_none, lambda x: from_stringified_bool(from_str(x))], obj.get("nullable")) | |
| 84 | + arr_one = from_union([lambda x: from_list(lambda x: from_stringified_bool(from_str(x)), x), from_none], obj.get("arrOne")) | |
| 85 | + arr_nullable = from_union([lambda x: from_list(lambda x: from_union([from_none, lambda x: from_stringified_bool(from_str(x))], x), x), from_none], obj.get("arrNullable")) | |
| 86 | + return TopLevel(one, union_with_bool, union_with_bool_and_enum, optional, nullable, arr_one, arr_nullable) | |
| 87 | 87 | |
| 88 | 88 | def to_dict(self) -> dict: |
| 89 | 89 | result: dict = {} |
| 90 | 90 | result["one"] = from_str(str(self.one).lower()) |
| 91 | 91 | result["unionWithBool"] = from_bool(self.union_with_bool) |
| 92 | 92 | result["unionWithBoolAndEnum"] = from_union([lambda x: from_bool((lambda x: is_type(bool, x))(x)), lambda x: from_str((lambda x: to_enum(UnionWithBoolAndEnumEnum, (lambda x: is_type(UnionWithBoolAndEnumEnum, x))(x)))(x))], self.union_with_bool_and_enum) |
| 93 | - if self.arr_nullable is not None: | |
| 94 | - result["arrNullable"] = from_union([lambda x: from_list(lambda x: from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(bool, x))(x)).lower())(x))], x), x), from_none], self.arr_nullable) | |
| 95 | - if self.arr_one is not None: | |
| 96 | - result["arrOne"] = from_union([lambda x: from_list(lambda x: from_str((lambda x: str(x).lower())(x)), x), from_none], self.arr_one) | |
| 97 | - result["nullable"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(bool, x))(x)).lower())(x))], self.nullable) | |
| 98 | 93 | if self.optional is not None: |
| 99 | 94 | result["optional"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(bool, x))(x)).lower())(x))], self.optional) |
| 95 | + result["nullable"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(bool, x))(x)).lower())(x))], self.nullable) | |
| 96 | + if self.arr_one is not None: | |
| 97 | + result["arrOne"] = from_union([lambda x: from_list(lambda x: from_str((lambda x: str(x).lower())(x)), x), from_none], self.arr_one) | |
| 98 | + if self.arr_nullable is not None: | |
| 99 | + result["arrNullable"] = from_union([lambda x: from_list(lambda x: from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(bool, x))(x)).lower())(x))], x), x), from_none], self.arr_nullable) | |
| 100 | 100 | return result |
Mschema-rubydefault / TopLevel.rb+10 −10
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.arr_one&.first | |
| 7 | +# puts top_level.arr_nullable&.first.nil? | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -53,22 +53,22 @@ class UnionWithBool < Dry::Struct | ||
| 53 | 53 | end |
| 54 | 54 | |
| 55 | 55 | class TopLevel < Dry::Struct |
| 56 | - attribute :arr_nullable, Types.Array(Types::String.optional).optional | |
| 57 | - attribute :arr_one, Types.Array(Types::String).optional | |
| 58 | - attribute :nullable, Types::String.optional | |
| 59 | 56 | attribute :one, Types::String |
| 60 | 57 | attribute :top_level_optional, Types::String.optional |
| 58 | + attribute :nullable, Types::String.optional | |
| 59 | + attribute :arr_one, Types.Array(Types::String).optional | |
| 60 | + attribute :arr_nullable, Types.Array(Types::String.optional).optional | |
| 61 | 61 | attribute :union_with_bool, Types.Instance(UnionWithBool) |
| 62 | 62 | attribute :union_with_bool_and_enum, Types.Instance(UnionWithBool) |
| 63 | 63 | |
| 64 | 64 | def self.from_dynamic!(d) |
| 65 | 65 | d = Types::Hash[d] |
| 66 | 66 | new( |
| 67 | - arr_nullable: d["arrNullable"], | |
| 68 | - arr_one: d["arrOne"], | |
| 69 | - nullable: d.fetch("nullable"), | |
| 70 | 67 | one: d.fetch("one"), |
| 71 | 68 | top_level_optional: d["optional"], |
| 69 | + nullable: d.fetch("nullable"), | |
| 70 | + arr_one: d["arrOne"], | |
| 71 | + arr_nullable: d["arrNullable"], | |
| 72 | 72 | union_with_bool: UnionWithBool.from_dynamic!(d.fetch("unionWithBool")), |
| 73 | 73 | union_with_bool_and_enum: UnionWithBool.from_dynamic!(d.fetch("unionWithBoolAndEnum")), |
| 74 | 74 | ) |
| @@ -80,11 +80,11 @@ class TopLevel < Dry::Struct | ||
| 80 | 80 | |
| 81 | 81 | def to_dynamic |
| 82 | 82 | { |
| 83 | - "arrNullable" => arr_nullable, | |
| 84 | - "arrOne" => arr_one, | |
| 85 | - "nullable" => nullable, | |
| 86 | 83 | "one" => one, |
| 87 | 84 | "optional" => top_level_optional, |
| 85 | + "nullable" => nullable, | |
| 86 | + "arrOne" => arr_one, | |
| 87 | + "arrNullable" => arr_nullable, | |
| 88 | 88 | "unionWithBool" => union_with_bool.to_dynamic, |
| 89 | 89 | "unionWithBoolAndEnum" => union_with_bool_and_enum.to_dynamic, |
| 90 | 90 | } |
Mschema-rustdefault / module_under_test.rs+4 −4
| @@ -16,15 +16,15 @@ use serde::{Serialize, Deserialize}; | ||
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | #[serde(rename_all = "camelCase")] |
| 18 | 18 | pub struct TopLevel { |
| 19 | - pub arr_nullable: Option<Vec<Option<String>>>, | |
| 19 | + pub one: String, | |
| 20 | 20 | |
| 21 | - pub arr_one: Option<Vec<String>>, | |
| 21 | + pub optional: Option<String>, | |
| 22 | 22 | |
| 23 | 23 | pub nullable: Option<String>, |
| 24 | 24 | |
| 25 | - pub one: String, | |
| 25 | + pub arr_one: Option<Vec<String>>, | |
| 26 | 26 | |
| 27 | - pub optional: Option<String>, | |
| 27 | + pub arr_nullable: Option<Vec<Option<String>>>, | |
| 28 | 28 | |
| 29 | 29 | pub union_with_bool: UnionWithBool, |
Mschema-scala3-upickledefault / TopLevel.scala+3 −3
| @@ -66,11 +66,11 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val arrNullable : Option[Seq[Option[String]]] = None, | |
| 70 | - val arrOne : Option[Seq[String]] = None, | |
| 71 | - val nullable : Option[String] = None, | |
| 72 | 69 | val one : String, |
| 73 | 70 | val optional : Option[String] = None, |
| 71 | + val nullable : Option[String] = None, | |
| 72 | + val arrOne : Option[Seq[String]] = None, | |
| 73 | + val arrNullable : Option[Seq[Option[String]]] = None, | |
| 74 | 74 | val unionWithBool : UnionWithBool, |
| 75 | 75 | val unionWithBoolAndEnum : UnionWithBool |
| 76 | 76 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+3 −3
| @@ -8,11 +8,11 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val arrNullable : Option[Seq[Option[String]]] = None, | |
| 12 | - val arrOne : Option[Seq[String]] = None, | |
| 13 | - val nullable : Option[String] = None, | |
| 14 | 11 | val one : String, |
| 15 | 12 | val optional : Option[String] = None, |
| 13 | + val nullable : Option[String] = None, | |
| 14 | + val arrOne : Option[Seq[String]] = None, | |
| 15 | + val arrNullable : Option[Seq[Option[String]]] = None, | |
| 16 | 16 | val unionWithBool : UnionWithBool, |
| 17 | 17 | val unionWithBoolAndEnum : UnionWithBool |
| 18 | 18 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+25 −25
| @@ -6,26 +6,13 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": {}, |
| 8 | 8 | "properties": { |
| 9 | - "arrNullable": { | |
| 10 | - "type": "array", | |
| 11 | - "items": { | |
| 12 | - "anyOf": [ | |
| 13 | - { | |
| 14 | - "type": "string", | |
| 15 | - "format": "boolean" | |
| 16 | - }, | |
| 17 | - { | |
| 18 | - "type": "null" | |
| 19 | - } | |
| 20 | - ] | |
| 21 | - } | |
| 9 | + "one": { | |
| 10 | + "type": "string", | |
| 11 | + "format": "boolean" | |
| 22 | 12 | }, |
| 23 | - "arrOne": { | |
| 24 | - "type": "array", | |
| 25 | - "items": { | |
| 26 | - "type": "string", | |
| 27 | - "format": "boolean" | |
| 28 | - } | |
| 13 | + "optional": { | |
| 14 | + "type": "string", | |
| 15 | + "format": "boolean" | |
| 29 | 16 | }, |
| 30 | 17 | "nullable": { |
| 31 | 18 | "anyOf": [ |
| @@ -38,13 +25,26 @@ | ||
| 38 | 25 | } |
| 39 | 26 | ] |
| 40 | 27 | }, |
| 41 | - "one": { | |
| 42 | - "type": "string", | |
| 43 | - "format": "boolean" | |
| 28 | + "arrOne": { | |
| 29 | + "type": "array", | |
| 30 | + "items": { | |
| 31 | + "type": "string", | |
| 32 | + "format": "boolean" | |
| 33 | + } | |
| 44 | 34 | }, |
| 45 | - "optional": { | |
| 46 | - "type": "string", | |
| 47 | - "format": "boolean" | |
| 35 | + "arrNullable": { | |
| 36 | + "type": "array", | |
| 37 | + "items": { | |
| 38 | + "anyOf": [ | |
| 39 | + { | |
| 40 | + "type": "string", | |
| 41 | + "format": "boolean" | |
| 42 | + }, | |
| 43 | + { | |
| 44 | + "type": "null" | |
| 45 | + } | |
| 46 | + ] | |
| 47 | + } | |
| 48 | 48 | }, |
| 49 | 49 | "unionWithBool": { |
| 50 | 50 | "$ref": "#/definitions/UnionWithBool" |
Mschema-swiftdefault / quicktype.swift+12 −12
| @@ -7,20 +7,20 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | - let arrNullable: [String?]? | |
| 11 | - let arrOne: [String]? | |
| 12 | - let nullable: String? | |
| 13 | 10 | let one: String |
| 14 | 11 | let topLevelOptional: String? |
| 12 | + let nullable: String? | |
| 13 | + let arrOne: [String]? | |
| 14 | + let arrNullable: [String?]? | |
| 15 | 15 | let unionWithBool: UnionWithBool |
| 16 | 16 | let unionWithBoolAndEnum: UnionWithBool |
| 17 | 17 | |
| 18 | 18 | enum CodingKeys: String, CodingKey { |
| 19 | - case arrNullable = "arrNullable" | |
| 20 | - case arrOne = "arrOne" | |
| 21 | - case nullable = "nullable" | |
| 22 | 19 | case one = "one" |
| 23 | 20 | case topLevelOptional = "optional" |
| 21 | + case nullable = "nullable" | |
| 22 | + case arrOne = "arrOne" | |
| 23 | + case arrNullable = "arrNullable" | |
| 24 | 24 | case unionWithBool = "unionWithBool" |
| 25 | 25 | case unionWithBoolAndEnum = "unionWithBoolAndEnum" |
| 26 | 26 | } |
| @@ -45,20 +45,20 @@ extension TopLevel { | ||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | func with( |
| 48 | - arrNullable: [String?]?? = nil, | |
| 49 | - arrOne: [String]?? = nil, | |
| 50 | - nullable: String?? = nil, | |
| 51 | 48 | one: String? = nil, |
| 52 | 49 | topLevelOptional: String?? = nil, |
| 50 | + nullable: String?? = nil, | |
| 51 | + arrOne: [String]?? = nil, | |
| 52 | + arrNullable: [String?]?? = nil, | |
| 53 | 53 | unionWithBool: UnionWithBool? = nil, |
| 54 | 54 | unionWithBoolAndEnum: UnionWithBool? = nil |
| 55 | 55 | ) -> TopLevel { |
| 56 | 56 | return TopLevel( |
| 57 | - arrNullable: arrNullable ?? self.arrNullable, | |
| 58 | - arrOne: arrOne ?? self.arrOne, | |
| 59 | - nullable: nullable ?? self.nullable, | |
| 60 | 57 | one: one ?? self.one, |
| 61 | 58 | topLevelOptional: topLevelOptional ?? self.topLevelOptional, |
| 59 | + nullable: nullable ?? self.nullable, | |
| 60 | + arrOne: arrOne ?? self.arrOne, | |
| 61 | + arrNullable: arrNullable ?? self.arrNullable, | |
| 62 | 62 | unionWithBool: unionWithBool ?? self.unionWithBool, |
| 63 | 63 | unionWithBoolAndEnum: unionWithBoolAndEnum ?? self.unionWithBoolAndEnum |
| 64 | 64 | ) |
Mschema-typescript-zoddefault / TopLevel.ts+3 −3
| @@ -2,11 +2,11 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "arrNullable": z.array(z.union([z.null(), z.string()])).optional(), | |
| 6 | - "arrOne": z.array(z.string()).optional(), | |
| 7 | - "nullable": z.union([z.null(), z.string()]), | |
| 8 | 5 | "one": z.string(), |
| 9 | 6 | "optional": z.string().optional(), |
| 7 | + "nullable": z.union([z.null(), z.string()]), | |
| 8 | + "arrOne": z.array(z.string()).optional(), | |
| 9 | + "arrNullable": z.array(z.union([z.null(), z.string()])).optional(), | |
| 10 | 10 | "unionWithBool": z.union([z.boolean(), z.string()]), |
| 11 | 11 | "unionWithBoolAndEnum": z.union([z.boolean(), z.string()]), |
| 12 | 12 | }); |
Mschema-typescriptdefault / TopLevel.ts+6 −6
| @@ -8,11 +8,11 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - arrNullable?: (null | string)[]; | |
| 12 | - arrOne?: string[]; | |
| 13 | - nullable: null | string; | |
| 14 | 11 | one: string; |
| 15 | 12 | optional?: string; |
| 13 | + nullable: null | string; | |
| 14 | + arrOne?: string[]; | |
| 15 | + arrNullable?: (null | string)[]; | |
| 16 | 16 | unionWithBool: UnionWithBool; |
| 17 | 17 | unionWithBoolAndEnum: UnionWithBool; |
| 18 | 18 | [property: string]: unknown; |
| @@ -187,11 +187,11 @@ function r(name: string) { | ||
| 187 | 187 | |
| 188 | 188 | const typeMap: any = { |
| 189 | 189 | "TopLevel": o([ |
| 190 | - { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 191 | - { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 192 | - { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 193 | 190 | { json: "one", js: "one", typ: "" }, |
| 194 | 191 | { json: "optional", js: "optional", typ: u(undefined, "") }, |
| 192 | + { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 193 | + { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 194 | + { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 195 | 195 | { json: "unionWithBool", js: "unionWithBool", typ: u(true, "") }, |
| 196 | 196 | { json: "unionWithBoolAndEnum", js: "unionWithBoolAndEnum", typ: u(true, "") }, |
| 197 | 197 | ], "any"), |
Test case
26 generated files · +143 −143test/inputs/schema/boolean-subschema.schema
Mschema-cplusplusdefault / quicktype.hpp+7 −7
| @@ -94,12 +94,16 @@ namespace quicktype { | ||
| 94 | 94 | virtual ~TopLevel() = default; |
| 95 | 95 | |
| 96 | 96 | private: |
| 97 | + std::string foo; | |
| 97 | 98 | nlohmann::json disallowed; |
| 98 | 99 | std::vector<nlohmann::json> empty; |
| 99 | - std::string foo; | |
| 100 | 100 | nlohmann::json impossible; |
| 101 | 101 | |
| 102 | 102 | public: |
| 103 | + const std::string & get_foo() const { return foo; } | |
| 104 | + std::string & get_mutable_foo() { return foo; } | |
| 105 | + void set_foo(const std::string & value) { this->foo = value; } | |
| 106 | + | |
| 103 | 107 | const nlohmann::json & get_disallowed() const { return disallowed; } |
| 104 | 108 | nlohmann::json & get_mutable_disallowed() { return disallowed; } |
| 105 | 109 | void set_disallowed(const nlohmann::json & value) { this->disallowed = value; } |
| @@ -108,10 +112,6 @@ namespace quicktype { | ||
| 108 | 112 | std::vector<nlohmann::json> & get_mutable_empty() { return empty; } |
| 109 | 113 | void set_empty(const std::vector<nlohmann::json> & value) { this->empty = value; } |
| 110 | 114 | |
| 111 | - const std::string & get_foo() const { return foo; } | |
| 112 | - std::string & get_mutable_foo() { return foo; } | |
| 113 | - void set_foo(const std::string & value) { this->foo = value; } | |
| 114 | - | |
| 115 | 115 | const nlohmann::json & get_impossible() const { return impossible; } |
| 116 | 116 | nlohmann::json & get_mutable_impossible() { return impossible; } |
| 117 | 117 | void set_impossible(const nlohmann::json & value) { this->impossible = value; } |
| @@ -123,17 +123,17 @@ namespace quicktype { | ||
| 123 | 123 | void to_json(json & j, const TopLevel & x); |
| 124 | 124 | |
| 125 | 125 | inline void from_json(const json & j, TopLevel& x) { |
| 126 | + x.set_foo(j.at("foo").get<std::string>()); | |
| 126 | 127 | x.set_disallowed(get_untyped(j, "disallowed")); |
| 127 | 128 | x.set_empty(j.at("empty").get<std::vector<nlohmann::json>>()); |
| 128 | - x.set_foo(j.at("foo").get<std::string>()); | |
| 129 | 129 | x.set_impossible(get_untyped(j, "impossible")); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | inline void to_json(json & j, const TopLevel & x) { |
| 133 | 133 | j = json::object(); |
| 134 | + j["foo"] = x.get_foo(); | |
| 134 | 135 | j["disallowed"] = x.get_disallowed(); |
| 135 | 136 | j["empty"] = x.get_empty(); |
| 136 | - j["foo"] = x.get_foo(); | |
| 137 | 137 | j["impossible"] = x.get_impossible(); |
| 138 | 138 | } |
| 139 | 139 | } |
Mschema-csharp-recordsdefault / QuickType.cs+3 −3
| @@ -25,15 +25,15 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | + [JsonProperty("foo", Required = Required.Always)] | |
| 29 | + public string Foo { get; set; } | |
| 30 | + | |
| 28 | 31 | [JsonProperty("disallowed")] |
| 29 | 32 | public object? Disallowed { get; set; } |
| 30 | 33 | |
| 31 | 34 | [JsonProperty("empty", Required = Required.Always)] |
| 32 | 35 | public object[] Empty { get; set; } |
| 33 | 36 | |
| 34 | - [JsonProperty("foo", Required = Required.Always)] | |
| 35 | - public string Foo { get; set; } | |
| 36 | - | |
| 37 | 37 | [JsonProperty("impossible")] |
| 38 | 38 | public object? Impossible { get; set; } |
| 39 | 39 | } |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+4 −4
| @@ -22,6 +22,10 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | + [JsonRequired] | |
| 26 | + [JsonPropertyName("foo")] | |
| 27 | + public string Foo { get; set; } | |
| 28 | + | |
| 25 | 29 | [JsonPropertyName("disallowed")] |
| 26 | 30 | public object? Disallowed { get; set; } |
| 27 | 31 | |
| @@ -29,10 +33,6 @@ namespace QuickType | ||
| 29 | 33 | [JsonPropertyName("empty")] |
| 30 | 34 | public object[] Empty { get; set; } |
| 31 | 35 | |
| 32 | - [JsonRequired] | |
| 33 | - [JsonPropertyName("foo")] | |
| 34 | - public string Foo { get; set; } | |
| 35 | - | |
| 36 | 36 | [JsonPropertyName("impossible")] |
| 37 | 37 | public object? Impossible { get; set; } |
| 38 | 38 | } |
Mschema-csharpdefault / QuickType.cs+3 −3
| @@ -25,15 +25,15 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | + [JsonProperty("foo", Required = Required.Always)] | |
| 29 | + public string Foo { get; set; } | |
| 30 | + | |
| 28 | 31 | [JsonProperty("disallowed")] |
| 29 | 32 | public object? Disallowed { get; set; } |
| 30 | 33 | |
| 31 | 34 | [JsonProperty("empty", Required = Required.Always)] |
| 32 | 35 | public object[] Empty { get; set; } |
| 33 | 36 | |
| 34 | - [JsonProperty("foo", Required = Required.Always)] | |
| 35 | - public string Foo { get; set; } | |
| 36 | - | |
| 37 | 37 | [JsonProperty("impossible")] |
| 38 | 38 | public object? Impossible { get; set; } |
| 39 | 39 | } |
Mschema-dartdefault / TopLevel.dart+4 −4
| @@ -9,29 +9,29 @@ TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | ||
| 9 | 9 | String topLevelToJson(TopLevel data) => json.encode(data.toJson()); |
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | + final String foo; | |
| 12 | 13 | final dynamic disallowed; |
| 13 | 14 | final List<dynamic> empty; |
| 14 | - final String foo; | |
| 15 | 15 | final dynamic impossible; |
| 16 | 16 | |
| 17 | 17 | TopLevel({ |
| 18 | + required this.foo, | |
| 18 | 19 | this.disallowed, |
| 19 | 20 | required this.empty, |
| 20 | - required this.foo, | |
| 21 | 21 | this.impossible, |
| 22 | 22 | }); |
| 23 | 23 | |
| 24 | 24 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 25 | + foo: json["foo"], | |
| 25 | 26 | disallowed: json["disallowed"], |
| 26 | 27 | empty: List<dynamic>.from(json["empty"].map((x) => x)), |
| 27 | - foo: json["foo"], | |
| 28 | 28 | impossible: json["impossible"], |
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | 31 | Map<String, dynamic> toJson() => { |
| 32 | + "foo": foo, | |
| 32 | 33 | "disallowed": disallowed, |
| 33 | 34 | "empty": List<dynamic>.from(empty.map((x) => x)), |
| 34 | - "foo": foo, | |
| 35 | 35 | "impossible": impossible, |
| 36 | 36 | }; |
| 37 | 37 | } |
Mschema-elmdefault / QuickType.elm+5 −5
| @@ -23,9 +23,9 @@ import Json.Encode as Jenc | ||
| 23 | 23 | import Dict exposing (Dict) |
| 24 | 24 | |
| 25 | 25 | type alias QuickType = |
| 26 | - { disallowed : Maybe Jdec.Value | |
| 26 | + { foo : String | |
| 27 | + , disallowed : Maybe Jdec.Value | |
| 27 | 28 | , empty : List Jdec.Value |
| 28 | - , foo : String | |
| 29 | 29 | , impossible : Maybe Jdec.Value |
| 30 | 30 | } |
| 31 | 31 | |
| @@ -37,17 +37,17 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 37 | 37 | quickType : Jdec.Decoder QuickType |
| 38 | 38 | quickType = |
| 39 | 39 | Jdec.succeed QuickType |
| 40 | + |> Jpipe.required "foo" Jdec.string | |
| 40 | 41 | |> Jpipe.optional "disallowed" (Jdec.nullable Jdec.value) Nothing |
| 41 | 42 | |> Jpipe.required "empty" (Jdec.list Jdec.value) |
| 42 | - |> Jpipe.required "foo" Jdec.string | |
| 43 | 43 | |> Jpipe.optional "impossible" (Jdec.nullable Jdec.value) Nothing |
| 44 | 44 | |
| 45 | 45 | encodeQuickType : QuickType -> Jenc.Value |
| 46 | 46 | encodeQuickType x = |
| 47 | 47 | Jenc.object |
| 48 | - [ ("disallowed", makeNullableEncoder identity x.disallowed) | |
| 48 | + [ ("foo", Jenc.string x.foo) | |
| 49 | + , ("disallowed", makeNullableEncoder identity x.disallowed) | |
| 49 | 50 | , ("empty", Jenc.list identity x.empty) |
| 50 | - , ("foo", Jenc.string x.foo) | |
| 51 | 51 | , ("impossible", makeNullableEncoder identity x.impossible) |
| 52 | 52 | ] |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -10,9 +10,9 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | + foo: string; | |
| 13 | 14 | disallowed?: mixed; |
| 14 | 15 | empty: mixed[]; |
| 15 | - foo: string; | |
| 16 | 16 | impossible?: mixed; |
| 17 | 17 | }; |
| 18 | 18 | |
| @@ -181,9 +181,9 @@ function r(name: string) { | ||
| 181 | 181 | |
| 182 | 182 | const typeMap: any = { |
| 183 | 183 | "TopLevel": o([ |
| 184 | + { json: "foo", js: "foo", typ: "" }, | |
| 184 | 185 | { json: "disallowed", js: "disallowed", typ: u(undefined, "any") }, |
| 185 | 186 | { json: "empty", js: "empty", typ: a("any") }, |
| 186 | - { json: "foo", js: "foo", typ: "" }, | |
| 187 | 187 | { json: "impossible", js: "impossible", typ: u(undefined, "any") }, |
| 188 | 188 | ], false), |
| 189 | 189 | }; |
Mschema-golangdefault / quicktype.go+1 −1
| @@ -19,8 +19,8 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | type TopLevel struct { |
| 22 | + Foo string `json:"foo"` | |
| 22 | 23 | Disallowed interface{} `json:"disallowed"` |
| 23 | 24 | Empty []interface{} `json:"empty"` |
| 24 | - Foo string `json:"foo"` | |
| 25 | 25 | Impossible interface{} `json:"impossible"` |
| 26 | 26 | } |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -4,11 +4,16 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | + private String foo; | |
| 7 | 8 | private Object disallowed; |
| 8 | 9 | private List<Object> empty; |
| 9 | - private String foo; | |
| 10 | 10 | private Object impossible; |
| 11 | 11 | |
| 12 | + @JsonProperty("foo") | |
| 13 | + public String getFoo() { return foo; } | |
| 14 | + @JsonProperty("foo") | |
| 15 | + public void setFoo(String value) { this.foo = value; } | |
| 16 | + | |
| 12 | 17 | @JsonProperty("disallowed") |
| 13 | 18 | public Object getDisallowed() { return disallowed; } |
| 14 | 19 | @JsonProperty("disallowed") |
| @@ -19,11 +24,6 @@ public class TopLevel { | ||
| 19 | 24 | @JsonProperty("empty") |
| 20 | 25 | public void setEmpty(List<Object> value) { this.empty = value; } |
| 21 | 26 | |
| 22 | - @JsonProperty("foo") | |
| 23 | - public String getFoo() { return foo; } | |
| 24 | - @JsonProperty("foo") | |
| 25 | - public void setFoo(String value) { this.foo = value; } | |
| 26 | - | |
| 27 | 27 | @JsonProperty("impossible") |
| 28 | 28 | public Object getImpossible() { return impossible; } |
| 29 | 29 | @JsonProperty("impossible") |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -4,11 +4,16 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | + private String foo; | |
| 7 | 8 | private Object disallowed; |
| 8 | 9 | private List<Object> empty; |
| 9 | - private String foo; | |
| 10 | 10 | private Object impossible; |
| 11 | 11 | |
| 12 | + @JsonProperty("foo") | |
| 13 | + public String getFoo() { return foo; } | |
| 14 | + @JsonProperty("foo") | |
| 15 | + public void setFoo(String value) { this.foo = value; } | |
| 16 | + | |
| 12 | 17 | @JsonProperty("disallowed") |
| 13 | 18 | public Object getDisallowed() { return disallowed; } |
| 14 | 19 | @JsonProperty("disallowed") |
| @@ -19,11 +24,6 @@ public class TopLevel { | ||
| 19 | 24 | @JsonProperty("empty") |
| 20 | 25 | public void setEmpty(List<Object> value) { this.empty = value; } |
| 21 | 26 | |
| 22 | - @JsonProperty("foo") | |
| 23 | - public String getFoo() { return foo; } | |
| 24 | - @JsonProperty("foo") | |
| 25 | - public void setFoo(String value) { this.foo = value; } | |
| 26 | - | |
| 27 | 27 | @JsonProperty("impossible") |
| 28 | 28 | public Object getImpossible() { return impossible; } |
| 29 | 29 | @JsonProperty("impossible") |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -4,11 +4,16 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | + private String foo; | |
| 7 | 8 | private Object disallowed; |
| 8 | 9 | private List<Object> empty; |
| 9 | - private String foo; | |
| 10 | 10 | private Object impossible; |
| 11 | 11 | |
| 12 | + @JsonProperty("foo") | |
| 13 | + public String getFoo() { return foo; } | |
| 14 | + @JsonProperty("foo") | |
| 15 | + public void setFoo(String value) { this.foo = value; } | |
| 16 | + | |
| 12 | 17 | @JsonProperty("disallowed") |
| 13 | 18 | public Object getDisallowed() { return disallowed; } |
| 14 | 19 | @JsonProperty("disallowed") |
| @@ -19,11 +24,6 @@ public class TopLevel { | ||
| 19 | 24 | @JsonProperty("empty") |
| 20 | 25 | public void setEmpty(List<Object> value) { this.empty = value; } |
| 21 | 26 | |
| 22 | - @JsonProperty("foo") | |
| 23 | - public String getFoo() { return foo; } | |
| 24 | - @JsonProperty("foo") | |
| 25 | - public void setFoo(String value) { this.foo = value; } | |
| 26 | - | |
| 27 | 27 | @JsonProperty("impossible") |
| 28 | 28 | public Object getImpossible() { return impossible; } |
| 29 | 29 | @JsonProperty("impossible") |
Mschema-javascriptdefault / TopLevel.js+1 −1
| @@ -172,9 +172,9 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | + { json: "foo", js: "foo", typ: "" }, | |
| 175 | 176 | { json: "disallowed", js: "disallowed", typ: u(undefined, "any") }, |
| 176 | 177 | { json: "empty", js: "empty", typ: a("any") }, |
| 177 | - { json: "foo", js: "foo", typ: "" }, | |
| 178 | 178 | { json: "impossible", js: "impossible", typ: u(undefined, "any") }, |
| 179 | 179 | ], false), |
| 180 | 180 | }; |
Mschema-kotlin-jacksondefault / TopLevel.kt+3 −3
| @@ -19,14 +19,14 @@ val mapper = jacksonObjectMapper().apply { | ||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | data class TopLevel ( |
| 22 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 23 | + val foo: String, | |
| 24 | + | |
| 22 | 25 | val disallowed: Any? = null, |
| 23 | 26 | |
| 24 | 27 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 25 | 28 | val empty: List<Any?>, |
| 26 | 29 | |
| 27 | - @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 28 | - val foo: String, | |
| 29 | - | |
| 30 | 30 | val impossible: Any? = null |
| 31 | 31 | ) { |
| 32 | 32 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+1 −1
| @@ -9,9 +9,9 @@ import com.beust.klaxon.* | ||
| 9 | 9 | private val klaxon = Klaxon() |
| 10 | 10 | |
| 11 | 11 | data class TopLevel ( |
| 12 | + val foo: String, | |
| 12 | 13 | val disallowed: Any? = null, |
| 13 | 14 | val empty: List<Any?>, |
| 14 | - val foo: String, | |
| 15 | 15 | val impossible: Any? = null |
| 16 | 16 | ) { |
| 17 | 17 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-kotlinxdefault / TopLevel.kt+1 −1
| @@ -12,8 +12,8 @@ import kotlinx.serialization.encoding.* | ||
| 12 | 12 | |
| 13 | 13 | @Serializable |
| 14 | 14 | data class TopLevel ( |
| 15 | + val foo: String, | |
| 15 | 16 | val disallowed: JsonElement? = null, |
| 16 | 17 | val empty: JsonArray, |
| 17 | - val foo: String, | |
| 18 | 18 | val impossible: JsonElement? = null |
| 19 | 19 | ) |
Mschema-phpdefault / TopLevel.php+61 −61
| @@ -4,24 +4,71 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | + private string $foo; // json:foo Required | |
| 7 | 8 | private mixed $disallowed; // json:disallowed Optional |
| 8 | 9 | private array $empty; // json:empty Required |
| 9 | - private string $foo; // json:foo Required | |
| 10 | 10 | private mixed $impossible; // json:impossible Optional |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | + * @param string $foo | |
| 13 | 14 | * @param mixed $disallowed |
| 14 | 15 | * @param array $empty |
| 15 | - * @param string $foo | |
| 16 | 16 | * @param mixed $impossible |
| 17 | 17 | */ |
| 18 | - public function __construct(mixed $disallowed, array $empty, string $foo, mixed $impossible) { | |
| 18 | + public function __construct(string $foo, mixed $disallowed, array $empty, mixed $impossible) { | |
| 19 | + $this->foo = $foo; | |
| 19 | 20 | $this->disallowed = $disallowed; |
| 20 | 21 | $this->empty = $empty; |
| 21 | - $this->foo = $foo; | |
| 22 | 22 | $this->impossible = $impossible; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | + /** | |
| 26 | + * @param string $value | |
| 27 | + * @throws Exception | |
| 28 | + * @return string | |
| 29 | + */ | |
| 30 | + public static function fromFoo(string $value): string { | |
| 31 | + return $value; /*string*/ | |
| 32 | + } | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * @throws Exception | |
| 36 | + * @return string | |
| 37 | + */ | |
| 38 | + public function toFoo(): string { | |
| 39 | + if (TopLevel::validateFoo($this->foo)) { | |
| 40 | + return $this->foo; /*string*/ | |
| 41 | + } | |
| 42 | + throw new Exception('never get to this TopLevel::foo'); | |
| 43 | + } | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * @param string | |
| 47 | + * @return bool | |
| 48 | + * @throws Exception | |
| 49 | + */ | |
| 50 | + public static function validateFoo(string $value): bool { | |
| 51 | + return true; | |
| 52 | + } | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * @throws Exception | |
| 56 | + * @return string | |
| 57 | + */ | |
| 58 | + public function getFoo(): string { | |
| 59 | + if (TopLevel::validateFoo($this->foo)) { | |
| 60 | + return $this->foo; | |
| 61 | + } | |
| 62 | + throw new Exception('never get to getFoo TopLevel::foo'); | |
| 63 | + } | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * @return string | |
| 67 | + */ | |
| 68 | + public static function sampleFoo(): string { | |
| 69 | + return 'TopLevel::foo::31'; /*31:foo*/ | |
| 70 | + } | |
| 71 | + | |
| 25 | 72 | /** |
| 26 | 73 | * @param mixed $value |
| 27 | 74 | * @throws Exception |
| @@ -66,7 +113,7 @@ class TopLevel { | ||
| 66 | 113 | * @return mixed |
| 67 | 114 | */ |
| 68 | 115 | public static function sampleDisallowed(): mixed { |
| 69 | - return 'AnyType::TopLevel::disallowed::31';/*31:disallowed*/ | |
| 116 | + return 'AnyType::TopLevel::disallowed::32';/*32:disallowed*/ | |
| 70 | 117 | } |
| 71 | 118 | |
| 72 | 119 | /** |
| @@ -123,55 +170,8 @@ class TopLevel { | ||
| 123 | 170 | */ |
| 124 | 171 | public static function sampleEmpty(): array { |
| 125 | 172 | return array( |
| 126 | - 'AnyType::TopLevel::::32'/*32:*/ | |
| 127 | - ); /* 32:empty*/ | |
| 128 | - } | |
| 129 | - | |
| 130 | - /** | |
| 131 | - * @param string $value | |
| 132 | - * @throws Exception | |
| 133 | - * @return string | |
| 134 | - */ | |
| 135 | - public static function fromFoo(string $value): string { | |
| 136 | - return $value; /*string*/ | |
| 137 | - } | |
| 138 | - | |
| 139 | - /** | |
| 140 | - * @throws Exception | |
| 141 | - * @return string | |
| 142 | - */ | |
| 143 | - public function toFoo(): string { | |
| 144 | - if (TopLevel::validateFoo($this->foo)) { | |
| 145 | - return $this->foo; /*string*/ | |
| 146 | - } | |
| 147 | - throw new Exception('never get to this TopLevel::foo'); | |
| 148 | - } | |
| 149 | - | |
| 150 | - /** | |
| 151 | - * @param string | |
| 152 | - * @return bool | |
| 153 | - * @throws Exception | |
| 154 | - */ | |
| 155 | - public static function validateFoo(string $value): bool { | |
| 156 | - return true; | |
| 157 | - } | |
| 158 | - | |
| 159 | - /** | |
| 160 | - * @throws Exception | |
| 161 | - * @return string | |
| 162 | - */ | |
| 163 | - public function getFoo(): string { | |
| 164 | - if (TopLevel::validateFoo($this->foo)) { | |
| 165 | - return $this->foo; | |
| 166 | - } | |
| 167 | - throw new Exception('never get to getFoo TopLevel::foo'); | |
| 168 | - } | |
| 169 | - | |
| 170 | - /** | |
| 171 | - * @return string | |
| 172 | - */ | |
| 173 | - public static function sampleFoo(): string { | |
| 174 | - return 'TopLevel::foo::33'; /*33:foo*/ | |
| 173 | + 'AnyType::TopLevel::::33'/*33:*/ | |
| 174 | + ); /* 33:empty*/ | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
| @@ -226,9 +226,9 @@ class TopLevel { | ||
| 226 | 226 | * @return bool |
| 227 | 227 | */ |
| 228 | 228 | public function validate(): bool { |
| 229 | - return TopLevel::validateDisallowed($this->disallowed) | |
| 229 | + return TopLevel::validateFoo($this->foo) | |
| 230 | + || TopLevel::validateDisallowed($this->disallowed) | |
| 230 | 231 | || TopLevel::validateEmpty($this->empty) |
| 231 | - || TopLevel::validateFoo($this->foo) | |
| 232 | 232 | || TopLevel::validateImpossible($this->impossible); |
| 233 | 233 | } |
| 234 | 234 | |
| @@ -238,9 +238,9 @@ class TopLevel { | ||
| 238 | 238 | */ |
| 239 | 239 | public function to(): stdClass { |
| 240 | 240 | $out = new stdClass(); |
| 241 | + $out->{'foo'} = $this->toFoo(); | |
| 241 | 242 | $out->{'disallowed'} = $this->toDisallowed(); |
| 242 | 243 | $out->{'empty'} = $this->toEmpty(); |
| 243 | - $out->{'foo'} = $this->toFoo(); | |
| 244 | 244 | $out->{'impossible'} = $this->toImpossible(); |
| 245 | 245 | return $out; |
| 246 | 246 | } |
| @@ -252,9 +252,9 @@ class TopLevel { | ||
| 252 | 252 | */ |
| 253 | 253 | public static function from(stdClass $obj): TopLevel { |
| 254 | 254 | return new TopLevel( |
| 255 | - TopLevel::fromDisallowed($obj->{'disallowed'}) | |
| 255 | + TopLevel::fromFoo($obj->{'foo'}) | |
| 256 | + ,TopLevel::fromDisallowed($obj->{'disallowed'}) | |
| 256 | 257 | ,TopLevel::fromEmpty($obj->{'empty'}) |
| 257 | - ,TopLevel::fromFoo($obj->{'foo'}) | |
| 258 | 258 | ,TopLevel::fromImpossible($obj->{'impossible'}) |
| 259 | 259 | ); |
| 260 | 260 | } |
| @@ -264,9 +264,9 @@ class TopLevel { | ||
| 264 | 264 | */ |
| 265 | 265 | public static function sample(): TopLevel { |
| 266 | 266 | return new TopLevel( |
| 267 | - TopLevel::sampleDisallowed() | |
| 267 | + TopLevel::sampleFoo() | |
| 268 | + ,TopLevel::sampleDisallowed() | |
| 268 | 269 | ,TopLevel::sampleEmpty() |
| 269 | - ,TopLevel::sampleFoo() | |
| 270 | 270 | ,TopLevel::sampleImpossible() |
| 271 | 271 | ); |
| 272 | 272 | } |
Mschema-pikedefault / TopLevel.pmod+3 −3
| @@ -13,16 +13,16 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | + string foo; // json: "foo" | |
| 16 | 17 | mixed disallowed; // json: "disallowed" |
| 17 | 18 | array(mixed) empty; // json: "empty" |
| 18 | - string foo; // json: "foo" | |
| 19 | 19 | mixed impossible; // json: "impossible" |
| 20 | 20 | |
| 21 | 21 | string encode_json() { |
| 22 | 22 | mapping(string:mixed) json = ([ |
| 23 | + "foo" : foo, | |
| 23 | 24 | "disallowed" : disallowed, |
| 24 | 25 | "empty" : empty, |
| 25 | - "foo" : foo, | |
| 26 | 26 | "impossible" : impossible, |
| 27 | 27 | ]); |
| 28 | 28 | |
| @@ -33,9 +33,9 @@ class TopLevel { | ||
| 33 | 33 | TopLevel TopLevel_from_JSON(mixed json) { |
| 34 | 34 | TopLevel retval = TopLevel(); |
| 35 | 35 | |
| 36 | + retval.foo = json["foo"]; | |
| 36 | 37 | retval.disallowed = json["disallowed"]; |
| 37 | 38 | retval.empty = json["empty"]; |
| 38 | - retval.foo = json["foo"]; | |
| 39 | 39 | retval.impossible = json["impossible"]; |
| 40 | 40 | |
| 41 | 41 | return retval; |
Mschema-pythondefault / quicktype.py+9 −9
| @@ -5,16 +5,16 @@ from typing import Any, TypeVar, Callable, Type, cast | ||
| 5 | 5 | T = TypeVar("T") |
| 6 | 6 | |
| 7 | 7 | |
| 8 | -def from_list(f: Callable[[Any], T], x: Any) -> list[T]: | |
| 9 | - assert isinstance(x, list) | |
| 10 | - return [f(y) for y in x] | |
| 11 | - | |
| 12 | - | |
| 13 | 8 | def from_str(x: Any) -> str: |
| 14 | 9 | assert isinstance(x, str) |
| 15 | 10 | return x |
| 16 | 11 | |
| 17 | 12 | |
| 13 | +def from_list(f: Callable[[Any], T], x: Any) -> list[T]: | |
| 14 | + assert isinstance(x, list) | |
| 15 | + return [f(y) for y in x] | |
| 16 | + | |
| 17 | + | |
| 18 | 18 | def to_class(c: Type[T], x: Any) -> dict: |
| 19 | 19 | assert isinstance(x, c) |
| 20 | 20 | return cast(Any, x).to_dict() |
| @@ -22,24 +22,24 @@ def to_class(c: Type[T], x: Any) -> dict: | ||
| 22 | 22 | |
| 23 | 23 | @dataclass |
| 24 | 24 | class TopLevel: |
| 25 | - empty: list[Any] | |
| 26 | 25 | foo: str |
| 26 | + empty: list[Any] | |
| 27 | 27 | disallowed: Any = None |
| 28 | 28 | impossible: Any = None |
| 29 | 29 | |
| 30 | 30 | @staticmethod |
| 31 | 31 | def from_dict(obj: Any) -> 'TopLevel': |
| 32 | 32 | assert isinstance(obj, dict) |
| 33 | - empty = from_list(lambda x: x, obj.get("empty")) | |
| 34 | 33 | foo = from_str(obj.get("foo")) |
| 34 | + empty = from_list(lambda x: x, obj.get("empty")) | |
| 35 | 35 | disallowed = obj.get("disallowed") |
| 36 | 36 | impossible = obj.get("impossible") |
| 37 | - return TopLevel(empty, foo, disallowed, impossible) | |
| 37 | + return TopLevel(foo, empty, disallowed, impossible) | |
| 38 | 38 | |
| 39 | 39 | def to_dict(self) -> dict: |
| 40 | 40 | result: dict = {} |
| 41 | - result["empty"] = from_list(lambda x: x, self.empty) | |
| 42 | 41 | result["foo"] = from_str(self.foo) |
| 42 | + result["empty"] = from_list(lambda x: x, self.empty) | |
| 43 | 43 | if self.disallowed is not None: |
| 44 | 44 | result["disallowed"] = self.disallowed |
| 45 | 45 | if self.impossible is not None: |
Mschema-rubydefault / TopLevel.rb+3 −3
| @@ -20,17 +20,17 @@ module Types | ||
| 20 | 20 | end |
| 21 | 21 | |
| 22 | 22 | class TopLevel < Dry::Struct |
| 23 | + attribute :foo, Types::String | |
| 23 | 24 | attribute :disallowed, Types::Any.optional |
| 24 | 25 | attribute :empty, Types.Array(Types::Any) |
| 25 | - attribute :foo, Types::String | |
| 26 | 26 | attribute :impossible, Types::Any.optional |
| 27 | 27 | |
| 28 | 28 | def self.from_dynamic!(d) |
| 29 | 29 | d = Types::Hash[d] |
| 30 | 30 | new( |
| 31 | + foo: d.fetch("foo"), | |
| 31 | 32 | disallowed: d["disallowed"], |
| 32 | 33 | empty: d.fetch("empty"), |
| 33 | - foo: d.fetch("foo"), | |
| 34 | 34 | impossible: d["impossible"], |
| 35 | 35 | ) |
| 36 | 36 | end |
| @@ -41,9 +41,9 @@ class TopLevel < Dry::Struct | ||
| 41 | 41 | |
| 42 | 42 | def to_dynamic |
| 43 | 43 | { |
| 44 | + "foo" => foo, | |
| 44 | 45 | "disallowed" => disallowed, |
| 45 | 46 | "empty" => empty, |
| 46 | - "foo" => foo, | |
| 47 | 47 | "impossible" => impossible, |
| 48 | 48 | } |
| 49 | 49 | end |
Mschema-rustdefault / module_under_test.rs+2 −2
| @@ -15,11 +15,11 @@ use serde::{Serialize, Deserialize}; | ||
| 15 | 15 | |
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | pub struct TopLevel { |
| 18 | + pub foo: String, | |
| 19 | + | |
| 18 | 20 | pub disallowed: Option<serde_json::Value>, |
| 19 | 21 | |
| 20 | 22 | pub empty: Vec<Option<serde_json::Value>>, |
| 21 | 23 | |
| 22 | - pub foo: String, | |
| 23 | - | |
| 24 | 24 | pub impossible: Option<serde_json::Value>, |
| 25 | 25 | } |
Mschema-scala3-upickledefault / TopLevel.scala+1 −1
| @@ -66,8 +66,8 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | + val foo : String, | |
| 69 | 70 | val disallowed : Option[ujson.Value] = None, |
| 70 | 71 | val empty : Seq[Option[ujson.Value]], |
| 71 | - val foo : String, | |
| 72 | 72 | val impossible : Option[ujson.Value] = None |
| 73 | 73 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+1 −1
| @@ -8,8 +8,8 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | + val foo : String, | |
| 11 | 12 | val disallowed : Option[Json] = None, |
| 12 | 13 | val empty : Seq[Option[Json]], |
| 13 | - val foo : String, | |
| 14 | 14 | val impossible : Option[Json] = None |
| 15 | 15 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+3 −3
| @@ -6,14 +6,14 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": false, |
| 8 | 8 | "properties": { |
| 9 | + "foo": { | |
| 10 | + "type": "string" | |
| 11 | + }, | |
| 9 | 12 | "disallowed": {}, |
| 10 | 13 | "empty": { |
| 11 | 14 | "type": "array", |
| 12 | 15 | "items": {} |
| 13 | 16 | }, |
| 14 | - "foo": { | |
| 15 | - "type": "string" | |
| 16 | - }, | |
| 17 | 17 | "impossible": {} |
| 18 | 18 | }, |
| 19 | 19 | "required": [ |
Mschema-swiftdefault / quicktype.swift+4 −4
| @@ -7,15 +7,15 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | + let foo: String | |
| 10 | 11 | let disallowed: JSONAny? |
| 11 | 12 | let empty: [JSONAny] |
| 12 | - let foo: String | |
| 13 | 13 | let impossible: JSONAny? |
| 14 | 14 | |
| 15 | 15 | enum CodingKeys: String, CodingKey { |
| 16 | + case foo = "foo" | |
| 16 | 17 | case disallowed = "disallowed" |
| 17 | 18 | case empty = "empty" |
| 18 | - case foo = "foo" | |
| 19 | 19 | case impossible = "impossible" |
| 20 | 20 | } |
| 21 | 21 | } |
| @@ -39,15 +39,15 @@ extension TopLevel { | ||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | func with( |
| 42 | + foo: String? = nil, | |
| 42 | 43 | disallowed: JSONAny?? = nil, |
| 43 | 44 | empty: [JSONAny]? = nil, |
| 44 | - foo: String? = nil, | |
| 45 | 45 | impossible: JSONAny?? = nil |
| 46 | 46 | ) -> TopLevel { |
| 47 | 47 | return TopLevel( |
| 48 | + foo: foo ?? self.foo, | |
| 48 | 49 | disallowed: disallowed ?? self.disallowed, |
| 49 | 50 | empty: empty ?? self.empty, |
| 50 | - foo: foo ?? self.foo, | |
| 51 | 51 | impossible: impossible ?? self.impossible |
| 52 | 52 | ) |
| 53 | 53 | } |
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,9 +2,9 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | + "foo": z.string(), | |
| 5 | 6 | "disallowed": z.any().optional(), |
| 6 | 7 | "empty": z.array(z.any()), |
| 7 | - "foo": z.string(), | |
| 8 | 8 | "impossible": z.any().optional(), |
| 9 | 9 | }); |
| 10 | 10 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -8,9 +8,9 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | + foo: string; | |
| 11 | 12 | disallowed?: unknown; |
| 12 | 13 | empty: unknown[]; |
| 13 | - foo: string; | |
| 14 | 14 | impossible?: unknown; |
| 15 | 15 | } |
| 16 | 16 | |
| @@ -181,9 +181,9 @@ function r(name: string) { | ||
| 181 | 181 | |
| 182 | 182 | const typeMap: any = { |
| 183 | 183 | "TopLevel": o([ |
| 184 | + { json: "foo", js: "foo", typ: "" }, | |
| 184 | 185 | { json: "disallowed", js: "disallowed", typ: u(undefined, "any") }, |
| 185 | 186 | { json: "empty", js: "empty", typ: a("any") }, |
| 186 | - { json: "foo", js: "foo", typ: "" }, | |
| 187 | 187 | { json: "impossible", js: "impossible", typ: u(undefined, "any") }, |
| 188 | 188 | ], false), |
| 189 | 189 | }; |
Test case
32 generated files · +510 −510test/inputs/schema/comment-injection.schema
Mcomment-injection-objective-cdefault / QTTopLevel.h+6 −6
| @@ -31,12 +31,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 31 | 31 | /// } |
| 32 | 32 | /// } |
| 33 | 33 | @interface QTTopLevel : NSObject |
| 34 | -/// Ends with a backslash \. | |
| 35 | -@property (nonatomic, nullable, copy) NSString *trailingBackslash; | |
| 36 | -/// Ends with a quote " | |
| 37 | -@property (nonatomic, nullable, copy) NSString *trailingQuote; | |
| 38 | -/// Ends with a triple quote """ | |
| 39 | -@property (nonatomic, nullable, copy) NSString *trailingTripleQuote; | |
| 40 | 34 | /// Property delimiters: |
| 41 | 35 | /// */ |
| 42 | 36 | /// /* |
| @@ -50,6 +44,12 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 50 | 44 | /// } |
| 51 | 45 | /// } |
| 52 | 46 | @property (nonatomic, copy) NSString *value; |
| 47 | +/// Ends with a backslash \. | |
| 48 | +@property (nonatomic, nullable, copy) NSString *trailingBackslash; | |
| 49 | +/// Ends with a quote " | |
| 50 | +@property (nonatomic, nullable, copy) NSString *trailingQuote; | |
| 51 | +/// Ends with a triple quote """ | |
| 52 | +@property (nonatomic, nullable, copy) NSString *trailingTripleQuote; | |
| 53 | 53 | |
| 54 | 54 | + (_Nullable instancetype)fromJSON:(NSString *)json encoding:(NSStringEncoding)encoding error:(NSError *_Nullable *)error; |
| 55 | 55 | + (_Nullable instancetype)fromData:(NSData *)data error:(NSError *_Nullable *)error; |
Mcomment-injection-objective-cdefault / QTTopLevel.m+1 −1
| @@ -54,10 +54,10 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 54 | 54 | { |
| 55 | 55 | static NSDictionary<NSString *, NSString *> *properties; |
| 56 | 56 | return properties = properties ? properties : @{ |
| 57 | + @"value": @"value", | |
| 57 | 58 | @"trailingBackslash": @"trailingBackslash", |
| 58 | 59 | @"trailingQuote": @"trailingQuote", |
| 59 | 60 | @"trailingTripleQuote": @"trailingTripleQuote", |
| 60 | - @"value": @"value", | |
| 61 | 61 | }; |
| 62 | 62 | } |
Mcomment-injection-typescriptdefault / TopLevel.ts+13 −13
| @@ -22,18 +22,6 @@ | ||
| 22 | 22 | * } |
| 23 | 23 | */ |
| 24 | 24 | export interface TopLevel { |
| 25 | - /** | |
| 26 | - * Ends with a backslash \ | |
| 27 | - */ | |
| 28 | - trailingBackslash?: string; | |
| 29 | - /** | |
| 30 | - * Ends with a quote " | |
| 31 | - */ | |
| 32 | - trailingQuote?: string; | |
| 33 | - /** | |
| 34 | - * Ends with a triple quote """ | |
| 35 | - */ | |
| 36 | - trailingTripleQuote?: string; | |
| 37 | 25 | /** |
| 38 | 26 | * Property delimiters: |
| 39 | 27 | * * / |
| @@ -49,6 +37,18 @@ export interface TopLevel { | ||
| 49 | 37 | * } |
| 50 | 38 | */ |
| 51 | 39 | value: string; |
| 40 | + /** | |
| 41 | + * Ends with a backslash \ | |
| 42 | + */ | |
| 43 | + trailingBackslash?: string; | |
| 44 | + /** | |
| 45 | + * Ends with a quote " | |
| 46 | + */ | |
| 47 | + trailingQuote?: string; | |
| 48 | + /** | |
| 49 | + * Ends with a triple quote """ | |
| 50 | + */ | |
| 51 | + trailingTripleQuote?: string; | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // Converts JSON strings to/from your types |
| @@ -218,9 +218,9 @@ function r(name: string) { | ||
| 218 | 218 | |
| 219 | 219 | const typeMap: any = { |
| 220 | 220 | "TopLevel": o([ |
| 221 | + { json: "value", js: "value", typ: "" }, | |
| 221 | 222 | { json: "trailingBackslash", js: "trailingBackslash", typ: u(undefined, "") }, |
| 222 | 223 | { json: "trailingQuote", js: "trailingQuote", typ: u(undefined, "") }, |
| 223 | 224 | { json: "trailingTripleQuote", js: "trailingTripleQuote", typ: u(undefined, "") }, |
| 224 | - { json: "value", js: "value", typ: "" }, | |
| 225 | 225 | ], false), |
| 226 | 226 | }; |
Mschema-cjsondefault / TopLevel.c+17 −17
| @@ -22,6 +22,14 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 22 | 22 | if (NULL != j) { |
| 23 | 23 | if (NULL != (x = cJSON_malloc(sizeof(struct TopLevel)))) { |
| 24 | 24 | memset(x, 0, sizeof(struct TopLevel)); |
| 25 | + if (cJSON_HasObjectItem(j, "value")) { | |
| 26 | + x->value = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "value"))); | |
| 27 | + } | |
| 28 | + else { | |
| 29 | + if (NULL != (x->value = cJSON_malloc(sizeof(char)))) { | |
| 30 | + x->value[0] = '\0'; | |
| 31 | + } | |
| 32 | + } | |
| 25 | 33 | if (cJSON_HasObjectItem(j, "trailingBackslash")) { |
| 26 | 34 | x->trailing_backslash = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "trailingBackslash"))); |
| 27 | 35 | } |
| @@ -31,14 +39,6 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 31 | 39 | if (cJSON_HasObjectItem(j, "trailingTripleQuote")) { |
| 32 | 40 | x->trailing_triple_quote = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "trailingTripleQuote"))); |
| 33 | 41 | } |
| 34 | - if (cJSON_HasObjectItem(j, "value")) { | |
| 35 | - x->value = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "value"))); | |
| 36 | - } | |
| 37 | - else { | |
| 38 | - if (NULL != (x->value = cJSON_malloc(sizeof(char)))) { | |
| 39 | - x->value[0] = '\0'; | |
| 40 | - } | |
| 41 | - } | |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | return x; |
| @@ -48,6 +48,12 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 48 | 48 | cJSON * j = NULL; |
| 49 | 49 | if (NULL != x) { |
| 50 | 50 | if (NULL != (j = cJSON_CreateObject())) { |
| 51 | + if (NULL != x->value) { | |
| 52 | + cJSON_AddStringToObject(j, "value", x->value); | |
| 53 | + } | |
| 54 | + else { | |
| 55 | + cJSON_AddStringToObject(j, "value", ""); | |
| 56 | + } | |
| 51 | 57 | if (NULL != x->trailing_backslash) { |
| 52 | 58 | cJSON_AddStringToObject(j, "trailingBackslash", x->trailing_backslash); |
| 53 | 59 | } |
| @@ -57,12 +63,6 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 57 | 63 | if (NULL != x->trailing_triple_quote) { |
| 58 | 64 | cJSON_AddStringToObject(j, "trailingTripleQuote", x->trailing_triple_quote); |
| 59 | 65 | } |
| 60 | - if (NULL != x->value) { | |
| 61 | - cJSON_AddStringToObject(j, "value", x->value); | |
| 62 | - } | |
| 63 | - else { | |
| 64 | - cJSON_AddStringToObject(j, "value", ""); | |
| 65 | - } | |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | return j; |
| @@ -82,6 +82,9 @@ char * cJSON_PrintTopLevel(const struct TopLevel * x) { | ||
| 82 | 82 | |
| 83 | 83 | void cJSON_DeleteTopLevel(struct TopLevel * x) { |
| 84 | 84 | if (NULL != x) { |
| 85 | + if (NULL != x->value) { | |
| 86 | + cJSON_free(x->value); | |
| 87 | + } | |
| 85 | 88 | if (NULL != x->trailing_backslash) { |
| 86 | 89 | cJSON_free(x->trailing_backslash); |
| 87 | 90 | } |
| @@ -91,9 +94,6 @@ void cJSON_DeleteTopLevel(struct TopLevel * x) { | ||
| 91 | 94 | if (NULL != x->trailing_triple_quote) { |
| 92 | 95 | cJSON_free(x->trailing_triple_quote); |
| 93 | 96 | } |
| 94 | - if (NULL != x->value) { | |
| 95 | - cJSON_free(x->value); | |
| 96 | - } | |
| 97 | 97 | cJSON_free(x); |
| 98 | 98 | } |
| 99 | 99 | } |
Mschema-cjsondefault / TopLevel.h+12 −12
| @@ -49,18 +49,6 @@ extern "C" { | ||
| 49 | 49 | * } |
| 50 | 50 | */ |
| 51 | 51 | struct TopLevel { |
| 52 | - /** | |
| 53 | - * Ends with a backslash \. | |
| 54 | - */ | |
| 55 | - char * trailing_backslash; | |
| 56 | - /** | |
| 57 | - * Ends with a quote " | |
| 58 | - */ | |
| 59 | - char * trailing_quote; | |
| 60 | - /** | |
| 61 | - * Ends with a triple quote """ | |
| 62 | - */ | |
| 63 | - char * trailing_triple_quote; | |
| 64 | 52 | /** |
| 65 | 53 | * Property delimiters: |
| 66 | 54 | * * / |
| @@ -76,6 +64,18 @@ struct TopLevel { | ||
| 76 | 64 | * } |
| 77 | 65 | */ |
| 78 | 66 | char * value; |
| 67 | + /** | |
| 68 | + * Ends with a backslash \. | |
| 69 | + */ | |
| 70 | + char * trailing_backslash; | |
| 71 | + /** | |
| 72 | + * Ends with a quote " | |
| 73 | + */ | |
| 74 | + char * trailing_quote; | |
| 75 | + /** | |
| 76 | + * Ends with a triple quote """ | |
| 77 | + */ | |
| 78 | + char * trailing_triple_quote; | |
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | 81 | struct TopLevel * cJSON_ParseTopLevel(const char * s); |
Mschema-cplusplusdefault / quicktype.hpp+21 −21
| @@ -108,12 +108,30 @@ namespace quicktype { | ||
| 108 | 108 | virtual ~TopLevel() = default; |
| 109 | 109 | |
| 110 | 110 | private: |
| 111 | + std::string value; | |
| 111 | 112 | std::optional<std::string> trailing_backslash; |
| 112 | 113 | std::optional<std::string> trailing_quote; |
| 113 | 114 | std::optional<std::string> trailing_triple_quote; |
| 114 | - std::string value; | |
| 115 | 115 | |
| 116 | 116 | public: |
| 117 | + /** | |
| 118 | + * Property delimiters: | |
| 119 | + * * / | |
| 120 | + * / * | |
| 121 | + * {- | |
| 122 | + * -} | |
| 123 | + * """ | |
| 124 | + * </summary> & <br> | |
| 125 | + * } | |
| 126 | + * } | |
| 127 | + * } | |
| 128 | + * } | |
| 129 | + * } | |
| 130 | + */ | |
| 131 | + const std::string & get_value() const { return value; } | |
| 132 | + std::string & get_mutable_value() { return value; } | |
| 133 | + void set_value(const std::string & value) { this->value = value; } | |
| 134 | + | |
| 117 | 135 | /** |
| 118 | 136 | * Ends with a backslash \. |
| 119 | 137 | */ |
| @@ -134,24 +152,6 @@ namespace quicktype { | ||
| 134 | 152 | const std::optional<std::string> & get_trailing_triple_quote() const { return trailing_triple_quote; } |
| 135 | 153 | std::optional<std::string> & get_mutable_trailing_triple_quote() { return trailing_triple_quote; } |
| 136 | 154 | void set_trailing_triple_quote(const std::optional<std::string> & value) { this->trailing_triple_quote = value; } |
| 137 | - | |
| 138 | - /** | |
| 139 | - * Property delimiters: | |
| 140 | - * * / | |
| 141 | - * / * | |
| 142 | - * {- | |
| 143 | - * -} | |
| 144 | - * """ | |
| 145 | - * </summary> & <br> | |
| 146 | - * } | |
| 147 | - * } | |
| 148 | - * } | |
| 149 | - * } | |
| 150 | - * } | |
| 151 | - */ | |
| 152 | - const std::string & get_value() const { return value; } | |
| 153 | - std::string & get_mutable_value() { return value; } | |
| 154 | - void set_value(const std::string & value) { this->value = value; } | |
| 155 | 155 | }; |
| 156 | 156 | } |
| 157 | 157 | |
| @@ -160,17 +160,17 @@ namespace quicktype { | ||
| 160 | 160 | void to_json(json & j, const TopLevel & x); |
| 161 | 161 | |
| 162 | 162 | inline void from_json(const json & j, TopLevel& x) { |
| 163 | + x.set_value(j.at("value").get<std::string>()); | |
| 163 | 164 | x.set_trailing_backslash(get_stack_optional<std::string>(j, "trailingBackslash")); |
| 164 | 165 | x.set_trailing_quote(get_stack_optional<std::string>(j, "trailingQuote")); |
| 165 | 166 | x.set_trailing_triple_quote(get_stack_optional<std::string>(j, "trailingTripleQuote")); |
| 166 | - x.set_value(j.at("value").get<std::string>()); | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | inline void to_json(json & j, const TopLevel & x) { |
| 170 | 170 | j = json::object(); |
| 171 | + j["value"] = x.get_value(); | |
| 171 | 172 | j["trailingBackslash"] = x.get_trailing_backslash(); |
| 172 | 173 | j["trailingQuote"] = x.get_trailing_quote(); |
| 173 | 174 | j["trailingTripleQuote"] = x.get_trailing_triple_quote(); |
| 174 | - j["value"] = x.get_value(); | |
| 175 | 175 | } |
| 176 | 176 | } |
Mschema-csharp-recordsdefault / QuickType.cs+17 −17
| @@ -39,6 +39,23 @@ namespace QuickType | ||
| 39 | 39 | /// </summary> |
| 40 | 40 | public partial record TopLevel |
| 41 | 41 | { |
| 42 | + /// <summary> | |
| 43 | + /// Property delimiters: | |
| 44 | + /// */ | |
| 45 | + /// /* | |
| 46 | + /// {- | |
| 47 | + /// -} | |
| 48 | + /// """ | |
| 49 | + /// </summary> & <br> | |
| 50 | + /// } | |
| 51 | + /// } | |
| 52 | + /// } | |
| 53 | + /// } | |
| 54 | + /// } | |
| 55 | + /// </summary> | |
| 56 | + [JsonProperty("value", Required = Required.Always)] | |
| 57 | + public string Value { get; set; } | |
| 58 | + | |
| 42 | 59 | /// <summary> |
| 43 | 60 | /// Ends with a backslash \ |
| 44 | 61 | /// </summary> |
| @@ -56,23 +73,6 @@ namespace QuickType | ||
| 56 | 73 | /// </summary> |
| 57 | 74 | [JsonProperty("trailingTripleQuote", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 58 | 75 | public string? TrailingTripleQuote { get; set; } |
| 59 | - | |
| 60 | - /// <summary> | |
| 61 | - /// Property delimiters: | |
| 62 | - /// */ | |
| 63 | - /// /* | |
| 64 | - /// {- | |
| 65 | - /// -} | |
| 66 | - /// """ | |
| 67 | - /// </summary> & <br> | |
| 68 | - /// } | |
| 69 | - /// } | |
| 70 | - /// } | |
| 71 | - /// } | |
| 72 | - /// } | |
| 73 | - /// </summary> | |
| 74 | - [JsonProperty("value", Required = Required.Always)] | |
| 75 | - public string Value { get; set; } | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public partial record TopLevel |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+18 −18
| @@ -36,6 +36,24 @@ namespace QuickType | ||
| 36 | 36 | /// </summary> |
| 37 | 37 | public partial class TopLevel |
| 38 | 38 | { |
| 39 | + /// <summary> | |
| 40 | + /// Property delimiters: | |
| 41 | + /// */ | |
| 42 | + /// /* | |
| 43 | + /// {- | |
| 44 | + /// -} | |
| 45 | + /// """ | |
| 46 | + /// </summary> & <br> | |
| 47 | + /// } | |
| 48 | + /// } | |
| 49 | + /// } | |
| 50 | + /// } | |
| 51 | + /// } | |
| 52 | + /// </summary> | |
| 53 | + [JsonRequired] | |
| 54 | + [JsonPropertyName("value")] | |
| 55 | + public string Value { get; set; } | |
| 56 | + | |
| 39 | 57 | /// <summary> |
| 40 | 58 | /// Ends with a backslash \ |
| 41 | 59 | /// </summary> |
| @@ -56,24 +74,6 @@ namespace QuickType | ||
| 56 | 74 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 57 | 75 | [JsonPropertyName("trailingTripleQuote")] |
| 58 | 76 | public string? TrailingTripleQuote { get; set; } |
| 59 | - | |
| 60 | - /// <summary> | |
| 61 | - /// Property delimiters: | |
| 62 | - /// */ | |
| 63 | - /// /* | |
| 64 | - /// {- | |
| 65 | - /// -} | |
| 66 | - /// """ | |
| 67 | - /// </summary> & <br> | |
| 68 | - /// } | |
| 69 | - /// } | |
| 70 | - /// } | |
| 71 | - /// } | |
| 72 | - /// } | |
| 73 | - /// </summary> | |
| 74 | - [JsonRequired] | |
| 75 | - [JsonPropertyName("value")] | |
| 76 | - public string Value { get; set; } | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public partial class TopLevel |
Mschema-csharpdefault / QuickType.cs+17 −17
| @@ -39,6 +39,23 @@ namespace QuickType | ||
| 39 | 39 | /// </summary> |
| 40 | 40 | public partial class TopLevel |
| 41 | 41 | { |
| 42 | + /// <summary> | |
| 43 | + /// Property delimiters: | |
| 44 | + /// */ | |
| 45 | + /// /* | |
| 46 | + /// {- | |
| 47 | + /// -} | |
| 48 | + /// """ | |
| 49 | + /// </summary> & <br> | |
| 50 | + /// } | |
| 51 | + /// } | |
| 52 | + /// } | |
| 53 | + /// } | |
| 54 | + /// } | |
| 55 | + /// </summary> | |
| 56 | + [JsonProperty("value", Required = Required.Always)] | |
| 57 | + public string Value { get; set; } | |
| 58 | + | |
| 42 | 59 | /// <summary> |
| 43 | 60 | /// Ends with a backslash \ |
| 44 | 61 | /// </summary> |
| @@ -56,23 +73,6 @@ namespace QuickType | ||
| 56 | 73 | /// </summary> |
| 57 | 74 | [JsonProperty("trailingTripleQuote", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 58 | 75 | public string? TrailingTripleQuote { get; set; } |
| 59 | - | |
| 60 | - /// <summary> | |
| 61 | - /// Property delimiters: | |
| 62 | - /// */ | |
| 63 | - /// /* | |
| 64 | - /// {- | |
| 65 | - /// -} | |
| 66 | - /// """ | |
| 67 | - /// </summary> & <br> | |
| 68 | - /// } | |
| 69 | - /// } | |
| 70 | - /// } | |
| 71 | - /// } | |
| 72 | - /// } | |
| 73 | - /// </summary> | |
| 74 | - [JsonProperty("value", Required = Required.Always)] | |
| 75 | - public string Value { get; set; } | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public partial class TopLevel |
Mschema-dartdefault / TopLevel.dart+12 −12
| @@ -23,15 +23,6 @@ String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | ||
| 23 | 23 | ///} |
| 24 | 24 | class TopLevel { |
| 25 | 25 | |
| 26 | - ///Ends with a backslash \ | |
| 27 | - final String? trailingBackslash; | |
| 28 | - | |
| 29 | - ///Ends with a quote " | |
| 30 | - final String? trailingQuote; | |
| 31 | - | |
| 32 | - ///Ends with a triple quote """ | |
| 33 | - final String? trailingTripleQuote; | |
| 34 | - | |
| 35 | 26 | ///Property delimiters: |
| 36 | 27 | ///*/ |
| 37 | 28 | ////* |
| @@ -45,25 +36,34 @@ class TopLevel { | ||
| 45 | 36 | ///} |
| 46 | 37 | ///} |
| 47 | 38 | final String value; |
| 39 | + | |
| 40 | + ///Ends with a backslash \ | |
| 41 | + final String? trailingBackslash; | |
| 42 | + | |
| 43 | + ///Ends with a quote " | |
| 44 | + final String? trailingQuote; | |
| 45 | + | |
| 46 | + ///Ends with a triple quote """ | |
| 47 | + final String? trailingTripleQuote; | |
| 48 | 48 | |
| 49 | 49 | TopLevel({ |
| 50 | + required this.value, | |
| 50 | 51 | this.trailingBackslash, |
| 51 | 52 | this.trailingQuote, |
| 52 | 53 | this.trailingTripleQuote, |
| 53 | - required this.value, | |
| 54 | 54 | }); |
| 55 | 55 | |
| 56 | 56 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 57 | + value: json["value"], | |
| 57 | 58 | trailingBackslash: json["trailingBackslash"], |
| 58 | 59 | trailingQuote: json["trailingQuote"], |
| 59 | 60 | trailingTripleQuote: json["trailingTripleQuote"], |
| 60 | - value: json["value"], | |
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | 63 | Map<String, dynamic> toJson() => { |
| 64 | + "value": value, | |
| 64 | 65 | "trailingBackslash": trailingBackslash, |
| 65 | 66 | "trailingQuote": trailingQuote, |
| 66 | 67 | "trailingTripleQuote": trailingTripleQuote, |
| 67 | - "value": value, | |
| 68 | 68 | }; |
| 69 | 69 | } |
Mschema-elixirdefault / QuickType.ex+6 −6
| @@ -19,28 +19,28 @@ defmodule TopLevel do | ||
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | + - `:value` - Property delimiters:*//*{--}\"\"\"</summary> & <br>}}}}} | |
| 22 | 23 | - `:trailing_backslash` - Ends with a backslash \\ |
| 23 | 24 | - `:trailing_quote` - Ends with a quote " |
| 24 | 25 | - `:trailing_triple_quote` - Ends with a triple quote \"\"\" |
| 25 | - - `:value` - Property delimiters:*//*{--}\"\"\"</summary> & <br>}}}}} | |
| 26 | 26 | """ |
| 27 | 27 | |
| 28 | 28 | @enforce_keys [:value] |
| 29 | - defstruct [:trailing_backslash, :trailing_quote, :trailing_triple_quote, :value] | |
| 29 | + defstruct [:value, :trailing_backslash, :trailing_quote, :trailing_triple_quote] | |
| 30 | 30 | |
| 31 | 31 | @type t :: %__MODULE__{ |
| 32 | + value: String.t(), | |
| 32 | 33 | trailing_backslash: String.t() | nil, |
| 33 | 34 | trailing_quote: String.t() | nil, |
| 34 | - trailing_triple_quote: String.t() | nil, | |
| 35 | - value: String.t() | |
| 35 | + trailing_triple_quote: String.t() | nil | |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | def from_map(m) do |
| 39 | 39 | %TopLevel{ |
| 40 | + value: m["value"], | |
| 40 | 41 | trailing_backslash: m["trailingBackslash"], |
| 41 | 42 | trailing_quote: m["trailingQuote"], |
| 42 | 43 | trailing_triple_quote: m["trailingTripleQuote"], |
| 43 | - value: m["value"], | |
| 44 | 44 | } |
| 45 | 45 | end |
| 46 | 46 | |
| @@ -52,10 +52,10 @@ defmodule TopLevel do | ||
| 52 | 52 | |
| 53 | 53 | def to_map(struct) do |
| 54 | 54 | %{ |
| 55 | + "value" => struct.value, | |
| 55 | 56 | "trailingBackslash" => struct.trailing_backslash, |
| 56 | 57 | "trailingQuote" => struct.trailing_quote, |
| 57 | 58 | "trailingTripleQuote" => struct.trailing_triple_quote, |
| 58 | - "value" => struct.value, | |
| 59 | 59 | } |
| 60 | 60 | end |
Mschema-elmdefault / QuickType.elm+14 −14
| @@ -35,15 +35,6 @@ import Dict exposing (Dict) | ||
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -trailingBackslash: | |
| 39 | -Ends with a backslash \ | |
| 40 | - | |
| 41 | -trailingQuote: | |
| 42 | -Ends with a quote " | |
| 43 | - | |
| 44 | -trailingTripleQuote: | |
| 45 | -Ends with a triple quote """ | |
| 46 | - | |
| 47 | 38 | value: |
| 48 | 39 | Property delimiters: |
| 49 | 40 | */ |
| @@ -57,12 +48,21 @@ Property delimiters: | ||
| 57 | 48 | } |
| 58 | 49 | } |
| 59 | 50 | } |
| 51 | + | |
| 52 | +trailingBackslash: | |
| 53 | +Ends with a backslash \ | |
| 54 | + | |
| 55 | +trailingQuote: | |
| 56 | +Ends with a quote " | |
| 57 | + | |
| 58 | +trailingTripleQuote: | |
| 59 | +Ends with a triple quote """ | |
| 60 | 60 | -} |
| 61 | 61 | type alias QuickType = |
| 62 | - { trailingBackslash : Maybe String | |
| 62 | + { value : String | |
| 63 | + , trailingBackslash : Maybe String | |
| 63 | 64 | , trailingQuote : Maybe String |
| 64 | 65 | , trailingTripleQuote : Maybe String |
| 65 | - , value : String | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | -- decoders and encoders |
| @@ -73,18 +73,18 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 73 | 73 | quickType : Jdec.Decoder QuickType |
| 74 | 74 | quickType = |
| 75 | 75 | Jdec.succeed QuickType |
| 76 | + |> Jpipe.required "value" Jdec.string | |
| 76 | 77 | |> Jpipe.optional "trailingBackslash" (Jdec.nullable Jdec.string) Nothing |
| 77 | 78 | |> Jpipe.optional "trailingQuote" (Jdec.nullable Jdec.string) Nothing |
| 78 | 79 | |> Jpipe.optional "trailingTripleQuote" (Jdec.nullable Jdec.string) Nothing |
| 79 | - |> Jpipe.required "value" Jdec.string | |
| 80 | 80 | |
| 81 | 81 | encodeQuickType : QuickType -> Jenc.Value |
| 82 | 82 | encodeQuickType x = |
| 83 | 83 | Jenc.object |
| 84 | - [ ("trailingBackslash", makeNullableEncoder Jenc.string x.trailingBackslash) | |
| 84 | + [ ("value", Jenc.string x.value) | |
| 85 | + , ("trailingBackslash", makeNullableEncoder Jenc.string x.trailingBackslash) | |
| 85 | 86 | , ("trailingQuote", makeNullableEncoder Jenc.string x.trailingQuote) |
| 86 | 87 | , ("trailingTripleQuote", makeNullableEncoder Jenc.string x.trailingTripleQuote) |
| 87 | - , ("value", Jenc.string x.value) | |
| 88 | 88 | ] |
| 89 | 89 | |
| 90 | 90 | --- encoder helpers |
Mschema-flowdefault / TopLevel.js+13 −13
| @@ -24,18 +24,6 @@ | ||
| 24 | 24 | * } |
| 25 | 25 | */ |
| 26 | 26 | export type TopLevel = { |
| 27 | - /** | |
| 28 | - * Ends with a backslash \ | |
| 29 | - */ | |
| 30 | - trailingBackslash?: string; | |
| 31 | - /** | |
| 32 | - * Ends with a quote " | |
| 33 | - */ | |
| 34 | - trailingQuote?: string; | |
| 35 | - /** | |
| 36 | - * Ends with a triple quote """ | |
| 37 | - */ | |
| 38 | - trailingTripleQuote?: string; | |
| 39 | 27 | /** |
| 40 | 28 | * Property delimiters: |
| 41 | 29 | * * / |
| @@ -51,6 +39,18 @@ export type TopLevel = { | ||
| 51 | 39 | * } |
| 52 | 40 | */ |
| 53 | 41 | value: string; |
| 42 | + /** | |
| 43 | + * Ends with a backslash \ | |
| 44 | + */ | |
| 45 | + trailingBackslash?: string; | |
| 46 | + /** | |
| 47 | + * Ends with a quote " | |
| 48 | + */ | |
| 49 | + trailingQuote?: string; | |
| 50 | + /** | |
| 51 | + * Ends with a triple quote """ | |
| 52 | + */ | |
| 53 | + trailingTripleQuote?: string; | |
| 54 | 54 | }; |
| 55 | 55 | |
| 56 | 56 | // Converts JSON strings to/from your types |
| @@ -218,10 +218,10 @@ function r(name: string) { | ||
| 218 | 218 | |
| 219 | 219 | const typeMap: any = { |
| 220 | 220 | "TopLevel": o([ |
| 221 | + { json: "value", js: "value", typ: "" }, | |
| 221 | 222 | { json: "trailingBackslash", js: "trailingBackslash", typ: u(undefined, "") }, |
| 222 | 223 | { json: "trailingQuote", js: "trailingQuote", typ: u(undefined, "") }, |
| 223 | 224 | { json: "trailingTripleQuote", js: "trailingTripleQuote", typ: u(undefined, "") }, |
| 224 | - { json: "value", js: "value", typ: "" }, | |
| 225 | 225 | ], false), |
| 226 | 226 | }; |
Mschema-golangdefault / quicktype.go+6 −6
| @@ -31,12 +31,6 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 31 | 31 | // } |
| 32 | 32 | // } |
| 33 | 33 | type TopLevel struct { |
| 34 | - // Ends with a backslash \ | |
| 35 | - TrailingBackslash *string `json:"trailingBackslash,omitempty"` | |
| 36 | - // Ends with a quote " | |
| 37 | - TrailingQuote *string `json:"trailingQuote,omitempty"` | |
| 38 | - // Ends with a triple quote """ | |
| 39 | - TrailingTripleQuote *string `json:"trailingTripleQuote,omitempty"` | |
| 40 | 34 | // Property delimiters: |
| 41 | 35 | // */ |
| 42 | 36 | // /* |
| @@ -50,4 +44,10 @@ type TopLevel struct { | ||
| 50 | 44 | // } |
| 51 | 45 | // } |
| 52 | 46 | Value string `json:"value"` |
| 47 | + // Ends with a backslash \ | |
| 48 | + TrailingBackslash *string `json:"trailingBackslash,omitempty"` | |
| 49 | + // Ends with a quote " | |
| 50 | + TrailingQuote *string `json:"trailingQuote,omitempty"` | |
| 51 | + // Ends with a triple quote """ | |
| 52 | + TrailingTripleQuote *string `json:"trailingTripleQuote,omitempty"` | |
| 53 | 53 | } |
Mschema-haskelldefault / QuickType.hs+16 −16
| @@ -25,15 +25,6 @@ import Data.Text (Text) | ||
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | -trailingBackslash: | |
| 29 | -Ends with a backslash \ | |
| 30 | - | |
| 31 | -trailingQuote: | |
| 32 | -Ends with a quote " | |
| 33 | - | |
| 34 | -trailingTripleQuote: | |
| 35 | -Ends with a triple quote """ | |
| 36 | - | |
| 37 | 28 | value: |
| 38 | 29 | Property delimiters: |
| 39 | 30 | */ |
| @@ -47,29 +38,38 @@ Property delimiters: | ||
| 47 | 38 | } |
| 48 | 39 | } |
| 49 | 40 | } |
| 41 | + | |
| 42 | +trailingBackslash: | |
| 43 | +Ends with a backslash \ | |
| 44 | + | |
| 45 | +trailingQuote: | |
| 46 | +Ends with a quote " | |
| 47 | + | |
| 48 | +trailingTripleQuote: | |
| 49 | +Ends with a triple quote """ | |
| 50 | 50 | -} |
| 51 | 51 | data QuickType = QuickType |
| 52 | - { trailingBackslashQuickType :: Maybe Text | |
| 52 | + { valueQuickType :: Text | |
| 53 | + , trailingBackslashQuickType :: Maybe Text | |
| 53 | 54 | , trailingQuoteQuickType :: Maybe Text |
| 54 | 55 | , trailingTripleQuoteQuickType :: Maybe Text |
| 55 | - , valueQuickType :: Text | |
| 56 | 56 | } deriving (Show) |
| 57 | 57 | |
| 58 | 58 | decodeTopLevel :: ByteString -> Maybe QuickType |
| 59 | 59 | decodeTopLevel = decode |
| 60 | 60 | |
| 61 | 61 | instance ToJSON QuickType where |
| 62 | - toJSON (QuickType trailingBackslashQuickType trailingQuoteQuickType trailingTripleQuoteQuickType valueQuickType) = | |
| 62 | + toJSON (QuickType valueQuickType trailingBackslashQuickType trailingQuoteQuickType trailingTripleQuoteQuickType) = | |
| 63 | 63 | object |
| 64 | - [ "trailingBackslash" .= trailingBackslashQuickType | |
| 64 | + [ "value" .= valueQuickType | |
| 65 | + , "trailingBackslash" .= trailingBackslashQuickType | |
| 65 | 66 | , "trailingQuote" .= trailingQuoteQuickType |
| 66 | 67 | , "trailingTripleQuote" .= trailingTripleQuoteQuickType |
| 67 | - , "value" .= valueQuickType | |
| 68 | 68 | ] |
| 69 | 69 | |
| 70 | 70 | instance FromJSON QuickType where |
| 71 | 71 | parseJSON (Object v) = QuickType |
| 72 | - <$> v .:? "trailingBackslash" | |
| 72 | + <$> v .: "value" | |
| 73 | + <*> v .:? "trailingBackslash" | |
| 73 | 74 | <*> v .:? "trailingQuote" |
| 74 | 75 | <*> v .:? "trailingTripleQuote" |
| 75 | - <*> v .: "value" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+20 −20
| @@ -17,10 +17,29 @@ import com.fasterxml.jackson.annotation.*; | ||
| 17 | 17 | * } |
| 18 | 18 | */ |
| 19 | 19 | public class TopLevel { |
| 20 | + private String value; | |
| 20 | 21 | private String trailingBackslash; |
| 21 | 22 | private String trailingQuote; |
| 22 | 23 | private String trailingTripleQuote; |
| 23 | - private String value; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * Property delimiters: | |
| 27 | + * * / | |
| 28 | + * / * | |
| 29 | + * {- | |
| 30 | + * -} | |
| 31 | + * """ | |
| 32 | + * </summary> & <br> | |
| 33 | + * } | |
| 34 | + * } | |
| 35 | + * } | |
| 36 | + * } | |
| 37 | + * } | |
| 38 | + */ | |
| 39 | + @JsonProperty("value") | |
| 40 | + public String getValue() { return value; } | |
| 41 | + @JsonProperty("value") | |
| 42 | + public void setValue(String value) { this.value = value; } | |
| 24 | 43 | |
| 25 | 44 | /** |
| 26 | 45 | * Ends with a backslash \ |
| @@ -45,23 +64,4 @@ public class TopLevel { | ||
| 45 | 64 | public String getTrailingTripleQuote() { return trailingTripleQuote; } |
| 46 | 65 | @JsonProperty("trailingTripleQuote") |
| 47 | 66 | public void setTrailingTripleQuote(String value) { this.trailingTripleQuote = value; } |
| 48 | - | |
| 49 | - /** | |
| 50 | - * Property delimiters: | |
| 51 | - * * / | |
| 52 | - * / * | |
| 53 | - * {- | |
| 54 | - * -} | |
| 55 | - * """ | |
| 56 | - * </summary> & <br> | |
| 57 | - * } | |
| 58 | - * } | |
| 59 | - * } | |
| 60 | - * } | |
| 61 | - * } | |
| 62 | - */ | |
| 63 | - @JsonProperty("value") | |
| 64 | - public String getValue() { return value; } | |
| 65 | - @JsonProperty("value") | |
| 66 | - public void setValue(String value) { this.value = value; } | |
| 67 | 67 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+20 −20
| @@ -17,10 +17,29 @@ import com.fasterxml.jackson.annotation.*; | ||
| 17 | 17 | * } |
| 18 | 18 | */ |
| 19 | 19 | public class TopLevel { |
| 20 | + private String value; | |
| 20 | 21 | private String trailingBackslash; |
| 21 | 22 | private String trailingQuote; |
| 22 | 23 | private String trailingTripleQuote; |
| 23 | - private String value; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * Property delimiters: | |
| 27 | + * * / | |
| 28 | + * / * | |
| 29 | + * {- | |
| 30 | + * -} | |
| 31 | + * """ | |
| 32 | + * </summary> & <br> | |
| 33 | + * } | |
| 34 | + * } | |
| 35 | + * } | |
| 36 | + * } | |
| 37 | + * } | |
| 38 | + */ | |
| 39 | + @JsonProperty("value") | |
| 40 | + public String getValue() { return value; } | |
| 41 | + @JsonProperty("value") | |
| 42 | + public void setValue(String value) { this.value = value; } | |
| 24 | 43 | |
| 25 | 44 | /** |
| 26 | 45 | * Ends with a backslash \ |
| @@ -45,23 +64,4 @@ public class TopLevel { | ||
| 45 | 64 | public String getTrailingTripleQuote() { return trailingTripleQuote; } |
| 46 | 65 | @JsonProperty("trailingTripleQuote") |
| 47 | 66 | public void setTrailingTripleQuote(String value) { this.trailingTripleQuote = value; } |
| 48 | - | |
| 49 | - /** | |
| 50 | - * Property delimiters: | |
| 51 | - * * / | |
| 52 | - * / * | |
| 53 | - * {- | |
| 54 | - * -} | |
| 55 | - * """ | |
| 56 | - * </summary> & <br> | |
| 57 | - * } | |
| 58 | - * } | |
| 59 | - * } | |
| 60 | - * } | |
| 61 | - * } | |
| 62 | - */ | |
| 63 | - @JsonProperty("value") | |
| 64 | - public String getValue() { return value; } | |
| 65 | - @JsonProperty("value") | |
| 66 | - public void setValue(String value) { this.value = value; } | |
| 67 | 67 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+20 −20
| @@ -17,10 +17,29 @@ import com.fasterxml.jackson.annotation.*; | ||
| 17 | 17 | * } |
| 18 | 18 | */ |
| 19 | 19 | public class TopLevel { |
| 20 | + private String value; | |
| 20 | 21 | private String trailingBackslash; |
| 21 | 22 | private String trailingQuote; |
| 22 | 23 | private String trailingTripleQuote; |
| 23 | - private String value; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * Property delimiters: | |
| 27 | + * * / | |
| 28 | + * / * | |
| 29 | + * {- | |
| 30 | + * -} | |
| 31 | + * """ | |
| 32 | + * </summary> & <br> | |
| 33 | + * } | |
| 34 | + * } | |
| 35 | + * } | |
| 36 | + * } | |
| 37 | + * } | |
| 38 | + */ | |
| 39 | + @JsonProperty("value") | |
| 40 | + public String getValue() { return value; } | |
| 41 | + @JsonProperty("value") | |
| 42 | + public void setValue(String value) { this.value = value; } | |
| 24 | 43 | |
| 25 | 44 | /** |
| 26 | 45 | * Ends with a backslash \ |
| @@ -45,23 +64,4 @@ public class TopLevel { | ||
| 45 | 64 | public String getTrailingTripleQuote() { return trailingTripleQuote; } |
| 46 | 65 | @JsonProperty("trailingTripleQuote") |
| 47 | 66 | public void setTrailingTripleQuote(String value) { this.trailingTripleQuote = value; } |
| 48 | - | |
| 49 | - /** | |
| 50 | - * Property delimiters: | |
| 51 | - * * / | |
| 52 | - * / * | |
| 53 | - * {- | |
| 54 | - * -} | |
| 55 | - * """ | |
| 56 | - * </summary> & <br> | |
| 57 | - * } | |
| 58 | - * } | |
| 59 | - * } | |
| 60 | - * } | |
| 61 | - * } | |
| 62 | - */ | |
| 63 | - @JsonProperty("value") | |
| 64 | - public String getValue() { return value; } | |
| 65 | - @JsonProperty("value") | |
| 66 | - public void setValue(String value) { this.value = value; } | |
| 67 | 67 | } |
Mschema-javascriptdefault / TopLevel.js+1 −1
| @@ -172,10 +172,10 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | + { json: "value", js: "value", typ: "" }, | |
| 175 | 176 | { json: "trailingBackslash", js: "trailingBackslash", typ: u(undefined, "") }, |
| 176 | 177 | { json: "trailingQuote", js: "trailingQuote", typ: u(undefined, "") }, |
| 177 | 178 | { json: "trailingTripleQuote", js: "trailingTripleQuote", typ: u(undefined, "") }, |
| 178 | - { json: "value", js: "value", typ: "" }, | |
| 179 | 179 | ], false), |
| 180 | 180 | }; |
Mschema-kotlin-jacksondefault / TopLevel.kt+16 −16
| @@ -33,21 +33,6 @@ val mapper = jacksonObjectMapper().apply { | ||
| 33 | 33 | * } |
| 34 | 34 | */ |
| 35 | 35 | data class TopLevel ( |
| 36 | - /** | |
| 37 | - * Ends with a backslash \ | |
| 38 | - */ | |
| 39 | - val trailingBackslash: String? = null, | |
| 40 | - | |
| 41 | - /** | |
| 42 | - * Ends with a quote " | |
| 43 | - */ | |
| 44 | - val trailingQuote: String? = null, | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * Ends with a triple quote """ | |
| 48 | - */ | |
| 49 | - val trailingTripleQuote: String? = null, | |
| 50 | - | |
| 51 | 36 | /** |
| 52 | 37 | * Property delimiters: |
| 53 | 38 | * * / |
| @@ -63,7 +48,22 @@ data class TopLevel ( | ||
| 63 | 48 | * } |
| 64 | 49 | */ |
| 65 | 50 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 66 | - val value: String | |
| 51 | + val value: String, | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * Ends with a backslash \ | |
| 55 | + */ | |
| 56 | + val trailingBackslash: String? = null, | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * Ends with a quote " | |
| 60 | + */ | |
| 61 | + val trailingQuote: String? = null, | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * Ends with a triple quote """ | |
| 65 | + */ | |
| 66 | + val trailingTripleQuote: String? = null | |
| 67 | 67 | ) { |
| 68 | 68 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+16 −16
| @@ -23,21 +23,6 @@ private val klaxon = Klaxon() | ||
| 23 | 23 | * } |
| 24 | 24 | */ |
| 25 | 25 | data class TopLevel ( |
| 26 | - /** | |
| 27 | - * Ends with a backslash \ | |
| 28 | - */ | |
| 29 | - val trailingBackslash: String? = null, | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * Ends with a quote " | |
| 33 | - */ | |
| 34 | - val trailingQuote: String? = null, | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * Ends with a triple quote """ | |
| 38 | - */ | |
| 39 | - val trailingTripleQuote: String? = null, | |
| 40 | - | |
| 41 | 26 | /** |
| 42 | 27 | * Property delimiters: |
| 43 | 28 | * * / |
| @@ -52,7 +37,22 @@ data class TopLevel ( | ||
| 52 | 37 | * } |
| 53 | 38 | * } |
| 54 | 39 | */ |
| 55 | - val value: String | |
| 40 | + val value: String, | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * Ends with a backslash \ | |
| 44 | + */ | |
| 45 | + val trailingBackslash: String? = null, | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * Ends with a quote " | |
| 49 | + */ | |
| 50 | + val trailingQuote: String? = null, | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * Ends with a triple quote """ | |
| 54 | + */ | |
| 55 | + val trailingTripleQuote: String? = null | |
| 56 | 56 | ) { |
| 57 | 57 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-kotlinxdefault / TopLevel.kt+16 −16
| @@ -26,21 +26,6 @@ import kotlinx.serialization.encoding.* | ||
| 26 | 26 | */ |
| 27 | 27 | @Serializable |
| 28 | 28 | data class TopLevel ( |
| 29 | - /** | |
| 30 | - * Ends with a backslash \ | |
| 31 | - */ | |
| 32 | - val trailingBackslash: String? = null, | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * Ends with a quote " | |
| 36 | - */ | |
| 37 | - val trailingQuote: String? = null, | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * Ends with a triple quote """ | |
| 41 | - */ | |
| 42 | - val trailingTripleQuote: String? = null, | |
| 43 | - | |
| 44 | 29 | /** |
| 45 | 30 | * Property delimiters: |
| 46 | 31 | * * / |
| @@ -55,5 +40,20 @@ data class TopLevel ( | ||
| 55 | 40 | * } |
| 56 | 41 | * } |
| 57 | 42 | */ |
| 58 | - val value: String | |
| 43 | + val value: String, | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * Ends with a backslash \ | |
| 47 | + */ | |
| 48 | + val trailingBackslash: String? = null, | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * Ends with a quote " | |
| 52 | + */ | |
| 53 | + val trailingQuote: String? = null, | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * Ends with a triple quote """ | |
| 57 | + */ | |
| 58 | + val trailingTripleQuote: String? = null | |
| 59 | 59 | ) |
Mschema-phpdefault / TopLevel.php+127 −127
| @@ -4,22 +4,134 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | + private string $value; // json:value Required | |
| 7 | 8 | private ?string $trailingBackslash; // json:trailingBackslash Optional |
| 8 | 9 | private ?string $trailingQuote; // json:trailingQuote Optional |
| 9 | 10 | private ?string $trailingTripleQuote; // json:trailingTripleQuote Optional |
| 10 | - private string $value; // json:value Required | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | + * @param string $value | |
| 13 | 14 | * @param string|null $trailingBackslash |
| 14 | 15 | * @param string|null $trailingQuote |
| 15 | 16 | * @param string|null $trailingTripleQuote |
| 16 | - * @param string $value | |
| 17 | 17 | */ |
| 18 | - public function __construct(?string $trailingBackslash, ?string $trailingQuote, ?string $trailingTripleQuote, string $value) { | |
| 18 | + public function __construct(string $value, ?string $trailingBackslash, ?string $trailingQuote, ?string $trailingTripleQuote) { | |
| 19 | + $this->value = $value; | |
| 19 | 20 | $this->trailingBackslash = $trailingBackslash; |
| 20 | 21 | $this->trailingQuote = $trailingQuote; |
| 21 | 22 | $this->trailingTripleQuote = $trailingTripleQuote; |
| 22 | - $this->value = $value; | |
| 23 | + } | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * Property delimiters: | |
| 27 | + * * / | |
| 28 | + * / * | |
| 29 | + * {- | |
| 30 | + * -} | |
| 31 | + * """ | |
| 32 | + * </summary> & <br> | |
| 33 | + * } | |
| 34 | + * } | |
| 35 | + * } | |
| 36 | + * } | |
| 37 | + * } | |
| 38 | + * | |
| 39 | + * @param string $value | |
| 40 | + * @throws Exception | |
| 41 | + * @return string | |
| 42 | + */ | |
| 43 | + public static function fromValue(string $value): string { | |
| 44 | + return $value; /*string*/ | |
| 45 | + } | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * Property delimiters: | |
| 49 | + * * / | |
| 50 | + * / * | |
| 51 | + * {- | |
| 52 | + * -} | |
| 53 | + * """ | |
| 54 | + * </summary> & <br> | |
| 55 | + * } | |
| 56 | + * } | |
| 57 | + * } | |
| 58 | + * } | |
| 59 | + * } | |
| 60 | + * | |
| 61 | + * @throws Exception | |
| 62 | + * @return string | |
| 63 | + */ | |
| 64 | + public function toValue(): string { | |
| 65 | + if (TopLevel::validateValue($this->value)) { | |
| 66 | + return $this->value; /*string*/ | |
| 67 | + } | |
| 68 | + throw new Exception('never get to this TopLevel::value'); | |
| 69 | + } | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * Property delimiters: | |
| 73 | + * * / | |
| 74 | + * / * | |
| 75 | + * {- | |
| 76 | + * -} | |
| 77 | + * """ | |
| 78 | + * </summary> & <br> | |
| 79 | + * } | |
| 80 | + * } | |
| 81 | + * } | |
| 82 | + * } | |
| 83 | + * } | |
| 84 | + * | |
| 85 | + * @param string | |
| 86 | + * @return bool | |
| 87 | + * @throws Exception | |
| 88 | + */ | |
| 89 | + public static function validateValue(string $value): bool { | |
| 90 | + return true; | |
| 91 | + } | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * Property delimiters: | |
| 95 | + * * / | |
| 96 | + * / * | |
| 97 | + * {- | |
| 98 | + * -} | |
| 99 | + * """ | |
| 100 | + * </summary> & <br> | |
| 101 | + * } | |
| 102 | + * } | |
| 103 | + * } | |
| 104 | + * } | |
| 105 | + * } | |
| 106 | + * | |
| 107 | + * @throws Exception | |
| 108 | + * @return string | |
| 109 | + */ | |
| 110 | + public function getValue(): string { | |
| 111 | + if (TopLevel::validateValue($this->value)) { | |
| 112 | + return $this->value; | |
| 113 | + } | |
| 114 | + throw new Exception('never get to getValue TopLevel::value'); | |
| 115 | + } | |
| 116 | + | |
| 117 | + /** | |
| 118 | + * Property delimiters: | |
| 119 | + * * / | |
| 120 | + * / * | |
| 121 | + * {- | |
| 122 | + * -} | |
| 123 | + * """ | |
| 124 | + * </summary> & <br> | |
| 125 | + * } | |
| 126 | + * } | |
| 127 | + * } | |
| 128 | + * } | |
| 129 | + * } | |
| 130 | + * | |
| 131 | + * @return string | |
| 132 | + */ | |
| 133 | + public static function sampleValue(): string { | |
| 134 | + return 'TopLevel::value::31'; /*31:value*/ | |
| 23 | 135 | } |
| 24 | 136 | |
| 25 | 137 | /** |
| @@ -86,7 +198,7 @@ class TopLevel { | ||
| 86 | 198 | * @return ?string |
| 87 | 199 | */ |
| 88 | 200 | public static function sampleTrailingBackslash(): ?string { |
| 89 | - return 'TopLevel::trailingBackslash::31'; /*31:trailingBackslash*/ | |
| 201 | + return 'TopLevel::trailingBackslash::32'; /*32:trailingBackslash*/ | |
| 90 | 202 | } |
| 91 | 203 | |
| 92 | 204 | /** |
| @@ -153,7 +265,7 @@ class TopLevel { | ||
| 153 | 265 | * @return ?string |
| 154 | 266 | */ |
| 155 | 267 | public static function sampleTrailingQuote(): ?string { |
| 156 | - return 'TopLevel::trailingQuote::32'; /*32:trailingQuote*/ | |
| 268 | + return 'TopLevel::trailingQuote::33'; /*33:trailingQuote*/ | |
| 157 | 269 | } |
| 158 | 270 | |
| 159 | 271 | /** |
| @@ -220,119 +332,7 @@ class TopLevel { | ||
| 220 | 332 | * @return ?string |
| 221 | 333 | */ |
| 222 | 334 | public static function sampleTrailingTripleQuote(): ?string { |
| 223 | - return 'TopLevel::trailingTripleQuote::33'; /*33:trailingTripleQuote*/ | |
| 224 | - } | |
| 225 | - | |
| 226 | - /** | |
| 227 | - * Property delimiters: | |
| 228 | - * * / | |
| 229 | - * / * | |
| 230 | - * {- | |
| 231 | - * -} | |
| 232 | - * """ | |
| 233 | - * </summary> & <br> | |
| 234 | - * } | |
| 235 | - * } | |
| 236 | - * } | |
| 237 | - * } | |
| 238 | - * } | |
| 239 | - * | |
| 240 | - * @param string $value | |
| 241 | - * @throws Exception | |
| 242 | - * @return string | |
| 243 | - */ | |
| 244 | - public static function fromValue(string $value): string { | |
| 245 | - return $value; /*string*/ | |
| 246 | - } | |
| 247 | - | |
| 248 | - /** | |
| 249 | - * Property delimiters: | |
| 250 | - * * / | |
| 251 | - * / * | |
| 252 | - * {- | |
| 253 | - * -} | |
| 254 | - * """ | |
| 255 | - * </summary> & <br> | |
| 256 | - * } | |
| 257 | - * } | |
| 258 | - * } | |
| 259 | - * } | |
| 260 | - * } | |
| 261 | - * | |
| 262 | - * @throws Exception | |
| 263 | - * @return string | |
| 264 | - */ | |
| 265 | - public function toValue(): string { | |
| 266 | - if (TopLevel::validateValue($this->value)) { | |
| 267 | - return $this->value; /*string*/ | |
| 268 | - } | |
| 269 | - throw new Exception('never get to this TopLevel::value'); | |
| 270 | - } | |
| 271 | - | |
| 272 | - /** | |
| 273 | - * Property delimiters: | |
| 274 | - * * / | |
| 275 | - * / * | |
| 276 | - * {- | |
| 277 | - * -} | |
| 278 | - * """ | |
| 279 | - * </summary> & <br> | |
| 280 | - * } | |
| 281 | - * } | |
| 282 | - * } | |
| 283 | - * } | |
| 284 | - * } | |
| 285 | - * | |
| 286 | - * @param string | |
| 287 | - * @return bool | |
| 288 | - * @throws Exception | |
| 289 | - */ | |
| 290 | - public static function validateValue(string $value): bool { | |
| 291 | - return true; | |
| 292 | - } | |
| 293 | - | |
| 294 | - /** | |
| 295 | - * Property delimiters: | |
| 296 | - * * / | |
| 297 | - * / * | |
| 298 | - * {- | |
| 299 | - * -} | |
| 300 | - * """ | |
| 301 | - * </summary> & <br> | |
| 302 | - * } | |
| 303 | - * } | |
| 304 | - * } | |
| 305 | - * } | |
| 306 | - * } | |
| 307 | - * | |
| 308 | - * @throws Exception | |
| 309 | - * @return string | |
| 310 | - */ | |
| 311 | - public function getValue(): string { | |
| 312 | - if (TopLevel::validateValue($this->value)) { | |
| 313 | - return $this->value; | |
| 314 | - } | |
| 315 | - throw new Exception('never get to getValue TopLevel::value'); | |
| 316 | - } | |
| 317 | - | |
| 318 | - /** | |
| 319 | - * Property delimiters: | |
| 320 | - * * / | |
| 321 | - * / * | |
| 322 | - * {- | |
| 323 | - * -} | |
| 324 | - * """ | |
| 325 | - * </summary> & <br> | |
| 326 | - * } | |
| 327 | - * } | |
| 328 | - * } | |
| 329 | - * } | |
| 330 | - * } | |
| 331 | - * | |
| 332 | - * @return string | |
| 333 | - */ | |
| 334 | - public static function sampleValue(): string { | |
| 335 | - return 'TopLevel::value::34'; /*34:value*/ | |
| 335 | + return 'TopLevel::trailingTripleQuote::34'; /*34:trailingTripleQuote*/ | |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | /** |
| @@ -340,10 +340,10 @@ class TopLevel { | ||
| 340 | 340 | * @return bool |
| 341 | 341 | */ |
| 342 | 342 | public function validate(): bool { |
| 343 | - return TopLevel::validateTrailingBackslash($this->trailingBackslash) | |
| 343 | + return TopLevel::validateValue($this->value) | |
| 344 | + || TopLevel::validateTrailingBackslash($this->trailingBackslash) | |
| 344 | 345 | || TopLevel::validateTrailingQuote($this->trailingQuote) |
| 345 | - || TopLevel::validateTrailingTripleQuote($this->trailingTripleQuote) | |
| 346 | - || TopLevel::validateValue($this->value); | |
| 346 | + || TopLevel::validateTrailingTripleQuote($this->trailingTripleQuote); | |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /** |
| @@ -352,10 +352,10 @@ class TopLevel { | ||
| 352 | 352 | */ |
| 353 | 353 | public function to(): stdClass { |
| 354 | 354 | $out = new stdClass(); |
| 355 | + $out->{'value'} = $this->toValue(); | |
| 355 | 356 | $out->{'trailingBackslash'} = $this->toTrailingBackslash(); |
| 356 | 357 | $out->{'trailingQuote'} = $this->toTrailingQuote(); |
| 357 | 358 | $out->{'trailingTripleQuote'} = $this->toTrailingTripleQuote(); |
| 358 | - $out->{'value'} = $this->toValue(); | |
| 359 | 359 | return $out; |
| 360 | 360 | } |
| 361 | 361 | |
| @@ -366,10 +366,10 @@ class TopLevel { | ||
| 366 | 366 | */ |
| 367 | 367 | public static function from(stdClass $obj): TopLevel { |
| 368 | 368 | return new TopLevel( |
| 369 | - TopLevel::fromTrailingBackslash($obj->{'trailingBackslash'}) | |
| 369 | + TopLevel::fromValue($obj->{'value'}) | |
| 370 | + ,TopLevel::fromTrailingBackslash($obj->{'trailingBackslash'}) | |
| 370 | 371 | ,TopLevel::fromTrailingQuote($obj->{'trailingQuote'}) |
| 371 | 372 | ,TopLevel::fromTrailingTripleQuote($obj->{'trailingTripleQuote'}) |
| 372 | - ,TopLevel::fromValue($obj->{'value'}) | |
| 373 | 373 | ); |
| 374 | 374 | } |
| 375 | 375 | |
| @@ -378,10 +378,10 @@ class TopLevel { | ||
| 378 | 378 | */ |
| 379 | 379 | public static function sample(): TopLevel { |
| 380 | 380 | return new TopLevel( |
| 381 | - TopLevel::sampleTrailingBackslash() | |
| 381 | + TopLevel::sampleValue() | |
| 382 | + ,TopLevel::sampleTrailingBackslash() | |
| 382 | 383 | ,TopLevel::sampleTrailingQuote() |
| 383 | 384 | ,TopLevel::sampleTrailingTripleQuote() |
| 384 | - ,TopLevel::sampleValue() | |
| 385 | 385 | ); |
| 386 | 386 | } |
| 387 | 387 | } |
Mschema-pikedefault / TopLevel.pmod+3 −3
| @@ -25,17 +25,17 @@ | ||
| 25 | 25 | // } |
| 26 | 26 | // } |
| 27 | 27 | class TopLevel { |
| 28 | + string value; // json: "value" | |
| 28 | 29 | mixed|string trailing_backslash; // json: "trailingBackslash" |
| 29 | 30 | mixed|string trailing_quote; // json: "trailingQuote" |
| 30 | 31 | mixed|string trailing_triple_quote; // json: "trailingTripleQuote" |
| 31 | - string value; // json: "value" | |
| 32 | 32 | |
| 33 | 33 | string encode_json() { |
| 34 | 34 | mapping(string:mixed) json = ([ |
| 35 | + "value" : value, | |
| 35 | 36 | "trailingBackslash" : trailing_backslash, |
| 36 | 37 | "trailingQuote" : trailing_quote, |
| 37 | 38 | "trailingTripleQuote" : trailing_triple_quote, |
| 38 | - "value" : value, | |
| 39 | 39 | ]); |
| 40 | 40 | |
| 41 | 41 | return Standards.JSON.encode(json); |
| @@ -45,10 +45,10 @@ class TopLevel { | ||
| 45 | 45 | TopLevel TopLevel_from_JSON(mixed json) { |
| 46 | 46 | TopLevel retval = TopLevel(); |
| 47 | 47 | |
| 48 | + retval.value = json["value"]; | |
| 48 | 49 | retval.trailing_backslash = json["trailingBackslash"]; |
| 49 | 50 | retval.trailing_quote = json["trailingQuote"]; |
| 50 | 51 | retval.trailing_triple_quote = json["trailingTripleQuote"]; |
| 51 | - retval.value = json["value"]; | |
| 52 | 52 | |
| 53 | 53 | return retval; |
| 54 | 54 | } |
Mschema-rubydefault / TopLevel.rb+12 −12
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.trailing_backslash | |
| 7 | +# puts top_level.value | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -33,15 +33,6 @@ end | ||
| 33 | 33 | # } |
| 34 | 34 | class TopLevel < Dry::Struct |
| 35 | 35 | |
| 36 | - # Ends with a backslash \ | |
| 37 | - attribute :trailing_backslash, Types::String.optional | |
| 38 | - | |
| 39 | - # Ends with a quote " | |
| 40 | - attribute :trailing_quote, Types::String.optional | |
| 41 | - | |
| 42 | - # Ends with a triple quote """ | |
| 43 | - attribute :trailing_triple_quote, Types::String.optional | |
| 44 | - | |
| 45 | 36 | # Property delimiters: |
| 46 | 37 | # */ |
| 47 | 38 | # /* |
| @@ -56,13 +47,22 @@ class TopLevel < Dry::Struct | ||
| 56 | 47 | # } |
| 57 | 48 | attribute :value, Types::String |
| 58 | 49 | |
| 50 | + # Ends with a backslash \ | |
| 51 | + attribute :trailing_backslash, Types::String.optional | |
| 52 | + | |
| 53 | + # Ends with a quote " | |
| 54 | + attribute :trailing_quote, Types::String.optional | |
| 55 | + | |
| 56 | + # Ends with a triple quote """ | |
| 57 | + attribute :trailing_triple_quote, Types::String.optional | |
| 58 | + | |
| 59 | 59 | def self.from_dynamic!(d) |
| 60 | 60 | d = Types::Hash[d] |
| 61 | 61 | new( |
| 62 | + value: d.fetch("value"), | |
| 62 | 63 | trailing_backslash: d["trailingBackslash"], |
| 63 | 64 | trailing_quote: d["trailingQuote"], |
| 64 | 65 | trailing_triple_quote: d["trailingTripleQuote"], |
| 65 | - value: d.fetch("value"), | |
| 66 | 66 | ) |
| 67 | 67 | end |
| 68 | 68 | |
| @@ -72,10 +72,10 @@ class TopLevel < Dry::Struct | ||
| 72 | 72 | |
| 73 | 73 | def to_dynamic |
| 74 | 74 | { |
| 75 | + "value" => value, | |
| 75 | 76 | "trailingBackslash" => trailing_backslash, |
| 76 | 77 | "trailingQuote" => trailing_quote, |
| 77 | 78 | "trailingTripleQuote" => trailing_triple_quote, |
| 78 | - "value" => value, | |
| 79 | 79 | } |
| 80 | 80 | end |
Mschema-rustdefault / module_under_test.rs+9 −9
| @@ -28,15 +28,6 @@ use serde::{Serialize, Deserialize}; | ||
| 28 | 28 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 29 | 29 | #[serde(rename_all = "camelCase")] |
| 30 | 30 | pub struct TopLevel { |
| 31 | - /// Ends with a backslash \ | |
| 32 | - pub trailing_backslash: Option<String>, | |
| 33 | - | |
| 34 | - /// Ends with a quote " | |
| 35 | - pub trailing_quote: Option<String>, | |
| 36 | - | |
| 37 | - /// Ends with a triple quote """ | |
| 38 | - pub trailing_triple_quote: Option<String>, | |
| 39 | - | |
| 40 | 31 | /// Property delimiters: |
| 41 | 32 | /// */ |
| 42 | 33 | /// /* |
| @@ -50,4 +41,13 @@ pub struct TopLevel { | ||
| 50 | 41 | /// } |
| 51 | 42 | /// } |
| 52 | 43 | pub value: String, |
| 44 | + | |
| 45 | + /// Ends with a backslash \ | |
| 46 | + pub trailing_backslash: Option<String>, | |
| 47 | + | |
| 48 | + /// Ends with a quote " | |
| 49 | + pub trailing_quote: Option<String>, | |
| 50 | + | |
| 51 | + /// Ends with a triple quote """ | |
| 52 | + pub trailing_triple_quote: Option<String>, | |
| 53 | 53 | } |
Mschema-scala3-upickledefault / TopLevel.scala+16 −16
| @@ -80,21 +80,6 @@ end JsonExt | ||
| 80 | 80 | * } |
| 81 | 81 | */ |
| 82 | 82 | case class TopLevel ( |
| 83 | - /** | |
| 84 | - * Ends with a backslash \ | |
| 85 | - */ | |
| 86 | - val trailingBackslash : Option[String] = None, | |
| 87 | - | |
| 88 | - /** | |
| 89 | - * Ends with a quote " | |
| 90 | - */ | |
| 91 | - val trailingQuote : Option[String] = None, | |
| 92 | - | |
| 93 | - /** | |
| 94 | - * Ends with a triple quote """ | |
| 95 | - */ | |
| 96 | - val trailingTripleQuote : Option[String] = None, | |
| 97 | - | |
| 98 | 83 | /** |
| 99 | 84 | * Property delimiters: |
| 100 | 85 | * * / |
| @@ -109,5 +94,20 @@ case class TopLevel ( | ||
| 109 | 94 | * } |
| 110 | 95 | * } |
| 111 | 96 | */ |
| 112 | - val value : String | |
| 97 | + val value : String, | |
| 98 | + | |
| 99 | + /** | |
| 100 | + * Ends with a backslash \ | |
| 101 | + */ | |
| 102 | + val trailingBackslash : Option[String] = None, | |
| 103 | + | |
| 104 | + /** | |
| 105 | + * Ends with a quote " | |
| 106 | + */ | |
| 107 | + val trailingQuote : Option[String] = None, | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * Ends with a triple quote """ | |
| 111 | + */ | |
| 112 | + val trailingTripleQuote : Option[String] = None | |
| 113 | 113 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+16 −16
| @@ -22,21 +22,6 @@ type NullValue = None.type | ||
| 22 | 22 | * } |
| 23 | 23 | */ |
| 24 | 24 | case class TopLevel ( |
| 25 | - /** | |
| 26 | - * Ends with a backslash \ | |
| 27 | - */ | |
| 28 | - val trailingBackslash : Option[String] = None, | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * Ends with a quote " | |
| 32 | - */ | |
| 33 | - val trailingQuote : Option[String] = None, | |
| 34 | - | |
| 35 | - /** | |
| 36 | - * Ends with a triple quote """ | |
| 37 | - */ | |
| 38 | - val trailingTripleQuote : Option[String] = None, | |
| 39 | - | |
| 40 | 25 | /** |
| 41 | 26 | * Property delimiters: |
| 42 | 27 | * * / |
| @@ -51,5 +36,20 @@ case class TopLevel ( | ||
| 51 | 36 | * } |
| 52 | 37 | * } |
| 53 | 38 | */ |
| 54 | - val value : String | |
| 39 | + val value : String, | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * Ends with a backslash \ | |
| 43 | + */ | |
| 44 | + val trailingBackslash : Option[String] = None, | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * Ends with a quote " | |
| 48 | + */ | |
| 49 | + val trailingQuote : Option[String] = None, | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * Ends with a triple quote """ | |
| 53 | + */ | |
| 54 | + val trailingTripleQuote : Option[String] = None | |
| 55 | 55 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+4 −4
| @@ -6,6 +6,10 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": false, |
| 8 | 8 | "properties": { |
| 9 | + "value": { | |
| 10 | + "type": "string", | |
| 11 | + "description": "Property delimiters:\n*/\n/*\n{-\n-}\n\"\"\"\n</summary> & <br>\n}\n}\n}\n}\n}" | |
| 12 | + }, | |
| 9 | 13 | "trailingBackslash": { |
| 10 | 14 | "type": "string", |
| 11 | 15 | "description": "Ends with a backslash \\" |
| @@ -17,10 +21,6 @@ | ||
| 17 | 21 | "trailingTripleQuote": { |
| 18 | 22 | "type": "string", |
| 19 | 23 | "description": "Ends with a triple quote \"\"\"" |
| 20 | - }, | |
| 21 | - "value": { | |
| 22 | - "type": "string", | |
| 23 | - "description": "Property delimiters:\n*/\n/*\n{-\n-}\n\"\"\"\n</summary> & <br>\n}\n}\n}\n}\n}" | |
| 24 | 24 | } |
| 25 | 25 | }, |
| 26 | 26 | "required": [ |
Mschema-swiftdefault / quicktype.swift+11 −11
| @@ -19,12 +19,6 @@ import Foundation | ||
| 19 | 19 | /// } |
| 20 | 20 | // MARK: - TopLevel |
| 21 | 21 | struct TopLevel: Codable { |
| 22 | - /// Ends with a backslash \ | |
| 23 | - let trailingBackslash: String? | |
| 24 | - /// Ends with a quote " | |
| 25 | - let trailingQuote: String? | |
| 26 | - /// Ends with a triple quote """ | |
| 27 | - let trailingTripleQuote: String? | |
| 28 | 22 | /// Property delimiters: |
| 29 | 23 | /// */ |
| 30 | 24 | /// /* |
| @@ -38,12 +32,18 @@ struct TopLevel: Codable { | ||
| 38 | 32 | /// } |
| 39 | 33 | /// } |
| 40 | 34 | let value: String |
| 35 | + /// Ends with a backslash \ | |
| 36 | + let trailingBackslash: String? | |
| 37 | + /// Ends with a quote " | |
| 38 | + let trailingQuote: String? | |
| 39 | + /// Ends with a triple quote """ | |
| 40 | + let trailingTripleQuote: String? | |
| 41 | 41 | |
| 42 | 42 | enum CodingKeys: String, CodingKey { |
| 43 | + case value = "value" | |
| 43 | 44 | case trailingBackslash = "trailingBackslash" |
| 44 | 45 | case trailingQuote = "trailingQuote" |
| 45 | 46 | case trailingTripleQuote = "trailingTripleQuote" |
| 46 | - case value = "value" | |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| @@ -66,16 +66,16 @@ extension TopLevel { | ||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | func with( |
| 69 | + value: String? = nil, | |
| 69 | 70 | trailingBackslash: String?? = nil, |
| 70 | 71 | trailingQuote: String?? = nil, |
| 71 | - trailingTripleQuote: String?? = nil, | |
| 72 | - value: String? = nil | |
| 72 | + trailingTripleQuote: String?? = nil | |
| 73 | 73 | ) -> TopLevel { |
| 74 | 74 | return TopLevel( |
| 75 | + value: value ?? self.value, | |
| 75 | 76 | trailingBackslash: trailingBackslash ?? self.trailingBackslash, |
| 76 | 77 | trailingQuote: trailingQuote ?? self.trailingQuote, |
| 77 | - trailingTripleQuote: trailingTripleQuote ?? self.trailingTripleQuote, | |
| 78 | - value: value ?? self.value | |
| 78 | + trailingTripleQuote: trailingTripleQuote ?? self.trailingTripleQuote | |
| 79 | 79 | ) |
| 80 | 80 | } |
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,9 +2,9 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | + "value": z.string(), | |
| 5 | 6 | "trailingBackslash": z.string().optional(), |
| 6 | 7 | "trailingQuote": z.string().optional(), |
| 7 | 8 | "trailingTripleQuote": z.string().optional(), |
| 8 | - "value": z.string(), | |
| 9 | 9 | }); |
| 10 | 10 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+13 −13
| @@ -22,18 +22,6 @@ | ||
| 22 | 22 | * } |
| 23 | 23 | */ |
| 24 | 24 | export interface TopLevel { |
| 25 | - /** | |
| 26 | - * Ends with a backslash \ | |
| 27 | - */ | |
| 28 | - trailingBackslash?: string; | |
| 29 | - /** | |
| 30 | - * Ends with a quote " | |
| 31 | - */ | |
| 32 | - trailingQuote?: string; | |
| 33 | - /** | |
| 34 | - * Ends with a triple quote """ | |
| 35 | - */ | |
| 36 | - trailingTripleQuote?: string; | |
| 37 | 25 | /** |
| 38 | 26 | * Property delimiters: |
| 39 | 27 | * * / |
| @@ -49,6 +37,18 @@ export interface TopLevel { | ||
| 49 | 37 | * } |
| 50 | 38 | */ |
| 51 | 39 | value: string; |
| 40 | + /** | |
| 41 | + * Ends with a backslash \ | |
| 42 | + */ | |
| 43 | + trailingBackslash?: string; | |
| 44 | + /** | |
| 45 | + * Ends with a quote " | |
| 46 | + */ | |
| 47 | + trailingQuote?: string; | |
| 48 | + /** | |
| 49 | + * Ends with a triple quote """ | |
| 50 | + */ | |
| 51 | + trailingTripleQuote?: string; | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // Converts JSON strings to/from your types |
| @@ -218,9 +218,9 @@ function r(name: string) { | ||
| 218 | 218 | |
| 219 | 219 | const typeMap: any = { |
| 220 | 220 | "TopLevel": o([ |
| 221 | + { json: "value", js: "value", typ: "" }, | |
| 221 | 222 | { json: "trailingBackslash", js: "trailingBackslash", typ: u(undefined, "") }, |
| 222 | 223 | { json: "trailingQuote", js: "trailingQuote", typ: u(undefined, "") }, |
| 223 | 224 | { json: "trailingTripleQuote", js: "trailingTripleQuote", typ: u(undefined, "") }, |
| 224 | - { json: "value", js: "value", typ: "" }, | |
| 225 | 225 | ], false), |
| 226 | 226 | }; |
Test case
24 generated files · +269 −269test/inputs/schema/const-non-string.schema
Mschema-cplusplusdefault / quicktype.hpp+14 −14
| @@ -39,17 +39,25 @@ namespace quicktype { | ||
| 39 | 39 | virtual ~TopLevel() = default; |
| 40 | 40 | |
| 41 | 41 | private: |
| 42 | + double version; | |
| 42 | 43 | int64_t amount; |
| 44 | + double ratio; | |
| 43 | 45 | bool enabled; |
| 44 | 46 | Kind kind; |
| 45 | - double ratio; | |
| 46 | - double version; | |
| 47 | 47 | |
| 48 | 48 | public: |
| 49 | + const double & get_version() const { return version; } | |
| 50 | + double & get_mutable_version() { return version; } | |
| 51 | + void set_version(const double & value) { this->version = value; } | |
| 52 | + | |
| 49 | 53 | const int64_t & get_amount() const { return amount; } |
| 50 | 54 | int64_t & get_mutable_amount() { return amount; } |
| 51 | 55 | void set_amount(const int64_t & value) { this->amount = value; } |
| 52 | 56 | |
| 57 | + const double & get_ratio() const { return ratio; } | |
| 58 | + double & get_mutable_ratio() { return ratio; } | |
| 59 | + void set_ratio(const double & value) { this->ratio = value; } | |
| 60 | + | |
| 53 | 61 | const bool & get_enabled() const { return enabled; } |
| 54 | 62 | bool & get_mutable_enabled() { return enabled; } |
| 55 | 63 | void set_enabled(const bool & value) { this->enabled = value; } |
| @@ -57,14 +65,6 @@ namespace quicktype { | ||
| 57 | 65 | const Kind & get_kind() const { return kind; } |
| 58 | 66 | Kind & get_mutable_kind() { return kind; } |
| 59 | 67 | void set_kind(const Kind & value) { this->kind = value; } |
| 60 | - | |
| 61 | - const double & get_ratio() const { return ratio; } | |
| 62 | - double & get_mutable_ratio() { return ratio; } | |
| 63 | - void set_ratio(const double & value) { this->ratio = value; } | |
| 64 | - | |
| 65 | - const double & get_version() const { return version; } | |
| 66 | - double & get_mutable_version() { return version; } | |
| 67 | - void set_version(const double & value) { this->version = value; } | |
| 68 | 68 | }; |
| 69 | 69 | } |
| 70 | 70 | |
| @@ -76,20 +76,20 @@ namespace quicktype { | ||
| 76 | 76 | void to_json(json & j, const Kind & x); |
| 77 | 77 | |
| 78 | 78 | inline void from_json(const json & j, TopLevel& x) { |
| 79 | + x.set_version(j.at("version").get<double>()); | |
| 79 | 80 | x.set_amount(j.at("amount").get<int64_t>()); |
| 81 | + x.set_ratio(j.at("ratio").get<double>()); | |
| 80 | 82 | x.set_enabled(j.at("enabled").get<bool>()); |
| 81 | 83 | x.set_kind(j.at("kind").get<Kind>()); |
| 82 | - x.set_ratio(j.at("ratio").get<double>()); | |
| 83 | - x.set_version(j.at("version").get<double>()); | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | inline void to_json(json & j, const TopLevel & x) { |
| 87 | 87 | j = json::object(); |
| 88 | + j["version"] = x.get_version(); | |
| 88 | 89 | j["amount"] = x.get_amount(); |
| 90 | + j["ratio"] = x.get_ratio(); | |
| 89 | 91 | j["enabled"] = x.get_enabled(); |
| 90 | 92 | j["kind"] = x.get_kind(); |
| 91 | - j["ratio"] = x.get_ratio(); | |
| 92 | - j["version"] = x.get_version(); | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | inline void from_json(const json & j, Kind & x) { |
Mschema-csharp-recordsdefault / QuickType.cs+6 −6
| @@ -25,20 +25,20 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | + [JsonProperty("version", Required = Required.Always)] | |
| 29 | + public double Version { get; set; } | |
| 30 | + | |
| 28 | 31 | [JsonProperty("amount", Required = Required.Always)] |
| 29 | 32 | public long Amount { get; set; } |
| 30 | 33 | |
| 34 | + [JsonProperty("ratio", Required = Required.Always)] | |
| 35 | + public double Ratio { get; set; } | |
| 36 | + | |
| 31 | 37 | [JsonProperty("enabled", Required = Required.Always)] |
| 32 | 38 | public bool Enabled { get; set; } |
| 33 | 39 | |
| 34 | 40 | [JsonProperty("kind", Required = Required.Always)] |
| 35 | 41 | public Kind Kind { get; set; } |
| 36 | - | |
| 37 | - [JsonProperty("ratio", Required = Required.Always)] | |
| 38 | - public double Ratio { get; set; } | |
| 39 | - | |
| 40 | - [JsonProperty("version", Required = Required.Always)] | |
| 41 | - public double Version { get; set; } | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public enum Kind { Widget }; |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+8 −8
| @@ -22,10 +22,18 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | + [JsonRequired] | |
| 26 | + [JsonPropertyName("version")] | |
| 27 | + public double Version { get; set; } | |
| 28 | + | |
| 25 | 29 | [JsonRequired] |
| 26 | 30 | [JsonPropertyName("amount")] |
| 27 | 31 | public long Amount { get; set; } |
| 28 | 32 | |
| 33 | + [JsonRequired] | |
| 34 | + [JsonPropertyName("ratio")] | |
| 35 | + public double Ratio { get; set; } | |
| 36 | + | |
| 29 | 37 | [JsonRequired] |
| 30 | 38 | [JsonPropertyName("enabled")] |
| 31 | 39 | public bool Enabled { get; set; } |
| @@ -33,14 +41,6 @@ namespace QuickType | ||
| 33 | 41 | [JsonRequired] |
| 34 | 42 | [JsonPropertyName("kind")] |
| 35 | 43 | public Kind Kind { get; set; } |
| 36 | - | |
| 37 | - [JsonRequired] | |
| 38 | - [JsonPropertyName("ratio")] | |
| 39 | - public double Ratio { get; set; } | |
| 40 | - | |
| 41 | - [JsonRequired] | |
| 42 | - [JsonPropertyName("version")] | |
| 43 | - public double Version { get; set; } | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public enum Kind { Widget }; |
Mschema-csharpdefault / QuickType.cs+6 −6
| @@ -25,20 +25,20 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | + [JsonProperty("version", Required = Required.Always)] | |
| 29 | + public double Version { get; set; } | |
| 30 | + | |
| 28 | 31 | [JsonProperty("amount", Required = Required.Always)] |
| 29 | 32 | public long Amount { get; set; } |
| 30 | 33 | |
| 34 | + [JsonProperty("ratio", Required = Required.Always)] | |
| 35 | + public double Ratio { get; set; } | |
| 36 | + | |
| 31 | 37 | [JsonProperty("enabled", Required = Required.Always)] |
| 32 | 38 | public bool Enabled { get; set; } |
| 33 | 39 | |
| 34 | 40 | [JsonProperty("kind", Required = Required.Always)] |
| 35 | 41 | public Kind Kind { get; set; } |
| 36 | - | |
| 37 | - [JsonProperty("ratio", Required = Required.Always)] | |
| 38 | - public double Ratio { get; set; } | |
| 39 | - | |
| 40 | - [JsonProperty("version", Required = Required.Always)] | |
| 41 | - public double Version { get; set; } | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public enum Kind { Widget }; |
Mschema-elixirdefault / QuickType.ex+9 −9
| @@ -51,24 +51,24 @@ defmodule Kind do | ||
| 51 | 51 | end |
| 52 | 52 | |
| 53 | 53 | defmodule TopLevel do |
| 54 | - @enforce_keys [:amount, :enabled, :kind, :ratio, :version] | |
| 55 | - defstruct [:amount, :enabled, :kind, :ratio, :version] | |
| 54 | + @enforce_keys [:version, :amount, :ratio, :enabled, :kind] | |
| 55 | + defstruct [:version, :amount, :ratio, :enabled, :kind] | |
| 56 | 56 | |
| 57 | 57 | @type t :: %__MODULE__{ |
| 58 | + version: float(), | |
| 58 | 59 | amount: integer(), |
| 59 | - enabled: boolean(), | |
| 60 | - kind: Kind.t(), | |
| 61 | 60 | ratio: float(), |
| 62 | - version: float() | |
| 61 | + enabled: boolean(), | |
| 62 | + kind: Kind.t() | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | def from_map(m) do |
| 66 | 66 | %TopLevel{ |
| 67 | + version: m["version"], | |
| 67 | 68 | amount: m["amount"], |
| 69 | + ratio: m["ratio"], | |
| 68 | 70 | enabled: m["enabled"], |
| 69 | 71 | kind: Kind.decode(m["kind"]), |
| 70 | - ratio: m["ratio"], | |
| 71 | - version: m["version"], | |
| 72 | 72 | } |
| 73 | 73 | end |
| 74 | 74 | |
| @@ -80,11 +80,11 @@ defmodule TopLevel do | ||
| 80 | 80 | |
| 81 | 81 | def to_map(struct) do |
| 82 | 82 | %{ |
| 83 | + "version" => struct.version, | |
| 83 | 84 | "amount" => struct.amount, |
| 85 | + "ratio" => struct.ratio, | |
| 84 | 86 | "enabled" => struct.enabled, |
| 85 | 87 | "kind" => Kind.encode(struct.kind), |
| 86 | - "ratio" => struct.ratio, | |
| 87 | - "version" => struct.version, | |
| 88 | 88 | } |
| 89 | 89 | end |
Mschema-elmdefault / QuickType.elm+8 −8
| @@ -24,11 +24,11 @@ import Json.Encode as Jenc | ||
| 24 | 24 | import Dict exposing (Dict) |
| 25 | 25 | |
| 26 | 26 | type alias QuickType = |
| 27 | - { amount : Int | |
| 27 | + { version : Float | |
| 28 | + , amount : Int | |
| 29 | + , ratio : Float | |
| 28 | 30 | , enabled : Bool |
| 29 | 31 | , kind : Kind |
| 30 | - , ratio : Float | |
| 31 | - , version : Float | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | type Kind |
| @@ -42,20 +42,20 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 42 | 42 | quickType : Jdec.Decoder QuickType |
| 43 | 43 | quickType = |
| 44 | 44 | Jdec.succeed QuickType |
| 45 | + |> Jpipe.required "version" Jdec.float | |
| 45 | 46 | |> Jpipe.required "amount" Jdec.int |
| 47 | + |> Jpipe.required "ratio" Jdec.float | |
| 46 | 48 | |> Jpipe.required "enabled" Jdec.bool |
| 47 | 49 | |> Jpipe.required "kind" kind |
| 48 | - |> Jpipe.required "ratio" Jdec.float | |
| 49 | - |> Jpipe.required "version" Jdec.float | |
| 50 | 50 | |
| 51 | 51 | encodeQuickType : QuickType -> Jenc.Value |
| 52 | 52 | encodeQuickType x = |
| 53 | 53 | Jenc.object |
| 54 | - [ ("amount", Jenc.int x.amount) | |
| 54 | + [ ("version", Jenc.float x.version) | |
| 55 | + , ("amount", Jenc.int x.amount) | |
| 56 | + , ("ratio", Jenc.float x.ratio) | |
| 55 | 57 | , ("enabled", Jenc.bool x.enabled) |
| 56 | 58 | , ("kind", encodeKind x.kind) |
| 57 | - , ("ratio", Jenc.float x.ratio) | |
| 58 | - , ("version", Jenc.float x.version) | |
| 59 | 59 | ] |
| 60 | 60 | |
| 61 | 61 | kind : Jdec.Decoder Kind |
Mschema-flowdefault / TopLevel.js+4 −4
| @@ -10,11 +10,11 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | + version: number; | |
| 13 | 14 | amount: number; |
| 15 | + ratio: number; | |
| 14 | 16 | enabled: boolean; |
| 15 | 17 | kind: Kind; |
| 16 | - ratio: number; | |
| 17 | - version: number; | |
| 18 | 18 | [property: string]: mixed; |
| 19 | 19 | }; |
| 20 | 20 | |
| @@ -186,11 +186,11 @@ function r(name: string) { | ||
| 186 | 186 | |
| 187 | 187 | const typeMap: any = { |
| 188 | 188 | "TopLevel": o([ |
| 189 | + { json: "version", js: "version", typ: 3.14 }, | |
| 189 | 190 | { json: "amount", js: "amount", typ: 0 }, |
| 191 | + { json: "ratio", js: "ratio", typ: 3.14 }, | |
| 190 | 192 | { json: "enabled", js: "enabled", typ: true }, |
| 191 | 193 | { json: "kind", js: "kind", typ: r("Kind") }, |
| 192 | - { json: "ratio", js: "ratio", typ: 3.14 }, | |
| 193 | - { json: "version", js: "version", typ: 3.14 }, | |
| 194 | 194 | ], "any"), |
| 195 | 195 | "Kind": [ |
| 196 | 196 | "widget", |
Mschema-golangdefault / quicktype.go+2 −2
| @@ -19,11 +19,11 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | type TopLevel struct { |
| 22 | + Version float64 `json:"version"` | |
| 22 | 23 | Amount int64 `json:"amount"` |
| 24 | + Ratio float64 `json:"ratio"` | |
| 23 | 25 | Enabled bool `json:"enabled"` |
| 24 | 26 | Kind Kind `json:"kind"` |
| 25 | - Ratio float64 `json:"ratio"` | |
| 26 | - Version float64 `json:"version"` | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | type Kind string |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+12 −12
| @@ -3,17 +3,27 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | + private double version; | |
| 6 | 7 | private long amount; |
| 8 | + private double ratio; | |
| 7 | 9 | private boolean enabled; |
| 8 | 10 | private Kind kind; |
| 9 | - private double ratio; | |
| 10 | - private double version; | |
| 11 | + | |
| 12 | + @JsonProperty("version") | |
| 13 | + public double getVersion() { return version; } | |
| 14 | + @JsonProperty("version") | |
| 15 | + public void setVersion(double value) { this.version = value; } | |
| 11 | 16 | |
| 12 | 17 | @JsonProperty("amount") |
| 13 | 18 | public long getAmount() { return amount; } |
| 14 | 19 | @JsonProperty("amount") |
| 15 | 20 | public void setAmount(long value) { this.amount = value; } |
| 16 | 21 | |
| 22 | + @JsonProperty("ratio") | |
| 23 | + public double getRatio() { return ratio; } | |
| 24 | + @JsonProperty("ratio") | |
| 25 | + public void setRatio(double value) { this.ratio = value; } | |
| 26 | + | |
| 17 | 27 | @JsonProperty("enabled") |
| 18 | 28 | public boolean getEnabled() { return enabled; } |
| 19 | 29 | @JsonProperty("enabled") |
| @@ -23,14 +33,4 @@ public class TopLevel { | ||
| 23 | 33 | public Kind getKind() { return kind; } |
| 24 | 34 | @JsonProperty("kind") |
| 25 | 35 | public void setKind(Kind value) { this.kind = value; } |
| 26 | - | |
| 27 | - @JsonProperty("ratio") | |
| 28 | - public double getRatio() { return ratio; } | |
| 29 | - @JsonProperty("ratio") | |
| 30 | - public void setRatio(double value) { this.ratio = value; } | |
| 31 | - | |
| 32 | - @JsonProperty("version") | |
| 33 | - public double getVersion() { return version; } | |
| 34 | - @JsonProperty("version") | |
| 35 | - public void setVersion(double value) { this.version = value; } | |
| 36 | 36 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+12 −12
| @@ -3,17 +3,27 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | + private double version; | |
| 6 | 7 | private long amount; |
| 8 | + private double ratio; | |
| 7 | 9 | private boolean enabled; |
| 8 | 10 | private Kind kind; |
| 9 | - private double ratio; | |
| 10 | - private double version; | |
| 11 | + | |
| 12 | + @JsonProperty("version") | |
| 13 | + public double getVersion() { return version; } | |
| 14 | + @JsonProperty("version") | |
| 15 | + public void setVersion(double value) { this.version = value; } | |
| 11 | 16 | |
| 12 | 17 | @JsonProperty("amount") |
| 13 | 18 | public long getAmount() { return amount; } |
| 14 | 19 | @JsonProperty("amount") |
| 15 | 20 | public void setAmount(long value) { this.amount = value; } |
| 16 | 21 | |
| 22 | + @JsonProperty("ratio") | |
| 23 | + public double getRatio() { return ratio; } | |
| 24 | + @JsonProperty("ratio") | |
| 25 | + public void setRatio(double value) { this.ratio = value; } | |
| 26 | + | |
| 17 | 27 | @JsonProperty("enabled") |
| 18 | 28 | public boolean getEnabled() { return enabled; } |
| 19 | 29 | @JsonProperty("enabled") |
| @@ -23,14 +33,4 @@ public class TopLevel { | ||
| 23 | 33 | public Kind getKind() { return kind; } |
| 24 | 34 | @JsonProperty("kind") |
| 25 | 35 | public void setKind(Kind value) { this.kind = value; } |
| 26 | - | |
| 27 | - @JsonProperty("ratio") | |
| 28 | - public double getRatio() { return ratio; } | |
| 29 | - @JsonProperty("ratio") | |
| 30 | - public void setRatio(double value) { this.ratio = value; } | |
| 31 | - | |
| 32 | - @JsonProperty("version") | |
| 33 | - public double getVersion() { return version; } | |
| 34 | - @JsonProperty("version") | |
| 35 | - public void setVersion(double value) { this.version = value; } | |
| 36 | 36 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+12 −12
| @@ -3,17 +3,27 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | + private double version; | |
| 6 | 7 | private long amount; |
| 8 | + private double ratio; | |
| 7 | 9 | private boolean enabled; |
| 8 | 10 | private Kind kind; |
| 9 | - private double ratio; | |
| 10 | - private double version; | |
| 11 | + | |
| 12 | + @JsonProperty("version") | |
| 13 | + public double getVersion() { return version; } | |
| 14 | + @JsonProperty("version") | |
| 15 | + public void setVersion(double value) { this.version = value; } | |
| 11 | 16 | |
| 12 | 17 | @JsonProperty("amount") |
| 13 | 18 | public long getAmount() { return amount; } |
| 14 | 19 | @JsonProperty("amount") |
| 15 | 20 | public void setAmount(long value) { this.amount = value; } |
| 16 | 21 | |
| 22 | + @JsonProperty("ratio") | |
| 23 | + public double getRatio() { return ratio; } | |
| 24 | + @JsonProperty("ratio") | |
| 25 | + public void setRatio(double value) { this.ratio = value; } | |
| 26 | + | |
| 17 | 27 | @JsonProperty("enabled") |
| 18 | 28 | public boolean getEnabled() { return enabled; } |
| 19 | 29 | @JsonProperty("enabled") |
| @@ -23,14 +33,4 @@ public class TopLevel { | ||
| 23 | 33 | public Kind getKind() { return kind; } |
| 24 | 34 | @JsonProperty("kind") |
| 25 | 35 | public void setKind(Kind value) { this.kind = value; } |
| 26 | - | |
| 27 | - @JsonProperty("ratio") | |
| 28 | - public double getRatio() { return ratio; } | |
| 29 | - @JsonProperty("ratio") | |
| 30 | - public void setRatio(double value) { this.ratio = value; } | |
| 31 | - | |
| 32 | - @JsonProperty("version") | |
| 33 | - public double getVersion() { return version; } | |
| 34 | - @JsonProperty("version") | |
| 35 | - public void setVersion(double value) { this.version = value; } | |
| 36 | 36 | } |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -172,11 +172,11 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | + { json: "version", js: "version", typ: 3.14 }, | |
| 175 | 176 | { json: "amount", js: "amount", typ: 0 }, |
| 177 | + { json: "ratio", js: "ratio", typ: 3.14 }, | |
| 176 | 178 | { json: "enabled", js: "enabled", typ: true }, |
| 177 | 179 | { json: "kind", js: "kind", typ: r("Kind") }, |
| 178 | - { json: "ratio", js: "ratio", typ: 3.14 }, | |
| 179 | - { json: "version", js: "version", typ: 3.14 }, | |
| 180 | 180 | ], "any"), |
| 181 | 181 | "Kind": [ |
| 182 | 182 | "widget", |
Mschema-kotlin-jacksondefault / TopLevel.kt+5 −5
| @@ -32,19 +32,19 @@ val mapper = jacksonObjectMapper().apply { | ||
| 32 | 32 | |
| 33 | 33 | data class TopLevel ( |
| 34 | 34 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 35 | - val amount: Long, | |
| 35 | + val version: Double, | |
| 36 | 36 | |
| 37 | 37 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 38 | - val enabled: Boolean, | |
| 38 | + val amount: Long, | |
| 39 | 39 | |
| 40 | 40 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 41 | - val kind: Kind, | |
| 41 | + val ratio: Double, | |
| 42 | 42 | |
| 43 | 43 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 44 | - val ratio: Double, | |
| 44 | + val enabled: Boolean, | |
| 45 | 45 | |
| 46 | 46 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 47 | - val version: Double | |
| 47 | + val kind: Kind | |
| 48 | 48 | ) { |
| 49 | 49 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+3 −3
| @@ -18,11 +18,11 @@ private val klaxon = Klaxon() | ||
| 18 | 18 | .convert(Kind::class, { Kind.fromValue(it.string!!) }, { "\"${it.value}\"" }) |
| 19 | 19 | |
| 20 | 20 | data class TopLevel ( |
| 21 | + val version: Double, | |
| 21 | 22 | val amount: Long, |
| 22 | - val enabled: Boolean, | |
| 23 | - val kind: Kind, | |
| 24 | 23 | val ratio: Double, |
| 25 | - val version: Double | |
| 24 | + val enabled: Boolean, | |
| 25 | + val kind: Kind | |
| 26 | 26 | ) { |
| 27 | 27 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-kotlinxdefault / TopLevel.kt+3 −3
| @@ -12,11 +12,11 @@ import kotlinx.serialization.encoding.* | ||
| 12 | 12 | |
| 13 | 13 | @Serializable |
| 14 | 14 | data class TopLevel ( |
| 15 | + val version: Double, | |
| 15 | 16 | val amount: Long, |
| 16 | - val enabled: Boolean, | |
| 17 | - val kind: Kind, | |
| 18 | 17 | val ratio: Double, |
| 19 | - val version: Double | |
| 18 | + val enabled: Boolean, | |
| 19 | + val kind: Kind | |
| 20 | 20 | ) |
| 21 | 21 | |
| 22 | 22 | @Serializable |
Mschema-phpdefault / TopLevel.php+115 −115
| @@ -4,261 +4,261 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | + private float $version; // json:version Required | |
| 7 | 8 | private int $amount; // json:amount Required |
| 9 | + private float $ratio; // json:ratio Required | |
| 8 | 10 | private bool $enabled; // json:enabled Required |
| 9 | 11 | private Kind $kind; // json:kind Required |
| 10 | - private float $ratio; // json:ratio Required | |
| 11 | - private float $version; // json:version Required | |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | + * @param float $version | |
| 14 | 15 | * @param int $amount |
| 16 | + * @param float $ratio | |
| 15 | 17 | * @param bool $enabled |
| 16 | 18 | * @param Kind $kind |
| 17 | - * @param float $ratio | |
| 18 | - * @param float $version | |
| 19 | 19 | */ |
| 20 | - public function __construct(int $amount, bool $enabled, Kind $kind, float $ratio, float $version) { | |
| 20 | + public function __construct(float $version, int $amount, float $ratio, bool $enabled, Kind $kind) { | |
| 21 | + $this->version = $version; | |
| 21 | 22 | $this->amount = $amount; |
| 23 | + $this->ratio = $ratio; | |
| 22 | 24 | $this->enabled = $enabled; |
| 23 | 25 | $this->kind = $kind; |
| 24 | - $this->ratio = $ratio; | |
| 25 | - $this->version = $version; | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * @param int $value | |
| 29 | + * @param float $value | |
| 30 | 30 | * @throws Exception |
| 31 | - * @return int | |
| 31 | + * @return float | |
| 32 | 32 | */ |
| 33 | - public static function fromAmount(int $value): int { | |
| 34 | - return $value; /*int*/ | |
| 33 | + public static function fromVersion(float $value): float { | |
| 34 | + return $value; /*float*/ | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @throws Exception |
| 39 | - * @return int | |
| 39 | + * @return float | |
| 40 | 40 | */ |
| 41 | - public function toAmount(): int { | |
| 42 | - if (TopLevel::validateAmount($this->amount)) { | |
| 43 | - return $this->amount; /*int*/ | |
| 41 | + public function toVersion(): float { | |
| 42 | + if (TopLevel::validateVersion($this->version)) { | |
| 43 | + return $this->version; /*float*/ | |
| 44 | 44 | } |
| 45 | - throw new Exception('never get to this TopLevel::amount'); | |
| 45 | + throw new Exception('never get to this TopLevel::version'); | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * @param int | |
| 49 | + * @param float | |
| 50 | 50 | * @return bool |
| 51 | 51 | * @throws Exception |
| 52 | 52 | */ |
| 53 | - public static function validateAmount(int $value): bool { | |
| 53 | + public static function validateVersion(float $value): bool { | |
| 54 | 54 | return true; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * @throws Exception |
| 59 | - * @return int | |
| 59 | + * @return float | |
| 60 | 60 | */ |
| 61 | - public function getAmount(): int { | |
| 62 | - if (TopLevel::validateAmount($this->amount)) { | |
| 63 | - return $this->amount; | |
| 61 | + public function getVersion(): float { | |
| 62 | + if (TopLevel::validateVersion($this->version)) { | |
| 63 | + return $this->version; | |
| 64 | 64 | } |
| 65 | - throw new Exception('never get to getAmount TopLevel::amount'); | |
| 65 | + throw new Exception('never get to getVersion TopLevel::version'); | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | - * @return int | |
| 69 | + * @return float | |
| 70 | 70 | */ |
| 71 | - public static function sampleAmount(): int { | |
| 72 | - return 31; /*31:amount*/ | |
| 71 | + public static function sampleVersion(): float { | |
| 72 | + return 31.031; /*31:version*/ | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | - * @param bool $value | |
| 76 | + * @param int $value | |
| 77 | 77 | * @throws Exception |
| 78 | - * @return bool | |
| 78 | + * @return int | |
| 79 | 79 | */ |
| 80 | - public static function fromEnabled(bool $value): bool { | |
| 81 | - return $value; /*bool*/ | |
| 80 | + public static function fromAmount(int $value): int { | |
| 81 | + return $value; /*int*/ | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * @throws Exception |
| 86 | - * @return bool | |
| 86 | + * @return int | |
| 87 | 87 | */ |
| 88 | - public function toEnabled(): bool { | |
| 89 | - if (TopLevel::validateEnabled($this->enabled)) { | |
| 90 | - return $this->enabled; /*bool*/ | |
| 88 | + public function toAmount(): int { | |
| 89 | + if (TopLevel::validateAmount($this->amount)) { | |
| 90 | + return $this->amount; /*int*/ | |
| 91 | 91 | } |
| 92 | - throw new Exception('never get to this TopLevel::enabled'); | |
| 92 | + throw new Exception('never get to this TopLevel::amount'); | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | - * @param bool | |
| 96 | + * @param int | |
| 97 | 97 | * @return bool |
| 98 | 98 | * @throws Exception |
| 99 | 99 | */ |
| 100 | - public static function validateEnabled(bool $value): bool { | |
| 100 | + public static function validateAmount(int $value): bool { | |
| 101 | 101 | return true; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * @throws Exception |
| 106 | - * @return bool | |
| 106 | + * @return int | |
| 107 | 107 | */ |
| 108 | - public function getEnabled(): bool { | |
| 109 | - if (TopLevel::validateEnabled($this->enabled)) { | |
| 110 | - return $this->enabled; | |
| 108 | + public function getAmount(): int { | |
| 109 | + if (TopLevel::validateAmount($this->amount)) { | |
| 110 | + return $this->amount; | |
| 111 | 111 | } |
| 112 | - throw new Exception('never get to getEnabled TopLevel::enabled'); | |
| 112 | + throw new Exception('never get to getAmount TopLevel::amount'); | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | - * @return bool | |
| 116 | + * @return int | |
| 117 | 117 | */ |
| 118 | - public static function sampleEnabled(): bool { | |
| 119 | - return true; /*32:enabled*/ | |
| 118 | + public static function sampleAmount(): int { | |
| 119 | + return 32; /*32:amount*/ | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | - * @param string $value | |
| 123 | + * @param float $value | |
| 124 | 124 | * @throws Exception |
| 125 | - * @return Kind | |
| 125 | + * @return float | |
| 126 | 126 | */ |
| 127 | - public static function fromKind(string $value): Kind { | |
| 128 | - return Kind::from($value); /*enum*/ | |
| 127 | + public static function fromRatio(float $value): float { | |
| 128 | + return $value; /*float*/ | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | 132 | * @throws Exception |
| 133 | - * @return string | |
| 133 | + * @return float | |
| 134 | 134 | */ |
| 135 | - public function toKind(): string { | |
| 136 | - if (TopLevel::validateKind($this->kind)) { | |
| 137 | - return Kind::to($this->kind); /*enum*/ | |
| 135 | + public function toRatio(): float { | |
| 136 | + if (TopLevel::validateRatio($this->ratio)) { | |
| 137 | + return $this->ratio; /*float*/ | |
| 138 | 138 | } |
| 139 | - throw new Exception('never get to this TopLevel::kind'); | |
| 139 | + throw new Exception('never get to this TopLevel::ratio'); | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | - * @param Kind | |
| 143 | + * @param float | |
| 144 | 144 | * @return bool |
| 145 | 145 | * @throws Exception |
| 146 | 146 | */ |
| 147 | - public static function validateKind(Kind $value): bool { | |
| 148 | - Kind::to($value); | |
| 147 | + public static function validateRatio(float $value): bool { | |
| 149 | 148 | return true; |
| 150 | 149 | } |
| 151 | 150 | |
| 152 | 151 | /** |
| 153 | 152 | * @throws Exception |
| 154 | - * @return Kind | |
| 153 | + * @return float | |
| 155 | 154 | */ |
| 156 | - public function getKind(): Kind { | |
| 157 | - if (TopLevel::validateKind($this->kind)) { | |
| 158 | - return $this->kind; | |
| 155 | + public function getRatio(): float { | |
| 156 | + if (TopLevel::validateRatio($this->ratio)) { | |
| 157 | + return $this->ratio; | |
| 159 | 158 | } |
| 160 | - throw new Exception('never get to getKind TopLevel::kind'); | |
| 159 | + throw new Exception('never get to getRatio TopLevel::ratio'); | |
| 161 | 160 | } |
| 162 | 161 | |
| 163 | 162 | /** |
| 164 | - * @return Kind | |
| 163 | + * @return float | |
| 165 | 164 | */ |
| 166 | - public static function sampleKind(): Kind { | |
| 167 | - return Kind::sample(); /*enum*/ | |
| 165 | + public static function sampleRatio(): float { | |
| 166 | + return 33.033; /*33:ratio*/ | |
| 168 | 167 | } |
| 169 | 168 | |
| 170 | 169 | /** |
| 171 | - * @param float $value | |
| 170 | + * @param bool $value | |
| 172 | 171 | * @throws Exception |
| 173 | - * @return float | |
| 172 | + * @return bool | |
| 174 | 173 | */ |
| 175 | - public static function fromRatio(float $value): float { | |
| 176 | - return $value; /*float*/ | |
| 174 | + public static function fromEnabled(bool $value): bool { | |
| 175 | + return $value; /*bool*/ | |
| 177 | 176 | } |
| 178 | 177 | |
| 179 | 178 | /** |
| 180 | 179 | * @throws Exception |
| 181 | - * @return float | |
| 180 | + * @return bool | |
| 182 | 181 | */ |
| 183 | - public function toRatio(): float { | |
| 184 | - if (TopLevel::validateRatio($this->ratio)) { | |
| 185 | - return $this->ratio; /*float*/ | |
| 182 | + public function toEnabled(): bool { | |
| 183 | + if (TopLevel::validateEnabled($this->enabled)) { | |
| 184 | + return $this->enabled; /*bool*/ | |
| 186 | 185 | } |
| 187 | - throw new Exception('never get to this TopLevel::ratio'); | |
| 186 | + throw new Exception('never get to this TopLevel::enabled'); | |
| 188 | 187 | } |
| 189 | 188 | |
| 190 | 189 | /** |
| 191 | - * @param float | |
| 190 | + * @param bool | |
| 192 | 191 | * @return bool |
| 193 | 192 | * @throws Exception |
| 194 | 193 | */ |
| 195 | - public static function validateRatio(float $value): bool { | |
| 194 | + public static function validateEnabled(bool $value): bool { | |
| 196 | 195 | return true; |
| 197 | 196 | } |
| 198 | 197 | |
| 199 | 198 | /** |
| 200 | 199 | * @throws Exception |
| 201 | - * @return float | |
| 200 | + * @return bool | |
| 202 | 201 | */ |
| 203 | - public function getRatio(): float { | |
| 204 | - if (TopLevel::validateRatio($this->ratio)) { | |
| 205 | - return $this->ratio; | |
| 202 | + public function getEnabled(): bool { | |
| 203 | + if (TopLevel::validateEnabled($this->enabled)) { | |
| 204 | + return $this->enabled; | |
| 206 | 205 | } |
| 207 | - throw new Exception('never get to getRatio TopLevel::ratio'); | |
| 206 | + throw new Exception('never get to getEnabled TopLevel::enabled'); | |
| 208 | 207 | } |
| 209 | 208 | |
| 210 | 209 | /** |
| 211 | - * @return float | |
| 210 | + * @return bool | |
| 212 | 211 | */ |
| 213 | - public static function sampleRatio(): float { | |
| 214 | - return 34.034; /*34:ratio*/ | |
| 212 | + public static function sampleEnabled(): bool { | |
| 213 | + return true; /*34:enabled*/ | |
| 215 | 214 | } |
| 216 | 215 | |
| 217 | 216 | /** |
| 218 | - * @param float $value | |
| 217 | + * @param string $value | |
| 219 | 218 | * @throws Exception |
| 220 | - * @return float | |
| 219 | + * @return Kind | |
| 221 | 220 | */ |
| 222 | - public static function fromVersion(float $value): float { | |
| 223 | - return $value; /*float*/ | |
| 221 | + public static function fromKind(string $value): Kind { | |
| 222 | + return Kind::from($value); /*enum*/ | |
| 224 | 223 | } |
| 225 | 224 | |
| 226 | 225 | /** |
| 227 | 226 | * @throws Exception |
| 228 | - * @return float | |
| 227 | + * @return string | |
| 229 | 228 | */ |
| 230 | - public function toVersion(): float { | |
| 231 | - if (TopLevel::validateVersion($this->version)) { | |
| 232 | - return $this->version; /*float*/ | |
| 229 | + public function toKind(): string { | |
| 230 | + if (TopLevel::validateKind($this->kind)) { | |
| 231 | + return Kind::to($this->kind); /*enum*/ | |
| 233 | 232 | } |
| 234 | - throw new Exception('never get to this TopLevel::version'); | |
| 233 | + throw new Exception('never get to this TopLevel::kind'); | |
| 235 | 234 | } |
| 236 | 235 | |
| 237 | 236 | /** |
| 238 | - * @param float | |
| 237 | + * @param Kind | |
| 239 | 238 | * @return bool |
| 240 | 239 | * @throws Exception |
| 241 | 240 | */ |
| 242 | - public static function validateVersion(float $value): bool { | |
| 241 | + public static function validateKind(Kind $value): bool { | |
| 242 | + Kind::to($value); | |
| 243 | 243 | return true; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
| 247 | 247 | * @throws Exception |
| 248 | - * @return float | |
| 248 | + * @return Kind | |
| 249 | 249 | */ |
| 250 | - public function getVersion(): float { | |
| 251 | - if (TopLevel::validateVersion($this->version)) { | |
| 252 | - return $this->version; | |
| 250 | + public function getKind(): Kind { | |
| 251 | + if (TopLevel::validateKind($this->kind)) { | |
| 252 | + return $this->kind; | |
| 253 | 253 | } |
| 254 | - throw new Exception('never get to getVersion TopLevel::version'); | |
| 254 | + throw new Exception('never get to getKind TopLevel::kind'); | |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /** |
| 258 | - * @return float | |
| 258 | + * @return Kind | |
| 259 | 259 | */ |
| 260 | - public static function sampleVersion(): float { | |
| 261 | - return 35.035; /*35:version*/ | |
| 260 | + public static function sampleKind(): Kind { | |
| 261 | + return Kind::sample(); /*enum*/ | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /** |
| @@ -266,11 +266,11 @@ class TopLevel { | ||
| 266 | 266 | * @return bool |
| 267 | 267 | */ |
| 268 | 268 | public function validate(): bool { |
| 269 | - return TopLevel::validateAmount($this->amount) | |
| 270 | - || TopLevel::validateEnabled($this->enabled) | |
| 271 | - || TopLevel::validateKind($this->kind) | |
| 269 | + return TopLevel::validateVersion($this->version) | |
| 270 | + || TopLevel::validateAmount($this->amount) | |
| 272 | 271 | || TopLevel::validateRatio($this->ratio) |
| 273 | - || TopLevel::validateVersion($this->version); | |
| 272 | + || TopLevel::validateEnabled($this->enabled) | |
| 273 | + || TopLevel::validateKind($this->kind); | |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** |
| @@ -279,11 +279,11 @@ class TopLevel { | ||
| 279 | 279 | */ |
| 280 | 280 | public function to(): stdClass { |
| 281 | 281 | $out = new stdClass(); |
| 282 | + $out->{'version'} = $this->toVersion(); | |
| 282 | 283 | $out->{'amount'} = $this->toAmount(); |
| 284 | + $out->{'ratio'} = $this->toRatio(); | |
| 283 | 285 | $out->{'enabled'} = $this->toEnabled(); |
| 284 | 286 | $out->{'kind'} = $this->toKind(); |
| 285 | - $out->{'ratio'} = $this->toRatio(); | |
| 286 | - $out->{'version'} = $this->toVersion(); | |
| 287 | 287 | return $out; |
| 288 | 288 | } |
| 289 | 289 | |
| @@ -294,11 +294,11 @@ class TopLevel { | ||
| 294 | 294 | */ |
| 295 | 295 | public static function from(stdClass $obj): TopLevel { |
| 296 | 296 | return new TopLevel( |
| 297 | - TopLevel::fromAmount($obj->{'amount'}) | |
| 297 | + TopLevel::fromVersion($obj->{'version'}) | |
| 298 | + ,TopLevel::fromAmount($obj->{'amount'}) | |
| 299 | + ,TopLevel::fromRatio($obj->{'ratio'}) | |
| 298 | 300 | ,TopLevel::fromEnabled($obj->{'enabled'}) |
| 299 | 301 | ,TopLevel::fromKind($obj->{'kind'}) |
| 300 | - ,TopLevel::fromRatio($obj->{'ratio'}) | |
| 301 | - ,TopLevel::fromVersion($obj->{'version'}) | |
| 302 | 302 | ); |
| 303 | 303 | } |
| 304 | 304 | |
| @@ -307,11 +307,11 @@ class TopLevel { | ||
| 307 | 307 | */ |
| 308 | 308 | public static function sample(): TopLevel { |
| 309 | 309 | return new TopLevel( |
| 310 | - TopLevel::sampleAmount() | |
| 310 | + TopLevel::sampleVersion() | |
| 311 | + ,TopLevel::sampleAmount() | |
| 312 | + ,TopLevel::sampleRatio() | |
| 311 | 313 | ,TopLevel::sampleEnabled() |
| 312 | 314 | ,TopLevel::sampleKind() |
| 313 | - ,TopLevel::sampleRatio() | |
| 314 | - ,TopLevel::sampleVersion() | |
| 315 | 315 | ); |
| 316 | 316 | } |
| 317 | 317 | } |
Mschema-pikedefault / TopLevel.pmod+6 −6
| @@ -13,19 +13,19 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | + float version; // json: "version" | |
| 16 | 17 | int amount; // json: "amount" |
| 18 | + float ratio; // json: "ratio" | |
| 17 | 19 | bool enabled; // json: "enabled" |
| 18 | 20 | Kind kind; // json: "kind" |
| 19 | - float ratio; // json: "ratio" | |
| 20 | - float version; // json: "version" | |
| 21 | 21 | |
| 22 | 22 | string encode_json() { |
| 23 | 23 | mapping(string:mixed) json = ([ |
| 24 | + "version" : version, | |
| 24 | 25 | "amount" : amount, |
| 26 | + "ratio" : ratio, | |
| 25 | 27 | "enabled" : enabled, |
| 26 | 28 | "kind" : kind, |
| 27 | - "ratio" : ratio, | |
| 28 | - "version" : version, | |
| 29 | 29 | ]); |
| 30 | 30 | |
| 31 | 31 | return Standards.JSON.encode(json); |
| @@ -35,11 +35,11 @@ class TopLevel { | ||
| 35 | 35 | TopLevel TopLevel_from_JSON(mixed json) { |
| 36 | 36 | TopLevel retval = TopLevel(); |
| 37 | 37 | |
| 38 | + retval.version = json["version"]; | |
| 38 | 39 | retval.amount = json["amount"]; |
| 40 | + retval.ratio = json["ratio"]; | |
| 39 | 41 | retval.enabled = json["enabled"]; |
| 40 | 42 | retval.kind = json["kind"]; |
| 41 | - retval.ratio = json["ratio"]; | |
| 42 | - retval.version = json["version"]; | |
| 43 | 43 | |
| 44 | 44 | return retval; |
| 45 | 45 | } |
Mschema-pythondefault / quicktype.py+15 −15
| @@ -7,6 +7,11 @@ T = TypeVar("T") | ||
| 7 | 7 | EnumT = TypeVar("EnumT", bound=Enum) |
| 8 | 8 | |
| 9 | 9 | |
| 10 | +def from_float(x: Any) -> float: | |
| 11 | + assert isinstance(x, (float, int)) and not isinstance(x, bool) | |
| 12 | + return float(x) | |
| 13 | + | |
| 14 | + | |
| 10 | 15 | def from_int(x: Any) -> int: |
| 11 | 16 | assert isinstance(x, int) and not isinstance(x, bool) |
| 12 | 17 | return x |
| @@ -17,9 +22,9 @@ def from_bool(x: Any) -> bool: | ||
| 17 | 22 | return x |
| 18 | 23 | |
| 19 | 24 | |
| 20 | -def from_float(x: Any) -> float: | |
| 21 | - assert isinstance(x, (float, int)) and not isinstance(x, bool) | |
| 22 | - return float(x) | |
| 25 | +def to_float(x: Any) -> float: | |
| 26 | + assert isinstance(x, (int, float)) | |
| 27 | + return x | |
| 23 | 28 | |
| 24 | 29 | |
| 25 | 30 | def to_enum(c: Type[EnumT], x: Any) -> EnumT: |
| @@ -27,11 +32,6 @@ def to_enum(c: Type[EnumT], x: Any) -> EnumT: | ||
| 27 | 32 | return x.value |
| 28 | 33 | |
| 29 | 34 | |
| 30 | -def to_float(x: Any) -> float: | |
| 31 | - assert isinstance(x, (int, float)) | |
| 32 | - return x | |
| 33 | - | |
| 34 | - | |
| 35 | 35 | def to_class(c: Type[T], x: Any) -> dict: |
| 36 | 36 | assert isinstance(x, c) |
| 37 | 37 | return cast(Any, x).to_dict() |
| @@ -43,29 +43,29 @@ class Kind(Enum): | ||
| 43 | 43 | |
| 44 | 44 | @dataclass |
| 45 | 45 | class TopLevel: |
| 46 | + version: float | |
| 46 | 47 | amount: int |
| 48 | + ratio: float | |
| 47 | 49 | enabled: bool |
| 48 | 50 | kind: Kind |
| 49 | - ratio: float | |
| 50 | - version: float | |
| 51 | 51 | |
| 52 | 52 | @staticmethod |
| 53 | 53 | def from_dict(obj: Any) -> 'TopLevel': |
| 54 | 54 | assert isinstance(obj, dict) |
| 55 | + version = from_float(obj.get("version")) | |
| 55 | 56 | amount = from_int(obj.get("amount")) |
| 57 | + ratio = from_float(obj.get("ratio")) | |
| 56 | 58 | enabled = from_bool(obj.get("enabled")) |
| 57 | 59 | kind = Kind(obj.get("kind")) |
| 58 | - ratio = from_float(obj.get("ratio")) | |
| 59 | - version = from_float(obj.get("version")) | |
| 60 | - return TopLevel(amount, enabled, kind, ratio, version) | |
| 60 | + return TopLevel(version, amount, ratio, enabled, kind) | |
| 61 | 61 | |
| 62 | 62 | def to_dict(self) -> dict: |
| 63 | 63 | result: dict = {} |
| 64 | + result["version"] = to_float(self.version) | |
| 64 | 65 | result["amount"] = from_int(self.amount) |
| 66 | + result["ratio"] = to_float(self.ratio) | |
| 65 | 67 | result["enabled"] = from_bool(self.enabled) |
| 66 | 68 | result["kind"] = to_enum(Kind, self.kind) |
| 67 | - result["ratio"] = to_float(self.ratio) | |
| 68 | - result["version"] = to_float(self.version) | |
| 69 | 69 | return result |
Mschema-rubydefault / TopLevel.rb+7 −7
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.amount.even? | |
| 7 | +# puts top_level.version | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -28,20 +28,20 @@ module Kind | ||
| 28 | 28 | end |
| 29 | 29 | |
| 30 | 30 | class TopLevel < Dry::Struct |
| 31 | + attribute :version, Types::Double | |
| 31 | 32 | attribute :amount, Types::Integer |
| 33 | + attribute :ratio, Types::Double | |
| 32 | 34 | attribute :enabled, Types::Bool |
| 33 | 35 | attribute :kind, Types::Kind |
| 34 | - attribute :ratio, Types::Double | |
| 35 | - attribute :version, Types::Double | |
| 36 | 36 | |
| 37 | 37 | def self.from_dynamic!(d) |
| 38 | 38 | d = Types::Hash[d] |
| 39 | 39 | new( |
| 40 | + version: d.fetch("version"), | |
| 40 | 41 | amount: d.fetch("amount"), |
| 42 | + ratio: d.fetch("ratio"), | |
| 41 | 43 | enabled: d.fetch("enabled"), |
| 42 | 44 | kind: d.fetch("kind"), |
| 43 | - ratio: d.fetch("ratio"), | |
| 44 | - version: d.fetch("version"), | |
| 45 | 45 | ) |
| 46 | 46 | end |
| 47 | 47 | |
| @@ -51,11 +51,11 @@ class TopLevel < Dry::Struct | ||
| 51 | 51 | |
| 52 | 52 | def to_dynamic |
| 53 | 53 | { |
| 54 | + "version" => version, | |
| 54 | 55 | "amount" => amount, |
| 56 | + "ratio" => ratio, | |
| 55 | 57 | "enabled" => enabled, |
| 56 | 58 | "kind" => kind, |
| 57 | - "ratio" => ratio, | |
| 58 | - "version" => version, | |
| 59 | 59 | } |
| 60 | 60 | end |
Mschema-rustdefault / module_under_test.rs+4 −4
| @@ -15,15 +15,15 @@ use serde::{Serialize, Deserialize}; | ||
| 15 | 15 | |
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | pub struct TopLevel { |
| 18 | + pub version: f64, | |
| 19 | + | |
| 18 | 20 | pub amount: i64, |
| 19 | 21 | |
| 22 | + pub ratio: f64, | |
| 23 | + | |
| 20 | 24 | pub enabled: bool, |
| 21 | 25 | |
| 22 | 26 | pub kind: Kind, |
| 23 | - | |
| 24 | - pub ratio: f64, | |
| 25 | - | |
| 26 | - pub version: f64, | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | #[derive(Debug, Clone, Serialize, Deserialize)] |
Mschema-scala3-upickledefault / TopLevel.scala+3 −3
| @@ -66,11 +66,11 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | + val version : Double, | |
| 69 | 70 | val amount : Long, |
| 70 | - val enabled : Boolean, | |
| 71 | - val kind : Kind, | |
| 72 | 71 | val ratio : Double, |
| 73 | - val version : Double | |
| 72 | + val enabled : Boolean, | |
| 73 | + val kind : Kind | |
| 74 | 74 | ) derives OptionPickler.ReadWriter |
| 75 | 75 | |
| 76 | 76 | enum Kind : |
Mschema-scala3default / TopLevel.scala+3 −3
| @@ -8,11 +8,11 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | + val version : Double, | |
| 11 | 12 | val amount : Long, |
| 12 | - val enabled : Boolean, | |
| 13 | - val kind : Kind, | |
| 14 | 13 | val ratio : Double, |
| 15 | - val version : Double | |
| 14 | + val enabled : Boolean, | |
| 15 | + val kind : Kind | |
| 16 | 16 | ) derives Encoder.AsObject, Decoder |
| 17 | 17 | |
| 18 | 18 | enum Kind : |
Mschema-schemadefault / TopLevel.schema+6 −6
| @@ -6,20 +6,20 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": {}, |
| 8 | 8 | "properties": { |
| 9 | + "version": { | |
| 10 | + "type": "number" | |
| 11 | + }, | |
| 9 | 12 | "amount": { |
| 10 | 13 | "type": "integer" |
| 11 | 14 | }, |
| 15 | + "ratio": { | |
| 16 | + "type": "number" | |
| 17 | + }, | |
| 12 | 18 | "enabled": { |
| 13 | 19 | "type": "boolean" |
| 14 | 20 | }, |
| 15 | 21 | "kind": { |
| 16 | 22 | "$ref": "#/definitions/Kind" |
| 17 | - }, | |
| 18 | - "ratio": { | |
| 19 | - "type": "number" | |
| 20 | - }, | |
| 21 | - "version": { | |
| 22 | - "type": "number" | |
| 23 | 23 | } |
| 24 | 24 | }, |
| 25 | 25 | "required": [ |
Mschema-typescriptdefault / TopLevel.ts+4 −4
| @@ -8,11 +8,11 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | + version: number; | |
| 11 | 12 | amount: number; |
| 13 | + ratio: number; | |
| 12 | 14 | enabled: boolean; |
| 13 | 15 | kind: Kind; |
| 14 | - ratio: number; | |
| 15 | - version: number; | |
| 16 | 16 | [property: string]: unknown; |
| 17 | 17 | } |
| 18 | 18 | |
| @@ -185,11 +185,11 @@ function r(name: string) { | ||
| 185 | 185 | |
| 186 | 186 | const typeMap: any = { |
| 187 | 187 | "TopLevel": o([ |
| 188 | + { json: "version", js: "version", typ: 3.14 }, | |
| 188 | 189 | { json: "amount", js: "amount", typ: 0 }, |
| 190 | + { json: "ratio", js: "ratio", typ: 3.14 }, | |
| 189 | 191 | { json: "enabled", js: "enabled", typ: true }, |
| 190 | 192 | { json: "kind", js: "kind", typ: r("Kind") }, |
| 191 | - { json: "ratio", js: "ratio", typ: 3.14 }, | |
| 192 | - { json: "version", js: "version", typ: 3.14 }, | |
| 193 | 193 | ], "any"), |
| 194 | 194 | "Kind": [ |
| 195 | 195 | "widget", |
Test case
29 generated files · +175 −175test/inputs/schema/date-time-or-string.schema
Mschema-cjsondefault / TopLevel.c+17 −17
| @@ -22,14 +22,6 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 22 | 22 | if (NULL != j) { |
| 23 | 23 | if (NULL != (x = cJSON_malloc(sizeof(struct TopLevel)))) { |
| 24 | 24 | memset(x, 0, sizeof(struct TopLevel)); |
| 25 | - if (cJSON_HasObjectItem(j, "bar")) { | |
| 26 | - x->bar = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "bar"))); | |
| 27 | - } | |
| 28 | - else { | |
| 29 | - if (NULL != (x->bar = cJSON_malloc(sizeof(char)))) { | |
| 30 | - x->bar[0] = '\0'; | |
| 31 | - } | |
| 32 | - } | |
| 33 | 25 | if (cJSON_HasObjectItem(j, "foo")) { |
| 34 | 26 | x->foo = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "foo"))); |
| 35 | 27 | } |
| @@ -38,6 +30,14 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 38 | 30 | x->foo[0] = '\0'; |
| 39 | 31 | } |
| 40 | 32 | } |
| 33 | + if (cJSON_HasObjectItem(j, "bar")) { | |
| 34 | + x->bar = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "bar"))); | |
| 35 | + } | |
| 36 | + else { | |
| 37 | + if (NULL != (x->bar = cJSON_malloc(sizeof(char)))) { | |
| 38 | + x->bar[0] = '\0'; | |
| 39 | + } | |
| 40 | + } | |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | return x; |
| @@ -47,18 +47,18 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 47 | 47 | cJSON * j = NULL; |
| 48 | 48 | if (NULL != x) { |
| 49 | 49 | if (NULL != (j = cJSON_CreateObject())) { |
| 50 | - if (NULL != x->bar) { | |
| 51 | - cJSON_AddStringToObject(j, "bar", x->bar); | |
| 52 | - } | |
| 53 | - else { | |
| 54 | - cJSON_AddStringToObject(j, "bar", ""); | |
| 55 | - } | |
| 56 | 50 | if (NULL != x->foo) { |
| 57 | 51 | cJSON_AddStringToObject(j, "foo", x->foo); |
| 58 | 52 | } |
| 59 | 53 | else { |
| 60 | 54 | cJSON_AddStringToObject(j, "foo", ""); |
| 61 | 55 | } |
| 56 | + if (NULL != x->bar) { | |
| 57 | + cJSON_AddStringToObject(j, "bar", x->bar); | |
| 58 | + } | |
| 59 | + else { | |
| 60 | + cJSON_AddStringToObject(j, "bar", ""); | |
| 61 | + } | |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | return j; |
| @@ -78,12 +78,12 @@ char * cJSON_PrintTopLevel(const struct TopLevel * x) { | ||
| 78 | 78 | |
| 79 | 79 | void cJSON_DeleteTopLevel(struct TopLevel * x) { |
| 80 | 80 | if (NULL != x) { |
| 81 | - if (NULL != x->bar) { | |
| 82 | - cJSON_free(x->bar); | |
| 83 | - } | |
| 84 | 81 | if (NULL != x->foo) { |
| 85 | 82 | cJSON_free(x->foo); |
| 86 | 83 | } |
| 84 | + if (NULL != x->bar) { | |
| 85 | + cJSON_free(x->bar); | |
| 86 | + } | |
| 87 | 87 | cJSON_free(x); |
| 88 | 88 | } |
| 89 | 89 | } |
Mschema-cjsondefault / TopLevel.h+1 −1
| @@ -35,8 +35,8 @@ extern "C" { | ||
| 35 | 35 | #endif |
| 36 | 36 | |
| 37 | 37 | struct TopLevel { |
| 38 | - char * bar; | |
| 39 | 38 | char * foo; |
| 39 | + char * bar; | |
| 40 | 40 | }; |
| 41 | 41 | |
| 42 | 42 | struct TopLevel * cJSON_ParseTopLevel(const char * s); |
Mschema-cplusplusdefault / quicktype.hpp+7 −7
| @@ -37,17 +37,17 @@ namespace quicktype { | ||
| 37 | 37 | virtual ~TopLevel() = default; |
| 38 | 38 | |
| 39 | 39 | private: |
| 40 | - std::string bar; | |
| 41 | 40 | std::string foo; |
| 41 | + std::string bar; | |
| 42 | 42 | |
| 43 | 43 | public: |
| 44 | - const std::string & get_bar() const { return bar; } | |
| 45 | - std::string & get_mutable_bar() { return bar; } | |
| 46 | - void set_bar(const std::string & value) { this->bar = value; } | |
| 47 | - | |
| 48 | 44 | const std::string & get_foo() const { return foo; } |
| 49 | 45 | std::string & get_mutable_foo() { return foo; } |
| 50 | 46 | void set_foo(const std::string & value) { this->foo = value; } |
| 47 | + | |
| 48 | + const std::string & get_bar() const { return bar; } | |
| 49 | + std::string & get_mutable_bar() { return bar; } | |
| 50 | + void set_bar(const std::string & value) { this->bar = value; } | |
| 51 | 51 | }; |
| 52 | 52 | } |
| 53 | 53 | |
| @@ -56,13 +56,13 @@ namespace quicktype { | ||
| 56 | 56 | void to_json(json & j, const TopLevel & x); |
| 57 | 57 | |
| 58 | 58 | inline void from_json(const json & j, TopLevel& x) { |
| 59 | - x.set_bar(j.at("bar").get<std::string>()); | |
| 60 | 59 | x.set_foo(j.at("foo").get<std::string>()); |
| 60 | + x.set_bar(j.at("bar").get<std::string>()); | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | inline void to_json(json & j, const TopLevel & x) { |
| 64 | 64 | j = json::object(); |
| 65 | - j["bar"] = x.get_bar(); | |
| 66 | 65 | j["foo"] = x.get_foo(); |
| 66 | + j["bar"] = x.get_bar(); | |
| 67 | 67 | } |
| 68 | 68 | } |
Mschema-csharp-recordsdefault / QuickType.cs+3 −3
| @@ -25,11 +25,11 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("bar", Required = Required.Always)] | |
| 29 | - public BarUnion Bar { get; set; } | |
| 30 | - | |
| 31 | 28 | [JsonProperty("foo", Required = Required.Always)] |
| 32 | 29 | public string Foo { get; set; } |
| 30 | + | |
| 31 | + [JsonProperty("bar", Required = Required.Always)] | |
| 32 | + public BarUnion Bar { get; set; } | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public enum BarEnum { Quux }; |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+4 −4
| @@ -22,13 +22,13 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | - [JsonRequired] | |
| 26 | - [JsonPropertyName("bar")] | |
| 27 | - public BarUnion Bar { get; set; } | |
| 28 | - | |
| 29 | 25 | [JsonRequired] |
| 30 | 26 | [JsonPropertyName("foo")] |
| 31 | 27 | public string Foo { get; set; } |
| 28 | + | |
| 29 | + [JsonRequired] | |
| 30 | + [JsonPropertyName("bar")] | |
| 31 | + public BarUnion Bar { get; set; } | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public enum BarEnum { Quux }; |
Mschema-csharpdefault / QuickType.cs+3 −3
| @@ -25,11 +25,11 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("bar", Required = Required.Always)] | |
| 29 | - public BarUnion Bar { get; set; } | |
| 30 | - | |
| 31 | 28 | [JsonProperty("foo", Required = Required.Always)] |
| 32 | 29 | public string Foo { get; set; } |
| 30 | + | |
| 31 | + [JsonProperty("bar", Required = Required.Always)] | |
| 32 | + public BarUnion Bar { get; set; } | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public enum BarEnum { Quux }; |
Mschema-dartdefault / TopLevel.dart+4 −4
| @@ -9,22 +9,22 @@ TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | ||
| 9 | 9 | String topLevelToJson(TopLevel data) => json.encode(data.toJson()); |
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | - final dynamic bar; | |
| 13 | 12 | final String foo; |
| 13 | + final dynamic bar; | |
| 14 | 14 | |
| 15 | 15 | TopLevel({ |
| 16 | - required this.bar, | |
| 17 | 16 | required this.foo, |
| 17 | + required this.bar, | |
| 18 | 18 | }); |
| 19 | 19 | |
| 20 | 20 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 21 | - bar: json["bar"], | |
| 22 | 21 | foo: json["foo"], |
| 22 | + bar: json["bar"], | |
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | Map<String, dynamic> toJson() => { |
| 26 | - "bar": bar, | |
| 27 | 26 | "foo": foo, |
| 27 | + "bar": bar, | |
| 28 | 28 | }; |
| 29 | 29 | } |
Mschema-elixirdefault / QuickType.ex+6 −6
| @@ -6,18 +6,18 @@ | ||
| 6 | 6 | # Encode into a JSON string: TopLevel.to_json(struct) |
| 7 | 7 | |
| 8 | 8 | defmodule TopLevel do |
| 9 | - @enforce_keys [:bar, :foo] | |
| 10 | - defstruct [:bar, :foo] | |
| 9 | + @enforce_keys [:foo, :bar] | |
| 10 | + defstruct [:foo, :bar] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | - bar: String.t(), | |
| 14 | - foo: String.t() | |
| 13 | + foo: String.t(), | |
| 14 | + bar: String.t() | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | def from_map(m) do |
| 18 | 18 | %TopLevel{ |
| 19 | - bar: m["bar"], | |
| 20 | 19 | foo: m["foo"], |
| 20 | + bar: m["bar"], | |
| 21 | 21 | } |
| 22 | 22 | end |
| 23 | 23 | |
| @@ -29,8 +29,8 @@ defmodule TopLevel do | ||
| 29 | 29 | |
| 30 | 30 | def to_map(struct) do |
| 31 | 31 | %{ |
| 32 | - "bar" => struct.bar, | |
| 33 | 32 | "foo" => struct.foo, |
| 33 | + "bar" => struct.bar, | |
| 34 | 34 | } |
| 35 | 35 | end |
Mschema-elmdefault / QuickType.elm+5 −5
| @@ -23,8 +23,8 @@ import Json.Encode as Jenc | ||
| 23 | 23 | import Dict exposing (Dict) |
| 24 | 24 | |
| 25 | 25 | type alias QuickType = |
| 26 | - { bar : String | |
| 27 | - , foo : String | |
| 26 | + { foo : String | |
| 27 | + , bar : String | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | -- decoders and encoders |
| @@ -35,14 +35,14 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 35 | 35 | quickType : Jdec.Decoder QuickType |
| 36 | 36 | quickType = |
| 37 | 37 | Jdec.succeed QuickType |
| 38 | - |> Jpipe.required "bar" Jdec.string | |
| 39 | 38 | |> Jpipe.required "foo" Jdec.string |
| 39 | + |> Jpipe.required "bar" Jdec.string | |
| 40 | 40 | |
| 41 | 41 | encodeQuickType : QuickType -> Jenc.Value |
| 42 | 42 | encodeQuickType x = |
| 43 | 43 | Jenc.object |
| 44 | - [ ("bar", Jenc.string x.bar) | |
| 45 | - , ("foo", Jenc.string x.foo) | |
| 44 | + [ ("foo", Jenc.string x.foo) | |
| 45 | + , ("bar", Jenc.string x.bar) | |
| 46 | 46 | ] |
| 47 | 47 | |
| 48 | 48 | --- encoder helpers |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -10,8 +10,8 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - bar: BarUnion; | |
| 14 | 13 | foo: string; |
| 14 | + bar: BarUnion; | |
| 15 | 15 | [property: string]: mixed; |
| 16 | 16 | }; |
| 17 | 17 | |
| @@ -185,8 +185,8 @@ function r(name: string) { | ||
| 185 | 185 | |
| 186 | 186 | const typeMap: any = { |
| 187 | 187 | "TopLevel": o([ |
| 188 | - { json: "bar", js: "bar", typ: u(Date, r("BarEnum")) }, | |
| 189 | 188 | { json: "foo", js: "foo", typ: "" }, |
| 189 | + { json: "bar", js: "bar", typ: u(Date, r("BarEnum")) }, | |
| 190 | 190 | ], "any"), |
| 191 | 191 | "BarEnum": [ |
| 192 | 192 | "quux", |
Mschema-golangdefault / quicktype.go+1 −1
| @@ -23,8 +23,8 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | type TopLevel struct { |
| 26 | - Bar *BarUnion `json:"bar"` | |
| 27 | 26 | Foo string `json:"foo"` |
| 27 | + Bar *BarUnion `json:"bar"` | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | type BarEnum string |
Mschema-haskelldefault / QuickType.hs+7 −7
| @@ -13,21 +13,21 @@ import Data.HashMap.Strict (HashMap) | ||
| 13 | 13 | import Data.Text (Text) |
| 14 | 14 | |
| 15 | 15 | data QuickType = QuickType |
| 16 | - { barQuickType :: Text | |
| 17 | - , fooQuickType :: Text | |
| 16 | + { fooQuickType :: Text | |
| 17 | + , barQuickType :: Text | |
| 18 | 18 | } deriving (Show) |
| 19 | 19 | |
| 20 | 20 | decodeTopLevel :: ByteString -> Maybe QuickType |
| 21 | 21 | decodeTopLevel = decode |
| 22 | 22 | |
| 23 | 23 | instance ToJSON QuickType where |
| 24 | - toJSON (QuickType barQuickType fooQuickType) = | |
| 24 | + toJSON (QuickType fooQuickType barQuickType) = | |
| 25 | 25 | object |
| 26 | - [ "bar" .= barQuickType | |
| 27 | - , "foo" .= fooQuickType | |
| 26 | + [ "foo" .= fooQuickType | |
| 27 | + , "bar" .= barQuickType | |
| 28 | 28 | ] |
| 29 | 29 | |
| 30 | 30 | instance FromJSON QuickType where |
| 31 | 31 | parseJSON (Object v) = QuickType |
| 32 | - <$> v .: "bar" | |
| 33 | - <*> v .: "foo" | |
| 32 | + <$> v .: "foo" | |
| 33 | + <*> v .: "bar" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -4,16 +4,16 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.Date; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private BarUnion bar; | |
| 8 | 7 | private String foo; |
| 9 | - | |
| 10 | - @JsonProperty("bar") | |
| 11 | - public BarUnion getBar() { return bar; } | |
| 12 | - @JsonProperty("bar") | |
| 13 | - public void setBar(BarUnion value) { this.bar = value; } | |
| 8 | + private BarUnion bar; | |
| 14 | 9 | |
| 15 | 10 | @JsonProperty("foo") |
| 16 | 11 | public String getFoo() { return foo; } |
| 17 | 12 | @JsonProperty("foo") |
| 18 | 13 | public void setFoo(String value) { this.foo = value; } |
| 14 | + | |
| 15 | + @JsonProperty("bar") | |
| 16 | + public BarUnion getBar() { return bar; } | |
| 17 | + @JsonProperty("bar") | |
| 18 | + public void setBar(BarUnion value) { this.bar = value; } | |
| 19 | 19 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -4,16 +4,16 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.time.OffsetDateTime; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private BarUnion bar; | |
| 8 | 7 | private String foo; |
| 9 | - | |
| 10 | - @JsonProperty("bar") | |
| 11 | - public BarUnion getBar() { return bar; } | |
| 12 | - @JsonProperty("bar") | |
| 13 | - public void setBar(BarUnion value) { this.bar = value; } | |
| 8 | + private BarUnion bar; | |
| 14 | 9 | |
| 15 | 10 | @JsonProperty("foo") |
| 16 | 11 | public String getFoo() { return foo; } |
| 17 | 12 | @JsonProperty("foo") |
| 18 | 13 | public void setFoo(String value) { this.foo = value; } |
| 14 | + | |
| 15 | + @JsonProperty("bar") | |
| 16 | + public BarUnion getBar() { return bar; } | |
| 17 | + @JsonProperty("bar") | |
| 18 | + public void setBar(BarUnion value) { this.bar = value; } | |
| 19 | 19 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -4,16 +4,16 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.time.OffsetDateTime; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private BarUnion bar; | |
| 8 | 7 | private String foo; |
| 9 | - | |
| 10 | - @JsonProperty("bar") | |
| 11 | - public BarUnion getBar() { return bar; } | |
| 12 | - @JsonProperty("bar") | |
| 13 | - public void setBar(BarUnion value) { this.bar = value; } | |
| 8 | + private BarUnion bar; | |
| 14 | 9 | |
| 15 | 10 | @JsonProperty("foo") |
| 16 | 11 | public String getFoo() { return foo; } |
| 17 | 12 | @JsonProperty("foo") |
| 18 | 13 | public void setFoo(String value) { this.foo = value; } |
| 14 | + | |
| 15 | + @JsonProperty("bar") | |
| 16 | + public BarUnion getBar() { return bar; } | |
| 17 | + @JsonProperty("bar") | |
| 18 | + public void setBar(BarUnion value) { this.bar = value; } | |
| 19 | 19 | } |
Mschema-javascriptdefault / TopLevel.js+1 −1
| @@ -172,8 +172,8 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "bar", js: "bar", typ: u(Date, r("BarEnum")) }, | |
| 176 | 175 | { json: "foo", js: "foo", typ: "" }, |
| 176 | + { json: "bar", js: "bar", typ: u(Date, r("BarEnum")) }, | |
| 177 | 177 | ], "any"), |
| 178 | 178 | "BarEnum": [ |
| 179 | 179 | "quux", |
Mschema-kotlin-jacksondefault / TopLevel.kt+2 −2
| @@ -36,10 +36,10 @@ val mapper = jacksonObjectMapper().apply { | ||
| 36 | 36 | |
| 37 | 37 | data class TopLevel ( |
| 38 | 38 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 39 | - val bar: BarUnion, | |
| 39 | + val foo: String, | |
| 40 | 40 | |
| 41 | 41 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 42 | - val foo: String | |
| 42 | + val bar: BarUnion | |
| 43 | 43 | ) { |
| 44 | 44 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+2 −2
| @@ -22,8 +22,8 @@ private val klaxon = Klaxon() | ||
| 22 | 22 | .convert(BarUnion::class, { BarUnion.fromJson(it) }, { it.toJson() }, true) |
| 23 | 23 | |
| 24 | 24 | data class TopLevel ( |
| 25 | - val bar: BarUnion, | |
| 26 | - val foo: String | |
| 25 | + val foo: String, | |
| 26 | + val bar: BarUnion | |
| 27 | 27 | ) { |
| 28 | 28 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-phpdefault / TopLevel.php+58 −58
| @@ -4,16 +4,63 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private Bar|DateTime $bar; // json:bar Required | |
| 8 | 7 | private string $foo; // json:foo Required |
| 8 | + private Bar|DateTime $bar; // json:bar Required | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | - * @param Bar|DateTime $bar | |
| 12 | 11 | * @param string $foo |
| 12 | + * @param Bar|DateTime $bar | |
| 13 | 13 | */ |
| 14 | - public function __construct(Bar|DateTime $bar, string $foo) { | |
| 15 | - $this->bar = $bar; | |
| 14 | + public function __construct(string $foo, Bar|DateTime $bar) { | |
| 16 | 15 | $this->foo = $foo; |
| 16 | + $this->bar = $bar; | |
| 17 | + } | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * @param string $value | |
| 21 | + * @throws Exception | |
| 22 | + * @return string | |
| 23 | + */ | |
| 24 | + public static function fromFoo(string $value): string { | |
| 25 | + return $value; /*string*/ | |
| 26 | + } | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * @throws Exception | |
| 30 | + * @return string | |
| 31 | + */ | |
| 32 | + public function toFoo(): string { | |
| 33 | + if (TopLevel::validateFoo($this->foo)) { | |
| 34 | + return $this->foo; /*string*/ | |
| 35 | + } | |
| 36 | + throw new Exception('never get to this TopLevel::foo'); | |
| 37 | + } | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * @param string | |
| 41 | + * @return bool | |
| 42 | + * @throws Exception | |
| 43 | + */ | |
| 44 | + public static function validateFoo(string $value): bool { | |
| 45 | + return true; | |
| 46 | + } | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * @throws Exception | |
| 50 | + * @return string | |
| 51 | + */ | |
| 52 | + public function getFoo(): string { | |
| 53 | + if (TopLevel::validateFoo($this->foo)) { | |
| 54 | + return $this->foo; | |
| 55 | + } | |
| 56 | + throw new Exception('never get to getFoo TopLevel::foo'); | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * @return string | |
| 61 | + */ | |
| 62 | + public static function sampleFoo(): string { | |
| 63 | + return 'TopLevel::foo::31'; /*31:foo*/ | |
| 17 | 64 | } |
| 18 | 65 | |
| 19 | 66 | /** |
| @@ -88,60 +135,13 @@ class TopLevel { | ||
| 88 | 135 | return Bar::sample(); /*enum*/ |
| 89 | 136 | } |
| 90 | 137 | |
| 91 | - /** | |
| 92 | - * @param string $value | |
| 93 | - * @throws Exception | |
| 94 | - * @return string | |
| 95 | - */ | |
| 96 | - public static function fromFoo(string $value): string { | |
| 97 | - return $value; /*string*/ | |
| 98 | - } | |
| 99 | - | |
| 100 | - /** | |
| 101 | - * @throws Exception | |
| 102 | - * @return string | |
| 103 | - */ | |
| 104 | - public function toFoo(): string { | |
| 105 | - if (TopLevel::validateFoo($this->foo)) { | |
| 106 | - return $this->foo; /*string*/ | |
| 107 | - } | |
| 108 | - throw new Exception('never get to this TopLevel::foo'); | |
| 109 | - } | |
| 110 | - | |
| 111 | - /** | |
| 112 | - * @param string | |
| 113 | - * @return bool | |
| 114 | - * @throws Exception | |
| 115 | - */ | |
| 116 | - public static function validateFoo(string $value): bool { | |
| 117 | - return true; | |
| 118 | - } | |
| 119 | - | |
| 120 | - /** | |
| 121 | - * @throws Exception | |
| 122 | - * @return string | |
| 123 | - */ | |
| 124 | - public function getFoo(): string { | |
| 125 | - if (TopLevel::validateFoo($this->foo)) { | |
| 126 | - return $this->foo; | |
| 127 | - } | |
| 128 | - throw new Exception('never get to getFoo TopLevel::foo'); | |
| 129 | - } | |
| 130 | - | |
| 131 | - /** | |
| 132 | - * @return string | |
| 133 | - */ | |
| 134 | - public static function sampleFoo(): string { | |
| 135 | - return 'TopLevel::foo::32'; /*32:foo*/ | |
| 136 | - } | |
| 137 | - | |
| 138 | 138 | /** |
| 139 | 139 | * @throws Exception |
| 140 | 140 | * @return bool |
| 141 | 141 | */ |
| 142 | 142 | public function validate(): bool { |
| 143 | - return TopLevel::validateBar($this->bar) | |
| 144 | - || TopLevel::validateFoo($this->foo); | |
| 143 | + return TopLevel::validateFoo($this->foo) | |
| 144 | + || TopLevel::validateBar($this->bar); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
| @@ -150,8 +150,8 @@ class TopLevel { | ||
| 150 | 150 | */ |
| 151 | 151 | public function to(): stdClass { |
| 152 | 152 | $out = new stdClass(); |
| 153 | - $out->{'bar'} = $this->toBar(); | |
| 154 | 153 | $out->{'foo'} = $this->toFoo(); |
| 154 | + $out->{'bar'} = $this->toBar(); | |
| 155 | 155 | return $out; |
| 156 | 156 | } |
| 157 | 157 | |
| @@ -162,8 +162,8 @@ class TopLevel { | ||
| 162 | 162 | */ |
| 163 | 163 | public static function from(stdClass $obj): TopLevel { |
| 164 | 164 | return new TopLevel( |
| 165 | - TopLevel::fromBar($obj->{'bar'}) | |
| 166 | - ,TopLevel::fromFoo($obj->{'foo'}) | |
| 165 | + TopLevel::fromFoo($obj->{'foo'}) | |
| 166 | + ,TopLevel::fromBar($obj->{'bar'}) | |
| 167 | 167 | ); |
| 168 | 168 | } |
| 169 | 169 | |
| @@ -172,8 +172,8 @@ class TopLevel { | ||
| 172 | 172 | */ |
| 173 | 173 | public static function sample(): TopLevel { |
| 174 | 174 | return new TopLevel( |
| 175 | - TopLevel::sampleBar() | |
| 176 | - ,TopLevel::sampleFoo() | |
| 175 | + TopLevel::sampleFoo() | |
| 176 | + ,TopLevel::sampleBar() | |
| 177 | 177 | ); |
| 178 | 178 | } |
| 179 | 179 | } |
Mschema-pikedefault / TopLevel.pmod+3 −3
| @@ -13,13 +13,13 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - string bar; // json: "bar" | |
| 17 | 16 | string foo; // json: "foo" |
| 17 | + string bar; // json: "bar" | |
| 18 | 18 | |
| 19 | 19 | string encode_json() { |
| 20 | 20 | mapping(string:mixed) json = ([ |
| 21 | - "bar" : bar, | |
| 22 | 21 | "foo" : foo, |
| 22 | + "bar" : bar, | |
| 23 | 23 | ]); |
| 24 | 24 | |
| 25 | 25 | return Standards.JSON.encode(json); |
| @@ -29,8 +29,8 @@ class TopLevel { | ||
| 29 | 29 | TopLevel TopLevel_from_JSON(mixed json) { |
| 30 | 30 | TopLevel retval = TopLevel(); |
| 31 | 31 | |
| 32 | - retval.bar = json["bar"]; | |
| 33 | 32 | retval.foo = json["foo"]; |
| 33 | + retval.bar = json["bar"]; | |
| 34 | 34 | |
| 35 | 35 | return retval; |
| 36 | 36 | } |
Mschema-pythondefault / quicktype.py+9 −9
| @@ -9,6 +9,11 @@ T = TypeVar("T") | ||
| 9 | 9 | EnumT = TypeVar("EnumT", bound=Enum) |
| 10 | 10 | |
| 11 | 11 | |
| 12 | +def from_str(x: Any) -> str: | |
| 13 | + assert isinstance(x, str) | |
| 14 | + return x | |
| 15 | + | |
| 16 | + | |
| 12 | 17 | def from_datetime(x: Any) -> datetime.datetime: |
| 13 | 18 | return dateutil.parser.parse(x) |
| 14 | 19 | |
| @@ -22,11 +27,6 @@ def from_union(fs, x): | ||
| 22 | 27 | assert False |
| 23 | 28 | |
| 24 | 29 | |
| 25 | -def from_str(x: Any) -> str: | |
| 26 | - assert isinstance(x, str) | |
| 27 | - return x | |
| 28 | - | |
| 29 | - | |
| 30 | 30 | def to_enum(c: Type[EnumT], x: Any) -> EnumT: |
| 31 | 31 | assert isinstance(x, c) |
| 32 | 32 | return x.value |
| @@ -43,20 +43,20 @@ class BarEnum(Enum): | ||
| 43 | 43 | |
| 44 | 44 | @dataclass |
| 45 | 45 | class TopLevel: |
| 46 | - bar: BarEnum | datetime.datetime | |
| 47 | 46 | foo: str |
| 47 | + bar: BarEnum | datetime.datetime | |
| 48 | 48 | |
| 49 | 49 | @staticmethod |
| 50 | 50 | def from_dict(obj: Any) -> 'TopLevel': |
| 51 | 51 | assert isinstance(obj, dict) |
| 52 | - bar = from_union([BarEnum, from_datetime], obj.get("bar")) | |
| 53 | 52 | foo = from_str(obj.get("foo")) |
| 54 | - return TopLevel(bar, foo) | |
| 53 | + bar = from_union([BarEnum, from_datetime], obj.get("bar")) | |
| 54 | + return TopLevel(foo, bar) | |
| 55 | 55 | |
| 56 | 56 | def to_dict(self) -> dict: |
| 57 | 57 | result: dict = {} |
| 58 | - result["bar"] = from_union([lambda x: to_enum(BarEnum, x), lambda x: x.isoformat()], self.bar) | |
| 59 | 58 | result["foo"] = from_str(self.foo) |
| 59 | + result["bar"] = from_union([lambda x: to_enum(BarEnum, x), lambda x: x.isoformat()], self.bar) | |
| 60 | 60 | return result |
Mschema-rubydefault / TopLevel.rb+4 −4
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.bar | |
| 7 | +# puts top_level.foo | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -20,14 +20,14 @@ module Types | ||
| 20 | 20 | end |
| 21 | 21 | |
| 22 | 22 | class TopLevel < Dry::Struct |
| 23 | - attribute :bar, Types::String | |
| 24 | 23 | attribute :foo, Types::String |
| 24 | + attribute :bar, Types::String | |
| 25 | 25 | |
| 26 | 26 | def self.from_dynamic!(d) |
| 27 | 27 | d = Types::Hash[d] |
| 28 | 28 | new( |
| 29 | - bar: d.fetch("bar"), | |
| 30 | 29 | foo: d.fetch("foo"), |
| 30 | + bar: d.fetch("bar"), | |
| 31 | 31 | ) |
| 32 | 32 | end |
| 33 | 33 | |
| @@ -37,8 +37,8 @@ class TopLevel < Dry::Struct | ||
| 37 | 37 | |
| 38 | 38 | def to_dynamic |
| 39 | 39 | { |
| 40 | - "bar" => bar, | |
| 41 | 40 | "foo" => foo, |
| 41 | + "bar" => bar, | |
| 42 | 42 | } |
| 43 | 43 | end |
Mschema-rustdefault / module_under_test.rs+2 −2
| @@ -15,7 +15,7 @@ use serde::{Serialize, Deserialize}; | ||
| 15 | 15 | |
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | pub struct TopLevel { |
| 18 | - pub bar: String, | |
| 19 | - | |
| 20 | 18 | pub foo: String, |
| 19 | + | |
| 20 | + pub bar: String, | |
| 21 | 21 | } |
Mschema-scala3-upickledefault / TopLevel.scala+2 −2
| @@ -66,6 +66,6 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val bar : String, | |
| 70 | - val foo : String | |
| 69 | + val foo : String, | |
| 70 | + val bar : String | |
| 71 | 71 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+2 −2
| @@ -8,6 +8,6 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val bar : String, | |
| 12 | - val foo : String | |
| 11 | + val foo : String, | |
| 12 | + val bar : String | |
| 13 | 13 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+3 −3
| @@ -6,11 +6,11 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": {}, |
| 8 | 8 | "properties": { |
| 9 | - "bar": { | |
| 10 | - "$ref": "#/definitions/BarUnion" | |
| 11 | - }, | |
| 12 | 9 | "foo": { |
| 13 | 10 | "type": "string" |
| 11 | + }, | |
| 12 | + "bar": { | |
| 13 | + "$ref": "#/definitions/BarUnion" | |
| 14 | 14 | } |
| 15 | 15 | }, |
| 16 | 16 | "required": [ |
Mschema-swiftdefault / quicktype.swift+6 −6
| @@ -7,12 +7,12 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | - let bar: BarUnion | |
| 11 | 10 | let foo: String |
| 11 | + let bar: BarUnion | |
| 12 | 12 | |
| 13 | 13 | enum CodingKeys: String, CodingKey { |
| 14 | - case bar = "bar" | |
| 15 | 14 | case foo = "foo" |
| 15 | + case bar = "bar" | |
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | |
| @@ -35,12 +35,12 @@ extension TopLevel { | ||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | func with( |
| 38 | - bar: BarUnion? = nil, | |
| 39 | - foo: String? = nil | |
| 38 | + foo: String? = nil, | |
| 39 | + bar: BarUnion? = nil | |
| 40 | 40 | ) -> TopLevel { |
| 41 | 41 | return TopLevel( |
| 42 | - bar: bar ?? self.bar, | |
| 43 | - foo: foo ?? self.foo | |
| 42 | + foo: foo ?? self.foo, | |
| 43 | + bar: bar ?? self.bar | |
| 44 | 44 | ) |
| 45 | 45 | } |
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -7,7 +7,7 @@ export const BarEnumSchema = z.enum([ | ||
| 7 | 7 | export type BarEnum = z.infer<typeof BarEnumSchema>; |
| 8 | 8 | |
| 9 | 9 | export const TopLevelSchema = z.object({ |
| 10 | - "bar": z.union([z.coerce.date(), BarEnumSchema]), | |
| 11 | 10 | "foo": z.string(), |
| 11 | + "bar": z.union([z.coerce.date(), BarEnumSchema]), | |
| 12 | 12 | }); |
| 13 | 13 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -8,8 +8,8 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - bar: BarUnion; | |
| 12 | 11 | foo: string; |
| 12 | + bar: BarUnion; | |
| 13 | 13 | [property: string]: unknown; |
| 14 | 14 | } |
| 15 | 15 | |
| @@ -184,8 +184,8 @@ function r(name: string) { | ||
| 184 | 184 | |
| 185 | 185 | const typeMap: any = { |
| 186 | 186 | "TopLevel": o([ |
| 187 | - { json: "bar", js: "bar", typ: u(Date, r("BarEnum")) }, | |
| 188 | 187 | { json: "foo", js: "foo", typ: "" }, |
| 188 | + { json: "bar", js: "bar", typ: u(Date, r("BarEnum")) }, | |
| 189 | 189 | ], "any"), |
| 190 | 190 | "BarEnum": [ |
| 191 | 191 | "quux", |
Test case
28 generated files · +357 −358test/inputs/schema/date-time.schema
Mschema-cjsondefault / TopLevel.c+49 −49
| @@ -62,20 +62,6 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 62 | 62 | if (NULL != j) { |
| 63 | 63 | if (NULL != (x = cJSON_malloc(sizeof(struct TopLevel)))) { |
| 64 | 64 | memset(x, 0, sizeof(struct TopLevel)); |
| 65 | - if (cJSON_HasObjectItem(j, "complex-union-array")) { | |
| 66 | - list_t * x1 = list_create(false, NULL); | |
| 67 | - if (NULL != x1) { | |
| 68 | - cJSON * e1 = NULL; | |
| 69 | - cJSON * j1 = cJSON_GetObjectItemCaseSensitive(j, "complex-union-array"); | |
| 70 | - cJSON_ArrayForEach(e1, j1) { | |
| 71 | - list_add_tail(x1, cJSON_GetComplexUnionArrayValue(e1), sizeof(struct ComplexUnionArray *)); | |
| 72 | - } | |
| 73 | - x->complex_union_array = x1; | |
| 74 | - } | |
| 75 | - } | |
| 76 | - else { | |
| 77 | - x->complex_union_array = list_create(false, NULL); | |
| 78 | - } | |
| 79 | 65 | if (cJSON_HasObjectItem(j, "date")) { |
| 80 | 66 | x->date = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "date"))); |
| 81 | 67 | } |
| @@ -84,14 +70,6 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 84 | 70 | x->date[0] = '\0'; |
| 85 | 71 | } |
| 86 | 72 | } |
| 87 | - if (cJSON_HasObjectItem(j, "date-time")) { | |
| 88 | - x->date_time = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "date-time"))); | |
| 89 | - } | |
| 90 | - else { | |
| 91 | - if (NULL != (x->date_time = cJSON_malloc(sizeof(char)))) { | |
| 92 | - x->date_time[0] = '\0'; | |
| 93 | - } | |
| 94 | - } | |
| 95 | 73 | if (cJSON_HasObjectItem(j, "time")) { |
| 96 | 74 | x->time = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "time"))); |
| 97 | 75 | } |
| @@ -100,6 +78,14 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 100 | 78 | x->time[0] = '\0'; |
| 101 | 79 | } |
| 102 | 80 | } |
| 81 | + if (cJSON_HasObjectItem(j, "date-time")) { | |
| 82 | + x->date_time = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "date-time"))); | |
| 83 | + } | |
| 84 | + else { | |
| 85 | + if (NULL != (x->date_time = cJSON_malloc(sizeof(char)))) { | |
| 86 | + x->date_time[0] = '\0'; | |
| 87 | + } | |
| 88 | + } | |
| 103 | 89 | if (cJSON_HasObjectItem(j, "union-array")) { |
| 104 | 90 | list_t * x1 = list_create(false, NULL); |
| 105 | 91 | if (NULL != x1) { |
| @@ -114,6 +100,20 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 114 | 100 | else { |
| 115 | 101 | x->union_array = list_create(false, NULL); |
| 116 | 102 | } |
| 103 | + if (cJSON_HasObjectItem(j, "complex-union-array")) { | |
| 104 | + list_t * x1 = list_create(false, NULL); | |
| 105 | + if (NULL != x1) { | |
| 106 | + cJSON * e1 = NULL; | |
| 107 | + cJSON * j1 = cJSON_GetObjectItemCaseSensitive(j, "complex-union-array"); | |
| 108 | + cJSON_ArrayForEach(e1, j1) { | |
| 109 | + list_add_tail(x1, cJSON_GetComplexUnionArrayValue(e1), sizeof(struct ComplexUnionArray *)); | |
| 110 | + } | |
| 111 | + x->complex_union_array = x1; | |
| 112 | + } | |
| 113 | + } | |
| 114 | + else { | |
| 115 | + x->complex_union_array = list_create(false, NULL); | |
| 116 | + } | |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | return x; |
| @@ -123,34 +123,24 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 123 | 123 | cJSON * j = NULL; |
| 124 | 124 | if (NULL != x) { |
| 125 | 125 | if (NULL != (j = cJSON_CreateObject())) { |
| 126 | - if (NULL != x->complex_union_array) { | |
| 127 | - cJSON * j1 = cJSON_AddArrayToObject(j, "complex-union-array"); | |
| 128 | - if (NULL != j1) { | |
| 129 | - struct ComplexUnionArray * x1 = list_get_head(x->complex_union_array); | |
| 130 | - while (NULL != x1) { | |
| 131 | - cJSON_AddItemToArray(j1, cJSON_CreateComplexUnionArray(x1)); | |
| 132 | - x1 = list_get_next(x->complex_union_array); | |
| 133 | - } | |
| 134 | - } | |
| 135 | - } | |
| 136 | 126 | if (NULL != x->date) { |
| 137 | 127 | cJSON_AddStringToObject(j, "date", x->date); |
| 138 | 128 | } |
| 139 | 129 | else { |
| 140 | 130 | cJSON_AddStringToObject(j, "date", ""); |
| 141 | 131 | } |
| 142 | - if (NULL != x->date_time) { | |
| 143 | - cJSON_AddStringToObject(j, "date-time", x->date_time); | |
| 144 | - } | |
| 145 | - else { | |
| 146 | - cJSON_AddStringToObject(j, "date-time", ""); | |
| 147 | - } | |
| 148 | 132 | if (NULL != x->time) { |
| 149 | 133 | cJSON_AddStringToObject(j, "time", x->time); |
| 150 | 134 | } |
| 151 | 135 | else { |
| 152 | 136 | cJSON_AddStringToObject(j, "time", ""); |
| 153 | 137 | } |
| 138 | + if (NULL != x->date_time) { | |
| 139 | + cJSON_AddStringToObject(j, "date-time", x->date_time); | |
| 140 | + } | |
| 141 | + else { | |
| 142 | + cJSON_AddStringToObject(j, "date-time", ""); | |
| 143 | + } | |
| 154 | 144 | if (NULL != x->union_array) { |
| 155 | 145 | cJSON * j1 = cJSON_AddArrayToObject(j, "union-array"); |
| 156 | 146 | if (NULL != j1) { |
| @@ -161,6 +151,16 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 161 | 151 | } |
| 162 | 152 | } |
| 163 | 153 | } |
| 154 | + if (NULL != x->complex_union_array) { | |
| 155 | + cJSON * j1 = cJSON_AddArrayToObject(j, "complex-union-array"); | |
| 156 | + if (NULL != j1) { | |
| 157 | + struct ComplexUnionArray * x1 = list_get_head(x->complex_union_array); | |
| 158 | + while (NULL != x1) { | |
| 159 | + cJSON_AddItemToArray(j1, cJSON_CreateComplexUnionArray(x1)); | |
| 160 | + x1 = list_get_next(x->complex_union_array); | |
| 161 | + } | |
| 162 | + } | |
| 163 | + } | |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | return j; |
| @@ -180,23 +180,15 @@ char * cJSON_PrintTopLevel(const struct TopLevel * x) { | ||
| 180 | 180 | |
| 181 | 181 | void cJSON_DeleteTopLevel(struct TopLevel * x) { |
| 182 | 182 | if (NULL != x) { |
| 183 | - if (NULL != x->complex_union_array) { | |
| 184 | - struct ComplexUnionArray * x1 = list_get_head(x->complex_union_array); | |
| 185 | - while (NULL != x1) { | |
| 186 | - cJSON_DeleteComplexUnionArray(x1); | |
| 187 | - x1 = list_get_next(x->complex_union_array); | |
| 188 | - } | |
| 189 | - list_release(x->complex_union_array); | |
| 190 | - } | |
| 191 | 183 | if (NULL != x->date) { |
| 192 | 184 | cJSON_free(x->date); |
| 193 | 185 | } |
| 194 | - if (NULL != x->date_time) { | |
| 195 | - cJSON_free(x->date_time); | |
| 196 | - } | |
| 197 | 186 | if (NULL != x->time) { |
| 198 | 187 | cJSON_free(x->time); |
| 199 | 188 | } |
| 189 | + if (NULL != x->date_time) { | |
| 190 | + cJSON_free(x->date_time); | |
| 191 | + } | |
| 200 | 192 | if (NULL != x->union_array) { |
| 201 | 193 | char * x1 = list_get_head(x->union_array); |
| 202 | 194 | while (NULL != x1) { |
| @@ -205,6 +197,14 @@ void cJSON_DeleteTopLevel(struct TopLevel * x) { | ||
| 205 | 197 | } |
| 206 | 198 | list_release(x->union_array); |
| 207 | 199 | } |
| 200 | + if (NULL != x->complex_union_array) { | |
| 201 | + struct ComplexUnionArray * x1 = list_get_head(x->complex_union_array); | |
| 202 | + while (NULL != x1) { | |
| 203 | + cJSON_DeleteComplexUnionArray(x1); | |
| 204 | + x1 = list_get_next(x->complex_union_array); | |
| 205 | + } | |
| 206 | + list_release(x->complex_union_array); | |
| 207 | + } | |
| 208 | 208 | cJSON_free(x); |
| 209 | 209 | } |
| 210 | 210 | } |
Mschema-cjsondefault / TopLevel.h+2 −2
| @@ -43,11 +43,11 @@ struct ComplexUnionArray { | ||
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | 45 | struct TopLevel { |
| 46 | - list_t * complex_union_array; | |
| 47 | 46 | char * date; |
| 48 | - char * date_time; | |
| 49 | 47 | char * time; |
| 48 | + char * date_time; | |
| 50 | 49 | list_t * union_array; |
| 50 | + list_t * complex_union_array; | |
| 51 | 51 | }; |
| 52 | 52 | |
| 53 | 53 | struct ComplexUnionArray * cJSON_GetComplexUnionArrayValue(const cJSON * j); |
Mschema-cplusplusdefault / quicktype.hpp+14 −14
| @@ -96,32 +96,32 @@ namespace quicktype { | ||
| 96 | 96 | virtual ~TopLevel() = default; |
| 97 | 97 | |
| 98 | 98 | private: |
| 99 | - std::vector<ComplexUnionArray> complex_union_array; | |
| 100 | 99 | std::string date; |
| 101 | - std::string date_time; | |
| 102 | 100 | std::string time; |
| 101 | + std::string date_time; | |
| 103 | 102 | std::vector<std::string> union_array; |
| 103 | + std::vector<ComplexUnionArray> complex_union_array; | |
| 104 | 104 | |
| 105 | 105 | public: |
| 106 | - const std::vector<ComplexUnionArray> & get_complex_union_array() const { return complex_union_array; } | |
| 107 | - std::vector<ComplexUnionArray> & get_mutable_complex_union_array() { return complex_union_array; } | |
| 108 | - void set_complex_union_array(const std::vector<ComplexUnionArray> & value) { this->complex_union_array = value; } | |
| 109 | - | |
| 110 | 106 | const std::string & get_date() const { return date; } |
| 111 | 107 | std::string & get_mutable_date() { return date; } |
| 112 | 108 | void set_date(const std::string & value) { this->date = value; } |
| 113 | 109 | |
| 114 | - const std::string & get_date_time() const { return date_time; } | |
| 115 | - std::string & get_mutable_date_time() { return date_time; } | |
| 116 | - void set_date_time(const std::string & value) { this->date_time = value; } | |
| 117 | - | |
| 118 | 110 | const std::string & get_time() const { return time; } |
| 119 | 111 | std::string & get_mutable_time() { return time; } |
| 120 | 112 | void set_time(const std::string & value) { this->time = value; } |
| 121 | 113 | |
| 114 | + const std::string & get_date_time() const { return date_time; } | |
| 115 | + std::string & get_mutable_date_time() { return date_time; } | |
| 116 | + void set_date_time(const std::string & value) { this->date_time = value; } | |
| 117 | + | |
| 122 | 118 | const std::vector<std::string> & get_union_array() const { return union_array; } |
| 123 | 119 | std::vector<std::string> & get_mutable_union_array() { return union_array; } |
| 124 | 120 | void set_union_array(const std::vector<std::string> & value) { this->union_array = value; } |
| 121 | + | |
| 122 | + const std::vector<ComplexUnionArray> & get_complex_union_array() const { return complex_union_array; } | |
| 123 | + std::vector<ComplexUnionArray> & get_mutable_complex_union_array() { return complex_union_array; } | |
| 124 | + void set_complex_union_array(const std::vector<ComplexUnionArray> & value) { this->complex_union_array = value; } | |
| 125 | 125 | }; |
| 126 | 126 | } |
| 127 | 127 | |
| @@ -138,20 +138,20 @@ struct adl_serializer<std::variant<int64_t, std::string>> { | ||
| 138 | 138 | } |
| 139 | 139 | namespace quicktype { |
| 140 | 140 | inline void from_json(const json & j, TopLevel& x) { |
| 141 | - x.set_complex_union_array(j.at("complex-union-array").get<std::vector<ComplexUnionArray>>()); | |
| 142 | 141 | x.set_date(j.at("date").get<std::string>()); |
| 143 | - x.set_date_time(j.at("date-time").get<std::string>()); | |
| 144 | 142 | x.set_time(j.at("time").get<std::string>()); |
| 143 | + x.set_date_time(j.at("date-time").get<std::string>()); | |
| 145 | 144 | x.set_union_array(j.at("union-array").get<std::vector<std::string>>()); |
| 145 | + x.set_complex_union_array(j.at("complex-union-array").get<std::vector<ComplexUnionArray>>()); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | inline void to_json(json & j, const TopLevel & x) { |
| 149 | 149 | j = json::object(); |
| 150 | - j["complex-union-array"] = x.get_complex_union_array(); | |
| 151 | 150 | j["date"] = x.get_date(); |
| 152 | - j["date-time"] = x.get_date_time(); | |
| 153 | 151 | j["time"] = x.get_time(); |
| 152 | + j["date-time"] = x.get_date_time(); | |
| 154 | 153 | j["union-array"] = x.get_union_array(); |
| 154 | + j["complex-union-array"] = x.get_complex_union_array(); | |
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | namespace nlohmann { |
Mschema-csharp-recordsdefault / QuickType.cs+6 −6
| @@ -25,20 +25,20 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("complex-union-array", Required = Required.Always)] | |
| 29 | - public ComplexUnionArrayElement[] ComplexUnionArray { get; set; } | |
| 30 | - | |
| 31 | 28 | [JsonProperty("date", Required = Required.Always)] |
| 32 | 29 | public DateTimeOffset Date { get; set; } |
| 33 | 30 | |
| 34 | - [JsonProperty("date-time", Required = Required.Always)] | |
| 35 | - public DateTimeOffset DateTime { get; set; } | |
| 36 | - | |
| 37 | 31 | [JsonProperty("time", Required = Required.Always)] |
| 38 | 32 | public DateTimeOffset Time { get; set; } |
| 39 | 33 | |
| 34 | + [JsonProperty("date-time", Required = Required.Always)] | |
| 35 | + public DateTimeOffset DateTime { get; set; } | |
| 36 | + | |
| 40 | 37 | [JsonProperty("union-array", Required = Required.Always)] |
| 41 | 38 | public DateTimeOffset[] UnionArray { get; set; } |
| 39 | + | |
| 40 | + [JsonProperty("complex-union-array", Required = Required.Always)] | |
| 41 | + public ComplexUnionArrayElement[] ComplexUnionArray { get; set; } | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public enum ComplexUnionArrayEnum { Foo, Bar }; |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+8 −8
| @@ -22,25 +22,25 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | - [JsonRequired] | |
| 26 | - [JsonPropertyName("complex-union-array")] | |
| 27 | - public ComplexUnionArrayElement[] ComplexUnionArray { get; set; } | |
| 28 | - | |
| 29 | 25 | [JsonRequired] |
| 30 | 26 | [JsonPropertyName("date")] |
| 31 | 27 | public DateTimeOffset Date { get; set; } |
| 32 | 28 | |
| 33 | - [JsonRequired] | |
| 34 | - [JsonPropertyName("date-time")] | |
| 35 | - public DateTimeOffset DateTime { get; set; } | |
| 36 | - | |
| 37 | 29 | [JsonRequired] |
| 38 | 30 | [JsonPropertyName("time")] |
| 39 | 31 | public DateTimeOffset Time { get; set; } |
| 40 | 32 | |
| 33 | + [JsonRequired] | |
| 34 | + [JsonPropertyName("date-time")] | |
| 35 | + public DateTimeOffset DateTime { get; set; } | |
| 36 | + | |
| 41 | 37 | [JsonRequired] |
| 42 | 38 | [JsonPropertyName("union-array")] |
| 43 | 39 | public DateTimeOffset[] UnionArray { get; set; } |
| 40 | + | |
| 41 | + [JsonRequired] | |
| 42 | + [JsonPropertyName("complex-union-array")] | |
| 43 | + public ComplexUnionArrayElement[] ComplexUnionArray { get; set; } | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public enum ComplexUnionArrayEnum { Foo, Bar }; |
Mschema-csharpdefault / QuickType.cs+6 −6
| @@ -25,20 +25,20 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("complex-union-array", Required = Required.Always)] | |
| 29 | - public ComplexUnionArrayElement[] ComplexUnionArray { get; set; } | |
| 30 | - | |
| 31 | 28 | [JsonProperty("date", Required = Required.Always)] |
| 32 | 29 | public DateTimeOffset Date { get; set; } |
| 33 | 30 | |
| 34 | - [JsonProperty("date-time", Required = Required.Always)] | |
| 35 | - public DateTimeOffset DateTime { get; set; } | |
| 36 | - | |
| 37 | 31 | [JsonProperty("time", Required = Required.Always)] |
| 38 | 32 | public DateTimeOffset Time { get; set; } |
| 39 | 33 | |
| 34 | + [JsonProperty("date-time", Required = Required.Always)] | |
| 35 | + public DateTimeOffset DateTime { get; set; } | |
| 36 | + | |
| 40 | 37 | [JsonProperty("union-array", Required = Required.Always)] |
| 41 | 38 | public DateTimeOffset[] UnionArray { get; set; } |
| 39 | + | |
| 40 | + [JsonProperty("complex-union-array", Required = Required.Always)] | |
| 41 | + public ComplexUnionArrayElement[] ComplexUnionArray { get; set; } | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public enum ComplexUnionArrayEnum { Foo, Bar }; |
Mschema-dartdefault / TopLevel.dart+8 −8
| @@ -9,34 +9,34 @@ TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | ||
| 9 | 9 | String topLevelToJson(TopLevel data) => json.encode(data.toJson()); |
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | - final List<dynamic> complexUnionArray; | |
| 13 | 12 | final DateTime date; |
| 14 | - final DateTime dateTime; | |
| 15 | 13 | final String time; |
| 14 | + final DateTime dateTime; | |
| 16 | 15 | final List<String> unionArray; |
| 16 | + final List<dynamic> complexUnionArray; | |
| 17 | 17 | |
| 18 | 18 | TopLevel({ |
| 19 | - required this.complexUnionArray, | |
| 20 | 19 | required this.date, |
| 21 | - required this.dateTime, | |
| 22 | 20 | required this.time, |
| 21 | + required this.dateTime, | |
| 23 | 22 | required this.unionArray, |
| 23 | + required this.complexUnionArray, | |
| 24 | 24 | }); |
| 25 | 25 | |
| 26 | 26 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 27 | - complexUnionArray: List<dynamic>.from(json["complex-union-array"].map((x) => x)), | |
| 28 | 27 | date: DateTime.parse(json["date"]), |
| 29 | - dateTime: DateTime.parse(json["date-time"]), | |
| 30 | 28 | time: json["time"], |
| 29 | + dateTime: DateTime.parse(json["date-time"]), | |
| 31 | 30 | unionArray: List<String>.from(json["union-array"].map((x) => x)), |
| 31 | + complexUnionArray: List<dynamic>.from(json["complex-union-array"].map((x) => x)), | |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | 34 | Map<String, dynamic> toJson() => { |
| 35 | - "complex-union-array": List<dynamic>.from(complexUnionArray.map((x) => x)), | |
| 36 | 35 | "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", |
| 37 | - "date-time": dateTime.toIso8601String(), | |
| 38 | 36 | "time": time, |
| 37 | + "date-time": dateTime.toIso8601String(), | |
| 39 | 38 | "union-array": List<dynamic>.from(unionArray.map((x) => x)), |
| 39 | + "complex-union-array": List<dynamic>.from(complexUnionArray.map((x) => x)), | |
| 40 | 40 | }; |
| 41 | 41 | } |
Mschema-elixirdefault / QuickType.ex+9 −9
| @@ -6,15 +6,15 @@ | ||
| 6 | 6 | # Encode into a JSON string: TopLevel.to_json(struct) |
| 7 | 7 | |
| 8 | 8 | defmodule TopLevel do |
| 9 | - @enforce_keys [:complex_union_array, :date, :date_time, :time, :union_array] | |
| 10 | - defstruct [:complex_union_array, :date, :date_time, :time, :union_array] | |
| 9 | + @enforce_keys [:date, :time, :date_time, :union_array, :complex_union_array] | |
| 10 | + defstruct [:date, :time, :date_time, :union_array, :complex_union_array] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | - complex_union_array: [integer() | String.t()], | |
| 14 | 13 | date: String.t(), |
| 15 | - date_time: String.t(), | |
| 16 | 14 | time: String.t(), |
| 17 | - union_array: [String.t()] | |
| 15 | + date_time: String.t(), | |
| 16 | + union_array: [String.t()], | |
| 17 | + complex_union_array: [integer() | String.t()] | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | def decode_complex_union_array_element(value) when is_integer(value), do: value |
| @@ -27,11 +27,11 @@ defmodule TopLevel do | ||
| 27 | 27 | |
| 28 | 28 | def from_map(m) do |
| 29 | 29 | %TopLevel{ |
| 30 | - complex_union_array: Enum.map(m["complex-union-array"], &decode_complex_union_array_element/1), | |
| 31 | 30 | date: m["date"], |
| 32 | - date_time: m["date-time"], | |
| 33 | 31 | time: m["time"], |
| 32 | + date_time: m["date-time"], | |
| 34 | 33 | union_array: m["union-array"], |
| 34 | + complex_union_array: Enum.map(m["complex-union-array"], &decode_complex_union_array_element/1), | |
| 35 | 35 | } |
| 36 | 36 | end |
| 37 | 37 | |
| @@ -43,11 +43,11 @@ defmodule TopLevel do | ||
| 43 | 43 | |
| 44 | 44 | def to_map(struct) do |
| 45 | 45 | %{ |
| 46 | - "complex-union-array" => struct.complex_union_array && Enum.map(struct.complex_union_array, &encode_complex_union_array_element/1), | |
| 47 | 46 | "date" => struct.date, |
| 48 | - "date-time" => struct.date_time, | |
| 49 | 47 | "time" => struct.time, |
| 48 | + "date-time" => struct.date_time, | |
| 50 | 49 | "union-array" => struct.union_array, |
| 50 | + "complex-union-array" => struct.complex_union_array && Enum.map(struct.complex_union_array, &encode_complex_union_array_element/1), | |
| 51 | 51 | } |
| 52 | 52 | end |
Mschema-elmdefault / QuickType.elm+8 −8
| @@ -24,11 +24,11 @@ import Json.Encode as Jenc | ||
| 24 | 24 | import Dict exposing (Dict) |
| 25 | 25 | |
| 26 | 26 | type alias QuickType = |
| 27 | - { complexUnionArray : List ComplexUnionArray | |
| 28 | - , date : String | |
| 29 | - , dateTime : String | |
| 27 | + { date : String | |
| 30 | 28 | , time : String |
| 29 | + , dateTime : String | |
| 31 | 30 | , unionArray : List String |
| 31 | + , complexUnionArray : List ComplexUnionArray | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | type ComplexUnionArray |
| @@ -43,20 +43,20 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 43 | 43 | quickType : Jdec.Decoder QuickType |
| 44 | 44 | quickType = |
| 45 | 45 | Jdec.succeed QuickType |
| 46 | - |> Jpipe.required "complex-union-array" (Jdec.list complexUnionArray) | |
| 47 | 46 | |> Jpipe.required "date" Jdec.string |
| 48 | - |> Jpipe.required "date-time" Jdec.string | |
| 49 | 47 | |> Jpipe.required "time" Jdec.string |
| 48 | + |> Jpipe.required "date-time" Jdec.string | |
| 50 | 49 | |> Jpipe.required "union-array" (Jdec.list Jdec.string) |
| 50 | + |> Jpipe.required "complex-union-array" (Jdec.list complexUnionArray) | |
| 51 | 51 | |
| 52 | 52 | encodeQuickType : QuickType -> Jenc.Value |
| 53 | 53 | encodeQuickType x = |
| 54 | 54 | Jenc.object |
| 55 | - [ ("complex-union-array", Jenc.list encodeComplexUnionArray x.complexUnionArray) | |
| 56 | - , ("date", Jenc.string x.date) | |
| 57 | - , ("date-time", Jenc.string x.dateTime) | |
| 55 | + [ ("date", Jenc.string x.date) | |
| 58 | 56 | , ("time", Jenc.string x.time) |
| 57 | + , ("date-time", Jenc.string x.dateTime) | |
| 59 | 58 | , ("union-array", Jenc.list Jenc.string x.unionArray) |
| 59 | + , ("complex-union-array", Jenc.list encodeComplexUnionArray x.complexUnionArray) | |
| 60 | 60 | ] |
| 61 | 61 | |
| 62 | 62 | complexUnionArray : Jdec.Decoder ComplexUnionArray |
Mschema-flowdefault / TopLevel.js+4 −4
| @@ -10,11 +10,11 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - "complex-union-array": ComplexUnionArrayElement[]; | |
| 14 | 13 | date: Date; |
| 15 | - "date-time": Date; | |
| 16 | 14 | time: string; |
| 15 | + "date-time": Date; | |
| 17 | 16 | "union-array": string[]; |
| 17 | + "complex-union-array": ComplexUnionArrayElement[]; | |
| 18 | 18 | }; |
| 19 | 19 | |
| 20 | 20 | export type ComplexUnionArrayElement = Date | ComplexUnionArrayEnum | number; |
| @@ -188,11 +188,11 @@ function r(name: string) { | ||
| 188 | 188 | |
| 189 | 189 | const typeMap: any = { |
| 190 | 190 | "TopLevel": o([ |
| 191 | - { json: "complex-union-array", js: "complex-union-array", typ: a(u(Date, r("ComplexUnionArrayEnum"), 0)) }, | |
| 192 | 191 | { json: "date", js: "date", typ: Date }, |
| 193 | - { json: "date-time", js: "date-time", typ: Date }, | |
| 194 | 192 | { json: "time", js: "time", typ: "" }, |
| 193 | + { json: "date-time", js: "date-time", typ: Date }, | |
| 195 | 194 | { json: "union-array", js: "union-array", typ: a("") }, |
| 195 | + { json: "complex-union-array", js: "complex-union-array", typ: a(u(Date, r("ComplexUnionArrayEnum"), 0)) }, | |
| 196 | 196 | ], false), |
| 197 | 197 | "ComplexUnionArrayEnum": [ |
| 198 | 198 | "foo", |
Mschema-golang-leading-commentsdefault / multi / TopLevel.go+2 −2
| @@ -14,9 +14,9 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | type TopLevel struct { |
| 17 | - ComplexUnionArray []ComplexUnionArrayElement `json:"complex-union-array"` | |
| 18 | 17 | Date string `json:"date"` |
| 19 | - DateTime time.Time `json:"date-time"` | |
| 20 | 18 | Time string `json:"time"` |
| 19 | + DateTime time.Time `json:"date-time"` | |
| 21 | 20 | UnionArray []string `json:"union-array"` |
| 21 | + ComplexUnionArray []ComplexUnionArrayElement `json:"complex-union-array"` | |
| 22 | 22 | } |
Mschema-golang-leading-commentsdefault / quicktype.go+2 −2
| @@ -17,11 +17,11 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | type TopLevel struct { |
| 20 | - ComplexUnionArray []ComplexUnionArrayElement `json:"complex-union-array"` | |
| 21 | 20 | Date string `json:"date"` |
| 22 | - DateTime time.Time `json:"date-time"` | |
| 23 | 21 | Time string `json:"time"` |
| 22 | + DateTime time.Time `json:"date-time"` | |
| 24 | 23 | UnionArray []string `json:"union-array"` |
| 24 | + ComplexUnionArray []ComplexUnionArrayElement `json:"complex-union-array"` | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | type ComplexUnionArrayEnum string |
Mschema-golangdefault / quicktype.go+2 −2
| @@ -23,11 +23,11 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | type TopLevel struct { |
| 26 | - ComplexUnionArray []ComplexUnionArrayElement `json:"complex-union-array"` | |
| 27 | 26 | Date string `json:"date"` |
| 28 | - DateTime time.Time `json:"date-time"` | |
| 29 | 27 | Time string `json:"time"` |
| 28 | + DateTime time.Time `json:"date-time"` | |
| 30 | 29 | UnionArray []string `json:"union-array"` |
| 30 | + ComplexUnionArray []ComplexUnionArrayElement `json:"complex-union-array"` | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | type ComplexUnionArrayEnum string |
Mschema-haskelldefault / QuickType.hs+10 −10
| @@ -14,11 +14,11 @@ import Data.HashMap.Strict (HashMap) | ||
| 14 | 14 | import Data.Text (Text) |
| 15 | 15 | |
| 16 | 16 | data QuickType = QuickType |
| 17 | - { complexUnionArrayQuickType :: [ComplexUnionArray] | |
| 18 | - , dateQuickType :: Text | |
| 19 | - , dateTimeQuickType :: Text | |
| 17 | + { dateQuickType :: Text | |
| 20 | 18 | , timeQuickType :: Text |
| 19 | + , dateTimeQuickType :: Text | |
| 21 | 20 | , unionArrayQuickType :: [Text] |
| 21 | + , complexUnionArrayQuickType :: [ComplexUnionArray] | |
| 22 | 22 | } deriving (Show) |
| 23 | 23 | |
| 24 | 24 | data ComplexUnionArray |
| @@ -30,22 +30,22 @@ decodeTopLevel :: ByteString -> Maybe QuickType | ||
| 30 | 30 | decodeTopLevel = decode |
| 31 | 31 | |
| 32 | 32 | instance ToJSON QuickType where |
| 33 | - toJSON (QuickType complexUnionArrayQuickType dateQuickType dateTimeQuickType timeQuickType unionArrayQuickType) = | |
| 33 | + toJSON (QuickType dateQuickType timeQuickType dateTimeQuickType unionArrayQuickType complexUnionArrayQuickType) = | |
| 34 | 34 | object |
| 35 | - [ "complex-union-array" .= complexUnionArrayQuickType | |
| 36 | - , "date" .= dateQuickType | |
| 37 | - , "date-time" .= dateTimeQuickType | |
| 35 | + [ "date" .= dateQuickType | |
| 38 | 36 | , "time" .= timeQuickType |
| 37 | + , "date-time" .= dateTimeQuickType | |
| 39 | 38 | , "union-array" .= unionArrayQuickType |
| 39 | + , "complex-union-array" .= complexUnionArrayQuickType | |
| 40 | 40 | ] |
| 41 | 41 | |
| 42 | 42 | instance FromJSON QuickType where |
| 43 | 43 | parseJSON (Object v) = QuickType |
| 44 | - <$> v .: "complex-union-array" | |
| 45 | - <*> v .: "date" | |
| 46 | - <*> v .: "date-time" | |
| 44 | + <$> v .: "date" | |
| 47 | 45 | <*> v .: "time" |
| 46 | + <*> v .: "date-time" | |
| 48 | 47 | <*> v .: "union-array" |
| 48 | + <*> v .: "complex-union-array" | |
| 49 | 49 | |
| 50 | 50 | instance ToJSON ComplexUnionArray where |
| 51 | 51 | toJSON (IntegerInComplexUnionArray x) = toJSON x |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+12 −12
| @@ -7,34 +7,34 @@ import java.time.OffsetTime; | ||
| 7 | 7 | import java.util.List; |
| 8 | 8 | |
| 9 | 9 | public class TopLevel { |
| 10 | - private List<ComplexUnionArrayElement> complexUnionArray; | |
| 11 | 10 | private LocalDate date; |
| 12 | - private OffsetDateTime dateTime; | |
| 13 | 11 | private OffsetTime time; |
| 12 | + private OffsetDateTime dateTime; | |
| 14 | 13 | private List<UnionArray> unionArray; |
| 15 | - | |
| 16 | - @JsonProperty("complex-union-array") | |
| 17 | - public List<ComplexUnionArrayElement> getComplexUnionArray() { return complexUnionArray; } | |
| 18 | - @JsonProperty("complex-union-array") | |
| 19 | - public void setComplexUnionArray(List<ComplexUnionArrayElement> value) { this.complexUnionArray = value; } | |
| 14 | + private List<ComplexUnionArrayElement> complexUnionArray; | |
| 20 | 15 | |
| 21 | 16 | @JsonProperty("date") |
| 22 | 17 | public LocalDate getDate() { return date; } |
| 23 | 18 | @JsonProperty("date") |
| 24 | 19 | public void setDate(LocalDate value) { this.date = value; } |
| 25 | 20 | |
| 26 | - @JsonProperty("date-time") | |
| 27 | - public OffsetDateTime getDateTime() { return dateTime; } | |
| 28 | - @JsonProperty("date-time") | |
| 29 | - public void setDateTime(OffsetDateTime value) { this.dateTime = value; } | |
| 30 | - | |
| 31 | 21 | @JsonProperty("time") |
| 32 | 22 | public OffsetTime getTime() { return time; } |
| 33 | 23 | @JsonProperty("time") |
| 34 | 24 | public void setTime(OffsetTime value) { this.time = value; } |
| 35 | 25 | |
| 26 | + @JsonProperty("date-time") | |
| 27 | + public OffsetDateTime getDateTime() { return dateTime; } | |
| 28 | + @JsonProperty("date-time") | |
| 29 | + public void setDateTime(OffsetDateTime value) { this.dateTime = value; } | |
| 30 | + | |
| 36 | 31 | @JsonProperty("union-array") |
| 37 | 32 | public List<UnionArray> getUnionArray() { return unionArray; } |
| 38 | 33 | @JsonProperty("union-array") |
| 39 | 34 | public void setUnionArray(List<UnionArray> value) { this.unionArray = value; } |
| 35 | + | |
| 36 | + @JsonProperty("complex-union-array") | |
| 37 | + public List<ComplexUnionArrayElement> getComplexUnionArray() { return complexUnionArray; } | |
| 38 | + @JsonProperty("complex-union-array") | |
| 39 | + public void setComplexUnionArray(List<ComplexUnionArrayElement> value) { this.complexUnionArray = value; } | |
| 40 | 40 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+12 −12
| @@ -7,34 +7,34 @@ import java.time.OffsetTime; | ||
| 7 | 7 | import java.util.List; |
| 8 | 8 | |
| 9 | 9 | public class TopLevel { |
| 10 | - private List<ComplexUnionArrayElement> complexUnionArray; | |
| 11 | 10 | private LocalDate date; |
| 12 | - private OffsetDateTime dateTime; | |
| 13 | 11 | private OffsetTime time; |
| 12 | + private OffsetDateTime dateTime; | |
| 14 | 13 | private List<UnionArray> unionArray; |
| 15 | - | |
| 16 | - @JsonProperty("complex-union-array") | |
| 17 | - public List<ComplexUnionArrayElement> getComplexUnionArray() { return complexUnionArray; } | |
| 18 | - @JsonProperty("complex-union-array") | |
| 19 | - public void setComplexUnionArray(List<ComplexUnionArrayElement> value) { this.complexUnionArray = value; } | |
| 14 | + private List<ComplexUnionArrayElement> complexUnionArray; | |
| 20 | 15 | |
| 21 | 16 | @JsonProperty("date") |
| 22 | 17 | public LocalDate getDate() { return date; } |
| 23 | 18 | @JsonProperty("date") |
| 24 | 19 | public void setDate(LocalDate value) { this.date = value; } |
| 25 | 20 | |
| 26 | - @JsonProperty("date-time") | |
| 27 | - public OffsetDateTime getDateTime() { return dateTime; } | |
| 28 | - @JsonProperty("date-time") | |
| 29 | - public void setDateTime(OffsetDateTime value) { this.dateTime = value; } | |
| 30 | - | |
| 31 | 21 | @JsonProperty("time") |
| 32 | 22 | public OffsetTime getTime() { return time; } |
| 33 | 23 | @JsonProperty("time") |
| 34 | 24 | public void setTime(OffsetTime value) { this.time = value; } |
| 35 | 25 | |
| 26 | + @JsonProperty("date-time") | |
| 27 | + public OffsetDateTime getDateTime() { return dateTime; } | |
| 28 | + @JsonProperty("date-time") | |
| 29 | + public void setDateTime(OffsetDateTime value) { this.dateTime = value; } | |
| 30 | + | |
| 36 | 31 | @JsonProperty("union-array") |
| 37 | 32 | public List<UnionArray> getUnionArray() { return unionArray; } |
| 38 | 33 | @JsonProperty("union-array") |
| 39 | 34 | public void setUnionArray(List<UnionArray> value) { this.unionArray = value; } |
| 35 | + | |
| 36 | + @JsonProperty("complex-union-array") | |
| 37 | + public List<ComplexUnionArrayElement> getComplexUnionArray() { return complexUnionArray; } | |
| 38 | + @JsonProperty("complex-union-array") | |
| 39 | + public void setComplexUnionArray(List<ComplexUnionArrayElement> value) { this.complexUnionArray = value; } | |
| 40 | 40 | } |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -172,11 +172,11 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "complex-union-array", js: "complex-union-array", typ: a(u(Date, r("ComplexUnionArrayEnum"), 0)) }, | |
| 176 | 175 | { json: "date", js: "date", typ: Date }, |
| 177 | - { json: "date-time", js: "date-time", typ: Date }, | |
| 178 | 176 | { json: "time", js: "time", typ: "" }, |
| 177 | + { json: "date-time", js: "date-time", typ: Date }, | |
| 179 | 178 | { json: "union-array", js: "union-array", typ: a("") }, |
| 179 | + { json: "complex-union-array", js: "complex-union-array", typ: a(u(Date, r("ComplexUnionArrayEnum"), 0)) }, | |
| 180 | 180 | ], false), |
| 181 | 181 | "ComplexUnionArrayEnum": [ |
| 182 | 182 | "foo", |
Mschema-kotlin-jacksondefault / TopLevel.kt+7 −7
| @@ -40,20 +40,20 @@ val mapper = jacksonObjectMapper().apply { | ||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | data class TopLevel ( |
| 43 | - @get:JsonProperty("complex-union-array", required=true)@field:JsonProperty("complex-union-array", required=true) | |
| 44 | - val complexUnionArray: List<ComplexUnionArrayElement>, | |
| 45 | - | |
| 46 | 43 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 47 | 44 | val date: LocalDate, |
| 48 | 45 | |
| 49 | - @get:JsonProperty("date-time", required=true)@field:JsonProperty("date-time", required=true) | |
| 50 | - val dateTime: OffsetDateTime, | |
| 51 | - | |
| 52 | 46 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 53 | 47 | val time: OffsetTime, |
| 54 | 48 | |
| 49 | + @get:JsonProperty("date-time", required=true)@field:JsonProperty("date-time", required=true) | |
| 50 | + val dateTime: OffsetDateTime, | |
| 51 | + | |
| 55 | 52 | @get:JsonProperty("union-array", required=true)@field:JsonProperty("union-array", required=true) |
| 56 | - val unionArray: List<UnionArray> | |
| 53 | + val unionArray: List<UnionArray>, | |
| 54 | + | |
| 55 | + @get:JsonProperty("complex-union-array", required=true)@field:JsonProperty("complex-union-array", required=true) | |
| 56 | + val complexUnionArray: List<ComplexUnionArrayElement> | |
| 57 | 57 | ) { |
| 58 | 58 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+5 −6
| @@ -27,18 +27,17 @@ private val klaxon = Klaxon() | ||
| 27 | 27 | .convert(UnionArray::class, { UnionArray.fromJson(it) }, { it.toJson() }, true) |
| 28 | 28 | |
| 29 | 29 | data class TopLevel ( |
| 30 | - @Json(name = "complex-union-array") | |
| 31 | - val complexUnionArray: List<ComplexUnionArrayElement>, | |
| 32 | - | |
| 33 | 30 | val date: LocalDate, |
| 31 | + val time: OffsetTime, | |
| 34 | 32 | |
| 35 | 33 | @Json(name = "date-time") |
| 36 | 34 | val dateTime: OffsetDateTime, |
| 37 | 35 | |
| 38 | - val time: OffsetTime, | |
| 39 | - | |
| 40 | 36 | @Json(name = "union-array") |
| 41 | - val unionArray: List<UnionArray> | |
| 37 | + val unionArray: List<UnionArray>, | |
| 38 | + | |
| 39 | + @Json(name = "complex-union-array") | |
| 40 | + val complexUnionArray: List<ComplexUnionArrayElement> | |
| 42 | 41 | ) { |
| 43 | 42 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-phpdefault / TopLevel.php+131 −131
| @@ -4,116 +4,72 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private array $complexUnionArray; // json:complex-union-array Required | |
| 8 | 7 | private string $date; // json:date Required |
| 9 | - private DateTime $dateTime; // json:date-time Required | |
| 10 | 8 | private string $time; // json:time Required |
| 9 | + private DateTime $dateTime; // json:date-time Required | |
| 11 | 10 | private array $unionArray; // json:union-array Required |
| 11 | + private array $complexUnionArray; // json:complex-union-array Required | |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * @param array $complexUnionArray | |
| 15 | 14 | * @param string $date |
| 16 | - * @param DateTime $dateTime | |
| 17 | 15 | * @param string $time |
| 16 | + * @param DateTime $dateTime | |
| 18 | 17 | * @param array $unionArray |
| 18 | + * @param array $complexUnionArray | |
| 19 | 19 | */ |
| 20 | - public function __construct(array $complexUnionArray, string $date, DateTime $dateTime, string $time, array $unionArray) { | |
| 21 | - $this->complexUnionArray = $complexUnionArray; | |
| 20 | + public function __construct(string $date, string $time, DateTime $dateTime, array $unionArray, array $complexUnionArray) { | |
| 22 | 21 | $this->date = $date; |
| 23 | - $this->dateTime = $dateTime; | |
| 24 | 22 | $this->time = $time; |
| 23 | + $this->dateTime = $dateTime; | |
| 25 | 24 | $this->unionArray = $unionArray; |
| 25 | + $this->complexUnionArray = $complexUnionArray; | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * @param array $value | |
| 29 | + * @param string $value | |
| 30 | 30 | * @throws Exception |
| 31 | - * @return array | |
| 31 | + * @return string | |
| 32 | 32 | */ |
| 33 | - public static function fromComplexUnionArray(array $value): array { | |
| 34 | - return array_map(function ($value) { | |
| 35 | - if (is_string($value) && in_array($value, ['foo', 'bar'], true)) { | |
| 36 | - return ComplexUnionArray::from($value); /*enum*/ | |
| 37 | - } elseif (is_string($value)) { | |
| 38 | - $tmp = DateTime::createFromFormat(DateTimeInterface::ISO8601, $value); | |
| 39 | - if (!is_a($tmp, 'DateTime')) { | |
| 40 | - throw new Exception('Attribute Error:TopLevel::'); | |
| 41 | - } | |
| 42 | - return $tmp; | |
| 43 | - } elseif (is_int($value)) { | |
| 44 | - return $value; /*int*/ | |
| 45 | - } else { | |
| 46 | - throw new Exception('Cannot deserialize union value in TopLevel'); | |
| 47 | - } | |
| 48 | - }, $value); | |
| 33 | + public static function fromDate(string $value): string { | |
| 34 | + return $value; /*string*/ | |
| 49 | 35 | } |
| 50 | 36 | |
| 51 | 37 | /** |
| 52 | 38 | * @throws Exception |
| 53 | - * @return array | |
| 39 | + * @return string | |
| 54 | 40 | */ |
| 55 | - public function toComplexUnionArray(): array { | |
| 56 | - if (TopLevel::validateComplexUnionArray($this->complexUnionArray)) { | |
| 57 | - return array_map(function ($value) { | |
| 58 | - if ($value instanceof ComplexUnionArray) { | |
| 59 | - return ComplexUnionArray::to($value); /*enum*/ | |
| 60 | - } elseif ($value instanceof DateTime) { | |
| 61 | - return $value->format(DateTimeInterface::ISO8601); | |
| 62 | - } elseif (is_int($value)) { | |
| 63 | - return $value; /*int*/ | |
| 64 | - } else { | |
| 65 | - throw new Exception('Union value has no matching member in TopLevel'); | |
| 66 | - } | |
| 67 | - }, $this->complexUnionArray); | |
| 41 | + public function toDate(): string { | |
| 42 | + if (TopLevel::validateDate($this->date)) { | |
| 43 | + return $this->date; /*string*/ | |
| 68 | 44 | } |
| 69 | - throw new Exception('never get to this TopLevel::complexUnionArray'); | |
| 45 | + throw new Exception('never get to this TopLevel::date'); | |
| 70 | 46 | } |
| 71 | 47 | |
| 72 | 48 | /** |
| 73 | - * @param array | |
| 49 | + * @param string | |
| 74 | 50 | * @return bool |
| 75 | 51 | * @throws Exception |
| 76 | 52 | */ |
| 77 | - public static function validateComplexUnionArray(array $value): bool { | |
| 78 | - if (!is_array($value)) { | |
| 79 | - throw new Exception("Attribute Error:TopLevel::complexUnionArray"); | |
| 80 | - } | |
| 81 | - array_walk($value, function($value_v) { | |
| 82 | - if ($value_v instanceof ComplexUnionArray) { | |
| 83 | - ComplexUnionArray::to($value_v); | |
| 84 | - } elseif ($value_v instanceof DateTime) { | |
| 85 | - if (!is_a($value_v, 'DateTime')) { | |
| 86 | - throw new Exception('Attribute Error:TopLevel::complexUnionArray'); | |
| 87 | - } | |
| 88 | - } elseif (is_int($value_v)) { | |
| 89 | - if (!is_integer($value_v)) { | |
| 90 | - throw new Exception("Attribute Error:TopLevel::complexUnionArray"); | |
| 91 | - } | |
| 92 | - } else { | |
| 93 | - throw new Exception("Attribute Error:TopLevel::complexUnionArray"); | |
| 94 | - } | |
| 95 | - }); | |
| 53 | + public static function validateDate(string $value): bool { | |
| 96 | 54 | return true; |
| 97 | 55 | } |
| 98 | 56 | |
| 99 | 57 | /** |
| 100 | 58 | * @throws Exception |
| 101 | - * @return array | |
| 59 | + * @return string | |
| 102 | 60 | */ |
| 103 | - public function getComplexUnionArray(): array { | |
| 104 | - if (TopLevel::validateComplexUnionArray($this->complexUnionArray)) { | |
| 105 | - return $this->complexUnionArray; | |
| 61 | + public function getDate(): string { | |
| 62 | + if (TopLevel::validateDate($this->date)) { | |
| 63 | + return $this->date; | |
| 106 | 64 | } |
| 107 | - throw new Exception('never get to getComplexUnionArray TopLevel::complexUnionArray'); | |
| 65 | + throw new Exception('never get to getDate TopLevel::date'); | |
| 108 | 66 | } |
| 109 | 67 | |
| 110 | 68 | /** |
| 111 | - * @return array | |
| 69 | + * @return string | |
| 112 | 70 | */ |
| 113 | - public static function sampleComplexUnionArray(): array { | |
| 114 | - return array( | |
| 115 | - ComplexUnionArray::sample() /*enum*/ | |
| 116 | - ); /* 31:complexUnionArray*/ | |
| 71 | + public static function sampleDate(): string { | |
| 72 | + return 'TopLevel::date::31'; /*31:date*/ | |
| 117 | 73 | } |
| 118 | 74 | |
| 119 | 75 | /** |
| @@ -121,7 +77,7 @@ class TopLevel { | ||
| 121 | 77 | * @throws Exception |
| 122 | 78 | * @return string |
| 123 | 79 | */ |
| 124 | - public static function fromDate(string $value): string { | |
| 80 | + public static function fromTime(string $value): string { | |
| 125 | 81 | return $value; /*string*/ |
| 126 | 82 | } |
| 127 | 83 | |
| @@ -129,11 +85,11 @@ class TopLevel { | ||
| 129 | 85 | * @throws Exception |
| 130 | 86 | * @return string |
| 131 | 87 | */ |
| 132 | - public function toDate(): string { | |
| 133 | - if (TopLevel::validateDate($this->date)) { | |
| 134 | - return $this->date; /*string*/ | |
| 88 | + public function toTime(): string { | |
| 89 | + if (TopLevel::validateTime($this->time)) { | |
| 90 | + return $this->time; /*string*/ | |
| 135 | 91 | } |
| 136 | - throw new Exception('never get to this TopLevel::date'); | |
| 92 | + throw new Exception('never get to this TopLevel::time'); | |
| 137 | 93 | } |
| 138 | 94 | |
| 139 | 95 | /** |
| @@ -141,7 +97,7 @@ class TopLevel { | ||
| 141 | 97 | * @return bool |
| 142 | 98 | * @throws Exception |
| 143 | 99 | */ |
| 144 | - public static function validateDate(string $value): bool { | |
| 100 | + public static function validateTime(string $value): bool { | |
| 145 | 101 | return true; |
| 146 | 102 | } |
| 147 | 103 | |
| @@ -149,18 +105,18 @@ class TopLevel { | ||
| 149 | 105 | * @throws Exception |
| 150 | 106 | * @return string |
| 151 | 107 | */ |
| 152 | - public function getDate(): string { | |
| 153 | - if (TopLevel::validateDate($this->date)) { | |
| 154 | - return $this->date; | |
| 108 | + public function getTime(): string { | |
| 109 | + if (TopLevel::validateTime($this->time)) { | |
| 110 | + return $this->time; | |
| 155 | 111 | } |
| 156 | - throw new Exception('never get to getDate TopLevel::date'); | |
| 112 | + throw new Exception('never get to getTime TopLevel::time'); | |
| 157 | 113 | } |
| 158 | 114 | |
| 159 | 115 | /** |
| 160 | 116 | * @return string |
| 161 | 117 | */ |
| 162 | - public static function sampleDate(): string { | |
| 163 | - return 'TopLevel::date::32'; /*32:date*/ | |
| 118 | + public static function sampleTime(): string { | |
| 119 | + return 'TopLevel::time::32'; /*32:time*/ | |
| 164 | 120 | } |
| 165 | 121 | |
| 166 | 122 | /** |
| @@ -218,50 +174,64 @@ class TopLevel { | ||
| 218 | 174 | } |
| 219 | 175 | |
| 220 | 176 | /** |
| 221 | - * @param string $value | |
| 177 | + * @param array $value | |
| 222 | 178 | * @throws Exception |
| 223 | - * @return string | |
| 179 | + * @return array | |
| 224 | 180 | */ |
| 225 | - public static function fromTime(string $value): string { | |
| 226 | - return $value; /*string*/ | |
| 181 | + public static function fromUnionArray(array $value): array { | |
| 182 | + return array_map(function ($value) { | |
| 183 | + return $value; /*string*/ | |
| 184 | + }, $value); | |
| 227 | 185 | } |
| 228 | 186 | |
| 229 | 187 | /** |
| 230 | 188 | * @throws Exception |
| 231 | - * @return string | |
| 189 | + * @return array | |
| 232 | 190 | */ |
| 233 | - public function toTime(): string { | |
| 234 | - if (TopLevel::validateTime($this->time)) { | |
| 235 | - return $this->time; /*string*/ | |
| 191 | + public function toUnionArray(): array { | |
| 192 | + if (TopLevel::validateUnionArray($this->unionArray)) { | |
| 193 | + return array_map(function ($value) { | |
| 194 | + return $value; /*string*/ | |
| 195 | + }, $this->unionArray); | |
| 236 | 196 | } |
| 237 | - throw new Exception('never get to this TopLevel::time'); | |
| 197 | + throw new Exception('never get to this TopLevel::unionArray'); | |
| 238 | 198 | } |
| 239 | 199 | |
| 240 | 200 | /** |
| 241 | - * @param string | |
| 201 | + * @param array | |
| 242 | 202 | * @return bool |
| 243 | 203 | * @throws Exception |
| 244 | 204 | */ |
| 245 | - public static function validateTime(string $value): bool { | |
| 205 | + public static function validateUnionArray(array $value): bool { | |
| 206 | + if (!is_array($value)) { | |
| 207 | + throw new Exception("Attribute Error:TopLevel::unionArray"); | |
| 208 | + } | |
| 209 | + array_walk($value, function($value_v) { | |
| 210 | + if (!is_string($value_v)) { | |
| 211 | + throw new Exception("Attribute Error:TopLevel::unionArray"); | |
| 212 | + } | |
| 213 | + }); | |
| 246 | 214 | return true; |
| 247 | 215 | } |
| 248 | 216 | |
| 249 | 217 | /** |
| 250 | 218 | * @throws Exception |
| 251 | - * @return string | |
| 219 | + * @return array | |
| 252 | 220 | */ |
| 253 | - public function getTime(): string { | |
| 254 | - if (TopLevel::validateTime($this->time)) { | |
| 255 | - return $this->time; | |
| 221 | + public function getUnionArray(): array { | |
| 222 | + if (TopLevel::validateUnionArray($this->unionArray)) { | |
| 223 | + return $this->unionArray; | |
| 256 | 224 | } |
| 257 | - throw new Exception('never get to getTime TopLevel::time'); | |
| 225 | + throw new Exception('never get to getUnionArray TopLevel::unionArray'); | |
| 258 | 226 | } |
| 259 | 227 | |
| 260 | 228 | /** |
| 261 | - * @return string | |
| 229 | + * @return array | |
| 262 | 230 | */ |
| 263 | - public static function sampleTime(): string { | |
| 264 | - return 'TopLevel::time::34'; /*34:time*/ | |
| 231 | + public static function sampleUnionArray(): array { | |
| 232 | + return array( | |
| 233 | + 'TopLevel::::34' /*34:*/ | |
| 234 | + ); /* 34:unionArray*/ | |
| 265 | 235 | } |
| 266 | 236 | |
| 267 | 237 | /** |
| @@ -269,9 +239,21 @@ class TopLevel { | ||
| 269 | 239 | * @throws Exception |
| 270 | 240 | * @return array |
| 271 | 241 | */ |
| 272 | - public static function fromUnionArray(array $value): array { | |
| 242 | + public static function fromComplexUnionArray(array $value): array { | |
| 273 | 243 | return array_map(function ($value) { |
| 274 | - return $value; /*string*/ | |
| 244 | + if (is_string($value) && in_array($value, ['foo', 'bar'], true)) { | |
| 245 | + return ComplexUnionArray::from($value); /*enum*/ | |
| 246 | + } elseif (is_string($value)) { | |
| 247 | + $tmp = DateTime::createFromFormat(DateTimeInterface::ISO8601, $value); | |
| 248 | + if (!is_a($tmp, 'DateTime')) { | |
| 249 | + throw new Exception('Attribute Error:TopLevel::'); | |
| 250 | + } | |
| 251 | + return $tmp; | |
| 252 | + } elseif (is_int($value)) { | |
| 253 | + return $value; /*int*/ | |
| 254 | + } else { | |
| 255 | + throw new Exception('Cannot deserialize union value in TopLevel'); | |
| 256 | + } | |
| 275 | 257 | }, $value); |
| 276 | 258 | } |
| 277 | 259 | |
| @@ -279,13 +261,21 @@ class TopLevel { | ||
| 279 | 261 | * @throws Exception |
| 280 | 262 | * @return array |
| 281 | 263 | */ |
| 282 | - public function toUnionArray(): array { | |
| 283 | - if (TopLevel::validateUnionArray($this->unionArray)) { | |
| 264 | + public function toComplexUnionArray(): array { | |
| 265 | + if (TopLevel::validateComplexUnionArray($this->complexUnionArray)) { | |
| 284 | 266 | return array_map(function ($value) { |
| 285 | - return $value; /*string*/ | |
| 286 | - }, $this->unionArray); | |
| 267 | + if ($value instanceof ComplexUnionArray) { | |
| 268 | + return ComplexUnionArray::to($value); /*enum*/ | |
| 269 | + } elseif ($value instanceof DateTime) { | |
| 270 | + return $value->format(DateTimeInterface::ISO8601); | |
| 271 | + } elseif (is_int($value)) { | |
| 272 | + return $value; /*int*/ | |
| 273 | + } else { | |
| 274 | + throw new Exception('Union value has no matching member in TopLevel'); | |
| 275 | + } | |
| 276 | + }, $this->complexUnionArray); | |
| 287 | 277 | } |
| 288 | - throw new Exception('never get to this TopLevel::unionArray'); | |
| 278 | + throw new Exception('never get to this TopLevel::complexUnionArray'); | |
| 289 | 279 | } |
| 290 | 280 | |
| 291 | 281 | /** |
| @@ -293,13 +283,23 @@ class TopLevel { | ||
| 293 | 283 | * @return bool |
| 294 | 284 | * @throws Exception |
| 295 | 285 | */ |
| 296 | - public static function validateUnionArray(array $value): bool { | |
| 286 | + public static function validateComplexUnionArray(array $value): bool { | |
| 297 | 287 | if (!is_array($value)) { |
| 298 | - throw new Exception("Attribute Error:TopLevel::unionArray"); | |
| 288 | + throw new Exception("Attribute Error:TopLevel::complexUnionArray"); | |
| 299 | 289 | } |
| 300 | 290 | array_walk($value, function($value_v) { |
| 301 | - if (!is_string($value_v)) { | |
| 302 | - throw new Exception("Attribute Error:TopLevel::unionArray"); | |
| 291 | + if ($value_v instanceof ComplexUnionArray) { | |
| 292 | + ComplexUnionArray::to($value_v); | |
| 293 | + } elseif ($value_v instanceof DateTime) { | |
| 294 | + if (!is_a($value_v, 'DateTime')) { | |
| 295 | + throw new Exception('Attribute Error:TopLevel::complexUnionArray'); | |
| 296 | + } | |
| 297 | + } elseif (is_int($value_v)) { | |
| 298 | + if (!is_integer($value_v)) { | |
| 299 | + throw new Exception("Attribute Error:TopLevel::complexUnionArray"); | |
| 300 | + } | |
| 301 | + } else { | |
| 302 | + throw new Exception("Attribute Error:TopLevel::complexUnionArray"); | |
| 303 | 303 | } |
| 304 | 304 | }); |
| 305 | 305 | return true; |
| @@ -309,20 +309,20 @@ class TopLevel { | ||
| 309 | 309 | * @throws Exception |
| 310 | 310 | * @return array |
| 311 | 311 | */ |
| 312 | - public function getUnionArray(): array { | |
| 313 | - if (TopLevel::validateUnionArray($this->unionArray)) { | |
| 314 | - return $this->unionArray; | |
| 312 | + public function getComplexUnionArray(): array { | |
| 313 | + if (TopLevel::validateComplexUnionArray($this->complexUnionArray)) { | |
| 314 | + return $this->complexUnionArray; | |
| 315 | 315 | } |
| 316 | - throw new Exception('never get to getUnionArray TopLevel::unionArray'); | |
| 316 | + throw new Exception('never get to getComplexUnionArray TopLevel::complexUnionArray'); | |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
| 320 | 320 | * @return array |
| 321 | 321 | */ |
| 322 | - public static function sampleUnionArray(): array { | |
| 322 | + public static function sampleComplexUnionArray(): array { | |
| 323 | 323 | return array( |
| 324 | - 'TopLevel::::35' /*35:*/ | |
| 325 | - ); /* 35:unionArray*/ | |
| 324 | + ComplexUnionArray::sample() /*enum*/ | |
| 325 | + ); /* 35:complexUnionArray*/ | |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | /** |
| @@ -330,11 +330,11 @@ class TopLevel { | ||
| 330 | 330 | * @return bool |
| 331 | 331 | */ |
| 332 | 332 | public function validate(): bool { |
| 333 | - return TopLevel::validateComplexUnionArray($this->complexUnionArray) | |
| 334 | - || TopLevel::validateDate($this->date) | |
| 335 | - || TopLevel::validateDateTime($this->dateTime) | |
| 333 | + return TopLevel::validateDate($this->date) | |
| 336 | 334 | || TopLevel::validateTime($this->time) |
| 337 | - || TopLevel::validateUnionArray($this->unionArray); | |
| 335 | + || TopLevel::validateDateTime($this->dateTime) | |
| 336 | + || TopLevel::validateUnionArray($this->unionArray) | |
| 337 | + || TopLevel::validateComplexUnionArray($this->complexUnionArray); | |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
| @@ -343,11 +343,11 @@ class TopLevel { | ||
| 343 | 343 | */ |
| 344 | 344 | public function to(): stdClass { |
| 345 | 345 | $out = new stdClass(); |
| 346 | - $out->{'complex-union-array'} = $this->toComplexUnionArray(); | |
| 347 | 346 | $out->{'date'} = $this->toDate(); |
| 348 | - $out->{'date-time'} = $this->toDateTime(); | |
| 349 | 347 | $out->{'time'} = $this->toTime(); |
| 348 | + $out->{'date-time'} = $this->toDateTime(); | |
| 350 | 349 | $out->{'union-array'} = $this->toUnionArray(); |
| 350 | + $out->{'complex-union-array'} = $this->toComplexUnionArray(); | |
| 351 | 351 | return $out; |
| 352 | 352 | } |
| 353 | 353 | |
| @@ -358,11 +358,11 @@ class TopLevel { | ||
| 358 | 358 | */ |
| 359 | 359 | public static function from(stdClass $obj): TopLevel { |
| 360 | 360 | return new TopLevel( |
| 361 | - TopLevel::fromComplexUnionArray($obj->{'complex-union-array'}) | |
| 362 | - ,TopLevel::fromDate($obj->{'date'}) | |
| 363 | - ,TopLevel::fromDateTime($obj->{'date-time'}) | |
| 361 | + TopLevel::fromDate($obj->{'date'}) | |
| 364 | 362 | ,TopLevel::fromTime($obj->{'time'}) |
| 363 | + ,TopLevel::fromDateTime($obj->{'date-time'}) | |
| 365 | 364 | ,TopLevel::fromUnionArray($obj->{'union-array'}) |
| 365 | + ,TopLevel::fromComplexUnionArray($obj->{'complex-union-array'}) | |
| 366 | 366 | ); |
| 367 | 367 | } |
| 368 | 368 | |
| @@ -371,11 +371,11 @@ class TopLevel { | ||
| 371 | 371 | */ |
| 372 | 372 | public static function sample(): TopLevel { |
| 373 | 373 | return new TopLevel( |
| 374 | - TopLevel::sampleComplexUnionArray() | |
| 375 | - ,TopLevel::sampleDate() | |
| 376 | - ,TopLevel::sampleDateTime() | |
| 374 | + TopLevel::sampleDate() | |
| 377 | 375 | ,TopLevel::sampleTime() |
| 376 | + ,TopLevel::sampleDateTime() | |
| 378 | 377 | ,TopLevel::sampleUnionArray() |
| 378 | + ,TopLevel::sampleComplexUnionArray() | |
| 379 | 379 | ); |
| 380 | 380 | } |
| 381 | 381 | } |
Mschema-pikedefault / TopLevel.pmod+6 −6
| @@ -13,19 +13,19 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - array(ComplexUnionArray) complex_union_array; // json: "complex-union-array" | |
| 17 | 16 | string date; // json: "date" |
| 18 | - string date_time; // json: "date-time" | |
| 19 | 17 | string time; // json: "time" |
| 18 | + string date_time; // json: "date-time" | |
| 20 | 19 | array(string) union_array; // json: "union-array" |
| 20 | + array(ComplexUnionArray) complex_union_array; // json: "complex-union-array" | |
| 21 | 21 | |
| 22 | 22 | string encode_json() { |
| 23 | 23 | mapping(string:mixed) json = ([ |
| 24 | - "complex-union-array" : complex_union_array, | |
| 25 | 24 | "date" : date, |
| 26 | - "date-time" : date_time, | |
| 27 | 25 | "time" : time, |
| 26 | + "date-time" : date_time, | |
| 28 | 27 | "union-array" : union_array, |
| 28 | + "complex-union-array" : complex_union_array, | |
| 29 | 29 | ]); |
| 30 | 30 | |
| 31 | 31 | return Standards.JSON.encode(json); |
| @@ -35,11 +35,11 @@ class TopLevel { | ||
| 35 | 35 | TopLevel TopLevel_from_JSON(mixed json) { |
| 36 | 36 | TopLevel retval = TopLevel(); |
| 37 | 37 | |
| 38 | - retval.complex_union_array = json["complex-union-array"]; | |
| 39 | 38 | retval.date = json["date"]; |
| 40 | - retval.date_time = json["date-time"]; | |
| 41 | 39 | retval.time = json["time"]; |
| 40 | + retval.date_time = json["date-time"]; | |
| 42 | 41 | retval.union_array = json["union-array"]; |
| 42 | + retval.complex_union_array = json["complex-union-array"]; | |
| 43 | 43 | |
| 44 | 44 | return retval; |
| 45 | 45 | } |
Mschema-pythondefault / quicktype.py+21 −21
| @@ -10,20 +10,25 @@ T = TypeVar("T") | ||
| 10 | 10 | EnumT = TypeVar("EnumT", bound=Enum) |
| 11 | 11 | |
| 12 | 12 | |
| 13 | -def from_list(f: Callable[[Any], T], x: Any) -> list[T]: | |
| 14 | - assert isinstance(x, list) | |
| 15 | - return [f(y) for y in x] | |
| 13 | +def from_date(x: Any) -> datetime.date: | |
| 14 | + assert isinstance(x, str) and re.match(r"^\d{4}-\d{2}-\d{2}$", x) | |
| 15 | + return dateutil.parser.parse(x).date() | |
| 16 | 16 | |
| 17 | 17 | |
| 18 | -def from_int(x: Any) -> int: | |
| 19 | - assert isinstance(x, int) and not isinstance(x, bool) | |
| 20 | - return x | |
| 18 | +def from_time(x: Any) -> datetime.time: | |
| 19 | + assert isinstance(x, str) and re.match(r"^\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$", x) | |
| 20 | + return dateutil.parser.parse(x).time() | |
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | def from_datetime(x: Any) -> datetime.datetime: |
| 24 | 24 | return dateutil.parser.parse(x) |
| 25 | 25 | |
| 26 | 26 | |
| 27 | +def from_list(f: Callable[[Any], T], x: Any) -> list[T]: | |
| 28 | + assert isinstance(x, list) | |
| 29 | + return [f(y) for y in x] | |
| 30 | + | |
| 31 | + | |
| 27 | 32 | def from_union(fs, x): |
| 28 | 33 | for f in fs: |
| 29 | 34 | try: |
| @@ -33,14 +38,9 @@ def from_union(fs, x): | ||
| 33 | 38 | assert False |
| 34 | 39 | |
| 35 | 40 | |
| 36 | -def from_date(x: Any) -> datetime.date: | |
| 37 | - assert isinstance(x, str) and re.match(r"^\d{4}-\d{2}-\d{2}$", x) | |
| 38 | - return dateutil.parser.parse(x).date() | |
| 39 | - | |
| 40 | - | |
| 41 | -def from_time(x: Any) -> datetime.time: | |
| 42 | - assert isinstance(x, str) and re.match(r"^\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$", x) | |
| 43 | - return dateutil.parser.parse(x).time() | |
| 41 | +def from_int(x: Any) -> int: | |
| 42 | + assert isinstance(x, int) and not isinstance(x, bool) | |
| 43 | + return x | |
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | def to_enum(c: Type[EnumT], x: Any) -> EnumT: |
| @@ -60,29 +60,29 @@ class ComplexUnionArrayEnum(Enum): | ||
| 60 | 60 | |
| 61 | 61 | @dataclass |
| 62 | 62 | class TopLevel: |
| 63 | - complex_union_array: list[int | ComplexUnionArrayEnum | datetime.datetime] | |
| 64 | 63 | date: datetime.date |
| 65 | - date_time: datetime.datetime | |
| 66 | 64 | time: datetime.time |
| 65 | + date_time: datetime.datetime | |
| 67 | 66 | union_array: list[datetime.date | datetime.time | datetime.datetime] |
| 67 | + complex_union_array: list[int | ComplexUnionArrayEnum | datetime.datetime] | |
| 68 | 68 | |
| 69 | 69 | @staticmethod |
| 70 | 70 | def from_dict(obj: Any) -> 'TopLevel': |
| 71 | 71 | assert isinstance(obj, dict) |
| 72 | - complex_union_array = from_list(lambda x: from_union([from_int, ComplexUnionArrayEnum, from_datetime], x), obj.get("complex-union-array")) | |
| 73 | 72 | date = from_date(obj.get("date")) |
| 74 | - date_time = from_datetime(obj.get("date-time")) | |
| 75 | 73 | time = from_time(obj.get("time")) |
| 74 | + date_time = from_datetime(obj.get("date-time")) | |
| 76 | 75 | union_array = from_list(lambda x: from_union([from_date, from_time, from_datetime], x), obj.get("union-array")) |
| 77 | - return TopLevel(complex_union_array, date, date_time, time, union_array) | |
| 76 | + complex_union_array = from_list(lambda x: from_union([from_int, ComplexUnionArrayEnum, from_datetime], x), obj.get("complex-union-array")) | |
| 77 | + return TopLevel(date, time, date_time, union_array, complex_union_array) | |
| 78 | 78 | |
| 79 | 79 | def to_dict(self) -> dict: |
| 80 | 80 | result: dict = {} |
| 81 | - result["complex-union-array"] = from_list(lambda x: from_union([from_int, lambda x: to_enum(ComplexUnionArrayEnum, x), lambda x: x.isoformat()], x), self.complex_union_array) | |
| 82 | 81 | result["date"] = self.date.isoformat() |
| 83 | - result["date-time"] = self.date_time.isoformat() | |
| 84 | 82 | result["time"] = self.time.isoformat() |
| 83 | + result["date-time"] = self.date_time.isoformat() | |
| 85 | 84 | result["union-array"] = from_list(lambda x: from_union([lambda x: x.isoformat(), lambda x: x.isoformat(), lambda x: x.isoformat()], x), self.union_array) |
| 85 | + result["complex-union-array"] = from_list(lambda x: from_union([from_int, lambda x: to_enum(ComplexUnionArrayEnum, x), lambda x: x.isoformat()], x), self.complex_union_array) | |
| 86 | 86 | return result |
Mschema-rubydefault / TopLevel.rb+7 −7
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.union_array.first | |
| 7 | +# puts top_level.complex_union_array.first | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -52,20 +52,20 @@ class ComplexUnionArray < Dry::Struct | ||
| 52 | 52 | end |
| 53 | 53 | |
| 54 | 54 | class TopLevel < Dry::Struct |
| 55 | - attribute :complex_union_array, Types.Array(Types.Instance(ComplexUnionArray)) | |
| 56 | 55 | attribute :date, Types::String |
| 57 | - attribute :date_time, Types::String | |
| 58 | 56 | attribute :time, Types::String |
| 57 | + attribute :date_time, Types::String | |
| 59 | 58 | attribute :union_array, Types.Array(Types::String) |
| 59 | + attribute :complex_union_array, Types.Array(Types.Instance(ComplexUnionArray)) | |
| 60 | 60 | |
| 61 | 61 | def self.from_dynamic!(d) |
| 62 | 62 | d = Types::Hash[d] |
| 63 | 63 | new( |
| 64 | - complex_union_array: d.fetch("complex-union-array").map { |x| ComplexUnionArray.from_dynamic!(x) }, | |
| 65 | 64 | date: d.fetch("date"), |
| 66 | - date_time: d.fetch("date-time"), | |
| 67 | 65 | time: d.fetch("time"), |
| 66 | + date_time: d.fetch("date-time"), | |
| 68 | 67 | union_array: d.fetch("union-array"), |
| 68 | + complex_union_array: d.fetch("complex-union-array").map { |x| ComplexUnionArray.from_dynamic!(x) }, | |
| 69 | 69 | ) |
| 70 | 70 | end |
| 71 | 71 | |
| @@ -75,11 +75,11 @@ class TopLevel < Dry::Struct | ||
| 75 | 75 | |
| 76 | 76 | def to_dynamic |
| 77 | 77 | { |
| 78 | - "complex-union-array" => complex_union_array.map { |x| x.to_dynamic }, | |
| 79 | 78 | "date" => date, |
| 80 | - "date-time" => date_time, | |
| 81 | 79 | "time" => time, |
| 80 | + "date-time" => date_time, | |
| 82 | 81 | "union-array" => union_array, |
| 82 | + "complex-union-array" => complex_union_array.map { |x| x.to_dynamic }, | |
| 83 | 83 | } |
| 84 | 84 | end |
Mschema-rustdefault / module_under_test.rs+4 −4
| @@ -16,15 +16,15 @@ use serde::{Serialize, Deserialize}; | ||
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | #[serde(rename_all = "kebab-case")] |
| 18 | 18 | pub struct TopLevel { |
| 19 | - pub complex_union_array: Vec<ComplexUnionArray>, | |
| 20 | - | |
| 21 | 19 | pub date: String, |
| 22 | 20 | |
| 23 | - pub date_time: String, | |
| 24 | - | |
| 25 | 21 | pub time: String, |
| 26 | 22 | |
| 23 | + pub date_time: String, | |
| 24 | + | |
| 27 | 25 | pub union_array: Vec<String>, |
| 26 | + | |
| 27 | + pub complex_union_array: Vec<ComplexUnionArray>, | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | #[derive(Debug, Clone, Serialize, Deserialize)] |
Mschema-scala3-upickledefault / TopLevel.scala+3 −3
| @@ -66,11 +66,11 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val `complex-union-array` : Seq[ComplexUnionArray], | |
| 70 | 69 | val date : String, |
| 71 | - val `date-time` : String, | |
| 72 | 70 | val time : String, |
| 73 | - val `union-array` : Seq[String] | |
| 71 | + val `date-time` : String, | |
| 72 | + val `union-array` : Seq[String], | |
| 73 | + val `complex-union-array` : Seq[ComplexUnionArray] | |
| 74 | 74 | ) derives OptionPickler.ReadWriter |
| 75 | 75 | |
| 76 | 76 | type ComplexUnionArray = Long | String |
Mschema-scala3default / TopLevel.scala+3 −3
| @@ -8,11 +8,11 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val `complex-union-array` : Seq[ComplexUnionArray], | |
| 12 | 11 | val date : String, |
| 13 | - val `date-time` : String, | |
| 14 | 12 | val time : String, |
| 15 | - val `union-array` : Seq[String] | |
| 13 | + val `date-time` : String, | |
| 14 | + val `union-array` : Seq[String], | |
| 15 | + val `complex-union-array` : Seq[ComplexUnionArray] | |
| 16 | 16 | ) derives Encoder.AsObject, Decoder |
| 17 | 17 | |
| 18 | 18 | type ComplexUnionArray = Long | String |
Mschema-schemadefault / TopLevel.schema+10 −10
| @@ -6,29 +6,29 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": false, |
| 8 | 8 | "properties": { |
| 9 | - "complex-union-array": { | |
| 10 | - "type": "array", | |
| 11 | - "items": { | |
| 12 | - "$ref": "#/definitions/ComplexUnionArrayElement" | |
| 13 | - } | |
| 14 | - }, | |
| 15 | 9 | "date": { |
| 16 | 10 | "type": "string", |
| 17 | 11 | "format": "date" |
| 18 | 12 | }, |
| 19 | - "date-time": { | |
| 20 | - "type": "string", | |
| 21 | - "format": "date-time" | |
| 22 | - }, | |
| 23 | 13 | "time": { |
| 24 | 14 | "type": "string", |
| 25 | 15 | "format": "time" |
| 26 | 16 | }, |
| 17 | + "date-time": { | |
| 18 | + "type": "string", | |
| 19 | + "format": "date-time" | |
| 20 | + }, | |
| 27 | 21 | "union-array": { |
| 28 | 22 | "type": "array", |
| 29 | 23 | "items": { |
| 30 | 24 | "$ref": "#/definitions/UnionArray" |
| 31 | 25 | } |
| 26 | + }, | |
| 27 | + "complex-union-array": { | |
| 28 | + "type": "array", | |
| 29 | + "items": { | |
| 30 | + "$ref": "#/definitions/ComplexUnionArrayElement" | |
| 31 | + } | |
| 32 | 32 | } |
| 33 | 33 | }, |
| 34 | 34 | "required": [ |
Mschema-typescriptdefault / TopLevel.ts+4 −4
| @@ -8,11 +8,11 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - "complex-union-array": ComplexUnionArrayElement[]; | |
| 12 | 11 | date: Date; |
| 13 | - "date-time": Date; | |
| 14 | 12 | time: string; |
| 13 | + "date-time": Date; | |
| 15 | 14 | "union-array": string[]; |
| 15 | + "complex-union-array": ComplexUnionArrayElement[]; | |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | export type ComplexUnionArrayElement = Date | ComplexUnionArrayEnum | number; |
| @@ -186,11 +186,11 @@ function r(name: string) { | ||
| 186 | 186 | |
| 187 | 187 | const typeMap: any = { |
| 188 | 188 | "TopLevel": o([ |
| 189 | - { json: "complex-union-array", js: "complex-union-array", typ: a(u(Date, r("ComplexUnionArrayEnum"), 0)) }, | |
| 190 | 189 | { json: "date", js: "date", typ: Date }, |
| 191 | - { json: "date-time", js: "date-time", typ: Date }, | |
| 192 | 190 | { json: "time", js: "time", typ: "" }, |
| 191 | + { json: "date-time", js: "date-time", typ: Date }, | |
| 193 | 192 | { json: "union-array", js: "union-array", typ: a("") }, |
| 193 | + { json: "complex-union-array", js: "complex-union-array", typ: a(u(Date, r("ComplexUnionArrayEnum"), 0)) }, | |
| 194 | 194 | ], false), |
| 195 | 195 | "ComplexUnionArrayEnum": [ |
| 196 | 196 | "foo", |
Test case
27 generated files · +369 −367test/inputs/schema/description.schema
Mschema-cjsondefault / TopLevel.c+16 −16
| @@ -174,10 +174,8 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 174 | 174 | if (NULL != j) { |
| 175 | 175 | if (NULL != (x = cJSON_malloc(sizeof(struct TopLevel)))) { |
| 176 | 176 | memset(x, 0, sizeof(struct TopLevel)); |
| 177 | - if (cJSON_HasObjectItem(j, "bar")) { | |
| 178 | - if (NULL != (x->bar = cJSON_malloc(sizeof(bool)))) { | |
| 179 | - *x->bar = cJSON_IsTrue(cJSON_GetObjectItemCaseSensitive(j, "bar")); | |
| 180 | - } | |
| 177 | + if (cJSON_HasObjectItem(j, "union")) { | |
| 178 | + x->top_level_union = cJSON_GetUnionValue(cJSON_GetObjectItemCaseSensitive(j, "union")); | |
| 181 | 179 | } |
| 182 | 180 | if (cJSON_HasObjectItem(j, "enum")) { |
| 183 | 181 | x->top_level_enum = cJSON_GetEnumValue(cJSON_GetObjectItemCaseSensitive(j, "enum")); |
| @@ -187,12 +185,14 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 187 | 185 | *x->foo = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "foo")); |
| 188 | 186 | } |
| 189 | 187 | } |
| 188 | + if (cJSON_HasObjectItem(j, "bar")) { | |
| 189 | + if (NULL != (x->bar = cJSON_malloc(sizeof(bool)))) { | |
| 190 | + *x->bar = cJSON_IsTrue(cJSON_GetObjectItemCaseSensitive(j, "bar")); | |
| 191 | + } | |
| 192 | + } | |
| 190 | 193 | if (cJSON_HasObjectItem(j, "object-or-string")) { |
| 191 | 194 | x->object_or_string = cJSON_GetObjectOrStringUnionValue(cJSON_GetObjectItemCaseSensitive(j, "object-or-string")); |
| 192 | 195 | } |
| 193 | - if (cJSON_HasObjectItem(j, "union")) { | |
| 194 | - x->top_level_union = cJSON_GetUnionValue(cJSON_GetObjectItemCaseSensitive(j, "union")); | |
| 195 | - } | |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | return x; |
| @@ -202,15 +202,15 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 202 | 202 | cJSON * j = NULL; |
| 203 | 203 | if (NULL != x) { |
| 204 | 204 | if (NULL != (j = cJSON_CreateObject())) { |
| 205 | - if (NULL != x->bar) { | |
| 206 | - cJSON_AddBoolToObject(j, "bar", *x->bar); | |
| 207 | - } | |
| 205 | + cJSON_AddItemToObject(j, "union", cJSON_CreateUnion(x->top_level_union)); | |
| 208 | 206 | cJSON_AddItemToObject(j, "enum", cJSON_CreateEnum(x->top_level_enum)); |
| 209 | 207 | if (NULL != x->foo) { |
| 210 | 208 | cJSON_AddNumberToObject(j, "foo", *x->foo); |
| 211 | 209 | } |
| 210 | + if (NULL != x->bar) { | |
| 211 | + cJSON_AddBoolToObject(j, "bar", *x->bar); | |
| 212 | + } | |
| 212 | 213 | cJSON_AddItemToObject(j, "object-or-string", cJSON_CreateObjectOrStringUnion(x->object_or_string)); |
| 213 | - cJSON_AddItemToObject(j, "union", cJSON_CreateUnion(x->top_level_union)); | |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | return j; |
| @@ -230,18 +230,18 @@ char * cJSON_PrintTopLevel(const struct TopLevel * x) { | ||
| 230 | 230 | |
| 231 | 231 | void cJSON_DeleteTopLevel(struct TopLevel * x) { |
| 232 | 232 | if (NULL != x) { |
| 233 | - if (NULL != x->bar) { | |
| 234 | - cJSON_free(x->bar); | |
| 233 | + if (NULL != x->top_level_union) { | |
| 234 | + cJSON_DeleteUnion(x->top_level_union); | |
| 235 | 235 | } |
| 236 | 236 | if (NULL != x->foo) { |
| 237 | 237 | cJSON_free(x->foo); |
| 238 | 238 | } |
| 239 | + if (NULL != x->bar) { | |
| 240 | + cJSON_free(x->bar); | |
| 241 | + } | |
| 239 | 242 | if (NULL != x->object_or_string) { |
| 240 | 243 | cJSON_DeleteObjectOrStringUnion(x->object_or_string); |
| 241 | 244 | } |
| 242 | - if (NULL != x->top_level_union) { | |
| 243 | - cJSON_DeleteUnion(x->top_level_union); | |
| 244 | - } | |
| 245 | 245 | cJSON_free(x); |
| 246 | 246 | } |
| 247 | 247 | } |
Mschema-cjsondefault / TopLevel.h+5 −5
| @@ -74,19 +74,19 @@ struct Union { | ||
| 74 | 74 | */ |
| 75 | 75 | struct TopLevel { |
| 76 | 76 | /** |
| 77 | - * A pretty boolean | |
| 77 | + * Either a number or a string | |
| 78 | 78 | */ |
| 79 | - bool * bar; | |
| 79 | + struct Union * top_level_union; | |
| 80 | 80 | /** |
| 81 | 81 | * An enumeration |
| 82 | 82 | */ |
| 83 | 83 | enum Enum top_level_enum; |
| 84 | 84 | double * foo; |
| 85 | - struct ObjectOrStringUnion * object_or_string; | |
| 86 | 85 | /** |
| 87 | - * Either a number or a string | |
| 86 | + * A pretty boolean | |
| 88 | 87 | */ |
| 89 | - struct Union * top_level_union; | |
| 88 | + bool * bar; | |
| 89 | + struct ObjectOrStringUnion * object_or_string; | |
| 90 | 90 | }; |
| 91 | 91 | |
| 92 | 92 | enum Enum cJSON_GetEnumValue(const cJSON * j); |
Mschema-cplusplusdefault / quicktype.hpp+17 −17
| @@ -125,19 +125,19 @@ namespace quicktype { | ||
| 125 | 125 | virtual ~TopLevel() = default; |
| 126 | 126 | |
| 127 | 127 | private: |
| 128 | - std::optional<bool> bar; | |
| 128 | + Union top_level_union; | |
| 129 | 129 | Enum top_level_enum; |
| 130 | 130 | std::optional<double> foo; |
| 131 | + std::optional<bool> bar; | |
| 131 | 132 | ObjectOrStringUnion object_or_string; |
| 132 | - Union top_level_union; | |
| 133 | 133 | |
| 134 | 134 | public: |
| 135 | 135 | /** |
| 136 | - * A pretty boolean | |
| 136 | + * Either a number or a string | |
| 137 | 137 | */ |
| 138 | - const std::optional<bool> & get_bar() const { return bar; } | |
| 139 | - std::optional<bool> & get_mutable_bar() { return bar; } | |
| 140 | - void set_bar(const std::optional<bool> & value) { this->bar = value; } | |
| 138 | + const Union & get_top_level_union() const { return top_level_union; } | |
| 139 | + Union & get_mutable_top_level_union() { return top_level_union; } | |
| 140 | + void set_top_level_union(const Union & value) { this->top_level_union = value; } | |
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | 143 | * An enumeration |
| @@ -150,16 +150,16 @@ namespace quicktype { | ||
| 150 | 150 | std::optional<double> & get_mutable_foo() { return foo; } |
| 151 | 151 | void set_foo(const std::optional<double> & value) { this->foo = value; } |
| 152 | 152 | |
| 153 | + /** | |
| 154 | + * A pretty boolean | |
| 155 | + */ | |
| 156 | + const std::optional<bool> & get_bar() const { return bar; } | |
| 157 | + std::optional<bool> & get_mutable_bar() { return bar; } | |
| 158 | + void set_bar(const std::optional<bool> & value) { this->bar = value; } | |
| 159 | + | |
| 153 | 160 | const ObjectOrStringUnion & get_object_or_string() const { return object_or_string; } |
| 154 | 161 | ObjectOrStringUnion & get_mutable_object_or_string() { return object_or_string; } |
| 155 | 162 | void set_object_or_string(const ObjectOrStringUnion & value) { this->object_or_string = value; } |
| 156 | - | |
| 157 | - /** | |
| 158 | - * Either a number or a string | |
| 159 | - */ | |
| 160 | - const Union & get_top_level_union() const { return top_level_union; } | |
| 161 | - Union & get_mutable_top_level_union() { return top_level_union; } | |
| 162 | - void set_top_level_union(const Union & value) { this->top_level_union = value; } | |
| 163 | 163 | }; |
| 164 | 164 | } |
| 165 | 165 | |
| @@ -197,20 +197,20 @@ namespace quicktype { | ||
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | inline void from_json(const json & j, TopLevel& x) { |
| 200 | - x.set_bar(get_stack_optional<bool>(j, "bar")); | |
| 200 | + x.set_top_level_union(j.at("union").get<Union>()); | |
| 201 | 201 | x.set_top_level_enum(j.at("enum").get<Enum>()); |
| 202 | 202 | x.set_foo(get_stack_optional<double>(j, "foo")); |
| 203 | + x.set_bar(get_stack_optional<bool>(j, "bar")); | |
| 203 | 204 | x.set_object_or_string(j.at("object-or-string").get<ObjectOrStringUnion>()); |
| 204 | - x.set_top_level_union(j.at("union").get<Union>()); | |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | inline void to_json(json & j, const TopLevel & x) { |
| 208 | 208 | j = json::object(); |
| 209 | - j["bar"] = x.get_bar(); | |
| 209 | + j["union"] = x.get_top_level_union(); | |
| 210 | 210 | j["enum"] = x.get_top_level_enum(); |
| 211 | 211 | j["foo"] = x.get_foo(); |
| 212 | + j["bar"] = x.get_bar(); | |
| 212 | 213 | j["object-or-string"] = x.get_object_or_string(); |
| 213 | - j["union"] = x.get_top_level_union(); | |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | inline void from_json(const json & j, Enum & x) { |
Mschema-csharp-recordsdefault / QuickType.cs+9 −9
| @@ -30,10 +30,10 @@ namespace QuickType | ||
| 30 | 30 | public partial record TopLevel |
| 31 | 31 | { |
| 32 | 32 | /// <summary> |
| 33 | - /// A pretty boolean | |
| 33 | + /// Either a number or a string | |
| 34 | 34 | /// </summary> |
| 35 | - [JsonProperty("bar", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 36 | - public bool? Bar { get; set; } | |
| 35 | + [JsonProperty("union", Required = Required.Always)] | |
| 36 | + public Union Union { get; set; } | |
| 37 | 37 | |
| 38 | 38 | /// <summary> |
| 39 | 39 | /// An enumeration |
| @@ -44,14 +44,14 @@ namespace QuickType | ||
| 44 | 44 | [JsonProperty("foo", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 45 | 45 | public double? Foo { get; set; } |
| 46 | 46 | |
| 47 | - [JsonProperty("object-or-string", Required = Required.Always)] | |
| 48 | - public ObjectOrStringUnion ObjectOrString { get; set; } | |
| 49 | - | |
| 50 | 47 | /// <summary> |
| 51 | - /// Either a number or a string | |
| 48 | + /// A pretty boolean | |
| 52 | 49 | /// </summary> |
| 53 | - [JsonProperty("union", Required = Required.Always)] | |
| 54 | - public Union Union { get; set; } | |
| 50 | + [JsonProperty("bar", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 51 | + public bool? Bar { get; set; } | |
| 52 | + | |
| 53 | + [JsonProperty("object-or-string", Required = Required.Always)] | |
| 54 | + public ObjectOrStringUnion ObjectOrString { get; set; } | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public partial record ObjectOrStringClass |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+11 −11
| @@ -27,11 +27,11 @@ namespace QuickType | ||
| 27 | 27 | public partial class TopLevel |
| 28 | 28 | { |
| 29 | 29 | /// <summary> |
| 30 | - /// A pretty boolean | |
| 30 | + /// Either a number or a string | |
| 31 | 31 | /// </summary> |
| 32 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 33 | - [JsonPropertyName("bar")] | |
| 34 | - public bool? Bar { get; set; } | |
| 32 | + [JsonRequired] | |
| 33 | + [JsonPropertyName("union")] | |
| 34 | + public Union Union { get; set; } | |
| 35 | 35 | |
| 36 | 36 | /// <summary> |
| 37 | 37 | /// An enumeration |
| @@ -44,16 +44,16 @@ namespace QuickType | ||
| 44 | 44 | [JsonPropertyName("foo")] |
| 45 | 45 | public double? Foo { get; set; } |
| 46 | 46 | |
| 47 | - [JsonRequired] | |
| 48 | - [JsonPropertyName("object-or-string")] | |
| 49 | - public ObjectOrStringUnion ObjectOrString { get; set; } | |
| 50 | - | |
| 51 | 47 | /// <summary> |
| 52 | - /// Either a number or a string | |
| 48 | + /// A pretty boolean | |
| 53 | 49 | /// </summary> |
| 50 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 51 | + [JsonPropertyName("bar")] | |
| 52 | + public bool? Bar { get; set; } | |
| 53 | + | |
| 54 | 54 | [JsonRequired] |
| 55 | - [JsonPropertyName("union")] | |
| 56 | - public Union Union { get; set; } | |
| 55 | + [JsonPropertyName("object-or-string")] | |
| 56 | + public ObjectOrStringUnion ObjectOrString { get; set; } | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public partial class ObjectOrStringClass |
Mschema-csharpdefault / QuickType.cs+9 −9
| @@ -30,10 +30,10 @@ namespace QuickType | ||
| 30 | 30 | public partial class TopLevel |
| 31 | 31 | { |
| 32 | 32 | /// <summary> |
| 33 | - /// A pretty boolean | |
| 33 | + /// Either a number or a string | |
| 34 | 34 | /// </summary> |
| 35 | - [JsonProperty("bar", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 36 | - public bool? Bar { get; set; } | |
| 35 | + [JsonProperty("union", Required = Required.Always)] | |
| 36 | + public Union Union { get; set; } | |
| 37 | 37 | |
| 38 | 38 | /// <summary> |
| 39 | 39 | /// An enumeration |
| @@ -44,14 +44,14 @@ namespace QuickType | ||
| 44 | 44 | [JsonProperty("foo", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 45 | 45 | public double? Foo { get; set; } |
| 46 | 46 | |
| 47 | - [JsonProperty("object-or-string", Required = Required.Always)] | |
| 48 | - public ObjectOrStringUnion ObjectOrString { get; set; } | |
| 49 | - | |
| 50 | 47 | /// <summary> |
| 51 | - /// Either a number or a string | |
| 48 | + /// A pretty boolean | |
| 52 | 49 | /// </summary> |
| 53 | - [JsonProperty("union", Required = Required.Always)] | |
| 54 | - public Union Union { get; set; } | |
| 50 | + [JsonProperty("bar", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 51 | + public bool? Bar { get; set; } | |
| 52 | + | |
| 53 | + [JsonProperty("object-or-string", Required = Required.Always)] | |
| 54 | + public ObjectOrStringUnion ObjectOrString { get; set; } | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public partial class ObjectOrStringClass |
Mschema-dartdefault / TopLevel.dart+11 −11
| @@ -13,39 +13,39 @@ String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | ||
| 13 | 13 | ///Its description has two lines. |
| 14 | 14 | class TopLevel { |
| 15 | 15 | |
| 16 | - ///A pretty boolean | |
| 17 | - final bool? bar; | |
| 16 | + ///Either a number or a string | |
| 17 | + final dynamic union; | |
| 18 | 18 | |
| 19 | 19 | ///An enumeration |
| 20 | 20 | final Enum topLevelEnum; |
| 21 | 21 | final double? foo; |
| 22 | - final dynamic objectOrString; | |
| 23 | 22 | |
| 24 | - ///Either a number or a string | |
| 25 | - final dynamic union; | |
| 23 | + ///A pretty boolean | |
| 24 | + final bool? bar; | |
| 25 | + final dynamic objectOrString; | |
| 26 | 26 | |
| 27 | 27 | TopLevel({ |
| 28 | - this.bar, | |
| 28 | + required this.union, | |
| 29 | 29 | required this.topLevelEnum, |
| 30 | 30 | this.foo, |
| 31 | + this.bar, | |
| 31 | 32 | required this.objectOrString, |
| 32 | - required this.union, | |
| 33 | 33 | }); |
| 34 | 34 | |
| 35 | 35 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 36 | - bar: json["bar"], | |
| 36 | + union: json["union"], | |
| 37 | 37 | topLevelEnum: enumValues.map[json["enum"]]!, |
| 38 | 38 | foo: json["foo"]?.toDouble(), |
| 39 | + bar: json["bar"], | |
| 39 | 40 | objectOrString: json["object-or-string"], |
| 40 | - union: json["union"], | |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | Map<String, dynamic> toJson() => { |
| 44 | - "bar": bar, | |
| 44 | + "union": union, | |
| 45 | 45 | "enum": enumValues.reverse[topLevelEnum], |
| 46 | 46 | "foo": foo, |
| 47 | + "bar": bar, | |
| 47 | 48 | "object-or-string": objectOrString, |
| 48 | - "union": union, | |
| 49 | 49 | }; |
| 50 | 50 | } |
Mschema-elixirdefault / QuickType.ex+11 −11
| @@ -95,20 +95,20 @@ defmodule TopLevel do | ||
| 95 | 95 | @moduledoc """ |
| 96 | 96 | The top-level class. |
| 97 | 97 | Its description has two lines. |
| 98 | - - `:bar` - A pretty boolean | |
| 99 | - - `:enum` - An enumeration | |
| 100 | 98 | - `:union` - Either a number or a string |
| 99 | + - `:enum` - An enumeration | |
| 100 | + - `:bar` - A pretty boolean | |
| 101 | 101 | """ |
| 102 | 102 | |
| 103 | - @enforce_keys [:enum, :object_or_string, :union] | |
| 104 | - defstruct [:bar, :enum, :foo, :object_or_string, :union] | |
| 103 | + @enforce_keys [:union, :enum, :object_or_string] | |
| 104 | + defstruct [:union, :enum, :foo, :bar, :object_or_string] | |
| 105 | 105 | |
| 106 | 106 | @type t :: %__MODULE__{ |
| 107 | - bar: boolean() | nil, | |
| 107 | + union: float() | String.t(), | |
| 108 | 108 | enum: EnumEnum.t(), |
| 109 | 109 | foo: float() | nil, |
| 110 | - object_or_string: ObjectOrStringClass.t() | String.t(), | |
| 111 | - union: float() | String.t() | |
| 110 | + bar: boolean() | nil, | |
| 111 | + object_or_string: ObjectOrStringClass.t() | String.t() | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | def decode_object_or_string(%{"prop" => _,} = value), do: ObjectOrStringClass.from_map(value) |
| @@ -121,11 +121,11 @@ defmodule TopLevel do | ||
| 121 | 121 | |
| 122 | 122 | def from_map(m) do |
| 123 | 123 | %TopLevel{ |
| 124 | - bar: m["bar"], | |
| 124 | + union: m["union"], | |
| 125 | 125 | enum: EnumEnum.decode(m["enum"]), |
| 126 | 126 | foo: m["foo"], |
| 127 | + bar: m["bar"], | |
| 127 | 128 | object_or_string: decode_object_or_string(m["object-or-string"]), |
| 128 | - union: m["union"], | |
| 129 | 129 | } |
| 130 | 130 | end |
| 131 | 131 | |
| @@ -137,11 +137,11 @@ defmodule TopLevel do | ||
| 137 | 137 | |
| 138 | 138 | def to_map(struct) do |
| 139 | 139 | %{ |
| 140 | - "bar" => struct.bar, | |
| 140 | + "union" => struct.union, | |
| 141 | 141 | "enum" => EnumEnum.encode(struct.enum), |
| 142 | 142 | "foo" => struct.foo, |
| 143 | + "bar" => struct.bar, | |
| 143 | 144 | "object-or-string" => encode_object_or_string(struct.object_or_string), |
| 144 | - "union" => struct.union, | |
| 145 | 145 | } |
| 146 | 146 | end |
Mschema-elmdefault / QuickType.elm+10 −10
| @@ -29,21 +29,21 @@ import Dict exposing (Dict) | ||
| 29 | 29 | {-| The top-level class. |
| 30 | 30 | Its description has two lines. |
| 31 | 31 | |
| 32 | -bar: | |
| 33 | -A pretty boolean | |
| 32 | +union: | |
| 33 | +Either a number or a string | |
| 34 | 34 | |
| 35 | 35 | enum: |
| 36 | 36 | An enumeration |
| 37 | 37 | |
| 38 | -union: | |
| 39 | -Either a number or a string | |
| 38 | +bar: | |
| 39 | +A pretty boolean | |
| 40 | 40 | -} |
| 41 | 41 | type alias QuickType = |
| 42 | - { bar : Maybe Bool | |
| 42 | + { union : Union | |
| 43 | 43 | , enum : Enum |
| 44 | 44 | , foo : Maybe Float |
| 45 | + , bar : Maybe Bool | |
| 45 | 46 | , objectOrString : ObjectOrStringUnion |
| 46 | - , union : Union | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | {-| An enumeration -} |
| @@ -77,20 +77,20 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 77 | 77 | quickType : Jdec.Decoder QuickType |
| 78 | 78 | quickType = |
| 79 | 79 | Jdec.succeed QuickType |
| 80 | - |> Jpipe.optional "bar" (Jdec.nullable Jdec.bool) Nothing | |
| 80 | + |> Jpipe.required "union" union | |
| 81 | 81 | |> Jpipe.required "enum" enum |
| 82 | 82 | |> Jpipe.optional "foo" (Jdec.nullable Jdec.float) Nothing |
| 83 | + |> Jpipe.optional "bar" (Jdec.nullable Jdec.bool) Nothing | |
| 83 | 84 | |> Jpipe.required "object-or-string" objectOrStringUnion |
| 84 | - |> Jpipe.required "union" union | |
| 85 | 85 | |
| 86 | 86 | encodeQuickType : QuickType -> Jenc.Value |
| 87 | 87 | encodeQuickType x = |
| 88 | 88 | Jenc.object |
| 89 | - [ ("bar", makeNullableEncoder Jenc.bool x.bar) | |
| 89 | + [ ("union", encodeUnion x.union) | |
| 90 | 90 | , ("enum", encodeEnum x.enum) |
| 91 | 91 | , ("foo", makeNullableEncoder Jenc.float x.foo) |
| 92 | + , ("bar", makeNullableEncoder Jenc.bool x.bar) | |
| 92 | 93 | , ("object-or-string", encodeObjectOrStringUnion x.objectOrString) |
| 93 | - , ("union", encodeUnion x.union) | |
| 94 | 94 | ] |
| 95 | 95 | |
| 96 | 96 | enum : Jdec.Decoder Enum |
Mschema-flowdefault / TopLevel.js+9 −9
| @@ -15,19 +15,19 @@ | ||
| 15 | 15 | */ |
| 16 | 16 | export type TopLevel = { |
| 17 | 17 | /** |
| 18 | - * A pretty boolean | |
| 18 | + * Either a number or a string | |
| 19 | 19 | */ |
| 20 | - bar?: boolean; | |
| 20 | + union: Union; | |
| 21 | 21 | /** |
| 22 | 22 | * An enumeration |
| 23 | 23 | */ |
| 24 | - enum: Enum; | |
| 25 | - foo?: number; | |
| 26 | - "object-or-string": ObjectOrStringUnion; | |
| 24 | + enum: Enum; | |
| 25 | + foo?: number; | |
| 27 | 26 | /** |
| 28 | - * Either a number or a string | |
| 27 | + * A pretty boolean | |
| 29 | 28 | */ |
| 30 | - union: Union; | |
| 29 | + bar?: boolean; | |
| 30 | + "object-or-string": ObjectOrStringUnion; | |
| 31 | 31 | }; |
| 32 | 32 | |
| 33 | 33 | /** |
| @@ -217,11 +217,11 @@ function r(name: string) { | ||
| 217 | 217 | |
| 218 | 218 | const typeMap: any = { |
| 219 | 219 | "TopLevel": o([ |
| 220 | - { json: "bar", js: "bar", typ: u(undefined, true) }, | |
| 220 | + { json: "union", js: "union", typ: u(3.14, "") }, | |
| 221 | 221 | { json: "enum", js: "enum", typ: r("Enum") }, |
| 222 | 222 | { json: "foo", js: "foo", typ: u(undefined, 3.14) }, |
| 223 | + { json: "bar", js: "bar", typ: u(undefined, true) }, | |
| 223 | 224 | { json: "object-or-string", js: "object-or-string", typ: u(r("ObjectOrStringObject"), "") }, |
| 224 | - { json: "union", js: "union", typ: u(3.14, "") }, | |
| 225 | 225 | ], false), |
| 226 | 226 | "ObjectOrStringObject": o([ |
| 227 | 227 | { json: "prop", js: "prop", typ: 3.14 }, |
Mschema-golangdefault / quicktype.go+4 −4
| @@ -24,14 +24,14 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 24 | 24 | // The top-level class. |
| 25 | 25 | // Its description has two lines. |
| 26 | 26 | type TopLevel struct { |
| 27 | - // A pretty boolean | |
| 28 | - Bar *bool `json:"bar,omitempty"` | |
| 27 | + // Either a number or a string | |
| 28 | + Union *Union `json:"union"` | |
| 29 | 29 | // An enumeration |
| 30 | 30 | Enum Enum `json:"enum"` |
| 31 | 31 | Foo *float64 `json:"foo,omitempty"` |
| 32 | + // A pretty boolean | |
| 33 | + Bar *bool `json:"bar,omitempty"` | |
| 32 | 34 | ObjectOrString *ObjectOrStringUnion `json:"object-or-string"` |
| 33 | - // Either a number or a string | |
| 34 | - Union *Union `json:"union"` | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | type ObjectOrStringClass struct { |
Mschema-haskelldefault / QuickType.hs+11 −11
| @@ -19,21 +19,21 @@ import Data.Text (Text) | ||
| 19 | 19 | {-| The top-level class. |
| 20 | 20 | Its description has two lines. |
| 21 | 21 | |
| 22 | -bar: | |
| 23 | -A pretty boolean | |
| 22 | +union: | |
| 23 | +Either a number or a string | |
| 24 | 24 | |
| 25 | 25 | enum: |
| 26 | 26 | An enumeration |
| 27 | 27 | |
| 28 | -union: | |
| 29 | -Either a number or a string | |
| 28 | +bar: | |
| 29 | +A pretty boolean | |
| 30 | 30 | -} |
| 31 | 31 | data QuickType = QuickType |
| 32 | - { barQuickType :: Maybe Bool | |
| 32 | + { unionQuickType :: Union | |
| 33 | 33 | , enumQuickType :: EnumEnum |
| 34 | 34 | , fooQuickType :: Maybe Float |
| 35 | + , barQuickType :: Maybe Bool | |
| 35 | 36 | , objectOrStringQuickType :: ObjectOrStringUnion |
| 36 | - , unionQuickType :: Union | |
| 37 | 37 | } deriving (Show) |
| 38 | 38 | |
| 39 | 39 | {-| An enumeration -} |
| @@ -66,22 +66,22 @@ decodeTopLevel :: ByteString -> Maybe QuickType | ||
| 66 | 66 | decodeTopLevel = decode |
| 67 | 67 | |
| 68 | 68 | instance ToJSON QuickType where |
| 69 | - toJSON (QuickType barQuickType enumQuickType fooQuickType objectOrStringQuickType unionQuickType) = | |
| 69 | + toJSON (QuickType unionQuickType enumQuickType fooQuickType barQuickType objectOrStringQuickType) = | |
| 70 | 70 | object |
| 71 | - [ "bar" .= barQuickType | |
| 71 | + [ "union" .= unionQuickType | |
| 72 | 72 | , "enum" .= enumQuickType |
| 73 | 73 | , "foo" .= fooQuickType |
| 74 | + , "bar" .= barQuickType | |
| 74 | 75 | , "object-or-string" .= objectOrStringQuickType |
| 75 | - , "union" .= unionQuickType | |
| 76 | 76 | ] |
| 77 | 77 | |
| 78 | 78 | instance FromJSON QuickType where |
| 79 | 79 | parseJSON (Object v) = QuickType |
| 80 | - <$> v .:? "bar" | |
| 80 | + <$> v .: "union" | |
| 81 | 81 | <*> v .: "enum" |
| 82 | 82 | <*> v .:? "foo" |
| 83 | + <*> v .:? "bar" | |
| 83 | 84 | <*> v .: "object-or-string" |
| 84 | - <*> v .: "union" | |
| 85 | 85 | |
| 86 | 86 | instance ToJSON EnumEnum where |
| 87 | 87 | toJSON FooEnumEnum = "foo" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+15 −15
| @@ -7,19 +7,19 @@ import com.fasterxml.jackson.annotation.*; | ||
| 7 | 7 | * Its description has two lines. |
| 8 | 8 | */ |
| 9 | 9 | public class TopLevel { |
| 10 | - private Boolean bar; | |
| 10 | + private Union union; | |
| 11 | 11 | private Enum topLevelEnum; |
| 12 | 12 | private Double foo; |
| 13 | + private Boolean bar; | |
| 13 | 14 | private ObjectOrStringUnion objectOrString; |
| 14 | - private Union union; | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | - * A pretty boolean | |
| 17 | + * Either a number or a string | |
| 18 | 18 | */ |
| 19 | - @JsonProperty("bar") | |
| 20 | - public Boolean getBar() { return bar; } | |
| 21 | - @JsonProperty("bar") | |
| 22 | - public void setBar(Boolean value) { this.bar = value; } | |
| 19 | + @JsonProperty("union") | |
| 20 | + public Union getUnion() { return union; } | |
| 21 | + @JsonProperty("union") | |
| 22 | + public void setUnion(Union value) { this.union = value; } | |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * An enumeration |
| @@ -34,16 +34,16 @@ public class TopLevel { | ||
| 34 | 34 | @JsonProperty("foo") |
| 35 | 35 | public void setFoo(Double value) { this.foo = value; } |
| 36 | 36 | |
| 37 | + /** | |
| 38 | + * A pretty boolean | |
| 39 | + */ | |
| 40 | + @JsonProperty("bar") | |
| 41 | + public Boolean getBar() { return bar; } | |
| 42 | + @JsonProperty("bar") | |
| 43 | + public void setBar(Boolean value) { this.bar = value; } | |
| 44 | + | |
| 37 | 45 | @JsonProperty("object-or-string") |
| 38 | 46 | public ObjectOrStringUnion getObjectOrString() { return objectOrString; } |
| 39 | 47 | @JsonProperty("object-or-string") |
| 40 | 48 | public void setObjectOrString(ObjectOrStringUnion value) { this.objectOrString = value; } |
| 41 | - | |
| 42 | - /** | |
| 43 | - * Either a number or a string | |
| 44 | - */ | |
| 45 | - @JsonProperty("union") | |
| 46 | - public Union getUnion() { return union; } | |
| 47 | - @JsonProperty("union") | |
| 48 | - public void setUnion(Union value) { this.union = value; } | |
| 49 | 49 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+15 −15
| @@ -7,19 +7,19 @@ import com.fasterxml.jackson.annotation.*; | ||
| 7 | 7 | * Its description has two lines. |
| 8 | 8 | */ |
| 9 | 9 | public class TopLevel { |
| 10 | - private Boolean bar; | |
| 10 | + private Union union; | |
| 11 | 11 | private Enum topLevelEnum; |
| 12 | 12 | private Double foo; |
| 13 | + private Boolean bar; | |
| 13 | 14 | private ObjectOrStringUnion objectOrString; |
| 14 | - private Union union; | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | - * A pretty boolean | |
| 17 | + * Either a number or a string | |
| 18 | 18 | */ |
| 19 | - @JsonProperty("bar") | |
| 20 | - public Boolean getBar() { return bar; } | |
| 21 | - @JsonProperty("bar") | |
| 22 | - public void setBar(Boolean value) { this.bar = value; } | |
| 19 | + @JsonProperty("union") | |
| 20 | + public Union getUnion() { return union; } | |
| 21 | + @JsonProperty("union") | |
| 22 | + public void setUnion(Union value) { this.union = value; } | |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * An enumeration |
| @@ -34,16 +34,16 @@ public class TopLevel { | ||
| 34 | 34 | @JsonProperty("foo") |
| 35 | 35 | public void setFoo(Double value) { this.foo = value; } |
| 36 | 36 | |
| 37 | + /** | |
| 38 | + * A pretty boolean | |
| 39 | + */ | |
| 40 | + @JsonProperty("bar") | |
| 41 | + public Boolean getBar() { return bar; } | |
| 42 | + @JsonProperty("bar") | |
| 43 | + public void setBar(Boolean value) { this.bar = value; } | |
| 44 | + | |
| 37 | 45 | @JsonProperty("object-or-string") |
| 38 | 46 | public ObjectOrStringUnion getObjectOrString() { return objectOrString; } |
| 39 | 47 | @JsonProperty("object-or-string") |
| 40 | 48 | public void setObjectOrString(ObjectOrStringUnion value) { this.objectOrString = value; } |
| 41 | - | |
| 42 | - /** | |
| 43 | - * Either a number or a string | |
| 44 | - */ | |
| 45 | - @JsonProperty("union") | |
| 46 | - public Union getUnion() { return union; } | |
| 47 | - @JsonProperty("union") | |
| 48 | - public void setUnion(Union value) { this.union = value; } | |
| 49 | 49 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+15 −15
| @@ -7,19 +7,19 @@ import com.fasterxml.jackson.annotation.*; | ||
| 7 | 7 | * Its description has two lines. |
| 8 | 8 | */ |
| 9 | 9 | public class TopLevel { |
| 10 | - private Boolean bar; | |
| 10 | + private Union union; | |
| 11 | 11 | private Enum topLevelEnum; |
| 12 | 12 | private Double foo; |
| 13 | + private Boolean bar; | |
| 13 | 14 | private ObjectOrStringUnion objectOrString; |
| 14 | - private Union union; | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | - * A pretty boolean | |
| 17 | + * Either a number or a string | |
| 18 | 18 | */ |
| 19 | - @JsonProperty("bar") | |
| 20 | - public Boolean getBar() { return bar; } | |
| 21 | - @JsonProperty("bar") | |
| 22 | - public void setBar(Boolean value) { this.bar = value; } | |
| 19 | + @JsonProperty("union") | |
| 20 | + public Union getUnion() { return union; } | |
| 21 | + @JsonProperty("union") | |
| 22 | + public void setUnion(Union value) { this.union = value; } | |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * An enumeration |
| @@ -34,16 +34,16 @@ public class TopLevel { | ||
| 34 | 34 | @JsonProperty("foo") |
| 35 | 35 | public void setFoo(Double value) { this.foo = value; } |
| 36 | 36 | |
| 37 | + /** | |
| 38 | + * A pretty boolean | |
| 39 | + */ | |
| 40 | + @JsonProperty("bar") | |
| 41 | + public Boolean getBar() { return bar; } | |
| 42 | + @JsonProperty("bar") | |
| 43 | + public void setBar(Boolean value) { this.bar = value; } | |
| 44 | + | |
| 37 | 45 | @JsonProperty("object-or-string") |
| 38 | 46 | public ObjectOrStringUnion getObjectOrString() { return objectOrString; } |
| 39 | 47 | @JsonProperty("object-or-string") |
| 40 | 48 | public void setObjectOrString(ObjectOrStringUnion value) { this.objectOrString = value; } |
| 41 | - | |
| 42 | - /** | |
| 43 | - * Either a number or a string | |
| 44 | - */ | |
| 45 | - @JsonProperty("union") | |
| 46 | - public Union getUnion() { return union; } | |
| 47 | - @JsonProperty("union") | |
| 48 | - public void setUnion(Union value) { this.union = value; } | |
| 49 | 49 | } |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -172,11 +172,11 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "bar", js: "bar", typ: u(undefined, true) }, | |
| 175 | + { json: "union", js: "union", typ: u(3.14, "") }, | |
| 176 | 176 | { json: "enum", js: "enum", typ: r("Enum") }, |
| 177 | 177 | { json: "foo", js: "foo", typ: u(undefined, 3.14) }, |
| 178 | + { json: "bar", js: "bar", typ: u(undefined, true) }, | |
| 178 | 179 | { json: "object-or-string", js: "object-or-string", typ: u(r("ObjectOrStringObject"), "") }, |
| 179 | - { json: "union", js: "union", typ: u(3.14, "") }, | |
| 180 | 180 | ], false), |
| 181 | 181 | "ObjectOrStringObject": o([ |
| 182 | 182 | { json: "prop", js: "prop", typ: 3.14 }, |
Mschema-phpdefault / TopLevel.php+119 −119
| @@ -4,92 +4,105 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private ?bool $bar; // json:bar Optional | |
| 7 | + private float|string $union; // json:union Required | |
| 8 | 8 | private EnumEnum $enum; // json:enum Required |
| 9 | 9 | private ?float $foo; // json:foo Optional |
| 10 | + private ?bool $bar; // json:bar Optional | |
| 10 | 11 | private ObjectOrString|string $objectOrString; // json:object-or-string Required |
| 11 | - private float|string $union; // json:union Required | |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * @param bool|null $bar | |
| 14 | + * @param float|string $union | |
| 15 | 15 | * @param EnumEnum $enum |
| 16 | 16 | * @param float|null $foo |
| 17 | + * @param bool|null $bar | |
| 17 | 18 | * @param ObjectOrString|string $objectOrString |
| 18 | - * @param float|string $union | |
| 19 | 19 | */ |
| 20 | - public function __construct(?bool $bar, EnumEnum $enum, ?float $foo, ObjectOrString|string $objectOrString, float|string $union) { | |
| 21 | - $this->bar = $bar; | |
| 20 | + public function __construct(float|string $union, EnumEnum $enum, ?float $foo, ?bool $bar, ObjectOrString|string $objectOrString) { | |
| 21 | + $this->union = $union; | |
| 22 | 22 | $this->enum = $enum; |
| 23 | 23 | $this->foo = $foo; |
| 24 | + $this->bar = $bar; | |
| 24 | 25 | $this->objectOrString = $objectOrString; |
| 25 | - $this->union = $union; | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * A pretty boolean | |
| 29 | + * Either a number or a string | |
| 30 | 30 | * |
| 31 | - * @param ?bool $value | |
| 31 | + * @param float|string $value | |
| 32 | 32 | * @throws Exception |
| 33 | - * @return ?bool | |
| 33 | + * @return float|string | |
| 34 | 34 | */ |
| 35 | - public static function fromBar(?bool $value): ?bool { | |
| 36 | - if (!is_null($value)) { | |
| 37 | - return $value; /*bool*/ | |
| 35 | + public static function fromUnion(float|string $value): float|string { | |
| 36 | + if (is_float($value) || is_int($value)) { | |
| 37 | + return $value; /*float*/ | |
| 38 | + } elseif (is_string($value)) { | |
| 39 | + return $value; /*string*/ | |
| 38 | 40 | } else { |
| 39 | - return null; | |
| 41 | + throw new Exception('Cannot deserialize union value in TopLevel'); | |
| 40 | 42 | } |
| 41 | 43 | } |
| 42 | 44 | |
| 43 | 45 | /** |
| 44 | - * A pretty boolean | |
| 46 | + * Either a number or a string | |
| 45 | 47 | * |
| 46 | 48 | * @throws Exception |
| 47 | - * @return ?bool | |
| 49 | + * @return float|string | |
| 48 | 50 | */ |
| 49 | - public function toBar(): ?bool { | |
| 50 | - if (TopLevel::validateBar($this->bar)) { | |
| 51 | - if (!is_null($this->bar)) { | |
| 52 | - return $this->bar; /*bool*/ | |
| 51 | + public function toUnion(): float|string { | |
| 52 | + if (TopLevel::validateUnion($this->union)) { | |
| 53 | + if (is_float($this->union) || is_int($this->union)) { | |
| 54 | + return $this->union; /*float*/ | |
| 55 | + } elseif (is_string($this->union)) { | |
| 56 | + return $this->union; /*string*/ | |
| 53 | 57 | } else { |
| 54 | - return null; | |
| 58 | + throw new Exception('Union value has no matching member in TopLevel'); | |
| 55 | 59 | } |
| 56 | 60 | } |
| 57 | - throw new Exception('never get to this TopLevel::bar'); | |
| 61 | + throw new Exception('never get to this TopLevel::union'); | |
| 58 | 62 | } |
| 59 | 63 | |
| 60 | 64 | /** |
| 61 | - * A pretty boolean | |
| 65 | + * Either a number or a string | |
| 62 | 66 | * |
| 63 | - * @param bool|null | |
| 67 | + * @param float|string | |
| 64 | 68 | * @return bool |
| 65 | 69 | * @throws Exception |
| 66 | 70 | */ |
| 67 | - public static function validateBar(?bool $value): bool { | |
| 68 | - if (!is_null($value)) { | |
| 71 | + public static function validateUnion(float|string $value): bool { | |
| 72 | + if (is_float($value) || is_int($value)) { | |
| 73 | + if (!is_float($value) && !is_int($value)) { | |
| 74 | + throw new Exception("Attribute Error:TopLevel::union"); | |
| 75 | + } | |
| 76 | + } elseif (is_string($value)) { | |
| 77 | + if (!is_string($value)) { | |
| 78 | + throw new Exception("Attribute Error:TopLevel::union"); | |
| 79 | + } | |
| 80 | + } else { | |
| 81 | + throw new Exception("Attribute Error:TopLevel::union"); | |
| 69 | 82 | } |
| 70 | 83 | return true; |
| 71 | 84 | } |
| 72 | 85 | |
| 73 | 86 | /** |
| 74 | - * A pretty boolean | |
| 87 | + * Either a number or a string | |
| 75 | 88 | * |
| 76 | 89 | * @throws Exception |
| 77 | - * @return ?bool | |
| 90 | + * @return float|string | |
| 78 | 91 | */ |
| 79 | - public function getBar(): ?bool { | |
| 80 | - if (TopLevel::validateBar($this->bar)) { | |
| 81 | - return $this->bar; | |
| 92 | + public function getUnion(): float|string { | |
| 93 | + if (TopLevel::validateUnion($this->union)) { | |
| 94 | + return $this->union; | |
| 82 | 95 | } |
| 83 | - throw new Exception('never get to getBar TopLevel::bar'); | |
| 96 | + throw new Exception('never get to getUnion TopLevel::union'); | |
| 84 | 97 | } |
| 85 | 98 | |
| 86 | 99 | /** |
| 87 | - * A pretty boolean | |
| 100 | + * Either a number or a string | |
| 88 | 101 | * |
| 89 | - * @return ?bool | |
| 102 | + * @return float|string | |
| 90 | 103 | */ |
| 91 | - public static function sampleBar(): ?bool { | |
| 92 | - return true; /*31:bar*/ | |
| 104 | + public static function sampleUnion(): float|string { | |
| 105 | + return 31.031; /*31:union*/ | |
| 93 | 106 | } |
| 94 | 107 | |
| 95 | 108 | /** |
| @@ -208,83 +221,80 @@ class TopLevel { | ||
| 208 | 221 | } |
| 209 | 222 | |
| 210 | 223 | /** |
| 211 | - * @param stdClass|string $value | |
| 224 | + * A pretty boolean | |
| 225 | + * | |
| 226 | + * @param ?bool $value | |
| 212 | 227 | * @throws Exception |
| 213 | - * @return ObjectOrString|string | |
| 228 | + * @return ?bool | |
| 214 | 229 | */ |
| 215 | - public static function fromObjectOrString(stdClass|string $value): ObjectOrString|string { | |
| 216 | - if (is_object($value)) { | |
| 217 | - return ObjectOrString::from($value); /*class*/ | |
| 218 | - } elseif (is_string($value)) { | |
| 219 | - return $value; /*string*/ | |
| 230 | + public static function fromBar(?bool $value): ?bool { | |
| 231 | + if (!is_null($value)) { | |
| 232 | + return $value; /*bool*/ | |
| 220 | 233 | } else { |
| 221 | - throw new Exception('Cannot deserialize union value in TopLevel'); | |
| 234 | + return null; | |
| 222 | 235 | } |
| 223 | 236 | } |
| 224 | 237 | |
| 225 | 238 | /** |
| 239 | + * A pretty boolean | |
| 240 | + * | |
| 226 | 241 | * @throws Exception |
| 227 | - * @return stdClass|string | |
| 242 | + * @return ?bool | |
| 228 | 243 | */ |
| 229 | - public function toObjectOrString(): stdClass|string { | |
| 230 | - if (TopLevel::validateObjectOrString($this->objectOrString)) { | |
| 231 | - if ($this->objectOrString instanceof ObjectOrString) { | |
| 232 | - return $this->objectOrString->to(); /*class*/ | |
| 233 | - } elseif (is_string($this->objectOrString)) { | |
| 234 | - return $this->objectOrString; /*string*/ | |
| 244 | + public function toBar(): ?bool { | |
| 245 | + if (TopLevel::validateBar($this->bar)) { | |
| 246 | + if (!is_null($this->bar)) { | |
| 247 | + return $this->bar; /*bool*/ | |
| 235 | 248 | } else { |
| 236 | - throw new Exception('Union value has no matching member in TopLevel'); | |
| 249 | + return null; | |
| 237 | 250 | } |
| 238 | 251 | } |
| 239 | - throw new Exception('never get to this TopLevel::objectOrString'); | |
| 252 | + throw new Exception('never get to this TopLevel::bar'); | |
| 240 | 253 | } |
| 241 | 254 | |
| 242 | 255 | /** |
| 243 | - * @param ObjectOrString|string | |
| 256 | + * A pretty boolean | |
| 257 | + * | |
| 258 | + * @param bool|null | |
| 244 | 259 | * @return bool |
| 245 | 260 | * @throws Exception |
| 246 | 261 | */ |
| 247 | - public static function validateObjectOrString(ObjectOrString|string $value): bool { | |
| 248 | - if ($value instanceof ObjectOrString) { | |
| 249 | - $value->validate(); | |
| 250 | - } elseif (is_string($value)) { | |
| 251 | - if (!is_string($value)) { | |
| 252 | - throw new Exception("Attribute Error:TopLevel::objectOrString"); | |
| 253 | - } | |
| 254 | - } else { | |
| 255 | - throw new Exception("Attribute Error:TopLevel::objectOrString"); | |
| 262 | + public static function validateBar(?bool $value): bool { | |
| 263 | + if (!is_null($value)) { | |
| 256 | 264 | } |
| 257 | 265 | return true; |
| 258 | 266 | } |
| 259 | 267 | |
| 260 | 268 | /** |
| 269 | + * A pretty boolean | |
| 270 | + * | |
| 261 | 271 | * @throws Exception |
| 262 | - * @return ObjectOrString|string | |
| 272 | + * @return ?bool | |
| 263 | 273 | */ |
| 264 | - public function getObjectOrString(): ObjectOrString|string { | |
| 265 | - if (TopLevel::validateObjectOrString($this->objectOrString)) { | |
| 266 | - return $this->objectOrString; | |
| 274 | + public function getBar(): ?bool { | |
| 275 | + if (TopLevel::validateBar($this->bar)) { | |
| 276 | + return $this->bar; | |
| 267 | 277 | } |
| 268 | - throw new Exception('never get to getObjectOrString TopLevel::objectOrString'); | |
| 278 | + throw new Exception('never get to getBar TopLevel::bar'); | |
| 269 | 279 | } |
| 270 | 280 | |
| 271 | 281 | /** |
| 272 | - * @return ObjectOrString|string | |
| 282 | + * A pretty boolean | |
| 283 | + * | |
| 284 | + * @return ?bool | |
| 273 | 285 | */ |
| 274 | - public static function sampleObjectOrString(): ObjectOrString|string { | |
| 275 | - return ObjectOrString::sample(); /*34:objectOrString*/ | |
| 286 | + public static function sampleBar(): ?bool { | |
| 287 | + return true; /*34:bar*/ | |
| 276 | 288 | } |
| 277 | 289 | |
| 278 | 290 | /** |
| 279 | - * Either a number or a string | |
| 280 | - * | |
| 281 | - * @param float|string $value | |
| 291 | + * @param stdClass|string $value | |
| 282 | 292 | * @throws Exception |
| 283 | - * @return float|string | |
| 293 | + * @return ObjectOrString|string | |
| 284 | 294 | */ |
| 285 | - public static function fromUnion(float|string $value): float|string { | |
| 286 | - if (is_float($value) || is_int($value)) { | |
| 287 | - return $value; /*float*/ | |
| 295 | + public static function fromObjectOrString(stdClass|string $value): ObjectOrString|string { | |
| 296 | + if (is_object($value)) { | |
| 297 | + return ObjectOrString::from($value); /*class*/ | |
| 288 | 298 | } elseif (is_string($value)) { |
| 289 | 299 | return $value; /*string*/ |
| 290 | 300 | } else { |
| @@ -293,66 +303,56 @@ class TopLevel { | ||
| 293 | 303 | } |
| 294 | 304 | |
| 295 | 305 | /** |
| 296 | - * Either a number or a string | |
| 297 | - * | |
| 298 | 306 | * @throws Exception |
| 299 | - * @return float|string | |
| 307 | + * @return stdClass|string | |
| 300 | 308 | */ |
| 301 | - public function toUnion(): float|string { | |
| 302 | - if (TopLevel::validateUnion($this->union)) { | |
| 303 | - if (is_float($this->union) || is_int($this->union)) { | |
| 304 | - return $this->union; /*float*/ | |
| 305 | - } elseif (is_string($this->union)) { | |
| 306 | - return $this->union; /*string*/ | |
| 309 | + public function toObjectOrString(): stdClass|string { | |
| 310 | + if (TopLevel::validateObjectOrString($this->objectOrString)) { | |
| 311 | + if ($this->objectOrString instanceof ObjectOrString) { | |
| 312 | + return $this->objectOrString->to(); /*class*/ | |
| 313 | + } elseif (is_string($this->objectOrString)) { | |
| 314 | + return $this->objectOrString; /*string*/ | |
| 307 | 315 | } else { |
| 308 | 316 | throw new Exception('Union value has no matching member in TopLevel'); |
| 309 | 317 | } |
| 310 | 318 | } |
| 311 | - throw new Exception('never get to this TopLevel::union'); | |
| 319 | + throw new Exception('never get to this TopLevel::objectOrString'); | |
| 312 | 320 | } |
| 313 | 321 | |
| 314 | 322 | /** |
| 315 | - * Either a number or a string | |
| 316 | - * | |
| 317 | - * @param float|string | |
| 323 | + * @param ObjectOrString|string | |
| 318 | 324 | * @return bool |
| 319 | 325 | * @throws Exception |
| 320 | 326 | */ |
| 321 | - public static function validateUnion(float|string $value): bool { | |
| 322 | - if (is_float($value) || is_int($value)) { | |
| 323 | - if (!is_float($value) && !is_int($value)) { | |
| 324 | - throw new Exception("Attribute Error:TopLevel::union"); | |
| 325 | - } | |
| 327 | + public static function validateObjectOrString(ObjectOrString|string $value): bool { | |
| 328 | + if ($value instanceof ObjectOrString) { | |
| 329 | + $value->validate(); | |
| 326 | 330 | } elseif (is_string($value)) { |
| 327 | 331 | if (!is_string($value)) { |
| 328 | - throw new Exception("Attribute Error:TopLevel::union"); | |
| 332 | + throw new Exception("Attribute Error:TopLevel::objectOrString"); | |
| 329 | 333 | } |
| 330 | 334 | } else { |
| 331 | - throw new Exception("Attribute Error:TopLevel::union"); | |
| 335 | + throw new Exception("Attribute Error:TopLevel::objectOrString"); | |
| 332 | 336 | } |
| 333 | 337 | return true; |
| 334 | 338 | } |
| 335 | 339 | |
| 336 | 340 | /** |
| 337 | - * Either a number or a string | |
| 338 | - * | |
| 339 | 341 | * @throws Exception |
| 340 | - * @return float|string | |
| 342 | + * @return ObjectOrString|string | |
| 341 | 343 | */ |
| 342 | - public function getUnion(): float|string { | |
| 343 | - if (TopLevel::validateUnion($this->union)) { | |
| 344 | - return $this->union; | |
| 344 | + public function getObjectOrString(): ObjectOrString|string { | |
| 345 | + if (TopLevel::validateObjectOrString($this->objectOrString)) { | |
| 346 | + return $this->objectOrString; | |
| 345 | 347 | } |
| 346 | - throw new Exception('never get to getUnion TopLevel::union'); | |
| 348 | + throw new Exception('never get to getObjectOrString TopLevel::objectOrString'); | |
| 347 | 349 | } |
| 348 | 350 | |
| 349 | 351 | /** |
| 350 | - * Either a number or a string | |
| 351 | - * | |
| 352 | - * @return float|string | |
| 352 | + * @return ObjectOrString|string | |
| 353 | 353 | */ |
| 354 | - public static function sampleUnion(): float|string { | |
| 355 | - return 35.035; /*35:union*/ | |
| 354 | + public static function sampleObjectOrString(): ObjectOrString|string { | |
| 355 | + return ObjectOrString::sample(); /*35:objectOrString*/ | |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
| @@ -360,11 +360,11 @@ class TopLevel { | ||
| 360 | 360 | * @return bool |
| 361 | 361 | */ |
| 362 | 362 | public function validate(): bool { |
| 363 | - return TopLevel::validateBar($this->bar) | |
| 363 | + return TopLevel::validateUnion($this->union) | |
| 364 | 364 | || TopLevel::validateEnum($this->enum) |
| 365 | 365 | || TopLevel::validateFoo($this->foo) |
| 366 | - || TopLevel::validateObjectOrString($this->objectOrString) | |
| 367 | - || TopLevel::validateUnion($this->union); | |
| 366 | + || TopLevel::validateBar($this->bar) | |
| 367 | + || TopLevel::validateObjectOrString($this->objectOrString); | |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | /** |
| @@ -373,11 +373,11 @@ class TopLevel { | ||
| 373 | 373 | */ |
| 374 | 374 | public function to(): stdClass { |
| 375 | 375 | $out = new stdClass(); |
| 376 | - $out->{'bar'} = $this->toBar(); | |
| 376 | + $out->{'union'} = $this->toUnion(); | |
| 377 | 377 | $out->{'enum'} = $this->toEnum(); |
| 378 | 378 | $out->{'foo'} = $this->toFoo(); |
| 379 | + $out->{'bar'} = $this->toBar(); | |
| 379 | 380 | $out->{'object-or-string'} = $this->toObjectOrString(); |
| 380 | - $out->{'union'} = $this->toUnion(); | |
| 381 | 381 | return $out; |
| 382 | 382 | } |
| 383 | 383 | |
| @@ -388,11 +388,11 @@ class TopLevel { | ||
| 388 | 388 | */ |
| 389 | 389 | public static function from(stdClass $obj): TopLevel { |
| 390 | 390 | return new TopLevel( |
| 391 | - TopLevel::fromBar($obj->{'bar'}) | |
| 391 | + TopLevel::fromUnion($obj->{'union'}) | |
| 392 | 392 | ,TopLevel::fromEnum($obj->{'enum'}) |
| 393 | 393 | ,TopLevel::fromFoo($obj->{'foo'}) |
| 394 | + ,TopLevel::fromBar($obj->{'bar'}) | |
| 394 | 395 | ,TopLevel::fromObjectOrString($obj->{'object-or-string'}) |
| 395 | - ,TopLevel::fromUnion($obj->{'union'}) | |
| 396 | 396 | ); |
| 397 | 397 | } |
| 398 | 398 | |
| @@ -401,11 +401,11 @@ class TopLevel { | ||
| 401 | 401 | */ |
| 402 | 402 | public static function sample(): TopLevel { |
| 403 | 403 | return new TopLevel( |
| 404 | - TopLevel::sampleBar() | |
| 404 | + TopLevel::sampleUnion() | |
| 405 | 405 | ,TopLevel::sampleEnum() |
| 406 | 406 | ,TopLevel::sampleFoo() |
| 407 | + ,TopLevel::sampleBar() | |
| 407 | 408 | ,TopLevel::sampleObjectOrString() |
| 408 | - ,TopLevel::sampleUnion() | |
| 409 | 409 | ); |
| 410 | 410 | } |
| 411 | 411 | } |
Mschema-pikedefault / TopLevel.pmod+6 −6
| @@ -15,19 +15,19 @@ | ||
| 15 | 15 | // The top-level class. |
| 16 | 16 | // Its description has two lines. |
| 17 | 17 | class TopLevel { |
| 18 | - bool|mixed bar; // json: "bar" | |
| 18 | + Union union; // json: "union" | |
| 19 | 19 | Enum top_level_enum; // json: "enum" |
| 20 | 20 | float|mixed foo; // json: "foo" |
| 21 | + bool|mixed bar; // json: "bar" | |
| 21 | 22 | ObjectOrStringUnion object_or_string; // json: "object-or-string" |
| 22 | - Union union; // json: "union" | |
| 23 | 23 | |
| 24 | 24 | string encode_json() { |
| 25 | 25 | mapping(string:mixed) json = ([ |
| 26 | - "bar" : bar, | |
| 26 | + "union" : union, | |
| 27 | 27 | "enum" : top_level_enum, |
| 28 | 28 | "foo" : foo, |
| 29 | + "bar" : bar, | |
| 29 | 30 | "object-or-string" : object_or_string, |
| 30 | - "union" : union, | |
| 31 | 31 | ]); |
| 32 | 32 | |
| 33 | 33 | return Standards.JSON.encode(json); |
| @@ -37,11 +37,11 @@ class TopLevel { | ||
| 37 | 37 | TopLevel TopLevel_from_JSON(mixed json) { |
| 38 | 38 | TopLevel retval = TopLevel(); |
| 39 | 39 | |
| 40 | - retval.bar = json["bar"]; | |
| 40 | + retval.union = json["union"]; | |
| 41 | 41 | retval.top_level_enum = json["enum"]; |
| 42 | 42 | retval.foo = json["foo"]; |
| 43 | + retval.bar = json["bar"]; | |
| 43 | 44 | retval.object_or_string = json["object-or-string"]; |
| 44 | - retval.union = json["union"]; | |
| 45 | 45 | |
| 46 | 46 | return retval; |
| 47 | 47 | } |
Mschema-pythondefault / quicktype.py+14 −15
| @@ -31,13 +31,13 @@ def from_union(fs, x): | ||
| 31 | 31 | assert False |
| 32 | 32 | |
| 33 | 33 | |
| 34 | -def from_bool(x: Any) -> bool: | |
| 35 | - assert isinstance(x, bool) | |
| 34 | +def from_none(x: Any) -> Any: | |
| 35 | + assert x is None | |
| 36 | 36 | return x |
| 37 | 37 | |
| 38 | 38 | |
| 39 | -def from_none(x: Any) -> Any: | |
| 40 | - assert x is None | |
| 39 | +def from_bool(x: Any) -> bool: | |
| 40 | + assert isinstance(x, bool) | |
| 41 | 41 | return x |
| 42 | 42 | |
| 43 | 43 | |
| @@ -80,37 +80,36 @@ class TopLevel: | ||
| 80 | 80 | """The top-level class. |
| 81 | 81 | Its description has two lines. |
| 82 | 82 | """ |
| 83 | + union: float | str | |
| 84 | + """Either a number or a string""" | |
| 85 | + | |
| 83 | 86 | enum: EnumEnum |
| 84 | 87 | """An enumeration""" |
| 85 | 88 | |
| 86 | 89 | object_or_string: str | ObjectOrStringClass |
| 87 | - union: float | str | |
| 88 | - """Either a number or a string""" | |
| 89 | - | |
| 90 | + foo: float | None = None | |
| 90 | 91 | bar: bool | None = None |
| 91 | 92 | """A pretty boolean""" |
| 92 | 93 | |
| 93 | - foo: float | None = None | |
| 94 | - | |
| 95 | 94 | @staticmethod |
| 96 | 95 | def from_dict(obj: Any) -> 'TopLevel': |
| 97 | 96 | assert isinstance(obj, dict) |
| 97 | + union = from_union([from_float, from_str], obj.get("union")) | |
| 98 | 98 | enum = EnumEnum(obj.get("enum")) |
| 99 | 99 | object_or_string = from_union([from_str, ObjectOrStringClass.from_dict], obj.get("object-or-string")) |
| 100 | - union = from_union([from_float, from_str], obj.get("union")) | |
| 101 | - bar = from_union([from_bool, from_none], obj.get("bar")) | |
| 102 | 100 | foo = from_union([from_float, from_none], obj.get("foo")) |
| 103 | - return TopLevel(enum, object_or_string, union, bar, foo) | |
| 101 | + bar = from_union([from_bool, from_none], obj.get("bar")) | |
| 102 | + return TopLevel(union, enum, object_or_string, foo, bar) | |
| 104 | 103 | |
| 105 | 104 | def to_dict(self) -> dict: |
| 106 | 105 | result: dict = {} |
| 106 | + result["union"] = from_union([to_float, from_str], self.union) | |
| 107 | 107 | result["enum"] = to_enum(EnumEnum, self.enum) |
| 108 | 108 | result["object-or-string"] = from_union([from_str, lambda x: to_class(ObjectOrStringClass, x)], self.object_or_string) |
| 109 | - result["union"] = from_union([to_float, from_str], self.union) | |
| 110 | - if self.bar is not None: | |
| 111 | - result["bar"] = from_union([from_bool, from_none], self.bar) | |
| 112 | 109 | if self.foo is not None: |
| 113 | 110 | result["foo"] = from_union([to_float, from_none], self.foo) |
| 111 | + if self.bar is not None: | |
| 112 | + result["bar"] = from_union([from_bool, from_none], self.bar) | |
| 114 | 113 | return result |
Mschema-rubydefault / TopLevel.rb+12 −11
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.bar | |
| 7 | +# puts top_level.union | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -126,26 +126,27 @@ end | ||
| 126 | 126 | # Its description has two lines. |
| 127 | 127 | class TopLevel < Dry::Struct |
| 128 | 128 | |
| 129 | - # A pretty boolean | |
| 130 | - attribute :bar, Types::Bool.optional | |
| 129 | + # Either a number or a string | |
| 130 | + attribute :union, Types.Instance(Union) | |
| 131 | 131 | |
| 132 | 132 | # An enumeration |
| 133 | 133 | attribute :top_level_enum, Types::Enum |
| 134 | 134 | |
| 135 | - attribute :foo, Types::Double.optional | |
| 136 | - attribute :object_or_string, Types.Instance(ObjectOrStringUnion) | |
| 135 | + attribute :foo, Types::Double.optional | |
| 137 | 136 | |
| 138 | - # Either a number or a string | |
| 139 | - attribute :union, Types.Instance(Union) | |
| 137 | + # A pretty boolean | |
| 138 | + attribute :bar, Types::Bool.optional | |
| 139 | + | |
| 140 | + attribute :object_or_string, Types.Instance(ObjectOrStringUnion) | |
| 140 | 141 | |
| 141 | 142 | def self.from_dynamic!(d) |
| 142 | 143 | d = Types::Hash[d] |
| 143 | 144 | new( |
| 144 | - bar: d["bar"], | |
| 145 | + union: Union.from_dynamic!(d.fetch("union")), | |
| 145 | 146 | top_level_enum: d.fetch("enum"), |
| 146 | 147 | foo: d["foo"], |
| 148 | + bar: d["bar"], | |
| 147 | 149 | object_or_string: ObjectOrStringUnion.from_dynamic!(d.fetch("object-or-string")), |
| 148 | - union: Union.from_dynamic!(d.fetch("union")), | |
| 149 | 150 | ) |
| 150 | 151 | end |
| 151 | 152 | |
| @@ -155,11 +156,11 @@ class TopLevel < Dry::Struct | ||
| 155 | 156 | |
| 156 | 157 | def to_dynamic |
| 157 | 158 | { |
| 158 | - "bar" => bar, | |
| 159 | + "union" => union.to_dynamic, | |
| 159 | 160 | "enum" => top_level_enum, |
| 160 | 161 | "foo" => foo, |
| 162 | + "bar" => bar, | |
| 161 | 163 | "object-or-string" => object_or_string.to_dynamic, |
| 162 | - "union" => union.to_dynamic, | |
| 163 | 164 | } |
| 164 | 165 | end |
Mschema-rustdefault / module_under_test.rs+6 −6
| @@ -18,8 +18,9 @@ use serde::{Serialize, Deserialize}; | ||
| 18 | 18 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 19 | 19 | #[serde(rename_all = "kebab-case")] |
| 20 | 20 | pub struct TopLevel { |
| 21 | - /// A pretty boolean | |
| 22 | - pub bar: Option<bool>, | |
| 21 | + /// Either a number or a string | |
| 22 | + #[serde(rename = "union")] | |
| 23 | + pub top_level_union: Union, | |
| 23 | 24 | |
| 24 | 25 | /// An enumeration |
| 25 | 26 | #[serde(rename = "enum")] |
| @@ -27,11 +28,10 @@ pub struct TopLevel { | ||
| 27 | 28 | |
| 28 | 29 | pub foo: Option<f64>, |
| 29 | 30 | |
| 30 | - pub object_or_string: ObjectOrStringUnion, | |
| 31 | + /// A pretty boolean | |
| 32 | + pub bar: Option<bool>, | |
| 31 | 33 | |
| 32 | - /// Either a number or a string | |
| 33 | - #[serde(rename = "union")] | |
| 34 | - pub top_level_union: Union, | |
| 34 | + pub object_or_string: ObjectOrStringUnion, | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | #[derive(Debug, Clone, Serialize, Deserialize)] |
Mschema-scala3-upickledefault / TopLevel.scala+6 −5
| @@ -71,9 +71,9 @@ end JsonExt | ||
| 71 | 71 | */ |
| 72 | 72 | case class TopLevel ( |
| 73 | 73 | /** |
| 74 | - * A pretty boolean | |
| 74 | + * Either a number or a string | |
| 75 | 75 | */ |
| 76 | - val bar : Option[Boolean] = None, | |
| 76 | + val union : Union, | |
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * An enumeration |
| @@ -81,12 +81,13 @@ case class TopLevel ( | ||
| 81 | 81 | val `enum` : EnumEnum, |
| 82 | 82 | |
| 83 | 83 | val foo : Option[Double] = None, |
| 84 | - val `object-or-string` : ObjectOrStringUnion, | |
| 85 | 84 | |
| 86 | 85 | /** |
| 87 | - * Either a number or a string | |
| 86 | + * A pretty boolean | |
| 88 | 87 | */ |
| 89 | - val union : Union | |
| 88 | + val bar : Option[Boolean] = None, | |
| 89 | + | |
| 90 | + val `object-or-string` : ObjectOrStringUnion | |
| 90 | 91 | ) derives OptionPickler.ReadWriter |
| 91 | 92 | |
| 92 | 93 | type ObjectOrStringUnion = ObjectOrStringClass | String |
Mschema-scala3default / TopLevel.scala+6 −5
| @@ -13,9 +13,9 @@ type NullValue = None.type | ||
| 13 | 13 | */ |
| 14 | 14 | case class TopLevel ( |
| 15 | 15 | /** |
| 16 | - * A pretty boolean | |
| 16 | + * Either a number or a string | |
| 17 | 17 | */ |
| 18 | - val bar : Option[Boolean] = None, | |
| 18 | + val union : Union, | |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * An enumeration |
| @@ -23,12 +23,13 @@ case class TopLevel ( | ||
| 23 | 23 | val `enum` : EnumEnum, |
| 24 | 24 | |
| 25 | 25 | val foo : Option[Double] = None, |
| 26 | - val `object-or-string` : ObjectOrStringUnion, | |
| 27 | 26 | |
| 28 | 27 | /** |
| 29 | - * Either a number or a string | |
| 28 | + * A pretty boolean | |
| 30 | 29 | */ |
| 31 | - val union : Union | |
| 30 | + val bar : Option[Boolean] = None, | |
| 31 | + | |
| 32 | + val `object-or-string` : ObjectOrStringUnion | |
| 32 | 33 | ) derives Encoder.AsObject, Decoder |
| 33 | 34 | |
| 34 | 35 | type ObjectOrStringUnion = ObjectOrStringClass | String |
Mschema-schemadefault / TopLevel.schema+7 −7
| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": false, |
| 8 | 8 | "properties": { |
| 9 | - "bar": { | |
| 10 | - "type": "boolean", | |
| 11 | - "description": "A pretty boolean" | |
| 9 | + "union": { | |
| 10 | + "$ref": "#/definitions/Union", | |
| 11 | + "description": "Either a number or a string" | |
| 12 | 12 | }, |
| 13 | 13 | "enum": { |
| 14 | 14 | "$ref": "#/definitions/Enum", |
| @@ -17,12 +17,12 @@ | ||
| 17 | 17 | "foo": { |
| 18 | 18 | "type": "number" |
| 19 | 19 | }, |
| 20 | + "bar": { | |
| 21 | + "type": "boolean", | |
| 22 | + "description": "A pretty boolean" | |
| 23 | + }, | |
| 20 | 24 | "object-or-string": { |
| 21 | 25 | "$ref": "#/definitions/ObjectOrStringUnion" |
| 22 | - }, | |
| 23 | - "union": { | |
| 24 | - "$ref": "#/definitions/Union", | |
| 25 | - "description": "Either a number or a string" | |
| 26 | 26 | } |
| 27 | 27 | }, |
| 28 | 28 | "required": [ |
Mschema-swiftdefault / quicktype.swift+12 −12
| @@ -9,21 +9,21 @@ import Foundation | ||
| 9 | 9 | /// Its description has two lines. |
| 10 | 10 | // MARK: - TopLevel |
| 11 | 11 | struct TopLevel: Codable { |
| 12 | - /// A pretty boolean | |
| 13 | - let bar: Bool? | |
| 12 | + /// Either a number or a string | |
| 13 | + let union: Union | |
| 14 | 14 | /// An enumeration |
| 15 | 15 | let topLevelEnum: Enum |
| 16 | 16 | let foo: Double? |
| 17 | + /// A pretty boolean | |
| 18 | + let bar: Bool? | |
| 17 | 19 | let objectOrString: ObjectOrStringUnion |
| 18 | - /// Either a number or a string | |
| 19 | - let union: Union | |
| 20 | 20 | |
| 21 | 21 | enum CodingKeys: String, CodingKey { |
| 22 | - case bar = "bar" | |
| 22 | + case union = "union" | |
| 23 | 23 | case topLevelEnum = "enum" |
| 24 | 24 | case foo = "foo" |
| 25 | + case bar = "bar" | |
| 25 | 26 | case objectOrString = "object-or-string" |
| 26 | - case union = "union" | |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| @@ -46,18 +46,18 @@ extension TopLevel { | ||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | func with( |
| 49 | - bar: Bool?? = nil, | |
| 49 | + union: Union? = nil, | |
| 50 | 50 | topLevelEnum: Enum? = nil, |
| 51 | 51 | foo: Double?? = nil, |
| 52 | - objectOrString: ObjectOrStringUnion? = nil, | |
| 53 | - union: Union? = nil | |
| 52 | + bar: Bool?? = nil, | |
| 53 | + objectOrString: ObjectOrStringUnion? = nil | |
| 54 | 54 | ) -> TopLevel { |
| 55 | 55 | return TopLevel( |
| 56 | - bar: bar ?? self.bar, | |
| 56 | + union: union ?? self.union, | |
| 57 | 57 | topLevelEnum: topLevelEnum ?? self.topLevelEnum, |
| 58 | 58 | foo: foo ?? self.foo, |
| 59 | - objectOrString: objectOrString ?? self.objectOrString, | |
| 60 | - union: union ?? self.union | |
| 59 | + bar: bar ?? self.bar, | |
| 60 | + objectOrString: objectOrString ?? self.objectOrString | |
| 61 | 61 | ) |
| 62 | 62 | } |
Mschema-typescript-zoddefault / TopLevel.ts+2 −2
| @@ -14,10 +14,10 @@ export const ObjectOrStringClassSchema = z.object({ | ||
| 14 | 14 | export type ObjectOrStringClass = z.infer<typeof ObjectOrStringClassSchema>; |
| 15 | 15 | |
| 16 | 16 | export const TopLevelSchema = z.object({ |
| 17 | - "bar": z.boolean().optional(), | |
| 17 | + "union": z.union([z.number(), z.string()]), | |
| 18 | 18 | "enum": EnumSchema, |
| 19 | 19 | "foo": z.number().optional(), |
| 20 | + "bar": z.boolean().optional(), | |
| 20 | 21 | "object-or-string": z.union([ObjectOrStringClassSchema, z.string()]), |
| 21 | - "union": z.union([z.number(), z.string()]), | |
| 22 | 22 | }); |
| 23 | 23 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+9 −9
| @@ -13,19 +13,19 @@ | ||
| 13 | 13 | */ |
| 14 | 14 | export interface TopLevel { |
| 15 | 15 | /** |
| 16 | - * A pretty boolean | |
| 16 | + * Either a number or a string | |
| 17 | 17 | */ |
| 18 | - bar?: boolean; | |
| 18 | + union: Union; | |
| 19 | 19 | /** |
| 20 | 20 | * An enumeration |
| 21 | 21 | */ |
| 22 | - enum: Enum; | |
| 23 | - foo?: number; | |
| 24 | - "object-or-string": ObjectOrStringUnion; | |
| 22 | + enum: Enum; | |
| 23 | + foo?: number; | |
| 25 | 24 | /** |
| 26 | - * Either a number or a string | |
| 25 | + * A pretty boolean | |
| 27 | 26 | */ |
| 28 | - union: Union; | |
| 27 | + bar?: boolean; | |
| 28 | + "object-or-string": ObjectOrStringUnion; | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| @@ -215,11 +215,11 @@ function r(name: string) { | ||
| 215 | 215 | |
| 216 | 216 | const typeMap: any = { |
| 217 | 217 | "TopLevel": o([ |
| 218 | - { json: "bar", js: "bar", typ: u(undefined, true) }, | |
| 218 | + { json: "union", js: "union", typ: u(3.14, "") }, | |
| 219 | 219 | { json: "enum", js: "enum", typ: r("Enum") }, |
| 220 | 220 | { json: "foo", js: "foo", typ: u(undefined, 3.14) }, |
| 221 | + { json: "bar", js: "bar", typ: u(undefined, true) }, | |
| 221 | 222 | { json: "object-or-string", js: "object-or-string", typ: u(r("ObjectOrStringObject"), "") }, |
| 222 | - { json: "union", js: "union", typ: u(3.14, "") }, | |
| 223 | 223 | ], false), |
| 224 | 224 | "ObjectOrStringObject": o([ |
| 225 | 225 | { json: "prop", js: "prop", typ: 3.14 }, |
Test case
23 generated files · +173 −173test/inputs/schema/direct-union.schema
Mschema-cplusplusdefault / quicktype.hpp+6 −6
| @@ -97,15 +97,15 @@ namespace quicktype { | ||
| 97 | 97 | virtual ~Thing() = default; |
| 98 | 98 | |
| 99 | 99 | private: |
| 100 | - Anything optional; | |
| 101 | 100 | Anything required; |
| 101 | + Anything optional; | |
| 102 | 102 | |
| 103 | 103 | public: |
| 104 | - Anything get_optional() const { return optional; } | |
| 105 | - void set_optional(Anything value) { this->optional = value; } | |
| 106 | - | |
| 107 | 104 | Anything get_required() const { return required; } |
| 108 | 105 | void set_required(Anything value) { this->required = value; } |
| 106 | + | |
| 107 | + Anything get_optional() const { return optional; } | |
| 108 | + void set_optional(Anything value) { this->optional = value; } | |
| 109 | 109 | }; |
| 110 | 110 | |
| 111 | 111 | class TopLevel { |
| @@ -139,14 +139,14 @@ struct adl_serializer<std::variant<std::vector<json>, bool, double, int64_t, std | ||
| 139 | 139 | } |
| 140 | 140 | namespace quicktype { |
| 141 | 141 | inline void from_json(const json & j, Thing& x) { |
| 142 | - x.set_optional(get_stack_optional<std::variant<std::vector<nlohmann::json>, bool, double, int64_t, std::map<std::string, nlohmann::json>, std::string>>(j, "optional")); | |
| 143 | 142 | x.set_required(get_stack_optional<std::variant<std::vector<nlohmann::json>, bool, double, int64_t, std::map<std::string, nlohmann::json>, std::string>>(j, "required")); |
| 143 | + x.set_optional(get_stack_optional<std::variant<std::vector<nlohmann::json>, bool, double, int64_t, std::map<std::string, nlohmann::json>, std::string>>(j, "optional")); | |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | inline void to_json(json & j, const Thing & x) { |
| 147 | 147 | j = json::object(); |
| 148 | - j["optional"] = x.get_optional(); | |
| 149 | 148 | j["required"] = x.get_required(); |
| 149 | + j["optional"] = x.get_optional(); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | inline void from_json(const json & j, TopLevel& x) { |
Mschema-csharp-recordsdefault / QuickType.cs+3 −3
| @@ -31,11 +31,11 @@ namespace QuickType | ||
| 31 | 31 | |
| 32 | 32 | public partial record Thing |
| 33 | 33 | { |
| 34 | - [JsonProperty("optional")] | |
| 35 | - public Anything? Optional { get; set; } | |
| 36 | - | |
| 37 | 34 | [JsonProperty("required", Required = Required.AllowNull)] |
| 38 | 35 | public Anything ThingRequired { get; set; } |
| 36 | + | |
| 37 | + [JsonProperty("optional")] | |
| 38 | + public Anything? Optional { get; set; } | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public partial struct Anything |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+3 −3
| @@ -29,12 +29,12 @@ namespace QuickType | ||
| 29 | 29 | |
| 30 | 30 | public partial class Thing |
| 31 | 31 | { |
| 32 | - [JsonPropertyName("optional")] | |
| 33 | - public Anything? Optional { get; set; } | |
| 34 | - | |
| 35 | 32 | [JsonRequired] |
| 36 | 33 | [JsonPropertyName("required")] |
| 37 | 34 | public Anything ThingRequired { get; set; } |
| 35 | + | |
| 36 | + [JsonPropertyName("optional")] | |
| 37 | + public Anything? Optional { get; set; } | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public partial struct Anything |
Mschema-csharpdefault / QuickType.cs+3 −3
| @@ -31,11 +31,11 @@ namespace QuickType | ||
| 31 | 31 | |
| 32 | 32 | public partial class Thing |
| 33 | 33 | { |
| 34 | - [JsonProperty("optional")] | |
| 35 | - public Anything? Optional { get; set; } | |
| 36 | - | |
| 37 | 34 | [JsonProperty("required", Required = Required.AllowNull)] |
| 38 | 35 | public Anything ThingRequired { get; set; } |
| 36 | + | |
| 37 | + [JsonProperty("optional")] | |
| 38 | + public Anything? Optional { get; set; } | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public partial struct Anything |
Mschema-dartdefault / TopLevel.dart+4 −4
| @@ -25,21 +25,21 @@ class TopLevel { | ||
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | class Thing { |
| 28 | - final dynamic optional; | |
| 29 | 28 | final dynamic required; |
| 29 | + final dynamic optional; | |
| 30 | 30 | |
| 31 | 31 | Thing({ |
| 32 | - this.optional, | |
| 33 | 32 | required this.required, |
| 33 | + this.optional, | |
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | 36 | factory Thing.fromJson(Map<String, dynamic> json) => Thing( |
| 37 | - optional: json["optional"], | |
| 38 | 37 | required: json["required"], |
| 38 | + optional: json["optional"], | |
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | 41 | Map<String, dynamic> toJson() => { |
| 42 | - "optional": optional, | |
| 43 | 42 | "required": required, |
| 43 | + "optional": optional, | |
| 44 | 44 | }; |
| 45 | 45 | } |
Mschema-elixirdefault / QuickType.ex+23 −23
| @@ -7,31 +7,13 @@ | ||
| 7 | 7 | |
| 8 | 8 | defmodule Thing do |
| 9 | 9 | @enforce_keys [:required] |
| 10 | - defstruct [:optional, :required] | |
| 10 | + defstruct [:required, :optional] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | - optional: [any()] | boolean() | float() | integer() | %{String.t() => any()} | nil | String.t() | nil, | |
| 14 | - required: [any()] | boolean() | float() | integer() | %{String.t() => any()} | nil | String.t() | |
| 13 | + required: [any()] | boolean() | float() | integer() | %{String.t() => any()} | nil | String.t(), | |
| 14 | + optional: [any()] | boolean() | float() | integer() | %{String.t() => any()} | nil | String.t() | nil | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - def decode_optional(value) when is_boolean(value), do: value | |
| 18 | - def decode_optional(value) when is_float(value), do: value | |
| 19 | - def decode_optional(value) when is_integer(value), do: value | |
| 20 | - def decode_optional(value) when is_nil(value), do: value | |
| 21 | - def decode_optional(value) when is_binary(value), do: value | |
| 22 | - def decode_optional(value) when is_list(value), do: value | |
| 23 | - def decode_optional(value) when is_map(value), do: value | |
| 24 | - def decode_optional(_), do: {:error, "Unexpected type when decoding Thing.optional"} | |
| 25 | - | |
| 26 | - def encode_optional(value) when is_boolean(value), do: value | |
| 27 | - def encode_optional(value) when is_float(value), do: value | |
| 28 | - def encode_optional(value) when is_integer(value), do: value | |
| 29 | - def encode_optional(value) when is_nil(value), do: value | |
| 30 | - def encode_optional(value) when is_binary(value), do: value | |
| 31 | - def encode_optional(value) when is_list(value), do: value | |
| 32 | - def encode_optional(value) when is_map(value), do: value | |
| 33 | - def encode_optional(_), do: {:error, "Unexpected type when encoding Thing.optional"} | |
| 34 | - | |
| 35 | 17 | def decode_required(value) when is_boolean(value), do: value |
| 36 | 18 | def decode_required(value) when is_float(value), do: value |
| 37 | 19 | def decode_required(value) when is_integer(value), do: value |
| @@ -50,10 +32,28 @@ defmodule Thing do | ||
| 50 | 32 | def encode_required(value) when is_map(value), do: value |
| 51 | 33 | def encode_required(_), do: {:error, "Unexpected type when encoding Thing.required"} |
| 52 | 34 | |
| 35 | + def decode_optional(value) when is_boolean(value), do: value | |
| 36 | + def decode_optional(value) when is_float(value), do: value | |
| 37 | + def decode_optional(value) when is_integer(value), do: value | |
| 38 | + def decode_optional(value) when is_nil(value), do: value | |
| 39 | + def decode_optional(value) when is_binary(value), do: value | |
| 40 | + def decode_optional(value) when is_list(value), do: value | |
| 41 | + def decode_optional(value) when is_map(value), do: value | |
| 42 | + def decode_optional(_), do: {:error, "Unexpected type when decoding Thing.optional"} | |
| 43 | + | |
| 44 | + def encode_optional(value) when is_boolean(value), do: value | |
| 45 | + def encode_optional(value) when is_float(value), do: value | |
| 46 | + def encode_optional(value) when is_integer(value), do: value | |
| 47 | + def encode_optional(value) when is_nil(value), do: value | |
| 48 | + def encode_optional(value) when is_binary(value), do: value | |
| 49 | + def encode_optional(value) when is_list(value), do: value | |
| 50 | + def encode_optional(value) when is_map(value), do: value | |
| 51 | + def encode_optional(_), do: {:error, "Unexpected type when encoding Thing.optional"} | |
| 52 | + | |
| 53 | 53 | def from_map(m) do |
| 54 | 54 | %Thing{ |
| 55 | - optional: decode_optional(m["optional"]), | |
| 56 | 55 | required: decode_required(m["required"]), |
| 56 | + optional: decode_optional(m["optional"]), | |
| 57 | 57 | } |
| 58 | 58 | end |
| 59 | 59 | |
| @@ -65,8 +65,8 @@ defmodule Thing do | ||
| 65 | 65 | |
| 66 | 66 | def to_map(struct) do |
| 67 | 67 | %{ |
| 68 | - "optional" => encode_optional(struct.optional), | |
| 69 | 68 | "required" => encode_required(struct.required), |
| 69 | + "optional" => encode_optional(struct.optional), | |
| 70 | 70 | } |
| 71 | 71 | end |
Mschema-elmdefault / QuickType.elm+5 −5
| @@ -29,8 +29,8 @@ type alias QuickType = | ||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | type alias Thing = |
| 32 | - { optional : Maybe Anything | |
| 33 | - , required : Anything | |
| 32 | + { required : Anything | |
| 33 | + , optional : Maybe Anything | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | type Anything |
| @@ -61,14 +61,14 @@ encodeQuickType x = | ||
| 61 | 61 | thing : Jdec.Decoder Thing |
| 62 | 62 | thing = |
| 63 | 63 | Jdec.succeed Thing |
| 64 | - |> Jpipe.optional "optional" (Jdec.nullable anything) Nothing | |
| 65 | 64 | |> Jpipe.required "required" anything |
| 65 | + |> Jpipe.optional "optional" (Jdec.nullable anything) Nothing | |
| 66 | 66 | |
| 67 | 67 | encodeThing : Thing -> Jenc.Value |
| 68 | 68 | encodeThing x = |
| 69 | 69 | Jenc.object |
| 70 | - [ ("optional", makeNullableEncoder encodeAnything x.optional) | |
| 71 | - , ("required", encodeAnything x.required) | |
| 70 | + [ ("required", encodeAnything x.required) | |
| 71 | + , ("optional", makeNullableEncoder encodeAnything x.optional) | |
| 72 | 72 | ] |
| 73 | 73 | |
| 74 | 74 | anything : Jdec.Decoder Anything |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -14,8 +14,8 @@ export type TopLevel = { | ||
| 14 | 14 | }; |
| 15 | 15 | |
| 16 | 16 | export type Thing = { |
| 17 | - optional?: Anything; | |
| 18 | 17 | required: Anything; |
| 18 | + optional?: Anything; | |
| 19 | 19 | }; |
| 20 | 20 | |
| 21 | 21 | export type Anything = mixed[] | boolean | number | number | { [key: string]: mixed } | null | string; |
| @@ -188,8 +188,8 @@ const typeMap: any = { | ||
| 188 | 188 | { json: "stuff", js: "stuff", typ: m(r("Thing")) }, |
| 189 | 189 | ], false), |
| 190 | 190 | "Thing": o([ |
| 191 | - { json: "optional", js: "optional", typ: u(undefined, u(a("any"), true, 3.14, 0, m("any"), null, "")) }, | |
| 192 | 191 | { json: "required", js: "required", typ: u(a("any"), true, 3.14, 0, m("any"), null, "") }, |
| 192 | + { json: "optional", js: "optional", typ: u(undefined, u(a("any"), true, 3.14, 0, m("any"), null, "")) }, | |
| 193 | 193 | ], false), |
| 194 | 194 | }; |
Mschema-golangdefault / quicktype.go+1 −1
| @@ -26,8 +26,8 @@ type TopLevel struct { | ||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | type Thing struct { |
| 29 | - Optional *Anything `json:"optional"` | |
| 30 | 29 | Required *Anything `json:"required"` |
| 30 | + Optional *Anything `json:"optional"` | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | type Anything struct { |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / Thing.java+6 −6
| @@ -5,16 +5,16 @@ import java.util.List; | ||
| 5 | 5 | import java.util.Map; |
| 6 | 6 | |
| 7 | 7 | public class Thing { |
| 8 | - private Anything optional; | |
| 9 | 8 | private Anything required; |
| 10 | - | |
| 11 | - @JsonProperty("optional") | |
| 12 | - public Anything getOptional() { return optional; } | |
| 13 | - @JsonProperty("optional") | |
| 14 | - public void setOptional(Anything value) { this.optional = value; } | |
| 9 | + private Anything optional; | |
| 15 | 10 | |
| 16 | 11 | @JsonProperty("required") |
| 17 | 12 | public Anything getRequired() { return required; } |
| 18 | 13 | @JsonProperty("required") |
| 19 | 14 | public void setRequired(Anything value) { this.required = value; } |
| 15 | + | |
| 16 | + @JsonProperty("optional") | |
| 17 | + public Anything getOptional() { return optional; } | |
| 18 | + @JsonProperty("optional") | |
| 19 | + public void setOptional(Anything value) { this.optional = value; } | |
| 20 | 20 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / Thing.java+6 −6
| @@ -5,16 +5,16 @@ import java.util.List; | ||
| 5 | 5 | import java.util.Map; |
| 6 | 6 | |
| 7 | 7 | public class Thing { |
| 8 | - private Anything optional; | |
| 9 | 8 | private Anything required; |
| 10 | - | |
| 11 | - @JsonProperty("optional") | |
| 12 | - public Anything getOptional() { return optional; } | |
| 13 | - @JsonProperty("optional") | |
| 14 | - public void setOptional(Anything value) { this.optional = value; } | |
| 9 | + private Anything optional; | |
| 15 | 10 | |
| 16 | 11 | @JsonProperty("required") |
| 17 | 12 | public Anything getRequired() { return required; } |
| 18 | 13 | @JsonProperty("required") |
| 19 | 14 | public void setRequired(Anything value) { this.required = value; } |
| 15 | + | |
| 16 | + @JsonProperty("optional") | |
| 17 | + public Anything getOptional() { return optional; } | |
| 18 | + @JsonProperty("optional") | |
| 19 | + public void setOptional(Anything value) { this.optional = value; } | |
| 20 | 20 | } |
Mschema-javadefault / src / main / java / io / quicktype / Thing.java+6 −6
| @@ -5,16 +5,16 @@ import java.util.List; | ||
| 5 | 5 | import java.util.Map; |
| 6 | 6 | |
| 7 | 7 | public class Thing { |
| 8 | - private Anything optional; | |
| 9 | 8 | private Anything required; |
| 10 | - | |
| 11 | - @JsonProperty("optional") | |
| 12 | - public Anything getOptional() { return optional; } | |
| 13 | - @JsonProperty("optional") | |
| 14 | - public void setOptional(Anything value) { this.optional = value; } | |
| 9 | + private Anything optional; | |
| 15 | 10 | |
| 16 | 11 | @JsonProperty("required") |
| 17 | 12 | public Anything getRequired() { return required; } |
| 18 | 13 | @JsonProperty("required") |
| 19 | 14 | public void setRequired(Anything value) { this.required = value; } |
| 15 | + | |
| 16 | + @JsonProperty("optional") | |
| 17 | + public Anything getOptional() { return optional; } | |
| 18 | + @JsonProperty("optional") | |
| 19 | + public void setOptional(Anything value) { this.optional = value; } | |
| 20 | 20 | } |
Mschema-javascriptdefault / TopLevel.js+1 −1
| @@ -175,8 +175,8 @@ const typeMap = { | ||
| 175 | 175 | { json: "stuff", js: "stuff", typ: m(r("Thing")) }, |
| 176 | 176 | ], false), |
| 177 | 177 | "Thing": o([ |
| 178 | - { json: "optional", js: "optional", typ: u(undefined, u(a("any"), true, 3.14, 0, m("any"), null, "")) }, | |
| 179 | 178 | { json: "required", js: "required", typ: u(a("any"), true, 3.14, 0, m("any"), null, "") }, |
| 179 | + { json: "optional", js: "optional", typ: u(undefined, u(a("any"), true, 3.14, 0, m("any"), null, "")) }, | |
| 180 | 180 | ], false), |
| 181 | 181 | }; |
Mschema-phpdefault / TopLevel.php+77 −77
| @@ -117,16 +117,16 @@ class TopLevel { | ||
| 117 | 117 | // This is an autogenerated file:Thing |
| 118 | 118 | |
| 119 | 119 | class Thing { |
| 120 | - private stdClass|array|bool|int|float|string|null $optional; // json:optional Optional | |
| 121 | 120 | private stdClass|array|bool|int|float|string|null $required; // json:required Optional |
| 121 | + private stdClass|array|bool|int|float|string|null $optional; // json:optional Optional | |
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | - * @param stdClass|array|bool|int|float|string|null $optional | |
| 125 | 124 | * @param stdClass|array|bool|int|float|string|null $required |
| 125 | + * @param stdClass|array|bool|int|float|string|null $optional | |
| 126 | 126 | */ |
| 127 | - public function __construct(stdClass|array|bool|int|float|string|null $optional, stdClass|array|bool|int|float|string|null $required) { | |
| 128 | - $this->optional = $optional; | |
| 127 | + public function __construct(stdClass|array|bool|int|float|string|null $required, stdClass|array|bool|int|float|string|null $optional) { | |
| 129 | 128 | $this->required = $required; |
| 129 | + $this->optional = $optional; | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
| @@ -134,7 +134,7 @@ class Thing { | ||
| 134 | 134 | * @throws Exception |
| 135 | 135 | * @return stdClass|array|bool|int|float|string|null |
| 136 | 136 | */ |
| 137 | - public static function fromOptional(stdClass|array|bool|int|float|string|null $value): stdClass|array|bool|int|float|string|null { | |
| 137 | + public static function fromRequired(stdClass|array|bool|int|float|string|null $value): stdClass|array|bool|int|float|string|null { | |
| 138 | 138 | if (is_null($value)) { |
| 139 | 139 | return $value; /*null*/ |
| 140 | 140 | } elseif (is_object($value)) { |
| @@ -164,33 +164,33 @@ class Thing { | ||
| 164 | 164 | * @throws Exception |
| 165 | 165 | * @return stdClass|array|bool|int|float|string|null |
| 166 | 166 | */ |
| 167 | - public function toOptional(): stdClass|array|bool|int|float|string|null { | |
| 168 | - if (Thing::validateOptional($this->optional)) { | |
| 169 | - if (is_null($this->optional)) { | |
| 170 | - return $this->optional; /*null*/ | |
| 171 | - } elseif ($this->optional instanceof stdClass) { | |
| 167 | + public function toRequired(): stdClass|array|bool|int|float|string|null { | |
| 168 | + if (Thing::validateRequired($this->required)) { | |
| 169 | + if (is_null($this->required)) { | |
| 170 | + return $this->required; /*null*/ | |
| 171 | + } elseif ($this->required instanceof stdClass) { | |
| 172 | 172 | $out = new stdClass(); |
| 173 | - foreach ($this->optional as $k => $v) { | |
| 173 | + foreach ($this->required as $k => $v) { | |
| 174 | 174 | $out->$k = $v; /*any*/ |
| 175 | 175 | } |
| 176 | 176 | return $out; |
| 177 | - } elseif (is_array($this->optional)) { | |
| 177 | + } elseif (is_array($this->required)) { | |
| 178 | 178 | return array_map(function ($value) { |
| 179 | 179 | return $value; /*any*/ |
| 180 | - }, $this->optional); | |
| 181 | - } elseif (is_bool($this->optional)) { | |
| 182 | - return $this->optional; /*bool*/ | |
| 183 | - } elseif (is_int($this->optional)) { | |
| 184 | - return $this->optional; /*int*/ | |
| 185 | - } elseif (is_float($this->optional) || is_int($this->optional)) { | |
| 186 | - return $this->optional; /*float*/ | |
| 187 | - } elseif (is_string($this->optional)) { | |
| 188 | - return $this->optional; /*string*/ | |
| 180 | + }, $this->required); | |
| 181 | + } elseif (is_bool($this->required)) { | |
| 182 | + return $this->required; /*bool*/ | |
| 183 | + } elseif (is_int($this->required)) { | |
| 184 | + return $this->required; /*int*/ | |
| 185 | + } elseif (is_float($this->required) || is_int($this->required)) { | |
| 186 | + return $this->required; /*float*/ | |
| 187 | + } elseif (is_string($this->required)) { | |
| 188 | + return $this->required; /*string*/ | |
| 189 | 189 | } else { |
| 190 | 190 | throw new Exception('Union value has no matching member in Thing'); |
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | - throw new Exception('never get to this Thing::optional'); | |
| 193 | + throw new Exception('never get to this Thing::required'); | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
| @@ -198,38 +198,38 @@ class Thing { | ||
| 198 | 198 | * @return bool |
| 199 | 199 | * @throws Exception |
| 200 | 200 | */ |
| 201 | - public static function validateOptional(stdClass|array|bool|int|float|string|null $value): bool { | |
| 201 | + public static function validateRequired(stdClass|array|bool|int|float|string|null $value): bool { | |
| 202 | 202 | if (is_null($value)) { |
| 203 | 203 | if (!is_null($value)) { |
| 204 | - throw new Exception("Attribute Error:Thing::optional"); | |
| 204 | + throw new Exception("Attribute Error:Thing::required"); | |
| 205 | 205 | } |
| 206 | 206 | } elseif ($value instanceof stdClass) { |
| 207 | 207 | foreach ($value as $k => $v) { |
| 208 | 208 | } |
| 209 | 209 | } elseif (is_array($value)) { |
| 210 | 210 | if (!is_array($value)) { |
| 211 | - throw new Exception("Attribute Error:Thing::optional"); | |
| 211 | + throw new Exception("Attribute Error:Thing::required"); | |
| 212 | 212 | } |
| 213 | 213 | array_walk($value, function($value_v) { |
| 214 | 214 | }); |
| 215 | 215 | } elseif (is_bool($value)) { |
| 216 | 216 | if (!is_bool($value)) { |
| 217 | - throw new Exception("Attribute Error:Thing::optional"); | |
| 217 | + throw new Exception("Attribute Error:Thing::required"); | |
| 218 | 218 | } |
| 219 | 219 | } elseif (is_int($value)) { |
| 220 | 220 | if (!is_integer($value)) { |
| 221 | - throw new Exception("Attribute Error:Thing::optional"); | |
| 221 | + throw new Exception("Attribute Error:Thing::required"); | |
| 222 | 222 | } |
| 223 | 223 | } elseif (is_float($value) || is_int($value)) { |
| 224 | 224 | if (!is_float($value) && !is_int($value)) { |
| 225 | - throw new Exception("Attribute Error:Thing::optional"); | |
| 225 | + throw new Exception("Attribute Error:Thing::required"); | |
| 226 | 226 | } |
| 227 | 227 | } elseif (is_string($value)) { |
| 228 | 228 | if (!is_string($value)) { |
| 229 | - throw new Exception("Attribute Error:Thing::optional"); | |
| 229 | + throw new Exception("Attribute Error:Thing::required"); | |
| 230 | 230 | } |
| 231 | 231 | } else { |
| 232 | - throw new Exception("Attribute Error:Thing::optional"); | |
| 232 | + throw new Exception("Attribute Error:Thing::required"); | |
| 233 | 233 | } |
| 234 | 234 | return true; |
| 235 | 235 | } |
| @@ -238,22 +238,22 @@ class Thing { | ||
| 238 | 238 | * @throws Exception |
| 239 | 239 | * @return stdClass|array|bool|int|float|string|null |
| 240 | 240 | */ |
| 241 | - public function getOptional(): stdClass|array|bool|int|float|string|null { | |
| 242 | - if (Thing::validateOptional($this->optional)) { | |
| 243 | - return $this->optional; | |
| 241 | + public function getRequired(): stdClass|array|bool|int|float|string|null { | |
| 242 | + if (Thing::validateRequired($this->required)) { | |
| 243 | + return $this->required; | |
| 244 | 244 | } |
| 245 | - throw new Exception('never get to getOptional Thing::optional'); | |
| 245 | + throw new Exception('never get to getRequired Thing::required'); | |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |
| 249 | 249 | * @return stdClass|array|bool|int|float|string|null |
| 250 | 250 | */ |
| 251 | - public static function sampleOptional(): stdClass|array|bool|int|float|string|null { | |
| 251 | + public static function sampleRequired(): stdClass|array|bool|int|float|string|null { | |
| 252 | 252 | return (function () { |
| 253 | 253 | $out = new stdClass(); |
| 254 | - $out->{'Thing'} = 'AnyType::Thing::optional::31';/*31:optional*/ | |
| 254 | + $out->{'Thing'} = 'AnyType::Thing::required::31';/*31:required*/ | |
| 255 | 255 | return $out; |
| 256 | - })(); /* 31:optional*/ | |
| 256 | + })(); /* 31:required*/ | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
| @@ -261,7 +261,7 @@ class Thing { | ||
| 261 | 261 | * @throws Exception |
| 262 | 262 | * @return stdClass|array|bool|int|float|string|null |
| 263 | 263 | */ |
| 264 | - public static function fromRequired(stdClass|array|bool|int|float|string|null $value): stdClass|array|bool|int|float|string|null { | |
| 264 | + public static function fromOptional(stdClass|array|bool|int|float|string|null $value): stdClass|array|bool|int|float|string|null { | |
| 265 | 265 | if (is_null($value)) { |
| 266 | 266 | return $value; /*null*/ |
| 267 | 267 | } elseif (is_object($value)) { |
| @@ -291,33 +291,33 @@ class Thing { | ||
| 291 | 291 | * @throws Exception |
| 292 | 292 | * @return stdClass|array|bool|int|float|string|null |
| 293 | 293 | */ |
| 294 | - public function toRequired(): stdClass|array|bool|int|float|string|null { | |
| 295 | - if (Thing::validateRequired($this->required)) { | |
| 296 | - if (is_null($this->required)) { | |
| 297 | - return $this->required; /*null*/ | |
| 298 | - } elseif ($this->required instanceof stdClass) { | |
| 294 | + public function toOptional(): stdClass|array|bool|int|float|string|null { | |
| 295 | + if (Thing::validateOptional($this->optional)) { | |
| 296 | + if (is_null($this->optional)) { | |
| 297 | + return $this->optional; /*null*/ | |
| 298 | + } elseif ($this->optional instanceof stdClass) { | |
| 299 | 299 | $out = new stdClass(); |
| 300 | - foreach ($this->required as $k => $v) { | |
| 300 | + foreach ($this->optional as $k => $v) { | |
| 301 | 301 | $out->$k = $v; /*any*/ |
| 302 | 302 | } |
| 303 | 303 | return $out; |
| 304 | - } elseif (is_array($this->required)) { | |
| 304 | + } elseif (is_array($this->optional)) { | |
| 305 | 305 | return array_map(function ($value) { |
| 306 | 306 | return $value; /*any*/ |
| 307 | - }, $this->required); | |
| 308 | - } elseif (is_bool($this->required)) { | |
| 309 | - return $this->required; /*bool*/ | |
| 310 | - } elseif (is_int($this->required)) { | |
| 311 | - return $this->required; /*int*/ | |
| 312 | - } elseif (is_float($this->required) || is_int($this->required)) { | |
| 313 | - return $this->required; /*float*/ | |
| 314 | - } elseif (is_string($this->required)) { | |
| 315 | - return $this->required; /*string*/ | |
| 307 | + }, $this->optional); | |
| 308 | + } elseif (is_bool($this->optional)) { | |
| 309 | + return $this->optional; /*bool*/ | |
| 310 | + } elseif (is_int($this->optional)) { | |
| 311 | + return $this->optional; /*int*/ | |
| 312 | + } elseif (is_float($this->optional) || is_int($this->optional)) { | |
| 313 | + return $this->optional; /*float*/ | |
| 314 | + } elseif (is_string($this->optional)) { | |
| 315 | + return $this->optional; /*string*/ | |
| 316 | 316 | } else { |
| 317 | 317 | throw new Exception('Union value has no matching member in Thing'); |
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | - throw new Exception('never get to this Thing::required'); | |
| 320 | + throw new Exception('never get to this Thing::optional'); | |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
| @@ -325,38 +325,38 @@ class Thing { | ||
| 325 | 325 | * @return bool |
| 326 | 326 | * @throws Exception |
| 327 | 327 | */ |
| 328 | - public static function validateRequired(stdClass|array|bool|int|float|string|null $value): bool { | |
| 328 | + public static function validateOptional(stdClass|array|bool|int|float|string|null $value): bool { | |
| 329 | 329 | if (is_null($value)) { |
| 330 | 330 | if (!is_null($value)) { |
| 331 | - throw new Exception("Attribute Error:Thing::required"); | |
| 331 | + throw new Exception("Attribute Error:Thing::optional"); | |
| 332 | 332 | } |
| 333 | 333 | } elseif ($value instanceof stdClass) { |
| 334 | 334 | foreach ($value as $k => $v) { |
| 335 | 335 | } |
| 336 | 336 | } elseif (is_array($value)) { |
| 337 | 337 | if (!is_array($value)) { |
| 338 | - throw new Exception("Attribute Error:Thing::required"); | |
| 338 | + throw new Exception("Attribute Error:Thing::optional"); | |
| 339 | 339 | } |
| 340 | 340 | array_walk($value, function($value_v) { |
| 341 | 341 | }); |
| 342 | 342 | } elseif (is_bool($value)) { |
| 343 | 343 | if (!is_bool($value)) { |
| 344 | - throw new Exception("Attribute Error:Thing::required"); | |
| 344 | + throw new Exception("Attribute Error:Thing::optional"); | |
| 345 | 345 | } |
| 346 | 346 | } elseif (is_int($value)) { |
| 347 | 347 | if (!is_integer($value)) { |
| 348 | - throw new Exception("Attribute Error:Thing::required"); | |
| 348 | + throw new Exception("Attribute Error:Thing::optional"); | |
| 349 | 349 | } |
| 350 | 350 | } elseif (is_float($value) || is_int($value)) { |
| 351 | 351 | if (!is_float($value) && !is_int($value)) { |
| 352 | - throw new Exception("Attribute Error:Thing::required"); | |
| 352 | + throw new Exception("Attribute Error:Thing::optional"); | |
| 353 | 353 | } |
| 354 | 354 | } elseif (is_string($value)) { |
| 355 | 355 | if (!is_string($value)) { |
| 356 | - throw new Exception("Attribute Error:Thing::required"); | |
| 356 | + throw new Exception("Attribute Error:Thing::optional"); | |
| 357 | 357 | } |
| 358 | 358 | } else { |
| 359 | - throw new Exception("Attribute Error:Thing::required"); | |
| 359 | + throw new Exception("Attribute Error:Thing::optional"); | |
| 360 | 360 | } |
| 361 | 361 | return true; |
| 362 | 362 | } |
| @@ -365,22 +365,22 @@ class Thing { | ||
| 365 | 365 | * @throws Exception |
| 366 | 366 | * @return stdClass|array|bool|int|float|string|null |
| 367 | 367 | */ |
| 368 | - public function getRequired(): stdClass|array|bool|int|float|string|null { | |
| 369 | - if (Thing::validateRequired($this->required)) { | |
| 370 | - return $this->required; | |
| 368 | + public function getOptional(): stdClass|array|bool|int|float|string|null { | |
| 369 | + if (Thing::validateOptional($this->optional)) { | |
| 370 | + return $this->optional; | |
| 371 | 371 | } |
| 372 | - throw new Exception('never get to getRequired Thing::required'); | |
| 372 | + throw new Exception('never get to getOptional Thing::optional'); | |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | /** |
| 376 | 376 | * @return stdClass|array|bool|int|float|string|null |
| 377 | 377 | */ |
| 378 | - public static function sampleRequired(): stdClass|array|bool|int|float|string|null { | |
| 378 | + public static function sampleOptional(): stdClass|array|bool|int|float|string|null { | |
| 379 | 379 | return (function () { |
| 380 | 380 | $out = new stdClass(); |
| 381 | - $out->{'Thing'} = 'AnyType::Thing::required::32';/*32:required*/ | |
| 381 | + $out->{'Thing'} = 'AnyType::Thing::optional::32';/*32:optional*/ | |
| 382 | 382 | return $out; |
| 383 | - })(); /* 32:required*/ | |
| 383 | + })(); /* 32:optional*/ | |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /** |
| @@ -388,8 +388,8 @@ class Thing { | ||
| 388 | 388 | * @return bool |
| 389 | 389 | */ |
| 390 | 390 | public function validate(): bool { |
| 391 | - return Thing::validateOptional($this->optional) | |
| 392 | - || Thing::validateRequired($this->required); | |
| 391 | + return Thing::validateRequired($this->required) | |
| 392 | + || Thing::validateOptional($this->optional); | |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | /** |
| @@ -398,8 +398,8 @@ class Thing { | ||
| 398 | 398 | */ |
| 399 | 399 | public function to(): stdClass { |
| 400 | 400 | $out = new stdClass(); |
| 401 | - $out->{'optional'} = $this->toOptional(); | |
| 402 | 401 | $out->{'required'} = $this->toRequired(); |
| 402 | + $out->{'optional'} = $this->toOptional(); | |
| 403 | 403 | return $out; |
| 404 | 404 | } |
| 405 | 405 | |
| @@ -410,8 +410,8 @@ class Thing { | ||
| 410 | 410 | */ |
| 411 | 411 | public static function from(stdClass $obj): Thing { |
| 412 | 412 | return new Thing( |
| 413 | - Thing::fromOptional($obj->{'optional'}) | |
| 414 | - ,Thing::fromRequired($obj->{'required'}) | |
| 413 | + Thing::fromRequired($obj->{'required'}) | |
| 414 | + ,Thing::fromOptional($obj->{'optional'}) | |
| 415 | 415 | ); |
| 416 | 416 | } |
| 417 | 417 | |
| @@ -420,8 +420,8 @@ class Thing { | ||
| 420 | 420 | */ |
| 421 | 421 | public static function sample(): Thing { |
| 422 | 422 | return new Thing( |
| 423 | - Thing::sampleOptional() | |
| 424 | - ,Thing::sampleRequired() | |
| 423 | + Thing::sampleRequired() | |
| 424 | + ,Thing::sampleOptional() | |
| 425 | 425 | ); |
| 426 | 426 | } |
| 427 | 427 | } |
Mschema-pikedefault / TopLevel.pmod+3 −3
| @@ -33,13 +33,13 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | class Thing { |
| 36 | - Anything thing_optional; // json: "optional" | |
| 37 | 36 | Anything required; // json: "required" |
| 37 | + Anything thing_optional; // json: "optional" | |
| 38 | 38 | |
| 39 | 39 | string encode_json() { |
| 40 | 40 | mapping(string:mixed) json = ([ |
| 41 | - "optional" : thing_optional, | |
| 42 | 41 | "required" : required, |
| 42 | + "optional" : thing_optional, | |
| 43 | 43 | ]); |
| 44 | 44 | |
| 45 | 45 | return Standards.JSON.encode(json); |
| @@ -49,8 +49,8 @@ class Thing { | ||
| 49 | 49 | Thing Thing_from_JSON(mixed json) { |
| 50 | 50 | Thing retval = Thing(); |
| 51 | 51 | |
| 52 | - retval.thing_optional = json["optional"]; | |
| 53 | 52 | retval.required = json["required"]; |
| 53 | + retval.thing_optional = json["optional"]; | |
| 54 | 54 | |
| 55 | 55 | return retval; |
| 56 | 56 | } |
Mschema-pythondefault / quicktype.py+4 −4
| @@ -61,21 +61,21 @@ def to_class(c: Type[T], x: Any) -> dict: | ||
| 61 | 61 | |
| 62 | 62 | @dataclass |
| 63 | 63 | class Thing: |
| 64 | - optional: float | int | bool | str | list[Any] | dict[str, Any] | None = None | |
| 65 | 64 | required: float | int | bool | str | list[Any] | dict[str, Any] | None = None |
| 65 | + optional: float | int | bool | str | list[Any] | dict[str, Any] | None = None | |
| 66 | 66 | |
| 67 | 67 | @staticmethod |
| 68 | 68 | def from_dict(obj: Any) -> 'Thing': |
| 69 | 69 | assert isinstance(obj, dict) |
| 70 | - optional = from_union([from_none, from_int, from_float, from_bool, from_str, lambda x: from_list(lambda x: x, x), lambda x: from_dict(lambda x: x, x)], obj.get("optional")) | |
| 71 | 70 | required = from_union([from_none, from_int, from_float, from_bool, from_str, lambda x: from_list(lambda x: x, x), lambda x: from_dict(lambda x: x, x)], obj.get("required")) |
| 72 | - return Thing(optional, required) | |
| 71 | + optional = from_union([from_none, from_int, from_float, from_bool, from_str, lambda x: from_list(lambda x: x, x), lambda x: from_dict(lambda x: x, x)], obj.get("optional")) | |
| 72 | + return Thing(required, optional) | |
| 73 | 73 | |
| 74 | 74 | def to_dict(self) -> dict: |
| 75 | 75 | result: dict = {} |
| 76 | + result["required"] = from_union([from_none, from_int, to_float, from_bool, from_str, lambda x: from_list(lambda x: x, x), lambda x: from_dict(lambda x: x, x)], self.required) | |
| 76 | 77 | if self.optional is not None: |
| 77 | 78 | result["optional"] = from_union([from_none, from_int, to_float, from_bool, from_str, lambda x: from_list(lambda x: x, x), lambda x: from_dict(lambda x: x, x)], self.optional) |
| 78 | - result["required"] = from_union([from_none, from_int, to_float, from_bool, from_str, lambda x: from_list(lambda x: x, x), lambda x: from_dict(lambda x: x, x)], self.required) | |
| 79 | 79 | return result |
Mschema-rubydefault / TopLevel.rb+4 −4
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.stuff["…"].thing_optional | |
| 7 | +# puts top_level.stuff["…"].required | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -89,14 +89,14 @@ class Anything < Dry::Struct | ||
| 89 | 89 | end |
| 90 | 90 | |
| 91 | 91 | class Thing < Dry::Struct |
| 92 | - attribute :thing_optional, Types.Instance(Anything).optional | |
| 93 | 92 | attribute :required, Types.Instance(Anything) |
| 93 | + attribute :thing_optional, Types.Instance(Anything).optional | |
| 94 | 94 | |
| 95 | 95 | def self.from_dynamic!(d) |
| 96 | 96 | d = Types::Hash[d] |
| 97 | 97 | new( |
| 98 | - thing_optional: d["optional"] ? Anything.from_dynamic!(d["optional"]) : nil, | |
| 99 | 98 | required: Anything.from_dynamic!(d.fetch("required")), |
| 99 | + thing_optional: d["optional"] ? Anything.from_dynamic!(d["optional"]) : nil, | |
| 100 | 100 | ) |
| 101 | 101 | end |
| 102 | 102 | |
| @@ -106,8 +106,8 @@ class Thing < Dry::Struct | ||
| 106 | 106 | |
| 107 | 107 | def to_dynamic |
| 108 | 108 | { |
| 109 | - "optional" => thing_optional&.to_dynamic, | |
| 110 | 109 | "required" => required.to_dynamic, |
| 110 | + "optional" => thing_optional&.to_dynamic, | |
| 111 | 111 | } |
| 112 | 112 | end |
Mschema-rustdefault / module_under_test.rs+2 −2
| @@ -21,9 +21,9 @@ pub struct TopLevel { | ||
| 21 | 21 | |
| 22 | 22 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 23 | 23 | pub struct Thing { |
| 24 | - pub optional: Option<Anything>, | |
| 25 | - | |
| 26 | 24 | pub required: Option<Anything>, |
| 25 | + | |
| 26 | + pub optional: Option<Anything>, | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | #[derive(Debug, Clone, Serialize, Deserialize)] |
Mschema-scala3-upickledefault / TopLevel.scala+2 −2
| @@ -70,8 +70,8 @@ case class TopLevel ( | ||
| 70 | 70 | ) derives OptionPickler.ReadWriter |
| 71 | 71 | |
| 72 | 72 | case class Thing ( |
| 73 | - val optional : Option[Anything] = None, | |
| 74 | - val required : Anything | |
| 73 | + val required : Anything, | |
| 74 | + val optional : Option[Anything] = None | |
| 75 | 75 | ) derives OptionPickler.ReadWriter |
| 76 | 76 | |
| 77 | 77 | type Anything = Seq[Option[ujson.Value]] | Map[String, Option[ujson.Value]] | Boolean | Double | Long | String | NullValue |
Mschema-scala3default / TopLevel.scala+2 −2
| @@ -12,8 +12,8 @@ case class TopLevel ( | ||
| 12 | 12 | ) derives Encoder.AsObject, Decoder |
| 13 | 13 | |
| 14 | 14 | case class Thing ( |
| 15 | - val optional : Option[Anything] = None, | |
| 16 | - val required : Anything | |
| 15 | + val required : Anything, | |
| 16 | + val optional : Option[Anything] = None | |
| 17 | 17 | ) derives Encoder.AsObject, Decoder |
| 18 | 18 | |
| 19 | 19 | type Anything = Seq[Option[Json]] | Map[String, Option[Json]] | Boolean | Double | Long | String | NullValue |
Mschema-schemadefault / TopLevel.schema+2 −2
| @@ -22,10 +22,10 @@ | ||
| 22 | 22 | "type": "object", |
| 23 | 23 | "additionalProperties": false, |
| 24 | 24 | "properties": { |
| 25 | - "optional": { | |
| 25 | + "required": { | |
| 26 | 26 | "$ref": "#/definitions/Anything" |
| 27 | 27 | }, |
| 28 | - "required": { | |
| 28 | + "optional": { | |
| 29 | 29 | "$ref": "#/definitions/Anything" |
| 30 | 30 | } |
| 31 | 31 | }, |
Mschema-swiftdefault / quicktype.swift+6 −6
| @@ -51,12 +51,12 @@ extension TopLevel { | ||
| 51 | 51 | |
| 52 | 52 | // MARK: - Thing |
| 53 | 53 | struct Thing: Codable { |
| 54 | - let thingOptional: Anything? | |
| 55 | 54 | let thingRequired: Anything |
| 55 | + let thingOptional: Anything? | |
| 56 | 56 | |
| 57 | 57 | enum CodingKeys: String, CodingKey { |
| 58 | - case thingOptional = "optional" | |
| 59 | 58 | case thingRequired = "required" |
| 59 | + case thingOptional = "optional" | |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
| @@ -79,12 +79,12 @@ extension Thing { | ||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | func with( |
| 82 | - thingOptional: Anything?? = nil, | |
| 83 | - thingRequired: Anything? = nil | |
| 82 | + thingRequired: Anything? = nil, | |
| 83 | + thingOptional: Anything?? = nil | |
| 84 | 84 | ) -> Thing { |
| 85 | 85 | return Thing( |
| 86 | - thingOptional: thingOptional ?? self.thingOptional, | |
| 87 | - thingRequired: thingRequired ?? self.thingRequired | |
| 86 | + thingRequired: thingRequired ?? self.thingRequired, | |
| 87 | + thingOptional: thingOptional ?? self.thingOptional | |
| 88 | 88 | ) |
| 89 | 89 | } |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -12,8 +12,8 @@ export interface TopLevel { | ||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | export interface Thing { |
| 15 | - optional?: Anything; | |
| 16 | 15 | required: Anything; |
| 16 | + optional?: Anything; | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | export type Anything = unknown[] | boolean | number | number | { [key: string]: unknown } | null | string; |
| @@ -188,7 +188,7 @@ const typeMap: any = { | ||
| 188 | 188 | { json: "stuff", js: "stuff", typ: m(r("Thing")) }, |
| 189 | 189 | ], false), |
| 190 | 190 | "Thing": o([ |
| 191 | - { json: "optional", js: "optional", typ: u(undefined, u(a("any"), true, 3.14, 0, m("any"), null, "")) }, | |
| 192 | 191 | { json: "required", js: "required", typ: u(a("any"), true, 3.14, 0, m("any"), null, "") }, |
| 192 | + { json: "optional", js: "optional", typ: u(undefined, u(a("any"), true, 3.14, 0, m("any"), null, "")) }, | |
| 193 | 193 | ], false), |
| 194 | 194 | }; |
Test case
23 generated files · +347 −348test/inputs/schema/enum.schema
Mschema-cplusplusdefault / quicktype.hpp+19 −19
| @@ -103,32 +103,32 @@ namespace quicktype { | ||
| 103 | 103 | virtual ~TopLevel() = default; |
| 104 | 104 | |
| 105 | 105 | private: |
| 106 | - std::optional<std::vector<Arr>> arr; | |
| 107 | - std::optional<std::string> top_level_for; | |
| 108 | - Gve gve; | |
| 109 | 106 | std::optional<Lvc> lvc; |
| 107 | + Gve gve; | |
| 108 | + std::optional<std::vector<Arr>> arr; | |
| 110 | 109 | std::optional<std::vector<OtherArr>> other_arr; |
| 110 | + std::optional<std::string> top_level_for; | |
| 111 | 111 | |
| 112 | 112 | public: |
| 113 | - const std::optional<std::vector<Arr>> & get_arr() const { return arr; } | |
| 114 | - std::optional<std::vector<Arr>> & get_mutable_arr() { return arr; } | |
| 115 | - void set_arr(const std::optional<std::vector<Arr>> & value) { this->arr = value; } | |
| 116 | - | |
| 117 | - const std::optional<std::string> & get_top_level_for() const { return top_level_for; } | |
| 118 | - std::optional<std::string> & get_mutable_top_level_for() { return top_level_for; } | |
| 119 | - void set_top_level_for(const std::optional<std::string> & value) { this->top_level_for = value; } | |
| 113 | + const std::optional<Lvc> & get_lvc() const { return lvc; } | |
| 114 | + std::optional<Lvc> & get_mutable_lvc() { return lvc; } | |
| 115 | + void set_lvc(const std::optional<Lvc> & value) { this->lvc = value; } | |
| 120 | 116 | |
| 121 | 117 | const Gve & get_gve() const { return gve; } |
| 122 | 118 | Gve & get_mutable_gve() { return gve; } |
| 123 | 119 | void set_gve(const Gve & value) { this->gve = value; } |
| 124 | 120 | |
| 125 | - const std::optional<Lvc> & get_lvc() const { return lvc; } | |
| 126 | - std::optional<Lvc> & get_mutable_lvc() { return lvc; } | |
| 127 | - void set_lvc(const std::optional<Lvc> & value) { this->lvc = value; } | |
| 121 | + const std::optional<std::vector<Arr>> & get_arr() const { return arr; } | |
| 122 | + std::optional<std::vector<Arr>> & get_mutable_arr() { return arr; } | |
| 123 | + void set_arr(const std::optional<std::vector<Arr>> & value) { this->arr = value; } | |
| 128 | 124 | |
| 129 | 125 | const std::optional<std::vector<OtherArr>> & get_other_arr() const { return other_arr; } |
| 130 | 126 | std::optional<std::vector<OtherArr>> & get_mutable_other_arr() { return other_arr; } |
| 131 | 127 | void set_other_arr(const std::optional<std::vector<OtherArr>> & value) { this->other_arr = value; } |
| 128 | + | |
| 129 | + const std::optional<std::string> & get_top_level_for() const { return top_level_for; } | |
| 130 | + std::optional<std::string> & get_mutable_top_level_for() { return top_level_for; } | |
| 131 | + void set_top_level_for(const std::optional<std::string> & value) { this->top_level_for = value; } | |
| 132 | 132 | }; |
| 133 | 133 | } |
| 134 | 134 | |
| @@ -154,20 +154,20 @@ struct adl_serializer<std::variant<quicktype::OtherArr, int64_t>> { | ||
| 154 | 154 | } |
| 155 | 155 | namespace quicktype { |
| 156 | 156 | inline void from_json(const json & j, TopLevel& x) { |
| 157 | - x.set_arr(get_stack_optional<std::vector<Arr>>(j, "arr")); | |
| 158 | - x.set_top_level_for(get_stack_optional<std::string>(j, "for")); | |
| 159 | - x.set_gve(j.at("gve").get<Gve>()); | |
| 160 | 157 | x.set_lvc(get_stack_optional<Lvc>(j, "lvc")); |
| 158 | + x.set_gve(j.at("gve").get<Gve>()); | |
| 159 | + x.set_arr(get_stack_optional<std::vector<Arr>>(j, "arr")); | |
| 161 | 160 | x.set_other_arr(get_stack_optional<std::vector<OtherArr>>(j, "otherArr")); |
| 161 | + x.set_top_level_for(get_stack_optional<std::string>(j, "for")); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | inline void to_json(json & j, const TopLevel & x) { |
| 165 | 165 | j = json::object(); |
| 166 | - j["arr"] = x.get_arr(); | |
| 167 | - j["for"] = x.get_top_level_for(); | |
| 168 | - j["gve"] = x.get_gve(); | |
| 169 | 166 | j["lvc"] = x.get_lvc(); |
| 167 | + j["gve"] = x.get_gve(); | |
| 168 | + j["arr"] = x.get_arr(); | |
| 170 | 169 | j["otherArr"] = x.get_other_arr(); |
| 170 | + j["for"] = x.get_top_level_for(); | |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | inline void from_json(const json & j, OtherArr & x) { |
Mschema-csharp-recordsdefault / QuickType.cs+7 −7
| @@ -25,20 +25,20 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("arr", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 29 | - public Arr[]? Arr { get; set; } | |
| 30 | - | |
| 31 | - [JsonProperty("for", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 32 | - public string? For { get; set; } | |
| 28 | + [JsonProperty("lvc", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 29 | + public Lvc? Lvc { get; set; } | |
| 33 | 30 | |
| 34 | 31 | [JsonProperty("gve", Required = Required.Always)] |
| 35 | 32 | public Gve Gve { get; set; } |
| 36 | 33 | |
| 37 | - [JsonProperty("lvc", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 38 | - public Lvc? Lvc { get; set; } | |
| 34 | + [JsonProperty("arr", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 35 | + public Arr[]? Arr { get; set; } | |
| 39 | 36 | |
| 40 | 37 | [JsonProperty("otherArr", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 41 | 38 | public OtherArr[]? OtherArr { get; set; } |
| 39 | + | |
| 40 | + [JsonProperty("for", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 41 | + public string? For { get; set; } | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public enum OtherArr { Foo, Bar, If }; |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+8 −8
| @@ -23,24 +23,24 @@ namespace QuickType | ||
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | 25 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 26 | - [JsonPropertyName("arr")] | |
| 27 | - public Arr[]? Arr { get; set; } | |
| 28 | - | |
| 29 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 30 | - [JsonPropertyName("for")] | |
| 31 | - public string? For { get; set; } | |
| 26 | + [JsonPropertyName("lvc")] | |
| 27 | + public Lvc? Lvc { get; set; } | |
| 32 | 28 | |
| 33 | 29 | [JsonRequired] |
| 34 | 30 | [JsonPropertyName("gve")] |
| 35 | 31 | public Gve Gve { get; set; } |
| 36 | 32 | |
| 37 | 33 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 38 | - [JsonPropertyName("lvc")] | |
| 39 | - public Lvc? Lvc { get; set; } | |
| 34 | + [JsonPropertyName("arr")] | |
| 35 | + public Arr[]? Arr { get; set; } | |
| 40 | 36 | |
| 41 | 37 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 42 | 38 | [JsonPropertyName("otherArr")] |
| 43 | 39 | public OtherArr[]? OtherArr { get; set; } |
| 40 | + | |
| 41 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 42 | + [JsonPropertyName("for")] | |
| 43 | + public string? For { get; set; } | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public enum OtherArr { Foo, Bar, If }; |
Mschema-csharpdefault / QuickType.cs+7 −7
| @@ -25,20 +25,20 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("arr", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 29 | - public Arr[]? Arr { get; set; } | |
| 30 | - | |
| 31 | - [JsonProperty("for", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 32 | - public string? For { get; set; } | |
| 28 | + [JsonProperty("lvc", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 29 | + public Lvc? Lvc { get; set; } | |
| 33 | 30 | |
| 34 | 31 | [JsonProperty("gve", Required = Required.Always)] |
| 35 | 32 | public Gve Gve { get; set; } |
| 36 | 33 | |
| 37 | - [JsonProperty("lvc", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 38 | - public Lvc? Lvc { get; set; } | |
| 34 | + [JsonProperty("arr", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 35 | + public Arr[]? Arr { get; set; } | |
| 39 | 36 | |
| 40 | 37 | [JsonProperty("otherArr", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 41 | 38 | public OtherArr[]? OtherArr { get; set; } |
| 39 | + | |
| 40 | + [JsonProperty("for", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 41 | + public string? For { get; set; } | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public enum OtherArr { Foo, Bar, If }; |
Mschema-elixirdefault / QuickType.ex+11 −11
| @@ -148,14 +148,14 @@ end | ||
| 148 | 148 | |
| 149 | 149 | defmodule TopLevel do |
| 150 | 150 | @enforce_keys [:gve] |
| 151 | - defstruct [:arr, :for, :gve, :lvc, :other_arr] | |
| 151 | + defstruct [:lvc, :gve, :arr, :other_arr, :for] | |
| 152 | 152 | |
| 153 | 153 | @type t :: %__MODULE__{ |
| 154 | - arr: [OtherArr.t() | integer()] | nil, | |
| 155 | - for: String.t() | nil, | |
| 156 | - gve: Gve.t(), | |
| 157 | 154 | lvc: Lvc.t() | nil, |
| 158 | - other_arr: [OtherArr.t()] | nil | |
| 155 | + gve: Gve.t(), | |
| 156 | + arr: [OtherArr.t() | integer()] | nil, | |
| 157 | + other_arr: [OtherArr.t()] | nil, | |
| 158 | + for: String.t() | nil | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | def decode_arr_element(value) when is_binary(value), do: OtherArr.decode(value) |
| @@ -168,11 +168,11 @@ defmodule TopLevel do | ||
| 168 | 168 | |
| 169 | 169 | def from_map(m) do |
| 170 | 170 | %TopLevel{ |
| 171 | - arr: m["arr"] && Enum.map(m["arr"], &decode_arr_element/1), | |
| 172 | - for: m["for"], | |
| 173 | - gve: Gve.decode(m["gve"]), | |
| 174 | 171 | lvc: m["lvc"] && Lvc.decode(m["lvc"]), |
| 172 | + gve: Gve.decode(m["gve"]), | |
| 173 | + arr: m["arr"] && Enum.map(m["arr"], &decode_arr_element/1), | |
| 175 | 174 | other_arr: m["otherArr"] && Enum.map(m["otherArr"], &OtherArr.decode/1), |
| 175 | + for: m["for"], | |
| 176 | 176 | } |
| 177 | 177 | end |
| 178 | 178 | |
| @@ -184,11 +184,11 @@ defmodule TopLevel do | ||
| 184 | 184 | |
| 185 | 185 | def to_map(struct) do |
| 186 | 186 | %{ |
| 187 | - "arr" => struct.arr && Enum.map(struct.arr, &encode_arr_element/1), | |
| 188 | - "for" => struct.for, | |
| 189 | - "gve" => Gve.encode(struct.gve), | |
| 190 | 187 | "lvc" => struct.lvc && Lvc.encode(struct.lvc), |
| 188 | + "gve" => Gve.encode(struct.gve), | |
| 189 | + "arr" => struct.arr && Enum.map(struct.arr, &encode_arr_element/1), | |
| 191 | 190 | "otherArr" => struct.other_arr && Enum.map(struct.other_arr, &OtherArr.encode/1), |
| 191 | + "for" => struct.for, | |
| 192 | 192 | } |
| 193 | 193 | end |
Mschema-elmdefault / QuickType.elm+9 −9
| @@ -27,11 +27,11 @@ import Json.Encode as Jenc | ||
| 27 | 27 | import Dict exposing (Dict) |
| 28 | 28 | |
| 29 | 29 | type alias QuickType = |
| 30 | - { arr : Maybe (List Arr) | |
| 31 | - , for : Maybe String | |
| 30 | + { lvc : Maybe Lvc | |
| 32 | 31 | , gve : Gve |
| 33 | - , lvc : Maybe Lvc | |
| 32 | + , arr : Maybe (List Arr) | |
| 34 | 33 | , otherArr : Maybe (List OtherArr) |
| 34 | + , for : Maybe String | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | type Arr |
| @@ -61,20 +61,20 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 61 | 61 | quickType : Jdec.Decoder QuickType |
| 62 | 62 | quickType = |
| 63 | 63 | Jdec.succeed QuickType |
| 64 | - |> Jpipe.optional "arr" (Jdec.nullable (Jdec.list arr)) Nothing | |
| 65 | - |> Jpipe.optional "for" (Jdec.nullable Jdec.string) Nothing | |
| 66 | - |> Jpipe.required "gve" gve | |
| 67 | 64 | |> Jpipe.optional "lvc" (Jdec.nullable lvc) Nothing |
| 65 | + |> Jpipe.required "gve" gve | |
| 66 | + |> Jpipe.optional "arr" (Jdec.nullable (Jdec.list arr)) Nothing | |
| 68 | 67 | |> Jpipe.optional "otherArr" (Jdec.nullable (Jdec.list otherArr)) Nothing |
| 68 | + |> Jpipe.optional "for" (Jdec.nullable Jdec.string) Nothing | |
| 69 | 69 | |
| 70 | 70 | encodeQuickType : QuickType -> Jenc.Value |
| 71 | 71 | encodeQuickType x = |
| 72 | 72 | Jenc.object |
| 73 | - [ ("arr", makeNullableEncoder (Jenc.list encodeArr) x.arr) | |
| 74 | - , ("for", makeNullableEncoder Jenc.string x.for) | |
| 73 | + [ ("lvc", makeNullableEncoder encodeLvc x.lvc) | |
| 75 | 74 | , ("gve", encodeGve x.gve) |
| 76 | - , ("lvc", makeNullableEncoder encodeLvc x.lvc) | |
| 75 | + , ("arr", makeNullableEncoder (Jenc.list encodeArr) x.arr) | |
| 77 | 76 | , ("otherArr", makeNullableEncoder (Jenc.list encodeOtherArr) x.otherArr) |
| 77 | + , ("for", makeNullableEncoder Jenc.string x.for) | |
| 78 | 78 | ] |
| 79 | 79 | |
| 80 | 80 | arr : Jdec.Decoder Arr |
Mschema-flowdefault / TopLevel.js+6 −6
| @@ -10,11 +10,11 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - arr?: Arr[]; | |
| 14 | - for?: string; | |
| 15 | - gve: Gve; | |
| 16 | 13 | lvc?: Lvc; |
| 14 | + gve: Gve; | |
| 15 | + arr?: Arr[]; | |
| 17 | 16 | otherArr?: OtherArr[]; |
| 17 | + for?: string; | |
| 18 | 18 | [property: string]: mixed; |
| 19 | 19 | }; |
| 20 | 20 | |
| @@ -200,11 +200,11 @@ function r(name: string) { | ||
| 200 | 200 | |
| 201 | 201 | const typeMap: any = { |
| 202 | 202 | "TopLevel": o([ |
| 203 | - { json: "arr", js: "arr", typ: u(undefined, a(u(r("OtherArr"), 0))) }, | |
| 204 | - { json: "for", js: "for", typ: u(undefined, "") }, | |
| 205 | - { json: "gve", js: "gve", typ: r("Gve") }, | |
| 206 | 203 | { json: "lvc", js: "lvc", typ: u(undefined, r("Lvc")) }, |
| 204 | + { json: "gve", js: "gve", typ: r("Gve") }, | |
| 205 | + { json: "arr", js: "arr", typ: u(undefined, a(u(r("OtherArr"), 0))) }, | |
| 207 | 206 | { json: "otherArr", js: "otherArr", typ: u(undefined, a(r("OtherArr"))) }, |
| 207 | + { json: "for", js: "for", typ: u(undefined, "") }, | |
| 208 | 208 | ], "any"), |
| 209 | 209 | "OtherArr": [ |
| 210 | 210 | "foo", |
Mschema-golangdefault / quicktype.go+3 −3
| @@ -22,11 +22,11 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | type TopLevel struct { |
| 25 | - Arr []Arr `json:"arr,omitempty"` | |
| 26 | - For *string `json:"for,omitempty"` | |
| 27 | - Gve Gve `json:"gve"` | |
| 28 | 25 | Lvc *Lvc `json:"lvc,omitempty"` |
| 26 | + Gve Gve `json:"gve"` | |
| 27 | + Arr []Arr `json:"arr,omitempty"` | |
| 29 | 28 | OtherArr []OtherArr `json:"otherArr,omitempty"` |
| 29 | + For *string `json:"for,omitempty"` | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | type OtherArr string |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+16 −16
| @@ -4,34 +4,34 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private List<Arr> arr; | |
| 8 | - private String topLevelFor; | |
| 9 | - private Gve gve; | |
| 10 | 7 | private Lvc lvc; |
| 8 | + private Gve gve; | |
| 9 | + private List<Arr> arr; | |
| 11 | 10 | private List<OtherArr> otherArr; |
| 11 | + private String topLevelFor; | |
| 12 | 12 | |
| 13 | - @JsonProperty("arr") | |
| 14 | - public List<Arr> getArr() { return arr; } | |
| 15 | - @JsonProperty("arr") | |
| 16 | - public void setArr(List<Arr> value) { this.arr = value; } | |
| 17 | - | |
| 18 | - @JsonProperty("for") | |
| 19 | - public String getTopLevelFor() { return topLevelFor; } | |
| 20 | - @JsonProperty("for") | |
| 21 | - public void setTopLevelFor(String value) { this.topLevelFor = value; } | |
| 13 | + @JsonProperty("lvc") | |
| 14 | + public Lvc getLvc() { return lvc; } | |
| 15 | + @JsonProperty("lvc") | |
| 16 | + public void setLvc(Lvc value) { this.lvc = value; } | |
| 22 | 17 | |
| 23 | 18 | @JsonProperty("gve") |
| 24 | 19 | public Gve getGve() { return gve; } |
| 25 | 20 | @JsonProperty("gve") |
| 26 | 21 | public void setGve(Gve value) { this.gve = value; } |
| 27 | 22 | |
| 28 | - @JsonProperty("lvc") | |
| 29 | - public Lvc getLvc() { return lvc; } | |
| 30 | - @JsonProperty("lvc") | |
| 31 | - public void setLvc(Lvc value) { this.lvc = value; } | |
| 23 | + @JsonProperty("arr") | |
| 24 | + public List<Arr> getArr() { return arr; } | |
| 25 | + @JsonProperty("arr") | |
| 26 | + public void setArr(List<Arr> value) { this.arr = value; } | |
| 32 | 27 | |
| 33 | 28 | @JsonProperty("otherArr") |
| 34 | 29 | public List<OtherArr> getOtherArr() { return otherArr; } |
| 35 | 30 | @JsonProperty("otherArr") |
| 36 | 31 | public void setOtherArr(List<OtherArr> value) { this.otherArr = value; } |
| 32 | + | |
| 33 | + @JsonProperty("for") | |
| 34 | + public String getTopLevelFor() { return topLevelFor; } | |
| 35 | + @JsonProperty("for") | |
| 36 | + public void setTopLevelFor(String value) { this.topLevelFor = value; } | |
| 37 | 37 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+16 −16
| @@ -4,34 +4,34 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private List<Arr> arr; | |
| 8 | - private String topLevelFor; | |
| 9 | - private Gve gve; | |
| 10 | 7 | private Lvc lvc; |
| 8 | + private Gve gve; | |
| 9 | + private List<Arr> arr; | |
| 11 | 10 | private List<OtherArr> otherArr; |
| 11 | + private String topLevelFor; | |
| 12 | 12 | |
| 13 | - @JsonProperty("arr") | |
| 14 | - public List<Arr> getArr() { return arr; } | |
| 15 | - @JsonProperty("arr") | |
| 16 | - public void setArr(List<Arr> value) { this.arr = value; } | |
| 17 | - | |
| 18 | - @JsonProperty("for") | |
| 19 | - public String getTopLevelFor() { return topLevelFor; } | |
| 20 | - @JsonProperty("for") | |
| 21 | - public void setTopLevelFor(String value) { this.topLevelFor = value; } | |
| 13 | + @JsonProperty("lvc") | |
| 14 | + public Lvc getLvc() { return lvc; } | |
| 15 | + @JsonProperty("lvc") | |
| 16 | + public void setLvc(Lvc value) { this.lvc = value; } | |
| 22 | 17 | |
| 23 | 18 | @JsonProperty("gve") |
| 24 | 19 | public Gve getGve() { return gve; } |
| 25 | 20 | @JsonProperty("gve") |
| 26 | 21 | public void setGve(Gve value) { this.gve = value; } |
| 27 | 22 | |
| 28 | - @JsonProperty("lvc") | |
| 29 | - public Lvc getLvc() { return lvc; } | |
| 30 | - @JsonProperty("lvc") | |
| 31 | - public void setLvc(Lvc value) { this.lvc = value; } | |
| 23 | + @JsonProperty("arr") | |
| 24 | + public List<Arr> getArr() { return arr; } | |
| 25 | + @JsonProperty("arr") | |
| 26 | + public void setArr(List<Arr> value) { this.arr = value; } | |
| 32 | 27 | |
| 33 | 28 | @JsonProperty("otherArr") |
| 34 | 29 | public List<OtherArr> getOtherArr() { return otherArr; } |
| 35 | 30 | @JsonProperty("otherArr") |
| 36 | 31 | public void setOtherArr(List<OtherArr> value) { this.otherArr = value; } |
| 32 | + | |
| 33 | + @JsonProperty("for") | |
| 34 | + public String getTopLevelFor() { return topLevelFor; } | |
| 35 | + @JsonProperty("for") | |
| 36 | + public void setTopLevelFor(String value) { this.topLevelFor = value; } | |
| 37 | 37 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+16 −16
| @@ -4,34 +4,34 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private List<Arr> arr; | |
| 8 | - private String topLevelFor; | |
| 9 | - private Gve gve; | |
| 10 | 7 | private Lvc lvc; |
| 8 | + private Gve gve; | |
| 9 | + private List<Arr> arr; | |
| 11 | 10 | private List<OtherArr> otherArr; |
| 11 | + private String topLevelFor; | |
| 12 | 12 | |
| 13 | - @JsonProperty("arr") | |
| 14 | - public List<Arr> getArr() { return arr; } | |
| 15 | - @JsonProperty("arr") | |
| 16 | - public void setArr(List<Arr> value) { this.arr = value; } | |
| 17 | - | |
| 18 | - @JsonProperty("for") | |
| 19 | - public String getTopLevelFor() { return topLevelFor; } | |
| 20 | - @JsonProperty("for") | |
| 21 | - public void setTopLevelFor(String value) { this.topLevelFor = value; } | |
| 13 | + @JsonProperty("lvc") | |
| 14 | + public Lvc getLvc() { return lvc; } | |
| 15 | + @JsonProperty("lvc") | |
| 16 | + public void setLvc(Lvc value) { this.lvc = value; } | |
| 22 | 17 | |
| 23 | 18 | @JsonProperty("gve") |
| 24 | 19 | public Gve getGve() { return gve; } |
| 25 | 20 | @JsonProperty("gve") |
| 26 | 21 | public void setGve(Gve value) { this.gve = value; } |
| 27 | 22 | |
| 28 | - @JsonProperty("lvc") | |
| 29 | - public Lvc getLvc() { return lvc; } | |
| 30 | - @JsonProperty("lvc") | |
| 31 | - public void setLvc(Lvc value) { this.lvc = value; } | |
| 23 | + @JsonProperty("arr") | |
| 24 | + public List<Arr> getArr() { return arr; } | |
| 25 | + @JsonProperty("arr") | |
| 26 | + public void setArr(List<Arr> value) { this.arr = value; } | |
| 32 | 27 | |
| 33 | 28 | @JsonProperty("otherArr") |
| 34 | 29 | public List<OtherArr> getOtherArr() { return otherArr; } |
| 35 | 30 | @JsonProperty("otherArr") |
| 36 | 31 | public void setOtherArr(List<OtherArr> value) { this.otherArr = value; } |
| 32 | + | |
| 33 | + @JsonProperty("for") | |
| 34 | + public String getTopLevelFor() { return topLevelFor; } | |
| 35 | + @JsonProperty("for") | |
| 36 | + public void setTopLevelFor(String value) { this.topLevelFor = value; } | |
| 37 | 37 | } |
Mschema-javascriptdefault / TopLevel.js+3 −3
| @@ -172,11 +172,11 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "arr", js: "arr", typ: u(undefined, a(u(r("OtherArr"), 0))) }, | |
| 176 | - { json: "for", js: "for", typ: u(undefined, "") }, | |
| 177 | - { json: "gve", js: "gve", typ: r("Gve") }, | |
| 178 | 175 | { json: "lvc", js: "lvc", typ: u(undefined, r("Lvc")) }, |
| 176 | + { json: "gve", js: "gve", typ: r("Gve") }, | |
| 177 | + { json: "arr", js: "arr", typ: u(undefined, a(u(r("OtherArr"), 0))) }, | |
| 179 | 178 | { json: "otherArr", js: "otherArr", typ: u(undefined, a(r("OtherArr"))) }, |
| 179 | + { json: "for", js: "for", typ: u(undefined, "") }, | |
| 180 | 180 | ], "any"), |
| 181 | 181 | "OtherArr": [ |
| 182 | 182 | "foo", |
Mschema-kotlin-jacksondefault / TopLevel.kt+6 −6
| @@ -34,16 +34,16 @@ val mapper = jacksonObjectMapper().apply { | ||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | data class TopLevel ( |
| 37 | - val arr: List<Arr>? = null, | |
| 38 | - | |
| 39 | - @get:JsonProperty("for")@field:JsonProperty("for") | |
| 40 | - val topLevelFor: String? = null, | |
| 37 | + val lvc: Lvc? = null, | |
| 41 | 38 | |
| 42 | 39 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 43 | 40 | val gve: Gve, |
| 44 | 41 | |
| 45 | - val lvc: Lvc? = null, | |
| 46 | - val otherArr: List<OtherArr>? = null | |
| 42 | + val arr: List<Arr>? = null, | |
| 43 | + val otherArr: List<OtherArr>? = null, | |
| 44 | + | |
| 45 | + @get:JsonProperty("for")@field:JsonProperty("for") | |
| 46 | + val topLevelFor: String? = null | |
| 47 | 47 | ) { |
| 48 | 48 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+4 −5
| @@ -21,14 +21,13 @@ private val klaxon = Klaxon() | ||
| 21 | 21 | .convert(Arr::class, { Arr.fromJson(it) }, { it.toJson() }, true) |
| 22 | 22 | |
| 23 | 23 | data class TopLevel ( |
| 24 | + val lvc: Lvc? = null, | |
| 25 | + val gve: Gve, | |
| 24 | 26 | val arr: List<Arr>? = null, |
| 27 | + val otherArr: List<OtherArr>? = null, | |
| 25 | 28 | |
| 26 | 29 | @Json(name = "for") |
| 27 | - val topLevelFor: String? = null, | |
| 28 | - | |
| 29 | - val gve: Gve, | |
| 30 | - val lvc: Lvc? = null, | |
| 31 | - val otherArr: List<OtherArr>? = null | |
| 30 | + val topLevelFor: String? = null | |
| 32 | 31 | ) { |
| 33 | 32 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-phpdefault / TopLevel.php+152 −152
| @@ -4,124 +4,35 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private ?array $arr; // json:arr Optional | |
| 8 | - private ?string $for; // json:for Optional | |
| 9 | - private Gve $gve; // json:gve Required | |
| 10 | 7 | private ?Lvc $lvc; // json:lvc Optional |
| 8 | + private Gve $gve; // json:gve Required | |
| 9 | + private ?array $arr; // json:arr Optional | |
| 11 | 10 | private ?array $otherArr; // json:otherArr Optional |
| 11 | + private ?string $for; // json:for Optional | |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * @param array|null $arr | |
| 15 | - * @param string|null $for | |
| 16 | - * @param Gve $gve | |
| 17 | 14 | * @param Lvc|null $lvc |
| 15 | + * @param Gve $gve | |
| 16 | + * @param array|null $arr | |
| 18 | 17 | * @param array|null $otherArr |
| 18 | + * @param string|null $for | |
| 19 | 19 | */ |
| 20 | - public function __construct(?array $arr, ?string $for, Gve $gve, ?Lvc $lvc, ?array $otherArr) { | |
| 21 | - $this->arr = $arr; | |
| 22 | - $this->for = $for; | |
| 23 | - $this->gve = $gve; | |
| 20 | + public function __construct(?Lvc $lvc, Gve $gve, ?array $arr, ?array $otherArr, ?string $for) { | |
| 24 | 21 | $this->lvc = $lvc; |
| 22 | + $this->gve = $gve; | |
| 23 | + $this->arr = $arr; | |
| 25 | 24 | $this->otherArr = $otherArr; |
| 26 | - } | |
| 27 | - | |
| 28 | - /** | |
| 29 | - * @param ?array $value | |
| 30 | - * @throws Exception | |
| 31 | - * @return ?array | |
| 32 | - */ | |
| 33 | - public static function fromArr(?array $value): ?array { | |
| 34 | - if (!is_null($value)) { | |
| 35 | - return array_map(function ($value) { | |
| 36 | - if (is_string($value) && in_array($value, ['foo', 'bar', 'if'], true)) { | |
| 37 | - return OtherArr::from($value); /*enum*/ | |
| 38 | - } elseif (is_int($value)) { | |
| 39 | - return $value; /*int*/ | |
| 40 | - } else { | |
| 41 | - throw new Exception('Cannot deserialize union value in TopLevel'); | |
| 42 | - } | |
| 43 | - }, $value); | |
| 44 | - } else { | |
| 45 | - return null; | |
| 46 | - } | |
| 47 | - } | |
| 48 | - | |
| 49 | - /** | |
| 50 | - * @throws Exception | |
| 51 | - * @return ?array | |
| 52 | - */ | |
| 53 | - public function toArr(): ?array { | |
| 54 | - if (TopLevel::validateArr($this->arr)) { | |
| 55 | - if (!is_null($this->arr)) { | |
| 56 | - return array_map(function ($value) { | |
| 57 | - if ($value instanceof OtherArr) { | |
| 58 | - return OtherArr::to($value); /*enum*/ | |
| 59 | - } elseif (is_int($value)) { | |
| 60 | - return $value; /*int*/ | |
| 61 | - } else { | |
| 62 | - throw new Exception('Union value has no matching member in TopLevel'); | |
| 63 | - } | |
| 64 | - }, $this->arr); | |
| 65 | - } else { | |
| 66 | - return null; | |
| 67 | - } | |
| 68 | - } | |
| 69 | - throw new Exception('never get to this TopLevel::arr'); | |
| 70 | - } | |
| 71 | - | |
| 72 | - /** | |
| 73 | - * @param array|null | |
| 74 | - * @return bool | |
| 75 | - * @throws Exception | |
| 76 | - */ | |
| 77 | - public static function validateArr(?array $value): bool { | |
| 78 | - if (!is_null($value)) { | |
| 79 | - if (!is_array($value)) { | |
| 80 | - throw new Exception("Attribute Error:TopLevel::arr"); | |
| 81 | - } | |
| 82 | - array_walk($value, function($value_v) { | |
| 83 | - if ($value_v instanceof OtherArr) { | |
| 84 | - OtherArr::to($value_v); | |
| 85 | - } elseif (is_int($value_v)) { | |
| 86 | - if (!is_integer($value_v)) { | |
| 87 | - throw new Exception("Attribute Error:TopLevel::arr"); | |
| 88 | - } | |
| 89 | - } else { | |
| 90 | - throw new Exception("Attribute Error:TopLevel::arr"); | |
| 91 | - } | |
| 92 | - }); | |
| 93 | - } | |
| 94 | - return true; | |
| 95 | - } | |
| 96 | - | |
| 97 | - /** | |
| 98 | - * @throws Exception | |
| 99 | - * @return ?array | |
| 100 | - */ | |
| 101 | - public function getArr(): ?array { | |
| 102 | - if (TopLevel::validateArr($this->arr)) { | |
| 103 | - return $this->arr; | |
| 104 | - } | |
| 105 | - throw new Exception('never get to getArr TopLevel::arr'); | |
| 106 | - } | |
| 107 | - | |
| 108 | - /** | |
| 109 | - * @return ?array | |
| 110 | - */ | |
| 111 | - public static function sampleArr(): ?array { | |
| 112 | - return array( | |
| 113 | - OtherArr::sample() /*enum*/ | |
| 114 | - ); /* 31:arr*/ | |
| 25 | + $this->for = $for; | |
| 115 | 26 | } |
| 116 | 27 | |
| 117 | 28 | /** |
| 118 | 29 | * @param ?string $value |
| 119 | 30 | * @throws Exception |
| 120 | - * @return ?string | |
| 31 | + * @return ?Lvc | |
| 121 | 32 | */ |
| 122 | - public static function fromFor(?string $value): ?string { | |
| 33 | + public static function fromLvc(?string $value): ?Lvc { | |
| 123 | 34 | if (!is_null($value)) { |
| 124 | - return $value; /*string*/ | |
| 35 | + return Lvc::from($value); /*enum*/ | |
| 125 | 36 | } else { |
| 126 | 37 | return null; |
| 127 | 38 | } |
| @@ -131,44 +42,45 @@ class TopLevel { | ||
| 131 | 42 | * @throws Exception |
| 132 | 43 | * @return ?string |
| 133 | 44 | */ |
| 134 | - public function toFor(): ?string { | |
| 135 | - if (TopLevel::validateFor($this->for)) { | |
| 136 | - if (!is_null($this->for)) { | |
| 137 | - return $this->for; /*string*/ | |
| 45 | + public function toLvc(): ?string { | |
| 46 | + if (TopLevel::validateLvc($this->lvc)) { | |
| 47 | + if (!is_null($this->lvc)) { | |
| 48 | + return Lvc::to($this->lvc); /*enum*/ | |
| 138 | 49 | } else { |
| 139 | 50 | return null; |
| 140 | 51 | } |
| 141 | 52 | } |
| 142 | - throw new Exception('never get to this TopLevel::for'); | |
| 53 | + throw new Exception('never get to this TopLevel::lvc'); | |
| 143 | 54 | } |
| 144 | 55 | |
| 145 | 56 | /** |
| 146 | - * @param string|null | |
| 57 | + * @param Lvc|null | |
| 147 | 58 | * @return bool |
| 148 | 59 | * @throws Exception |
| 149 | 60 | */ |
| 150 | - public static function validateFor(?string $value): bool { | |
| 61 | + public static function validateLvc(?Lvc $value): bool { | |
| 151 | 62 | if (!is_null($value)) { |
| 63 | + Lvc::to($value); | |
| 152 | 64 | } |
| 153 | 65 | return true; |
| 154 | 66 | } |
| 155 | 67 | |
| 156 | 68 | /** |
| 157 | 69 | * @throws Exception |
| 158 | - * @return ?string | |
| 70 | + * @return ?Lvc | |
| 159 | 71 | */ |
| 160 | - public function getFor(): ?string { | |
| 161 | - if (TopLevel::validateFor($this->for)) { | |
| 162 | - return $this->for; | |
| 72 | + public function getLvc(): ?Lvc { | |
| 73 | + if (TopLevel::validateLvc($this->lvc)) { | |
| 74 | + return $this->lvc; | |
| 163 | 75 | } |
| 164 | - throw new Exception('never get to getFor TopLevel::for'); | |
| 76 | + throw new Exception('never get to getLvc TopLevel::lvc'); | |
| 165 | 77 | } |
| 166 | 78 | |
| 167 | 79 | /** |
| 168 | - * @return ?string | |
| 80 | + * @return ?Lvc | |
| 169 | 81 | */ |
| 170 | - public static function sampleFor(): ?string { | |
| 171 | - return 'TopLevel::for::32'; /*32:for*/ | |
| 82 | + public static function sampleLvc(): ?Lvc { | |
| 83 | + return Lvc::sample(); /*enum*/ | |
| 172 | 84 | } |
| 173 | 85 | |
| 174 | 86 | /** |
| @@ -220,13 +132,21 @@ class TopLevel { | ||
| 220 | 132 | } |
| 221 | 133 | |
| 222 | 134 | /** |
| 223 | - * @param ?string $value | |
| 135 | + * @param ?array $value | |
| 224 | 136 | * @throws Exception |
| 225 | - * @return ?Lvc | |
| 137 | + * @return ?array | |
| 226 | 138 | */ |
| 227 | - public static function fromLvc(?string $value): ?Lvc { | |
| 139 | + public static function fromArr(?array $value): ?array { | |
| 228 | 140 | if (!is_null($value)) { |
| 229 | - return Lvc::from($value); /*enum*/ | |
| 141 | + return array_map(function ($value) { | |
| 142 | + if (is_string($value) && in_array($value, ['foo', 'bar', 'if'], true)) { | |
| 143 | + return OtherArr::from($value); /*enum*/ | |
| 144 | + } elseif (is_int($value)) { | |
| 145 | + return $value; /*int*/ | |
| 146 | + } else { | |
| 147 | + throw new Exception('Cannot deserialize union value in TopLevel'); | |
| 148 | + } | |
| 149 | + }, $value); | |
| 230 | 150 | } else { |
| 231 | 151 | return null; |
| 232 | 152 | } |
| @@ -234,47 +154,70 @@ class TopLevel { | ||
| 234 | 154 | |
| 235 | 155 | /** |
| 236 | 156 | * @throws Exception |
| 237 | - * @return ?string | |
| 157 | + * @return ?array | |
| 238 | 158 | */ |
| 239 | - public function toLvc(): ?string { | |
| 240 | - if (TopLevel::validateLvc($this->lvc)) { | |
| 241 | - if (!is_null($this->lvc)) { | |
| 242 | - return Lvc::to($this->lvc); /*enum*/ | |
| 159 | + public function toArr(): ?array { | |
| 160 | + if (TopLevel::validateArr($this->arr)) { | |
| 161 | + if (!is_null($this->arr)) { | |
| 162 | + return array_map(function ($value) { | |
| 163 | + if ($value instanceof OtherArr) { | |
| 164 | + return OtherArr::to($value); /*enum*/ | |
| 165 | + } elseif (is_int($value)) { | |
| 166 | + return $value; /*int*/ | |
| 167 | + } else { | |
| 168 | + throw new Exception('Union value has no matching member in TopLevel'); | |
| 169 | + } | |
| 170 | + }, $this->arr); | |
| 243 | 171 | } else { |
| 244 | 172 | return null; |
| 245 | 173 | } |
| 246 | 174 | } |
| 247 | - throw new Exception('never get to this TopLevel::lvc'); | |
| 175 | + throw new Exception('never get to this TopLevel::arr'); | |
| 248 | 176 | } |
| 249 | 177 | |
| 250 | 178 | /** |
| 251 | - * @param Lvc|null | |
| 179 | + * @param array|null | |
| 252 | 180 | * @return bool |
| 253 | 181 | * @throws Exception |
| 254 | 182 | */ |
| 255 | - public static function validateLvc(?Lvc $value): bool { | |
| 183 | + public static function validateArr(?array $value): bool { | |
| 256 | 184 | if (!is_null($value)) { |
| 257 | - Lvc::to($value); | |
| 185 | + if (!is_array($value)) { | |
| 186 | + throw new Exception("Attribute Error:TopLevel::arr"); | |
| 187 | + } | |
| 188 | + array_walk($value, function($value_v) { | |
| 189 | + if ($value_v instanceof OtherArr) { | |
| 190 | + OtherArr::to($value_v); | |
| 191 | + } elseif (is_int($value_v)) { | |
| 192 | + if (!is_integer($value_v)) { | |
| 193 | + throw new Exception("Attribute Error:TopLevel::arr"); | |
| 194 | + } | |
| 195 | + } else { | |
| 196 | + throw new Exception("Attribute Error:TopLevel::arr"); | |
| 197 | + } | |
| 198 | + }); | |
| 258 | 199 | } |
| 259 | 200 | return true; |
| 260 | 201 | } |
| 261 | 202 | |
| 262 | 203 | /** |
| 263 | 204 | * @throws Exception |
| 264 | - * @return ?Lvc | |
| 205 | + * @return ?array | |
| 265 | 206 | */ |
| 266 | - public function getLvc(): ?Lvc { | |
| 267 | - if (TopLevel::validateLvc($this->lvc)) { | |
| 268 | - return $this->lvc; | |
| 207 | + public function getArr(): ?array { | |
| 208 | + if (TopLevel::validateArr($this->arr)) { | |
| 209 | + return $this->arr; | |
| 269 | 210 | } |
| 270 | - throw new Exception('never get to getLvc TopLevel::lvc'); | |
| 211 | + throw new Exception('never get to getArr TopLevel::arr'); | |
| 271 | 212 | } |
| 272 | 213 | |
| 273 | 214 | /** |
| 274 | - * @return ?Lvc | |
| 215 | + * @return ?array | |
| 275 | 216 | */ |
| 276 | - public static function sampleLvc(): ?Lvc { | |
| 277 | - return Lvc::sample(); /*enum*/ | |
| 217 | + public static function sampleArr(): ?array { | |
| 218 | + return array( | |
| 219 | + OtherArr::sample() /*enum*/ | |
| 220 | + ); /* 33:arr*/ | |
| 278 | 221 | } |
| 279 | 222 | |
| 280 | 223 | /** |
| @@ -343,7 +286,64 @@ class TopLevel { | ||
| 343 | 286 | public static function sampleOtherArr(): ?array { |
| 344 | 287 | return array( |
| 345 | 288 | OtherArr::sample() /*enum*/ |
| 346 | - ); /* 35:otherArr*/ | |
| 289 | + ); /* 34:otherArr*/ | |
| 290 | + } | |
| 291 | + | |
| 292 | + /** | |
| 293 | + * @param ?string $value | |
| 294 | + * @throws Exception | |
| 295 | + * @return ?string | |
| 296 | + */ | |
| 297 | + public static function fromFor(?string $value): ?string { | |
| 298 | + if (!is_null($value)) { | |
| 299 | + return $value; /*string*/ | |
| 300 | + } else { | |
| 301 | + return null; | |
| 302 | + } | |
| 303 | + } | |
| 304 | + | |
| 305 | + /** | |
| 306 | + * @throws Exception | |
| 307 | + * @return ?string | |
| 308 | + */ | |
| 309 | + public function toFor(): ?string { | |
| 310 | + if (TopLevel::validateFor($this->for)) { | |
| 311 | + if (!is_null($this->for)) { | |
| 312 | + return $this->for; /*string*/ | |
| 313 | + } else { | |
| 314 | + return null; | |
| 315 | + } | |
| 316 | + } | |
| 317 | + throw new Exception('never get to this TopLevel::for'); | |
| 318 | + } | |
| 319 | + | |
| 320 | + /** | |
| 321 | + * @param string|null | |
| 322 | + * @return bool | |
| 323 | + * @throws Exception | |
| 324 | + */ | |
| 325 | + public static function validateFor(?string $value): bool { | |
| 326 | + if (!is_null($value)) { | |
| 327 | + } | |
| 328 | + return true; | |
| 329 | + } | |
| 330 | + | |
| 331 | + /** | |
| 332 | + * @throws Exception | |
| 333 | + * @return ?string | |
| 334 | + */ | |
| 335 | + public function getFor(): ?string { | |
| 336 | + if (TopLevel::validateFor($this->for)) { | |
| 337 | + return $this->for; | |
| 338 | + } | |
| 339 | + throw new Exception('never get to getFor TopLevel::for'); | |
| 340 | + } | |
| 341 | + | |
| 342 | + /** | |
| 343 | + * @return ?string | |
| 344 | + */ | |
| 345 | + public static function sampleFor(): ?string { | |
| 346 | + return 'TopLevel::for::35'; /*35:for*/ | |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /** |
| @@ -351,11 +351,11 @@ class TopLevel { | ||
| 351 | 351 | * @return bool |
| 352 | 352 | */ |
| 353 | 353 | public function validate(): bool { |
| 354 | - return TopLevel::validateArr($this->arr) | |
| 355 | - || TopLevel::validateFor($this->for) | |
| 354 | + return TopLevel::validateLvc($this->lvc) | |
| 356 | 355 | || TopLevel::validateGve($this->gve) |
| 357 | - || TopLevel::validateLvc($this->lvc) | |
| 358 | - || TopLevel::validateOtherArr($this->otherArr); | |
| 356 | + || TopLevel::validateArr($this->arr) | |
| 357 | + || TopLevel::validateOtherArr($this->otherArr) | |
| 358 | + || TopLevel::validateFor($this->for); | |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | /** |
| @@ -364,11 +364,11 @@ class TopLevel { | ||
| 364 | 364 | */ |
| 365 | 365 | public function to(): stdClass { |
| 366 | 366 | $out = new stdClass(); |
| 367 | - $out->{'arr'} = $this->toArr(); | |
| 368 | - $out->{'for'} = $this->toFor(); | |
| 369 | - $out->{'gve'} = $this->toGve(); | |
| 370 | 367 | $out->{'lvc'} = $this->toLvc(); |
| 368 | + $out->{'gve'} = $this->toGve(); | |
| 369 | + $out->{'arr'} = $this->toArr(); | |
| 371 | 370 | $out->{'otherArr'} = $this->toOtherArr(); |
| 371 | + $out->{'for'} = $this->toFor(); | |
| 372 | 372 | return $out; |
| 373 | 373 | } |
| 374 | 374 | |
| @@ -379,11 +379,11 @@ class TopLevel { | ||
| 379 | 379 | */ |
| 380 | 380 | public static function from(stdClass $obj): TopLevel { |
| 381 | 381 | return new TopLevel( |
| 382 | - TopLevel::fromArr($obj->{'arr'}) | |
| 383 | - ,TopLevel::fromFor($obj->{'for'}) | |
| 382 | + TopLevel::fromLvc($obj->{'lvc'}) | |
| 384 | 383 | ,TopLevel::fromGve($obj->{'gve'}) |
| 385 | - ,TopLevel::fromLvc($obj->{'lvc'}) | |
| 384 | + ,TopLevel::fromArr($obj->{'arr'}) | |
| 386 | 385 | ,TopLevel::fromOtherArr($obj->{'otherArr'}) |
| 386 | + ,TopLevel::fromFor($obj->{'for'}) | |
| 387 | 387 | ); |
| 388 | 388 | } |
| 389 | 389 | |
| @@ -392,11 +392,11 @@ class TopLevel { | ||
| 392 | 392 | */ |
| 393 | 393 | public static function sample(): TopLevel { |
| 394 | 394 | return new TopLevel( |
| 395 | - TopLevel::sampleArr() | |
| 396 | - ,TopLevel::sampleFor() | |
| 395 | + TopLevel::sampleLvc() | |
| 397 | 396 | ,TopLevel::sampleGve() |
| 398 | - ,TopLevel::sampleLvc() | |
| 397 | + ,TopLevel::sampleArr() | |
| 399 | 398 | ,TopLevel::sampleOtherArr() |
| 399 | + ,TopLevel::sampleFor() | |
| 400 | 400 | ); |
| 401 | 401 | } |
| 402 | 402 | } |
Mschema-pikedefault / TopLevel.pmod+9 −9
| @@ -13,19 +13,19 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - array(Arr)|mixed arr; // json: "arr" | |
| 17 | - mixed|string top_level_for; // json: "for" | |
| 18 | - Gve gve; // json: "gve" | |
| 19 | 16 | Lvc|mixed lvc; // json: "lvc" |
| 17 | + Gve gve; // json: "gve" | |
| 18 | + array(Arr)|mixed arr; // json: "arr" | |
| 20 | 19 | array(OtherArr)|mixed other_arr; // json: "otherArr" |
| 20 | + mixed|string top_level_for; // json: "for" | |
| 21 | 21 | |
| 22 | 22 | string encode_json() { |
| 23 | 23 | mapping(string:mixed) json = ([ |
| 24 | - "arr" : arr, | |
| 25 | - "for" : top_level_for, | |
| 26 | - "gve" : gve, | |
| 27 | 24 | "lvc" : lvc, |
| 25 | + "gve" : gve, | |
| 26 | + "arr" : arr, | |
| 28 | 27 | "otherArr" : other_arr, |
| 28 | + "for" : top_level_for, | |
| 29 | 29 | ]); |
| 30 | 30 | |
| 31 | 31 | return Standards.JSON.encode(json); |
| @@ -35,11 +35,11 @@ class TopLevel { | ||
| 35 | 35 | TopLevel TopLevel_from_JSON(mixed json) { |
| 36 | 36 | TopLevel retval = TopLevel(); |
| 37 | 37 | |
| 38 | - retval.arr = json["arr"]; | |
| 39 | - retval.top_level_for = json["for"]; | |
| 40 | - retval.gve = json["gve"]; | |
| 41 | 38 | retval.lvc = json["lvc"]; |
| 39 | + retval.gve = json["gve"]; | |
| 40 | + retval.arr = json["arr"]; | |
| 42 | 41 | retval.other_arr = json["otherArr"]; |
| 42 | + retval.top_level_for = json["for"]; | |
| 43 | 43 | |
| 44 | 44 | return retval; |
| 45 | 45 | } |
Mschema-pythondefault / quicktype.py+18 −18
| @@ -7,13 +7,8 @@ T = TypeVar("T") | ||
| 7 | 7 | EnumT = TypeVar("EnumT", bound=Enum) |
| 8 | 8 | |
| 9 | 9 | |
| 10 | -def from_list(f: Callable[[Any], T], x: Any) -> list[T]: | |
| 11 | - assert isinstance(x, list) | |
| 12 | - return [f(y) for y in x] | |
| 13 | - | |
| 14 | - | |
| 15 | -def from_int(x: Any) -> int: | |
| 16 | - assert isinstance(x, int) and not isinstance(x, bool) | |
| 10 | +def from_none(x: Any) -> Any: | |
| 11 | + assert x is None | |
| 17 | 12 | return x |
| 18 | 13 | |
| 19 | 14 | |
| @@ -26,8 +21,13 @@ def from_union(fs, x): | ||
| 26 | 21 | assert False |
| 27 | 22 | |
| 28 | 23 | |
| 29 | -def from_none(x: Any) -> Any: | |
| 30 | - assert x is None | |
| 24 | +def from_list(f: Callable[[Any], T], x: Any) -> list[T]: | |
| 25 | + assert isinstance(x, list) | |
| 26 | + return [f(y) for y in x] | |
| 27 | + | |
| 28 | + | |
| 29 | +def from_int(x: Any) -> int: | |
| 30 | + assert isinstance(x, int) and not isinstance(x, bool) | |
| 31 | 31 | return x |
| 32 | 32 | |
| 33 | 33 | |
| @@ -67,32 +67,32 @@ class Lvc(Enum): | ||
| 67 | 67 | @dataclass |
| 68 | 68 | class TopLevel: |
| 69 | 69 | gve: Gve |
| 70 | - arr: list[int | OtherArr] | None = None | |
| 71 | - top_level_for: str | None = None | |
| 72 | 70 | lvc: Lvc | None = None |
| 71 | + arr: list[int | OtherArr] | None = None | |
| 73 | 72 | other_arr: list[OtherArr] | None = None |
| 73 | + top_level_for: str | None = None | |
| 74 | 74 | |
| 75 | 75 | @staticmethod |
| 76 | 76 | def from_dict(obj: Any) -> 'TopLevel': |
| 77 | 77 | assert isinstance(obj, dict) |
| 78 | 78 | gve = Gve(obj.get("gve")) |
| 79 | - arr = from_union([lambda x: from_list(lambda x: from_union([from_int, OtherArr], x), x), from_none], obj.get("arr")) | |
| 80 | - top_level_for = from_union([from_str, from_none], obj.get("for")) | |
| 81 | 79 | lvc = from_union([Lvc, from_none], obj.get("lvc")) |
| 80 | + arr = from_union([lambda x: from_list(lambda x: from_union([from_int, OtherArr], x), x), from_none], obj.get("arr")) | |
| 82 | 81 | other_arr = from_union([lambda x: from_list(OtherArr, x), from_none], obj.get("otherArr")) |
| 83 | - return TopLevel(gve, arr, top_level_for, lvc, other_arr) | |
| 82 | + top_level_for = from_union([from_str, from_none], obj.get("for")) | |
| 83 | + return TopLevel(gve, lvc, arr, other_arr, top_level_for) | |
| 84 | 84 | |
| 85 | 85 | def to_dict(self) -> dict: |
| 86 | 86 | result: dict = {} |
| 87 | 87 | result["gve"] = to_enum(Gve, self.gve) |
| 88 | - if self.arr is not None: | |
| 89 | - result["arr"] = from_union([lambda x: from_list(lambda x: from_union([from_int, lambda x: to_enum(OtherArr, x)], x), x), from_none], self.arr) | |
| 90 | - if self.top_level_for is not None: | |
| 91 | - result["for"] = from_union([from_str, from_none], self.top_level_for) | |
| 92 | 88 | if self.lvc is not None: |
| 93 | 89 | result["lvc"] = from_union([lambda x: to_enum(Lvc, x), from_none], self.lvc) |
| 90 | + if self.arr is not None: | |
| 91 | + result["arr"] = from_union([lambda x: from_list(lambda x: from_union([from_int, lambda x: to_enum(OtherArr, x)], x), x), from_none], self.arr) | |
| 94 | 92 | if self.other_arr is not None: |
| 95 | 93 | result["otherArr"] = from_union([lambda x: from_list(lambda x: to_enum(OtherArr, x), x), from_none], self.other_arr) |
| 94 | + if self.top_level_for is not None: | |
| 95 | + result["for"] = from_union([from_str, from_none], self.top_level_for) | |
| 96 | 96 | return result |
Mschema-rubydefault / TopLevel.rb+9 −9
| @@ -73,20 +73,20 @@ module Lvc | ||
| 73 | 73 | end |
| 74 | 74 | |
| 75 | 75 | class TopLevel < Dry::Struct |
| 76 | - attribute :arr, Types.Array(Types.Instance(Arr)).optional | |
| 77 | - attribute :top_level_for, Types::String.optional | |
| 78 | - attribute :gve, Types::Gve | |
| 79 | 76 | attribute :lvc, Types::Lvc.optional |
| 77 | + attribute :gve, Types::Gve | |
| 78 | + attribute :arr, Types.Array(Types.Instance(Arr)).optional | |
| 80 | 79 | attribute :other_arr, Types.Array(Types::OtherArr).optional |
| 80 | + attribute :top_level_for, Types::String.optional | |
| 81 | 81 | |
| 82 | 82 | def self.from_dynamic!(d) |
| 83 | 83 | d = Types::Hash[d] |
| 84 | 84 | new( |
| 85 | - arr: d["arr"]&.map { |x| Arr.from_dynamic!(x) }, | |
| 86 | - top_level_for: d["for"], | |
| 87 | - gve: d.fetch("gve"), | |
| 88 | 85 | lvc: d["lvc"], |
| 86 | + gve: d.fetch("gve"), | |
| 87 | + arr: d["arr"]&.map { |x| Arr.from_dynamic!(x) }, | |
| 89 | 88 | other_arr: d["otherArr"], |
| 89 | + top_level_for: d["for"], | |
| 90 | 90 | ) |
| 91 | 91 | end |
| 92 | 92 | |
| @@ -96,11 +96,11 @@ class TopLevel < Dry::Struct | ||
| 96 | 96 | |
| 97 | 97 | def to_dynamic |
| 98 | 98 | { |
| 99 | - "arr" => arr&.map { |x| x.to_dynamic }, | |
| 100 | - "for" => top_level_for, | |
| 101 | - "gve" => gve, | |
| 102 | 99 | "lvc" => lvc, |
| 100 | + "gve" => gve, | |
| 101 | + "arr" => arr&.map { |x| x.to_dynamic }, | |
| 103 | 102 | "otherArr" => other_arr, |
| 103 | + "for" => top_level_for, | |
| 104 | 104 | } |
| 105 | 105 | end |
Mschema-rustdefault / module_under_test.rs+5 −5
| @@ -16,16 +16,16 @@ use serde::{Serialize, Deserialize}; | ||
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | #[serde(rename_all = "camelCase")] |
| 18 | 18 | pub struct TopLevel { |
| 19 | - pub arr: Option<Vec<Arr>>, | |
| 20 | - | |
| 21 | - #[serde(rename = "for")] | |
| 22 | - pub top_level_for: Option<String>, | |
| 19 | + pub lvc: Option<Lvc>, | |
| 23 | 20 | |
| 24 | 21 | pub gve: Gve, |
| 25 | 22 | |
| 26 | - pub lvc: Option<Lvc>, | |
| 23 | + pub arr: Option<Vec<Arr>>, | |
| 27 | 24 | |
| 28 | 25 | pub other_arr: Option<Vec<OtherArr>>, |
| 26 | + | |
| 27 | + #[serde(rename = "for")] | |
| 28 | + pub top_level_for: Option<String>, | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | #[derive(Debug, Clone, Serialize, Deserialize)] |
Mschema-scala3-upickledefault / TopLevel.scala+4 −4
| @@ -66,11 +66,11 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val arr : Option[Seq[Arr]] = None, | |
| 70 | - val `for` : Option[String] = None, | |
| 71 | - val gve : Gve, | |
| 72 | 69 | val lvc : Option[Lvc] = None, |
| 73 | - val otherArr : Option[Seq[OtherArr]] = None | |
| 70 | + val gve : Gve, | |
| 71 | + val arr : Option[Seq[Arr]] = None, | |
| 72 | + val otherArr : Option[Seq[OtherArr]] = None, | |
| 73 | + val `for` : Option[String] = None | |
| 74 | 74 | ) derives OptionPickler.ReadWriter |
| 75 | 75 | |
| 76 | 76 | type Arr = OtherArr | Long |
Mschema-scala3default / TopLevel.scala+4 −4
| @@ -8,11 +8,11 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val arr : Option[Seq[Arr]] = None, | |
| 12 | - val `for` : Option[String] = None, | |
| 13 | - val gve : Gve, | |
| 14 | 11 | val lvc : Option[Lvc] = None, |
| 15 | - val otherArr : Option[Seq[OtherArr]] = None | |
| 12 | + val gve : Gve, | |
| 13 | + val arr : Option[Seq[Arr]] = None, | |
| 14 | + val otherArr : Option[Seq[OtherArr]] = None, | |
| 15 | + val `for` : Option[String] = None | |
| 16 | 16 | ) derives Encoder.AsObject, Decoder |
| 17 | 17 | |
| 18 | 18 | type Arr = OtherArr | Long |
Mschema-schemadefault / TopLevel.schema+9 −9
| @@ -6,26 +6,26 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": {}, |
| 8 | 8 | "properties": { |
| 9 | + "lvc": { | |
| 10 | + "$ref": "#/definitions/Lvc" | |
| 11 | + }, | |
| 12 | + "gve": { | |
| 13 | + "$ref": "#/definitions/Gve" | |
| 14 | + }, | |
| 9 | 15 | "arr": { |
| 10 | 16 | "type": "array", |
| 11 | 17 | "items": { |
| 12 | 18 | "$ref": "#/definitions/Arr" |
| 13 | 19 | } |
| 14 | 20 | }, |
| 15 | - "for": { | |
| 16 | - "type": "string" | |
| 17 | - }, | |
| 18 | - "gve": { | |
| 19 | - "$ref": "#/definitions/Gve" | |
| 20 | - }, | |
| 21 | - "lvc": { | |
| 22 | - "$ref": "#/definitions/Lvc" | |
| 23 | - }, | |
| 24 | 21 | "otherArr": { |
| 25 | 22 | "type": "array", |
| 26 | 23 | "items": { |
| 27 | 24 | "$ref": "#/definitions/OtherArr" |
| 28 | 25 | } |
| 26 | + }, | |
| 27 | + "for": { | |
| 28 | + "type": "string" | |
| 29 | 29 | } |
| 30 | 30 | }, |
| 31 | 31 | "required": [ |
Mschema-typescriptdefault / TopLevel.ts+6 −6
| @@ -8,11 +8,11 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - arr?: Arr[]; | |
| 12 | - for?: string; | |
| 13 | - gve: Gve; | |
| 14 | 11 | lvc?: Lvc; |
| 12 | + gve: Gve; | |
| 13 | + arr?: Arr[]; | |
| 15 | 14 | otherArr?: OtherArr[]; |
| 15 | + for?: string; | |
| 16 | 16 | [property: string]: unknown; |
| 17 | 17 | } |
| 18 | 18 | |
| @@ -191,11 +191,11 @@ function r(name: string) { | ||
| 191 | 191 | |
| 192 | 192 | const typeMap: any = { |
| 193 | 193 | "TopLevel": o([ |
| 194 | - { json: "arr", js: "arr", typ: u(undefined, a(u(r("OtherArr"), 0))) }, | |
| 195 | - { json: "for", js: "for", typ: u(undefined, "") }, | |
| 196 | - { json: "gve", js: "gve", typ: r("Gve") }, | |
| 197 | 194 | { json: "lvc", js: "lvc", typ: u(undefined, r("Lvc")) }, |
| 195 | + { json: "gve", js: "gve", typ: r("Gve") }, | |
| 196 | + { json: "arr", js: "arr", typ: u(undefined, a(u(r("OtherArr"), 0))) }, | |
| 198 | 197 | { json: "otherArr", js: "otherArr", typ: u(undefined, a(r("OtherArr"))) }, |
| 198 | + { json: "for", js: "for", typ: u(undefined, "") }, | |
| 199 | 199 | ], "any"), |
| 200 | 200 | "OtherArr": [ |
| 201 | 201 | "foo", |
Test case
26 generated files · +472 −472test/inputs/schema/integer-string.schema
Mschema-cjsondefault / TopLevel.c+67 −67
| @@ -62,6 +62,31 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 62 | 62 | if (NULL != j) { |
| 63 | 63 | if (NULL != (x = cJSON_malloc(sizeof(struct TopLevel)))) { |
| 64 | 64 | memset(x, 0, sizeof(struct TopLevel)); |
| 65 | + if (cJSON_HasObjectItem(j, "one")) { | |
| 66 | + x->one = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "one"))); | |
| 67 | + } | |
| 68 | + else { | |
| 69 | + if (NULL != (x->one = cJSON_malloc(sizeof(char)))) { | |
| 70 | + x->one[0] = '\0'; | |
| 71 | + } | |
| 72 | + } | |
| 73 | + if (cJSON_HasObjectItem(j, "optional")) { | |
| 74 | + x->optional = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "optional"))); | |
| 75 | + } | |
| 76 | + if ((cJSON_HasObjectItem(j, "nullable")) && (!cJSON_IsNull(cJSON_GetObjectItemCaseSensitive(j, "nullable")))) { | |
| 77 | + x->nullable = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "nullable"))); | |
| 78 | + } | |
| 79 | + if (cJSON_HasObjectItem(j, "arrOne")) { | |
| 80 | + list_t * x1 = list_create(false, NULL); | |
| 81 | + if (NULL != x1) { | |
| 82 | + cJSON * e1 = NULL; | |
| 83 | + cJSON * j1 = cJSON_GetObjectItemCaseSensitive(j, "arrOne"); | |
| 84 | + cJSON_ArrayForEach(e1, j1) { | |
| 85 | + list_add_tail(x1, strdup(cJSON_GetStringValue(e1)), sizeof(char *)); | |
| 86 | + } | |
| 87 | + x->arr_one = x1; | |
| 88 | + } | |
| 89 | + } | |
| 65 | 90 | if (cJSON_HasObjectItem(j, "arrNullable")) { |
| 66 | 91 | list_t * x1 = list_create(false, NULL); |
| 67 | 92 | if (NULL != x1) { |
| @@ -78,31 +103,6 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 78 | 103 | x->arr_nullable = x1; |
| 79 | 104 | } |
| 80 | 105 | } |
| 81 | - if (cJSON_HasObjectItem(j, "arrOne")) { | |
| 82 | - list_t * x1 = list_create(false, NULL); | |
| 83 | - if (NULL != x1) { | |
| 84 | - cJSON * e1 = NULL; | |
| 85 | - cJSON * j1 = cJSON_GetObjectItemCaseSensitive(j, "arrOne"); | |
| 86 | - cJSON_ArrayForEach(e1, j1) { | |
| 87 | - list_add_tail(x1, strdup(cJSON_GetStringValue(e1)), sizeof(char *)); | |
| 88 | - } | |
| 89 | - x->arr_one = x1; | |
| 90 | - } | |
| 91 | - } | |
| 92 | - if ((cJSON_HasObjectItem(j, "nullable")) && (!cJSON_IsNull(cJSON_GetObjectItemCaseSensitive(j, "nullable")))) { | |
| 93 | - x->nullable = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "nullable"))); | |
| 94 | - } | |
| 95 | - if (cJSON_HasObjectItem(j, "one")) { | |
| 96 | - x->one = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "one"))); | |
| 97 | - } | |
| 98 | - else { | |
| 99 | - if (NULL != (x->one = cJSON_malloc(sizeof(char)))) { | |
| 100 | - x->one[0] = '\0'; | |
| 101 | - } | |
| 102 | - } | |
| 103 | - if (cJSON_HasObjectItem(j, "optional")) { | |
| 104 | - x->optional = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "optional"))); | |
| 105 | - } | |
| 106 | 106 | if (cJSON_HasObjectItem(j, "unionWithInt")) { |
| 107 | 107 | x->union_with_int = cJSON_GetUnionWithIntValue(cJSON_GetObjectItemCaseSensitive(j, "unionWithInt")); |
| 108 | 108 | } |
| @@ -118,6 +118,31 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 118 | 118 | cJSON * j = NULL; |
| 119 | 119 | if (NULL != x) { |
| 120 | 120 | if (NULL != (j = cJSON_CreateObject())) { |
| 121 | + if (NULL != x->one) { | |
| 122 | + cJSON_AddStringToObject(j, "one", x->one); | |
| 123 | + } | |
| 124 | + else { | |
| 125 | + cJSON_AddStringToObject(j, "one", ""); | |
| 126 | + } | |
| 127 | + if (NULL != x->optional) { | |
| 128 | + cJSON_AddStringToObject(j, "optional", x->optional); | |
| 129 | + } | |
| 130 | + if (NULL != x->nullable) { | |
| 131 | + cJSON_AddStringToObject(j, "nullable", x->nullable); | |
| 132 | + } | |
| 133 | + else { | |
| 134 | + cJSON_AddNullToObject(j, "nullable"); | |
| 135 | + } | |
| 136 | + if (NULL != x->arr_one) { | |
| 137 | + cJSON * j1 = cJSON_AddArrayToObject(j, "arrOne"); | |
| 138 | + if (NULL != j1) { | |
| 139 | + char * x1 = list_get_head(x->arr_one); | |
| 140 | + while (NULL != x1) { | |
| 141 | + cJSON_AddItemToArray(j1, cJSON_CreateString(x1)); | |
| 142 | + x1 = list_get_next(x->arr_one); | |
| 143 | + } | |
| 144 | + } | |
| 145 | + } | |
| 121 | 146 | if (NULL != x->arr_nullable) { |
| 122 | 147 | cJSON * j1 = cJSON_AddArrayToObject(j, "arrNullable"); |
| 123 | 148 | if (NULL != j1) { |
| @@ -133,31 +158,6 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 133 | 158 | } |
| 134 | 159 | } |
| 135 | 160 | } |
| 136 | - if (NULL != x->arr_one) { | |
| 137 | - cJSON * j1 = cJSON_AddArrayToObject(j, "arrOne"); | |
| 138 | - if (NULL != j1) { | |
| 139 | - char * x1 = list_get_head(x->arr_one); | |
| 140 | - while (NULL != x1) { | |
| 141 | - cJSON_AddItemToArray(j1, cJSON_CreateString(x1)); | |
| 142 | - x1 = list_get_next(x->arr_one); | |
| 143 | - } | |
| 144 | - } | |
| 145 | - } | |
| 146 | - if (NULL != x->nullable) { | |
| 147 | - cJSON_AddStringToObject(j, "nullable", x->nullable); | |
| 148 | - } | |
| 149 | - else { | |
| 150 | - cJSON_AddNullToObject(j, "nullable"); | |
| 151 | - } | |
| 152 | - if (NULL != x->one) { | |
| 153 | - cJSON_AddStringToObject(j, "one", x->one); | |
| 154 | - } | |
| 155 | - else { | |
| 156 | - cJSON_AddStringToObject(j, "one", ""); | |
| 157 | - } | |
| 158 | - if (NULL != x->optional) { | |
| 159 | - cJSON_AddStringToObject(j, "optional", x->optional); | |
| 160 | - } | |
| 161 | 161 | cJSON_AddItemToObject(j, "unionWithInt", cJSON_CreateUnionWithInt(x->union_with_int)); |
| 162 | 162 | cJSON_AddItemToObject(j, "unionWithIntAndEnum", cJSON_CreateUnionWithInt(x->union_with_int_and_enum)); |
| 163 | 163 | } |
| @@ -179,15 +179,14 @@ char * cJSON_PrintTopLevel(const struct TopLevel * x) { | ||
| 179 | 179 | |
| 180 | 180 | void cJSON_DeleteTopLevel(struct TopLevel * x) { |
| 181 | 181 | if (NULL != x) { |
| 182 | - if (NULL != x->arr_nullable) { | |
| 183 | - char * x1 = list_get_head(x->arr_nullable); | |
| 184 | - while (NULL != x1) { | |
| 185 | - if ((void *)0xDEADBEEF != x1) { | |
| 186 | - cJSON_free(x1); | |
| 187 | - } | |
| 188 | - x1 = list_get_next(x->arr_nullable); | |
| 189 | - } | |
| 190 | - list_release(x->arr_nullable); | |
| 182 | + if (NULL != x->one) { | |
| 183 | + cJSON_free(x->one); | |
| 184 | + } | |
| 185 | + if (NULL != x->optional) { | |
| 186 | + cJSON_free(x->optional); | |
| 187 | + } | |
| 188 | + if (NULL != x->nullable) { | |
| 189 | + cJSON_free(x->nullable); | |
| 191 | 190 | } |
| 192 | 191 | if (NULL != x->arr_one) { |
| 193 | 192 | char * x1 = list_get_head(x->arr_one); |
| @@ -197,14 +196,15 @@ void cJSON_DeleteTopLevel(struct TopLevel * x) { | ||
| 197 | 196 | } |
| 198 | 197 | list_release(x->arr_one); |
| 199 | 198 | } |
| 200 | - if (NULL != x->nullable) { | |
| 201 | - cJSON_free(x->nullable); | |
| 202 | - } | |
| 203 | - if (NULL != x->one) { | |
| 204 | - cJSON_free(x->one); | |
| 205 | - } | |
| 206 | - if (NULL != x->optional) { | |
| 207 | - cJSON_free(x->optional); | |
| 199 | + if (NULL != x->arr_nullable) { | |
| 200 | + char * x1 = list_get_head(x->arr_nullable); | |
| 201 | + while (NULL != x1) { | |
| 202 | + if ((void *)0xDEADBEEF != x1) { | |
| 203 | + cJSON_free(x1); | |
| 204 | + } | |
| 205 | + x1 = list_get_next(x->arr_nullable); | |
| 206 | + } | |
| 207 | + list_release(x->arr_nullable); | |
| 208 | 208 | } |
| 209 | 209 | if (NULL != x->union_with_int) { |
| 210 | 210 | cJSON_DeleteUnionWithInt(x->union_with_int); |
Mschema-cjsondefault / TopLevel.h+3 −3
| @@ -43,11 +43,11 @@ struct UnionWithInt { | ||
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | 45 | struct TopLevel { |
| 46 | - list_t * arr_nullable; | |
| 47 | - list_t * arr_one; | |
| 48 | - char * nullable; | |
| 49 | 46 | char * one; |
| 50 | 47 | char * optional; |
| 48 | + char * nullable; | |
| 49 | + list_t * arr_one; | |
| 50 | + list_t * arr_nullable; | |
| 51 | 51 | struct UnionWithInt * union_with_int; |
| 52 | 52 | struct UnionWithInt * union_with_int_and_enum; |
| 53 | 53 | }; |
Mschema-cplusplusdefault / quicktype.hpp+20 −20
| @@ -97,26 +97,15 @@ namespace quicktype { | ||
| 97 | 97 | virtual ~TopLevel() = default; |
| 98 | 98 | |
| 99 | 99 | private: |
| 100 | - std::optional<std::vector<std::optional<std::string>>> arr_nullable; | |
| 101 | - std::optional<std::vector<std::string>> arr_one; | |
| 102 | - std::optional<std::string> nullable; | |
| 103 | 100 | std::string one; |
| 104 | 101 | std::optional<std::string> optional; |
| 102 | + std::optional<std::string> nullable; | |
| 103 | + std::optional<std::vector<std::string>> arr_one; | |
| 104 | + std::optional<std::vector<std::optional<std::string>>> arr_nullable; | |
| 105 | 105 | UnionWithInt union_with_int; |
| 106 | 106 | UnionWithInt union_with_int_and_enum; |
| 107 | 107 | |
| 108 | 108 | public: |
| 109 | - const std::optional<std::vector<std::optional<std::string>>> & get_arr_nullable() const { return arr_nullable; } | |
| 110 | - std::optional<std::vector<std::optional<std::string>>> & get_mutable_arr_nullable() { return arr_nullable; } | |
| 111 | - void set_arr_nullable(const std::optional<std::vector<std::optional<std::string>>> & value) { this->arr_nullable = value; } | |
| 112 | - | |
| 113 | - const std::optional<std::vector<std::string>> & get_arr_one() const { return arr_one; } | |
| 114 | - std::optional<std::vector<std::string>> & get_mutable_arr_one() { return arr_one; } | |
| 115 | - void set_arr_one(const std::optional<std::vector<std::string>> & value) { this->arr_one = value; } | |
| 116 | - | |
| 117 | - std::optional<std::string> get_nullable() const { return nullable; } | |
| 118 | - void set_nullable(std::optional<std::string> value) { this->nullable = value; } | |
| 119 | - | |
| 120 | 109 | const std::string & get_one() const { return one; } |
| 121 | 110 | std::string & get_mutable_one() { return one; } |
| 122 | 111 | void set_one(const std::string & value) { this->one = value; } |
| @@ -125,6 +114,17 @@ namespace quicktype { | ||
| 125 | 114 | std::optional<std::string> & get_mutable_optional() { return optional; } |
| 126 | 115 | void set_optional(const std::optional<std::string> & value) { this->optional = value; } |
| 127 | 116 | |
| 117 | + std::optional<std::string> get_nullable() const { return nullable; } | |
| 118 | + void set_nullable(std::optional<std::string> value) { this->nullable = value; } | |
| 119 | + | |
| 120 | + const std::optional<std::vector<std::string>> & get_arr_one() const { return arr_one; } | |
| 121 | + std::optional<std::vector<std::string>> & get_mutable_arr_one() { return arr_one; } | |
| 122 | + void set_arr_one(const std::optional<std::vector<std::string>> & value) { this->arr_one = value; } | |
| 123 | + | |
| 124 | + const std::optional<std::vector<std::optional<std::string>>> & get_arr_nullable() const { return arr_nullable; } | |
| 125 | + std::optional<std::vector<std::optional<std::string>>> & get_mutable_arr_nullable() { return arr_nullable; } | |
| 126 | + void set_arr_nullable(const std::optional<std::vector<std::optional<std::string>>> & value) { this->arr_nullable = value; } | |
| 127 | + | |
| 128 | 128 | const UnionWithInt & get_union_with_int() const { return union_with_int; } |
| 129 | 129 | UnionWithInt & get_mutable_union_with_int() { return union_with_int; } |
| 130 | 130 | void set_union_with_int(const UnionWithInt & value) { this->union_with_int = value; } |
| @@ -148,22 +148,22 @@ struct adl_serializer<std::variant<int64_t, std::string>> { | ||
| 148 | 148 | } |
| 149 | 149 | namespace quicktype { |
| 150 | 150 | inline void from_json(const json & j, TopLevel& x) { |
| 151 | - x.set_arr_nullable(get_stack_optional<std::vector<std::optional<std::string>>>(j, "arrNullable")); | |
| 152 | - x.set_arr_one(get_stack_optional<std::vector<std::string>>(j, "arrOne")); | |
| 153 | - x.set_nullable(get_stack_optional<std::string>(j, "nullable")); | |
| 154 | 151 | x.set_one(j.at("one").get<std::string>()); |
| 155 | 152 | x.set_optional(get_stack_optional<std::string>(j, "optional")); |
| 153 | + x.set_nullable(get_stack_optional<std::string>(j, "nullable")); | |
| 154 | + x.set_arr_one(get_stack_optional<std::vector<std::string>>(j, "arrOne")); | |
| 155 | + x.set_arr_nullable(get_stack_optional<std::vector<std::optional<std::string>>>(j, "arrNullable")); | |
| 156 | 156 | x.set_union_with_int(j.at("unionWithInt").get<UnionWithInt>()); |
| 157 | 157 | x.set_union_with_int_and_enum(j.at("unionWithIntAndEnum").get<UnionWithInt>()); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | inline void to_json(json & j, const TopLevel & x) { |
| 161 | 161 | j = json::object(); |
| 162 | - j["arrNullable"] = x.get_arr_nullable(); | |
| 163 | - j["arrOne"] = x.get_arr_one(); | |
| 164 | - j["nullable"] = x.get_nullable(); | |
| 165 | 162 | j["one"] = x.get_one(); |
| 166 | 163 | j["optional"] = x.get_optional(); |
| 164 | + j["nullable"] = x.get_nullable(); | |
| 165 | + j["arrOne"] = x.get_arr_one(); | |
| 166 | + j["arrNullable"] = x.get_arr_nullable(); | |
| 167 | 167 | j["unionWithInt"] = x.get_union_with_int(); |
| 168 | 168 | j["unionWithIntAndEnum"] = x.get_union_with_int_and_enum(); |
| 169 | 169 | } |
Mschema-csharp-recordsdefault / QuickType.cs+12 −12
| @@ -25,18 +25,6 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("arrNullable", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 29 | - [JsonConverter(typeof(PurpleDecodeArrayConverter))] | |
| 30 | - public long?[]? ArrNullable { get; set; } | |
| 31 | - | |
| 32 | - [JsonProperty("arrOne", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 33 | - [JsonConverter(typeof(FluffyDecodeArrayConverter))] | |
| 34 | - public long[]? ArrOne { get; set; } | |
| 35 | - | |
| 36 | - [JsonProperty("nullable", Required = Required.AllowNull)] | |
| 37 | - [JsonConverter(typeof(ParseStringConverter))] | |
| 38 | - public long? Nullable { get; set; } | |
| 39 | - | |
| 40 | 28 | [JsonProperty("one", Required = Required.Always)] |
| 41 | 29 | [JsonConverter(typeof(ParseStringConverter))] |
| 42 | 30 | public long One { get; set; } |
| @@ -45,6 +33,18 @@ namespace QuickType | ||
| 45 | 33 | [JsonConverter(typeof(ParseStringConverter))] |
| 46 | 34 | public long? Optional { get; set; } |
| 47 | 35 | |
| 36 | + [JsonProperty("nullable", Required = Required.AllowNull)] | |
| 37 | + [JsonConverter(typeof(ParseStringConverter))] | |
| 38 | + public long? Nullable { get; set; } | |
| 39 | + | |
| 40 | + [JsonProperty("arrOne", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 41 | + [JsonConverter(typeof(FluffyDecodeArrayConverter))] | |
| 42 | + public long[]? ArrOne { get; set; } | |
| 43 | + | |
| 44 | + [JsonProperty("arrNullable", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 45 | + [JsonConverter(typeof(PurpleDecodeArrayConverter))] | |
| 46 | + public long?[]? ArrNullable { get; set; } | |
| 47 | + | |
| 48 | 48 | [JsonProperty("unionWithInt", Required = Required.Always)] |
| 49 | 49 | [JsonConverter(typeof(DecodingChoiceConverter))] |
| 50 | 50 | public long UnionWithInt { get; set; } |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+14 −14
| @@ -22,30 +22,30 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 26 | - [JsonPropertyName("arrNullable")] | |
| 27 | - [JsonConverter(typeof(PurpleDecodeArrayConverter))] | |
| 28 | - public long?[]? ArrNullable { get; set; } | |
| 25 | + [JsonRequired] | |
| 26 | + [JsonPropertyName("one")] | |
| 27 | + [JsonConverter(typeof(ParseStringConverter))] | |
| 28 | + public long One { get; set; } | |
| 29 | 29 | |
| 30 | 30 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 31 | - [JsonPropertyName("arrOne")] | |
| 32 | - [JsonConverter(typeof(FluffyDecodeArrayConverter))] | |
| 33 | - public long[]? ArrOne { get; set; } | |
| 31 | + [JsonPropertyName("optional")] | |
| 32 | + [JsonConverter(typeof(ParseStringConverter))] | |
| 33 | + public long? Optional { get; set; } | |
| 34 | 34 | |
| 35 | 35 | [JsonRequired] |
| 36 | 36 | [JsonPropertyName("nullable")] |
| 37 | 37 | [JsonConverter(typeof(ParseStringConverter))] |
| 38 | 38 | public long? Nullable { get; set; } |
| 39 | 39 | |
| 40 | - [JsonRequired] | |
| 41 | - [JsonPropertyName("one")] | |
| 42 | - [JsonConverter(typeof(ParseStringConverter))] | |
| 43 | - public long One { get; set; } | |
| 40 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 41 | + [JsonPropertyName("arrOne")] | |
| 42 | + [JsonConverter(typeof(FluffyDecodeArrayConverter))] | |
| 43 | + public long[]? ArrOne { get; set; } | |
| 44 | 44 | |
| 45 | 45 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 46 | - [JsonPropertyName("optional")] | |
| 47 | - [JsonConverter(typeof(ParseStringConverter))] | |
| 48 | - public long? Optional { get; set; } | |
| 46 | + [JsonPropertyName("arrNullable")] | |
| 47 | + [JsonConverter(typeof(PurpleDecodeArrayConverter))] | |
| 48 | + public long?[]? ArrNullable { get; set; } | |
| 49 | 49 | |
| 50 | 50 | [JsonRequired] |
| 51 | 51 | [JsonPropertyName("unionWithInt")] |
Mschema-csharpdefault / QuickType.cs+12 −12
| @@ -25,18 +25,6 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("arrNullable", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 29 | - [JsonConverter(typeof(PurpleDecodeArrayConverter))] | |
| 30 | - public long?[]? ArrNullable { get; set; } | |
| 31 | - | |
| 32 | - [JsonProperty("arrOne", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 33 | - [JsonConverter(typeof(FluffyDecodeArrayConverter))] | |
| 34 | - public long[]? ArrOne { get; set; } | |
| 35 | - | |
| 36 | - [JsonProperty("nullable", Required = Required.AllowNull)] | |
| 37 | - [JsonConverter(typeof(ParseStringConverter))] | |
| 38 | - public long? Nullable { get; set; } | |
| 39 | - | |
| 40 | 28 | [JsonProperty("one", Required = Required.Always)] |
| 41 | 29 | [JsonConverter(typeof(ParseStringConverter))] |
| 42 | 30 | public long One { get; set; } |
| @@ -45,6 +33,18 @@ namespace QuickType | ||
| 45 | 33 | [JsonConverter(typeof(ParseStringConverter))] |
| 46 | 34 | public long? Optional { get; set; } |
| 47 | 35 | |
| 36 | + [JsonProperty("nullable", Required = Required.AllowNull)] | |
| 37 | + [JsonConverter(typeof(ParseStringConverter))] | |
| 38 | + public long? Nullable { get; set; } | |
| 39 | + | |
| 40 | + [JsonProperty("arrOne", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 41 | + [JsonConverter(typeof(FluffyDecodeArrayConverter))] | |
| 42 | + public long[]? ArrOne { get; set; } | |
| 43 | + | |
| 44 | + [JsonProperty("arrNullable", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 45 | + [JsonConverter(typeof(PurpleDecodeArrayConverter))] | |
| 46 | + public long?[]? ArrNullable { get; set; } | |
| 47 | + | |
| 48 | 48 | [JsonProperty("unionWithInt", Required = Required.Always)] |
| 49 | 49 | [JsonConverter(typeof(DecodingChoiceConverter))] |
| 50 | 50 | public long UnionWithInt { get; set; } |
Mschema-elixirdefault / QuickType.ex+11 −11
| @@ -6,15 +6,15 @@ | ||
| 6 | 6 | # Encode into a JSON string: TopLevel.to_json(struct) |
| 7 | 7 | |
| 8 | 8 | defmodule TopLevel do |
| 9 | - @enforce_keys [:nullable, :one, :union_with_int, :union_with_int_and_enum] | |
| 10 | - defstruct [:arr_nullable, :arr_one, :nullable, :one, :optional, :union_with_int, :union_with_int_and_enum] | |
| 9 | + @enforce_keys [:one, :nullable, :union_with_int, :union_with_int_and_enum] | |
| 10 | + defstruct [:one, :optional, :nullable, :arr_one, :arr_nullable, :union_with_int, :union_with_int_and_enum] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | - arr_nullable: [nil | String.t()] | nil, | |
| 14 | - arr_one: [String.t()] | nil, | |
| 15 | - nullable: nil | String.t(), | |
| 16 | 13 | one: String.t(), |
| 17 | 14 | optional: String.t() | nil, |
| 15 | + nullable: nil | String.t(), | |
| 16 | + arr_one: [String.t()] | nil, | |
| 17 | + arr_nullable: [nil | String.t()] | nil, | |
| 18 | 18 | union_with_int: integer() | String.t(), |
| 19 | 19 | union_with_int_and_enum: integer() | String.t() |
| 20 | 20 | } |
| @@ -29,11 +29,11 @@ defmodule TopLevel do | ||
| 29 | 29 | |
| 30 | 30 | def from_map(m) do |
| 31 | 31 | %TopLevel{ |
| 32 | - arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1), | |
| 33 | - arr_one: m["arrOne"], | |
| 34 | - nullable: m["nullable"], | |
| 35 | 32 | one: m["one"], |
| 36 | 33 | optional: m["optional"], |
| 34 | + nullable: m["nullable"], | |
| 35 | + arr_one: m["arrOne"], | |
| 36 | + arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1), | |
| 37 | 37 | union_with_int: m["unionWithInt"], |
| 38 | 38 | union_with_int_and_enum: m["unionWithIntAndEnum"], |
| 39 | 39 | } |
| @@ -47,11 +47,11 @@ defmodule TopLevel do | ||
| 47 | 47 | |
| 48 | 48 | def to_map(struct) do |
| 49 | 49 | %{ |
| 50 | - "arrNullable" => struct.arr_nullable && Enum.map(struct.arr_nullable, &encode_arr_nullable_element/1), | |
| 51 | - "arrOne" => struct.arr_one, | |
| 52 | - "nullable" => struct.nullable, | |
| 53 | 50 | "one" => struct.one, |
| 54 | 51 | "optional" => struct.optional, |
| 52 | + "nullable" => struct.nullable, | |
| 53 | + "arrOne" => struct.arr_one, | |
| 54 | + "arrNullable" => struct.arr_nullable && Enum.map(struct.arr_nullable, &encode_arr_nullable_element/1), | |
| 55 | 55 | "unionWithInt" => struct.union_with_int, |
| 56 | 56 | "unionWithIntAndEnum" => struct.union_with_int_and_enum, |
| 57 | 57 | } |
Mschema-elmdefault / QuickType.elm+11 −11
| @@ -24,11 +24,11 @@ import Json.Encode as Jenc | ||
| 24 | 24 | import Dict exposing (Dict) |
| 25 | 25 | |
| 26 | 26 | type alias QuickType = |
| 27 | - { arrNullable : Maybe (List (Maybe String)) | |
| 28 | - , arrOne : Maybe (List String) | |
| 29 | - , nullable : Maybe String | |
| 30 | - , one : String | |
| 27 | + { one : String | |
| 31 | 28 | , optional : Maybe String |
| 29 | + , nullable : Maybe String | |
| 30 | + , arrOne : Maybe (List String) | |
| 31 | + , arrNullable : Maybe (List (Maybe String)) | |
| 32 | 32 | , unionWithInt : UnionWithInt |
| 33 | 33 | , unionWithIntAndEnum : UnionWithInt |
| 34 | 34 | } |
| @@ -45,22 +45,22 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 45 | 45 | quickType : Jdec.Decoder QuickType |
| 46 | 46 | quickType = |
| 47 | 47 | Jdec.succeed QuickType |
| 48 | - |> Jpipe.optional "arrNullable" (Jdec.nullable (Jdec.list (Jdec.nullable Jdec.string))) Nothing | |
| 49 | - |> Jpipe.optional "arrOne" (Jdec.nullable (Jdec.list Jdec.string)) Nothing | |
| 50 | - |> Jpipe.optional "nullable" (Jdec.nullable Jdec.string) Nothing | |
| 51 | 48 | |> Jpipe.required "one" Jdec.string |
| 52 | 49 | |> Jpipe.optional "optional" (Jdec.nullable Jdec.string) Nothing |
| 50 | + |> Jpipe.optional "nullable" (Jdec.nullable Jdec.string) Nothing | |
| 51 | + |> Jpipe.optional "arrOne" (Jdec.nullable (Jdec.list Jdec.string)) Nothing | |
| 52 | + |> Jpipe.optional "arrNullable" (Jdec.nullable (Jdec.list (Jdec.nullable Jdec.string))) Nothing | |
| 53 | 53 | |> Jpipe.required "unionWithInt" unionWithInt |
| 54 | 54 | |> Jpipe.required "unionWithIntAndEnum" unionWithInt |
| 55 | 55 | |
| 56 | 56 | encodeQuickType : QuickType -> Jenc.Value |
| 57 | 57 | encodeQuickType x = |
| 58 | 58 | Jenc.object |
| 59 | - [ ("arrNullable", makeNullableEncoder (Jenc.list (makeNullableEncoder Jenc.string)) x.arrNullable) | |
| 60 | - , ("arrOne", makeNullableEncoder (Jenc.list Jenc.string) x.arrOne) | |
| 61 | - , ("nullable", makeNullableEncoder Jenc.string x.nullable) | |
| 62 | - , ("one", Jenc.string x.one) | |
| 59 | + [ ("one", Jenc.string x.one) | |
| 63 | 60 | , ("optional", makeNullableEncoder Jenc.string x.optional) |
| 61 | + , ("nullable", makeNullableEncoder Jenc.string x.nullable) | |
| 62 | + , ("arrOne", makeNullableEncoder (Jenc.list Jenc.string) x.arrOne) | |
| 63 | + , ("arrNullable", makeNullableEncoder (Jenc.list (makeNullableEncoder Jenc.string)) x.arrNullable) | |
| 64 | 64 | , ("unionWithInt", encodeUnionWithInt x.unionWithInt) |
| 65 | 65 | , ("unionWithIntAndEnum", encodeUnionWithInt x.unionWithIntAndEnum) |
| 66 | 66 | ] |
Mschema-flowdefault / TopLevel.js+6 −6
| @@ -10,11 +10,11 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - arrNullable?: (null | string)[]; | |
| 14 | - arrOne?: string[]; | |
| 15 | - nullable: null | string; | |
| 16 | 13 | one: string; |
| 17 | 14 | optional?: string; |
| 15 | + nullable: null | string; | |
| 16 | + arrOne?: string[]; | |
| 17 | + arrNullable?: (null | string)[]; | |
| 18 | 18 | unionWithInt: UnionWithInt; |
| 19 | 19 | unionWithIntAndEnum: UnionWithInt; |
| 20 | 20 | [property: string]: mixed; |
| @@ -187,11 +187,11 @@ function r(name: string) { | ||
| 187 | 187 | |
| 188 | 188 | const typeMap: any = { |
| 189 | 189 | "TopLevel": o([ |
| 190 | - { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 191 | - { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 192 | - { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 193 | 190 | { json: "one", js: "one", typ: "" }, |
| 194 | 191 | { json: "optional", js: "optional", typ: u(undefined, "") }, |
| 192 | + { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 193 | + { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 194 | + { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 195 | 195 | { json: "unionWithInt", js: "unionWithInt", typ: u(0, "") }, |
| 196 | 196 | { json: "unionWithIntAndEnum", js: "unionWithIntAndEnum", typ: u(0, "") }, |
| 197 | 197 | ], "any"), |
Mschema-golangdefault / quicktype.go+3 −3
| @@ -22,11 +22,11 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | type TopLevel struct { |
| 25 | - ArrNullable []*string `json:"arrNullable,omitempty"` | |
| 26 | - ArrOne []string `json:"arrOne,omitempty"` | |
| 27 | - Nullable *string `json:"nullable"` | |
| 28 | 25 | One string `json:"one"` |
| 29 | 26 | Optional *string `json:"optional,omitempty"` |
| 27 | + Nullable *string `json:"nullable"` | |
| 28 | + ArrOne []string `json:"arrOne,omitempty"` | |
| 29 | + ArrNullable []*string `json:"arrNullable,omitempty"` | |
| 30 | 30 | UnionWithInt *UnionWithInt `json:"unionWithInt"` |
| 31 | 31 | UnionWithIntAndEnum *UnionWithInt `json:"unionWithIntAndEnum"` |
| 32 | 32 | } |
Mschema-haskelldefault / QuickType.hs+13 −13
| @@ -14,11 +14,11 @@ import Data.HashMap.Strict (HashMap) | ||
| 14 | 14 | import Data.Text (Text) |
| 15 | 15 | |
| 16 | 16 | data QuickType = QuickType |
| 17 | - { arrNullableQuickType :: Maybe ([(Maybe Text)]) | |
| 18 | - , arrOneQuickType :: Maybe ([Text]) | |
| 19 | - , nullableQuickType :: Maybe Text | |
| 20 | - , oneQuickType :: Text | |
| 17 | + { oneQuickType :: Text | |
| 21 | 18 | , optionalQuickType :: Maybe Text |
| 19 | + , nullableQuickType :: Maybe Text | |
| 20 | + , arrOneQuickType :: Maybe ([Text]) | |
| 21 | + , arrNullableQuickType :: Maybe ([(Maybe Text)]) | |
| 22 | 22 | , unionWithIntQuickType :: UnionWithInt |
| 23 | 23 | , unionWithIntAndEnumQuickType :: UnionWithInt |
| 24 | 24 | } deriving (Show) |
| @@ -32,24 +32,24 @@ decodeTopLevel :: ByteString -> Maybe QuickType | ||
| 32 | 32 | decodeTopLevel = decode |
| 33 | 33 | |
| 34 | 34 | instance ToJSON QuickType where |
| 35 | - toJSON (QuickType arrNullableQuickType arrOneQuickType nullableQuickType oneQuickType optionalQuickType unionWithIntQuickType unionWithIntAndEnumQuickType) = | |
| 35 | + toJSON (QuickType oneQuickType optionalQuickType nullableQuickType arrOneQuickType arrNullableQuickType unionWithIntQuickType unionWithIntAndEnumQuickType) = | |
| 36 | 36 | object |
| 37 | - [ "arrNullable" .= arrNullableQuickType | |
| 38 | - , "arrOne" .= arrOneQuickType | |
| 39 | - , "nullable" .= nullableQuickType | |
| 40 | - , "one" .= oneQuickType | |
| 37 | + [ "one" .= oneQuickType | |
| 41 | 38 | , "optional" .= optionalQuickType |
| 39 | + , "nullable" .= nullableQuickType | |
| 40 | + , "arrOne" .= arrOneQuickType | |
| 41 | + , "arrNullable" .= arrNullableQuickType | |
| 42 | 42 | , "unionWithInt" .= unionWithIntQuickType |
| 43 | 43 | , "unionWithIntAndEnum" .= unionWithIntAndEnumQuickType |
| 44 | 44 | ] |
| 45 | 45 | |
| 46 | 46 | instance FromJSON QuickType where |
| 47 | 47 | parseJSON (Object v) = QuickType |
| 48 | - <$> v .:? "arrNullable" | |
| 49 | - <*> v .:? "arrOne" | |
| 50 | - <*> v .: "nullable" | |
| 51 | - <*> v .: "one" | |
| 48 | + <$> v .: "one" | |
| 52 | 49 | <*> v .:? "optional" |
| 50 | + <*> v .: "nullable" | |
| 51 | + <*> v .:? "arrOne" | |
| 52 | + <*> v .:? "arrNullable" | |
| 53 | 53 | <*> v .: "unionWithInt" |
| 54 | 54 | <*> v .: "unionWithIntAndEnum" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+18 −18
| @@ -4,29 +4,14 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private List<String> arrNullable; | |
| 8 | - private List<String> arrOne; | |
| 9 | - private String nullable; | |
| 10 | 7 | private String one; |
| 11 | 8 | private String optional; |
| 9 | + private String nullable; | |
| 10 | + private List<String> arrOne; | |
| 11 | + private List<String> arrNullable; | |
| 12 | 12 | private UnionWithInt unionWithInt; |
| 13 | 13 | private UnionWithInt unionWithIntAndEnum; |
| 14 | 14 | |
| 15 | - @JsonProperty("arrNullable") | |
| 16 | - public List<String> getArrNullable() { return arrNullable; } | |
| 17 | - @JsonProperty("arrNullable") | |
| 18 | - public void setArrNullable(List<String> value) { this.arrNullable = value; } | |
| 19 | - | |
| 20 | - @JsonProperty("arrOne") | |
| 21 | - public List<String> getArrOne() { return arrOne; } | |
| 22 | - @JsonProperty("arrOne") | |
| 23 | - public void setArrOne(List<String> value) { this.arrOne = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("nullable") | |
| 26 | - public String getNullable() { return nullable; } | |
| 27 | - @JsonProperty("nullable") | |
| 28 | - public void setNullable(String value) { this.nullable = value; } | |
| 29 | - | |
| 30 | 15 | @JsonProperty("one") |
| 31 | 16 | public String getOne() { return one; } |
| 32 | 17 | @JsonProperty("one") |
| @@ -37,6 +22,21 @@ public class TopLevel { | ||
| 37 | 22 | @JsonProperty("optional") |
| 38 | 23 | public void setOptional(String value) { this.optional = value; } |
| 39 | 24 | |
| 25 | + @JsonProperty("nullable") | |
| 26 | + public String getNullable() { return nullable; } | |
| 27 | + @JsonProperty("nullable") | |
| 28 | + public void setNullable(String value) { this.nullable = value; } | |
| 29 | + | |
| 30 | + @JsonProperty("arrOne") | |
| 31 | + public List<String> getArrOne() { return arrOne; } | |
| 32 | + @JsonProperty("arrOne") | |
| 33 | + public void setArrOne(List<String> value) { this.arrOne = value; } | |
| 34 | + | |
| 35 | + @JsonProperty("arrNullable") | |
| 36 | + public List<String> getArrNullable() { return arrNullable; } | |
| 37 | + @JsonProperty("arrNullable") | |
| 38 | + public void setArrNullable(List<String> value) { this.arrNullable = value; } | |
| 39 | + | |
| 40 | 40 | @JsonProperty("unionWithInt") |
| 41 | 41 | public UnionWithInt getUnionWithInt() { return unionWithInt; } |
| 42 | 42 | @JsonProperty("unionWithInt") |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+18 −18
| @@ -4,29 +4,14 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private List<String> arrNullable; | |
| 8 | - private List<String> arrOne; | |
| 9 | - private String nullable; | |
| 10 | 7 | private String one; |
| 11 | 8 | private String optional; |
| 9 | + private String nullable; | |
| 10 | + private List<String> arrOne; | |
| 11 | + private List<String> arrNullable; | |
| 12 | 12 | private UnionWithInt unionWithInt; |
| 13 | 13 | private UnionWithInt unionWithIntAndEnum; |
| 14 | 14 | |
| 15 | - @JsonProperty("arrNullable") | |
| 16 | - public List<String> getArrNullable() { return arrNullable; } | |
| 17 | - @JsonProperty("arrNullable") | |
| 18 | - public void setArrNullable(List<String> value) { this.arrNullable = value; } | |
| 19 | - | |
| 20 | - @JsonProperty("arrOne") | |
| 21 | - public List<String> getArrOne() { return arrOne; } | |
| 22 | - @JsonProperty("arrOne") | |
| 23 | - public void setArrOne(List<String> value) { this.arrOne = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("nullable") | |
| 26 | - public String getNullable() { return nullable; } | |
| 27 | - @JsonProperty("nullable") | |
| 28 | - public void setNullable(String value) { this.nullable = value; } | |
| 29 | - | |
| 30 | 15 | @JsonProperty("one") |
| 31 | 16 | public String getOne() { return one; } |
| 32 | 17 | @JsonProperty("one") |
| @@ -37,6 +22,21 @@ public class TopLevel { | ||
| 37 | 22 | @JsonProperty("optional") |
| 38 | 23 | public void setOptional(String value) { this.optional = value; } |
| 39 | 24 | |
| 25 | + @JsonProperty("nullable") | |
| 26 | + public String getNullable() { return nullable; } | |
| 27 | + @JsonProperty("nullable") | |
| 28 | + public void setNullable(String value) { this.nullable = value; } | |
| 29 | + | |
| 30 | + @JsonProperty("arrOne") | |
| 31 | + public List<String> getArrOne() { return arrOne; } | |
| 32 | + @JsonProperty("arrOne") | |
| 33 | + public void setArrOne(List<String> value) { this.arrOne = value; } | |
| 34 | + | |
| 35 | + @JsonProperty("arrNullable") | |
| 36 | + public List<String> getArrNullable() { return arrNullable; } | |
| 37 | + @JsonProperty("arrNullable") | |
| 38 | + public void setArrNullable(List<String> value) { this.arrNullable = value; } | |
| 39 | + | |
| 40 | 40 | @JsonProperty("unionWithInt") |
| 41 | 41 | public UnionWithInt getUnionWithInt() { return unionWithInt; } |
| 42 | 42 | @JsonProperty("unionWithInt") |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+18 −18
| @@ -4,29 +4,14 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private List<String> arrNullable; | |
| 8 | - private List<String> arrOne; | |
| 9 | - private String nullable; | |
| 10 | 7 | private String one; |
| 11 | 8 | private String optional; |
| 9 | + private String nullable; | |
| 10 | + private List<String> arrOne; | |
| 11 | + private List<String> arrNullable; | |
| 12 | 12 | private UnionWithInt unionWithInt; |
| 13 | 13 | private UnionWithInt unionWithIntAndEnum; |
| 14 | 14 | |
| 15 | - @JsonProperty("arrNullable") | |
| 16 | - public List<String> getArrNullable() { return arrNullable; } | |
| 17 | - @JsonProperty("arrNullable") | |
| 18 | - public void setArrNullable(List<String> value) { this.arrNullable = value; } | |
| 19 | - | |
| 20 | - @JsonProperty("arrOne") | |
| 21 | - public List<String> getArrOne() { return arrOne; } | |
| 22 | - @JsonProperty("arrOne") | |
| 23 | - public void setArrOne(List<String> value) { this.arrOne = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("nullable") | |
| 26 | - public String getNullable() { return nullable; } | |
| 27 | - @JsonProperty("nullable") | |
| 28 | - public void setNullable(String value) { this.nullable = value; } | |
| 29 | - | |
| 30 | 15 | @JsonProperty("one") |
| 31 | 16 | public String getOne() { return one; } |
| 32 | 17 | @JsonProperty("one") |
| @@ -37,6 +22,21 @@ public class TopLevel { | ||
| 37 | 22 | @JsonProperty("optional") |
| 38 | 23 | public void setOptional(String value) { this.optional = value; } |
| 39 | 24 | |
| 25 | + @JsonProperty("nullable") | |
| 26 | + public String getNullable() { return nullable; } | |
| 27 | + @JsonProperty("nullable") | |
| 28 | + public void setNullable(String value) { this.nullable = value; } | |
| 29 | + | |
| 30 | + @JsonProperty("arrOne") | |
| 31 | + public List<String> getArrOne() { return arrOne; } | |
| 32 | + @JsonProperty("arrOne") | |
| 33 | + public void setArrOne(List<String> value) { this.arrOne = value; } | |
| 34 | + | |
| 35 | + @JsonProperty("arrNullable") | |
| 36 | + public List<String> getArrNullable() { return arrNullable; } | |
| 37 | + @JsonProperty("arrNullable") | |
| 38 | + public void setArrNullable(List<String> value) { this.arrNullable = value; } | |
| 39 | + | |
| 40 | 40 | @JsonProperty("unionWithInt") |
| 41 | 41 | public UnionWithInt getUnionWithInt() { return unionWithInt; } |
| 42 | 42 | @JsonProperty("unionWithInt") |
Mschema-javascriptdefault / TopLevel.js+3 −3
| @@ -172,11 +172,11 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 176 | - { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 177 | - { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 178 | 175 | { json: "one", js: "one", typ: "" }, |
| 179 | 176 | { json: "optional", js: "optional", typ: u(undefined, "") }, |
| 177 | + { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 178 | + { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 179 | + { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 180 | 180 | { json: "unionWithInt", js: "unionWithInt", typ: u(0, "") }, |
| 181 | 181 | { json: "unionWithIntAndEnum", js: "unionWithIntAndEnum", typ: u(0, "") }, |
| 182 | 182 | ], "any"), |
Mschema-phpdefault / TopLevel.php+151 −151
| @@ -4,124 +4,88 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private ?array $arrNullable; // json:arrNullable Optional | |
| 8 | - private ?array $arrOne; // json:arrOne Optional | |
| 9 | - private ?string $nullable; // json:nullable Optional | |
| 10 | 7 | private string $one; // json:one Required |
| 11 | 8 | private ?string $optional; // json:optional Optional |
| 9 | + private ?string $nullable; // json:nullable Optional | |
| 10 | + private ?array $arrOne; // json:arrOne Optional | |
| 11 | + private ?array $arrNullable; // json:arrNullable Optional | |
| 12 | 12 | private int|string $unionWithInt; // json:unionWithInt Required |
| 13 | 13 | private int|string $unionWithIntAndEnum; // json:unionWithIntAndEnum Required |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * @param array|null $arrNullable | |
| 17 | - * @param array|null $arrOne | |
| 18 | - * @param string|null $nullable | |
| 19 | 16 | * @param string $one |
| 20 | 17 | * @param string|null $optional |
| 18 | + * @param string|null $nullable | |
| 19 | + * @param array|null $arrOne | |
| 20 | + * @param array|null $arrNullable | |
| 21 | 21 | * @param int|string $unionWithInt |
| 22 | 22 | * @param int|string $unionWithIntAndEnum |
| 23 | 23 | */ |
| 24 | - public function __construct(?array $arrNullable, ?array $arrOne, ?string $nullable, string $one, ?string $optional, int|string $unionWithInt, int|string $unionWithIntAndEnum) { | |
| 25 | - $this->arrNullable = $arrNullable; | |
| 26 | - $this->arrOne = $arrOne; | |
| 27 | - $this->nullable = $nullable; | |
| 24 | + public function __construct(string $one, ?string $optional, ?string $nullable, ?array $arrOne, ?array $arrNullable, int|string $unionWithInt, int|string $unionWithIntAndEnum) { | |
| 28 | 25 | $this->one = $one; |
| 29 | 26 | $this->optional = $optional; |
| 27 | + $this->nullable = $nullable; | |
| 28 | + $this->arrOne = $arrOne; | |
| 29 | + $this->arrNullable = $arrNullable; | |
| 30 | 30 | $this->unionWithInt = $unionWithInt; |
| 31 | 31 | $this->unionWithIntAndEnum = $unionWithIntAndEnum; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * @param ?array $value | |
| 35 | + * @param string $value | |
| 36 | 36 | * @throws Exception |
| 37 | - * @return ?array | |
| 37 | + * @return string | |
| 38 | 38 | */ |
| 39 | - public static function fromArrNullable(?array $value): ?array { | |
| 40 | - if (!is_null($value)) { | |
| 41 | - return array_map(function ($value) { | |
| 42 | - if (!is_null($value)) { | |
| 43 | - return $value; /*string*/ | |
| 44 | - } else { | |
| 45 | - return null; | |
| 46 | - } | |
| 47 | - }, $value); | |
| 48 | - } else { | |
| 49 | - return null; | |
| 50 | - } | |
| 39 | + public static function fromOne(string $value): string { | |
| 40 | + return $value; /*string*/ | |
| 51 | 41 | } |
| 52 | 42 | |
| 53 | 43 | /** |
| 54 | 44 | * @throws Exception |
| 55 | - * @return ?array | |
| 45 | + * @return string | |
| 56 | 46 | */ |
| 57 | - public function toArrNullable(): ?array { | |
| 58 | - if (TopLevel::validateArrNullable($this->arrNullable)) { | |
| 59 | - if (!is_null($this->arrNullable)) { | |
| 60 | - return array_map(function ($value) { | |
| 61 | - if (!is_null($value)) { | |
| 62 | - return $value; /*string*/ | |
| 63 | - } else { | |
| 64 | - return null; | |
| 65 | - } | |
| 66 | - }, $this->arrNullable); | |
| 67 | - } else { | |
| 68 | - return null; | |
| 69 | - } | |
| 47 | + public function toOne(): string { | |
| 48 | + if (TopLevel::validateOne($this->one)) { | |
| 49 | + return $this->one; /*string*/ | |
| 70 | 50 | } |
| 71 | - throw new Exception('never get to this TopLevel::arrNullable'); | |
| 51 | + throw new Exception('never get to this TopLevel::one'); | |
| 72 | 52 | } |
| 73 | 53 | |
| 74 | 54 | /** |
| 75 | - * @param array|null | |
| 55 | + * @param string | |
| 76 | 56 | * @return bool |
| 77 | 57 | * @throws Exception |
| 78 | 58 | */ |
| 79 | - public static function validateArrNullable(?array $value): bool { | |
| 80 | - if (!is_null($value)) { | |
| 81 | - if (!is_array($value)) { | |
| 82 | - throw new Exception("Attribute Error:TopLevel::arrNullable"); | |
| 83 | - } | |
| 84 | - array_walk($value, function($value_v) { | |
| 85 | - if (!is_null($value_v)) { | |
| 86 | - if (!is_string($value_v)) { | |
| 87 | - throw new Exception("Attribute Error:TopLevel::arrNullable"); | |
| 88 | - } | |
| 89 | - } | |
| 90 | - }); | |
| 91 | - } | |
| 59 | + public static function validateOne(string $value): bool { | |
| 92 | 60 | return true; |
| 93 | 61 | } |
| 94 | 62 | |
| 95 | 63 | /** |
| 96 | 64 | * @throws Exception |
| 97 | - * @return ?array | |
| 65 | + * @return string | |
| 98 | 66 | */ |
| 99 | - public function getArrNullable(): ?array { | |
| 100 | - if (TopLevel::validateArrNullable($this->arrNullable)) { | |
| 101 | - return $this->arrNullable; | |
| 67 | + public function getOne(): string { | |
| 68 | + if (TopLevel::validateOne($this->one)) { | |
| 69 | + return $this->one; | |
| 102 | 70 | } |
| 103 | - throw new Exception('never get to getArrNullable TopLevel::arrNullable'); | |
| 71 | + throw new Exception('never get to getOne TopLevel::one'); | |
| 104 | 72 | } |
| 105 | 73 | |
| 106 | 74 | /** |
| 107 | - * @return ?array | |
| 75 | + * @return string | |
| 108 | 76 | */ |
| 109 | - public static function sampleArrNullable(): ?array { | |
| 110 | - return array( | |
| 111 | - 'TopLevel::::31' /*31:*/ | |
| 112 | - ); /* 31:arrNullable*/ | |
| 77 | + public static function sampleOne(): string { | |
| 78 | + return 'TopLevel::one::31'; /*31:one*/ | |
| 113 | 79 | } |
| 114 | 80 | |
| 115 | 81 | /** |
| 116 | - * @param ?array $value | |
| 82 | + * @param ?string $value | |
| 117 | 83 | * @throws Exception |
| 118 | - * @return ?array | |
| 84 | + * @return ?string | |
| 119 | 85 | */ |
| 120 | - public static function fromArrOne(?array $value): ?array { | |
| 86 | + public static function fromOptional(?string $value): ?string { | |
| 121 | 87 | if (!is_null($value)) { |
| 122 | - return array_map(function ($value) { | |
| 123 | - return $value; /*string*/ | |
| 124 | - }, $value); | |
| 88 | + return $value; /*string*/ | |
| 125 | 89 | } else { |
| 126 | 90 | return null; |
| 127 | 91 | } |
| @@ -129,58 +93,46 @@ class TopLevel { | ||
| 129 | 93 | |
| 130 | 94 | /** |
| 131 | 95 | * @throws Exception |
| 132 | - * @return ?array | |
| 96 | + * @return ?string | |
| 133 | 97 | */ |
| 134 | - public function toArrOne(): ?array { | |
| 135 | - if (TopLevel::validateArrOne($this->arrOne)) { | |
| 136 | - if (!is_null($this->arrOne)) { | |
| 137 | - return array_map(function ($value) { | |
| 138 | - return $value; /*string*/ | |
| 139 | - }, $this->arrOne); | |
| 98 | + public function toOptional(): ?string { | |
| 99 | + if (TopLevel::validateOptional($this->optional)) { | |
| 100 | + if (!is_null($this->optional)) { | |
| 101 | + return $this->optional; /*string*/ | |
| 140 | 102 | } else { |
| 141 | 103 | return null; |
| 142 | 104 | } |
| 143 | 105 | } |
| 144 | - throw new Exception('never get to this TopLevel::arrOne'); | |
| 106 | + throw new Exception('never get to this TopLevel::optional'); | |
| 145 | 107 | } |
| 146 | 108 | |
| 147 | 109 | /** |
| 148 | - * @param array|null | |
| 110 | + * @param string|null | |
| 149 | 111 | * @return bool |
| 150 | 112 | * @throws Exception |
| 151 | 113 | */ |
| 152 | - public static function validateArrOne(?array $value): bool { | |
| 114 | + public static function validateOptional(?string $value): bool { | |
| 153 | 115 | if (!is_null($value)) { |
| 154 | - if (!is_array($value)) { | |
| 155 | - throw new Exception("Attribute Error:TopLevel::arrOne"); | |
| 156 | - } | |
| 157 | - array_walk($value, function($value_v) { | |
| 158 | - if (!is_string($value_v)) { | |
| 159 | - throw new Exception("Attribute Error:TopLevel::arrOne"); | |
| 160 | - } | |
| 161 | - }); | |
| 162 | 116 | } |
| 163 | 117 | return true; |
| 164 | 118 | } |
| 165 | 119 | |
| 166 | 120 | /** |
| 167 | 121 | * @throws Exception |
| 168 | - * @return ?array | |
| 122 | + * @return ?string | |
| 169 | 123 | */ |
| 170 | - public function getArrOne(): ?array { | |
| 171 | - if (TopLevel::validateArrOne($this->arrOne)) { | |
| 172 | - return $this->arrOne; | |
| 124 | + public function getOptional(): ?string { | |
| 125 | + if (TopLevel::validateOptional($this->optional)) { | |
| 126 | + return $this->optional; | |
| 173 | 127 | } |
| 174 | - throw new Exception('never get to getArrOne TopLevel::arrOne'); | |
| 128 | + throw new Exception('never get to getOptional TopLevel::optional'); | |
| 175 | 129 | } |
| 176 | 130 | |
| 177 | 131 | /** |
| 178 | - * @return ?array | |
| 132 | + * @return ?string | |
| 179 | 133 | */ |
| 180 | - public static function sampleArrOne(): ?array { | |
| 181 | - return array( | |
| 182 | - 'TopLevel::::32' /*32:*/ | |
| 183 | - ); /* 32:arrOne*/ | |
| 134 | + public static function sampleOptional(): ?string { | |
| 135 | + return 'TopLevel::optional::32'; /*32:optional*/ | |
| 184 | 136 | } |
| 185 | 137 | |
| 186 | 138 | /** |
| @@ -241,60 +193,90 @@ class TopLevel { | ||
| 241 | 193 | } |
| 242 | 194 | |
| 243 | 195 | /** |
| 244 | - * @param string $value | |
| 196 | + * @param ?array $value | |
| 245 | 197 | * @throws Exception |
| 246 | - * @return string | |
| 198 | + * @return ?array | |
| 247 | 199 | */ |
| 248 | - public static function fromOne(string $value): string { | |
| 249 | - return $value; /*string*/ | |
| 200 | + public static function fromArrOne(?array $value): ?array { | |
| 201 | + if (!is_null($value)) { | |
| 202 | + return array_map(function ($value) { | |
| 203 | + return $value; /*string*/ | |
| 204 | + }, $value); | |
| 205 | + } else { | |
| 206 | + return null; | |
| 207 | + } | |
| 250 | 208 | } |
| 251 | 209 | |
| 252 | 210 | /** |
| 253 | 211 | * @throws Exception |
| 254 | - * @return string | |
| 212 | + * @return ?array | |
| 255 | 213 | */ |
| 256 | - public function toOne(): string { | |
| 257 | - if (TopLevel::validateOne($this->one)) { | |
| 258 | - return $this->one; /*string*/ | |
| 214 | + public function toArrOne(): ?array { | |
| 215 | + if (TopLevel::validateArrOne($this->arrOne)) { | |
| 216 | + if (!is_null($this->arrOne)) { | |
| 217 | + return array_map(function ($value) { | |
| 218 | + return $value; /*string*/ | |
| 219 | + }, $this->arrOne); | |
| 220 | + } else { | |
| 221 | + return null; | |
| 222 | + } | |
| 259 | 223 | } |
| 260 | - throw new Exception('never get to this TopLevel::one'); | |
| 224 | + throw new Exception('never get to this TopLevel::arrOne'); | |
| 261 | 225 | } |
| 262 | 226 | |
| 263 | 227 | /** |
| 264 | - * @param string | |
| 228 | + * @param array|null | |
| 265 | 229 | * @return bool |
| 266 | 230 | * @throws Exception |
| 267 | 231 | */ |
| 268 | - public static function validateOne(string $value): bool { | |
| 232 | + public static function validateArrOne(?array $value): bool { | |
| 233 | + if (!is_null($value)) { | |
| 234 | + if (!is_array($value)) { | |
| 235 | + throw new Exception("Attribute Error:TopLevel::arrOne"); | |
| 236 | + } | |
| 237 | + array_walk($value, function($value_v) { | |
| 238 | + if (!is_string($value_v)) { | |
| 239 | + throw new Exception("Attribute Error:TopLevel::arrOne"); | |
| 240 | + } | |
| 241 | + }); | |
| 242 | + } | |
| 269 | 243 | return true; |
| 270 | 244 | } |
| 271 | 245 | |
| 272 | 246 | /** |
| 273 | 247 | * @throws Exception |
| 274 | - * @return string | |
| 248 | + * @return ?array | |
| 275 | 249 | */ |
| 276 | - public function getOne(): string { | |
| 277 | - if (TopLevel::validateOne($this->one)) { | |
| 278 | - return $this->one; | |
| 250 | + public function getArrOne(): ?array { | |
| 251 | + if (TopLevel::validateArrOne($this->arrOne)) { | |
| 252 | + return $this->arrOne; | |
| 279 | 253 | } |
| 280 | - throw new Exception('never get to getOne TopLevel::one'); | |
| 254 | + throw new Exception('never get to getArrOne TopLevel::arrOne'); | |
| 281 | 255 | } |
| 282 | 256 | |
| 283 | 257 | /** |
| 284 | - * @return string | |
| 258 | + * @return ?array | |
| 285 | 259 | */ |
| 286 | - public static function sampleOne(): string { | |
| 287 | - return 'TopLevel::one::34'; /*34:one*/ | |
| 260 | + public static function sampleArrOne(): ?array { | |
| 261 | + return array( | |
| 262 | + 'TopLevel::::34' /*34:*/ | |
| 263 | + ); /* 34:arrOne*/ | |
| 288 | 264 | } |
| 289 | 265 | |
| 290 | 266 | /** |
| 291 | - * @param ?string $value | |
| 267 | + * @param ?array $value | |
| 292 | 268 | * @throws Exception |
| 293 | - * @return ?string | |
| 269 | + * @return ?array | |
| 294 | 270 | */ |
| 295 | - public static function fromOptional(?string $value): ?string { | |
| 271 | + public static function fromArrNullable(?array $value): ?array { | |
| 296 | 272 | if (!is_null($value)) { |
| 297 | - return $value; /*string*/ | |
| 273 | + return array_map(function ($value) { | |
| 274 | + if (!is_null($value)) { | |
| 275 | + return $value; /*string*/ | |
| 276 | + } else { | |
| 277 | + return null; | |
| 278 | + } | |
| 279 | + }, $value); | |
| 298 | 280 | } else { |
| 299 | 281 | return null; |
| 300 | 282 | } |
| @@ -302,46 +284,64 @@ class TopLevel { | ||
| 302 | 284 | |
| 303 | 285 | /** |
| 304 | 286 | * @throws Exception |
| 305 | - * @return ?string | |
| 287 | + * @return ?array | |
| 306 | 288 | */ |
| 307 | - public function toOptional(): ?string { | |
| 308 | - if (TopLevel::validateOptional($this->optional)) { | |
| 309 | - if (!is_null($this->optional)) { | |
| 310 | - return $this->optional; /*string*/ | |
| 289 | + public function toArrNullable(): ?array { | |
| 290 | + if (TopLevel::validateArrNullable($this->arrNullable)) { | |
| 291 | + if (!is_null($this->arrNullable)) { | |
| 292 | + return array_map(function ($value) { | |
| 293 | + if (!is_null($value)) { | |
| 294 | + return $value; /*string*/ | |
| 295 | + } else { | |
| 296 | + return null; | |
| 297 | + } | |
| 298 | + }, $this->arrNullable); | |
| 311 | 299 | } else { |
| 312 | 300 | return null; |
| 313 | 301 | } |
| 314 | 302 | } |
| 315 | - throw new Exception('never get to this TopLevel::optional'); | |
| 303 | + throw new Exception('never get to this TopLevel::arrNullable'); | |
| 316 | 304 | } |
| 317 | 305 | |
| 318 | 306 | /** |
| 319 | - * @param string|null | |
| 307 | + * @param array|null | |
| 320 | 308 | * @return bool |
| 321 | 309 | * @throws Exception |
| 322 | 310 | */ |
| 323 | - public static function validateOptional(?string $value): bool { | |
| 311 | + public static function validateArrNullable(?array $value): bool { | |
| 324 | 312 | if (!is_null($value)) { |
| 313 | + if (!is_array($value)) { | |
| 314 | + throw new Exception("Attribute Error:TopLevel::arrNullable"); | |
| 315 | + } | |
| 316 | + array_walk($value, function($value_v) { | |
| 317 | + if (!is_null($value_v)) { | |
| 318 | + if (!is_string($value_v)) { | |
| 319 | + throw new Exception("Attribute Error:TopLevel::arrNullable"); | |
| 320 | + } | |
| 321 | + } | |
| 322 | + }); | |
| 325 | 323 | } |
| 326 | 324 | return true; |
| 327 | 325 | } |
| 328 | 326 | |
| 329 | 327 | /** |
| 330 | 328 | * @throws Exception |
| 331 | - * @return ?string | |
| 329 | + * @return ?array | |
| 332 | 330 | */ |
| 333 | - public function getOptional(): ?string { | |
| 334 | - if (TopLevel::validateOptional($this->optional)) { | |
| 335 | - return $this->optional; | |
| 331 | + public function getArrNullable(): ?array { | |
| 332 | + if (TopLevel::validateArrNullable($this->arrNullable)) { | |
| 333 | + return $this->arrNullable; | |
| 336 | 334 | } |
| 337 | - throw new Exception('never get to getOptional TopLevel::optional'); | |
| 335 | + throw new Exception('never get to getArrNullable TopLevel::arrNullable'); | |
| 338 | 336 | } |
| 339 | 337 | |
| 340 | 338 | /** |
| 341 | - * @return ?string | |
| 339 | + * @return ?array | |
| 342 | 340 | */ |
| 343 | - public static function sampleOptional(): ?string { | |
| 344 | - return 'TopLevel::optional::35'; /*35:optional*/ | |
| 341 | + public static function sampleArrNullable(): ?array { | |
| 342 | + return array( | |
| 343 | + 'TopLevel::::35' /*35:*/ | |
| 344 | + ); /* 35:arrNullable*/ | |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
| @@ -489,11 +489,11 @@ class TopLevel { | ||
| 489 | 489 | * @return bool |
| 490 | 490 | */ |
| 491 | 491 | public function validate(): bool { |
| 492 | - return TopLevel::validateArrNullable($this->arrNullable) | |
| 493 | - || TopLevel::validateArrOne($this->arrOne) | |
| 494 | - || TopLevel::validateNullable($this->nullable) | |
| 495 | - || TopLevel::validateOne($this->one) | |
| 492 | + return TopLevel::validateOne($this->one) | |
| 496 | 493 | || TopLevel::validateOptional($this->optional) |
| 494 | + || TopLevel::validateNullable($this->nullable) | |
| 495 | + || TopLevel::validateArrOne($this->arrOne) | |
| 496 | + || TopLevel::validateArrNullable($this->arrNullable) | |
| 497 | 497 | || TopLevel::validateUnionWithInt($this->unionWithInt) |
| 498 | 498 | || TopLevel::validateUnionWithIntAndEnum($this->unionWithIntAndEnum); |
| 499 | 499 | } |
| @@ -504,11 +504,11 @@ class TopLevel { | ||
| 504 | 504 | */ |
| 505 | 505 | public function to(): stdClass { |
| 506 | 506 | $out = new stdClass(); |
| 507 | - $out->{'arrNullable'} = $this->toArrNullable(); | |
| 508 | - $out->{'arrOne'} = $this->toArrOne(); | |
| 509 | - $out->{'nullable'} = $this->toNullable(); | |
| 510 | 507 | $out->{'one'} = $this->toOne(); |
| 511 | 508 | $out->{'optional'} = $this->toOptional(); |
| 509 | + $out->{'nullable'} = $this->toNullable(); | |
| 510 | + $out->{'arrOne'} = $this->toArrOne(); | |
| 511 | + $out->{'arrNullable'} = $this->toArrNullable(); | |
| 512 | 512 | $out->{'unionWithInt'} = $this->toUnionWithInt(); |
| 513 | 513 | $out->{'unionWithIntAndEnum'} = $this->toUnionWithIntAndEnum(); |
| 514 | 514 | return $out; |
| @@ -521,11 +521,11 @@ class TopLevel { | ||
| 521 | 521 | */ |
| 522 | 522 | public static function from(stdClass $obj): TopLevel { |
| 523 | 523 | return new TopLevel( |
| 524 | - TopLevel::fromArrNullable($obj->{'arrNullable'}) | |
| 525 | - ,TopLevel::fromArrOne($obj->{'arrOne'}) | |
| 526 | - ,TopLevel::fromNullable($obj->{'nullable'}) | |
| 527 | - ,TopLevel::fromOne($obj->{'one'}) | |
| 524 | + TopLevel::fromOne($obj->{'one'}) | |
| 528 | 525 | ,TopLevel::fromOptional($obj->{'optional'}) |
| 526 | + ,TopLevel::fromNullable($obj->{'nullable'}) | |
| 527 | + ,TopLevel::fromArrOne($obj->{'arrOne'}) | |
| 528 | + ,TopLevel::fromArrNullable($obj->{'arrNullable'}) | |
| 529 | 529 | ,TopLevel::fromUnionWithInt($obj->{'unionWithInt'}) |
| 530 | 530 | ,TopLevel::fromUnionWithIntAndEnum($obj->{'unionWithIntAndEnum'}) |
| 531 | 531 | ); |
| @@ -536,11 +536,11 @@ class TopLevel { | ||
| 536 | 536 | */ |
| 537 | 537 | public static function sample(): TopLevel { |
| 538 | 538 | return new TopLevel( |
| 539 | - TopLevel::sampleArrNullable() | |
| 540 | - ,TopLevel::sampleArrOne() | |
| 541 | - ,TopLevel::sampleNullable() | |
| 542 | - ,TopLevel::sampleOne() | |
| 539 | + TopLevel::sampleOne() | |
| 543 | 540 | ,TopLevel::sampleOptional() |
| 541 | + ,TopLevel::sampleNullable() | |
| 542 | + ,TopLevel::sampleArrOne() | |
| 543 | + ,TopLevel::sampleArrNullable() | |
| 544 | 544 | ,TopLevel::sampleUnionWithInt() |
| 545 | 545 | ,TopLevel::sampleUnionWithIntAndEnum() |
| 546 | 546 | ); |
Mschema-pikedefault / TopLevel.pmod+9 −9
| @@ -13,21 +13,21 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - array(mixed|string)|mixed arr_nullable; // json: "arrNullable" | |
| 17 | - array(string)|mixed arr_one; // json: "arrOne" | |
| 18 | - mixed|string nullable; // json: "nullable" | |
| 19 | 16 | string one; // json: "one" |
| 20 | 17 | mixed|string top_level_optional; // json: "optional" |
| 18 | + mixed|string nullable; // json: "nullable" | |
| 19 | + array(string)|mixed arr_one; // json: "arrOne" | |
| 20 | + array(mixed|string)|mixed arr_nullable; // json: "arrNullable" | |
| 21 | 21 | UnionWithInt union_with_int; // json: "unionWithInt" |
| 22 | 22 | UnionWithInt union_with_int_and_enum; // json: "unionWithIntAndEnum" |
| 23 | 23 | |
| 24 | 24 | string encode_json() { |
| 25 | 25 | mapping(string:mixed) json = ([ |
| 26 | - "arrNullable" : arr_nullable, | |
| 27 | - "arrOne" : arr_one, | |
| 28 | - "nullable" : nullable, | |
| 29 | 26 | "one" : one, |
| 30 | 27 | "optional" : top_level_optional, |
| 28 | + "nullable" : nullable, | |
| 29 | + "arrOne" : arr_one, | |
| 30 | + "arrNullable" : arr_nullable, | |
| 31 | 31 | "unionWithInt" : union_with_int, |
| 32 | 32 | "unionWithIntAndEnum" : union_with_int_and_enum, |
| 33 | 33 | ]); |
| @@ -39,11 +39,11 @@ class TopLevel { | ||
| 39 | 39 | TopLevel TopLevel_from_JSON(mixed json) { |
| 40 | 40 | TopLevel retval = TopLevel(); |
| 41 | 41 | |
| 42 | - retval.arr_nullable = json["arrNullable"]; | |
| 43 | - retval.arr_one = json["arrOne"]; | |
| 44 | - retval.nullable = json["nullable"]; | |
| 45 | 42 | retval.one = json["one"]; |
| 46 | 43 | retval.top_level_optional = json["optional"]; |
| 44 | + retval.nullable = json["nullable"]; | |
| 45 | + retval.arr_one = json["arrOne"]; | |
| 46 | + retval.arr_nullable = json["arrNullable"]; | |
| 47 | 47 | retval.union_with_int = json["unionWithInt"]; |
| 48 | 48 | retval.union_with_int_and_enum = json["unionWithIntAndEnum"]; |
Mschema-pythondefault / quicktype.py+17 −17
| @@ -26,16 +26,16 @@ def from_union(fs, x): | ||
| 26 | 26 | assert False |
| 27 | 27 | |
| 28 | 28 | |
| 29 | -def from_list(f: Callable[[Any], T], x: Any) -> list[T]: | |
| 30 | - assert isinstance(x, list) | |
| 31 | - return [f(y) for y in x] | |
| 32 | - | |
| 33 | - | |
| 34 | 29 | def from_none(x: Any) -> Any: |
| 35 | 30 | assert x is None |
| 36 | 31 | return x |
| 37 | 32 | |
| 38 | 33 | |
| 34 | +def from_list(f: Callable[[Any], T], x: Any) -> list[T]: | |
| 35 | + assert isinstance(x, list) | |
| 36 | + return [f(y) for y in x] | |
| 37 | + | |
| 38 | + | |
| 39 | 39 | def is_type(t: Type[T], x: Any) -> T: |
| 40 | 40 | assert isinstance(x, t) |
| 41 | 41 | return x |
| @@ -60,10 +60,10 @@ class TopLevel: | ||
| 60 | 60 | one: int |
| 61 | 61 | union_with_int: int |
| 62 | 62 | union_with_int_and_enum: int | UnionWithIntAndEnumEnum |
| 63 | - arr_nullable: list[int | None] | None = None | |
| 64 | - arr_one: list[int] | None = None | |
| 65 | - nullable: int | None = None | |
| 66 | 63 | optional: int | None = None |
| 64 | + nullable: int | None = None | |
| 65 | + arr_one: list[int] | None = None | |
| 66 | + arr_nullable: list[int | None] | None = None | |
| 67 | 67 | |
| 68 | 68 | @staticmethod |
| 69 | 69 | def from_dict(obj: Any) -> 'TopLevel': |
| @@ -71,24 +71,24 @@ class TopLevel: | ||
| 71 | 71 | one = int(from_str(obj.get("one"))) |
| 72 | 72 | union_with_int = from_union([from_int, lambda x: int(from_str(x))], obj.get("unionWithInt")) |
| 73 | 73 | union_with_int_and_enum = from_union([from_int, lambda x: from_union([UnionWithIntAndEnumEnum, lambda x: int(x)], from_str(x))], obj.get("unionWithIntAndEnum")) |
| 74 | - arr_nullable = from_union([lambda x: from_list(lambda x: from_union([from_none, lambda x: int(from_str(x))], x), x), from_none], obj.get("arrNullable")) | |
| 75 | - arr_one = from_union([lambda x: from_list(lambda x: int(from_str(x)), x), from_none], obj.get("arrOne")) | |
| 76 | - nullable = from_union([from_none, lambda x: int(from_str(x))], obj.get("nullable")) | |
| 77 | 74 | optional = from_union([from_none, lambda x: int(from_str(x))], obj.get("optional")) |
| 78 | - return TopLevel(one, union_with_int, union_with_int_and_enum, arr_nullable, arr_one, nullable, optional) | |
| 75 | + nullable = from_union([from_none, lambda x: int(from_str(x))], obj.get("nullable")) | |
| 76 | + arr_one = from_union([lambda x: from_list(lambda x: int(from_str(x)), x), from_none], obj.get("arrOne")) | |
| 77 | + arr_nullable = from_union([lambda x: from_list(lambda x: from_union([from_none, lambda x: int(from_str(x))], x), x), from_none], obj.get("arrNullable")) | |
| 78 | + return TopLevel(one, union_with_int, union_with_int_and_enum, optional, nullable, arr_one, arr_nullable) | |
| 79 | 79 | |
| 80 | 80 | def to_dict(self) -> dict: |
| 81 | 81 | result: dict = {} |
| 82 | 82 | result["one"] = from_str(str(self.one)) |
| 83 | 83 | result["unionWithInt"] = from_int(self.union_with_int) |
| 84 | 84 | result["unionWithIntAndEnum"] = from_union([lambda x: from_int((lambda x: is_type(int, x))(x)), lambda x: from_str((lambda x: to_enum(UnionWithIntAndEnumEnum, (lambda x: is_type(UnionWithIntAndEnumEnum, x))(x)))(x))], self.union_with_int_and_enum) |
| 85 | - if self.arr_nullable is not None: | |
| 86 | - result["arrNullable"] = from_union([lambda x: from_list(lambda x: from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], x), x), from_none], self.arr_nullable) | |
| 87 | - if self.arr_one is not None: | |
| 88 | - result["arrOne"] = from_union([lambda x: from_list(lambda x: from_str((lambda x: str(x))(x)), x), from_none], self.arr_one) | |
| 89 | - result["nullable"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], self.nullable) | |
| 90 | 85 | if self.optional is not None: |
| 91 | 86 | result["optional"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], self.optional) |
| 87 | + result["nullable"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], self.nullable) | |
| 88 | + if self.arr_one is not None: | |
| 89 | + result["arrOne"] = from_union([lambda x: from_list(lambda x: from_str((lambda x: str(x))(x)), x), from_none], self.arr_one) | |
| 90 | + if self.arr_nullable is not None: | |
| 91 | + result["arrNullable"] = from_union([lambda x: from_list(lambda x: from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], x), x), from_none], self.arr_nullable) | |
| 92 | 92 | return result |
Mschema-rubydefault / TopLevel.rb+10 −10
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.arr_one&.first | |
| 7 | +# puts top_level.arr_nullable&.first.nil? | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -53,22 +53,22 @@ class UnionWithInt < Dry::Struct | ||
| 53 | 53 | end |
| 54 | 54 | |
| 55 | 55 | class TopLevel < Dry::Struct |
| 56 | - attribute :arr_nullable, Types.Array(Types::String.optional).optional | |
| 57 | - attribute :arr_one, Types.Array(Types::String).optional | |
| 58 | - attribute :nullable, Types::String.optional | |
| 59 | 56 | attribute :one, Types::String |
| 60 | 57 | attribute :top_level_optional, Types::String.optional |
| 58 | + attribute :nullable, Types::String.optional | |
| 59 | + attribute :arr_one, Types.Array(Types::String).optional | |
| 60 | + attribute :arr_nullable, Types.Array(Types::String.optional).optional | |
| 61 | 61 | attribute :union_with_int, Types.Instance(UnionWithInt) |
| 62 | 62 | attribute :union_with_int_and_enum, Types.Instance(UnionWithInt) |
| 63 | 63 | |
| 64 | 64 | def self.from_dynamic!(d) |
| 65 | 65 | d = Types::Hash[d] |
| 66 | 66 | new( |
| 67 | - arr_nullable: d["arrNullable"], | |
| 68 | - arr_one: d["arrOne"], | |
| 69 | - nullable: d.fetch("nullable"), | |
| 70 | 67 | one: d.fetch("one"), |
| 71 | 68 | top_level_optional: d["optional"], |
| 69 | + nullable: d.fetch("nullable"), | |
| 70 | + arr_one: d["arrOne"], | |
| 71 | + arr_nullable: d["arrNullable"], | |
| 72 | 72 | union_with_int: UnionWithInt.from_dynamic!(d.fetch("unionWithInt")), |
| 73 | 73 | union_with_int_and_enum: UnionWithInt.from_dynamic!(d.fetch("unionWithIntAndEnum")), |
| 74 | 74 | ) |
| @@ -80,11 +80,11 @@ class TopLevel < Dry::Struct | ||
| 80 | 80 | |
| 81 | 81 | def to_dynamic |
| 82 | 82 | { |
| 83 | - "arrNullable" => arr_nullable, | |
| 84 | - "arrOne" => arr_one, | |
| 85 | - "nullable" => nullable, | |
| 86 | 83 | "one" => one, |
| 87 | 84 | "optional" => top_level_optional, |
| 85 | + "nullable" => nullable, | |
| 86 | + "arrOne" => arr_one, | |
| 87 | + "arrNullable" => arr_nullable, | |
| 88 | 88 | "unionWithInt" => union_with_int.to_dynamic, |
| 89 | 89 | "unionWithIntAndEnum" => union_with_int_and_enum.to_dynamic, |
| 90 | 90 | } |
Mschema-rustdefault / module_under_test.rs+4 −4
| @@ -16,15 +16,15 @@ use serde::{Serialize, Deserialize}; | ||
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | #[serde(rename_all = "camelCase")] |
| 18 | 18 | pub struct TopLevel { |
| 19 | - pub arr_nullable: Option<Vec<Option<String>>>, | |
| 19 | + pub one: String, | |
| 20 | 20 | |
| 21 | - pub arr_one: Option<Vec<String>>, | |
| 21 | + pub optional: Option<String>, | |
| 22 | 22 | |
| 23 | 23 | pub nullable: Option<String>, |
| 24 | 24 | |
| 25 | - pub one: String, | |
| 25 | + pub arr_one: Option<Vec<String>>, | |
| 26 | 26 | |
| 27 | - pub optional: Option<String>, | |
| 27 | + pub arr_nullable: Option<Vec<Option<String>>>, | |
| 28 | 28 | |
| 29 | 29 | pub union_with_int: UnionWithInt, |
Mschema-scala3-upickledefault / TopLevel.scala+3 −3
| @@ -66,11 +66,11 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val arrNullable : Option[Seq[Option[String]]] = None, | |
| 70 | - val arrOne : Option[Seq[String]] = None, | |
| 71 | - val nullable : Option[String] = None, | |
| 72 | 69 | val one : String, |
| 73 | 70 | val optional : Option[String] = None, |
| 71 | + val nullable : Option[String] = None, | |
| 72 | + val arrOne : Option[Seq[String]] = None, | |
| 73 | + val arrNullable : Option[Seq[Option[String]]] = None, | |
| 74 | 74 | val unionWithInt : UnionWithInt, |
| 75 | 75 | val unionWithIntAndEnum : UnionWithInt |
| 76 | 76 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+3 −3
| @@ -8,11 +8,11 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val arrNullable : Option[Seq[Option[String]]] = None, | |
| 12 | - val arrOne : Option[Seq[String]] = None, | |
| 13 | - val nullable : Option[String] = None, | |
| 14 | 11 | val one : String, |
| 15 | 12 | val optional : Option[String] = None, |
| 13 | + val nullable : Option[String] = None, | |
| 14 | + val arrOne : Option[Seq[String]] = None, | |
| 15 | + val arrNullable : Option[Seq[Option[String]]] = None, | |
| 16 | 16 | val unionWithInt : UnionWithInt, |
| 17 | 17 | val unionWithIntAndEnum : UnionWithInt |
| 18 | 18 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+25 −25
| @@ -6,26 +6,13 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": {}, |
| 8 | 8 | "properties": { |
| 9 | - "arrNullable": { | |
| 10 | - "type": "array", | |
| 11 | - "items": { | |
| 12 | - "anyOf": [ | |
| 13 | - { | |
| 14 | - "type": "string", | |
| 15 | - "format": "integer" | |
| 16 | - }, | |
| 17 | - { | |
| 18 | - "type": "null" | |
| 19 | - } | |
| 20 | - ] | |
| 21 | - } | |
| 9 | + "one": { | |
| 10 | + "type": "string", | |
| 11 | + "format": "integer" | |
| 22 | 12 | }, |
| 23 | - "arrOne": { | |
| 24 | - "type": "array", | |
| 25 | - "items": { | |
| 26 | - "type": "string", | |
| 27 | - "format": "integer" | |
| 28 | - } | |
| 13 | + "optional": { | |
| 14 | + "type": "string", | |
| 15 | + "format": "integer" | |
| 29 | 16 | }, |
| 30 | 17 | "nullable": { |
| 31 | 18 | "anyOf": [ |
| @@ -38,13 +25,26 @@ | ||
| 38 | 25 | } |
| 39 | 26 | ] |
| 40 | 27 | }, |
| 41 | - "one": { | |
| 42 | - "type": "string", | |
| 43 | - "format": "integer" | |
| 28 | + "arrOne": { | |
| 29 | + "type": "array", | |
| 30 | + "items": { | |
| 31 | + "type": "string", | |
| 32 | + "format": "integer" | |
| 33 | + } | |
| 44 | 34 | }, |
| 45 | - "optional": { | |
| 46 | - "type": "string", | |
| 47 | - "format": "integer" | |
| 35 | + "arrNullable": { | |
| 36 | + "type": "array", | |
| 37 | + "items": { | |
| 38 | + "anyOf": [ | |
| 39 | + { | |
| 40 | + "type": "string", | |
| 41 | + "format": "integer" | |
| 42 | + }, | |
| 43 | + { | |
| 44 | + "type": "null" | |
| 45 | + } | |
| 46 | + ] | |
| 47 | + } | |
| 48 | 48 | }, |
| 49 | 49 | "unionWithInt": { |
| 50 | 50 | "$ref": "#/definitions/UnionWithInt" |
Mschema-swiftdefault / quicktype.swift+12 −12
| @@ -7,20 +7,20 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | - let arrNullable: [String?]? | |
| 11 | - let arrOne: [String]? | |
| 12 | - let nullable: String? | |
| 13 | 10 | let one: String |
| 14 | 11 | let topLevelOptional: String? |
| 12 | + let nullable: String? | |
| 13 | + let arrOne: [String]? | |
| 14 | + let arrNullable: [String?]? | |
| 15 | 15 | let unionWithInt: UnionWithInt |
| 16 | 16 | let unionWithIntAndEnum: UnionWithInt |
| 17 | 17 | |
| 18 | 18 | enum CodingKeys: String, CodingKey { |
| 19 | - case arrNullable = "arrNullable" | |
| 20 | - case arrOne = "arrOne" | |
| 21 | - case nullable = "nullable" | |
| 22 | 19 | case one = "one" |
| 23 | 20 | case topLevelOptional = "optional" |
| 21 | + case nullable = "nullable" | |
| 22 | + case arrOne = "arrOne" | |
| 23 | + case arrNullable = "arrNullable" | |
| 24 | 24 | case unionWithInt = "unionWithInt" |
| 25 | 25 | case unionWithIntAndEnum = "unionWithIntAndEnum" |
| 26 | 26 | } |
| @@ -45,20 +45,20 @@ extension TopLevel { | ||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | func with( |
| 48 | - arrNullable: [String?]?? = nil, | |
| 49 | - arrOne: [String]?? = nil, | |
| 50 | - nullable: String?? = nil, | |
| 51 | 48 | one: String? = nil, |
| 52 | 49 | topLevelOptional: String?? = nil, |
| 50 | + nullable: String?? = nil, | |
| 51 | + arrOne: [String]?? = nil, | |
| 52 | + arrNullable: [String?]?? = nil, | |
| 53 | 53 | unionWithInt: UnionWithInt? = nil, |
| 54 | 54 | unionWithIntAndEnum: UnionWithInt? = nil |
| 55 | 55 | ) -> TopLevel { |
| 56 | 56 | return TopLevel( |
| 57 | - arrNullable: arrNullable ?? self.arrNullable, | |
| 58 | - arrOne: arrOne ?? self.arrOne, | |
| 59 | - nullable: nullable ?? self.nullable, | |
| 60 | 57 | one: one ?? self.one, |
| 61 | 58 | topLevelOptional: topLevelOptional ?? self.topLevelOptional, |
| 59 | + nullable: nullable ?? self.nullable, | |
| 60 | + arrOne: arrOne ?? self.arrOne, | |
| 61 | + arrNullable: arrNullable ?? self.arrNullable, | |
| 62 | 62 | unionWithInt: unionWithInt ?? self.unionWithInt, |
| 63 | 63 | unionWithIntAndEnum: unionWithIntAndEnum ?? self.unionWithIntAndEnum |
| 64 | 64 | ) |
Mschema-typescript-zoddefault / TopLevel.ts+3 −3
| @@ -2,11 +2,11 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "arrNullable": z.array(z.union([z.null(), z.string()])).optional(), | |
| 6 | - "arrOne": z.array(z.string()).optional(), | |
| 7 | - "nullable": z.union([z.null(), z.string()]), | |
| 8 | 5 | "one": z.string(), |
| 9 | 6 | "optional": z.string().optional(), |
| 7 | + "nullable": z.union([z.null(), z.string()]), | |
| 8 | + "arrOne": z.array(z.string()).optional(), | |
| 9 | + "arrNullable": z.array(z.union([z.null(), z.string()])).optional(), | |
| 10 | 10 | "unionWithInt": z.union([z.number(), z.string()]), |
| 11 | 11 | "unionWithIntAndEnum": z.union([z.number(), z.string()]), |
| 12 | 12 | }); |
Mschema-typescriptdefault / TopLevel.ts+6 −6
| @@ -8,11 +8,11 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - arrNullable?: (null | string)[]; | |
| 12 | - arrOne?: string[]; | |
| 13 | - nullable: null | string; | |
| 14 | 11 | one: string; |
| 15 | 12 | optional?: string; |
| 13 | + nullable: null | string; | |
| 14 | + arrOne?: string[]; | |
| 15 | + arrNullable?: (null | string)[]; | |
| 16 | 16 | unionWithInt: UnionWithInt; |
| 17 | 17 | unionWithIntAndEnum: UnionWithInt; |
| 18 | 18 | [property: string]: unknown; |
| @@ -187,11 +187,11 @@ function r(name: string) { | ||
| 187 | 187 | |
| 188 | 188 | const typeMap: any = { |
| 189 | 189 | "TopLevel": o([ |
| 190 | - { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 191 | - { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 192 | - { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 193 | 190 | { json: "one", js: "one", typ: "" }, |
| 194 | 191 | { json: "optional", js: "optional", typ: u(undefined, "") }, |
| 192 | + { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 193 | + { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 194 | + { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 195 | 195 | { json: "unionWithInt", js: "unionWithInt", typ: u(0, "") }, |
| 196 | 196 | { json: "unionWithIntAndEnum", js: "unionWithIntAndEnum", typ: u(0, "") }, |
| 197 | 197 | ], "any"), |
Test case
32 generated files · +584 −584test/inputs/schema/integer-type.schema
Mschema-cjsondefault / TopLevel.c+18 −18
| @@ -22,33 +22,33 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 22 | 22 | if (NULL != j) { |
| 23 | 23 | if (NULL != (x = cJSON_malloc(sizeof(struct TopLevel)))) { |
| 24 | 24 | memset(x, 0, sizeof(struct TopLevel)); |
| 25 | - if (cJSON_HasObjectItem(j, "above_i32_max")) { | |
| 26 | - x->above_i32_max = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "above_i32_max")); | |
| 25 | + if (cJSON_HasObjectItem(j, "small_positive")) { | |
| 26 | + x->small_positive = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "small_positive")); | |
| 27 | 27 | } |
| 28 | - if (cJSON_HasObjectItem(j, "below_i32_min")) { | |
| 29 | - x->below_i32_min = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "below_i32_min")); | |
| 28 | + if (cJSON_HasObjectItem(j, "small_negative")) { | |
| 29 | + x->small_negative = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "small_negative")); | |
| 30 | 30 | } |
| 31 | 31 | if (cJSON_HasObjectItem(j, "i32_range")) { |
| 32 | 32 | x->i32_range = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "i32_range")); |
| 33 | 33 | } |
| 34 | - if (cJSON_HasObjectItem(j, "large_bounds")) { | |
| 35 | - x->large_bounds = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "large_bounds")); | |
| 34 | + if (cJSON_HasObjectItem(j, "above_i32_max")) { | |
| 35 | + x->above_i32_max = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "above_i32_max")); | |
| 36 | 36 | } |
| 37 | - if (cJSON_HasObjectItem(j, "only_maximum")) { | |
| 38 | - x->only_maximum = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "only_maximum")); | |
| 37 | + if (cJSON_HasObjectItem(j, "below_i32_min")) { | |
| 38 | + x->below_i32_min = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "below_i32_min")); | |
| 39 | 39 | } |
| 40 | 40 | if (cJSON_HasObjectItem(j, "only_minimum")) { |
| 41 | 41 | x->only_minimum = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "only_minimum")); |
| 42 | 42 | } |
| 43 | - if (cJSON_HasObjectItem(j, "small_negative")) { | |
| 44 | - x->small_negative = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "small_negative")); | |
| 45 | - } | |
| 46 | - if (cJSON_HasObjectItem(j, "small_positive")) { | |
| 47 | - x->small_positive = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "small_positive")); | |
| 43 | + if (cJSON_HasObjectItem(j, "only_maximum")) { | |
| 44 | + x->only_maximum = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "only_maximum")); | |
| 48 | 45 | } |
| 49 | 46 | if (cJSON_HasObjectItem(j, "unbounded")) { |
| 50 | 47 | x->unbounded = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "unbounded")); |
| 51 | 48 | } |
| 49 | + if (cJSON_HasObjectItem(j, "large_bounds")) { | |
| 50 | + x->large_bounds = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "large_bounds")); | |
| 51 | + } | |
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | return x; |
| @@ -58,15 +58,15 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 58 | 58 | cJSON * j = NULL; |
| 59 | 59 | if (NULL != x) { |
| 60 | 60 | if (NULL != (j = cJSON_CreateObject())) { |
| 61 | + cJSON_AddNumberToObject(j, "small_positive", x->small_positive); | |
| 62 | + cJSON_AddNumberToObject(j, "small_negative", x->small_negative); | |
| 63 | + cJSON_AddNumberToObject(j, "i32_range", x->i32_range); | |
| 61 | 64 | cJSON_AddNumberToObject(j, "above_i32_max", x->above_i32_max); |
| 62 | 65 | cJSON_AddNumberToObject(j, "below_i32_min", x->below_i32_min); |
| 63 | - cJSON_AddNumberToObject(j, "i32_range", x->i32_range); | |
| 64 | - cJSON_AddNumberToObject(j, "large_bounds", x->large_bounds); | |
| 65 | - cJSON_AddNumberToObject(j, "only_maximum", x->only_maximum); | |
| 66 | 66 | cJSON_AddNumberToObject(j, "only_minimum", x->only_minimum); |
| 67 | - cJSON_AddNumberToObject(j, "small_negative", x->small_negative); | |
| 68 | - cJSON_AddNumberToObject(j, "small_positive", x->small_positive); | |
| 67 | + cJSON_AddNumberToObject(j, "only_maximum", x->only_maximum); | |
| 69 | 68 | cJSON_AddNumberToObject(j, "unbounded", x->unbounded); |
| 69 | + cJSON_AddNumberToObject(j, "large_bounds", x->large_bounds); | |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | return j; |
Mschema-cjsondefault / TopLevel.h+5 −5
| @@ -35,15 +35,15 @@ extern "C" { | ||
| 35 | 35 | #endif |
| 36 | 36 | |
| 37 | 37 | struct TopLevel { |
| 38 | + int64_t small_positive; | |
| 39 | + int64_t small_negative; | |
| 40 | + int64_t i32_range; | |
| 38 | 41 | int64_t above_i32_max; |
| 39 | 42 | int64_t below_i32_min; |
| 40 | - int64_t i32_range; | |
| 41 | - int64_t large_bounds; | |
| 42 | - int64_t only_maximum; | |
| 43 | 43 | int64_t only_minimum; |
| 44 | - int64_t small_negative; | |
| 45 | - int64_t small_positive; | |
| 44 | + int64_t only_maximum; | |
| 46 | 45 | int64_t unbounded; |
| 46 | + int64_t large_bounds; | |
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | 49 | struct TopLevel * cJSON_ParseTopLevel(const char * s); |
Mschema-cplusplusdefault / quicktype.hpp+44 −44
| @@ -165,72 +165,72 @@ namespace quicktype { | ||
| 165 | 165 | class TopLevel { |
| 166 | 166 | public: |
| 167 | 167 | TopLevel() : |
| 168 | + small_positive_constraint(0, 100, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 169 | + small_negative_constraint(-100, 0, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 170 | + i32_range_constraint(-2147483648, 2147483647, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 168 | 171 | above_i32_max_constraint(0, 2147483648, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), |
| 169 | 172 | below_i32_min_constraint(-2147483649, 0, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), |
| 170 | - i32_range_constraint(-2147483648, 2147483647, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 171 | - large_bounds_constraint(-9007199254740991, 9007199254740991, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 172 | - only_maximum_constraint(std::nullopt, 0, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 173 | 173 | only_minimum_constraint(0, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), |
| 174 | - small_negative_constraint(-100, 0, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 175 | - small_positive_constraint(0, 100, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt) | |
| 174 | + only_maximum_constraint(std::nullopt, 0, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 175 | + large_bounds_constraint(-9007199254740991, 9007199254740991, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt) | |
| 176 | 176 | {} |
| 177 | 177 | virtual ~TopLevel() = default; |
| 178 | 178 | |
| 179 | 179 | private: |
| 180 | + int64_t small_positive; | |
| 181 | + ClassMemberConstraints small_positive_constraint; | |
| 182 | + int64_t small_negative; | |
| 183 | + ClassMemberConstraints small_negative_constraint; | |
| 184 | + int64_t i32_range; | |
| 185 | + ClassMemberConstraints i32_range_constraint; | |
| 180 | 186 | int64_t above_i32_max; |
| 181 | 187 | ClassMemberConstraints above_i32_max_constraint; |
| 182 | 188 | int64_t below_i32_min; |
| 183 | 189 | ClassMemberConstraints below_i32_min_constraint; |
| 184 | - int64_t i32_range; | |
| 185 | - ClassMemberConstraints i32_range_constraint; | |
| 186 | - int64_t large_bounds; | |
| 187 | - ClassMemberConstraints large_bounds_constraint; | |
| 188 | - int64_t only_maximum; | |
| 189 | - ClassMemberConstraints only_maximum_constraint; | |
| 190 | 190 | int64_t only_minimum; |
| 191 | 191 | ClassMemberConstraints only_minimum_constraint; |
| 192 | - int64_t small_negative; | |
| 193 | - ClassMemberConstraints small_negative_constraint; | |
| 194 | - int64_t small_positive; | |
| 195 | - ClassMemberConstraints small_positive_constraint; | |
| 192 | + int64_t only_maximum; | |
| 193 | + ClassMemberConstraints only_maximum_constraint; | |
| 196 | 194 | int64_t unbounded; |
| 195 | + int64_t large_bounds; | |
| 196 | + ClassMemberConstraints large_bounds_constraint; | |
| 197 | 197 | |
| 198 | 198 | public: |
| 199 | - const int64_t & get_above_i32_max() const { return above_i32_max; } | |
| 200 | - int64_t & get_mutable_above_i32_max() { return above_i32_max; } | |
| 201 | - void set_above_i32_max(const int64_t & value) { CheckConstraint("above_i32_max", above_i32_max_constraint, value); this->above_i32_max = value; } | |
| 199 | + const int64_t & get_small_positive() const { return small_positive; } | |
| 200 | + int64_t & get_mutable_small_positive() { return small_positive; } | |
| 201 | + void set_small_positive(const int64_t & value) { CheckConstraint("small_positive", small_positive_constraint, value); this->small_positive = value; } | |
| 202 | 202 | |
| 203 | - const int64_t & get_below_i32_min() const { return below_i32_min; } | |
| 204 | - int64_t & get_mutable_below_i32_min() { return below_i32_min; } | |
| 205 | - void set_below_i32_min(const int64_t & value) { CheckConstraint("below_i32_min", below_i32_min_constraint, value); this->below_i32_min = value; } | |
| 203 | + const int64_t & get_small_negative() const { return small_negative; } | |
| 204 | + int64_t & get_mutable_small_negative() { return small_negative; } | |
| 205 | + void set_small_negative(const int64_t & value) { CheckConstraint("small_negative", small_negative_constraint, value); this->small_negative = value; } | |
| 206 | 206 | |
| 207 | 207 | const int64_t & get_i32_range() const { return i32_range; } |
| 208 | 208 | int64_t & get_mutable_i32_range() { return i32_range; } |
| 209 | 209 | void set_i32_range(const int64_t & value) { CheckConstraint("i32_range", i32_range_constraint, value); this->i32_range = value; } |
| 210 | 210 | |
| 211 | - const int64_t & get_large_bounds() const { return large_bounds; } | |
| 212 | - int64_t & get_mutable_large_bounds() { return large_bounds; } | |
| 213 | - void set_large_bounds(const int64_t & value) { CheckConstraint("large_bounds", large_bounds_constraint, value); this->large_bounds = value; } | |
| 211 | + const int64_t & get_above_i32_max() const { return above_i32_max; } | |
| 212 | + int64_t & get_mutable_above_i32_max() { return above_i32_max; } | |
| 213 | + void set_above_i32_max(const int64_t & value) { CheckConstraint("above_i32_max", above_i32_max_constraint, value); this->above_i32_max = value; } | |
| 214 | 214 | |
| 215 | - const int64_t & get_only_maximum() const { return only_maximum; } | |
| 216 | - int64_t & get_mutable_only_maximum() { return only_maximum; } | |
| 217 | - void set_only_maximum(const int64_t & value) { CheckConstraint("only_maximum", only_maximum_constraint, value); this->only_maximum = value; } | |
| 215 | + const int64_t & get_below_i32_min() const { return below_i32_min; } | |
| 216 | + int64_t & get_mutable_below_i32_min() { return below_i32_min; } | |
| 217 | + void set_below_i32_min(const int64_t & value) { CheckConstraint("below_i32_min", below_i32_min_constraint, value); this->below_i32_min = value; } | |
| 218 | 218 | |
| 219 | 219 | const int64_t & get_only_minimum() const { return only_minimum; } |
| 220 | 220 | int64_t & get_mutable_only_minimum() { return only_minimum; } |
| 221 | 221 | void set_only_minimum(const int64_t & value) { CheckConstraint("only_minimum", only_minimum_constraint, value); this->only_minimum = value; } |
| 222 | 222 | |
| 223 | - const int64_t & get_small_negative() const { return small_negative; } | |
| 224 | - int64_t & get_mutable_small_negative() { return small_negative; } | |
| 225 | - void set_small_negative(const int64_t & value) { CheckConstraint("small_negative", small_negative_constraint, value); this->small_negative = value; } | |
| 226 | - | |
| 227 | - const int64_t & get_small_positive() const { return small_positive; } | |
| 228 | - int64_t & get_mutable_small_positive() { return small_positive; } | |
| 229 | - void set_small_positive(const int64_t & value) { CheckConstraint("small_positive", small_positive_constraint, value); this->small_positive = value; } | |
| 223 | + const int64_t & get_only_maximum() const { return only_maximum; } | |
| 224 | + int64_t & get_mutable_only_maximum() { return only_maximum; } | |
| 225 | + void set_only_maximum(const int64_t & value) { CheckConstraint("only_maximum", only_maximum_constraint, value); this->only_maximum = value; } | |
| 230 | 226 | |
| 231 | 227 | const int64_t & get_unbounded() const { return unbounded; } |
| 232 | 228 | int64_t & get_mutable_unbounded() { return unbounded; } |
| 233 | 229 | void set_unbounded(const int64_t & value) { this->unbounded = value; } |
| 230 | + | |
| 231 | + const int64_t & get_large_bounds() const { return large_bounds; } | |
| 232 | + int64_t & get_mutable_large_bounds() { return large_bounds; } | |
| 233 | + void set_large_bounds(const int64_t & value) { CheckConstraint("large_bounds", large_bounds_constraint, value); this->large_bounds = value; } | |
| 234 | 234 | }; |
| 235 | 235 | } |
| 236 | 236 | |
| @@ -239,27 +239,27 @@ namespace quicktype { | ||
| 239 | 239 | void to_json(json & j, const TopLevel & x); |
| 240 | 240 | |
| 241 | 241 | inline void from_json(const json & j, TopLevel& x) { |
| 242 | + x.set_small_positive(j.at("small_positive").get<int64_t>()); | |
| 243 | + x.set_small_negative(j.at("small_negative").get<int64_t>()); | |
| 244 | + x.set_i32_range(j.at("i32_range").get<int64_t>()); | |
| 242 | 245 | x.set_above_i32_max(j.at("above_i32_max").get<int64_t>()); |
| 243 | 246 | x.set_below_i32_min(j.at("below_i32_min").get<int64_t>()); |
| 244 | - x.set_i32_range(j.at("i32_range").get<int64_t>()); | |
| 245 | - x.set_large_bounds(j.at("large_bounds").get<int64_t>()); | |
| 246 | - x.set_only_maximum(j.at("only_maximum").get<int64_t>()); | |
| 247 | 247 | x.set_only_minimum(j.at("only_minimum").get<int64_t>()); |
| 248 | - x.set_small_negative(j.at("small_negative").get<int64_t>()); | |
| 249 | - x.set_small_positive(j.at("small_positive").get<int64_t>()); | |
| 248 | + x.set_only_maximum(j.at("only_maximum").get<int64_t>()); | |
| 250 | 249 | x.set_unbounded(j.at("unbounded").get<int64_t>()); |
| 250 | + x.set_large_bounds(j.at("large_bounds").get<int64_t>()); | |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | inline void to_json(json & j, const TopLevel & x) { |
| 254 | 254 | j = json::object(); |
| 255 | + j["small_positive"] = x.get_small_positive(); | |
| 256 | + j["small_negative"] = x.get_small_negative(); | |
| 257 | + j["i32_range"] = x.get_i32_range(); | |
| 255 | 258 | j["above_i32_max"] = x.get_above_i32_max(); |
| 256 | 259 | j["below_i32_min"] = x.get_below_i32_min(); |
| 257 | - j["i32_range"] = x.get_i32_range(); | |
| 258 | - j["large_bounds"] = x.get_large_bounds(); | |
| 259 | - j["only_maximum"] = x.get_only_maximum(); | |
| 260 | 260 | j["only_minimum"] = x.get_only_minimum(); |
| 261 | - j["small_negative"] = x.get_small_negative(); | |
| 262 | - j["small_positive"] = x.get_small_positive(); | |
| 261 | + j["only_maximum"] = x.get_only_maximum(); | |
| 263 | 262 | j["unbounded"] = x.get_unbounded(); |
| 263 | + j["large_bounds"] = x.get_large_bounds(); | |
| 264 | 264 | } |
| 265 | 265 | } |
Mschema-csharp-recordsdefault / QuickType.cs+13 −13
| @@ -25,32 +25,32 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("above_i32_max", Required = Required.Always)] | |
| 29 | - public long AboveI32Max { get; set; } | |
| 28 | + [JsonProperty("small_positive", Required = Required.Always)] | |
| 29 | + public long SmallPositive { get; set; } | |
| 30 | 30 | |
| 31 | - [JsonProperty("below_i32_min", Required = Required.Always)] | |
| 32 | - public long BelowI32Min { get; set; } | |
| 31 | + [JsonProperty("small_negative", Required = Required.Always)] | |
| 32 | + public long SmallNegative { get; set; } | |
| 33 | 33 | |
| 34 | 34 | [JsonProperty("i32_range", Required = Required.Always)] |
| 35 | 35 | public long I32Range { get; set; } |
| 36 | 36 | |
| 37 | - [JsonProperty("large_bounds", Required = Required.Always)] | |
| 38 | - public long LargeBounds { get; set; } | |
| 37 | + [JsonProperty("above_i32_max", Required = Required.Always)] | |
| 38 | + public long AboveI32Max { get; set; } | |
| 39 | 39 | |
| 40 | - [JsonProperty("only_maximum", Required = Required.Always)] | |
| 41 | - public long OnlyMaximum { get; set; } | |
| 40 | + [JsonProperty("below_i32_min", Required = Required.Always)] | |
| 41 | + public long BelowI32Min { get; set; } | |
| 42 | 42 | |
| 43 | 43 | [JsonProperty("only_minimum", Required = Required.Always)] |
| 44 | 44 | public long OnlyMinimum { get; set; } |
| 45 | 45 | |
| 46 | - [JsonProperty("small_negative", Required = Required.Always)] | |
| 47 | - public long SmallNegative { get; set; } | |
| 48 | - | |
| 49 | - [JsonProperty("small_positive", Required = Required.Always)] | |
| 50 | - public long SmallPositive { get; set; } | |
| 46 | + [JsonProperty("only_maximum", Required = Required.Always)] | |
| 47 | + public long OnlyMaximum { get; set; } | |
| 51 | 48 | |
| 52 | 49 | [JsonProperty("unbounded", Required = Required.Always)] |
| 53 | 50 | public long Unbounded { get; set; } |
| 51 | + | |
| 52 | + [JsonProperty("large_bounds", Required = Required.Always)] | |
| 53 | + public long LargeBounds { get; set; } | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public partial record TopLevel |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+14 −14
| @@ -23,40 +23,40 @@ namespace QuickType | ||
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | 25 | [JsonRequired] |
| 26 | - [JsonPropertyName("above_i32_max")] | |
| 27 | - public long AboveI32Max { get; set; } | |
| 26 | + [JsonPropertyName("small_positive")] | |
| 27 | + public long SmallPositive { get; set; } | |
| 28 | 28 | |
| 29 | 29 | [JsonRequired] |
| 30 | - [JsonPropertyName("below_i32_min")] | |
| 31 | - public long BelowI32Min { get; set; } | |
| 30 | + [JsonPropertyName("small_negative")] | |
| 31 | + public long SmallNegative { get; set; } | |
| 32 | 32 | |
| 33 | 33 | [JsonRequired] |
| 34 | 34 | [JsonPropertyName("i32_range")] |
| 35 | 35 | public long I32Range { get; set; } |
| 36 | 36 | |
| 37 | 37 | [JsonRequired] |
| 38 | - [JsonPropertyName("large_bounds")] | |
| 39 | - public long LargeBounds { get; set; } | |
| 38 | + [JsonPropertyName("above_i32_max")] | |
| 39 | + public long AboveI32Max { get; set; } | |
| 40 | 40 | |
| 41 | 41 | [JsonRequired] |
| 42 | - [JsonPropertyName("only_maximum")] | |
| 43 | - public long OnlyMaximum { get; set; } | |
| 42 | + [JsonPropertyName("below_i32_min")] | |
| 43 | + public long BelowI32Min { get; set; } | |
| 44 | 44 | |
| 45 | 45 | [JsonRequired] |
| 46 | 46 | [JsonPropertyName("only_minimum")] |
| 47 | 47 | public long OnlyMinimum { get; set; } |
| 48 | 48 | |
| 49 | 49 | [JsonRequired] |
| 50 | - [JsonPropertyName("small_negative")] | |
| 51 | - public long SmallNegative { get; set; } | |
| 52 | - | |
| 53 | - [JsonRequired] | |
| 54 | - [JsonPropertyName("small_positive")] | |
| 55 | - public long SmallPositive { get; set; } | |
| 50 | + [JsonPropertyName("only_maximum")] | |
| 51 | + public long OnlyMaximum { get; set; } | |
| 56 | 52 | |
| 57 | 53 | [JsonRequired] |
| 58 | 54 | [JsonPropertyName("unbounded")] |
| 59 | 55 | public long Unbounded { get; set; } |
| 56 | + | |
| 57 | + [JsonRequired] | |
| 58 | + [JsonPropertyName("large_bounds")] | |
| 59 | + public long LargeBounds { get; set; } | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public partial class TopLevel |
Mschema-csharpdefault / QuickType.cs+13 −13
| @@ -25,32 +25,32 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("above_i32_max", Required = Required.Always)] | |
| 29 | - public long AboveI32Max { get; set; } | |
| 28 | + [JsonProperty("small_positive", Required = Required.Always)] | |
| 29 | + public long SmallPositive { get; set; } | |
| 30 | 30 | |
| 31 | - [JsonProperty("below_i32_min", Required = Required.Always)] | |
| 32 | - public long BelowI32Min { get; set; } | |
| 31 | + [JsonProperty("small_negative", Required = Required.Always)] | |
| 32 | + public long SmallNegative { get; set; } | |
| 33 | 33 | |
| 34 | 34 | [JsonProperty("i32_range", Required = Required.Always)] |
| 35 | 35 | public long I32Range { get; set; } |
| 36 | 36 | |
| 37 | - [JsonProperty("large_bounds", Required = Required.Always)] | |
| 38 | - public long LargeBounds { get; set; } | |
| 37 | + [JsonProperty("above_i32_max", Required = Required.Always)] | |
| 38 | + public long AboveI32Max { get; set; } | |
| 39 | 39 | |
| 40 | - [JsonProperty("only_maximum", Required = Required.Always)] | |
| 41 | - public long OnlyMaximum { get; set; } | |
| 40 | + [JsonProperty("below_i32_min", Required = Required.Always)] | |
| 41 | + public long BelowI32Min { get; set; } | |
| 42 | 42 | |
| 43 | 43 | [JsonProperty("only_minimum", Required = Required.Always)] |
| 44 | 44 | public long OnlyMinimum { get; set; } |
| 45 | 45 | |
| 46 | - [JsonProperty("small_negative", Required = Required.Always)] | |
| 47 | - public long SmallNegative { get; set; } | |
| 48 | - | |
| 49 | - [JsonProperty("small_positive", Required = Required.Always)] | |
| 50 | - public long SmallPositive { get; set; } | |
| 46 | + [JsonProperty("only_maximum", Required = Required.Always)] | |
| 47 | + public long OnlyMaximum { get; set; } | |
| 51 | 48 | |
| 52 | 49 | [JsonProperty("unbounded", Required = Required.Always)] |
| 53 | 50 | public long Unbounded { get; set; } |
| 51 | + | |
| 52 | + [JsonProperty("large_bounds", Required = Required.Always)] | |
| 53 | + public long LargeBounds { get; set; } | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public partial class TopLevel |
Mschema-dartdefault / TopLevel.dart+20 −20
| @@ -9,49 +9,49 @@ TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | ||
| 9 | 9 | String topLevelToJson(TopLevel data) => json.encode(data.toJson()); |
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | + final int smallPositive; | |
| 13 | + final int smallNegative; | |
| 14 | + final int i32Range; | |
| 12 | 15 | final int aboveI32Max; |
| 13 | 16 | final int belowI32Min; |
| 14 | - final int i32Range; | |
| 15 | - final int largeBounds; | |
| 16 | - final int onlyMaximum; | |
| 17 | 17 | final int onlyMinimum; |
| 18 | - final int smallNegative; | |
| 19 | - final int smallPositive; | |
| 18 | + final int onlyMaximum; | |
| 20 | 19 | final int unbounded; |
| 20 | + final int largeBounds; | |
| 21 | 21 | |
| 22 | 22 | TopLevel({ |
| 23 | + required this.smallPositive, | |
| 24 | + required this.smallNegative, | |
| 25 | + required this.i32Range, | |
| 23 | 26 | required this.aboveI32Max, |
| 24 | 27 | required this.belowI32Min, |
| 25 | - required this.i32Range, | |
| 26 | - required this.largeBounds, | |
| 27 | - required this.onlyMaximum, | |
| 28 | 28 | required this.onlyMinimum, |
| 29 | - required this.smallNegative, | |
| 30 | - required this.smallPositive, | |
| 29 | + required this.onlyMaximum, | |
| 31 | 30 | required this.unbounded, |
| 31 | + required this.largeBounds, | |
| 32 | 32 | }); |
| 33 | 33 | |
| 34 | 34 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 35 | + smallPositive: json["small_positive"], | |
| 36 | + smallNegative: json["small_negative"], | |
| 37 | + i32Range: json["i32_range"], | |
| 35 | 38 | aboveI32Max: json["above_i32_max"], |
| 36 | 39 | belowI32Min: json["below_i32_min"], |
| 37 | - i32Range: json["i32_range"], | |
| 38 | - largeBounds: json["large_bounds"], | |
| 39 | - onlyMaximum: json["only_maximum"], | |
| 40 | 40 | onlyMinimum: json["only_minimum"], |
| 41 | - smallNegative: json["small_negative"], | |
| 42 | - smallPositive: json["small_positive"], | |
| 41 | + onlyMaximum: json["only_maximum"], | |
| 43 | 42 | unbounded: json["unbounded"], |
| 43 | + largeBounds: json["large_bounds"], | |
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | 46 | Map<String, dynamic> toJson() => { |
| 47 | + "small_positive": smallPositive, | |
| 48 | + "small_negative": smallNegative, | |
| 49 | + "i32_range": i32Range, | |
| 47 | 50 | "above_i32_max": aboveI32Max, |
| 48 | 51 | "below_i32_min": belowI32Min, |
| 49 | - "i32_range": i32Range, | |
| 50 | - "large_bounds": largeBounds, | |
| 51 | - "only_maximum": onlyMaximum, | |
| 52 | 52 | "only_minimum": onlyMinimum, |
| 53 | - "small_negative": smallNegative, | |
| 54 | - "small_positive": smallPositive, | |
| 53 | + "only_maximum": onlyMaximum, | |
| 55 | 54 | "unbounded": unbounded, |
| 55 | + "large_bounds": largeBounds, | |
| 56 | 56 | }; |
| 57 | 57 | } |
Mschema-elixirdefault / QuickType.ex+18 −18
| @@ -6,32 +6,32 @@ | ||
| 6 | 6 | # Encode into a JSON string: TopLevel.to_json(struct) |
| 7 | 7 | |
| 8 | 8 | defmodule TopLevel do |
| 9 | - @enforce_keys [:above_i32_max, :below_i32_min, :i32_range, :large_bounds, :only_maximum, :only_minimum, :small_negative, :small_positive, :unbounded] | |
| 10 | - defstruct [:above_i32_max, :below_i32_min, :i32_range, :large_bounds, :only_maximum, :only_minimum, :small_negative, :small_positive, :unbounded] | |
| 9 | + @enforce_keys [:small_positive, :small_negative, :i32_range, :above_i32_max, :below_i32_min, :only_minimum, :only_maximum, :unbounded, :large_bounds] | |
| 10 | + defstruct [:small_positive, :small_negative, :i32_range, :above_i32_max, :below_i32_min, :only_minimum, :only_maximum, :unbounded, :large_bounds] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | + small_positive: integer(), | |
| 14 | + small_negative: integer(), | |
| 15 | + i32_range: integer(), | |
| 13 | 16 | above_i32_max: integer(), |
| 14 | 17 | below_i32_min: integer(), |
| 15 | - i32_range: integer(), | |
| 16 | - large_bounds: integer(), | |
| 17 | - only_maximum: integer(), | |
| 18 | 18 | only_minimum: integer(), |
| 19 | - small_negative: integer(), | |
| 20 | - small_positive: integer(), | |
| 21 | - unbounded: integer() | |
| 19 | + only_maximum: integer(), | |
| 20 | + unbounded: integer(), | |
| 21 | + large_bounds: integer() | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | def from_map(m) do |
| 25 | 25 | %TopLevel{ |
| 26 | + small_positive: m["small_positive"], | |
| 27 | + small_negative: m["small_negative"], | |
| 28 | + i32_range: m["i32_range"], | |
| 26 | 29 | above_i32_max: m["above_i32_max"], |
| 27 | 30 | below_i32_min: m["below_i32_min"], |
| 28 | - i32_range: m["i32_range"], | |
| 29 | - large_bounds: m["large_bounds"], | |
| 30 | - only_maximum: m["only_maximum"], | |
| 31 | 31 | only_minimum: m["only_minimum"], |
| 32 | - small_negative: m["small_negative"], | |
| 33 | - small_positive: m["small_positive"], | |
| 32 | + only_maximum: m["only_maximum"], | |
| 34 | 33 | unbounded: m["unbounded"], |
| 34 | + large_bounds: m["large_bounds"], | |
| 35 | 35 | } |
| 36 | 36 | end |
| 37 | 37 | |
| @@ -43,15 +43,15 @@ defmodule TopLevel do | ||
| 43 | 43 | |
| 44 | 44 | def to_map(struct) do |
| 45 | 45 | %{ |
| 46 | + "small_positive" => struct.small_positive, | |
| 47 | + "small_negative" => struct.small_negative, | |
| 48 | + "i32_range" => struct.i32_range, | |
| 46 | 49 | "above_i32_max" => struct.above_i32_max, |
| 47 | 50 | "below_i32_min" => struct.below_i32_min, |
| 48 | - "i32_range" => struct.i32_range, | |
| 49 | - "large_bounds" => struct.large_bounds, | |
| 50 | - "only_maximum" => struct.only_maximum, | |
| 51 | 51 | "only_minimum" => struct.only_minimum, |
| 52 | - "small_negative" => struct.small_negative, | |
| 53 | - "small_positive" => struct.small_positive, | |
| 52 | + "only_maximum" => struct.only_maximum, | |
| 54 | 53 | "unbounded" => struct.unbounded, |
| 54 | + "large_bounds" => struct.large_bounds, | |
| 55 | 55 | } |
| 56 | 56 | end |
Mschema-elmdefault / QuickType.elm+17 −17
| @@ -23,15 +23,15 @@ import Json.Encode as Jenc | ||
| 23 | 23 | import Dict exposing (Dict) |
| 24 | 24 | |
| 25 | 25 | type alias QuickType = |
| 26 | - { aboveI32Max : Int | |
| 27 | - , belowI32Min : Int | |
| 26 | + { smallPositive : Int | |
| 27 | + , smallNegative : Int | |
| 28 | 28 | , i32Range : Int |
| 29 | - , largeBounds : Int | |
| 30 | - , onlyMaximum : Int | |
| 29 | + , aboveI32Max : Int | |
| 30 | + , belowI32Min : Int | |
| 31 | 31 | , onlyMinimum : Int |
| 32 | - , smallNegative : Int | |
| 33 | - , smallPositive : Int | |
| 32 | + , onlyMaximum : Int | |
| 34 | 33 | , unbounded : Int |
| 34 | + , largeBounds : Int | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | -- decoders and encoders |
| @@ -42,28 +42,28 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 42 | 42 | quickType : Jdec.Decoder QuickType |
| 43 | 43 | quickType = |
| 44 | 44 | Jdec.succeed QuickType |
| 45 | + |> Jpipe.required "small_positive" Jdec.int | |
| 46 | + |> Jpipe.required "small_negative" Jdec.int | |
| 47 | + |> Jpipe.required "i32_range" Jdec.int | |
| 45 | 48 | |> Jpipe.required "above_i32_max" Jdec.int |
| 46 | 49 | |> Jpipe.required "below_i32_min" Jdec.int |
| 47 | - |> Jpipe.required "i32_range" Jdec.int | |
| 48 | - |> Jpipe.required "large_bounds" Jdec.int | |
| 49 | - |> Jpipe.required "only_maximum" Jdec.int | |
| 50 | 50 | |> Jpipe.required "only_minimum" Jdec.int |
| 51 | - |> Jpipe.required "small_negative" Jdec.int | |
| 52 | - |> Jpipe.required "small_positive" Jdec.int | |
| 51 | + |> Jpipe.required "only_maximum" Jdec.int | |
| 53 | 52 | |> Jpipe.required "unbounded" Jdec.int |
| 53 | + |> Jpipe.required "large_bounds" Jdec.int | |
| 54 | 54 | |
| 55 | 55 | encodeQuickType : QuickType -> Jenc.Value |
| 56 | 56 | encodeQuickType x = |
| 57 | 57 | Jenc.object |
| 58 | - [ ("above_i32_max", Jenc.int x.aboveI32Max) | |
| 59 | - , ("below_i32_min", Jenc.int x.belowI32Min) | |
| 58 | + [ ("small_positive", Jenc.int x.smallPositive) | |
| 59 | + , ("small_negative", Jenc.int x.smallNegative) | |
| 60 | 60 | , ("i32_range", Jenc.int x.i32Range) |
| 61 | - , ("large_bounds", Jenc.int x.largeBounds) | |
| 62 | - , ("only_maximum", Jenc.int x.onlyMaximum) | |
| 61 | + , ("above_i32_max", Jenc.int x.aboveI32Max) | |
| 62 | + , ("below_i32_min", Jenc.int x.belowI32Min) | |
| 63 | 63 | , ("only_minimum", Jenc.int x.onlyMinimum) |
| 64 | - , ("small_negative", Jenc.int x.smallNegative) | |
| 65 | - , ("small_positive", Jenc.int x.smallPositive) | |
| 64 | + , ("only_maximum", Jenc.int x.onlyMaximum) | |
| 66 | 65 | , ("unbounded", Jenc.int x.unbounded) |
| 66 | + , ("large_bounds", Jenc.int x.largeBounds) | |
| 67 | 67 | ] |
| 68 | 68 | |
| 69 | 69 | --- encoder helpers |
Mschema-flowdefault / TopLevel.js+10 −10
| @@ -10,15 +10,15 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | + small_positive: number; | |
| 14 | + small_negative: number; | |
| 15 | + i32_range: number; | |
| 13 | 16 | above_i32_max: number; |
| 14 | 17 | below_i32_min: number; |
| 15 | - i32_range: number; | |
| 16 | - large_bounds: number; | |
| 17 | - only_maximum: number; | |
| 18 | 18 | only_minimum: number; |
| 19 | - small_negative: number; | |
| 20 | - small_positive: number; | |
| 19 | + only_maximum: number; | |
| 21 | 20 | unbounded: number; |
| 21 | + large_bounds: number; | |
| 22 | 22 | [property: string]: mixed; |
| 23 | 23 | }; |
| 24 | 24 | |
| @@ -187,15 +187,15 @@ function r(name: string) { | ||
| 187 | 187 | |
| 188 | 188 | const typeMap: any = { |
| 189 | 189 | "TopLevel": o([ |
| 190 | + { json: "small_positive", js: "small_positive", typ: 0 }, | |
| 191 | + { json: "small_negative", js: "small_negative", typ: 0 }, | |
| 192 | + { json: "i32_range", js: "i32_range", typ: 0 }, | |
| 190 | 193 | { json: "above_i32_max", js: "above_i32_max", typ: 0 }, |
| 191 | 194 | { json: "below_i32_min", js: "below_i32_min", typ: 0 }, |
| 192 | - { json: "i32_range", js: "i32_range", typ: 0 }, | |
| 193 | - { json: "large_bounds", js: "large_bounds", typ: 0 }, | |
| 194 | - { json: "only_maximum", js: "only_maximum", typ: 0 }, | |
| 195 | 195 | { json: "only_minimum", js: "only_minimum", typ: 0 }, |
| 196 | - { json: "small_negative", js: "small_negative", typ: 0 }, | |
| 197 | - { json: "small_positive", js: "small_positive", typ: 0 }, | |
| 196 | + { json: "only_maximum", js: "only_maximum", typ: 0 }, | |
| 198 | 197 | { json: "unbounded", js: "unbounded", typ: 0 }, |
| 198 | + { json: "large_bounds", js: "large_bounds", typ: 0 }, | |
| 199 | 199 | ], "any"), |
| 200 | 200 | }; |
Mschema-golangdefault / quicktype.go+5 −5
| @@ -19,13 +19,13 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | type TopLevel struct { |
| 22 | + SmallPositive int64 `json:"small_positive"` | |
| 23 | + SmallNegative int64 `json:"small_negative"` | |
| 24 | + I32Range int64 `json:"i32_range"` | |
| 22 | 25 | AboveI32Max int64 `json:"above_i32_max"` |
| 23 | 26 | BelowI32Min int64 `json:"below_i32_min"` |
| 24 | - I32Range int64 `json:"i32_range"` | |
| 25 | - LargeBounds int64 `json:"large_bounds"` | |
| 26 | - OnlyMaximum int64 `json:"only_maximum"` | |
| 27 | 27 | OnlyMinimum int64 `json:"only_minimum"` |
| 28 | - SmallNegative int64 `json:"small_negative"` | |
| 29 | - SmallPositive int64 `json:"small_positive"` | |
| 28 | + OnlyMaximum int64 `json:"only_maximum"` | |
| 30 | 29 | Unbounded int64 `json:"unbounded"` |
| 30 | + LargeBounds int64 `json:"large_bounds"` | |
| 31 | 31 | } |
Mschema-haskelldefault / QuickType.hs+19 −19
| @@ -13,42 +13,42 @@ import Data.HashMap.Strict (HashMap) | ||
| 13 | 13 | import Data.Text (Text) |
| 14 | 14 | |
| 15 | 15 | data QuickType = QuickType |
| 16 | - { aboveI32MaxQuickType :: Int | |
| 17 | - , belowI32MinQuickType :: Int | |
| 16 | + { smallPositiveQuickType :: Int | |
| 17 | + , smallNegativeQuickType :: Int | |
| 18 | 18 | , i32RangeQuickType :: Int |
| 19 | - , largeBoundsQuickType :: Int | |
| 20 | - , onlyMaximumQuickType :: Int | |
| 19 | + , aboveI32MaxQuickType :: Int | |
| 20 | + , belowI32MinQuickType :: Int | |
| 21 | 21 | , onlyMinimumQuickType :: Int |
| 22 | - , smallNegativeQuickType :: Int | |
| 23 | - , smallPositiveQuickType :: Int | |
| 22 | + , onlyMaximumQuickType :: Int | |
| 24 | 23 | , unboundedQuickType :: Int |
| 24 | + , largeBoundsQuickType :: Int | |
| 25 | 25 | } deriving (Show) |
| 26 | 26 | |
| 27 | 27 | decodeTopLevel :: ByteString -> Maybe QuickType |
| 28 | 28 | decodeTopLevel = decode |
| 29 | 29 | |
| 30 | 30 | instance ToJSON QuickType where |
| 31 | - toJSON (QuickType aboveI32MaxQuickType belowI32MinQuickType i32RangeQuickType largeBoundsQuickType onlyMaximumQuickType onlyMinimumQuickType smallNegativeQuickType smallPositiveQuickType unboundedQuickType) = | |
| 31 | + toJSON (QuickType smallPositiveQuickType smallNegativeQuickType i32RangeQuickType aboveI32MaxQuickType belowI32MinQuickType onlyMinimumQuickType onlyMaximumQuickType unboundedQuickType largeBoundsQuickType) = | |
| 32 | 32 | object |
| 33 | - [ "above_i32_max" .= aboveI32MaxQuickType | |
| 34 | - , "below_i32_min" .= belowI32MinQuickType | |
| 33 | + [ "small_positive" .= smallPositiveQuickType | |
| 34 | + , "small_negative" .= smallNegativeQuickType | |
| 35 | 35 | , "i32_range" .= i32RangeQuickType |
| 36 | - , "large_bounds" .= largeBoundsQuickType | |
| 37 | - , "only_maximum" .= onlyMaximumQuickType | |
| 36 | + , "above_i32_max" .= aboveI32MaxQuickType | |
| 37 | + , "below_i32_min" .= belowI32MinQuickType | |
| 38 | 38 | , "only_minimum" .= onlyMinimumQuickType |
| 39 | - , "small_negative" .= smallNegativeQuickType | |
| 40 | - , "small_positive" .= smallPositiveQuickType | |
| 39 | + , "only_maximum" .= onlyMaximumQuickType | |
| 41 | 40 | , "unbounded" .= unboundedQuickType |
| 41 | + , "large_bounds" .= largeBoundsQuickType | |
| 42 | 42 | ] |
| 43 | 43 | |
| 44 | 44 | instance FromJSON QuickType where |
| 45 | 45 | parseJSON (Object v) = QuickType |
| 46 | - <$> v .: "above_i32_max" | |
| 47 | - <*> v .: "below_i32_min" | |
| 46 | + <$> v .: "small_positive" | |
| 47 | + <*> v .: "small_negative" | |
| 48 | 48 | <*> v .: "i32_range" |
| 49 | - <*> v .: "large_bounds" | |
| 50 | - <*> v .: "only_maximum" | |
| 49 | + <*> v .: "above_i32_max" | |
| 50 | + <*> v .: "below_i32_min" | |
| 51 | 51 | <*> v .: "only_minimum" |
| 52 | - <*> v .: "small_negative" | |
| 53 | - <*> v .: "small_positive" | |
| 52 | + <*> v .: "only_maximum" | |
| 54 | 53 | <*> v .: "unbounded" |
| 54 | + <*> v .: "large_bounds" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+29 −29
| @@ -3,15 +3,30 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | + private long smallPositive; | |
| 7 | + private long smallNegative; | |
| 8 | + private long i32Range; | |
| 6 | 9 | private long aboveI32Max; |
| 7 | 10 | private long belowI32Min; |
| 8 | - private long i32Range; | |
| 9 | - private long largeBounds; | |
| 10 | - private long onlyMaximum; | |
| 11 | 11 | private long onlyMinimum; |
| 12 | - private long smallNegative; | |
| 13 | - private long smallPositive; | |
| 12 | + private long onlyMaximum; | |
| 14 | 13 | private long unbounded; |
| 14 | + private long largeBounds; | |
| 15 | + | |
| 16 | + @JsonProperty("small_positive") | |
| 17 | + public long getSmallPositive() { return smallPositive; } | |
| 18 | + @JsonProperty("small_positive") | |
| 19 | + public void setSmallPositive(long value) { this.smallPositive = value; } | |
| 20 | + | |
| 21 | + @JsonProperty("small_negative") | |
| 22 | + public long getSmallNegative() { return smallNegative; } | |
| 23 | + @JsonProperty("small_negative") | |
| 24 | + public void setSmallNegative(long value) { this.smallNegative = value; } | |
| 25 | + | |
| 26 | + @JsonProperty("i32_range") | |
| 27 | + public long getI32Range() { return i32Range; } | |
| 28 | + @JsonProperty("i32_range") | |
| 29 | + public void setI32Range(long value) { this.i32Range = value; } | |
| 15 | 30 | |
| 16 | 31 | @JsonProperty("above_i32_max") |
| 17 | 32 | public long getAboveI32Max() { return aboveI32Max; } |
| @@ -23,38 +38,23 @@ public class TopLevel { | ||
| 23 | 38 | @JsonProperty("below_i32_min") |
| 24 | 39 | public void setBelowI32Min(long value) { this.belowI32Min = value; } |
| 25 | 40 | |
| 26 | - @JsonProperty("i32_range") | |
| 27 | - public long getI32Range() { return i32Range; } | |
| 28 | - @JsonProperty("i32_range") | |
| 29 | - public void setI32Range(long value) { this.i32Range = value; } | |
| 30 | - | |
| 31 | - @JsonProperty("large_bounds") | |
| 32 | - public long getLargeBounds() { return largeBounds; } | |
| 33 | - @JsonProperty("large_bounds") | |
| 34 | - public void setLargeBounds(long value) { this.largeBounds = value; } | |
| 35 | - | |
| 36 | - @JsonProperty("only_maximum") | |
| 37 | - public long getOnlyMaximum() { return onlyMaximum; } | |
| 38 | - @JsonProperty("only_maximum") | |
| 39 | - public void setOnlyMaximum(long value) { this.onlyMaximum = value; } | |
| 40 | - | |
| 41 | 41 | @JsonProperty("only_minimum") |
| 42 | 42 | public long getOnlyMinimum() { return onlyMinimum; } |
| 43 | 43 | @JsonProperty("only_minimum") |
| 44 | 44 | public void setOnlyMinimum(long value) { this.onlyMinimum = value; } |
| 45 | 45 | |
| 46 | - @JsonProperty("small_negative") | |
| 47 | - public long getSmallNegative() { return smallNegative; } | |
| 48 | - @JsonProperty("small_negative") | |
| 49 | - public void setSmallNegative(long value) { this.smallNegative = value; } | |
| 50 | - | |
| 51 | - @JsonProperty("small_positive") | |
| 52 | - public long getSmallPositive() { return smallPositive; } | |
| 53 | - @JsonProperty("small_positive") | |
| 54 | - public void setSmallPositive(long value) { this.smallPositive = value; } | |
| 46 | + @JsonProperty("only_maximum") | |
| 47 | + public long getOnlyMaximum() { return onlyMaximum; } | |
| 48 | + @JsonProperty("only_maximum") | |
| 49 | + public void setOnlyMaximum(long value) { this.onlyMaximum = value; } | |
| 55 | 50 | |
| 56 | 51 | @JsonProperty("unbounded") |
| 57 | 52 | public long getUnbounded() { return unbounded; } |
| 58 | 53 | @JsonProperty("unbounded") |
| 59 | 54 | public void setUnbounded(long value) { this.unbounded = value; } |
| 55 | + | |
| 56 | + @JsonProperty("large_bounds") | |
| 57 | + public long getLargeBounds() { return largeBounds; } | |
| 58 | + @JsonProperty("large_bounds") | |
| 59 | + public void setLargeBounds(long value) { this.largeBounds = value; } | |
| 60 | 60 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+29 −29
| @@ -3,15 +3,30 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | + private long smallPositive; | |
| 7 | + private long smallNegative; | |
| 8 | + private long i32Range; | |
| 6 | 9 | private long aboveI32Max; |
| 7 | 10 | private long belowI32Min; |
| 8 | - private long i32Range; | |
| 9 | - private long largeBounds; | |
| 10 | - private long onlyMaximum; | |
| 11 | 11 | private long onlyMinimum; |
| 12 | - private long smallNegative; | |
| 13 | - private long smallPositive; | |
| 12 | + private long onlyMaximum; | |
| 14 | 13 | private long unbounded; |
| 14 | + private long largeBounds; | |
| 15 | + | |
| 16 | + @JsonProperty("small_positive") | |
| 17 | + public long getSmallPositive() { return smallPositive; } | |
| 18 | + @JsonProperty("small_positive") | |
| 19 | + public void setSmallPositive(long value) { this.smallPositive = value; } | |
| 20 | + | |
| 21 | + @JsonProperty("small_negative") | |
| 22 | + public long getSmallNegative() { return smallNegative; } | |
| 23 | + @JsonProperty("small_negative") | |
| 24 | + public void setSmallNegative(long value) { this.smallNegative = value; } | |
| 25 | + | |
| 26 | + @JsonProperty("i32_range") | |
| 27 | + public long getI32Range() { return i32Range; } | |
| 28 | + @JsonProperty("i32_range") | |
| 29 | + public void setI32Range(long value) { this.i32Range = value; } | |
| 15 | 30 | |
| 16 | 31 | @JsonProperty("above_i32_max") |
| 17 | 32 | public long getAboveI32Max() { return aboveI32Max; } |
| @@ -23,38 +38,23 @@ public class TopLevel { | ||
| 23 | 38 | @JsonProperty("below_i32_min") |
| 24 | 39 | public void setBelowI32Min(long value) { this.belowI32Min = value; } |
| 25 | 40 | |
| 26 | - @JsonProperty("i32_range") | |
| 27 | - public long getI32Range() { return i32Range; } | |
| 28 | - @JsonProperty("i32_range") | |
| 29 | - public void setI32Range(long value) { this.i32Range = value; } | |
| 30 | - | |
| 31 | - @JsonProperty("large_bounds") | |
| 32 | - public long getLargeBounds() { return largeBounds; } | |
| 33 | - @JsonProperty("large_bounds") | |
| 34 | - public void setLargeBounds(long value) { this.largeBounds = value; } | |
| 35 | - | |
| 36 | - @JsonProperty("only_maximum") | |
| 37 | - public long getOnlyMaximum() { return onlyMaximum; } | |
| 38 | - @JsonProperty("only_maximum") | |
| 39 | - public void setOnlyMaximum(long value) { this.onlyMaximum = value; } | |
| 40 | - | |
| 41 | 41 | @JsonProperty("only_minimum") |
| 42 | 42 | public long getOnlyMinimum() { return onlyMinimum; } |
| 43 | 43 | @JsonProperty("only_minimum") |
| 44 | 44 | public void setOnlyMinimum(long value) { this.onlyMinimum = value; } |
| 45 | 45 | |
| 46 | - @JsonProperty("small_negative") | |
| 47 | - public long getSmallNegative() { return smallNegative; } | |
| 48 | - @JsonProperty("small_negative") | |
| 49 | - public void setSmallNegative(long value) { this.smallNegative = value; } | |
| 50 | - | |
| 51 | - @JsonProperty("small_positive") | |
| 52 | - public long getSmallPositive() { return smallPositive; } | |
| 53 | - @JsonProperty("small_positive") | |
| 54 | - public void setSmallPositive(long value) { this.smallPositive = value; } | |
| 46 | + @JsonProperty("only_maximum") | |
| 47 | + public long getOnlyMaximum() { return onlyMaximum; } | |
| 48 | + @JsonProperty("only_maximum") | |
| 49 | + public void setOnlyMaximum(long value) { this.onlyMaximum = value; } | |
| 55 | 50 | |
| 56 | 51 | @JsonProperty("unbounded") |
| 57 | 52 | public long getUnbounded() { return unbounded; } |
| 58 | 53 | @JsonProperty("unbounded") |
| 59 | 54 | public void setUnbounded(long value) { this.unbounded = value; } |
| 55 | + | |
| 56 | + @JsonProperty("large_bounds") | |
| 57 | + public long getLargeBounds() { return largeBounds; } | |
| 58 | + @JsonProperty("large_bounds") | |
| 59 | + public void setLargeBounds(long value) { this.largeBounds = value; } | |
| 60 | 60 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+29 −29
| @@ -3,15 +3,30 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | + private long smallPositive; | |
| 7 | + private long smallNegative; | |
| 8 | + private long i32Range; | |
| 6 | 9 | private long aboveI32Max; |
| 7 | 10 | private long belowI32Min; |
| 8 | - private long i32Range; | |
| 9 | - private long largeBounds; | |
| 10 | - private long onlyMaximum; | |
| 11 | 11 | private long onlyMinimum; |
| 12 | - private long smallNegative; | |
| 13 | - private long smallPositive; | |
| 12 | + private long onlyMaximum; | |
| 14 | 13 | private long unbounded; |
| 14 | + private long largeBounds; | |
| 15 | + | |
| 16 | + @JsonProperty("small_positive") | |
| 17 | + public long getSmallPositive() { return smallPositive; } | |
| 18 | + @JsonProperty("small_positive") | |
| 19 | + public void setSmallPositive(long value) { this.smallPositive = value; } | |
| 20 | + | |
| 21 | + @JsonProperty("small_negative") | |
| 22 | + public long getSmallNegative() { return smallNegative; } | |
| 23 | + @JsonProperty("small_negative") | |
| 24 | + public void setSmallNegative(long value) { this.smallNegative = value; } | |
| 25 | + | |
| 26 | + @JsonProperty("i32_range") | |
| 27 | + public long getI32Range() { return i32Range; } | |
| 28 | + @JsonProperty("i32_range") | |
| 29 | + public void setI32Range(long value) { this.i32Range = value; } | |
| 15 | 30 | |
| 16 | 31 | @JsonProperty("above_i32_max") |
| 17 | 32 | public long getAboveI32Max() { return aboveI32Max; } |
| @@ -23,38 +38,23 @@ public class TopLevel { | ||
| 23 | 38 | @JsonProperty("below_i32_min") |
| 24 | 39 | public void setBelowI32Min(long value) { this.belowI32Min = value; } |
| 25 | 40 | |
| 26 | - @JsonProperty("i32_range") | |
| 27 | - public long getI32Range() { return i32Range; } | |
| 28 | - @JsonProperty("i32_range") | |
| 29 | - public void setI32Range(long value) { this.i32Range = value; } | |
| 30 | - | |
| 31 | - @JsonProperty("large_bounds") | |
| 32 | - public long getLargeBounds() { return largeBounds; } | |
| 33 | - @JsonProperty("large_bounds") | |
| 34 | - public void setLargeBounds(long value) { this.largeBounds = value; } | |
| 35 | - | |
| 36 | - @JsonProperty("only_maximum") | |
| 37 | - public long getOnlyMaximum() { return onlyMaximum; } | |
| 38 | - @JsonProperty("only_maximum") | |
| 39 | - public void setOnlyMaximum(long value) { this.onlyMaximum = value; } | |
| 40 | - | |
| 41 | 41 | @JsonProperty("only_minimum") |
| 42 | 42 | public long getOnlyMinimum() { return onlyMinimum; } |
| 43 | 43 | @JsonProperty("only_minimum") |
| 44 | 44 | public void setOnlyMinimum(long value) { this.onlyMinimum = value; } |
| 45 | 45 | |
| 46 | - @JsonProperty("small_negative") | |
| 47 | - public long getSmallNegative() { return smallNegative; } | |
| 48 | - @JsonProperty("small_negative") | |
| 49 | - public void setSmallNegative(long value) { this.smallNegative = value; } | |
| 50 | - | |
| 51 | - @JsonProperty("small_positive") | |
| 52 | - public long getSmallPositive() { return smallPositive; } | |
| 53 | - @JsonProperty("small_positive") | |
| 54 | - public void setSmallPositive(long value) { this.smallPositive = value; } | |
| 46 | + @JsonProperty("only_maximum") | |
| 47 | + public long getOnlyMaximum() { return onlyMaximum; } | |
| 48 | + @JsonProperty("only_maximum") | |
| 49 | + public void setOnlyMaximum(long value) { this.onlyMaximum = value; } | |
| 55 | 50 | |
| 56 | 51 | @JsonProperty("unbounded") |
| 57 | 52 | public long getUnbounded() { return unbounded; } |
| 58 | 53 | @JsonProperty("unbounded") |
| 59 | 54 | public void setUnbounded(long value) { this.unbounded = value; } |
| 55 | + | |
| 56 | + @JsonProperty("large_bounds") | |
| 57 | + public long getLargeBounds() { return largeBounds; } | |
| 58 | + @JsonProperty("large_bounds") | |
| 59 | + public void setLargeBounds(long value) { this.largeBounds = value; } | |
| 60 | 60 | } |
Mschema-javascriptdefault / TopLevel.js+5 −5
| @@ -172,15 +172,15 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | + { json: "small_positive", js: "small_positive", typ: 0 }, | |
| 176 | + { json: "small_negative", js: "small_negative", typ: 0 }, | |
| 177 | + { json: "i32_range", js: "i32_range", typ: 0 }, | |
| 175 | 178 | { json: "above_i32_max", js: "above_i32_max", typ: 0 }, |
| 176 | 179 | { json: "below_i32_min", js: "below_i32_min", typ: 0 }, |
| 177 | - { json: "i32_range", js: "i32_range", typ: 0 }, | |
| 178 | - { json: "large_bounds", js: "large_bounds", typ: 0 }, | |
| 179 | - { json: "only_maximum", js: "only_maximum", typ: 0 }, | |
| 180 | 180 | { json: "only_minimum", js: "only_minimum", typ: 0 }, |
| 181 | - { json: "small_negative", js: "small_negative", typ: 0 }, | |
| 182 | - { json: "small_positive", js: "small_positive", typ: 0 }, | |
| 181 | + { json: "only_maximum", js: "only_maximum", typ: 0 }, | |
| 183 | 182 | { json: "unbounded", js: "unbounded", typ: 0 }, |
| 183 | + { json: "large_bounds", js: "large_bounds", typ: 0 }, | |
| 184 | 184 | ], "any"), |
| 185 | 185 | }; |
Mschema-kotlin-jacksondefault / TopLevel.kt+14 −14
| @@ -19,32 +19,32 @@ val mapper = jacksonObjectMapper().apply { | ||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | data class TopLevel ( |
| 22 | - @get:JsonProperty("above_i32_max", required=true)@field:JsonProperty("above_i32_max", required=true) | |
| 23 | - val aboveI32Max: Long, | |
| 22 | + @get:JsonProperty("small_positive", required=true)@field:JsonProperty("small_positive", required=true) | |
| 23 | + val smallPositive: Long, | |
| 24 | 24 | |
| 25 | - @get:JsonProperty("below_i32_min", required=true)@field:JsonProperty("below_i32_min", required=true) | |
| 26 | - val belowI32Min: Long, | |
| 25 | + @get:JsonProperty("small_negative", required=true)@field:JsonProperty("small_negative", required=true) | |
| 26 | + val smallNegative: Long, | |
| 27 | 27 | |
| 28 | 28 | @get:JsonProperty("i32_range", required=true)@field:JsonProperty("i32_range", required=true) |
| 29 | 29 | val i32Range: Long, |
| 30 | 30 | |
| 31 | - @get:JsonProperty("large_bounds", required=true)@field:JsonProperty("large_bounds", required=true) | |
| 32 | - val largeBounds: Long, | |
| 31 | + @get:JsonProperty("above_i32_max", required=true)@field:JsonProperty("above_i32_max", required=true) | |
| 32 | + val aboveI32Max: Long, | |
| 33 | 33 | |
| 34 | - @get:JsonProperty("only_maximum", required=true)@field:JsonProperty("only_maximum", required=true) | |
| 35 | - val onlyMaximum: Long, | |
| 34 | + @get:JsonProperty("below_i32_min", required=true)@field:JsonProperty("below_i32_min", required=true) | |
| 35 | + val belowI32Min: Long, | |
| 36 | 36 | |
| 37 | 37 | @get:JsonProperty("only_minimum", required=true)@field:JsonProperty("only_minimum", required=true) |
| 38 | 38 | val onlyMinimum: Long, |
| 39 | 39 | |
| 40 | - @get:JsonProperty("small_negative", required=true)@field:JsonProperty("small_negative", required=true) | |
| 41 | - val smallNegative: Long, | |
| 42 | - | |
| 43 | - @get:JsonProperty("small_positive", required=true)@field:JsonProperty("small_positive", required=true) | |
| 44 | - val smallPositive: Long, | |
| 40 | + @get:JsonProperty("only_maximum", required=true)@field:JsonProperty("only_maximum", required=true) | |
| 41 | + val onlyMaximum: Long, | |
| 45 | 42 | |
| 46 | 43 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 47 | - val unbounded: Long | |
| 44 | + val unbounded: Long, | |
| 45 | + | |
| 46 | + @get:JsonProperty("large_bounds", required=true)@field:JsonProperty("large_bounds", required=true) | |
| 47 | + val largeBounds: Long | |
| 48 | 48 | ) { |
| 49 | 49 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+13 −13
| @@ -9,31 +9,31 @@ import com.beust.klaxon.* | ||
| 9 | 9 | private val klaxon = Klaxon() |
| 10 | 10 | |
| 11 | 11 | data class TopLevel ( |
| 12 | - @Json(name = "above_i32_max") | |
| 13 | - val aboveI32Max: Long, | |
| 12 | + @Json(name = "small_positive") | |
| 13 | + val smallPositive: Long, | |
| 14 | 14 | |
| 15 | - @Json(name = "below_i32_min") | |
| 16 | - val belowI32Min: Long, | |
| 15 | + @Json(name = "small_negative") | |
| 16 | + val smallNegative: Long, | |
| 17 | 17 | |
| 18 | 18 | @Json(name = "i32_range") |
| 19 | 19 | val i32Range: Long, |
| 20 | 20 | |
| 21 | - @Json(name = "large_bounds") | |
| 22 | - val largeBounds: Long, | |
| 21 | + @Json(name = "above_i32_max") | |
| 22 | + val aboveI32Max: Long, | |
| 23 | 23 | |
| 24 | - @Json(name = "only_maximum") | |
| 25 | - val onlyMaximum: Long, | |
| 24 | + @Json(name = "below_i32_min") | |
| 25 | + val belowI32Min: Long, | |
| 26 | 26 | |
| 27 | 27 | @Json(name = "only_minimum") |
| 28 | 28 | val onlyMinimum: Long, |
| 29 | 29 | |
| 30 | - @Json(name = "small_negative") | |
| 31 | - val smallNegative: Long, | |
| 30 | + @Json(name = "only_maximum") | |
| 31 | + val onlyMaximum: Long, | |
| 32 | 32 | |
| 33 | - @Json(name = "small_positive") | |
| 34 | - val smallPositive: Long, | |
| 33 | + val unbounded: Long, | |
| 35 | 34 | |
| 36 | - val unbounded: Long | |
| 35 | + @Json(name = "large_bounds") | |
| 36 | + val largeBounds: Long | |
| 37 | 37 | ) { |
| 38 | 38 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-kotlinxdefault / TopLevel.kt+13 −13
| @@ -12,29 +12,29 @@ import kotlinx.serialization.encoding.* | ||
| 12 | 12 | |
| 13 | 13 | @Serializable |
| 14 | 14 | data class TopLevel ( |
| 15 | - @SerialName("above_i32_max") | |
| 16 | - val aboveI32Max: Long, | |
| 15 | + @SerialName("small_positive") | |
| 16 | + val smallPositive: Long, | |
| 17 | 17 | |
| 18 | - @SerialName("below_i32_min") | |
| 19 | - val belowI32Min: Long, | |
| 18 | + @SerialName("small_negative") | |
| 19 | + val smallNegative: Long, | |
| 20 | 20 | |
| 21 | 21 | @SerialName("i32_range") |
| 22 | 22 | val i32Range: Long, |
| 23 | 23 | |
| 24 | - @SerialName("large_bounds") | |
| 25 | - val largeBounds: Long, | |
| 24 | + @SerialName("above_i32_max") | |
| 25 | + val aboveI32Max: Long, | |
| 26 | 26 | |
| 27 | - @SerialName("only_maximum") | |
| 28 | - val onlyMaximum: Long, | |
| 27 | + @SerialName("below_i32_min") | |
| 28 | + val belowI32Min: Long, | |
| 29 | 29 | |
| 30 | 30 | @SerialName("only_minimum") |
| 31 | 31 | val onlyMinimum: Long, |
| 32 | 32 | |
| 33 | - @SerialName("small_negative") | |
| 34 | - val smallNegative: Long, | |
| 33 | + @SerialName("only_maximum") | |
| 34 | + val onlyMaximum: Long, | |
| 35 | 35 | |
| 36 | - @SerialName("small_positive") | |
| 37 | - val smallPositive: Long, | |
| 36 | + val unbounded: Long, | |
| 38 | 37 | |
| 39 | - val unbounded: Long | |
| 38 | + @SerialName("large_bounds") | |
| 39 | + val largeBounds: Long | |
| 40 | 40 | ) |
Mschema-phpdefault / TopLevel.php+124 −124
| @@ -4,37 +4,37 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | + private int $smallPositive; // json:small_positive Required | |
| 8 | + private int $smallNegative; // json:small_negative Required | |
| 9 | + private int $i32Range; // json:i32_range Required | |
| 7 | 10 | private int $aboveI32Max; // json:above_i32_max Required |
| 8 | 11 | private int $belowI32Min; // json:below_i32_min Required |
| 9 | - private int $i32Range; // json:i32_range Required | |
| 10 | - private int $largeBounds; // json:large_bounds Required | |
| 11 | - private int $onlyMaximum; // json:only_maximum Required | |
| 12 | 12 | private int $onlyMinimum; // json:only_minimum Required |
| 13 | - private int $smallNegative; // json:small_negative Required | |
| 14 | - private int $smallPositive; // json:small_positive Required | |
| 13 | + private int $onlyMaximum; // json:only_maximum Required | |
| 15 | 14 | private int $unbounded; // json:unbounded Required |
| 15 | + private int $largeBounds; // json:large_bounds Required | |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | + * @param int $smallPositive | |
| 19 | + * @param int $smallNegative | |
| 20 | + * @param int $i32Range | |
| 18 | 21 | * @param int $aboveI32Max |
| 19 | 22 | * @param int $belowI32Min |
| 20 | - * @param int $i32Range | |
| 21 | - * @param int $largeBounds | |
| 22 | - * @param int $onlyMaximum | |
| 23 | 23 | * @param int $onlyMinimum |
| 24 | - * @param int $smallNegative | |
| 25 | - * @param int $smallPositive | |
| 24 | + * @param int $onlyMaximum | |
| 26 | 25 | * @param int $unbounded |
| 26 | + * @param int $largeBounds | |
| 27 | 27 | */ |
| 28 | - public function __construct(int $aboveI32Max, int $belowI32Min, int $i32Range, int $largeBounds, int $onlyMaximum, int $onlyMinimum, int $smallNegative, int $smallPositive, int $unbounded) { | |
| 28 | + public function __construct(int $smallPositive, int $smallNegative, int $i32Range, int $aboveI32Max, int $belowI32Min, int $onlyMinimum, int $onlyMaximum, int $unbounded, int $largeBounds) { | |
| 29 | + $this->smallPositive = $smallPositive; | |
| 30 | + $this->smallNegative = $smallNegative; | |
| 31 | + $this->i32Range = $i32Range; | |
| 29 | 32 | $this->aboveI32Max = $aboveI32Max; |
| 30 | 33 | $this->belowI32Min = $belowI32Min; |
| 31 | - $this->i32Range = $i32Range; | |
| 32 | - $this->largeBounds = $largeBounds; | |
| 33 | - $this->onlyMaximum = $onlyMaximum; | |
| 34 | 34 | $this->onlyMinimum = $onlyMinimum; |
| 35 | - $this->smallNegative = $smallNegative; | |
| 36 | - $this->smallPositive = $smallPositive; | |
| 35 | + $this->onlyMaximum = $onlyMaximum; | |
| 37 | 36 | $this->unbounded = $unbounded; |
| 37 | + $this->largeBounds = $largeBounds; | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| @@ -42,7 +42,7 @@ class TopLevel { | ||
| 42 | 42 | * @throws Exception |
| 43 | 43 | * @return int |
| 44 | 44 | */ |
| 45 | - public static function fromAboveI32Max(int $value): int { | |
| 45 | + public static function fromSmallPositive(int $value): int { | |
| 46 | 46 | return $value; /*int*/ |
| 47 | 47 | } |
| 48 | 48 | |
| @@ -50,11 +50,11 @@ class TopLevel { | ||
| 50 | 50 | * @throws Exception |
| 51 | 51 | * @return int |
| 52 | 52 | */ |
| 53 | - public function toAboveI32Max(): int { | |
| 54 | - if (TopLevel::validateAboveI32Max($this->aboveI32Max)) { | |
| 55 | - return $this->aboveI32Max; /*int*/ | |
| 53 | + public function toSmallPositive(): int { | |
| 54 | + if (TopLevel::validateSmallPositive($this->smallPositive)) { | |
| 55 | + return $this->smallPositive; /*int*/ | |
| 56 | 56 | } |
| 57 | - throw new Exception('never get to this TopLevel::aboveI32Max'); | |
| 57 | + throw new Exception('never get to this TopLevel::smallPositive'); | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| @@ -62,7 +62,7 @@ class TopLevel { | ||
| 62 | 62 | * @return bool |
| 63 | 63 | * @throws Exception |
| 64 | 64 | */ |
| 65 | - public static function validateAboveI32Max(int $value): bool { | |
| 65 | + public static function validateSmallPositive(int $value): bool { | |
| 66 | 66 | return true; |
| 67 | 67 | } |
| 68 | 68 | |
| @@ -70,18 +70,18 @@ class TopLevel { | ||
| 70 | 70 | * @throws Exception |
| 71 | 71 | * @return int |
| 72 | 72 | */ |
| 73 | - public function getAboveI32Max(): int { | |
| 74 | - if (TopLevel::validateAboveI32Max($this->aboveI32Max)) { | |
| 75 | - return $this->aboveI32Max; | |
| 73 | + public function getSmallPositive(): int { | |
| 74 | + if (TopLevel::validateSmallPositive($this->smallPositive)) { | |
| 75 | + return $this->smallPositive; | |
| 76 | 76 | } |
| 77 | - throw new Exception('never get to getAboveI32Max TopLevel::aboveI32Max'); | |
| 77 | + throw new Exception('never get to getSmallPositive TopLevel::smallPositive'); | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * @return int |
| 82 | 82 | */ |
| 83 | - public static function sampleAboveI32Max(): int { | |
| 84 | - return 31; /*31:aboveI32Max*/ | |
| 83 | + public static function sampleSmallPositive(): int { | |
| 84 | + return 31; /*31:smallPositive*/ | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
| @@ -89,7 +89,7 @@ class TopLevel { | ||
| 89 | 89 | * @throws Exception |
| 90 | 90 | * @return int |
| 91 | 91 | */ |
| 92 | - public static function fromBelowI32Min(int $value): int { | |
| 92 | + public static function fromSmallNegative(int $value): int { | |
| 93 | 93 | return $value; /*int*/ |
| 94 | 94 | } |
| 95 | 95 | |
| @@ -97,11 +97,11 @@ class TopLevel { | ||
| 97 | 97 | * @throws Exception |
| 98 | 98 | * @return int |
| 99 | 99 | */ |
| 100 | - public function toBelowI32Min(): int { | |
| 101 | - if (TopLevel::validateBelowI32Min($this->belowI32Min)) { | |
| 102 | - return $this->belowI32Min; /*int*/ | |
| 100 | + public function toSmallNegative(): int { | |
| 101 | + if (TopLevel::validateSmallNegative($this->smallNegative)) { | |
| 102 | + return $this->smallNegative; /*int*/ | |
| 103 | 103 | } |
| 104 | - throw new Exception('never get to this TopLevel::belowI32Min'); | |
| 104 | + throw new Exception('never get to this TopLevel::smallNegative'); | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
| @@ -109,7 +109,7 @@ class TopLevel { | ||
| 109 | 109 | * @return bool |
| 110 | 110 | * @throws Exception |
| 111 | 111 | */ |
| 112 | - public static function validateBelowI32Min(int $value): bool { | |
| 112 | + public static function validateSmallNegative(int $value): bool { | |
| 113 | 113 | return true; |
| 114 | 114 | } |
| 115 | 115 | |
| @@ -117,18 +117,18 @@ class TopLevel { | ||
| 117 | 117 | * @throws Exception |
| 118 | 118 | * @return int |
| 119 | 119 | */ |
| 120 | - public function getBelowI32Min(): int { | |
| 121 | - if (TopLevel::validateBelowI32Min($this->belowI32Min)) { | |
| 122 | - return $this->belowI32Min; | |
| 120 | + public function getSmallNegative(): int { | |
| 121 | + if (TopLevel::validateSmallNegative($this->smallNegative)) { | |
| 122 | + return $this->smallNegative; | |
| 123 | 123 | } |
| 124 | - throw new Exception('never get to getBelowI32Min TopLevel::belowI32Min'); | |
| 124 | + throw new Exception('never get to getSmallNegative TopLevel::smallNegative'); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * @return int |
| 129 | 129 | */ |
| 130 | - public static function sampleBelowI32Min(): int { | |
| 131 | - return 32; /*32:belowI32Min*/ | |
| 130 | + public static function sampleSmallNegative(): int { | |
| 131 | + return 32; /*32:smallNegative*/ | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
| @@ -183,7 +183,7 @@ class TopLevel { | ||
| 183 | 183 | * @throws Exception |
| 184 | 184 | * @return int |
| 185 | 185 | */ |
| 186 | - public static function fromLargeBounds(int $value): int { | |
| 186 | + public static function fromAboveI32Max(int $value): int { | |
| 187 | 187 | return $value; /*int*/ |
| 188 | 188 | } |
| 189 | 189 | |
| @@ -191,11 +191,11 @@ class TopLevel { | ||
| 191 | 191 | * @throws Exception |
| 192 | 192 | * @return int |
| 193 | 193 | */ |
| 194 | - public function toLargeBounds(): int { | |
| 195 | - if (TopLevel::validateLargeBounds($this->largeBounds)) { | |
| 196 | - return $this->largeBounds; /*int*/ | |
| 194 | + public function toAboveI32Max(): int { | |
| 195 | + if (TopLevel::validateAboveI32Max($this->aboveI32Max)) { | |
| 196 | + return $this->aboveI32Max; /*int*/ | |
| 197 | 197 | } |
| 198 | - throw new Exception('never get to this TopLevel::largeBounds'); | |
| 198 | + throw new Exception('never get to this TopLevel::aboveI32Max'); | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
| @@ -203,7 +203,7 @@ class TopLevel { | ||
| 203 | 203 | * @return bool |
| 204 | 204 | * @throws Exception |
| 205 | 205 | */ |
| 206 | - public static function validateLargeBounds(int $value): bool { | |
| 206 | + public static function validateAboveI32Max(int $value): bool { | |
| 207 | 207 | return true; |
| 208 | 208 | } |
| 209 | 209 | |
| @@ -211,18 +211,18 @@ class TopLevel { | ||
| 211 | 211 | * @throws Exception |
| 212 | 212 | * @return int |
| 213 | 213 | */ |
| 214 | - public function getLargeBounds(): int { | |
| 215 | - if (TopLevel::validateLargeBounds($this->largeBounds)) { | |
| 216 | - return $this->largeBounds; | |
| 214 | + public function getAboveI32Max(): int { | |
| 215 | + if (TopLevel::validateAboveI32Max($this->aboveI32Max)) { | |
| 216 | + return $this->aboveI32Max; | |
| 217 | 217 | } |
| 218 | - throw new Exception('never get to getLargeBounds TopLevel::largeBounds'); | |
| 218 | + throw new Exception('never get to getAboveI32Max TopLevel::aboveI32Max'); | |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
| 222 | 222 | * @return int |
| 223 | 223 | */ |
| 224 | - public static function sampleLargeBounds(): int { | |
| 225 | - return 34; /*34:largeBounds*/ | |
| 224 | + public static function sampleAboveI32Max(): int { | |
| 225 | + return 34; /*34:aboveI32Max*/ | |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
| @@ -230,7 +230,7 @@ class TopLevel { | ||
| 230 | 230 | * @throws Exception |
| 231 | 231 | * @return int |
| 232 | 232 | */ |
| 233 | - public static function fromOnlyMaximum(int $value): int { | |
| 233 | + public static function fromBelowI32Min(int $value): int { | |
| 234 | 234 | return $value; /*int*/ |
| 235 | 235 | } |
| 236 | 236 | |
| @@ -238,11 +238,11 @@ class TopLevel { | ||
| 238 | 238 | * @throws Exception |
| 239 | 239 | * @return int |
| 240 | 240 | */ |
| 241 | - public function toOnlyMaximum(): int { | |
| 242 | - if (TopLevel::validateOnlyMaximum($this->onlyMaximum)) { | |
| 243 | - return $this->onlyMaximum; /*int*/ | |
| 241 | + public function toBelowI32Min(): int { | |
| 242 | + if (TopLevel::validateBelowI32Min($this->belowI32Min)) { | |
| 243 | + return $this->belowI32Min; /*int*/ | |
| 244 | 244 | } |
| 245 | - throw new Exception('never get to this TopLevel::onlyMaximum'); | |
| 245 | + throw new Exception('never get to this TopLevel::belowI32Min'); | |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |
| @@ -250,7 +250,7 @@ class TopLevel { | ||
| 250 | 250 | * @return bool |
| 251 | 251 | * @throws Exception |
| 252 | 252 | */ |
| 253 | - public static function validateOnlyMaximum(int $value): bool { | |
| 253 | + public static function validateBelowI32Min(int $value): bool { | |
| 254 | 254 | return true; |
| 255 | 255 | } |
| 256 | 256 | |
| @@ -258,18 +258,18 @@ class TopLevel { | ||
| 258 | 258 | * @throws Exception |
| 259 | 259 | * @return int |
| 260 | 260 | */ |
| 261 | - public function getOnlyMaximum(): int { | |
| 262 | - if (TopLevel::validateOnlyMaximum($this->onlyMaximum)) { | |
| 263 | - return $this->onlyMaximum; | |
| 261 | + public function getBelowI32Min(): int { | |
| 262 | + if (TopLevel::validateBelowI32Min($this->belowI32Min)) { | |
| 263 | + return $this->belowI32Min; | |
| 264 | 264 | } |
| 265 | - throw new Exception('never get to getOnlyMaximum TopLevel::onlyMaximum'); | |
| 265 | + throw new Exception('never get to getBelowI32Min TopLevel::belowI32Min'); | |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
| 269 | 269 | * @return int |
| 270 | 270 | */ |
| 271 | - public static function sampleOnlyMaximum(): int { | |
| 272 | - return 35; /*35:onlyMaximum*/ | |
| 271 | + public static function sampleBelowI32Min(): int { | |
| 272 | + return 35; /*35:belowI32Min*/ | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
| @@ -324,7 +324,7 @@ class TopLevel { | ||
| 324 | 324 | * @throws Exception |
| 325 | 325 | * @return int |
| 326 | 326 | */ |
| 327 | - public static function fromSmallNegative(int $value): int { | |
| 327 | + public static function fromOnlyMaximum(int $value): int { | |
| 328 | 328 | return $value; /*int*/ |
| 329 | 329 | } |
| 330 | 330 | |
| @@ -332,11 +332,11 @@ class TopLevel { | ||
| 332 | 332 | * @throws Exception |
| 333 | 333 | * @return int |
| 334 | 334 | */ |
| 335 | - public function toSmallNegative(): int { | |
| 336 | - if (TopLevel::validateSmallNegative($this->smallNegative)) { | |
| 337 | - return $this->smallNegative; /*int*/ | |
| 335 | + public function toOnlyMaximum(): int { | |
| 336 | + if (TopLevel::validateOnlyMaximum($this->onlyMaximum)) { | |
| 337 | + return $this->onlyMaximum; /*int*/ | |
| 338 | 338 | } |
| 339 | - throw new Exception('never get to this TopLevel::smallNegative'); | |
| 339 | + throw new Exception('never get to this TopLevel::onlyMaximum'); | |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | /** |
| @@ -344,7 +344,7 @@ class TopLevel { | ||
| 344 | 344 | * @return bool |
| 345 | 345 | * @throws Exception |
| 346 | 346 | */ |
| 347 | - public static function validateSmallNegative(int $value): bool { | |
| 347 | + public static function validateOnlyMaximum(int $value): bool { | |
| 348 | 348 | return true; |
| 349 | 349 | } |
| 350 | 350 | |
| @@ -352,18 +352,18 @@ class TopLevel { | ||
| 352 | 352 | * @throws Exception |
| 353 | 353 | * @return int |
| 354 | 354 | */ |
| 355 | - public function getSmallNegative(): int { | |
| 356 | - if (TopLevel::validateSmallNegative($this->smallNegative)) { | |
| 357 | - return $this->smallNegative; | |
| 355 | + public function getOnlyMaximum(): int { | |
| 356 | + if (TopLevel::validateOnlyMaximum($this->onlyMaximum)) { | |
| 357 | + return $this->onlyMaximum; | |
| 358 | 358 | } |
| 359 | - throw new Exception('never get to getSmallNegative TopLevel::smallNegative'); | |
| 359 | + throw new Exception('never get to getOnlyMaximum TopLevel::onlyMaximum'); | |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /** |
| 363 | 363 | * @return int |
| 364 | 364 | */ |
| 365 | - public static function sampleSmallNegative(): int { | |
| 366 | - return 37; /*37:smallNegative*/ | |
| 365 | + public static function sampleOnlyMaximum(): int { | |
| 366 | + return 37; /*37:onlyMaximum*/ | |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | /** |
| @@ -371,7 +371,7 @@ class TopLevel { | ||
| 371 | 371 | * @throws Exception |
| 372 | 372 | * @return int |
| 373 | 373 | */ |
| 374 | - public static function fromSmallPositive(int $value): int { | |
| 374 | + public static function fromUnbounded(int $value): int { | |
| 375 | 375 | return $value; /*int*/ |
| 376 | 376 | } |
| 377 | 377 | |
| @@ -379,11 +379,11 @@ class TopLevel { | ||
| 379 | 379 | * @throws Exception |
| 380 | 380 | * @return int |
| 381 | 381 | */ |
| 382 | - public function toSmallPositive(): int { | |
| 383 | - if (TopLevel::validateSmallPositive($this->smallPositive)) { | |
| 384 | - return $this->smallPositive; /*int*/ | |
| 382 | + public function toUnbounded(): int { | |
| 383 | + if (TopLevel::validateUnbounded($this->unbounded)) { | |
| 384 | + return $this->unbounded; /*int*/ | |
| 385 | 385 | } |
| 386 | - throw new Exception('never get to this TopLevel::smallPositive'); | |
| 386 | + throw new Exception('never get to this TopLevel::unbounded'); | |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | /** |
| @@ -391,7 +391,7 @@ class TopLevel { | ||
| 391 | 391 | * @return bool |
| 392 | 392 | * @throws Exception |
| 393 | 393 | */ |
| 394 | - public static function validateSmallPositive(int $value): bool { | |
| 394 | + public static function validateUnbounded(int $value): bool { | |
| 395 | 395 | return true; |
| 396 | 396 | } |
| 397 | 397 | |
| @@ -399,18 +399,18 @@ class TopLevel { | ||
| 399 | 399 | * @throws Exception |
| 400 | 400 | * @return int |
| 401 | 401 | */ |
| 402 | - public function getSmallPositive(): int { | |
| 403 | - if (TopLevel::validateSmallPositive($this->smallPositive)) { | |
| 404 | - return $this->smallPositive; | |
| 402 | + public function getUnbounded(): int { | |
| 403 | + if (TopLevel::validateUnbounded($this->unbounded)) { | |
| 404 | + return $this->unbounded; | |
| 405 | 405 | } |
| 406 | - throw new Exception('never get to getSmallPositive TopLevel::smallPositive'); | |
| 406 | + throw new Exception('never get to getUnbounded TopLevel::unbounded'); | |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | /** |
| 410 | 410 | * @return int |
| 411 | 411 | */ |
| 412 | - public static function sampleSmallPositive(): int { | |
| 413 | - return 38; /*38:smallPositive*/ | |
| 412 | + public static function sampleUnbounded(): int { | |
| 413 | + return 38; /*38:unbounded*/ | |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | /** |
| @@ -418,7 +418,7 @@ class TopLevel { | ||
| 418 | 418 | * @throws Exception |
| 419 | 419 | * @return int |
| 420 | 420 | */ |
| 421 | - public static function fromUnbounded(int $value): int { | |
| 421 | + public static function fromLargeBounds(int $value): int { | |
| 422 | 422 | return $value; /*int*/ |
| 423 | 423 | } |
| 424 | 424 | |
| @@ -426,11 +426,11 @@ class TopLevel { | ||
| 426 | 426 | * @throws Exception |
| 427 | 427 | * @return int |
| 428 | 428 | */ |
| 429 | - public function toUnbounded(): int { | |
| 430 | - if (TopLevel::validateUnbounded($this->unbounded)) { | |
| 431 | - return $this->unbounded; /*int*/ | |
| 429 | + public function toLargeBounds(): int { | |
| 430 | + if (TopLevel::validateLargeBounds($this->largeBounds)) { | |
| 431 | + return $this->largeBounds; /*int*/ | |
| 432 | 432 | } |
| 433 | - throw new Exception('never get to this TopLevel::unbounded'); | |
| 433 | + throw new Exception('never get to this TopLevel::largeBounds'); | |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | /** |
| @@ -438,7 +438,7 @@ class TopLevel { | ||
| 438 | 438 | * @return bool |
| 439 | 439 | * @throws Exception |
| 440 | 440 | */ |
| 441 | - public static function validateUnbounded(int $value): bool { | |
| 441 | + public static function validateLargeBounds(int $value): bool { | |
| 442 | 442 | return true; |
| 443 | 443 | } |
| 444 | 444 | |
| @@ -446,18 +446,18 @@ class TopLevel { | ||
| 446 | 446 | * @throws Exception |
| 447 | 447 | * @return int |
| 448 | 448 | */ |
| 449 | - public function getUnbounded(): int { | |
| 450 | - if (TopLevel::validateUnbounded($this->unbounded)) { | |
| 451 | - return $this->unbounded; | |
| 449 | + public function getLargeBounds(): int { | |
| 450 | + if (TopLevel::validateLargeBounds($this->largeBounds)) { | |
| 451 | + return $this->largeBounds; | |
| 452 | 452 | } |
| 453 | - throw new Exception('never get to getUnbounded TopLevel::unbounded'); | |
| 453 | + throw new Exception('never get to getLargeBounds TopLevel::largeBounds'); | |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | /** |
| 457 | 457 | * @return int |
| 458 | 458 | */ |
| 459 | - public static function sampleUnbounded(): int { | |
| 460 | - return 39; /*39:unbounded*/ | |
| 459 | + public static function sampleLargeBounds(): int { | |
| 460 | + return 39; /*39:largeBounds*/ | |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | /** |
| @@ -465,15 +465,15 @@ class TopLevel { | ||
| 465 | 465 | * @return bool |
| 466 | 466 | */ |
| 467 | 467 | public function validate(): bool { |
| 468 | - return TopLevel::validateAboveI32Max($this->aboveI32Max) | |
| 469 | - || TopLevel::validateBelowI32Min($this->belowI32Min) | |
| 468 | + return TopLevel::validateSmallPositive($this->smallPositive) | |
| 469 | + || TopLevel::validateSmallNegative($this->smallNegative) | |
| 470 | 470 | || TopLevel::validateI32Range($this->i32Range) |
| 471 | - || TopLevel::validateLargeBounds($this->largeBounds) | |
| 472 | - || TopLevel::validateOnlyMaximum($this->onlyMaximum) | |
| 471 | + || TopLevel::validateAboveI32Max($this->aboveI32Max) | |
| 472 | + || TopLevel::validateBelowI32Min($this->belowI32Min) | |
| 473 | 473 | || TopLevel::validateOnlyMinimum($this->onlyMinimum) |
| 474 | - || TopLevel::validateSmallNegative($this->smallNegative) | |
| 475 | - || TopLevel::validateSmallPositive($this->smallPositive) | |
| 476 | - || TopLevel::validateUnbounded($this->unbounded); | |
| 474 | + || TopLevel::validateOnlyMaximum($this->onlyMaximum) | |
| 475 | + || TopLevel::validateUnbounded($this->unbounded) | |
| 476 | + || TopLevel::validateLargeBounds($this->largeBounds); | |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /** |
| @@ -482,15 +482,15 @@ class TopLevel { | ||
| 482 | 482 | */ |
| 483 | 483 | public function to(): stdClass { |
| 484 | 484 | $out = new stdClass(); |
| 485 | + $out->{'small_positive'} = $this->toSmallPositive(); | |
| 486 | + $out->{'small_negative'} = $this->toSmallNegative(); | |
| 487 | + $out->{'i32_range'} = $this->toI32Range(); | |
| 485 | 488 | $out->{'above_i32_max'} = $this->toAboveI32Max(); |
| 486 | 489 | $out->{'below_i32_min'} = $this->toBelowI32Min(); |
| 487 | - $out->{'i32_range'} = $this->toI32Range(); | |
| 488 | - $out->{'large_bounds'} = $this->toLargeBounds(); | |
| 489 | - $out->{'only_maximum'} = $this->toOnlyMaximum(); | |
| 490 | 490 | $out->{'only_minimum'} = $this->toOnlyMinimum(); |
| 491 | - $out->{'small_negative'} = $this->toSmallNegative(); | |
| 492 | - $out->{'small_positive'} = $this->toSmallPositive(); | |
| 491 | + $out->{'only_maximum'} = $this->toOnlyMaximum(); | |
| 493 | 492 | $out->{'unbounded'} = $this->toUnbounded(); |
| 493 | + $out->{'large_bounds'} = $this->toLargeBounds(); | |
| 494 | 494 | return $out; |
| 495 | 495 | } |
| 496 | 496 | |
| @@ -501,15 +501,15 @@ class TopLevel { | ||
| 501 | 501 | */ |
| 502 | 502 | public static function from(stdClass $obj): TopLevel { |
| 503 | 503 | return new TopLevel( |
| 504 | - TopLevel::fromAboveI32Max($obj->{'above_i32_max'}) | |
| 505 | - ,TopLevel::fromBelowI32Min($obj->{'below_i32_min'}) | |
| 504 | + TopLevel::fromSmallPositive($obj->{'small_positive'}) | |
| 505 | + ,TopLevel::fromSmallNegative($obj->{'small_negative'}) | |
| 506 | 506 | ,TopLevel::fromI32Range($obj->{'i32_range'}) |
| 507 | - ,TopLevel::fromLargeBounds($obj->{'large_bounds'}) | |
| 508 | - ,TopLevel::fromOnlyMaximum($obj->{'only_maximum'}) | |
| 507 | + ,TopLevel::fromAboveI32Max($obj->{'above_i32_max'}) | |
| 508 | + ,TopLevel::fromBelowI32Min($obj->{'below_i32_min'}) | |
| 509 | 509 | ,TopLevel::fromOnlyMinimum($obj->{'only_minimum'}) |
| 510 | - ,TopLevel::fromSmallNegative($obj->{'small_negative'}) | |
| 511 | - ,TopLevel::fromSmallPositive($obj->{'small_positive'}) | |
| 510 | + ,TopLevel::fromOnlyMaximum($obj->{'only_maximum'}) | |
| 512 | 511 | ,TopLevel::fromUnbounded($obj->{'unbounded'}) |
| 512 | + ,TopLevel::fromLargeBounds($obj->{'large_bounds'}) | |
| 513 | 513 | ); |
| 514 | 514 | } |
| 515 | 515 | |
| @@ -518,15 +518,15 @@ class TopLevel { | ||
| 518 | 518 | */ |
| 519 | 519 | public static function sample(): TopLevel { |
| 520 | 520 | return new TopLevel( |
| 521 | - TopLevel::sampleAboveI32Max() | |
| 522 | - ,TopLevel::sampleBelowI32Min() | |
| 521 | + TopLevel::sampleSmallPositive() | |
| 522 | + ,TopLevel::sampleSmallNegative() | |
| 523 | 523 | ,TopLevel::sampleI32Range() |
| 524 | - ,TopLevel::sampleLargeBounds() | |
| 525 | - ,TopLevel::sampleOnlyMaximum() | |
| 524 | + ,TopLevel::sampleAboveI32Max() | |
| 525 | + ,TopLevel::sampleBelowI32Min() | |
| 526 | 526 | ,TopLevel::sampleOnlyMinimum() |
| 527 | - ,TopLevel::sampleSmallNegative() | |
| 528 | - ,TopLevel::sampleSmallPositive() | |
| 527 | + ,TopLevel::sampleOnlyMaximum() | |
| 529 | 528 | ,TopLevel::sampleUnbounded() |
| 529 | + ,TopLevel::sampleLargeBounds() | |
| 530 | 530 | ); |
| 531 | 531 | } |
| 532 | 532 | } |
Mschema-pikedefault / TopLevel.pmod+15 −15
| @@ -13,27 +13,27 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | + int small_positive; // json: "small_positive" | |
| 17 | + int small_negative; // json: "small_negative" | |
| 18 | + int i32_range; // json: "i32_range" | |
| 16 | 19 | int above_i32_max; // json: "above_i32_max" |
| 17 | 20 | int below_i32_min; // json: "below_i32_min" |
| 18 | - int i32_range; // json: "i32_range" | |
| 19 | - int large_bounds; // json: "large_bounds" | |
| 20 | - int only_maximum; // json: "only_maximum" | |
| 21 | 21 | int only_minimum; // json: "only_minimum" |
| 22 | - int small_negative; // json: "small_negative" | |
| 23 | - int small_positive; // json: "small_positive" | |
| 22 | + int only_maximum; // json: "only_maximum" | |
| 24 | 23 | int unbounded; // json: "unbounded" |
| 24 | + int large_bounds; // json: "large_bounds" | |
| 25 | 25 | |
| 26 | 26 | string encode_json() { |
| 27 | 27 | mapping(string:mixed) json = ([ |
| 28 | + "small_positive" : small_positive, | |
| 29 | + "small_negative" : small_negative, | |
| 30 | + "i32_range" : i32_range, | |
| 28 | 31 | "above_i32_max" : above_i32_max, |
| 29 | 32 | "below_i32_min" : below_i32_min, |
| 30 | - "i32_range" : i32_range, | |
| 31 | - "large_bounds" : large_bounds, | |
| 32 | - "only_maximum" : only_maximum, | |
| 33 | 33 | "only_minimum" : only_minimum, |
| 34 | - "small_negative" : small_negative, | |
| 35 | - "small_positive" : small_positive, | |
| 34 | + "only_maximum" : only_maximum, | |
| 36 | 35 | "unbounded" : unbounded, |
| 36 | + "large_bounds" : large_bounds, | |
| 37 | 37 | ]); |
| 38 | 38 | |
| 39 | 39 | return Standards.JSON.encode(json); |
| @@ -43,15 +43,15 @@ class TopLevel { | ||
| 43 | 43 | TopLevel TopLevel_from_JSON(mixed json) { |
| 44 | 44 | TopLevel retval = TopLevel(); |
| 45 | 45 | |
| 46 | + retval.small_positive = json["small_positive"]; | |
| 47 | + retval.small_negative = json["small_negative"]; | |
| 48 | + retval.i32_range = json["i32_range"]; | |
| 46 | 49 | retval.above_i32_max = json["above_i32_max"]; |
| 47 | 50 | retval.below_i32_min = json["below_i32_min"]; |
| 48 | - retval.i32_range = json["i32_range"]; | |
| 49 | - retval.large_bounds = json["large_bounds"]; | |
| 50 | - retval.only_maximum = json["only_maximum"]; | |
| 51 | 51 | retval.only_minimum = json["only_minimum"]; |
| 52 | - retval.small_negative = json["small_negative"]; | |
| 53 | - retval.small_positive = json["small_positive"]; | |
| 52 | + retval.only_maximum = json["only_maximum"]; | |
| 54 | 53 | retval.unbounded = json["unbounded"]; |
| 54 | + retval.large_bounds = json["large_bounds"]; | |
| 55 | 55 | |
| 56 | 56 | return retval; |
| 57 | 57 | } |
Mschema-pythondefault / quicktype.py+16 −16
| @@ -17,41 +17,41 @@ def to_class(c: Type[T], x: Any) -> dict: | ||
| 17 | 17 | |
| 18 | 18 | @dataclass |
| 19 | 19 | class TopLevel: |
| 20 | + small_positive: int | |
| 21 | + small_negative: int | |
| 22 | + i32_range: int | |
| 20 | 23 | above_i32_max: int |
| 21 | 24 | below_i32_min: int |
| 22 | - i32_range: int | |
| 23 | - large_bounds: int | |
| 24 | - only_maximum: int | |
| 25 | 25 | only_minimum: int |
| 26 | - small_negative: int | |
| 27 | - small_positive: int | |
| 26 | + only_maximum: int | |
| 28 | 27 | unbounded: int |
| 28 | + large_bounds: int | |
| 29 | 29 | |
| 30 | 30 | @staticmethod |
| 31 | 31 | def from_dict(obj: Any) -> 'TopLevel': |
| 32 | 32 | assert isinstance(obj, dict) |
| 33 | + small_positive = from_int(obj.get("small_positive")) | |
| 34 | + small_negative = from_int(obj.get("small_negative")) | |
| 35 | + i32_range = from_int(obj.get("i32_range")) | |
| 33 | 36 | above_i32_max = from_int(obj.get("above_i32_max")) |
| 34 | 37 | below_i32_min = from_int(obj.get("below_i32_min")) |
| 35 | - i32_range = from_int(obj.get("i32_range")) | |
| 36 | - large_bounds = from_int(obj.get("large_bounds")) | |
| 37 | - only_maximum = from_int(obj.get("only_maximum")) | |
| 38 | 38 | only_minimum = from_int(obj.get("only_minimum")) |
| 39 | - small_negative = from_int(obj.get("small_negative")) | |
| 40 | - small_positive = from_int(obj.get("small_positive")) | |
| 39 | + only_maximum = from_int(obj.get("only_maximum")) | |
| 41 | 40 | unbounded = from_int(obj.get("unbounded")) |
| 42 | - return TopLevel(above_i32_max, below_i32_min, i32_range, large_bounds, only_maximum, only_minimum, small_negative, small_positive, unbounded) | |
| 41 | + large_bounds = from_int(obj.get("large_bounds")) | |
| 42 | + return TopLevel(small_positive, small_negative, i32_range, above_i32_max, below_i32_min, only_minimum, only_maximum, unbounded, large_bounds) | |
| 43 | 43 | |
| 44 | 44 | def to_dict(self) -> dict: |
| 45 | 45 | result: dict = {} |
| 46 | + result["small_positive"] = from_int(self.small_positive) | |
| 47 | + result["small_negative"] = from_int(self.small_negative) | |
| 48 | + result["i32_range"] = from_int(self.i32_range) | |
| 46 | 49 | result["above_i32_max"] = from_int(self.above_i32_max) |
| 47 | 50 | result["below_i32_min"] = from_int(self.below_i32_min) |
| 48 | - result["i32_range"] = from_int(self.i32_range) | |
| 49 | - result["large_bounds"] = from_int(self.large_bounds) | |
| 50 | - result["only_maximum"] = from_int(self.only_maximum) | |
| 51 | 51 | result["only_minimum"] = from_int(self.only_minimum) |
| 52 | - result["small_negative"] = from_int(self.small_negative) | |
| 53 | - result["small_positive"] = from_int(self.small_positive) | |
| 52 | + result["only_maximum"] = from_int(self.only_maximum) | |
| 54 | 53 | result["unbounded"] = from_int(self.unbounded) |
| 54 | + result["large_bounds"] = from_int(self.large_bounds) | |
| 55 | 55 | return result |
Mschema-rubydefault / TopLevel.rb+16 −16
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.above_i32_max.even? | |
| 7 | +# puts top_level.small_positive.even? | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -20,28 +20,28 @@ module Types | ||
| 20 | 20 | end |
| 21 | 21 | |
| 22 | 22 | class TopLevel < Dry::Struct |
| 23 | + attribute :small_positive, Types::Integer | |
| 24 | + attribute :small_negative, Types::Integer | |
| 25 | + attribute :i32_range, Types::Integer | |
| 23 | 26 | attribute :above_i32_max, Types::Integer |
| 24 | 27 | attribute :below_i32_min, Types::Integer |
| 25 | - attribute :i32_range, Types::Integer | |
| 26 | - attribute :large_bounds, Types::Integer | |
| 27 | - attribute :only_maximum, Types::Integer | |
| 28 | 28 | attribute :only_minimum, Types::Integer |
| 29 | - attribute :small_negative, Types::Integer | |
| 30 | - attribute :small_positive, Types::Integer | |
| 29 | + attribute :only_maximum, Types::Integer | |
| 31 | 30 | attribute :unbounded, Types::Integer |
| 31 | + attribute :large_bounds, Types::Integer | |
| 32 | 32 | |
| 33 | 33 | def self.from_dynamic!(d) |
| 34 | 34 | d = Types::Hash[d] |
| 35 | 35 | new( |
| 36 | + small_positive: d.fetch("small_positive"), | |
| 37 | + small_negative: d.fetch("small_negative"), | |
| 38 | + i32_range: d.fetch("i32_range"), | |
| 36 | 39 | above_i32_max: d.fetch("above_i32_max"), |
| 37 | 40 | below_i32_min: d.fetch("below_i32_min"), |
| 38 | - i32_range: d.fetch("i32_range"), | |
| 39 | - large_bounds: d.fetch("large_bounds"), | |
| 40 | - only_maximum: d.fetch("only_maximum"), | |
| 41 | 41 | only_minimum: d.fetch("only_minimum"), |
| 42 | - small_negative: d.fetch("small_negative"), | |
| 43 | - small_positive: d.fetch("small_positive"), | |
| 42 | + only_maximum: d.fetch("only_maximum"), | |
| 44 | 43 | unbounded: d.fetch("unbounded"), |
| 44 | + large_bounds: d.fetch("large_bounds"), | |
| 45 | 45 | ) |
| 46 | 46 | end |
| 47 | 47 | |
| @@ -51,15 +51,15 @@ class TopLevel < Dry::Struct | ||
| 51 | 51 | |
| 52 | 52 | def to_dynamic |
| 53 | 53 | { |
| 54 | + "small_positive" => small_positive, | |
| 55 | + "small_negative" => small_negative, | |
| 56 | + "i32_range" => i32_range, | |
| 54 | 57 | "above_i32_max" => above_i32_max, |
| 55 | 58 | "below_i32_min" => below_i32_min, |
| 56 | - "i32_range" => i32_range, | |
| 57 | - "large_bounds" => large_bounds, | |
| 58 | - "only_maximum" => only_maximum, | |
| 59 | 59 | "only_minimum" => only_minimum, |
| 60 | - "small_negative" => small_negative, | |
| 61 | - "small_positive" => small_positive, | |
| 60 | + "only_maximum" => only_maximum, | |
| 62 | 61 | "unbounded" => unbounded, |
| 62 | + "large_bounds" => large_bounds, | |
| 63 | 63 | } |
| 64 | 64 | end |
Mschema-rustdefault / module_under_test.rs+7 −7
| @@ -15,21 +15,21 @@ use serde::{Serialize, Deserialize}; | ||
| 15 | 15 | |
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | pub struct TopLevel { |
| 18 | - pub above_i32_max: i64, | |
| 18 | + pub small_positive: i32, | |
| 19 | 19 | |
| 20 | - pub below_i32_min: i64, | |
| 20 | + pub small_negative: i32, | |
| 21 | 21 | |
| 22 | 22 | pub i32_range: i32, |
| 23 | 23 | |
| 24 | - pub large_bounds: i64, | |
| 24 | + pub above_i32_max: i64, | |
| 25 | 25 | |
| 26 | - pub only_maximum: i64, | |
| 26 | + pub below_i32_min: i64, | |
| 27 | 27 | |
| 28 | 28 | pub only_minimum: i64, |
| 29 | 29 | |
| 30 | - pub small_negative: i32, | |
| 31 | - | |
| 32 | - pub small_positive: i32, | |
| 30 | + pub only_maximum: i64, | |
| 33 | 31 | |
| 34 | 32 | pub unbounded: i64, |
| 33 | + | |
| 34 | + pub large_bounds: i64, | |
| 35 | 35 | } |
Mschema-rustinteger-type-conservative--3a501d5af5e7 / module_under_test.rs+7 −7
| @@ -15,21 +15,21 @@ use serde::{Serialize, Deserialize}; | ||
| 15 | 15 | |
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | pub struct TopLevel { |
| 18 | - pub above_i32_max: i64, | |
| 18 | + pub small_positive: i32, | |
| 19 | 19 | |
| 20 | - pub below_i32_min: i64, | |
| 20 | + pub small_negative: i32, | |
| 21 | 21 | |
| 22 | 22 | pub i32_range: i32, |
| 23 | 23 | |
| 24 | - pub large_bounds: i64, | |
| 24 | + pub above_i32_max: i64, | |
| 25 | 25 | |
| 26 | - pub only_maximum: i64, | |
| 26 | + pub below_i32_min: i64, | |
| 27 | 27 | |
| 28 | 28 | pub only_minimum: i64, |
| 29 | 29 | |
| 30 | - pub small_negative: i32, | |
| 31 | - | |
| 32 | - pub small_positive: i32, | |
| 30 | + pub only_maximum: i64, | |
| 33 | 31 | |
| 34 | 32 | pub unbounded: i64, |
| 33 | + | |
| 34 | + pub large_bounds: i64, | |
| 35 | 35 | } |
Mschema-rustinteger-type-force-i64--9c2eded45bf2 / module_under_test.rs+7 −7
| @@ -15,21 +15,21 @@ use serde::{Serialize, Deserialize}; | ||
| 15 | 15 | |
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | pub struct TopLevel { |
| 18 | - pub above_i32_max: i64, | |
| 18 | + pub small_positive: i64, | |
| 19 | 19 | |
| 20 | - pub below_i32_min: i64, | |
| 20 | + pub small_negative: i64, | |
| 21 | 21 | |
| 22 | 22 | pub i32_range: i64, |
| 23 | 23 | |
| 24 | - pub large_bounds: i64, | |
| 24 | + pub above_i32_max: i64, | |
| 25 | 25 | |
| 26 | - pub only_maximum: i64, | |
| 26 | + pub below_i32_min: i64, | |
| 27 | 27 | |
| 28 | 28 | pub only_minimum: i64, |
| 29 | 29 | |
| 30 | - pub small_negative: i64, | |
| 31 | - | |
| 32 | - pub small_positive: i64, | |
| 30 | + pub only_maximum: i64, | |
| 33 | 31 | |
| 34 | 32 | pub unbounded: i64, |
| 33 | + | |
| 34 | + pub large_bounds: i64, | |
| 35 | 35 | } |
Mschema-scala3-upickledefault / TopLevel.scala+6 −6
| @@ -66,13 +66,13 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | + val small_positive : Long, | |
| 70 | + val small_negative : Long, | |
| 71 | + val i32_range : Long, | |
| 69 | 72 | val above_i32_max : Long, |
| 70 | 73 | val below_i32_min : Long, |
| 71 | - val i32_range : Long, | |
| 72 | - val large_bounds : Long, | |
| 73 | - val only_maximum : Long, | |
| 74 | 74 | val only_minimum : Long, |
| 75 | - val small_negative : Long, | |
| 76 | - val small_positive : Long, | |
| 77 | - val unbounded : Long | |
| 75 | + val only_maximum : Long, | |
| 76 | + val unbounded : Long, | |
| 77 | + val large_bounds : Long | |
| 78 | 78 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+6 −6
| @@ -8,13 +8,13 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | + val small_positive : Long, | |
| 12 | + val small_negative : Long, | |
| 13 | + val i32_range : Long, | |
| 11 | 14 | val above_i32_max : Long, |
| 12 | 15 | val below_i32_min : Long, |
| 13 | - val i32_range : Long, | |
| 14 | - val large_bounds : Long, | |
| 15 | - val only_maximum : Long, | |
| 16 | 16 | val only_minimum : Long, |
| 17 | - val small_negative : Long, | |
| 18 | - val small_positive : Long, | |
| 19 | - val unbounded : Long | |
| 17 | + val only_maximum : Long, | |
| 18 | + val unbounded : Long, | |
| 19 | + val large_bounds : Long | |
| 20 | 20 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+15 −15
| @@ -6,14 +6,14 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": {}, |
| 8 | 8 | "properties": { |
| 9 | - "above_i32_max": { | |
| 9 | + "small_positive": { | |
| 10 | 10 | "type": "integer", |
| 11 | 11 | "minimum": 0, |
| 12 | - "maximum": 2147483648 | |
| 12 | + "maximum": 100 | |
| 13 | 13 | }, |
| 14 | - "below_i32_min": { | |
| 14 | + "small_negative": { | |
| 15 | 15 | "type": "integer", |
| 16 | - "minimum": -2147483649, | |
| 16 | + "minimum": -100, | |
| 17 | 17 | "maximum": 0 |
| 18 | 18 | }, |
| 19 | 19 | "i32_range": { |
| @@ -21,31 +21,31 @@ | ||
| 21 | 21 | "minimum": -2147483648, |
| 22 | 22 | "maximum": 2147483647 |
| 23 | 23 | }, |
| 24 | - "large_bounds": { | |
| 24 | + "above_i32_max": { | |
| 25 | 25 | "type": "integer", |
| 26 | - "minimum": -9007199254740991, | |
| 27 | - "maximum": 9007199254740991 | |
| 26 | + "minimum": 0, | |
| 27 | + "maximum": 2147483648 | |
| 28 | 28 | }, |
| 29 | - "only_maximum": { | |
| 29 | + "below_i32_min": { | |
| 30 | 30 | "type": "integer", |
| 31 | + "minimum": -2147483649, | |
| 31 | 32 | "maximum": 0 |
| 32 | 33 | }, |
| 33 | 34 | "only_minimum": { |
| 34 | 35 | "type": "integer", |
| 35 | 36 | "minimum": 0 |
| 36 | 37 | }, |
| 37 | - "small_negative": { | |
| 38 | + "only_maximum": { | |
| 38 | 39 | "type": "integer", |
| 39 | - "minimum": -100, | |
| 40 | 40 | "maximum": 0 |
| 41 | 41 | }, |
| 42 | - "small_positive": { | |
| 43 | - "type": "integer", | |
| 44 | - "minimum": 0, | |
| 45 | - "maximum": 100 | |
| 46 | - }, | |
| 47 | 42 | "unbounded": { |
| 48 | 43 | "type": "integer" |
| 44 | + }, | |
| 45 | + "large_bounds": { | |
| 46 | + "type": "integer", | |
| 47 | + "minimum": -9007199254740991, | |
| 48 | + "maximum": 9007199254740991 | |
| 49 | 49 | } |
| 50 | 50 | }, |
| 51 | 51 | "required": [ |
Mschema-swiftdefault / quicktype.swift+22 −22
| @@ -7,26 +7,26 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | + let smallPositive: Int | |
| 11 | + let smallNegative: Int | |
| 12 | + let i32Range: Int | |
| 10 | 13 | let aboveI32Max: Int |
| 11 | 14 | let belowI32Min: Int |
| 12 | - let i32Range: Int | |
| 13 | - let largeBounds: Int | |
| 14 | - let onlyMaximum: Int | |
| 15 | 15 | let onlyMinimum: Int |
| 16 | - let smallNegative: Int | |
| 17 | - let smallPositive: Int | |
| 16 | + let onlyMaximum: Int | |
| 18 | 17 | let unbounded: Int |
| 18 | + let largeBounds: Int | |
| 19 | 19 | |
| 20 | 20 | enum CodingKeys: String, CodingKey { |
| 21 | + case smallPositive = "small_positive" | |
| 22 | + case smallNegative = "small_negative" | |
| 23 | + case i32Range = "i32_range" | |
| 21 | 24 | case aboveI32Max = "above_i32_max" |
| 22 | 25 | case belowI32Min = "below_i32_min" |
| 23 | - case i32Range = "i32_range" | |
| 24 | - case largeBounds = "large_bounds" | |
| 25 | - case onlyMaximum = "only_maximum" | |
| 26 | 26 | case onlyMinimum = "only_minimum" |
| 27 | - case smallNegative = "small_negative" | |
| 28 | - case smallPositive = "small_positive" | |
| 27 | + case onlyMaximum = "only_maximum" | |
| 29 | 28 | case unbounded = "unbounded" |
| 29 | + case largeBounds = "large_bounds" | |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
| @@ -49,26 +49,26 @@ extension TopLevel { | ||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | func with( |
| 52 | + smallPositive: Int? = nil, | |
| 53 | + smallNegative: Int? = nil, | |
| 54 | + i32Range: Int? = nil, | |
| 52 | 55 | aboveI32Max: Int? = nil, |
| 53 | 56 | belowI32Min: Int? = nil, |
| 54 | - i32Range: Int? = nil, | |
| 55 | - largeBounds: Int? = nil, | |
| 56 | - onlyMaximum: Int? = nil, | |
| 57 | 57 | onlyMinimum: Int? = nil, |
| 58 | - smallNegative: Int? = nil, | |
| 59 | - smallPositive: Int? = nil, | |
| 60 | - unbounded: Int? = nil | |
| 58 | + onlyMaximum: Int? = nil, | |
| 59 | + unbounded: Int? = nil, | |
| 60 | + largeBounds: Int? = nil | |
| 61 | 61 | ) -> TopLevel { |
| 62 | 62 | return TopLevel( |
| 63 | + smallPositive: smallPositive ?? self.smallPositive, | |
| 64 | + smallNegative: smallNegative ?? self.smallNegative, | |
| 65 | + i32Range: i32Range ?? self.i32Range, | |
| 63 | 66 | aboveI32Max: aboveI32Max ?? self.aboveI32Max, |
| 64 | 67 | belowI32Min: belowI32Min ?? self.belowI32Min, |
| 65 | - i32Range: i32Range ?? self.i32Range, | |
| 66 | - largeBounds: largeBounds ?? self.largeBounds, | |
| 67 | - onlyMaximum: onlyMaximum ?? self.onlyMaximum, | |
| 68 | 68 | onlyMinimum: onlyMinimum ?? self.onlyMinimum, |
| 69 | - smallNegative: smallNegative ?? self.smallNegative, | |
| 70 | - smallPositive: smallPositive ?? self.smallPositive, | |
| 71 | - unbounded: unbounded ?? self.unbounded | |
| 69 | + onlyMaximum: onlyMaximum ?? self.onlyMaximum, | |
| 70 | + unbounded: unbounded ?? self.unbounded, | |
| 71 | + largeBounds: largeBounds ?? self.largeBounds | |
| 72 | 72 | ) |
| 73 | 73 | } |
Mschema-typescript-zoddefault / TopLevel.ts+5 −5
| @@ -2,14 +2,14 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | + "small_positive": z.number(), | |
| 6 | + "small_negative": z.number(), | |
| 7 | + "i32_range": z.number(), | |
| 5 | 8 | "above_i32_max": z.number(), |
| 6 | 9 | "below_i32_min": z.number(), |
| 7 | - "i32_range": z.number(), | |
| 8 | - "large_bounds": z.number(), | |
| 9 | - "only_maximum": z.number(), | |
| 10 | 10 | "only_minimum": z.number(), |
| 11 | - "small_negative": z.number(), | |
| 12 | - "small_positive": z.number(), | |
| 11 | + "only_maximum": z.number(), | |
| 13 | 12 | "unbounded": z.number(), |
| 13 | + "large_bounds": z.number(), | |
| 14 | 14 | }); |
| 15 | 15 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+10 −10
| @@ -8,15 +8,15 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | + small_positive: number; | |
| 12 | + small_negative: number; | |
| 13 | + i32_range: number; | |
| 11 | 14 | above_i32_max: number; |
| 12 | 15 | below_i32_min: number; |
| 13 | - i32_range: number; | |
| 14 | - large_bounds: number; | |
| 15 | - only_maximum: number; | |
| 16 | 16 | only_minimum: number; |
| 17 | - small_negative: number; | |
| 18 | - small_positive: number; | |
| 17 | + only_maximum: number; | |
| 19 | 18 | unbounded: number; |
| 19 | + large_bounds: number; | |
| 20 | 20 | [property: string]: unknown; |
| 21 | 21 | } |
| 22 | 22 | |
| @@ -187,14 +187,14 @@ function r(name: string) { | ||
| 187 | 187 | |
| 188 | 188 | const typeMap: any = { |
| 189 | 189 | "TopLevel": o([ |
| 190 | + { json: "small_positive", js: "small_positive", typ: 0 }, | |
| 191 | + { json: "small_negative", js: "small_negative", typ: 0 }, | |
| 192 | + { json: "i32_range", js: "i32_range", typ: 0 }, | |
| 190 | 193 | { json: "above_i32_max", js: "above_i32_max", typ: 0 }, |
| 191 | 194 | { json: "below_i32_min", js: "below_i32_min", typ: 0 }, |
| 192 | - { json: "i32_range", js: "i32_range", typ: 0 }, | |
| 193 | - { json: "large_bounds", js: "large_bounds", typ: 0 }, | |
| 194 | - { json: "only_maximum", js: "only_maximum", typ: 0 }, | |
| 195 | 195 | { json: "only_minimum", js: "only_minimum", typ: 0 }, |
| 196 | - { json: "small_negative", js: "small_negative", typ: 0 }, | |
| 197 | - { json: "small_positive", js: "small_positive", typ: 0 }, | |
| 196 | + { json: "only_maximum", js: "only_maximum", typ: 0 }, | |
| 198 | 197 | { json: "unbounded", js: "unbounded", typ: 0 }, |
| 198 | + { json: "large_bounds", js: "large_bounds", typ: 0 }, | |
| 199 | 199 | ], "any"), |
| 200 | 200 | }; |
Test case
10 generated files · +82 −82test/inputs/schema/keyword-unions.schema
Mschema-cjsondefault / TopLevel.c+20 −20
| @@ -24814,11 +24814,6 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 24814 | 24814 | if (cJSON_HasObjectItem(j, "double")) { |
| 24815 | 24815 | x->top_level_double = cJSON_GetUnionDoubleValue(cJSON_GetObjectItemCaseSensitive(j, "double")); |
| 24816 | 24816 | } |
| 24817 | - if (cJSON_HasObjectItem(j, "dummy")) { | |
| 24818 | - if (NULL != (x->dummy = cJSON_malloc(sizeof(double)))) { | |
| 24819 | - *x->dummy = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "dummy")); | |
| 24820 | - } | |
| 24821 | - } | |
| 24822 | 24817 | if (cJSON_HasObjectItem(j, "dynamic")) { |
| 24823 | 24818 | x->dynamic = cJSON_GetUnionDynamicValue(cJSON_GetObjectItemCaseSensitive(j, "dynamic")); |
| 24824 | 24819 | } |
| @@ -24975,12 +24970,12 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 24975 | 24970 | if (cJSON_HasObjectItem(j, "internal")) { |
| 24976 | 24971 | x->internal = cJSON_GetUnionInternalValue(cJSON_GetObjectItemCaseSensitive(j, "internal")); |
| 24977 | 24972 | } |
| 24978 | - if (cJSON_HasObjectItem(j, "is")) { | |
| 24979 | - x->is = cJSON_GetUnionIsValue(cJSON_GetObjectItemCaseSensitive(j, "is")); | |
| 24980 | - } | |
| 24981 | 24973 | if (cJSON_HasObjectItem(j, "iterable")) { |
| 24982 | 24974 | x->iterable = cJSON_GetUnionIterableValue(cJSON_GetObjectItemCaseSensitive(j, "iterable")); |
| 24983 | 24975 | } |
| 24976 | + if (cJSON_HasObjectItem(j, "is")) { | |
| 24977 | + x->is = cJSON_GetUnionIsValue(cJSON_GetObjectItemCaseSensitive(j, "is")); | |
| 24978 | + } | |
| 24984 | 24979 | if (cJSON_HasObjectItem(j, "jdec")) { |
| 24985 | 24980 | x->jdec = cJSON_GetUnionJdecValue(cJSON_GetObjectItemCaseSensitive(j, "jdec")); |
| 24986 | 24981 | } |
| @@ -25419,6 +25414,11 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 25419 | 25414 | if (cJSON_HasObjectItem(j, "yield")) { |
| 25420 | 25415 | x->yield = cJSON_GetUnionYieldValue(cJSON_GetObjectItemCaseSensitive(j, "yield")); |
| 25421 | 25416 | } |
| 25417 | + if (cJSON_HasObjectItem(j, "dummy")) { | |
| 25418 | + if (NULL != (x->dummy = cJSON_malloc(sizeof(double)))) { | |
| 25419 | + *x->dummy = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "dummy")); | |
| 25420 | + } | |
| 25421 | + } | |
| 25422 | 25422 | } |
| 25423 | 25423 | } |
| 25424 | 25424 | return x; |
| @@ -25656,9 +25656,6 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 25656 | 25656 | if (NULL != x->top_level_double) { |
| 25657 | 25657 | cJSON_AddItemToObject(j, "double", cJSON_CreateUnionDouble(x->top_level_double)); |
| 25658 | 25658 | } |
| 25659 | - if (NULL != x->dummy) { | |
| 25660 | - cJSON_AddNumberToObject(j, "dummy", *x->dummy); | |
| 25661 | - } | |
| 25662 | 25659 | if (NULL != x->dynamic) { |
| 25663 | 25660 | cJSON_AddItemToObject(j, "dynamic", cJSON_CreateUnionDynamic(x->dynamic)); |
| 25664 | 25661 | } |
| @@ -25815,12 +25812,12 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 25815 | 25812 | if (NULL != x->internal) { |
| 25816 | 25813 | cJSON_AddItemToObject(j, "internal", cJSON_CreateUnionInternal(x->internal)); |
| 25817 | 25814 | } |
| 25818 | - if (NULL != x->is) { | |
| 25819 | - cJSON_AddItemToObject(j, "is", cJSON_CreateUnionIs(x->is)); | |
| 25820 | - } | |
| 25821 | 25815 | if (NULL != x->iterable) { |
| 25822 | 25816 | cJSON_AddItemToObject(j, "iterable", cJSON_CreateUnionIterable(x->iterable)); |
| 25823 | 25817 | } |
| 25818 | + if (NULL != x->is) { | |
| 25819 | + cJSON_AddItemToObject(j, "is", cJSON_CreateUnionIs(x->is)); | |
| 25820 | + } | |
| 25824 | 25821 | if (NULL != x->jdec) { |
| 25825 | 25822 | cJSON_AddItemToObject(j, "jdec", cJSON_CreateUnionJdec(x->jdec)); |
| 25826 | 25823 | } |
| @@ -26259,6 +26256,9 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 26259 | 26256 | if (NULL != x->yield) { |
| 26260 | 26257 | cJSON_AddItemToObject(j, "yield", cJSON_CreateUnionYield(x->yield)); |
| 26261 | 26258 | } |
| 26259 | + if (NULL != x->dummy) { | |
| 26260 | + cJSON_AddNumberToObject(j, "dummy", *x->dummy); | |
| 26261 | + } | |
| 26262 | 26262 | } |
| 26263 | 26263 | } |
| 26264 | 26264 | return j; |
| @@ -26506,9 +26506,6 @@ void cJSON_DeleteTopLevel(struct TopLevel * x) { | ||
| 26506 | 26506 | if (NULL != x->top_level_double) { |
| 26507 | 26507 | cJSON_DeleteUnionDouble(x->top_level_double); |
| 26508 | 26508 | } |
| 26509 | - if (NULL != x->dummy) { | |
| 26510 | - cJSON_free(x->dummy); | |
| 26511 | - } | |
| 26512 | 26509 | if (NULL != x->dynamic) { |
| 26513 | 26510 | cJSON_DeleteUnionDynamic(x->dynamic); |
| 26514 | 26511 | } |
| @@ -26665,12 +26662,12 @@ void cJSON_DeleteTopLevel(struct TopLevel * x) { | ||
| 26665 | 26662 | if (NULL != x->internal) { |
| 26666 | 26663 | cJSON_DeleteUnionInternal(x->internal); |
| 26667 | 26664 | } |
| 26668 | - if (NULL != x->is) { | |
| 26669 | - cJSON_DeleteUnionIs(x->is); | |
| 26670 | - } | |
| 26671 | 26665 | if (NULL != x->iterable) { |
| 26672 | 26666 | cJSON_DeleteUnionIterable(x->iterable); |
| 26673 | 26667 | } |
| 26668 | + if (NULL != x->is) { | |
| 26669 | + cJSON_DeleteUnionIs(x->is); | |
| 26670 | + } | |
| 26674 | 26671 | if (NULL != x->jdec) { |
| 26675 | 26672 | cJSON_DeleteUnionJdec(x->jdec); |
| 26676 | 26673 | } |
| @@ -27109,6 +27106,9 @@ void cJSON_DeleteTopLevel(struct TopLevel * x) { | ||
| 27109 | 27106 | if (NULL != x->yield) { |
| 27110 | 27107 | cJSON_DeleteUnionYield(x->yield); |
| 27111 | 27108 | } |
| 27109 | + if (NULL != x->dummy) { | |
| 27110 | + cJSON_free(x->dummy); | |
| 27111 | + } | |
| 27112 | 27112 | cJSON_free(x); |
| 27113 | 27113 | } |
| 27114 | 27114 | } |
Mschema-cjsondefault / TopLevel.h+2 −2
| @@ -3147,7 +3147,6 @@ struct TopLevel { | ||
| 3147 | 3147 | struct UnionDidSet * did_set; |
| 3148 | 3148 | struct UnionDo * top_level_do; |
| 3149 | 3149 | struct UnionDouble * top_level_double; |
| 3150 | - double * dummy; | |
| 3151 | 3150 | struct UnionDynamic * dynamic; |
| 3152 | 3151 | struct UnionDynamicCast * top_level_dynamic_cast; |
| 3153 | 3152 | struct UnionElif * elif; |
| @@ -3200,8 +3199,8 @@ struct TopLevel { | ||
| 3200 | 3199 | struct UnionInt * top_level_int; |
| 3201 | 3200 | struct UnionInterface * interface; |
| 3202 | 3201 | struct UnionInternal * internal; |
| 3203 | - struct UnionIs * is; | |
| 3204 | 3202 | struct UnionIterable * iterable; |
| 3203 | + struct UnionIs * is; | |
| 3205 | 3204 | struct UnionJdec * jdec; |
| 3206 | 3205 | struct UnionJenc * jenc; |
| 3207 | 3206 | struct UnionJpipe * jpipe; |
| @@ -3348,6 +3347,7 @@ struct TopLevel { | ||
| 3348 | 3347 | struct UnionXorEq * top_level_xor_eq; |
| 3349 | 3348 | struct UnionYes * yes; |
| 3350 | 3349 | struct UnionYield * yield; |
| 3350 | + double * dummy; | |
| 3351 | 3351 | }; |
| 3352 | 3352 | |
| 3353 | 3353 | struct UnionAbstract * cJSON_GetUnionAbstractValue(const cJSON * j); |
Mschema-csharp-recordsdefault / QuickType.cs+6 −6
| @@ -253,9 +253,6 @@ namespace QuickType | ||
| 253 | 253 | [JsonProperty("double", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 254 | 254 | public UnionDouble? Double { get; set; } |
| 255 | 255 | |
| 256 | - [JsonProperty("dummy", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 257 | - public double? Dummy { get; set; } | |
| 258 | - | |
| 259 | 256 | [JsonProperty("dynamic", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 260 | 257 | public UnionDynamic? Dynamic { get; set; } |
| 261 | 258 | |
| @@ -412,12 +409,12 @@ namespace QuickType | ||
| 412 | 409 | [JsonProperty("internal", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 413 | 410 | public UnionInternal? Internal { get; set; } |
| 414 | 411 | |
| 415 | - [JsonProperty("is", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 416 | - public UnionIs? Is { get; set; } | |
| 417 | - | |
| 418 | 412 | [JsonProperty("iterable", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 419 | 413 | public UnionIterable? Iterable { get; set; } |
| 420 | 414 | |
| 415 | + [JsonProperty("is", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 416 | + public UnionIs? Is { get; set; } | |
| 417 | + | |
| 421 | 418 | [JsonProperty("jdec", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 422 | 419 | public UnionJdec? Jdec { get; set; } |
| 423 | 420 | |
| @@ -855,6 +852,9 @@ namespace QuickType | ||
| 855 | 852 | |
| 856 | 853 | [JsonProperty("yield", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 857 | 854 | public UnionYield? Yield { get; set; } |
| 855 | + | |
| 856 | + [JsonProperty("dummy", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 857 | + public double? Dummy { get; set; } | |
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | public partial record Abstract |
Mschema-csharpdefault / QuickType.cs+6 −6
| @@ -253,9 +253,6 @@ namespace QuickType | ||
| 253 | 253 | [JsonProperty("double", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 254 | 254 | public UnionDouble? Double { get; set; } |
| 255 | 255 | |
| 256 | - [JsonProperty("dummy", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 257 | - public double? Dummy { get; set; } | |
| 258 | - | |
| 259 | 256 | [JsonProperty("dynamic", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 260 | 257 | public UnionDynamic? Dynamic { get; set; } |
| 261 | 258 | |
| @@ -412,12 +409,12 @@ namespace QuickType | ||
| 412 | 409 | [JsonProperty("internal", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 413 | 410 | public UnionInternal? Internal { get; set; } |
| 414 | 411 | |
| 415 | - [JsonProperty("is", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 416 | - public UnionIs? Is { get; set; } | |
| 417 | - | |
| 418 | 412 | [JsonProperty("iterable", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 419 | 413 | public UnionIterable? Iterable { get; set; } |
| 420 | 414 | |
| 415 | + [JsonProperty("is", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 416 | + public UnionIs? Is { get; set; } | |
| 417 | + | |
| 421 | 418 | [JsonProperty("jdec", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 422 | 419 | public UnionJdec? Jdec { get; set; } |
| 423 | 420 | |
| @@ -855,6 +852,9 @@ namespace QuickType | ||
| 855 | 852 | |
| 856 | 853 | [JsonProperty("yield", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 857 | 854 | public UnionYield? Yield { get; set; } |
| 855 | + | |
| 856 | + [JsonProperty("dummy", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 857 | + public double? Dummy { get; set; } | |
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | public partial class Abstract |
Mschema-elixirdefault / QuickType.ex+20 −20
| @@ -8010,7 +8010,7 @@ defmodule Yield do | ||
| 8010 | 8010 | end |
| 8011 | 8011 | |
| 8012 | 8012 | defmodule TopLevel do |
| 8013 | - defstruct [:empty, :top_level_bool, :complex, :imaginery, :abstract, :alignas, :alignof, :top_level_and, :and_eq, :top_level_any, :any, :array, :as, :asm, :assert, :associatedtype, :associativity, :async, :atomic, :atomic_cancel, :atomic_commit, :atomic_noexcept, :auto, :await, :base, :bitand, :bitor, :bool, :bool_1, :boolean, :break, :bycopy, :byref, :byte, :case, :top_level_catch, :chan, :char, :char16_t, :char32_t, :checked, :top_level_class, :class, :co_await, :co_return, :co_yield, :compl, :concept, :console, :const, :const_cast, :constexpr, :constructor, :continue, :convenience, :convert, :converter, :date, :date_parse_handling, :debugger, :decimal, :declare, :decltype, :decode_string, :top_level_def, :default, :defer, :deinit, :del, :delegate, :delete, :dict, :dictionary, :did_set, :top_level_do, :double, :dummy, :dynamic, :dynamic_cast, :elif, :top_level_else, :encode_quick_type, :enum, :event, :except, :exception, :explicit, :export, :exposing, :extends, :extension, :extern, :fallthrough, :false_1, :top_level_false, :fileprivate, :final, :finally, :fixed, :float, :for, :foreach, :friend, :from, :from_json, :func, :function, :get, :global, :go, :goto, :guard, :has_own_property, :id, :if, :imp, :implements, :implicit, :top_level_import, :top_level_in, :indirect, :infix, :init, :inline, :inout, :instanceof, :int, :interface, :internal, :is, :iterable, :jdec, :jenc, :jpipe, :json, :json_converter, :json_serializer, :json_token, :json_writer, :lambda, :lazy, :left, :let, :list, :lock, :long, :map, :metadata_property_handling, :module, :mutable, :mutating, :namespace, :native, :new, :newtonsoft, :top_level_nil, :no, :noexcept, :nonatomic, :top_level_none, :none, :nonlocal, :nonmutating, :top_level_not, :not_eq, :ns_string, :null, :top_level_null, :nullptr, :number, :object, :of, :oneway, :open, :operator, :optional, :top_level_or, :or_eq, :out, :override, :package, :params, :pass, :port, :postfix, :precedence, :prefix, :print, :printf, :private, :protected, :protocol, :top_level_protocol, :public, :quicktype, :raise, :range, :readonly, :ref, :register, :reinterpret_cast, :repeat, :require, :required, :requires, :restrict, :retain, :rethrows, :return, :right, :sbyte, :sealed, :sel, :select, :self, :top_level_self, :serialize, :set, :short, :signed, :sizeof, :stackalloc, :static, :static_assert, :static_cast, :strictfp, :string, :struct, :subscript, :super, :switch, :symbol, :synchronized, :system, :template, :then, :this, :thread_local, :throw, :throws, :to_json, :top_level, :transient, :top_level_true, :true_1, :try, :type, :top_level_type, :typealias, :typedef, :typeid, :typename, :typeof, :uint, :ulong, :unchecked, :undefined, :union, :unowned, :unsafe, :unsigned, :ushort, :using, :var, :virtual, :void, :volatile, :wchar_t, :weak, :where, :while, :will_set, :with, :xor, :xor_eq, :yes, :yield] | |
| 8013 | + defstruct [:empty, :top_level_bool, :complex, :imaginery, :abstract, :alignas, :alignof, :top_level_and, :and_eq, :top_level_any, :any, :array, :as, :asm, :assert, :associatedtype, :associativity, :async, :atomic, :atomic_cancel, :atomic_commit, :atomic_noexcept, :auto, :await, :base, :bitand, :bitor, :bool, :bool_1, :boolean, :break, :bycopy, :byref, :byte, :case, :top_level_catch, :chan, :char, :char16_t, :char32_t, :checked, :top_level_class, :class, :co_await, :co_return, :co_yield, :compl, :concept, :console, :const, :const_cast, :constexpr, :constructor, :continue, :convenience, :convert, :converter, :date, :date_parse_handling, :debugger, :decimal, :declare, :decltype, :decode_string, :top_level_def, :default, :defer, :deinit, :del, :delegate, :delete, :dict, :dictionary, :did_set, :top_level_do, :double, :dynamic, :dynamic_cast, :elif, :top_level_else, :encode_quick_type, :enum, :event, :except, :exception, :explicit, :export, :exposing, :extends, :extension, :extern, :fallthrough, :false_1, :top_level_false, :fileprivate, :final, :finally, :fixed, :float, :for, :foreach, :friend, :from, :from_json, :func, :function, :get, :global, :go, :goto, :guard, :has_own_property, :id, :if, :imp, :implements, :implicit, :top_level_import, :top_level_in, :indirect, :infix, :init, :inline, :inout, :instanceof, :int, :interface, :internal, :iterable, :is, :jdec, :jenc, :jpipe, :json, :json_converter, :json_serializer, :json_token, :json_writer, :lambda, :lazy, :left, :let, :list, :lock, :long, :map, :metadata_property_handling, :module, :mutable, :mutating, :namespace, :native, :new, :newtonsoft, :top_level_nil, :no, :noexcept, :nonatomic, :top_level_none, :none, :nonlocal, :nonmutating, :top_level_not, :not_eq, :ns_string, :null, :top_level_null, :nullptr, :number, :object, :of, :oneway, :open, :operator, :optional, :top_level_or, :or_eq, :out, :override, :package, :params, :pass, :port, :postfix, :precedence, :prefix, :print, :printf, :private, :protected, :protocol, :top_level_protocol, :public, :quicktype, :raise, :range, :readonly, :ref, :register, :reinterpret_cast, :repeat, :require, :required, :requires, :restrict, :retain, :rethrows, :return, :right, :sbyte, :sealed, :sel, :select, :self, :top_level_self, :serialize, :set, :short, :signed, :sizeof, :stackalloc, :static, :static_assert, :static_cast, :strictfp, :string, :struct, :subscript, :super, :switch, :symbol, :synchronized, :system, :template, :then, :this, :thread_local, :throw, :throws, :to_json, :top_level, :transient, :top_level_true, :true_1, :try, :type, :top_level_type, :typealias, :typedef, :typeid, :typename, :typeof, :uint, :ulong, :unchecked, :undefined, :union, :unowned, :unsafe, :unsigned, :ushort, :using, :var, :virtual, :void, :volatile, :wchar_t, :weak, :where, :while, :will_set, :with, :xor, :xor_eq, :yes, :yield, :dummy] | |
| 8014 | 8014 | |
| 8015 | 8015 | @type t :: %__MODULE__{ |
| 8016 | 8016 | empty: Empty.t() | float() | nil, |
| @@ -8089,7 +8089,6 @@ defmodule TopLevel do | ||
| 8089 | 8089 | did_set: DidSet.t() | float() | nil, |
| 8090 | 8090 | top_level_do: DoClass.t() | float() | nil, |
| 8091 | 8091 | double: Double.t() | float() | nil, |
| 8092 | - dummy: float() | nil, | |
| 8093 | 8092 | dynamic: Dynamic.t() | float() | nil, |
| 8094 | 8093 | dynamic_cast: DynamicCast.t() | float() | nil, |
| 8095 | 8094 | elif: Elif.t() | float() | nil, |
| @@ -8142,8 +8141,8 @@ defmodule TopLevel do | ||
| 8142 | 8141 | int: Int.t() | float() | nil, |
| 8143 | 8142 | interface: Interface.t() | float() | nil, |
| 8144 | 8143 | internal: Internal.t() | float() | nil, |
| 8145 | - is: Is.t() | float() | nil, | |
| 8146 | 8144 | iterable: Iterable.t() | float() | nil, |
| 8145 | + is: Is.t() | float() | nil, | |
| 8147 | 8146 | jdec: Jdec.t() | float() | nil, |
| 8148 | 8147 | jenc: Jenc.t() | float() | nil, |
| 8149 | 8148 | jpipe: Jpipe.t() | float() | nil, |
| @@ -8289,7 +8288,8 @@ defmodule TopLevel do | ||
| 8289 | 8288 | xor: Xor.t() | float() | nil, |
| 8290 | 8289 | xor_eq: XorEq.t() | float() | nil, |
| 8291 | 8290 | yes: Yes.t() | float() | nil, |
| 8292 | - yield: Yield.t() | float() | nil | |
| 8291 | + yield: Yield.t() | float() | nil, | |
| 8292 | + dummy: float() | nil | |
| 8293 | 8293 | } |
| 8294 | 8294 | |
| 8295 | 8295 | def decode_empty(%{} = value), do: Empty.from_map(value) |
| @@ -9828,18 +9828,6 @@ defmodule TopLevel do | ||
| 9828 | 9828 | def encode_internal(value) when is_nil(value), do: value |
| 9829 | 9829 | def encode_internal(_), do: {:error, "Unexpected type when encoding TopLevel.internal"} |
| 9830 | 9830 | |
| 9831 | - def decode_is(%{} = value), do: Is.from_map(value) | |
| 9832 | - def decode_is(value) when is_float(value), do: value | |
| 9833 | - def decode_is(value) when is_integer(value), do: value | |
| 9834 | - def decode_is(value) when is_nil(value), do: value | |
| 9835 | - def decode_is(_), do: {:error, "Unexpected type when decoding TopLevel.is"} | |
| 9836 | - | |
| 9837 | - def encode_is(%Is{} = value), do: Is.to_map(value) | |
| 9838 | - def encode_is(value) when is_float(value), do: value | |
| 9839 | - def encode_is(value) when is_integer(value), do: value | |
| 9840 | - def encode_is(value) when is_nil(value), do: value | |
| 9841 | - def encode_is(_), do: {:error, "Unexpected type when encoding TopLevel.is"} | |
| 9842 | - | |
| 9843 | 9831 | def decode_iterable(%{} = value), do: Iterable.from_map(value) |
| 9844 | 9832 | def decode_iterable(value) when is_float(value), do: value |
| 9845 | 9833 | def decode_iterable(value) when is_integer(value), do: value |
| @@ -9852,6 +9840,18 @@ defmodule TopLevel do | ||
| 9852 | 9840 | def encode_iterable(value) when is_nil(value), do: value |
| 9853 | 9841 | def encode_iterable(_), do: {:error, "Unexpected type when encoding TopLevel.iterable"} |
| 9854 | 9842 | |
| 9843 | + def decode_is(%{} = value), do: Is.from_map(value) | |
| 9844 | + def decode_is(value) when is_float(value), do: value | |
| 9845 | + def decode_is(value) when is_integer(value), do: value | |
| 9846 | + def decode_is(value) when is_nil(value), do: value | |
| 9847 | + def decode_is(_), do: {:error, "Unexpected type when decoding TopLevel.is"} | |
| 9848 | + | |
| 9849 | + def encode_is(%Is{} = value), do: Is.to_map(value) | |
| 9850 | + def encode_is(value) when is_float(value), do: value | |
| 9851 | + def encode_is(value) when is_integer(value), do: value | |
| 9852 | + def encode_is(value) when is_nil(value), do: value | |
| 9853 | + def encode_is(_), do: {:error, "Unexpected type when encoding TopLevel.is"} | |
| 9854 | + | |
| 9855 | 9855 | def decode_jdec(%{} = value), do: Jdec.from_map(value) |
| 9856 | 9856 | def decode_jdec(value) when is_float(value), do: value |
| 9857 | 9857 | def decode_jdec(value) when is_integer(value), do: value |
| @@ -11682,7 +11682,6 @@ defmodule TopLevel do | ||
| 11682 | 11682 | did_set: decode_did_set(m["didSet"]), |
| 11683 | 11683 | top_level_do: decode_top_level_do(m["do"]), |
| 11684 | 11684 | double: decode_double(m["double"]), |
| 11685 | - dummy: m["dummy"], | |
| 11686 | 11685 | dynamic: decode_dynamic(m["dynamic"]), |
| 11687 | 11686 | dynamic_cast: decode_dynamic_cast(m["dynamic_cast"]), |
| 11688 | 11687 | elif: decode_elif(m["elif"]), |
| @@ -11735,8 +11734,8 @@ defmodule TopLevel do | ||
| 11735 | 11734 | int: decode_int(m["int"]), |
| 11736 | 11735 | interface: decode_interface(m["interface"]), |
| 11737 | 11736 | internal: decode_internal(m["internal"]), |
| 11738 | - is: decode_is(m["is"]), | |
| 11739 | 11737 | iterable: decode_iterable(m["iterable"]), |
| 11738 | + is: decode_is(m["is"]), | |
| 11740 | 11739 | jdec: decode_jdec(m["jdec"]), |
| 11741 | 11740 | jenc: decode_jenc(m["jenc"]), |
| 11742 | 11741 | jpipe: decode_jpipe(m["jpipe"]), |
| @@ -11883,6 +11882,7 @@ defmodule TopLevel do | ||
| 11883 | 11882 | xor_eq: decode_xor_eq(m["xor_eq"]), |
| 11884 | 11883 | yes: decode_yes(m["YES"]), |
| 11885 | 11884 | yield: decode_yield(m["yield"]), |
| 11885 | + dummy: m["dummy"], | |
| 11886 | 11886 | } |
| 11887 | 11887 | end |
| 11888 | 11888 | |
| @@ -11970,7 +11970,6 @@ defmodule TopLevel do | ||
| 11970 | 11970 | "didSet" => encode_did_set(struct.did_set), |
| 11971 | 11971 | "do" => encode_top_level_do(struct.top_level_do), |
| 11972 | 11972 | "double" => encode_double(struct.double), |
| 11973 | - "dummy" => struct.dummy, | |
| 11974 | 11973 | "dynamic" => encode_dynamic(struct.dynamic), |
| 11975 | 11974 | "dynamic_cast" => encode_dynamic_cast(struct.dynamic_cast), |
| 11976 | 11975 | "elif" => encode_elif(struct.elif), |
| @@ -12023,8 +12022,8 @@ defmodule TopLevel do | ||
| 12023 | 12022 | "int" => encode_int(struct.int), |
| 12024 | 12023 | "interface" => encode_interface(struct.interface), |
| 12025 | 12024 | "internal" => encode_internal(struct.internal), |
| 12026 | - "is" => encode_is(struct.is), | |
| 12027 | 12025 | "iterable" => encode_iterable(struct.iterable), |
| 12026 | + "is" => encode_is(struct.is), | |
| 12028 | 12027 | "jdec" => encode_jdec(struct.jdec), |
| 12029 | 12028 | "jenc" => encode_jenc(struct.jenc), |
| 12030 | 12029 | "jpipe" => encode_jpipe(struct.jpipe), |
| @@ -12171,6 +12170,7 @@ defmodule TopLevel do | ||
| 12171 | 12170 | "xor_eq" => encode_xor_eq(struct.xor_eq), |
| 12172 | 12171 | "YES" => encode_yes(struct.yes), |
| 12173 | 12172 | "yield" => encode_yield(struct.yield), |
| 12173 | + "dummy" => struct.dummy, | |
| 12174 | 12174 | } |
| 12175 | 12175 | end |
Mschema-golangdefault / quicktype.go+2 −2
| @@ -98,7 +98,6 @@ type TopLevel struct { | ||
| 98 | 98 | DidSet *UnionDidSet `json:"didSet"` |
| 99 | 99 | Do *UnionDo `json:"do"` |
| 100 | 100 | Double *UnionDouble `json:"double"` |
| 101 | - Dummy *float64 `json:"dummy,omitempty"` | |
| 102 | 101 | Dynamic *UnionDynamic `json:"dynamic"` |
| 103 | 102 | DynamicCast *UnionDynamicCast `json:"dynamic_cast"` |
| 104 | 103 | Elif *UnionElif `json:"elif"` |
| @@ -151,8 +150,8 @@ type TopLevel struct { | ||
| 151 | 150 | Int *UnionInt `json:"int"` |
| 152 | 151 | Interface *UnionInterface `json:"interface"` |
| 153 | 152 | Internal *UnionInternal `json:"internal"` |
| 154 | - Is *UnionIs `json:"is"` | |
| 155 | 153 | Iterable *UnionIterable `json:"iterable"` |
| 154 | + Is *UnionIs `json:"is"` | |
| 156 | 155 | Jdec *UnionJdec `json:"jdec"` |
| 157 | 156 | Jenc *UnionJenc `json:"jenc"` |
| 158 | 157 | Jpipe *UnionJpipe `json:"jpipe"` |
| @@ -299,6 +298,7 @@ type TopLevel struct { | ||
| 299 | 298 | XorEq *UnionXorEq `json:"xor_eq"` |
| 300 | 299 | Yes *UnionYES `json:"YES"` |
| 301 | 300 | Yield *UnionYield `json:"yield"` |
| 301 | + Dummy *float64 `json:"dummy,omitempty"` | |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | type ASM struct { |
Mschema-rubydefault / TopLevel.rb+6 −6
| @@ -15828,7 +15828,6 @@ class TopLevel < Dry::Struct | ||
| 15828 | 15828 | attribute :did_set, Types.Instance(UnionDidSet).optional |
| 15829 | 15829 | attribute :top_level_do, Types.Instance(UnionDo).optional |
| 15830 | 15830 | attribute :double, Types.Instance(UnionDouble).optional |
| 15831 | - attribute :dummy, Types::Double.optional | |
| 15832 | 15831 | attribute :dynamic, Types.Instance(UnionDynamic).optional |
| 15833 | 15832 | attribute :dynamic_cast, Types.Instance(UnionDynamicCast).optional |
| 15834 | 15833 | attribute :elif, Types.Instance(UnionElif).optional |
| @@ -15881,8 +15880,8 @@ class TopLevel < Dry::Struct | ||
| 15881 | 15880 | attribute :int, Types.Instance(UnionInt).optional |
| 15882 | 15881 | attribute :interface, Types.Instance(UnionInterface).optional |
| 15883 | 15882 | attribute :internal, Types.Instance(UnionInternal).optional |
| 15884 | - attribute :is, Types.Instance(UnionIs).optional | |
| 15885 | 15883 | attribute :iterable, Types.Instance(UnionIterable).optional |
| 15884 | + attribute :is, Types.Instance(UnionIs).optional | |
| 15886 | 15885 | attribute :jdec, Types.Instance(UnionJdec).optional |
| 15887 | 15886 | attribute :jenc, Types.Instance(UnionJenc).optional |
| 15888 | 15887 | attribute :jpipe, Types.Instance(UnionJpipe).optional |
| @@ -16029,6 +16028,7 @@ class TopLevel < Dry::Struct | ||
| 16029 | 16028 | attribute :xor_eq, Types.Instance(UnionXorEq).optional |
| 16030 | 16029 | attribute :yes, Types.Instance(UnionYES).optional |
| 16031 | 16030 | attribute :top_level_yield, Types.Instance(UnionYield).optional |
| 16031 | + attribute :dummy, Types::Double.optional | |
| 16032 | 16032 | |
| 16033 | 16033 | def self.from_dynamic!(d) |
| 16034 | 16034 | d = Types::Hash[d] |
| @@ -16109,7 +16109,6 @@ class TopLevel < Dry::Struct | ||
| 16109 | 16109 | did_set: d["didSet"] ? UnionDidSet.from_dynamic!(d["didSet"]) : nil, |
| 16110 | 16110 | top_level_do: d["do"] ? UnionDo.from_dynamic!(d["do"]) : nil, |
| 16111 | 16111 | double: d["double"] ? UnionDouble.from_dynamic!(d["double"]) : nil, |
| 16112 | - dummy: d["dummy"], | |
| 16113 | 16112 | dynamic: d["dynamic"] ? UnionDynamic.from_dynamic!(d["dynamic"]) : nil, |
| 16114 | 16113 | dynamic_cast: d["dynamic_cast"] ? UnionDynamicCast.from_dynamic!(d["dynamic_cast"]) : nil, |
| 16115 | 16114 | elif: d["elif"] ? UnionElif.from_dynamic!(d["elif"]) : nil, |
| @@ -16162,8 +16161,8 @@ class TopLevel < Dry::Struct | ||
| 16162 | 16161 | int: d["int"] ? UnionInt.from_dynamic!(d["int"]) : nil, |
| 16163 | 16162 | interface: d["interface"] ? UnionInterface.from_dynamic!(d["interface"]) : nil, |
| 16164 | 16163 | internal: d["internal"] ? UnionInternal.from_dynamic!(d["internal"]) : nil, |
| 16165 | - is: d["is"] ? UnionIs.from_dynamic!(d["is"]) : nil, | |
| 16166 | 16164 | iterable: d["iterable"] ? UnionIterable.from_dynamic!(d["iterable"]) : nil, |
| 16165 | + is: d["is"] ? UnionIs.from_dynamic!(d["is"]) : nil, | |
| 16167 | 16166 | jdec: d["jdec"] ? UnionJdec.from_dynamic!(d["jdec"]) : nil, |
| 16168 | 16167 | jenc: d["jenc"] ? UnionJenc.from_dynamic!(d["jenc"]) : nil, |
| 16169 | 16168 | jpipe: d["jpipe"] ? UnionJpipe.from_dynamic!(d["jpipe"]) : nil, |
| @@ -16310,6 +16309,7 @@ class TopLevel < Dry::Struct | ||
| 16310 | 16309 | xor_eq: d["xor_eq"] ? UnionXorEq.from_dynamic!(d["xor_eq"]) : nil, |
| 16311 | 16310 | yes: d["YES"] ? UnionYES.from_dynamic!(d["YES"]) : nil, |
| 16312 | 16311 | top_level_yield: d["yield"] ? UnionYield.from_dynamic!(d["yield"]) : nil, |
| 16312 | + dummy: d["dummy"], | |
| 16313 | 16313 | ) |
| 16314 | 16314 | end |
| 16315 | 16315 | |
| @@ -16395,7 +16395,6 @@ class TopLevel < Dry::Struct | ||
| 16395 | 16395 | "didSet" => did_set&.to_dynamic, |
| 16396 | 16396 | "do" => top_level_do&.to_dynamic, |
| 16397 | 16397 | "double" => double&.to_dynamic, |
| 16398 | - "dummy" => dummy, | |
| 16399 | 16398 | "dynamic" => dynamic&.to_dynamic, |
| 16400 | 16399 | "dynamic_cast" => dynamic_cast&.to_dynamic, |
| 16401 | 16400 | "elif" => elif&.to_dynamic, |
| @@ -16448,8 +16447,8 @@ class TopLevel < Dry::Struct | ||
| 16448 | 16447 | "int" => int&.to_dynamic, |
| 16449 | 16448 | "interface" => interface&.to_dynamic, |
| 16450 | 16449 | "internal" => internal&.to_dynamic, |
| 16451 | - "is" => is&.to_dynamic, | |
| 16452 | 16450 | "iterable" => iterable&.to_dynamic, |
| 16451 | + "is" => is&.to_dynamic, | |
| 16453 | 16452 | "jdec" => jdec&.to_dynamic, |
| 16454 | 16453 | "jenc" => jenc&.to_dynamic, |
| 16455 | 16454 | "jpipe" => jpipe&.to_dynamic, |
| @@ -16596,6 +16595,7 @@ class TopLevel < Dry::Struct | ||
| 16596 | 16595 | "xor_eq" => xor_eq&.to_dynamic, |
| 16597 | 16596 | "YES" => yes&.to_dynamic, |
| 16598 | 16597 | "yield" => top_level_yield&.to_dynamic, |
| 16598 | + "dummy" => dummy, | |
| 16599 | 16599 | } |
| 16600 | 16600 | end |
Mschema-rustdefault / module_under_test.rs+4 −4
| @@ -188,8 +188,6 @@ pub struct TopLevel { | ||
| 188 | 188 | |
| 189 | 189 | pub double: Option<UnionDouble>, |
| 190 | 190 | |
| 191 | - pub dummy: Option<f64>, | |
| 192 | - | |
| 193 | 191 | pub dynamic: Option<UnionDynamic>, |
| 194 | 192 | |
| 195 | 193 | pub dynamic_cast: Option<UnionDynamicCast>, |
| @@ -305,10 +303,10 @@ pub struct TopLevel { | ||
| 305 | 303 | |
| 306 | 304 | pub internal: Option<UnionInternal>, |
| 307 | 305 | |
| 308 | - pub is: Option<UnionIs>, | |
| 309 | - | |
| 310 | 306 | pub iterable: Option<UnionIterable>, |
| 311 | 307 | |
| 308 | + pub is: Option<UnionIs>, | |
| 309 | + | |
| 312 | 310 | pub jdec: Option<UnionJdec>, |
| 313 | 311 | |
| 314 | 312 | pub jenc: Option<UnionJenc>, |
| @@ -632,6 +630,8 @@ pub struct TopLevel { | ||
| 632 | 630 | |
| 633 | 631 | #[serde(rename = "yield")] |
| 634 | 632 | pub top_level_yield: Option<UnionYield>, |
| 633 | + | |
| 634 | + pub dummy: Option<f64>, | |
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | #[derive(Debug, Clone, Serialize, Deserialize)] |
Mschema-schemadefault / TopLevel.schema+6 −6
| @@ -234,9 +234,6 @@ | ||
| 234 | 234 | "double": { |
| 235 | 235 | "$ref": "#/definitions/UnionDouble" |
| 236 | 236 | }, |
| 237 | - "dummy": { | |
| 238 | - "type": "number" | |
| 239 | - }, | |
| 240 | 237 | "dynamic": { |
| 241 | 238 | "$ref": "#/definitions/UnionDynamic" |
| 242 | 239 | }, |
| @@ -393,12 +390,12 @@ | ||
| 393 | 390 | "internal": { |
| 394 | 391 | "$ref": "#/definitions/UnionInternal" |
| 395 | 392 | }, |
| 396 | - "is": { | |
| 397 | - "$ref": "#/definitions/UnionIs" | |
| 398 | - }, | |
| 399 | 393 | "iterable": { |
| 400 | 394 | "$ref": "#/definitions/UnionIterable" |
| 401 | 395 | }, |
| 396 | + "is": { | |
| 397 | + "$ref": "#/definitions/UnionIs" | |
| 398 | + }, | |
| 402 | 399 | "jdec": { |
| 403 | 400 | "$ref": "#/definitions/UnionJdec" |
| 404 | 401 | }, |
| @@ -836,6 +833,9 @@ | ||
| 836 | 833 | }, |
| 837 | 834 | "yield": { |
| 838 | 835 | "$ref": "#/definitions/UnionYield" |
| 836 | + }, | |
| 837 | + "dummy": { | |
| 838 | + "type": "number" | |
| 839 | 839 | } |
| 840 | 840 | }, |
| 841 | 841 | "required": [], |
Mschema-swiftdefault / quicktype.swift+10 −10
| @@ -83,7 +83,6 @@ struct TopLevel: Codable { | ||
| 83 | 83 | let topLevelDidSet: UnionDidSet? |
| 84 | 84 | let topLevelDo: UnionDo? |
| 85 | 85 | let double: UnionDouble? |
| 86 | - let dummy: Double? | |
| 87 | 86 | let topLevelDynamic: UnionDynamic? |
| 88 | 87 | let dynamicCast: UnionDynamicCast? |
| 89 | 88 | let elif: UnionElif? |
| @@ -136,8 +135,8 @@ struct TopLevel: Codable { | ||
| 136 | 135 | let int: UnionInt? |
| 137 | 136 | let interface: UnionInterface? |
| 138 | 137 | let topLevelInternal: UnionInternal? |
| 139 | - let topLevelIs: UnionIs? | |
| 140 | 138 | let iterable: UnionIterable? |
| 139 | + let topLevelIs: UnionIs? | |
| 141 | 140 | let jdec: UnionJdec? |
| 142 | 141 | let jenc: UnionJenc? |
| 143 | 142 | let jpipe: UnionJpipe? |
| @@ -284,6 +283,7 @@ struct TopLevel: Codable { | ||
| 284 | 283 | let xorEq: UnionXorEq? |
| 285 | 284 | let yes: UnionYES? |
| 286 | 285 | let yield: UnionYield? |
| 286 | + let dummy: Double? | |
| 287 | 287 | |
| 288 | 288 | enum CodingKeys: String, CodingKey { |
| 289 | 289 | case empty = "_" |
| @@ -362,7 +362,6 @@ struct TopLevel: Codable { | ||
| 362 | 362 | case topLevelDidSet = "didSet" |
| 363 | 363 | case topLevelDo = "do" |
| 364 | 364 | case double = "double" |
| 365 | - case dummy = "dummy" | |
| 366 | 365 | case topLevelDynamic = "dynamic" |
| 367 | 366 | case dynamicCast = "dynamic_cast" |
| 368 | 367 | case elif = "elif" |
| @@ -415,8 +414,8 @@ struct TopLevel: Codable { | ||
| 415 | 414 | case int = "int" |
| 416 | 415 | case interface = "interface" |
| 417 | 416 | case topLevelInternal = "internal" |
| 418 | - case topLevelIs = "is" | |
| 419 | 417 | case iterable = "iterable" |
| 418 | + case topLevelIs = "is" | |
| 420 | 419 | case jdec = "jdec" |
| 421 | 420 | case jenc = "jenc" |
| 422 | 421 | case jpipe = "jpipe" |
| @@ -563,6 +562,7 @@ struct TopLevel: Codable { | ||
| 563 | 562 | case xorEq = "xor_eq" |
| 564 | 563 | case yes = "YES" |
| 565 | 564 | case yield = "yield" |
| 565 | + case dummy = "dummy" | |
| 566 | 566 | } |
| 567 | 567 | } |
| 568 | 568 | |
| @@ -661,7 +661,6 @@ extension TopLevel { | ||
| 661 | 661 | topLevelDidSet: UnionDidSet?? = nil, |
| 662 | 662 | topLevelDo: UnionDo?? = nil, |
| 663 | 663 | double: UnionDouble?? = nil, |
| 664 | - dummy: Double?? = nil, | |
| 665 | 664 | topLevelDynamic: UnionDynamic?? = nil, |
| 666 | 665 | dynamicCast: UnionDynamicCast?? = nil, |
| 667 | 666 | elif: UnionElif?? = nil, |
| @@ -714,8 +713,8 @@ extension TopLevel { | ||
| 714 | 713 | int: UnionInt?? = nil, |
| 715 | 714 | interface: UnionInterface?? = nil, |
| 716 | 715 | topLevelInternal: UnionInternal?? = nil, |
| 717 | - topLevelIs: UnionIs?? = nil, | |
| 718 | 716 | iterable: UnionIterable?? = nil, |
| 717 | + topLevelIs: UnionIs?? = nil, | |
| 719 | 718 | jdec: UnionJdec?? = nil, |
| 720 | 719 | jenc: UnionJenc?? = nil, |
| 721 | 720 | jpipe: UnionJpipe?? = nil, |
| @@ -861,7 +860,8 @@ extension TopLevel { | ||
| 861 | 860 | xor: UnionXor?? = nil, |
| 862 | 861 | xorEq: UnionXorEq?? = nil, |
| 863 | 862 | yes: UnionYES?? = nil, |
| 864 | - yield: UnionYield?? = nil | |
| 863 | + yield: UnionYield?? = nil, | |
| 864 | + dummy: Double?? = nil | |
| 865 | 865 | ) -> TopLevel { |
| 866 | 866 | return TopLevel( |
| 867 | 867 | empty: empty ?? self.empty, |
| @@ -940,7 +940,6 @@ extension TopLevel { | ||
| 940 | 940 | topLevelDidSet: topLevelDidSet ?? self.topLevelDidSet, |
| 941 | 941 | topLevelDo: topLevelDo ?? self.topLevelDo, |
| 942 | 942 | double: double ?? self.double, |
| 943 | - dummy: dummy ?? self.dummy, | |
| 944 | 943 | topLevelDynamic: topLevelDynamic ?? self.topLevelDynamic, |
| 945 | 944 | dynamicCast: dynamicCast ?? self.dynamicCast, |
| 946 | 945 | elif: elif ?? self.elif, |
| @@ -993,8 +992,8 @@ extension TopLevel { | ||
| 993 | 992 | int: int ?? self.int, |
| 994 | 993 | interface: interface ?? self.interface, |
| 995 | 994 | topLevelInternal: topLevelInternal ?? self.topLevelInternal, |
| 996 | - topLevelIs: topLevelIs ?? self.topLevelIs, | |
| 997 | 995 | iterable: iterable ?? self.iterable, |
| 996 | + topLevelIs: topLevelIs ?? self.topLevelIs, | |
| 998 | 997 | jdec: jdec ?? self.jdec, |
| 999 | 998 | jenc: jenc ?? self.jenc, |
| 1000 | 999 | jpipe: jpipe ?? self.jpipe, |
| @@ -1140,7 +1139,8 @@ extension TopLevel { | ||
| 1140 | 1139 | xor: xor ?? self.xor, |
| 1141 | 1140 | xorEq: xorEq ?? self.xorEq, |
| 1142 | 1141 | yes: yes ?? self.yes, |
| 1143 | - yield: yield ?? self.yield | |
| 1142 | + yield: yield ?? self.yield, | |
| 1143 | + dummy: dummy ?? self.dummy | |
| 1144 | 1144 | ) |
| 1145 | 1145 | } |
Test case
30 generated files · +146 −146test/inputs/schema/light.schema
Mschema-cjsondefault / TopLevel.c+17 −17
| @@ -22,14 +22,6 @@ struct LightParams * cJSON_GetLightParamsValue(const cJSON * j) { | ||
| 22 | 22 | if (NULL != j) { |
| 23 | 23 | if (NULL != (x = cJSON_malloc(sizeof(struct LightParams)))) { |
| 24 | 24 | memset(x, 0, sizeof(struct LightParams)); |
| 25 | - if (cJSON_HasObjectItem(j, "app_id")) { | |
| 26 | - x->app_id = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "app_id"))); | |
| 27 | - } | |
| 28 | - else { | |
| 29 | - if (NULL != (x->app_id = cJSON_malloc(sizeof(char)))) { | |
| 30 | - x->app_id[0] = '\0'; | |
| 31 | - } | |
| 32 | - } | |
| 33 | 25 | if (cJSON_HasObjectItem(j, "outlet_id")) { |
| 34 | 26 | x->outlet_id = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "outlet_id"))); |
| 35 | 27 | } |
| @@ -38,6 +30,14 @@ struct LightParams * cJSON_GetLightParamsValue(const cJSON * j) { | ||
| 38 | 30 | x->outlet_id[0] = '\0'; |
| 39 | 31 | } |
| 40 | 32 | } |
| 33 | + if (cJSON_HasObjectItem(j, "app_id")) { | |
| 34 | + x->app_id = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "app_id"))); | |
| 35 | + } | |
| 36 | + else { | |
| 37 | + if (NULL != (x->app_id = cJSON_malloc(sizeof(char)))) { | |
| 38 | + x->app_id[0] = '\0'; | |
| 39 | + } | |
| 40 | + } | |
| 41 | 41 | if (cJSON_HasObjectItem(j, "rgba")) { |
| 42 | 42 | x->rgba = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "rgba"))); |
| 43 | 43 | } |
| @@ -55,18 +55,18 @@ cJSON * cJSON_CreateLightParams(const struct LightParams * x) { | ||
| 55 | 55 | cJSON * j = NULL; |
| 56 | 56 | if (NULL != x) { |
| 57 | 57 | if (NULL != (j = cJSON_CreateObject())) { |
| 58 | - if (NULL != x->app_id) { | |
| 59 | - cJSON_AddStringToObject(j, "app_id", x->app_id); | |
| 60 | - } | |
| 61 | - else { | |
| 62 | - cJSON_AddStringToObject(j, "app_id", ""); | |
| 63 | - } | |
| 64 | 58 | if (NULL != x->outlet_id) { |
| 65 | 59 | cJSON_AddStringToObject(j, "outlet_id", x->outlet_id); |
| 66 | 60 | } |
| 67 | 61 | else { |
| 68 | 62 | cJSON_AddStringToObject(j, "outlet_id", ""); |
| 69 | 63 | } |
| 64 | + if (NULL != x->app_id) { | |
| 65 | + cJSON_AddStringToObject(j, "app_id", x->app_id); | |
| 66 | + } | |
| 67 | + else { | |
| 68 | + cJSON_AddStringToObject(j, "app_id", ""); | |
| 69 | + } | |
| 70 | 70 | if (NULL != x->rgba) { |
| 71 | 71 | cJSON_AddStringToObject(j, "rgba", x->rgba); |
| 72 | 72 | } |
| @@ -92,12 +92,12 @@ char * cJSON_PrintLightParams(const struct LightParams * x) { | ||
| 92 | 92 | |
| 93 | 93 | void cJSON_DeleteLightParams(struct LightParams * x) { |
| 94 | 94 | if (NULL != x) { |
| 95 | - if (NULL != x->app_id) { | |
| 96 | - cJSON_free(x->app_id); | |
| 97 | - } | |
| 98 | 95 | if (NULL != x->outlet_id) { |
| 99 | 96 | cJSON_free(x->outlet_id); |
| 100 | 97 | } |
| 98 | + if (NULL != x->app_id) { | |
| 99 | + cJSON_free(x->app_id); | |
| 100 | + } | |
| 101 | 101 | if (NULL != x->rgba) { |
| 102 | 102 | cJSON_free(x->rgba); |
| 103 | 103 | } |
Mschema-cjsondefault / TopLevel.h+1 −1
| @@ -35,8 +35,8 @@ extern "C" { | ||
| 35 | 35 | #endif |
| 36 | 36 | |
| 37 | 37 | struct LightParams { |
| 38 | - char * app_id; | |
| 39 | 38 | char * outlet_id; |
| 39 | + char * app_id; | |
| 40 | 40 | char * rgba; |
| 41 | 41 | }; |
Mschema-cplusplusdefault / quicktype.hpp+7 −7
| @@ -37,19 +37,19 @@ namespace quicktype { | ||
| 37 | 37 | virtual ~LightParams() = default; |
| 38 | 38 | |
| 39 | 39 | private: |
| 40 | - std::string app_id; | |
| 41 | 40 | std::string outlet_id; |
| 41 | + std::string app_id; | |
| 42 | 42 | std::string rgba; |
| 43 | 43 | |
| 44 | 44 | public: |
| 45 | - const std::string & get_app_id() const { return app_id; } | |
| 46 | - std::string & get_mutable_app_id() { return app_id; } | |
| 47 | - void set_app_id(const std::string & value) { this->app_id = value; } | |
| 48 | - | |
| 49 | 45 | const std::string & get_outlet_id() const { return outlet_id; } |
| 50 | 46 | std::string & get_mutable_outlet_id() { return outlet_id; } |
| 51 | 47 | void set_outlet_id(const std::string & value) { this->outlet_id = value; } |
| 52 | 48 | |
| 49 | + const std::string & get_app_id() const { return app_id; } | |
| 50 | + std::string & get_mutable_app_id() { return app_id; } | |
| 51 | + void set_app_id(const std::string & value) { this->app_id = value; } | |
| 52 | + | |
| 53 | 53 | const std::string & get_rgba() const { return rgba; } |
| 54 | 54 | std::string & get_mutable_rgba() { return rgba; } |
| 55 | 55 | void set_rgba(const std::string & value) { this->rgba = value; } |
| @@ -78,15 +78,15 @@ namespace quicktype { | ||
| 78 | 78 | void to_json(json & j, const TopLevel & x); |
| 79 | 79 | |
| 80 | 80 | inline void from_json(const json & j, LightParams& x) { |
| 81 | - x.set_app_id(j.at("app_id").get<std::string>()); | |
| 82 | 81 | x.set_outlet_id(j.at("outlet_id").get<std::string>()); |
| 82 | + x.set_app_id(j.at("app_id").get<std::string>()); | |
| 83 | 83 | x.set_rgba(j.at("rgba").get<std::string>()); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | inline void to_json(json & j, const LightParams & x) { |
| 87 | 87 | j = json::object(); |
| 88 | - j["app_id"] = x.get_app_id(); | |
| 89 | 88 | j["outlet_id"] = x.get_outlet_id(); |
| 89 | + j["app_id"] = x.get_app_id(); | |
| 90 | 90 | j["rgba"] = x.get_rgba(); |
| 91 | 91 | } |
Mschema-csharp-recordsdefault / QuickType.cs+3 −3
| @@ -31,12 +31,12 @@ namespace QuickType | ||
| 31 | 31 | |
| 32 | 32 | public partial record LightParams |
| 33 | 33 | { |
| 34 | - [JsonProperty("app_id", Required = Required.Always)] | |
| 35 | - public string AppId { get; set; } | |
| 36 | - | |
| 37 | 34 | [JsonProperty("outlet_id", Required = Required.Always)] |
| 38 | 35 | public string OutletId { get; set; } |
| 39 | 36 | |
| 37 | + [JsonProperty("app_id", Required = Required.Always)] | |
| 38 | + public string AppId { get; set; } | |
| 39 | + | |
| 40 | 40 | [JsonProperty("rgba", Required = Required.Always)] |
| 41 | 41 | public string Rgba { get; set; } |
| 42 | 42 | } |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+4 −4
| @@ -29,14 +29,14 @@ namespace QuickType | ||
| 29 | 29 | |
| 30 | 30 | public partial class LightParams |
| 31 | 31 | { |
| 32 | - [JsonRequired] | |
| 33 | - [JsonPropertyName("app_id")] | |
| 34 | - public string AppId { get; set; } | |
| 35 | - | |
| 36 | 32 | [JsonRequired] |
| 37 | 33 | [JsonPropertyName("outlet_id")] |
| 38 | 34 | public string OutletId { get; set; } |
| 39 | 35 | |
| 36 | + [JsonRequired] | |
| 37 | + [JsonPropertyName("app_id")] | |
| 38 | + public string AppId { get; set; } | |
| 39 | + | |
| 40 | 40 | [JsonRequired] |
| 41 | 41 | [JsonPropertyName("rgba")] |
| 42 | 42 | public string Rgba { get; set; } |
Mschema-csharpdefault / QuickType.cs+3 −3
| @@ -31,12 +31,12 @@ namespace QuickType | ||
| 31 | 31 | |
| 32 | 32 | public partial class LightParams |
| 33 | 33 | { |
| 34 | - [JsonProperty("app_id", Required = Required.Always)] | |
| 35 | - public string AppId { get; set; } | |
| 36 | - | |
| 37 | 34 | [JsonProperty("outlet_id", Required = Required.Always)] |
| 38 | 35 | public string OutletId { get; set; } |
| 39 | 36 | |
| 37 | + [JsonProperty("app_id", Required = Required.Always)] | |
| 38 | + public string AppId { get; set; } | |
| 39 | + | |
| 40 | 40 | [JsonProperty("rgba", Required = Required.Always)] |
| 41 | 41 | public string Rgba { get; set; } |
| 42 | 42 | } |
Mschema-dartdefault / TopLevel.dart+4 −4
| @@ -25,25 +25,25 @@ class TopLevel { | ||
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | class LightParams { |
| 28 | - final String appId; | |
| 29 | 28 | final String outletId; |
| 29 | + final String appId; | |
| 30 | 30 | final String rgba; |
| 31 | 31 | |
| 32 | 32 | LightParams({ |
| 33 | - required this.appId, | |
| 34 | 33 | required this.outletId, |
| 34 | + required this.appId, | |
| 35 | 35 | required this.rgba, |
| 36 | 36 | }); |
| 37 | 37 | |
| 38 | 38 | factory LightParams.fromJson(Map<String, dynamic> json) => LightParams( |
| 39 | - appId: json["app_id"], | |
| 40 | 39 | outletId: json["outlet_id"], |
| 40 | + appId: json["app_id"], | |
| 41 | 41 | rgba: json["rgba"], |
| 42 | 42 | ); |
| 43 | 43 | |
| 44 | 44 | Map<String, dynamic> toJson() => { |
| 45 | - "app_id": appId, | |
| 46 | 45 | "outlet_id": outletId, |
| 46 | + "app_id": appId, | |
| 47 | 47 | "rgba": rgba, |
| 48 | 48 | }; |
| 49 | 49 | } |
Mschema-elixirdefault / QuickType.ex+5 −5
| @@ -6,19 +6,19 @@ | ||
| 6 | 6 | # Encode into a JSON string: TopLevel.to_json(struct) |
| 7 | 7 | |
| 8 | 8 | defmodule LightParams do |
| 9 | - @enforce_keys [:app_id, :outlet_id, :rgba] | |
| 10 | - defstruct [:app_id, :outlet_id, :rgba] | |
| 9 | + @enforce_keys [:outlet_id, :app_id, :rgba] | |
| 10 | + defstruct [:outlet_id, :app_id, :rgba] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | - app_id: String.t(), | |
| 14 | 13 | outlet_id: String.t(), |
| 14 | + app_id: String.t(), | |
| 15 | 15 | rgba: String.t() |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | def from_map(m) do |
| 19 | 19 | %LightParams{ |
| 20 | - app_id: m["app_id"], | |
| 21 | 20 | outlet_id: m["outlet_id"], |
| 21 | + app_id: m["app_id"], | |
| 22 | 22 | rgba: m["rgba"], |
| 23 | 23 | } |
| 24 | 24 | end |
| @@ -31,8 +31,8 @@ defmodule LightParams do | ||
| 31 | 31 | |
| 32 | 32 | def to_map(struct) do |
| 33 | 33 | %{ |
| 34 | - "app_id" => struct.app_id, | |
| 35 | 34 | "outlet_id" => struct.outlet_id, |
| 35 | + "app_id" => struct.app_id, | |
| 36 | 36 | "rgba" => struct.rgba, |
| 37 | 37 | } |
| 38 | 38 | end |
Mschema-elmdefault / QuickType.elm+5 −5
| @@ -28,8 +28,8 @@ type alias QuickType = | ||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | type alias LightParams = |
| 31 | - { appID : String | |
| 32 | - , outletID : String | |
| 31 | + { outletID : String | |
| 32 | + , appID : String | |
| 33 | 33 | , rgba : String |
| 34 | 34 | } |
| 35 | 35 | |
| @@ -52,15 +52,15 @@ encodeQuickType x = | ||
| 52 | 52 | lightParams : Jdec.Decoder LightParams |
| 53 | 53 | lightParams = |
| 54 | 54 | Jdec.succeed LightParams |
| 55 | - |> Jpipe.required "app_id" Jdec.string | |
| 56 | 55 | |> Jpipe.required "outlet_id" Jdec.string |
| 56 | + |> Jpipe.required "app_id" Jdec.string | |
| 57 | 57 | |> Jpipe.required "rgba" Jdec.string |
| 58 | 58 | |
| 59 | 59 | encodeLightParams : LightParams -> Jenc.Value |
| 60 | 60 | encodeLightParams x = |
| 61 | 61 | Jenc.object |
| 62 | - [ ("app_id", Jenc.string x.appID) | |
| 63 | - , ("outlet_id", Jenc.string x.outletID) | |
| 62 | + [ ("outlet_id", Jenc.string x.outletID) | |
| 63 | + , ("app_id", Jenc.string x.appID) | |
| 64 | 64 | , ("rgba", Jenc.string x.rgba) |
| 65 | 65 | ] |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -14,8 +14,8 @@ export type TopLevel = { | ||
| 14 | 14 | }; |
| 15 | 15 | |
| 16 | 16 | export type LightParams = { |
| 17 | - app_id: string; | |
| 18 | 17 | outlet_id: string; |
| 18 | + app_id: string; | |
| 19 | 19 | rgba: string; |
| 20 | 20 | }; |
| 21 | 21 | |
| @@ -187,8 +187,8 @@ const typeMap: any = { | ||
| 187 | 187 | { json: "LightParams", js: "LightParams", typ: r("LightParams") }, |
| 188 | 188 | ], false), |
| 189 | 189 | "LightParams": o([ |
| 190 | - { json: "app_id", js: "app_id", typ: "" }, | |
| 191 | 190 | { json: "outlet_id", js: "outlet_id", typ: "" }, |
| 191 | + { json: "app_id", js: "app_id", typ: "" }, | |
| 192 | 192 | { json: "rgba", js: "rgba", typ: "" }, |
| 193 | 193 | ], false), |
| 194 | 194 | }; |
Mschema-golangdefault / quicktype.go+1 −1
| @@ -23,7 +23,7 @@ type TopLevel struct { | ||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | type LightParams struct { |
| 26 | - AppID string `json:"app_id"` | |
| 27 | 26 | OutletID string `json:"outlet_id"` |
| 27 | + AppID string `json:"app_id"` | |
| 28 | 28 | RGBA string `json:"rgba"` |
| 29 | 29 | } |
Mschema-haskelldefault / QuickType.hs+7 −7
| @@ -18,8 +18,8 @@ data QuickType = QuickType | ||
| 18 | 18 | } deriving (Show) |
| 19 | 19 | |
| 20 | 20 | data LightParams = LightParams |
| 21 | - { appIDLightParams :: Text | |
| 22 | - , outletIDLightParams :: Text | |
| 21 | + { outletIDLightParams :: Text | |
| 22 | + , appIDLightParams :: Text | |
| 23 | 23 | , rgbaLightParams :: Text |
| 24 | 24 | } deriving (Show) |
| 25 | 25 | |
| @@ -37,15 +37,15 @@ instance FromJSON QuickType where | ||
| 37 | 37 | <$> v .: "LightParams" |
| 38 | 38 | |
| 39 | 39 | instance ToJSON LightParams where |
| 40 | - toJSON (LightParams appIDLightParams outletIDLightParams rgbaLightParams) = | |
| 40 | + toJSON (LightParams outletIDLightParams appIDLightParams rgbaLightParams) = | |
| 41 | 41 | object |
| 42 | - [ "app_id" .= appIDLightParams | |
| 43 | - , "outlet_id" .= outletIDLightParams | |
| 42 | + [ "outlet_id" .= outletIDLightParams | |
| 43 | + , "app_id" .= appIDLightParams | |
| 44 | 44 | , "rgba" .= rgbaLightParams |
| 45 | 45 | ] |
| 46 | 46 | |
| 47 | 47 | instance FromJSON LightParams where |
| 48 | 48 | parseJSON (Object v) = LightParams |
| 49 | - <$> v .: "app_id" | |
| 50 | - <*> v .: "outlet_id" | |
| 49 | + <$> v .: "outlet_id" | |
| 50 | + <*> v .: "app_id" | |
| 51 | 51 | <*> v .: "rgba" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / LightParams.java+6 −6
| @@ -3,20 +3,20 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class LightParams { |
| 6 | - private String appID; | |
| 7 | 6 | private String outletID; |
| 7 | + private String appID; | |
| 8 | 8 | private String rgba; |
| 9 | 9 | |
| 10 | - @JsonProperty("app_id") | |
| 11 | - public String getAppID() { return appID; } | |
| 12 | - @JsonProperty("app_id") | |
| 13 | - public void setAppID(String value) { this.appID = value; } | |
| 14 | - | |
| 15 | 10 | @JsonProperty("outlet_id") |
| 16 | 11 | public String getOutletID() { return outletID; } |
| 17 | 12 | @JsonProperty("outlet_id") |
| 18 | 13 | public void setOutletID(String value) { this.outletID = value; } |
| 19 | 14 | |
| 15 | + @JsonProperty("app_id") | |
| 16 | + public String getAppID() { return appID; } | |
| 17 | + @JsonProperty("app_id") | |
| 18 | + public void setAppID(String value) { this.appID = value; } | |
| 19 | + | |
| 20 | 20 | @JsonProperty("rgba") |
| 21 | 21 | public String getRGBA() { return rgba; } |
| 22 | 22 | @JsonProperty("rgba") |
Mschema-java-lombokdefault / src / main / java / io / quicktype / LightParams.java+6 −6
| @@ -3,20 +3,20 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class LightParams { |
| 6 | - private String appID; | |
| 7 | 6 | private String outletID; |
| 7 | + private String appID; | |
| 8 | 8 | private String rgba; |
| 9 | 9 | |
| 10 | - @JsonProperty("app_id") | |
| 11 | - public String getAppID() { return appID; } | |
| 12 | - @JsonProperty("app_id") | |
| 13 | - public void setAppID(String value) { this.appID = value; } | |
| 14 | - | |
| 15 | 10 | @JsonProperty("outlet_id") |
| 16 | 11 | public String getOutletID() { return outletID; } |
| 17 | 12 | @JsonProperty("outlet_id") |
| 18 | 13 | public void setOutletID(String value) { this.outletID = value; } |
| 19 | 14 | |
| 15 | + @JsonProperty("app_id") | |
| 16 | + public String getAppID() { return appID; } | |
| 17 | + @JsonProperty("app_id") | |
| 18 | + public void setAppID(String value) { this.appID = value; } | |
| 19 | + | |
| 20 | 20 | @JsonProperty("rgba") |
| 21 | 21 | public String getRGBA() { return rgba; } |
| 22 | 22 | @JsonProperty("rgba") |
Mschema-javadefault / src / main / java / io / quicktype / LightParams.java+6 −6
| @@ -3,20 +3,20 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class LightParams { |
| 6 | - private String appID; | |
| 7 | 6 | private String outletID; |
| 7 | + private String appID; | |
| 8 | 8 | private String rgba; |
| 9 | 9 | |
| 10 | - @JsonProperty("app_id") | |
| 11 | - public String getAppID() { return appID; } | |
| 12 | - @JsonProperty("app_id") | |
| 13 | - public void setAppID(String value) { this.appID = value; } | |
| 14 | - | |
| 15 | 10 | @JsonProperty("outlet_id") |
| 16 | 11 | public String getOutletID() { return outletID; } |
| 17 | 12 | @JsonProperty("outlet_id") |
| 18 | 13 | public void setOutletID(String value) { this.outletID = value; } |
| 19 | 14 | |
| 15 | + @JsonProperty("app_id") | |
| 16 | + public String getAppID() { return appID; } | |
| 17 | + @JsonProperty("app_id") | |
| 18 | + public void setAppID(String value) { this.appID = value; } | |
| 19 | + | |
| 20 | 20 | @JsonProperty("rgba") |
| 21 | 21 | public String getRGBA() { return rgba; } |
| 22 | 22 | @JsonProperty("rgba") |
Mschema-javascriptdefault / TopLevel.js+1 −1
| @@ -175,8 +175,8 @@ const typeMap = { | ||
| 175 | 175 | { json: "LightParams", js: "LightParams", typ: r("LightParams") }, |
| 176 | 176 | ], false), |
| 177 | 177 | "LightParams": o([ |
| 178 | - { json: "app_id", js: "app_id", typ: "" }, | |
| 179 | 178 | { json: "outlet_id", js: "outlet_id", typ: "" }, |
| 179 | + { json: "app_id", js: "app_id", typ: "" }, | |
| 180 | 180 | { json: "rgba", js: "rgba", typ: "" }, |
| 181 | 181 | ], false), |
| 182 | 182 | }; |
Mschema-kotlin-jacksondefault / TopLevel.kt+3 −3
| @@ -30,12 +30,12 @@ data class TopLevel ( | ||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | data class LightParams ( |
| 33 | - @get:JsonProperty("app_id", required=true)@field:JsonProperty("app_id", required=true) | |
| 34 | - val appID: String, | |
| 35 | - | |
| 36 | 33 | @get:JsonProperty("outlet_id", required=true)@field:JsonProperty("outlet_id", required=true) |
| 37 | 34 | val outletID: String, |
| 38 | 35 | |
| 36 | + @get:JsonProperty("app_id", required=true)@field:JsonProperty("app_id", required=true) | |
| 37 | + val appID: String, | |
| 38 | + | |
| 39 | 39 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 40 | 40 | val rgba: String |
| 41 | 41 | ) |
Mschema-kotlindefault / TopLevel.kt+3 −3
| @@ -20,11 +20,11 @@ data class TopLevel ( | ||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | data class LightParams ( |
| 23 | - @Json(name = "app_id") | |
| 24 | - val appID: String, | |
| 25 | - | |
| 26 | 23 | @Json(name = "outlet_id") |
| 27 | 24 | val outletID: String, |
| 28 | 25 | |
| 26 | + @Json(name = "app_id") | |
| 27 | + val appID: String, | |
| 28 | + | |
| 29 | 29 | val rgba: String |
| 30 | 30 | ) |
Mschema-kotlinxdefault / TopLevel.kt+3 −3
| @@ -18,11 +18,11 @@ data class TopLevel ( | ||
| 18 | 18 | |
| 19 | 19 | @Serializable |
| 20 | 20 | data class LightParams ( |
| 21 | - @SerialName("app_id") | |
| 22 | - val appID: String, | |
| 23 | - | |
| 24 | 21 | @SerialName("outlet_id") |
| 25 | 22 | val outletID: String, |
| 26 | 23 | |
| 24 | + @SerialName("app_id") | |
| 25 | + val appID: String, | |
| 26 | + | |
| 27 | 27 | val rgba: String |
| 28 | 28 | ) |
Mschema-phpdefault / TopLevel.php+35 −35
| @@ -103,18 +103,18 @@ class TopLevel { | ||
| 103 | 103 | // This is an autogenerated file:LightParams |
| 104 | 104 | |
| 105 | 105 | class LightParams { |
| 106 | - private string $appID; // json:app_id Required | |
| 107 | 106 | private string $outletID; // json:outlet_id Required |
| 107 | + private string $appID; // json:app_id Required | |
| 108 | 108 | private string $rgba; // json:rgba Required |
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | - * @param string $appID | |
| 112 | 111 | * @param string $outletID |
| 112 | + * @param string $appID | |
| 113 | 113 | * @param string $rgba |
| 114 | 114 | */ |
| 115 | - public function __construct(string $appID, string $outletID, string $rgba) { | |
| 116 | - $this->appID = $appID; | |
| 115 | + public function __construct(string $outletID, string $appID, string $rgba) { | |
| 117 | 116 | $this->outletID = $outletID; |
| 117 | + $this->appID = $appID; | |
| 118 | 118 | $this->rgba = $rgba; |
| 119 | 119 | } |
| 120 | 120 | |
| @@ -123,7 +123,7 @@ class LightParams { | ||
| 123 | 123 | * @throws Exception |
| 124 | 124 | * @return string |
| 125 | 125 | */ |
| 126 | - public static function fromAppID(string $value): string { | |
| 126 | + public static function fromOutletID(string $value): string { | |
| 127 | 127 | return $value; /*string*/ |
| 128 | 128 | } |
| 129 | 129 | |
| @@ -131,11 +131,11 @@ class LightParams { | ||
| 131 | 131 | * @throws Exception |
| 132 | 132 | * @return string |
| 133 | 133 | */ |
| 134 | - public function toAppID(): string { | |
| 135 | - if (LightParams::validateAppID($this->appID)) { | |
| 136 | - return $this->appID; /*string*/ | |
| 134 | + public function toOutletID(): string { | |
| 135 | + if (LightParams::validateOutletID($this->outletID)) { | |
| 136 | + return $this->outletID; /*string*/ | |
| 137 | 137 | } |
| 138 | - throw new Exception('never get to this LightParams::appID'); | |
| 138 | + throw new Exception('never get to this LightParams::outletID'); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
| @@ -143,7 +143,7 @@ class LightParams { | ||
| 143 | 143 | * @return bool |
| 144 | 144 | * @throws Exception |
| 145 | 145 | */ |
| 146 | - public static function validateAppID(string $value): bool { | |
| 146 | + public static function validateOutletID(string $value): bool { | |
| 147 | 147 | return true; |
| 148 | 148 | } |
| 149 | 149 | |
| @@ -151,18 +151,18 @@ class LightParams { | ||
| 151 | 151 | * @throws Exception |
| 152 | 152 | * @return string |
| 153 | 153 | */ |
| 154 | - public function getAppID(): string { | |
| 155 | - if (LightParams::validateAppID($this->appID)) { | |
| 156 | - return $this->appID; | |
| 154 | + public function getOutletID(): string { | |
| 155 | + if (LightParams::validateOutletID($this->outletID)) { | |
| 156 | + return $this->outletID; | |
| 157 | 157 | } |
| 158 | - throw new Exception('never get to getAppID LightParams::appID'); | |
| 158 | + throw new Exception('never get to getOutletID LightParams::outletID'); | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
| 162 | 162 | * @return string |
| 163 | 163 | */ |
| 164 | - public static function sampleAppID(): string { | |
| 165 | - return 'LightParams::appID::31'; /*31:appID*/ | |
| 164 | + public static function sampleOutletID(): string { | |
| 165 | + return 'LightParams::outletID::31'; /*31:outletID*/ | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
| @@ -170,7 +170,7 @@ class LightParams { | ||
| 170 | 170 | * @throws Exception |
| 171 | 171 | * @return string |
| 172 | 172 | */ |
| 173 | - public static function fromOutletID(string $value): string { | |
| 173 | + public static function fromAppID(string $value): string { | |
| 174 | 174 | return $value; /*string*/ |
| 175 | 175 | } |
| 176 | 176 | |
| @@ -178,11 +178,11 @@ class LightParams { | ||
| 178 | 178 | * @throws Exception |
| 179 | 179 | * @return string |
| 180 | 180 | */ |
| 181 | - public function toOutletID(): string { | |
| 182 | - if (LightParams::validateOutletID($this->outletID)) { | |
| 183 | - return $this->outletID; /*string*/ | |
| 181 | + public function toAppID(): string { | |
| 182 | + if (LightParams::validateAppID($this->appID)) { | |
| 183 | + return $this->appID; /*string*/ | |
| 184 | 184 | } |
| 185 | - throw new Exception('never get to this LightParams::outletID'); | |
| 185 | + throw new Exception('never get to this LightParams::appID'); | |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
| @@ -190,7 +190,7 @@ class LightParams { | ||
| 190 | 190 | * @return bool |
| 191 | 191 | * @throws Exception |
| 192 | 192 | */ |
| 193 | - public static function validateOutletID(string $value): bool { | |
| 193 | + public static function validateAppID(string $value): bool { | |
| 194 | 194 | return true; |
| 195 | 195 | } |
| 196 | 196 | |
| @@ -198,18 +198,18 @@ class LightParams { | ||
| 198 | 198 | * @throws Exception |
| 199 | 199 | * @return string |
| 200 | 200 | */ |
| 201 | - public function getOutletID(): string { | |
| 202 | - if (LightParams::validateOutletID($this->outletID)) { | |
| 203 | - return $this->outletID; | |
| 201 | + public function getAppID(): string { | |
| 202 | + if (LightParams::validateAppID($this->appID)) { | |
| 203 | + return $this->appID; | |
| 204 | 204 | } |
| 205 | - throw new Exception('never get to getOutletID LightParams::outletID'); | |
| 205 | + throw new Exception('never get to getAppID LightParams::appID'); | |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | 209 | * @return string |
| 210 | 210 | */ |
| 211 | - public static function sampleOutletID(): string { | |
| 212 | - return 'LightParams::outletID::32'; /*32:outletID*/ | |
| 211 | + public static function sampleAppID(): string { | |
| 212 | + return 'LightParams::appID::32'; /*32:appID*/ | |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
| @@ -264,8 +264,8 @@ class LightParams { | ||
| 264 | 264 | * @return bool |
| 265 | 265 | */ |
| 266 | 266 | public function validate(): bool { |
| 267 | - return LightParams::validateAppID($this->appID) | |
| 268 | - || LightParams::validateOutletID($this->outletID) | |
| 267 | + return LightParams::validateOutletID($this->outletID) | |
| 268 | + || LightParams::validateAppID($this->appID) | |
| 269 | 269 | || LightParams::validateRGBA($this->rgba); |
| 270 | 270 | } |
| 271 | 271 | |
| @@ -275,8 +275,8 @@ class LightParams { | ||
| 275 | 275 | */ |
| 276 | 276 | public function to(): stdClass { |
| 277 | 277 | $out = new stdClass(); |
| 278 | - $out->{'app_id'} = $this->toAppID(); | |
| 279 | 278 | $out->{'outlet_id'} = $this->toOutletID(); |
| 279 | + $out->{'app_id'} = $this->toAppID(); | |
| 280 | 280 | $out->{'rgba'} = $this->toRGBA(); |
| 281 | 281 | return $out; |
| 282 | 282 | } |
| @@ -288,8 +288,8 @@ class LightParams { | ||
| 288 | 288 | */ |
| 289 | 289 | public static function from(stdClass $obj): LightParams { |
| 290 | 290 | return new LightParams( |
| 291 | - LightParams::fromAppID($obj->{'app_id'}) | |
| 292 | - ,LightParams::fromOutletID($obj->{'outlet_id'}) | |
| 291 | + LightParams::fromOutletID($obj->{'outlet_id'}) | |
| 292 | + ,LightParams::fromAppID($obj->{'app_id'}) | |
| 293 | 293 | ,LightParams::fromRGBA($obj->{'rgba'}) |
| 294 | 294 | ); |
| 295 | 295 | } |
| @@ -299,8 +299,8 @@ class LightParams { | ||
| 299 | 299 | */ |
| 300 | 300 | public static function sample(): LightParams { |
| 301 | 301 | return new LightParams( |
| 302 | - LightParams::sampleAppID() | |
| 303 | - ,LightParams::sampleOutletID() | |
| 302 | + LightParams::sampleOutletID() | |
| 303 | + ,LightParams::sampleAppID() | |
| 304 | 304 | ,LightParams::sampleRGBA() |
| 305 | 305 | ); |
| 306 | 306 | } |
Mschema-pikedefault / TopLevel.pmod+3 −3
| @@ -33,14 +33,14 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | class LightParams { |
| 36 | - string app_id; // json: "app_id" | |
| 37 | 36 | string outlet_id; // json: "outlet_id" |
| 37 | + string app_id; // json: "app_id" | |
| 38 | 38 | string rgba; // json: "rgba" |
| 39 | 39 | |
| 40 | 40 | string encode_json() { |
| 41 | 41 | mapping(string:mixed) json = ([ |
| 42 | - "app_id" : app_id, | |
| 43 | 42 | "outlet_id" : outlet_id, |
| 43 | + "app_id" : app_id, | |
| 44 | 44 | "rgba" : rgba, |
| 45 | 45 | ]); |
| 46 | 46 | |
| @@ -51,8 +51,8 @@ class LightParams { | ||
| 51 | 51 | LightParams LightParams_from_JSON(mixed json) { |
| 52 | 52 | LightParams retval = LightParams(); |
| 53 | 53 | |
| 54 | - retval.app_id = json["app_id"]; | |
| 55 | 54 | retval.outlet_id = json["outlet_id"]; |
| 55 | + retval.app_id = json["app_id"]; | |
| 56 | 56 | retval.rgba = json["rgba"]; |
| 57 | 57 | |
| 58 | 58 | return retval; |
Mschema-pythondefault / quicktype.py+4 −4
| @@ -17,22 +17,22 @@ def to_class(c: Type[T], x: Any) -> dict: | ||
| 17 | 17 | |
| 18 | 18 | @dataclass |
| 19 | 19 | class LightParams: |
| 20 | - app_id: str | |
| 21 | 20 | outlet_id: str |
| 21 | + app_id: str | |
| 22 | 22 | rgba: str |
| 23 | 23 | |
| 24 | 24 | @staticmethod |
| 25 | 25 | def from_dict(obj: Any) -> 'LightParams': |
| 26 | 26 | assert isinstance(obj, dict) |
| 27 | - app_id = from_str(obj.get("app_id")) | |
| 28 | 27 | outlet_id = from_str(obj.get("outlet_id")) |
| 28 | + app_id = from_str(obj.get("app_id")) | |
| 29 | 29 | rgba = from_str(obj.get("rgba")) |
| 30 | - return LightParams(app_id, outlet_id, rgba) | |
| 30 | + return LightParams(outlet_id, app_id, rgba) | |
| 31 | 31 | |
| 32 | 32 | def to_dict(self) -> dict: |
| 33 | 33 | result: dict = {} |
| 34 | - result["app_id"] = from_str(self.app_id) | |
| 35 | 34 | result["outlet_id"] = from_str(self.outlet_id) |
| 35 | + result["app_id"] = from_str(self.app_id) | |
| 36 | 36 | result["rgba"] = from_str(self.rgba) |
| 37 | 37 | return result |
Mschema-rubydefault / TopLevel.rb+4 −4
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.light_params.app_id | |
| 7 | +# puts top_level.light_params.outlet_id | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -20,15 +20,15 @@ module Types | ||
| 20 | 20 | end |
| 21 | 21 | |
| 22 | 22 | class LightParams < Dry::Struct |
| 23 | - attribute :app_id, Types::String | |
| 24 | 23 | attribute :outlet_id, Types::String |
| 24 | + attribute :app_id, Types::String | |
| 25 | 25 | attribute :rgba, Types::String |
| 26 | 26 | |
| 27 | 27 | def self.from_dynamic!(d) |
| 28 | 28 | d = Types::Hash[d] |
| 29 | 29 | new( |
| 30 | - app_id: d.fetch("app_id"), | |
| 31 | 30 | outlet_id: d.fetch("outlet_id"), |
| 31 | + app_id: d.fetch("app_id"), | |
| 32 | 32 | rgba: d.fetch("rgba"), |
| 33 | 33 | ) |
| 34 | 34 | end |
| @@ -39,8 +39,8 @@ class LightParams < Dry::Struct | ||
| 39 | 39 | |
| 40 | 40 | def to_dynamic |
| 41 | 41 | { |
| 42 | - "app_id" => app_id, | |
| 43 | 42 | "outlet_id" => outlet_id, |
| 43 | + "app_id" => app_id, | |
| 44 | 44 | "rgba" => rgba, |
| 45 | 45 | } |
| 46 | 46 | end |
Mschema-rustdefault / module_under_test.rs+2 −2
| @@ -21,9 +21,9 @@ pub struct TopLevel { | ||
| 21 | 21 | |
| 22 | 22 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 23 | 23 | pub struct LightParams { |
| 24 | - pub app_id: String, | |
| 25 | - | |
| 26 | 24 | pub outlet_id: String, |
| 27 | 25 | |
| 26 | + pub app_id: String, | |
| 27 | + | |
| 28 | 28 | pub rgba: String, |
| 29 | 29 | } |
Mschema-scala3-upickledefault / TopLevel.scala+1 −1
| @@ -70,7 +70,7 @@ case class TopLevel ( | ||
| 70 | 70 | ) derives OptionPickler.ReadWriter |
| 71 | 71 | |
| 72 | 72 | case class LightParams ( |
| 73 | - val app_id : String, | |
| 74 | 73 | val outlet_id : String, |
| 74 | + val app_id : String, | |
| 75 | 75 | val rgba : String |
| 76 | 76 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+1 −1
| @@ -12,7 +12,7 @@ case class TopLevel ( | ||
| 12 | 12 | ) derives Encoder.AsObject, Decoder |
| 13 | 13 | |
| 14 | 14 | case class LightParams ( |
| 15 | - val app_id : String, | |
| 16 | 15 | val outlet_id : String, |
| 16 | + val app_id : String, | |
| 17 | 17 | val rgba : String |
| 18 | 18 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+2 −2
| @@ -19,10 +19,10 @@ | ||
| 19 | 19 | "type": "object", |
| 20 | 20 | "additionalProperties": false, |
| 21 | 21 | "properties": { |
| 22 | - "app_id": { | |
| 22 | + "outlet_id": { | |
| 23 | 23 | "type": "string" |
| 24 | 24 | }, |
| 25 | - "outlet_id": { | |
| 25 | + "app_id": { | |
| 26 | 26 | "type": "string" |
| 27 | 27 | }, |
| 28 | 28 | "rgba": { |
Mschema-swiftdefault / quicktype.swift+4 −4
| @@ -51,13 +51,13 @@ extension TopLevel { | ||
| 51 | 51 | |
| 52 | 52 | // MARK: - LightParams |
| 53 | 53 | struct LightParams: Codable { |
| 54 | - let appID: String | |
| 55 | 54 | let outletID: String |
| 55 | + let appID: String | |
| 56 | 56 | let rgba: String |
| 57 | 57 | |
| 58 | 58 | enum CodingKeys: String, CodingKey { |
| 59 | - case appID = "app_id" | |
| 60 | 59 | case outletID = "outlet_id" |
| 60 | + case appID = "app_id" | |
| 61 | 61 | case rgba = "rgba" |
| 62 | 62 | } |
| 63 | 63 | } |
| @@ -81,13 +81,13 @@ extension LightParams { | ||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | func with( |
| 84 | - appID: String? = nil, | |
| 85 | 84 | outletID: String? = nil, |
| 85 | + appID: String? = nil, | |
| 86 | 86 | rgba: String? = nil |
| 87 | 87 | ) -> LightParams { |
| 88 | 88 | return LightParams( |
| 89 | - appID: appID ?? self.appID, | |
| 90 | 89 | outletID: outletID ?? self.outletID, |
| 90 | + appID: appID ?? self.appID, | |
| 91 | 91 | rgba: rgba ?? self.rgba |
| 92 | 92 | ) |
| 93 | 93 | } |
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,8 +2,8 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const LightParamsSchema = z.object({ |
| 5 | - "app_id": z.string(), | |
| 6 | 5 | "outlet_id": z.string(), |
| 6 | + "app_id": z.string(), | |
| 7 | 7 | "rgba": z.string(), |
| 8 | 8 | }); |
| 9 | 9 | export type LightParams = z.infer<typeof LightParamsSchema>; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -12,8 +12,8 @@ export interface TopLevel { | ||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | export interface LightParams { |
| 15 | - app_id: string; | |
| 16 | 15 | outlet_id: string; |
| 16 | + app_id: string; | |
| 17 | 17 | rgba: string; |
| 18 | 18 | } |
| 19 | 19 | |
| @@ -187,8 +187,8 @@ const typeMap: any = { | ||
| 187 | 187 | { json: "LightParams", js: "LightParams", typ: r("LightParams") }, |
| 188 | 188 | ], false), |
| 189 | 189 | "LightParams": o([ |
| 190 | - { json: "app_id", js: "app_id", typ: "" }, | |
| 191 | 190 | { json: "outlet_id", js: "outlet_id", typ: "" }, |
| 191 | + { json: "app_id", js: "app_id", typ: "" }, | |
| 192 | 192 | { json: "rgba", js: "rgba", typ: "" }, |
| 193 | 193 | ], false), |
| 194 | 194 | }; |
Test case
29 generated files · +195 −195test/inputs/schema/min-max-items.schema
Mschema-cjsondefault / TopLevel.c+32 −32
| @@ -62,6 +62,20 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 62 | 62 | if (NULL != j) { |
| 63 | 63 | if (NULL != (x = cJSON_malloc(sizeof(struct TopLevel)))) { |
| 64 | 64 | memset(x, 0, sizeof(struct TopLevel)); |
| 65 | + if (cJSON_HasObjectItem(j, "minOnly")) { | |
| 66 | + list_t * x1 = list_create(false, NULL); | |
| 67 | + if (NULL != x1) { | |
| 68 | + cJSON * e1 = NULL; | |
| 69 | + cJSON * j1 = cJSON_GetObjectItemCaseSensitive(j, "minOnly"); | |
| 70 | + cJSON_ArrayForEach(e1, j1) { | |
| 71 | + list_add_tail(x1, strdup(cJSON_GetStringValue(e1)), sizeof(char *)); | |
| 72 | + } | |
| 73 | + x->min_only = x1; | |
| 74 | + } | |
| 75 | + } | |
| 76 | + else { | |
| 77 | + x->min_only = list_create(false, NULL); | |
| 78 | + } | |
| 65 | 79 | if (cJSON_HasObjectItem(j, "maxOnly")) { |
| 66 | 80 | list_t * x1 = list_create(false, NULL); |
| 67 | 81 | if (NULL != x1) { |
| @@ -98,20 +112,6 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 98 | 112 | else { |
| 99 | 113 | x->min_and_max = list_create(false, NULL); |
| 100 | 114 | } |
| 101 | - if (cJSON_HasObjectItem(j, "minOnly")) { | |
| 102 | - list_t * x1 = list_create(false, NULL); | |
| 103 | - if (NULL != x1) { | |
| 104 | - cJSON * e1 = NULL; | |
| 105 | - cJSON * j1 = cJSON_GetObjectItemCaseSensitive(j, "minOnly"); | |
| 106 | - cJSON_ArrayForEach(e1, j1) { | |
| 107 | - list_add_tail(x1, strdup(cJSON_GetStringValue(e1)), sizeof(char *)); | |
| 108 | - } | |
| 109 | - x->min_only = x1; | |
| 110 | - } | |
| 111 | - } | |
| 112 | - else { | |
| 113 | - x->min_only = list_create(false, NULL); | |
| 114 | - } | |
| 115 | 115 | if (cJSON_HasObjectItem(j, "plain")) { |
| 116 | 116 | list_t * x1 = list_create(false, NULL); |
| 117 | 117 | if (NULL != x1) { |
| @@ -149,6 +149,16 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 149 | 149 | cJSON * j = NULL; |
| 150 | 150 | if (NULL != x) { |
| 151 | 151 | if (NULL != (j = cJSON_CreateObject())) { |
| 152 | + if (NULL != x->min_only) { | |
| 153 | + cJSON * j1 = cJSON_AddArrayToObject(j, "minOnly"); | |
| 154 | + if (NULL != j1) { | |
| 155 | + char * x1 = list_get_head(x->min_only); | |
| 156 | + while (NULL != x1) { | |
| 157 | + cJSON_AddItemToArray(j1, cJSON_CreateString(x1)); | |
| 158 | + x1 = list_get_next(x->min_only); | |
| 159 | + } | |
| 160 | + } | |
| 161 | + } | |
| 152 | 162 | if (NULL != x->max_only) { |
| 153 | 163 | cJSON * j1 = cJSON_AddArrayToObject(j, "maxOnly"); |
| 154 | 164 | if (NULL != j1) { |
| @@ -169,16 +179,6 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 169 | 179 | } |
| 170 | 180 | } |
| 171 | 181 | } |
| 172 | - if (NULL != x->min_only) { | |
| 173 | - cJSON * j1 = cJSON_AddArrayToObject(j, "minOnly"); | |
| 174 | - if (NULL != j1) { | |
| 175 | - char * x1 = list_get_head(x->min_only); | |
| 176 | - while (NULL != x1) { | |
| 177 | - cJSON_AddItemToArray(j1, cJSON_CreateString(x1)); | |
| 178 | - x1 = list_get_next(x->min_only); | |
| 179 | - } | |
| 180 | - } | |
| 181 | - } | |
| 182 | 182 | if (NULL != x->plain) { |
| 183 | 183 | cJSON * j1 = cJSON_AddArrayToObject(j, "plain"); |
| 184 | 184 | if (NULL != j1) { |
| @@ -218,6 +218,14 @@ char * cJSON_PrintTopLevel(const struct TopLevel * x) { | ||
| 218 | 218 | |
| 219 | 219 | void cJSON_DeleteTopLevel(struct TopLevel * x) { |
| 220 | 220 | if (NULL != x) { |
| 221 | + if (NULL != x->min_only) { | |
| 222 | + char * x1 = list_get_head(x->min_only); | |
| 223 | + while (NULL != x1) { | |
| 224 | + cJSON_free(x1); | |
| 225 | + x1 = list_get_next(x->min_only); | |
| 226 | + } | |
| 227 | + list_release(x->min_only); | |
| 228 | + } | |
| 221 | 229 | if (NULL != x->max_only) { |
| 222 | 230 | int64_t * x1 = list_get_head(x->max_only); |
| 223 | 231 | while (NULL != x1) { |
| @@ -234,14 +242,6 @@ void cJSON_DeleteTopLevel(struct TopLevel * x) { | ||
| 234 | 242 | } |
| 235 | 243 | list_release(x->min_and_max); |
| 236 | 244 | } |
| 237 | - if (NULL != x->min_only) { | |
| 238 | - char * x1 = list_get_head(x->min_only); | |
| 239 | - while (NULL != x1) { | |
| 240 | - cJSON_free(x1); | |
| 241 | - x1 = list_get_next(x->min_only); | |
| 242 | - } | |
| 243 | - list_release(x->min_only); | |
| 244 | - } | |
| 245 | 245 | if (NULL != x->plain) { |
| 246 | 246 | char * x1 = list_get_head(x->plain); |
| 247 | 247 | while (NULL != x1) { |
Mschema-cjsondefault / TopLevel.h+1 −1
| @@ -43,9 +43,9 @@ struct UnionItem { | ||
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | 45 | struct TopLevel { |
| 46 | + list_t * min_only; | |
| 46 | 47 | list_t * max_only; |
| 47 | 48 | list_t * min_and_max; |
| 48 | - list_t * min_only; | |
| 49 | 49 | list_t * plain; |
| 50 | 50 | list_t * union_items; |
| 51 | 51 | }; |
Mschema-cplusplusdefault / quicktype.hpp+7 −7
| @@ -96,13 +96,17 @@ namespace quicktype { | ||
| 96 | 96 | virtual ~TopLevel() = default; |
| 97 | 97 | |
| 98 | 98 | private: |
| 99 | + std::vector<std::string> min_only; | |
| 99 | 100 | std::vector<int64_t> max_only; |
| 100 | 101 | std::vector<double> min_and_max; |
| 101 | - std::vector<std::string> min_only; | |
| 102 | 102 | std::vector<std::string> plain; |
| 103 | 103 | std::vector<UnionItem> union_items; |
| 104 | 104 | |
| 105 | 105 | public: |
| 106 | + const std::vector<std::string> & get_min_only() const { return min_only; } | |
| 107 | + std::vector<std::string> & get_mutable_min_only() { return min_only; } | |
| 108 | + void set_min_only(const std::vector<std::string> & value) { this->min_only = value; } | |
| 109 | + | |
| 106 | 110 | const std::vector<int64_t> & get_max_only() const { return max_only; } |
| 107 | 111 | std::vector<int64_t> & get_mutable_max_only() { return max_only; } |
| 108 | 112 | void set_max_only(const std::vector<int64_t> & value) { this->max_only = value; } |
| @@ -111,10 +115,6 @@ namespace quicktype { | ||
| 111 | 115 | std::vector<double> & get_mutable_min_and_max() { return min_and_max; } |
| 112 | 116 | void set_min_and_max(const std::vector<double> & value) { this->min_and_max = value; } |
| 113 | 117 | |
| 114 | - const std::vector<std::string> & get_min_only() const { return min_only; } | |
| 115 | - std::vector<std::string> & get_mutable_min_only() { return min_only; } | |
| 116 | - void set_min_only(const std::vector<std::string> & value) { this->min_only = value; } | |
| 117 | - | |
| 118 | 118 | const std::vector<std::string> & get_plain() const { return plain; } |
| 119 | 119 | std::vector<std::string> & get_mutable_plain() { return plain; } |
| 120 | 120 | void set_plain(const std::vector<std::string> & value) { this->plain = value; } |
| @@ -138,18 +138,18 @@ struct adl_serializer<std::variant<int64_t, std::string>> { | ||
| 138 | 138 | } |
| 139 | 139 | namespace quicktype { |
| 140 | 140 | inline void from_json(const json & j, TopLevel& x) { |
| 141 | + x.set_min_only(j.at("minOnly").get<std::vector<std::string>>()); | |
| 141 | 142 | x.set_max_only(j.at("maxOnly").get<std::vector<int64_t>>()); |
| 142 | 143 | x.set_min_and_max(j.at("minAndMax").get<std::vector<double>>()); |
| 143 | - x.set_min_only(j.at("minOnly").get<std::vector<std::string>>()); | |
| 144 | 144 | x.set_plain(j.at("plain").get<std::vector<std::string>>()); |
| 145 | 145 | x.set_union_items(j.at("unionItems").get<std::vector<UnionItem>>()); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | inline void to_json(json & j, const TopLevel & x) { |
| 149 | 149 | j = json::object(); |
| 150 | + j["minOnly"] = x.get_min_only(); | |
| 150 | 151 | j["maxOnly"] = x.get_max_only(); |
| 151 | 152 | j["minAndMax"] = x.get_min_and_max(); |
| 152 | - j["minOnly"] = x.get_min_only(); | |
| 153 | 153 | j["plain"] = x.get_plain(); |
| 154 | 154 | j["unionItems"] = x.get_union_items(); |
| 155 | 155 | } |
Mschema-csharp-recordsdefault / QuickType.cs+3 −3
| @@ -25,15 +25,15 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | + [JsonProperty("minOnly", Required = Required.Always)] | |
| 29 | + public string[] MinOnly { get; set; } | |
| 30 | + | |
| 28 | 31 | [JsonProperty("maxOnly", Required = Required.Always)] |
| 29 | 32 | public long[] MaxOnly { get; set; } |
| 30 | 33 | |
| 31 | 34 | [JsonProperty("minAndMax", Required = Required.Always)] |
| 32 | 35 | public double[] MinAndMax { get; set; } |
| 33 | 36 | |
| 34 | - [JsonProperty("minOnly", Required = Required.Always)] | |
| 35 | - public string[] MinOnly { get; set; } | |
| 36 | - | |
| 37 | 37 | [JsonProperty("plain", Required = Required.Always)] |
| 38 | 38 | public string[] Plain { get; set; } |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+4 −4
| @@ -22,6 +22,10 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | + [JsonRequired] | |
| 26 | + [JsonPropertyName("minOnly")] | |
| 27 | + public string[] MinOnly { get; set; } | |
| 28 | + | |
| 25 | 29 | [JsonRequired] |
| 26 | 30 | [JsonPropertyName("maxOnly")] |
| 27 | 31 | public long[] MaxOnly { get; set; } |
| @@ -30,10 +34,6 @@ namespace QuickType | ||
| 30 | 34 | [JsonPropertyName("minAndMax")] |
| 31 | 35 | public double[] MinAndMax { get; set; } |
| 32 | 36 | |
| 33 | - [JsonRequired] | |
| 34 | - [JsonPropertyName("minOnly")] | |
| 35 | - public string[] MinOnly { get; set; } | |
| 36 | - | |
| 37 | 37 | [JsonRequired] |
| 38 | 38 | [JsonPropertyName("plain")] |
| 39 | 39 | public string[] Plain { get; set; } |
Mschema-csharpdefault / QuickType.cs+3 −3
| @@ -25,15 +25,15 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | + [JsonProperty("minOnly", Required = Required.Always)] | |
| 29 | + public string[] MinOnly { get; set; } | |
| 30 | + | |
| 28 | 31 | [JsonProperty("maxOnly", Required = Required.Always)] |
| 29 | 32 | public long[] MaxOnly { get; set; } |
| 30 | 33 | |
| 31 | 34 | [JsonProperty("minAndMax", Required = Required.Always)] |
| 32 | 35 | public double[] MinAndMax { get; set; } |
| 33 | 36 | |
| 34 | - [JsonProperty("minOnly", Required = Required.Always)] | |
| 35 | - public string[] MinOnly { get; set; } | |
| 36 | - | |
| 37 | 37 | [JsonProperty("plain", Required = Required.Always)] |
| 38 | 38 | public string[] Plain { get; set; } |
Mschema-dartdefault / TopLevel.dart+4 −4
| @@ -9,32 +9,32 @@ TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | ||
| 9 | 9 | String topLevelToJson(TopLevel data) => json.encode(data.toJson()); |
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | + final List<String> minOnly; | |
| 12 | 13 | final List<int> maxOnly; |
| 13 | 14 | final List<double> minAndMax; |
| 14 | - final List<String> minOnly; | |
| 15 | 15 | final List<String> plain; |
| 16 | 16 | final List<dynamic> unionItems; |
| 17 | 17 | |
| 18 | 18 | TopLevel({ |
| 19 | + required this.minOnly, | |
| 19 | 20 | required this.maxOnly, |
| 20 | 21 | required this.minAndMax, |
| 21 | - required this.minOnly, | |
| 22 | 22 | required this.plain, |
| 23 | 23 | required this.unionItems, |
| 24 | 24 | }); |
| 25 | 25 | |
| 26 | 26 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 27 | + minOnly: List<String>.from(json["minOnly"].map((x) => x)), | |
| 27 | 28 | maxOnly: List<int>.from(json["maxOnly"].map((x) => x)), |
| 28 | 29 | minAndMax: List<double>.from(json["minAndMax"].map((x) => x?.toDouble())), |
| 29 | - minOnly: List<String>.from(json["minOnly"].map((x) => x)), | |
| 30 | 30 | plain: List<String>.from(json["plain"].map((x) => x)), |
| 31 | 31 | unionItems: List<dynamic>.from(json["unionItems"].map((x) => x)), |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | 34 | Map<String, dynamic> toJson() => { |
| 35 | + "minOnly": List<dynamic>.from(minOnly.map((x) => x)), | |
| 35 | 36 | "maxOnly": List<dynamic>.from(maxOnly.map((x) => x)), |
| 36 | 37 | "minAndMax": List<dynamic>.from(minAndMax.map((x) => x)), |
| 37 | - "minOnly": List<dynamic>.from(minOnly.map((x) => x)), | |
| 38 | 38 | "plain": List<dynamic>.from(plain.map((x) => x)), |
| 39 | 39 | "unionItems": List<dynamic>.from(unionItems.map((x) => x)), |
| 40 | 40 | }; |
Mschema-elixirdefault / QuickType.ex+5 −5
| @@ -6,13 +6,13 @@ | ||
| 6 | 6 | # Encode into a JSON string: TopLevel.to_json(struct) |
| 7 | 7 | |
| 8 | 8 | defmodule TopLevel do |
| 9 | - @enforce_keys [:max_only, :min_and_max, :min_only, :plain, :union_items] | |
| 10 | - defstruct [:max_only, :min_and_max, :min_only, :plain, :union_items] | |
| 9 | + @enforce_keys [:min_only, :max_only, :min_and_max, :plain, :union_items] | |
| 10 | + defstruct [:min_only, :max_only, :min_and_max, :plain, :union_items] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | + min_only: [String.t()], | |
| 13 | 14 | max_only: [integer()], |
| 14 | 15 | min_and_max: [float()], |
| 15 | - min_only: [String.t()], | |
| 16 | 16 | plain: [String.t()], |
| 17 | 17 | union_items: [integer() | String.t()] |
| 18 | 18 | } |
| @@ -27,9 +27,9 @@ defmodule TopLevel do | ||
| 27 | 27 | |
| 28 | 28 | def from_map(m) do |
| 29 | 29 | %TopLevel{ |
| 30 | + min_only: m["minOnly"], | |
| 30 | 31 | max_only: m["maxOnly"], |
| 31 | 32 | min_and_max: m["minAndMax"], |
| 32 | - min_only: m["minOnly"], | |
| 33 | 33 | plain: m["plain"], |
| 34 | 34 | union_items: Enum.map(m["unionItems"], &decode_union_items_element/1), |
| 35 | 35 | } |
| @@ -43,9 +43,9 @@ defmodule TopLevel do | ||
| 43 | 43 | |
| 44 | 44 | def to_map(struct) do |
| 45 | 45 | %{ |
| 46 | + "minOnly" => struct.min_only, | |
| 46 | 47 | "maxOnly" => struct.max_only, |
| 47 | 48 | "minAndMax" => struct.min_and_max, |
| 48 | - "minOnly" => struct.min_only, | |
| 49 | 49 | "plain" => struct.plain, |
| 50 | 50 | "unionItems" => struct.union_items && Enum.map(struct.union_items, &encode_union_items_element/1), |
| 51 | 51 | } |
Mschema-elmdefault / QuickType.elm+5 −5
| @@ -24,9 +24,9 @@ import Json.Encode as Jenc | ||
| 24 | 24 | import Dict exposing (Dict) |
| 25 | 25 | |
| 26 | 26 | type alias QuickType = |
| 27 | - { maxOnly : List Int | |
| 27 | + { minOnly : List String | |
| 28 | + , maxOnly : List Int | |
| 28 | 29 | , minAndMax : List Float |
| 29 | - , minOnly : List String | |
| 30 | 30 | , plain : List String |
| 31 | 31 | , unionItems : List UnionItem |
| 32 | 32 | } |
| @@ -43,18 +43,18 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 43 | 43 | quickType : Jdec.Decoder QuickType |
| 44 | 44 | quickType = |
| 45 | 45 | Jdec.succeed QuickType |
| 46 | + |> Jpipe.required "minOnly" (Jdec.list Jdec.string) | |
| 46 | 47 | |> Jpipe.required "maxOnly" (Jdec.list Jdec.int) |
| 47 | 48 | |> Jpipe.required "minAndMax" (Jdec.list Jdec.float) |
| 48 | - |> Jpipe.required "minOnly" (Jdec.list Jdec.string) | |
| 49 | 49 | |> Jpipe.required "plain" (Jdec.list Jdec.string) |
| 50 | 50 | |> Jpipe.required "unionItems" (Jdec.list unionItem) |
| 51 | 51 | |
| 52 | 52 | encodeQuickType : QuickType -> Jenc.Value |
| 53 | 53 | encodeQuickType x = |
| 54 | 54 | Jenc.object |
| 55 | - [ ("maxOnly", Jenc.list Jenc.int x.maxOnly) | |
| 55 | + [ ("minOnly", Jenc.list Jenc.string x.minOnly) | |
| 56 | + , ("maxOnly", Jenc.list Jenc.int x.maxOnly) | |
| 56 | 57 | , ("minAndMax", Jenc.list Jenc.float x.minAndMax) |
| 57 | - , ("minOnly", Jenc.list Jenc.string x.minOnly) | |
| 58 | 58 | , ("plain", Jenc.list Jenc.string x.plain) |
| 59 | 59 | , ("unionItems", Jenc.list encodeUnionItem x.unionItems) |
| 60 | 60 | ] |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -10,9 +10,9 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | + minOnly: string[]; | |
| 13 | 14 | maxOnly: number[]; |
| 14 | 15 | minAndMax: number[]; |
| 15 | - minOnly: string[]; | |
| 16 | 16 | plain: string[]; |
| 17 | 17 | unionItems: UnionItem[]; |
| 18 | 18 | [property: string]: mixed; |
| @@ -185,9 +185,9 @@ function r(name: string) { | ||
| 185 | 185 | |
| 186 | 186 | const typeMap: any = { |
| 187 | 187 | "TopLevel": o([ |
| 188 | + { json: "minOnly", js: "minOnly", typ: a("") }, | |
| 188 | 189 | { json: "maxOnly", js: "maxOnly", typ: a(0) }, |
| 189 | 190 | { json: "minAndMax", js: "minAndMax", typ: a(3.14) }, |
| 190 | - { json: "minOnly", js: "minOnly", typ: a("") }, | |
| 191 | 191 | { json: "plain", js: "plain", typ: a("") }, |
| 192 | 192 | { json: "unionItems", js: "unionItems", typ: a(u(0, "")) }, |
| 193 | 193 | ], "any"), |
Mschema-golangdefault / quicktype.go+1 −1
| @@ -22,9 +22,9 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | type TopLevel struct { |
| 25 | + MinOnly []string `json:"minOnly"` | |
| 25 | 26 | MaxOnly []int64 `json:"maxOnly"` |
| 26 | 27 | MinAndMax []float64 `json:"minAndMax"` |
| 27 | - MinOnly []string `json:"minOnly"` | |
| 28 | 28 | Plain []string `json:"plain"` |
| 29 | 29 | UnionItems []UnionItem `json:"unionItems"` |
| 30 | 30 | } |
Mschema-haskelldefault / QuickType.hs+7 −7
| @@ -14,9 +14,9 @@ import Data.HashMap.Strict (HashMap) | ||
| 14 | 14 | import Data.Text (Text) |
| 15 | 15 | |
| 16 | 16 | data QuickType = QuickType |
| 17 | - { maxOnlyQuickType :: [Int] | |
| 17 | + { minOnlyQuickType :: [Text] | |
| 18 | + , maxOnlyQuickType :: [Int] | |
| 18 | 19 | , minAndMaxQuickType :: [Float] |
| 19 | - , minOnlyQuickType :: [Text] | |
| 20 | 20 | , plainQuickType :: [Text] |
| 21 | 21 | , unionItemsQuickType :: [UnionItem] |
| 22 | 22 | } deriving (Show) |
| @@ -30,20 +30,20 @@ decodeTopLevel :: ByteString -> Maybe QuickType | ||
| 30 | 30 | decodeTopLevel = decode |
| 31 | 31 | |
| 32 | 32 | instance ToJSON QuickType where |
| 33 | - toJSON (QuickType maxOnlyQuickType minAndMaxQuickType minOnlyQuickType plainQuickType unionItemsQuickType) = | |
| 33 | + toJSON (QuickType minOnlyQuickType maxOnlyQuickType minAndMaxQuickType plainQuickType unionItemsQuickType) = | |
| 34 | 34 | object |
| 35 | - [ "maxOnly" .= maxOnlyQuickType | |
| 35 | + [ "minOnly" .= minOnlyQuickType | |
| 36 | + , "maxOnly" .= maxOnlyQuickType | |
| 36 | 37 | , "minAndMax" .= minAndMaxQuickType |
| 37 | - , "minOnly" .= minOnlyQuickType | |
| 38 | 38 | , "plain" .= plainQuickType |
| 39 | 39 | , "unionItems" .= unionItemsQuickType |
| 40 | 40 | ] |
| 41 | 41 | |
| 42 | 42 | instance FromJSON QuickType where |
| 43 | 43 | parseJSON (Object v) = QuickType |
| 44 | - <$> v .: "maxOnly" | |
| 44 | + <$> v .: "minOnly" | |
| 45 | + <*> v .: "maxOnly" | |
| 45 | 46 | <*> v .: "minAndMax" |
| 46 | - <*> v .: "minOnly" | |
| 47 | 47 | <*> v .: "plain" |
| 48 | 48 | <*> v .: "unionItems" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -4,12 +4,17 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | + private List<String> minOnly; | |
| 7 | 8 | private List<Long> maxOnly; |
| 8 | 9 | private List<Double> minAndMax; |
| 9 | - private List<String> minOnly; | |
| 10 | 10 | private List<String> plain; |
| 11 | 11 | private List<UnionItem> unionItems; |
| 12 | 12 | |
| 13 | + @JsonProperty("minOnly") | |
| 14 | + public List<String> getMinOnly() { return minOnly; } | |
| 15 | + @JsonProperty("minOnly") | |
| 16 | + public void setMinOnly(List<String> value) { this.minOnly = value; } | |
| 17 | + | |
| 13 | 18 | @JsonProperty("maxOnly") |
| 14 | 19 | public List<Long> getMaxOnly() { return maxOnly; } |
| 15 | 20 | @JsonProperty("maxOnly") |
| @@ -20,11 +25,6 @@ public class TopLevel { | ||
| 20 | 25 | @JsonProperty("minAndMax") |
| 21 | 26 | public void setMinAndMax(List<Double> value) { this.minAndMax = value; } |
| 22 | 27 | |
| 23 | - @JsonProperty("minOnly") | |
| 24 | - public List<String> getMinOnly() { return minOnly; } | |
| 25 | - @JsonProperty("minOnly") | |
| 26 | - public void setMinOnly(List<String> value) { this.minOnly = value; } | |
| 27 | - | |
| 28 | 28 | @JsonProperty("plain") |
| 29 | 29 | public List<String> getPlain() { return plain; } |
| 30 | 30 | @JsonProperty("plain") |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -4,12 +4,17 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | + private List<String> minOnly; | |
| 7 | 8 | private List<Long> maxOnly; |
| 8 | 9 | private List<Double> minAndMax; |
| 9 | - private List<String> minOnly; | |
| 10 | 10 | private List<String> plain; |
| 11 | 11 | private List<UnionItem> unionItems; |
| 12 | 12 | |
| 13 | + @JsonProperty("minOnly") | |
| 14 | + public List<String> getMinOnly() { return minOnly; } | |
| 15 | + @JsonProperty("minOnly") | |
| 16 | + public void setMinOnly(List<String> value) { this.minOnly = value; } | |
| 17 | + | |
| 13 | 18 | @JsonProperty("maxOnly") |
| 14 | 19 | public List<Long> getMaxOnly() { return maxOnly; } |
| 15 | 20 | @JsonProperty("maxOnly") |
| @@ -20,11 +25,6 @@ public class TopLevel { | ||
| 20 | 25 | @JsonProperty("minAndMax") |
| 21 | 26 | public void setMinAndMax(List<Double> value) { this.minAndMax = value; } |
| 22 | 27 | |
| 23 | - @JsonProperty("minOnly") | |
| 24 | - public List<String> getMinOnly() { return minOnly; } | |
| 25 | - @JsonProperty("minOnly") | |
| 26 | - public void setMinOnly(List<String> value) { this.minOnly = value; } | |
| 27 | - | |
| 28 | 28 | @JsonProperty("plain") |
| 29 | 29 | public List<String> getPlain() { return plain; } |
| 30 | 30 | @JsonProperty("plain") |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -4,12 +4,17 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | + private List<String> minOnly; | |
| 7 | 8 | private List<Long> maxOnly; |
| 8 | 9 | private List<Double> minAndMax; |
| 9 | - private List<String> minOnly; | |
| 10 | 10 | private List<String> plain; |
| 11 | 11 | private List<UnionItem> unionItems; |
| 12 | 12 | |
| 13 | + @JsonProperty("minOnly") | |
| 14 | + public List<String> getMinOnly() { return minOnly; } | |
| 15 | + @JsonProperty("minOnly") | |
| 16 | + public void setMinOnly(List<String> value) { this.minOnly = value; } | |
| 17 | + | |
| 13 | 18 | @JsonProperty("maxOnly") |
| 14 | 19 | public List<Long> getMaxOnly() { return maxOnly; } |
| 15 | 20 | @JsonProperty("maxOnly") |
| @@ -20,11 +25,6 @@ public class TopLevel { | ||
| 20 | 25 | @JsonProperty("minAndMax") |
| 21 | 26 | public void setMinAndMax(List<Double> value) { this.minAndMax = value; } |
| 22 | 27 | |
| 23 | - @JsonProperty("minOnly") | |
| 24 | - public List<String> getMinOnly() { return minOnly; } | |
| 25 | - @JsonProperty("minOnly") | |
| 26 | - public void setMinOnly(List<String> value) { this.minOnly = value; } | |
| 27 | - | |
| 28 | 28 | @JsonProperty("plain") |
| 29 | 29 | public List<String> getPlain() { return plain; } |
| 30 | 30 | @JsonProperty("plain") |
Mschema-javascriptdefault / TopLevel.js+1 −1
| @@ -172,9 +172,9 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | + { json: "minOnly", js: "minOnly", typ: a("") }, | |
| 175 | 176 | { json: "maxOnly", js: "maxOnly", typ: a(0) }, |
| 176 | 177 | { json: "minAndMax", js: "minAndMax", typ: a(3.14) }, |
| 177 | - { json: "minOnly", js: "minOnly", typ: a("") }, | |
| 178 | 178 | { json: "plain", js: "plain", typ: a("") }, |
| 179 | 179 | { json: "unionItems", js: "unionItems", typ: a(u(0, "")) }, |
| 180 | 180 | ], "any"), |
Mschema-kotlin-jacksondefault / TopLevel.kt+3 −3
| @@ -32,13 +32,13 @@ val mapper = jacksonObjectMapper().apply { | ||
| 32 | 32 | |
| 33 | 33 | data class TopLevel ( |
| 34 | 34 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 35 | - val maxOnly: List<Long>, | |
| 35 | + val minOnly: List<String>, | |
| 36 | 36 | |
| 37 | 37 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 38 | - val minAndMax: List<Double>, | |
| 38 | + val maxOnly: List<Long>, | |
| 39 | 39 | |
| 40 | 40 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 41 | - val minOnly: List<String>, | |
| 41 | + val minAndMax: List<Double>, | |
| 42 | 42 | |
| 43 | 43 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 44 | 44 | val plain: List<String>, |
Mschema-kotlindefault / TopLevel.kt+1 −1
| @@ -18,9 +18,9 @@ private val klaxon = Klaxon() | ||
| 18 | 18 | .convert(UnionItem::class, { UnionItem.fromJson(it) }, { it.toJson() }, true) |
| 19 | 19 | |
| 20 | 20 | data class TopLevel ( |
| 21 | + val minOnly: List<String>, | |
| 21 | 22 | val maxOnly: List<Long>, |
| 22 | 23 | val minAndMax: List<Double>, |
| 23 | - val minOnly: List<String>, | |
| 24 | 24 | val plain: List<String>, |
| 25 | 25 | val unionItems: List<UnionItem> |
| 26 | 26 | ) { |
Mschema-phpdefault / TopLevel.php+65 −65
| @@ -4,23 +4,23 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | + private array $minOnly; // json:minOnly Required | |
| 7 | 8 | private array $maxOnly; // json:maxOnly Required |
| 8 | 9 | private array $minAndMax; // json:minAndMax Required |
| 9 | - private array $minOnly; // json:minOnly Required | |
| 10 | 10 | private array $plain; // json:plain Required |
| 11 | 11 | private array $unionItems; // json:unionItems Required |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | + * @param array $minOnly | |
| 14 | 15 | * @param array $maxOnly |
| 15 | 16 | * @param array $minAndMax |
| 16 | - * @param array $minOnly | |
| 17 | 17 | * @param array $plain |
| 18 | 18 | * @param array $unionItems |
| 19 | 19 | */ |
| 20 | - public function __construct(array $maxOnly, array $minAndMax, array $minOnly, array $plain, array $unionItems) { | |
| 20 | + public function __construct(array $minOnly, array $maxOnly, array $minAndMax, array $plain, array $unionItems) { | |
| 21 | + $this->minOnly = $minOnly; | |
| 21 | 22 | $this->maxOnly = $maxOnly; |
| 22 | 23 | $this->minAndMax = $minAndMax; |
| 23 | - $this->minOnly = $minOnly; | |
| 24 | 24 | $this->plain = $plain; |
| 25 | 25 | $this->unionItems = $unionItems; |
| 26 | 26 | } |
| @@ -30,9 +30,9 @@ class TopLevel { | ||
| 30 | 30 | * @throws Exception |
| 31 | 31 | * @return array |
| 32 | 32 | */ |
| 33 | - public static function fromMaxOnly(array $value): array { | |
| 33 | + public static function fromMinOnly(array $value): array { | |
| 34 | 34 | return array_map(function ($value) { |
| 35 | - return $value; /*int*/ | |
| 35 | + return $value; /*string*/ | |
| 36 | 36 | }, $value); |
| 37 | 37 | } |
| 38 | 38 | |
| @@ -40,13 +40,13 @@ class TopLevel { | ||
| 40 | 40 | * @throws Exception |
| 41 | 41 | * @return array |
| 42 | 42 | */ |
| 43 | - public function toMaxOnly(): array { | |
| 44 | - if (TopLevel::validateMaxOnly($this->maxOnly)) { | |
| 43 | + public function toMinOnly(): array { | |
| 44 | + if (TopLevel::validateMinOnly($this->minOnly)) { | |
| 45 | 45 | return array_map(function ($value) { |
| 46 | - return $value; /*int*/ | |
| 47 | - }, $this->maxOnly); | |
| 46 | + return $value; /*string*/ | |
| 47 | + }, $this->minOnly); | |
| 48 | 48 | } |
| 49 | - throw new Exception('never get to this TopLevel::maxOnly'); | |
| 49 | + throw new Exception('never get to this TopLevel::minOnly'); | |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
| @@ -54,13 +54,13 @@ class TopLevel { | ||
| 54 | 54 | * @return bool |
| 55 | 55 | * @throws Exception |
| 56 | 56 | */ |
| 57 | - public static function validateMaxOnly(array $value): bool { | |
| 57 | + public static function validateMinOnly(array $value): bool { | |
| 58 | 58 | if (!is_array($value)) { |
| 59 | - throw new Exception("Attribute Error:TopLevel::maxOnly"); | |
| 59 | + throw new Exception("Attribute Error:TopLevel::minOnly"); | |
| 60 | 60 | } |
| 61 | 61 | array_walk($value, function($value_v) { |
| 62 | - if (!is_integer($value_v)) { | |
| 63 | - throw new Exception("Attribute Error:TopLevel::maxOnly"); | |
| 62 | + if (!is_string($value_v)) { | |
| 63 | + throw new Exception("Attribute Error:TopLevel::minOnly"); | |
| 64 | 64 | } |
| 65 | 65 | }); |
| 66 | 66 | return true; |
| @@ -70,20 +70,20 @@ class TopLevel { | ||
| 70 | 70 | * @throws Exception |
| 71 | 71 | * @return array |
| 72 | 72 | */ |
| 73 | - public function getMaxOnly(): array { | |
| 74 | - if (TopLevel::validateMaxOnly($this->maxOnly)) { | |
| 75 | - return $this->maxOnly; | |
| 73 | + public function getMinOnly(): array { | |
| 74 | + if (TopLevel::validateMinOnly($this->minOnly)) { | |
| 75 | + return $this->minOnly; | |
| 76 | 76 | } |
| 77 | - throw new Exception('never get to getMaxOnly TopLevel::maxOnly'); | |
| 77 | + throw new Exception('never get to getMinOnly TopLevel::minOnly'); | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * @return array |
| 82 | 82 | */ |
| 83 | - public static function sampleMaxOnly(): array { | |
| 83 | + public static function sampleMinOnly(): array { | |
| 84 | 84 | return array( |
| 85 | - 31 /*31:*/ | |
| 86 | - ); /* 31:maxOnly*/ | |
| 85 | + 'TopLevel::::31' /*31:*/ | |
| 86 | + ); /* 31:minOnly*/ | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
| @@ -91,9 +91,9 @@ class TopLevel { | ||
| 91 | 91 | * @throws Exception |
| 92 | 92 | * @return array |
| 93 | 93 | */ |
| 94 | - public static function fromMinAndMax(array $value): array { | |
| 94 | + public static function fromMaxOnly(array $value): array { | |
| 95 | 95 | return array_map(function ($value) { |
| 96 | - return $value; /*float*/ | |
| 96 | + return $value; /*int*/ | |
| 97 | 97 | }, $value); |
| 98 | 98 | } |
| 99 | 99 | |
| @@ -101,13 +101,13 @@ class TopLevel { | ||
| 101 | 101 | * @throws Exception |
| 102 | 102 | * @return array |
| 103 | 103 | */ |
| 104 | - public function toMinAndMax(): array { | |
| 105 | - if (TopLevel::validateMinAndMax($this->minAndMax)) { | |
| 104 | + public function toMaxOnly(): array { | |
| 105 | + if (TopLevel::validateMaxOnly($this->maxOnly)) { | |
| 106 | 106 | return array_map(function ($value) { |
| 107 | - return $value; /*float*/ | |
| 108 | - }, $this->minAndMax); | |
| 107 | + return $value; /*int*/ | |
| 108 | + }, $this->maxOnly); | |
| 109 | 109 | } |
| 110 | - throw new Exception('never get to this TopLevel::minAndMax'); | |
| 110 | + throw new Exception('never get to this TopLevel::maxOnly'); | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
| @@ -115,13 +115,13 @@ class TopLevel { | ||
| 115 | 115 | * @return bool |
| 116 | 116 | * @throws Exception |
| 117 | 117 | */ |
| 118 | - public static function validateMinAndMax(array $value): bool { | |
| 118 | + public static function validateMaxOnly(array $value): bool { | |
| 119 | 119 | if (!is_array($value)) { |
| 120 | - throw new Exception("Attribute Error:TopLevel::minAndMax"); | |
| 120 | + throw new Exception("Attribute Error:TopLevel::maxOnly"); | |
| 121 | 121 | } |
| 122 | 122 | array_walk($value, function($value_v) { |
| 123 | - if (!is_float($value_v) && !is_int($value_v)) { | |
| 124 | - throw new Exception("Attribute Error:TopLevel::minAndMax"); | |
| 123 | + if (!is_integer($value_v)) { | |
| 124 | + throw new Exception("Attribute Error:TopLevel::maxOnly"); | |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | 127 | return true; |
| @@ -131,20 +131,20 @@ class TopLevel { | ||
| 131 | 131 | * @throws Exception |
| 132 | 132 | * @return array |
| 133 | 133 | */ |
| 134 | - public function getMinAndMax(): array { | |
| 135 | - if (TopLevel::validateMinAndMax($this->minAndMax)) { | |
| 136 | - return $this->minAndMax; | |
| 134 | + public function getMaxOnly(): array { | |
| 135 | + if (TopLevel::validateMaxOnly($this->maxOnly)) { | |
| 136 | + return $this->maxOnly; | |
| 137 | 137 | } |
| 138 | - throw new Exception('never get to getMinAndMax TopLevel::minAndMax'); | |
| 138 | + throw new Exception('never get to getMaxOnly TopLevel::maxOnly'); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | * @return array |
| 143 | 143 | */ |
| 144 | - public static function sampleMinAndMax(): array { | |
| 144 | + public static function sampleMaxOnly(): array { | |
| 145 | 145 | return array( |
| 146 | - 32.032 /*32:*/ | |
| 147 | - ); /* 32:minAndMax*/ | |
| 146 | + 32 /*32:*/ | |
| 147 | + ); /* 32:maxOnly*/ | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
| @@ -152,9 +152,9 @@ class TopLevel { | ||
| 152 | 152 | * @throws Exception |
| 153 | 153 | * @return array |
| 154 | 154 | */ |
| 155 | - public static function fromMinOnly(array $value): array { | |
| 155 | + public static function fromMinAndMax(array $value): array { | |
| 156 | 156 | return array_map(function ($value) { |
| 157 | - return $value; /*string*/ | |
| 157 | + return $value; /*float*/ | |
| 158 | 158 | }, $value); |
| 159 | 159 | } |
| 160 | 160 | |
| @@ -162,13 +162,13 @@ class TopLevel { | ||
| 162 | 162 | * @throws Exception |
| 163 | 163 | * @return array |
| 164 | 164 | */ |
| 165 | - public function toMinOnly(): array { | |
| 166 | - if (TopLevel::validateMinOnly($this->minOnly)) { | |
| 165 | + public function toMinAndMax(): array { | |
| 166 | + if (TopLevel::validateMinAndMax($this->minAndMax)) { | |
| 167 | 167 | return array_map(function ($value) { |
| 168 | - return $value; /*string*/ | |
| 169 | - }, $this->minOnly); | |
| 168 | + return $value; /*float*/ | |
| 169 | + }, $this->minAndMax); | |
| 170 | 170 | } |
| 171 | - throw new Exception('never get to this TopLevel::minOnly'); | |
| 171 | + throw new Exception('never get to this TopLevel::minAndMax'); | |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
| @@ -176,13 +176,13 @@ class TopLevel { | ||
| 176 | 176 | * @return bool |
| 177 | 177 | * @throws Exception |
| 178 | 178 | */ |
| 179 | - public static function validateMinOnly(array $value): bool { | |
| 179 | + public static function validateMinAndMax(array $value): bool { | |
| 180 | 180 | if (!is_array($value)) { |
| 181 | - throw new Exception("Attribute Error:TopLevel::minOnly"); | |
| 181 | + throw new Exception("Attribute Error:TopLevel::minAndMax"); | |
| 182 | 182 | } |
| 183 | 183 | array_walk($value, function($value_v) { |
| 184 | - if (!is_string($value_v)) { | |
| 185 | - throw new Exception("Attribute Error:TopLevel::minOnly"); | |
| 184 | + if (!is_float($value_v) && !is_int($value_v)) { | |
| 185 | + throw new Exception("Attribute Error:TopLevel::minAndMax"); | |
| 186 | 186 | } |
| 187 | 187 | }); |
| 188 | 188 | return true; |
| @@ -192,20 +192,20 @@ class TopLevel { | ||
| 192 | 192 | * @throws Exception |
| 193 | 193 | * @return array |
| 194 | 194 | */ |
| 195 | - public function getMinOnly(): array { | |
| 196 | - if (TopLevel::validateMinOnly($this->minOnly)) { | |
| 197 | - return $this->minOnly; | |
| 195 | + public function getMinAndMax(): array { | |
| 196 | + if (TopLevel::validateMinAndMax($this->minAndMax)) { | |
| 197 | + return $this->minAndMax; | |
| 198 | 198 | } |
| 199 | - throw new Exception('never get to getMinOnly TopLevel::minOnly'); | |
| 199 | + throw new Exception('never get to getMinAndMax TopLevel::minAndMax'); | |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | 203 | * @return array |
| 204 | 204 | */ |
| 205 | - public static function sampleMinOnly(): array { | |
| 205 | + public static function sampleMinAndMax(): array { | |
| 206 | 206 | return array( |
| 207 | - 'TopLevel::::33' /*33:*/ | |
| 208 | - ); /* 33:minOnly*/ | |
| 207 | + 33.033 /*33:*/ | |
| 208 | + ); /* 33:minAndMax*/ | |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
| @@ -355,9 +355,9 @@ class TopLevel { | ||
| 355 | 355 | * @return bool |
| 356 | 356 | */ |
| 357 | 357 | public function validate(): bool { |
| 358 | - return TopLevel::validateMaxOnly($this->maxOnly) | |
| 358 | + return TopLevel::validateMinOnly($this->minOnly) | |
| 359 | + || TopLevel::validateMaxOnly($this->maxOnly) | |
| 359 | 360 | || TopLevel::validateMinAndMax($this->minAndMax) |
| 360 | - || TopLevel::validateMinOnly($this->minOnly) | |
| 361 | 361 | || TopLevel::validatePlain($this->plain) |
| 362 | 362 | || TopLevel::validateUnionItems($this->unionItems); |
| 363 | 363 | } |
| @@ -368,9 +368,9 @@ class TopLevel { | ||
| 368 | 368 | */ |
| 369 | 369 | public function to(): stdClass { |
| 370 | 370 | $out = new stdClass(); |
| 371 | + $out->{'minOnly'} = $this->toMinOnly(); | |
| 371 | 372 | $out->{'maxOnly'} = $this->toMaxOnly(); |
| 372 | 373 | $out->{'minAndMax'} = $this->toMinAndMax(); |
| 373 | - $out->{'minOnly'} = $this->toMinOnly(); | |
| 374 | 374 | $out->{'plain'} = $this->toPlain(); |
| 375 | 375 | $out->{'unionItems'} = $this->toUnionItems(); |
| 376 | 376 | return $out; |
| @@ -383,9 +383,9 @@ class TopLevel { | ||
| 383 | 383 | */ |
| 384 | 384 | public static function from(stdClass $obj): TopLevel { |
| 385 | 385 | return new TopLevel( |
| 386 | - TopLevel::fromMaxOnly($obj->{'maxOnly'}) | |
| 386 | + TopLevel::fromMinOnly($obj->{'minOnly'}) | |
| 387 | + ,TopLevel::fromMaxOnly($obj->{'maxOnly'}) | |
| 387 | 388 | ,TopLevel::fromMinAndMax($obj->{'minAndMax'}) |
| 388 | - ,TopLevel::fromMinOnly($obj->{'minOnly'}) | |
| 389 | 389 | ,TopLevel::fromPlain($obj->{'plain'}) |
| 390 | 390 | ,TopLevel::fromUnionItems($obj->{'unionItems'}) |
| 391 | 391 | ); |
| @@ -396,9 +396,9 @@ class TopLevel { | ||
| 396 | 396 | */ |
| 397 | 397 | public static function sample(): TopLevel { |
| 398 | 398 | return new TopLevel( |
| 399 | - TopLevel::sampleMaxOnly() | |
| 399 | + TopLevel::sampleMinOnly() | |
| 400 | + ,TopLevel::sampleMaxOnly() | |
| 400 | 401 | ,TopLevel::sampleMinAndMax() |
| 401 | - ,TopLevel::sampleMinOnly() | |
| 402 | 402 | ,TopLevel::samplePlain() |
| 403 | 403 | ,TopLevel::sampleUnionItems() |
| 404 | 404 | ); |
Mschema-pikedefault / TopLevel.pmod+3 −3
| @@ -13,17 +13,17 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | + array(string) min_only; // json: "minOnly" | |
| 16 | 17 | array(int) max_only; // json: "maxOnly" |
| 17 | 18 | array(float) min_and_max; // json: "minAndMax" |
| 18 | - array(string) min_only; // json: "minOnly" | |
| 19 | 19 | array(string) plain; // json: "plain" |
| 20 | 20 | array(UnionItem) union_items; // json: "unionItems" |
| 21 | 21 | |
| 22 | 22 | string encode_json() { |
| 23 | 23 | mapping(string:mixed) json = ([ |
| 24 | + "minOnly" : min_only, | |
| 24 | 25 | "maxOnly" : max_only, |
| 25 | 26 | "minAndMax" : min_and_max, |
| 26 | - "minOnly" : min_only, | |
| 27 | 27 | "plain" : plain, |
| 28 | 28 | "unionItems" : union_items, |
| 29 | 29 | ]); |
| @@ -35,9 +35,9 @@ class TopLevel { | ||
| 35 | 35 | TopLevel TopLevel_from_JSON(mixed json) { |
| 36 | 36 | TopLevel retval = TopLevel(); |
| 37 | 37 | |
| 38 | + retval.min_only = json["minOnly"]; | |
| 38 | 39 | retval.max_only = json["maxOnly"]; |
| 39 | 40 | retval.min_and_max = json["minAndMax"]; |
| 40 | - retval.min_only = json["minOnly"]; | |
| 41 | 41 | retval.plain = json["plain"]; |
| 42 | 42 | retval.union_items = json["unionItems"]; |
Mschema-pythondefault / quicktype.py+9 −9
| @@ -10,6 +10,11 @@ def from_list(f: Callable[[Any], T], x: Any) -> list[T]: | ||
| 10 | 10 | return [f(y) for y in x] |
| 11 | 11 | |
| 12 | 12 | |
| 13 | +def from_str(x: Any) -> str: | |
| 14 | + assert isinstance(x, str) | |
| 15 | + return x | |
| 16 | + | |
| 17 | + | |
| 13 | 18 | def from_int(x: Any) -> int: |
| 14 | 19 | assert isinstance(x, int) and not isinstance(x, bool) |
| 15 | 20 | return x |
| @@ -20,11 +25,6 @@ def from_float(x: Any) -> float: | ||
| 20 | 25 | return float(x) |
| 21 | 26 | |
| 22 | 27 | |
| 23 | -def from_str(x: Any) -> str: | |
| 24 | - assert isinstance(x, str) | |
| 25 | - return x | |
| 26 | - | |
| 27 | - | |
| 28 | 28 | def from_union(fs, x): |
| 29 | 29 | for f in fs: |
| 30 | 30 | try: |
| @@ -46,27 +46,27 @@ def to_class(c: Type[T], x: Any) -> dict: | ||
| 46 | 46 | |
| 47 | 47 | @dataclass |
| 48 | 48 | class TopLevel: |
| 49 | + min_only: list[str] | |
| 49 | 50 | max_only: list[int] |
| 50 | 51 | min_and_max: list[float] |
| 51 | - min_only: list[str] | |
| 52 | 52 | plain: list[str] |
| 53 | 53 | union_items: list[int | str] |
| 54 | 54 | |
| 55 | 55 | @staticmethod |
| 56 | 56 | def from_dict(obj: Any) -> 'TopLevel': |
| 57 | 57 | assert isinstance(obj, dict) |
| 58 | + min_only = from_list(from_str, obj.get("minOnly")) | |
| 58 | 59 | max_only = from_list(from_int, obj.get("maxOnly")) |
| 59 | 60 | min_and_max = from_list(from_float, obj.get("minAndMax")) |
| 60 | - min_only = from_list(from_str, obj.get("minOnly")) | |
| 61 | 61 | plain = from_list(from_str, obj.get("plain")) |
| 62 | 62 | union_items = from_list(lambda x: from_union([from_int, from_str], x), obj.get("unionItems")) |
| 63 | - return TopLevel(max_only, min_and_max, min_only, plain, union_items) | |
| 63 | + return TopLevel(min_only, max_only, min_and_max, plain, union_items) | |
| 64 | 64 | |
| 65 | 65 | def to_dict(self) -> dict: |
| 66 | 66 | result: dict = {} |
| 67 | + result["minOnly"] = from_list(from_str, self.min_only) | |
| 67 | 68 | result["maxOnly"] = from_list(from_int, self.max_only) |
| 68 | 69 | result["minAndMax"] = from_list(to_float, self.min_and_max) |
| 69 | - result["minOnly"] = from_list(from_str, self.min_only) | |
| 70 | 70 | result["plain"] = from_list(from_str, self.plain) |
| 71 | 71 | result["unionItems"] = from_list(lambda x: from_union([from_int, from_str], x), self.union_items) |
| 72 | 72 | return result |
Mschema-rubydefault / TopLevel.rb+3 −3
| @@ -53,18 +53,18 @@ class UnionItem < Dry::Struct | ||
| 53 | 53 | end |
| 54 | 54 | |
| 55 | 55 | class TopLevel < Dry::Struct |
| 56 | + attribute :min_only, Types.Array(Types::String) | |
| 56 | 57 | attribute :max_only, Types.Array(Types::Integer) |
| 57 | 58 | attribute :min_and_max, Types.Array(Types::Double) |
| 58 | - attribute :min_only, Types.Array(Types::String) | |
| 59 | 59 | attribute :plain, Types.Array(Types::String) |
| 60 | 60 | attribute :union_items, Types.Array(Types.Instance(UnionItem)) |
| 61 | 61 | |
| 62 | 62 | def self.from_dynamic!(d) |
| 63 | 63 | d = Types::Hash[d] |
| 64 | 64 | new( |
| 65 | + min_only: d.fetch("minOnly"), | |
| 65 | 66 | max_only: d.fetch("maxOnly"), |
| 66 | 67 | min_and_max: d.fetch("minAndMax"), |
| 67 | - min_only: d.fetch("minOnly"), | |
| 68 | 68 | plain: d.fetch("plain"), |
| 69 | 69 | union_items: d.fetch("unionItems").map { |x| UnionItem.from_dynamic!(x) }, |
| 70 | 70 | ) |
| @@ -76,9 +76,9 @@ class TopLevel < Dry::Struct | ||
| 76 | 76 | |
| 77 | 77 | def to_dynamic |
| 78 | 78 | { |
| 79 | + "minOnly" => min_only, | |
| 79 | 80 | "maxOnly" => max_only, |
| 80 | 81 | "minAndMax" => min_and_max, |
| 81 | - "minOnly" => min_only, | |
| 82 | 82 | "plain" => plain, |
| 83 | 83 | "unionItems" => union_items.map { |x| x.to_dynamic }, |
| 84 | 84 | } |
Mschema-rustdefault / module_under_test.rs+2 −2
| @@ -16,12 +16,12 @@ use serde::{Serialize, Deserialize}; | ||
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | #[serde(rename_all = "camelCase")] |
| 18 | 18 | pub struct TopLevel { |
| 19 | + pub min_only: Vec<String>, | |
| 20 | + | |
| 19 | 21 | pub max_only: Vec<i64>, |
| 20 | 22 | |
| 21 | 23 | pub min_and_max: Vec<f64>, |
| 22 | 24 | |
| 23 | - pub min_only: Vec<String>, | |
| 24 | - | |
| 25 | 25 | pub plain: Vec<String>, |
| 26 | 26 | |
| 27 | 27 | pub union_items: Vec<UnionItem>, |
Mschema-scala3-upickledefault / TopLevel.scala+1 −1
| @@ -66,9 +66,9 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | + val minOnly : Seq[String], | |
| 69 | 70 | val maxOnly : Seq[Long], |
| 70 | 71 | val minAndMax : Seq[Double], |
| 71 | - val minOnly : Seq[String], | |
| 72 | 72 | val plain : Seq[String], |
| 73 | 73 | val unionItems : Seq[UnionItem] |
| 74 | 74 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+1 −1
| @@ -8,9 +8,9 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | + val minOnly : Seq[String], | |
| 11 | 12 | val maxOnly : Seq[Long], |
| 12 | 13 | val minAndMax : Seq[Double], |
| 13 | - val minOnly : Seq[String], | |
| 14 | 14 | val plain : Seq[String], |
| 15 | 15 | val unionItems : Seq[UnionItem] |
| 16 | 16 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+7 −7
| @@ -6,6 +6,13 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": {}, |
| 8 | 8 | "properties": { |
| 9 | + "minOnly": { | |
| 10 | + "type": "array", | |
| 11 | + "items": { | |
| 12 | + "type": "string" | |
| 13 | + }, | |
| 14 | + "minItems": 2 | |
| 15 | + }, | |
| 9 | 16 | "maxOnly": { |
| 10 | 17 | "type": "array", |
| 11 | 18 | "items": { |
| @@ -21,13 +28,6 @@ | ||
| 21 | 28 | "minItems": 1, |
| 22 | 29 | "maxItems": 4 |
| 23 | 30 | }, |
| 24 | - "minOnly": { | |
| 25 | - "type": "array", | |
| 26 | - "items": { | |
| 27 | - "type": "string" | |
| 28 | - }, | |
| 29 | - "minItems": 2 | |
| 30 | - }, | |
| 31 | 31 | "plain": { |
| 32 | 32 | "type": "array", |
| 33 | 33 | "items": { |
Mschema-swiftdefault / quicktype.swift+4 −4
| @@ -7,16 +7,16 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | + let minOnly: [String] | |
| 10 | 11 | let maxOnly: [Int] |
| 11 | 12 | let minAndMax: [Double] |
| 12 | - let minOnly: [String] | |
| 13 | 13 | let plain: [String] |
| 14 | 14 | let unionItems: [UnionItem] |
| 15 | 15 | |
| 16 | 16 | enum CodingKeys: String, CodingKey { |
| 17 | + case minOnly = "minOnly" | |
| 17 | 18 | case maxOnly = "maxOnly" |
| 18 | 19 | case minAndMax = "minAndMax" |
| 19 | - case minOnly = "minOnly" | |
| 20 | 20 | case plain = "plain" |
| 21 | 21 | case unionItems = "unionItems" |
| 22 | 22 | } |
| @@ -41,16 +41,16 @@ extension TopLevel { | ||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | func with( |
| 44 | + minOnly: [String]? = nil, | |
| 44 | 45 | maxOnly: [Int]? = nil, |
| 45 | 46 | minAndMax: [Double]? = nil, |
| 46 | - minOnly: [String]? = nil, | |
| 47 | 47 | plain: [String]? = nil, |
| 48 | 48 | unionItems: [UnionItem]? = nil |
| 49 | 49 | ) -> TopLevel { |
| 50 | 50 | return TopLevel( |
| 51 | + minOnly: minOnly ?? self.minOnly, | |
| 51 | 52 | maxOnly: maxOnly ?? self.maxOnly, |
| 52 | 53 | minAndMax: minAndMax ?? self.minAndMax, |
| 53 | - minOnly: minOnly ?? self.minOnly, | |
| 54 | 54 | plain: plain ?? self.plain, |
| 55 | 55 | unionItems: unionItems ?? self.unionItems |
| 56 | 56 | ) |
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,9 +2,9 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | + "minOnly": z.array(z.string()).min(2), | |
| 5 | 6 | "maxOnly": z.array(z.number()).max(3), |
| 6 | 7 | "minAndMax": z.array(z.number()).min(1).max(4), |
| 7 | - "minOnly": z.array(z.string()).min(2), | |
| 8 | 8 | "plain": z.array(z.string()), |
| 9 | 9 | "unionItems": z.array(z.union([z.number(), z.string()])).min(2), |
| 10 | 10 | }); |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -8,9 +8,9 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | + minOnly: [string, string, ...string[]]; | |
| 11 | 12 | maxOnly: number[]; |
| 12 | 13 | minAndMax: [number, ...number[]]; |
| 13 | - minOnly: [string, string, ...string[]]; | |
| 14 | 14 | plain: string[]; |
| 15 | 15 | unionItems: [UnionItem, UnionItem, ...UnionItem[]]; |
| 16 | 16 | [property: string]: unknown; |
| @@ -185,9 +185,9 @@ function r(name: string) { | ||
| 185 | 185 | |
| 186 | 186 | const typeMap: any = { |
| 187 | 187 | "TopLevel": o([ |
| 188 | + { json: "minOnly", js: "minOnly", typ: a("") }, | |
| 188 | 189 | { json: "maxOnly", js: "maxOnly", typ: a(0) }, |
| 189 | 190 | { json: "minAndMax", js: "minAndMax", typ: a(3.14) }, |
| 190 | - { json: "minOnly", js: "minOnly", typ: a("") }, | |
| 191 | 191 | { json: "plain", js: "plain", typ: a("") }, |
| 192 | 192 | { json: "unionItems", js: "unionItems", typ: a(u(0, "")) }, |
| 193 | 193 | ], "any"), |
Test case
31 generated files · +422 −422test/inputs/schema/minmax-integer.schema
Mschema-cjsondefault / TopLevel.c+13 −13
| @@ -25,26 +25,26 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 25 | 25 | if (cJSON_HasObjectItem(j, "free")) { |
| 26 | 26 | x->free = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "free")); |
| 27 | 27 | } |
| 28 | - if (cJSON_HasObjectItem(j, "intersection")) { | |
| 29 | - x->intersection = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "intersection")); | |
| 28 | + if (cJSON_HasObjectItem(j, "min")) { | |
| 29 | + x->min = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "min")); | |
| 30 | 30 | } |
| 31 | 31 | if (cJSON_HasObjectItem(j, "max")) { |
| 32 | 32 | x->max = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "max")); |
| 33 | 33 | } |
| 34 | - if (cJSON_HasObjectItem(j, "min")) { | |
| 35 | - x->min = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "min")); | |
| 36 | - } | |
| 37 | 34 | if (cJSON_HasObjectItem(j, "minmax")) { |
| 38 | 35 | x->minmax = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "minmax")); |
| 39 | 36 | } |
| 40 | - if (cJSON_HasObjectItem(j, "minMaxIntersection")) { | |
| 41 | - x->min_max_intersection = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "minMaxIntersection")); | |
| 37 | + if (cJSON_HasObjectItem(j, "union")) { | |
| 38 | + x->top_level_union = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "union")); | |
| 42 | 39 | } |
| 43 | 40 | if (cJSON_HasObjectItem(j, "minMaxUnion")) { |
| 44 | 41 | x->min_max_union = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "minMaxUnion")); |
| 45 | 42 | } |
| 46 | - if (cJSON_HasObjectItem(j, "union")) { | |
| 47 | - x->top_level_union = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "union")); | |
| 43 | + if (cJSON_HasObjectItem(j, "intersection")) { | |
| 44 | + x->intersection = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "intersection")); | |
| 45 | + } | |
| 46 | + if (cJSON_HasObjectItem(j, "minMaxIntersection")) { | |
| 47 | + x->min_max_intersection = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "minMaxIntersection")); | |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | } |
| @@ -56,13 +56,13 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 56 | 56 | if (NULL != x) { |
| 57 | 57 | if (NULL != (j = cJSON_CreateObject())) { |
| 58 | 58 | cJSON_AddNumberToObject(j, "free", x->free); |
| 59 | - cJSON_AddNumberToObject(j, "intersection", x->intersection); | |
| 60 | - cJSON_AddNumberToObject(j, "max", x->max); | |
| 61 | 59 | cJSON_AddNumberToObject(j, "min", x->min); |
| 60 | + cJSON_AddNumberToObject(j, "max", x->max); | |
| 62 | 61 | cJSON_AddNumberToObject(j, "minmax", x->minmax); |
| 63 | - cJSON_AddNumberToObject(j, "minMaxIntersection", x->min_max_intersection); | |
| 64 | - cJSON_AddNumberToObject(j, "minMaxUnion", x->min_max_union); | |
| 65 | 62 | cJSON_AddNumberToObject(j, "union", x->top_level_union); |
| 63 | + cJSON_AddNumberToObject(j, "minMaxUnion", x->min_max_union); | |
| 64 | + cJSON_AddNumberToObject(j, "intersection", x->intersection); | |
| 65 | + cJSON_AddNumberToObject(j, "minMaxIntersection", x->min_max_intersection); | |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | return j; |
Mschema-cjsondefault / TopLevel.h+4 −4
| @@ -36,13 +36,13 @@ extern "C" { | ||
| 36 | 36 | |
| 37 | 37 | struct TopLevel { |
| 38 | 38 | int64_t free; |
| 39 | - int64_t intersection; | |
| 40 | - int64_t max; | |
| 41 | 39 | int64_t min; |
| 40 | + int64_t max; | |
| 42 | 41 | int64_t minmax; |
| 43 | - int64_t min_max_intersection; | |
| 44 | - int64_t min_max_union; | |
| 45 | 42 | int64_t top_level_union; |
| 43 | + int64_t min_max_union; | |
| 44 | + int64_t intersection; | |
| 45 | + int64_t min_max_intersection; | |
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | 48 | struct TopLevel * cJSON_ParseTopLevel(const char * s); |
Mschema-cplusplusdefault / quicktype.hpp+32 −32
| @@ -165,63 +165,63 @@ namespace quicktype { | ||
| 165 | 165 | class TopLevel { |
| 166 | 166 | public: |
| 167 | 167 | TopLevel() : |
| 168 | - intersection_constraint(4, 5, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 169 | - max_constraint(std::nullopt, 5, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 170 | 168 | min_constraint(3, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), |
| 169 | + max_constraint(std::nullopt, 5, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 171 | 170 | minmax_constraint(3, 5, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), |
| 172 | - min_max_intersection_constraint(3, 5, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 173 | - union_constraint(3, 6, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt) | |
| 171 | + union_constraint(3, 6, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 172 | + intersection_constraint(4, 5, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 173 | + min_max_intersection_constraint(3, 5, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt) | |
| 174 | 174 | {} |
| 175 | 175 | virtual ~TopLevel() = default; |
| 176 | 176 | |
| 177 | 177 | private: |
| 178 | 178 | int64_t free; |
| 179 | - int64_t intersection; | |
| 180 | - ClassMemberConstraints intersection_constraint; | |
| 181 | - int64_t max; | |
| 182 | - ClassMemberConstraints max_constraint; | |
| 183 | 179 | int64_t min; |
| 184 | 180 | ClassMemberConstraints min_constraint; |
| 181 | + int64_t max; | |
| 182 | + ClassMemberConstraints max_constraint; | |
| 185 | 183 | int64_t minmax; |
| 186 | 184 | ClassMemberConstraints minmax_constraint; |
| 187 | - int64_t min_max_intersection; | |
| 188 | - ClassMemberConstraints min_max_intersection_constraint; | |
| 189 | - int64_t min_max_union; | |
| 190 | 185 | int64_t top_level_union; |
| 191 | 186 | ClassMemberConstraints union_constraint; |
| 187 | + int64_t min_max_union; | |
| 188 | + int64_t intersection; | |
| 189 | + ClassMemberConstraints intersection_constraint; | |
| 190 | + int64_t min_max_intersection; | |
| 191 | + ClassMemberConstraints min_max_intersection_constraint; | |
| 192 | 192 | |
| 193 | 193 | public: |
| 194 | 194 | const int64_t & get_free() const { return free; } |
| 195 | 195 | int64_t & get_mutable_free() { return free; } |
| 196 | 196 | void set_free(const int64_t & value) { this->free = value; } |
| 197 | 197 | |
| 198 | - const int64_t & get_intersection() const { return intersection; } | |
| 199 | - int64_t & get_mutable_intersection() { return intersection; } | |
| 200 | - void set_intersection(const int64_t & value) { CheckConstraint("intersection", intersection_constraint, value); this->intersection = value; } | |
| 198 | + const int64_t & get_min() const { return min; } | |
| 199 | + int64_t & get_mutable_min() { return min; } | |
| 200 | + void set_min(const int64_t & value) { CheckConstraint("min", min_constraint, value); this->min = value; } | |
| 201 | 201 | |
| 202 | 202 | const int64_t & get_max() const { return max; } |
| 203 | 203 | int64_t & get_mutable_max() { return max; } |
| 204 | 204 | void set_max(const int64_t & value) { CheckConstraint("max", max_constraint, value); this->max = value; } |
| 205 | 205 | |
| 206 | - const int64_t & get_min() const { return min; } | |
| 207 | - int64_t & get_mutable_min() { return min; } | |
| 208 | - void set_min(const int64_t & value) { CheckConstraint("min", min_constraint, value); this->min = value; } | |
| 209 | - | |
| 210 | 206 | const int64_t & get_minmax() const { return minmax; } |
| 211 | 207 | int64_t & get_mutable_minmax() { return minmax; } |
| 212 | 208 | void set_minmax(const int64_t & value) { CheckConstraint("minmax", minmax_constraint, value); this->minmax = value; } |
| 213 | 209 | |
| 214 | - const int64_t & get_min_max_intersection() const { return min_max_intersection; } | |
| 215 | - int64_t & get_mutable_min_max_intersection() { return min_max_intersection; } | |
| 216 | - void set_min_max_intersection(const int64_t & value) { CheckConstraint("min_max_intersection", min_max_intersection_constraint, value); this->min_max_intersection = value; } | |
| 210 | + const int64_t & get_top_level_union() const { return top_level_union; } | |
| 211 | + int64_t & get_mutable_top_level_union() { return top_level_union; } | |
| 212 | + void set_top_level_union(const int64_t & value) { CheckConstraint("top_level_union", union_constraint, value); this->top_level_union = value; } | |
| 217 | 213 | |
| 218 | 214 | const int64_t & get_min_max_union() const { return min_max_union; } |
| 219 | 215 | int64_t & get_mutable_min_max_union() { return min_max_union; } |
| 220 | 216 | void set_min_max_union(const int64_t & value) { this->min_max_union = value; } |
| 221 | 217 | |
| 222 | - const int64_t & get_top_level_union() const { return top_level_union; } | |
| 223 | - int64_t & get_mutable_top_level_union() { return top_level_union; } | |
| 224 | - void set_top_level_union(const int64_t & value) { CheckConstraint("top_level_union", union_constraint, value); this->top_level_union = value; } | |
| 218 | + const int64_t & get_intersection() const { return intersection; } | |
| 219 | + int64_t & get_mutable_intersection() { return intersection; } | |
| 220 | + void set_intersection(const int64_t & value) { CheckConstraint("intersection", intersection_constraint, value); this->intersection = value; } | |
| 221 | + | |
| 222 | + const int64_t & get_min_max_intersection() const { return min_max_intersection; } | |
| 223 | + int64_t & get_mutable_min_max_intersection() { return min_max_intersection; } | |
| 224 | + void set_min_max_intersection(const int64_t & value) { CheckConstraint("min_max_intersection", min_max_intersection_constraint, value); this->min_max_intersection = value; } | |
| 225 | 225 | }; |
| 226 | 226 | } |
| 227 | 227 | |
| @@ -231,24 +231,24 @@ namespace quicktype { | ||
| 231 | 231 | |
| 232 | 232 | inline void from_json(const json & j, TopLevel& x) { |
| 233 | 233 | x.set_free(j.at("free").get<int64_t>()); |
| 234 | - x.set_intersection(j.at("intersection").get<int64_t>()); | |
| 235 | - x.set_max(j.at("max").get<int64_t>()); | |
| 236 | 234 | x.set_min(j.at("min").get<int64_t>()); |
| 235 | + x.set_max(j.at("max").get<int64_t>()); | |
| 237 | 236 | x.set_minmax(j.at("minmax").get<int64_t>()); |
| 238 | - x.set_min_max_intersection(j.at("minMaxIntersection").get<int64_t>()); | |
| 239 | - x.set_min_max_union(j.at("minMaxUnion").get<int64_t>()); | |
| 240 | 237 | x.set_top_level_union(j.at("union").get<int64_t>()); |
| 238 | + x.set_min_max_union(j.at("minMaxUnion").get<int64_t>()); | |
| 239 | + x.set_intersection(j.at("intersection").get<int64_t>()); | |
| 240 | + x.set_min_max_intersection(j.at("minMaxIntersection").get<int64_t>()); | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | inline void to_json(json & j, const TopLevel & x) { |
| 244 | 244 | j = json::object(); |
| 245 | 245 | j["free"] = x.get_free(); |
| 246 | - j["intersection"] = x.get_intersection(); | |
| 247 | - j["max"] = x.get_max(); | |
| 248 | 246 | j["min"] = x.get_min(); |
| 247 | + j["max"] = x.get_max(); | |
| 249 | 248 | j["minmax"] = x.get_minmax(); |
| 250 | - j["minMaxIntersection"] = x.get_min_max_intersection(); | |
| 251 | - j["minMaxUnion"] = x.get_min_max_union(); | |
| 252 | 249 | j["union"] = x.get_top_level_union(); |
| 250 | + j["minMaxUnion"] = x.get_min_max_union(); | |
| 251 | + j["intersection"] = x.get_intersection(); | |
| 252 | + j["minMaxIntersection"] = x.get_min_max_intersection(); | |
| 253 | 253 | } |
| 254 | 254 | } |
Mschema-csharp-recordsdefault / QuickType.cs+9 −9
| @@ -28,26 +28,26 @@ namespace QuickType | ||
| 28 | 28 | [JsonProperty("free", Required = Required.Always)] |
| 29 | 29 | public long Free { get; set; } |
| 30 | 30 | |
| 31 | - [JsonProperty("intersection", Required = Required.Always)] | |
| 32 | - public long Intersection { get; set; } | |
| 31 | + [JsonProperty("min", Required = Required.Always)] | |
| 32 | + public long Min { get; set; } | |
| 33 | 33 | |
| 34 | 34 | [JsonProperty("max", Required = Required.Always)] |
| 35 | 35 | public long Max { get; set; } |
| 36 | 36 | |
| 37 | - [JsonProperty("min", Required = Required.Always)] | |
| 38 | - public long Min { get; set; } | |
| 39 | - | |
| 40 | 37 | [JsonProperty("minmax", Required = Required.Always)] |
| 41 | 38 | public long Minmax { get; set; } |
| 42 | 39 | |
| 43 | - [JsonProperty("minMaxIntersection", Required = Required.Always)] | |
| 44 | - public long MinMaxIntersection { get; set; } | |
| 40 | + [JsonProperty("union", Required = Required.Always)] | |
| 41 | + public long Union { get; set; } | |
| 45 | 42 | |
| 46 | 43 | [JsonProperty("minMaxUnion", Required = Required.Always)] |
| 47 | 44 | public long MinMaxUnion { get; set; } |
| 48 | 45 | |
| 49 | - [JsonProperty("union", Required = Required.Always)] | |
| 50 | - public long Union { get; set; } | |
| 46 | + [JsonProperty("intersection", Required = Required.Always)] | |
| 47 | + public long Intersection { get; set; } | |
| 48 | + | |
| 49 | + [JsonProperty("minMaxIntersection", Required = Required.Always)] | |
| 50 | + public long MinMaxIntersection { get; set; } | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public partial record TopLevel |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+10 −10
| @@ -27,32 +27,32 @@ namespace QuickType | ||
| 27 | 27 | public long Free { get; set; } |
| 28 | 28 | |
| 29 | 29 | [JsonRequired] |
| 30 | - [JsonPropertyName("intersection")] | |
| 31 | - public long Intersection { get; set; } | |
| 30 | + [JsonPropertyName("min")] | |
| 31 | + public long Min { get; set; } | |
| 32 | 32 | |
| 33 | 33 | [JsonRequired] |
| 34 | 34 | [JsonPropertyName("max")] |
| 35 | 35 | public long Max { get; set; } |
| 36 | 36 | |
| 37 | - [JsonRequired] | |
| 38 | - [JsonPropertyName("min")] | |
| 39 | - public long Min { get; set; } | |
| 40 | - | |
| 41 | 37 | [JsonRequired] |
| 42 | 38 | [JsonPropertyName("minmax")] |
| 43 | 39 | public long Minmax { get; set; } |
| 44 | 40 | |
| 45 | 41 | [JsonRequired] |
| 46 | - [JsonPropertyName("minMaxIntersection")] | |
| 47 | - public long MinMaxIntersection { get; set; } | |
| 42 | + [JsonPropertyName("union")] | |
| 43 | + public long Union { get; set; } | |
| 48 | 44 | |
| 49 | 45 | [JsonRequired] |
| 50 | 46 | [JsonPropertyName("minMaxUnion")] |
| 51 | 47 | public long MinMaxUnion { get; set; } |
| 52 | 48 | |
| 53 | 49 | [JsonRequired] |
| 54 | - [JsonPropertyName("union")] | |
| 55 | - public long Union { get; set; } | |
| 50 | + [JsonPropertyName("intersection")] | |
| 51 | + public long Intersection { get; set; } | |
| 52 | + | |
| 53 | + [JsonRequired] | |
| 54 | + [JsonPropertyName("minMaxIntersection")] | |
| 55 | + public long MinMaxIntersection { get; set; } | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public partial class TopLevel |
Mschema-csharpdefault / QuickType.cs+9 −9
| @@ -28,26 +28,26 @@ namespace QuickType | ||
| 28 | 28 | [JsonProperty("free", Required = Required.Always)] |
| 29 | 29 | public long Free { get; set; } |
| 30 | 30 | |
| 31 | - [JsonProperty("intersection", Required = Required.Always)] | |
| 32 | - public long Intersection { get; set; } | |
| 31 | + [JsonProperty("min", Required = Required.Always)] | |
| 32 | + public long Min { get; set; } | |
| 33 | 33 | |
| 34 | 34 | [JsonProperty("max", Required = Required.Always)] |
| 35 | 35 | public long Max { get; set; } |
| 36 | 36 | |
| 37 | - [JsonProperty("min", Required = Required.Always)] | |
| 38 | - public long Min { get; set; } | |
| 39 | - | |
| 40 | 37 | [JsonProperty("minmax", Required = Required.Always)] |
| 41 | 38 | public long Minmax { get; set; } |
| 42 | 39 | |
| 43 | - [JsonProperty("minMaxIntersection", Required = Required.Always)] | |
| 44 | - public long MinMaxIntersection { get; set; } | |
| 40 | + [JsonProperty("union", Required = Required.Always)] | |
| 41 | + public long Union { get; set; } | |
| 45 | 42 | |
| 46 | 43 | [JsonProperty("minMaxUnion", Required = Required.Always)] |
| 47 | 44 | public long MinMaxUnion { get; set; } |
| 48 | 45 | |
| 49 | - [JsonProperty("union", Required = Required.Always)] | |
| 50 | - public long Union { get; set; } | |
| 46 | + [JsonProperty("intersection", Required = Required.Always)] | |
| 47 | + public long Intersection { get; set; } | |
| 48 | + | |
| 49 | + [JsonProperty("minMaxIntersection", Required = Required.Always)] | |
| 50 | + public long MinMaxIntersection { get; set; } | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public partial class TopLevel |
Mschema-dartdefault / TopLevel.dart+16 −16
| @@ -10,44 +10,44 @@ String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | ||
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | 12 | final int free; |
| 13 | - final int intersection; | |
| 14 | - final int max; | |
| 15 | 13 | final int min; |
| 14 | + final int max; | |
| 16 | 15 | final int minmax; |
| 17 | - final int minMaxIntersection; | |
| 18 | - final int minMaxUnion; | |
| 19 | 16 | final int union; |
| 17 | + final int minMaxUnion; | |
| 18 | + final int intersection; | |
| 19 | + final int minMaxIntersection; | |
| 20 | 20 | |
| 21 | 21 | TopLevel({ |
| 22 | 22 | required this.free, |
| 23 | - required this.intersection, | |
| 24 | - required this.max, | |
| 25 | 23 | required this.min, |
| 24 | + required this.max, | |
| 26 | 25 | required this.minmax, |
| 27 | - required this.minMaxIntersection, | |
| 28 | - required this.minMaxUnion, | |
| 29 | 26 | required this.union, |
| 27 | + required this.minMaxUnion, | |
| 28 | + required this.intersection, | |
| 29 | + required this.minMaxIntersection, | |
| 30 | 30 | }); |
| 31 | 31 | |
| 32 | 32 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 33 | 33 | free: json["free"], |
| 34 | - intersection: json["intersection"], | |
| 35 | - max: json["max"], | |
| 36 | 34 | min: json["min"], |
| 35 | + max: json["max"], | |
| 37 | 36 | minmax: json["minmax"], |
| 38 | - minMaxIntersection: json["minMaxIntersection"], | |
| 39 | - minMaxUnion: json["minMaxUnion"], | |
| 40 | 37 | union: json["union"], |
| 38 | + minMaxUnion: json["minMaxUnion"], | |
| 39 | + intersection: json["intersection"], | |
| 40 | + minMaxIntersection: json["minMaxIntersection"], | |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | Map<String, dynamic> toJson() => { |
| 44 | 44 | "free": free, |
| 45 | - "intersection": intersection, | |
| 46 | - "max": max, | |
| 47 | 45 | "min": min, |
| 46 | + "max": max, | |
| 48 | 47 | "minmax": minmax, |
| 49 | - "minMaxIntersection": minMaxIntersection, | |
| 50 | - "minMaxUnion": minMaxUnion, | |
| 51 | 48 | "union": union, |
| 49 | + "minMaxUnion": minMaxUnion, | |
| 50 | + "intersection": intersection, | |
| 51 | + "minMaxIntersection": minMaxIntersection, | |
| 52 | 52 | }; |
| 53 | 53 | } |
Mschema-elixirdefault / QuickType.ex+14 −14
| @@ -6,30 +6,30 @@ | ||
| 6 | 6 | # Encode into a JSON string: TopLevel.to_json(struct) |
| 7 | 7 | |
| 8 | 8 | defmodule TopLevel do |
| 9 | - @enforce_keys [:free, :intersection, :max, :min, :minmax, :min_max_intersection, :min_max_union, :union] | |
| 10 | - defstruct [:free, :intersection, :max, :min, :minmax, :min_max_intersection, :min_max_union, :union] | |
| 9 | + @enforce_keys [:free, :min, :max, :minmax, :union, :min_max_union, :intersection, :min_max_intersection] | |
| 10 | + defstruct [:free, :min, :max, :minmax, :union, :min_max_union, :intersection, :min_max_intersection] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | 13 | free: integer(), |
| 14 | - intersection: integer(), | |
| 15 | - max: integer(), | |
| 16 | 14 | min: integer(), |
| 15 | + max: integer(), | |
| 17 | 16 | minmax: integer(), |
| 18 | - min_max_intersection: integer(), | |
| 17 | + union: integer(), | |
| 19 | 18 | min_max_union: integer(), |
| 20 | - union: integer() | |
| 19 | + intersection: integer(), | |
| 20 | + min_max_intersection: integer() | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | def from_map(m) do |
| 24 | 24 | %TopLevel{ |
| 25 | 25 | free: m["free"], |
| 26 | - intersection: m["intersection"], | |
| 27 | - max: m["max"], | |
| 28 | 26 | min: m["min"], |
| 27 | + max: m["max"], | |
| 29 | 28 | minmax: m["minmax"], |
| 30 | - min_max_intersection: m["minMaxIntersection"], | |
| 31 | - min_max_union: m["minMaxUnion"], | |
| 32 | 29 | union: m["union"], |
| 30 | + min_max_union: m["minMaxUnion"], | |
| 31 | + intersection: m["intersection"], | |
| 32 | + min_max_intersection: m["minMaxIntersection"], | |
| 33 | 33 | } |
| 34 | 34 | end |
| 35 | 35 | |
| @@ -42,13 +42,13 @@ defmodule TopLevel do | ||
| 42 | 42 | def to_map(struct) do |
| 43 | 43 | %{ |
| 44 | 44 | "free" => struct.free, |
| 45 | - "intersection" => struct.intersection, | |
| 46 | - "max" => struct.max, | |
| 47 | 45 | "min" => struct.min, |
| 46 | + "max" => struct.max, | |
| 48 | 47 | "minmax" => struct.minmax, |
| 49 | - "minMaxIntersection" => struct.min_max_intersection, | |
| 50 | - "minMaxUnion" => struct.min_max_union, | |
| 51 | 48 | "union" => struct.union, |
| 49 | + "minMaxUnion" => struct.min_max_union, | |
| 50 | + "intersection" => struct.intersection, | |
| 51 | + "minMaxIntersection" => struct.min_max_intersection, | |
| 52 | 52 | } |
| 53 | 53 | end |
Mschema-elmdefault / QuickType.elm+12 −12
| @@ -24,13 +24,13 @@ import Dict exposing (Dict) | ||
| 24 | 24 | |
| 25 | 25 | type alias QuickType = |
| 26 | 26 | { free : Int |
| 27 | - , intersection : Int | |
| 28 | - , max : Int | |
| 29 | 27 | , min : Int |
| 28 | + , max : Int | |
| 30 | 29 | , minmax : Int |
| 31 | - , minMaxIntersection : Int | |
| 32 | - , minMaxUnion : Int | |
| 33 | 30 | , union : Int |
| 31 | + , minMaxUnion : Int | |
| 32 | + , intersection : Int | |
| 33 | + , minMaxIntersection : Int | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | -- decoders and encoders |
| @@ -42,25 +42,25 @@ quickType : Jdec.Decoder QuickType | ||
| 42 | 42 | quickType = |
| 43 | 43 | Jdec.succeed QuickType |
| 44 | 44 | |> Jpipe.required "free" Jdec.int |
| 45 | - |> Jpipe.required "intersection" Jdec.int | |
| 46 | - |> Jpipe.required "max" Jdec.int | |
| 47 | 45 | |> Jpipe.required "min" Jdec.int |
| 46 | + |> Jpipe.required "max" Jdec.int | |
| 48 | 47 | |> Jpipe.required "minmax" Jdec.int |
| 49 | - |> Jpipe.required "minMaxIntersection" Jdec.int | |
| 50 | - |> Jpipe.required "minMaxUnion" Jdec.int | |
| 51 | 48 | |> Jpipe.required "union" Jdec.int |
| 49 | + |> Jpipe.required "minMaxUnion" Jdec.int | |
| 50 | + |> Jpipe.required "intersection" Jdec.int | |
| 51 | + |> Jpipe.required "minMaxIntersection" Jdec.int | |
| 52 | 52 | |
| 53 | 53 | encodeQuickType : QuickType -> Jenc.Value |
| 54 | 54 | encodeQuickType x = |
| 55 | 55 | Jenc.object |
| 56 | 56 | [ ("free", Jenc.int x.free) |
| 57 | - , ("intersection", Jenc.int x.intersection) | |
| 58 | - , ("max", Jenc.int x.max) | |
| 59 | 57 | , ("min", Jenc.int x.min) |
| 58 | + , ("max", Jenc.int x.max) | |
| 60 | 59 | , ("minmax", Jenc.int x.minmax) |
| 61 | - , ("minMaxIntersection", Jenc.int x.minMaxIntersection) | |
| 62 | - , ("minMaxUnion", Jenc.int x.minMaxUnion) | |
| 63 | 60 | , ("union", Jenc.int x.union) |
| 61 | + , ("minMaxUnion", Jenc.int x.minMaxUnion) | |
| 62 | + , ("intersection", Jenc.int x.intersection) | |
| 63 | + , ("minMaxIntersection", Jenc.int x.minMaxIntersection) | |
| 64 | 64 | ] |
| 65 | 65 | |
| 66 | 66 | --- encoder helpers |
Mschema-flowdefault / TopLevel.js+8 −8
| @@ -11,13 +11,13 @@ | ||
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | 13 | free: number; |
| 14 | - intersection: number; | |
| 15 | - max: number; | |
| 16 | 14 | min: number; |
| 15 | + max: number; | |
| 17 | 16 | minmax: number; |
| 18 | - minMaxIntersection: number; | |
| 19 | - minMaxUnion: number; | |
| 20 | 17 | union: number; |
| 18 | + minMaxUnion: number; | |
| 19 | + intersection: number; | |
| 20 | + minMaxIntersection: number; | |
| 21 | 21 | [property: string]: mixed; |
| 22 | 22 | }; |
| 23 | 23 | |
| @@ -187,13 +187,13 @@ function r(name: string) { | ||
| 187 | 187 | const typeMap: any = { |
| 188 | 188 | "TopLevel": o([ |
| 189 | 189 | { json: "free", js: "free", typ: 0 }, |
| 190 | - { json: "intersection", js: "intersection", typ: 0 }, | |
| 191 | - { json: "max", js: "max", typ: 0 }, | |
| 192 | 190 | { json: "min", js: "min", typ: 0 }, |
| 191 | + { json: "max", js: "max", typ: 0 }, | |
| 193 | 192 | { json: "minmax", js: "minmax", typ: 0 }, |
| 194 | - { json: "minMaxIntersection", js: "minMaxIntersection", typ: 0 }, | |
| 195 | - { json: "minMaxUnion", js: "minMaxUnion", typ: 0 }, | |
| 196 | 193 | { json: "union", js: "union", typ: 0 }, |
| 194 | + { json: "minMaxUnion", js: "minMaxUnion", typ: 0 }, | |
| 195 | + { json: "intersection", js: "intersection", typ: 0 }, | |
| 196 | + { json: "minMaxIntersection", js: "minMaxIntersection", typ: 0 }, | |
| 197 | 197 | ], "any"), |
| 198 | 198 | }; |
Mschema-golangdefault / quicktype.go+4 −4
| @@ -20,11 +20,11 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 20 | 20 | |
| 21 | 21 | type TopLevel struct { |
| 22 | 22 | Free int64 `json:"free"` |
| 23 | - Intersection int64 `json:"intersection"` | |
| 24 | - Max int64 `json:"max"` | |
| 25 | 23 | Min int64 `json:"min"` |
| 24 | + Max int64 `json:"max"` | |
| 26 | 25 | Minmax int64 `json:"minmax"` |
| 27 | - MinMaxIntersection int64 `json:"minMaxIntersection"` | |
| 28 | - MinMaxUnion int64 `json:"minMaxUnion"` | |
| 29 | 26 | Union int64 `json:"union"` |
| 27 | + MinMaxUnion int64 `json:"minMaxUnion"` | |
| 28 | + Intersection int64 `json:"intersection"` | |
| 29 | + MinMaxIntersection int64 `json:"minMaxIntersection"` | |
| 30 | 30 | } |
Mschema-haskelldefault / QuickType.hs+13 −13
| @@ -14,38 +14,38 @@ import Data.Text (Text) | ||
| 14 | 14 | |
| 15 | 15 | data QuickType = QuickType |
| 16 | 16 | { freeQuickType :: Int |
| 17 | - , intersectionQuickType :: Int | |
| 18 | - , maxQuickType :: Int | |
| 19 | 17 | , minQuickType :: Int |
| 18 | + , maxQuickType :: Int | |
| 20 | 19 | , minmaxQuickType :: Int |
| 21 | - , minMaxIntersectionQuickType :: Int | |
| 22 | - , minMaxUnionQuickType :: Int | |
| 23 | 20 | , unionQuickType :: Int |
| 21 | + , minMaxUnionQuickType :: Int | |
| 22 | + , intersectionQuickType :: Int | |
| 23 | + , minMaxIntersectionQuickType :: Int | |
| 24 | 24 | } deriving (Show) |
| 25 | 25 | |
| 26 | 26 | decodeTopLevel :: ByteString -> Maybe QuickType |
| 27 | 27 | decodeTopLevel = decode |
| 28 | 28 | |
| 29 | 29 | instance ToJSON QuickType where |
| 30 | - toJSON (QuickType freeQuickType intersectionQuickType maxQuickType minQuickType minmaxQuickType minMaxIntersectionQuickType minMaxUnionQuickType unionQuickType) = | |
| 30 | + toJSON (QuickType freeQuickType minQuickType maxQuickType minmaxQuickType unionQuickType minMaxUnionQuickType intersectionQuickType minMaxIntersectionQuickType) = | |
| 31 | 31 | object |
| 32 | 32 | [ "free" .= freeQuickType |
| 33 | - , "intersection" .= intersectionQuickType | |
| 34 | - , "max" .= maxQuickType | |
| 35 | 33 | , "min" .= minQuickType |
| 34 | + , "max" .= maxQuickType | |
| 36 | 35 | , "minmax" .= minmaxQuickType |
| 37 | - , "minMaxIntersection" .= minMaxIntersectionQuickType | |
| 38 | - , "minMaxUnion" .= minMaxUnionQuickType | |
| 39 | 36 | , "union" .= unionQuickType |
| 37 | + , "minMaxUnion" .= minMaxUnionQuickType | |
| 38 | + , "intersection" .= intersectionQuickType | |
| 39 | + , "minMaxIntersection" .= minMaxIntersectionQuickType | |
| 40 | 40 | ] |
| 41 | 41 | |
| 42 | 42 | instance FromJSON QuickType where |
| 43 | 43 | parseJSON (Object v) = QuickType |
| 44 | 44 | <$> v .: "free" |
| 45 | - <*> v .: "intersection" | |
| 46 | - <*> v .: "max" | |
| 47 | 45 | <*> v .: "min" |
| 46 | + <*> v .: "max" | |
| 48 | 47 | <*> v .: "minmax" |
| 49 | - <*> v .: "minMaxIntersection" | |
| 50 | - <*> v .: "minMaxUnion" | |
| 51 | 48 | <*> v .: "union" |
| 49 | + <*> v .: "minMaxUnion" | |
| 50 | + <*> v .: "intersection" | |
| 51 | + <*> v .: "minMaxIntersection" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+21 −21
| @@ -4,51 +4,51 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | 6 | private long free; |
| 7 | - private long intersection; | |
| 8 | - private long max; | |
| 9 | 7 | private long min; |
| 8 | + private long max; | |
| 10 | 9 | private long minmax; |
| 11 | - private long minMaxIntersection; | |
| 12 | - private long minMaxUnion; | |
| 13 | 10 | private long union; |
| 11 | + private long minMaxUnion; | |
| 12 | + private long intersection; | |
| 13 | + private long minMaxIntersection; | |
| 14 | 14 | |
| 15 | 15 | @JsonProperty("free") |
| 16 | 16 | public long getFree() { return free; } |
| 17 | 17 | @JsonProperty("free") |
| 18 | 18 | public void setFree(long value) { this.free = value; } |
| 19 | 19 | |
| 20 | - @JsonProperty("intersection") | |
| 21 | - public long getIntersection() { return intersection; } | |
| 22 | - @JsonProperty("intersection") | |
| 23 | - public void setIntersection(long value) { this.intersection = value; } | |
| 20 | + @JsonProperty("min") | |
| 21 | + public long getMin() { return min; } | |
| 22 | + @JsonProperty("min") | |
| 23 | + public void setMin(long value) { this.min = value; } | |
| 24 | 24 | |
| 25 | 25 | @JsonProperty("max") |
| 26 | 26 | public long getMax() { return max; } |
| 27 | 27 | @JsonProperty("max") |
| 28 | 28 | public void setMax(long value) { this.max = value; } |
| 29 | 29 | |
| 30 | - @JsonProperty("min") | |
| 31 | - public long getMin() { return min; } | |
| 32 | - @JsonProperty("min") | |
| 33 | - public void setMin(long value) { this.min = value; } | |
| 34 | - | |
| 35 | 30 | @JsonProperty("minmax") |
| 36 | 31 | public long getMinmax() { return minmax; } |
| 37 | 32 | @JsonProperty("minmax") |
| 38 | 33 | public void setMinmax(long value) { this.minmax = value; } |
| 39 | 34 | |
| 40 | - @JsonProperty("minMaxIntersection") | |
| 41 | - public long getMinMaxIntersection() { return minMaxIntersection; } | |
| 42 | - @JsonProperty("minMaxIntersection") | |
| 43 | - public void setMinMaxIntersection(long value) { this.minMaxIntersection = value; } | |
| 35 | + @JsonProperty("union") | |
| 36 | + public long getUnion() { return union; } | |
| 37 | + @JsonProperty("union") | |
| 38 | + public void setUnion(long value) { this.union = value; } | |
| 44 | 39 | |
| 45 | 40 | @JsonProperty("minMaxUnion") |
| 46 | 41 | public long getMinMaxUnion() { return minMaxUnion; } |
| 47 | 42 | @JsonProperty("minMaxUnion") |
| 48 | 43 | public void setMinMaxUnion(long value) { this.minMaxUnion = value; } |
| 49 | 44 | |
| 50 | - @JsonProperty("union") | |
| 51 | - public long getUnion() { return union; } | |
| 52 | - @JsonProperty("union") | |
| 53 | - public void setUnion(long value) { this.union = value; } | |
| 45 | + @JsonProperty("intersection") | |
| 46 | + public long getIntersection() { return intersection; } | |
| 47 | + @JsonProperty("intersection") | |
| 48 | + public void setIntersection(long value) { this.intersection = value; } | |
| 49 | + | |
| 50 | + @JsonProperty("minMaxIntersection") | |
| 51 | + public long getMinMaxIntersection() { return minMaxIntersection; } | |
| 52 | + @JsonProperty("minMaxIntersection") | |
| 53 | + public void setMinMaxIntersection(long value) { this.minMaxIntersection = value; } | |
| 54 | 54 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+21 −21
| @@ -4,51 +4,51 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | 6 | private long free; |
| 7 | - private long intersection; | |
| 8 | - private long max; | |
| 9 | 7 | private long min; |
| 8 | + private long max; | |
| 10 | 9 | private long minmax; |
| 11 | - private long minMaxIntersection; | |
| 12 | - private long minMaxUnion; | |
| 13 | 10 | private long union; |
| 11 | + private long minMaxUnion; | |
| 12 | + private long intersection; | |
| 13 | + private long minMaxIntersection; | |
| 14 | 14 | |
| 15 | 15 | @JsonProperty("free") |
| 16 | 16 | public long getFree() { return free; } |
| 17 | 17 | @JsonProperty("free") |
| 18 | 18 | public void setFree(long value) { this.free = value; } |
| 19 | 19 | |
| 20 | - @JsonProperty("intersection") | |
| 21 | - public long getIntersection() { return intersection; } | |
| 22 | - @JsonProperty("intersection") | |
| 23 | - public void setIntersection(long value) { this.intersection = value; } | |
| 20 | + @JsonProperty("min") | |
| 21 | + public long getMin() { return min; } | |
| 22 | + @JsonProperty("min") | |
| 23 | + public void setMin(long value) { this.min = value; } | |
| 24 | 24 | |
| 25 | 25 | @JsonProperty("max") |
| 26 | 26 | public long getMax() { return max; } |
| 27 | 27 | @JsonProperty("max") |
| 28 | 28 | public void setMax(long value) { this.max = value; } |
| 29 | 29 | |
| 30 | - @JsonProperty("min") | |
| 31 | - public long getMin() { return min; } | |
| 32 | - @JsonProperty("min") | |
| 33 | - public void setMin(long value) { this.min = value; } | |
| 34 | - | |
| 35 | 30 | @JsonProperty("minmax") |
| 36 | 31 | public long getMinmax() { return minmax; } |
| 37 | 32 | @JsonProperty("minmax") |
| 38 | 33 | public void setMinmax(long value) { this.minmax = value; } |
| 39 | 34 | |
| 40 | - @JsonProperty("minMaxIntersection") | |
| 41 | - public long getMinMaxIntersection() { return minMaxIntersection; } | |
| 42 | - @JsonProperty("minMaxIntersection") | |
| 43 | - public void setMinMaxIntersection(long value) { this.minMaxIntersection = value; } | |
| 35 | + @JsonProperty("union") | |
| 36 | + public long getUnion() { return union; } | |
| 37 | + @JsonProperty("union") | |
| 38 | + public void setUnion(long value) { this.union = value; } | |
| 44 | 39 | |
| 45 | 40 | @JsonProperty("minMaxUnion") |
| 46 | 41 | public long getMinMaxUnion() { return minMaxUnion; } |
| 47 | 42 | @JsonProperty("minMaxUnion") |
| 48 | 43 | public void setMinMaxUnion(long value) { this.minMaxUnion = value; } |
| 49 | 44 | |
| 50 | - @JsonProperty("union") | |
| 51 | - public long getUnion() { return union; } | |
| 52 | - @JsonProperty("union") | |
| 53 | - public void setUnion(long value) { this.union = value; } | |
| 45 | + @JsonProperty("intersection") | |
| 46 | + public long getIntersection() { return intersection; } | |
| 47 | + @JsonProperty("intersection") | |
| 48 | + public void setIntersection(long value) { this.intersection = value; } | |
| 49 | + | |
| 50 | + @JsonProperty("minMaxIntersection") | |
| 51 | + public long getMinMaxIntersection() { return minMaxIntersection; } | |
| 52 | + @JsonProperty("minMaxIntersection") | |
| 53 | + public void setMinMaxIntersection(long value) { this.minMaxIntersection = value; } | |
| 54 | 54 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+21 −21
| @@ -4,51 +4,51 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | 6 | private long free; |
| 7 | - private long intersection; | |
| 8 | - private long max; | |
| 9 | 7 | private long min; |
| 8 | + private long max; | |
| 10 | 9 | private long minmax; |
| 11 | - private long minMaxIntersection; | |
| 12 | - private long minMaxUnion; | |
| 13 | 10 | private long union; |
| 11 | + private long minMaxUnion; | |
| 12 | + private long intersection; | |
| 13 | + private long minMaxIntersection; | |
| 14 | 14 | |
| 15 | 15 | @JsonProperty("free") |
| 16 | 16 | public long getFree() { return free; } |
| 17 | 17 | @JsonProperty("free") |
| 18 | 18 | public void setFree(long value) { this.free = value; } |
| 19 | 19 | |
| 20 | - @JsonProperty("intersection") | |
| 21 | - public long getIntersection() { return intersection; } | |
| 22 | - @JsonProperty("intersection") | |
| 23 | - public void setIntersection(long value) { this.intersection = value; } | |
| 20 | + @JsonProperty("min") | |
| 21 | + public long getMin() { return min; } | |
| 22 | + @JsonProperty("min") | |
| 23 | + public void setMin(long value) { this.min = value; } | |
| 24 | 24 | |
| 25 | 25 | @JsonProperty("max") |
| 26 | 26 | public long getMax() { return max; } |
| 27 | 27 | @JsonProperty("max") |
| 28 | 28 | public void setMax(long value) { this.max = value; } |
| 29 | 29 | |
| 30 | - @JsonProperty("min") | |
| 31 | - public long getMin() { return min; } | |
| 32 | - @JsonProperty("min") | |
| 33 | - public void setMin(long value) { this.min = value; } | |
| 34 | - | |
| 35 | 30 | @JsonProperty("minmax") |
| 36 | 31 | public long getMinmax() { return minmax; } |
| 37 | 32 | @JsonProperty("minmax") |
| 38 | 33 | public void setMinmax(long value) { this.minmax = value; } |
| 39 | 34 | |
| 40 | - @JsonProperty("minMaxIntersection") | |
| 41 | - public long getMinMaxIntersection() { return minMaxIntersection; } | |
| 42 | - @JsonProperty("minMaxIntersection") | |
| 43 | - public void setMinMaxIntersection(long value) { this.minMaxIntersection = value; } | |
| 35 | + @JsonProperty("union") | |
| 36 | + public long getUnion() { return union; } | |
| 37 | + @JsonProperty("union") | |
| 38 | + public void setUnion(long value) { this.union = value; } | |
| 44 | 39 | |
| 45 | 40 | @JsonProperty("minMaxUnion") |
| 46 | 41 | public long getMinMaxUnion() { return minMaxUnion; } |
| 47 | 42 | @JsonProperty("minMaxUnion") |
| 48 | 43 | public void setMinMaxUnion(long value) { this.minMaxUnion = value; } |
| 49 | 44 | |
| 50 | - @JsonProperty("union") | |
| 51 | - public long getUnion() { return union; } | |
| 52 | - @JsonProperty("union") | |
| 53 | - public void setUnion(long value) { this.union = value; } | |
| 45 | + @JsonProperty("intersection") | |
| 46 | + public long getIntersection() { return intersection; } | |
| 47 | + @JsonProperty("intersection") | |
| 48 | + public void setIntersection(long value) { this.intersection = value; } | |
| 49 | + | |
| 50 | + @JsonProperty("minMaxIntersection") | |
| 51 | + public long getMinMaxIntersection() { return minMaxIntersection; } | |
| 52 | + @JsonProperty("minMaxIntersection") | |
| 53 | + public void setMinMaxIntersection(long value) { this.minMaxIntersection = value; } | |
| 54 | 54 | } |
Mschema-javascriptdefault / TopLevel.js+4 −4
| @@ -173,13 +173,13 @@ function r(name) { | ||
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | 175 | { json: "free", js: "free", typ: 0 }, |
| 176 | - { json: "intersection", js: "intersection", typ: 0 }, | |
| 177 | - { json: "max", js: "max", typ: 0 }, | |
| 178 | 176 | { json: "min", js: "min", typ: 0 }, |
| 177 | + { json: "max", js: "max", typ: 0 }, | |
| 179 | 178 | { json: "minmax", js: "minmax", typ: 0 }, |
| 180 | - { json: "minMaxIntersection", js: "minMaxIntersection", typ: 0 }, | |
| 181 | - { json: "minMaxUnion", js: "minMaxUnion", typ: 0 }, | |
| 182 | 179 | { json: "union", js: "union", typ: 0 }, |
| 180 | + { json: "minMaxUnion", js: "minMaxUnion", typ: 0 }, | |
| 181 | + { json: "intersection", js: "intersection", typ: 0 }, | |
| 182 | + { json: "minMaxIntersection", js: "minMaxIntersection", typ: 0 }, | |
| 183 | 183 | ], "any"), |
| 184 | 184 | }; |
Mschema-kotlin-jacksondefault / TopLevel.kt+6 −6
| @@ -23,25 +23,25 @@ data class TopLevel ( | ||
| 23 | 23 | val free: Long, |
| 24 | 24 | |
| 25 | 25 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 26 | - val intersection: Long, | |
| 26 | + val min: Long, | |
| 27 | 27 | |
| 28 | 28 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 29 | 29 | val max: Long, |
| 30 | 30 | |
| 31 | - @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 32 | - val min: Long, | |
| 33 | - | |
| 34 | 31 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 35 | 32 | val minmax: Long, |
| 36 | 33 | |
| 37 | 34 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 38 | - val minMaxIntersection: Long, | |
| 35 | + val union: Long, | |
| 39 | 36 | |
| 40 | 37 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 41 | 38 | val minMaxUnion: Long, |
| 42 | 39 | |
| 43 | 40 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 44 | - val union: Long | |
| 41 | + val intersection: Long, | |
| 42 | + | |
| 43 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 44 | + val minMaxIntersection: Long | |
| 45 | 45 | ) { |
| 46 | 46 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+4 −4
| @@ -10,13 +10,13 @@ private val klaxon = Klaxon() | ||
| 10 | 10 | |
| 11 | 11 | data class TopLevel ( |
| 12 | 12 | val free: Long, |
| 13 | - val intersection: Long, | |
| 14 | - val max: Long, | |
| 15 | 13 | val min: Long, |
| 14 | + val max: Long, | |
| 16 | 15 | val minmax: Long, |
| 17 | - val minMaxIntersection: Long, | |
| 16 | + val union: Long, | |
| 18 | 17 | val minMaxUnion: Long, |
| 19 | - val union: Long | |
| 18 | + val intersection: Long, | |
| 19 | + val minMaxIntersection: Long | |
| 20 | 20 | ) { |
| 21 | 21 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-kotlinxdefault / TopLevel.kt+4 −4
| @@ -13,11 +13,11 @@ import kotlinx.serialization.encoding.* | ||
| 13 | 13 | @Serializable |
| 14 | 14 | data class TopLevel ( |
| 15 | 15 | val free: Long, |
| 16 | - val intersection: Long, | |
| 17 | - val max: Long, | |
| 18 | 16 | val min: Long, |
| 17 | + val max: Long, | |
| 19 | 18 | val minmax: Long, |
| 20 | - val minMaxIntersection: Long, | |
| 19 | + val union: Long, | |
| 21 | 20 | val minMaxUnion: Long, |
| 22 | - val union: Long | |
| 21 | + val intersection: Long, | |
| 22 | + val minMaxIntersection: Long | |
| 23 | 23 | ) |
Mschema-phpdefault / TopLevel.php+101 −101
| @@ -5,33 +5,33 @@ declare(strict_types=1); | ||
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | 7 | private int $free; // json:free Required |
| 8 | - private int $intersection; // json:intersection Required | |
| 9 | - private int $max; // json:max Required | |
| 10 | 8 | private int $min; // json:min Required |
| 9 | + private int $max; // json:max Required | |
| 11 | 10 | private int $minmax; // json:minmax Required |
| 12 | - private int $minMaxIntersection; // json:minMaxIntersection Required | |
| 13 | - private int $minMaxUnion; // json:minMaxUnion Required | |
| 14 | 11 | private int $union; // json:union Required |
| 12 | + private int $minMaxUnion; // json:minMaxUnion Required | |
| 13 | + private int $intersection; // json:intersection Required | |
| 14 | + private int $minMaxIntersection; // json:minMaxIntersection Required | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @param int $free |
| 18 | - * @param int $intersection | |
| 19 | - * @param int $max | |
| 20 | 18 | * @param int $min |
| 19 | + * @param int $max | |
| 21 | 20 | * @param int $minmax |
| 22 | - * @param int $minMaxIntersection | |
| 23 | - * @param int $minMaxUnion | |
| 24 | 21 | * @param int $union |
| 22 | + * @param int $minMaxUnion | |
| 23 | + * @param int $intersection | |
| 24 | + * @param int $minMaxIntersection | |
| 25 | 25 | */ |
| 26 | - public function __construct(int $free, int $intersection, int $max, int $min, int $minmax, int $minMaxIntersection, int $minMaxUnion, int $union) { | |
| 26 | + public function __construct(int $free, int $min, int $max, int $minmax, int $union, int $minMaxUnion, int $intersection, int $minMaxIntersection) { | |
| 27 | 27 | $this->free = $free; |
| 28 | - $this->intersection = $intersection; | |
| 29 | - $this->max = $max; | |
| 30 | 28 | $this->min = $min; |
| 29 | + $this->max = $max; | |
| 31 | 30 | $this->minmax = $minmax; |
| 32 | - $this->minMaxIntersection = $minMaxIntersection; | |
| 33 | - $this->minMaxUnion = $minMaxUnion; | |
| 34 | 31 | $this->union = $union; |
| 32 | + $this->minMaxUnion = $minMaxUnion; | |
| 33 | + $this->intersection = $intersection; | |
| 34 | + $this->minMaxIntersection = $minMaxIntersection; | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
| @@ -86,7 +86,7 @@ class TopLevel { | ||
| 86 | 86 | * @throws Exception |
| 87 | 87 | * @return int |
| 88 | 88 | */ |
| 89 | - public static function fromIntersection(int $value): int { | |
| 89 | + public static function fromMin(int $value): int { | |
| 90 | 90 | return $value; /*int*/ |
| 91 | 91 | } |
| 92 | 92 | |
| @@ -94,11 +94,11 @@ class TopLevel { | ||
| 94 | 94 | * @throws Exception |
| 95 | 95 | * @return int |
| 96 | 96 | */ |
| 97 | - public function toIntersection(): int { | |
| 98 | - if (TopLevel::validateIntersection($this->intersection)) { | |
| 99 | - return $this->intersection; /*int*/ | |
| 97 | + public function toMin(): int { | |
| 98 | + if (TopLevel::validateMin($this->min)) { | |
| 99 | + return $this->min; /*int*/ | |
| 100 | 100 | } |
| 101 | - throw new Exception('never get to this TopLevel::intersection'); | |
| 101 | + throw new Exception('never get to this TopLevel::min'); | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| @@ -106,7 +106,7 @@ class TopLevel { | ||
| 106 | 106 | * @return bool |
| 107 | 107 | * @throws Exception |
| 108 | 108 | */ |
| 109 | - public static function validateIntersection(int $value): bool { | |
| 109 | + public static function validateMin(int $value): bool { | |
| 110 | 110 | return true; |
| 111 | 111 | } |
| 112 | 112 | |
| @@ -114,18 +114,18 @@ class TopLevel { | ||
| 114 | 114 | * @throws Exception |
| 115 | 115 | * @return int |
| 116 | 116 | */ |
| 117 | - public function getIntersection(): int { | |
| 118 | - if (TopLevel::validateIntersection($this->intersection)) { | |
| 119 | - return $this->intersection; | |
| 117 | + public function getMin(): int { | |
| 118 | + if (TopLevel::validateMin($this->min)) { | |
| 119 | + return $this->min; | |
| 120 | 120 | } |
| 121 | - throw new Exception('never get to getIntersection TopLevel::intersection'); | |
| 121 | + throw new Exception('never get to getMin TopLevel::min'); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | 125 | * @return int |
| 126 | 126 | */ |
| 127 | - public static function sampleIntersection(): int { | |
| 128 | - return 32; /*32:intersection*/ | |
| 127 | + public static function sampleMin(): int { | |
| 128 | + return 32; /*32:min*/ | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| @@ -180,7 +180,7 @@ class TopLevel { | ||
| 180 | 180 | * @throws Exception |
| 181 | 181 | * @return int |
| 182 | 182 | */ |
| 183 | - public static function fromMin(int $value): int { | |
| 183 | + public static function fromMinmax(int $value): int { | |
| 184 | 184 | return $value; /*int*/ |
| 185 | 185 | } |
| 186 | 186 | |
| @@ -188,11 +188,11 @@ class TopLevel { | ||
| 188 | 188 | * @throws Exception |
| 189 | 189 | * @return int |
| 190 | 190 | */ |
| 191 | - public function toMin(): int { | |
| 192 | - if (TopLevel::validateMin($this->min)) { | |
| 193 | - return $this->min; /*int*/ | |
| 191 | + public function toMinmax(): int { | |
| 192 | + if (TopLevel::validateMinmax($this->minmax)) { | |
| 193 | + return $this->minmax; /*int*/ | |
| 194 | 194 | } |
| 195 | - throw new Exception('never get to this TopLevel::min'); | |
| 195 | + throw new Exception('never get to this TopLevel::minmax'); | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
| @@ -200,7 +200,7 @@ class TopLevel { | ||
| 200 | 200 | * @return bool |
| 201 | 201 | * @throws Exception |
| 202 | 202 | */ |
| 203 | - public static function validateMin(int $value): bool { | |
| 203 | + public static function validateMinmax(int $value): bool { | |
| 204 | 204 | return true; |
| 205 | 205 | } |
| 206 | 206 | |
| @@ -208,18 +208,18 @@ class TopLevel { | ||
| 208 | 208 | * @throws Exception |
| 209 | 209 | * @return int |
| 210 | 210 | */ |
| 211 | - public function getMin(): int { | |
| 212 | - if (TopLevel::validateMin($this->min)) { | |
| 213 | - return $this->min; | |
| 211 | + public function getMinmax(): int { | |
| 212 | + if (TopLevel::validateMinmax($this->minmax)) { | |
| 213 | + return $this->minmax; | |
| 214 | 214 | } |
| 215 | - throw new Exception('never get to getMin TopLevel::min'); | |
| 215 | + throw new Exception('never get to getMinmax TopLevel::minmax'); | |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
| 219 | 219 | * @return int |
| 220 | 220 | */ |
| 221 | - public static function sampleMin(): int { | |
| 222 | - return 34; /*34:min*/ | |
| 221 | + public static function sampleMinmax(): int { | |
| 222 | + return 34; /*34:minmax*/ | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
| @@ -227,7 +227,7 @@ class TopLevel { | ||
| 227 | 227 | * @throws Exception |
| 228 | 228 | * @return int |
| 229 | 229 | */ |
| 230 | - public static function fromMinmax(int $value): int { | |
| 230 | + public static function fromUnion(int $value): int { | |
| 231 | 231 | return $value; /*int*/ |
| 232 | 232 | } |
| 233 | 233 | |
| @@ -235,11 +235,11 @@ class TopLevel { | ||
| 235 | 235 | * @throws Exception |
| 236 | 236 | * @return int |
| 237 | 237 | */ |
| 238 | - public function toMinmax(): int { | |
| 239 | - if (TopLevel::validateMinmax($this->minmax)) { | |
| 240 | - return $this->minmax; /*int*/ | |
| 238 | + public function toUnion(): int { | |
| 239 | + if (TopLevel::validateUnion($this->union)) { | |
| 240 | + return $this->union; /*int*/ | |
| 241 | 241 | } |
| 242 | - throw new Exception('never get to this TopLevel::minmax'); | |
| 242 | + throw new Exception('never get to this TopLevel::union'); | |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
| @@ -247,7 +247,7 @@ class TopLevel { | ||
| 247 | 247 | * @return bool |
| 248 | 248 | * @throws Exception |
| 249 | 249 | */ |
| 250 | - public static function validateMinmax(int $value): bool { | |
| 250 | + public static function validateUnion(int $value): bool { | |
| 251 | 251 | return true; |
| 252 | 252 | } |
| 253 | 253 | |
| @@ -255,18 +255,18 @@ class TopLevel { | ||
| 255 | 255 | * @throws Exception |
| 256 | 256 | * @return int |
| 257 | 257 | */ |
| 258 | - public function getMinmax(): int { | |
| 259 | - if (TopLevel::validateMinmax($this->minmax)) { | |
| 260 | - return $this->minmax; | |
| 258 | + public function getUnion(): int { | |
| 259 | + if (TopLevel::validateUnion($this->union)) { | |
| 260 | + return $this->union; | |
| 261 | 261 | } |
| 262 | - throw new Exception('never get to getMinmax TopLevel::minmax'); | |
| 262 | + throw new Exception('never get to getUnion TopLevel::union'); | |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | 266 | * @return int |
| 267 | 267 | */ |
| 268 | - public static function sampleMinmax(): int { | |
| 269 | - return 35; /*35:minmax*/ | |
| 268 | + public static function sampleUnion(): int { | |
| 269 | + return 35; /*35:union*/ | |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
| @@ -274,7 +274,7 @@ class TopLevel { | ||
| 274 | 274 | * @throws Exception |
| 275 | 275 | * @return int |
| 276 | 276 | */ |
| 277 | - public static function fromMinMaxIntersection(int $value): int { | |
| 277 | + public static function fromMinMaxUnion(int $value): int { | |
| 278 | 278 | return $value; /*int*/ |
| 279 | 279 | } |
| 280 | 280 | |
| @@ -282,11 +282,11 @@ class TopLevel { | ||
| 282 | 282 | * @throws Exception |
| 283 | 283 | * @return int |
| 284 | 284 | */ |
| 285 | - public function toMinMaxIntersection(): int { | |
| 286 | - if (TopLevel::validateMinMaxIntersection($this->minMaxIntersection)) { | |
| 287 | - return $this->minMaxIntersection; /*int*/ | |
| 285 | + public function toMinMaxUnion(): int { | |
| 286 | + if (TopLevel::validateMinMaxUnion($this->minMaxUnion)) { | |
| 287 | + return $this->minMaxUnion; /*int*/ | |
| 288 | 288 | } |
| 289 | - throw new Exception('never get to this TopLevel::minMaxIntersection'); | |
| 289 | + throw new Exception('never get to this TopLevel::minMaxUnion'); | |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
| @@ -294,7 +294,7 @@ class TopLevel { | ||
| 294 | 294 | * @return bool |
| 295 | 295 | * @throws Exception |
| 296 | 296 | */ |
| 297 | - public static function validateMinMaxIntersection(int $value): bool { | |
| 297 | + public static function validateMinMaxUnion(int $value): bool { | |
| 298 | 298 | return true; |
| 299 | 299 | } |
| 300 | 300 | |
| @@ -302,18 +302,18 @@ class TopLevel { | ||
| 302 | 302 | * @throws Exception |
| 303 | 303 | * @return int |
| 304 | 304 | */ |
| 305 | - public function getMinMaxIntersection(): int { | |
| 306 | - if (TopLevel::validateMinMaxIntersection($this->minMaxIntersection)) { | |
| 307 | - return $this->minMaxIntersection; | |
| 305 | + public function getMinMaxUnion(): int { | |
| 306 | + if (TopLevel::validateMinMaxUnion($this->minMaxUnion)) { | |
| 307 | + return $this->minMaxUnion; | |
| 308 | 308 | } |
| 309 | - throw new Exception('never get to getMinMaxIntersection TopLevel::minMaxIntersection'); | |
| 309 | + throw new Exception('never get to getMinMaxUnion TopLevel::minMaxUnion'); | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | /** |
| 313 | 313 | * @return int |
| 314 | 314 | */ |
| 315 | - public static function sampleMinMaxIntersection(): int { | |
| 316 | - return 36; /*36:minMaxIntersection*/ | |
| 315 | + public static function sampleMinMaxUnion(): int { | |
| 316 | + return 36; /*36:minMaxUnion*/ | |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
| @@ -321,7 +321,7 @@ class TopLevel { | ||
| 321 | 321 | * @throws Exception |
| 322 | 322 | * @return int |
| 323 | 323 | */ |
| 324 | - public static function fromMinMaxUnion(int $value): int { | |
| 324 | + public static function fromIntersection(int $value): int { | |
| 325 | 325 | return $value; /*int*/ |
| 326 | 326 | } |
| 327 | 327 | |
| @@ -329,11 +329,11 @@ class TopLevel { | ||
| 329 | 329 | * @throws Exception |
| 330 | 330 | * @return int |
| 331 | 331 | */ |
| 332 | - public function toMinMaxUnion(): int { | |
| 333 | - if (TopLevel::validateMinMaxUnion($this->minMaxUnion)) { | |
| 334 | - return $this->minMaxUnion; /*int*/ | |
| 332 | + public function toIntersection(): int { | |
| 333 | + if (TopLevel::validateIntersection($this->intersection)) { | |
| 334 | + return $this->intersection; /*int*/ | |
| 335 | 335 | } |
| 336 | - throw new Exception('never get to this TopLevel::minMaxUnion'); | |
| 336 | + throw new Exception('never get to this TopLevel::intersection'); | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
| @@ -341,7 +341,7 @@ class TopLevel { | ||
| 341 | 341 | * @return bool |
| 342 | 342 | * @throws Exception |
| 343 | 343 | */ |
| 344 | - public static function validateMinMaxUnion(int $value): bool { | |
| 344 | + public static function validateIntersection(int $value): bool { | |
| 345 | 345 | return true; |
| 346 | 346 | } |
| 347 | 347 | |
| @@ -349,18 +349,18 @@ class TopLevel { | ||
| 349 | 349 | * @throws Exception |
| 350 | 350 | * @return int |
| 351 | 351 | */ |
| 352 | - public function getMinMaxUnion(): int { | |
| 353 | - if (TopLevel::validateMinMaxUnion($this->minMaxUnion)) { | |
| 354 | - return $this->minMaxUnion; | |
| 352 | + public function getIntersection(): int { | |
| 353 | + if (TopLevel::validateIntersection($this->intersection)) { | |
| 354 | + return $this->intersection; | |
| 355 | 355 | } |
| 356 | - throw new Exception('never get to getMinMaxUnion TopLevel::minMaxUnion'); | |
| 356 | + throw new Exception('never get to getIntersection TopLevel::intersection'); | |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | /** |
| 360 | 360 | * @return int |
| 361 | 361 | */ |
| 362 | - public static function sampleMinMaxUnion(): int { | |
| 363 | - return 37; /*37:minMaxUnion*/ | |
| 362 | + public static function sampleIntersection(): int { | |
| 363 | + return 37; /*37:intersection*/ | |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | /** |
| @@ -368,7 +368,7 @@ class TopLevel { | ||
| 368 | 368 | * @throws Exception |
| 369 | 369 | * @return int |
| 370 | 370 | */ |
| 371 | - public static function fromUnion(int $value): int { | |
| 371 | + public static function fromMinMaxIntersection(int $value): int { | |
| 372 | 372 | return $value; /*int*/ |
| 373 | 373 | } |
| 374 | 374 | |
| @@ -376,11 +376,11 @@ class TopLevel { | ||
| 376 | 376 | * @throws Exception |
| 377 | 377 | * @return int |
| 378 | 378 | */ |
| 379 | - public function toUnion(): int { | |
| 380 | - if (TopLevel::validateUnion($this->union)) { | |
| 381 | - return $this->union; /*int*/ | |
| 379 | + public function toMinMaxIntersection(): int { | |
| 380 | + if (TopLevel::validateMinMaxIntersection($this->minMaxIntersection)) { | |
| 381 | + return $this->minMaxIntersection; /*int*/ | |
| 382 | 382 | } |
| 383 | - throw new Exception('never get to this TopLevel::union'); | |
| 383 | + throw new Exception('never get to this TopLevel::minMaxIntersection'); | |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /** |
| @@ -388,7 +388,7 @@ class TopLevel { | ||
| 388 | 388 | * @return bool |
| 389 | 389 | * @throws Exception |
| 390 | 390 | */ |
| 391 | - public static function validateUnion(int $value): bool { | |
| 391 | + public static function validateMinMaxIntersection(int $value): bool { | |
| 392 | 392 | return true; |
| 393 | 393 | } |
| 394 | 394 | |
| @@ -396,18 +396,18 @@ class TopLevel { | ||
| 396 | 396 | * @throws Exception |
| 397 | 397 | * @return int |
| 398 | 398 | */ |
| 399 | - public function getUnion(): int { | |
| 400 | - if (TopLevel::validateUnion($this->union)) { | |
| 401 | - return $this->union; | |
| 399 | + public function getMinMaxIntersection(): int { | |
| 400 | + if (TopLevel::validateMinMaxIntersection($this->minMaxIntersection)) { | |
| 401 | + return $this->minMaxIntersection; | |
| 402 | 402 | } |
| 403 | - throw new Exception('never get to getUnion TopLevel::union'); | |
| 403 | + throw new Exception('never get to getMinMaxIntersection TopLevel::minMaxIntersection'); | |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /** |
| 407 | 407 | * @return int |
| 408 | 408 | */ |
| 409 | - public static function sampleUnion(): int { | |
| 410 | - return 38; /*38:union*/ | |
| 409 | + public static function sampleMinMaxIntersection(): int { | |
| 410 | + return 38; /*38:minMaxIntersection*/ | |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
| @@ -416,13 +416,13 @@ class TopLevel { | ||
| 416 | 416 | */ |
| 417 | 417 | public function validate(): bool { |
| 418 | 418 | return TopLevel::validateFree($this->free) |
| 419 | - || TopLevel::validateIntersection($this->intersection) | |
| 420 | - || TopLevel::validateMax($this->max) | |
| 421 | 419 | || TopLevel::validateMin($this->min) |
| 420 | + || TopLevel::validateMax($this->max) | |
| 422 | 421 | || TopLevel::validateMinmax($this->minmax) |
| 423 | - || TopLevel::validateMinMaxIntersection($this->minMaxIntersection) | |
| 422 | + || TopLevel::validateUnion($this->union) | |
| 424 | 423 | || TopLevel::validateMinMaxUnion($this->minMaxUnion) |
| 425 | - || TopLevel::validateUnion($this->union); | |
| 424 | + || TopLevel::validateIntersection($this->intersection) | |
| 425 | + || TopLevel::validateMinMaxIntersection($this->minMaxIntersection); | |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | /** |
| @@ -432,13 +432,13 @@ class TopLevel { | ||
| 432 | 432 | public function to(): stdClass { |
| 433 | 433 | $out = new stdClass(); |
| 434 | 434 | $out->{'free'} = $this->toFree(); |
| 435 | - $out->{'intersection'} = $this->toIntersection(); | |
| 436 | - $out->{'max'} = $this->toMax(); | |
| 437 | 435 | $out->{'min'} = $this->toMin(); |
| 436 | + $out->{'max'} = $this->toMax(); | |
| 438 | 437 | $out->{'minmax'} = $this->toMinmax(); |
| 439 | - $out->{'minMaxIntersection'} = $this->toMinMaxIntersection(); | |
| 440 | - $out->{'minMaxUnion'} = $this->toMinMaxUnion(); | |
| 441 | 438 | $out->{'union'} = $this->toUnion(); |
| 439 | + $out->{'minMaxUnion'} = $this->toMinMaxUnion(); | |
| 440 | + $out->{'intersection'} = $this->toIntersection(); | |
| 441 | + $out->{'minMaxIntersection'} = $this->toMinMaxIntersection(); | |
| 442 | 442 | return $out; |
| 443 | 443 | } |
| 444 | 444 | |
| @@ -450,13 +450,13 @@ class TopLevel { | ||
| 450 | 450 | public static function from(stdClass $obj): TopLevel { |
| 451 | 451 | return new TopLevel( |
| 452 | 452 | TopLevel::fromFree($obj->{'free'}) |
| 453 | - ,TopLevel::fromIntersection($obj->{'intersection'}) | |
| 454 | - ,TopLevel::fromMax($obj->{'max'}) | |
| 455 | 453 | ,TopLevel::fromMin($obj->{'min'}) |
| 454 | + ,TopLevel::fromMax($obj->{'max'}) | |
| 456 | 455 | ,TopLevel::fromMinmax($obj->{'minmax'}) |
| 457 | - ,TopLevel::fromMinMaxIntersection($obj->{'minMaxIntersection'}) | |
| 458 | - ,TopLevel::fromMinMaxUnion($obj->{'minMaxUnion'}) | |
| 459 | 456 | ,TopLevel::fromUnion($obj->{'union'}) |
| 457 | + ,TopLevel::fromMinMaxUnion($obj->{'minMaxUnion'}) | |
| 458 | + ,TopLevel::fromIntersection($obj->{'intersection'}) | |
| 459 | + ,TopLevel::fromMinMaxIntersection($obj->{'minMaxIntersection'}) | |
| 460 | 460 | ); |
| 461 | 461 | } |
| 462 | 462 | |
| @@ -466,13 +466,13 @@ class TopLevel { | ||
| 466 | 466 | public static function sample(): TopLevel { |
| 467 | 467 | return new TopLevel( |
| 468 | 468 | TopLevel::sampleFree() |
| 469 | - ,TopLevel::sampleIntersection() | |
| 470 | - ,TopLevel::sampleMax() | |
| 471 | 469 | ,TopLevel::sampleMin() |
| 470 | + ,TopLevel::sampleMax() | |
| 472 | 471 | ,TopLevel::sampleMinmax() |
| 473 | - ,TopLevel::sampleMinMaxIntersection() | |
| 474 | - ,TopLevel::sampleMinMaxUnion() | |
| 475 | 472 | ,TopLevel::sampleUnion() |
| 473 | + ,TopLevel::sampleMinMaxUnion() | |
| 474 | + ,TopLevel::sampleIntersection() | |
| 475 | + ,TopLevel::sampleMinMaxIntersection() | |
| 476 | 476 | ); |
| 477 | 477 | } |
| 478 | 478 | } |
Mschema-pikedefault / TopLevel.pmod+12 −12
| @@ -14,24 +14,24 @@ | ||
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | 16 | int free; // json: "free" |
| 17 | - int intersection; // json: "intersection" | |
| 18 | - int max; // json: "max" | |
| 19 | 17 | int min; // json: "min" |
| 18 | + int max; // json: "max" | |
| 20 | 19 | int minmax; // json: "minmax" |
| 21 | - int min_max_intersection; // json: "minMaxIntersection" | |
| 22 | - int min_max_union; // json: "minMaxUnion" | |
| 23 | 20 | int union; // json: "union" |
| 21 | + int min_max_union; // json: "minMaxUnion" | |
| 22 | + int intersection; // json: "intersection" | |
| 23 | + int min_max_intersection; // json: "minMaxIntersection" | |
| 24 | 24 | |
| 25 | 25 | string encode_json() { |
| 26 | 26 | mapping(string:mixed) json = ([ |
| 27 | 27 | "free" : free, |
| 28 | - "intersection" : intersection, | |
| 29 | - "max" : max, | |
| 30 | 28 | "min" : min, |
| 29 | + "max" : max, | |
| 31 | 30 | "minmax" : minmax, |
| 32 | - "minMaxIntersection" : min_max_intersection, | |
| 33 | - "minMaxUnion" : min_max_union, | |
| 34 | 31 | "union" : union, |
| 32 | + "minMaxUnion" : min_max_union, | |
| 33 | + "intersection" : intersection, | |
| 34 | + "minMaxIntersection" : min_max_intersection, | |
| 35 | 35 | ]); |
| 36 | 36 | |
| 37 | 37 | return Standards.JSON.encode(json); |
| @@ -42,13 +42,13 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 42 | 42 | TopLevel retval = TopLevel(); |
| 43 | 43 | |
| 44 | 44 | retval.free = json["free"]; |
| 45 | - retval.intersection = json["intersection"]; | |
| 46 | - retval.max = json["max"]; | |
| 47 | 45 | retval.min = json["min"]; |
| 46 | + retval.max = json["max"]; | |
| 48 | 47 | retval.minmax = json["minmax"]; |
| 49 | - retval.min_max_intersection = json["minMaxIntersection"]; | |
| 50 | - retval.min_max_union = json["minMaxUnion"]; | |
| 51 | 48 | retval.union = json["union"]; |
| 49 | + retval.min_max_union = json["minMaxUnion"]; | |
| 50 | + retval.intersection = json["intersection"]; | |
| 51 | + retval.min_max_intersection = json["minMaxIntersection"]; | |
| 52 | 52 | |
| 53 | 53 | return retval; |
| 54 | 54 | } |
Mschema-pythondefault / quicktype.py+13 −13
| @@ -18,37 +18,37 @@ def to_class(c: Type[T], x: Any) -> dict: | ||
| 18 | 18 | @dataclass |
| 19 | 19 | class TopLevel: |
| 20 | 20 | free: int |
| 21 | - intersection: int | |
| 22 | - max: int | |
| 23 | 21 | min: int |
| 22 | + max: int | |
| 24 | 23 | minmax: int |
| 25 | - min_max_intersection: int | |
| 26 | - min_max_union: int | |
| 27 | 24 | union: int |
| 25 | + min_max_union: int | |
| 26 | + intersection: int | |
| 27 | + min_max_intersection: int | |
| 28 | 28 | |
| 29 | 29 | @staticmethod |
| 30 | 30 | def from_dict(obj: Any) -> 'TopLevel': |
| 31 | 31 | assert isinstance(obj, dict) |
| 32 | 32 | free = from_int(obj.get("free")) |
| 33 | - intersection = from_int(obj.get("intersection")) | |
| 34 | - max = from_int(obj.get("max")) | |
| 35 | 33 | min = from_int(obj.get("min")) |
| 34 | + max = from_int(obj.get("max")) | |
| 36 | 35 | minmax = from_int(obj.get("minmax")) |
| 37 | - min_max_intersection = from_int(obj.get("minMaxIntersection")) | |
| 38 | - min_max_union = from_int(obj.get("minMaxUnion")) | |
| 39 | 36 | union = from_int(obj.get("union")) |
| 40 | - return TopLevel(free, intersection, max, min, minmax, min_max_intersection, min_max_union, union) | |
| 37 | + min_max_union = from_int(obj.get("minMaxUnion")) | |
| 38 | + intersection = from_int(obj.get("intersection")) | |
| 39 | + min_max_intersection = from_int(obj.get("minMaxIntersection")) | |
| 40 | + return TopLevel(free, min, max, minmax, union, min_max_union, intersection, min_max_intersection) | |
| 41 | 41 | |
| 42 | 42 | def to_dict(self) -> dict: |
| 43 | 43 | result: dict = {} |
| 44 | 44 | result["free"] = from_int(self.free) |
| 45 | - result["intersection"] = from_int(self.intersection) | |
| 46 | - result["max"] = from_int(self.max) | |
| 47 | 45 | result["min"] = from_int(self.min) |
| 46 | + result["max"] = from_int(self.max) | |
| 48 | 47 | result["minmax"] = from_int(self.minmax) |
| 49 | - result["minMaxIntersection"] = from_int(self.min_max_intersection) | |
| 50 | - result["minMaxUnion"] = from_int(self.min_max_union) | |
| 51 | 48 | result["union"] = from_int(self.union) |
| 49 | + result["minMaxUnion"] = from_int(self.min_max_union) | |
| 50 | + result["intersection"] = from_int(self.intersection) | |
| 51 | + result["minMaxIntersection"] = from_int(self.min_max_intersection) | |
| 52 | 52 | return result |
Mschema-rubydefault / TopLevel.rb+12 −12
| @@ -21,25 +21,25 @@ end | ||
| 21 | 21 | |
| 22 | 22 | class TopLevel < Dry::Struct |
| 23 | 23 | attribute :free, Types::Integer |
| 24 | - attribute :intersection, Types::Integer | |
| 25 | - attribute :max, Types::Integer | |
| 26 | 24 | attribute :min, Types::Integer |
| 25 | + attribute :max, Types::Integer | |
| 27 | 26 | attribute :minmax, Types::Integer |
| 28 | - attribute :min_max_intersection, Types::Integer | |
| 29 | - attribute :min_max_union, Types::Integer | |
| 30 | 27 | attribute :union, Types::Integer |
| 28 | + attribute :min_max_union, Types::Integer | |
| 29 | + attribute :intersection, Types::Integer | |
| 30 | + attribute :min_max_intersection, Types::Integer | |
| 31 | 31 | |
| 32 | 32 | def self.from_dynamic!(d) |
| 33 | 33 | d = Types::Hash[d] |
| 34 | 34 | new( |
| 35 | 35 | free: d.fetch("free"), |
| 36 | - intersection: d.fetch("intersection"), | |
| 37 | - max: d.fetch("max"), | |
| 38 | 36 | min: d.fetch("min"), |
| 37 | + max: d.fetch("max"), | |
| 39 | 38 | minmax: d.fetch("minmax"), |
| 40 | - min_max_intersection: d.fetch("minMaxIntersection"), | |
| 41 | - min_max_union: d.fetch("minMaxUnion"), | |
| 42 | 39 | union: d.fetch("union"), |
| 40 | + min_max_union: d.fetch("minMaxUnion"), | |
| 41 | + intersection: d.fetch("intersection"), | |
| 42 | + min_max_intersection: d.fetch("minMaxIntersection"), | |
| 43 | 43 | ) |
| 44 | 44 | end |
| 45 | 45 | |
| @@ -50,13 +50,13 @@ class TopLevel < Dry::Struct | ||
| 50 | 50 | def to_dynamic |
| 51 | 51 | { |
| 52 | 52 | "free" => free, |
| 53 | - "intersection" => intersection, | |
| 54 | - "max" => max, | |
| 55 | 53 | "min" => min, |
| 54 | + "max" => max, | |
| 56 | 55 | "minmax" => minmax, |
| 57 | - "minMaxIntersection" => min_max_intersection, | |
| 58 | - "minMaxUnion" => min_max_union, | |
| 59 | 56 | "union" => union, |
| 57 | + "minMaxUnion" => min_max_union, | |
| 58 | + "intersection" => intersection, | |
| 59 | + "minMaxIntersection" => min_max_intersection, | |
| 60 | 60 | } |
| 61 | 61 | end |
Mschema-rustdefault / module_under_test.rs+6 −6
| @@ -18,18 +18,18 @@ use serde::{Serialize, Deserialize}; | ||
| 18 | 18 | pub struct TopLevel { |
| 19 | 19 | pub free: i64, |
| 20 | 20 | |
| 21 | - pub intersection: i32, | |
| 21 | + pub min: i64, | |
| 22 | 22 | |
| 23 | 23 | pub max: i64, |
| 24 | 24 | |
| 25 | - pub min: i64, | |
| 26 | - | |
| 27 | 25 | pub minmax: i32, |
| 28 | 26 | |
| 29 | - pub min_max_intersection: i32, | |
| 27 | + #[serde(rename = "union")] | |
| 28 | + pub top_level_union: i32, | |
| 30 | 29 | |
| 31 | 30 | pub min_max_union: i64, |
| 32 | 31 | |
| 33 | - #[serde(rename = "union")] | |
| 34 | - pub top_level_union: i32, | |
| 32 | + pub intersection: i32, | |
| 33 | + | |
| 34 | + pub min_max_intersection: i32, | |
| 35 | 35 | } |
Mschema-rustinteger-type-force-i32--513c6f621a11 / module_under_test.rs+6 −6
| @@ -18,18 +18,18 @@ use serde::{Serialize, Deserialize}; | ||
| 18 | 18 | pub struct TopLevel { |
| 19 | 19 | pub free: i32, |
| 20 | 20 | |
| 21 | - pub intersection: i32, | |
| 21 | + pub min: i32, | |
| 22 | 22 | |
| 23 | 23 | pub max: i32, |
| 24 | 24 | |
| 25 | - pub min: i32, | |
| 26 | - | |
| 27 | 25 | pub minmax: i32, |
| 28 | 26 | |
| 29 | - pub min_max_intersection: i32, | |
| 27 | + #[serde(rename = "union")] | |
| 28 | + pub top_level_union: i32, | |
| 30 | 29 | |
| 31 | 30 | pub min_max_union: i32, |
| 32 | 31 | |
| 33 | - #[serde(rename = "union")] | |
| 34 | - pub top_level_union: i32, | |
| 32 | + pub intersection: i32, | |
| 33 | + | |
| 34 | + pub min_max_intersection: i32, | |
| 35 | 35 | } |
Mschema-scala3-upickledefault / TopLevel.scala+4 −4
| @@ -67,11 +67,11 @@ end JsonExt | ||
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | 69 | val free : Long, |
| 70 | - val intersection : Long, | |
| 71 | - val max : Long, | |
| 72 | 70 | val min : Long, |
| 71 | + val max : Long, | |
| 73 | 72 | val minmax : Long, |
| 74 | - val minMaxIntersection : Long, | |
| 73 | + val union : Long, | |
| 75 | 74 | val minMaxUnion : Long, |
| 76 | - val union : Long | |
| 75 | + val intersection : Long, | |
| 76 | + val minMaxIntersection : Long | |
| 77 | 77 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+4 −4
| @@ -9,11 +9,11 @@ type NullValue = None.type | ||
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | 11 | val free : Long, |
| 12 | - val intersection : Long, | |
| 13 | - val max : Long, | |
| 14 | 12 | val min : Long, |
| 13 | + val max : Long, | |
| 15 | 14 | val minmax : Long, |
| 16 | - val minMaxIntersection : Long, | |
| 15 | + val union : Long, | |
| 17 | 16 | val minMaxUnion : Long, |
| 18 | - val union : Long | |
| 17 | + val intersection : Long, | |
| 18 | + val minMaxIntersection : Long | |
| 19 | 19 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+11 −11
| @@ -9,36 +9,36 @@ | ||
| 9 | 9 | "free": { |
| 10 | 10 | "type": "integer" |
| 11 | 11 | }, |
| 12 | - "intersection": { | |
| 12 | + "min": { | |
| 13 | 13 | "type": "integer", |
| 14 | - "minimum": 4, | |
| 15 | - "maximum": 5 | |
| 14 | + "minimum": 3 | |
| 16 | 15 | }, |
| 17 | 16 | "max": { |
| 18 | 17 | "type": "integer", |
| 19 | 18 | "maximum": 5 |
| 20 | 19 | }, |
| 21 | - "min": { | |
| 22 | - "type": "integer", | |
| 23 | - "minimum": 3 | |
| 24 | - }, | |
| 25 | 20 | "minmax": { |
| 26 | 21 | "type": "integer", |
| 27 | 22 | "minimum": 3, |
| 28 | 23 | "maximum": 5 |
| 29 | 24 | }, |
| 30 | - "minMaxIntersection": { | |
| 25 | + "union": { | |
| 31 | 26 | "type": "integer", |
| 32 | 27 | "minimum": 3, |
| 33 | - "maximum": 5 | |
| 28 | + "maximum": 6 | |
| 34 | 29 | }, |
| 35 | 30 | "minMaxUnion": { |
| 36 | 31 | "type": "integer" |
| 37 | 32 | }, |
| 38 | - "union": { | |
| 33 | + "intersection": { | |
| 34 | + "type": "integer", | |
| 35 | + "minimum": 4, | |
| 36 | + "maximum": 5 | |
| 37 | + }, | |
| 38 | + "minMaxIntersection": { | |
| 39 | 39 | "type": "integer", |
| 40 | 40 | "minimum": 3, |
| 41 | - "maximum": 6 | |
| 41 | + "maximum": 5 | |
| 42 | 42 | } |
| 43 | 43 | }, |
| 44 | 44 | "required": [ |
Mschema-swiftdefault / quicktype.swift+16 −16
| @@ -8,23 +8,23 @@ import Foundation | ||
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | 10 | let free: Int |
| 11 | - let intersection: Int | |
| 12 | - let max: Int | |
| 13 | 11 | let min: Int |
| 12 | + let max: Int | |
| 14 | 13 | let minmax: Int |
| 15 | - let minMaxIntersection: Int | |
| 16 | - let minMaxUnion: Int | |
| 17 | 14 | let union: Int |
| 15 | + let minMaxUnion: Int | |
| 16 | + let intersection: Int | |
| 17 | + let minMaxIntersection: Int | |
| 18 | 18 | |
| 19 | 19 | enum CodingKeys: String, CodingKey { |
| 20 | 20 | case free = "free" |
| 21 | - case intersection = "intersection" | |
| 22 | - case max = "max" | |
| 23 | 21 | case min = "min" |
| 22 | + case max = "max" | |
| 24 | 23 | case minmax = "minmax" |
| 25 | - case minMaxIntersection = "minMaxIntersection" | |
| 26 | - case minMaxUnion = "minMaxUnion" | |
| 27 | 24 | case union = "union" |
| 25 | + case minMaxUnion = "minMaxUnion" | |
| 26 | + case intersection = "intersection" | |
| 27 | + case minMaxIntersection = "minMaxIntersection" | |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| @@ -48,23 +48,23 @@ extension TopLevel { | ||
| 48 | 48 | |
| 49 | 49 | func with( |
| 50 | 50 | free: Int? = nil, |
| 51 | - intersection: Int? = nil, | |
| 52 | - max: Int? = nil, | |
| 53 | 51 | min: Int? = nil, |
| 52 | + max: Int? = nil, | |
| 54 | 53 | minmax: Int? = nil, |
| 55 | - minMaxIntersection: Int? = nil, | |
| 54 | + union: Int? = nil, | |
| 56 | 55 | minMaxUnion: Int? = nil, |
| 57 | - union: Int? = nil | |
| 56 | + intersection: Int? = nil, | |
| 57 | + minMaxIntersection: Int? = nil | |
| 58 | 58 | ) -> TopLevel { |
| 59 | 59 | return TopLevel( |
| 60 | 60 | free: free ?? self.free, |
| 61 | - intersection: intersection ?? self.intersection, | |
| 62 | - max: max ?? self.max, | |
| 63 | 61 | min: min ?? self.min, |
| 62 | + max: max ?? self.max, | |
| 64 | 63 | minmax: minmax ?? self.minmax, |
| 65 | - minMaxIntersection: minMaxIntersection ?? self.minMaxIntersection, | |
| 64 | + union: union ?? self.union, | |
| 66 | 65 | minMaxUnion: minMaxUnion ?? self.minMaxUnion, |
| 67 | - union: union ?? self.union | |
| 66 | + intersection: intersection ?? self.intersection, | |
| 67 | + minMaxIntersection: minMaxIntersection ?? self.minMaxIntersection | |
| 68 | 68 | ) |
| 69 | 69 | } |
Mschema-typescript-zoddefault / TopLevel.ts+4 −4
| @@ -3,12 +3,12 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | 5 | "free": z.number(), |
| 6 | - "intersection": z.number(), | |
| 7 | - "max": z.number(), | |
| 8 | 6 | "min": z.number(), |
| 7 | + "max": z.number(), | |
| 9 | 8 | "minmax": z.number(), |
| 10 | - "minMaxIntersection": z.number(), | |
| 11 | - "minMaxUnion": z.number(), | |
| 12 | 9 | "union": z.number(), |
| 10 | + "minMaxUnion": z.number(), | |
| 11 | + "intersection": z.number(), | |
| 12 | + "minMaxIntersection": z.number(), | |
| 13 | 13 | }); |
| 14 | 14 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+8 −8
| @@ -9,13 +9,13 @@ | ||
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | 11 | free: number; |
| 12 | - intersection: number; | |
| 13 | - max: number; | |
| 14 | 12 | min: number; |
| 13 | + max: number; | |
| 15 | 14 | minmax: number; |
| 16 | - minMaxIntersection: number; | |
| 17 | - minMaxUnion: number; | |
| 18 | 15 | union: number; |
| 16 | + minMaxUnion: number; | |
| 17 | + intersection: number; | |
| 18 | + minMaxIntersection: number; | |
| 19 | 19 | [property: string]: unknown; |
| 20 | 20 | } |
| 21 | 21 | |
| @@ -187,12 +187,12 @@ function r(name: string) { | ||
| 187 | 187 | const typeMap: any = { |
| 188 | 188 | "TopLevel": o([ |
| 189 | 189 | { json: "free", js: "free", typ: 0 }, |
| 190 | - { json: "intersection", js: "intersection", typ: 0 }, | |
| 191 | - { json: "max", js: "max", typ: 0 }, | |
| 192 | 190 | { json: "min", js: "min", typ: 0 }, |
| 191 | + { json: "max", js: "max", typ: 0 }, | |
| 193 | 192 | { json: "minmax", js: "minmax", typ: 0 }, |
| 194 | - { json: "minMaxIntersection", js: "minMaxIntersection", typ: 0 }, | |
| 195 | - { json: "minMaxUnion", js: "minMaxUnion", typ: 0 }, | |
| 196 | 193 | { json: "union", js: "union", typ: 0 }, |
| 194 | + { json: "minMaxUnion", js: "minMaxUnion", typ: 0 }, | |
| 195 | + { json: "intersection", js: "intersection", typ: 0 }, | |
| 196 | + { json: "minMaxIntersection", js: "minMaxIntersection", typ: 0 }, | |
| 197 | 197 | ], "any"), |
| 198 | 198 | }; |
Test case
27 generated files · +399 −399test/inputs/schema/minmax.schema
Mschema-cplusplusdefault / quicktype.hpp+32 −32
| @@ -165,63 +165,63 @@ namespace quicktype { | ||
| 165 | 165 | class TopLevel { |
| 166 | 166 | public: |
| 167 | 167 | TopLevel() : |
| 168 | - intersection_constraint(std::nullopt, std::nullopt, 4, 5, std::nullopt, std::nullopt, std::nullopt), | |
| 169 | - max_constraint(std::nullopt, std::nullopt, std::nullopt, 5, std::nullopt, std::nullopt, std::nullopt), | |
| 170 | 168 | min_constraint(std::nullopt, std::nullopt, 3, std::nullopt, std::nullopt, std::nullopt, std::nullopt), |
| 169 | + max_constraint(std::nullopt, std::nullopt, std::nullopt, 5, std::nullopt, std::nullopt, std::nullopt), | |
| 171 | 170 | minmax_constraint(std::nullopt, std::nullopt, 3, 5, std::nullopt, std::nullopt, std::nullopt), |
| 172 | - min_max_intersection_constraint(std::nullopt, std::nullopt, 3, 5, std::nullopt, std::nullopt, std::nullopt), | |
| 173 | - union_constraint(std::nullopt, std::nullopt, 3, 6, std::nullopt, std::nullopt, std::nullopt) | |
| 171 | + union_constraint(std::nullopt, std::nullopt, 3, 6, std::nullopt, std::nullopt, std::nullopt), | |
| 172 | + intersection_constraint(std::nullopt, std::nullopt, 4, 5, std::nullopt, std::nullopt, std::nullopt), | |
| 173 | + min_max_intersection_constraint(std::nullopt, std::nullopt, 3, 5, std::nullopt, std::nullopt, std::nullopt) | |
| 174 | 174 | {} |
| 175 | 175 | virtual ~TopLevel() = default; |
| 176 | 176 | |
| 177 | 177 | private: |
| 178 | 178 | double free; |
| 179 | - double intersection; | |
| 180 | - ClassMemberConstraints intersection_constraint; | |
| 181 | - double max; | |
| 182 | - ClassMemberConstraints max_constraint; | |
| 183 | 179 | double min; |
| 184 | 180 | ClassMemberConstraints min_constraint; |
| 181 | + double max; | |
| 182 | + ClassMemberConstraints max_constraint; | |
| 185 | 183 | double minmax; |
| 186 | 184 | ClassMemberConstraints minmax_constraint; |
| 187 | - double min_max_intersection; | |
| 188 | - ClassMemberConstraints min_max_intersection_constraint; | |
| 189 | - double min_max_union; | |
| 190 | 185 | double top_level_union; |
| 191 | 186 | ClassMemberConstraints union_constraint; |
| 187 | + double min_max_union; | |
| 188 | + double intersection; | |
| 189 | + ClassMemberConstraints intersection_constraint; | |
| 190 | + double min_max_intersection; | |
| 191 | + ClassMemberConstraints min_max_intersection_constraint; | |
| 192 | 192 | |
| 193 | 193 | public: |
| 194 | 194 | const double & get_free() const { return free; } |
| 195 | 195 | double & get_mutable_free() { return free; } |
| 196 | 196 | void set_free(const double & value) { this->free = value; } |
| 197 | 197 | |
| 198 | - const double & get_intersection() const { return intersection; } | |
| 199 | - double & get_mutable_intersection() { return intersection; } | |
| 200 | - void set_intersection(const double & value) { CheckConstraint("intersection", intersection_constraint, value); this->intersection = value; } | |
| 198 | + const double & get_min() const { return min; } | |
| 199 | + double & get_mutable_min() { return min; } | |
| 200 | + void set_min(const double & value) { CheckConstraint("min", min_constraint, value); this->min = value; } | |
| 201 | 201 | |
| 202 | 202 | const double & get_max() const { return max; } |
| 203 | 203 | double & get_mutable_max() { return max; } |
| 204 | 204 | void set_max(const double & value) { CheckConstraint("max", max_constraint, value); this->max = value; } |
| 205 | 205 | |
| 206 | - const double & get_min() const { return min; } | |
| 207 | - double & get_mutable_min() { return min; } | |
| 208 | - void set_min(const double & value) { CheckConstraint("min", min_constraint, value); this->min = value; } | |
| 209 | - | |
| 210 | 206 | const double & get_minmax() const { return minmax; } |
| 211 | 207 | double & get_mutable_minmax() { return minmax; } |
| 212 | 208 | void set_minmax(const double & value) { CheckConstraint("minmax", minmax_constraint, value); this->minmax = value; } |
| 213 | 209 | |
| 214 | - const double & get_min_max_intersection() const { return min_max_intersection; } | |
| 215 | - double & get_mutable_min_max_intersection() { return min_max_intersection; } | |
| 216 | - void set_min_max_intersection(const double & value) { CheckConstraint("min_max_intersection", min_max_intersection_constraint, value); this->min_max_intersection = value; } | |
| 210 | + const double & get_top_level_union() const { return top_level_union; } | |
| 211 | + double & get_mutable_top_level_union() { return top_level_union; } | |
| 212 | + void set_top_level_union(const double & value) { CheckConstraint("top_level_union", union_constraint, value); this->top_level_union = value; } | |
| 217 | 213 | |
| 218 | 214 | const double & get_min_max_union() const { return min_max_union; } |
| 219 | 215 | double & get_mutable_min_max_union() { return min_max_union; } |
| 220 | 216 | void set_min_max_union(const double & value) { this->min_max_union = value; } |
| 221 | 217 | |
| 222 | - const double & get_top_level_union() const { return top_level_union; } | |
| 223 | - double & get_mutable_top_level_union() { return top_level_union; } | |
| 224 | - void set_top_level_union(const double & value) { CheckConstraint("top_level_union", union_constraint, value); this->top_level_union = value; } | |
| 218 | + const double & get_intersection() const { return intersection; } | |
| 219 | + double & get_mutable_intersection() { return intersection; } | |
| 220 | + void set_intersection(const double & value) { CheckConstraint("intersection", intersection_constraint, value); this->intersection = value; } | |
| 221 | + | |
| 222 | + const double & get_min_max_intersection() const { return min_max_intersection; } | |
| 223 | + double & get_mutable_min_max_intersection() { return min_max_intersection; } | |
| 224 | + void set_min_max_intersection(const double & value) { CheckConstraint("min_max_intersection", min_max_intersection_constraint, value); this->min_max_intersection = value; } | |
| 225 | 225 | }; |
| 226 | 226 | } |
| 227 | 227 | |
| @@ -231,24 +231,24 @@ namespace quicktype { | ||
| 231 | 231 | |
| 232 | 232 | inline void from_json(const json & j, TopLevel& x) { |
| 233 | 233 | x.set_free(j.at("free").get<double>()); |
| 234 | - x.set_intersection(j.at("intersection").get<double>()); | |
| 235 | - x.set_max(j.at("max").get<double>()); | |
| 236 | 234 | x.set_min(j.at("min").get<double>()); |
| 235 | + x.set_max(j.at("max").get<double>()); | |
| 237 | 236 | x.set_minmax(j.at("minmax").get<double>()); |
| 238 | - x.set_min_max_intersection(j.at("minMaxIntersection").get<double>()); | |
| 239 | - x.set_min_max_union(j.at("minMaxUnion").get<double>()); | |
| 240 | 237 | x.set_top_level_union(j.at("union").get<double>()); |
| 238 | + x.set_min_max_union(j.at("minMaxUnion").get<double>()); | |
| 239 | + x.set_intersection(j.at("intersection").get<double>()); | |
| 240 | + x.set_min_max_intersection(j.at("minMaxIntersection").get<double>()); | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | inline void to_json(json & j, const TopLevel & x) { |
| 244 | 244 | j = json::object(); |
| 245 | 245 | j["free"] = x.get_free(); |
| 246 | - j["intersection"] = x.get_intersection(); | |
| 247 | - j["max"] = x.get_max(); | |
| 248 | 246 | j["min"] = x.get_min(); |
| 247 | + j["max"] = x.get_max(); | |
| 249 | 248 | j["minmax"] = x.get_minmax(); |
| 250 | - j["minMaxIntersection"] = x.get_min_max_intersection(); | |
| 251 | - j["minMaxUnion"] = x.get_min_max_union(); | |
| 252 | 249 | j["union"] = x.get_top_level_union(); |
| 250 | + j["minMaxUnion"] = x.get_min_max_union(); | |
| 251 | + j["intersection"] = x.get_intersection(); | |
| 252 | + j["minMaxIntersection"] = x.get_min_max_intersection(); | |
| 253 | 253 | } |
| 254 | 254 | } |
Mschema-csharp-recordsdefault / QuickType.cs+13 −13
| @@ -28,32 +28,32 @@ namespace QuickType | ||
| 28 | 28 | [JsonProperty("free", Required = Required.Always)] |
| 29 | 29 | public double Free { get; set; } |
| 30 | 30 | |
| 31 | - [JsonProperty("intersection", Required = Required.Always)] | |
| 32 | - [JsonConverter(typeof(PurpleMinMaxValueCheckConverter))] | |
| 33 | - public double Intersection { get; set; } | |
| 31 | + [JsonProperty("min", Required = Required.Always)] | |
| 32 | + [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] | |
| 33 | + public double Min { get; set; } | |
| 34 | 34 | |
| 35 | 35 | [JsonProperty("max", Required = Required.Always)] |
| 36 | 36 | [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] |
| 37 | 37 | public double Max { get; set; } |
| 38 | 38 | |
| 39 | - [JsonProperty("min", Required = Required.Always)] | |
| 40 | - [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] | |
| 41 | - public double Min { get; set; } | |
| 42 | - | |
| 43 | 39 | [JsonProperty("minmax", Required = Required.Always)] |
| 44 | 40 | [JsonConverter(typeof(StickyMinMaxValueCheckConverter))] |
| 45 | 41 | public double Minmax { get; set; } |
| 46 | 42 | |
| 47 | - [JsonProperty("minMaxIntersection", Required = Required.Always)] | |
| 48 | - [JsonConverter(typeof(StickyMinMaxValueCheckConverter))] | |
| 49 | - public double MinMaxIntersection { get; set; } | |
| 43 | + [JsonProperty("union", Required = Required.Always)] | |
| 44 | + [JsonConverter(typeof(IndigoMinMaxValueCheckConverter))] | |
| 45 | + public double Union { get; set; } | |
| 50 | 46 | |
| 51 | 47 | [JsonProperty("minMaxUnion", Required = Required.Always)] |
| 52 | 48 | public double MinMaxUnion { get; set; } |
| 53 | 49 | |
| 54 | - [JsonProperty("union", Required = Required.Always)] | |
| 55 | - [JsonConverter(typeof(IndigoMinMaxValueCheckConverter))] | |
| 56 | - public double Union { get; set; } | |
| 50 | + [JsonProperty("intersection", Required = Required.Always)] | |
| 51 | + [JsonConverter(typeof(PurpleMinMaxValueCheckConverter))] | |
| 52 | + public double Intersection { get; set; } | |
| 53 | + | |
| 54 | + [JsonProperty("minMaxIntersection", Required = Required.Always)] | |
| 55 | + [JsonConverter(typeof(StickyMinMaxValueCheckConverter))] | |
| 56 | + public double MinMaxIntersection { get; set; } | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public partial record TopLevel |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+14 −14
| @@ -27,38 +27,38 @@ namespace QuickType | ||
| 27 | 27 | public double Free { get; set; } |
| 28 | 28 | |
| 29 | 29 | [JsonRequired] |
| 30 | - [JsonPropertyName("intersection")] | |
| 31 | - [JsonConverter(typeof(PurpleMinMaxValueCheckConverter))] | |
| 32 | - public double Intersection { get; set; } | |
| 30 | + [JsonPropertyName("min")] | |
| 31 | + [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] | |
| 32 | + public double Min { get; set; } | |
| 33 | 33 | |
| 34 | 34 | [JsonRequired] |
| 35 | 35 | [JsonPropertyName("max")] |
| 36 | 36 | [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] |
| 37 | 37 | public double Max { get; set; } |
| 38 | 38 | |
| 39 | - [JsonRequired] | |
| 40 | - [JsonPropertyName("min")] | |
| 41 | - [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] | |
| 42 | - public double Min { get; set; } | |
| 43 | - | |
| 44 | 39 | [JsonRequired] |
| 45 | 40 | [JsonPropertyName("minmax")] |
| 46 | 41 | [JsonConverter(typeof(StickyMinMaxValueCheckConverter))] |
| 47 | 42 | public double Minmax { get; set; } |
| 48 | 43 | |
| 49 | 44 | [JsonRequired] |
| 50 | - [JsonPropertyName("minMaxIntersection")] | |
| 51 | - [JsonConverter(typeof(StickyMinMaxValueCheckConverter))] | |
| 52 | - public double MinMaxIntersection { get; set; } | |
| 45 | + [JsonPropertyName("union")] | |
| 46 | + [JsonConverter(typeof(IndigoMinMaxValueCheckConverter))] | |
| 47 | + public double Union { get; set; } | |
| 53 | 48 | |
| 54 | 49 | [JsonRequired] |
| 55 | 50 | [JsonPropertyName("minMaxUnion")] |
| 56 | 51 | public double MinMaxUnion { get; set; } |
| 57 | 52 | |
| 58 | 53 | [JsonRequired] |
| 59 | - [JsonPropertyName("union")] | |
| 60 | - [JsonConverter(typeof(IndigoMinMaxValueCheckConverter))] | |
| 61 | - public double Union { get; set; } | |
| 54 | + [JsonPropertyName("intersection")] | |
| 55 | + [JsonConverter(typeof(PurpleMinMaxValueCheckConverter))] | |
| 56 | + public double Intersection { get; set; } | |
| 57 | + | |
| 58 | + [JsonRequired] | |
| 59 | + [JsonPropertyName("minMaxIntersection")] | |
| 60 | + [JsonConverter(typeof(StickyMinMaxValueCheckConverter))] | |
| 61 | + public double MinMaxIntersection { get; set; } | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | public partial class TopLevel |
Mschema-csharpdefault / QuickType.cs+13 −13
| @@ -28,32 +28,32 @@ namespace QuickType | ||
| 28 | 28 | [JsonProperty("free", Required = Required.Always)] |
| 29 | 29 | public double Free { get; set; } |
| 30 | 30 | |
| 31 | - [JsonProperty("intersection", Required = Required.Always)] | |
| 32 | - [JsonConverter(typeof(PurpleMinMaxValueCheckConverter))] | |
| 33 | - public double Intersection { get; set; } | |
| 31 | + [JsonProperty("min", Required = Required.Always)] | |
| 32 | + [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] | |
| 33 | + public double Min { get; set; } | |
| 34 | 34 | |
| 35 | 35 | [JsonProperty("max", Required = Required.Always)] |
| 36 | 36 | [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] |
| 37 | 37 | public double Max { get; set; } |
| 38 | 38 | |
| 39 | - [JsonProperty("min", Required = Required.Always)] | |
| 40 | - [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] | |
| 41 | - public double Min { get; set; } | |
| 42 | - | |
| 43 | 39 | [JsonProperty("minmax", Required = Required.Always)] |
| 44 | 40 | [JsonConverter(typeof(StickyMinMaxValueCheckConverter))] |
| 45 | 41 | public double Minmax { get; set; } |
| 46 | 42 | |
| 47 | - [JsonProperty("minMaxIntersection", Required = Required.Always)] | |
| 48 | - [JsonConverter(typeof(StickyMinMaxValueCheckConverter))] | |
| 49 | - public double MinMaxIntersection { get; set; } | |
| 43 | + [JsonProperty("union", Required = Required.Always)] | |
| 44 | + [JsonConverter(typeof(IndigoMinMaxValueCheckConverter))] | |
| 45 | + public double Union { get; set; } | |
| 50 | 46 | |
| 51 | 47 | [JsonProperty("minMaxUnion", Required = Required.Always)] |
| 52 | 48 | public double MinMaxUnion { get; set; } |
| 53 | 49 | |
| 54 | - [JsonProperty("union", Required = Required.Always)] | |
| 55 | - [JsonConverter(typeof(IndigoMinMaxValueCheckConverter))] | |
| 56 | - public double Union { get; set; } | |
| 50 | + [JsonProperty("intersection", Required = Required.Always)] | |
| 51 | + [JsonConverter(typeof(PurpleMinMaxValueCheckConverter))] | |
| 52 | + public double Intersection { get; set; } | |
| 53 | + | |
| 54 | + [JsonProperty("minMaxIntersection", Required = Required.Always)] | |
| 55 | + [JsonConverter(typeof(StickyMinMaxValueCheckConverter))] | |
| 56 | + public double MinMaxIntersection { get; set; } | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public partial class TopLevel |
Mschema-dartdefault / TopLevel.dart+16 −16
| @@ -10,44 +10,44 @@ String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | ||
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | 12 | final double free; |
| 13 | - final double intersection; | |
| 14 | - final double max; | |
| 15 | 13 | final double min; |
| 14 | + final double max; | |
| 16 | 15 | final double minmax; |
| 17 | - final double minMaxIntersection; | |
| 18 | - final double minMaxUnion; | |
| 19 | 16 | final double union; |
| 17 | + final double minMaxUnion; | |
| 18 | + final double intersection; | |
| 19 | + final double minMaxIntersection; | |
| 20 | 20 | |
| 21 | 21 | TopLevel({ |
| 22 | 22 | required this.free, |
| 23 | - required this.intersection, | |
| 24 | - required this.max, | |
| 25 | 23 | required this.min, |
| 24 | + required this.max, | |
| 26 | 25 | required this.minmax, |
| 27 | - required this.minMaxIntersection, | |
| 28 | - required this.minMaxUnion, | |
| 29 | 26 | required this.union, |
| 27 | + required this.minMaxUnion, | |
| 28 | + required this.intersection, | |
| 29 | + required this.minMaxIntersection, | |
| 30 | 30 | }); |
| 31 | 31 | |
| 32 | 32 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 33 | 33 | free: json["free"]?.toDouble(), |
| 34 | - intersection: json["intersection"]?.toDouble(), | |
| 35 | - max: json["max"]?.toDouble(), | |
| 36 | 34 | min: json["min"]?.toDouble(), |
| 35 | + max: json["max"]?.toDouble(), | |
| 37 | 36 | minmax: json["minmax"]?.toDouble(), |
| 38 | - minMaxIntersection: json["minMaxIntersection"]?.toDouble(), | |
| 39 | - minMaxUnion: json["minMaxUnion"]?.toDouble(), | |
| 40 | 37 | union: json["union"]?.toDouble(), |
| 38 | + minMaxUnion: json["minMaxUnion"]?.toDouble(), | |
| 39 | + intersection: json["intersection"]?.toDouble(), | |
| 40 | + minMaxIntersection: json["minMaxIntersection"]?.toDouble(), | |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | Map<String, dynamic> toJson() => { |
| 44 | 44 | "free": free, |
| 45 | - "intersection": intersection, | |
| 46 | - "max": max, | |
| 47 | 45 | "min": min, |
| 46 | + "max": max, | |
| 48 | 47 | "minmax": minmax, |
| 49 | - "minMaxIntersection": minMaxIntersection, | |
| 50 | - "minMaxUnion": minMaxUnion, | |
| 51 | 48 | "union": union, |
| 49 | + "minMaxUnion": minMaxUnion, | |
| 50 | + "intersection": intersection, | |
| 51 | + "minMaxIntersection": minMaxIntersection, | |
| 52 | 52 | }; |
| 53 | 53 | } |
Mschema-elixirdefault / QuickType.ex+14 −14
| @@ -6,30 +6,30 @@ | ||
| 6 | 6 | # Encode into a JSON string: TopLevel.to_json(struct) |
| 7 | 7 | |
| 8 | 8 | defmodule TopLevel do |
| 9 | - @enforce_keys [:free, :intersection, :max, :min, :minmax, :min_max_intersection, :min_max_union, :union] | |
| 10 | - defstruct [:free, :intersection, :max, :min, :minmax, :min_max_intersection, :min_max_union, :union] | |
| 9 | + @enforce_keys [:free, :min, :max, :minmax, :union, :min_max_union, :intersection, :min_max_intersection] | |
| 10 | + defstruct [:free, :min, :max, :minmax, :union, :min_max_union, :intersection, :min_max_intersection] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | 13 | free: float(), |
| 14 | - intersection: float(), | |
| 15 | - max: float(), | |
| 16 | 14 | min: float(), |
| 15 | + max: float(), | |
| 17 | 16 | minmax: float(), |
| 18 | - min_max_intersection: float(), | |
| 17 | + union: float(), | |
| 19 | 18 | min_max_union: float(), |
| 20 | - union: float() | |
| 19 | + intersection: float(), | |
| 20 | + min_max_intersection: float() | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | def from_map(m) do |
| 24 | 24 | %TopLevel{ |
| 25 | 25 | free: m["free"], |
| 26 | - intersection: m["intersection"], | |
| 27 | - max: m["max"], | |
| 28 | 26 | min: m["min"], |
| 27 | + max: m["max"], | |
| 29 | 28 | minmax: m["minmax"], |
| 30 | - min_max_intersection: m["minMaxIntersection"], | |
| 31 | - min_max_union: m["minMaxUnion"], | |
| 32 | 29 | union: m["union"], |
| 30 | + min_max_union: m["minMaxUnion"], | |
| 31 | + intersection: m["intersection"], | |
| 32 | + min_max_intersection: m["minMaxIntersection"], | |
| 33 | 33 | } |
| 34 | 34 | end |
| 35 | 35 | |
| @@ -42,13 +42,13 @@ defmodule TopLevel do | ||
| 42 | 42 | def to_map(struct) do |
| 43 | 43 | %{ |
| 44 | 44 | "free" => struct.free, |
| 45 | - "intersection" => struct.intersection, | |
| 46 | - "max" => struct.max, | |
| 47 | 45 | "min" => struct.min, |
| 46 | + "max" => struct.max, | |
| 48 | 47 | "minmax" => struct.minmax, |
| 49 | - "minMaxIntersection" => struct.min_max_intersection, | |
| 50 | - "minMaxUnion" => struct.min_max_union, | |
| 51 | 48 | "union" => struct.union, |
| 49 | + "minMaxUnion" => struct.min_max_union, | |
| 50 | + "intersection" => struct.intersection, | |
| 51 | + "minMaxIntersection" => struct.min_max_intersection, | |
| 52 | 52 | } |
| 53 | 53 | end |
Mschema-elmdefault / QuickType.elm+12 −12
| @@ -24,13 +24,13 @@ import Dict exposing (Dict) | ||
| 24 | 24 | |
| 25 | 25 | type alias QuickType = |
| 26 | 26 | { free : Float |
| 27 | - , intersection : Float | |
| 28 | - , max : Float | |
| 29 | 27 | , min : Float |
| 28 | + , max : Float | |
| 30 | 29 | , minmax : Float |
| 31 | - , minMaxIntersection : Float | |
| 32 | - , minMaxUnion : Float | |
| 33 | 30 | , union : Float |
| 31 | + , minMaxUnion : Float | |
| 32 | + , intersection : Float | |
| 33 | + , minMaxIntersection : Float | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | -- decoders and encoders |
| @@ -42,25 +42,25 @@ quickType : Jdec.Decoder QuickType | ||
| 42 | 42 | quickType = |
| 43 | 43 | Jdec.succeed QuickType |
| 44 | 44 | |> Jpipe.required "free" Jdec.float |
| 45 | - |> Jpipe.required "intersection" Jdec.float | |
| 46 | - |> Jpipe.required "max" Jdec.float | |
| 47 | 45 | |> Jpipe.required "min" Jdec.float |
| 46 | + |> Jpipe.required "max" Jdec.float | |
| 48 | 47 | |> Jpipe.required "minmax" Jdec.float |
| 49 | - |> Jpipe.required "minMaxIntersection" Jdec.float | |
| 50 | - |> Jpipe.required "minMaxUnion" Jdec.float | |
| 51 | 48 | |> Jpipe.required "union" Jdec.float |
| 49 | + |> Jpipe.required "minMaxUnion" Jdec.float | |
| 50 | + |> Jpipe.required "intersection" Jdec.float | |
| 51 | + |> Jpipe.required "minMaxIntersection" Jdec.float | |
| 52 | 52 | |
| 53 | 53 | encodeQuickType : QuickType -> Jenc.Value |
| 54 | 54 | encodeQuickType x = |
| 55 | 55 | Jenc.object |
| 56 | 56 | [ ("free", Jenc.float x.free) |
| 57 | - , ("intersection", Jenc.float x.intersection) | |
| 58 | - , ("max", Jenc.float x.max) | |
| 59 | 57 | , ("min", Jenc.float x.min) |
| 58 | + , ("max", Jenc.float x.max) | |
| 60 | 59 | , ("minmax", Jenc.float x.minmax) |
| 61 | - , ("minMaxIntersection", Jenc.float x.minMaxIntersection) | |
| 62 | - , ("minMaxUnion", Jenc.float x.minMaxUnion) | |
| 63 | 60 | , ("union", Jenc.float x.union) |
| 61 | + , ("minMaxUnion", Jenc.float x.minMaxUnion) | |
| 62 | + , ("intersection", Jenc.float x.intersection) | |
| 63 | + , ("minMaxIntersection", Jenc.float x.minMaxIntersection) | |
| 64 | 64 | ] |
| 65 | 65 | |
| 66 | 66 | --- encoder helpers |
Mschema-flowdefault / TopLevel.js+8 −8
| @@ -11,13 +11,13 @@ | ||
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | 13 | free: number; |
| 14 | - intersection: number; | |
| 15 | - max: number; | |
| 16 | 14 | min: number; |
| 15 | + max: number; | |
| 17 | 16 | minmax: number; |
| 18 | - minMaxIntersection: number; | |
| 19 | - minMaxUnion: number; | |
| 20 | 17 | union: number; |
| 18 | + minMaxUnion: number; | |
| 19 | + intersection: number; | |
| 20 | + minMaxIntersection: number; | |
| 21 | 21 | [property: string]: mixed; |
| 22 | 22 | }; |
| 23 | 23 | |
| @@ -187,13 +187,13 @@ function r(name: string) { | ||
| 187 | 187 | const typeMap: any = { |
| 188 | 188 | "TopLevel": o([ |
| 189 | 189 | { json: "free", js: "free", typ: 3.14 }, |
| 190 | - { json: "intersection", js: "intersection", typ: 3.14 }, | |
| 191 | - { json: "max", js: "max", typ: 3.14 }, | |
| 192 | 190 | { json: "min", js: "min", typ: 3.14 }, |
| 191 | + { json: "max", js: "max", typ: 3.14 }, | |
| 193 | 192 | { json: "minmax", js: "minmax", typ: 3.14 }, |
| 194 | - { json: "minMaxIntersection", js: "minMaxIntersection", typ: 3.14 }, | |
| 195 | - { json: "minMaxUnion", js: "minMaxUnion", typ: 3.14 }, | |
| 196 | 193 | { json: "union", js: "union", typ: 3.14 }, |
| 194 | + { json: "minMaxUnion", js: "minMaxUnion", typ: 3.14 }, | |
| 195 | + { json: "intersection", js: "intersection", typ: 3.14 }, | |
| 196 | + { json: "minMaxIntersection", js: "minMaxIntersection", typ: 3.14 }, | |
| 197 | 197 | ], "any"), |
| 198 | 198 | }; |
Mschema-golangdefault / quicktype.go+4 −4
| @@ -20,11 +20,11 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 20 | 20 | |
| 21 | 21 | type TopLevel struct { |
| 22 | 22 | Free float64 `json:"free"` |
| 23 | - Intersection float64 `json:"intersection"` | |
| 24 | - Max float64 `json:"max"` | |
| 25 | 23 | Min float64 `json:"min"` |
| 24 | + Max float64 `json:"max"` | |
| 26 | 25 | Minmax float64 `json:"minmax"` |
| 27 | - MinMaxIntersection float64 `json:"minMaxIntersection"` | |
| 28 | - MinMaxUnion float64 `json:"minMaxUnion"` | |
| 29 | 26 | Union float64 `json:"union"` |
| 27 | + MinMaxUnion float64 `json:"minMaxUnion"` | |
| 28 | + Intersection float64 `json:"intersection"` | |
| 29 | + MinMaxIntersection float64 `json:"minMaxIntersection"` | |
| 30 | 30 | } |
Mschema-haskelldefault / QuickType.hs+13 −13
| @@ -14,38 +14,38 @@ import Data.Text (Text) | ||
| 14 | 14 | |
| 15 | 15 | data QuickType = QuickType |
| 16 | 16 | { freeQuickType :: Float |
| 17 | - , intersectionQuickType :: Float | |
| 18 | - , maxQuickType :: Float | |
| 19 | 17 | , minQuickType :: Float |
| 18 | + , maxQuickType :: Float | |
| 20 | 19 | , minmaxQuickType :: Float |
| 21 | - , minMaxIntersectionQuickType :: Float | |
| 22 | - , minMaxUnionQuickType :: Float | |
| 23 | 20 | , unionQuickType :: Float |
| 21 | + , minMaxUnionQuickType :: Float | |
| 22 | + , intersectionQuickType :: Float | |
| 23 | + , minMaxIntersectionQuickType :: Float | |
| 24 | 24 | } deriving (Show) |
| 25 | 25 | |
| 26 | 26 | decodeTopLevel :: ByteString -> Maybe QuickType |
| 27 | 27 | decodeTopLevel = decode |
| 28 | 28 | |
| 29 | 29 | instance ToJSON QuickType where |
| 30 | - toJSON (QuickType freeQuickType intersectionQuickType maxQuickType minQuickType minmaxQuickType minMaxIntersectionQuickType minMaxUnionQuickType unionQuickType) = | |
| 30 | + toJSON (QuickType freeQuickType minQuickType maxQuickType minmaxQuickType unionQuickType minMaxUnionQuickType intersectionQuickType minMaxIntersectionQuickType) = | |
| 31 | 31 | object |
| 32 | 32 | [ "free" .= freeQuickType |
| 33 | - , "intersection" .= intersectionQuickType | |
| 34 | - , "max" .= maxQuickType | |
| 35 | 33 | , "min" .= minQuickType |
| 34 | + , "max" .= maxQuickType | |
| 36 | 35 | , "minmax" .= minmaxQuickType |
| 37 | - , "minMaxIntersection" .= minMaxIntersectionQuickType | |
| 38 | - , "minMaxUnion" .= minMaxUnionQuickType | |
| 39 | 36 | , "union" .= unionQuickType |
| 37 | + , "minMaxUnion" .= minMaxUnionQuickType | |
| 38 | + , "intersection" .= intersectionQuickType | |
| 39 | + , "minMaxIntersection" .= minMaxIntersectionQuickType | |
| 40 | 40 | ] |
| 41 | 41 | |
| 42 | 42 | instance FromJSON QuickType where |
| 43 | 43 | parseJSON (Object v) = QuickType |
| 44 | 44 | <$> v .: "free" |
| 45 | - <*> v .: "intersection" | |
| 46 | - <*> v .: "max" | |
| 47 | 45 | <*> v .: "min" |
| 46 | + <*> v .: "max" | |
| 48 | 47 | <*> v .: "minmax" |
| 49 | - <*> v .: "minMaxIntersection" | |
| 50 | - <*> v .: "minMaxUnion" | |
| 51 | 48 | <*> v .: "union" |
| 49 | + <*> v .: "minMaxUnion" | |
| 50 | + <*> v .: "intersection" | |
| 51 | + <*> v .: "minMaxIntersection" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+21 −21
| @@ -4,51 +4,51 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | 6 | private double free; |
| 7 | - private double intersection; | |
| 8 | - private double max; | |
| 9 | 7 | private double min; |
| 8 | + private double max; | |
| 10 | 9 | private double minmax; |
| 11 | - private double minMaxIntersection; | |
| 12 | - private double minMaxUnion; | |
| 13 | 10 | private double union; |
| 11 | + private double minMaxUnion; | |
| 12 | + private double intersection; | |
| 13 | + private double minMaxIntersection; | |
| 14 | 14 | |
| 15 | 15 | @JsonProperty("free") |
| 16 | 16 | public double getFree() { return free; } |
| 17 | 17 | @JsonProperty("free") |
| 18 | 18 | public void setFree(double value) { this.free = value; } |
| 19 | 19 | |
| 20 | - @JsonProperty("intersection") | |
| 21 | - public double getIntersection() { return intersection; } | |
| 22 | - @JsonProperty("intersection") | |
| 23 | - public void setIntersection(double value) { this.intersection = value; } | |
| 20 | + @JsonProperty("min") | |
| 21 | + public double getMin() { return min; } | |
| 22 | + @JsonProperty("min") | |
| 23 | + public void setMin(double value) { this.min = value; } | |
| 24 | 24 | |
| 25 | 25 | @JsonProperty("max") |
| 26 | 26 | public double getMax() { return max; } |
| 27 | 27 | @JsonProperty("max") |
| 28 | 28 | public void setMax(double value) { this.max = value; } |
| 29 | 29 | |
| 30 | - @JsonProperty("min") | |
| 31 | - public double getMin() { return min; } | |
| 32 | - @JsonProperty("min") | |
| 33 | - public void setMin(double value) { this.min = value; } | |
| 34 | - | |
| 35 | 30 | @JsonProperty("minmax") |
| 36 | 31 | public double getMinmax() { return minmax; } |
| 37 | 32 | @JsonProperty("minmax") |
| 38 | 33 | public void setMinmax(double value) { this.minmax = value; } |
| 39 | 34 | |
| 40 | - @JsonProperty("minMaxIntersection") | |
| 41 | - public double getMinMaxIntersection() { return minMaxIntersection; } | |
| 42 | - @JsonProperty("minMaxIntersection") | |
| 43 | - public void setMinMaxIntersection(double value) { this.minMaxIntersection = value; } | |
| 35 | + @JsonProperty("union") | |
| 36 | + public double getUnion() { return union; } | |
| 37 | + @JsonProperty("union") | |
| 38 | + public void setUnion(double value) { this.union = value; } | |
| 44 | 39 | |
| 45 | 40 | @JsonProperty("minMaxUnion") |
| 46 | 41 | public double getMinMaxUnion() { return minMaxUnion; } |
| 47 | 42 | @JsonProperty("minMaxUnion") |
| 48 | 43 | public void setMinMaxUnion(double value) { this.minMaxUnion = value; } |
| 49 | 44 | |
| 50 | - @JsonProperty("union") | |
| 51 | - public double getUnion() { return union; } | |
| 52 | - @JsonProperty("union") | |
| 53 | - public void setUnion(double value) { this.union = value; } | |
| 45 | + @JsonProperty("intersection") | |
| 46 | + public double getIntersection() { return intersection; } | |
| 47 | + @JsonProperty("intersection") | |
| 48 | + public void setIntersection(double value) { this.intersection = value; } | |
| 49 | + | |
| 50 | + @JsonProperty("minMaxIntersection") | |
| 51 | + public double getMinMaxIntersection() { return minMaxIntersection; } | |
| 52 | + @JsonProperty("minMaxIntersection") | |
| 53 | + public void setMinMaxIntersection(double value) { this.minMaxIntersection = value; } | |
| 54 | 54 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+21 −21
| @@ -4,51 +4,51 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | 6 | private double free; |
| 7 | - private double intersection; | |
| 8 | - private double max; | |
| 9 | 7 | private double min; |
| 8 | + private double max; | |
| 10 | 9 | private double minmax; |
| 11 | - private double minMaxIntersection; | |
| 12 | - private double minMaxUnion; | |
| 13 | 10 | private double union; |
| 11 | + private double minMaxUnion; | |
| 12 | + private double intersection; | |
| 13 | + private double minMaxIntersection; | |
| 14 | 14 | |
| 15 | 15 | @JsonProperty("free") |
| 16 | 16 | public double getFree() { return free; } |
| 17 | 17 | @JsonProperty("free") |
| 18 | 18 | public void setFree(double value) { this.free = value; } |
| 19 | 19 | |
| 20 | - @JsonProperty("intersection") | |
| 21 | - public double getIntersection() { return intersection; } | |
| 22 | - @JsonProperty("intersection") | |
| 23 | - public void setIntersection(double value) { this.intersection = value; } | |
| 20 | + @JsonProperty("min") | |
| 21 | + public double getMin() { return min; } | |
| 22 | + @JsonProperty("min") | |
| 23 | + public void setMin(double value) { this.min = value; } | |
| 24 | 24 | |
| 25 | 25 | @JsonProperty("max") |
| 26 | 26 | public double getMax() { return max; } |
| 27 | 27 | @JsonProperty("max") |
| 28 | 28 | public void setMax(double value) { this.max = value; } |
| 29 | 29 | |
| 30 | - @JsonProperty("min") | |
| 31 | - public double getMin() { return min; } | |
| 32 | - @JsonProperty("min") | |
| 33 | - public void setMin(double value) { this.min = value; } | |
| 34 | - | |
| 35 | 30 | @JsonProperty("minmax") |
| 36 | 31 | public double getMinmax() { return minmax; } |
| 37 | 32 | @JsonProperty("minmax") |
| 38 | 33 | public void setMinmax(double value) { this.minmax = value; } |
| 39 | 34 | |
| 40 | - @JsonProperty("minMaxIntersection") | |
| 41 | - public double getMinMaxIntersection() { return minMaxIntersection; } | |
| 42 | - @JsonProperty("minMaxIntersection") | |
| 43 | - public void setMinMaxIntersection(double value) { this.minMaxIntersection = value; } | |
| 35 | + @JsonProperty("union") | |
| 36 | + public double getUnion() { return union; } | |
| 37 | + @JsonProperty("union") | |
| 38 | + public void setUnion(double value) { this.union = value; } | |
| 44 | 39 | |
| 45 | 40 | @JsonProperty("minMaxUnion") |
| 46 | 41 | public double getMinMaxUnion() { return minMaxUnion; } |
| 47 | 42 | @JsonProperty("minMaxUnion") |
| 48 | 43 | public void setMinMaxUnion(double value) { this.minMaxUnion = value; } |
| 49 | 44 | |
| 50 | - @JsonProperty("union") | |
| 51 | - public double getUnion() { return union; } | |
| 52 | - @JsonProperty("union") | |
| 53 | - public void setUnion(double value) { this.union = value; } | |
| 45 | + @JsonProperty("intersection") | |
| 46 | + public double getIntersection() { return intersection; } | |
| 47 | + @JsonProperty("intersection") | |
| 48 | + public void setIntersection(double value) { this.intersection = value; } | |
| 49 | + | |
| 50 | + @JsonProperty("minMaxIntersection") | |
| 51 | + public double getMinMaxIntersection() { return minMaxIntersection; } | |
| 52 | + @JsonProperty("minMaxIntersection") | |
| 53 | + public void setMinMaxIntersection(double value) { this.minMaxIntersection = value; } | |
| 54 | 54 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+21 −21
| @@ -4,51 +4,51 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | 6 | private double free; |
| 7 | - private double intersection; | |
| 8 | - private double max; | |
| 9 | 7 | private double min; |
| 8 | + private double max; | |
| 10 | 9 | private double minmax; |
| 11 | - private double minMaxIntersection; | |
| 12 | - private double minMaxUnion; | |
| 13 | 10 | private double union; |
| 11 | + private double minMaxUnion; | |
| 12 | + private double intersection; | |
| 13 | + private double minMaxIntersection; | |
| 14 | 14 | |
| 15 | 15 | @JsonProperty("free") |
| 16 | 16 | public double getFree() { return free; } |
| 17 | 17 | @JsonProperty("free") |
| 18 | 18 | public void setFree(double value) { this.free = value; } |
| 19 | 19 | |
| 20 | - @JsonProperty("intersection") | |
| 21 | - public double getIntersection() { return intersection; } | |
| 22 | - @JsonProperty("intersection") | |
| 23 | - public void setIntersection(double value) { this.intersection = value; } | |
| 20 | + @JsonProperty("min") | |
| 21 | + public double getMin() { return min; } | |
| 22 | + @JsonProperty("min") | |
| 23 | + public void setMin(double value) { this.min = value; } | |
| 24 | 24 | |
| 25 | 25 | @JsonProperty("max") |
| 26 | 26 | public double getMax() { return max; } |
| 27 | 27 | @JsonProperty("max") |
| 28 | 28 | public void setMax(double value) { this.max = value; } |
| 29 | 29 | |
| 30 | - @JsonProperty("min") | |
| 31 | - public double getMin() { return min; } | |
| 32 | - @JsonProperty("min") | |
| 33 | - public void setMin(double value) { this.min = value; } | |
| 34 | - | |
| 35 | 30 | @JsonProperty("minmax") |
| 36 | 31 | public double getMinmax() { return minmax; } |
| 37 | 32 | @JsonProperty("minmax") |
| 38 | 33 | public void setMinmax(double value) { this.minmax = value; } |
| 39 | 34 | |
| 40 | - @JsonProperty("minMaxIntersection") | |
| 41 | - public double getMinMaxIntersection() { return minMaxIntersection; } | |
| 42 | - @JsonProperty("minMaxIntersection") | |
| 43 | - public void setMinMaxIntersection(double value) { this.minMaxIntersection = value; } | |
| 35 | + @JsonProperty("union") | |
| 36 | + public double getUnion() { return union; } | |
| 37 | + @JsonProperty("union") | |
| 38 | + public void setUnion(double value) { this.union = value; } | |
| 44 | 39 | |
| 45 | 40 | @JsonProperty("minMaxUnion") |
| 46 | 41 | public double getMinMaxUnion() { return minMaxUnion; } |
| 47 | 42 | @JsonProperty("minMaxUnion") |
| 48 | 43 | public void setMinMaxUnion(double value) { this.minMaxUnion = value; } |
| 49 | 44 | |
| 50 | - @JsonProperty("union") | |
| 51 | - public double getUnion() { return union; } | |
| 52 | - @JsonProperty("union") | |
| 53 | - public void setUnion(double value) { this.union = value; } | |
| 45 | + @JsonProperty("intersection") | |
| 46 | + public double getIntersection() { return intersection; } | |
| 47 | + @JsonProperty("intersection") | |
| 48 | + public void setIntersection(double value) { this.intersection = value; } | |
| 49 | + | |
| 50 | + @JsonProperty("minMaxIntersection") | |
| 51 | + public double getMinMaxIntersection() { return minMaxIntersection; } | |
| 52 | + @JsonProperty("minMaxIntersection") | |
| 53 | + public void setMinMaxIntersection(double value) { this.minMaxIntersection = value; } | |
| 54 | 54 | } |
Mschema-javascriptdefault / TopLevel.js+4 −4
| @@ -173,13 +173,13 @@ function r(name) { | ||
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | 175 | { json: "free", js: "free", typ: 3.14 }, |
| 176 | - { json: "intersection", js: "intersection", typ: 3.14 }, | |
| 177 | - { json: "max", js: "max", typ: 3.14 }, | |
| 178 | 176 | { json: "min", js: "min", typ: 3.14 }, |
| 177 | + { json: "max", js: "max", typ: 3.14 }, | |
| 179 | 178 | { json: "minmax", js: "minmax", typ: 3.14 }, |
| 180 | - { json: "minMaxIntersection", js: "minMaxIntersection", typ: 3.14 }, | |
| 181 | - { json: "minMaxUnion", js: "minMaxUnion", typ: 3.14 }, | |
| 182 | 179 | { json: "union", js: "union", typ: 3.14 }, |
| 180 | + { json: "minMaxUnion", js: "minMaxUnion", typ: 3.14 }, | |
| 181 | + { json: "intersection", js: "intersection", typ: 3.14 }, | |
| 182 | + { json: "minMaxIntersection", js: "minMaxIntersection", typ: 3.14 }, | |
| 183 | 183 | ], "any"), |
| 184 | 184 | }; |
Mschema-kotlin-jacksondefault / TopLevel.kt+6 −6
| @@ -23,25 +23,25 @@ data class TopLevel ( | ||
| 23 | 23 | val free: Double, |
| 24 | 24 | |
| 25 | 25 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 26 | - val intersection: Double, | |
| 26 | + val min: Double, | |
| 27 | 27 | |
| 28 | 28 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 29 | 29 | val max: Double, |
| 30 | 30 | |
| 31 | - @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 32 | - val min: Double, | |
| 33 | - | |
| 34 | 31 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 35 | 32 | val minmax: Double, |
| 36 | 33 | |
| 37 | 34 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 38 | - val minMaxIntersection: Double, | |
| 35 | + val union: Double, | |
| 39 | 36 | |
| 40 | 37 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 41 | 38 | val minMaxUnion: Double, |
| 42 | 39 | |
| 43 | 40 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 44 | - val union: Double | |
| 41 | + val intersection: Double, | |
| 42 | + | |
| 43 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 44 | + val minMaxIntersection: Double | |
| 45 | 45 | ) { |
| 46 | 46 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+4 −4
| @@ -10,13 +10,13 @@ private val klaxon = Klaxon() | ||
| 10 | 10 | |
| 11 | 11 | data class TopLevel ( |
| 12 | 12 | val free: Double, |
| 13 | - val intersection: Double, | |
| 14 | - val max: Double, | |
| 15 | 13 | val min: Double, |
| 14 | + val max: Double, | |
| 16 | 15 | val minmax: Double, |
| 17 | - val minMaxIntersection: Double, | |
| 16 | + val union: Double, | |
| 18 | 17 | val minMaxUnion: Double, |
| 19 | - val union: Double | |
| 18 | + val intersection: Double, | |
| 19 | + val minMaxIntersection: Double | |
| 20 | 20 | ) { |
| 21 | 21 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-kotlinxdefault / TopLevel.kt+4 −4
| @@ -13,11 +13,11 @@ import kotlinx.serialization.encoding.* | ||
| 13 | 13 | @Serializable |
| 14 | 14 | data class TopLevel ( |
| 15 | 15 | val free: Double, |
| 16 | - val intersection: Double, | |
| 17 | - val max: Double, | |
| 18 | 16 | val min: Double, |
| 17 | + val max: Double, | |
| 19 | 18 | val minmax: Double, |
| 20 | - val minMaxIntersection: Double, | |
| 19 | + val union: Double, | |
| 21 | 20 | val minMaxUnion: Double, |
| 22 | - val union: Double | |
| 21 | + val intersection: Double, | |
| 22 | + val minMaxIntersection: Double | |
| 23 | 23 | ) |
Mschema-phpdefault / TopLevel.php+101 −101
| @@ -5,33 +5,33 @@ declare(strict_types=1); | ||
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | 7 | private float $free; // json:free Required |
| 8 | - private float $intersection; // json:intersection Required | |
| 9 | - private float $max; // json:max Required | |
| 10 | 8 | private float $min; // json:min Required |
| 9 | + private float $max; // json:max Required | |
| 11 | 10 | private float $minmax; // json:minmax Required |
| 12 | - private float $minMaxIntersection; // json:minMaxIntersection Required | |
| 13 | - private float $minMaxUnion; // json:minMaxUnion Required | |
| 14 | 11 | private float $union; // json:union Required |
| 12 | + private float $minMaxUnion; // json:minMaxUnion Required | |
| 13 | + private float $intersection; // json:intersection Required | |
| 14 | + private float $minMaxIntersection; // json:minMaxIntersection Required | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @param float $free |
| 18 | - * @param float $intersection | |
| 19 | - * @param float $max | |
| 20 | 18 | * @param float $min |
| 19 | + * @param float $max | |
| 21 | 20 | * @param float $minmax |
| 22 | - * @param float $minMaxIntersection | |
| 23 | - * @param float $minMaxUnion | |
| 24 | 21 | * @param float $union |
| 22 | + * @param float $minMaxUnion | |
| 23 | + * @param float $intersection | |
| 24 | + * @param float $minMaxIntersection | |
| 25 | 25 | */ |
| 26 | - public function __construct(float $free, float $intersection, float $max, float $min, float $minmax, float $minMaxIntersection, float $minMaxUnion, float $union) { | |
| 26 | + public function __construct(float $free, float $min, float $max, float $minmax, float $union, float $minMaxUnion, float $intersection, float $minMaxIntersection) { | |
| 27 | 27 | $this->free = $free; |
| 28 | - $this->intersection = $intersection; | |
| 29 | - $this->max = $max; | |
| 30 | 28 | $this->min = $min; |
| 29 | + $this->max = $max; | |
| 31 | 30 | $this->minmax = $minmax; |
| 32 | - $this->minMaxIntersection = $minMaxIntersection; | |
| 33 | - $this->minMaxUnion = $minMaxUnion; | |
| 34 | 31 | $this->union = $union; |
| 32 | + $this->minMaxUnion = $minMaxUnion; | |
| 33 | + $this->intersection = $intersection; | |
| 34 | + $this->minMaxIntersection = $minMaxIntersection; | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
| @@ -86,7 +86,7 @@ class TopLevel { | ||
| 86 | 86 | * @throws Exception |
| 87 | 87 | * @return float |
| 88 | 88 | */ |
| 89 | - public static function fromIntersection(float $value): float { | |
| 89 | + public static function fromMin(float $value): float { | |
| 90 | 90 | return $value; /*float*/ |
| 91 | 91 | } |
| 92 | 92 | |
| @@ -94,11 +94,11 @@ class TopLevel { | ||
| 94 | 94 | * @throws Exception |
| 95 | 95 | * @return float |
| 96 | 96 | */ |
| 97 | - public function toIntersection(): float { | |
| 98 | - if (TopLevel::validateIntersection($this->intersection)) { | |
| 99 | - return $this->intersection; /*float*/ | |
| 97 | + public function toMin(): float { | |
| 98 | + if (TopLevel::validateMin($this->min)) { | |
| 99 | + return $this->min; /*float*/ | |
| 100 | 100 | } |
| 101 | - throw new Exception('never get to this TopLevel::intersection'); | |
| 101 | + throw new Exception('never get to this TopLevel::min'); | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| @@ -106,7 +106,7 @@ class TopLevel { | ||
| 106 | 106 | * @return bool |
| 107 | 107 | * @throws Exception |
| 108 | 108 | */ |
| 109 | - public static function validateIntersection(float $value): bool { | |
| 109 | + public static function validateMin(float $value): bool { | |
| 110 | 110 | return true; |
| 111 | 111 | } |
| 112 | 112 | |
| @@ -114,18 +114,18 @@ class TopLevel { | ||
| 114 | 114 | * @throws Exception |
| 115 | 115 | * @return float |
| 116 | 116 | */ |
| 117 | - public function getIntersection(): float { | |
| 118 | - if (TopLevel::validateIntersection($this->intersection)) { | |
| 119 | - return $this->intersection; | |
| 117 | + public function getMin(): float { | |
| 118 | + if (TopLevel::validateMin($this->min)) { | |
| 119 | + return $this->min; | |
| 120 | 120 | } |
| 121 | - throw new Exception('never get to getIntersection TopLevel::intersection'); | |
| 121 | + throw new Exception('never get to getMin TopLevel::min'); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | 125 | * @return float |
| 126 | 126 | */ |
| 127 | - public static function sampleIntersection(): float { | |
| 128 | - return 32.032; /*32:intersection*/ | |
| 127 | + public static function sampleMin(): float { | |
| 128 | + return 32.032; /*32:min*/ | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| @@ -180,7 +180,7 @@ class TopLevel { | ||
| 180 | 180 | * @throws Exception |
| 181 | 181 | * @return float |
| 182 | 182 | */ |
| 183 | - public static function fromMin(float $value): float { | |
| 183 | + public static function fromMinmax(float $value): float { | |
| 184 | 184 | return $value; /*float*/ |
| 185 | 185 | } |
| 186 | 186 | |
| @@ -188,11 +188,11 @@ class TopLevel { | ||
| 188 | 188 | * @throws Exception |
| 189 | 189 | * @return float |
| 190 | 190 | */ |
| 191 | - public function toMin(): float { | |
| 192 | - if (TopLevel::validateMin($this->min)) { | |
| 193 | - return $this->min; /*float*/ | |
| 191 | + public function toMinmax(): float { | |
| 192 | + if (TopLevel::validateMinmax($this->minmax)) { | |
| 193 | + return $this->minmax; /*float*/ | |
| 194 | 194 | } |
| 195 | - throw new Exception('never get to this TopLevel::min'); | |
| 195 | + throw new Exception('never get to this TopLevel::minmax'); | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
| @@ -200,7 +200,7 @@ class TopLevel { | ||
| 200 | 200 | * @return bool |
| 201 | 201 | * @throws Exception |
| 202 | 202 | */ |
| 203 | - public static function validateMin(float $value): bool { | |
| 203 | + public static function validateMinmax(float $value): bool { | |
| 204 | 204 | return true; |
| 205 | 205 | } |
| 206 | 206 | |
| @@ -208,18 +208,18 @@ class TopLevel { | ||
| 208 | 208 | * @throws Exception |
| 209 | 209 | * @return float |
| 210 | 210 | */ |
| 211 | - public function getMin(): float { | |
| 212 | - if (TopLevel::validateMin($this->min)) { | |
| 213 | - return $this->min; | |
| 211 | + public function getMinmax(): float { | |
| 212 | + if (TopLevel::validateMinmax($this->minmax)) { | |
| 213 | + return $this->minmax; | |
| 214 | 214 | } |
| 215 | - throw new Exception('never get to getMin TopLevel::min'); | |
| 215 | + throw new Exception('never get to getMinmax TopLevel::minmax'); | |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
| 219 | 219 | * @return float |
| 220 | 220 | */ |
| 221 | - public static function sampleMin(): float { | |
| 222 | - return 34.034; /*34:min*/ | |
| 221 | + public static function sampleMinmax(): float { | |
| 222 | + return 34.034; /*34:minmax*/ | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
| @@ -227,7 +227,7 @@ class TopLevel { | ||
| 227 | 227 | * @throws Exception |
| 228 | 228 | * @return float |
| 229 | 229 | */ |
| 230 | - public static function fromMinmax(float $value): float { | |
| 230 | + public static function fromUnion(float $value): float { | |
| 231 | 231 | return $value; /*float*/ |
| 232 | 232 | } |
| 233 | 233 | |
| @@ -235,11 +235,11 @@ class TopLevel { | ||
| 235 | 235 | * @throws Exception |
| 236 | 236 | * @return float |
| 237 | 237 | */ |
| 238 | - public function toMinmax(): float { | |
| 239 | - if (TopLevel::validateMinmax($this->minmax)) { | |
| 240 | - return $this->minmax; /*float*/ | |
| 238 | + public function toUnion(): float { | |
| 239 | + if (TopLevel::validateUnion($this->union)) { | |
| 240 | + return $this->union; /*float*/ | |
| 241 | 241 | } |
| 242 | - throw new Exception('never get to this TopLevel::minmax'); | |
| 242 | + throw new Exception('never get to this TopLevel::union'); | |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
| @@ -247,7 +247,7 @@ class TopLevel { | ||
| 247 | 247 | * @return bool |
| 248 | 248 | * @throws Exception |
| 249 | 249 | */ |
| 250 | - public static function validateMinmax(float $value): bool { | |
| 250 | + public static function validateUnion(float $value): bool { | |
| 251 | 251 | return true; |
| 252 | 252 | } |
| 253 | 253 | |
| @@ -255,18 +255,18 @@ class TopLevel { | ||
| 255 | 255 | * @throws Exception |
| 256 | 256 | * @return float |
| 257 | 257 | */ |
| 258 | - public function getMinmax(): float { | |
| 259 | - if (TopLevel::validateMinmax($this->minmax)) { | |
| 260 | - return $this->minmax; | |
| 258 | + public function getUnion(): float { | |
| 259 | + if (TopLevel::validateUnion($this->union)) { | |
| 260 | + return $this->union; | |
| 261 | 261 | } |
| 262 | - throw new Exception('never get to getMinmax TopLevel::minmax'); | |
| 262 | + throw new Exception('never get to getUnion TopLevel::union'); | |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | 266 | * @return float |
| 267 | 267 | */ |
| 268 | - public static function sampleMinmax(): float { | |
| 269 | - return 35.035; /*35:minmax*/ | |
| 268 | + public static function sampleUnion(): float { | |
| 269 | + return 35.035; /*35:union*/ | |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
| @@ -274,7 +274,7 @@ class TopLevel { | ||
| 274 | 274 | * @throws Exception |
| 275 | 275 | * @return float |
| 276 | 276 | */ |
| 277 | - public static function fromMinMaxIntersection(float $value): float { | |
| 277 | + public static function fromMinMaxUnion(float $value): float { | |
| 278 | 278 | return $value; /*float*/ |
| 279 | 279 | } |
| 280 | 280 | |
| @@ -282,11 +282,11 @@ class TopLevel { | ||
| 282 | 282 | * @throws Exception |
| 283 | 283 | * @return float |
| 284 | 284 | */ |
| 285 | - public function toMinMaxIntersection(): float { | |
| 286 | - if (TopLevel::validateMinMaxIntersection($this->minMaxIntersection)) { | |
| 287 | - return $this->minMaxIntersection; /*float*/ | |
| 285 | + public function toMinMaxUnion(): float { | |
| 286 | + if (TopLevel::validateMinMaxUnion($this->minMaxUnion)) { | |
| 287 | + return $this->minMaxUnion; /*float*/ | |
| 288 | 288 | } |
| 289 | - throw new Exception('never get to this TopLevel::minMaxIntersection'); | |
| 289 | + throw new Exception('never get to this TopLevel::minMaxUnion'); | |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
| @@ -294,7 +294,7 @@ class TopLevel { | ||
| 294 | 294 | * @return bool |
| 295 | 295 | * @throws Exception |
| 296 | 296 | */ |
| 297 | - public static function validateMinMaxIntersection(float $value): bool { | |
| 297 | + public static function validateMinMaxUnion(float $value): bool { | |
| 298 | 298 | return true; |
| 299 | 299 | } |
| 300 | 300 | |
| @@ -302,18 +302,18 @@ class TopLevel { | ||
| 302 | 302 | * @throws Exception |
| 303 | 303 | * @return float |
| 304 | 304 | */ |
| 305 | - public function getMinMaxIntersection(): float { | |
| 306 | - if (TopLevel::validateMinMaxIntersection($this->minMaxIntersection)) { | |
| 307 | - return $this->minMaxIntersection; | |
| 305 | + public function getMinMaxUnion(): float { | |
| 306 | + if (TopLevel::validateMinMaxUnion($this->minMaxUnion)) { | |
| 307 | + return $this->minMaxUnion; | |
| 308 | 308 | } |
| 309 | - throw new Exception('never get to getMinMaxIntersection TopLevel::minMaxIntersection'); | |
| 309 | + throw new Exception('never get to getMinMaxUnion TopLevel::minMaxUnion'); | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | /** |
| 313 | 313 | * @return float |
| 314 | 314 | */ |
| 315 | - public static function sampleMinMaxIntersection(): float { | |
| 316 | - return 36.036; /*36:minMaxIntersection*/ | |
| 315 | + public static function sampleMinMaxUnion(): float { | |
| 316 | + return 36.036; /*36:minMaxUnion*/ | |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
| @@ -321,7 +321,7 @@ class TopLevel { | ||
| 321 | 321 | * @throws Exception |
| 322 | 322 | * @return float |
| 323 | 323 | */ |
| 324 | - public static function fromMinMaxUnion(float $value): float { | |
| 324 | + public static function fromIntersection(float $value): float { | |
| 325 | 325 | return $value; /*float*/ |
| 326 | 326 | } |
| 327 | 327 | |
| @@ -329,11 +329,11 @@ class TopLevel { | ||
| 329 | 329 | * @throws Exception |
| 330 | 330 | * @return float |
| 331 | 331 | */ |
| 332 | - public function toMinMaxUnion(): float { | |
| 333 | - if (TopLevel::validateMinMaxUnion($this->minMaxUnion)) { | |
| 334 | - return $this->minMaxUnion; /*float*/ | |
| 332 | + public function toIntersection(): float { | |
| 333 | + if (TopLevel::validateIntersection($this->intersection)) { | |
| 334 | + return $this->intersection; /*float*/ | |
| 335 | 335 | } |
| 336 | - throw new Exception('never get to this TopLevel::minMaxUnion'); | |
| 336 | + throw new Exception('never get to this TopLevel::intersection'); | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
| @@ -341,7 +341,7 @@ class TopLevel { | ||
| 341 | 341 | * @return bool |
| 342 | 342 | * @throws Exception |
| 343 | 343 | */ |
| 344 | - public static function validateMinMaxUnion(float $value): bool { | |
| 344 | + public static function validateIntersection(float $value): bool { | |
| 345 | 345 | return true; |
| 346 | 346 | } |
| 347 | 347 | |
| @@ -349,18 +349,18 @@ class TopLevel { | ||
| 349 | 349 | * @throws Exception |
| 350 | 350 | * @return float |
| 351 | 351 | */ |
| 352 | - public function getMinMaxUnion(): float { | |
| 353 | - if (TopLevel::validateMinMaxUnion($this->minMaxUnion)) { | |
| 354 | - return $this->minMaxUnion; | |
| 352 | + public function getIntersection(): float { | |
| 353 | + if (TopLevel::validateIntersection($this->intersection)) { | |
| 354 | + return $this->intersection; | |
| 355 | 355 | } |
| 356 | - throw new Exception('never get to getMinMaxUnion TopLevel::minMaxUnion'); | |
| 356 | + throw new Exception('never get to getIntersection TopLevel::intersection'); | |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | /** |
| 360 | 360 | * @return float |
| 361 | 361 | */ |
| 362 | - public static function sampleMinMaxUnion(): float { | |
| 363 | - return 37.037; /*37:minMaxUnion*/ | |
| 362 | + public static function sampleIntersection(): float { | |
| 363 | + return 37.037; /*37:intersection*/ | |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | /** |
| @@ -368,7 +368,7 @@ class TopLevel { | ||
| 368 | 368 | * @throws Exception |
| 369 | 369 | * @return float |
| 370 | 370 | */ |
| 371 | - public static function fromUnion(float $value): float { | |
| 371 | + public static function fromMinMaxIntersection(float $value): float { | |
| 372 | 372 | return $value; /*float*/ |
| 373 | 373 | } |
| 374 | 374 | |
| @@ -376,11 +376,11 @@ class TopLevel { | ||
| 376 | 376 | * @throws Exception |
| 377 | 377 | * @return float |
| 378 | 378 | */ |
| 379 | - public function toUnion(): float { | |
| 380 | - if (TopLevel::validateUnion($this->union)) { | |
| 381 | - return $this->union; /*float*/ | |
| 379 | + public function toMinMaxIntersection(): float { | |
| 380 | + if (TopLevel::validateMinMaxIntersection($this->minMaxIntersection)) { | |
| 381 | + return $this->minMaxIntersection; /*float*/ | |
| 382 | 382 | } |
| 383 | - throw new Exception('never get to this TopLevel::union'); | |
| 383 | + throw new Exception('never get to this TopLevel::minMaxIntersection'); | |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /** |
| @@ -388,7 +388,7 @@ class TopLevel { | ||
| 388 | 388 | * @return bool |
| 389 | 389 | * @throws Exception |
| 390 | 390 | */ |
| 391 | - public static function validateUnion(float $value): bool { | |
| 391 | + public static function validateMinMaxIntersection(float $value): bool { | |
| 392 | 392 | return true; |
| 393 | 393 | } |
| 394 | 394 | |
| @@ -396,18 +396,18 @@ class TopLevel { | ||
| 396 | 396 | * @throws Exception |
| 397 | 397 | * @return float |
| 398 | 398 | */ |
| 399 | - public function getUnion(): float { | |
| 400 | - if (TopLevel::validateUnion($this->union)) { | |
| 401 | - return $this->union; | |
| 399 | + public function getMinMaxIntersection(): float { | |
| 400 | + if (TopLevel::validateMinMaxIntersection($this->minMaxIntersection)) { | |
| 401 | + return $this->minMaxIntersection; | |
| 402 | 402 | } |
| 403 | - throw new Exception('never get to getUnion TopLevel::union'); | |
| 403 | + throw new Exception('never get to getMinMaxIntersection TopLevel::minMaxIntersection'); | |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /** |
| 407 | 407 | * @return float |
| 408 | 408 | */ |
| 409 | - public static function sampleUnion(): float { | |
| 410 | - return 38.038; /*38:union*/ | |
| 409 | + public static function sampleMinMaxIntersection(): float { | |
| 410 | + return 38.038; /*38:minMaxIntersection*/ | |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
| @@ -416,13 +416,13 @@ class TopLevel { | ||
| 416 | 416 | */ |
| 417 | 417 | public function validate(): bool { |
| 418 | 418 | return TopLevel::validateFree($this->free) |
| 419 | - || TopLevel::validateIntersection($this->intersection) | |
| 420 | - || TopLevel::validateMax($this->max) | |
| 421 | 419 | || TopLevel::validateMin($this->min) |
| 420 | + || TopLevel::validateMax($this->max) | |
| 422 | 421 | || TopLevel::validateMinmax($this->minmax) |
| 423 | - || TopLevel::validateMinMaxIntersection($this->minMaxIntersection) | |
| 422 | + || TopLevel::validateUnion($this->union) | |
| 424 | 423 | || TopLevel::validateMinMaxUnion($this->minMaxUnion) |
| 425 | - || TopLevel::validateUnion($this->union); | |
| 424 | + || TopLevel::validateIntersection($this->intersection) | |
| 425 | + || TopLevel::validateMinMaxIntersection($this->minMaxIntersection); | |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | /** |
| @@ -432,13 +432,13 @@ class TopLevel { | ||
| 432 | 432 | public function to(): stdClass { |
| 433 | 433 | $out = new stdClass(); |
| 434 | 434 | $out->{'free'} = $this->toFree(); |
| 435 | - $out->{'intersection'} = $this->toIntersection(); | |
| 436 | - $out->{'max'} = $this->toMax(); | |
| 437 | 435 | $out->{'min'} = $this->toMin(); |
| 436 | + $out->{'max'} = $this->toMax(); | |
| 438 | 437 | $out->{'minmax'} = $this->toMinmax(); |
| 439 | - $out->{'minMaxIntersection'} = $this->toMinMaxIntersection(); | |
| 440 | - $out->{'minMaxUnion'} = $this->toMinMaxUnion(); | |
| 441 | 438 | $out->{'union'} = $this->toUnion(); |
| 439 | + $out->{'minMaxUnion'} = $this->toMinMaxUnion(); | |
| 440 | + $out->{'intersection'} = $this->toIntersection(); | |
| 441 | + $out->{'minMaxIntersection'} = $this->toMinMaxIntersection(); | |
| 442 | 442 | return $out; |
| 443 | 443 | } |
| 444 | 444 | |
| @@ -450,13 +450,13 @@ class TopLevel { | ||
| 450 | 450 | public static function from(stdClass $obj): TopLevel { |
| 451 | 451 | return new TopLevel( |
| 452 | 452 | TopLevel::fromFree($obj->{'free'}) |
| 453 | - ,TopLevel::fromIntersection($obj->{'intersection'}) | |
| 454 | - ,TopLevel::fromMax($obj->{'max'}) | |
| 455 | 453 | ,TopLevel::fromMin($obj->{'min'}) |
| 454 | + ,TopLevel::fromMax($obj->{'max'}) | |
| 456 | 455 | ,TopLevel::fromMinmax($obj->{'minmax'}) |
| 457 | - ,TopLevel::fromMinMaxIntersection($obj->{'minMaxIntersection'}) | |
| 458 | - ,TopLevel::fromMinMaxUnion($obj->{'minMaxUnion'}) | |
| 459 | 456 | ,TopLevel::fromUnion($obj->{'union'}) |
| 457 | + ,TopLevel::fromMinMaxUnion($obj->{'minMaxUnion'}) | |
| 458 | + ,TopLevel::fromIntersection($obj->{'intersection'}) | |
| 459 | + ,TopLevel::fromMinMaxIntersection($obj->{'minMaxIntersection'}) | |
| 460 | 460 | ); |
| 461 | 461 | } |
| 462 | 462 | |
| @@ -466,13 +466,13 @@ class TopLevel { | ||
| 466 | 466 | public static function sample(): TopLevel { |
| 467 | 467 | return new TopLevel( |
| 468 | 468 | TopLevel::sampleFree() |
| 469 | - ,TopLevel::sampleIntersection() | |
| 470 | - ,TopLevel::sampleMax() | |
| 471 | 469 | ,TopLevel::sampleMin() |
| 470 | + ,TopLevel::sampleMax() | |
| 472 | 471 | ,TopLevel::sampleMinmax() |
| 473 | - ,TopLevel::sampleMinMaxIntersection() | |
| 474 | - ,TopLevel::sampleMinMaxUnion() | |
| 475 | 472 | ,TopLevel::sampleUnion() |
| 473 | + ,TopLevel::sampleMinMaxUnion() | |
| 474 | + ,TopLevel::sampleIntersection() | |
| 475 | + ,TopLevel::sampleMinMaxIntersection() | |
| 476 | 476 | ); |
| 477 | 477 | } |
| 478 | 478 | } |
Mschema-pythondefault / quicktype.py+13 −13
| @@ -23,37 +23,37 @@ def to_class(c: Type[T], x: Any) -> dict: | ||
| 23 | 23 | @dataclass |
| 24 | 24 | class TopLevel: |
| 25 | 25 | free: float |
| 26 | - intersection: float | |
| 27 | - max: float | |
| 28 | 26 | min: float |
| 27 | + max: float | |
| 29 | 28 | minmax: float |
| 30 | - min_max_intersection: float | |
| 31 | - min_max_union: float | |
| 32 | 29 | union: float |
| 30 | + min_max_union: float | |
| 31 | + intersection: float | |
| 32 | + min_max_intersection: float | |
| 33 | 33 | |
| 34 | 34 | @staticmethod |
| 35 | 35 | def from_dict(obj: Any) -> 'TopLevel': |
| 36 | 36 | assert isinstance(obj, dict) |
| 37 | 37 | free = from_float(obj.get("free")) |
| 38 | - intersection = from_float(obj.get("intersection")) | |
| 39 | - max = from_float(obj.get("max")) | |
| 40 | 38 | min = from_float(obj.get("min")) |
| 39 | + max = from_float(obj.get("max")) | |
| 41 | 40 | minmax = from_float(obj.get("minmax")) |
| 42 | - min_max_intersection = from_float(obj.get("minMaxIntersection")) | |
| 43 | - min_max_union = from_float(obj.get("minMaxUnion")) | |
| 44 | 41 | union = from_float(obj.get("union")) |
| 45 | - return TopLevel(free, intersection, max, min, minmax, min_max_intersection, min_max_union, union) | |
| 42 | + min_max_union = from_float(obj.get("minMaxUnion")) | |
| 43 | + intersection = from_float(obj.get("intersection")) | |
| 44 | + min_max_intersection = from_float(obj.get("minMaxIntersection")) | |
| 45 | + return TopLevel(free, min, max, minmax, union, min_max_union, intersection, min_max_intersection) | |
| 46 | 46 | |
| 47 | 47 | def to_dict(self) -> dict: |
| 48 | 48 | result: dict = {} |
| 49 | 49 | result["free"] = to_float(self.free) |
| 50 | - result["intersection"] = to_float(self.intersection) | |
| 51 | - result["max"] = to_float(self.max) | |
| 52 | 50 | result["min"] = to_float(self.min) |
| 51 | + result["max"] = to_float(self.max) | |
| 53 | 52 | result["minmax"] = to_float(self.minmax) |
| 54 | - result["minMaxIntersection"] = to_float(self.min_max_intersection) | |
| 55 | - result["minMaxUnion"] = to_float(self.min_max_union) | |
| 56 | 53 | result["union"] = to_float(self.union) |
| 54 | + result["minMaxUnion"] = to_float(self.min_max_union) | |
| 55 | + result["intersection"] = to_float(self.intersection) | |
| 56 | + result["minMaxIntersection"] = to_float(self.min_max_intersection) | |
| 57 | 57 | return result |
Mschema-rubydefault / TopLevel.rb+12 −12
| @@ -21,25 +21,25 @@ end | ||
| 21 | 21 | |
| 22 | 22 | class TopLevel < Dry::Struct |
| 23 | 23 | attribute :free, Types::Double |
| 24 | - attribute :intersection, Types::Double | |
| 25 | - attribute :max, Types::Double | |
| 26 | 24 | attribute :min, Types::Double |
| 25 | + attribute :max, Types::Double | |
| 27 | 26 | attribute :minmax, Types::Double |
| 28 | - attribute :min_max_intersection, Types::Double | |
| 29 | - attribute :min_max_union, Types::Double | |
| 30 | 27 | attribute :union, Types::Double |
| 28 | + attribute :min_max_union, Types::Double | |
| 29 | + attribute :intersection, Types::Double | |
| 30 | + attribute :min_max_intersection, Types::Double | |
| 31 | 31 | |
| 32 | 32 | def self.from_dynamic!(d) |
| 33 | 33 | d = Types::Hash[d] |
| 34 | 34 | new( |
| 35 | 35 | free: d.fetch("free"), |
| 36 | - intersection: d.fetch("intersection"), | |
| 37 | - max: d.fetch("max"), | |
| 38 | 36 | min: d.fetch("min"), |
| 37 | + max: d.fetch("max"), | |
| 39 | 38 | minmax: d.fetch("minmax"), |
| 40 | - min_max_intersection: d.fetch("minMaxIntersection"), | |
| 41 | - min_max_union: d.fetch("minMaxUnion"), | |
| 42 | 39 | union: d.fetch("union"), |
| 40 | + min_max_union: d.fetch("minMaxUnion"), | |
| 41 | + intersection: d.fetch("intersection"), | |
| 42 | + min_max_intersection: d.fetch("minMaxIntersection"), | |
| 43 | 43 | ) |
| 44 | 44 | end |
| 45 | 45 | |
| @@ -50,13 +50,13 @@ class TopLevel < Dry::Struct | ||
| 50 | 50 | def to_dynamic |
| 51 | 51 | { |
| 52 | 52 | "free" => free, |
| 53 | - "intersection" => intersection, | |
| 54 | - "max" => max, | |
| 55 | 53 | "min" => min, |
| 54 | + "max" => max, | |
| 56 | 55 | "minmax" => minmax, |
| 57 | - "minMaxIntersection" => min_max_intersection, | |
| 58 | - "minMaxUnion" => min_max_union, | |
| 59 | 56 | "union" => union, |
| 57 | + "minMaxUnion" => min_max_union, | |
| 58 | + "intersection" => intersection, | |
| 59 | + "minMaxIntersection" => min_max_intersection, | |
| 60 | 60 | } |
| 61 | 61 | end |
Mschema-rustdefault / module_under_test.rs+6 −6
| @@ -18,18 +18,18 @@ use serde::{Serialize, Deserialize}; | ||
| 18 | 18 | pub struct TopLevel { |
| 19 | 19 | pub free: f64, |
| 20 | 20 | |
| 21 | - pub intersection: f64, | |
| 21 | + pub min: f64, | |
| 22 | 22 | |
| 23 | 23 | pub max: f64, |
| 24 | 24 | |
| 25 | - pub min: f64, | |
| 26 | - | |
| 27 | 25 | pub minmax: f64, |
| 28 | 26 | |
| 29 | - pub min_max_intersection: f64, | |
| 27 | + #[serde(rename = "union")] | |
| 28 | + pub top_level_union: f64, | |
| 30 | 29 | |
| 31 | 30 | pub min_max_union: f64, |
| 32 | 31 | |
| 33 | - #[serde(rename = "union")] | |
| 34 | - pub top_level_union: f64, | |
| 32 | + pub intersection: f64, | |
| 33 | + | |
| 34 | + pub min_max_intersection: f64, | |
| 35 | 35 | } |
Mschema-scala3-upickledefault / TopLevel.scala+4 −4
| @@ -67,11 +67,11 @@ end JsonExt | ||
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | 69 | val free : Double, |
| 70 | - val intersection : Double, | |
| 71 | - val max : Double, | |
| 72 | 70 | val min : Double, |
| 71 | + val max : Double, | |
| 73 | 72 | val minmax : Double, |
| 74 | - val minMaxIntersection : Double, | |
| 73 | + val union : Double, | |
| 75 | 74 | val minMaxUnion : Double, |
| 76 | - val union : Double | |
| 75 | + val intersection : Double, | |
| 76 | + val minMaxIntersection : Double | |
| 77 | 77 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+4 −4
| @@ -9,11 +9,11 @@ type NullValue = None.type | ||
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | 11 | val free : Double, |
| 12 | - val intersection : Double, | |
| 13 | - val max : Double, | |
| 14 | 12 | val min : Double, |
| 13 | + val max : Double, | |
| 15 | 14 | val minmax : Double, |
| 16 | - val minMaxIntersection : Double, | |
| 15 | + val union : Double, | |
| 17 | 16 | val minMaxUnion : Double, |
| 18 | - val union : Double | |
| 17 | + val intersection : Double, | |
| 18 | + val minMaxIntersection : Double | |
| 19 | 19 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+11 −11
| @@ -9,36 +9,36 @@ | ||
| 9 | 9 | "free": { |
| 10 | 10 | "type": "number" |
| 11 | 11 | }, |
| 12 | - "intersection": { | |
| 12 | + "min": { | |
| 13 | 13 | "type": "number", |
| 14 | - "minimum": 4, | |
| 15 | - "maximum": 5 | |
| 14 | + "minimum": 3 | |
| 16 | 15 | }, |
| 17 | 16 | "max": { |
| 18 | 17 | "type": "number", |
| 19 | 18 | "maximum": 5 |
| 20 | 19 | }, |
| 21 | - "min": { | |
| 22 | - "type": "number", | |
| 23 | - "minimum": 3 | |
| 24 | - }, | |
| 25 | 20 | "minmax": { |
| 26 | 21 | "type": "number", |
| 27 | 22 | "minimum": 3, |
| 28 | 23 | "maximum": 5 |
| 29 | 24 | }, |
| 30 | - "minMaxIntersection": { | |
| 25 | + "union": { | |
| 31 | 26 | "type": "number", |
| 32 | 27 | "minimum": 3, |
| 33 | - "maximum": 5 | |
| 28 | + "maximum": 6 | |
| 34 | 29 | }, |
| 35 | 30 | "minMaxUnion": { |
| 36 | 31 | "type": "number" |
| 37 | 32 | }, |
| 38 | - "union": { | |
| 33 | + "intersection": { | |
| 34 | + "type": "number", | |
| 35 | + "minimum": 4, | |
| 36 | + "maximum": 5 | |
| 37 | + }, | |
| 38 | + "minMaxIntersection": { | |
| 39 | 39 | "type": "number", |
| 40 | 40 | "minimum": 3, |
| 41 | - "maximum": 6 | |
| 41 | + "maximum": 5 | |
| 42 | 42 | } |
| 43 | 43 | }, |
| 44 | 44 | "required": [ |
Mschema-swiftdefault / quicktype.swift+16 −16
| @@ -8,23 +8,23 @@ import Foundation | ||
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | 10 | let free: Double |
| 11 | - let intersection: Double | |
| 12 | - let max: Double | |
| 13 | 11 | let min: Double |
| 12 | + let max: Double | |
| 14 | 13 | let minmax: Double |
| 15 | - let minMaxIntersection: Double | |
| 16 | - let minMaxUnion: Double | |
| 17 | 14 | let union: Double |
| 15 | + let minMaxUnion: Double | |
| 16 | + let intersection: Double | |
| 17 | + let minMaxIntersection: Double | |
| 18 | 18 | |
| 19 | 19 | enum CodingKeys: String, CodingKey { |
| 20 | 20 | case free = "free" |
| 21 | - case intersection = "intersection" | |
| 22 | - case max = "max" | |
| 23 | 21 | case min = "min" |
| 22 | + case max = "max" | |
| 24 | 23 | case minmax = "minmax" |
| 25 | - case minMaxIntersection = "minMaxIntersection" | |
| 26 | - case minMaxUnion = "minMaxUnion" | |
| 27 | 24 | case union = "union" |
| 25 | + case minMaxUnion = "minMaxUnion" | |
| 26 | + case intersection = "intersection" | |
| 27 | + case minMaxIntersection = "minMaxIntersection" | |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| @@ -48,23 +48,23 @@ extension TopLevel { | ||
| 48 | 48 | |
| 49 | 49 | func with( |
| 50 | 50 | free: Double? = nil, |
| 51 | - intersection: Double? = nil, | |
| 52 | - max: Double? = nil, | |
| 53 | 51 | min: Double? = nil, |
| 52 | + max: Double? = nil, | |
| 54 | 53 | minmax: Double? = nil, |
| 55 | - minMaxIntersection: Double? = nil, | |
| 54 | + union: Double? = nil, | |
| 56 | 55 | minMaxUnion: Double? = nil, |
| 57 | - union: Double? = nil | |
| 56 | + intersection: Double? = nil, | |
| 57 | + minMaxIntersection: Double? = nil | |
| 58 | 58 | ) -> TopLevel { |
| 59 | 59 | return TopLevel( |
| 60 | 60 | free: free ?? self.free, |
| 61 | - intersection: intersection ?? self.intersection, | |
| 62 | - max: max ?? self.max, | |
| 63 | 61 | min: min ?? self.min, |
| 62 | + max: max ?? self.max, | |
| 64 | 63 | minmax: minmax ?? self.minmax, |
| 65 | - minMaxIntersection: minMaxIntersection ?? self.minMaxIntersection, | |
| 64 | + union: union ?? self.union, | |
| 66 | 65 | minMaxUnion: minMaxUnion ?? self.minMaxUnion, |
| 67 | - union: union ?? self.union | |
| 66 | + intersection: intersection ?? self.intersection, | |
| 67 | + minMaxIntersection: minMaxIntersection ?? self.minMaxIntersection | |
| 68 | 68 | ) |
| 69 | 69 | } |
Mschema-typescript-zoddefault / TopLevel.ts+4 −4
| @@ -3,12 +3,12 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | 5 | "free": z.number(), |
| 6 | - "intersection": z.number(), | |
| 7 | - "max": z.number(), | |
| 8 | 6 | "min": z.number(), |
| 7 | + "max": z.number(), | |
| 9 | 8 | "minmax": z.number(), |
| 10 | - "minMaxIntersection": z.number(), | |
| 11 | - "minMaxUnion": z.number(), | |
| 12 | 9 | "union": z.number(), |
| 10 | + "minMaxUnion": z.number(), | |
| 11 | + "intersection": z.number(), | |
| 12 | + "minMaxIntersection": z.number(), | |
| 13 | 13 | }); |
| 14 | 14 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+8 −8
| @@ -9,13 +9,13 @@ | ||
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | 11 | free: number; |
| 12 | - intersection: number; | |
| 13 | - max: number; | |
| 14 | 12 | min: number; |
| 13 | + max: number; | |
| 15 | 14 | minmax: number; |
| 16 | - minMaxIntersection: number; | |
| 17 | - minMaxUnion: number; | |
| 18 | 15 | union: number; |
| 16 | + minMaxUnion: number; | |
| 17 | + intersection: number; | |
| 18 | + minMaxIntersection: number; | |
| 19 | 19 | [property: string]: unknown; |
| 20 | 20 | } |
| 21 | 21 | |
| @@ -187,12 +187,12 @@ function r(name: string) { | ||
| 187 | 187 | const typeMap: any = { |
| 188 | 188 | "TopLevel": o([ |
| 189 | 189 | { json: "free", js: "free", typ: 3.14 }, |
| 190 | - { json: "intersection", js: "intersection", typ: 3.14 }, | |
| 191 | - { json: "max", js: "max", typ: 3.14 }, | |
| 192 | 190 | { json: "min", js: "min", typ: 3.14 }, |
| 191 | + { json: "max", js: "max", typ: 3.14 }, | |
| 193 | 192 | { json: "minmax", js: "minmax", typ: 3.14 }, |
| 194 | - { json: "minMaxIntersection", js: "minMaxIntersection", typ: 3.14 }, | |
| 195 | - { json: "minMaxUnion", js: "minMaxUnion", typ: 3.14 }, | |
| 196 | 193 | { json: "union", js: "union", typ: 3.14 }, |
| 194 | + { json: "minMaxUnion", js: "minMaxUnion", typ: 3.14 }, | |
| 195 | + { json: "intersection", js: "intersection", typ: 3.14 }, | |
| 196 | + { json: "minMaxIntersection", js: "minMaxIntersection", typ: 3.14 }, | |
| 197 | 197 | ], "any"), |
| 198 | 198 | }; |
Test case
27 generated files · +562 −562test/inputs/schema/minmaxlength.schema
Mschema-cplusplusdefault / quicktype.hpp+40 −40
| @@ -224,63 +224,63 @@ namespace quicktype { | ||
| 224 | 224 | class TopLevel { |
| 225 | 225 | public: |
| 226 | 226 | TopLevel() : |
| 227 | - intersection_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, 4, 5, std::nullopt), | |
| 228 | - maxlength_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt, 5, std::nullopt), | |
| 229 | 227 | minlength_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, 3, std::nullopt, std::nullopt), |
| 230 | - min_max_intersection_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, 3, 5, std::nullopt), | |
| 228 | + maxlength_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt, 5, std::nullopt), | |
| 231 | 229 | minmaxlength_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, 3, 5, std::nullopt), |
| 232 | - union_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, 3, 6, std::nullopt) | |
| 230 | + union_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, 3, 6, std::nullopt), | |
| 231 | + intersection_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, 4, 5, std::nullopt), | |
| 232 | + min_max_intersection_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, 3, 5, std::nullopt) | |
| 233 | 233 | {} |
| 234 | 234 | virtual ~TopLevel() = default; |
| 235 | 235 | |
| 236 | 236 | private: |
| 237 | - std::string intersection; | |
| 238 | - ClassMemberConstraints intersection_constraint; | |
| 239 | - InUnion in_union; | |
| 240 | - std::string maxlength; | |
| 241 | - ClassMemberConstraints maxlength_constraint; | |
| 242 | 237 | std::string minlength; |
| 243 | 238 | ClassMemberConstraints minlength_constraint; |
| 244 | - std::string min_max_intersection; | |
| 245 | - ClassMemberConstraints min_max_intersection_constraint; | |
| 239 | + std::string maxlength; | |
| 240 | + ClassMemberConstraints maxlength_constraint; | |
| 246 | 241 | std::string minmaxlength; |
| 247 | 242 | ClassMemberConstraints minmaxlength_constraint; |
| 248 | - std::string min_max_union; | |
| 249 | 243 | std::string top_level_union; |
| 250 | 244 | ClassMemberConstraints union_constraint; |
| 245 | + InUnion in_union; | |
| 246 | + std::string min_max_union; | |
| 247 | + std::string intersection; | |
| 248 | + ClassMemberConstraints intersection_constraint; | |
| 249 | + std::string min_max_intersection; | |
| 250 | + ClassMemberConstraints min_max_intersection_constraint; | |
| 251 | 251 | |
| 252 | 252 | public: |
| 253 | - const std::string & get_intersection() const { return intersection; } | |
| 254 | - std::string & get_mutable_intersection() { return intersection; } | |
| 255 | - void set_intersection(const std::string & value) { CheckConstraint("intersection", intersection_constraint, value); this->intersection = value; } | |
| 256 | - | |
| 257 | - const InUnion & get_in_union() const { return in_union; } | |
| 258 | - InUnion & get_mutable_in_union() { return in_union; } | |
| 259 | - void set_in_union(const InUnion & value) { this->in_union = value; } | |
| 260 | - | |
| 261 | - const std::string & get_maxlength() const { return maxlength; } | |
| 262 | - std::string & get_mutable_maxlength() { return maxlength; } | |
| 263 | - void set_maxlength(const std::string & value) { CheckConstraint("maxlength", maxlength_constraint, value); this->maxlength = value; } | |
| 264 | - | |
| 265 | 253 | const std::string & get_minlength() const { return minlength; } |
| 266 | 254 | std::string & get_mutable_minlength() { return minlength; } |
| 267 | 255 | void set_minlength(const std::string & value) { CheckConstraint("minlength", minlength_constraint, value); this->minlength = value; } |
| 268 | 256 | |
| 269 | - const std::string & get_min_max_intersection() const { return min_max_intersection; } | |
| 270 | - std::string & get_mutable_min_max_intersection() { return min_max_intersection; } | |
| 271 | - void set_min_max_intersection(const std::string & value) { CheckConstraint("min_max_intersection", min_max_intersection_constraint, value); this->min_max_intersection = value; } | |
| 257 | + const std::string & get_maxlength() const { return maxlength; } | |
| 258 | + std::string & get_mutable_maxlength() { return maxlength; } | |
| 259 | + void set_maxlength(const std::string & value) { CheckConstraint("maxlength", maxlength_constraint, value); this->maxlength = value; } | |
| 272 | 260 | |
| 273 | 261 | const std::string & get_minmaxlength() const { return minmaxlength; } |
| 274 | 262 | std::string & get_mutable_minmaxlength() { return minmaxlength; } |
| 275 | 263 | void set_minmaxlength(const std::string & value) { CheckConstraint("minmaxlength", minmaxlength_constraint, value); this->minmaxlength = value; } |
| 276 | 264 | |
| 265 | + const std::string & get_top_level_union() const { return top_level_union; } | |
| 266 | + std::string & get_mutable_top_level_union() { return top_level_union; } | |
| 267 | + void set_top_level_union(const std::string & value) { CheckConstraint("top_level_union", union_constraint, value); this->top_level_union = value; } | |
| 268 | + | |
| 269 | + const InUnion & get_in_union() const { return in_union; } | |
| 270 | + InUnion & get_mutable_in_union() { return in_union; } | |
| 271 | + void set_in_union(const InUnion & value) { this->in_union = value; } | |
| 272 | + | |
| 277 | 273 | const std::string & get_min_max_union() const { return min_max_union; } |
| 278 | 274 | std::string & get_mutable_min_max_union() { return min_max_union; } |
| 279 | 275 | void set_min_max_union(const std::string & value) { this->min_max_union = value; } |
| 280 | 276 | |
| 281 | - const std::string & get_top_level_union() const { return top_level_union; } | |
| 282 | - std::string & get_mutable_top_level_union() { return top_level_union; } | |
| 283 | - void set_top_level_union(const std::string & value) { CheckConstraint("top_level_union", union_constraint, value); this->top_level_union = value; } | |
| 277 | + const std::string & get_intersection() const { return intersection; } | |
| 278 | + std::string & get_mutable_intersection() { return intersection; } | |
| 279 | + void set_intersection(const std::string & value) { CheckConstraint("intersection", intersection_constraint, value); this->intersection = value; } | |
| 280 | + | |
| 281 | + const std::string & get_min_max_intersection() const { return min_max_intersection; } | |
| 282 | + std::string & get_mutable_min_max_intersection() { return min_max_intersection; } | |
| 283 | + void set_min_max_intersection(const std::string & value) { CheckConstraint("min_max_intersection", min_max_intersection_constraint, value); this->min_max_intersection = value; } | |
| 284 | 284 | }; |
| 285 | 285 | } |
| 286 | 286 | |
| @@ -297,26 +297,26 @@ struct adl_serializer<std::variant<double, std::string>> { | ||
| 297 | 297 | } |
| 298 | 298 | namespace quicktype { |
| 299 | 299 | inline void from_json(const json & j, TopLevel& x) { |
| 300 | - x.set_intersection(j.at("intersection").get<std::string>()); | |
| 301 | - x.set_in_union(j.at("inUnion").get<InUnion>()); | |
| 302 | - x.set_maxlength(j.at("maxlength").get<std::string>()); | |
| 303 | 300 | x.set_minlength(j.at("minlength").get<std::string>()); |
| 304 | - x.set_min_max_intersection(j.at("minMaxIntersection").get<std::string>()); | |
| 301 | + x.set_maxlength(j.at("maxlength").get<std::string>()); | |
| 305 | 302 | x.set_minmaxlength(j.at("minmaxlength").get<std::string>()); |
| 306 | - x.set_min_max_union(j.at("minMaxUnion").get<std::string>()); | |
| 307 | 303 | x.set_top_level_union(j.at("union").get<std::string>()); |
| 304 | + x.set_in_union(j.at("inUnion").get<InUnion>()); | |
| 305 | + x.set_min_max_union(j.at("minMaxUnion").get<std::string>()); | |
| 306 | + x.set_intersection(j.at("intersection").get<std::string>()); | |
| 307 | + x.set_min_max_intersection(j.at("minMaxIntersection").get<std::string>()); | |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | inline void to_json(json & j, const TopLevel & x) { |
| 311 | 311 | j = json::object(); |
| 312 | - j["intersection"] = x.get_intersection(); | |
| 313 | - j["inUnion"] = x.get_in_union(); | |
| 314 | - j["maxlength"] = x.get_maxlength(); | |
| 315 | 312 | j["minlength"] = x.get_minlength(); |
| 316 | - j["minMaxIntersection"] = x.get_min_max_intersection(); | |
| 313 | + j["maxlength"] = x.get_maxlength(); | |
| 317 | 314 | j["minmaxlength"] = x.get_minmaxlength(); |
| 318 | - j["minMaxUnion"] = x.get_min_max_union(); | |
| 319 | 315 | j["union"] = x.get_top_level_union(); |
| 316 | + j["inUnion"] = x.get_in_union(); | |
| 317 | + j["minMaxUnion"] = x.get_min_max_union(); | |
| 318 | + j["intersection"] = x.get_intersection(); | |
| 319 | + j["minMaxIntersection"] = x.get_min_max_intersection(); | |
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | namespace nlohmann { |
Mschema-csharp-recordsdefault / QuickType.cs+17 −17
| @@ -25,35 +25,35 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("intersection", Required = Required.Always)] | |
| 29 | - [JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))] | |
| 30 | - public string Intersection { get; set; } | |
| 31 | - | |
| 32 | - [JsonProperty("inUnion", Required = Required.Always)] | |
| 33 | - public InUnion InUnion { get; set; } | |
| 34 | - | |
| 35 | - [JsonProperty("maxlength", Required = Required.Always)] | |
| 36 | - [JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))] | |
| 37 | - public string Maxlength { get; set; } | |
| 38 | - | |
| 39 | 28 | [JsonProperty("minlength", Required = Required.Always)] |
| 40 | 29 | [JsonConverter(typeof(StickyMinMaxLengthCheckConverter))] |
| 41 | 30 | public string Minlength { get; set; } |
| 42 | 31 | |
| 43 | - [JsonProperty("minMaxIntersection", Required = Required.Always)] | |
| 44 | - [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))] | |
| 45 | - public string MinMaxIntersection { get; set; } | |
| 32 | + [JsonProperty("maxlength", Required = Required.Always)] | |
| 33 | + [JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))] | |
| 34 | + public string Maxlength { get; set; } | |
| 46 | 35 | |
| 47 | 36 | [JsonProperty("minmaxlength", Required = Required.Always)] |
| 48 | 37 | [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))] |
| 49 | 38 | public string Minmaxlength { get; set; } |
| 50 | 39 | |
| 51 | - [JsonProperty("minMaxUnion", Required = Required.Always)] | |
| 52 | - public string MinMaxUnion { get; set; } | |
| 53 | - | |
| 54 | 40 | [JsonProperty("union", Required = Required.Always)] |
| 55 | 41 | [JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))] |
| 56 | 42 | public string Union { get; set; } |
| 43 | + | |
| 44 | + [JsonProperty("inUnion", Required = Required.Always)] | |
| 45 | + public InUnion InUnion { get; set; } | |
| 46 | + | |
| 47 | + [JsonProperty("minMaxUnion", Required = Required.Always)] | |
| 48 | + public string MinMaxUnion { get; set; } | |
| 49 | + | |
| 50 | + [JsonProperty("intersection", Required = Required.Always)] | |
| 51 | + [JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))] | |
| 52 | + public string Intersection { get; set; } | |
| 53 | + | |
| 54 | + [JsonProperty("minMaxIntersection", Required = Required.Always)] | |
| 55 | + [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))] | |
| 56 | + public string MinMaxIntersection { get; set; } | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public partial struct InUnion |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+19 −19
| @@ -23,13 +23,9 @@ namespace QuickType | ||
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | 25 | [JsonRequired] |
| 26 | - [JsonPropertyName("intersection")] | |
| 27 | - [JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))] | |
| 28 | - public string Intersection { get; set; } | |
| 29 | - | |
| 30 | - [JsonRequired] | |
| 31 | - [JsonPropertyName("inUnion")] | |
| 32 | - public InUnion InUnion { get; set; } | |
| 26 | + [JsonPropertyName("minlength")] | |
| 27 | + [JsonConverter(typeof(StickyMinMaxLengthCheckConverter))] | |
| 28 | + public string Minlength { get; set; } | |
| 33 | 29 | |
| 34 | 30 | [JsonRequired] |
| 35 | 31 | [JsonPropertyName("maxlength")] |
| @@ -37,28 +33,32 @@ namespace QuickType | ||
| 37 | 33 | public string Maxlength { get; set; } |
| 38 | 34 | |
| 39 | 35 | [JsonRequired] |
| 40 | - [JsonPropertyName("minlength")] | |
| 41 | - [JsonConverter(typeof(StickyMinMaxLengthCheckConverter))] | |
| 42 | - public string Minlength { get; set; } | |
| 36 | + [JsonPropertyName("minmaxlength")] | |
| 37 | + [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))] | |
| 38 | + public string Minmaxlength { get; set; } | |
| 43 | 39 | |
| 44 | 40 | [JsonRequired] |
| 45 | - [JsonPropertyName("minMaxIntersection")] | |
| 46 | - [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))] | |
| 47 | - public string MinMaxIntersection { get; set; } | |
| 41 | + [JsonPropertyName("union")] | |
| 42 | + [JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))] | |
| 43 | + public string Union { get; set; } | |
| 48 | 44 | |
| 49 | 45 | [JsonRequired] |
| 50 | - [JsonPropertyName("minmaxlength")] | |
| 51 | - [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))] | |
| 52 | - public string Minmaxlength { get; set; } | |
| 46 | + [JsonPropertyName("inUnion")] | |
| 47 | + public InUnion InUnion { get; set; } | |
| 53 | 48 | |
| 54 | 49 | [JsonRequired] |
| 55 | 50 | [JsonPropertyName("minMaxUnion")] |
| 56 | 51 | public string MinMaxUnion { get; set; } |
| 57 | 52 | |
| 58 | 53 | [JsonRequired] |
| 59 | - [JsonPropertyName("union")] | |
| 60 | - [JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))] | |
| 61 | - public string Union { get; set; } | |
| 54 | + [JsonPropertyName("intersection")] | |
| 55 | + [JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))] | |
| 56 | + public string Intersection { get; set; } | |
| 57 | + | |
| 58 | + [JsonRequired] | |
| 59 | + [JsonPropertyName("minMaxIntersection")] | |
| 60 | + [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))] | |
| 61 | + public string MinMaxIntersection { get; set; } | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | public partial struct InUnion |
Mschema-csharpdefault / QuickType.cs+17 −17
| @@ -25,35 +25,35 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("intersection", Required = Required.Always)] | |
| 29 | - [JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))] | |
| 30 | - public string Intersection { get; set; } | |
| 31 | - | |
| 32 | - [JsonProperty("inUnion", Required = Required.Always)] | |
| 33 | - public InUnion InUnion { get; set; } | |
| 34 | - | |
| 35 | - [JsonProperty("maxlength", Required = Required.Always)] | |
| 36 | - [JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))] | |
| 37 | - public string Maxlength { get; set; } | |
| 38 | - | |
| 39 | 28 | [JsonProperty("minlength", Required = Required.Always)] |
| 40 | 29 | [JsonConverter(typeof(StickyMinMaxLengthCheckConverter))] |
| 41 | 30 | public string Minlength { get; set; } |
| 42 | 31 | |
| 43 | - [JsonProperty("minMaxIntersection", Required = Required.Always)] | |
| 44 | - [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))] | |
| 45 | - public string MinMaxIntersection { get; set; } | |
| 32 | + [JsonProperty("maxlength", Required = Required.Always)] | |
| 33 | + [JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))] | |
| 34 | + public string Maxlength { get; set; } | |
| 46 | 35 | |
| 47 | 36 | [JsonProperty("minmaxlength", Required = Required.Always)] |
| 48 | 37 | [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))] |
| 49 | 38 | public string Minmaxlength { get; set; } |
| 50 | 39 | |
| 51 | - [JsonProperty("minMaxUnion", Required = Required.Always)] | |
| 52 | - public string MinMaxUnion { get; set; } | |
| 53 | - | |
| 54 | 40 | [JsonProperty("union", Required = Required.Always)] |
| 55 | 41 | [JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))] |
| 56 | 42 | public string Union { get; set; } |
| 43 | + | |
| 44 | + [JsonProperty("inUnion", Required = Required.Always)] | |
| 45 | + public InUnion InUnion { get; set; } | |
| 46 | + | |
| 47 | + [JsonProperty("minMaxUnion", Required = Required.Always)] | |
| 48 | + public string MinMaxUnion { get; set; } | |
| 49 | + | |
| 50 | + [JsonProperty("intersection", Required = Required.Always)] | |
| 51 | + [JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))] | |
| 52 | + public string Intersection { get; set; } | |
| 53 | + | |
| 54 | + [JsonProperty("minMaxIntersection", Required = Required.Always)] | |
| 55 | + [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))] | |
| 56 | + public string MinMaxIntersection { get; set; } | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public partial struct InUnion |
Mschema-dartdefault / TopLevel.dart+20 −20
| @@ -9,45 +9,45 @@ TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | ||
| 9 | 9 | String topLevelToJson(TopLevel data) => json.encode(data.toJson()); |
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | - final String intersection; | |
| 13 | - final dynamic inUnion; | |
| 14 | - final String maxlength; | |
| 15 | 12 | final String minlength; |
| 16 | - final String minMaxIntersection; | |
| 13 | + final String maxlength; | |
| 17 | 14 | final String minmaxlength; |
| 18 | - final String minMaxUnion; | |
| 19 | 15 | final String union; |
| 16 | + final dynamic inUnion; | |
| 17 | + final String minMaxUnion; | |
| 18 | + final String intersection; | |
| 19 | + final String minMaxIntersection; | |
| 20 | 20 | |
| 21 | 21 | TopLevel({ |
| 22 | - required this.intersection, | |
| 23 | - required this.inUnion, | |
| 24 | - required this.maxlength, | |
| 25 | 22 | required this.minlength, |
| 26 | - required this.minMaxIntersection, | |
| 23 | + required this.maxlength, | |
| 27 | 24 | required this.minmaxlength, |
| 28 | - required this.minMaxUnion, | |
| 29 | 25 | required this.union, |
| 26 | + required this.inUnion, | |
| 27 | + required this.minMaxUnion, | |
| 28 | + required this.intersection, | |
| 29 | + required this.minMaxIntersection, | |
| 30 | 30 | }); |
| 31 | 31 | |
| 32 | 32 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 33 | - intersection: json["intersection"], | |
| 34 | - inUnion: json["inUnion"], | |
| 35 | - maxlength: json["maxlength"], | |
| 36 | 33 | minlength: json["minlength"], |
| 37 | - minMaxIntersection: json["minMaxIntersection"], | |
| 34 | + maxlength: json["maxlength"], | |
| 38 | 35 | minmaxlength: json["minmaxlength"], |
| 39 | - minMaxUnion: json["minMaxUnion"], | |
| 40 | 36 | union: json["union"], |
| 37 | + inUnion: json["inUnion"], | |
| 38 | + minMaxUnion: json["minMaxUnion"], | |
| 39 | + intersection: json["intersection"], | |
| 40 | + minMaxIntersection: json["minMaxIntersection"], | |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | Map<String, dynamic> toJson() => { |
| 44 | - "intersection": intersection, | |
| 45 | - "inUnion": inUnion, | |
| 46 | - "maxlength": maxlength, | |
| 47 | 44 | "minlength": minlength, |
| 48 | - "minMaxIntersection": minMaxIntersection, | |
| 45 | + "maxlength": maxlength, | |
| 49 | 46 | "minmaxlength": minmaxlength, |
| 50 | - "minMaxUnion": minMaxUnion, | |
| 51 | 47 | "union": union, |
| 48 | + "inUnion": inUnion, | |
| 49 | + "minMaxUnion": minMaxUnion, | |
| 50 | + "intersection": intersection, | |
| 51 | + "minMaxIntersection": minMaxIntersection, | |
| 52 | 52 | }; |
| 53 | 53 | } |
Mschema-elixirdefault / QuickType.ex+17 −17
| @@ -6,30 +6,30 @@ | ||
| 6 | 6 | # Encode into a JSON string: TopLevel.to_json(struct) |
| 7 | 7 | |
| 8 | 8 | defmodule TopLevel do |
| 9 | - @enforce_keys [:intersection, :in_union, :maxlength, :minlength, :min_max_intersection, :minmaxlength, :min_max_union, :union] | |
| 10 | - defstruct [:intersection, :in_union, :maxlength, :minlength, :min_max_intersection, :minmaxlength, :min_max_union, :union] | |
| 9 | + @enforce_keys [:minlength, :maxlength, :minmaxlength, :union, :in_union, :min_max_union, :intersection, :min_max_intersection] | |
| 10 | + defstruct [:minlength, :maxlength, :minmaxlength, :union, :in_union, :min_max_union, :intersection, :min_max_intersection] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | - intersection: String.t(), | |
| 14 | - in_union: float() | String.t(), | |
| 15 | - maxlength: String.t(), | |
| 16 | 13 | minlength: String.t(), |
| 17 | - min_max_intersection: String.t(), | |
| 14 | + maxlength: String.t(), | |
| 18 | 15 | minmaxlength: String.t(), |
| 16 | + union: String.t(), | |
| 17 | + in_union: float() | String.t(), | |
| 19 | 18 | min_max_union: String.t(), |
| 20 | - union: String.t() | |
| 19 | + intersection: String.t(), | |
| 20 | + min_max_intersection: String.t() | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | def from_map(m) do |
| 24 | 24 | %TopLevel{ |
| 25 | - intersection: m["intersection"], | |
| 26 | - in_union: m["inUnion"], | |
| 27 | - maxlength: m["maxlength"], | |
| 28 | 25 | minlength: m["minlength"], |
| 29 | - min_max_intersection: m["minMaxIntersection"], | |
| 26 | + maxlength: m["maxlength"], | |
| 30 | 27 | minmaxlength: m["minmaxlength"], |
| 31 | - min_max_union: m["minMaxUnion"], | |
| 32 | 28 | union: m["union"], |
| 29 | + in_union: m["inUnion"], | |
| 30 | + min_max_union: m["minMaxUnion"], | |
| 31 | + intersection: m["intersection"], | |
| 32 | + min_max_intersection: m["minMaxIntersection"], | |
| 33 | 33 | } |
| 34 | 34 | end |
| 35 | 35 | |
| @@ -41,14 +41,14 @@ defmodule TopLevel do | ||
| 41 | 41 | |
| 42 | 42 | def to_map(struct) do |
| 43 | 43 | %{ |
| 44 | - "intersection" => struct.intersection, | |
| 45 | - "inUnion" => struct.in_union, | |
| 46 | - "maxlength" => struct.maxlength, | |
| 47 | 44 | "minlength" => struct.minlength, |
| 48 | - "minMaxIntersection" => struct.min_max_intersection, | |
| 45 | + "maxlength" => struct.maxlength, | |
| 49 | 46 | "minmaxlength" => struct.minmaxlength, |
| 50 | - "minMaxUnion" => struct.min_max_union, | |
| 51 | 47 | "union" => struct.union, |
| 48 | + "inUnion" => struct.in_union, | |
| 49 | + "minMaxUnion" => struct.min_max_union, | |
| 50 | + "intersection" => struct.intersection, | |
| 51 | + "minMaxIntersection" => struct.min_max_intersection, | |
| 52 | 52 | } |
| 53 | 53 | end |
Mschema-elmdefault / QuickType.elm+15 −15
| @@ -24,14 +24,14 @@ import Json.Encode as Jenc | ||
| 24 | 24 | import Dict exposing (Dict) |
| 25 | 25 | |
| 26 | 26 | type alias QuickType = |
| 27 | - { intersection : String | |
| 28 | - , inUnion : InUnion | |
| 27 | + { minlength : String | |
| 29 | 28 | , maxlength : String |
| 30 | - , minlength : String | |
| 31 | - , minMaxIntersection : String | |
| 32 | 29 | , minmaxlength : String |
| 33 | - , minMaxUnion : String | |
| 34 | 30 | , union : String |
| 31 | + , inUnion : InUnion | |
| 32 | + , minMaxUnion : String | |
| 33 | + , intersection : String | |
| 34 | + , minMaxIntersection : String | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | type InUnion |
| @@ -46,26 +46,26 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 46 | 46 | quickType : Jdec.Decoder QuickType |
| 47 | 47 | quickType = |
| 48 | 48 | Jdec.succeed QuickType |
| 49 | - |> Jpipe.required "intersection" Jdec.string | |
| 50 | - |> Jpipe.required "inUnion" inUnion | |
| 51 | - |> Jpipe.required "maxlength" Jdec.string | |
| 52 | 49 | |> Jpipe.required "minlength" Jdec.string |
| 53 | - |> Jpipe.required "minMaxIntersection" Jdec.string | |
| 50 | + |> Jpipe.required "maxlength" Jdec.string | |
| 54 | 51 | |> Jpipe.required "minmaxlength" Jdec.string |
| 55 | - |> Jpipe.required "minMaxUnion" Jdec.string | |
| 56 | 52 | |> Jpipe.required "union" Jdec.string |
| 53 | + |> Jpipe.required "inUnion" inUnion | |
| 54 | + |> Jpipe.required "minMaxUnion" Jdec.string | |
| 55 | + |> Jpipe.required "intersection" Jdec.string | |
| 56 | + |> Jpipe.required "minMaxIntersection" Jdec.string | |
| 57 | 57 | |
| 58 | 58 | encodeQuickType : QuickType -> Jenc.Value |
| 59 | 59 | encodeQuickType x = |
| 60 | 60 | Jenc.object |
| 61 | - [ ("intersection", Jenc.string x.intersection) | |
| 62 | - , ("inUnion", encodeInUnion x.inUnion) | |
| 61 | + [ ("minlength", Jenc.string x.minlength) | |
| 63 | 62 | , ("maxlength", Jenc.string x.maxlength) |
| 64 | - , ("minlength", Jenc.string x.minlength) | |
| 65 | - , ("minMaxIntersection", Jenc.string x.minMaxIntersection) | |
| 66 | 63 | , ("minmaxlength", Jenc.string x.minmaxlength) |
| 67 | - , ("minMaxUnion", Jenc.string x.minMaxUnion) | |
| 68 | 64 | , ("union", Jenc.string x.union) |
| 65 | + , ("inUnion", encodeInUnion x.inUnion) | |
| 66 | + , ("minMaxUnion", Jenc.string x.minMaxUnion) | |
| 67 | + , ("intersection", Jenc.string x.intersection) | |
| 68 | + , ("minMaxIntersection", Jenc.string x.minMaxIntersection) | |
| 69 | 69 | ] |
| 70 | 70 | |
| 71 | 71 | inUnion : Jdec.Decoder InUnion |
Mschema-flowdefault / TopLevel.js+10 −10
| @@ -10,14 +10,14 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - intersection: string; | |
| 14 | - inUnion: InUnion; | |
| 15 | - maxlength: string; | |
| 16 | 13 | minlength: string; |
| 17 | - minMaxIntersection: string; | |
| 14 | + maxlength: string; | |
| 18 | 15 | minmaxlength: string; |
| 19 | - minMaxUnion: string; | |
| 20 | 16 | union: string; |
| 17 | + inUnion: InUnion; | |
| 18 | + minMaxUnion: string; | |
| 19 | + intersection: string; | |
| 20 | + minMaxIntersection: string; | |
| 21 | 21 | [property: string]: mixed; |
| 22 | 22 | }; |
| 23 | 23 | |
| @@ -188,14 +188,14 @@ function r(name: string) { | ||
| 188 | 188 | |
| 189 | 189 | const typeMap: any = { |
| 190 | 190 | "TopLevel": o([ |
| 191 | - { json: "intersection", js: "intersection", typ: "" }, | |
| 192 | - { json: "inUnion", js: "inUnion", typ: u(3.14, "") }, | |
| 193 | - { json: "maxlength", js: "maxlength", typ: "" }, | |
| 194 | 191 | { json: "minlength", js: "minlength", typ: "" }, |
| 195 | - { json: "minMaxIntersection", js: "minMaxIntersection", typ: "" }, | |
| 192 | + { json: "maxlength", js: "maxlength", typ: "" }, | |
| 196 | 193 | { json: "minmaxlength", js: "minmaxlength", typ: "" }, |
| 197 | - { json: "minMaxUnion", js: "minMaxUnion", typ: "" }, | |
| 198 | 194 | { json: "union", js: "union", typ: "" }, |
| 195 | + { json: "inUnion", js: "inUnion", typ: u(3.14, "") }, | |
| 196 | + { json: "minMaxUnion", js: "minMaxUnion", typ: "" }, | |
| 197 | + { json: "intersection", js: "intersection", typ: "" }, | |
| 198 | + { json: "minMaxIntersection", js: "minMaxIntersection", typ: "" }, | |
| 199 | 199 | ], "any"), |
| 200 | 200 | }; |
Mschema-golangdefault / quicktype.go+5 −5
| @@ -22,14 +22,14 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | type TopLevel struct { |
| 25 | - Intersection string `json:"intersection"` | |
| 26 | - InUnion *InUnion `json:"inUnion"` | |
| 27 | - Maxlength string `json:"maxlength"` | |
| 28 | 25 | Minlength string `json:"minlength"` |
| 29 | - MinMaxIntersection string `json:"minMaxIntersection"` | |
| 26 | + Maxlength string `json:"maxlength"` | |
| 30 | 27 | Minmaxlength string `json:"minmaxlength"` |
| 31 | - MinMaxUnion string `json:"minMaxUnion"` | |
| 32 | 28 | Union string `json:"union"` |
| 29 | + InUnion *InUnion `json:"inUnion"` | |
| 30 | + MinMaxUnion string `json:"minMaxUnion"` | |
| 31 | + Intersection string `json:"intersection"` | |
| 32 | + MinMaxIntersection string `json:"minMaxIntersection"` | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | type InUnion struct { |
Mschema-haskelldefault / QuickType.hs+16 −16
| @@ -14,14 +14,14 @@ import Data.HashMap.Strict (HashMap) | ||
| 14 | 14 | import Data.Text (Text) |
| 15 | 15 | |
| 16 | 16 | data QuickType = QuickType |
| 17 | - { intersectionQuickType :: Text | |
| 18 | - , inUnionQuickType :: InUnion | |
| 17 | + { minlengthQuickType :: Text | |
| 19 | 18 | , maxlengthQuickType :: Text |
| 20 | - , minlengthQuickType :: Text | |
| 21 | - , minMaxIntersectionQuickType :: Text | |
| 22 | 19 | , minmaxlengthQuickType :: Text |
| 23 | - , minMaxUnionQuickType :: Text | |
| 24 | 20 | , unionQuickType :: Text |
| 21 | + , inUnionQuickType :: InUnion | |
| 22 | + , minMaxUnionQuickType :: Text | |
| 23 | + , intersectionQuickType :: Text | |
| 24 | + , minMaxIntersectionQuickType :: Text | |
| 25 | 25 | } deriving (Show) |
| 26 | 26 | |
| 27 | 27 | data InUnion |
| @@ -33,28 +33,28 @@ decodeTopLevel :: ByteString -> Maybe QuickType | ||
| 33 | 33 | decodeTopLevel = decode |
| 34 | 34 | |
| 35 | 35 | instance ToJSON QuickType where |
| 36 | - toJSON (QuickType intersectionQuickType inUnionQuickType maxlengthQuickType minlengthQuickType minMaxIntersectionQuickType minmaxlengthQuickType minMaxUnionQuickType unionQuickType) = | |
| 36 | + toJSON (QuickType minlengthQuickType maxlengthQuickType minmaxlengthQuickType unionQuickType inUnionQuickType minMaxUnionQuickType intersectionQuickType minMaxIntersectionQuickType) = | |
| 37 | 37 | object |
| 38 | - [ "intersection" .= intersectionQuickType | |
| 39 | - , "inUnion" .= inUnionQuickType | |
| 38 | + [ "minlength" .= minlengthQuickType | |
| 40 | 39 | , "maxlength" .= maxlengthQuickType |
| 41 | - , "minlength" .= minlengthQuickType | |
| 42 | - , "minMaxIntersection" .= minMaxIntersectionQuickType | |
| 43 | 40 | , "minmaxlength" .= minmaxlengthQuickType |
| 44 | - , "minMaxUnion" .= minMaxUnionQuickType | |
| 45 | 41 | , "union" .= unionQuickType |
| 42 | + , "inUnion" .= inUnionQuickType | |
| 43 | + , "minMaxUnion" .= minMaxUnionQuickType | |
| 44 | + , "intersection" .= intersectionQuickType | |
| 45 | + , "minMaxIntersection" .= minMaxIntersectionQuickType | |
| 46 | 46 | ] |
| 47 | 47 | |
| 48 | 48 | instance FromJSON QuickType where |
| 49 | 49 | parseJSON (Object v) = QuickType |
| 50 | - <$> v .: "intersection" | |
| 51 | - <*> v .: "inUnion" | |
| 50 | + <$> v .: "minlength" | |
| 52 | 51 | <*> v .: "maxlength" |
| 53 | - <*> v .: "minlength" | |
| 54 | - <*> v .: "minMaxIntersection" | |
| 55 | 52 | <*> v .: "minmaxlength" |
| 56 | - <*> v .: "minMaxUnion" | |
| 57 | 53 | <*> v .: "union" |
| 54 | + <*> v .: "inUnion" | |
| 55 | + <*> v .: "minMaxUnion" | |
| 56 | + <*> v .: "intersection" | |
| 57 | + <*> v .: "minMaxIntersection" | |
| 58 | 58 | |
| 59 | 59 | instance ToJSON InUnion where |
| 60 | 60 | toJSON (DoubleInInUnion x) = toJSON x |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+28 −28
| @@ -3,52 +3,52 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private String intersection; | |
| 7 | - private InUnion inUnion; | |
| 8 | - private String maxlength; | |
| 9 | 6 | private String minlength; |
| 10 | - private String minMaxIntersection; | |
| 7 | + private String maxlength; | |
| 11 | 8 | private String minmaxlength; |
| 12 | - private String minMaxUnion; | |
| 13 | 9 | private String union; |
| 14 | - | |
| 15 | - @JsonProperty("intersection") | |
| 16 | - public String getIntersection() { return intersection; } | |
| 17 | - @JsonProperty("intersection") | |
| 18 | - public void setIntersection(String value) { this.intersection = value; } | |
| 19 | - | |
| 20 | - @JsonProperty("inUnion") | |
| 21 | - public InUnion getInUnion() { return inUnion; } | |
| 22 | - @JsonProperty("inUnion") | |
| 23 | - public void setInUnion(InUnion value) { this.inUnion = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("maxlength") | |
| 26 | - public String getMaxlength() { return maxlength; } | |
| 27 | - @JsonProperty("maxlength") | |
| 28 | - public void setMaxlength(String value) { this.maxlength = value; } | |
| 10 | + private InUnion inUnion; | |
| 11 | + private String minMaxUnion; | |
| 12 | + private String intersection; | |
| 13 | + private String minMaxIntersection; | |
| 29 | 14 | |
| 30 | 15 | @JsonProperty("minlength") |
| 31 | 16 | public String getMinlength() { return minlength; } |
| 32 | 17 | @JsonProperty("minlength") |
| 33 | 18 | public void setMinlength(String value) { this.minlength = value; } |
| 34 | 19 | |
| 35 | - @JsonProperty("minMaxIntersection") | |
| 36 | - public String getMinMaxIntersection() { return minMaxIntersection; } | |
| 37 | - @JsonProperty("minMaxIntersection") | |
| 38 | - public void setMinMaxIntersection(String value) { this.minMaxIntersection = value; } | |
| 20 | + @JsonProperty("maxlength") | |
| 21 | + public String getMaxlength() { return maxlength; } | |
| 22 | + @JsonProperty("maxlength") | |
| 23 | + public void setMaxlength(String value) { this.maxlength = value; } | |
| 39 | 24 | |
| 40 | 25 | @JsonProperty("minmaxlength") |
| 41 | 26 | public String getMinmaxlength() { return minmaxlength; } |
| 42 | 27 | @JsonProperty("minmaxlength") |
| 43 | 28 | public void setMinmaxlength(String value) { this.minmaxlength = value; } |
| 44 | 29 | |
| 30 | + @JsonProperty("union") | |
| 31 | + public String getUnion() { return union; } | |
| 32 | + @JsonProperty("union") | |
| 33 | + public void setUnion(String value) { this.union = value; } | |
| 34 | + | |
| 35 | + @JsonProperty("inUnion") | |
| 36 | + public InUnion getInUnion() { return inUnion; } | |
| 37 | + @JsonProperty("inUnion") | |
| 38 | + public void setInUnion(InUnion value) { this.inUnion = value; } | |
| 39 | + | |
| 45 | 40 | @JsonProperty("minMaxUnion") |
| 46 | 41 | public String getMinMaxUnion() { return minMaxUnion; } |
| 47 | 42 | @JsonProperty("minMaxUnion") |
| 48 | 43 | public void setMinMaxUnion(String value) { this.minMaxUnion = value; } |
| 49 | 44 | |
| 50 | - @JsonProperty("union") | |
| 51 | - public String getUnion() { return union; } | |
| 52 | - @JsonProperty("union") | |
| 53 | - public void setUnion(String value) { this.union = value; } | |
| 45 | + @JsonProperty("intersection") | |
| 46 | + public String getIntersection() { return intersection; } | |
| 47 | + @JsonProperty("intersection") | |
| 48 | + public void setIntersection(String value) { this.intersection = value; } | |
| 49 | + | |
| 50 | + @JsonProperty("minMaxIntersection") | |
| 51 | + public String getMinMaxIntersection() { return minMaxIntersection; } | |
| 52 | + @JsonProperty("minMaxIntersection") | |
| 53 | + public void setMinMaxIntersection(String value) { this.minMaxIntersection = value; } | |
| 54 | 54 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+28 −28
| @@ -3,52 +3,52 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private String intersection; | |
| 7 | - private InUnion inUnion; | |
| 8 | - private String maxlength; | |
| 9 | 6 | private String minlength; |
| 10 | - private String minMaxIntersection; | |
| 7 | + private String maxlength; | |
| 11 | 8 | private String minmaxlength; |
| 12 | - private String minMaxUnion; | |
| 13 | 9 | private String union; |
| 14 | - | |
| 15 | - @JsonProperty("intersection") | |
| 16 | - public String getIntersection() { return intersection; } | |
| 17 | - @JsonProperty("intersection") | |
| 18 | - public void setIntersection(String value) { this.intersection = value; } | |
| 19 | - | |
| 20 | - @JsonProperty("inUnion") | |
| 21 | - public InUnion getInUnion() { return inUnion; } | |
| 22 | - @JsonProperty("inUnion") | |
| 23 | - public void setInUnion(InUnion value) { this.inUnion = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("maxlength") | |
| 26 | - public String getMaxlength() { return maxlength; } | |
| 27 | - @JsonProperty("maxlength") | |
| 28 | - public void setMaxlength(String value) { this.maxlength = value; } | |
| 10 | + private InUnion inUnion; | |
| 11 | + private String minMaxUnion; | |
| 12 | + private String intersection; | |
| 13 | + private String minMaxIntersection; | |
| 29 | 14 | |
| 30 | 15 | @JsonProperty("minlength") |
| 31 | 16 | public String getMinlength() { return minlength; } |
| 32 | 17 | @JsonProperty("minlength") |
| 33 | 18 | public void setMinlength(String value) { this.minlength = value; } |
| 34 | 19 | |
| 35 | - @JsonProperty("minMaxIntersection") | |
| 36 | - public String getMinMaxIntersection() { return minMaxIntersection; } | |
| 37 | - @JsonProperty("minMaxIntersection") | |
| 38 | - public void setMinMaxIntersection(String value) { this.minMaxIntersection = value; } | |
| 20 | + @JsonProperty("maxlength") | |
| 21 | + public String getMaxlength() { return maxlength; } | |
| 22 | + @JsonProperty("maxlength") | |
| 23 | + public void setMaxlength(String value) { this.maxlength = value; } | |
| 39 | 24 | |
| 40 | 25 | @JsonProperty("minmaxlength") |
| 41 | 26 | public String getMinmaxlength() { return minmaxlength; } |
| 42 | 27 | @JsonProperty("minmaxlength") |
| 43 | 28 | public void setMinmaxlength(String value) { this.minmaxlength = value; } |
| 44 | 29 | |
| 30 | + @JsonProperty("union") | |
| 31 | + public String getUnion() { return union; } | |
| 32 | + @JsonProperty("union") | |
| 33 | + public void setUnion(String value) { this.union = value; } | |
| 34 | + | |
| 35 | + @JsonProperty("inUnion") | |
| 36 | + public InUnion getInUnion() { return inUnion; } | |
| 37 | + @JsonProperty("inUnion") | |
| 38 | + public void setInUnion(InUnion value) { this.inUnion = value; } | |
| 39 | + | |
| 45 | 40 | @JsonProperty("minMaxUnion") |
| 46 | 41 | public String getMinMaxUnion() { return minMaxUnion; } |
| 47 | 42 | @JsonProperty("minMaxUnion") |
| 48 | 43 | public void setMinMaxUnion(String value) { this.minMaxUnion = value; } |
| 49 | 44 | |
| 50 | - @JsonProperty("union") | |
| 51 | - public String getUnion() { return union; } | |
| 52 | - @JsonProperty("union") | |
| 53 | - public void setUnion(String value) { this.union = value; } | |
| 45 | + @JsonProperty("intersection") | |
| 46 | + public String getIntersection() { return intersection; } | |
| 47 | + @JsonProperty("intersection") | |
| 48 | + public void setIntersection(String value) { this.intersection = value; } | |
| 49 | + | |
| 50 | + @JsonProperty("minMaxIntersection") | |
| 51 | + public String getMinMaxIntersection() { return minMaxIntersection; } | |
| 52 | + @JsonProperty("minMaxIntersection") | |
| 53 | + public void setMinMaxIntersection(String value) { this.minMaxIntersection = value; } | |
| 54 | 54 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+28 −28
| @@ -3,52 +3,52 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private String intersection; | |
| 7 | - private InUnion inUnion; | |
| 8 | - private String maxlength; | |
| 9 | 6 | private String minlength; |
| 10 | - private String minMaxIntersection; | |
| 7 | + private String maxlength; | |
| 11 | 8 | private String minmaxlength; |
| 12 | - private String minMaxUnion; | |
| 13 | 9 | private String union; |
| 14 | - | |
| 15 | - @JsonProperty("intersection") | |
| 16 | - public String getIntersection() { return intersection; } | |
| 17 | - @JsonProperty("intersection") | |
| 18 | - public void setIntersection(String value) { this.intersection = value; } | |
| 19 | - | |
| 20 | - @JsonProperty("inUnion") | |
| 21 | - public InUnion getInUnion() { return inUnion; } | |
| 22 | - @JsonProperty("inUnion") | |
| 23 | - public void setInUnion(InUnion value) { this.inUnion = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("maxlength") | |
| 26 | - public String getMaxlength() { return maxlength; } | |
| 27 | - @JsonProperty("maxlength") | |
| 28 | - public void setMaxlength(String value) { this.maxlength = value; } | |
| 10 | + private InUnion inUnion; | |
| 11 | + private String minMaxUnion; | |
| 12 | + private String intersection; | |
| 13 | + private String minMaxIntersection; | |
| 29 | 14 | |
| 30 | 15 | @JsonProperty("minlength") |
| 31 | 16 | public String getMinlength() { return minlength; } |
| 32 | 17 | @JsonProperty("minlength") |
| 33 | 18 | public void setMinlength(String value) { this.minlength = value; } |
| 34 | 19 | |
| 35 | - @JsonProperty("minMaxIntersection") | |
| 36 | - public String getMinMaxIntersection() { return minMaxIntersection; } | |
| 37 | - @JsonProperty("minMaxIntersection") | |
| 38 | - public void setMinMaxIntersection(String value) { this.minMaxIntersection = value; } | |
| 20 | + @JsonProperty("maxlength") | |
| 21 | + public String getMaxlength() { return maxlength; } | |
| 22 | + @JsonProperty("maxlength") | |
| 23 | + public void setMaxlength(String value) { this.maxlength = value; } | |
| 39 | 24 | |
| 40 | 25 | @JsonProperty("minmaxlength") |
| 41 | 26 | public String getMinmaxlength() { return minmaxlength; } |
| 42 | 27 | @JsonProperty("minmaxlength") |
| 43 | 28 | public void setMinmaxlength(String value) { this.minmaxlength = value; } |
| 44 | 29 | |
| 30 | + @JsonProperty("union") | |
| 31 | + public String getUnion() { return union; } | |
| 32 | + @JsonProperty("union") | |
| 33 | + public void setUnion(String value) { this.union = value; } | |
| 34 | + | |
| 35 | + @JsonProperty("inUnion") | |
| 36 | + public InUnion getInUnion() { return inUnion; } | |
| 37 | + @JsonProperty("inUnion") | |
| 38 | + public void setInUnion(InUnion value) { this.inUnion = value; } | |
| 39 | + | |
| 45 | 40 | @JsonProperty("minMaxUnion") |
| 46 | 41 | public String getMinMaxUnion() { return minMaxUnion; } |
| 47 | 42 | @JsonProperty("minMaxUnion") |
| 48 | 43 | public void setMinMaxUnion(String value) { this.minMaxUnion = value; } |
| 49 | 44 | |
| 50 | - @JsonProperty("union") | |
| 51 | - public String getUnion() { return union; } | |
| 52 | - @JsonProperty("union") | |
| 53 | - public void setUnion(String value) { this.union = value; } | |
| 45 | + @JsonProperty("intersection") | |
| 46 | + public String getIntersection() { return intersection; } | |
| 47 | + @JsonProperty("intersection") | |
| 48 | + public void setIntersection(String value) { this.intersection = value; } | |
| 49 | + | |
| 50 | + @JsonProperty("minMaxIntersection") | |
| 51 | + public String getMinMaxIntersection() { return minMaxIntersection; } | |
| 52 | + @JsonProperty("minMaxIntersection") | |
| 53 | + public void setMinMaxIntersection(String value) { this.minMaxIntersection = value; } | |
| 54 | 54 | } |
Mschema-javascriptdefault / TopLevel.js+5 −5
| @@ -172,14 +172,14 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "intersection", js: "intersection", typ: "" }, | |
| 176 | - { json: "inUnion", js: "inUnion", typ: u(3.14, "") }, | |
| 177 | - { json: "maxlength", js: "maxlength", typ: "" }, | |
| 178 | 175 | { json: "minlength", js: "minlength", typ: "" }, |
| 179 | - { json: "minMaxIntersection", js: "minMaxIntersection", typ: "" }, | |
| 176 | + { json: "maxlength", js: "maxlength", typ: "" }, | |
| 180 | 177 | { json: "minmaxlength", js: "minmaxlength", typ: "" }, |
| 181 | - { json: "minMaxUnion", js: "minMaxUnion", typ: "" }, | |
| 182 | 178 | { json: "union", js: "union", typ: "" }, |
| 179 | + { json: "inUnion", js: "inUnion", typ: u(3.14, "") }, | |
| 180 | + { json: "minMaxUnion", js: "minMaxUnion", typ: "" }, | |
| 181 | + { json: "intersection", js: "intersection", typ: "" }, | |
| 182 | + { json: "minMaxIntersection", js: "minMaxIntersection", typ: "" }, | |
| 183 | 183 | ], "any"), |
| 184 | 184 | }; |
Mschema-kotlin-jacksondefault / TopLevel.kt+8 −8
| @@ -32,28 +32,28 @@ val mapper = jacksonObjectMapper().apply { | ||
| 32 | 32 | |
| 33 | 33 | data class TopLevel ( |
| 34 | 34 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 35 | - val intersection: String, | |
| 36 | - | |
| 37 | - @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 38 | - val inUnion: InUnion, | |
| 35 | + val minlength: String, | |
| 39 | 36 | |
| 40 | 37 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 41 | 38 | val maxlength: String, |
| 42 | 39 | |
| 43 | 40 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 44 | - val minlength: String, | |
| 41 | + val minmaxlength: String, | |
| 45 | 42 | |
| 46 | 43 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 47 | - val minMaxIntersection: String, | |
| 44 | + val union: String, | |
| 48 | 45 | |
| 49 | 46 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 50 | - val minmaxlength: String, | |
| 47 | + val inUnion: InUnion, | |
| 51 | 48 | |
| 52 | 49 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 53 | 50 | val minMaxUnion: String, |
| 54 | 51 | |
| 55 | 52 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 56 | - val union: String | |
| 53 | + val intersection: String, | |
| 54 | + | |
| 55 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 56 | + val minMaxIntersection: String | |
| 57 | 57 | ) { |
| 58 | 58 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+5 −5
| @@ -18,14 +18,14 @@ private val klaxon = Klaxon() | ||
| 18 | 18 | .convert(InUnion::class, { InUnion.fromJson(it) }, { it.toJson() }, true) |
| 19 | 19 | |
| 20 | 20 | data class TopLevel ( |
| 21 | - val intersection: String, | |
| 22 | - val inUnion: InUnion, | |
| 23 | - val maxlength: String, | |
| 24 | 21 | val minlength: String, |
| 25 | - val minMaxIntersection: String, | |
| 22 | + val maxlength: String, | |
| 26 | 23 | val minmaxlength: String, |
| 24 | + val union: String, | |
| 25 | + val inUnion: InUnion, | |
| 27 | 26 | val minMaxUnion: String, |
| 28 | - val union: String | |
| 27 | + val intersection: String, | |
| 28 | + val minMaxIntersection: String | |
| 29 | 29 | ) { |
| 30 | 30 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-phpdefault / TopLevel.php+169 −169
| @@ -4,34 +4,34 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private string $intersection; // json:intersection Required | |
| 8 | - private float|string $inUnion; // json:inUnion Required | |
| 9 | - private string $maxlength; // json:maxlength Required | |
| 10 | 7 | private string $minlength; // json:minlength Required |
| 11 | - private string $minMaxIntersection; // json:minMaxIntersection Required | |
| 8 | + private string $maxlength; // json:maxlength Required | |
| 12 | 9 | private string $minmaxlength; // json:minmaxlength Required |
| 13 | - private string $minMaxUnion; // json:minMaxUnion Required | |
| 14 | 10 | private string $union; // json:union Required |
| 11 | + private float|string $inUnion; // json:inUnion Required | |
| 12 | + private string $minMaxUnion; // json:minMaxUnion Required | |
| 13 | + private string $intersection; // json:intersection Required | |
| 14 | + private string $minMaxIntersection; // json:minMaxIntersection Required | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | - * @param string $intersection | |
| 18 | - * @param float|string $inUnion | |
| 19 | - * @param string $maxlength | |
| 20 | 17 | * @param string $minlength |
| 21 | - * @param string $minMaxIntersection | |
| 18 | + * @param string $maxlength | |
| 22 | 19 | * @param string $minmaxlength |
| 23 | - * @param string $minMaxUnion | |
| 24 | 20 | * @param string $union |
| 21 | + * @param float|string $inUnion | |
| 22 | + * @param string $minMaxUnion | |
| 23 | + * @param string $intersection | |
| 24 | + * @param string $minMaxIntersection | |
| 25 | 25 | */ |
| 26 | - public function __construct(string $intersection, float|string $inUnion, string $maxlength, string $minlength, string $minMaxIntersection, string $minmaxlength, string $minMaxUnion, string $union) { | |
| 27 | - $this->intersection = $intersection; | |
| 28 | - $this->inUnion = $inUnion; | |
| 29 | - $this->maxlength = $maxlength; | |
| 26 | + public function __construct(string $minlength, string $maxlength, string $minmaxlength, string $union, float|string $inUnion, string $minMaxUnion, string $intersection, string $minMaxIntersection) { | |
| 30 | 27 | $this->minlength = $minlength; |
| 31 | - $this->minMaxIntersection = $minMaxIntersection; | |
| 28 | + $this->maxlength = $maxlength; | |
| 32 | 29 | $this->minmaxlength = $minmaxlength; |
| 33 | - $this->minMaxUnion = $minMaxUnion; | |
| 34 | 30 | $this->union = $union; |
| 31 | + $this->inUnion = $inUnion; | |
| 32 | + $this->minMaxUnion = $minMaxUnion; | |
| 33 | + $this->intersection = $intersection; | |
| 34 | + $this->minMaxIntersection = $minMaxIntersection; | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
| @@ -39,7 +39,7 @@ class TopLevel { | ||
| 39 | 39 | * @throws Exception |
| 40 | 40 | * @return string |
| 41 | 41 | */ |
| 42 | - public static function fromIntersection(string $value): string { | |
| 42 | + public static function fromMinlength(string $value): string { | |
| 43 | 43 | return $value; /*string*/ |
| 44 | 44 | } |
| 45 | 45 | |
| @@ -47,11 +47,11 @@ class TopLevel { | ||
| 47 | 47 | * @throws Exception |
| 48 | 48 | * @return string |
| 49 | 49 | */ |
| 50 | - public function toIntersection(): string { | |
| 51 | - if (TopLevel::validateIntersection($this->intersection)) { | |
| 52 | - return $this->intersection; /*string*/ | |
| 50 | + public function toMinlength(): string { | |
| 51 | + if (TopLevel::validateMinlength($this->minlength)) { | |
| 52 | + return $this->minlength; /*string*/ | |
| 53 | 53 | } |
| 54 | - throw new Exception('never get to this TopLevel::intersection'); | |
| 54 | + throw new Exception('never get to this TopLevel::minlength'); | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| @@ -59,7 +59,7 @@ class TopLevel { | ||
| 59 | 59 | * @return bool |
| 60 | 60 | * @throws Exception |
| 61 | 61 | */ |
| 62 | - public static function validateIntersection(string $value): bool { | |
| 62 | + public static function validateMinlength(string $value): bool { | |
| 63 | 63 | return true; |
| 64 | 64 | } |
| 65 | 65 | |
| @@ -67,88 +67,65 @@ class TopLevel { | ||
| 67 | 67 | * @throws Exception |
| 68 | 68 | * @return string |
| 69 | 69 | */ |
| 70 | - public function getIntersection(): string { | |
| 71 | - if (TopLevel::validateIntersection($this->intersection)) { | |
| 72 | - return $this->intersection; | |
| 70 | + public function getMinlength(): string { | |
| 71 | + if (TopLevel::validateMinlength($this->minlength)) { | |
| 72 | + return $this->minlength; | |
| 73 | 73 | } |
| 74 | - throw new Exception('never get to getIntersection TopLevel::intersection'); | |
| 74 | + throw new Exception('never get to getMinlength TopLevel::minlength'); | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * @return string |
| 79 | 79 | */ |
| 80 | - public static function sampleIntersection(): string { | |
| 81 | - return 'TopLevel::intersection::31'; /*31:intersection*/ | |
| 80 | + public static function sampleMinlength(): string { | |
| 81 | + return 'TopLevel::minlength::31'; /*31:minlength*/ | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | - * @param float|string $value | |
| 85 | + * @param string $value | |
| 86 | 86 | * @throws Exception |
| 87 | - * @return float|string | |
| 87 | + * @return string | |
| 88 | 88 | */ |
| 89 | - public static function fromInUnion(float|string $value): float|string { | |
| 90 | - if (is_float($value) || is_int($value)) { | |
| 91 | - return $value; /*float*/ | |
| 92 | - } elseif (is_string($value)) { | |
| 93 | - return $value; /*string*/ | |
| 94 | - } else { | |
| 95 | - throw new Exception('Cannot deserialize union value in TopLevel'); | |
| 96 | - } | |
| 89 | + public static function fromMaxlength(string $value): string { | |
| 90 | + return $value; /*string*/ | |
| 97 | 91 | } |
| 98 | 92 | |
| 99 | 93 | /** |
| 100 | 94 | * @throws Exception |
| 101 | - * @return float|string | |
| 95 | + * @return string | |
| 102 | 96 | */ |
| 103 | - public function toInUnion(): float|string { | |
| 104 | - if (TopLevel::validateInUnion($this->inUnion)) { | |
| 105 | - if (is_float($this->inUnion) || is_int($this->inUnion)) { | |
| 106 | - return $this->inUnion; /*float*/ | |
| 107 | - } elseif (is_string($this->inUnion)) { | |
| 108 | - return $this->inUnion; /*string*/ | |
| 109 | - } else { | |
| 110 | - throw new Exception('Union value has no matching member in TopLevel'); | |
| 111 | - } | |
| 97 | + public function toMaxlength(): string { | |
| 98 | + if (TopLevel::validateMaxlength($this->maxlength)) { | |
| 99 | + return $this->maxlength; /*string*/ | |
| 112 | 100 | } |
| 113 | - throw new Exception('never get to this TopLevel::inUnion'); | |
| 101 | + throw new Exception('never get to this TopLevel::maxlength'); | |
| 114 | 102 | } |
| 115 | 103 | |
| 116 | 104 | /** |
| 117 | - * @param float|string | |
| 105 | + * @param string | |
| 118 | 106 | * @return bool |
| 119 | 107 | * @throws Exception |
| 120 | 108 | */ |
| 121 | - public static function validateInUnion(float|string $value): bool { | |
| 122 | - if (is_float($value) || is_int($value)) { | |
| 123 | - if (!is_float($value) && !is_int($value)) { | |
| 124 | - throw new Exception("Attribute Error:TopLevel::inUnion"); | |
| 125 | - } | |
| 126 | - } elseif (is_string($value)) { | |
| 127 | - if (!is_string($value)) { | |
| 128 | - throw new Exception("Attribute Error:TopLevel::inUnion"); | |
| 129 | - } | |
| 130 | - } else { | |
| 131 | - throw new Exception("Attribute Error:TopLevel::inUnion"); | |
| 132 | - } | |
| 109 | + public static function validateMaxlength(string $value): bool { | |
| 133 | 110 | return true; |
| 134 | 111 | } |
| 135 | 112 | |
| 136 | 113 | /** |
| 137 | 114 | * @throws Exception |
| 138 | - * @return float|string | |
| 115 | + * @return string | |
| 139 | 116 | */ |
| 140 | - public function getInUnion(): float|string { | |
| 141 | - if (TopLevel::validateInUnion($this->inUnion)) { | |
| 142 | - return $this->inUnion; | |
| 117 | + public function getMaxlength(): string { | |
| 118 | + if (TopLevel::validateMaxlength($this->maxlength)) { | |
| 119 | + return $this->maxlength; | |
| 143 | 120 | } |
| 144 | - throw new Exception('never get to getInUnion TopLevel::inUnion'); | |
| 121 | + throw new Exception('never get to getMaxlength TopLevel::maxlength'); | |
| 145 | 122 | } |
| 146 | 123 | |
| 147 | 124 | /** |
| 148 | - * @return float|string | |
| 125 | + * @return string | |
| 149 | 126 | */ |
| 150 | - public static function sampleInUnion(): float|string { | |
| 151 | - return 32.032; /*32:inUnion*/ | |
| 127 | + public static function sampleMaxlength(): string { | |
| 128 | + return 'TopLevel::maxlength::32'; /*32:maxlength*/ | |
| 152 | 129 | } |
| 153 | 130 | |
| 154 | 131 | /** |
| @@ -156,7 +133,7 @@ class TopLevel { | ||
| 156 | 133 | * @throws Exception |
| 157 | 134 | * @return string |
| 158 | 135 | */ |
| 159 | - public static function fromMaxlength(string $value): string { | |
| 136 | + public static function fromMinmaxlength(string $value): string { | |
| 160 | 137 | return $value; /*string*/ |
| 161 | 138 | } |
| 162 | 139 | |
| @@ -164,11 +141,11 @@ class TopLevel { | ||
| 164 | 141 | * @throws Exception |
| 165 | 142 | * @return string |
| 166 | 143 | */ |
| 167 | - public function toMaxlength(): string { | |
| 168 | - if (TopLevel::validateMaxlength($this->maxlength)) { | |
| 169 | - return $this->maxlength; /*string*/ | |
| 144 | + public function toMinmaxlength(): string { | |
| 145 | + if (TopLevel::validateMinmaxlength($this->minmaxlength)) { | |
| 146 | + return $this->minmaxlength; /*string*/ | |
| 170 | 147 | } |
| 171 | - throw new Exception('never get to this TopLevel::maxlength'); | |
| 148 | + throw new Exception('never get to this TopLevel::minmaxlength'); | |
| 172 | 149 | } |
| 173 | 150 | |
| 174 | 151 | /** |
| @@ -176,7 +153,7 @@ class TopLevel { | ||
| 176 | 153 | * @return bool |
| 177 | 154 | * @throws Exception |
| 178 | 155 | */ |
| 179 | - public static function validateMaxlength(string $value): bool { | |
| 156 | + public static function validateMinmaxlength(string $value): bool { | |
| 180 | 157 | return true; |
| 181 | 158 | } |
| 182 | 159 | |
| @@ -184,18 +161,18 @@ class TopLevel { | ||
| 184 | 161 | * @throws Exception |
| 185 | 162 | * @return string |
| 186 | 163 | */ |
| 187 | - public function getMaxlength(): string { | |
| 188 | - if (TopLevel::validateMaxlength($this->maxlength)) { | |
| 189 | - return $this->maxlength; | |
| 164 | + public function getMinmaxlength(): string { | |
| 165 | + if (TopLevel::validateMinmaxlength($this->minmaxlength)) { | |
| 166 | + return $this->minmaxlength; | |
| 190 | 167 | } |
| 191 | - throw new Exception('never get to getMaxlength TopLevel::maxlength'); | |
| 168 | + throw new Exception('never get to getMinmaxlength TopLevel::minmaxlength'); | |
| 192 | 169 | } |
| 193 | 170 | |
| 194 | 171 | /** |
| 195 | 172 | * @return string |
| 196 | 173 | */ |
| 197 | - public static function sampleMaxlength(): string { | |
| 198 | - return 'TopLevel::maxlength::33'; /*33:maxlength*/ | |
| 174 | + public static function sampleMinmaxlength(): string { | |
| 175 | + return 'TopLevel::minmaxlength::33'; /*33:minmaxlength*/ | |
| 199 | 176 | } |
| 200 | 177 | |
| 201 | 178 | /** |
| @@ -203,7 +180,7 @@ class TopLevel { | ||
| 203 | 180 | * @throws Exception |
| 204 | 181 | * @return string |
| 205 | 182 | */ |
| 206 | - public static function fromMinlength(string $value): string { | |
| 183 | + public static function fromUnion(string $value): string { | |
| 207 | 184 | return $value; /*string*/ |
| 208 | 185 | } |
| 209 | 186 | |
| @@ -211,11 +188,11 @@ class TopLevel { | ||
| 211 | 188 | * @throws Exception |
| 212 | 189 | * @return string |
| 213 | 190 | */ |
| 214 | - public function toMinlength(): string { | |
| 215 | - if (TopLevel::validateMinlength($this->minlength)) { | |
| 216 | - return $this->minlength; /*string*/ | |
| 191 | + public function toUnion(): string { | |
| 192 | + if (TopLevel::validateUnion($this->union)) { | |
| 193 | + return $this->union; /*string*/ | |
| 217 | 194 | } |
| 218 | - throw new Exception('never get to this TopLevel::minlength'); | |
| 195 | + throw new Exception('never get to this TopLevel::union'); | |
| 219 | 196 | } |
| 220 | 197 | |
| 221 | 198 | /** |
| @@ -223,7 +200,7 @@ class TopLevel { | ||
| 223 | 200 | * @return bool |
| 224 | 201 | * @throws Exception |
| 225 | 202 | */ |
| 226 | - public static function validateMinlength(string $value): bool { | |
| 203 | + public static function validateUnion(string $value): bool { | |
| 227 | 204 | return true; |
| 228 | 205 | } |
| 229 | 206 | |
| @@ -231,65 +208,88 @@ class TopLevel { | ||
| 231 | 208 | * @throws Exception |
| 232 | 209 | * @return string |
| 233 | 210 | */ |
| 234 | - public function getMinlength(): string { | |
| 235 | - if (TopLevel::validateMinlength($this->minlength)) { | |
| 236 | - return $this->minlength; | |
| 211 | + public function getUnion(): string { | |
| 212 | + if (TopLevel::validateUnion($this->union)) { | |
| 213 | + return $this->union; | |
| 237 | 214 | } |
| 238 | - throw new Exception('never get to getMinlength TopLevel::minlength'); | |
| 215 | + throw new Exception('never get to getUnion TopLevel::union'); | |
| 239 | 216 | } |
| 240 | 217 | |
| 241 | 218 | /** |
| 242 | 219 | * @return string |
| 243 | 220 | */ |
| 244 | - public static function sampleMinlength(): string { | |
| 245 | - return 'TopLevel::minlength::34'; /*34:minlength*/ | |
| 221 | + public static function sampleUnion(): string { | |
| 222 | + return 'TopLevel::union::34'; /*34:union*/ | |
| 246 | 223 | } |
| 247 | 224 | |
| 248 | 225 | /** |
| 249 | - * @param string $value | |
| 226 | + * @param float|string $value | |
| 250 | 227 | * @throws Exception |
| 251 | - * @return string | |
| 228 | + * @return float|string | |
| 252 | 229 | */ |
| 253 | - public static function fromMinMaxIntersection(string $value): string { | |
| 254 | - return $value; /*string*/ | |
| 230 | + public static function fromInUnion(float|string $value): float|string { | |
| 231 | + if (is_float($value) || is_int($value)) { | |
| 232 | + return $value; /*float*/ | |
| 233 | + } elseif (is_string($value)) { | |
| 234 | + return $value; /*string*/ | |
| 235 | + } else { | |
| 236 | + throw new Exception('Cannot deserialize union value in TopLevel'); | |
| 237 | + } | |
| 255 | 238 | } |
| 256 | 239 | |
| 257 | 240 | /** |
| 258 | 241 | * @throws Exception |
| 259 | - * @return string | |
| 242 | + * @return float|string | |
| 260 | 243 | */ |
| 261 | - public function toMinMaxIntersection(): string { | |
| 262 | - if (TopLevel::validateMinMaxIntersection($this->minMaxIntersection)) { | |
| 263 | - return $this->minMaxIntersection; /*string*/ | |
| 244 | + public function toInUnion(): float|string { | |
| 245 | + if (TopLevel::validateInUnion($this->inUnion)) { | |
| 246 | + if (is_float($this->inUnion) || is_int($this->inUnion)) { | |
| 247 | + return $this->inUnion; /*float*/ | |
| 248 | + } elseif (is_string($this->inUnion)) { | |
| 249 | + return $this->inUnion; /*string*/ | |
| 250 | + } else { | |
| 251 | + throw new Exception('Union value has no matching member in TopLevel'); | |
| 252 | + } | |
| 264 | 253 | } |
| 265 | - throw new Exception('never get to this TopLevel::minMaxIntersection'); | |
| 254 | + throw new Exception('never get to this TopLevel::inUnion'); | |
| 266 | 255 | } |
| 267 | 256 | |
| 268 | 257 | /** |
| 269 | - * @param string | |
| 258 | + * @param float|string | |
| 270 | 259 | * @return bool |
| 271 | 260 | * @throws Exception |
| 272 | 261 | */ |
| 273 | - public static function validateMinMaxIntersection(string $value): bool { | |
| 262 | + public static function validateInUnion(float|string $value): bool { | |
| 263 | + if (is_float($value) || is_int($value)) { | |
| 264 | + if (!is_float($value) && !is_int($value)) { | |
| 265 | + throw new Exception("Attribute Error:TopLevel::inUnion"); | |
| 266 | + } | |
| 267 | + } elseif (is_string($value)) { | |
| 268 | + if (!is_string($value)) { | |
| 269 | + throw new Exception("Attribute Error:TopLevel::inUnion"); | |
| 270 | + } | |
| 271 | + } else { | |
| 272 | + throw new Exception("Attribute Error:TopLevel::inUnion"); | |
| 273 | + } | |
| 274 | 274 | return true; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
| 278 | 278 | * @throws Exception |
| 279 | - * @return string | |
| 279 | + * @return float|string | |
| 280 | 280 | */ |
| 281 | - public function getMinMaxIntersection(): string { | |
| 282 | - if (TopLevel::validateMinMaxIntersection($this->minMaxIntersection)) { | |
| 283 | - return $this->minMaxIntersection; | |
| 281 | + public function getInUnion(): float|string { | |
| 282 | + if (TopLevel::validateInUnion($this->inUnion)) { | |
| 283 | + return $this->inUnion; | |
| 284 | 284 | } |
| 285 | - throw new Exception('never get to getMinMaxIntersection TopLevel::minMaxIntersection'); | |
| 285 | + throw new Exception('never get to getInUnion TopLevel::inUnion'); | |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | /** |
| 289 | - * @return string | |
| 289 | + * @return float|string | |
| 290 | 290 | */ |
| 291 | - public static function sampleMinMaxIntersection(): string { | |
| 292 | - return 'TopLevel::minMaxIntersection::35'; /*35:minMaxIntersection*/ | |
| 291 | + public static function sampleInUnion(): float|string { | |
| 292 | + return 35.035; /*35:inUnion*/ | |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
| @@ -297,7 +297,7 @@ class TopLevel { | ||
| 297 | 297 | * @throws Exception |
| 298 | 298 | * @return string |
| 299 | 299 | */ |
| 300 | - public static function fromMinmaxlength(string $value): string { | |
| 300 | + public static function fromMinMaxUnion(string $value): string { | |
| 301 | 301 | return $value; /*string*/ |
| 302 | 302 | } |
| 303 | 303 | |
| @@ -305,11 +305,11 @@ class TopLevel { | ||
| 305 | 305 | * @throws Exception |
| 306 | 306 | * @return string |
| 307 | 307 | */ |
| 308 | - public function toMinmaxlength(): string { | |
| 309 | - if (TopLevel::validateMinmaxlength($this->minmaxlength)) { | |
| 310 | - return $this->minmaxlength; /*string*/ | |
| 308 | + public function toMinMaxUnion(): string { | |
| 309 | + if (TopLevel::validateMinMaxUnion($this->minMaxUnion)) { | |
| 310 | + return $this->minMaxUnion; /*string*/ | |
| 311 | 311 | } |
| 312 | - throw new Exception('never get to this TopLevel::minmaxlength'); | |
| 312 | + throw new Exception('never get to this TopLevel::minMaxUnion'); | |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
| @@ -317,7 +317,7 @@ class TopLevel { | ||
| 317 | 317 | * @return bool |
| 318 | 318 | * @throws Exception |
| 319 | 319 | */ |
| 320 | - public static function validateMinmaxlength(string $value): bool { | |
| 320 | + public static function validateMinMaxUnion(string $value): bool { | |
| 321 | 321 | return true; |
| 322 | 322 | } |
| 323 | 323 | |
| @@ -325,18 +325,18 @@ class TopLevel { | ||
| 325 | 325 | * @throws Exception |
| 326 | 326 | * @return string |
| 327 | 327 | */ |
| 328 | - public function getMinmaxlength(): string { | |
| 329 | - if (TopLevel::validateMinmaxlength($this->minmaxlength)) { | |
| 330 | - return $this->minmaxlength; | |
| 328 | + public function getMinMaxUnion(): string { | |
| 329 | + if (TopLevel::validateMinMaxUnion($this->minMaxUnion)) { | |
| 330 | + return $this->minMaxUnion; | |
| 331 | 331 | } |
| 332 | - throw new Exception('never get to getMinmaxlength TopLevel::minmaxlength'); | |
| 332 | + throw new Exception('never get to getMinMaxUnion TopLevel::minMaxUnion'); | |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | /** |
| 336 | 336 | * @return string |
| 337 | 337 | */ |
| 338 | - public static function sampleMinmaxlength(): string { | |
| 339 | - return 'TopLevel::minmaxlength::36'; /*36:minmaxlength*/ | |
| 338 | + public static function sampleMinMaxUnion(): string { | |
| 339 | + return 'TopLevel::minMaxUnion::36'; /*36:minMaxUnion*/ | |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | /** |
| @@ -344,7 +344,7 @@ class TopLevel { | ||
| 344 | 344 | * @throws Exception |
| 345 | 345 | * @return string |
| 346 | 346 | */ |
| 347 | - public static function fromMinMaxUnion(string $value): string { | |
| 347 | + public static function fromIntersection(string $value): string { | |
| 348 | 348 | return $value; /*string*/ |
| 349 | 349 | } |
| 350 | 350 | |
| @@ -352,11 +352,11 @@ class TopLevel { | ||
| 352 | 352 | * @throws Exception |
| 353 | 353 | * @return string |
| 354 | 354 | */ |
| 355 | - public function toMinMaxUnion(): string { | |
| 356 | - if (TopLevel::validateMinMaxUnion($this->minMaxUnion)) { | |
| 357 | - return $this->minMaxUnion; /*string*/ | |
| 355 | + public function toIntersection(): string { | |
| 356 | + if (TopLevel::validateIntersection($this->intersection)) { | |
| 357 | + return $this->intersection; /*string*/ | |
| 358 | 358 | } |
| 359 | - throw new Exception('never get to this TopLevel::minMaxUnion'); | |
| 359 | + throw new Exception('never get to this TopLevel::intersection'); | |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /** |
| @@ -364,7 +364,7 @@ class TopLevel { | ||
| 364 | 364 | * @return bool |
| 365 | 365 | * @throws Exception |
| 366 | 366 | */ |
| 367 | - public static function validateMinMaxUnion(string $value): bool { | |
| 367 | + public static function validateIntersection(string $value): bool { | |
| 368 | 368 | return true; |
| 369 | 369 | } |
| 370 | 370 | |
| @@ -372,18 +372,18 @@ class TopLevel { | ||
| 372 | 372 | * @throws Exception |
| 373 | 373 | * @return string |
| 374 | 374 | */ |
| 375 | - public function getMinMaxUnion(): string { | |
| 376 | - if (TopLevel::validateMinMaxUnion($this->minMaxUnion)) { | |
| 377 | - return $this->minMaxUnion; | |
| 375 | + public function getIntersection(): string { | |
| 376 | + if (TopLevel::validateIntersection($this->intersection)) { | |
| 377 | + return $this->intersection; | |
| 378 | 378 | } |
| 379 | - throw new Exception('never get to getMinMaxUnion TopLevel::minMaxUnion'); | |
| 379 | + throw new Exception('never get to getIntersection TopLevel::intersection'); | |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | /** |
| 383 | 383 | * @return string |
| 384 | 384 | */ |
| 385 | - public static function sampleMinMaxUnion(): string { | |
| 386 | - return 'TopLevel::minMaxUnion::37'; /*37:minMaxUnion*/ | |
| 385 | + public static function sampleIntersection(): string { | |
| 386 | + return 'TopLevel::intersection::37'; /*37:intersection*/ | |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | /** |
| @@ -391,7 +391,7 @@ class TopLevel { | ||
| 391 | 391 | * @throws Exception |
| 392 | 392 | * @return string |
| 393 | 393 | */ |
| 394 | - public static function fromUnion(string $value): string { | |
| 394 | + public static function fromMinMaxIntersection(string $value): string { | |
| 395 | 395 | return $value; /*string*/ |
| 396 | 396 | } |
| 397 | 397 | |
| @@ -399,11 +399,11 @@ class TopLevel { | ||
| 399 | 399 | * @throws Exception |
| 400 | 400 | * @return string |
| 401 | 401 | */ |
| 402 | - public function toUnion(): string { | |
| 403 | - if (TopLevel::validateUnion($this->union)) { | |
| 404 | - return $this->union; /*string*/ | |
| 402 | + public function toMinMaxIntersection(): string { | |
| 403 | + if (TopLevel::validateMinMaxIntersection($this->minMaxIntersection)) { | |
| 404 | + return $this->minMaxIntersection; /*string*/ | |
| 405 | 405 | } |
| 406 | - throw new Exception('never get to this TopLevel::union'); | |
| 406 | + throw new Exception('never get to this TopLevel::minMaxIntersection'); | |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | /** |
| @@ -411,7 +411,7 @@ class TopLevel { | ||
| 411 | 411 | * @return bool |
| 412 | 412 | * @throws Exception |
| 413 | 413 | */ |
| 414 | - public static function validateUnion(string $value): bool { | |
| 414 | + public static function validateMinMaxIntersection(string $value): bool { | |
| 415 | 415 | return true; |
| 416 | 416 | } |
| 417 | 417 | |
| @@ -419,18 +419,18 @@ class TopLevel { | ||
| 419 | 419 | * @throws Exception |
| 420 | 420 | * @return string |
| 421 | 421 | */ |
| 422 | - public function getUnion(): string { | |
| 423 | - if (TopLevel::validateUnion($this->union)) { | |
| 424 | - return $this->union; | |
| 422 | + public function getMinMaxIntersection(): string { | |
| 423 | + if (TopLevel::validateMinMaxIntersection($this->minMaxIntersection)) { | |
| 424 | + return $this->minMaxIntersection; | |
| 425 | 425 | } |
| 426 | - throw new Exception('never get to getUnion TopLevel::union'); | |
| 426 | + throw new Exception('never get to getMinMaxIntersection TopLevel::minMaxIntersection'); | |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | /** |
| 430 | 430 | * @return string |
| 431 | 431 | */ |
| 432 | - public static function sampleUnion(): string { | |
| 433 | - return 'TopLevel::union::38'; /*38:union*/ | |
| 432 | + public static function sampleMinMaxIntersection(): string { | |
| 433 | + return 'TopLevel::minMaxIntersection::38'; /*38:minMaxIntersection*/ | |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | /** |
| @@ -438,14 +438,14 @@ class TopLevel { | ||
| 438 | 438 | * @return bool |
| 439 | 439 | */ |
| 440 | 440 | public function validate(): bool { |
| 441 | - return TopLevel::validateIntersection($this->intersection) | |
| 442 | - || TopLevel::validateInUnion($this->inUnion) | |
| 441 | + return TopLevel::validateMinlength($this->minlength) | |
| 443 | 442 | || TopLevel::validateMaxlength($this->maxlength) |
| 444 | - || TopLevel::validateMinlength($this->minlength) | |
| 445 | - || TopLevel::validateMinMaxIntersection($this->minMaxIntersection) | |
| 446 | 443 | || TopLevel::validateMinmaxlength($this->minmaxlength) |
| 444 | + || TopLevel::validateUnion($this->union) | |
| 445 | + || TopLevel::validateInUnion($this->inUnion) | |
| 447 | 446 | || TopLevel::validateMinMaxUnion($this->minMaxUnion) |
| 448 | - || TopLevel::validateUnion($this->union); | |
| 447 | + || TopLevel::validateIntersection($this->intersection) | |
| 448 | + || TopLevel::validateMinMaxIntersection($this->minMaxIntersection); | |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | /** |
| @@ -454,14 +454,14 @@ class TopLevel { | ||
| 454 | 454 | */ |
| 455 | 455 | public function to(): stdClass { |
| 456 | 456 | $out = new stdClass(); |
| 457 | - $out->{'intersection'} = $this->toIntersection(); | |
| 458 | - $out->{'inUnion'} = $this->toInUnion(); | |
| 459 | - $out->{'maxlength'} = $this->toMaxlength(); | |
| 460 | 457 | $out->{'minlength'} = $this->toMinlength(); |
| 461 | - $out->{'minMaxIntersection'} = $this->toMinMaxIntersection(); | |
| 458 | + $out->{'maxlength'} = $this->toMaxlength(); | |
| 462 | 459 | $out->{'minmaxlength'} = $this->toMinmaxlength(); |
| 463 | - $out->{'minMaxUnion'} = $this->toMinMaxUnion(); | |
| 464 | 460 | $out->{'union'} = $this->toUnion(); |
| 461 | + $out->{'inUnion'} = $this->toInUnion(); | |
| 462 | + $out->{'minMaxUnion'} = $this->toMinMaxUnion(); | |
| 463 | + $out->{'intersection'} = $this->toIntersection(); | |
| 464 | + $out->{'minMaxIntersection'} = $this->toMinMaxIntersection(); | |
| 465 | 465 | return $out; |
| 466 | 466 | } |
| 467 | 467 | |
| @@ -472,14 +472,14 @@ class TopLevel { | ||
| 472 | 472 | */ |
| 473 | 473 | public static function from(stdClass $obj): TopLevel { |
| 474 | 474 | return new TopLevel( |
| 475 | - TopLevel::fromIntersection($obj->{'intersection'}) | |
| 476 | - ,TopLevel::fromInUnion($obj->{'inUnion'}) | |
| 475 | + TopLevel::fromMinlength($obj->{'minlength'}) | |
| 477 | 476 | ,TopLevel::fromMaxlength($obj->{'maxlength'}) |
| 478 | - ,TopLevel::fromMinlength($obj->{'minlength'}) | |
| 479 | - ,TopLevel::fromMinMaxIntersection($obj->{'minMaxIntersection'}) | |
| 480 | 477 | ,TopLevel::fromMinmaxlength($obj->{'minmaxlength'}) |
| 481 | - ,TopLevel::fromMinMaxUnion($obj->{'minMaxUnion'}) | |
| 482 | 478 | ,TopLevel::fromUnion($obj->{'union'}) |
| 479 | + ,TopLevel::fromInUnion($obj->{'inUnion'}) | |
| 480 | + ,TopLevel::fromMinMaxUnion($obj->{'minMaxUnion'}) | |
| 481 | + ,TopLevel::fromIntersection($obj->{'intersection'}) | |
| 482 | + ,TopLevel::fromMinMaxIntersection($obj->{'minMaxIntersection'}) | |
| 483 | 483 | ); |
| 484 | 484 | } |
| 485 | 485 | |
| @@ -488,14 +488,14 @@ class TopLevel { | ||
| 488 | 488 | */ |
| 489 | 489 | public static function sample(): TopLevel { |
| 490 | 490 | return new TopLevel( |
| 491 | - TopLevel::sampleIntersection() | |
| 492 | - ,TopLevel::sampleInUnion() | |
| 491 | + TopLevel::sampleMinlength() | |
| 493 | 492 | ,TopLevel::sampleMaxlength() |
| 494 | - ,TopLevel::sampleMinlength() | |
| 495 | - ,TopLevel::sampleMinMaxIntersection() | |
| 496 | 493 | ,TopLevel::sampleMinmaxlength() |
| 497 | - ,TopLevel::sampleMinMaxUnion() | |
| 498 | 494 | ,TopLevel::sampleUnion() |
| 495 | + ,TopLevel::sampleInUnion() | |
| 496 | + ,TopLevel::sampleMinMaxUnion() | |
| 497 | + ,TopLevel::sampleIntersection() | |
| 498 | + ,TopLevel::sampleMinMaxIntersection() | |
| 499 | 499 | ); |
| 500 | 500 | } |
| 501 | 501 | } |
Mschema-pikedefault / TopLevel.pmod+15 −15
| @@ -13,25 +13,25 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - string intersection; // json: "intersection" | |
| 17 | - InUnion in_union; // json: "inUnion" | |
| 18 | - string maxlength; // json: "maxlength" | |
| 19 | 16 | string minlength; // json: "minlength" |
| 20 | - string min_max_intersection; // json: "minMaxIntersection" | |
| 17 | + string maxlength; // json: "maxlength" | |
| 21 | 18 | string minmaxlength; // json: "minmaxlength" |
| 22 | - string min_max_union; // json: "minMaxUnion" | |
| 23 | 19 | string union; // json: "union" |
| 20 | + InUnion in_union; // json: "inUnion" | |
| 21 | + string min_max_union; // json: "minMaxUnion" | |
| 22 | + string intersection; // json: "intersection" | |
| 23 | + string min_max_intersection; // json: "minMaxIntersection" | |
| 24 | 24 | |
| 25 | 25 | string encode_json() { |
| 26 | 26 | mapping(string:mixed) json = ([ |
| 27 | - "intersection" : intersection, | |
| 28 | - "inUnion" : in_union, | |
| 29 | - "maxlength" : maxlength, | |
| 30 | 27 | "minlength" : minlength, |
| 31 | - "minMaxIntersection" : min_max_intersection, | |
| 28 | + "maxlength" : maxlength, | |
| 32 | 29 | "minmaxlength" : minmaxlength, |
| 33 | - "minMaxUnion" : min_max_union, | |
| 34 | 30 | "union" : union, |
| 31 | + "inUnion" : in_union, | |
| 32 | + "minMaxUnion" : min_max_union, | |
| 33 | + "intersection" : intersection, | |
| 34 | + "minMaxIntersection" : min_max_intersection, | |
| 35 | 35 | ]); |
| 36 | 36 | |
| 37 | 37 | return Standards.JSON.encode(json); |
| @@ -41,14 +41,14 @@ class TopLevel { | ||
| 41 | 41 | TopLevel TopLevel_from_JSON(mixed json) { |
| 42 | 42 | TopLevel retval = TopLevel(); |
| 43 | 43 | |
| 44 | - retval.intersection = json["intersection"]; | |
| 45 | - retval.in_union = json["inUnion"]; | |
| 46 | - retval.maxlength = json["maxlength"]; | |
| 47 | 44 | retval.minlength = json["minlength"]; |
| 48 | - retval.min_max_intersection = json["minMaxIntersection"]; | |
| 45 | + retval.maxlength = json["maxlength"]; | |
| 49 | 46 | retval.minmaxlength = json["minmaxlength"]; |
| 50 | - retval.min_max_union = json["minMaxUnion"]; | |
| 51 | 47 | retval.union = json["union"]; |
| 48 | + retval.in_union = json["inUnion"]; | |
| 49 | + retval.min_max_union = json["minMaxUnion"]; | |
| 50 | + retval.intersection = json["intersection"]; | |
| 51 | + retval.min_max_intersection = json["minMaxIntersection"]; | |
| 52 | 52 | |
| 53 | 53 | return retval; |
| 54 | 54 | } |
Mschema-pythondefault / quicktype.py+16 −16
| @@ -36,38 +36,38 @@ def to_class(c: Type[T], x: Any) -> dict: | ||
| 36 | 36 | |
| 37 | 37 | @dataclass |
| 38 | 38 | class TopLevel: |
| 39 | - intersection: str | |
| 40 | - in_union: float | str | |
| 41 | - maxlength: str | |
| 42 | 39 | minlength: str |
| 43 | - min_max_intersection: str | |
| 40 | + maxlength: str | |
| 44 | 41 | minmaxlength: str |
| 45 | - min_max_union: str | |
| 46 | 42 | union: str |
| 43 | + in_union: float | str | |
| 44 | + min_max_union: str | |
| 45 | + intersection: str | |
| 46 | + min_max_intersection: str | |
| 47 | 47 | |
| 48 | 48 | @staticmethod |
| 49 | 49 | def from_dict(obj: Any) -> 'TopLevel': |
| 50 | 50 | assert isinstance(obj, dict) |
| 51 | - intersection = from_str(obj.get("intersection")) | |
| 52 | - in_union = from_union([from_float, from_str], obj.get("inUnion")) | |
| 53 | - maxlength = from_str(obj.get("maxlength")) | |
| 54 | 51 | minlength = from_str(obj.get("minlength")) |
| 55 | - min_max_intersection = from_str(obj.get("minMaxIntersection")) | |
| 52 | + maxlength = from_str(obj.get("maxlength")) | |
| 56 | 53 | minmaxlength = from_str(obj.get("minmaxlength")) |
| 57 | - min_max_union = from_str(obj.get("minMaxUnion")) | |
| 58 | 54 | union = from_str(obj.get("union")) |
| 59 | - return TopLevel(intersection, in_union, maxlength, minlength, min_max_intersection, minmaxlength, min_max_union, union) | |
| 55 | + in_union = from_union([from_float, from_str], obj.get("inUnion")) | |
| 56 | + min_max_union = from_str(obj.get("minMaxUnion")) | |
| 57 | + intersection = from_str(obj.get("intersection")) | |
| 58 | + min_max_intersection = from_str(obj.get("minMaxIntersection")) | |
| 59 | + return TopLevel(minlength, maxlength, minmaxlength, union, in_union, min_max_union, intersection, min_max_intersection) | |
| 60 | 60 | |
| 61 | 61 | def to_dict(self) -> dict: |
| 62 | 62 | result: dict = {} |
| 63 | - result["intersection"] = from_str(self.intersection) | |
| 64 | - result["inUnion"] = from_union([to_float, from_str], self.in_union) | |
| 65 | - result["maxlength"] = from_str(self.maxlength) | |
| 66 | 63 | result["minlength"] = from_str(self.minlength) |
| 67 | - result["minMaxIntersection"] = from_str(self.min_max_intersection) | |
| 64 | + result["maxlength"] = from_str(self.maxlength) | |
| 68 | 65 | result["minmaxlength"] = from_str(self.minmaxlength) |
| 69 | - result["minMaxUnion"] = from_str(self.min_max_union) | |
| 70 | 66 | result["union"] = from_str(self.union) |
| 67 | + result["inUnion"] = from_union([to_float, from_str], self.in_union) | |
| 68 | + result["minMaxUnion"] = from_str(self.min_max_union) | |
| 69 | + result["intersection"] = from_str(self.intersection) | |
| 70 | + result["minMaxIntersection"] = from_str(self.min_max_intersection) | |
| 71 | 71 | return result |
Mschema-rubydefault / TopLevel.rb+16 −16
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.intersection | |
| 7 | +# puts top_level.minlength | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -52,26 +52,26 @@ class InUnion < Dry::Struct | ||
| 52 | 52 | end |
| 53 | 53 | |
| 54 | 54 | class TopLevel < Dry::Struct |
| 55 | - attribute :intersection, Types::String | |
| 56 | - attribute :in_union, Types.Instance(InUnion) | |
| 57 | - attribute :maxlength, Types::String | |
| 58 | 55 | attribute :minlength, Types::String |
| 59 | - attribute :min_max_intersection, Types::String | |
| 56 | + attribute :maxlength, Types::String | |
| 60 | 57 | attribute :minmaxlength, Types::String |
| 61 | - attribute :min_max_union, Types::String | |
| 62 | 58 | attribute :union, Types::String |
| 59 | + attribute :in_union, Types.Instance(InUnion) | |
| 60 | + attribute :min_max_union, Types::String | |
| 61 | + attribute :intersection, Types::String | |
| 62 | + attribute :min_max_intersection, Types::String | |
| 63 | 63 | |
| 64 | 64 | def self.from_dynamic!(d) |
| 65 | 65 | d = Types::Hash[d] |
| 66 | 66 | new( |
| 67 | - intersection: d.fetch("intersection"), | |
| 68 | - in_union: InUnion.from_dynamic!(d.fetch("inUnion")), | |
| 69 | - maxlength: d.fetch("maxlength"), | |
| 70 | 67 | minlength: d.fetch("minlength"), |
| 71 | - min_max_intersection: d.fetch("minMaxIntersection"), | |
| 68 | + maxlength: d.fetch("maxlength"), | |
| 72 | 69 | minmaxlength: d.fetch("minmaxlength"), |
| 73 | - min_max_union: d.fetch("minMaxUnion"), | |
| 74 | 70 | union: d.fetch("union"), |
| 71 | + in_union: InUnion.from_dynamic!(d.fetch("inUnion")), | |
| 72 | + min_max_union: d.fetch("minMaxUnion"), | |
| 73 | + intersection: d.fetch("intersection"), | |
| 74 | + min_max_intersection: d.fetch("minMaxIntersection"), | |
| 75 | 75 | ) |
| 76 | 76 | end |
| 77 | 77 | |
| @@ -81,14 +81,14 @@ class TopLevel < Dry::Struct | ||
| 81 | 81 | |
| 82 | 82 | def to_dynamic |
| 83 | 83 | { |
| 84 | - "intersection" => intersection, | |
| 85 | - "inUnion" => in_union.to_dynamic, | |
| 86 | - "maxlength" => maxlength, | |
| 87 | 84 | "minlength" => minlength, |
| 88 | - "minMaxIntersection" => min_max_intersection, | |
| 85 | + "maxlength" => maxlength, | |
| 89 | 86 | "minmaxlength" => minmaxlength, |
| 90 | - "minMaxUnion" => min_max_union, | |
| 91 | 87 | "union" => union, |
| 88 | + "inUnion" => in_union.to_dynamic, | |
| 89 | + "minMaxUnion" => min_max_union, | |
| 90 | + "intersection" => intersection, | |
| 91 | + "minMaxIntersection" => min_max_intersection, | |
| 92 | 92 | } |
| 93 | 93 | end |
Mschema-rustdefault / module_under_test.rs+8 −8
| @@ -16,22 +16,22 @@ use serde::{Serialize, Deserialize}; | ||
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | #[serde(rename_all = "camelCase")] |
| 18 | 18 | pub struct TopLevel { |
| 19 | - pub intersection: String, | |
| 20 | - | |
| 21 | - pub in_union: InUnion, | |
| 19 | + pub minlength: String, | |
| 22 | 20 | |
| 23 | 21 | pub maxlength: String, |
| 24 | 22 | |
| 25 | - pub minlength: String, | |
| 23 | + pub minmaxlength: String, | |
| 26 | 24 | |
| 27 | - pub min_max_intersection: String, | |
| 25 | + #[serde(rename = "union")] | |
| 26 | + pub top_level_union: String, | |
| 28 | 27 | |
| 29 | - pub minmaxlength: String, | |
| 28 | + pub in_union: InUnion, | |
| 30 | 29 | |
| 31 | 30 | pub min_max_union: String, |
| 32 | 31 | |
| 33 | - #[serde(rename = "union")] | |
| 34 | - pub top_level_union: String, | |
| 32 | + pub intersection: String, | |
| 33 | + | |
| 34 | + pub min_max_intersection: String, | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | #[derive(Debug, Clone, Serialize, Deserialize)] |
Mschema-scala3-upickledefault / TopLevel.scala+5 −5
| @@ -66,14 +66,14 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val intersection : String, | |
| 70 | - val inUnion : InUnion, | |
| 71 | - val maxlength : String, | |
| 72 | 69 | val minlength : String, |
| 73 | - val minMaxIntersection : String, | |
| 70 | + val maxlength : String, | |
| 74 | 71 | val minmaxlength : String, |
| 72 | + val union : String, | |
| 73 | + val inUnion : InUnion, | |
| 75 | 74 | val minMaxUnion : String, |
| 76 | - val union : String | |
| 75 | + val intersection : String, | |
| 76 | + val minMaxIntersection : String | |
| 77 | 77 | ) derives OptionPickler.ReadWriter |
| 78 | 78 | |
| 79 | 79 | type InUnion = Double | String |
Mschema-scala3default / TopLevel.scala+5 −5
| @@ -8,14 +8,14 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val intersection : String, | |
| 12 | - val inUnion : InUnion, | |
| 13 | - val maxlength : String, | |
| 14 | 11 | val minlength : String, |
| 15 | - val minMaxIntersection : String, | |
| 12 | + val maxlength : String, | |
| 16 | 13 | val minmaxlength : String, |
| 14 | + val union : String, | |
| 15 | + val inUnion : InUnion, | |
| 17 | 16 | val minMaxUnion : String, |
| 18 | - val union : String | |
| 17 | + val intersection : String, | |
| 18 | + val minMaxIntersection : String | |
| 19 | 19 | ) derives Encoder.AsObject, Decoder |
| 20 | 20 | |
| 21 | 21 | type InUnion = Double | String |
Mschema-schemadefault / TopLevel.schema+15 −15
| @@ -6,39 +6,39 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": {}, |
| 8 | 8 | "properties": { |
| 9 | - "intersection": { | |
| 9 | + "minlength": { | |
| 10 | 10 | "type": "string", |
| 11 | - "minLength": 4, | |
| 12 | - "maxLength": 5 | |
| 13 | - }, | |
| 14 | - "inUnion": { | |
| 15 | - "$ref": "#/definitions/InUnion" | |
| 11 | + "minLength": 3 | |
| 16 | 12 | }, |
| 17 | 13 | "maxlength": { |
| 18 | 14 | "type": "string", |
| 19 | 15 | "maxLength": 5 |
| 20 | 16 | }, |
| 21 | - "minlength": { | |
| 22 | - "type": "string", | |
| 23 | - "minLength": 3 | |
| 24 | - }, | |
| 25 | - "minMaxIntersection": { | |
| 17 | + "minmaxlength": { | |
| 26 | 18 | "type": "string", |
| 27 | 19 | "minLength": 3, |
| 28 | 20 | "maxLength": 5 |
| 29 | 21 | }, |
| 30 | - "minmaxlength": { | |
| 22 | + "union": { | |
| 31 | 23 | "type": "string", |
| 32 | 24 | "minLength": 3, |
| 33 | - "maxLength": 5 | |
| 25 | + "maxLength": 6 | |
| 26 | + }, | |
| 27 | + "inUnion": { | |
| 28 | + "$ref": "#/definitions/InUnion" | |
| 34 | 29 | }, |
| 35 | 30 | "minMaxUnion": { |
| 36 | 31 | "type": "string" |
| 37 | 32 | }, |
| 38 | - "union": { | |
| 33 | + "intersection": { | |
| 34 | + "type": "string", | |
| 35 | + "minLength": 4, | |
| 36 | + "maxLength": 5 | |
| 37 | + }, | |
| 38 | + "minMaxIntersection": { | |
| 39 | 39 | "type": "string", |
| 40 | 40 | "minLength": 3, |
| 41 | - "maxLength": 6 | |
| 41 | + "maxLength": 5 | |
| 42 | 42 | } |
| 43 | 43 | }, |
| 44 | 44 | "required": [ |
Mschema-swiftdefault / quicktype.swift+20 −20
| @@ -7,24 +7,24 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | - let intersection: String | |
| 11 | - let inUnion: InUnion | |
| 12 | - let maxlength: String | |
| 13 | 10 | let minlength: String |
| 14 | - let minMaxIntersection: String | |
| 11 | + let maxlength: String | |
| 15 | 12 | let minmaxlength: String |
| 16 | - let minMaxUnion: String | |
| 17 | 13 | let union: String |
| 14 | + let inUnion: InUnion | |
| 15 | + let minMaxUnion: String | |
| 16 | + let intersection: String | |
| 17 | + let minMaxIntersection: String | |
| 18 | 18 | |
| 19 | 19 | enum CodingKeys: String, CodingKey { |
| 20 | - case intersection = "intersection" | |
| 21 | - case inUnion = "inUnion" | |
| 22 | - case maxlength = "maxlength" | |
| 23 | 20 | case minlength = "minlength" |
| 24 | - case minMaxIntersection = "minMaxIntersection" | |
| 21 | + case maxlength = "maxlength" | |
| 25 | 22 | case minmaxlength = "minmaxlength" |
| 26 | - case minMaxUnion = "minMaxUnion" | |
| 27 | 23 | case union = "union" |
| 24 | + case inUnion = "inUnion" | |
| 25 | + case minMaxUnion = "minMaxUnion" | |
| 26 | + case intersection = "intersection" | |
| 27 | + case minMaxIntersection = "minMaxIntersection" | |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| @@ -47,24 +47,24 @@ extension TopLevel { | ||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | func with( |
| 50 | - intersection: String? = nil, | |
| 51 | - inUnion: InUnion? = nil, | |
| 52 | - maxlength: String? = nil, | |
| 53 | 50 | minlength: String? = nil, |
| 54 | - minMaxIntersection: String? = nil, | |
| 51 | + maxlength: String? = nil, | |
| 55 | 52 | minmaxlength: String? = nil, |
| 53 | + union: String? = nil, | |
| 54 | + inUnion: InUnion? = nil, | |
| 56 | 55 | minMaxUnion: String? = nil, |
| 57 | - union: String? = nil | |
| 56 | + intersection: String? = nil, | |
| 57 | + minMaxIntersection: String? = nil | |
| 58 | 58 | ) -> TopLevel { |
| 59 | 59 | return TopLevel( |
| 60 | - intersection: intersection ?? self.intersection, | |
| 61 | - inUnion: inUnion ?? self.inUnion, | |
| 62 | - maxlength: maxlength ?? self.maxlength, | |
| 63 | 60 | minlength: minlength ?? self.minlength, |
| 64 | - minMaxIntersection: minMaxIntersection ?? self.minMaxIntersection, | |
| 61 | + maxlength: maxlength ?? self.maxlength, | |
| 65 | 62 | minmaxlength: minmaxlength ?? self.minmaxlength, |
| 63 | + union: union ?? self.union, | |
| 64 | + inUnion: inUnion ?? self.inUnion, | |
| 66 | 65 | minMaxUnion: minMaxUnion ?? self.minMaxUnion, |
| 67 | - union: union ?? self.union | |
| 66 | + intersection: intersection ?? self.intersection, | |
| 67 | + minMaxIntersection: minMaxIntersection ?? self.minMaxIntersection | |
| 68 | 68 | ) |
| 69 | 69 | } |
Mschema-typescript-zoddefault / TopLevel.ts+5 −5
| @@ -2,13 +2,13 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "intersection": z.string(), | |
| 6 | - "inUnion": z.union([z.number(), z.string()]), | |
| 7 | - "maxlength": z.string(), | |
| 8 | 5 | "minlength": z.string(), |
| 9 | - "minMaxIntersection": z.string(), | |
| 6 | + "maxlength": z.string(), | |
| 10 | 7 | "minmaxlength": z.string(), |
| 11 | - "minMaxUnion": z.string(), | |
| 12 | 8 | "union": z.string(), |
| 9 | + "inUnion": z.union([z.number(), z.string()]), | |
| 10 | + "minMaxUnion": z.string(), | |
| 11 | + "intersection": z.string(), | |
| 12 | + "minMaxIntersection": z.string(), | |
| 13 | 13 | }); |
| 14 | 14 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+10 −10
| @@ -8,14 +8,14 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - intersection: string; | |
| 12 | - inUnion: InUnion; | |
| 13 | - maxlength: string; | |
| 14 | 11 | minlength: string; |
| 15 | - minMaxIntersection: string; | |
| 12 | + maxlength: string; | |
| 16 | 13 | minmaxlength: string; |
| 17 | - minMaxUnion: string; | |
| 18 | 14 | union: string; |
| 15 | + inUnion: InUnion; | |
| 16 | + minMaxUnion: string; | |
| 17 | + intersection: string; | |
| 18 | + minMaxIntersection: string; | |
| 19 | 19 | [property: string]: unknown; |
| 20 | 20 | } |
| 21 | 21 | |
| @@ -188,13 +188,13 @@ function r(name: string) { | ||
| 188 | 188 | |
| 189 | 189 | const typeMap: any = { |
| 190 | 190 | "TopLevel": o([ |
| 191 | - { json: "intersection", js: "intersection", typ: "" }, | |
| 192 | - { json: "inUnion", js: "inUnion", typ: u(3.14, "") }, | |
| 193 | - { json: "maxlength", js: "maxlength", typ: "" }, | |
| 194 | 191 | { json: "minlength", js: "minlength", typ: "" }, |
| 195 | - { json: "minMaxIntersection", js: "minMaxIntersection", typ: "" }, | |
| 192 | + { json: "maxlength", js: "maxlength", typ: "" }, | |
| 196 | 193 | { json: "minmaxlength", js: "minmaxlength", typ: "" }, |
| 197 | - { json: "minMaxUnion", js: "minMaxUnion", typ: "" }, | |
| 198 | 194 | { json: "union", js: "union", typ: "" }, |
| 195 | + { json: "inUnion", js: "inUnion", typ: u(3.14, "") }, | |
| 196 | + { json: "minMaxUnion", js: "minMaxUnion", typ: "" }, | |
| 197 | + { json: "intersection", js: "intersection", typ: "" }, | |
| 198 | + { json: "minMaxIntersection", js: "minMaxIntersection", typ: "" }, | |
| 199 | 199 | ], "any"), |
| 200 | 200 | }; |
Test case
30 generated files · +128 −128test/inputs/schema/non-standard-ref.schema
Mschema-cjsondefault / TopLevel.c+4 −4
| @@ -22,12 +22,12 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 22 | 22 | if (NULL != j) { |
| 23 | 23 | if (NULL != (x = cJSON_malloc(sizeof(struct TopLevel)))) { |
| 24 | 24 | memset(x, 0, sizeof(struct TopLevel)); |
| 25 | - if (cJSON_HasObjectItem(j, "bar")) { | |
| 26 | - x->bar = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "bar")); | |
| 27 | - } | |
| 28 | 25 | if (cJSON_HasObjectItem(j, "foo")) { |
| 29 | 26 | x->foo = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "foo")); |
| 30 | 27 | } |
| 28 | + if (cJSON_HasObjectItem(j, "bar")) { | |
| 29 | + x->bar = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "bar")); | |
| 30 | + } | |
| 31 | 31 | if (cJSON_HasObjectItem(j, "quux")) { |
| 32 | 32 | x->quux = cJSON_IsTrue(cJSON_GetObjectItemCaseSensitive(j, "quux")); |
| 33 | 33 | } |
| @@ -40,8 +40,8 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 40 | 40 | cJSON * j = NULL; |
| 41 | 41 | if (NULL != x) { |
| 42 | 42 | if (NULL != (j = cJSON_CreateObject())) { |
| 43 | - cJSON_AddNumberToObject(j, "bar", x->bar); | |
| 44 | 43 | cJSON_AddNumberToObject(j, "foo", x->foo); |
| 44 | + cJSON_AddNumberToObject(j, "bar", x->bar); | |
| 45 | 45 | cJSON_AddBoolToObject(j, "quux", x->quux); |
| 46 | 46 | } |
| 47 | 47 | } |
Mschema-cjsondefault / TopLevel.h+1 −1
| @@ -35,8 +35,8 @@ extern "C" { | ||
| 35 | 35 | #endif |
| 36 | 36 | |
| 37 | 37 | struct TopLevel { |
| 38 | - int64_t bar; | |
| 39 | 38 | int64_t foo; |
| 39 | + int64_t bar; | |
| 40 | 40 | bool quux; |
| 41 | 41 | }; |
Mschema-cplusplusdefault / quicktype.hpp+7 −7
| @@ -37,19 +37,19 @@ namespace quicktype { | ||
| 37 | 37 | virtual ~TopLevel() = default; |
| 38 | 38 | |
| 39 | 39 | private: |
| 40 | - int64_t bar; | |
| 41 | 40 | int64_t foo; |
| 41 | + int64_t bar; | |
| 42 | 42 | bool quux; |
| 43 | 43 | |
| 44 | 44 | public: |
| 45 | - const int64_t & get_bar() const { return bar; } | |
| 46 | - int64_t & get_mutable_bar() { return bar; } | |
| 47 | - void set_bar(const int64_t & value) { this->bar = value; } | |
| 48 | - | |
| 49 | 45 | const int64_t & get_foo() const { return foo; } |
| 50 | 46 | int64_t & get_mutable_foo() { return foo; } |
| 51 | 47 | void set_foo(const int64_t & value) { this->foo = value; } |
| 52 | 48 | |
| 49 | + const int64_t & get_bar() const { return bar; } | |
| 50 | + int64_t & get_mutable_bar() { return bar; } | |
| 51 | + void set_bar(const int64_t & value) { this->bar = value; } | |
| 52 | + | |
| 53 | 53 | const bool & get_quux() const { return quux; } |
| 54 | 54 | bool & get_mutable_quux() { return quux; } |
| 55 | 55 | void set_quux(const bool & value) { this->quux = value; } |
| @@ -61,15 +61,15 @@ namespace quicktype { | ||
| 61 | 61 | void to_json(json & j, const TopLevel & x); |
| 62 | 62 | |
| 63 | 63 | inline void from_json(const json & j, TopLevel& x) { |
| 64 | - x.set_bar(j.at("bar").get<int64_t>()); | |
| 65 | 64 | x.set_foo(j.at("foo").get<int64_t>()); |
| 65 | + x.set_bar(j.at("bar").get<int64_t>()); | |
| 66 | 66 | x.set_quux(j.at("quux").get<bool>()); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | inline void to_json(json & j, const TopLevel & x) { |
| 70 | 70 | j = json::object(); |
| 71 | - j["bar"] = x.get_bar(); | |
| 72 | 71 | j["foo"] = x.get_foo(); |
| 72 | + j["bar"] = x.get_bar(); | |
| 73 | 73 | j["quux"] = x.get_quux(); |
| 74 | 74 | } |
| 75 | 75 | } |
Mschema-csharp-recordsdefault / QuickType.cs+3 −3
| @@ -25,12 +25,12 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("bar", Required = Required.Always)] | |
| 29 | - public long Bar { get; set; } | |
| 30 | - | |
| 31 | 28 | [JsonProperty("foo", Required = Required.Always)] |
| 32 | 29 | public long Foo { get; set; } |
| 33 | 30 | |
| 31 | + [JsonProperty("bar", Required = Required.Always)] | |
| 32 | + public long Bar { get; set; } | |
| 33 | + | |
| 34 | 34 | [JsonProperty("quux", Required = Required.Always)] |
| 35 | 35 | public bool Quux { get; set; } |
| 36 | 36 | } |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+4 −4
| @@ -22,14 +22,14 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | - [JsonRequired] | |
| 26 | - [JsonPropertyName("bar")] | |
| 27 | - public long Bar { get; set; } | |
| 28 | - | |
| 29 | 25 | [JsonRequired] |
| 30 | 26 | [JsonPropertyName("foo")] |
| 31 | 27 | public long Foo { get; set; } |
| 32 | 28 | |
| 29 | + [JsonRequired] | |
| 30 | + [JsonPropertyName("bar")] | |
| 31 | + public long Bar { get; set; } | |
| 32 | + | |
| 33 | 33 | [JsonRequired] |
| 34 | 34 | [JsonPropertyName("quux")] |
| 35 | 35 | public bool Quux { get; set; } |
Mschema-csharpdefault / QuickType.cs+3 −3
| @@ -25,12 +25,12 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("bar", Required = Required.Always)] | |
| 29 | - public long Bar { get; set; } | |
| 30 | - | |
| 31 | 28 | [JsonProperty("foo", Required = Required.Always)] |
| 32 | 29 | public long Foo { get; set; } |
| 33 | 30 | |
| 31 | + [JsonProperty("bar", Required = Required.Always)] | |
| 32 | + public long Bar { get; set; } | |
| 33 | + | |
| 34 | 34 | [JsonProperty("quux", Required = Required.Always)] |
| 35 | 35 | public bool Quux { get; set; } |
| 36 | 36 | } |
Mschema-dartdefault / TopLevel.dart+4 −4
| @@ -9,25 +9,25 @@ TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | ||
| 9 | 9 | String topLevelToJson(TopLevel data) => json.encode(data.toJson()); |
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | - final int bar; | |
| 13 | 12 | final int foo; |
| 13 | + final int bar; | |
| 14 | 14 | final bool quux; |
| 15 | 15 | |
| 16 | 16 | TopLevel({ |
| 17 | - required this.bar, | |
| 18 | 17 | required this.foo, |
| 18 | + required this.bar, | |
| 19 | 19 | required this.quux, |
| 20 | 20 | }); |
| 21 | 21 | |
| 22 | 22 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 23 | - bar: json["bar"], | |
| 24 | 23 | foo: json["foo"], |
| 24 | + bar: json["bar"], | |
| 25 | 25 | quux: json["quux"], |
| 26 | 26 | ); |
| 27 | 27 | |
| 28 | 28 | Map<String, dynamic> toJson() => { |
| 29 | - "bar": bar, | |
| 30 | 29 | "foo": foo, |
| 30 | + "bar": bar, | |
| 31 | 31 | "quux": quux, |
| 32 | 32 | }; |
| 33 | 33 | } |
Mschema-elixirdefault / QuickType.ex+5 −5
| @@ -6,19 +6,19 @@ | ||
| 6 | 6 | # Encode into a JSON string: TopLevel.to_json(struct) |
| 7 | 7 | |
| 8 | 8 | defmodule TopLevel do |
| 9 | - @enforce_keys [:bar, :foo, :quux] | |
| 10 | - defstruct [:bar, :foo, :quux] | |
| 9 | + @enforce_keys [:foo, :bar, :quux] | |
| 10 | + defstruct [:foo, :bar, :quux] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | - bar: integer(), | |
| 14 | 13 | foo: integer(), |
| 14 | + bar: integer(), | |
| 15 | 15 | quux: boolean() |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | def from_map(m) do |
| 19 | 19 | %TopLevel{ |
| 20 | - bar: m["bar"], | |
| 21 | 20 | foo: m["foo"], |
| 21 | + bar: m["bar"], | |
| 22 | 22 | quux: m["quux"], |
| 23 | 23 | } |
| 24 | 24 | end |
| @@ -31,8 +31,8 @@ defmodule TopLevel do | ||
| 31 | 31 | |
| 32 | 32 | def to_map(struct) do |
| 33 | 33 | %{ |
| 34 | - "bar" => struct.bar, | |
| 35 | 34 | "foo" => struct.foo, |
| 35 | + "bar" => struct.bar, | |
| 36 | 36 | "quux" => struct.quux, |
| 37 | 37 | } |
| 38 | 38 | end |
Mschema-elmdefault / QuickType.elm+5 −5
| @@ -23,8 +23,8 @@ import Json.Encode as Jenc | ||
| 23 | 23 | import Dict exposing (Dict) |
| 24 | 24 | |
| 25 | 25 | type alias QuickType = |
| 26 | - { bar : Int | |
| 27 | - , foo : Int | |
| 26 | + { foo : Int | |
| 27 | + , bar : Int | |
| 28 | 28 | , quux : Bool |
| 29 | 29 | } |
| 30 | 30 | |
| @@ -36,15 +36,15 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 36 | 36 | quickType : Jdec.Decoder QuickType |
| 37 | 37 | quickType = |
| 38 | 38 | Jdec.succeed QuickType |
| 39 | - |> Jpipe.required "bar" Jdec.int | |
| 40 | 39 | |> Jpipe.required "foo" Jdec.int |
| 40 | + |> Jpipe.required "bar" Jdec.int | |
| 41 | 41 | |> Jpipe.required "quux" Jdec.bool |
| 42 | 42 | |
| 43 | 43 | encodeQuickType : QuickType -> Jenc.Value |
| 44 | 44 | encodeQuickType x = |
| 45 | 45 | Jenc.object |
| 46 | - [ ("bar", Jenc.int x.bar) | |
| 47 | - , ("foo", Jenc.int x.foo) | |
| 46 | + [ ("foo", Jenc.int x.foo) | |
| 47 | + , ("bar", Jenc.int x.bar) | |
| 48 | 48 | , ("quux", Jenc.bool x.quux) |
| 49 | 49 | ] |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -10,8 +10,8 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - bar: number; | |
| 14 | 13 | foo: number; |
| 14 | + bar: number; | |
| 15 | 15 | quux: boolean; |
| 16 | 16 | [property: string]: mixed; |
| 17 | 17 | }; |
| @@ -181,8 +181,8 @@ function r(name: string) { | ||
| 181 | 181 | |
| 182 | 182 | const typeMap: any = { |
| 183 | 183 | "TopLevel": o([ |
| 184 | - { json: "bar", js: "bar", typ: 0 }, | |
| 185 | 184 | { json: "foo", js: "foo", typ: 0 }, |
| 185 | + { json: "bar", js: "bar", typ: 0 }, | |
| 186 | 186 | { json: "quux", js: "quux", typ: true }, |
| 187 | 187 | ], "any"), |
| 188 | 188 | }; |
Mschema-golangdefault / quicktype.go+1 −1
| @@ -19,7 +19,7 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | type TopLevel struct { |
| 22 | - Bar int64 `json:"bar"` | |
| 23 | 22 | Foo int64 `json:"foo"` |
| 23 | + Bar int64 `json:"bar"` | |
| 24 | 24 | Quux bool `json:"quux"` |
| 25 | 25 | } |
Mschema-haskelldefault / QuickType.hs+7 −7
| @@ -13,8 +13,8 @@ import Data.HashMap.Strict (HashMap) | ||
| 13 | 13 | import Data.Text (Text) |
| 14 | 14 | |
| 15 | 15 | data QuickType = QuickType |
| 16 | - { barQuickType :: Int | |
| 17 | - , fooQuickType :: Int | |
| 16 | + { fooQuickType :: Int | |
| 17 | + , barQuickType :: Int | |
| 18 | 18 | , quuxQuickType :: Bool |
| 19 | 19 | } deriving (Show) |
| 20 | 20 | |
| @@ -22,15 +22,15 @@ decodeTopLevel :: ByteString -> Maybe QuickType | ||
| 22 | 22 | decodeTopLevel = decode |
| 23 | 23 | |
| 24 | 24 | instance ToJSON QuickType where |
| 25 | - toJSON (QuickType barQuickType fooQuickType quuxQuickType) = | |
| 25 | + toJSON (QuickType fooQuickType barQuickType quuxQuickType) = | |
| 26 | 26 | object |
| 27 | - [ "bar" .= barQuickType | |
| 28 | - , "foo" .= fooQuickType | |
| 27 | + [ "foo" .= fooQuickType | |
| 28 | + , "bar" .= barQuickType | |
| 29 | 29 | , "quux" .= quuxQuickType |
| 30 | 30 | ] |
| 31 | 31 | |
| 32 | 32 | instance FromJSON QuickType where |
| 33 | 33 | parseJSON (Object v) = QuickType |
| 34 | - <$> v .: "bar" | |
| 35 | - <*> v .: "foo" | |
| 34 | + <$> v .: "foo" | |
| 35 | + <*> v .: "bar" | |
| 36 | 36 | <*> v .: "quux" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -3,20 +3,20 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private long bar; | |
| 7 | 6 | private long foo; |
| 7 | + private long bar; | |
| 8 | 8 | private boolean quux; |
| 9 | 9 | |
| 10 | - @JsonProperty("bar") | |
| 11 | - public long getBar() { return bar; } | |
| 12 | - @JsonProperty("bar") | |
| 13 | - public void setBar(long value) { this.bar = value; } | |
| 14 | - | |
| 15 | 10 | @JsonProperty("foo") |
| 16 | 11 | public long getFoo() { return foo; } |
| 17 | 12 | @JsonProperty("foo") |
| 18 | 13 | public void setFoo(long value) { this.foo = value; } |
| 19 | 14 | |
| 15 | + @JsonProperty("bar") | |
| 16 | + public long getBar() { return bar; } | |
| 17 | + @JsonProperty("bar") | |
| 18 | + public void setBar(long value) { this.bar = value; } | |
| 19 | + | |
| 20 | 20 | @JsonProperty("quux") |
| 21 | 21 | public boolean getQuux() { return quux; } |
| 22 | 22 | @JsonProperty("quux") |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -3,20 +3,20 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private long bar; | |
| 7 | 6 | private long foo; |
| 7 | + private long bar; | |
| 8 | 8 | private boolean quux; |
| 9 | 9 | |
| 10 | - @JsonProperty("bar") | |
| 11 | - public long getBar() { return bar; } | |
| 12 | - @JsonProperty("bar") | |
| 13 | - public void setBar(long value) { this.bar = value; } | |
| 14 | - | |
| 15 | 10 | @JsonProperty("foo") |
| 16 | 11 | public long getFoo() { return foo; } |
| 17 | 12 | @JsonProperty("foo") |
| 18 | 13 | public void setFoo(long value) { this.foo = value; } |
| 19 | 14 | |
| 15 | + @JsonProperty("bar") | |
| 16 | + public long getBar() { return bar; } | |
| 17 | + @JsonProperty("bar") | |
| 18 | + public void setBar(long value) { this.bar = value; } | |
| 19 | + | |
| 20 | 20 | @JsonProperty("quux") |
| 21 | 21 | public boolean getQuux() { return quux; } |
| 22 | 22 | @JsonProperty("quux") |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -3,20 +3,20 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private long bar; | |
| 7 | 6 | private long foo; |
| 7 | + private long bar; | |
| 8 | 8 | private boolean quux; |
| 9 | 9 | |
| 10 | - @JsonProperty("bar") | |
| 11 | - public long getBar() { return bar; } | |
| 12 | - @JsonProperty("bar") | |
| 13 | - public void setBar(long value) { this.bar = value; } | |
| 14 | - | |
| 15 | 10 | @JsonProperty("foo") |
| 16 | 11 | public long getFoo() { return foo; } |
| 17 | 12 | @JsonProperty("foo") |
| 18 | 13 | public void setFoo(long value) { this.foo = value; } |
| 19 | 14 | |
| 15 | + @JsonProperty("bar") | |
| 16 | + public long getBar() { return bar; } | |
| 17 | + @JsonProperty("bar") | |
| 18 | + public void setBar(long value) { this.bar = value; } | |
| 19 | + | |
| 20 | 20 | @JsonProperty("quux") |
| 21 | 21 | public boolean getQuux() { return quux; } |
| 22 | 22 | @JsonProperty("quux") |
Mschema-javascriptdefault / TopLevel.js+1 −1
| @@ -172,8 +172,8 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "bar", js: "bar", typ: 0 }, | |
| 176 | 175 | { json: "foo", js: "foo", typ: 0 }, |
| 176 | + { json: "bar", js: "bar", typ: 0 }, | |
| 177 | 177 | { json: "quux", js: "quux", typ: true }, |
| 178 | 178 | ], "any"), |
| 179 | 179 | }; |
Mschema-kotlin-jacksondefault / TopLevel.kt+2 −2
| @@ -20,10 +20,10 @@ val mapper = jacksonObjectMapper().apply { | ||
| 20 | 20 | |
| 21 | 21 | data class TopLevel ( |
| 22 | 22 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 23 | - val bar: Long, | |
| 23 | + val foo: Long, | |
| 24 | 24 | |
| 25 | 25 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 26 | - val foo: Long, | |
| 26 | + val bar: Long, | |
| 27 | 27 | |
| 28 | 28 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 29 | 29 | val quux: Boolean |
Mschema-kotlindefault / TopLevel.kt+1 −1
| @@ -9,8 +9,8 @@ import com.beust.klaxon.* | ||
| 9 | 9 | private val klaxon = Klaxon() |
| 10 | 10 | |
| 11 | 11 | data class TopLevel ( |
| 12 | - val bar: Long, | |
| 13 | 12 | val foo: Long, |
| 13 | + val bar: Long, | |
| 14 | 14 | val quux: Boolean |
| 15 | 15 | ) { |
| 16 | 16 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-kotlinxdefault / TopLevel.kt+1 −1
| @@ -12,7 +12,7 @@ import kotlinx.serialization.encoding.* | ||
| 12 | 12 | |
| 13 | 13 | @Serializable |
| 14 | 14 | data class TopLevel ( |
| 15 | - val bar: Long, | |
| 16 | 15 | val foo: Long, |
| 16 | + val bar: Long, | |
| 17 | 17 | val quux: Boolean |
| 18 | 18 | ) |
Mschema-phpdefault / TopLevel.php+35 −35
| @@ -4,18 +4,18 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private int $bar; // json:bar Required | |
| 8 | 7 | private int $foo; // json:foo Required |
| 8 | + private int $bar; // json:bar Required | |
| 9 | 9 | private bool $quux; // json:quux Required |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | - * @param int $bar | |
| 13 | 12 | * @param int $foo |
| 13 | + * @param int $bar | |
| 14 | 14 | * @param bool $quux |
| 15 | 15 | */ |
| 16 | - public function __construct(int $bar, int $foo, bool $quux) { | |
| 17 | - $this->bar = $bar; | |
| 16 | + public function __construct(int $foo, int $bar, bool $quux) { | |
| 18 | 17 | $this->foo = $foo; |
| 18 | + $this->bar = $bar; | |
| 19 | 19 | $this->quux = $quux; |
| 20 | 20 | } |
| 21 | 21 | |
| @@ -24,7 +24,7 @@ class TopLevel { | ||
| 24 | 24 | * @throws Exception |
| 25 | 25 | * @return int |
| 26 | 26 | */ |
| 27 | - public static function fromBar(int $value): int { | |
| 27 | + public static function fromFoo(int $value): int { | |
| 28 | 28 | return $value; /*int*/ |
| 29 | 29 | } |
| 30 | 30 | |
| @@ -32,11 +32,11 @@ class TopLevel { | ||
| 32 | 32 | * @throws Exception |
| 33 | 33 | * @return int |
| 34 | 34 | */ |
| 35 | - public function toBar(): int { | |
| 36 | - if (TopLevel::validateBar($this->bar)) { | |
| 37 | - return $this->bar; /*int*/ | |
| 35 | + public function toFoo(): int { | |
| 36 | + if (TopLevel::validateFoo($this->foo)) { | |
| 37 | + return $this->foo; /*int*/ | |
| 38 | 38 | } |
| 39 | - throw new Exception('never get to this TopLevel::bar'); | |
| 39 | + throw new Exception('never get to this TopLevel::foo'); | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| @@ -44,7 +44,7 @@ class TopLevel { | ||
| 44 | 44 | * @return bool |
| 45 | 45 | * @throws Exception |
| 46 | 46 | */ |
| 47 | - public static function validateBar(int $value): bool { | |
| 47 | + public static function validateFoo(int $value): bool { | |
| 48 | 48 | return true; |
| 49 | 49 | } |
| 50 | 50 | |
| @@ -52,18 +52,18 @@ class TopLevel { | ||
| 52 | 52 | * @throws Exception |
| 53 | 53 | * @return int |
| 54 | 54 | */ |
| 55 | - public function getBar(): int { | |
| 56 | - if (TopLevel::validateBar($this->bar)) { | |
| 57 | - return $this->bar; | |
| 55 | + public function getFoo(): int { | |
| 56 | + if (TopLevel::validateFoo($this->foo)) { | |
| 57 | + return $this->foo; | |
| 58 | 58 | } |
| 59 | - throw new Exception('never get to getBar TopLevel::bar'); | |
| 59 | + throw new Exception('never get to getFoo TopLevel::foo'); | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * @return int |
| 64 | 64 | */ |
| 65 | - public static function sampleBar(): int { | |
| 66 | - return 31; /*31:bar*/ | |
| 65 | + public static function sampleFoo(): int { | |
| 66 | + return 31; /*31:foo*/ | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
| @@ -71,7 +71,7 @@ class TopLevel { | ||
| 71 | 71 | * @throws Exception |
| 72 | 72 | * @return int |
| 73 | 73 | */ |
| 74 | - public static function fromFoo(int $value): int { | |
| 74 | + public static function fromBar(int $value): int { | |
| 75 | 75 | return $value; /*int*/ |
| 76 | 76 | } |
| 77 | 77 | |
| @@ -79,11 +79,11 @@ class TopLevel { | ||
| 79 | 79 | * @throws Exception |
| 80 | 80 | * @return int |
| 81 | 81 | */ |
| 82 | - public function toFoo(): int { | |
| 83 | - if (TopLevel::validateFoo($this->foo)) { | |
| 84 | - return $this->foo; /*int*/ | |
| 82 | + public function toBar(): int { | |
| 83 | + if (TopLevel::validateBar($this->bar)) { | |
| 84 | + return $this->bar; /*int*/ | |
| 85 | 85 | } |
| 86 | - throw new Exception('never get to this TopLevel::foo'); | |
| 86 | + throw new Exception('never get to this TopLevel::bar'); | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
| @@ -91,7 +91,7 @@ class TopLevel { | ||
| 91 | 91 | * @return bool |
| 92 | 92 | * @throws Exception |
| 93 | 93 | */ |
| 94 | - public static function validateFoo(int $value): bool { | |
| 94 | + public static function validateBar(int $value): bool { | |
| 95 | 95 | return true; |
| 96 | 96 | } |
| 97 | 97 | |
| @@ -99,18 +99,18 @@ class TopLevel { | ||
| 99 | 99 | * @throws Exception |
| 100 | 100 | * @return int |
| 101 | 101 | */ |
| 102 | - public function getFoo(): int { | |
| 103 | - if (TopLevel::validateFoo($this->foo)) { | |
| 104 | - return $this->foo; | |
| 102 | + public function getBar(): int { | |
| 103 | + if (TopLevel::validateBar($this->bar)) { | |
| 104 | + return $this->bar; | |
| 105 | 105 | } |
| 106 | - throw new Exception('never get to getFoo TopLevel::foo'); | |
| 106 | + throw new Exception('never get to getBar TopLevel::bar'); | |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * @return int |
| 111 | 111 | */ |
| 112 | - public static function sampleFoo(): int { | |
| 113 | - return 32; /*32:foo*/ | |
| 112 | + public static function sampleBar(): int { | |
| 113 | + return 32; /*32:bar*/ | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
| @@ -165,8 +165,8 @@ class TopLevel { | ||
| 165 | 165 | * @return bool |
| 166 | 166 | */ |
| 167 | 167 | public function validate(): bool { |
| 168 | - return TopLevel::validateBar($this->bar) | |
| 169 | - || TopLevel::validateFoo($this->foo) | |
| 168 | + return TopLevel::validateFoo($this->foo) | |
| 169 | + || TopLevel::validateBar($this->bar) | |
| 170 | 170 | || TopLevel::validateQuux($this->quux); |
| 171 | 171 | } |
| 172 | 172 | |
| @@ -176,8 +176,8 @@ class TopLevel { | ||
| 176 | 176 | */ |
| 177 | 177 | public function to(): stdClass { |
| 178 | 178 | $out = new stdClass(); |
| 179 | - $out->{'bar'} = $this->toBar(); | |
| 180 | 179 | $out->{'foo'} = $this->toFoo(); |
| 180 | + $out->{'bar'} = $this->toBar(); | |
| 181 | 181 | $out->{'quux'} = $this->toQuux(); |
| 182 | 182 | return $out; |
| 183 | 183 | } |
| @@ -189,8 +189,8 @@ class TopLevel { | ||
| 189 | 189 | */ |
| 190 | 190 | public static function from(stdClass $obj): TopLevel { |
| 191 | 191 | return new TopLevel( |
| 192 | - TopLevel::fromBar($obj->{'bar'}) | |
| 193 | - ,TopLevel::fromFoo($obj->{'foo'}) | |
| 192 | + TopLevel::fromFoo($obj->{'foo'}) | |
| 193 | + ,TopLevel::fromBar($obj->{'bar'}) | |
| 194 | 194 | ,TopLevel::fromQuux($obj->{'quux'}) |
| 195 | 195 | ); |
| 196 | 196 | } |
| @@ -200,8 +200,8 @@ class TopLevel { | ||
| 200 | 200 | */ |
| 201 | 201 | public static function sample(): TopLevel { |
| 202 | 202 | return new TopLevel( |
| 203 | - TopLevel::sampleBar() | |
| 204 | - ,TopLevel::sampleFoo() | |
| 203 | + TopLevel::sampleFoo() | |
| 204 | + ,TopLevel::sampleBar() | |
| 205 | 205 | ,TopLevel::sampleQuux() |
| 206 | 206 | ); |
| 207 | 207 | } |
Mschema-pikedefault / TopLevel.pmod+3 −3
| @@ -13,14 +13,14 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - int bar; // json: "bar" | |
| 17 | 16 | int foo; // json: "foo" |
| 17 | + int bar; // json: "bar" | |
| 18 | 18 | bool quux; // json: "quux" |
| 19 | 19 | |
| 20 | 20 | string encode_json() { |
| 21 | 21 | mapping(string:mixed) json = ([ |
| 22 | - "bar" : bar, | |
| 23 | 22 | "foo" : foo, |
| 23 | + "bar" : bar, | |
| 24 | 24 | "quux" : quux, |
| 25 | 25 | ]); |
| 26 | 26 | |
| @@ -31,8 +31,8 @@ class TopLevel { | ||
| 31 | 31 | TopLevel TopLevel_from_JSON(mixed json) { |
| 32 | 32 | TopLevel retval = TopLevel(); |
| 33 | 33 | |
| 34 | - retval.bar = json["bar"]; | |
| 35 | 34 | retval.foo = json["foo"]; |
| 35 | + retval.bar = json["bar"]; | |
| 36 | 36 | retval.quux = json["quux"]; |
| 37 | 37 | |
| 38 | 38 | return retval; |
Mschema-pythondefault / quicktype.py+4 −4
| @@ -22,22 +22,22 @@ def to_class(c: Type[T], x: Any) -> dict: | ||
| 22 | 22 | |
| 23 | 23 | @dataclass |
| 24 | 24 | class TopLevel: |
| 25 | - bar: int | |
| 26 | 25 | foo: int |
| 26 | + bar: int | |
| 27 | 27 | quux: bool |
| 28 | 28 | |
| 29 | 29 | @staticmethod |
| 30 | 30 | def from_dict(obj: Any) -> 'TopLevel': |
| 31 | 31 | assert isinstance(obj, dict) |
| 32 | - bar = from_int(obj.get("bar")) | |
| 33 | 32 | foo = from_int(obj.get("foo")) |
| 33 | + bar = from_int(obj.get("bar")) | |
| 34 | 34 | quux = from_bool(obj.get("quux")) |
| 35 | - return TopLevel(bar, foo, quux) | |
| 35 | + return TopLevel(foo, bar, quux) | |
| 36 | 36 | |
| 37 | 37 | def to_dict(self) -> dict: |
| 38 | 38 | result: dict = {} |
| 39 | - result["bar"] = from_int(self.bar) | |
| 40 | 39 | result["foo"] = from_int(self.foo) |
| 40 | + result["bar"] = from_int(self.bar) | |
| 41 | 41 | result["quux"] = from_bool(self.quux) |
| 42 | 42 | return result |
Mschema-rubydefault / TopLevel.rb+4 −4
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.bar.even? | |
| 7 | +# puts top_level.foo.even? | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -21,15 +21,15 @@ module Types | ||
| 21 | 21 | end |
| 22 | 22 | |
| 23 | 23 | class TopLevel < Dry::Struct |
| 24 | - attribute :bar, Types::Integer | |
| 25 | 24 | attribute :foo, Types::Integer |
| 25 | + attribute :bar, Types::Integer | |
| 26 | 26 | attribute :quux, Types::Bool |
| 27 | 27 | |
| 28 | 28 | def self.from_dynamic!(d) |
| 29 | 29 | d = Types::Hash[d] |
| 30 | 30 | new( |
| 31 | - bar: d.fetch("bar"), | |
| 32 | 31 | foo: d.fetch("foo"), |
| 32 | + bar: d.fetch("bar"), | |
| 33 | 33 | quux: d.fetch("quux"), |
| 34 | 34 | ) |
| 35 | 35 | end |
| @@ -40,8 +40,8 @@ class TopLevel < Dry::Struct | ||
| 40 | 40 | |
| 41 | 41 | def to_dynamic |
| 42 | 42 | { |
| 43 | - "bar" => bar, | |
| 44 | 43 | "foo" => foo, |
| 44 | + "bar" => bar, | |
| 45 | 45 | "quux" => quux, |
| 46 | 46 | } |
| 47 | 47 | end |
Mschema-rustdefault / module_under_test.rs+2 −2
| @@ -15,9 +15,9 @@ use serde::{Serialize, Deserialize}; | ||
| 15 | 15 | |
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | pub struct TopLevel { |
| 18 | - pub bar: i64, | |
| 19 | - | |
| 20 | 18 | pub foo: i64, |
| 21 | 19 | |
| 20 | + pub bar: i64, | |
| 21 | + | |
| 22 | 22 | pub quux: bool, |
| 23 | 23 | } |
Mschema-scala3-upickledefault / TopLevel.scala+1 −1
| @@ -66,7 +66,7 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val bar : Long, | |
| 70 | 69 | val foo : Long, |
| 70 | + val bar : Long, | |
| 71 | 71 | val quux : Boolean |
| 72 | 72 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+1 −1
| @@ -8,7 +8,7 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val bar : Long, | |
| 12 | 11 | val foo : Long, |
| 12 | + val bar : Long, | |
| 13 | 13 | val quux : Boolean |
| 14 | 14 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+2 −2
| @@ -6,10 +6,10 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": {}, |
| 8 | 8 | "properties": { |
| 9 | - "bar": { | |
| 9 | + "foo": { | |
| 10 | 10 | "type": "integer" |
| 11 | 11 | }, |
| 12 | - "foo": { | |
| 12 | + "bar": { | |
| 13 | 13 | "type": "integer" |
| 14 | 14 | }, |
| 15 | 15 | "quux": { |
Mschema-swiftdefault / quicktype.swift+4 −4
| @@ -7,13 +7,13 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | - let bar: Int | |
| 11 | 10 | let foo: Int |
| 11 | + let bar: Int | |
| 12 | 12 | let quux: Bool |
| 13 | 13 | |
| 14 | 14 | enum CodingKeys: String, CodingKey { |
| 15 | - case bar = "bar" | |
| 16 | 15 | case foo = "foo" |
| 16 | + case bar = "bar" | |
| 17 | 17 | case quux = "quux" |
| 18 | 18 | } |
| 19 | 19 | } |
| @@ -37,13 +37,13 @@ extension TopLevel { | ||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | func with( |
| 40 | - bar: Int? = nil, | |
| 41 | 40 | foo: Int? = nil, |
| 41 | + bar: Int? = nil, | |
| 42 | 42 | quux: Bool? = nil |
| 43 | 43 | ) -> TopLevel { |
| 44 | 44 | return TopLevel( |
| 45 | - bar: bar ?? self.bar, | |
| 46 | 45 | foo: foo ?? self.foo, |
| 46 | + bar: bar ?? self.bar, | |
| 47 | 47 | quux: quux ?? self.quux |
| 48 | 48 | ) |
| 49 | 49 | } |
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,8 +2,8 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "bar": z.number(), | |
| 6 | 5 | "foo": z.number(), |
| 6 | + "bar": z.number(), | |
| 7 | 7 | "quux": z.boolean(), |
| 8 | 8 | }); |
| 9 | 9 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -8,8 +8,8 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - bar: number; | |
| 12 | 11 | foo: number; |
| 12 | + bar: number; | |
| 13 | 13 | quux: boolean; |
| 14 | 14 | [property: string]: unknown; |
| 15 | 15 | } |
| @@ -181,8 +181,8 @@ function r(name: string) { | ||
| 181 | 181 | |
| 182 | 182 | const typeMap: any = { |
| 183 | 183 | "TopLevel": o([ |
| 184 | - { json: "bar", js: "bar", typ: 0 }, | |
| 185 | 184 | { json: "foo", js: "foo", typ: 0 }, |
| 185 | + { json: "bar", js: "bar", typ: 0 }, | |
| 186 | 186 | { json: "quux", js: "quux", typ: true }, |
| 187 | 187 | ], "any"), |
| 188 | 188 | }; |
Test case
25 generated files · +137 −137test/inputs/schema/nullable-optional-one-of.schema
Mschema-cplusplusdefault / quicktype.hpp+6 −6
| @@ -96,16 +96,16 @@ namespace quicktype { | ||
| 96 | 96 | virtual ~TopLevel() = default; |
| 97 | 97 | |
| 98 | 98 | private: |
| 99 | - std::optional<std::string> b; | |
| 100 | 99 | Kind kind; |
| 100 | + std::optional<std::string> b; | |
| 101 | 101 | |
| 102 | 102 | public: |
| 103 | - std::optional<std::string> get_b() const { return b; } | |
| 104 | - void set_b(std::optional<std::string> value) { this->b = value; } | |
| 105 | - | |
| 106 | 103 | const Kind & get_kind() const { return kind; } |
| 107 | 104 | Kind & get_mutable_kind() { return kind; } |
| 108 | 105 | void set_kind(const Kind & value) { this->kind = value; } |
| 106 | + | |
| 107 | + std::optional<std::string> get_b() const { return b; } | |
| 108 | + void set_b(std::optional<std::string> value) { this->b = value; } | |
| 109 | 109 | }; |
| 110 | 110 | } |
| 111 | 111 | |
| @@ -117,14 +117,14 @@ namespace quicktype { | ||
| 117 | 117 | void to_json(json & j, const Kind & x); |
| 118 | 118 | |
| 119 | 119 | inline void from_json(const json & j, TopLevel& x) { |
| 120 | - x.set_b(get_stack_optional<std::string>(j, "b")); | |
| 121 | 120 | x.set_kind(j.at("kind").get<Kind>()); |
| 121 | + x.set_b(get_stack_optional<std::string>(j, "b")); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | inline void to_json(json & j, const TopLevel & x) { |
| 125 | 125 | j = json::object(); |
| 126 | - j["b"] = x.get_b(); | |
| 127 | 126 | j["kind"] = x.get_kind(); |
| 127 | + j["b"] = x.get_b(); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | inline void from_json(const json & j, Kind & x) { |
Mschema-csharp-recordsdefault / QuickType.cs+3 −3
| @@ -25,11 +25,11 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("b")] | |
| 29 | - public string? B { get; set; } | |
| 30 | - | |
| 31 | 28 | [JsonProperty("kind", Required = Required.Always)] |
| 32 | 29 | public Kind Kind { get; set; } |
| 30 | + | |
| 31 | + [JsonProperty("b")] | |
| 32 | + public string? B { get; set; } | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public enum Kind { One, Two }; |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+3 −3
| @@ -22,12 +22,12 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | - [JsonPropertyName("b")] | |
| 26 | - public string? B { get; set; } | |
| 27 | - | |
| 28 | 25 | [JsonRequired] |
| 29 | 26 | [JsonPropertyName("kind")] |
| 30 | 27 | public Kind Kind { get; set; } |
| 28 | + | |
| 29 | + [JsonPropertyName("b")] | |
| 30 | + public string? B { get; set; } | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public enum Kind { One, Two }; |
Mschema-csharpdefault / QuickType.cs+3 −3
| @@ -25,11 +25,11 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("b")] | |
| 29 | - public string? B { get; set; } | |
| 30 | - | |
| 31 | 28 | [JsonProperty("kind", Required = Required.Always)] |
| 32 | 29 | public Kind Kind { get; set; } |
| 30 | + | |
| 31 | + [JsonProperty("b")] | |
| 32 | + public string? B { get; set; } | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public enum Kind { One, Two }; |
Mschema-dartdefault / TopLevel.dart+4 −4
| @@ -9,22 +9,22 @@ TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | ||
| 9 | 9 | String topLevelToJson(TopLevel data) => json.encode(data.toJson()); |
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | - final String? b; | |
| 13 | 12 | final Kind kind; |
| 13 | + final String? b; | |
| 14 | 14 | |
| 15 | 15 | TopLevel({ |
| 16 | - this.b, | |
| 17 | 16 | required this.kind, |
| 17 | + this.b, | |
| 18 | 18 | }); |
| 19 | 19 | |
| 20 | 20 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 21 | - b: json["b"], | |
| 22 | 21 | kind: kindValues.map[json["kind"]]!, |
| 22 | + b: json["b"], | |
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | Map<String, dynamic> toJson() => { |
| 26 | - "b": b, | |
| 27 | 26 | "kind": kindValues.reverse[kind], |
| 27 | + "b": b, | |
| 28 | 28 | }; |
| 29 | 29 | } |
Mschema-elixirdefault / QuickType.ex+5 −5
| @@ -53,17 +53,17 @@ end | ||
| 53 | 53 | |
| 54 | 54 | defmodule TopLevel do |
| 55 | 55 | @enforce_keys [:kind] |
| 56 | - defstruct [:b, :kind] | |
| 56 | + defstruct [:kind, :b] | |
| 57 | 57 | |
| 58 | 58 | @type t :: %__MODULE__{ |
| 59 | - b: nil | String.t() | nil, | |
| 60 | - kind: Kind.t() | |
| 59 | + kind: Kind.t(), | |
| 60 | + b: nil | String.t() | nil | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | def from_map(m) do |
| 64 | 64 | %TopLevel{ |
| 65 | - b: m["b"], | |
| 66 | 65 | kind: Kind.decode(m["kind"]), |
| 66 | + b: m["b"], | |
| 67 | 67 | } |
| 68 | 68 | end |
| 69 | 69 | |
| @@ -75,8 +75,8 @@ defmodule TopLevel do | ||
| 75 | 75 | |
| 76 | 76 | def to_map(struct) do |
| 77 | 77 | %{ |
| 78 | - "b" => struct.b, | |
| 79 | 78 | "kind" => Kind.encode(struct.kind), |
| 79 | + "b" => struct.b, | |
| 80 | 80 | } |
| 81 | 81 | end |
Mschema-elmdefault / QuickType.elm+5 −5
| @@ -24,8 +24,8 @@ import Json.Encode as Jenc | ||
| 24 | 24 | import Dict exposing (Dict) |
| 25 | 25 | |
| 26 | 26 | type alias QuickType = |
| 27 | - { b : Maybe String | |
| 28 | - , kind : Kind | |
| 27 | + { kind : Kind | |
| 28 | + , b : Maybe String | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | type Kind |
| @@ -40,14 +40,14 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 40 | 40 | quickType : Jdec.Decoder QuickType |
| 41 | 41 | quickType = |
| 42 | 42 | Jdec.succeed QuickType |
| 43 | - |> Jpipe.optional "b" (Jdec.nullable Jdec.string) Nothing | |
| 44 | 43 | |> Jpipe.required "kind" kind |
| 44 | + |> Jpipe.optional "b" (Jdec.nullable Jdec.string) Nothing | |
| 45 | 45 | |
| 46 | 46 | encodeQuickType : QuickType -> Jenc.Value |
| 47 | 47 | encodeQuickType x = |
| 48 | 48 | Jenc.object |
| 49 | - [ ("b", makeNullableEncoder Jenc.string x.b) | |
| 50 | - , ("kind", encodeKind x.kind) | |
| 49 | + [ ("kind", encodeKind x.kind) | |
| 50 | + , ("b", makeNullableEncoder Jenc.string x.b) | |
| 51 | 51 | ] |
| 52 | 52 | |
| 53 | 53 | kind : Jdec.Decoder Kind |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -10,8 +10,8 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - b?: null | string; | |
| 14 | 13 | kind: Kind; |
| 14 | + b?: null | string; | |
| 15 | 15 | [property: string]: mixed; |
| 16 | 16 | }; |
| 17 | 17 | |
| @@ -184,8 +184,8 @@ function r(name: string) { | ||
| 184 | 184 | |
| 185 | 185 | const typeMap: any = { |
| 186 | 186 | "TopLevel": o([ |
| 187 | - { json: "b", js: "b", typ: u(undefined, u(null, "")) }, | |
| 188 | 187 | { json: "kind", js: "kind", typ: r("Kind") }, |
| 188 | + { json: "b", js: "b", typ: u(undefined, u(null, "")) }, | |
| 189 | 189 | ], "any"), |
| 190 | 190 | "Kind": [ |
| 191 | 191 | "one", |
Mschema-golangdefault / quicktype.go+1 −1
| @@ -19,8 +19,8 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | type TopLevel struct { |
| 22 | - B *string `json:"b"` | |
| 23 | 22 | Kind Kind `json:"kind"` |
| 23 | + B *string `json:"b"` | |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | type Kind string |
Mschema-golangomit-empty-true--1b4b28fcc762 / quicktype.go+1 −1
| @@ -19,8 +19,8 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | type TopLevel struct { |
| 22 | - B *string `json:"b"` | |
| 23 | 22 | Kind Kind `json:"kind"` |
| 23 | + B *string `json:"b"` | |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | type Kind string |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private String b; | |
| 7 | 6 | private Kind kind; |
| 8 | - | |
| 9 | - @JsonProperty("b") | |
| 10 | - public String getB() { return b; } | |
| 11 | - @JsonProperty("b") | |
| 12 | - public void setB(String value) { this.b = value; } | |
| 7 | + private String b; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("kind") |
| 15 | 10 | public Kind getKind() { return kind; } |
| 16 | 11 | @JsonProperty("kind") |
| 17 | 12 | public void setKind(Kind value) { this.kind = value; } |
| 13 | + | |
| 14 | + @JsonProperty("b") | |
| 15 | + public String getB() { return b; } | |
| 16 | + @JsonProperty("b") | |
| 17 | + public void setB(String value) { this.b = value; } | |
| 18 | 18 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private String b; | |
| 7 | 6 | private Kind kind; |
| 8 | - | |
| 9 | - @JsonProperty("b") | |
| 10 | - public String getB() { return b; } | |
| 11 | - @JsonProperty("b") | |
| 12 | - public void setB(String value) { this.b = value; } | |
| 7 | + private String b; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("kind") |
| 15 | 10 | public Kind getKind() { return kind; } |
| 16 | 11 | @JsonProperty("kind") |
| 17 | 12 | public void setKind(Kind value) { this.kind = value; } |
| 13 | + | |
| 14 | + @JsonProperty("b") | |
| 15 | + public String getB() { return b; } | |
| 16 | + @JsonProperty("b") | |
| 17 | + public void setB(String value) { this.b = value; } | |
| 18 | 18 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private String b; | |
| 7 | 6 | private Kind kind; |
| 8 | - | |
| 9 | - @JsonProperty("b") | |
| 10 | - public String getB() { return b; } | |
| 11 | - @JsonProperty("b") | |
| 12 | - public void setB(String value) { this.b = value; } | |
| 7 | + private String b; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("kind") |
| 15 | 10 | public Kind getKind() { return kind; } |
| 16 | 11 | @JsonProperty("kind") |
| 17 | 12 | public void setKind(Kind value) { this.kind = value; } |
| 13 | + | |
| 14 | + @JsonProperty("b") | |
| 15 | + public String getB() { return b; } | |
| 16 | + @JsonProperty("b") | |
| 17 | + public void setB(String value) { this.b = value; } | |
| 18 | 18 | } |
Mschema-javascriptdefault / TopLevel.js+1 −1
| @@ -172,8 +172,8 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "b", js: "b", typ: u(undefined, u(null, "")) }, | |
| 176 | 175 | { json: "kind", js: "kind", typ: r("Kind") }, |
| 176 | + { json: "b", js: "b", typ: u(undefined, u(null, "")) }, | |
| 177 | 177 | ], "any"), |
| 178 | 178 | "Kind": [ |
| 179 | 179 | "one", |
Mschema-kotlin-jacksondefault / TopLevel.kt+3 −3
| @@ -31,10 +31,10 @@ val mapper = jacksonObjectMapper().apply { | ||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | data class TopLevel ( |
| 34 | - val b: String? = null, | |
| 35 | - | |
| 36 | 34 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 37 | - val kind: Kind | |
| 35 | + val kind: Kind, | |
| 36 | + | |
| 37 | + val b: String? = null | |
| 38 | 38 | ) { |
| 39 | 39 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+2 −2
| @@ -18,8 +18,8 @@ private val klaxon = Klaxon() | ||
| 18 | 18 | .convert(Kind::class, { Kind.fromValue(it.string!!) }, { "\"${it.value}\"" }) |
| 19 | 19 | |
| 20 | 20 | data class TopLevel ( |
| 21 | - val b: String? = null, | |
| 22 | - val kind: Kind | |
| 21 | + val kind: Kind, | |
| 22 | + val b: String? = null | |
| 23 | 23 | ) { |
| 24 | 24 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-kotlinxdefault / TopLevel.kt+2 −2
| @@ -12,8 +12,8 @@ import kotlinx.serialization.encoding.* | ||
| 12 | 12 | |
| 13 | 13 | @Serializable |
| 14 | 14 | data class TopLevel ( |
| 15 | - val b: String? = null, | |
| 16 | - val kind: Kind | |
| 15 | + val kind: Kind, | |
| 16 | + val b: String? = null | |
| 17 | 17 | ) |
| 18 | 18 | |
| 19 | 19 | @Serializable |
Mschema-phpdefault / TopLevel.php+60 −60
| @@ -4,121 +4,121 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private ?string $b; // json:b Optional | |
| 8 | 7 | private Kind $kind; // json:kind Required |
| 8 | + private ?string $b; // json:b Optional | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | - * @param string|null $b | |
| 12 | 11 | * @param Kind $kind |
| 12 | + * @param string|null $b | |
| 13 | 13 | */ |
| 14 | - public function __construct(?string $b, Kind $kind) { | |
| 15 | - $this->b = $b; | |
| 14 | + public function __construct(Kind $kind, ?string $b) { | |
| 16 | 15 | $this->kind = $kind; |
| 16 | + $this->b = $b; | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * @param ?string $value | |
| 20 | + * @param string $value | |
| 21 | 21 | * @throws Exception |
| 22 | - * @return ?string | |
| 22 | + * @return Kind | |
| 23 | 23 | */ |
| 24 | - public static function fromB(?string $value): ?string { | |
| 25 | - if (!is_null($value)) { | |
| 26 | - return $value; /*string*/ | |
| 27 | - } else { | |
| 28 | - return null; | |
| 29 | - } | |
| 24 | + public static function fromKind(string $value): Kind { | |
| 25 | + return Kind::from($value); /*enum*/ | |
| 30 | 26 | } |
| 31 | 27 | |
| 32 | 28 | /** |
| 33 | 29 | * @throws Exception |
| 34 | - * @return ?string | |
| 30 | + * @return string | |
| 35 | 31 | */ |
| 36 | - public function toB(): ?string { | |
| 37 | - if (TopLevel::validateB($this->b)) { | |
| 38 | - if (!is_null($this->b)) { | |
| 39 | - return $this->b; /*string*/ | |
| 40 | - } else { | |
| 41 | - return null; | |
| 42 | - } | |
| 32 | + public function toKind(): string { | |
| 33 | + if (TopLevel::validateKind($this->kind)) { | |
| 34 | + return Kind::to($this->kind); /*enum*/ | |
| 43 | 35 | } |
| 44 | - throw new Exception('never get to this TopLevel::b'); | |
| 36 | + throw new Exception('never get to this TopLevel::kind'); | |
| 45 | 37 | } |
| 46 | 38 | |
| 47 | 39 | /** |
| 48 | - * @param string|null | |
| 40 | + * @param Kind | |
| 49 | 41 | * @return bool |
| 50 | 42 | * @throws Exception |
| 51 | 43 | */ |
| 52 | - public static function validateB(?string $value): bool { | |
| 53 | - if (!is_null($value)) { | |
| 54 | - } | |
| 44 | + public static function validateKind(Kind $value): bool { | |
| 45 | + Kind::to($value); | |
| 55 | 46 | return true; |
| 56 | 47 | } |
| 57 | 48 | |
| 58 | 49 | /** |
| 59 | 50 | * @throws Exception |
| 60 | - * @return ?string | |
| 51 | + * @return Kind | |
| 61 | 52 | */ |
| 62 | - public function getB(): ?string { | |
| 63 | - if (TopLevel::validateB($this->b)) { | |
| 64 | - return $this->b; | |
| 53 | + public function getKind(): Kind { | |
| 54 | + if (TopLevel::validateKind($this->kind)) { | |
| 55 | + return $this->kind; | |
| 65 | 56 | } |
| 66 | - throw new Exception('never get to getB TopLevel::b'); | |
| 57 | + throw new Exception('never get to getKind TopLevel::kind'); | |
| 67 | 58 | } |
| 68 | 59 | |
| 69 | 60 | /** |
| 70 | - * @return ?string | |
| 61 | + * @return Kind | |
| 71 | 62 | */ |
| 72 | - public static function sampleB(): ?string { | |
| 73 | - return 'TopLevel::b::31'; /*31:b*/ | |
| 63 | + public static function sampleKind(): Kind { | |
| 64 | + return Kind::sample(); /*enum*/ | |
| 74 | 65 | } |
| 75 | 66 | |
| 76 | 67 | /** |
| 77 | - * @param string $value | |
| 68 | + * @param ?string $value | |
| 78 | 69 | * @throws Exception |
| 79 | - * @return Kind | |
| 70 | + * @return ?string | |
| 80 | 71 | */ |
| 81 | - public static function fromKind(string $value): Kind { | |
| 82 | - return Kind::from($value); /*enum*/ | |
| 72 | + public static function fromB(?string $value): ?string { | |
| 73 | + if (!is_null($value)) { | |
| 74 | + return $value; /*string*/ | |
| 75 | + } else { | |
| 76 | + return null; | |
| 77 | + } | |
| 83 | 78 | } |
| 84 | 79 | |
| 85 | 80 | /** |
| 86 | 81 | * @throws Exception |
| 87 | - * @return string | |
| 82 | + * @return ?string | |
| 88 | 83 | */ |
| 89 | - public function toKind(): string { | |
| 90 | - if (TopLevel::validateKind($this->kind)) { | |
| 91 | - return Kind::to($this->kind); /*enum*/ | |
| 84 | + public function toB(): ?string { | |
| 85 | + if (TopLevel::validateB($this->b)) { | |
| 86 | + if (!is_null($this->b)) { | |
| 87 | + return $this->b; /*string*/ | |
| 88 | + } else { | |
| 89 | + return null; | |
| 90 | + } | |
| 92 | 91 | } |
| 93 | - throw new Exception('never get to this TopLevel::kind'); | |
| 92 | + throw new Exception('never get to this TopLevel::b'); | |
| 94 | 93 | } |
| 95 | 94 | |
| 96 | 95 | /** |
| 97 | - * @param Kind | |
| 96 | + * @param string|null | |
| 98 | 97 | * @return bool |
| 99 | 98 | * @throws Exception |
| 100 | 99 | */ |
| 101 | - public static function validateKind(Kind $value): bool { | |
| 102 | - Kind::to($value); | |
| 100 | + public static function validateB(?string $value): bool { | |
| 101 | + if (!is_null($value)) { | |
| 102 | + } | |
| 103 | 103 | return true; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | 107 | * @throws Exception |
| 108 | - * @return Kind | |
| 108 | + * @return ?string | |
| 109 | 109 | */ |
| 110 | - public function getKind(): Kind { | |
| 111 | - if (TopLevel::validateKind($this->kind)) { | |
| 112 | - return $this->kind; | |
| 110 | + public function getB(): ?string { | |
| 111 | + if (TopLevel::validateB($this->b)) { | |
| 112 | + return $this->b; | |
| 113 | 113 | } |
| 114 | - throw new Exception('never get to getKind TopLevel::kind'); | |
| 114 | + throw new Exception('never get to getB TopLevel::b'); | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | - * @return Kind | |
| 118 | + * @return ?string | |
| 119 | 119 | */ |
| 120 | - public static function sampleKind(): Kind { | |
| 121 | - return Kind::sample(); /*enum*/ | |
| 120 | + public static function sampleB(): ?string { | |
| 121 | + return 'TopLevel::b::32'; /*32:b*/ | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
| @@ -126,8 +126,8 @@ class TopLevel { | ||
| 126 | 126 | * @return bool |
| 127 | 127 | */ |
| 128 | 128 | public function validate(): bool { |
| 129 | - return TopLevel::validateB($this->b) | |
| 130 | - || TopLevel::validateKind($this->kind); | |
| 129 | + return TopLevel::validateKind($this->kind) | |
| 130 | + || TopLevel::validateB($this->b); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
| @@ -136,8 +136,8 @@ class TopLevel { | ||
| 136 | 136 | */ |
| 137 | 137 | public function to(): stdClass { |
| 138 | 138 | $out = new stdClass(); |
| 139 | - $out->{'b'} = $this->toB(); | |
| 140 | 139 | $out->{'kind'} = $this->toKind(); |
| 140 | + $out->{'b'} = $this->toB(); | |
| 141 | 141 | return $out; |
| 142 | 142 | } |
| 143 | 143 | |
| @@ -148,8 +148,8 @@ class TopLevel { | ||
| 148 | 148 | */ |
| 149 | 149 | public static function from(stdClass $obj): TopLevel { |
| 150 | 150 | return new TopLevel( |
| 151 | - TopLevel::fromB($obj->{'b'}) | |
| 152 | - ,TopLevel::fromKind($obj->{'kind'}) | |
| 151 | + TopLevel::fromKind($obj->{'kind'}) | |
| 152 | + ,TopLevel::fromB($obj->{'b'}) | |
| 153 | 153 | ); |
| 154 | 154 | } |
| 155 | 155 | |
| @@ -158,8 +158,8 @@ class TopLevel { | ||
| 158 | 158 | */ |
| 159 | 159 | public static function sample(): TopLevel { |
| 160 | 160 | return new TopLevel( |
| 161 | - TopLevel::sampleB() | |
| 162 | - ,TopLevel::sampleKind() | |
| 161 | + TopLevel::sampleKind() | |
| 162 | + ,TopLevel::sampleB() | |
| 163 | 163 | ); |
| 164 | 164 | } |
| 165 | 165 | } |
Mschema-pikedefault / TopLevel.pmod+3 −3
| @@ -13,13 +13,13 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - mixed|string b; // json: "b" | |
| 17 | 16 | Kind kind; // json: "kind" |
| 17 | + mixed|string b; // json: "b" | |
| 18 | 18 | |
| 19 | 19 | string encode_json() { |
| 20 | 20 | mapping(string:mixed) json = ([ |
| 21 | - "b" : b, | |
| 22 | 21 | "kind" : kind, |
| 22 | + "b" : b, | |
| 23 | 23 | ]); |
| 24 | 24 | |
| 25 | 25 | return Standards.JSON.encode(json); |
| @@ -29,8 +29,8 @@ class TopLevel { | ||
| 29 | 29 | TopLevel TopLevel_from_JSON(mixed json) { |
| 30 | 30 | TopLevel retval = TopLevel(); |
| 31 | 31 | |
| 32 | - retval.b = json["b"]; | |
| 33 | 32 | retval.kind = json["kind"]; |
| 33 | + retval.b = json["b"]; | |
| 34 | 34 | |
| 35 | 35 | return retval; |
| 36 | 36 | } |
Mschema-rubydefault / TopLevel.rb+4 −4
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.b.nil? | |
| 7 | +# puts top_level.kind == Kind::One | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -27,14 +27,14 @@ module Kind | ||
| 27 | 27 | end |
| 28 | 28 | |
| 29 | 29 | class TopLevel < Dry::Struct |
| 30 | - attribute :b, Types::String.optional.optional | |
| 31 | 30 | attribute :kind, Types::Kind |
| 31 | + attribute :b, Types::String.optional.optional | |
| 32 | 32 | |
| 33 | 33 | def self.from_dynamic!(d) |
| 34 | 34 | d = Types::Hash[d] |
| 35 | 35 | new( |
| 36 | - b: d["b"], | |
| 37 | 36 | kind: d.fetch("kind"), |
| 37 | + b: d["b"], | |
| 38 | 38 | ) |
| 39 | 39 | end |
| 40 | 40 | |
| @@ -44,8 +44,8 @@ class TopLevel < Dry::Struct | ||
| 44 | 44 | |
| 45 | 45 | def to_dynamic |
| 46 | 46 | { |
| 47 | - "b" => b, | |
| 48 | 47 | "kind" => kind, |
| 48 | + "b" => b, | |
| 49 | 49 | } |
| 50 | 50 | end |
Mschema-rustdefault / module_under_test.rs+2 −2
| @@ -15,9 +15,9 @@ use serde::{Serialize, Deserialize}; | ||
| 15 | 15 | |
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | pub struct TopLevel { |
| 18 | - pub b: Option<String>, | |
| 19 | - | |
| 20 | 18 | pub kind: Kind, |
| 19 | + | |
| 20 | + pub b: Option<String>, | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | #[derive(Debug, Clone, Serialize, Deserialize)] |
Mschema-scala3-upickledefault / TopLevel.scala+2 −2
| @@ -66,8 +66,8 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val b : Option[String] = None, | |
| 70 | - val kind : Kind | |
| 69 | + val kind : Kind, | |
| 70 | + val b : Option[String] = None | |
| 71 | 71 | ) derives OptionPickler.ReadWriter |
| 72 | 72 | |
| 73 | 73 | enum Kind : |
Mschema-scala3default / TopLevel.scala+2 −2
| @@ -8,8 +8,8 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val b : Option[String] = None, | |
| 12 | - val kind : Kind | |
| 11 | + val kind : Kind, | |
| 12 | + val b : Option[String] = None | |
| 13 | 13 | ) derives Encoder.AsObject, Decoder |
| 14 | 14 | |
| 15 | 15 | enum Kind : |
Mschema-schemadefault / TopLevel.schema+3 −3
| @@ -6,6 +6,9 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": {}, |
| 8 | 8 | "properties": { |
| 9 | + "kind": { | |
| 10 | + "$ref": "#/definitions/Kind" | |
| 11 | + }, | |
| 9 | 12 | "b": { |
| 10 | 13 | "anyOf": [ |
| 11 | 14 | { |
| @@ -15,9 +18,6 @@ | ||
| 15 | 18 | "type": "string" |
| 16 | 19 | } |
| 17 | 20 | ] |
| 18 | - }, | |
| 19 | - "kind": { | |
| 20 | - "$ref": "#/definitions/Kind" | |
| 21 | 21 | } |
| 22 | 22 | }, |
| 23 | 23 | "required": [ |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -8,8 +8,8 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - b?: null | string; | |
| 12 | 11 | kind: Kind; |
| 12 | + b?: null | string; | |
| 13 | 13 | [property: string]: unknown; |
| 14 | 14 | } |
| 15 | 15 | |
| @@ -182,8 +182,8 @@ function r(name: string) { | ||
| 182 | 182 | |
| 183 | 183 | const typeMap: any = { |
| 184 | 184 | "TopLevel": o([ |
| 185 | - { json: "b", js: "b", typ: u(undefined, u(null, "")) }, | |
| 186 | 185 | { json: "kind", js: "kind", typ: r("Kind") }, |
| 186 | + { json: "b", js: "b", typ: u(undefined, u(null, "")) }, | |
| 187 | 187 | ], "any"), |
| 188 | 188 | "Kind": [ |
| 189 | 189 | "one", |
Test case
25 generated files · +133 −133test/inputs/schema/optional-any.schema
Mschema-cplusplusdefault / quicktype.hpp+7 −7
| @@ -94,17 +94,17 @@ namespace quicktype { | ||
| 94 | 94 | virtual ~TopLevel() = default; |
| 95 | 95 | |
| 96 | 96 | private: |
| 97 | - bool bar; | |
| 98 | 97 | nlohmann::json foo; |
| 98 | + bool bar; | |
| 99 | 99 | |
| 100 | 100 | public: |
| 101 | - const bool & get_bar() const { return bar; } | |
| 102 | - bool & get_mutable_bar() { return bar; } | |
| 103 | - void set_bar(const bool & value) { this->bar = value; } | |
| 104 | - | |
| 105 | 101 | const nlohmann::json & get_foo() const { return foo; } |
| 106 | 102 | nlohmann::json & get_mutable_foo() { return foo; } |
| 107 | 103 | void set_foo(const nlohmann::json & value) { this->foo = value; } |
| 104 | + | |
| 105 | + const bool & get_bar() const { return bar; } | |
| 106 | + bool & get_mutable_bar() { return bar; } | |
| 107 | + void set_bar(const bool & value) { this->bar = value; } | |
| 108 | 108 | }; |
| 109 | 109 | } |
| 110 | 110 | |
| @@ -113,13 +113,13 @@ namespace quicktype { | ||
| 113 | 113 | void to_json(json & j, const TopLevel & x); |
| 114 | 114 | |
| 115 | 115 | inline void from_json(const json & j, TopLevel& x) { |
| 116 | - x.set_bar(j.at("bar").get<bool>()); | |
| 117 | 116 | x.set_foo(get_untyped(j, "foo")); |
| 117 | + x.set_bar(j.at("bar").get<bool>()); | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | inline void to_json(json & j, const TopLevel & x) { |
| 121 | 121 | j = json::object(); |
| 122 | - j["bar"] = x.get_bar(); | |
| 123 | 122 | j["foo"] = x.get_foo(); |
| 123 | + j["bar"] = x.get_bar(); | |
| 124 | 124 | } |
| 125 | 125 | } |
Mschema-cplusplushide-null-optional-true--b100cdb5877d / quicktype.hpp+7 −7
| @@ -94,17 +94,17 @@ namespace quicktype { | ||
| 94 | 94 | virtual ~TopLevel() = default; |
| 95 | 95 | |
| 96 | 96 | private: |
| 97 | - bool bar; | |
| 98 | 97 | nlohmann::json foo; |
| 98 | + bool bar; | |
| 99 | 99 | |
| 100 | 100 | public: |
| 101 | - const bool & get_bar() const { return bar; } | |
| 102 | - bool & get_mutable_bar() { return bar; } | |
| 103 | - void set_bar(const bool & value) { this->bar = value; } | |
| 104 | - | |
| 105 | 101 | const nlohmann::json & get_foo() const { return foo; } |
| 106 | 102 | nlohmann::json & get_mutable_foo() { return foo; } |
| 107 | 103 | void set_foo(const nlohmann::json & value) { this->foo = value; } |
| 104 | + | |
| 105 | + const bool & get_bar() const { return bar; } | |
| 106 | + bool & get_mutable_bar() { return bar; } | |
| 107 | + void set_bar(const bool & value) { this->bar = value; } | |
| 108 | 108 | }; |
| 109 | 109 | } |
| 110 | 110 | |
| @@ -113,15 +113,15 @@ namespace quicktype { | ||
| 113 | 113 | void to_json(json & j, const TopLevel & x); |
| 114 | 114 | |
| 115 | 115 | inline void from_json(const json & j, TopLevel& x) { |
| 116 | - x.set_bar(j.at("bar").get<bool>()); | |
| 117 | 116 | x.set_foo(get_untyped(j, "foo")); |
| 117 | + x.set_bar(j.at("bar").get<bool>()); | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | inline void to_json(json & j, const TopLevel & x) { |
| 121 | 121 | j = json::object(); |
| 122 | - j["bar"] = x.get_bar(); | |
| 123 | 122 | if (!x.get_foo().is_null()) { |
| 124 | 123 | j["foo"] = x.get_foo(); |
| 125 | 124 | } |
| 125 | + j["bar"] = x.get_bar(); | |
| 126 | 126 | } |
| 127 | 127 | } |
Mschema-csharp-recordsdefault / QuickType.cs+3 −3
| @@ -25,11 +25,11 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("bar", Required = Required.Always)] | |
| 29 | - public bool Bar { get; set; } | |
| 30 | - | |
| 31 | 28 | [JsonProperty("foo")] |
| 32 | 29 | public object? Foo { get; set; } |
| 30 | + | |
| 31 | + [JsonProperty("bar", Required = Required.Always)] | |
| 32 | + public bool Bar { get; set; } | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public partial record TopLevel |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+3 −3
| @@ -22,12 +22,12 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | + [JsonPropertyName("foo")] | |
| 26 | + public object? Foo { get; set; } | |
| 27 | + | |
| 25 | 28 | [JsonRequired] |
| 26 | 29 | [JsonPropertyName("bar")] |
| 27 | 30 | public bool Bar { get; set; } |
| 28 | - | |
| 29 | - [JsonPropertyName("foo")] | |
| 30 | - public object? Foo { get; set; } | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public partial class TopLevel |
Mschema-csharpdefault / QuickType.cs+3 −3
| @@ -25,11 +25,11 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("bar", Required = Required.Always)] | |
| 29 | - public bool Bar { get; set; } | |
| 30 | - | |
| 31 | 28 | [JsonProperty("foo")] |
| 32 | 29 | public object? Foo { get; set; } |
| 30 | + | |
| 31 | + [JsonProperty("bar", Required = Required.Always)] | |
| 32 | + public bool Bar { get; set; } | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public partial class TopLevel |
Mschema-dartdefault / TopLevel.dart+4 −4
| @@ -9,21 +9,21 @@ TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | ||
| 9 | 9 | String topLevelToJson(TopLevel data) => json.encode(data.toJson()); |
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | - final bool bar; | |
| 13 | 12 | final dynamic foo; |
| 13 | + final bool bar; | |
| 14 | 14 | |
| 15 | 15 | TopLevel({ |
| 16 | - required this.bar, | |
| 17 | 16 | this.foo, |
| 17 | + required this.bar, | |
| 18 | 18 | }); |
| 19 | 19 | |
| 20 | 20 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 21 | - bar: json["bar"], | |
| 22 | 21 | foo: json["foo"], |
| 22 | + bar: json["bar"], | |
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | Map<String, dynamic> toJson() => { |
| 26 | - "bar": bar, | |
| 27 | 26 | "foo": foo, |
| 27 | + "bar": bar, | |
| 28 | 28 | }; |
| 29 | 29 | } |
Mschema-elmdefault / QuickType.elm+5 −5
| @@ -23,8 +23,8 @@ import Json.Encode as Jenc | ||
| 23 | 23 | import Dict exposing (Dict) |
| 24 | 24 | |
| 25 | 25 | type alias QuickType = |
| 26 | - { bar : Bool | |
| 27 | - , foo : Maybe Jdec.Value | |
| 26 | + { foo : Maybe Jdec.Value | |
| 27 | + , bar : Bool | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | -- decoders and encoders |
| @@ -35,14 +35,14 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 35 | 35 | quickType : Jdec.Decoder QuickType |
| 36 | 36 | quickType = |
| 37 | 37 | Jdec.succeed QuickType |
| 38 | - |> Jpipe.required "bar" Jdec.bool | |
| 39 | 38 | |> Jpipe.optional "foo" (Jdec.nullable Jdec.value) Nothing |
| 39 | + |> Jpipe.required "bar" Jdec.bool | |
| 40 | 40 | |
| 41 | 41 | encodeQuickType : QuickType -> Jenc.Value |
| 42 | 42 | encodeQuickType x = |
| 43 | 43 | Jenc.object |
| 44 | - [ ("bar", Jenc.bool x.bar) | |
| 45 | - , ("foo", makeNullableEncoder identity x.foo) | |
| 44 | + [ ("foo", makeNullableEncoder identity x.foo) | |
| 45 | + , ("bar", Jenc.bool x.bar) | |
| 46 | 46 | ] |
| 47 | 47 | |
| 48 | 48 | --- encoder helpers |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -10,8 +10,8 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - bar: boolean; | |
| 14 | 13 | foo?: mixed; |
| 14 | + bar: boolean; | |
| 15 | 15 | }; |
| 16 | 16 | |
| 17 | 17 | // Converts JSON strings to/from your types |
| @@ -179,8 +179,8 @@ function r(name: string) { | ||
| 179 | 179 | |
| 180 | 180 | const typeMap: any = { |
| 181 | 181 | "TopLevel": o([ |
| 182 | - { json: "bar", js: "bar", typ: true }, | |
| 183 | 182 | { json: "foo", js: "foo", typ: u(undefined, "any") }, |
| 183 | + { json: "bar", js: "bar", typ: true }, | |
| 184 | 184 | ], false), |
| 185 | 185 | }; |
Mschema-golangdefault / quicktype.go+1 −1
| @@ -19,6 +19,6 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | type TopLevel struct { |
| 22 | - Bar bool `json:"bar"` | |
| 23 | 22 | Foo interface{} `json:"foo"` |
| 23 | + Bar bool `json:"bar"` | |
| 24 | 24 | } |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private boolean bar; | |
| 7 | 6 | private Object foo; |
| 8 | - | |
| 9 | - @JsonProperty("bar") | |
| 10 | - public boolean getBar() { return bar; } | |
| 11 | - @JsonProperty("bar") | |
| 12 | - public void setBar(boolean value) { this.bar = value; } | |
| 7 | + private boolean bar; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("foo") |
| 15 | 10 | public Object getFoo() { return foo; } |
| 16 | 11 | @JsonProperty("foo") |
| 17 | 12 | public void setFoo(Object value) { this.foo = value; } |
| 13 | + | |
| 14 | + @JsonProperty("bar") | |
| 15 | + public boolean getBar() { return bar; } | |
| 16 | + @JsonProperty("bar") | |
| 17 | + public void setBar(boolean value) { this.bar = value; } | |
| 18 | 18 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private boolean bar; | |
| 7 | 6 | private Object foo; |
| 8 | - | |
| 9 | - @JsonProperty("bar") | |
| 10 | - public boolean getBar() { return bar; } | |
| 11 | - @JsonProperty("bar") | |
| 12 | - public void setBar(boolean value) { this.bar = value; } | |
| 7 | + private boolean bar; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("foo") |
| 15 | 10 | public Object getFoo() { return foo; } |
| 16 | 11 | @JsonProperty("foo") |
| 17 | 12 | public void setFoo(Object value) { this.foo = value; } |
| 13 | + | |
| 14 | + @JsonProperty("bar") | |
| 15 | + public boolean getBar() { return bar; } | |
| 16 | + @JsonProperty("bar") | |
| 17 | + public void setBar(boolean value) { this.bar = value; } | |
| 18 | 18 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private boolean bar; | |
| 7 | 6 | private Object foo; |
| 8 | - | |
| 9 | - @JsonProperty("bar") | |
| 10 | - public boolean getBar() { return bar; } | |
| 11 | - @JsonProperty("bar") | |
| 12 | - public void setBar(boolean value) { this.bar = value; } | |
| 7 | + private boolean bar; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("foo") |
| 15 | 10 | public Object getFoo() { return foo; } |
| 16 | 11 | @JsonProperty("foo") |
| 17 | 12 | public void setFoo(Object value) { this.foo = value; } |
| 13 | + | |
| 14 | + @JsonProperty("bar") | |
| 15 | + public boolean getBar() { return bar; } | |
| 16 | + @JsonProperty("bar") | |
| 17 | + public void setBar(boolean value) { this.bar = value; } | |
| 18 | 18 | } |
Mschema-javascriptdefault / TopLevel.js+1 −1
| @@ -172,8 +172,8 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "bar", js: "bar", typ: true }, | |
| 176 | 175 | { json: "foo", js: "foo", typ: u(undefined, "any") }, |
| 176 | + { json: "bar", js: "bar", typ: true }, | |
| 177 | 177 | ], false), |
| 178 | 178 | }; |
Mschema-kotlin-jacksondefault / TopLevel.kt+3 −3
| @@ -19,10 +19,10 @@ val mapper = jacksonObjectMapper().apply { | ||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | data class TopLevel ( |
| 22 | - @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 23 | - val bar: Boolean, | |
| 22 | + val foo: Any? = null, | |
| 24 | 23 | |
| 25 | - val foo: Any? = null | |
| 24 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 25 | + val bar: Boolean | |
| 26 | 26 | ) { |
| 27 | 27 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+2 −2
| @@ -9,8 +9,8 @@ import com.beust.klaxon.* | ||
| 9 | 9 | private val klaxon = Klaxon() |
| 10 | 10 | |
| 11 | 11 | data class TopLevel ( |
| 12 | - val bar: Boolean, | |
| 13 | - val foo: Any? = null | |
| 12 | + val foo: Any? = null, | |
| 13 | + val bar: Boolean | |
| 14 | 14 | ) { |
| 15 | 15 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-kotlinxdefault / TopLevel.kt+2 −2
| @@ -12,6 +12,6 @@ import kotlinx.serialization.encoding.* | ||
| 12 | 12 | |
| 13 | 13 | @Serializable |
| 14 | 14 | data class TopLevel ( |
| 15 | - val bar: Boolean, | |
| 16 | - val foo: JsonElement? = null | |
| 15 | + val foo: JsonElement? = null, | |
| 16 | + val bar: Boolean | |
| 17 | 17 | ) |
Mschema-phpdefault / TopLevel.php+49 −49
| @@ -4,110 +4,110 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private bool $bar; // json:bar Required | |
| 8 | 7 | private mixed $foo; // json:foo Optional |
| 8 | + private bool $bar; // json:bar Required | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | - * @param bool $bar | |
| 12 | 11 | * @param mixed $foo |
| 12 | + * @param bool $bar | |
| 13 | 13 | */ |
| 14 | - public function __construct(bool $bar, mixed $foo) { | |
| 15 | - $this->bar = $bar; | |
| 14 | + public function __construct(mixed $foo, bool $bar) { | |
| 16 | 15 | $this->foo = $foo; |
| 16 | + $this->bar = $bar; | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * @param bool $value | |
| 20 | + * @param mixed $value | |
| 21 | 21 | * @throws Exception |
| 22 | - * @return bool | |
| 22 | + * @return mixed | |
| 23 | 23 | */ |
| 24 | - public static function fromBar(bool $value): bool { | |
| 25 | - return $value; /*bool*/ | |
| 24 | + public static function fromFoo(mixed $value): mixed { | |
| 25 | + return $value; /*any*/ | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * @throws Exception |
| 30 | - * @return bool | |
| 30 | + * @return mixed | |
| 31 | 31 | */ |
| 32 | - public function toBar(): bool { | |
| 33 | - if (TopLevel::validateBar($this->bar)) { | |
| 34 | - return $this->bar; /*bool*/ | |
| 32 | + public function toFoo(): mixed { | |
| 33 | + if (TopLevel::validateFoo($this->foo)) { | |
| 34 | + return $this->foo; /*any*/ | |
| 35 | 35 | } |
| 36 | - throw new Exception('never get to this TopLevel::bar'); | |
| 36 | + throw new Exception('never get to this TopLevel::foo'); | |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * @param bool | |
| 40 | + * @param mixed | |
| 41 | 41 | * @return bool |
| 42 | 42 | * @throws Exception |
| 43 | 43 | */ |
| 44 | - public static function validateBar(bool $value): bool { | |
| 44 | + public static function validateFoo(mixed $value): bool { | |
| 45 | 45 | return true; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * @throws Exception |
| 50 | - * @return bool | |
| 50 | + * @return mixed | |
| 51 | 51 | */ |
| 52 | - public function getBar(): bool { | |
| 53 | - if (TopLevel::validateBar($this->bar)) { | |
| 54 | - return $this->bar; | |
| 52 | + public function getFoo(): mixed { | |
| 53 | + if (TopLevel::validateFoo($this->foo)) { | |
| 54 | + return $this->foo; | |
| 55 | 55 | } |
| 56 | - throw new Exception('never get to getBar TopLevel::bar'); | |
| 56 | + throw new Exception('never get to getFoo TopLevel::foo'); | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * @return bool | |
| 60 | + * @return mixed | |
| 61 | 61 | */ |
| 62 | - public static function sampleBar(): bool { | |
| 63 | - return true; /*31:bar*/ | |
| 62 | + public static function sampleFoo(): mixed { | |
| 63 | + return 'AnyType::TopLevel::foo::31';/*31:foo*/ | |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * @param mixed $value | |
| 67 | + * @param bool $value | |
| 68 | 68 | * @throws Exception |
| 69 | - * @return mixed | |
| 69 | + * @return bool | |
| 70 | 70 | */ |
| 71 | - public static function fromFoo(mixed $value): mixed { | |
| 72 | - return $value; /*any*/ | |
| 71 | + public static function fromBar(bool $value): bool { | |
| 72 | + return $value; /*bool*/ | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * @throws Exception |
| 77 | - * @return mixed | |
| 77 | + * @return bool | |
| 78 | 78 | */ |
| 79 | - public function toFoo(): mixed { | |
| 80 | - if (TopLevel::validateFoo($this->foo)) { | |
| 81 | - return $this->foo; /*any*/ | |
| 79 | + public function toBar(): bool { | |
| 80 | + if (TopLevel::validateBar($this->bar)) { | |
| 81 | + return $this->bar; /*bool*/ | |
| 82 | 82 | } |
| 83 | - throw new Exception('never get to this TopLevel::foo'); | |
| 83 | + throw new Exception('never get to this TopLevel::bar'); | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | - * @param mixed | |
| 87 | + * @param bool | |
| 88 | 88 | * @return bool |
| 89 | 89 | * @throws Exception |
| 90 | 90 | */ |
| 91 | - public static function validateFoo(mixed $value): bool { | |
| 91 | + public static function validateBar(bool $value): bool { | |
| 92 | 92 | return true; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | 96 | * @throws Exception |
| 97 | - * @return mixed | |
| 97 | + * @return bool | |
| 98 | 98 | */ |
| 99 | - public function getFoo(): mixed { | |
| 100 | - if (TopLevel::validateFoo($this->foo)) { | |
| 101 | - return $this->foo; | |
| 99 | + public function getBar(): bool { | |
| 100 | + if (TopLevel::validateBar($this->bar)) { | |
| 101 | + return $this->bar; | |
| 102 | 102 | } |
| 103 | - throw new Exception('never get to getFoo TopLevel::foo'); | |
| 103 | + throw new Exception('never get to getBar TopLevel::bar'); | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | - * @return mixed | |
| 107 | + * @return bool | |
| 108 | 108 | */ |
| 109 | - public static function sampleFoo(): mixed { | |
| 110 | - return 'AnyType::TopLevel::foo::32';/*32:foo*/ | |
| 109 | + public static function sampleBar(): bool { | |
| 110 | + return true; /*32:bar*/ | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
| @@ -115,8 +115,8 @@ class TopLevel { | ||
| 115 | 115 | * @return bool |
| 116 | 116 | */ |
| 117 | 117 | public function validate(): bool { |
| 118 | - return TopLevel::validateBar($this->bar) | |
| 119 | - || TopLevel::validateFoo($this->foo); | |
| 118 | + return TopLevel::validateFoo($this->foo) | |
| 119 | + || TopLevel::validateBar($this->bar); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| @@ -125,8 +125,8 @@ class TopLevel { | ||
| 125 | 125 | */ |
| 126 | 126 | public function to(): stdClass { |
| 127 | 127 | $out = new stdClass(); |
| 128 | - $out->{'bar'} = $this->toBar(); | |
| 129 | 128 | $out->{'foo'} = $this->toFoo(); |
| 129 | + $out->{'bar'} = $this->toBar(); | |
| 130 | 130 | return $out; |
| 131 | 131 | } |
| 132 | 132 | |
| @@ -137,8 +137,8 @@ class TopLevel { | ||
| 137 | 137 | */ |
| 138 | 138 | public static function from(stdClass $obj): TopLevel { |
| 139 | 139 | return new TopLevel( |
| 140 | - TopLevel::fromBar($obj->{'bar'}) | |
| 141 | - ,TopLevel::fromFoo($obj->{'foo'}) | |
| 140 | + TopLevel::fromFoo($obj->{'foo'}) | |
| 141 | + ,TopLevel::fromBar($obj->{'bar'}) | |
| 142 | 142 | ); |
| 143 | 143 | } |
| 144 | 144 | |
| @@ -147,8 +147,8 @@ class TopLevel { | ||
| 147 | 147 | */ |
| 148 | 148 | public static function sample(): TopLevel { |
| 149 | 149 | return new TopLevel( |
| 150 | - TopLevel::sampleBar() | |
| 151 | - ,TopLevel::sampleFoo() | |
| 150 | + TopLevel::sampleFoo() | |
| 151 | + ,TopLevel::sampleBar() | |
| 152 | 152 | ); |
| 153 | 153 | } |
| 154 | 154 | } |
Mschema-pikedefault / TopLevel.pmod+3 −3
| @@ -13,13 +13,13 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - bool bar; // json: "bar" | |
| 17 | 16 | mixed foo; // json: "foo" |
| 17 | + bool bar; // json: "bar" | |
| 18 | 18 | |
| 19 | 19 | string encode_json() { |
| 20 | 20 | mapping(string:mixed) json = ([ |
| 21 | - "bar" : bar, | |
| 22 | 21 | "foo" : foo, |
| 22 | + "bar" : bar, | |
| 23 | 23 | ]); |
| 24 | 24 | |
| 25 | 25 | return Standards.JSON.encode(json); |
| @@ -29,8 +29,8 @@ class TopLevel { | ||
| 29 | 29 | TopLevel TopLevel_from_JSON(mixed json) { |
| 30 | 30 | TopLevel retval = TopLevel(); |
| 31 | 31 | |
| 32 | - retval.bar = json["bar"]; | |
| 33 | 32 | retval.foo = json["foo"]; |
| 33 | + retval.bar = json["bar"]; | |
| 34 | 34 | |
| 35 | 35 | return retval; |
| 36 | 36 | } |
Mschema-rubydefault / TopLevel.rb+4 −4
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.bar | |
| 7 | +# puts top_level.foo | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -20,14 +20,14 @@ module Types | ||
| 20 | 20 | end |
| 21 | 21 | |
| 22 | 22 | class TopLevel < Dry::Struct |
| 23 | - attribute :bar, Types::Bool | |
| 24 | 23 | attribute :foo, Types::Any.optional |
| 24 | + attribute :bar, Types::Bool | |
| 25 | 25 | |
| 26 | 26 | def self.from_dynamic!(d) |
| 27 | 27 | d = Types::Hash[d] |
| 28 | 28 | new( |
| 29 | - bar: d.fetch("bar"), | |
| 30 | 29 | foo: d["foo"], |
| 30 | + bar: d.fetch("bar"), | |
| 31 | 31 | ) |
| 32 | 32 | end |
| 33 | 33 | |
| @@ -37,8 +37,8 @@ class TopLevel < Dry::Struct | ||
| 37 | 37 | |
| 38 | 38 | def to_dynamic |
| 39 | 39 | { |
| 40 | - "bar" => bar, | |
| 41 | 40 | "foo" => foo, |
| 41 | + "bar" => bar, | |
| 42 | 42 | } |
| 43 | 43 | end |
Mschema-rustdefault / module_under_test.rs+2 −2
| @@ -15,7 +15,7 @@ use serde::{Serialize, Deserialize}; | ||
| 15 | 15 | |
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | pub struct TopLevel { |
| 18 | - pub bar: bool, | |
| 19 | - | |
| 20 | 18 | pub foo: Option<serde_json::Value>, |
| 19 | + | |
| 20 | + pub bar: bool, | |
| 21 | 21 | } |
Mschema-scala3-upickledefault / TopLevel.scala+2 −2
| @@ -66,6 +66,6 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val bar : Boolean, | |
| 70 | - val foo : Option[ujson.Value] = None | |
| 69 | + val foo : Option[ujson.Value] = None, | |
| 70 | + val bar : Boolean | |
| 71 | 71 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+2 −2
| @@ -8,6 +8,6 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val bar : Boolean, | |
| 12 | - val foo : Option[Json] = None | |
| 11 | + val foo : Option[Json] = None, | |
| 12 | + val bar : Boolean | |
| 13 | 13 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+2 −2
| @@ -6,10 +6,10 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": false, |
| 8 | 8 | "properties": { |
| 9 | + "foo": {}, | |
| 9 | 10 | "bar": { |
| 10 | 11 | "type": "boolean" |
| 11 | - }, | |
| 12 | - "foo": {} | |
| 12 | + } | |
| 13 | 13 | }, |
| 14 | 14 | "required": [ |
| 15 | 15 | "bar" |
Mschema-swiftdefault / quicktype.swift+6 −6
| @@ -7,12 +7,12 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | - let bar: Bool | |
| 11 | 10 | let foo: JSONAny? |
| 11 | + let bar: Bool | |
| 12 | 12 | |
| 13 | 13 | enum CodingKeys: String, CodingKey { |
| 14 | - case bar = "bar" | |
| 15 | 14 | case foo = "foo" |
| 15 | + case bar = "bar" | |
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | |
| @@ -35,12 +35,12 @@ extension TopLevel { | ||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | func with( |
| 38 | - bar: Bool? = nil, | |
| 39 | - foo: JSONAny?? = nil | |
| 38 | + foo: JSONAny?? = nil, | |
| 39 | + bar: Bool? = nil | |
| 40 | 40 | ) -> TopLevel { |
| 41 | 41 | return TopLevel( |
| 42 | - bar: bar ?? self.bar, | |
| 43 | - foo: foo ?? self.foo | |
| 42 | + foo: foo ?? self.foo, | |
| 43 | + bar: bar ?? self.bar | |
| 44 | 44 | ) |
| 45 | 45 | } |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -8,8 +8,8 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - bar: boolean; | |
| 12 | 11 | foo?: unknown; |
| 12 | + bar: boolean; | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | // Converts JSON strings to/from your types |
| @@ -179,7 +179,7 @@ function r(name: string) { | ||
| 179 | 179 | |
| 180 | 180 | const typeMap: any = { |
| 181 | 181 | "TopLevel": o([ |
| 182 | - { json: "bar", js: "bar", typ: true }, | |
| 183 | 182 | { json: "foo", js: "foo", typ: u(undefined, "any") }, |
| 183 | + { json: "bar", js: "bar", typ: true }, | |
| 184 | 184 | ], false), |
| 185 | 185 | }; |
Test case
28 generated files · +415 −414test/inputs/schema/optional-const-ref.schema
Mschema-cplusplusdefault / quicktype.hpp+26 −26
| @@ -242,55 +242,55 @@ namespace quicktype { | ||
| 242 | 242 | public: |
| 243 | 243 | TopLevel() : |
| 244 | 244 | count_constraint(1, 100, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), |
| 245 | - label_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, 2, 16, std::nullopt), | |
| 246 | 245 | required_count_constraint(1, 100, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), |
| 247 | - required_label_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, 2, 16, std::nullopt), | |
| 248 | - weight_constraint(std::nullopt, std::nullopt, 0.5, 99.5, std::nullopt, std::nullopt, std::nullopt) | |
| 246 | + weight_constraint(std::nullopt, std::nullopt, 0.5, 99.5, std::nullopt, std::nullopt, std::nullopt), | |
| 247 | + label_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, 2, 16, std::nullopt), | |
| 248 | + required_label_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, 2, 16, std::nullopt) | |
| 249 | 249 | {} |
| 250 | 250 | virtual ~TopLevel() = default; |
| 251 | 251 | |
| 252 | 252 | private: |
| 253 | 253 | std::optional<std::vector<Coordinate>> coordinates; |
| 254 | + std::vector<Coordinate> required_coordinates; | |
| 254 | 255 | std::optional<int64_t> count; |
| 255 | 256 | ClassMemberConstraints count_constraint; |
| 256 | - std::optional<std::string> label; | |
| 257 | - ClassMemberConstraints label_constraint; | |
| 258 | - std::vector<Coordinate> required_coordinates; | |
| 259 | 257 | int64_t required_count; |
| 260 | 258 | ClassMemberConstraints required_count_constraint; |
| 261 | - std::string required_label; | |
| 262 | - ClassMemberConstraints required_label_constraint; | |
| 263 | 259 | std::optional<double> weight; |
| 264 | 260 | ClassMemberConstraints weight_constraint; |
| 261 | + std::optional<std::string> label; | |
| 262 | + ClassMemberConstraints label_constraint; | |
| 263 | + std::string required_label; | |
| 264 | + ClassMemberConstraints required_label_constraint; | |
| 265 | 265 | |
| 266 | 266 | public: |
| 267 | 267 | const std::optional<std::vector<Coordinate>> & get_coordinates() const { return coordinates; } |
| 268 | 268 | std::optional<std::vector<Coordinate>> & get_mutable_coordinates() { return coordinates; } |
| 269 | 269 | void set_coordinates(const std::optional<std::vector<Coordinate>> & value) { this->coordinates = value; } |
| 270 | 270 | |
| 271 | - const std::optional<int64_t> & get_count() const { return count; } | |
| 272 | - std::optional<int64_t> & get_mutable_count() { return count; } | |
| 273 | - void set_count(const std::optional<int64_t> & value) { CheckConstraint("count", count_constraint, value); this->count = value; } | |
| 274 | - | |
| 275 | - const std::optional<std::string> & get_label() const { return label; } | |
| 276 | - std::optional<std::string> & get_mutable_label() { return label; } | |
| 277 | - void set_label(const std::optional<std::string> & value) { CheckConstraint("label", label_constraint, value); this->label = value; } | |
| 278 | - | |
| 279 | 271 | const std::vector<Coordinate> & get_required_coordinates() const { return required_coordinates; } |
| 280 | 272 | std::vector<Coordinate> & get_mutable_required_coordinates() { return required_coordinates; } |
| 281 | 273 | void set_required_coordinates(const std::vector<Coordinate> & value) { this->required_coordinates = value; } |
| 282 | 274 | |
| 275 | + const std::optional<int64_t> & get_count() const { return count; } | |
| 276 | + std::optional<int64_t> & get_mutable_count() { return count; } | |
| 277 | + void set_count(const std::optional<int64_t> & value) { CheckConstraint("count", count_constraint, value); this->count = value; } | |
| 278 | + | |
| 283 | 279 | const int64_t & get_required_count() const { return required_count; } |
| 284 | 280 | int64_t & get_mutable_required_count() { return required_count; } |
| 285 | 281 | void set_required_count(const int64_t & value) { CheckConstraint("required_count", required_count_constraint, value); this->required_count = value; } |
| 286 | 282 | |
| 287 | - const std::string & get_required_label() const { return required_label; } | |
| 288 | - std::string & get_mutable_required_label() { return required_label; } | |
| 289 | - void set_required_label(const std::string & value) { CheckConstraint("required_label", required_label_constraint, value); this->required_label = value; } | |
| 290 | - | |
| 291 | 283 | const std::optional<double> & get_weight() const { return weight; } |
| 292 | 284 | std::optional<double> & get_mutable_weight() { return weight; } |
| 293 | 285 | void set_weight(const std::optional<double> & value) { CheckConstraint("weight", weight_constraint, value); this->weight = value; } |
| 286 | + | |
| 287 | + const std::optional<std::string> & get_label() const { return label; } | |
| 288 | + std::optional<std::string> & get_mutable_label() { return label; } | |
| 289 | + void set_label(const std::optional<std::string> & value) { CheckConstraint("label", label_constraint, value); this->label = value; } | |
| 290 | + | |
| 291 | + const std::string & get_required_label() const { return required_label; } | |
| 292 | + std::string & get_mutable_required_label() { return required_label; } | |
| 293 | + void set_required_label(const std::string & value) { CheckConstraint("required_label", required_label_constraint, value); this->required_label = value; } | |
| 294 | 294 | }; |
| 295 | 295 | } |
| 296 | 296 | |
| @@ -314,22 +314,22 @@ namespace quicktype { | ||
| 314 | 314 | |
| 315 | 315 | inline void from_json(const json & j, TopLevel& x) { |
| 316 | 316 | x.set_coordinates(get_stack_optional<std::vector<Coordinate>>(j, "coordinates")); |
| 317 | - x.set_count(get_stack_optional<int64_t>(j, "count")); | |
| 318 | - x.set_label(get_stack_optional<std::string>(j, "label")); | |
| 319 | 317 | x.set_required_coordinates(j.at("requiredCoordinates").get<std::vector<Coordinate>>()); |
| 318 | + x.set_count(get_stack_optional<int64_t>(j, "count")); | |
| 320 | 319 | x.set_required_count(j.at("requiredCount").get<int64_t>()); |
| 321 | - x.set_required_label(j.at("requiredLabel").get<std::string>()); | |
| 322 | 320 | x.set_weight(get_stack_optional<double>(j, "weight")); |
| 321 | + x.set_label(get_stack_optional<std::string>(j, "label")); | |
| 322 | + x.set_required_label(j.at("requiredLabel").get<std::string>()); | |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | inline void to_json(json & j, const TopLevel & x) { |
| 326 | 326 | j = json::object(); |
| 327 | 327 | j["coordinates"] = x.get_coordinates(); |
| 328 | - j["count"] = x.get_count(); | |
| 329 | - j["label"] = x.get_label(); | |
| 330 | 328 | j["requiredCoordinates"] = x.get_required_coordinates(); |
| 329 | + j["count"] = x.get_count(); | |
| 331 | 330 | j["requiredCount"] = x.get_required_count(); |
| 332 | - j["requiredLabel"] = x.get_required_label(); | |
| 333 | 331 | j["weight"] = x.get_weight(); |
| 332 | + j["label"] = x.get_label(); | |
| 333 | + j["requiredLabel"] = x.get_required_label(); | |
| 334 | 334 | } |
| 335 | 335 | } |
Mschema-csharp-recordsdefault / QuickType.cs+10 −10
| @@ -28,26 +28,26 @@ namespace QuickType | ||
| 28 | 28 | [JsonProperty("coordinates", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 29 | 29 | public Coordinate[]? Coordinates { get; set; } |
| 30 | 30 | |
| 31 | + [JsonProperty("requiredCoordinates", Required = Required.Always)] | |
| 32 | + public Coordinate[] RequiredCoordinates { get; set; } | |
| 33 | + | |
| 31 | 34 | [JsonProperty("count", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 32 | 35 | public long? Count { get; set; } |
| 33 | 36 | |
| 37 | + [JsonProperty("requiredCount", Required = Required.Always)] | |
| 38 | + public long RequiredCount { get; set; } | |
| 39 | + | |
| 40 | + [JsonProperty("weight", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 41 | + [JsonConverter(typeof(MinMaxValueCheckConverter))] | |
| 42 | + public double? Weight { get; set; } | |
| 43 | + | |
| 34 | 44 | [JsonProperty("label", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 35 | 45 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 36 | 46 | public string? Label { get; set; } |
| 37 | 47 | |
| 38 | - [JsonProperty("requiredCoordinates", Required = Required.Always)] | |
| 39 | - public Coordinate[] RequiredCoordinates { get; set; } | |
| 40 | - | |
| 41 | - [JsonProperty("requiredCount", Required = Required.Always)] | |
| 42 | - public long RequiredCount { get; set; } | |
| 43 | - | |
| 44 | 48 | [JsonProperty("requiredLabel", Required = Required.Always)] |
| 45 | 49 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 46 | 50 | public string RequiredLabel { get; set; } |
| 47 | - | |
| 48 | - [JsonProperty("weight", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 49 | - [JsonConverter(typeof(MinMaxValueCheckConverter))] | |
| 50 | - public double? Weight { get; set; } | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public partial record Coordinate |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+13 −13
| @@ -26,32 +26,32 @@ namespace QuickType | ||
| 26 | 26 | [JsonPropertyName("coordinates")] |
| 27 | 27 | public Coordinate[]? Coordinates { get; set; } |
| 28 | 28 | |
| 29 | + [JsonRequired] | |
| 30 | + [JsonPropertyName("requiredCoordinates")] | |
| 31 | + public Coordinate[] RequiredCoordinates { get; set; } | |
| 32 | + | |
| 29 | 33 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 30 | 34 | [JsonPropertyName("count")] |
| 31 | 35 | public long? Count { get; set; } |
| 32 | 36 | |
| 37 | + [JsonRequired] | |
| 38 | + [JsonPropertyName("requiredCount")] | |
| 39 | + public long RequiredCount { get; set; } | |
| 40 | + | |
| 41 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 42 | + [JsonPropertyName("weight")] | |
| 43 | + [JsonConverter(typeof(MinMaxValueCheckConverter))] | |
| 44 | + public double? Weight { get; set; } | |
| 45 | + | |
| 33 | 46 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 34 | 47 | [JsonPropertyName("label")] |
| 35 | 48 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 36 | 49 | public string? Label { get; set; } |
| 37 | 50 | |
| 38 | - [JsonRequired] | |
| 39 | - [JsonPropertyName("requiredCoordinates")] | |
| 40 | - public Coordinate[] RequiredCoordinates { get; set; } | |
| 41 | - | |
| 42 | - [JsonRequired] | |
| 43 | - [JsonPropertyName("requiredCount")] | |
| 44 | - public long RequiredCount { get; set; } | |
| 45 | - | |
| 46 | 51 | [JsonRequired] |
| 47 | 52 | [JsonPropertyName("requiredLabel")] |
| 48 | 53 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 49 | 54 | public string RequiredLabel { get; set; } |
| 50 | - | |
| 51 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 52 | - [JsonPropertyName("weight")] | |
| 53 | - [JsonConverter(typeof(MinMaxValueCheckConverter))] | |
| 54 | - public double? Weight { get; set; } | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public partial class Coordinate |
Mschema-csharpdefault / QuickType.cs+10 −10
| @@ -28,26 +28,26 @@ namespace QuickType | ||
| 28 | 28 | [JsonProperty("coordinates", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 29 | 29 | public Coordinate[]? Coordinates { get; set; } |
| 30 | 30 | |
| 31 | + [JsonProperty("requiredCoordinates", Required = Required.Always)] | |
| 32 | + public Coordinate[] RequiredCoordinates { get; set; } | |
| 33 | + | |
| 31 | 34 | [JsonProperty("count", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 32 | 35 | public long? Count { get; set; } |
| 33 | 36 | |
| 37 | + [JsonProperty("requiredCount", Required = Required.Always)] | |
| 38 | + public long RequiredCount { get; set; } | |
| 39 | + | |
| 40 | + [JsonProperty("weight", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 41 | + [JsonConverter(typeof(MinMaxValueCheckConverter))] | |
| 42 | + public double? Weight { get; set; } | |
| 43 | + | |
| 34 | 44 | [JsonProperty("label", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 35 | 45 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 36 | 46 | public string? Label { get; set; } |
| 37 | 47 | |
| 38 | - [JsonProperty("requiredCoordinates", Required = Required.Always)] | |
| 39 | - public Coordinate[] RequiredCoordinates { get; set; } | |
| 40 | - | |
| 41 | - [JsonProperty("requiredCount", Required = Required.Always)] | |
| 42 | - public long RequiredCount { get; set; } | |
| 43 | - | |
| 44 | 48 | [JsonProperty("requiredLabel", Required = Required.Always)] |
| 45 | 49 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 46 | 50 | public string RequiredLabel { get; set; } |
| 47 | - | |
| 48 | - [JsonProperty("weight", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 49 | - [JsonConverter(typeof(MinMaxValueCheckConverter))] | |
| 50 | - public double? Weight { get; set; } | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public partial class Coordinate |
Mschema-dartdefault / TopLevel.dart+12 −12
| @@ -10,41 +10,41 @@ String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | ||
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | 12 | final List<Coordinate>? coordinates; |
| 13 | - final int? count; | |
| 14 | - final String? label; | |
| 15 | 13 | final List<Coordinate> requiredCoordinates; |
| 14 | + final int? count; | |
| 16 | 15 | final int requiredCount; |
| 17 | - final String requiredLabel; | |
| 18 | 16 | final double? weight; |
| 17 | + final String? label; | |
| 18 | + final String requiredLabel; | |
| 19 | 19 | |
| 20 | 20 | TopLevel({ |
| 21 | 21 | this.coordinates, |
| 22 | - this.count, | |
| 23 | - this.label, | |
| 24 | 22 | required this.requiredCoordinates, |
| 23 | + this.count, | |
| 25 | 24 | required this.requiredCount, |
| 26 | - required this.requiredLabel, | |
| 27 | 25 | this.weight, |
| 26 | + this.label, | |
| 27 | + required this.requiredLabel, | |
| 28 | 28 | }); |
| 29 | 29 | |
| 30 | 30 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 31 | 31 | coordinates: json["coordinates"] == null ? null : List<Coordinate>.from(json["coordinates"]!.map((x) => Coordinate.fromJson(x))), |
| 32 | - count: json["count"], | |
| 33 | - label: json["label"], | |
| 34 | 32 | requiredCoordinates: List<Coordinate>.from(json["requiredCoordinates"].map((x) => Coordinate.fromJson(x))), |
| 33 | + count: json["count"], | |
| 35 | 34 | requiredCount: json["requiredCount"], |
| 36 | - requiredLabel: json["requiredLabel"], | |
| 37 | 35 | weight: json["weight"]?.toDouble(), |
| 36 | + label: json["label"], | |
| 37 | + requiredLabel: json["requiredLabel"], | |
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | 40 | Map<String, dynamic> toJson() => { |
| 41 | 41 | "coordinates": coordinates == null ? null : List<dynamic>.from(coordinates!.map((x) => x.toJson())), |
| 42 | - "count": count, | |
| 43 | - "label": label, | |
| 44 | 42 | "requiredCoordinates": List<dynamic>.from(requiredCoordinates.map((x) => x.toJson())), |
| 43 | + "count": count, | |
| 45 | 44 | "requiredCount": requiredCount, |
| 46 | - "requiredLabel": requiredLabel, | |
| 47 | 45 | "weight": weight, |
| 46 | + "label": label, | |
| 47 | + "requiredLabel": requiredLabel, | |
| 48 | 48 | }; |
| 49 | 49 | } |
Mschema-elixirdefault / QuickType.ex+11 −11
| @@ -43,27 +43,27 @@ end | ||
| 43 | 43 | |
| 44 | 44 | defmodule TopLevel do |
| 45 | 45 | @enforce_keys [:required_coordinates, :required_count, :required_label] |
| 46 | - defstruct [:coordinates, :count, :label, :required_coordinates, :required_count, :required_label, :weight] | |
| 46 | + defstruct [:coordinates, :required_coordinates, :count, :required_count, :weight, :label, :required_label] | |
| 47 | 47 | |
| 48 | 48 | @type t :: %__MODULE__{ |
| 49 | 49 | coordinates: [Coordinate.t()] | nil, |
| 50 | - count: integer() | nil, | |
| 51 | - label: String.t() | nil, | |
| 52 | 50 | required_coordinates: [Coordinate.t()], |
| 51 | + count: integer() | nil, | |
| 53 | 52 | required_count: integer(), |
| 54 | - required_label: String.t(), | |
| 55 | - weight: float() | nil | |
| 53 | + weight: float() | nil, | |
| 54 | + label: String.t() | nil, | |
| 55 | + required_label: String.t() | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | def from_map(m) do |
| 59 | 59 | %TopLevel{ |
| 60 | 60 | coordinates: m["coordinates"] && Enum.map(m["coordinates"], &Coordinate.from_map/1), |
| 61 | - count: m["count"], | |
| 62 | - label: m["label"], | |
| 63 | 61 | required_coordinates: Enum.map(m["requiredCoordinates"], &Coordinate.from_map/1), |
| 62 | + count: m["count"], | |
| 64 | 63 | required_count: m["requiredCount"], |
| 65 | - required_label: m["requiredLabel"], | |
| 66 | 64 | weight: m["weight"], |
| 65 | + label: m["label"], | |
| 66 | + required_label: m["requiredLabel"], | |
| 67 | 67 | } |
| 68 | 68 | end |
| 69 | 69 | |
| @@ -76,12 +76,12 @@ defmodule TopLevel do | ||
| 76 | 76 | def to_map(struct) do |
| 77 | 77 | %{ |
| 78 | 78 | "coordinates" => struct.coordinates && Enum.map(struct.coordinates, &Coordinate.to_map/1), |
| 79 | - "count" => struct.count, | |
| 80 | - "label" => struct.label, | |
| 81 | 79 | "requiredCoordinates" => struct.required_coordinates && Enum.map(struct.required_coordinates, &Coordinate.to_map/1), |
| 80 | + "count" => struct.count, | |
| 82 | 81 | "requiredCount" => struct.required_count, |
| 83 | - "requiredLabel" => struct.required_label, | |
| 84 | 82 | "weight" => struct.weight, |
| 83 | + "label" => struct.label, | |
| 84 | + "requiredLabel" => struct.required_label, | |
| 85 | 85 | } |
| 86 | 86 | end |
Mschema-elmdefault / QuickType.elm+9 −9
| @@ -25,12 +25,12 @@ import Dict exposing (Dict) | ||
| 25 | 25 | |
| 26 | 26 | type alias QuickType = |
| 27 | 27 | { coordinates : Maybe (List Coordinate) |
| 28 | - , count : Maybe Int | |
| 29 | - , label : Maybe String | |
| 30 | 28 | , requiredCoordinates : List Coordinate |
| 29 | + , count : Maybe Int | |
| 31 | 30 | , requiredCount : Int |
| 32 | - , requiredLabel : String | |
| 33 | 31 | , weight : Maybe Float |
| 32 | + , label : Maybe String | |
| 33 | + , requiredLabel : String | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | type alias Coordinate = |
| @@ -47,23 +47,23 @@ quickType : Jdec.Decoder QuickType | ||
| 47 | 47 | quickType = |
| 48 | 48 | Jdec.succeed QuickType |
| 49 | 49 | |> Jpipe.optional "coordinates" (Jdec.nullable (Jdec.list coordinate)) Nothing |
| 50 | - |> Jpipe.optional "count" (Jdec.nullable Jdec.int) Nothing | |
| 51 | - |> Jpipe.optional "label" (Jdec.nullable Jdec.string) Nothing | |
| 52 | 50 | |> Jpipe.required "requiredCoordinates" (Jdec.list coordinate) |
| 51 | + |> Jpipe.optional "count" (Jdec.nullable Jdec.int) Nothing | |
| 53 | 52 | |> Jpipe.required "requiredCount" Jdec.int |
| 54 | - |> Jpipe.required "requiredLabel" Jdec.string | |
| 55 | 53 | |> Jpipe.optional "weight" (Jdec.nullable Jdec.float) Nothing |
| 54 | + |> Jpipe.optional "label" (Jdec.nullable Jdec.string) Nothing | |
| 55 | + |> Jpipe.required "requiredLabel" Jdec.string | |
| 56 | 56 | |
| 57 | 57 | encodeQuickType : QuickType -> Jenc.Value |
| 58 | 58 | encodeQuickType x = |
| 59 | 59 | Jenc.object |
| 60 | 60 | [ ("coordinates", makeNullableEncoder (Jenc.list encodeCoordinate) x.coordinates) |
| 61 | - , ("count", makeNullableEncoder Jenc.int x.count) | |
| 62 | - , ("label", makeNullableEncoder Jenc.string x.label) | |
| 63 | 61 | , ("requiredCoordinates", Jenc.list encodeCoordinate x.requiredCoordinates) |
| 62 | + , ("count", makeNullableEncoder Jenc.int x.count) | |
| 64 | 63 | , ("requiredCount", Jenc.int x.requiredCount) |
| 65 | - , ("requiredLabel", Jenc.string x.requiredLabel) | |
| 66 | 64 | , ("weight", makeNullableEncoder Jenc.float x.weight) |
| 65 | + , ("label", makeNullableEncoder Jenc.string x.label) | |
| 66 | + , ("requiredLabel", Jenc.string x.requiredLabel) | |
| 67 | 67 | ] |
| 68 | 68 | |
| 69 | 69 | coordinate : Jdec.Decoder Coordinate |
Mschema-flowdefault / TopLevel.js+6 −6
| @@ -11,12 +11,12 @@ | ||
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | 13 | coordinates?: Coordinate[]; |
| 14 | - count?: number; | |
| 15 | - label?: string; | |
| 16 | 14 | requiredCoordinates: Coordinate[]; |
| 15 | + count?: number; | |
| 17 | 16 | requiredCount: number; |
| 18 | - requiredLabel: string; | |
| 19 | 17 | weight?: number; |
| 18 | + label?: string; | |
| 19 | + requiredLabel: string; | |
| 20 | 20 | }; |
| 21 | 21 | |
| 22 | 22 | export type Coordinate = { |
| @@ -190,12 +190,12 @@ function r(name: string) { | ||
| 190 | 190 | const typeMap: any = { |
| 191 | 191 | "TopLevel": o([ |
| 192 | 192 | { json: "coordinates", js: "coordinates", typ: u(undefined, a(r("Coordinate"))) }, |
| 193 | - { json: "count", js: "count", typ: u(undefined, 0) }, | |
| 194 | - { json: "label", js: "label", typ: u(undefined, "") }, | |
| 195 | 193 | { json: "requiredCoordinates", js: "requiredCoordinates", typ: a(r("Coordinate")) }, |
| 194 | + { json: "count", js: "count", typ: u(undefined, 0) }, | |
| 196 | 195 | { json: "requiredCount", js: "requiredCount", typ: 0 }, |
| 197 | - { json: "requiredLabel", js: "requiredLabel", typ: "" }, | |
| 198 | 196 | { json: "weight", js: "weight", typ: u(undefined, 3.14) }, |
| 197 | + { json: "label", js: "label", typ: u(undefined, "") }, | |
| 198 | + { json: "requiredLabel", js: "requiredLabel", typ: "" }, | |
| 199 | 199 | ], false), |
| 200 | 200 | "Coordinate": o([ |
| 201 | 201 | { json: "latitude", js: "latitude", typ: 3.14 }, |
Mschema-golangdefault / quicktype.go+3 −3
| @@ -20,12 +20,12 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 20 | 20 | |
| 21 | 21 | type TopLevel struct { |
| 22 | 22 | Coordinates []Coordinate `json:"coordinates,omitempty"` |
| 23 | - Count *int64 `json:"count,omitempty"` | |
| 24 | - Label *string `json:"label,omitempty"` | |
| 25 | 23 | RequiredCoordinates []Coordinate `json:"requiredCoordinates"` |
| 24 | + Count *int64 `json:"count,omitempty"` | |
| 26 | 25 | RequiredCount int64 `json:"requiredCount"` |
| 27 | - RequiredLabel string `json:"requiredLabel"` | |
| 28 | 26 | Weight *float64 `json:"weight,omitempty"` |
| 27 | + Label *string `json:"label,omitempty"` | |
| 28 | + RequiredLabel string `json:"requiredLabel"` | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | type Coordinate struct { |
Mschema-haskelldefault / QuickType.hs+10 −10
| @@ -15,12 +15,12 @@ import Data.Text (Text) | ||
| 15 | 15 | |
| 16 | 16 | data QuickType = QuickType |
| 17 | 17 | { coordinatesQuickType :: Maybe ([Coordinate]) |
| 18 | - , countQuickType :: Maybe Int | |
| 19 | - , labelQuickType :: Maybe Text | |
| 20 | 18 | , requiredCoordinatesQuickType :: [Coordinate] |
| 19 | + , countQuickType :: Maybe Int | |
| 21 | 20 | , requiredCountQuickType :: Int |
| 22 | - , requiredLabelQuickType :: Text | |
| 23 | 21 | , weightQuickType :: Maybe Float |
| 22 | + , labelQuickType :: Maybe Text | |
| 23 | + , requiredLabelQuickType :: Text | |
| 24 | 24 | } deriving (Show) |
| 25 | 25 | |
| 26 | 26 | data Coordinate = Coordinate |
| @@ -32,26 +32,26 @@ decodeTopLevel :: ByteString -> Maybe QuickType | ||
| 32 | 32 | decodeTopLevel = decode |
| 33 | 33 | |
| 34 | 34 | instance ToJSON QuickType where |
| 35 | - toJSON (QuickType coordinatesQuickType countQuickType labelQuickType requiredCoordinatesQuickType requiredCountQuickType requiredLabelQuickType weightQuickType) = | |
| 35 | + toJSON (QuickType coordinatesQuickType requiredCoordinatesQuickType countQuickType requiredCountQuickType weightQuickType labelQuickType requiredLabelQuickType) = | |
| 36 | 36 | object |
| 37 | 37 | [ "coordinates" .= coordinatesQuickType |
| 38 | - , "count" .= countQuickType | |
| 39 | - , "label" .= labelQuickType | |
| 40 | 38 | , "requiredCoordinates" .= requiredCoordinatesQuickType |
| 39 | + , "count" .= countQuickType | |
| 41 | 40 | , "requiredCount" .= requiredCountQuickType |
| 42 | - , "requiredLabel" .= requiredLabelQuickType | |
| 43 | 41 | , "weight" .= weightQuickType |
| 42 | + , "label" .= labelQuickType | |
| 43 | + , "requiredLabel" .= requiredLabelQuickType | |
| 44 | 44 | ] |
| 45 | 45 | |
| 46 | 46 | instance FromJSON QuickType where |
| 47 | 47 | parseJSON (Object v) = QuickType |
| 48 | 48 | <$> v .:? "coordinates" |
| 49 | - <*> v .:? "count" | |
| 50 | - <*> v .:? "label" | |
| 51 | 49 | <*> v .: "requiredCoordinates" |
| 50 | + <*> v .:? "count" | |
| 52 | 51 | <*> v .: "requiredCount" |
| 53 | - <*> v .: "requiredLabel" | |
| 54 | 52 | <*> v .:? "weight" |
| 53 | + <*> v .:? "label" | |
| 54 | + <*> v .: "requiredLabel" | |
| 55 | 55 | |
| 56 | 56 | instance ToJSON Coordinate where |
| 57 | 57 | toJSON (Coordinate latitudeCoordinate longitudeCoordinate) = |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+18 −18
| @@ -5,45 +5,45 @@ import java.util.List; | ||
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | 7 | private List<Coordinate> coordinates; |
| 8 | - private Long count; | |
| 9 | - private String label; | |
| 10 | 8 | private List<Coordinate> requiredCoordinates; |
| 9 | + private Long count; | |
| 11 | 10 | private long requiredCount; |
| 12 | - private String requiredLabel; | |
| 13 | 11 | private Double weight; |
| 12 | + private String label; | |
| 13 | + private String requiredLabel; | |
| 14 | 14 | |
| 15 | 15 | @JsonProperty("coordinates") |
| 16 | 16 | public List<Coordinate> getCoordinates() { return coordinates; } |
| 17 | 17 | @JsonProperty("coordinates") |
| 18 | 18 | public void setCoordinates(List<Coordinate> value) { this.coordinates = value; } |
| 19 | 19 | |
| 20 | - @JsonProperty("count") | |
| 21 | - public Long getCount() { return count; } | |
| 22 | - @JsonProperty("count") | |
| 23 | - public void setCount(Long value) { this.count = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("label") | |
| 26 | - public String getLabel() { return label; } | |
| 27 | - @JsonProperty("label") | |
| 28 | - public void setLabel(String value) { this.label = value; } | |
| 29 | - | |
| 30 | 20 | @JsonProperty("requiredCoordinates") |
| 31 | 21 | public List<Coordinate> getRequiredCoordinates() { return requiredCoordinates; } |
| 32 | 22 | @JsonProperty("requiredCoordinates") |
| 33 | 23 | public void setRequiredCoordinates(List<Coordinate> value) { this.requiredCoordinates = value; } |
| 34 | 24 | |
| 25 | + @JsonProperty("count") | |
| 26 | + public Long getCount() { return count; } | |
| 27 | + @JsonProperty("count") | |
| 28 | + public void setCount(Long value) { this.count = value; } | |
| 29 | + | |
| 35 | 30 | @JsonProperty("requiredCount") |
| 36 | 31 | public long getRequiredCount() { return requiredCount; } |
| 37 | 32 | @JsonProperty("requiredCount") |
| 38 | 33 | public void setRequiredCount(long value) { this.requiredCount = value; } |
| 39 | 34 | |
| 40 | - @JsonProperty("requiredLabel") | |
| 41 | - public String getRequiredLabel() { return requiredLabel; } | |
| 42 | - @JsonProperty("requiredLabel") | |
| 43 | - public void setRequiredLabel(String value) { this.requiredLabel = value; } | |
| 44 | - | |
| 45 | 35 | @JsonProperty("weight") |
| 46 | 36 | public Double getWeight() { return weight; } |
| 47 | 37 | @JsonProperty("weight") |
| 48 | 38 | public void setWeight(Double value) { this.weight = value; } |
| 39 | + | |
| 40 | + @JsonProperty("label") | |
| 41 | + public String getLabel() { return label; } | |
| 42 | + @JsonProperty("label") | |
| 43 | + public void setLabel(String value) { this.label = value; } | |
| 44 | + | |
| 45 | + @JsonProperty("requiredLabel") | |
| 46 | + public String getRequiredLabel() { return requiredLabel; } | |
| 47 | + @JsonProperty("requiredLabel") | |
| 48 | + public void setRequiredLabel(String value) { this.requiredLabel = value; } | |
| 49 | 49 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+18 −18
| @@ -5,45 +5,45 @@ import java.util.List; | ||
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | 7 | private List<Coordinate> coordinates; |
| 8 | - private Long count; | |
| 9 | - private String label; | |
| 10 | 8 | private List<Coordinate> requiredCoordinates; |
| 9 | + private Long count; | |
| 11 | 10 | private long requiredCount; |
| 12 | - private String requiredLabel; | |
| 13 | 11 | private Double weight; |
| 12 | + private String label; | |
| 13 | + private String requiredLabel; | |
| 14 | 14 | |
| 15 | 15 | @JsonProperty("coordinates") |
| 16 | 16 | public List<Coordinate> getCoordinates() { return coordinates; } |
| 17 | 17 | @JsonProperty("coordinates") |
| 18 | 18 | public void setCoordinates(List<Coordinate> value) { this.coordinates = value; } |
| 19 | 19 | |
| 20 | - @JsonProperty("count") | |
| 21 | - public Long getCount() { return count; } | |
| 22 | - @JsonProperty("count") | |
| 23 | - public void setCount(Long value) { this.count = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("label") | |
| 26 | - public String getLabel() { return label; } | |
| 27 | - @JsonProperty("label") | |
| 28 | - public void setLabel(String value) { this.label = value; } | |
| 29 | - | |
| 30 | 20 | @JsonProperty("requiredCoordinates") |
| 31 | 21 | public List<Coordinate> getRequiredCoordinates() { return requiredCoordinates; } |
| 32 | 22 | @JsonProperty("requiredCoordinates") |
| 33 | 23 | public void setRequiredCoordinates(List<Coordinate> value) { this.requiredCoordinates = value; } |
| 34 | 24 | |
| 25 | + @JsonProperty("count") | |
| 26 | + public Long getCount() { return count; } | |
| 27 | + @JsonProperty("count") | |
| 28 | + public void setCount(Long value) { this.count = value; } | |
| 29 | + | |
| 35 | 30 | @JsonProperty("requiredCount") |
| 36 | 31 | public long getRequiredCount() { return requiredCount; } |
| 37 | 32 | @JsonProperty("requiredCount") |
| 38 | 33 | public void setRequiredCount(long value) { this.requiredCount = value; } |
| 39 | 34 | |
| 40 | - @JsonProperty("requiredLabel") | |
| 41 | - public String getRequiredLabel() { return requiredLabel; } | |
| 42 | - @JsonProperty("requiredLabel") | |
| 43 | - public void setRequiredLabel(String value) { this.requiredLabel = value; } | |
| 44 | - | |
| 45 | 35 | @JsonProperty("weight") |
| 46 | 36 | public Double getWeight() { return weight; } |
| 47 | 37 | @JsonProperty("weight") |
| 48 | 38 | public void setWeight(Double value) { this.weight = value; } |
| 39 | + | |
| 40 | + @JsonProperty("label") | |
| 41 | + public String getLabel() { return label; } | |
| 42 | + @JsonProperty("label") | |
| 43 | + public void setLabel(String value) { this.label = value; } | |
| 44 | + | |
| 45 | + @JsonProperty("requiredLabel") | |
| 46 | + public String getRequiredLabel() { return requiredLabel; } | |
| 47 | + @JsonProperty("requiredLabel") | |
| 48 | + public void setRequiredLabel(String value) { this.requiredLabel = value; } | |
| 49 | 49 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+18 −18
| @@ -5,45 +5,45 @@ import java.util.List; | ||
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | 7 | private List<Coordinate> coordinates; |
| 8 | - private Long count; | |
| 9 | - private String label; | |
| 10 | 8 | private List<Coordinate> requiredCoordinates; |
| 9 | + private Long count; | |
| 11 | 10 | private long requiredCount; |
| 12 | - private String requiredLabel; | |
| 13 | 11 | private Double weight; |
| 12 | + private String label; | |
| 13 | + private String requiredLabel; | |
| 14 | 14 | |
| 15 | 15 | @JsonProperty("coordinates") |
| 16 | 16 | public List<Coordinate> getCoordinates() { return coordinates; } |
| 17 | 17 | @JsonProperty("coordinates") |
| 18 | 18 | public void setCoordinates(List<Coordinate> value) { this.coordinates = value; } |
| 19 | 19 | |
| 20 | - @JsonProperty("count") | |
| 21 | - public Long getCount() { return count; } | |
| 22 | - @JsonProperty("count") | |
| 23 | - public void setCount(Long value) { this.count = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("label") | |
| 26 | - public String getLabel() { return label; } | |
| 27 | - @JsonProperty("label") | |
| 28 | - public void setLabel(String value) { this.label = value; } | |
| 29 | - | |
| 30 | 20 | @JsonProperty("requiredCoordinates") |
| 31 | 21 | public List<Coordinate> getRequiredCoordinates() { return requiredCoordinates; } |
| 32 | 22 | @JsonProperty("requiredCoordinates") |
| 33 | 23 | public void setRequiredCoordinates(List<Coordinate> value) { this.requiredCoordinates = value; } |
| 34 | 24 | |
| 25 | + @JsonProperty("count") | |
| 26 | + public Long getCount() { return count; } | |
| 27 | + @JsonProperty("count") | |
| 28 | + public void setCount(Long value) { this.count = value; } | |
| 29 | + | |
| 35 | 30 | @JsonProperty("requiredCount") |
| 36 | 31 | public long getRequiredCount() { return requiredCount; } |
| 37 | 32 | @JsonProperty("requiredCount") |
| 38 | 33 | public void setRequiredCount(long value) { this.requiredCount = value; } |
| 39 | 34 | |
| 40 | - @JsonProperty("requiredLabel") | |
| 41 | - public String getRequiredLabel() { return requiredLabel; } | |
| 42 | - @JsonProperty("requiredLabel") | |
| 43 | - public void setRequiredLabel(String value) { this.requiredLabel = value; } | |
| 44 | - | |
| 45 | 35 | @JsonProperty("weight") |
| 46 | 36 | public Double getWeight() { return weight; } |
| 47 | 37 | @JsonProperty("weight") |
| 48 | 38 | public void setWeight(Double value) { this.weight = value; } |
| 39 | + | |
| 40 | + @JsonProperty("label") | |
| 41 | + public String getLabel() { return label; } | |
| 42 | + @JsonProperty("label") | |
| 43 | + public void setLabel(String value) { this.label = value; } | |
| 44 | + | |
| 45 | + @JsonProperty("requiredLabel") | |
| 46 | + public String getRequiredLabel() { return requiredLabel; } | |
| 47 | + @JsonProperty("requiredLabel") | |
| 48 | + public void setRequiredLabel(String value) { this.requiredLabel = value; } | |
| 49 | 49 | } |
Mschema-javascriptdefault / TopLevel.js+3 −3
| @@ -173,12 +173,12 @@ function r(name) { | ||
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | 175 | { json: "coordinates", js: "coordinates", typ: u(undefined, a(r("Coordinate"))) }, |
| 176 | - { json: "count", js: "count", typ: u(undefined, 0) }, | |
| 177 | - { json: "label", js: "label", typ: u(undefined, "") }, | |
| 178 | 176 | { json: "requiredCoordinates", js: "requiredCoordinates", typ: a(r("Coordinate")) }, |
| 177 | + { json: "count", js: "count", typ: u(undefined, 0) }, | |
| 179 | 178 | { json: "requiredCount", js: "requiredCount", typ: 0 }, |
| 180 | - { json: "requiredLabel", js: "requiredLabel", typ: "" }, | |
| 181 | 179 | { json: "weight", js: "weight", typ: u(undefined, 3.14) }, |
| 180 | + { json: "label", js: "label", typ: u(undefined, "") }, | |
| 181 | + { json: "requiredLabel", js: "requiredLabel", typ: "" }, | |
| 182 | 182 | ], false), |
| 183 | 183 | "Coordinate": o([ |
| 184 | 184 | { json: "latitude", js: "latitude", typ: 3.14 }, |
Mschema-kotlin-jacksondefault / TopLevel.kt+6 −5
| @@ -20,19 +20,20 @@ val mapper = jacksonObjectMapper().apply { | ||
| 20 | 20 | |
| 21 | 21 | data class TopLevel ( |
| 22 | 22 | val coordinates: List<Coordinate>? = null, |
| 23 | - val count: Long? = null, | |
| 24 | - val label: String? = null, | |
| 25 | 23 | |
| 26 | 24 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 27 | 25 | val requiredCoordinates: List<Coordinate>, |
| 28 | 26 | |
| 27 | + val count: Long? = null, | |
| 28 | + | |
| 29 | 29 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 30 | 30 | val requiredCount: Long, |
| 31 | 31 | |
| 32 | - @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 33 | - val requiredLabel: String, | |
| 32 | + val weight: Double? = null, | |
| 33 | + val label: String? = null, | |
| 34 | 34 | |
| 35 | - val weight: Double? = null | |
| 35 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 36 | + val requiredLabel: String | |
| 36 | 37 | ) { |
| 37 | 38 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+4 −4
| @@ -10,12 +10,12 @@ private val klaxon = Klaxon() | ||
| 10 | 10 | |
| 11 | 11 | data class TopLevel ( |
| 12 | 12 | val coordinates: List<Coordinate>? = null, |
| 13 | - val count: Long? = null, | |
| 14 | - val label: String? = null, | |
| 15 | 13 | val requiredCoordinates: List<Coordinate>, |
| 14 | + val count: Long? = null, | |
| 16 | 15 | val requiredCount: Long, |
| 17 | - val requiredLabel: String, | |
| 18 | - val weight: Double? = null | |
| 16 | + val weight: Double? = null, | |
| 17 | + val label: String? = null, | |
| 18 | + val requiredLabel: String | |
| 19 | 19 | ) { |
| 20 | 20 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-kotlinxdefault / TopLevel.kt+4 −4
| @@ -13,12 +13,12 @@ import kotlinx.serialization.encoding.* | ||
| 13 | 13 | @Serializable |
| 14 | 14 | data class TopLevel ( |
| 15 | 15 | val coordinates: List<Coordinate>? = null, |
| 16 | - val count: Long? = null, | |
| 17 | - val label: String? = null, | |
| 18 | 16 | val requiredCoordinates: List<Coordinate>, |
| 17 | + val count: Long? = null, | |
| 19 | 18 | val requiredCount: Long, |
| 20 | - val requiredLabel: String, | |
| 21 | - val weight: Double? = null | |
| 19 | + val weight: Double? = null, | |
| 20 | + val label: String? = null, | |
| 21 | + val requiredLabel: String | |
| 22 | 22 | ) |
| 23 | 23 | |
| 24 | 24 | @Serializable |
Mschema-phpdefault / TopLevel.php+160 −160
| @@ -5,30 +5,30 @@ declare(strict_types=1); | ||
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | 7 | private ?array $coordinates; // json:coordinates Optional |
| 8 | - private ?int $count; // json:count Optional | |
| 9 | - private ?string $label; // json:label Optional | |
| 10 | 8 | private array $requiredCoordinates; // json:requiredCoordinates Required |
| 9 | + private ?int $count; // json:count Optional | |
| 11 | 10 | private int $requiredCount; // json:requiredCount Required |
| 12 | - private string $requiredLabel; // json:requiredLabel Required | |
| 13 | 11 | private ?float $weight; // json:weight Optional |
| 12 | + private ?string $label; // json:label Optional | |
| 13 | + private string $requiredLabel; // json:requiredLabel Required | |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * @param array|null $coordinates |
| 17 | - * @param int|null $count | |
| 18 | - * @param string|null $label | |
| 19 | 17 | * @param array $requiredCoordinates |
| 18 | + * @param int|null $count | |
| 20 | 19 | * @param int $requiredCount |
| 21 | - * @param string $requiredLabel | |
| 22 | 20 | * @param float|null $weight |
| 21 | + * @param string|null $label | |
| 22 | + * @param string $requiredLabel | |
| 23 | 23 | */ |
| 24 | - public function __construct(?array $coordinates, ?int $count, ?string $label, array $requiredCoordinates, int $requiredCount, string $requiredLabel, ?float $weight) { | |
| 24 | + public function __construct(?array $coordinates, array $requiredCoordinates, ?int $count, int $requiredCount, ?float $weight, ?string $label, string $requiredLabel) { | |
| 25 | 25 | $this->coordinates = $coordinates; |
| 26 | - $this->count = $count; | |
| 27 | - $this->label = $label; | |
| 28 | 26 | $this->requiredCoordinates = $requiredCoordinates; |
| 27 | + $this->count = $count; | |
| 29 | 28 | $this->requiredCount = $requiredCount; |
| 30 | - $this->requiredLabel = $requiredLabel; | |
| 31 | 29 | $this->weight = $weight; |
| 30 | + $this->label = $label; | |
| 31 | + $this->requiredLabel = $requiredLabel; | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
| @@ -100,6 +100,65 @@ class TopLevel { | ||
| 100 | 100 | ); /* 31:coordinates*/ |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | + /** | |
| 104 | + * @param array $value | |
| 105 | + * @throws Exception | |
| 106 | + * @return array | |
| 107 | + */ | |
| 108 | + public static function fromRequiredCoordinates(array $value): array { | |
| 109 | + return array_map(function ($value) { | |
| 110 | + return Coordinate::from($value); /*class*/ | |
| 111 | + }, $value); | |
| 112 | + } | |
| 113 | + | |
| 114 | + /** | |
| 115 | + * @throws Exception | |
| 116 | + * @return array | |
| 117 | + */ | |
| 118 | + public function toRequiredCoordinates(): array { | |
| 119 | + if (TopLevel::validateRequiredCoordinates($this->requiredCoordinates)) { | |
| 120 | + return array_map(function ($value) { | |
| 121 | + return $value->to(); /*class*/ | |
| 122 | + }, $this->requiredCoordinates); | |
| 123 | + } | |
| 124 | + throw new Exception('never get to this TopLevel::requiredCoordinates'); | |
| 125 | + } | |
| 126 | + | |
| 127 | + /** | |
| 128 | + * @param array | |
| 129 | + * @return bool | |
| 130 | + * @throws Exception | |
| 131 | + */ | |
| 132 | + public static function validateRequiredCoordinates(array $value): bool { | |
| 133 | + if (!is_array($value)) { | |
| 134 | + throw new Exception("Attribute Error:TopLevel::requiredCoordinates"); | |
| 135 | + } | |
| 136 | + array_walk($value, function($value_v) { | |
| 137 | + $value_v->validate(); | |
| 138 | + }); | |
| 139 | + return true; | |
| 140 | + } | |
| 141 | + | |
| 142 | + /** | |
| 143 | + * @throws Exception | |
| 144 | + * @return array | |
| 145 | + */ | |
| 146 | + public function getRequiredCoordinates(): array { | |
| 147 | + if (TopLevel::validateRequiredCoordinates($this->requiredCoordinates)) { | |
| 148 | + return $this->requiredCoordinates; | |
| 149 | + } | |
| 150 | + throw new Exception('never get to getRequiredCoordinates TopLevel::requiredCoordinates'); | |
| 151 | + } | |
| 152 | + | |
| 153 | + /** | |
| 154 | + * @return array | |
| 155 | + */ | |
| 156 | + public static function sampleRequiredCoordinates(): array { | |
| 157 | + return array( | |
| 158 | + Coordinate::sample() /*32:*/ | |
| 159 | + ); /* 32:requiredCoordinates*/ | |
| 160 | + } | |
| 161 | + | |
| 103 | 162 | /** |
| 104 | 163 | * @param ?int $value |
| 105 | 164 | * @throws Exception |
| @@ -154,170 +213,168 @@ class TopLevel { | ||
| 154 | 213 | * @return ?int |
| 155 | 214 | */ |
| 156 | 215 | public static function sampleCount(): ?int { |
| 157 | - return 32; /*32:count*/ | |
| 216 | + return 33; /*33:count*/ | |
| 158 | 217 | } |
| 159 | 218 | |
| 160 | 219 | /** |
| 161 | - * @param ?string $value | |
| 220 | + * @param int $value | |
| 162 | 221 | * @throws Exception |
| 163 | - * @return ?string | |
| 222 | + * @return int | |
| 164 | 223 | */ |
| 165 | - public static function fromLabel(?string $value): ?string { | |
| 166 | - if (!is_null($value)) { | |
| 167 | - return $value; /*string*/ | |
| 168 | - } else { | |
| 169 | - return null; | |
| 170 | - } | |
| 224 | + public static function fromRequiredCount(int $value): int { | |
| 225 | + return $value; /*int*/ | |
| 171 | 226 | } |
| 172 | 227 | |
| 173 | 228 | /** |
| 174 | 229 | * @throws Exception |
| 175 | - * @return ?string | |
| 230 | + * @return int | |
| 176 | 231 | */ |
| 177 | - public function toLabel(): ?string { | |
| 178 | - if (TopLevel::validateLabel($this->label)) { | |
| 179 | - if (!is_null($this->label)) { | |
| 180 | - return $this->label; /*string*/ | |
| 181 | - } else { | |
| 182 | - return null; | |
| 183 | - } | |
| 232 | + public function toRequiredCount(): int { | |
| 233 | + if (TopLevel::validateRequiredCount($this->requiredCount)) { | |
| 234 | + return $this->requiredCount; /*int*/ | |
| 184 | 235 | } |
| 185 | - throw new Exception('never get to this TopLevel::label'); | |
| 236 | + throw new Exception('never get to this TopLevel::requiredCount'); | |
| 186 | 237 | } |
| 187 | 238 | |
| 188 | 239 | /** |
| 189 | - * @param string|null | |
| 240 | + * @param int | |
| 190 | 241 | * @return bool |
| 191 | 242 | * @throws Exception |
| 192 | 243 | */ |
| 193 | - public static function validateLabel(?string $value): bool { | |
| 194 | - if (!is_null($value)) { | |
| 195 | - } | |
| 244 | + public static function validateRequiredCount(int $value): bool { | |
| 196 | 245 | return true; |
| 197 | 246 | } |
| 198 | 247 | |
| 199 | 248 | /** |
| 200 | 249 | * @throws Exception |
| 201 | - * @return ?string | |
| 250 | + * @return int | |
| 202 | 251 | */ |
| 203 | - public function getLabel(): ?string { | |
| 204 | - if (TopLevel::validateLabel($this->label)) { | |
| 205 | - return $this->label; | |
| 252 | + public function getRequiredCount(): int { | |
| 253 | + if (TopLevel::validateRequiredCount($this->requiredCount)) { | |
| 254 | + return $this->requiredCount; | |
| 206 | 255 | } |
| 207 | - throw new Exception('never get to getLabel TopLevel::label'); | |
| 256 | + throw new Exception('never get to getRequiredCount TopLevel::requiredCount'); | |
| 208 | 257 | } |
| 209 | 258 | |
| 210 | 259 | /** |
| 211 | - * @return ?string | |
| 260 | + * @return int | |
| 212 | 261 | */ |
| 213 | - public static function sampleLabel(): ?string { | |
| 214 | - return 'TopLevel::label::33'; /*33:label*/ | |
| 262 | + public static function sampleRequiredCount(): int { | |
| 263 | + return 34; /*34:requiredCount*/ | |
| 215 | 264 | } |
| 216 | 265 | |
| 217 | 266 | /** |
| 218 | - * @param array $value | |
| 267 | + * @param ?float $value | |
| 219 | 268 | * @throws Exception |
| 220 | - * @return array | |
| 269 | + * @return ?float | |
| 221 | 270 | */ |
| 222 | - public static function fromRequiredCoordinates(array $value): array { | |
| 223 | - return array_map(function ($value) { | |
| 224 | - return Coordinate::from($value); /*class*/ | |
| 225 | - }, $value); | |
| 271 | + public static function fromWeight(?float $value): ?float { | |
| 272 | + if (!is_null($value)) { | |
| 273 | + return $value; /*float*/ | |
| 274 | + } else { | |
| 275 | + return null; | |
| 276 | + } | |
| 226 | 277 | } |
| 227 | 278 | |
| 228 | 279 | /** |
| 229 | 280 | * @throws Exception |
| 230 | - * @return array | |
| 281 | + * @return ?float | |
| 231 | 282 | */ |
| 232 | - public function toRequiredCoordinates(): array { | |
| 233 | - if (TopLevel::validateRequiredCoordinates($this->requiredCoordinates)) { | |
| 234 | - return array_map(function ($value) { | |
| 235 | - return $value->to(); /*class*/ | |
| 236 | - }, $this->requiredCoordinates); | |
| 283 | + public function toWeight(): ?float { | |
| 284 | + if (TopLevel::validateWeight($this->weight)) { | |
| 285 | + if (!is_null($this->weight)) { | |
| 286 | + return $this->weight; /*float*/ | |
| 287 | + } else { | |
| 288 | + return null; | |
| 289 | + } | |
| 237 | 290 | } |
| 238 | - throw new Exception('never get to this TopLevel::requiredCoordinates'); | |
| 291 | + throw new Exception('never get to this TopLevel::weight'); | |
| 239 | 292 | } |
| 240 | 293 | |
| 241 | 294 | /** |
| 242 | - * @param array | |
| 295 | + * @param float|null | |
| 243 | 296 | * @return bool |
| 244 | 297 | * @throws Exception |
| 245 | 298 | */ |
| 246 | - public static function validateRequiredCoordinates(array $value): bool { | |
| 247 | - if (!is_array($value)) { | |
| 248 | - throw new Exception("Attribute Error:TopLevel::requiredCoordinates"); | |
| 299 | + public static function validateWeight(?float $value): bool { | |
| 300 | + if (!is_null($value)) { | |
| 249 | 301 | } |
| 250 | - array_walk($value, function($value_v) { | |
| 251 | - $value_v->validate(); | |
| 252 | - }); | |
| 253 | 302 | return true; |
| 254 | 303 | } |
| 255 | 304 | |
| 256 | 305 | /** |
| 257 | 306 | * @throws Exception |
| 258 | - * @return array | |
| 307 | + * @return ?float | |
| 259 | 308 | */ |
| 260 | - public function getRequiredCoordinates(): array { | |
| 261 | - if (TopLevel::validateRequiredCoordinates($this->requiredCoordinates)) { | |
| 262 | - return $this->requiredCoordinates; | |
| 309 | + public function getWeight(): ?float { | |
| 310 | + if (TopLevel::validateWeight($this->weight)) { | |
| 311 | + return $this->weight; | |
| 263 | 312 | } |
| 264 | - throw new Exception('never get to getRequiredCoordinates TopLevel::requiredCoordinates'); | |
| 313 | + throw new Exception('never get to getWeight TopLevel::weight'); | |
| 265 | 314 | } |
| 266 | 315 | |
| 267 | 316 | /** |
| 268 | - * @return array | |
| 317 | + * @return ?float | |
| 269 | 318 | */ |
| 270 | - public static function sampleRequiredCoordinates(): array { | |
| 271 | - return array( | |
| 272 | - Coordinate::sample() /*34:*/ | |
| 273 | - ); /* 34:requiredCoordinates*/ | |
| 319 | + public static function sampleWeight(): ?float { | |
| 320 | + return 35.035; /*35:weight*/ | |
| 274 | 321 | } |
| 275 | 322 | |
| 276 | 323 | /** |
| 277 | - * @param int $value | |
| 324 | + * @param ?string $value | |
| 278 | 325 | * @throws Exception |
| 279 | - * @return int | |
| 326 | + * @return ?string | |
| 280 | 327 | */ |
| 281 | - public static function fromRequiredCount(int $value): int { | |
| 282 | - return $value; /*int*/ | |
| 328 | + public static function fromLabel(?string $value): ?string { | |
| 329 | + if (!is_null($value)) { | |
| 330 | + return $value; /*string*/ | |
| 331 | + } else { | |
| 332 | + return null; | |
| 333 | + } | |
| 283 | 334 | } |
| 284 | 335 | |
| 285 | 336 | /** |
| 286 | 337 | * @throws Exception |
| 287 | - * @return int | |
| 338 | + * @return ?string | |
| 288 | 339 | */ |
| 289 | - public function toRequiredCount(): int { | |
| 290 | - if (TopLevel::validateRequiredCount($this->requiredCount)) { | |
| 291 | - return $this->requiredCount; /*int*/ | |
| 340 | + public function toLabel(): ?string { | |
| 341 | + if (TopLevel::validateLabel($this->label)) { | |
| 342 | + if (!is_null($this->label)) { | |
| 343 | + return $this->label; /*string*/ | |
| 344 | + } else { | |
| 345 | + return null; | |
| 346 | + } | |
| 292 | 347 | } |
| 293 | - throw new Exception('never get to this TopLevel::requiredCount'); | |
| 348 | + throw new Exception('never get to this TopLevel::label'); | |
| 294 | 349 | } |
| 295 | 350 | |
| 296 | 351 | /** |
| 297 | - * @param int | |
| 352 | + * @param string|null | |
| 298 | 353 | * @return bool |
| 299 | 354 | * @throws Exception |
| 300 | 355 | */ |
| 301 | - public static function validateRequiredCount(int $value): bool { | |
| 356 | + public static function validateLabel(?string $value): bool { | |
| 357 | + if (!is_null($value)) { | |
| 358 | + } | |
| 302 | 359 | return true; |
| 303 | 360 | } |
| 304 | 361 | |
| 305 | 362 | /** |
| 306 | 363 | * @throws Exception |
| 307 | - * @return int | |
| 364 | + * @return ?string | |
| 308 | 365 | */ |
| 309 | - public function getRequiredCount(): int { | |
| 310 | - if (TopLevel::validateRequiredCount($this->requiredCount)) { | |
| 311 | - return $this->requiredCount; | |
| 366 | + public function getLabel(): ?string { | |
| 367 | + if (TopLevel::validateLabel($this->label)) { | |
| 368 | + return $this->label; | |
| 312 | 369 | } |
| 313 | - throw new Exception('never get to getRequiredCount TopLevel::requiredCount'); | |
| 370 | + throw new Exception('never get to getLabel TopLevel::label'); | |
| 314 | 371 | } |
| 315 | 372 | |
| 316 | 373 | /** |
| 317 | - * @return int | |
| 374 | + * @return ?string | |
| 318 | 375 | */ |
| 319 | - public static function sampleRequiredCount(): int { | |
| 320 | - return 35; /*35:requiredCount*/ | |
| 376 | + public static function sampleLabel(): ?string { | |
| 377 | + return 'TopLevel::label::36'; /*36:label*/ | |
| 321 | 378 | } |
| 322 | 379 | |
| 323 | 380 | /** |
| @@ -364,64 +421,7 @@ class TopLevel { | ||
| 364 | 421 | * @return string |
| 365 | 422 | */ |
| 366 | 423 | public static function sampleRequiredLabel(): string { |
| 367 | - return 'TopLevel::requiredLabel::36'; /*36:requiredLabel*/ | |
| 368 | - } | |
| 369 | - | |
| 370 | - /** | |
| 371 | - * @param ?float $value | |
| 372 | - * @throws Exception | |
| 373 | - * @return ?float | |
| 374 | - */ | |
| 375 | - public static function fromWeight(?float $value): ?float { | |
| 376 | - if (!is_null($value)) { | |
| 377 | - return $value; /*float*/ | |
| 378 | - } else { | |
| 379 | - return null; | |
| 380 | - } | |
| 381 | - } | |
| 382 | - | |
| 383 | - /** | |
| 384 | - * @throws Exception | |
| 385 | - * @return ?float | |
| 386 | - */ | |
| 387 | - public function toWeight(): ?float { | |
| 388 | - if (TopLevel::validateWeight($this->weight)) { | |
| 389 | - if (!is_null($this->weight)) { | |
| 390 | - return $this->weight; /*float*/ | |
| 391 | - } else { | |
| 392 | - return null; | |
| 393 | - } | |
| 394 | - } | |
| 395 | - throw new Exception('never get to this TopLevel::weight'); | |
| 396 | - } | |
| 397 | - | |
| 398 | - /** | |
| 399 | - * @param float|null | |
| 400 | - * @return bool | |
| 401 | - * @throws Exception | |
| 402 | - */ | |
| 403 | - public static function validateWeight(?float $value): bool { | |
| 404 | - if (!is_null($value)) { | |
| 405 | - } | |
| 406 | - return true; | |
| 407 | - } | |
| 408 | - | |
| 409 | - /** | |
| 410 | - * @throws Exception | |
| 411 | - * @return ?float | |
| 412 | - */ | |
| 413 | - public function getWeight(): ?float { | |
| 414 | - if (TopLevel::validateWeight($this->weight)) { | |
| 415 | - return $this->weight; | |
| 416 | - } | |
| 417 | - throw new Exception('never get to getWeight TopLevel::weight'); | |
| 418 | - } | |
| 419 | - | |
| 420 | - /** | |
| 421 | - * @return ?float | |
| 422 | - */ | |
| 423 | - public static function sampleWeight(): ?float { | |
| 424 | - return 37.037; /*37:weight*/ | |
| 424 | + return 'TopLevel::requiredLabel::37'; /*37:requiredLabel*/ | |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | /** |
| @@ -430,12 +430,12 @@ class TopLevel { | ||
| 430 | 430 | */ |
| 431 | 431 | public function validate(): bool { |
| 432 | 432 | return TopLevel::validateCoordinates($this->coordinates) |
| 433 | - || TopLevel::validateCount($this->count) | |
| 434 | - || TopLevel::validateLabel($this->label) | |
| 435 | 433 | || TopLevel::validateRequiredCoordinates($this->requiredCoordinates) |
| 434 | + || TopLevel::validateCount($this->count) | |
| 436 | 435 | || TopLevel::validateRequiredCount($this->requiredCount) |
| 437 | - || TopLevel::validateRequiredLabel($this->requiredLabel) | |
| 438 | - || TopLevel::validateWeight($this->weight); | |
| 436 | + || TopLevel::validateWeight($this->weight) | |
| 437 | + || TopLevel::validateLabel($this->label) | |
| 438 | + || TopLevel::validateRequiredLabel($this->requiredLabel); | |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /** |
| @@ -445,12 +445,12 @@ class TopLevel { | ||
| 445 | 445 | public function to(): stdClass { |
| 446 | 446 | $out = new stdClass(); |
| 447 | 447 | $out->{'coordinates'} = $this->toCoordinates(); |
| 448 | - $out->{'count'} = $this->toCount(); | |
| 449 | - $out->{'label'} = $this->toLabel(); | |
| 450 | 448 | $out->{'requiredCoordinates'} = $this->toRequiredCoordinates(); |
| 449 | + $out->{'count'} = $this->toCount(); | |
| 451 | 450 | $out->{'requiredCount'} = $this->toRequiredCount(); |
| 452 | - $out->{'requiredLabel'} = $this->toRequiredLabel(); | |
| 453 | 451 | $out->{'weight'} = $this->toWeight(); |
| 452 | + $out->{'label'} = $this->toLabel(); | |
| 453 | + $out->{'requiredLabel'} = $this->toRequiredLabel(); | |
| 454 | 454 | return $out; |
| 455 | 455 | } |
| 456 | 456 | |
| @@ -462,12 +462,12 @@ class TopLevel { | ||
| 462 | 462 | public static function from(stdClass $obj): TopLevel { |
| 463 | 463 | return new TopLevel( |
| 464 | 464 | TopLevel::fromCoordinates($obj->{'coordinates'}) |
| 465 | - ,TopLevel::fromCount($obj->{'count'}) | |
| 466 | - ,TopLevel::fromLabel($obj->{'label'}) | |
| 467 | 465 | ,TopLevel::fromRequiredCoordinates($obj->{'requiredCoordinates'}) |
| 466 | + ,TopLevel::fromCount($obj->{'count'}) | |
| 468 | 467 | ,TopLevel::fromRequiredCount($obj->{'requiredCount'}) |
| 469 | - ,TopLevel::fromRequiredLabel($obj->{'requiredLabel'}) | |
| 470 | 468 | ,TopLevel::fromWeight($obj->{'weight'}) |
| 469 | + ,TopLevel::fromLabel($obj->{'label'}) | |
| 470 | + ,TopLevel::fromRequiredLabel($obj->{'requiredLabel'}) | |
| 471 | 471 | ); |
| 472 | 472 | } |
| 473 | 473 | |
| @@ -477,12 +477,12 @@ class TopLevel { | ||
| 477 | 477 | public static function sample(): TopLevel { |
| 478 | 478 | return new TopLevel( |
| 479 | 479 | TopLevel::sampleCoordinates() |
| 480 | - ,TopLevel::sampleCount() | |
| 481 | - ,TopLevel::sampleLabel() | |
| 482 | 480 | ,TopLevel::sampleRequiredCoordinates() |
| 481 | + ,TopLevel::sampleCount() | |
| 483 | 482 | ,TopLevel::sampleRequiredCount() |
| 484 | - ,TopLevel::sampleRequiredLabel() | |
| 485 | 483 | ,TopLevel::sampleWeight() |
| 484 | + ,TopLevel::sampleLabel() | |
| 485 | + ,TopLevel::sampleRequiredLabel() | |
| 486 | 486 | ); |
| 487 | 487 | } |
| 488 | 488 | } |
Mschema-pikedefault / TopLevel.pmod+9 −9
| @@ -14,22 +14,22 @@ | ||
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | 16 | array(Coordinate)|mixed coordinates; // json: "coordinates" |
| 17 | - int|mixed count; // json: "count" | |
| 18 | - mixed|string label; // json: "label" | |
| 19 | 17 | array(Coordinate) required_coordinates; // json: "requiredCoordinates" |
| 18 | + int|mixed count; // json: "count" | |
| 20 | 19 | int required_count; // json: "requiredCount" |
| 21 | - string required_label; // json: "requiredLabel" | |
| 22 | 20 | float|mixed weight; // json: "weight" |
| 21 | + mixed|string label; // json: "label" | |
| 22 | + string required_label; // json: "requiredLabel" | |
| 23 | 23 | |
| 24 | 24 | string encode_json() { |
| 25 | 25 | mapping(string:mixed) json = ([ |
| 26 | 26 | "coordinates" : coordinates, |
| 27 | - "count" : count, | |
| 28 | - "label" : label, | |
| 29 | 27 | "requiredCoordinates" : required_coordinates, |
| 28 | + "count" : count, | |
| 30 | 29 | "requiredCount" : required_count, |
| 31 | - "requiredLabel" : required_label, | |
| 32 | 30 | "weight" : weight, |
| 31 | + "label" : label, | |
| 32 | + "requiredLabel" : required_label, | |
| 33 | 33 | ]); |
| 34 | 34 | |
| 35 | 35 | return Standards.JSON.encode(json); |
| @@ -40,12 +40,12 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 40 | 40 | TopLevel retval = TopLevel(); |
| 41 | 41 | |
| 42 | 42 | retval.coordinates = json["coordinates"]; |
| 43 | - retval.count = json["count"]; | |
| 44 | - retval.label = json["label"]; | |
| 45 | 43 | retval.required_coordinates = json["requiredCoordinates"]; |
| 44 | + retval.count = json["count"]; | |
| 46 | 45 | retval.required_count = json["requiredCount"]; |
| 47 | - retval.required_label = json["requiredLabel"]; | |
| 48 | 46 | retval.weight = json["weight"]; |
| 47 | + retval.label = json["label"]; | |
| 48 | + retval.required_label = json["requiredLabel"]; | |
| 49 | 49 | |
| 50 | 50 | return retval; |
| 51 | 51 | } |
Mschema-pythondefault / quicktype.py+5 −5
| @@ -75,8 +75,8 @@ class TopLevel: | ||
| 75 | 75 | required_label: str |
| 76 | 76 | coordinates: list[Coordinate] | None = None |
| 77 | 77 | count: int | None = None |
| 78 | - label: str | None = None | |
| 79 | 78 | weight: float | None = None |
| 79 | + label: str | None = None | |
| 80 | 80 | |
| 81 | 81 | @staticmethod |
| 82 | 82 | def from_dict(obj: Any) -> 'TopLevel': |
| @@ -86,9 +86,9 @@ class TopLevel: | ||
| 86 | 86 | required_label = from_str(obj.get("requiredLabel")) |
| 87 | 87 | coordinates = from_union([lambda x: from_list(Coordinate.from_dict, x), from_none], obj.get("coordinates")) |
| 88 | 88 | count = from_union([from_int, from_none], obj.get("count")) |
| 89 | - label = from_union([from_str, from_none], obj.get("label")) | |
| 90 | 89 | weight = from_union([from_float, from_none], obj.get("weight")) |
| 91 | - return TopLevel(required_coordinates, required_count, required_label, coordinates, count, label, weight) | |
| 90 | + label = from_union([from_str, from_none], obj.get("label")) | |
| 91 | + return TopLevel(required_coordinates, required_count, required_label, coordinates, count, weight, label) | |
| 92 | 92 | |
| 93 | 93 | def to_dict(self) -> dict: |
| 94 | 94 | result: dict = {} |
| @@ -99,10 +99,10 @@ class TopLevel: | ||
| 99 | 99 | result["coordinates"] = from_union([lambda x: from_list(lambda x: to_class(Coordinate, x), x), from_none], self.coordinates) |
| 100 | 100 | if self.count is not None: |
| 101 | 101 | result["count"] = from_union([from_int, from_none], self.count) |
| 102 | - if self.label is not None: | |
| 103 | - result["label"] = from_union([from_str, from_none], self.label) | |
| 104 | 102 | if self.weight is not None: |
| 105 | 103 | result["weight"] = from_union([to_float, from_none], self.weight) |
| 104 | + if self.label is not None: | |
| 105 | + result["label"] = from_union([from_str, from_none], self.label) | |
| 106 | 106 | return result |
Mschema-rubydefault / TopLevel.rb+9 −9
| @@ -51,23 +51,23 @@ end | ||
| 51 | 51 | |
| 52 | 52 | class TopLevel < Dry::Struct |
| 53 | 53 | attribute :coordinates, Types.Array(Coordinate).optional |
| 54 | - attribute :count, Types::Integer.optional | |
| 55 | - attribute :label, Types::String.optional | |
| 56 | 54 | attribute :required_coordinates, Types.Array(Coordinate) |
| 55 | + attribute :count, Types::Integer.optional | |
| 57 | 56 | attribute :required_count, Types::Integer |
| 58 | - attribute :required_label, Types::String | |
| 59 | 57 | attribute :weight, Types::Double.optional |
| 58 | + attribute :label, Types::String.optional | |
| 59 | + attribute :required_label, Types::String | |
| 60 | 60 | |
| 61 | 61 | def self.from_dynamic!(d) |
| 62 | 62 | d = Types::Hash[d] |
| 63 | 63 | new( |
| 64 | 64 | coordinates: d["coordinates"]&.map { |x| Coordinate.from_dynamic!(x) }, |
| 65 | - count: d["count"], | |
| 66 | - label: d["label"], | |
| 67 | 65 | required_coordinates: d.fetch("requiredCoordinates").map { |x| Coordinate.from_dynamic!(x) }, |
| 66 | + count: d["count"], | |
| 68 | 67 | required_count: d.fetch("requiredCount"), |
| 69 | - required_label: d.fetch("requiredLabel"), | |
| 70 | 68 | weight: d["weight"], |
| 69 | + label: d["label"], | |
| 70 | + required_label: d.fetch("requiredLabel"), | |
| 71 | 71 | ) |
| 72 | 72 | end |
| 73 | 73 | |
| @@ -78,12 +78,12 @@ class TopLevel < Dry::Struct | ||
| 78 | 78 | def to_dynamic |
| 79 | 79 | { |
| 80 | 80 | "coordinates" => coordinates&.map { |x| x.to_dynamic }, |
| 81 | - "count" => count, | |
| 82 | - "label" => label, | |
| 83 | 81 | "requiredCoordinates" => required_coordinates.map { |x| x.to_dynamic }, |
| 82 | + "count" => count, | |
| 84 | 83 | "requiredCount" => required_count, |
| 85 | - "requiredLabel" => required_label, | |
| 86 | 84 | "weight" => weight, |
| 85 | + "label" => label, | |
| 86 | + "requiredLabel" => required_label, | |
| 87 | 87 | } |
| 88 | 88 | end |
Mschema-rustdefault / module_under_test.rs+5 −5
| @@ -18,17 +18,17 @@ use serde::{Serialize, Deserialize}; | ||
| 18 | 18 | pub struct TopLevel { |
| 19 | 19 | pub coordinates: Option<Vec<Coordinate>>, |
| 20 | 20 | |
| 21 | + pub required_coordinates: Vec<Coordinate>, | |
| 22 | + | |
| 21 | 23 | pub count: Option<i32>, |
| 22 | 24 | |
| 23 | - pub label: Option<String>, | |
| 25 | + pub required_count: i32, | |
| 24 | 26 | |
| 25 | - pub required_coordinates: Vec<Coordinate>, | |
| 27 | + pub weight: Option<f64>, | |
| 26 | 28 | |
| 27 | - pub required_count: i32, | |
| 29 | + pub label: Option<String>, | |
| 28 | 30 | |
| 29 | 31 | pub required_label: String, |
| 30 | - | |
| 31 | - pub weight: Option<f64>, | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | #[derive(Debug, Clone, Serialize, Deserialize)] |
Mschema-scala3-upickledefault / TopLevel.scala+4 −4
| @@ -67,12 +67,12 @@ end JsonExt | ||
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | 69 | val coordinates : Option[Seq[Coordinate]] = None, |
| 70 | - val count : Option[Long] = None, | |
| 71 | - val label : Option[String] = None, | |
| 72 | 70 | val requiredCoordinates : Seq[Coordinate], |
| 71 | + val count : Option[Long] = None, | |
| 73 | 72 | val requiredCount : Long, |
| 74 | - val requiredLabel : String, | |
| 75 | - val weight : Option[Double] = None | |
| 73 | + val weight : Option[Double] = None, | |
| 74 | + val label : Option[String] = None, | |
| 75 | + val requiredLabel : String | |
| 76 | 76 | ) derives OptionPickler.ReadWriter |
| 77 | 77 | |
| 78 | 78 | case class Coordinate ( |
Mschema-scala3default / TopLevel.scala+4 −4
| @@ -9,12 +9,12 @@ type NullValue = None.type | ||
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | 11 | val coordinates : Option[Seq[Coordinate]] = None, |
| 12 | - val count : Option[Long] = None, | |
| 13 | - val label : Option[String] = None, | |
| 14 | 12 | val requiredCoordinates : Seq[Coordinate], |
| 13 | + val count : Option[Long] = None, | |
| 15 | 14 | val requiredCount : Long, |
| 16 | - val requiredLabel : String, | |
| 17 | - val weight : Option[Double] = None | |
| 15 | + val weight : Option[Double] = None, | |
| 16 | + val label : Option[String] = None, | |
| 17 | + val requiredLabel : String | |
| 18 | 18 | ) derives Encoder.AsObject, Decoder |
| 19 | 19 | |
| 20 | 20 | case class Coordinate ( |
Mschema-schemadefault / TopLevel.schema+15 −15
| @@ -12,36 +12,36 @@ | ||
| 12 | 12 | "$ref": "#/definitions/Coordinate" |
| 13 | 13 | } |
| 14 | 14 | }, |
| 15 | - "count": { | |
| 16 | - "type": "integer", | |
| 17 | - "minimum": 1, | |
| 18 | - "maximum": 100 | |
| 19 | - }, | |
| 20 | - "label": { | |
| 21 | - "type": "string", | |
| 22 | - "minLength": 2, | |
| 23 | - "maxLength": 16 | |
| 24 | - }, | |
| 25 | 15 | "requiredCoordinates": { |
| 26 | 16 | "type": "array", |
| 27 | 17 | "items": { |
| 28 | 18 | "$ref": "#/definitions/Coordinate" |
| 29 | 19 | } |
| 30 | 20 | }, |
| 31 | - "requiredCount": { | |
| 21 | + "count": { | |
| 32 | 22 | "type": "integer", |
| 33 | 23 | "minimum": 1, |
| 34 | 24 | "maximum": 100 |
| 35 | 25 | }, |
| 36 | - "requiredLabel": { | |
| 37 | - "type": "string", | |
| 38 | - "minLength": 2, | |
| 39 | - "maxLength": 16 | |
| 26 | + "requiredCount": { | |
| 27 | + "type": "integer", | |
| 28 | + "minimum": 1, | |
| 29 | + "maximum": 100 | |
| 40 | 30 | }, |
| 41 | 31 | "weight": { |
| 42 | 32 | "type": "number", |
| 43 | 33 | "minimum": 0.5, |
| 44 | 34 | "maximum": 99.5 |
| 35 | + }, | |
| 36 | + "label": { | |
| 37 | + "type": "string", | |
| 38 | + "minLength": 2, | |
| 39 | + "maxLength": 16 | |
| 40 | + }, | |
| 41 | + "requiredLabel": { | |
| 42 | + "type": "string", | |
| 43 | + "minLength": 2, | |
| 44 | + "maxLength": 16 | |
| 45 | 45 | } |
| 46 | 46 | }, |
| 47 | 47 | "required": [ |
Mschema-swiftdefault / quicktype.swift+14 −14
| @@ -8,21 +8,21 @@ import Foundation | ||
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | 10 | let coordinates: [Coordinate]? |
| 11 | - let count: Int? | |
| 12 | - let label: String? | |
| 13 | 11 | let requiredCoordinates: [Coordinate] |
| 12 | + let count: Int? | |
| 14 | 13 | let requiredCount: Int |
| 15 | - let requiredLabel: String | |
| 16 | 14 | let weight: Double? |
| 15 | + let label: String? | |
| 16 | + let requiredLabel: String | |
| 17 | 17 | |
| 18 | 18 | enum CodingKeys: String, CodingKey { |
| 19 | 19 | case coordinates = "coordinates" |
| 20 | - case count = "count" | |
| 21 | - case label = "label" | |
| 22 | 20 | case requiredCoordinates = "requiredCoordinates" |
| 21 | + case count = "count" | |
| 23 | 22 | case requiredCount = "requiredCount" |
| 24 | - case requiredLabel = "requiredLabel" | |
| 25 | 23 | case weight = "weight" |
| 24 | + case label = "label" | |
| 25 | + case requiredLabel = "requiredLabel" | |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | |
| @@ -46,21 +46,21 @@ extension TopLevel { | ||
| 46 | 46 | |
| 47 | 47 | func with( |
| 48 | 48 | coordinates: [Coordinate]?? = nil, |
| 49 | - count: Int?? = nil, | |
| 50 | - label: String?? = nil, | |
| 51 | 49 | requiredCoordinates: [Coordinate]? = nil, |
| 50 | + count: Int?? = nil, | |
| 52 | 51 | requiredCount: Int? = nil, |
| 53 | - requiredLabel: String? = nil, | |
| 54 | - weight: Double?? = nil | |
| 52 | + weight: Double?? = nil, | |
| 53 | + label: String?? = nil, | |
| 54 | + requiredLabel: String? = nil | |
| 55 | 55 | ) -> TopLevel { |
| 56 | 56 | return TopLevel( |
| 57 | 57 | coordinates: coordinates ?? self.coordinates, |
| 58 | - count: count ?? self.count, | |
| 59 | - label: label ?? self.label, | |
| 60 | 58 | requiredCoordinates: requiredCoordinates ?? self.requiredCoordinates, |
| 59 | + count: count ?? self.count, | |
| 61 | 60 | requiredCount: requiredCount ?? self.requiredCount, |
| 62 | - requiredLabel: requiredLabel ?? self.requiredLabel, | |
| 63 | - weight: weight ?? self.weight | |
| 61 | + weight: weight ?? self.weight, | |
| 62 | + label: label ?? self.label, | |
| 63 | + requiredLabel: requiredLabel ?? self.requiredLabel | |
| 64 | 64 | ) |
| 65 | 65 | } |
Mschema-typescript-zoddefault / TopLevel.ts+3 −3
| @@ -9,11 +9,11 @@ export type Coordinate = z.infer<typeof CoordinateSchema>; | ||
| 9 | 9 | |
| 10 | 10 | export const TopLevelSchema = z.object({ |
| 11 | 11 | "coordinates": z.array(CoordinateSchema).optional(), |
| 12 | - "count": z.number().optional(), | |
| 13 | - "label": z.string().optional(), | |
| 14 | 12 | "requiredCoordinates": z.array(CoordinateSchema), |
| 13 | + "count": z.number().optional(), | |
| 15 | 14 | "requiredCount": z.number(), |
| 16 | - "requiredLabel": z.string(), | |
| 17 | 15 | "weight": z.number().optional(), |
| 16 | + "label": z.string().optional(), | |
| 17 | + "requiredLabel": z.string(), | |
| 18 | 18 | }); |
| 19 | 19 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+6 −6
| @@ -9,12 +9,12 @@ | ||
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | 11 | coordinates?: Coordinate[]; |
| 12 | - count?: number; | |
| 13 | - label?: string; | |
| 14 | 12 | requiredCoordinates: Coordinate[]; |
| 13 | + count?: number; | |
| 15 | 14 | requiredCount: number; |
| 16 | - requiredLabel: string; | |
| 17 | 15 | weight?: number; |
| 16 | + label?: string; | |
| 17 | + requiredLabel: string; | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | export interface Coordinate { |
| @@ -190,12 +190,12 @@ function r(name: string) { | ||
| 190 | 190 | const typeMap: any = { |
| 191 | 191 | "TopLevel": o([ |
| 192 | 192 | { json: "coordinates", js: "coordinates", typ: u(undefined, a(r("Coordinate"))) }, |
| 193 | - { json: "count", js: "count", typ: u(undefined, 0) }, | |
| 194 | - { json: "label", js: "label", typ: u(undefined, "") }, | |
| 195 | 193 | { json: "requiredCoordinates", js: "requiredCoordinates", typ: a(r("Coordinate")) }, |
| 194 | + { json: "count", js: "count", typ: u(undefined, 0) }, | |
| 196 | 195 | { json: "requiredCount", js: "requiredCount", typ: 0 }, |
| 197 | - { json: "requiredLabel", js: "requiredLabel", typ: "" }, | |
| 198 | 196 | { json: "weight", js: "weight", typ: u(undefined, 3.14) }, |
| 197 | + { json: "label", js: "label", typ: u(undefined, "") }, | |
| 198 | + { json: "requiredLabel", js: "requiredLabel", typ: "" }, | |
| 199 | 199 | ], false), |
| 200 | 200 | "Coordinate": o([ |
| 201 | 201 | { json: "latitude", js: "latitude", typ: 3.14 }, |
Test case
28 generated files · +320 −320test/inputs/schema/optional-constraints.schema
Mschema-cplusplusdefault / quicktype.hpp+24 −24
| @@ -222,46 +222,46 @@ namespace quicktype { | ||
| 222 | 222 | class TopLevel { |
| 223 | 223 | public: |
| 224 | 224 | TopLevel() : |
| 225 | - opt_double_constraint(std::nullopt, std::nullopt, 0.5, 99.5, std::nullopt, std::nullopt, std::nullopt), | |
| 225 | + req_zero_min_constraint(0, 100, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), | |
| 226 | 226 | opt_int_constraint(0, 100, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt), |
| 227 | - opt_pattern_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::string("^[a-z]+$")), | |
| 227 | + opt_double_constraint(std::nullopt, std::nullopt, 0.5, 99.5, std::nullopt, std::nullopt, std::nullopt), | |
| 228 | 228 | opt_string_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, 3, 10, std::nullopt), |
| 229 | - req_zero_min_constraint(0, 100, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt) | |
| 229 | + opt_pattern_constraint(std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::string("^[a-z]+$")) | |
| 230 | 230 | {} |
| 231 | 231 | virtual ~TopLevel() = default; |
| 232 | 232 | |
| 233 | 233 | private: |
| 234 | - std::optional<double> opt_double; | |
| 235 | - ClassMemberConstraints opt_double_constraint; | |
| 234 | + int64_t req_zero_min; | |
| 235 | + ClassMemberConstraints req_zero_min_constraint; | |
| 236 | 236 | std::optional<int64_t> opt_int; |
| 237 | 237 | ClassMemberConstraints opt_int_constraint; |
| 238 | - std::optional<std::string> opt_pattern; | |
| 239 | - ClassMemberConstraints opt_pattern_constraint; | |
| 238 | + std::optional<double> opt_double; | |
| 239 | + ClassMemberConstraints opt_double_constraint; | |
| 240 | 240 | std::optional<std::string> opt_string; |
| 241 | 241 | ClassMemberConstraints opt_string_constraint; |
| 242 | - int64_t req_zero_min; | |
| 243 | - ClassMemberConstraints req_zero_min_constraint; | |
| 242 | + std::optional<std::string> opt_pattern; | |
| 243 | + ClassMemberConstraints opt_pattern_constraint; | |
| 244 | 244 | |
| 245 | 245 | public: |
| 246 | - const std::optional<double> & get_opt_double() const { return opt_double; } | |
| 247 | - std::optional<double> & get_mutable_opt_double() { return opt_double; } | |
| 248 | - void set_opt_double(const std::optional<double> & value) { CheckConstraint("opt_double", opt_double_constraint, value); this->opt_double = value; } | |
| 246 | + const int64_t & get_req_zero_min() const { return req_zero_min; } | |
| 247 | + int64_t & get_mutable_req_zero_min() { return req_zero_min; } | |
| 248 | + void set_req_zero_min(const int64_t & value) { CheckConstraint("req_zero_min", req_zero_min_constraint, value); this->req_zero_min = value; } | |
| 249 | 249 | |
| 250 | 250 | const std::optional<int64_t> & get_opt_int() const { return opt_int; } |
| 251 | 251 | std::optional<int64_t> & get_mutable_opt_int() { return opt_int; } |
| 252 | 252 | void set_opt_int(const std::optional<int64_t> & value) { CheckConstraint("opt_int", opt_int_constraint, value); this->opt_int = value; } |
| 253 | 253 | |
| 254 | - const std::optional<std::string> & get_opt_pattern() const { return opt_pattern; } | |
| 255 | - std::optional<std::string> & get_mutable_opt_pattern() { return opt_pattern; } | |
| 256 | - void set_opt_pattern(const std::optional<std::string> & value) { CheckConstraint("opt_pattern", opt_pattern_constraint, value); this->opt_pattern = value; } | |
| 254 | + const std::optional<double> & get_opt_double() const { return opt_double; } | |
| 255 | + std::optional<double> & get_mutable_opt_double() { return opt_double; } | |
| 256 | + void set_opt_double(const std::optional<double> & value) { CheckConstraint("opt_double", opt_double_constraint, value); this->opt_double = value; } | |
| 257 | 257 | |
| 258 | 258 | const std::optional<std::string> & get_opt_string() const { return opt_string; } |
| 259 | 259 | std::optional<std::string> & get_mutable_opt_string() { return opt_string; } |
| 260 | 260 | void set_opt_string(const std::optional<std::string> & value) { CheckConstraint("opt_string", opt_string_constraint, value); this->opt_string = value; } |
| 261 | 261 | |
| 262 | - const int64_t & get_req_zero_min() const { return req_zero_min; } | |
| 263 | - int64_t & get_mutable_req_zero_min() { return req_zero_min; } | |
| 264 | - void set_req_zero_min(const int64_t & value) { CheckConstraint("req_zero_min", req_zero_min_constraint, value); this->req_zero_min = value; } | |
| 262 | + const std::optional<std::string> & get_opt_pattern() const { return opt_pattern; } | |
| 263 | + std::optional<std::string> & get_mutable_opt_pattern() { return opt_pattern; } | |
| 264 | + void set_opt_pattern(const std::optional<std::string> & value) { CheckConstraint("opt_pattern", opt_pattern_constraint, value); this->opt_pattern = value; } | |
| 265 | 265 | }; |
| 266 | 266 | } |
| 267 | 267 | |
| @@ -270,19 +270,19 @@ namespace quicktype { | ||
| 270 | 270 | void to_json(json & j, const TopLevel & x); |
| 271 | 271 | |
| 272 | 272 | inline void from_json(const json & j, TopLevel& x) { |
| 273 | - x.set_opt_double(get_stack_optional<double>(j, "optDouble")); | |
| 273 | + x.set_req_zero_min(j.at("reqZeroMin").get<int64_t>()); | |
| 274 | 274 | x.set_opt_int(get_stack_optional<int64_t>(j, "optInt")); |
| 275 | - x.set_opt_pattern(get_stack_optional<std::string>(j, "optPattern")); | |
| 275 | + x.set_opt_double(get_stack_optional<double>(j, "optDouble")); | |
| 276 | 276 | x.set_opt_string(get_stack_optional<std::string>(j, "optString")); |
| 277 | - x.set_req_zero_min(j.at("reqZeroMin").get<int64_t>()); | |
| 277 | + x.set_opt_pattern(get_stack_optional<std::string>(j, "optPattern")); | |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | inline void to_json(json & j, const TopLevel & x) { |
| 281 | 281 | j = json::object(); |
| 282 | - j["optDouble"] = x.get_opt_double(); | |
| 282 | + j["reqZeroMin"] = x.get_req_zero_min(); | |
| 283 | 283 | j["optInt"] = x.get_opt_int(); |
| 284 | - j["optPattern"] = x.get_opt_pattern(); | |
| 284 | + j["optDouble"] = x.get_opt_double(); | |
| 285 | 285 | j["optString"] = x.get_opt_string(); |
| 286 | - j["reqZeroMin"] = x.get_req_zero_min(); | |
| 286 | + j["optPattern"] = x.get_opt_pattern(); | |
| 287 | 287 | } |
| 288 | 288 | } |
Mschema-csharp-recordsdefault / QuickType.cs+7 −7
| @@ -25,22 +25,22 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("optDouble", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 29 | - [JsonConverter(typeof(MinMaxValueCheckConverter))] | |
| 30 | - public double? OptDouble { get; set; } | |
| 28 | + [JsonProperty("reqZeroMin", Required = Required.Always)] | |
| 29 | + public long ReqZeroMin { get; set; } | |
| 31 | 30 | |
| 32 | 31 | [JsonProperty("optInt", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 33 | 32 | public long? OptInt { get; set; } |
| 34 | 33 | |
| 35 | - [JsonProperty("optPattern", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 36 | - public string? OptPattern { get; set; } | |
| 34 | + [JsonProperty("optDouble", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 35 | + [JsonConverter(typeof(MinMaxValueCheckConverter))] | |
| 36 | + public double? OptDouble { get; set; } | |
| 37 | 37 | |
| 38 | 38 | [JsonProperty("optString", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 39 | 39 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 40 | 40 | public string? OptString { get; set; } |
| 41 | 41 | |
| 42 | - [JsonProperty("reqZeroMin", Required = Required.Always)] | |
| 43 | - public long ReqZeroMin { get; set; } | |
| 42 | + [JsonProperty("optPattern", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 43 | + public string? OptPattern { get; set; } | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public partial record TopLevel |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+9 −9
| @@ -22,27 +22,27 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 26 | - [JsonPropertyName("optDouble")] | |
| 27 | - [JsonConverter(typeof(MinMaxValueCheckConverter))] | |
| 28 | - public double? OptDouble { get; set; } | |
| 25 | + [JsonRequired] | |
| 26 | + [JsonPropertyName("reqZeroMin")] | |
| 27 | + public long ReqZeroMin { get; set; } | |
| 29 | 28 | |
| 30 | 29 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 31 | 30 | [JsonPropertyName("optInt")] |
| 32 | 31 | public long? OptInt { get; set; } |
| 33 | 32 | |
| 34 | 33 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 35 | - [JsonPropertyName("optPattern")] | |
| 36 | - public string? OptPattern { get; set; } | |
| 34 | + [JsonPropertyName("optDouble")] | |
| 35 | + [JsonConverter(typeof(MinMaxValueCheckConverter))] | |
| 36 | + public double? OptDouble { get; set; } | |
| 37 | 37 | |
| 38 | 38 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 39 | 39 | [JsonPropertyName("optString")] |
| 40 | 40 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 41 | 41 | public string? OptString { get; set; } |
| 42 | 42 | |
| 43 | - [JsonRequired] | |
| 44 | - [JsonPropertyName("reqZeroMin")] | |
| 45 | - public long ReqZeroMin { get; set; } | |
| 43 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 44 | + [JsonPropertyName("optPattern")] | |
| 45 | + public string? OptPattern { get; set; } | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public partial class TopLevel |
Mschema-csharpdefault / QuickType.cs+7 −7
| @@ -25,22 +25,22 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("optDouble", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 29 | - [JsonConverter(typeof(MinMaxValueCheckConverter))] | |
| 30 | - public double? OptDouble { get; set; } | |
| 28 | + [JsonProperty("reqZeroMin", Required = Required.Always)] | |
| 29 | + public long ReqZeroMin { get; set; } | |
| 31 | 30 | |
| 32 | 31 | [JsonProperty("optInt", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 33 | 32 | public long? OptInt { get; set; } |
| 34 | 33 | |
| 35 | - [JsonProperty("optPattern", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 36 | - public string? OptPattern { get; set; } | |
| 34 | + [JsonProperty("optDouble", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 35 | + [JsonConverter(typeof(MinMaxValueCheckConverter))] | |
| 36 | + public double? OptDouble { get; set; } | |
| 37 | 37 | |
| 38 | 38 | [JsonProperty("optString", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 39 | 39 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 40 | 40 | public string? OptString { get; set; } |
| 41 | 41 | |
| 42 | - [JsonProperty("reqZeroMin", Required = Required.Always)] | |
| 43 | - public long ReqZeroMin { get; set; } | |
| 42 | + [JsonProperty("optPattern", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 43 | + public string? OptPattern { get; set; } | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public partial class TopLevel |
Mschema-dartdefault / TopLevel.dart+12 −12
| @@ -9,33 +9,33 @@ TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | ||
| 9 | 9 | String topLevelToJson(TopLevel data) => json.encode(data.toJson()); |
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | - final double? optDouble; | |
| 12 | + final int reqZeroMin; | |
| 13 | 13 | final int? optInt; |
| 14 | - final String? optPattern; | |
| 14 | + final double? optDouble; | |
| 15 | 15 | final String? optString; |
| 16 | - final int reqZeroMin; | |
| 16 | + final String? optPattern; | |
| 17 | 17 | |
| 18 | 18 | TopLevel({ |
| 19 | - this.optDouble, | |
| 19 | + required this.reqZeroMin, | |
| 20 | 20 | this.optInt, |
| 21 | - this.optPattern, | |
| 21 | + this.optDouble, | |
| 22 | 22 | this.optString, |
| 23 | - required this.reqZeroMin, | |
| 23 | + this.optPattern, | |
| 24 | 24 | }); |
| 25 | 25 | |
| 26 | 26 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 27 | - optDouble: json["optDouble"]?.toDouble(), | |
| 27 | + reqZeroMin: json["reqZeroMin"], | |
| 28 | 28 | optInt: json["optInt"], |
| 29 | - optPattern: json["optPattern"], | |
| 29 | + optDouble: json["optDouble"]?.toDouble(), | |
| 30 | 30 | optString: json["optString"], |
| 31 | - reqZeroMin: json["reqZeroMin"], | |
| 31 | + optPattern: json["optPattern"], | |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | 34 | Map<String, dynamic> toJson() => { |
| 35 | - "optDouble": optDouble, | |
| 35 | + "reqZeroMin": reqZeroMin, | |
| 36 | 36 | "optInt": optInt, |
| 37 | - "optPattern": optPattern, | |
| 37 | + "optDouble": optDouble, | |
| 38 | 38 | "optString": optString, |
| 39 | - "reqZeroMin": reqZeroMin, | |
| 39 | + "optPattern": optPattern, | |
| 40 | 40 | }; |
| 41 | 41 | } |
Mschema-elixirdefault / QuickType.ex+10 −10
| @@ -7,23 +7,23 @@ | ||
| 7 | 7 | |
| 8 | 8 | defmodule TopLevel do |
| 9 | 9 | @enforce_keys [:req_zero_min] |
| 10 | - defstruct [:opt_double, :opt_int, :opt_pattern, :opt_string, :req_zero_min] | |
| 10 | + defstruct [:req_zero_min, :opt_int, :opt_double, :opt_string, :opt_pattern] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | - opt_double: float() | nil, | |
| 13 | + req_zero_min: integer(), | |
| 14 | 14 | opt_int: integer() | nil, |
| 15 | - opt_pattern: String.t() | nil, | |
| 15 | + opt_double: float() | nil, | |
| 16 | 16 | opt_string: String.t() | nil, |
| 17 | - req_zero_min: integer() | |
| 17 | + opt_pattern: String.t() | nil | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | def from_map(m) do |
| 21 | 21 | %TopLevel{ |
| 22 | - opt_double: m["optDouble"], | |
| 22 | + req_zero_min: m["reqZeroMin"], | |
| 23 | 23 | opt_int: m["optInt"], |
| 24 | - opt_pattern: m["optPattern"], | |
| 24 | + opt_double: m["optDouble"], | |
| 25 | 25 | opt_string: m["optString"], |
| 26 | - req_zero_min: m["reqZeroMin"], | |
| 26 | + opt_pattern: m["optPattern"], | |
| 27 | 27 | } |
| 28 | 28 | end |
| 29 | 29 | |
| @@ -35,11 +35,11 @@ defmodule TopLevel do | ||
| 35 | 35 | |
| 36 | 36 | def to_map(struct) do |
| 37 | 37 | %{ |
| 38 | - "optDouble" => struct.opt_double, | |
| 38 | + "reqZeroMin" => struct.req_zero_min, | |
| 39 | 39 | "optInt" => struct.opt_int, |
| 40 | - "optPattern" => struct.opt_pattern, | |
| 40 | + "optDouble" => struct.opt_double, | |
| 41 | 41 | "optString" => struct.opt_string, |
| 42 | - "reqZeroMin" => struct.req_zero_min, | |
| 42 | + "optPattern" => struct.opt_pattern, | |
| 43 | 43 | } |
| 44 | 44 | end |
Mschema-elmdefault / QuickType.elm+9 −9
| @@ -23,11 +23,11 @@ import Json.Encode as Jenc | ||
| 23 | 23 | import Dict exposing (Dict) |
| 24 | 24 | |
| 25 | 25 | type alias QuickType = |
| 26 | - { optDouble : Maybe Float | |
| 26 | + { reqZeroMin : Int | |
| 27 | 27 | , optInt : Maybe Int |
| 28 | - , optPattern : Maybe String | |
| 28 | + , optDouble : Maybe Float | |
| 29 | 29 | , optString : Maybe String |
| 30 | - , reqZeroMin : Int | |
| 30 | + , optPattern : Maybe String | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | -- decoders and encoders |
| @@ -38,20 +38,20 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 38 | 38 | quickType : Jdec.Decoder QuickType |
| 39 | 39 | quickType = |
| 40 | 40 | Jdec.succeed QuickType |
| 41 | - |> Jpipe.optional "optDouble" (Jdec.nullable Jdec.float) Nothing | |
| 41 | + |> Jpipe.required "reqZeroMin" Jdec.int | |
| 42 | 42 | |> Jpipe.optional "optInt" (Jdec.nullable Jdec.int) Nothing |
| 43 | - |> Jpipe.optional "optPattern" (Jdec.nullable Jdec.string) Nothing | |
| 43 | + |> Jpipe.optional "optDouble" (Jdec.nullable Jdec.float) Nothing | |
| 44 | 44 | |> Jpipe.optional "optString" (Jdec.nullable Jdec.string) Nothing |
| 45 | - |> Jpipe.required "reqZeroMin" Jdec.int | |
| 45 | + |> Jpipe.optional "optPattern" (Jdec.nullable Jdec.string) Nothing | |
| 46 | 46 | |
| 47 | 47 | encodeQuickType : QuickType -> Jenc.Value |
| 48 | 48 | encodeQuickType x = |
| 49 | 49 | Jenc.object |
| 50 | - [ ("optDouble", makeNullableEncoder Jenc.float x.optDouble) | |
| 50 | + [ ("reqZeroMin", Jenc.int x.reqZeroMin) | |
| 51 | 51 | , ("optInt", makeNullableEncoder Jenc.int x.optInt) |
| 52 | - , ("optPattern", makeNullableEncoder Jenc.string x.optPattern) | |
| 52 | + , ("optDouble", makeNullableEncoder Jenc.float x.optDouble) | |
| 53 | 53 | , ("optString", makeNullableEncoder Jenc.string x.optString) |
| 54 | - , ("reqZeroMin", Jenc.int x.reqZeroMin) | |
| 54 | + , ("optPattern", makeNullableEncoder Jenc.string x.optPattern) | |
| 55 | 55 | ] |
| 56 | 56 | |
| 57 | 57 | --- encoder helpers |
Mschema-flowdefault / TopLevel.js+6 −6
| @@ -10,11 +10,11 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - optDouble?: number; | |
| 13 | + reqZeroMin: number; | |
| 14 | 14 | optInt?: number; |
| 15 | - optPattern?: string; | |
| 15 | + optDouble?: number; | |
| 16 | 16 | optString?: string; |
| 17 | - reqZeroMin: number; | |
| 17 | + optPattern?: string; | |
| 18 | 18 | [property: string]: mixed; |
| 19 | 19 | }; |
| 20 | 20 | |
| @@ -183,11 +183,11 @@ function r(name: string) { | ||
| 183 | 183 | |
| 184 | 184 | const typeMap: any = { |
| 185 | 185 | "TopLevel": o([ |
| 186 | - { json: "optDouble", js: "optDouble", typ: u(undefined, 3.14) }, | |
| 186 | + { json: "reqZeroMin", js: "reqZeroMin", typ: 0 }, | |
| 187 | 187 | { json: "optInt", js: "optInt", typ: u(undefined, 0) }, |
| 188 | - { json: "optPattern", js: "optPattern", typ: u(undefined, "") }, | |
| 188 | + { json: "optDouble", js: "optDouble", typ: u(undefined, 3.14) }, | |
| 189 | 189 | { json: "optString", js: "optString", typ: u(undefined, "") }, |
| 190 | - { json: "reqZeroMin", js: "reqZeroMin", typ: 0 }, | |
| 190 | + { json: "optPattern", js: "optPattern", typ: u(undefined, "") }, | |
| 191 | 191 | ], "any"), |
| 192 | 192 | }; |
Mschema-golangdefault / quicktype.go+3 −3
| @@ -19,9 +19,9 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | type TopLevel struct { |
| 22 | - OptDouble *float64 `json:"optDouble,omitempty"` | |
| 22 | + ReqZeroMin int64 `json:"reqZeroMin"` | |
| 23 | 23 | OptInt *int64 `json:"optInt,omitempty"` |
| 24 | - OptPattern *string `json:"optPattern,omitempty"` | |
| 24 | + OptDouble *float64 `json:"optDouble,omitempty"` | |
| 25 | 25 | OptString *string `json:"optString,omitempty"` |
| 26 | - ReqZeroMin int64 `json:"reqZeroMin"` | |
| 26 | + OptPattern *string `json:"optPattern,omitempty"` | |
| 27 | 27 | } |
Mschema-haskelldefault / QuickType.hs+10 −10
| @@ -13,30 +13,30 @@ import Data.HashMap.Strict (HashMap) | ||
| 13 | 13 | import Data.Text (Text) |
| 14 | 14 | |
| 15 | 15 | data QuickType = QuickType |
| 16 | - { optDoubleQuickType :: Maybe Float | |
| 16 | + { reqZeroMinQuickType :: Int | |
| 17 | 17 | , optIntQuickType :: Maybe Int |
| 18 | - , optPatternQuickType :: Maybe Text | |
| 18 | + , optDoubleQuickType :: Maybe Float | |
| 19 | 19 | , optStringQuickType :: Maybe Text |
| 20 | - , reqZeroMinQuickType :: Int | |
| 20 | + , optPatternQuickType :: Maybe Text | |
| 21 | 21 | } deriving (Show) |
| 22 | 22 | |
| 23 | 23 | decodeTopLevel :: ByteString -> Maybe QuickType |
| 24 | 24 | decodeTopLevel = decode |
| 25 | 25 | |
| 26 | 26 | instance ToJSON QuickType where |
| 27 | - toJSON (QuickType optDoubleQuickType optIntQuickType optPatternQuickType optStringQuickType reqZeroMinQuickType) = | |
| 27 | + toJSON (QuickType reqZeroMinQuickType optIntQuickType optDoubleQuickType optStringQuickType optPatternQuickType) = | |
| 28 | 28 | object |
| 29 | - [ "optDouble" .= optDoubleQuickType | |
| 29 | + [ "reqZeroMin" .= reqZeroMinQuickType | |
| 30 | 30 | , "optInt" .= optIntQuickType |
| 31 | - , "optPattern" .= optPatternQuickType | |
| 31 | + , "optDouble" .= optDoubleQuickType | |
| 32 | 32 | , "optString" .= optStringQuickType |
| 33 | - , "reqZeroMin" .= reqZeroMinQuickType | |
| 33 | + , "optPattern" .= optPatternQuickType | |
| 34 | 34 | ] |
| 35 | 35 | |
| 36 | 36 | instance FromJSON QuickType where |
| 37 | 37 | parseJSON (Object v) = QuickType |
| 38 | - <$> v .:? "optDouble" | |
| 38 | + <$> v .: "reqZeroMin" | |
| 39 | 39 | <*> v .:? "optInt" |
| 40 | - <*> v .:? "optPattern" | |
| 40 | + <*> v .:? "optDouble" | |
| 41 | 41 | <*> v .:? "optString" |
| 42 | - <*> v .: "reqZeroMin" | |
| 42 | + <*> v .:? "optPattern" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+15 −15
| @@ -3,34 +3,34 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private Double optDouble; | |
| 6 | + private long reqZeroMin; | |
| 7 | 7 | private Long optInt; |
| 8 | - private String optPattern; | |
| 8 | + private Double optDouble; | |
| 9 | 9 | private String optString; |
| 10 | - private long reqZeroMin; | |
| 10 | + private String optPattern; | |
| 11 | 11 | |
| 12 | - @JsonProperty("optDouble") | |
| 13 | - public Double getOptDouble() { return optDouble; } | |
| 14 | - @JsonProperty("optDouble") | |
| 15 | - public void setOptDouble(Double value) { this.optDouble = value; } | |
| 12 | + @JsonProperty("reqZeroMin") | |
| 13 | + public long getReqZeroMin() { return reqZeroMin; } | |
| 14 | + @JsonProperty("reqZeroMin") | |
| 15 | + public void setReqZeroMin(long value) { this.reqZeroMin = value; } | |
| 16 | 16 | |
| 17 | 17 | @JsonProperty("optInt") |
| 18 | 18 | public Long getOptInt() { return optInt; } |
| 19 | 19 | @JsonProperty("optInt") |
| 20 | 20 | public void setOptInt(Long value) { this.optInt = value; } |
| 21 | 21 | |
| 22 | - @JsonProperty("optPattern") | |
| 23 | - public String getOptPattern() { return optPattern; } | |
| 24 | - @JsonProperty("optPattern") | |
| 25 | - public void setOptPattern(String value) { this.optPattern = value; } | |
| 22 | + @JsonProperty("optDouble") | |
| 23 | + public Double getOptDouble() { return optDouble; } | |
| 24 | + @JsonProperty("optDouble") | |
| 25 | + public void setOptDouble(Double value) { this.optDouble = value; } | |
| 26 | 26 | |
| 27 | 27 | @JsonProperty("optString") |
| 28 | 28 | public String getOptString() { return optString; } |
| 29 | 29 | @JsonProperty("optString") |
| 30 | 30 | public void setOptString(String value) { this.optString = value; } |
| 31 | 31 | |
| 32 | - @JsonProperty("reqZeroMin") | |
| 33 | - public long getReqZeroMin() { return reqZeroMin; } | |
| 34 | - @JsonProperty("reqZeroMin") | |
| 35 | - public void setReqZeroMin(long value) { this.reqZeroMin = value; } | |
| 32 | + @JsonProperty("optPattern") | |
| 33 | + public String getOptPattern() { return optPattern; } | |
| 34 | + @JsonProperty("optPattern") | |
| 35 | + public void setOptPattern(String value) { this.optPattern = value; } | |
| 36 | 36 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+15 −15
| @@ -3,34 +3,34 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private Double optDouble; | |
| 6 | + private long reqZeroMin; | |
| 7 | 7 | private Long optInt; |
| 8 | - private String optPattern; | |
| 8 | + private Double optDouble; | |
| 9 | 9 | private String optString; |
| 10 | - private long reqZeroMin; | |
| 10 | + private String optPattern; | |
| 11 | 11 | |
| 12 | - @JsonProperty("optDouble") | |
| 13 | - public Double getOptDouble() { return optDouble; } | |
| 14 | - @JsonProperty("optDouble") | |
| 15 | - public void setOptDouble(Double value) { this.optDouble = value; } | |
| 12 | + @JsonProperty("reqZeroMin") | |
| 13 | + public long getReqZeroMin() { return reqZeroMin; } | |
| 14 | + @JsonProperty("reqZeroMin") | |
| 15 | + public void setReqZeroMin(long value) { this.reqZeroMin = value; } | |
| 16 | 16 | |
| 17 | 17 | @JsonProperty("optInt") |
| 18 | 18 | public Long getOptInt() { return optInt; } |
| 19 | 19 | @JsonProperty("optInt") |
| 20 | 20 | public void setOptInt(Long value) { this.optInt = value; } |
| 21 | 21 | |
| 22 | - @JsonProperty("optPattern") | |
| 23 | - public String getOptPattern() { return optPattern; } | |
| 24 | - @JsonProperty("optPattern") | |
| 25 | - public void setOptPattern(String value) { this.optPattern = value; } | |
| 22 | + @JsonProperty("optDouble") | |
| 23 | + public Double getOptDouble() { return optDouble; } | |
| 24 | + @JsonProperty("optDouble") | |
| 25 | + public void setOptDouble(Double value) { this.optDouble = value; } | |
| 26 | 26 | |
| 27 | 27 | @JsonProperty("optString") |
| 28 | 28 | public String getOptString() { return optString; } |
| 29 | 29 | @JsonProperty("optString") |
| 30 | 30 | public void setOptString(String value) { this.optString = value; } |
| 31 | 31 | |
| 32 | - @JsonProperty("reqZeroMin") | |
| 33 | - public long getReqZeroMin() { return reqZeroMin; } | |
| 34 | - @JsonProperty("reqZeroMin") | |
| 35 | - public void setReqZeroMin(long value) { this.reqZeroMin = value; } | |
| 32 | + @JsonProperty("optPattern") | |
| 33 | + public String getOptPattern() { return optPattern; } | |
| 34 | + @JsonProperty("optPattern") | |
| 35 | + public void setOptPattern(String value) { this.optPattern = value; } | |
| 36 | 36 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+15 −15
| @@ -3,34 +3,34 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private Double optDouble; | |
| 6 | + private long reqZeroMin; | |
| 7 | 7 | private Long optInt; |
| 8 | - private String optPattern; | |
| 8 | + private Double optDouble; | |
| 9 | 9 | private String optString; |
| 10 | - private long reqZeroMin; | |
| 10 | + private String optPattern; | |
| 11 | 11 | |
| 12 | - @JsonProperty("optDouble") | |
| 13 | - public Double getOptDouble() { return optDouble; } | |
| 14 | - @JsonProperty("optDouble") | |
| 15 | - public void setOptDouble(Double value) { this.optDouble = value; } | |
| 12 | + @JsonProperty("reqZeroMin") | |
| 13 | + public long getReqZeroMin() { return reqZeroMin; } | |
| 14 | + @JsonProperty("reqZeroMin") | |
| 15 | + public void setReqZeroMin(long value) { this.reqZeroMin = value; } | |
| 16 | 16 | |
| 17 | 17 | @JsonProperty("optInt") |
| 18 | 18 | public Long getOptInt() { return optInt; } |
| 19 | 19 | @JsonProperty("optInt") |
| 20 | 20 | public void setOptInt(Long value) { this.optInt = value; } |
| 21 | 21 | |
| 22 | - @JsonProperty("optPattern") | |
| 23 | - public String getOptPattern() { return optPattern; } | |
| 24 | - @JsonProperty("optPattern") | |
| 25 | - public void setOptPattern(String value) { this.optPattern = value; } | |
| 22 | + @JsonProperty("optDouble") | |
| 23 | + public Double getOptDouble() { return optDouble; } | |
| 24 | + @JsonProperty("optDouble") | |
| 25 | + public void setOptDouble(Double value) { this.optDouble = value; } | |
| 26 | 26 | |
| 27 | 27 | @JsonProperty("optString") |
| 28 | 28 | public String getOptString() { return optString; } |
| 29 | 29 | @JsonProperty("optString") |
| 30 | 30 | public void setOptString(String value) { this.optString = value; } |
| 31 | 31 | |
| 32 | - @JsonProperty("reqZeroMin") | |
| 33 | - public long getReqZeroMin() { return reqZeroMin; } | |
| 34 | - @JsonProperty("reqZeroMin") | |
| 35 | - public void setReqZeroMin(long value) { this.reqZeroMin = value; } | |
| 32 | + @JsonProperty("optPattern") | |
| 33 | + public String getOptPattern() { return optPattern; } | |
| 34 | + @JsonProperty("optPattern") | |
| 35 | + public void setOptPattern(String value) { this.optPattern = value; } | |
| 36 | 36 | } |
Mschema-javascriptdefault / TopLevel.js+3 −3
| @@ -172,11 +172,11 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "optDouble", js: "optDouble", typ: u(undefined, 3.14) }, | |
| 175 | + { json: "reqZeroMin", js: "reqZeroMin", typ: 0 }, | |
| 176 | 176 | { json: "optInt", js: "optInt", typ: u(undefined, 0) }, |
| 177 | - { json: "optPattern", js: "optPattern", typ: u(undefined, "") }, | |
| 177 | + { json: "optDouble", js: "optDouble", typ: u(undefined, 3.14) }, | |
| 178 | 178 | { json: "optString", js: "optString", typ: u(undefined, "") }, |
| 179 | - { json: "reqZeroMin", js: "reqZeroMin", typ: 0 }, | |
| 179 | + { json: "optPattern", js: "optPattern", typ: u(undefined, "") }, | |
| 180 | 180 | ], "any"), |
| 181 | 181 | }; |
Mschema-kotlin-jacksondefault / TopLevel.kt+5 −5
| @@ -19,13 +19,13 @@ val mapper = jacksonObjectMapper().apply { | ||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | data class TopLevel ( |
| 22 | - val optDouble: Double? = null, | |
| 22 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 23 | + val reqZeroMin: Long, | |
| 24 | + | |
| 23 | 25 | val optInt: Long? = null, |
| 24 | - val optPattern: String? = null, | |
| 26 | + val optDouble: Double? = null, | |
| 25 | 27 | val optString: String? = null, |
| 26 | - | |
| 27 | - @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 28 | - val reqZeroMin: Long | |
| 28 | + val optPattern: String? = null | |
| 29 | 29 | ) { |
| 30 | 30 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+3 −3
| @@ -9,11 +9,11 @@ import com.beust.klaxon.* | ||
| 9 | 9 | private val klaxon = Klaxon() |
| 10 | 10 | |
| 11 | 11 | data class TopLevel ( |
| 12 | - val optDouble: Double? = null, | |
| 12 | + val reqZeroMin: Long, | |
| 13 | 13 | val optInt: Long? = null, |
| 14 | - val optPattern: String? = null, | |
| 14 | + val optDouble: Double? = null, | |
| 15 | 15 | val optString: String? = null, |
| 16 | - val reqZeroMin: Long | |
| 16 | + val optPattern: String? = null | |
| 17 | 17 | ) { |
| 18 | 18 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-kotlinxdefault / TopLevel.kt+3 −3
| @@ -12,9 +12,9 @@ import kotlinx.serialization.encoding.* | ||
| 12 | 12 | |
| 13 | 13 | @Serializable |
| 14 | 14 | data class TopLevel ( |
| 15 | - val optDouble: Double? = null, | |
| 15 | + val reqZeroMin: Long, | |
| 16 | 16 | val optInt: Long? = null, |
| 17 | - val optPattern: String? = null, | |
| 17 | + val optDouble: Double? = null, | |
| 18 | 18 | val optString: String? = null, |
| 19 | - val reqZeroMin: Long | |
| 19 | + val optPattern: String? = null | |
| 20 | 20 | ) |
Mschema-phpdefault / TopLevel.php+90 −90
| @@ -4,82 +4,72 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private ?float $optDouble; // json:optDouble Optional | |
| 7 | + private int $reqZeroMin; // json:reqZeroMin Required | |
| 8 | 8 | private ?int $optInt; // json:optInt Optional |
| 9 | - private ?string $optPattern; // json:optPattern Optional | |
| 9 | + private ?float $optDouble; // json:optDouble Optional | |
| 10 | 10 | private ?string $optString; // json:optString Optional |
| 11 | - private int $reqZeroMin; // json:reqZeroMin Required | |
| 11 | + private ?string $optPattern; // json:optPattern Optional | |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * @param float|null $optDouble | |
| 14 | + * @param int $reqZeroMin | |
| 15 | 15 | * @param int|null $optInt |
| 16 | - * @param string|null $optPattern | |
| 16 | + * @param float|null $optDouble | |
| 17 | 17 | * @param string|null $optString |
| 18 | - * @param int $reqZeroMin | |
| 18 | + * @param string|null $optPattern | |
| 19 | 19 | */ |
| 20 | - public function __construct(?float $optDouble, ?int $optInt, ?string $optPattern, ?string $optString, int $reqZeroMin) { | |
| 21 | - $this->optDouble = $optDouble; | |
| 20 | + public function __construct(int $reqZeroMin, ?int $optInt, ?float $optDouble, ?string $optString, ?string $optPattern) { | |
| 21 | + $this->reqZeroMin = $reqZeroMin; | |
| 22 | 22 | $this->optInt = $optInt; |
| 23 | - $this->optPattern = $optPattern; | |
| 23 | + $this->optDouble = $optDouble; | |
| 24 | 24 | $this->optString = $optString; |
| 25 | - $this->reqZeroMin = $reqZeroMin; | |
| 25 | + $this->optPattern = $optPattern; | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * @param ?float $value | |
| 29 | + * @param int $value | |
| 30 | 30 | * @throws Exception |
| 31 | - * @return ?float | |
| 31 | + * @return int | |
| 32 | 32 | */ |
| 33 | - public static function fromOptDouble(?float $value): ?float { | |
| 34 | - if (!is_null($value)) { | |
| 35 | - return $value; /*float*/ | |
| 36 | - } else { | |
| 37 | - return null; | |
| 38 | - } | |
| 33 | + public static function fromReqZeroMin(int $value): int { | |
| 34 | + return $value; /*int*/ | |
| 39 | 35 | } |
| 40 | 36 | |
| 41 | 37 | /** |
| 42 | 38 | * @throws Exception |
| 43 | - * @return ?float | |
| 39 | + * @return int | |
| 44 | 40 | */ |
| 45 | - public function toOptDouble(): ?float { | |
| 46 | - if (TopLevel::validateOptDouble($this->optDouble)) { | |
| 47 | - if (!is_null($this->optDouble)) { | |
| 48 | - return $this->optDouble; /*float*/ | |
| 49 | - } else { | |
| 50 | - return null; | |
| 51 | - } | |
| 41 | + public function toReqZeroMin(): int { | |
| 42 | + if (TopLevel::validateReqZeroMin($this->reqZeroMin)) { | |
| 43 | + return $this->reqZeroMin; /*int*/ | |
| 52 | 44 | } |
| 53 | - throw new Exception('never get to this TopLevel::optDouble'); | |
| 45 | + throw new Exception('never get to this TopLevel::reqZeroMin'); | |
| 54 | 46 | } |
| 55 | 47 | |
| 56 | 48 | /** |
| 57 | - * @param float|null | |
| 49 | + * @param int | |
| 58 | 50 | * @return bool |
| 59 | 51 | * @throws Exception |
| 60 | 52 | */ |
| 61 | - public static function validateOptDouble(?float $value): bool { | |
| 62 | - if (!is_null($value)) { | |
| 63 | - } | |
| 53 | + public static function validateReqZeroMin(int $value): bool { | |
| 64 | 54 | return true; |
| 65 | 55 | } |
| 66 | 56 | |
| 67 | 57 | /** |
| 68 | 58 | * @throws Exception |
| 69 | - * @return ?float | |
| 59 | + * @return int | |
| 70 | 60 | */ |
| 71 | - public function getOptDouble(): ?float { | |
| 72 | - if (TopLevel::validateOptDouble($this->optDouble)) { | |
| 73 | - return $this->optDouble; | |
| 61 | + public function getReqZeroMin(): int { | |
| 62 | + if (TopLevel::validateReqZeroMin($this->reqZeroMin)) { | |
| 63 | + return $this->reqZeroMin; | |
| 74 | 64 | } |
| 75 | - throw new Exception('never get to getOptDouble TopLevel::optDouble'); | |
| 65 | + throw new Exception('never get to getReqZeroMin TopLevel::reqZeroMin'); | |
| 76 | 66 | } |
| 77 | 67 | |
| 78 | 68 | /** |
| 79 | - * @return ?float | |
| 69 | + * @return int | |
| 80 | 70 | */ |
| 81 | - public static function sampleOptDouble(): ?float { | |
| 82 | - return 31.031; /*31:optDouble*/ | |
| 71 | + public static function sampleReqZeroMin(): int { | |
| 72 | + return 31; /*31:reqZeroMin*/ | |
| 83 | 73 | } |
| 84 | 74 | |
| 85 | 75 | /** |
| @@ -140,13 +130,13 @@ class TopLevel { | ||
| 140 | 130 | } |
| 141 | 131 | |
| 142 | 132 | /** |
| 143 | - * @param ?string $value | |
| 133 | + * @param ?float $value | |
| 144 | 134 | * @throws Exception |
| 145 | - * @return ?string | |
| 135 | + * @return ?float | |
| 146 | 136 | */ |
| 147 | - public static function fromOptPattern(?string $value): ?string { | |
| 137 | + public static function fromOptDouble(?float $value): ?float { | |
| 148 | 138 | if (!is_null($value)) { |
| 149 | - return $value; /*string*/ | |
| 139 | + return $value; /*float*/ | |
| 150 | 140 | } else { |
| 151 | 141 | return null; |
| 152 | 142 | } |
| @@ -154,25 +144,25 @@ class TopLevel { | ||
| 154 | 144 | |
| 155 | 145 | /** |
| 156 | 146 | * @throws Exception |
| 157 | - * @return ?string | |
| 147 | + * @return ?float | |
| 158 | 148 | */ |
| 159 | - public function toOptPattern(): ?string { | |
| 160 | - if (TopLevel::validateOptPattern($this->optPattern)) { | |
| 161 | - if (!is_null($this->optPattern)) { | |
| 162 | - return $this->optPattern; /*string*/ | |
| 149 | + public function toOptDouble(): ?float { | |
| 150 | + if (TopLevel::validateOptDouble($this->optDouble)) { | |
| 151 | + if (!is_null($this->optDouble)) { | |
| 152 | + return $this->optDouble; /*float*/ | |
| 163 | 153 | } else { |
| 164 | 154 | return null; |
| 165 | 155 | } |
| 166 | 156 | } |
| 167 | - throw new Exception('never get to this TopLevel::optPattern'); | |
| 157 | + throw new Exception('never get to this TopLevel::optDouble'); | |
| 168 | 158 | } |
| 169 | 159 | |
| 170 | 160 | /** |
| 171 | - * @param string|null | |
| 161 | + * @param float|null | |
| 172 | 162 | * @return bool |
| 173 | 163 | * @throws Exception |
| 174 | 164 | */ |
| 175 | - public static function validateOptPattern(?string $value): bool { | |
| 165 | + public static function validateOptDouble(?float $value): bool { | |
| 176 | 166 | if (!is_null($value)) { |
| 177 | 167 | } |
| 178 | 168 | return true; |
| @@ -180,20 +170,20 @@ class TopLevel { | ||
| 180 | 170 | |
| 181 | 171 | /** |
| 182 | 172 | * @throws Exception |
| 183 | - * @return ?string | |
| 173 | + * @return ?float | |
| 184 | 174 | */ |
| 185 | - public function getOptPattern(): ?string { | |
| 186 | - if (TopLevel::validateOptPattern($this->optPattern)) { | |
| 187 | - return $this->optPattern; | |
| 175 | + public function getOptDouble(): ?float { | |
| 176 | + if (TopLevel::validateOptDouble($this->optDouble)) { | |
| 177 | + return $this->optDouble; | |
| 188 | 178 | } |
| 189 | - throw new Exception('never get to getOptPattern TopLevel::optPattern'); | |
| 179 | + throw new Exception('never get to getOptDouble TopLevel::optDouble'); | |
| 190 | 180 | } |
| 191 | 181 | |
| 192 | 182 | /** |
| 193 | - * @return ?string | |
| 183 | + * @return ?float | |
| 194 | 184 | */ |
| 195 | - public static function sampleOptPattern(): ?string { | |
| 196 | - return 'TopLevel::optPattern::33'; /*33:optPattern*/ | |
| 185 | + public static function sampleOptDouble(): ?float { | |
| 186 | + return 33.033; /*33:optDouble*/ | |
| 197 | 187 | } |
| 198 | 188 | |
| 199 | 189 | /** |
| @@ -254,50 +244,60 @@ class TopLevel { | ||
| 254 | 244 | } |
| 255 | 245 | |
| 256 | 246 | /** |
| 257 | - * @param int $value | |
| 247 | + * @param ?string $value | |
| 258 | 248 | * @throws Exception |
| 259 | - * @return int | |
| 249 | + * @return ?string | |
| 260 | 250 | */ |
| 261 | - public static function fromReqZeroMin(int $value): int { | |
| 262 | - return $value; /*int*/ | |
| 251 | + public static function fromOptPattern(?string $value): ?string { | |
| 252 | + if (!is_null($value)) { | |
| 253 | + return $value; /*string*/ | |
| 254 | + } else { | |
| 255 | + return null; | |
| 256 | + } | |
| 263 | 257 | } |
| 264 | 258 | |
| 265 | 259 | /** |
| 266 | 260 | * @throws Exception |
| 267 | - * @return int | |
| 261 | + * @return ?string | |
| 268 | 262 | */ |
| 269 | - public function toReqZeroMin(): int { | |
| 270 | - if (TopLevel::validateReqZeroMin($this->reqZeroMin)) { | |
| 271 | - return $this->reqZeroMin; /*int*/ | |
| 263 | + public function toOptPattern(): ?string { | |
| 264 | + if (TopLevel::validateOptPattern($this->optPattern)) { | |
| 265 | + if (!is_null($this->optPattern)) { | |
| 266 | + return $this->optPattern; /*string*/ | |
| 267 | + } else { | |
| 268 | + return null; | |
| 269 | + } | |
| 272 | 270 | } |
| 273 | - throw new Exception('never get to this TopLevel::reqZeroMin'); | |
| 271 | + throw new Exception('never get to this TopLevel::optPattern'); | |
| 274 | 272 | } |
| 275 | 273 | |
| 276 | 274 | /** |
| 277 | - * @param int | |
| 275 | + * @param string|null | |
| 278 | 276 | * @return bool |
| 279 | 277 | * @throws Exception |
| 280 | 278 | */ |
| 281 | - public static function validateReqZeroMin(int $value): bool { | |
| 279 | + public static function validateOptPattern(?string $value): bool { | |
| 280 | + if (!is_null($value)) { | |
| 281 | + } | |
| 282 | 282 | return true; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | /** |
| 286 | 286 | * @throws Exception |
| 287 | - * @return int | |
| 287 | + * @return ?string | |
| 288 | 288 | */ |
| 289 | - public function getReqZeroMin(): int { | |
| 290 | - if (TopLevel::validateReqZeroMin($this->reqZeroMin)) { | |
| 291 | - return $this->reqZeroMin; | |
| 289 | + public function getOptPattern(): ?string { | |
| 290 | + if (TopLevel::validateOptPattern($this->optPattern)) { | |
| 291 | + return $this->optPattern; | |
| 292 | 292 | } |
| 293 | - throw new Exception('never get to getReqZeroMin TopLevel::reqZeroMin'); | |
| 293 | + throw new Exception('never get to getOptPattern TopLevel::optPattern'); | |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |
| 297 | - * @return int | |
| 297 | + * @return ?string | |
| 298 | 298 | */ |
| 299 | - public static function sampleReqZeroMin(): int { | |
| 300 | - return 35; /*35:reqZeroMin*/ | |
| 299 | + public static function sampleOptPattern(): ?string { | |
| 300 | + return 'TopLevel::optPattern::35'; /*35:optPattern*/ | |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /** |
| @@ -305,11 +305,11 @@ class TopLevel { | ||
| 305 | 305 | * @return bool |
| 306 | 306 | */ |
| 307 | 307 | public function validate(): bool { |
| 308 | - return TopLevel::validateOptDouble($this->optDouble) | |
| 308 | + return TopLevel::validateReqZeroMin($this->reqZeroMin) | |
| 309 | 309 | || TopLevel::validateOptInt($this->optInt) |
| 310 | - || TopLevel::validateOptPattern($this->optPattern) | |
| 310 | + || TopLevel::validateOptDouble($this->optDouble) | |
| 311 | 311 | || TopLevel::validateOptString($this->optString) |
| 312 | - || TopLevel::validateReqZeroMin($this->reqZeroMin); | |
| 312 | + || TopLevel::validateOptPattern($this->optPattern); | |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
| @@ -318,11 +318,11 @@ class TopLevel { | ||
| 318 | 318 | */ |
| 319 | 319 | public function to(): stdClass { |
| 320 | 320 | $out = new stdClass(); |
| 321 | - $out->{'optDouble'} = $this->toOptDouble(); | |
| 321 | + $out->{'reqZeroMin'} = $this->toReqZeroMin(); | |
| 322 | 322 | $out->{'optInt'} = $this->toOptInt(); |
| 323 | - $out->{'optPattern'} = $this->toOptPattern(); | |
| 323 | + $out->{'optDouble'} = $this->toOptDouble(); | |
| 324 | 324 | $out->{'optString'} = $this->toOptString(); |
| 325 | - $out->{'reqZeroMin'} = $this->toReqZeroMin(); | |
| 325 | + $out->{'optPattern'} = $this->toOptPattern(); | |
| 326 | 326 | return $out; |
| 327 | 327 | } |
| 328 | 328 | |
| @@ -333,11 +333,11 @@ class TopLevel { | ||
| 333 | 333 | */ |
| 334 | 334 | public static function from(stdClass $obj): TopLevel { |
| 335 | 335 | return new TopLevel( |
| 336 | - TopLevel::fromOptDouble($obj->{'optDouble'}) | |
| 336 | + TopLevel::fromReqZeroMin($obj->{'reqZeroMin'}) | |
| 337 | 337 | ,TopLevel::fromOptInt($obj->{'optInt'}) |
| 338 | - ,TopLevel::fromOptPattern($obj->{'optPattern'}) | |
| 338 | + ,TopLevel::fromOptDouble($obj->{'optDouble'}) | |
| 339 | 339 | ,TopLevel::fromOptString($obj->{'optString'}) |
| 340 | - ,TopLevel::fromReqZeroMin($obj->{'reqZeroMin'}) | |
| 340 | + ,TopLevel::fromOptPattern($obj->{'optPattern'}) | |
| 341 | 341 | ); |
| 342 | 342 | } |
| 343 | 343 | |
| @@ -346,11 +346,11 @@ class TopLevel { | ||
| 346 | 346 | */ |
| 347 | 347 | public static function sample(): TopLevel { |
| 348 | 348 | return new TopLevel( |
| 349 | - TopLevel::sampleOptDouble() | |
| 349 | + TopLevel::sampleReqZeroMin() | |
| 350 | 350 | ,TopLevel::sampleOptInt() |
| 351 | - ,TopLevel::sampleOptPattern() | |
| 351 | + ,TopLevel::sampleOptDouble() | |
| 352 | 352 | ,TopLevel::sampleOptString() |
| 353 | - ,TopLevel::sampleReqZeroMin() | |
| 353 | + ,TopLevel::sampleOptPattern() | |
| 354 | 354 | ); |
| 355 | 355 | } |
| 356 | 356 | } |
Mschema-pikedefault / TopLevel.pmod+9 −9
| @@ -13,19 +13,19 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - float|mixed opt_double; // json: "optDouble" | |
| 16 | + int req_zero_min; // json: "reqZeroMin" | |
| 17 | 17 | int|mixed opt_int; // json: "optInt" |
| 18 | - mixed|string opt_pattern; // json: "optPattern" | |
| 18 | + float|mixed opt_double; // json: "optDouble" | |
| 19 | 19 | mixed|string opt_string; // json: "optString" |
| 20 | - int req_zero_min; // json: "reqZeroMin" | |
| 20 | + mixed|string opt_pattern; // json: "optPattern" | |
| 21 | 21 | |
| 22 | 22 | string encode_json() { |
| 23 | 23 | mapping(string:mixed) json = ([ |
| 24 | - "optDouble" : opt_double, | |
| 24 | + "reqZeroMin" : req_zero_min, | |
| 25 | 25 | "optInt" : opt_int, |
| 26 | - "optPattern" : opt_pattern, | |
| 26 | + "optDouble" : opt_double, | |
| 27 | 27 | "optString" : opt_string, |
| 28 | - "reqZeroMin" : req_zero_min, | |
| 28 | + "optPattern" : opt_pattern, | |
| 29 | 29 | ]); |
| 30 | 30 | |
| 31 | 31 | return Standards.JSON.encode(json); |
| @@ -35,11 +35,11 @@ class TopLevel { | ||
| 35 | 35 | TopLevel TopLevel_from_JSON(mixed json) { |
| 36 | 36 | TopLevel retval = TopLevel(); |
| 37 | 37 | |
| 38 | - retval.opt_double = json["optDouble"]; | |
| 38 | + retval.req_zero_min = json["reqZeroMin"]; | |
| 39 | 39 | retval.opt_int = json["optInt"]; |
| 40 | - retval.opt_pattern = json["optPattern"]; | |
| 40 | + retval.opt_double = json["optDouble"]; | |
| 41 | 41 | retval.opt_string = json["optString"]; |
| 42 | - retval.req_zero_min = json["reqZeroMin"]; | |
| 42 | + retval.opt_pattern = json["optPattern"]; | |
| 43 | 43 | |
| 44 | 44 | return retval; |
| 45 | 45 | } |
Mschema-pythondefault / quicktype.py+14 −14
| @@ -10,11 +10,6 @@ def from_int(x: Any) -> int: | ||
| 10 | 10 | return x |
| 11 | 11 | |
| 12 | 12 | |
| 13 | -def from_float(x: Any) -> float: | |
| 14 | - assert isinstance(x, (float, int)) and not isinstance(x, bool) | |
| 15 | - return float(x) | |
| 16 | - | |
| 17 | - | |
| 18 | 13 | def from_none(x: Any) -> Any: |
| 19 | 14 | assert x is None |
| 20 | 15 | return x |
| @@ -29,6 +24,11 @@ def from_union(fs, x): | ||
| 29 | 24 | assert False |
| 30 | 25 | |
| 31 | 26 | |
| 27 | +def from_float(x: Any) -> float: | |
| 28 | + assert isinstance(x, (float, int)) and not isinstance(x, bool) | |
| 29 | + return float(x) | |
| 30 | + | |
| 31 | + | |
| 32 | 32 | def from_str(x: Any) -> str: |
| 33 | 33 | assert isinstance(x, str) |
| 34 | 34 | return x |
| @@ -47,32 +47,32 @@ def to_class(c: Type[T], x: Any) -> dict: | ||
| 47 | 47 | @dataclass |
| 48 | 48 | class TopLevel: |
| 49 | 49 | req_zero_min: int |
| 50 | - opt_double: float | None = None | |
| 51 | 50 | opt_int: int | None = None |
| 52 | - opt_pattern: str | None = None | |
| 51 | + opt_double: float | None = None | |
| 53 | 52 | opt_string: str | None = None |
| 53 | + opt_pattern: str | None = None | |
| 54 | 54 | |
| 55 | 55 | @staticmethod |
| 56 | 56 | def from_dict(obj: Any) -> 'TopLevel': |
| 57 | 57 | assert isinstance(obj, dict) |
| 58 | 58 | req_zero_min = from_int(obj.get("reqZeroMin")) |
| 59 | - opt_double = from_union([from_float, from_none], obj.get("optDouble")) | |
| 60 | 59 | opt_int = from_union([from_int, from_none], obj.get("optInt")) |
| 61 | - opt_pattern = from_union([from_str, from_none], obj.get("optPattern")) | |
| 60 | + opt_double = from_union([from_float, from_none], obj.get("optDouble")) | |
| 62 | 61 | opt_string = from_union([from_str, from_none], obj.get("optString")) |
| 63 | - return TopLevel(req_zero_min, opt_double, opt_int, opt_pattern, opt_string) | |
| 62 | + opt_pattern = from_union([from_str, from_none], obj.get("optPattern")) | |
| 63 | + return TopLevel(req_zero_min, opt_int, opt_double, opt_string, opt_pattern) | |
| 64 | 64 | |
| 65 | 65 | def to_dict(self) -> dict: |
| 66 | 66 | result: dict = {} |
| 67 | 67 | result["reqZeroMin"] = from_int(self.req_zero_min) |
| 68 | - if self.opt_double is not None: | |
| 69 | - result["optDouble"] = from_union([to_float, from_none], self.opt_double) | |
| 70 | 68 | if self.opt_int is not None: |
| 71 | 69 | result["optInt"] = from_union([from_int, from_none], self.opt_int) |
| 72 | - if self.opt_pattern is not None: | |
| 73 | - result["optPattern"] = from_union([from_str, from_none], self.opt_pattern) | |
| 70 | + if self.opt_double is not None: | |
| 71 | + result["optDouble"] = from_union([to_float, from_none], self.opt_double) | |
| 74 | 72 | if self.opt_string is not None: |
| 75 | 73 | result["optString"] = from_union([from_str, from_none], self.opt_string) |
| 74 | + if self.opt_pattern is not None: | |
| 75 | + result["optPattern"] = from_union([from_str, from_none], self.opt_pattern) | |
| 76 | 76 | return result |
Mschema-rubydefault / TopLevel.rb+10 −10
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.opt_double | |
| 7 | +# puts top_level.req_zero_min.even? | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -22,20 +22,20 @@ module Types | ||
| 22 | 22 | end |
| 23 | 23 | |
| 24 | 24 | class TopLevel < Dry::Struct |
| 25 | - attribute :opt_double, Types::Double.optional | |
| 25 | + attribute :req_zero_min, Types::Integer | |
| 26 | 26 | attribute :opt_int, Types::Integer.optional |
| 27 | - attribute :opt_pattern, Types::String.optional | |
| 27 | + attribute :opt_double, Types::Double.optional | |
| 28 | 28 | attribute :opt_string, Types::String.optional |
| 29 | - attribute :req_zero_min, Types::Integer | |
| 29 | + attribute :opt_pattern, Types::String.optional | |
| 30 | 30 | |
| 31 | 31 | def self.from_dynamic!(d) |
| 32 | 32 | d = Types::Hash[d] |
| 33 | 33 | new( |
| 34 | - opt_double: d["optDouble"], | |
| 34 | + req_zero_min: d.fetch("reqZeroMin"), | |
| 35 | 35 | opt_int: d["optInt"], |
| 36 | - opt_pattern: d["optPattern"], | |
| 36 | + opt_double: d["optDouble"], | |
| 37 | 37 | opt_string: d["optString"], |
| 38 | - req_zero_min: d.fetch("reqZeroMin"), | |
| 38 | + opt_pattern: d["optPattern"], | |
| 39 | 39 | ) |
| 40 | 40 | end |
| 41 | 41 | |
| @@ -45,11 +45,11 @@ class TopLevel < Dry::Struct | ||
| 45 | 45 | |
| 46 | 46 | def to_dynamic |
| 47 | 47 | { |
| 48 | - "optDouble" => opt_double, | |
| 48 | + "reqZeroMin" => req_zero_min, | |
| 49 | 49 | "optInt" => opt_int, |
| 50 | - "optPattern" => opt_pattern, | |
| 50 | + "optDouble" => opt_double, | |
| 51 | 51 | "optString" => opt_string, |
| 52 | - "reqZeroMin" => req_zero_min, | |
| 52 | + "optPattern" => opt_pattern, | |
| 53 | 53 | } |
| 54 | 54 | end |
Mschema-rustdefault / module_under_test.rs+3 −3
| @@ -16,13 +16,13 @@ use serde::{Serialize, Deserialize}; | ||
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | #[serde(rename_all = "camelCase")] |
| 18 | 18 | pub struct TopLevel { |
| 19 | - pub opt_double: Option<f64>, | |
| 19 | + pub req_zero_min: i32, | |
| 20 | 20 | |
| 21 | 21 | pub opt_int: Option<i32>, |
| 22 | 22 | |
| 23 | - pub opt_pattern: Option<String>, | |
| 23 | + pub opt_double: Option<f64>, | |
| 24 | 24 | |
| 25 | 25 | pub opt_string: Option<String>, |
| 26 | 26 | |
| 27 | - pub req_zero_min: i32, | |
| 27 | + pub opt_pattern: Option<String>, | |
| 28 | 28 | } |
Mschema-scala3-upickledefault / TopLevel.scala+3 −3
| @@ -66,9 +66,9 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val optDouble : Option[Double] = None, | |
| 69 | + val reqZeroMin : Long, | |
| 70 | 70 | val optInt : Option[Long] = None, |
| 71 | - val optPattern : Option[String] = None, | |
| 71 | + val optDouble : Option[Double] = None, | |
| 72 | 72 | val optString : Option[String] = None, |
| 73 | - val reqZeroMin : Long | |
| 73 | + val optPattern : Option[String] = None | |
| 74 | 74 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+3 −3
| @@ -8,9 +8,9 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val optDouble : Option[Double] = None, | |
| 11 | + val reqZeroMin : Long, | |
| 12 | 12 | val optInt : Option[Long] = None, |
| 13 | - val optPattern : Option[String] = None, | |
| 13 | + val optDouble : Option[Double] = None, | |
| 14 | 14 | val optString : Option[String] = None, |
| 15 | - val reqZeroMin : Long | |
| 15 | + val optPattern : Option[String] = None | |
| 16 | 16 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+11 −11
| @@ -6,29 +6,29 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": {}, |
| 8 | 8 | "properties": { |
| 9 | - "optDouble": { | |
| 10 | - "type": "number", | |
| 11 | - "minimum": 0.5, | |
| 12 | - "maximum": 99.5 | |
| 9 | + "reqZeroMin": { | |
| 10 | + "type": "integer", | |
| 11 | + "minimum": 0, | |
| 12 | + "maximum": 100 | |
| 13 | 13 | }, |
| 14 | 14 | "optInt": { |
| 15 | 15 | "type": "integer", |
| 16 | 16 | "minimum": 0, |
| 17 | 17 | "maximum": 100 |
| 18 | 18 | }, |
| 19 | - "optPattern": { | |
| 20 | - "type": "string", | |
| 21 | - "pattern": "^[a-z]+$" | |
| 19 | + "optDouble": { | |
| 20 | + "type": "number", | |
| 21 | + "minimum": 0.5, | |
| 22 | + "maximum": 99.5 | |
| 22 | 23 | }, |
| 23 | 24 | "optString": { |
| 24 | 25 | "type": "string", |
| 25 | 26 | "minLength": 3, |
| 26 | 27 | "maxLength": 10 |
| 27 | 28 | }, |
| 28 | - "reqZeroMin": { | |
| 29 | - "type": "integer", | |
| 30 | - "minimum": 0, | |
| 31 | - "maximum": 100 | |
| 29 | + "optPattern": { | |
| 30 | + "type": "string", | |
| 31 | + "pattern": "^[a-z]+$" | |
| 32 | 32 | } |
| 33 | 33 | }, |
| 34 | 34 | "required": [ |
Mschema-swiftdefault / quicktype.swift+12 −12
| @@ -7,18 +7,18 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | - let optDouble: Double? | |
| 10 | + let reqZeroMin: Int | |
| 11 | 11 | let optInt: Int? |
| 12 | - let optPattern: String? | |
| 12 | + let optDouble: Double? | |
| 13 | 13 | let optString: String? |
| 14 | - let reqZeroMin: Int | |
| 14 | + let optPattern: String? | |
| 15 | 15 | |
| 16 | 16 | enum CodingKeys: String, CodingKey { |
| 17 | - case optDouble = "optDouble" | |
| 17 | + case reqZeroMin = "reqZeroMin" | |
| 18 | 18 | case optInt = "optInt" |
| 19 | - case optPattern = "optPattern" | |
| 19 | + case optDouble = "optDouble" | |
| 20 | 20 | case optString = "optString" |
| 21 | - case reqZeroMin = "reqZeroMin" | |
| 21 | + case optPattern = "optPattern" | |
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
| @@ -41,18 +41,18 @@ extension TopLevel { | ||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | func with( |
| 44 | - optDouble: Double?? = nil, | |
| 44 | + reqZeroMin: Int? = nil, | |
| 45 | 45 | optInt: Int?? = nil, |
| 46 | - optPattern: String?? = nil, | |
| 46 | + optDouble: Double?? = nil, | |
| 47 | 47 | optString: String?? = nil, |
| 48 | - reqZeroMin: Int? = nil | |
| 48 | + optPattern: String?? = nil | |
| 49 | 49 | ) -> TopLevel { |
| 50 | 50 | return TopLevel( |
| 51 | - optDouble: optDouble ?? self.optDouble, | |
| 51 | + reqZeroMin: reqZeroMin ?? self.reqZeroMin, | |
| 52 | 52 | optInt: optInt ?? self.optInt, |
| 53 | - optPattern: optPattern ?? self.optPattern, | |
| 53 | + optDouble: optDouble ?? self.optDouble, | |
| 54 | 54 | optString: optString ?? self.optString, |
| 55 | - reqZeroMin: reqZeroMin ?? self.reqZeroMin | |
| 55 | + optPattern: optPattern ?? self.optPattern | |
| 56 | 56 | ) |
| 57 | 57 | } |
Mschema-typescript-zoddefault / TopLevel.ts+3 −3
| @@ -2,10 +2,10 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "optDouble": z.number().optional(), | |
| 5 | + "reqZeroMin": z.number(), | |
| 6 | 6 | "optInt": z.number().optional(), |
| 7 | - "optPattern": z.string().optional(), | |
| 7 | + "optDouble": z.number().optional(), | |
| 8 | 8 | "optString": z.string().optional(), |
| 9 | - "reqZeroMin": z.number(), | |
| 9 | + "optPattern": z.string().optional(), | |
| 10 | 10 | }); |
| 11 | 11 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+6 −6
| @@ -8,11 +8,11 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - optDouble?: number; | |
| 11 | + reqZeroMin: number; | |
| 12 | 12 | optInt?: number; |
| 13 | - optPattern?: string; | |
| 13 | + optDouble?: number; | |
| 14 | 14 | optString?: string; |
| 15 | - reqZeroMin: number; | |
| 15 | + optPattern?: string; | |
| 16 | 16 | [property: string]: unknown; |
| 17 | 17 | } |
| 18 | 18 | |
| @@ -183,10 +183,10 @@ function r(name: string) { | ||
| 183 | 183 | |
| 184 | 184 | const typeMap: any = { |
| 185 | 185 | "TopLevel": o([ |
| 186 | - { json: "optDouble", js: "optDouble", typ: u(undefined, 3.14) }, | |
| 186 | + { json: "reqZeroMin", js: "reqZeroMin", typ: 0 }, | |
| 187 | 187 | { json: "optInt", js: "optInt", typ: u(undefined, 0) }, |
| 188 | - { json: "optPattern", js: "optPattern", typ: u(undefined, "") }, | |
| 188 | + { json: "optDouble", js: "optDouble", typ: u(undefined, 3.14) }, | |
| 189 | 189 | { json: "optString", js: "optString", typ: u(undefined, "") }, |
| 190 | - { json: "reqZeroMin", js: "reqZeroMin", typ: 0 }, | |
| 190 | + { json: "optPattern", js: "optPattern", typ: u(undefined, "") }, | |
| 191 | 191 | ], "any"), |
| 192 | 192 | }; |
Test case
30 generated files · +566 −566test/inputs/schema/optional-date-time.schema
Mschema-cjsondefault / TopLevel.c+39 −39
| @@ -22,15 +22,6 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 22 | 22 | if (NULL != j) { |
| 23 | 23 | if (NULL != (x = cJSON_malloc(sizeof(struct TopLevel)))) { |
| 24 | 24 | memset(x, 0, sizeof(struct TopLevel)); |
| 25 | - if (cJSON_HasObjectItem(j, "optional-date")) { | |
| 26 | - x->optional_date = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "optional-date"))); | |
| 27 | - } | |
| 28 | - if (cJSON_HasObjectItem(j, "optional-date-time")) { | |
| 29 | - x->optional_date_time = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "optional-date-time"))); | |
| 30 | - } | |
| 31 | - if (cJSON_HasObjectItem(j, "optional-time")) { | |
| 32 | - x->optional_time = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "optional-time"))); | |
| 33 | - } | |
| 34 | 25 | if (cJSON_HasObjectItem(j, "required-date")) { |
| 35 | 26 | x->required_date = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "required-date"))); |
| 36 | 27 | } |
| @@ -39,6 +30,14 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 39 | 30 | x->required_date[0] = '\0'; |
| 40 | 31 | } |
| 41 | 32 | } |
| 33 | + if (cJSON_HasObjectItem(j, "required-time")) { | |
| 34 | + x->required_time = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "required-time"))); | |
| 35 | + } | |
| 36 | + else { | |
| 37 | + if (NULL != (x->required_time = cJSON_malloc(sizeof(char)))) { | |
| 38 | + x->required_time[0] = '\0'; | |
| 39 | + } | |
| 40 | + } | |
| 42 | 41 | if (cJSON_HasObjectItem(j, "required-date-time")) { |
| 43 | 42 | x->required_date_time = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "required-date-time"))); |
| 44 | 43 | } |
| @@ -47,13 +46,14 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 47 | 46 | x->required_date_time[0] = '\0'; |
| 48 | 47 | } |
| 49 | 48 | } |
| 50 | - if (cJSON_HasObjectItem(j, "required-time")) { | |
| 51 | - x->required_time = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "required-time"))); | |
| 49 | + if (cJSON_HasObjectItem(j, "optional-date")) { | |
| 50 | + x->optional_date = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "optional-date"))); | |
| 52 | 51 | } |
| 53 | - else { | |
| 54 | - if (NULL != (x->required_time = cJSON_malloc(sizeof(char)))) { | |
| 55 | - x->required_time[0] = '\0'; | |
| 56 | - } | |
| 52 | + if (cJSON_HasObjectItem(j, "optional-time")) { | |
| 53 | + x->optional_time = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "optional-time"))); | |
| 54 | + } | |
| 55 | + if (cJSON_HasObjectItem(j, "optional-date-time")) { | |
| 56 | + x->optional_date_time = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "optional-date-time"))); | |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | } |
| @@ -64,32 +64,32 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 64 | 64 | cJSON * j = NULL; |
| 65 | 65 | if (NULL != x) { |
| 66 | 66 | if (NULL != (j = cJSON_CreateObject())) { |
| 67 | - if (NULL != x->optional_date) { | |
| 68 | - cJSON_AddStringToObject(j, "optional-date", x->optional_date); | |
| 69 | - } | |
| 70 | - if (NULL != x->optional_date_time) { | |
| 71 | - cJSON_AddStringToObject(j, "optional-date-time", x->optional_date_time); | |
| 72 | - } | |
| 73 | - if (NULL != x->optional_time) { | |
| 74 | - cJSON_AddStringToObject(j, "optional-time", x->optional_time); | |
| 75 | - } | |
| 76 | 67 | if (NULL != x->required_date) { |
| 77 | 68 | cJSON_AddStringToObject(j, "required-date", x->required_date); |
| 78 | 69 | } |
| 79 | 70 | else { |
| 80 | 71 | cJSON_AddStringToObject(j, "required-date", ""); |
| 81 | 72 | } |
| 73 | + if (NULL != x->required_time) { | |
| 74 | + cJSON_AddStringToObject(j, "required-time", x->required_time); | |
| 75 | + } | |
| 76 | + else { | |
| 77 | + cJSON_AddStringToObject(j, "required-time", ""); | |
| 78 | + } | |
| 82 | 79 | if (NULL != x->required_date_time) { |
| 83 | 80 | cJSON_AddStringToObject(j, "required-date-time", x->required_date_time); |
| 84 | 81 | } |
| 85 | 82 | else { |
| 86 | 83 | cJSON_AddStringToObject(j, "required-date-time", ""); |
| 87 | 84 | } |
| 88 | - if (NULL != x->required_time) { | |
| 89 | - cJSON_AddStringToObject(j, "required-time", x->required_time); | |
| 85 | + if (NULL != x->optional_date) { | |
| 86 | + cJSON_AddStringToObject(j, "optional-date", x->optional_date); | |
| 90 | 87 | } |
| 91 | - else { | |
| 92 | - cJSON_AddStringToObject(j, "required-time", ""); | |
| 88 | + if (NULL != x->optional_time) { | |
| 89 | + cJSON_AddStringToObject(j, "optional-time", x->optional_time); | |
| 90 | + } | |
| 91 | + if (NULL != x->optional_date_time) { | |
| 92 | + cJSON_AddStringToObject(j, "optional-date-time", x->optional_date_time); | |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | } |
| @@ -110,23 +110,23 @@ char * cJSON_PrintTopLevel(const struct TopLevel * x) { | ||
| 110 | 110 | |
| 111 | 111 | void cJSON_DeleteTopLevel(struct TopLevel * x) { |
| 112 | 112 | if (NULL != x) { |
| 113 | - if (NULL != x->optional_date) { | |
| 114 | - cJSON_free(x->optional_date); | |
| 115 | - } | |
| 116 | - if (NULL != x->optional_date_time) { | |
| 117 | - cJSON_free(x->optional_date_time); | |
| 118 | - } | |
| 119 | - if (NULL != x->optional_time) { | |
| 120 | - cJSON_free(x->optional_time); | |
| 121 | - } | |
| 122 | 113 | if (NULL != x->required_date) { |
| 123 | 114 | cJSON_free(x->required_date); |
| 124 | 115 | } |
| 116 | + if (NULL != x->required_time) { | |
| 117 | + cJSON_free(x->required_time); | |
| 118 | + } | |
| 125 | 119 | if (NULL != x->required_date_time) { |
| 126 | 120 | cJSON_free(x->required_date_time); |
| 127 | 121 | } |
| 128 | - if (NULL != x->required_time) { | |
| 129 | - cJSON_free(x->required_time); | |
| 122 | + if (NULL != x->optional_date) { | |
| 123 | + cJSON_free(x->optional_date); | |
| 124 | + } | |
| 125 | + if (NULL != x->optional_time) { | |
| 126 | + cJSON_free(x->optional_time); | |
| 127 | + } | |
| 128 | + if (NULL != x->optional_date_time) { | |
| 129 | + cJSON_free(x->optional_date_time); | |
| 130 | 130 | } |
| 131 | 131 | cJSON_free(x); |
| 132 | 132 | } |
Mschema-cjsondefault / TopLevel.h+4 −4
| @@ -35,12 +35,12 @@ extern "C" { | ||
| 35 | 35 | #endif |
| 36 | 36 | |
| 37 | 37 | struct TopLevel { |
| 38 | - char * optional_date; | |
| 39 | - char * optional_date_time; | |
| 40 | - char * optional_time; | |
| 41 | 38 | char * required_date; |
| 42 | - char * required_date_time; | |
| 43 | 39 | char * required_time; |
| 40 | + char * required_date_time; | |
| 41 | + char * optional_date; | |
| 42 | + char * optional_time; | |
| 43 | + char * optional_date_time; | |
| 44 | 44 | }; |
| 45 | 45 | |
| 46 | 46 | struct TopLevel * cJSON_ParseTopLevel(const char * s); |
Mschema-cplusplusdefault / quicktype.hpp+27 −27
| @@ -94,37 +94,37 @@ namespace quicktype { | ||
| 94 | 94 | virtual ~TopLevel() = default; |
| 95 | 95 | |
| 96 | 96 | private: |
| 97 | - std::optional<std::string> optional_date; | |
| 98 | - std::optional<std::string> optional_date_time; | |
| 99 | - std::optional<std::string> optional_time; | |
| 100 | 97 | std::string required_date; |
| 101 | - std::string required_date_time; | |
| 102 | 98 | std::string required_time; |
| 99 | + std::string required_date_time; | |
| 100 | + std::optional<std::string> optional_date; | |
| 101 | + std::optional<std::string> optional_time; | |
| 102 | + std::optional<std::string> optional_date_time; | |
| 103 | 103 | |
| 104 | 104 | public: |
| 105 | - const std::optional<std::string> & get_optional_date() const { return optional_date; } | |
| 106 | - std::optional<std::string> & get_mutable_optional_date() { return optional_date; } | |
| 107 | - void set_optional_date(const std::optional<std::string> & value) { this->optional_date = value; } | |
| 108 | - | |
| 109 | - const std::optional<std::string> & get_optional_date_time() const { return optional_date_time; } | |
| 110 | - std::optional<std::string> & get_mutable_optional_date_time() { return optional_date_time; } | |
| 111 | - void set_optional_date_time(const std::optional<std::string> & value) { this->optional_date_time = value; } | |
| 112 | - | |
| 113 | - const std::optional<std::string> & get_optional_time() const { return optional_time; } | |
| 114 | - std::optional<std::string> & get_mutable_optional_time() { return optional_time; } | |
| 115 | - void set_optional_time(const std::optional<std::string> & value) { this->optional_time = value; } | |
| 116 | - | |
| 117 | 105 | const std::string & get_required_date() const { return required_date; } |
| 118 | 106 | std::string & get_mutable_required_date() { return required_date; } |
| 119 | 107 | void set_required_date(const std::string & value) { this->required_date = value; } |
| 120 | 108 | |
| 109 | + const std::string & get_required_time() const { return required_time; } | |
| 110 | + std::string & get_mutable_required_time() { return required_time; } | |
| 111 | + void set_required_time(const std::string & value) { this->required_time = value; } | |
| 112 | + | |
| 121 | 113 | const std::string & get_required_date_time() const { return required_date_time; } |
| 122 | 114 | std::string & get_mutable_required_date_time() { return required_date_time; } |
| 123 | 115 | void set_required_date_time(const std::string & value) { this->required_date_time = value; } |
| 124 | 116 | |
| 125 | - const std::string & get_required_time() const { return required_time; } | |
| 126 | - std::string & get_mutable_required_time() { return required_time; } | |
| 127 | - void set_required_time(const std::string & value) { this->required_time = value; } | |
| 117 | + const std::optional<std::string> & get_optional_date() const { return optional_date; } | |
| 118 | + std::optional<std::string> & get_mutable_optional_date() { return optional_date; } | |
| 119 | + void set_optional_date(const std::optional<std::string> & value) { this->optional_date = value; } | |
| 120 | + | |
| 121 | + const std::optional<std::string> & get_optional_time() const { return optional_time; } | |
| 122 | + std::optional<std::string> & get_mutable_optional_time() { return optional_time; } | |
| 123 | + void set_optional_time(const std::optional<std::string> & value) { this->optional_time = value; } | |
| 124 | + | |
| 125 | + const std::optional<std::string> & get_optional_date_time() const { return optional_date_time; } | |
| 126 | + std::optional<std::string> & get_mutable_optional_date_time() { return optional_date_time; } | |
| 127 | + void set_optional_date_time(const std::optional<std::string> & value) { this->optional_date_time = value; } | |
| 128 | 128 | }; |
| 129 | 129 | } |
| 130 | 130 | |
| @@ -133,21 +133,21 @@ namespace quicktype { | ||
| 133 | 133 | void to_json(json & j, const TopLevel & x); |
| 134 | 134 | |
| 135 | 135 | inline void from_json(const json & j, TopLevel& x) { |
| 136 | - x.set_optional_date(get_stack_optional<std::string>(j, "optional-date")); | |
| 137 | - x.set_optional_date_time(get_stack_optional<std::string>(j, "optional-date-time")); | |
| 138 | - x.set_optional_time(get_stack_optional<std::string>(j, "optional-time")); | |
| 139 | 136 | x.set_required_date(j.at("required-date").get<std::string>()); |
| 140 | - x.set_required_date_time(j.at("required-date-time").get<std::string>()); | |
| 141 | 137 | x.set_required_time(j.at("required-time").get<std::string>()); |
| 138 | + x.set_required_date_time(j.at("required-date-time").get<std::string>()); | |
| 139 | + x.set_optional_date(get_stack_optional<std::string>(j, "optional-date")); | |
| 140 | + x.set_optional_time(get_stack_optional<std::string>(j, "optional-time")); | |
| 141 | + x.set_optional_date_time(get_stack_optional<std::string>(j, "optional-date-time")); | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | inline void to_json(json & j, const TopLevel & x) { |
| 145 | 145 | j = json::object(); |
| 146 | - j["optional-date"] = x.get_optional_date(); | |
| 147 | - j["optional-date-time"] = x.get_optional_date_time(); | |
| 148 | - j["optional-time"] = x.get_optional_time(); | |
| 149 | 146 | j["required-date"] = x.get_required_date(); |
| 150 | - j["required-date-time"] = x.get_required_date_time(); | |
| 151 | 147 | j["required-time"] = x.get_required_time(); |
| 148 | + j["required-date-time"] = x.get_required_date_time(); | |
| 149 | + j["optional-date"] = x.get_optional_date(); | |
| 150 | + j["optional-time"] = x.get_optional_time(); | |
| 151 | + j["optional-date-time"] = x.get_optional_date_time(); | |
| 152 | 152 | } |
| 153 | 153 | } |
Mschema-csharp-recordsdefault / QuickType.cs+11 −11
| @@ -25,23 +25,23 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("optional-date", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 29 | - public DateTimeOffset? OptionalDate { get; set; } | |
| 30 | - | |
| 31 | - [JsonProperty("optional-date-time", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 32 | - public DateTimeOffset? OptionalDateTime { get; set; } | |
| 33 | - | |
| 34 | - [JsonProperty("optional-time", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 35 | - public DateTimeOffset? OptionalTime { get; set; } | |
| 36 | - | |
| 37 | 28 | [JsonProperty("required-date", Required = Required.Always)] |
| 38 | 29 | public DateTimeOffset RequiredDate { get; set; } |
| 39 | 30 | |
| 31 | + [JsonProperty("required-time", Required = Required.Always)] | |
| 32 | + public DateTimeOffset RequiredTime { get; set; } | |
| 33 | + | |
| 40 | 34 | [JsonProperty("required-date-time", Required = Required.Always)] |
| 41 | 35 | public DateTimeOffset RequiredDateTime { get; set; } |
| 42 | 36 | |
| 43 | - [JsonProperty("required-time", Required = Required.Always)] | |
| 44 | - public DateTimeOffset RequiredTime { get; set; } | |
| 37 | + [JsonProperty("optional-date", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 38 | + public DateTimeOffset? OptionalDate { get; set; } | |
| 39 | + | |
| 40 | + [JsonProperty("optional-time", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 41 | + public DateTimeOffset? OptionalTime { get; set; } | |
| 42 | + | |
| 43 | + [JsonProperty("optional-date-time", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 44 | + public DateTimeOffset? OptionalDateTime { get; set; } | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public partial record TopLevel |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+15 −15
| @@ -22,29 +22,29 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 26 | - [JsonPropertyName("optional-date")] | |
| 27 | - public DateTimeOffset? OptionalDate { get; set; } | |
| 28 | - | |
| 29 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 30 | - [JsonPropertyName("optional-date-time")] | |
| 31 | - public DateTimeOffset? OptionalDateTime { get; set; } | |
| 32 | - | |
| 33 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 34 | - [JsonPropertyName("optional-time")] | |
| 35 | - public DateTimeOffset? OptionalTime { get; set; } | |
| 36 | - | |
| 37 | 25 | [JsonRequired] |
| 38 | 26 | [JsonPropertyName("required-date")] |
| 39 | 27 | public DateTimeOffset RequiredDate { get; set; } |
| 40 | 28 | |
| 29 | + [JsonRequired] | |
| 30 | + [JsonPropertyName("required-time")] | |
| 31 | + public DateTimeOffset RequiredTime { get; set; } | |
| 32 | + | |
| 41 | 33 | [JsonRequired] |
| 42 | 34 | [JsonPropertyName("required-date-time")] |
| 43 | 35 | public DateTimeOffset RequiredDateTime { get; set; } |
| 44 | 36 | |
| 45 | - [JsonRequired] | |
| 46 | - [JsonPropertyName("required-time")] | |
| 47 | - public DateTimeOffset RequiredTime { get; set; } | |
| 37 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 38 | + [JsonPropertyName("optional-date")] | |
| 39 | + public DateTimeOffset? OptionalDate { get; set; } | |
| 40 | + | |
| 41 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 42 | + [JsonPropertyName("optional-time")] | |
| 43 | + public DateTimeOffset? OptionalTime { get; set; } | |
| 44 | + | |
| 45 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 46 | + [JsonPropertyName("optional-date-time")] | |
| 47 | + public DateTimeOffset? OptionalDateTime { get; set; } | |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public partial class TopLevel |
Mschema-csharpdefault / QuickType.cs+11 −11
| @@ -25,23 +25,23 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("optional-date", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 29 | - public DateTimeOffset? OptionalDate { get; set; } | |
| 30 | - | |
| 31 | - [JsonProperty("optional-date-time", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 32 | - public DateTimeOffset? OptionalDateTime { get; set; } | |
| 33 | - | |
| 34 | - [JsonProperty("optional-time", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 35 | - public DateTimeOffset? OptionalTime { get; set; } | |
| 36 | - | |
| 37 | 28 | [JsonProperty("required-date", Required = Required.Always)] |
| 38 | 29 | public DateTimeOffset RequiredDate { get; set; } |
| 39 | 30 | |
| 31 | + [JsonProperty("required-time", Required = Required.Always)] | |
| 32 | + public DateTimeOffset RequiredTime { get; set; } | |
| 33 | + | |
| 40 | 34 | [JsonProperty("required-date-time", Required = Required.Always)] |
| 41 | 35 | public DateTimeOffset RequiredDateTime { get; set; } |
| 42 | 36 | |
| 43 | - [JsonProperty("required-time", Required = Required.Always)] | |
| 44 | - public DateTimeOffset RequiredTime { get; set; } | |
| 37 | + [JsonProperty("optional-date", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 38 | + public DateTimeOffset? OptionalDate { get; set; } | |
| 39 | + | |
| 40 | + [JsonProperty("optional-time", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 41 | + public DateTimeOffset? OptionalTime { get; set; } | |
| 42 | + | |
| 43 | + [JsonProperty("optional-date-time", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 44 | + public DateTimeOffset? OptionalDateTime { get; set; } | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public partial class TopLevel |
Mschema-dartdefault / TopLevel.dart+16 −16
| @@ -9,37 +9,37 @@ TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | ||
| 9 | 9 | String topLevelToJson(TopLevel data) => json.encode(data.toJson()); |
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | - final DateTime? optionalDate; | |
| 13 | - final DateTime? optionalDateTime; | |
| 14 | - final String? optionalTime; | |
| 15 | 12 | final DateTime requiredDate; |
| 16 | - final DateTime requiredDateTime; | |
| 17 | 13 | final String requiredTime; |
| 14 | + final DateTime requiredDateTime; | |
| 15 | + final DateTime? optionalDate; | |
| 16 | + final String? optionalTime; | |
| 17 | + final DateTime? optionalDateTime; | |
| 18 | 18 | |
| 19 | 19 | TopLevel({ |
| 20 | - this.optionalDate, | |
| 21 | - this.optionalDateTime, | |
| 22 | - this.optionalTime, | |
| 23 | 20 | required this.requiredDate, |
| 24 | - required this.requiredDateTime, | |
| 25 | 21 | required this.requiredTime, |
| 22 | + required this.requiredDateTime, | |
| 23 | + this.optionalDate, | |
| 24 | + this.optionalTime, | |
| 25 | + this.optionalDateTime, | |
| 26 | 26 | }); |
| 27 | 27 | |
| 28 | 28 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 29 | - optionalDate: json["optional-date"] == null ? null : DateTime.parse(json["optional-date"]), | |
| 30 | - optionalDateTime: json["optional-date-time"] == null ? null : DateTime.parse(json["optional-date-time"]), | |
| 31 | - optionalTime: json["optional-time"], | |
| 32 | 29 | requiredDate: DateTime.parse(json["required-date"]), |
| 33 | - requiredDateTime: DateTime.parse(json["required-date-time"]), | |
| 34 | 30 | requiredTime: json["required-time"], |
| 31 | + requiredDateTime: DateTime.parse(json["required-date-time"]), | |
| 32 | + optionalDate: json["optional-date"] == null ? null : DateTime.parse(json["optional-date"]), | |
| 33 | + optionalTime: json["optional-time"], | |
| 34 | + optionalDateTime: json["optional-date-time"] == null ? null : DateTime.parse(json["optional-date-time"]), | |
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | Map<String, dynamic> toJson() => { |
| 38 | - "optional-date": optionalDate == null ? null : "${optionalDate!.year.toString().padLeft(4, '0')}-${optionalDate!.month.toString().padLeft(2, '0')}-${optionalDate!.day.toString().padLeft(2, '0')}", | |
| 39 | - "optional-date-time": optionalDateTime?.toIso8601String(), | |
| 40 | - "optional-time": optionalTime, | |
| 41 | 38 | "required-date": "${requiredDate.year.toString().padLeft(4, '0')}-${requiredDate.month.toString().padLeft(2, '0')}-${requiredDate.day.toString().padLeft(2, '0')}", |
| 42 | - "required-date-time": requiredDateTime.toIso8601String(), | |
| 43 | 39 | "required-time": requiredTime, |
| 40 | + "required-date-time": requiredDateTime.toIso8601String(), | |
| 41 | + "optional-date": optionalDate == null ? null : "${optionalDate!.year.toString().padLeft(4, '0')}-${optionalDate!.month.toString().padLeft(2, '0')}-${optionalDate!.day.toString().padLeft(2, '0')}", | |
| 42 | + "optional-time": optionalTime, | |
| 43 | + "optional-date-time": optionalDateTime?.toIso8601String(), | |
| 44 | 44 | }; |
| 45 | 45 | } |
Mschema-elixirdefault / QuickType.ex+14 −14
| @@ -6,26 +6,26 @@ | ||
| 6 | 6 | # Encode into a JSON string: TopLevel.to_json(struct) |
| 7 | 7 | |
| 8 | 8 | defmodule TopLevel do |
| 9 | - @enforce_keys [:required_date, :required_date_time, :required_time] | |
| 10 | - defstruct [:optional_date, :optional_date_time, :optional_time, :required_date, :required_date_time, :required_time] | |
| 9 | + @enforce_keys [:required_date, :required_time, :required_date_time] | |
| 10 | + defstruct [:required_date, :required_time, :required_date_time, :optional_date, :optional_time, :optional_date_time] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | - optional_date: String.t() | nil, | |
| 14 | - optional_date_time: String.t() | nil, | |
| 15 | - optional_time: String.t() | nil, | |
| 16 | 13 | required_date: String.t(), |
| 14 | + required_time: String.t(), | |
| 17 | 15 | required_date_time: String.t(), |
| 18 | - required_time: String.t() | |
| 16 | + optional_date: String.t() | nil, | |
| 17 | + optional_time: String.t() | nil, | |
| 18 | + optional_date_time: String.t() | nil | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | def from_map(m) do |
| 22 | 22 | %TopLevel{ |
| 23 | - optional_date: m["optional-date"], | |
| 24 | - optional_date_time: m["optional-date-time"], | |
| 25 | - optional_time: m["optional-time"], | |
| 26 | 23 | required_date: m["required-date"], |
| 27 | - required_date_time: m["required-date-time"], | |
| 28 | 24 | required_time: m["required-time"], |
| 25 | + required_date_time: m["required-date-time"], | |
| 26 | + optional_date: m["optional-date"], | |
| 27 | + optional_time: m["optional-time"], | |
| 28 | + optional_date_time: m["optional-date-time"], | |
| 29 | 29 | } |
| 30 | 30 | end |
| 31 | 31 | |
| @@ -37,12 +37,12 @@ defmodule TopLevel do | ||
| 37 | 37 | |
| 38 | 38 | def to_map(struct) do |
| 39 | 39 | %{ |
| 40 | - "optional-date" => struct.optional_date, | |
| 41 | - "optional-date-time" => struct.optional_date_time, | |
| 42 | - "optional-time" => struct.optional_time, | |
| 43 | 40 | "required-date" => struct.required_date, |
| 44 | - "required-date-time" => struct.required_date_time, | |
| 45 | 41 | "required-time" => struct.required_time, |
| 42 | + "required-date-time" => struct.required_date_time, | |
| 43 | + "optional-date" => struct.optional_date, | |
| 44 | + "optional-time" => struct.optional_time, | |
| 45 | + "optional-date-time" => struct.optional_date_time, | |
| 46 | 46 | } |
| 47 | 47 | end |
Mschema-elmdefault / QuickType.elm+14 −14
| @@ -23,12 +23,12 @@ import Json.Encode as Jenc | ||
| 23 | 23 | import Dict exposing (Dict) |
| 24 | 24 | |
| 25 | 25 | type alias QuickType = |
| 26 | - { optionalDate : Maybe String | |
| 27 | - , optionalDateTime : Maybe String | |
| 28 | - , optionalTime : Maybe String | |
| 29 | - , requiredDate : String | |
| 30 | - , requiredDateTime : String | |
| 26 | + { requiredDate : String | |
| 31 | 27 | , requiredTime : String |
| 28 | + , requiredDateTime : String | |
| 29 | + , optionalDate : Maybe String | |
| 30 | + , optionalTime : Maybe String | |
| 31 | + , optionalDateTime : Maybe String | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | -- decoders and encoders |
| @@ -39,22 +39,22 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 39 | 39 | quickType : Jdec.Decoder QuickType |
| 40 | 40 | quickType = |
| 41 | 41 | Jdec.succeed QuickType |
| 42 | - |> Jpipe.optional "optional-date" (Jdec.nullable Jdec.string) Nothing | |
| 43 | - |> Jpipe.optional "optional-date-time" (Jdec.nullable Jdec.string) Nothing | |
| 44 | - |> Jpipe.optional "optional-time" (Jdec.nullable Jdec.string) Nothing | |
| 45 | 42 | |> Jpipe.required "required-date" Jdec.string |
| 46 | - |> Jpipe.required "required-date-time" Jdec.string | |
| 47 | 43 | |> Jpipe.required "required-time" Jdec.string |
| 44 | + |> Jpipe.required "required-date-time" Jdec.string | |
| 45 | + |> Jpipe.optional "optional-date" (Jdec.nullable Jdec.string) Nothing | |
| 46 | + |> Jpipe.optional "optional-time" (Jdec.nullable Jdec.string) Nothing | |
| 47 | + |> Jpipe.optional "optional-date-time" (Jdec.nullable Jdec.string) Nothing | |
| 48 | 48 | |
| 49 | 49 | encodeQuickType : QuickType -> Jenc.Value |
| 50 | 50 | encodeQuickType x = |
| 51 | 51 | Jenc.object |
| 52 | - [ ("optional-date", makeNullableEncoder Jenc.string x.optionalDate) | |
| 53 | - , ("optional-date-time", makeNullableEncoder Jenc.string x.optionalDateTime) | |
| 54 | - , ("optional-time", makeNullableEncoder Jenc.string x.optionalTime) | |
| 55 | - , ("required-date", Jenc.string x.requiredDate) | |
| 56 | - , ("required-date-time", Jenc.string x.requiredDateTime) | |
| 52 | + [ ("required-date", Jenc.string x.requiredDate) | |
| 57 | 53 | , ("required-time", Jenc.string x.requiredTime) |
| 54 | + , ("required-date-time", Jenc.string x.requiredDateTime) | |
| 55 | + , ("optional-date", makeNullableEncoder Jenc.string x.optionalDate) | |
| 56 | + , ("optional-time", makeNullableEncoder Jenc.string x.optionalTime) | |
| 57 | + , ("optional-date-time", makeNullableEncoder Jenc.string x.optionalDateTime) | |
| 58 | 58 | ] |
| 59 | 59 | |
| 60 | 60 | --- encoder helpers |
Mschema-flowdefault / TopLevel.js+8 −8
| @@ -10,12 +10,12 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - "optional-date"?: Date; | |
| 14 | - "optional-date-time"?: Date; | |
| 15 | - "optional-time"?: string; | |
| 16 | 13 | "required-date": Date; |
| 17 | - "required-date-time": Date; | |
| 18 | 14 | "required-time": string; |
| 15 | + "required-date-time": Date; | |
| 16 | + "optional-date"?: Date; | |
| 17 | + "optional-time"?: string; | |
| 18 | + "optional-date-time"?: Date; | |
| 19 | 19 | }; |
| 20 | 20 | |
| 21 | 21 | // Converts JSON strings to/from your types |
| @@ -183,12 +183,12 @@ function r(name: string) { | ||
| 183 | 183 | |
| 184 | 184 | const typeMap: any = { |
| 185 | 185 | "TopLevel": o([ |
| 186 | - { json: "optional-date", js: "optional-date", typ: u(undefined, Date) }, | |
| 187 | - { json: "optional-date-time", js: "optional-date-time", typ: u(undefined, Date) }, | |
| 188 | - { json: "optional-time", js: "optional-time", typ: u(undefined, "") }, | |
| 189 | 186 | { json: "required-date", js: "required-date", typ: Date }, |
| 190 | - { json: "required-date-time", js: "required-date-time", typ: Date }, | |
| 191 | 187 | { json: "required-time", js: "required-time", typ: "" }, |
| 188 | + { json: "required-date-time", js: "required-date-time", typ: Date }, | |
| 189 | + { json: "optional-date", js: "optional-date", typ: u(undefined, Date) }, | |
| 190 | + { json: "optional-time", js: "optional-time", typ: u(undefined, "") }, | |
| 191 | + { json: "optional-date-time", js: "optional-date-time", typ: u(undefined, Date) }, | |
| 192 | 192 | ], false), |
| 193 | 193 | }; |
Mschema-golangdefault / quicktype.go+4 −4
| @@ -21,10 +21,10 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | type TopLevel struct { |
| 24 | - OptionalDate *string `json:"optional-date,omitempty"` | |
| 25 | - OptionalDateTime *time.Time `json:"optional-date-time,omitempty"` | |
| 26 | - OptionalTime *string `json:"optional-time,omitempty"` | |
| 27 | 24 | RequiredDate string `json:"required-date"` |
| 28 | - RequiredDateTime time.Time `json:"required-date-time"` | |
| 29 | 25 | RequiredTime string `json:"required-time"` |
| 26 | + RequiredDateTime time.Time `json:"required-date-time"` | |
| 27 | + OptionalDate *string `json:"optional-date,omitempty"` | |
| 28 | + OptionalTime *string `json:"optional-time,omitempty"` | |
| 29 | + OptionalDateTime *time.Time `json:"optional-date-time,omitempty"` | |
| 30 | 30 | } |
Mschema-haskelldefault / QuickType.hs+16 −16
| @@ -13,33 +13,33 @@ import Data.HashMap.Strict (HashMap) | ||
| 13 | 13 | import Data.Text (Text) |
| 14 | 14 | |
| 15 | 15 | data QuickType = QuickType |
| 16 | - { optionalDateQuickType :: Maybe Text | |
| 17 | - , optionalDateTimeQuickType :: Maybe Text | |
| 18 | - , optionalTimeQuickType :: Maybe Text | |
| 19 | - , requiredDateQuickType :: Text | |
| 20 | - , requiredDateTimeQuickType :: Text | |
| 16 | + { requiredDateQuickType :: Text | |
| 21 | 17 | , requiredTimeQuickType :: Text |
| 18 | + , requiredDateTimeQuickType :: Text | |
| 19 | + , optionalDateQuickType :: Maybe Text | |
| 20 | + , optionalTimeQuickType :: Maybe Text | |
| 21 | + , optionalDateTimeQuickType :: Maybe Text | |
| 22 | 22 | } deriving (Show) |
| 23 | 23 | |
| 24 | 24 | decodeTopLevel :: ByteString -> Maybe QuickType |
| 25 | 25 | decodeTopLevel = decode |
| 26 | 26 | |
| 27 | 27 | instance ToJSON QuickType where |
| 28 | - toJSON (QuickType optionalDateQuickType optionalDateTimeQuickType optionalTimeQuickType requiredDateQuickType requiredDateTimeQuickType requiredTimeQuickType) = | |
| 28 | + toJSON (QuickType requiredDateQuickType requiredTimeQuickType requiredDateTimeQuickType optionalDateQuickType optionalTimeQuickType optionalDateTimeQuickType) = | |
| 29 | 29 | object |
| 30 | - [ "optional-date" .= optionalDateQuickType | |
| 31 | - , "optional-date-time" .= optionalDateTimeQuickType | |
| 32 | - , "optional-time" .= optionalTimeQuickType | |
| 33 | - , "required-date" .= requiredDateQuickType | |
| 34 | - , "required-date-time" .= requiredDateTimeQuickType | |
| 30 | + [ "required-date" .= requiredDateQuickType | |
| 35 | 31 | , "required-time" .= requiredTimeQuickType |
| 32 | + , "required-date-time" .= requiredDateTimeQuickType | |
| 33 | + , "optional-date" .= optionalDateQuickType | |
| 34 | + , "optional-time" .= optionalTimeQuickType | |
| 35 | + , "optional-date-time" .= optionalDateTimeQuickType | |
| 36 | 36 | ] |
| 37 | 37 | |
| 38 | 38 | instance FromJSON QuickType where |
| 39 | 39 | parseJSON (Object v) = QuickType |
| 40 | - <$> v .:? "optional-date" | |
| 41 | - <*> v .:? "optional-date-time" | |
| 42 | - <*> v .:? "optional-time" | |
| 43 | - <*> v .: "required-date" | |
| 44 | - <*> v .: "required-date-time" | |
| 40 | + <$> v .: "required-date" | |
| 45 | 41 | <*> v .: "required-time" |
| 42 | + <*> v .: "required-date-time" | |
| 43 | + <*> v .:? "optional-date" | |
| 44 | + <*> v .:? "optional-time" | |
| 45 | + <*> v .:? "optional-date-time" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+29 −29
| @@ -4,33 +4,12 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.Date; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private Date optionalDate; | |
| 8 | - private Date optionalDateTime; | |
| 9 | - private Date optionalTime; | |
| 10 | 7 | private Date requiredDate; |
| 11 | - private Date requiredDateTime; | |
| 12 | 8 | private Date requiredTime; |
| 13 | - | |
| 14 | - @JsonProperty("optional-date") | |
| 15 | - @JsonFormat(pattern = "yyyy-MM-dd") | |
| 16 | - public Date getOptionalDate() { return optionalDate; } | |
| 17 | - @JsonProperty("optional-date") | |
| 18 | - @JsonFormat(pattern = "yyyy-MM-dd") | |
| 19 | - public void setOptionalDate(Date value) { this.optionalDate = value; } | |
| 20 | - | |
| 21 | - @JsonProperty("optional-date-time") | |
| 22 | - @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssX", timezone = "UTC") | |
| 23 | - public Date getOptionalDateTime() { return optionalDateTime; } | |
| 24 | - @JsonProperty("optional-date-time") | |
| 25 | - @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssX", timezone = "UTC") | |
| 26 | - public void setOptionalDateTime(Date value) { this.optionalDateTime = value; } | |
| 27 | - | |
| 28 | - @JsonProperty("optional-time") | |
| 29 | - @JsonFormat(pattern = "HH:mm:ssX", timezone = "UTC") | |
| 30 | - public Date getOptionalTime() { return optionalTime; } | |
| 31 | - @JsonProperty("optional-time") | |
| 32 | - @JsonFormat(pattern = "HH:mm:ssX", timezone = "UTC") | |
| 33 | - public void setOptionalTime(Date value) { this.optionalTime = value; } | |
| 9 | + private Date requiredDateTime; | |
| 10 | + private Date optionalDate; | |
| 11 | + private Date optionalTime; | |
| 12 | + private Date optionalDateTime; | |
| 34 | 13 | |
| 35 | 14 | @JsonProperty("required-date") |
| 36 | 15 | @JsonFormat(pattern = "yyyy-MM-dd") |
| @@ -39,6 +18,13 @@ public class TopLevel { | ||
| 39 | 18 | @JsonFormat(pattern = "yyyy-MM-dd") |
| 40 | 19 | public void setRequiredDate(Date value) { this.requiredDate = value; } |
| 41 | 20 | |
| 21 | + @JsonProperty("required-time") | |
| 22 | + @JsonFormat(pattern = "HH:mm:ssX", timezone = "UTC") | |
| 23 | + public Date getRequiredTime() { return requiredTime; } | |
| 24 | + @JsonProperty("required-time") | |
| 25 | + @JsonFormat(pattern = "HH:mm:ssX", timezone = "UTC") | |
| 26 | + public void setRequiredTime(Date value) { this.requiredTime = value; } | |
| 27 | + | |
| 42 | 28 | @JsonProperty("required-date-time") |
| 43 | 29 | @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssX", timezone = "UTC") |
| 44 | 30 | public Date getRequiredDateTime() { return requiredDateTime; } |
| @@ -46,10 +32,24 @@ public class TopLevel { | ||
| 46 | 32 | @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssX", timezone = "UTC") |
| 47 | 33 | public void setRequiredDateTime(Date value) { this.requiredDateTime = value; } |
| 48 | 34 | |
| 49 | - @JsonProperty("required-time") | |
| 35 | + @JsonProperty("optional-date") | |
| 36 | + @JsonFormat(pattern = "yyyy-MM-dd") | |
| 37 | + public Date getOptionalDate() { return optionalDate; } | |
| 38 | + @JsonProperty("optional-date") | |
| 39 | + @JsonFormat(pattern = "yyyy-MM-dd") | |
| 40 | + public void setOptionalDate(Date value) { this.optionalDate = value; } | |
| 41 | + | |
| 42 | + @JsonProperty("optional-time") | |
| 50 | 43 | @JsonFormat(pattern = "HH:mm:ssX", timezone = "UTC") |
| 51 | - public Date getRequiredTime() { return requiredTime; } | |
| 52 | - @JsonProperty("required-time") | |
| 44 | + public Date getOptionalTime() { return optionalTime; } | |
| 45 | + @JsonProperty("optional-time") | |
| 53 | 46 | @JsonFormat(pattern = "HH:mm:ssX", timezone = "UTC") |
| 54 | - public void setRequiredTime(Date value) { this.requiredTime = value; } | |
| 47 | + public void setOptionalTime(Date value) { this.optionalTime = value; } | |
| 48 | + | |
| 49 | + @JsonProperty("optional-date-time") | |
| 50 | + @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssX", timezone = "UTC") | |
| 51 | + public Date getOptionalDateTime() { return optionalDateTime; } | |
| 52 | + @JsonProperty("optional-date-time") | |
| 53 | + @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssX", timezone = "UTC") | |
| 54 | + public void setOptionalDateTime(Date value) { this.optionalDateTime = value; } | |
| 55 | 55 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+23 −23
| @@ -6,40 +6,40 @@ import java.time.OffsetDateTime; | ||
| 6 | 6 | import java.time.OffsetTime; |
| 7 | 7 | |
| 8 | 8 | public class TopLevel { |
| 9 | - private LocalDate optionalDate; | |
| 10 | - private OffsetDateTime optionalDateTime; | |
| 11 | - private OffsetTime optionalTime; | |
| 12 | 9 | private LocalDate requiredDate; |
| 13 | - private OffsetDateTime requiredDateTime; | |
| 14 | 10 | private OffsetTime requiredTime; |
| 15 | - | |
| 16 | - @JsonProperty("optional-date") | |
| 17 | - public LocalDate getOptionalDate() { return optionalDate; } | |
| 18 | - @JsonProperty("optional-date") | |
| 19 | - public void setOptionalDate(LocalDate value) { this.optionalDate = value; } | |
| 20 | - | |
| 21 | - @JsonProperty("optional-date-time") | |
| 22 | - public OffsetDateTime getOptionalDateTime() { return optionalDateTime; } | |
| 23 | - @JsonProperty("optional-date-time") | |
| 24 | - public void setOptionalDateTime(OffsetDateTime value) { this.optionalDateTime = value; } | |
| 25 | - | |
| 26 | - @JsonProperty("optional-time") | |
| 27 | - public OffsetTime getOptionalTime() { return optionalTime; } | |
| 28 | - @JsonProperty("optional-time") | |
| 29 | - public void setOptionalTime(OffsetTime value) { this.optionalTime = value; } | |
| 11 | + private OffsetDateTime requiredDateTime; | |
| 12 | + private LocalDate optionalDate; | |
| 13 | + private OffsetTime optionalTime; | |
| 14 | + private OffsetDateTime optionalDateTime; | |
| 30 | 15 | |
| 31 | 16 | @JsonProperty("required-date") |
| 32 | 17 | public LocalDate getRequiredDate() { return requiredDate; } |
| 33 | 18 | @JsonProperty("required-date") |
| 34 | 19 | public void setRequiredDate(LocalDate value) { this.requiredDate = value; } |
| 35 | 20 | |
| 21 | + @JsonProperty("required-time") | |
| 22 | + public OffsetTime getRequiredTime() { return requiredTime; } | |
| 23 | + @JsonProperty("required-time") | |
| 24 | + public void setRequiredTime(OffsetTime value) { this.requiredTime = value; } | |
| 25 | + | |
| 36 | 26 | @JsonProperty("required-date-time") |
| 37 | 27 | public OffsetDateTime getRequiredDateTime() { return requiredDateTime; } |
| 38 | 28 | @JsonProperty("required-date-time") |
| 39 | 29 | public void setRequiredDateTime(OffsetDateTime value) { this.requiredDateTime = value; } |
| 40 | 30 | |
| 41 | - @JsonProperty("required-time") | |
| 42 | - public OffsetTime getRequiredTime() { return requiredTime; } | |
| 43 | - @JsonProperty("required-time") | |
| 44 | - public void setRequiredTime(OffsetTime value) { this.requiredTime = value; } | |
| 31 | + @JsonProperty("optional-date") | |
| 32 | + public LocalDate getOptionalDate() { return optionalDate; } | |
| 33 | + @JsonProperty("optional-date") | |
| 34 | + public void setOptionalDate(LocalDate value) { this.optionalDate = value; } | |
| 35 | + | |
| 36 | + @JsonProperty("optional-time") | |
| 37 | + public OffsetTime getOptionalTime() { return optionalTime; } | |
| 38 | + @JsonProperty("optional-time") | |
| 39 | + public void setOptionalTime(OffsetTime value) { this.optionalTime = value; } | |
| 40 | + | |
| 41 | + @JsonProperty("optional-date-time") | |
| 42 | + public OffsetDateTime getOptionalDateTime() { return optionalDateTime; } | |
| 43 | + @JsonProperty("optional-date-time") | |
| 44 | + public void setOptionalDateTime(OffsetDateTime value) { this.optionalDateTime = value; } | |
| 45 | 45 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+23 −23
| @@ -6,40 +6,40 @@ import java.time.OffsetDateTime; | ||
| 6 | 6 | import java.time.OffsetTime; |
| 7 | 7 | |
| 8 | 8 | public class TopLevel { |
| 9 | - private LocalDate optionalDate; | |
| 10 | - private OffsetDateTime optionalDateTime; | |
| 11 | - private OffsetTime optionalTime; | |
| 12 | 9 | private LocalDate requiredDate; |
| 13 | - private OffsetDateTime requiredDateTime; | |
| 14 | 10 | private OffsetTime requiredTime; |
| 15 | - | |
| 16 | - @JsonProperty("optional-date") | |
| 17 | - public LocalDate getOptionalDate() { return optionalDate; } | |
| 18 | - @JsonProperty("optional-date") | |
| 19 | - public void setOptionalDate(LocalDate value) { this.optionalDate = value; } | |
| 20 | - | |
| 21 | - @JsonProperty("optional-date-time") | |
| 22 | - public OffsetDateTime getOptionalDateTime() { return optionalDateTime; } | |
| 23 | - @JsonProperty("optional-date-time") | |
| 24 | - public void setOptionalDateTime(OffsetDateTime value) { this.optionalDateTime = value; } | |
| 25 | - | |
| 26 | - @JsonProperty("optional-time") | |
| 27 | - public OffsetTime getOptionalTime() { return optionalTime; } | |
| 28 | - @JsonProperty("optional-time") | |
| 29 | - public void setOptionalTime(OffsetTime value) { this.optionalTime = value; } | |
| 11 | + private OffsetDateTime requiredDateTime; | |
| 12 | + private LocalDate optionalDate; | |
| 13 | + private OffsetTime optionalTime; | |
| 14 | + private OffsetDateTime optionalDateTime; | |
| 30 | 15 | |
| 31 | 16 | @JsonProperty("required-date") |
| 32 | 17 | public LocalDate getRequiredDate() { return requiredDate; } |
| 33 | 18 | @JsonProperty("required-date") |
| 34 | 19 | public void setRequiredDate(LocalDate value) { this.requiredDate = value; } |
| 35 | 20 | |
| 21 | + @JsonProperty("required-time") | |
| 22 | + public OffsetTime getRequiredTime() { return requiredTime; } | |
| 23 | + @JsonProperty("required-time") | |
| 24 | + public void setRequiredTime(OffsetTime value) { this.requiredTime = value; } | |
| 25 | + | |
| 36 | 26 | @JsonProperty("required-date-time") |
| 37 | 27 | public OffsetDateTime getRequiredDateTime() { return requiredDateTime; } |
| 38 | 28 | @JsonProperty("required-date-time") |
| 39 | 29 | public void setRequiredDateTime(OffsetDateTime value) { this.requiredDateTime = value; } |
| 40 | 30 | |
| 41 | - @JsonProperty("required-time") | |
| 42 | - public OffsetTime getRequiredTime() { return requiredTime; } | |
| 43 | - @JsonProperty("required-time") | |
| 44 | - public void setRequiredTime(OffsetTime value) { this.requiredTime = value; } | |
| 31 | + @JsonProperty("optional-date") | |
| 32 | + public LocalDate getOptionalDate() { return optionalDate; } | |
| 33 | + @JsonProperty("optional-date") | |
| 34 | + public void setOptionalDate(LocalDate value) { this.optionalDate = value; } | |
| 35 | + | |
| 36 | + @JsonProperty("optional-time") | |
| 37 | + public OffsetTime getOptionalTime() { return optionalTime; } | |
| 38 | + @JsonProperty("optional-time") | |
| 39 | + public void setOptionalTime(OffsetTime value) { this.optionalTime = value; } | |
| 40 | + | |
| 41 | + @JsonProperty("optional-date-time") | |
| 42 | + public OffsetDateTime getOptionalDateTime() { return optionalDateTime; } | |
| 43 | + @JsonProperty("optional-date-time") | |
| 44 | + public void setOptionalDateTime(OffsetDateTime value) { this.optionalDateTime = value; } | |
| 45 | 45 | } |
Mschema-javascriptdefault / TopLevel.js+4 −4
| @@ -172,12 +172,12 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "optional-date", js: "optional-date", typ: u(undefined, Date) }, | |
| 176 | - { json: "optional-date-time", js: "optional-date-time", typ: u(undefined, Date) }, | |
| 177 | - { json: "optional-time", js: "optional-time", typ: u(undefined, "") }, | |
| 178 | 175 | { json: "required-date", js: "required-date", typ: Date }, |
| 179 | - { json: "required-date-time", js: "required-date-time", typ: Date }, | |
| 180 | 176 | { json: "required-time", js: "required-time", typ: "" }, |
| 177 | + { json: "required-date-time", js: "required-date-time", typ: Date }, | |
| 178 | + { json: "optional-date", js: "optional-date", typ: u(undefined, Date) }, | |
| 179 | + { json: "optional-time", js: "optional-time", typ: u(undefined, "") }, | |
| 180 | + { json: "optional-date-time", js: "optional-date-time", typ: u(undefined, Date) }, | |
| 181 | 181 | ], false), |
| 182 | 182 | }; |
Mschema-kotlin-jacksondefault / TopLevel.kt+11 −11
| @@ -37,23 +37,23 @@ val mapper = jacksonObjectMapper().apply { | ||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | data class TopLevel ( |
| 40 | - @get:JsonProperty("optional-date")@field:JsonProperty("optional-date") | |
| 41 | - val optionalDate: LocalDate? = null, | |
| 42 | - | |
| 43 | - @get:JsonProperty("optional-date-time")@field:JsonProperty("optional-date-time") | |
| 44 | - val optionalDateTime: OffsetDateTime? = null, | |
| 45 | - | |
| 46 | - @get:JsonProperty("optional-time")@field:JsonProperty("optional-time") | |
| 47 | - val optionalTime: OffsetTime? = null, | |
| 48 | - | |
| 49 | 40 | @get:JsonProperty("required-date", required=true)@field:JsonProperty("required-date", required=true) |
| 50 | 41 | val requiredDate: LocalDate, |
| 51 | 42 | |
| 43 | + @get:JsonProperty("required-time", required=true)@field:JsonProperty("required-time", required=true) | |
| 44 | + val requiredTime: OffsetTime, | |
| 45 | + | |
| 52 | 46 | @get:JsonProperty("required-date-time", required=true)@field:JsonProperty("required-date-time", required=true) |
| 53 | 47 | val requiredDateTime: OffsetDateTime, |
| 54 | 48 | |
| 55 | - @get:JsonProperty("required-time", required=true)@field:JsonProperty("required-time", required=true) | |
| 56 | - val requiredTime: OffsetTime | |
| 49 | + @get:JsonProperty("optional-date")@field:JsonProperty("optional-date") | |
| 50 | + val optionalDate: LocalDate? = null, | |
| 51 | + | |
| 52 | + @get:JsonProperty("optional-time")@field:JsonProperty("optional-time") | |
| 53 | + val optionalTime: OffsetTime? = null, | |
| 54 | + | |
| 55 | + @get:JsonProperty("optional-date-time")@field:JsonProperty("optional-date-time") | |
| 56 | + val optionalDateTime: OffsetDateTime? = null | |
| 57 | 57 | ) { |
| 58 | 58 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+11 −11
| @@ -24,23 +24,23 @@ private val klaxon = Klaxon() | ||
| 24 | 24 | .convert(OffsetTime::class, { OffsetTime.parse(it.string!!) }, { "\"${java.time.format.DateTimeFormatter.ISO_OFFSET_TIME.format(it)}\"" }) |
| 25 | 25 | |
| 26 | 26 | data class TopLevel ( |
| 27 | - @Json(name = "optional-date") | |
| 28 | - val optionalDate: LocalDate? = null, | |
| 29 | - | |
| 30 | - @Json(name = "optional-date-time") | |
| 31 | - val optionalDateTime: OffsetDateTime? = null, | |
| 32 | - | |
| 33 | - @Json(name = "optional-time") | |
| 34 | - val optionalTime: OffsetTime? = null, | |
| 35 | - | |
| 36 | 27 | @Json(name = "required-date") |
| 37 | 28 | val requiredDate: LocalDate, |
| 38 | 29 | |
| 30 | + @Json(name = "required-time") | |
| 31 | + val requiredTime: OffsetTime, | |
| 32 | + | |
| 39 | 33 | @Json(name = "required-date-time") |
| 40 | 34 | val requiredDateTime: OffsetDateTime, |
| 41 | 35 | |
| 42 | - @Json(name = "required-time") | |
| 43 | - val requiredTime: OffsetTime | |
| 36 | + @Json(name = "optional-date") | |
| 37 | + val optionalDate: LocalDate? = null, | |
| 38 | + | |
| 39 | + @Json(name = "optional-time") | |
| 40 | + val optionalTime: OffsetTime? = null, | |
| 41 | + | |
| 42 | + @Json(name = "optional-date-time") | |
| 43 | + val optionalDateTime: OffsetDateTime? = null | |
| 44 | 44 | ) { |
| 45 | 45 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-kotlinxdefault / TopLevel.kt+11 −11
| @@ -18,23 +18,23 @@ import kotlinx.serialization.encoding.* | ||
| 18 | 18 | |
| 19 | 19 | @Serializable |
| 20 | 20 | data class TopLevel ( |
| 21 | - @SerialName("optional-date") | |
| 22 | - val optionalDate: LocalDate? = null, | |
| 23 | - | |
| 24 | - @SerialName("optional-date-time") | |
| 25 | - val optionalDateTime: OffsetDateTime? = null, | |
| 26 | - | |
| 27 | - @SerialName("optional-time") | |
| 28 | - val optionalTime: OffsetTime? = null, | |
| 29 | - | |
| 30 | 21 | @SerialName("required-date") |
| 31 | 22 | val requiredDate: LocalDate, |
| 32 | 23 | |
| 24 | + @SerialName("required-time") | |
| 25 | + val requiredTime: OffsetTime, | |
| 26 | + | |
| 33 | 27 | @SerialName("required-date-time") |
| 34 | 28 | val requiredDateTime: OffsetDateTime, |
| 35 | 29 | |
| 36 | - @SerialName("required-time") | |
| 37 | - val requiredTime: OffsetTime | |
| 30 | + @SerialName("optional-date") | |
| 31 | + val optionalDate: LocalDate? = null, | |
| 32 | + | |
| 33 | + @SerialName("optional-time") | |
| 34 | + val optionalTime: OffsetTime? = null, | |
| 35 | + | |
| 36 | + @SerialName("optional-date-time") | |
| 37 | + val optionalDateTime: OffsetDateTime? = null | |
| 38 | 38 | ) |
| 39 | 39 | |
| 40 | 40 | object OffsetDateTimeSerializer : KSerializer<OffsetDateTime> { |
Mschema-phpdefault / TopLevel.php+186 −186
| @@ -4,354 +4,354 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private ?string $optionalDate; // json:optional-date Optional | |
| 8 | - private ?DateTime $optionalDateTime; // json:optional-date-time Optional | |
| 9 | - private ?string $optionalTime; // json:optional-time Optional | |
| 10 | 7 | private string $requiredDate; // json:required-date Required |
| 11 | - private DateTime $requiredDateTime; // json:required-date-time Required | |
| 12 | 8 | private string $requiredTime; // json:required-time Required |
| 9 | + private DateTime $requiredDateTime; // json:required-date-time Required | |
| 10 | + private ?string $optionalDate; // json:optional-date Optional | |
| 11 | + private ?string $optionalTime; // json:optional-time Optional | |
| 12 | + private ?DateTime $optionalDateTime; // json:optional-date-time Optional | |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * @param string|null $optionalDate | |
| 16 | - * @param DateTime|null $optionalDateTime | |
| 17 | - * @param string|null $optionalTime | |
| 18 | 15 | * @param string $requiredDate |
| 19 | - * @param DateTime $requiredDateTime | |
| 20 | 16 | * @param string $requiredTime |
| 17 | + * @param DateTime $requiredDateTime | |
| 18 | + * @param string|null $optionalDate | |
| 19 | + * @param string|null $optionalTime | |
| 20 | + * @param DateTime|null $optionalDateTime | |
| 21 | 21 | */ |
| 22 | - public function __construct(?string $optionalDate, ?DateTime $optionalDateTime, ?string $optionalTime, string $requiredDate, DateTime $requiredDateTime, string $requiredTime) { | |
| 23 | - $this->optionalDate = $optionalDate; | |
| 24 | - $this->optionalDateTime = $optionalDateTime; | |
| 25 | - $this->optionalTime = $optionalTime; | |
| 22 | + public function __construct(string $requiredDate, string $requiredTime, DateTime $requiredDateTime, ?string $optionalDate, ?string $optionalTime, ?DateTime $optionalDateTime) { | |
| 26 | 23 | $this->requiredDate = $requiredDate; |
| 27 | - $this->requiredDateTime = $requiredDateTime; | |
| 28 | 24 | $this->requiredTime = $requiredTime; |
| 25 | + $this->requiredDateTime = $requiredDateTime; | |
| 26 | + $this->optionalDate = $optionalDate; | |
| 27 | + $this->optionalTime = $optionalTime; | |
| 28 | + $this->optionalDateTime = $optionalDateTime; | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * @param ?string $value | |
| 32 | + * @param string $value | |
| 33 | 33 | * @throws Exception |
| 34 | - * @return ?string | |
| 34 | + * @return string | |
| 35 | 35 | */ |
| 36 | - public static function fromOptionalDate(?string $value): ?string { | |
| 37 | - if (!is_null($value)) { | |
| 38 | - return $value; /*string*/ | |
| 39 | - } else { | |
| 40 | - return null; | |
| 41 | - } | |
| 36 | + public static function fromRequiredDate(string $value): string { | |
| 37 | + return $value; /*string*/ | |
| 42 | 38 | } |
| 43 | 39 | |
| 44 | 40 | /** |
| 45 | 41 | * @throws Exception |
| 46 | - * @return ?string | |
| 42 | + * @return string | |
| 47 | 43 | */ |
| 48 | - public function toOptionalDate(): ?string { | |
| 49 | - if (TopLevel::validateOptionalDate($this->optionalDate)) { | |
| 50 | - if (!is_null($this->optionalDate)) { | |
| 51 | - return $this->optionalDate; /*string*/ | |
| 52 | - } else { | |
| 53 | - return null; | |
| 54 | - } | |
| 44 | + public function toRequiredDate(): string { | |
| 45 | + if (TopLevel::validateRequiredDate($this->requiredDate)) { | |
| 46 | + return $this->requiredDate; /*string*/ | |
| 55 | 47 | } |
| 56 | - throw new Exception('never get to this TopLevel::optionalDate'); | |
| 48 | + throw new Exception('never get to this TopLevel::requiredDate'); | |
| 57 | 49 | } |
| 58 | 50 | |
| 59 | 51 | /** |
| 60 | - * @param string|null | |
| 52 | + * @param string | |
| 61 | 53 | * @return bool |
| 62 | 54 | * @throws Exception |
| 63 | 55 | */ |
| 64 | - public static function validateOptionalDate(?string $value): bool { | |
| 65 | - if (!is_null($value)) { | |
| 66 | - } | |
| 56 | + public static function validateRequiredDate(string $value): bool { | |
| 67 | 57 | return true; |
| 68 | 58 | } |
| 69 | 59 | |
| 70 | 60 | /** |
| 71 | 61 | * @throws Exception |
| 72 | - * @return ?string | |
| 62 | + * @return string | |
| 73 | 63 | */ |
| 74 | - public function getOptionalDate(): ?string { | |
| 75 | - if (TopLevel::validateOptionalDate($this->optionalDate)) { | |
| 76 | - return $this->optionalDate; | |
| 64 | + public function getRequiredDate(): string { | |
| 65 | + if (TopLevel::validateRequiredDate($this->requiredDate)) { | |
| 66 | + return $this->requiredDate; | |
| 77 | 67 | } |
| 78 | - throw new Exception('never get to getOptionalDate TopLevel::optionalDate'); | |
| 68 | + throw new Exception('never get to getRequiredDate TopLevel::requiredDate'); | |
| 79 | 69 | } |
| 80 | 70 | |
| 81 | 71 | /** |
| 82 | - * @return ?string | |
| 72 | + * @return string | |
| 83 | 73 | */ |
| 84 | - public static function sampleOptionalDate(): ?string { | |
| 85 | - return 'TopLevel::optionalDate::31'; /*31:optionalDate*/ | |
| 74 | + public static function sampleRequiredDate(): string { | |
| 75 | + return 'TopLevel::requiredDate::31'; /*31:requiredDate*/ | |
| 86 | 76 | } |
| 87 | 77 | |
| 88 | 78 | /** |
| 89 | - * @param ?string $value | |
| 79 | + * @param string $value | |
| 90 | 80 | * @throws Exception |
| 91 | - * @return ?DateTime | |
| 81 | + * @return string | |
| 92 | 82 | */ |
| 93 | - public static function fromOptionalDateTime(?string $value): ?DateTime { | |
| 94 | - if (!is_null($value)) { | |
| 95 | - $tmp = DateTime::createFromFormat(DateTimeInterface::ISO8601, $value); | |
| 96 | - if (!is_a($tmp, 'DateTime')) { | |
| 97 | - throw new Exception('Attribute Error:TopLevel::'); | |
| 98 | - } | |
| 99 | - return $tmp; | |
| 100 | - } else { | |
| 101 | - return null; | |
| 102 | - } | |
| 83 | + public static function fromRequiredTime(string $value): string { | |
| 84 | + return $value; /*string*/ | |
| 103 | 85 | } |
| 104 | 86 | |
| 105 | 87 | /** |
| 106 | 88 | * @throws Exception |
| 107 | - * @return ?string | |
| 89 | + * @return string | |
| 108 | 90 | */ |
| 109 | - public function toOptionalDateTime(): ?string { | |
| 110 | - if (TopLevel::validateOptionalDateTime($this->optionalDateTime)) { | |
| 111 | - if (!is_null($this->optionalDateTime)) { | |
| 112 | - return $this->optionalDateTime->format(DateTimeInterface::ISO8601); | |
| 113 | - } else { | |
| 114 | - return null; | |
| 115 | - } | |
| 91 | + public function toRequiredTime(): string { | |
| 92 | + if (TopLevel::validateRequiredTime($this->requiredTime)) { | |
| 93 | + return $this->requiredTime; /*string*/ | |
| 116 | 94 | } |
| 117 | - throw new Exception('never get to this TopLevel::optionalDateTime'); | |
| 95 | + throw new Exception('never get to this TopLevel::requiredTime'); | |
| 118 | 96 | } |
| 119 | 97 | |
| 120 | 98 | /** |
| 121 | - * @param DateTime|null | |
| 99 | + * @param string | |
| 122 | 100 | * @return bool |
| 123 | 101 | * @throws Exception |
| 124 | 102 | */ |
| 125 | - public static function validateOptionalDateTime(?DateTime $value): bool { | |
| 126 | - if (!is_null($value)) { | |
| 127 | - if (!is_a($value, 'DateTime')) { | |
| 128 | - throw new Exception('Attribute Error:TopLevel::optionalDateTime'); | |
| 129 | - } | |
| 130 | - } | |
| 103 | + public static function validateRequiredTime(string $value): bool { | |
| 131 | 104 | return true; |
| 132 | 105 | } |
| 133 | 106 | |
| 134 | 107 | /** |
| 135 | 108 | * @throws Exception |
| 136 | - * @return ?DateTime | |
| 109 | + * @return string | |
| 137 | 110 | */ |
| 138 | - public function getOptionalDateTime(): ?DateTime { | |
| 139 | - if (TopLevel::validateOptionalDateTime($this->optionalDateTime)) { | |
| 140 | - return $this->optionalDateTime; | |
| 111 | + public function getRequiredTime(): string { | |
| 112 | + if (TopLevel::validateRequiredTime($this->requiredTime)) { | |
| 113 | + return $this->requiredTime; | |
| 141 | 114 | } |
| 142 | - throw new Exception('never get to getOptionalDateTime TopLevel::optionalDateTime'); | |
| 115 | + throw new Exception('never get to getRequiredTime TopLevel::requiredTime'); | |
| 143 | 116 | } |
| 144 | 117 | |
| 145 | 118 | /** |
| 146 | - * @return ?DateTime | |
| 119 | + * @return string | |
| 147 | 120 | */ |
| 148 | - public static function sampleOptionalDateTime(): ?DateTime { | |
| 149 | - return DateTime::createFromFormat(DateTimeInterface::ISO8601, '2020-12-20T12:20:20+00:00'); | |
| 121 | + public static function sampleRequiredTime(): string { | |
| 122 | + return 'TopLevel::requiredTime::32'; /*32:requiredTime*/ | |
| 150 | 123 | } |
| 151 | 124 | |
| 152 | 125 | /** |
| 153 | - * @param ?string $value | |
| 126 | + * @param string $value | |
| 154 | 127 | * @throws Exception |
| 155 | - * @return ?string | |
| 128 | + * @return DateTime | |
| 156 | 129 | */ |
| 157 | - public static function fromOptionalTime(?string $value): ?string { | |
| 158 | - if (!is_null($value)) { | |
| 159 | - return $value; /*string*/ | |
| 160 | - } else { | |
| 161 | - return null; | |
| 130 | + public static function fromRequiredDateTime(string $value): DateTime { | |
| 131 | + $tmp = DateTime::createFromFormat(DateTimeInterface::ISO8601, $value); | |
| 132 | + if (!is_a($tmp, 'DateTime')) { | |
| 133 | + throw new Exception('Attribute Error:TopLevel::'); | |
| 162 | 134 | } |
| 135 | + return $tmp; | |
| 163 | 136 | } |
| 164 | 137 | |
| 165 | 138 | /** |
| 166 | 139 | * @throws Exception |
| 167 | - * @return ?string | |
| 140 | + * @return string | |
| 168 | 141 | */ |
| 169 | - public function toOptionalTime(): ?string { | |
| 170 | - if (TopLevel::validateOptionalTime($this->optionalTime)) { | |
| 171 | - if (!is_null($this->optionalTime)) { | |
| 172 | - return $this->optionalTime; /*string*/ | |
| 173 | - } else { | |
| 174 | - return null; | |
| 175 | - } | |
| 142 | + public function toRequiredDateTime(): string { | |
| 143 | + if (TopLevel::validateRequiredDateTime($this->requiredDateTime)) { | |
| 144 | + return $this->requiredDateTime->format(DateTimeInterface::ISO8601); | |
| 176 | 145 | } |
| 177 | - throw new Exception('never get to this TopLevel::optionalTime'); | |
| 146 | + throw new Exception('never get to this TopLevel::requiredDateTime'); | |
| 178 | 147 | } |
| 179 | 148 | |
| 180 | 149 | /** |
| 181 | - * @param string|null | |
| 150 | + * @param DateTime | |
| 182 | 151 | * @return bool |
| 183 | 152 | * @throws Exception |
| 184 | 153 | */ |
| 185 | - public static function validateOptionalTime(?string $value): bool { | |
| 186 | - if (!is_null($value)) { | |
| 154 | + public static function validateRequiredDateTime(DateTime $value): bool { | |
| 155 | + if (!is_a($value, 'DateTime')) { | |
| 156 | + throw new Exception('Attribute Error:TopLevel::requiredDateTime'); | |
| 187 | 157 | } |
| 188 | 158 | return true; |
| 189 | 159 | } |
| 190 | 160 | |
| 191 | 161 | /** |
| 192 | 162 | * @throws Exception |
| 193 | - * @return ?string | |
| 163 | + * @return DateTime | |
| 194 | 164 | */ |
| 195 | - public function getOptionalTime(): ?string { | |
| 196 | - if (TopLevel::validateOptionalTime($this->optionalTime)) { | |
| 197 | - return $this->optionalTime; | |
| 165 | + public function getRequiredDateTime(): DateTime { | |
| 166 | + if (TopLevel::validateRequiredDateTime($this->requiredDateTime)) { | |
| 167 | + return $this->requiredDateTime; | |
| 198 | 168 | } |
| 199 | - throw new Exception('never get to getOptionalTime TopLevel::optionalTime'); | |
| 169 | + throw new Exception('never get to getRequiredDateTime TopLevel::requiredDateTime'); | |
| 200 | 170 | } |
| 201 | 171 | |
| 202 | 172 | /** |
| 203 | - * @return ?string | |
| 173 | + * @return DateTime | |
| 204 | 174 | */ |
| 205 | - public static function sampleOptionalTime(): ?string { | |
| 206 | - return 'TopLevel::optionalTime::33'; /*33:optionalTime*/ | |
| 175 | + public static function sampleRequiredDateTime(): DateTime { | |
| 176 | + return DateTime::createFromFormat(DateTimeInterface::ISO8601, '2020-12-30T12:30:30+00:00'); | |
| 207 | 177 | } |
| 208 | 178 | |
| 209 | 179 | /** |
| 210 | - * @param string $value | |
| 180 | + * @param ?string $value | |
| 211 | 181 | * @throws Exception |
| 212 | - * @return string | |
| 182 | + * @return ?string | |
| 213 | 183 | */ |
| 214 | - public static function fromRequiredDate(string $value): string { | |
| 215 | - return $value; /*string*/ | |
| 184 | + public static function fromOptionalDate(?string $value): ?string { | |
| 185 | + if (!is_null($value)) { | |
| 186 | + return $value; /*string*/ | |
| 187 | + } else { | |
| 188 | + return null; | |
| 189 | + } | |
| 216 | 190 | } |
| 217 | 191 | |
| 218 | 192 | /** |
| 219 | 193 | * @throws Exception |
| 220 | - * @return string | |
| 194 | + * @return ?string | |
| 221 | 195 | */ |
| 222 | - public function toRequiredDate(): string { | |
| 223 | - if (TopLevel::validateRequiredDate($this->requiredDate)) { | |
| 224 | - return $this->requiredDate; /*string*/ | |
| 196 | + public function toOptionalDate(): ?string { | |
| 197 | + if (TopLevel::validateOptionalDate($this->optionalDate)) { | |
| 198 | + if (!is_null($this->optionalDate)) { | |
| 199 | + return $this->optionalDate; /*string*/ | |
| 200 | + } else { | |
| 201 | + return null; | |
| 202 | + } | |
| 225 | 203 | } |
| 226 | - throw new Exception('never get to this TopLevel::requiredDate'); | |
| 204 | + throw new Exception('never get to this TopLevel::optionalDate'); | |
| 227 | 205 | } |
| 228 | 206 | |
| 229 | 207 | /** |
| 230 | - * @param string | |
| 208 | + * @param string|null | |
| 231 | 209 | * @return bool |
| 232 | 210 | * @throws Exception |
| 233 | 211 | */ |
| 234 | - public static function validateRequiredDate(string $value): bool { | |
| 212 | + public static function validateOptionalDate(?string $value): bool { | |
| 213 | + if (!is_null($value)) { | |
| 214 | + } | |
| 235 | 215 | return true; |
| 236 | 216 | } |
| 237 | 217 | |
| 238 | 218 | /** |
| 239 | 219 | * @throws Exception |
| 240 | - * @return string | |
| 220 | + * @return ?string | |
| 241 | 221 | */ |
| 242 | - public function getRequiredDate(): string { | |
| 243 | - if (TopLevel::validateRequiredDate($this->requiredDate)) { | |
| 244 | - return $this->requiredDate; | |
| 222 | + public function getOptionalDate(): ?string { | |
| 223 | + if (TopLevel::validateOptionalDate($this->optionalDate)) { | |
| 224 | + return $this->optionalDate; | |
| 245 | 225 | } |
| 246 | - throw new Exception('never get to getRequiredDate TopLevel::requiredDate'); | |
| 226 | + throw new Exception('never get to getOptionalDate TopLevel::optionalDate'); | |
| 247 | 227 | } |
| 248 | 228 | |
| 249 | 229 | /** |
| 250 | - * @return string | |
| 230 | + * @return ?string | |
| 251 | 231 | */ |
| 252 | - public static function sampleRequiredDate(): string { | |
| 253 | - return 'TopLevel::requiredDate::34'; /*34:requiredDate*/ | |
| 232 | + public static function sampleOptionalDate(): ?string { | |
| 233 | + return 'TopLevel::optionalDate::34'; /*34:optionalDate*/ | |
| 254 | 234 | } |
| 255 | 235 | |
| 256 | 236 | /** |
| 257 | - * @param string $value | |
| 237 | + * @param ?string $value | |
| 258 | 238 | * @throws Exception |
| 259 | - * @return DateTime | |
| 239 | + * @return ?string | |
| 260 | 240 | */ |
| 261 | - public static function fromRequiredDateTime(string $value): DateTime { | |
| 262 | - $tmp = DateTime::createFromFormat(DateTimeInterface::ISO8601, $value); | |
| 263 | - if (!is_a($tmp, 'DateTime')) { | |
| 264 | - throw new Exception('Attribute Error:TopLevel::'); | |
| 241 | + public static function fromOptionalTime(?string $value): ?string { | |
| 242 | + if (!is_null($value)) { | |
| 243 | + return $value; /*string*/ | |
| 244 | + } else { | |
| 245 | + return null; | |
| 265 | 246 | } |
| 266 | - return $tmp; | |
| 267 | 247 | } |
| 268 | 248 | |
| 269 | 249 | /** |
| 270 | 250 | * @throws Exception |
| 271 | - * @return string | |
| 251 | + * @return ?string | |
| 272 | 252 | */ |
| 273 | - public function toRequiredDateTime(): string { | |
| 274 | - if (TopLevel::validateRequiredDateTime($this->requiredDateTime)) { | |
| 275 | - return $this->requiredDateTime->format(DateTimeInterface::ISO8601); | |
| 253 | + public function toOptionalTime(): ?string { | |
| 254 | + if (TopLevel::validateOptionalTime($this->optionalTime)) { | |
| 255 | + if (!is_null($this->optionalTime)) { | |
| 256 | + return $this->optionalTime; /*string*/ | |
| 257 | + } else { | |
| 258 | + return null; | |
| 259 | + } | |
| 276 | 260 | } |
| 277 | - throw new Exception('never get to this TopLevel::requiredDateTime'); | |
| 261 | + throw new Exception('never get to this TopLevel::optionalTime'); | |
| 278 | 262 | } |
| 279 | 263 | |
| 280 | 264 | /** |
| 281 | - * @param DateTime | |
| 265 | + * @param string|null | |
| 282 | 266 | * @return bool |
| 283 | 267 | * @throws Exception |
| 284 | 268 | */ |
| 285 | - public static function validateRequiredDateTime(DateTime $value): bool { | |
| 286 | - if (!is_a($value, 'DateTime')) { | |
| 287 | - throw new Exception('Attribute Error:TopLevel::requiredDateTime'); | |
| 269 | + public static function validateOptionalTime(?string $value): bool { | |
| 270 | + if (!is_null($value)) { | |
| 288 | 271 | } |
| 289 | 272 | return true; |
| 290 | 273 | } |
| 291 | 274 | |
| 292 | 275 | /** |
| 293 | 276 | * @throws Exception |
| 294 | - * @return DateTime | |
| 277 | + * @return ?string | |
| 295 | 278 | */ |
| 296 | - public function getRequiredDateTime(): DateTime { | |
| 297 | - if (TopLevel::validateRequiredDateTime($this->requiredDateTime)) { | |
| 298 | - return $this->requiredDateTime; | |
| 279 | + public function getOptionalTime(): ?string { | |
| 280 | + if (TopLevel::validateOptionalTime($this->optionalTime)) { | |
| 281 | + return $this->optionalTime; | |
| 299 | 282 | } |
| 300 | - throw new Exception('never get to getRequiredDateTime TopLevel::requiredDateTime'); | |
| 283 | + throw new Exception('never get to getOptionalTime TopLevel::optionalTime'); | |
| 301 | 284 | } |
| 302 | 285 | |
| 303 | 286 | /** |
| 304 | - * @return DateTime | |
| 287 | + * @return ?string | |
| 305 | 288 | */ |
| 306 | - public static function sampleRequiredDateTime(): DateTime { | |
| 307 | - return DateTime::createFromFormat(DateTimeInterface::ISO8601, '2020-12-50T12:50:50+00:00'); | |
| 289 | + public static function sampleOptionalTime(): ?string { | |
| 290 | + return 'TopLevel::optionalTime::35'; /*35:optionalTime*/ | |
| 308 | 291 | } |
| 309 | 292 | |
| 310 | 293 | /** |
| 311 | - * @param string $value | |
| 294 | + * @param ?string $value | |
| 312 | 295 | * @throws Exception |
| 313 | - * @return string | |
| 296 | + * @return ?DateTime | |
| 314 | 297 | */ |
| 315 | - public static function fromRequiredTime(string $value): string { | |
| 316 | - return $value; /*string*/ | |
| 298 | + public static function fromOptionalDateTime(?string $value): ?DateTime { | |
| 299 | + if (!is_null($value)) { | |
| 300 | + $tmp = DateTime::createFromFormat(DateTimeInterface::ISO8601, $value); | |
| 301 | + if (!is_a($tmp, 'DateTime')) { | |
| 302 | + throw new Exception('Attribute Error:TopLevel::'); | |
| 303 | + } | |
| 304 | + return $tmp; | |
| 305 | + } else { | |
| 306 | + return null; | |
| 307 | + } | |
| 317 | 308 | } |
| 318 | 309 | |
| 319 | 310 | /** |
| 320 | 311 | * @throws Exception |
| 321 | - * @return string | |
| 312 | + * @return ?string | |
| 322 | 313 | */ |
| 323 | - public function toRequiredTime(): string { | |
| 324 | - if (TopLevel::validateRequiredTime($this->requiredTime)) { | |
| 325 | - return $this->requiredTime; /*string*/ | |
| 314 | + public function toOptionalDateTime(): ?string { | |
| 315 | + if (TopLevel::validateOptionalDateTime($this->optionalDateTime)) { | |
| 316 | + if (!is_null($this->optionalDateTime)) { | |
| 317 | + return $this->optionalDateTime->format(DateTimeInterface::ISO8601); | |
| 318 | + } else { | |
| 319 | + return null; | |
| 320 | + } | |
| 326 | 321 | } |
| 327 | - throw new Exception('never get to this TopLevel::requiredTime'); | |
| 322 | + throw new Exception('never get to this TopLevel::optionalDateTime'); | |
| 328 | 323 | } |
| 329 | 324 | |
| 330 | 325 | /** |
| 331 | - * @param string | |
| 326 | + * @param DateTime|null | |
| 332 | 327 | * @return bool |
| 333 | 328 | * @throws Exception |
| 334 | 329 | */ |
| 335 | - public static function validateRequiredTime(string $value): bool { | |
| 330 | + public static function validateOptionalDateTime(?DateTime $value): bool { | |
| 331 | + if (!is_null($value)) { | |
| 332 | + if (!is_a($value, 'DateTime')) { | |
| 333 | + throw new Exception('Attribute Error:TopLevel::optionalDateTime'); | |
| 334 | + } | |
| 335 | + } | |
| 336 | 336 | return true; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
| 340 | 340 | * @throws Exception |
| 341 | - * @return string | |
| 341 | + * @return ?DateTime | |
| 342 | 342 | */ |
| 343 | - public function getRequiredTime(): string { | |
| 344 | - if (TopLevel::validateRequiredTime($this->requiredTime)) { | |
| 345 | - return $this->requiredTime; | |
| 343 | + public function getOptionalDateTime(): ?DateTime { | |
| 344 | + if (TopLevel::validateOptionalDateTime($this->optionalDateTime)) { | |
| 345 | + return $this->optionalDateTime; | |
| 346 | 346 | } |
| 347 | - throw new Exception('never get to getRequiredTime TopLevel::requiredTime'); | |
| 347 | + throw new Exception('never get to getOptionalDateTime TopLevel::optionalDateTime'); | |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | /** |
| 351 | - * @return string | |
| 351 | + * @return ?DateTime | |
| 352 | 352 | */ |
| 353 | - public static function sampleRequiredTime(): string { | |
| 354 | - return 'TopLevel::requiredTime::36'; /*36:requiredTime*/ | |
| 353 | + public static function sampleOptionalDateTime(): ?DateTime { | |
| 354 | + return DateTime::createFromFormat(DateTimeInterface::ISO8601, '2020-12-60T12:60:60+00:00'); | |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | /** |
| @@ -359,12 +359,12 @@ class TopLevel { | ||
| 359 | 359 | * @return bool |
| 360 | 360 | */ |
| 361 | 361 | public function validate(): bool { |
| 362 | - return TopLevel::validateOptionalDate($this->optionalDate) | |
| 363 | - || TopLevel::validateOptionalDateTime($this->optionalDateTime) | |
| 364 | - || TopLevel::validateOptionalTime($this->optionalTime) | |
| 365 | - || TopLevel::validateRequiredDate($this->requiredDate) | |
| 362 | + return TopLevel::validateRequiredDate($this->requiredDate) | |
| 363 | + || TopLevel::validateRequiredTime($this->requiredTime) | |
| 366 | 364 | || TopLevel::validateRequiredDateTime($this->requiredDateTime) |
| 367 | - || TopLevel::validateRequiredTime($this->requiredTime); | |
| 365 | + || TopLevel::validateOptionalDate($this->optionalDate) | |
| 366 | + || TopLevel::validateOptionalTime($this->optionalTime) | |
| 367 | + || TopLevel::validateOptionalDateTime($this->optionalDateTime); | |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | /** |
| @@ -373,12 +373,12 @@ class TopLevel { | ||
| 373 | 373 | */ |
| 374 | 374 | public function to(): stdClass { |
| 375 | 375 | $out = new stdClass(); |
| 376 | - $out->{'optional-date'} = $this->toOptionalDate(); | |
| 377 | - $out->{'optional-date-time'} = $this->toOptionalDateTime(); | |
| 378 | - $out->{'optional-time'} = $this->toOptionalTime(); | |
| 379 | 376 | $out->{'required-date'} = $this->toRequiredDate(); |
| 380 | - $out->{'required-date-time'} = $this->toRequiredDateTime(); | |
| 381 | 377 | $out->{'required-time'} = $this->toRequiredTime(); |
| 378 | + $out->{'required-date-time'} = $this->toRequiredDateTime(); | |
| 379 | + $out->{'optional-date'} = $this->toOptionalDate(); | |
| 380 | + $out->{'optional-time'} = $this->toOptionalTime(); | |
| 381 | + $out->{'optional-date-time'} = $this->toOptionalDateTime(); | |
| 382 | 382 | return $out; |
| 383 | 383 | } |
| 384 | 384 | |
| @@ -389,12 +389,12 @@ class TopLevel { | ||
| 389 | 389 | */ |
| 390 | 390 | public static function from(stdClass $obj): TopLevel { |
| 391 | 391 | return new TopLevel( |
| 392 | - TopLevel::fromOptionalDate($obj->{'optional-date'}) | |
| 393 | - ,TopLevel::fromOptionalDateTime($obj->{'optional-date-time'}) | |
| 394 | - ,TopLevel::fromOptionalTime($obj->{'optional-time'}) | |
| 395 | - ,TopLevel::fromRequiredDate($obj->{'required-date'}) | |
| 396 | - ,TopLevel::fromRequiredDateTime($obj->{'required-date-time'}) | |
| 392 | + TopLevel::fromRequiredDate($obj->{'required-date'}) | |
| 397 | 393 | ,TopLevel::fromRequiredTime($obj->{'required-time'}) |
| 394 | + ,TopLevel::fromRequiredDateTime($obj->{'required-date-time'}) | |
| 395 | + ,TopLevel::fromOptionalDate($obj->{'optional-date'}) | |
| 396 | + ,TopLevel::fromOptionalTime($obj->{'optional-time'}) | |
| 397 | + ,TopLevel::fromOptionalDateTime($obj->{'optional-date-time'}) | |
| 398 | 398 | ); |
| 399 | 399 | } |
| 400 | 400 | |
| @@ -403,12 +403,12 @@ class TopLevel { | ||
| 403 | 403 | */ |
| 404 | 404 | public static function sample(): TopLevel { |
| 405 | 405 | return new TopLevel( |
| 406 | - TopLevel::sampleOptionalDate() | |
| 407 | - ,TopLevel::sampleOptionalDateTime() | |
| 408 | - ,TopLevel::sampleOptionalTime() | |
| 409 | - ,TopLevel::sampleRequiredDate() | |
| 410 | - ,TopLevel::sampleRequiredDateTime() | |
| 406 | + TopLevel::sampleRequiredDate() | |
| 411 | 407 | ,TopLevel::sampleRequiredTime() |
| 408 | + ,TopLevel::sampleRequiredDateTime() | |
| 409 | + ,TopLevel::sampleOptionalDate() | |
| 410 | + ,TopLevel::sampleOptionalTime() | |
| 411 | + ,TopLevel::sampleOptionalDateTime() | |
| 412 | 412 | ); |
| 413 | 413 | } |
| 414 | 414 | } |
Mschema-pikedefault / TopLevel.pmod+12 −12
| @@ -13,21 +13,21 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - mixed|string optional_date; // json: "optional-date" | |
| 17 | - mixed|string optional_date_time; // json: "optional-date-time" | |
| 18 | - mixed|string optional_time; // json: "optional-time" | |
| 19 | 16 | string required_date; // json: "required-date" |
| 20 | - string required_date_time; // json: "required-date-time" | |
| 21 | 17 | string required_time; // json: "required-time" |
| 18 | + string required_date_time; // json: "required-date-time" | |
| 19 | + mixed|string optional_date; // json: "optional-date" | |
| 20 | + mixed|string optional_time; // json: "optional-time" | |
| 21 | + mixed|string optional_date_time; // json: "optional-date-time" | |
| 22 | 22 | |
| 23 | 23 | string encode_json() { |
| 24 | 24 | mapping(string:mixed) json = ([ |
| 25 | - "optional-date" : optional_date, | |
| 26 | - "optional-date-time" : optional_date_time, | |
| 27 | - "optional-time" : optional_time, | |
| 28 | 25 | "required-date" : required_date, |
| 29 | - "required-date-time" : required_date_time, | |
| 30 | 26 | "required-time" : required_time, |
| 27 | + "required-date-time" : required_date_time, | |
| 28 | + "optional-date" : optional_date, | |
| 29 | + "optional-time" : optional_time, | |
| 30 | + "optional-date-time" : optional_date_time, | |
| 31 | 31 | ]); |
| 32 | 32 | |
| 33 | 33 | return Standards.JSON.encode(json); |
| @@ -37,12 +37,12 @@ class TopLevel { | ||
| 37 | 37 | TopLevel TopLevel_from_JSON(mixed json) { |
| 38 | 38 | TopLevel retval = TopLevel(); |
| 39 | 39 | |
| 40 | - retval.optional_date = json["optional-date"]; | |
| 41 | - retval.optional_date_time = json["optional-date-time"]; | |
| 42 | - retval.optional_time = json["optional-time"]; | |
| 43 | 40 | retval.required_date = json["required-date"]; |
| 44 | - retval.required_date_time = json["required-date-time"]; | |
| 45 | 41 | retval.required_time = json["required-time"]; |
| 42 | + retval.required_date_time = json["required-date-time"]; | |
| 43 | + retval.optional_date = json["optional-date"]; | |
| 44 | + retval.optional_time = json["optional-time"]; | |
| 45 | + retval.optional_date_time = json["optional-date-time"]; | |
| 46 | 46 | |
| 47 | 47 | return retval; |
| 48 | 48 | } |
Mschema-pythondefault / quicktype.py+12 −12
| @@ -13,15 +13,15 @@ def from_date(x: Any) -> datetime.date: | ||
| 13 | 13 | return dateutil.parser.parse(x).date() |
| 14 | 14 | |
| 15 | 15 | |
| 16 | -def from_datetime(x: Any) -> datetime.datetime: | |
| 17 | - return dateutil.parser.parse(x) | |
| 18 | - | |
| 19 | - | |
| 20 | 16 | def from_time(x: Any) -> datetime.time: |
| 21 | 17 | assert isinstance(x, str) and re.match(r"^\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$", x) |
| 22 | 18 | return dateutil.parser.parse(x).time() |
| 23 | 19 | |
| 24 | 20 | |
| 21 | +def from_datetime(x: Any) -> datetime.datetime: | |
| 22 | + return dateutil.parser.parse(x) | |
| 23 | + | |
| 24 | + | |
| 25 | 25 | def from_none(x: Any) -> Any: |
| 26 | 26 | assert x is None |
| 27 | 27 | return x |
| @@ -44,34 +44,34 @@ def to_class(c: Type[T], x: Any) -> dict: | ||
| 44 | 44 | @dataclass |
| 45 | 45 | class TopLevel: |
| 46 | 46 | required_date: datetime.date |
| 47 | - required_date_time: datetime.datetime | |
| 48 | 47 | required_time: datetime.time |
| 48 | + required_date_time: datetime.datetime | |
| 49 | 49 | optional_date: datetime.date | None = None |
| 50 | - optional_date_time: datetime.datetime | None = None | |
| 51 | 50 | optional_time: datetime.time | None = None |
| 51 | + optional_date_time: datetime.datetime | None = None | |
| 52 | 52 | |
| 53 | 53 | @staticmethod |
| 54 | 54 | def from_dict(obj: Any) -> 'TopLevel': |
| 55 | 55 | assert isinstance(obj, dict) |
| 56 | 56 | required_date = from_date(obj.get("required-date")) |
| 57 | - required_date_time = from_datetime(obj.get("required-date-time")) | |
| 58 | 57 | required_time = from_time(obj.get("required-time")) |
| 58 | + required_date_time = from_datetime(obj.get("required-date-time")) | |
| 59 | 59 | optional_date = from_union([from_date, from_none], obj.get("optional-date")) |
| 60 | - optional_date_time = from_union([from_datetime, from_none], obj.get("optional-date-time")) | |
| 61 | 60 | optional_time = from_union([from_time, from_none], obj.get("optional-time")) |
| 62 | - return TopLevel(required_date, required_date_time, required_time, optional_date, optional_date_time, optional_time) | |
| 61 | + optional_date_time = from_union([from_datetime, from_none], obj.get("optional-date-time")) | |
| 62 | + return TopLevel(required_date, required_time, required_date_time, optional_date, optional_time, optional_date_time) | |
| 63 | 63 | |
| 64 | 64 | def to_dict(self) -> dict: |
| 65 | 65 | result: dict = {} |
| 66 | 66 | result["required-date"] = self.required_date.isoformat() |
| 67 | - result["required-date-time"] = self.required_date_time.isoformat() | |
| 68 | 67 | result["required-time"] = self.required_time.isoformat() |
| 68 | + result["required-date-time"] = self.required_date_time.isoformat() | |
| 69 | 69 | if self.optional_date is not None: |
| 70 | 70 | result["optional-date"] = from_union([lambda x: x.isoformat(), from_none], self.optional_date) |
| 71 | - if self.optional_date_time is not None: | |
| 72 | - result["optional-date-time"] = from_union([lambda x: x.isoformat(), from_none], self.optional_date_time) | |
| 73 | 71 | if self.optional_time is not None: |
| 74 | 72 | result["optional-time"] = from_union([lambda x: x.isoformat(), from_none], self.optional_time) |
| 73 | + if self.optional_date_time is not None: | |
| 74 | + result["optional-date-time"] = from_union([lambda x: x.isoformat(), from_none], self.optional_date_time) | |
| 75 | 75 | return result |
Mschema-rubydefault / TopLevel.rb+13 −13
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.optional_date | |
| 7 | +# puts top_level.required_date | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -20,22 +20,22 @@ module Types | ||
| 20 | 20 | end |
| 21 | 21 | |
| 22 | 22 | class TopLevel < Dry::Struct |
| 23 | - attribute :optional_date, Types::String.optional | |
| 24 | - attribute :optional_date_time, Types::String.optional | |
| 25 | - attribute :optional_time, Types::String.optional | |
| 26 | 23 | attribute :required_date, Types::String |
| 27 | - attribute :required_date_time, Types::String | |
| 28 | 24 | attribute :required_time, Types::String |
| 25 | + attribute :required_date_time, Types::String | |
| 26 | + attribute :optional_date, Types::String.optional | |
| 27 | + attribute :optional_time, Types::String.optional | |
| 28 | + attribute :optional_date_time, Types::String.optional | |
| 29 | 29 | |
| 30 | 30 | def self.from_dynamic!(d) |
| 31 | 31 | d = Types::Hash[d] |
| 32 | 32 | new( |
| 33 | - optional_date: d["optional-date"], | |
| 34 | - optional_date_time: d["optional-date-time"], | |
| 35 | - optional_time: d["optional-time"], | |
| 36 | 33 | required_date: d.fetch("required-date"), |
| 37 | - required_date_time: d.fetch("required-date-time"), | |
| 38 | 34 | required_time: d.fetch("required-time"), |
| 35 | + required_date_time: d.fetch("required-date-time"), | |
| 36 | + optional_date: d["optional-date"], | |
| 37 | + optional_time: d["optional-time"], | |
| 38 | + optional_date_time: d["optional-date-time"], | |
| 39 | 39 | ) |
| 40 | 40 | end |
| 41 | 41 | |
| @@ -45,12 +45,12 @@ class TopLevel < Dry::Struct | ||
| 45 | 45 | |
| 46 | 46 | def to_dynamic |
| 47 | 47 | { |
| 48 | - "optional-date" => optional_date, | |
| 49 | - "optional-date-time" => optional_date_time, | |
| 50 | - "optional-time" => optional_time, | |
| 51 | 48 | "required-date" => required_date, |
| 52 | - "required-date-time" => required_date_time, | |
| 53 | 49 | "required-time" => required_time, |
| 50 | + "required-date-time" => required_date_time, | |
| 51 | + "optional-date" => optional_date, | |
| 52 | + "optional-time" => optional_time, | |
| 53 | + "optional-date-time" => optional_date_time, | |
| 54 | 54 | } |
| 55 | 55 | end |
Mschema-rustdefault / module_under_test.rs+6 −6
| @@ -16,15 +16,15 @@ use serde::{Serialize, Deserialize}; | ||
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | #[serde(rename_all = "kebab-case")] |
| 18 | 18 | pub struct TopLevel { |
| 19 | - pub optional_date: Option<String>, | |
| 19 | + pub required_date: String, | |
| 20 | 20 | |
| 21 | - pub optional_date_time: Option<String>, | |
| 21 | + pub required_time: String, | |
| 22 | 22 | |
| 23 | - pub optional_time: Option<String>, | |
| 23 | + pub required_date_time: String, | |
| 24 | 24 | |
| 25 | - pub required_date: String, | |
| 25 | + pub optional_date: Option<String>, | |
| 26 | 26 | |
| 27 | - pub required_date_time: String, | |
| 27 | + pub optional_time: Option<String>, | |
| 28 | 28 | |
| 29 | - pub required_time: String, | |
| 29 | + pub optional_date_time: Option<String>, | |
| 30 | 30 | } |
Mschema-scala3-upickledefault / TopLevel.scala+4 −4
| @@ -66,10 +66,10 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val `optional-date` : Option[String] = None, | |
| 70 | - val `optional-date-time` : Option[String] = None, | |
| 71 | - val `optional-time` : Option[String] = None, | |
| 72 | 69 | val `required-date` : String, |
| 70 | + val `required-time` : String, | |
| 73 | 71 | val `required-date-time` : String, |
| 74 | - val `required-time` : String | |
| 72 | + val `optional-date` : Option[String] = None, | |
| 73 | + val `optional-time` : Option[String] = None, | |
| 74 | + val `optional-date-time` : Option[String] = None | |
| 75 | 75 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+4 −4
| @@ -8,10 +8,10 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val `optional-date` : Option[String] = None, | |
| 12 | - val `optional-date-time` : Option[String] = None, | |
| 13 | - val `optional-time` : Option[String] = None, | |
| 14 | 11 | val `required-date` : String, |
| 12 | + val `required-time` : String, | |
| 15 | 13 | val `required-date-time` : String, |
| 16 | - val `required-time` : String | |
| 14 | + val `optional-date` : Option[String] = None, | |
| 15 | + val `optional-time` : Option[String] = None, | |
| 16 | + val `optional-date-time` : Option[String] = None | |
| 17 | 17 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+10 −10
| @@ -6,29 +6,29 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": false, |
| 8 | 8 | "properties": { |
| 9 | - "optional-date": { | |
| 9 | + "required-date": { | |
| 10 | 10 | "type": "string", |
| 11 | 11 | "format": "date" |
| 12 | 12 | }, |
| 13 | - "optional-date-time": { | |
| 13 | + "required-time": { | |
| 14 | 14 | "type": "string", |
| 15 | - "format": "date-time" | |
| 15 | + "format": "time" | |
| 16 | 16 | }, |
| 17 | - "optional-time": { | |
| 17 | + "required-date-time": { | |
| 18 | 18 | "type": "string", |
| 19 | - "format": "time" | |
| 19 | + "format": "date-time" | |
| 20 | 20 | }, |
| 21 | - "required-date": { | |
| 21 | + "optional-date": { | |
| 22 | 22 | "type": "string", |
| 23 | 23 | "format": "date" |
| 24 | 24 | }, |
| 25 | - "required-date-time": { | |
| 25 | + "optional-time": { | |
| 26 | 26 | "type": "string", |
| 27 | - "format": "date-time" | |
| 27 | + "format": "time" | |
| 28 | 28 | }, |
| 29 | - "required-time": { | |
| 29 | + "optional-date-time": { | |
| 30 | 30 | "type": "string", |
| 31 | - "format": "time" | |
| 31 | + "format": "date-time" | |
| 32 | 32 | } |
| 33 | 33 | }, |
| 34 | 34 | "required": [ |
Mschema-swiftdefault / quicktype.swift+16 −16
| @@ -7,20 +7,20 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | - let optionalDate: String? | |
| 11 | - let optionalDateTime: Date? | |
| 12 | - let optionalTime: String? | |
| 13 | 10 | let requiredDate: String |
| 14 | - let requiredDateTime: Date | |
| 15 | 11 | let requiredTime: String |
| 12 | + let requiredDateTime: Date | |
| 13 | + let optionalDate: String? | |
| 14 | + let optionalTime: String? | |
| 15 | + let optionalDateTime: Date? | |
| 16 | 16 | |
| 17 | 17 | enum CodingKeys: String, CodingKey { |
| 18 | - case optionalDate = "optional-date" | |
| 19 | - case optionalDateTime = "optional-date-time" | |
| 20 | - case optionalTime = "optional-time" | |
| 21 | 18 | case requiredDate = "required-date" |
| 22 | - case requiredDateTime = "required-date-time" | |
| 23 | 19 | case requiredTime = "required-time" |
| 20 | + case requiredDateTime = "required-date-time" | |
| 21 | + case optionalDate = "optional-date" | |
| 22 | + case optionalTime = "optional-time" | |
| 23 | + case optionalDateTime = "optional-date-time" | |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | |
| @@ -43,20 +43,20 @@ extension TopLevel { | ||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | func with( |
| 46 | - optionalDate: String?? = nil, | |
| 47 | - optionalDateTime: Date?? = nil, | |
| 48 | - optionalTime: String?? = nil, | |
| 49 | 46 | requiredDate: String? = nil, |
| 47 | + requiredTime: String? = nil, | |
| 50 | 48 | requiredDateTime: Date? = nil, |
| 51 | - requiredTime: String? = nil | |
| 49 | + optionalDate: String?? = nil, | |
| 50 | + optionalTime: String?? = nil, | |
| 51 | + optionalDateTime: Date?? = nil | |
| 52 | 52 | ) -> TopLevel { |
| 53 | 53 | return TopLevel( |
| 54 | - optionalDate: optionalDate ?? self.optionalDate, | |
| 55 | - optionalDateTime: optionalDateTime ?? self.optionalDateTime, | |
| 56 | - optionalTime: optionalTime ?? self.optionalTime, | |
| 57 | 54 | requiredDate: requiredDate ?? self.requiredDate, |
| 55 | + requiredTime: requiredTime ?? self.requiredTime, | |
| 58 | 56 | requiredDateTime: requiredDateTime ?? self.requiredDateTime, |
| 59 | - requiredTime: requiredTime ?? self.requiredTime | |
| 57 | + optionalDate: optionalDate ?? self.optionalDate, | |
| 58 | + optionalTime: optionalTime ?? self.optionalTime, | |
| 59 | + optionalDateTime: optionalDateTime ?? self.optionalDateTime | |
| 60 | 60 | ) |
| 61 | 61 | } |
Mschema-typescript-zoddefault / TopLevel.ts+4 −4
| @@ -2,11 +2,11 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "optional-date": z.string().optional(), | |
| 6 | - "optional-date-time": z.coerce.date().optional(), | |
| 7 | - "optional-time": z.string().optional(), | |
| 8 | 5 | "required-date": z.string(), |
| 9 | - "required-date-time": z.coerce.date(), | |
| 10 | 6 | "required-time": z.string(), |
| 7 | + "required-date-time": z.coerce.date(), | |
| 8 | + "optional-date": z.string().optional(), | |
| 9 | + "optional-time": z.string().optional(), | |
| 10 | + "optional-date-time": z.coerce.date().optional(), | |
| 11 | 11 | }); |
| 12 | 12 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+8 −8
| @@ -8,12 +8,12 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - "optional-date"?: Date; | |
| 12 | - "optional-date-time"?: Date; | |
| 13 | - "optional-time"?: string; | |
| 14 | 11 | "required-date": Date; |
| 15 | - "required-date-time": Date; | |
| 16 | 12 | "required-time": string; |
| 13 | + "required-date-time": Date; | |
| 14 | + "optional-date"?: Date; | |
| 15 | + "optional-time"?: string; | |
| 16 | + "optional-date-time"?: Date; | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | // Converts JSON strings to/from your types |
| @@ -183,11 +183,11 @@ function r(name: string) { | ||
| 183 | 183 | |
| 184 | 184 | const typeMap: any = { |
| 185 | 185 | "TopLevel": o([ |
| 186 | - { json: "optional-date", js: "optional-date", typ: u(undefined, Date) }, | |
| 187 | - { json: "optional-date-time", js: "optional-date-time", typ: u(undefined, Date) }, | |
| 188 | - { json: "optional-time", js: "optional-time", typ: u(undefined, "") }, | |
| 189 | 186 | { json: "required-date", js: "required-date", typ: Date }, |
| 190 | - { json: "required-date-time", js: "required-date-time", typ: Date }, | |
| 191 | 187 | { json: "required-time", js: "required-time", typ: "" }, |
| 188 | + { json: "required-date-time", js: "required-date-time", typ: Date }, | |
| 189 | + { json: "optional-date", js: "optional-date", typ: u(undefined, Date) }, | |
| 190 | + { json: "optional-time", js: "optional-time", typ: u(undefined, "") }, | |
| 191 | + { json: "optional-date-time", js: "optional-date-time", typ: u(undefined, Date) }, | |
| 192 | 192 | ], false), |
| 193 | 193 | }; |
Test case
26 generated files · +137 −137test/inputs/schema/prefix-items.schema
Mschema-cplusplusdefault / quicktype.hpp+7 −7
| @@ -96,17 +96,17 @@ namespace quicktype { | ||
| 96 | 96 | virtual ~TopLevel() = default; |
| 97 | 97 | |
| 98 | 98 | private: |
| 99 | - std::vector<Open> open; | |
| 100 | 99 | std::vector<Open> tuple; |
| 100 | + std::vector<Open> open; | |
| 101 | 101 | |
| 102 | 102 | public: |
| 103 | - const std::vector<Open> & get_open() const { return open; } | |
| 104 | - std::vector<Open> & get_mutable_open() { return open; } | |
| 105 | - void set_open(const std::vector<Open> & value) { this->open = value; } | |
| 106 | - | |
| 107 | 103 | const std::vector<Open> & get_tuple() const { return tuple; } |
| 108 | 104 | std::vector<Open> & get_mutable_tuple() { return tuple; } |
| 109 | 105 | void set_tuple(const std::vector<Open> & value) { this->tuple = value; } |
| 106 | + | |
| 107 | + const std::vector<Open> & get_open() const { return open; } | |
| 108 | + std::vector<Open> & get_mutable_open() { return open; } | |
| 109 | + void set_open(const std::vector<Open> & value) { this->open = value; } | |
| 110 | 110 | }; |
| 111 | 111 | } |
| 112 | 112 | |
| @@ -123,14 +123,14 @@ struct adl_serializer<std::variant<bool, int64_t>> { | ||
| 123 | 123 | } |
| 124 | 124 | namespace quicktype { |
| 125 | 125 | inline void from_json(const json & j, TopLevel& x) { |
| 126 | - x.set_open(j.at("open").get<std::vector<Open>>()); | |
| 127 | 126 | x.set_tuple(j.at("tuple").get<std::vector<Open>>()); |
| 127 | + x.set_open(j.at("open").get<std::vector<Open>>()); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | inline void to_json(json & j, const TopLevel & x) { |
| 131 | 131 | j = json::object(); |
| 132 | - j["open"] = x.get_open(); | |
| 133 | 132 | j["tuple"] = x.get_tuple(); |
| 133 | + j["open"] = x.get_open(); | |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | namespace nlohmann { |
Mschema-csharp-recordsdefault / QuickType.cs+3 −3
| @@ -25,11 +25,11 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("open", Required = Required.Always)] | |
| 29 | - public Open[] Open { get; set; } | |
| 30 | - | |
| 31 | 28 | [JsonProperty("tuple", Required = Required.Always)] |
| 32 | 29 | public Open[] Tuple { get; set; } |
| 30 | + | |
| 31 | + [JsonProperty("open", Required = Required.Always)] | |
| 32 | + public Open[] Open { get; set; } | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public partial struct Open |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+4 −4
| @@ -22,13 +22,13 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | - [JsonRequired] | |
| 26 | - [JsonPropertyName("open")] | |
| 27 | - public Open[] Open { get; set; } | |
| 28 | - | |
| 29 | 25 | [JsonRequired] |
| 30 | 26 | [JsonPropertyName("tuple")] |
| 31 | 27 | public Open[] Tuple { get; set; } |
| 28 | + | |
| 29 | + [JsonRequired] | |
| 30 | + [JsonPropertyName("open")] | |
| 31 | + public Open[] Open { get; set; } | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public partial struct Open |
Mschema-csharpdefault / QuickType.cs+3 −3
| @@ -25,11 +25,11 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("open", Required = Required.Always)] | |
| 29 | - public Open[] Open { get; set; } | |
| 30 | - | |
| 31 | 28 | [JsonProperty("tuple", Required = Required.Always)] |
| 32 | 29 | public Open[] Tuple { get; set; } |
| 30 | + | |
| 31 | + [JsonProperty("open", Required = Required.Always)] | |
| 32 | + public Open[] Open { get; set; } | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public partial struct Open |
Mschema-dartdefault / TopLevel.dart+4 −4
| @@ -9,21 +9,21 @@ TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | ||
| 9 | 9 | String topLevelToJson(TopLevel data) => json.encode(data.toJson()); |
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | - final List<dynamic> open; | |
| 13 | 12 | final List<dynamic> tuple; |
| 13 | + final List<dynamic> open; | |
| 14 | 14 | |
| 15 | 15 | TopLevel({ |
| 16 | - required this.open, | |
| 17 | 16 | required this.tuple, |
| 17 | + required this.open, | |
| 18 | 18 | }); |
| 19 | 19 | |
| 20 | 20 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 21 | - open: List<dynamic>.from(json["open"].map((x) => x)), | |
| 22 | 21 | tuple: List<dynamic>.from(json["tuple"].map((x) => x)), |
| 22 | + open: List<dynamic>.from(json["open"].map((x) => x)), | |
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | Map<String, dynamic> toJson() => { |
| 26 | - "open": List<dynamic>.from(open.map((x) => x)), | |
| 27 | 26 | "tuple": List<dynamic>.from(tuple.map((x) => x)), |
| 27 | + "open": List<dynamic>.from(open.map((x) => x)), | |
| 28 | 28 | }; |
| 29 | 29 | } |
Mschema-elixirdefault / QuickType.ex+14 −14
| @@ -6,22 +6,14 @@ | ||
| 6 | 6 | # Encode into a JSON string: TopLevel.to_json(struct) |
| 7 | 7 | |
| 8 | 8 | defmodule TopLevel do |
| 9 | - @enforce_keys [:open, :tuple] | |
| 10 | - defstruct [:open, :tuple] | |
| 9 | + @enforce_keys [:tuple, :open] | |
| 10 | + defstruct [:tuple, :open] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | - open: [boolean() | integer()], | |
| 14 | - tuple: [boolean() | integer()] | |
| 13 | + tuple: [boolean() | integer()], | |
| 14 | + open: [boolean() | integer()] | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - def decode_open_element(value) when is_boolean(value), do: value | |
| 18 | - def decode_open_element(value) when is_integer(value), do: value | |
| 19 | - def decode_open_element(_), do: {:error, "Unexpected type when decoding TopLevel.open"} | |
| 20 | - | |
| 21 | - def encode_open_element(value) when is_boolean(value), do: value | |
| 22 | - def encode_open_element(value) when is_integer(value), do: value | |
| 23 | - def encode_open_element(_), do: {:error, "Unexpected type when encoding TopLevel.open"} | |
| 24 | - | |
| 25 | 17 | def decode_tuple_element(value) when is_boolean(value), do: value |
| 26 | 18 | def decode_tuple_element(value) when is_integer(value), do: value |
| 27 | 19 | def decode_tuple_element(_), do: {:error, "Unexpected type when decoding TopLevel.tuple"} |
| @@ -30,10 +22,18 @@ defmodule TopLevel do | ||
| 30 | 22 | def encode_tuple_element(value) when is_integer(value), do: value |
| 31 | 23 | def encode_tuple_element(_), do: {:error, "Unexpected type when encoding TopLevel.tuple"} |
| 32 | 24 | |
| 25 | + def decode_open_element(value) when is_boolean(value), do: value | |
| 26 | + def decode_open_element(value) when is_integer(value), do: value | |
| 27 | + def decode_open_element(_), do: {:error, "Unexpected type when decoding TopLevel.open"} | |
| 28 | + | |
| 29 | + def encode_open_element(value) when is_boolean(value), do: value | |
| 30 | + def encode_open_element(value) when is_integer(value), do: value | |
| 31 | + def encode_open_element(_), do: {:error, "Unexpected type when encoding TopLevel.open"} | |
| 32 | + | |
| 33 | 33 | def from_map(m) do |
| 34 | 34 | %TopLevel{ |
| 35 | - open: Enum.map(m["open"], &decode_open_element/1), | |
| 36 | 35 | tuple: Enum.map(m["tuple"], &decode_tuple_element/1), |
| 36 | + open: Enum.map(m["open"], &decode_open_element/1), | |
| 37 | 37 | } |
| 38 | 38 | end |
| 39 | 39 | |
| @@ -45,8 +45,8 @@ defmodule TopLevel do | ||
| 45 | 45 | |
| 46 | 46 | def to_map(struct) do |
| 47 | 47 | %{ |
| 48 | - "open" => struct.open && Enum.map(struct.open, &encode_open_element/1), | |
| 49 | 48 | "tuple" => struct.tuple && Enum.map(struct.tuple, &encode_tuple_element/1), |
| 49 | + "open" => struct.open && Enum.map(struct.open, &encode_open_element/1), | |
| 50 | 50 | } |
| 51 | 51 | end |
Mschema-elmdefault / QuickType.elm+5 −5
| @@ -24,8 +24,8 @@ import Json.Encode as Jenc | ||
| 24 | 24 | import Dict exposing (Dict) |
| 25 | 25 | |
| 26 | 26 | type alias QuickType = |
| 27 | - { open : List Open | |
| 28 | - , tuple : List Open | |
| 27 | + { tuple : List Open | |
| 28 | + , open : List Open | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | type Open |
| @@ -40,14 +40,14 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 40 | 40 | quickType : Jdec.Decoder QuickType |
| 41 | 41 | quickType = |
| 42 | 42 | Jdec.succeed QuickType |
| 43 | - |> Jpipe.required "open" (Jdec.list open) | |
| 44 | 43 | |> Jpipe.required "tuple" (Jdec.list open) |
| 44 | + |> Jpipe.required "open" (Jdec.list open) | |
| 45 | 45 | |
| 46 | 46 | encodeQuickType : QuickType -> Jenc.Value |
| 47 | 47 | encodeQuickType x = |
| 48 | 48 | Jenc.object |
| 49 | - [ ("open", Jenc.list encodeOpen x.open) | |
| 50 | - , ("tuple", Jenc.list encodeOpen x.tuple) | |
| 49 | + [ ("tuple", Jenc.list encodeOpen x.tuple) | |
| 50 | + , ("open", Jenc.list encodeOpen x.open) | |
| 51 | 51 | ] |
| 52 | 52 | |
| 53 | 53 | open : Jdec.Decoder Open |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -10,8 +10,8 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - open: Open[]; | |
| 14 | 13 | tuple: Open[]; |
| 14 | + open: Open[]; | |
| 15 | 15 | [property: string]: mixed; |
| 16 | 16 | }; |
| 17 | 17 | |
| @@ -182,8 +182,8 @@ function r(name: string) { | ||
| 182 | 182 | |
| 183 | 183 | const typeMap: any = { |
| 184 | 184 | "TopLevel": o([ |
| 185 | - { json: "open", js: "open", typ: a(u(true, 0)) }, | |
| 186 | 185 | { json: "tuple", js: "tuple", typ: a(u(true, 0)) }, |
| 186 | + { json: "open", js: "open", typ: a(u(true, 0)) }, | |
| 187 | 187 | ], "any"), |
| 188 | 188 | }; |
Mschema-golangdefault / quicktype.go+1 −1
| @@ -22,8 +22,8 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | type TopLevel struct { |
| 25 | - Open []Open `json:"open"` | |
| 26 | 25 | Tuple []Open `json:"tuple"` |
| 26 | + Open []Open `json:"open"` | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | type Open struct { |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -4,16 +4,16 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private List<Open> open; | |
| 8 | 7 | private List<Open> tuple; |
| 9 | - | |
| 10 | - @JsonProperty("open") | |
| 11 | - public List<Open> getOpen() { return open; } | |
| 12 | - @JsonProperty("open") | |
| 13 | - public void setOpen(List<Open> value) { this.open = value; } | |
| 8 | + private List<Open> open; | |
| 14 | 9 | |
| 15 | 10 | @JsonProperty("tuple") |
| 16 | 11 | public List<Open> getTuple() { return tuple; } |
| 17 | 12 | @JsonProperty("tuple") |
| 18 | 13 | public void setTuple(List<Open> value) { this.tuple = value; } |
| 14 | + | |
| 15 | + @JsonProperty("open") | |
| 16 | + public List<Open> getOpen() { return open; } | |
| 17 | + @JsonProperty("open") | |
| 18 | + public void setOpen(List<Open> value) { this.open = value; } | |
| 19 | 19 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -4,16 +4,16 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private List<Open> open; | |
| 8 | 7 | private List<Open> tuple; |
| 9 | - | |
| 10 | - @JsonProperty("open") | |
| 11 | - public List<Open> getOpen() { return open; } | |
| 12 | - @JsonProperty("open") | |
| 13 | - public void setOpen(List<Open> value) { this.open = value; } | |
| 8 | + private List<Open> open; | |
| 14 | 9 | |
| 15 | 10 | @JsonProperty("tuple") |
| 16 | 11 | public List<Open> getTuple() { return tuple; } |
| 17 | 12 | @JsonProperty("tuple") |
| 18 | 13 | public void setTuple(List<Open> value) { this.tuple = value; } |
| 14 | + | |
| 15 | + @JsonProperty("open") | |
| 16 | + public List<Open> getOpen() { return open; } | |
| 17 | + @JsonProperty("open") | |
| 18 | + public void setOpen(List<Open> value) { this.open = value; } | |
| 19 | 19 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -4,16 +4,16 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class TopLevel { |
| 7 | - private List<Open> open; | |
| 8 | 7 | private List<Open> tuple; |
| 9 | - | |
| 10 | - @JsonProperty("open") | |
| 11 | - public List<Open> getOpen() { return open; } | |
| 12 | - @JsonProperty("open") | |
| 13 | - public void setOpen(List<Open> value) { this.open = value; } | |
| 8 | + private List<Open> open; | |
| 14 | 9 | |
| 15 | 10 | @JsonProperty("tuple") |
| 16 | 11 | public List<Open> getTuple() { return tuple; } |
| 17 | 12 | @JsonProperty("tuple") |
| 18 | 13 | public void setTuple(List<Open> value) { this.tuple = value; } |
| 14 | + | |
| 15 | + @JsonProperty("open") | |
| 16 | + public List<Open> getOpen() { return open; } | |
| 17 | + @JsonProperty("open") | |
| 18 | + public void setOpen(List<Open> value) { this.open = value; } | |
| 19 | 19 | } |
Mschema-javascriptdefault / TopLevel.js+1 −1
| @@ -172,8 +172,8 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "open", js: "open", typ: a(u(true, 0)) }, | |
| 176 | 175 | { json: "tuple", js: "tuple", typ: a(u(true, 0)) }, |
| 176 | + { json: "open", js: "open", typ: a(u(true, 0)) }, | |
| 177 | 177 | ], "any"), |
| 178 | 178 | }; |
Mschema-kotlin-jacksondefault / TopLevel.kt+2 −2
| @@ -32,10 +32,10 @@ val mapper = jacksonObjectMapper().apply { | ||
| 32 | 32 | |
| 33 | 33 | data class TopLevel ( |
| 34 | 34 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 35 | - val open: List<Open>, | |
| 35 | + val tuple: List<Open>, | |
| 36 | 36 | |
| 37 | 37 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 38 | - val tuple: List<Open> | |
| 38 | + val open: List<Open> | |
| 39 | 39 | ) { |
| 40 | 40 | fun toJson() = mapper.writeValueAsString(this) |
Mschema-kotlindefault / TopLevel.kt+2 −2
| @@ -18,8 +18,8 @@ private val klaxon = Klaxon() | ||
| 18 | 18 | .convert(Open::class, { Open.fromJson(it) }, { it.toJson() }, true) |
| 19 | 19 | |
| 20 | 20 | data class TopLevel ( |
| 21 | - val open: List<Open>, | |
| 22 | - val tuple: List<Open> | |
| 21 | + val tuple: List<Open>, | |
| 22 | + val open: List<Open> | |
| 23 | 23 | ) { |
| 24 | 24 | public fun toJson() = klaxon.toJsonString(this) |
Mschema-phpdefault / TopLevel.php+43 −43
| @@ -4,16 +4,16 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private array $open; // json:open Required | |
| 8 | 7 | private array $tuple; // json:tuple Required |
| 8 | + private array $open; // json:open Required | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | - * @param array $open | |
| 12 | 11 | * @param array $tuple |
| 12 | + * @param array $open | |
| 13 | 13 | */ |
| 14 | - public function __construct(array $open, array $tuple) { | |
| 15 | - $this->open = $open; | |
| 14 | + public function __construct(array $tuple, array $open) { | |
| 16 | 15 | $this->tuple = $tuple; |
| 16 | + $this->open = $open; | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
| @@ -21,7 +21,7 @@ class TopLevel { | ||
| 21 | 21 | * @throws Exception |
| 22 | 22 | * @return array |
| 23 | 23 | */ |
| 24 | - public static function fromOpen(array $value): array { | |
| 24 | + public static function fromTuple(array $value): array { | |
| 25 | 25 | return array_map(function ($value) { |
| 26 | 26 | if (is_bool($value)) { |
| 27 | 27 | return $value; /*bool*/ |
| @@ -37,8 +37,8 @@ class TopLevel { | ||
| 37 | 37 | * @throws Exception |
| 38 | 38 | * @return array |
| 39 | 39 | */ |
| 40 | - public function toOpen(): array { | |
| 41 | - if (TopLevel::validateOpen($this->open)) { | |
| 40 | + public function toTuple(): array { | |
| 41 | + if (TopLevel::validateTuple($this->tuple)) { | |
| 42 | 42 | return array_map(function ($value) { |
| 43 | 43 | if (is_bool($value)) { |
| 44 | 44 | return $value; /*bool*/ |
| @@ -47,9 +47,9 @@ class TopLevel { | ||
| 47 | 47 | } else { |
| 48 | 48 | throw new Exception('Union value has no matching member in TopLevel'); |
| 49 | 49 | } |
| 50 | - }, $this->open); | |
| 50 | + }, $this->tuple); | |
| 51 | 51 | } |
| 52 | - throw new Exception('never get to this TopLevel::open'); | |
| 52 | + throw new Exception('never get to this TopLevel::tuple'); | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
| @@ -57,21 +57,21 @@ class TopLevel { | ||
| 57 | 57 | * @return bool |
| 58 | 58 | * @throws Exception |
| 59 | 59 | */ |
| 60 | - public static function validateOpen(array $value): bool { | |
| 60 | + public static function validateTuple(array $value): bool { | |
| 61 | 61 | if (!is_array($value)) { |
| 62 | - throw new Exception("Attribute Error:TopLevel::open"); | |
| 62 | + throw new Exception("Attribute Error:TopLevel::tuple"); | |
| 63 | 63 | } |
| 64 | 64 | array_walk($value, function($value_v) { |
| 65 | 65 | if (is_bool($value_v)) { |
| 66 | 66 | if (!is_bool($value_v)) { |
| 67 | - throw new Exception("Attribute Error:TopLevel::open"); | |
| 67 | + throw new Exception("Attribute Error:TopLevel::tuple"); | |
| 68 | 68 | } |
| 69 | 69 | } elseif (is_int($value_v)) { |
| 70 | 70 | if (!is_integer($value_v)) { |
| 71 | - throw new Exception("Attribute Error:TopLevel::open"); | |
| 71 | + throw new Exception("Attribute Error:TopLevel::tuple"); | |
| 72 | 72 | } |
| 73 | 73 | } else { |
| 74 | - throw new Exception("Attribute Error:TopLevel::open"); | |
| 74 | + throw new Exception("Attribute Error:TopLevel::tuple"); | |
| 75 | 75 | } |
| 76 | 76 | }); |
| 77 | 77 | return true; |
| @@ -81,20 +81,20 @@ class TopLevel { | ||
| 81 | 81 | * @throws Exception |
| 82 | 82 | * @return array |
| 83 | 83 | */ |
| 84 | - public function getOpen(): array { | |
| 85 | - if (TopLevel::validateOpen($this->open)) { | |
| 86 | - return $this->open; | |
| 84 | + public function getTuple(): array { | |
| 85 | + if (TopLevel::validateTuple($this->tuple)) { | |
| 86 | + return $this->tuple; | |
| 87 | 87 | } |
| 88 | - throw new Exception('never get to getOpen TopLevel::open'); | |
| 88 | + throw new Exception('never get to getTuple TopLevel::tuple'); | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * @return array |
| 93 | 93 | */ |
| 94 | - public static function sampleOpen(): array { | |
| 94 | + public static function sampleTuple(): array { | |
| 95 | 95 | return array( |
| 96 | 96 | true /*31:*/ |
| 97 | - ); /* 31:open*/ | |
| 97 | + ); /* 31:tuple*/ | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| @@ -102,7 +102,7 @@ class TopLevel { | ||
| 102 | 102 | * @throws Exception |
| 103 | 103 | * @return array |
| 104 | 104 | */ |
| 105 | - public static function fromTuple(array $value): array { | |
| 105 | + public static function fromOpen(array $value): array { | |
| 106 | 106 | return array_map(function ($value) { |
| 107 | 107 | if (is_bool($value)) { |
| 108 | 108 | return $value; /*bool*/ |
| @@ -118,8 +118,8 @@ class TopLevel { | ||
| 118 | 118 | * @throws Exception |
| 119 | 119 | * @return array |
| 120 | 120 | */ |
| 121 | - public function toTuple(): array { | |
| 122 | - if (TopLevel::validateTuple($this->tuple)) { | |
| 121 | + public function toOpen(): array { | |
| 122 | + if (TopLevel::validateOpen($this->open)) { | |
| 123 | 123 | return array_map(function ($value) { |
| 124 | 124 | if (is_bool($value)) { |
| 125 | 125 | return $value; /*bool*/ |
| @@ -128,9 +128,9 @@ class TopLevel { | ||
| 128 | 128 | } else { |
| 129 | 129 | throw new Exception('Union value has no matching member in TopLevel'); |
| 130 | 130 | } |
| 131 | - }, $this->tuple); | |
| 131 | + }, $this->open); | |
| 132 | 132 | } |
| 133 | - throw new Exception('never get to this TopLevel::tuple'); | |
| 133 | + throw new Exception('never get to this TopLevel::open'); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
| @@ -138,21 +138,21 @@ class TopLevel { | ||
| 138 | 138 | * @return bool |
| 139 | 139 | * @throws Exception |
| 140 | 140 | */ |
| 141 | - public static function validateTuple(array $value): bool { | |
| 141 | + public static function validateOpen(array $value): bool { | |
| 142 | 142 | if (!is_array($value)) { |
| 143 | - throw new Exception("Attribute Error:TopLevel::tuple"); | |
| 143 | + throw new Exception("Attribute Error:TopLevel::open"); | |
| 144 | 144 | } |
| 145 | 145 | array_walk($value, function($value_v) { |
| 146 | 146 | if (is_bool($value_v)) { |
| 147 | 147 | if (!is_bool($value_v)) { |
| 148 | - throw new Exception("Attribute Error:TopLevel::tuple"); | |
| 148 | + throw new Exception("Attribute Error:TopLevel::open"); | |
| 149 | 149 | } |
| 150 | 150 | } elseif (is_int($value_v)) { |
| 151 | 151 | if (!is_integer($value_v)) { |
| 152 | - throw new Exception("Attribute Error:TopLevel::tuple"); | |
| 152 | + throw new Exception("Attribute Error:TopLevel::open"); | |
| 153 | 153 | } |
| 154 | 154 | } else { |
| 155 | - throw new Exception("Attribute Error:TopLevel::tuple"); | |
| 155 | + throw new Exception("Attribute Error:TopLevel::open"); | |
| 156 | 156 | } |
| 157 | 157 | }); |
| 158 | 158 | return true; |
| @@ -162,20 +162,20 @@ class TopLevel { | ||
| 162 | 162 | * @throws Exception |
| 163 | 163 | * @return array |
| 164 | 164 | */ |
| 165 | - public function getTuple(): array { | |
| 166 | - if (TopLevel::validateTuple($this->tuple)) { | |
| 167 | - return $this->tuple; | |
| 165 | + public function getOpen(): array { | |
| 166 | + if (TopLevel::validateOpen($this->open)) { | |
| 167 | + return $this->open; | |
| 168 | 168 | } |
| 169 | - throw new Exception('never get to getTuple TopLevel::tuple'); | |
| 169 | + throw new Exception('never get to getOpen TopLevel::open'); | |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
| 173 | 173 | * @return array |
| 174 | 174 | */ |
| 175 | - public static function sampleTuple(): array { | |
| 175 | + public static function sampleOpen(): array { | |
| 176 | 176 | return array( |
| 177 | 177 | true /*32:*/ |
| 178 | - ); /* 32:tuple*/ | |
| 178 | + ); /* 32:open*/ | |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
| @@ -183,8 +183,8 @@ class TopLevel { | ||
| 183 | 183 | * @return bool |
| 184 | 184 | */ |
| 185 | 185 | public function validate(): bool { |
| 186 | - return TopLevel::validateOpen($this->open) | |
| 187 | - || TopLevel::validateTuple($this->tuple); | |
| 186 | + return TopLevel::validateTuple($this->tuple) | |
| 187 | + || TopLevel::validateOpen($this->open); | |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
| @@ -193,8 +193,8 @@ class TopLevel { | ||
| 193 | 193 | */ |
| 194 | 194 | public function to(): stdClass { |
| 195 | 195 | $out = new stdClass(); |
| 196 | - $out->{'open'} = $this->toOpen(); | |
| 197 | 196 | $out->{'tuple'} = $this->toTuple(); |
| 197 | + $out->{'open'} = $this->toOpen(); | |
| 198 | 198 | return $out; |
| 199 | 199 | } |
| 200 | 200 | |
| @@ -205,8 +205,8 @@ class TopLevel { | ||
| 205 | 205 | */ |
| 206 | 206 | public static function from(stdClass $obj): TopLevel { |
| 207 | 207 | return new TopLevel( |
| 208 | - TopLevel::fromOpen($obj->{'open'}) | |
| 209 | - ,TopLevel::fromTuple($obj->{'tuple'}) | |
| 208 | + TopLevel::fromTuple($obj->{'tuple'}) | |
| 209 | + ,TopLevel::fromOpen($obj->{'open'}) | |
| 210 | 210 | ); |
| 211 | 211 | } |
| 212 | 212 | |
| @@ -215,8 +215,8 @@ class TopLevel { | ||
| 215 | 215 | */ |
| 216 | 216 | public static function sample(): TopLevel { |
| 217 | 217 | return new TopLevel( |
| 218 | - TopLevel::sampleOpen() | |
| 219 | - ,TopLevel::sampleTuple() | |
| 218 | + TopLevel::sampleTuple() | |
| 219 | + ,TopLevel::sampleOpen() | |
| 220 | 220 | ); |
| 221 | 221 | } |
| 222 | 222 | } |
Mschema-pikedefault / TopLevel.pmod+3 −3
| @@ -13,13 +13,13 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - array(Open) open; // json: "open" | |
| 17 | 16 | array(Open) tuple; // json: "tuple" |
| 17 | + array(Open) open; // json: "open" | |
| 18 | 18 | |
| 19 | 19 | string encode_json() { |
| 20 | 20 | mapping(string:mixed) json = ([ |
| 21 | - "open" : open, | |
| 22 | 21 | "tuple" : tuple, |
| 22 | + "open" : open, | |
| 23 | 23 | ]); |
| 24 | 24 | |
| 25 | 25 | return Standards.JSON.encode(json); |
| @@ -29,8 +29,8 @@ class TopLevel { | ||
| 29 | 29 | TopLevel TopLevel_from_JSON(mixed json) { |
| 30 | 30 | TopLevel retval = TopLevel(); |
| 31 | 31 | |
| 32 | - retval.open = json["open"]; | |
| 33 | 32 | retval.tuple = json["tuple"]; |
| 33 | + retval.open = json["open"]; | |
| 34 | 34 | |
| 35 | 35 | return retval; |
| 36 | 36 | } |
Mschema-pythondefault / quicktype.py+4 −4
| @@ -36,20 +36,20 @@ def to_class(c: Type[T], x: Any) -> dict: | ||
| 36 | 36 | |
| 37 | 37 | @dataclass |
| 38 | 38 | class TopLevel: |
| 39 | - open: list[bool | int] | |
| 40 | 39 | tuple: list[bool | int] |
| 40 | + open: list[bool | int] | |
| 41 | 41 | |
| 42 | 42 | @staticmethod |
| 43 | 43 | def from_dict(obj: Any) -> 'TopLevel': |
| 44 | 44 | assert isinstance(obj, dict) |
| 45 | - open = from_list(lambda x: from_union([from_bool, from_int], x), obj.get("open")) | |
| 46 | 45 | tuple = from_list(lambda x: from_union([from_bool, from_int], x), obj.get("tuple")) |
| 47 | - return TopLevel(open, tuple) | |
| 46 | + open = from_list(lambda x: from_union([from_bool, from_int], x), obj.get("open")) | |
| 47 | + return TopLevel(tuple, open) | |
| 48 | 48 | |
| 49 | 49 | def to_dict(self) -> dict: |
| 50 | 50 | result: dict = {} |
| 51 | - result["open"] = from_list(lambda x: from_union([from_bool, from_int], x), self.open) | |
| 52 | 51 | result["tuple"] = from_list(lambda x: from_union([from_bool, from_int], x), self.tuple) |
| 52 | + result["open"] = from_list(lambda x: from_union([from_bool, from_int], x), self.open) | |
| 53 | 53 | return result |
Mschema-rubydefault / TopLevel.rb+4 −4
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.tuple.first | |
| 7 | +# puts top_level.top_level_open.first | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -52,14 +52,14 @@ class Open < Dry::Struct | ||
| 52 | 52 | end |
| 53 | 53 | |
| 54 | 54 | class TopLevel < Dry::Struct |
| 55 | - attribute :top_level_open, Types.Array(Types.Instance(Open)) | |
| 56 | 55 | attribute :tuple, Types.Array(Types.Instance(Open)) |
| 56 | + attribute :top_level_open, Types.Array(Types.Instance(Open)) | |
| 57 | 57 | |
| 58 | 58 | def self.from_dynamic!(d) |
| 59 | 59 | d = Types::Hash[d] |
| 60 | 60 | new( |
| 61 | - top_level_open: d.fetch("open").map { |x| Open.from_dynamic!(x) }, | |
| 62 | 61 | tuple: d.fetch("tuple").map { |x| Open.from_dynamic!(x) }, |
| 62 | + top_level_open: d.fetch("open").map { |x| Open.from_dynamic!(x) }, | |
| 63 | 63 | ) |
| 64 | 64 | end |
| 65 | 65 | |
| @@ -69,8 +69,8 @@ class TopLevel < Dry::Struct | ||
| 69 | 69 | |
| 70 | 70 | def to_dynamic |
| 71 | 71 | { |
| 72 | - "open" => top_level_open.map { |x| x.to_dynamic }, | |
| 73 | 72 | "tuple" => tuple.map { |x| x.to_dynamic }, |
| 73 | + "open" => top_level_open.map { |x| x.to_dynamic }, | |
| 74 | 74 | } |
| 75 | 75 | end |
Mschema-rustdefault / module_under_test.rs+2 −2
| @@ -15,9 +15,9 @@ use serde::{Serialize, Deserialize}; | ||
| 15 | 15 | |
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | pub struct TopLevel { |
| 18 | - pub open: Vec<Open>, | |
| 19 | - | |
| 20 | 18 | pub tuple: Vec<Open>, |
| 19 | + | |
| 20 | + pub open: Vec<Open>, | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | #[derive(Debug, Clone, Serialize, Deserialize)] |
Mschema-scala3-upickledefault / TopLevel.scala+2 −2
| @@ -66,8 +66,8 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val open : Seq[Open], | |
| 70 | - val tuple : Seq[Open] | |
| 69 | + val tuple : Seq[Open], | |
| 70 | + val open : Seq[Open] | |
| 71 | 71 | ) derives OptionPickler.ReadWriter |
| 72 | 72 | |
| 73 | 73 | type Open = Boolean | Long |
Mschema-scala3default / TopLevel.scala+2 −2
| @@ -8,8 +8,8 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val open : Seq[Open], | |
| 12 | - val tuple : Seq[Open] | |
| 11 | + val tuple : Seq[Open], | |
| 12 | + val open : Seq[Open] | |
| 13 | 13 | ) derives Encoder.AsObject, Decoder |
| 14 | 14 | |
| 15 | 15 | type Open = Boolean | Long |
Mschema-schemadefault / TopLevel.schema+2 −2
| @@ -6,13 +6,13 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": {}, |
| 8 | 8 | "properties": { |
| 9 | - "open": { | |
| 9 | + "tuple": { | |
| 10 | 10 | "type": "array", |
| 11 | 11 | "items": { |
| 12 | 12 | "$ref": "#/definitions/Open" |
| 13 | 13 | } |
| 14 | 14 | }, |
| 15 | - "tuple": { | |
| 15 | + "open": { | |
| 16 | 16 | "type": "array", |
| 17 | 17 | "items": { |
| 18 | 18 | "$ref": "#/definitions/Open" |
Mschema-swiftdefault / quicktype.swift+6 −6
| @@ -7,12 +7,12 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | - let topLevelOpen: [Open] | |
| 11 | 10 | let tuple: [Open] |
| 11 | + let topLevelOpen: [Open] | |
| 12 | 12 | |
| 13 | 13 | enum CodingKeys: String, CodingKey { |
| 14 | - case topLevelOpen = "open" | |
| 15 | 14 | case tuple = "tuple" |
| 15 | + case topLevelOpen = "open" | |
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | |
| @@ -35,12 +35,12 @@ extension TopLevel { | ||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | func with( |
| 38 | - topLevelOpen: [Open]? = nil, | |
| 39 | - tuple: [Open]? = nil | |
| 38 | + tuple: [Open]? = nil, | |
| 39 | + topLevelOpen: [Open]? = nil | |
| 40 | 40 | ) -> TopLevel { |
| 41 | 41 | return TopLevel( |
| 42 | - topLevelOpen: topLevelOpen ?? self.topLevelOpen, | |
| 43 | - tuple: tuple ?? self.tuple | |
| 42 | + tuple: tuple ?? self.tuple, | |
| 43 | + topLevelOpen: topLevelOpen ?? self.topLevelOpen | |
| 44 | 44 | ) |
| 45 | 45 | } |
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,7 +2,7 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "open": z.array(z.union([z.boolean(), z.number()])), | |
| 6 | 5 | "tuple": z.array(z.union([z.boolean(), z.number()])), |
| 6 | + "open": z.array(z.union([z.boolean(), z.number()])), | |
| 7 | 7 | }); |
| 8 | 8 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -8,8 +8,8 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - open: Open[]; | |
| 12 | 11 | tuple: Open[]; |
| 12 | + open: Open[]; | |
| 13 | 13 | [property: string]: unknown; |
| 14 | 14 | } |
| 15 | 15 | |
| @@ -182,7 +182,7 @@ function r(name: string) { | ||
| 182 | 182 | |
| 183 | 183 | const typeMap: any = { |
| 184 | 184 | "TopLevel": o([ |
| 185 | - { json: "open", js: "open", typ: a(u(true, 0)) }, | |
| 186 | 185 | { json: "tuple", js: "tuple", typ: a(u(true, 0)) }, |
| 186 | + { json: "open", js: "open", typ: a(u(true, 0)) }, | |
| 187 | 187 | ], "any"), |
| 188 | 188 | }; |
Test case
32 generated files · +3,164 −0test/inputs/schema/property-order.schema
Aschema-cplusplusdefault / quicktype.hpp+136 −0
| @@ -0,0 +1,136 @@ | ||
| 1 | +// To parse this JSON data, first install | |
| 2 | +// | |
| 3 | +// json.hpp https://github.com/nlohmann/json | |
| 4 | +// | |
| 5 | +// Then include this file, and then do | |
| 6 | +// | |
| 7 | +// TopLevel data = nlohmann::json::parse(jsonString); | |
| 8 | + | |
| 9 | +#pragma once | |
| 10 | + | |
| 11 | +#include "json.hpp" | |
| 12 | + | |
| 13 | +#include <optional> | |
| 14 | +#include <stdexcept> | |
| 15 | +#include <regex> | |
| 16 | + | |
| 17 | +namespace quicktype { | |
| 18 | + using nlohmann::json; | |
| 19 | + | |
| 20 | + #ifndef NLOHMANN_UNTYPED_quicktype_HELPER | |
| 21 | + #define NLOHMANN_UNTYPED_quicktype_HELPER | |
| 22 | + inline json get_untyped(const json & j, const char * property) { | |
| 23 | + if (j.find(property) != j.end()) { | |
| 24 | + return j.at(property).get<json>(); | |
| 25 | + } | |
| 26 | + return json(); | |
| 27 | + } | |
| 28 | + | |
| 29 | + inline json get_untyped(const json & j, std::string property) { | |
| 30 | + return get_untyped(j, property.data()); | |
| 31 | + } | |
| 32 | + #endif | |
| 33 | + | |
| 34 | + class Ordered { | |
| 35 | + public: | |
| 36 | + Ordered() = default; | |
| 37 | + virtual ~Ordered() = default; | |
| 38 | + | |
| 39 | + private: | |
| 40 | + double mango; | |
| 41 | + std::string zebra; | |
| 42 | + bool apple; | |
| 43 | + | |
| 44 | + public: | |
| 45 | + const double & get_mango() const { return mango; } | |
| 46 | + double & get_mutable_mango() { return mango; } | |
| 47 | + void set_mango(const double & value) { this->mango = value; } | |
| 48 | + | |
| 49 | + const std::string & get_zebra() const { return zebra; } | |
| 50 | + std::string & get_mutable_zebra() { return zebra; } | |
| 51 | + void set_zebra(const std::string & value) { this->zebra = value; } | |
| 52 | + | |
| 53 | + const bool & get_apple() const { return apple; } | |
| 54 | + bool & get_mutable_apple() { return apple; } | |
| 55 | + void set_apple(const bool & value) { this->apple = value; } | |
| 56 | + }; | |
| 57 | + | |
| 58 | + class TopLevel { | |
| 59 | + public: | |
| 60 | + TopLevel() = default; | |
| 61 | + virtual ~TopLevel() = default; | |
| 62 | + | |
| 63 | + private: | |
| 64 | + std::string zebra; | |
| 65 | + double mango; | |
| 66 | + bool apple; | |
| 67 | + std::string delta; | |
| 68 | + int64_t banana; | |
| 69 | + Ordered ordered; | |
| 70 | + | |
| 71 | + public: | |
| 72 | + const std::string & get_zebra() const { return zebra; } | |
| 73 | + std::string & get_mutable_zebra() { return zebra; } | |
| 74 | + void set_zebra(const std::string & value) { this->zebra = value; } | |
| 75 | + | |
| 76 | + const double & get_mango() const { return mango; } | |
| 77 | + double & get_mutable_mango() { return mango; } | |
| 78 | + void set_mango(const double & value) { this->mango = value; } | |
| 79 | + | |
| 80 | + const bool & get_apple() const { return apple; } | |
| 81 | + bool & get_mutable_apple() { return apple; } | |
| 82 | + void set_apple(const bool & value) { this->apple = value; } | |
| 83 | + | |
| 84 | + const std::string & get_delta() const { return delta; } | |
| 85 | + std::string & get_mutable_delta() { return delta; } | |
| 86 | + void set_delta(const std::string & value) { this->delta = value; } | |
| 87 | + | |
| 88 | + const int64_t & get_banana() const { return banana; } | |
| 89 | + int64_t & get_mutable_banana() { return banana; } | |
| 90 | + void set_banana(const int64_t & value) { this->banana = value; } | |
| 91 | + | |
| 92 | + const Ordered & get_ordered() const { return ordered; } | |
| 93 | + Ordered & get_mutable_ordered() { return ordered; } | |
| 94 | + void set_ordered(const Ordered & value) { this->ordered = value; } | |
| 95 | + }; | |
| 96 | +} | |
| 97 | + | |
| 98 | +namespace quicktype { | |
| 99 | + void from_json(const json & j, Ordered & x); | |
| 100 | + void to_json(json & j, const Ordered & x); | |
| 101 | + | |
| 102 | + void from_json(const json & j, TopLevel & x); | |
| 103 | + void to_json(json & j, const TopLevel & x); | |
| 104 | + | |
| 105 | + inline void from_json(const json & j, Ordered& x) { | |
| 106 | + x.set_mango(j.at("mango").get<double>()); | |
| 107 | + x.set_zebra(j.at("zebra").get<std::string>()); | |
| 108 | + x.set_apple(j.at("apple").get<bool>()); | |
| 109 | + } | |
| 110 | + | |
| 111 | + inline void to_json(json & j, const Ordered & x) { | |
| 112 | + j = json::object(); | |
| 113 | + j["mango"] = x.get_mango(); | |
| 114 | + j["zebra"] = x.get_zebra(); | |
| 115 | + j["apple"] = x.get_apple(); | |
| 116 | + } | |
| 117 | + | |
| 118 | + inline void from_json(const json & j, TopLevel& x) { | |
| 119 | + x.set_zebra(j.at("zebra").get<std::string>()); | |
| 120 | + x.set_mango(j.at("mango").get<double>()); | |
| 121 | + x.set_apple(j.at("apple").get<bool>()); | |
| 122 | + x.set_delta(j.at("delta").get<std::string>()); | |
| 123 | + x.set_banana(j.at("banana").get<int64_t>()); | |
| 124 | + x.set_ordered(j.at("ordered").get<Ordered>()); | |
| 125 | + } | |
| 126 | + | |
| 127 | + inline void to_json(json & j, const TopLevel & x) { | |
| 128 | + j = json::object(); | |
| 129 | + j["zebra"] = x.get_zebra(); | |
| 130 | + j["mango"] = x.get_mango(); | |
| 131 | + j["apple"] = x.get_apple(); | |
| 132 | + j["delta"] = x.get_delta(); | |
| 133 | + j["banana"] = x.get_banana(); | |
| 134 | + j["ordered"] = x.get_ordered(); | |
| 135 | + } | |
| 136 | +} |
Aschema-csharp-recordsdefault / QuickType.cs+88 −0
| @@ -0,0 +1,88 @@ | ||
| 1 | +// <auto-generated /> | |
| 2 | +// | |
| 3 | +// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do: | |
| 4 | +// | |
| 5 | +// using QuickType; | |
| 6 | +// | |
| 7 | +// var topLevel = TopLevel.FromJson(jsonString); | |
| 8 | +#nullable enable | |
| 9 | +#pragma warning disable CS8618 | |
| 10 | +#pragma warning disable CS8601 | |
| 11 | +#pragma warning disable CS8602 | |
| 12 | +#pragma warning disable CS8603 | |
| 13 | +#pragma warning disable CS8604 | |
| 14 | +#pragma warning disable CS8625 | |
| 15 | +#pragma warning disable CS8765 | |
| 16 | + | |
| 17 | +namespace QuickType | |
| 18 | +{ | |
| 19 | + using System; | |
| 20 | + using System.Collections.Generic; | |
| 21 | + | |
| 22 | + using System.Globalization; | |
| 23 | + using Newtonsoft.Json; | |
| 24 | + using Newtonsoft.Json.Converters; | |
| 25 | + | |
| 26 | + public partial record TopLevel | |
| 27 | + { | |
| 28 | + [JsonProperty("zebra", Required = Required.Always)] | |
| 29 | + public string Zebra { get; set; } | |
| 30 | + | |
| 31 | + [JsonProperty("mango", Required = Required.Always)] | |
| 32 | + public double Mango { get; set; } | |
| 33 | + | |
| 34 | + [JsonProperty("apple", Required = Required.Always)] | |
| 35 | + public bool Apple { get; set; } | |
| 36 | + | |
| 37 | + [JsonProperty("delta", Required = Required.Always)] | |
| 38 | + public string Delta { get; set; } | |
| 39 | + | |
| 40 | + [JsonProperty("banana", Required = Required.Always)] | |
| 41 | + public long Banana { get; set; } | |
| 42 | + | |
| 43 | + [JsonProperty("ordered", Required = Required.Always)] | |
| 44 | + public Ordered Ordered { get; set; } | |
| 45 | + } | |
| 46 | + | |
| 47 | + public partial record Ordered | |
| 48 | + { | |
| 49 | + [JsonProperty("mango", Required = Required.Always)] | |
| 50 | + public double Mango { get; set; } | |
| 51 | + | |
| 52 | + [JsonProperty("zebra", Required = Required.Always)] | |
| 53 | + public string Zebra { get; set; } | |
| 54 | + | |
| 55 | + [JsonProperty("apple", Required = Required.Always)] | |
| 56 | + public bool Apple { get; set; } | |
| 57 | + } | |
| 58 | + | |
| 59 | + public partial record TopLevel | |
| 60 | + { | |
| 61 | + public static TopLevel FromJson(string json) => JsonConvert.DeserializeObject<TopLevel>(json, QuickType.Converter.Settings); | |
| 62 | + } | |
| 63 | + | |
| 64 | + public static partial class Serialize | |
| 65 | + { | |
| 66 | + public static string ToJson(this TopLevel self) => JsonConvert.SerializeObject(self, QuickType.Converter.Settings); | |
| 67 | + } | |
| 68 | + | |
| 69 | + internal static partial class Converter | |
| 70 | + { | |
| 71 | + public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings | |
| 72 | + { | |
| 73 | + MetadataPropertyHandling = MetadataPropertyHandling.Ignore, | |
| 74 | + DateParseHandling = DateParseHandling.None, | |
| 75 | + Converters = | |
| 76 | + { | |
| 77 | + new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal } | |
| 78 | + }, | |
| 79 | + }; | |
| 80 | + } | |
| 81 | +} | |
| 82 | +#pragma warning restore CS8618 | |
| 83 | +#pragma warning restore CS8601 | |
| 84 | +#pragma warning restore CS8602 | |
| 85 | +#pragma warning restore CS8603 | |
| 86 | +#pragma warning restore CS8604 | |
| 87 | +#pragma warning restore CS8625 | |
| 88 | +#pragma warning restore CS8765 |
Aschema-csharp-SystemTextJsondefault / QuickType.cs+201 −0
| @@ -0,0 +1,201 @@ | ||
| 1 | +// <auto-generated /> | |
| 2 | +// | |
| 3 | +// To parse this JSON data, add NuGet 'System.Text.Json' then do: | |
| 4 | +// | |
| 5 | +// using QuickType; | |
| 6 | +// | |
| 7 | +// var topLevel = TopLevel.FromJson(jsonString); | |
| 8 | +#nullable enable | |
| 9 | +#pragma warning disable CS8618 | |
| 10 | +#pragma warning disable CS8601 | |
| 11 | +#pragma warning disable CS8602 | |
| 12 | +#pragma warning disable CS8603 | |
| 13 | + | |
| 14 | +namespace QuickType | |
| 15 | +{ | |
| 16 | + using System; | |
| 17 | + using System.Collections.Generic; | |
| 18 | + | |
| 19 | + using System.Text.Json; | |
| 20 | + using System.Text.Json.Serialization; | |
| 21 | + using System.Globalization; | |
| 22 | + | |
| 23 | + public partial class TopLevel | |
| 24 | + { | |
| 25 | + [JsonRequired] | |
| 26 | + [JsonPropertyName("zebra")] | |
| 27 | + public string Zebra { get; set; } | |
| 28 | + | |
| 29 | + [JsonRequired] | |
| 30 | + [JsonPropertyName("mango")] | |
| 31 | + public double Mango { get; set; } | |
| 32 | + | |
| 33 | + [JsonRequired] | |
| 34 | + [JsonPropertyName("apple")] | |
| 35 | + public bool Apple { get; set; } | |
| 36 | + | |
| 37 | + [JsonRequired] | |
| 38 | + [JsonPropertyName("delta")] | |
| 39 | + public string Delta { get; set; } | |
| 40 | + | |
| 41 | + [JsonRequired] | |
| 42 | + [JsonPropertyName("banana")] | |
| 43 | + public long Banana { get; set; } | |
| 44 | + | |
| 45 | + [JsonRequired] | |
| 46 | + [JsonPropertyName("ordered")] | |
| 47 | + public Ordered Ordered { get; set; } | |
| 48 | + } | |
| 49 | + | |
| 50 | + public partial class Ordered | |
| 51 | + { | |
| 52 | + [JsonRequired] | |
| 53 | + [JsonPropertyName("mango")] | |
| 54 | + public double Mango { get; set; } | |
| 55 | + | |
| 56 | + [JsonRequired] | |
| 57 | + [JsonPropertyName("zebra")] | |
| 58 | + public string Zebra { get; set; } | |
| 59 | + | |
| 60 | + [JsonRequired] | |
| 61 | + [JsonPropertyName("apple")] | |
| 62 | + public bool Apple { get; set; } | |
| 63 | + } | |
| 64 | + | |
| 65 | + public partial class TopLevel | |
| 66 | + { | |
| 67 | + public static TopLevel FromJson(string json) => JsonSerializer.Deserialize<TopLevel>(json, QuickType.Converter.Settings); | |
| 68 | + } | |
| 69 | + | |
| 70 | + public static partial class Serialize | |
| 71 | + { | |
| 72 | + public static string ToJson(this TopLevel self) => JsonSerializer.Serialize(self, QuickType.Converter.Settings); | |
| 73 | + } | |
| 74 | + | |
| 75 | + internal static partial class Converter | |
| 76 | + { | |
| 77 | + public static readonly JsonSerializerOptions Settings = new(JsonSerializerDefaults.General) | |
| 78 | + { | |
| 79 | + Converters = | |
| 80 | + { | |
| 81 | + new DateOnlyConverter(), | |
| 82 | + new TimeOnlyConverter(), | |
| 83 | + IsoDateTimeOffsetConverter.Singleton | |
| 84 | + }, | |
| 85 | + }; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public class DateOnlyConverter : JsonConverter<DateOnly> | |
| 89 | + { | |
| 90 | + private readonly string serializationFormat; | |
| 91 | + public DateOnlyConverter() : this(null) { } | |
| 92 | + | |
| 93 | + public DateOnlyConverter(string? serializationFormat) | |
| 94 | + { | |
| 95 | + this.serializationFormat = serializationFormat ?? "yyyy-MM-dd"; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | |
| 99 | + { | |
| 100 | + var value = reader.GetString(); | |
| 101 | + return DateOnly.Parse(value!); | |
| 102 | + } | |
| 103 | + | |
| 104 | + public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options) | |
| 105 | + => writer.WriteStringValue(value.ToString(serializationFormat)); | |
| 106 | + } | |
| 107 | + | |
| 108 | + public class TimeOnlyConverter : JsonConverter<TimeOnly> | |
| 109 | + { | |
| 110 | + private readonly string serializationFormat; | |
| 111 | + | |
| 112 | + public TimeOnlyConverter() : this(null) { } | |
| 113 | + | |
| 114 | + public TimeOnlyConverter(string? serializationFormat) | |
| 115 | + { | |
| 116 | + this.serializationFormat = serializationFormat ?? "HH:mm:ss.fff"; | |
| 117 | + } | |
| 118 | + | |
| 119 | + public override TimeOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | |
| 120 | + { | |
| 121 | + var value = reader.GetString(); | |
| 122 | + return TimeOnly.Parse(value!); | |
| 123 | + } | |
| 124 | + | |
| 125 | + public override void Write(Utf8JsonWriter writer, TimeOnly value, JsonSerializerOptions options) | |
| 126 | + => writer.WriteStringValue(value.ToString(serializationFormat)); | |
| 127 | + } | |
| 128 | + | |
| 129 | + internal class IsoDateTimeOffsetConverter : JsonConverter<DateTimeOffset> | |
| 130 | + { | |
| 131 | + public override bool CanConvert(Type t) => t == typeof(DateTimeOffset); | |
| 132 | + | |
| 133 | + private const string DefaultDateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK"; | |
| 134 | + | |
| 135 | + private DateTimeStyles _dateTimeStyles = DateTimeStyles.RoundtripKind; | |
| 136 | + private string? _dateTimeFormat; | |
| 137 | + private CultureInfo? _culture; | |
| 138 | + | |
| 139 | + public DateTimeStyles DateTimeStyles | |
| 140 | + { | |
| 141 | + get => _dateTimeStyles; | |
| 142 | + set => _dateTimeStyles = value; | |
| 143 | + } | |
| 144 | + | |
| 145 | + public string? DateTimeFormat | |
| 146 | + { | |
| 147 | + get => _dateTimeFormat ?? string.Empty; | |
| 148 | + set => _dateTimeFormat = (string.IsNullOrEmpty(value)) ? null : value; | |
| 149 | + } | |
| 150 | + | |
| 151 | + public CultureInfo Culture | |
| 152 | + { | |
| 153 | + get => _culture ?? CultureInfo.CurrentCulture; | |
| 154 | + set => _culture = value; | |
| 155 | + } | |
| 156 | + | |
| 157 | + public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) | |
| 158 | + { | |
| 159 | + string text; | |
| 160 | + | |
| 161 | + | |
| 162 | + if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal | |
| 163 | + || (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal) | |
| 164 | + { | |
| 165 | + value = value.ToUniversalTime(); | |
| 166 | + } | |
| 167 | + | |
| 168 | + text = value.ToString(_dateTimeFormat ?? DefaultDateTimeFormat, Culture); | |
| 169 | + | |
| 170 | + writer.WriteStringValue(text); | |
| 171 | + } | |
| 172 | + | |
| 173 | + public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | |
| 174 | + { | |
| 175 | + string? dateText = reader.GetString(); | |
| 176 | + | |
| 177 | + if (string.IsNullOrEmpty(dateText) == false) | |
| 178 | + { | |
| 179 | + if (!string.IsNullOrEmpty(_dateTimeFormat)) | |
| 180 | + { | |
| 181 | + return DateTimeOffset.ParseExact(dateText, _dateTimeFormat, Culture, _dateTimeStyles); | |
| 182 | + } | |
| 183 | + else | |
| 184 | + { | |
| 185 | + return DateTimeOffset.Parse(dateText, Culture, _dateTimeStyles); | |
| 186 | + } | |
| 187 | + } | |
| 188 | + else | |
| 189 | + { | |
| 190 | + return default(DateTimeOffset); | |
| 191 | + } | |
| 192 | + } | |
| 193 | + | |
| 194 | + | |
| 195 | + public static readonly IsoDateTimeOffsetConverter Singleton = new IsoDateTimeOffsetConverter(); | |
| 196 | + } | |
| 197 | +} | |
| 198 | +#pragma warning restore CS8618 | |
| 199 | +#pragma warning restore CS8601 | |
| 200 | +#pragma warning restore CS8602 | |
| 201 | +#pragma warning restore CS8603 |
Aschema-csharpdefault / QuickType.cs+88 −0
| @@ -0,0 +1,88 @@ | ||
| 1 | +// <auto-generated /> | |
| 2 | +// | |
| 3 | +// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do: | |
| 4 | +// | |
| 5 | +// using QuickType; | |
| 6 | +// | |
| 7 | +// var topLevel = TopLevel.FromJson(jsonString); | |
| 8 | +#nullable enable | |
| 9 | +#pragma warning disable CS8618 | |
| 10 | +#pragma warning disable CS8601 | |
| 11 | +#pragma warning disable CS8602 | |
| 12 | +#pragma warning disable CS8603 | |
| 13 | +#pragma warning disable CS8604 | |
| 14 | +#pragma warning disable CS8625 | |
| 15 | +#pragma warning disable CS8765 | |
| 16 | + | |
| 17 | +namespace QuickType | |
| 18 | +{ | |
| 19 | + using System; | |
| 20 | + using System.Collections.Generic; | |
| 21 | + | |
| 22 | + using System.Globalization; | |
| 23 | + using Newtonsoft.Json; | |
| 24 | + using Newtonsoft.Json.Converters; | |
| 25 | + | |
| 26 | + public partial class TopLevel | |
| 27 | + { | |
| 28 | + [JsonProperty("zebra", Required = Required.Always)] | |
| 29 | + public string Zebra { get; set; } | |
| 30 | + | |
| 31 | + [JsonProperty("mango", Required = Required.Always)] | |
| 32 | + public double Mango { get; set; } | |
| 33 | + | |
| 34 | + [JsonProperty("apple", Required = Required.Always)] | |
| 35 | + public bool Apple { get; set; } | |
| 36 | + | |
| 37 | + [JsonProperty("delta", Required = Required.Always)] | |
| 38 | + public string Delta { get; set; } | |
| 39 | + | |
| 40 | + [JsonProperty("banana", Required = Required.Always)] | |
| 41 | + public long Banana { get; set; } | |
| 42 | + | |
| 43 | + [JsonProperty("ordered", Required = Required.Always)] | |
| 44 | + public Ordered Ordered { get; set; } | |
| 45 | + } | |
| 46 | + | |
| 47 | + public partial class Ordered | |
| 48 | + { | |
| 49 | + [JsonProperty("mango", Required = Required.Always)] | |
| 50 | + public double Mango { get; set; } | |
| 51 | + | |
| 52 | + [JsonProperty("zebra", Required = Required.Always)] | |
| 53 | + public string Zebra { get; set; } | |
| 54 | + | |
| 55 | + [JsonProperty("apple", Required = Required.Always)] | |
| 56 | + public bool Apple { get; set; } | |
| 57 | + } | |
| 58 | + | |
| 59 | + public partial class TopLevel | |
| 60 | + { | |
| 61 | + public static TopLevel FromJson(string json) => JsonConvert.DeserializeObject<TopLevel>(json, QuickType.Converter.Settings); | |
| 62 | + } | |
| 63 | + | |
| 64 | + public static partial class Serialize | |
| 65 | + { | |
| 66 | + public static string ToJson(this TopLevel self) => JsonConvert.SerializeObject(self, QuickType.Converter.Settings); | |
| 67 | + } | |
| 68 | + | |
| 69 | + internal static partial class Converter | |
| 70 | + { | |
| 71 | + public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings | |
| 72 | + { | |
| 73 | + MetadataPropertyHandling = MetadataPropertyHandling.Ignore, | |
| 74 | + DateParseHandling = DateParseHandling.None, | |
| 75 | + Converters = | |
| 76 | + { | |
| 77 | + new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal } | |
| 78 | + }, | |
| 79 | + }; | |
| 80 | + } | |
| 81 | +} | |
| 82 | +#pragma warning restore CS8618 | |
| 83 | +#pragma warning restore CS8601 | |
| 84 | +#pragma warning restore CS8602 | |
| 85 | +#pragma warning restore CS8603 | |
| 86 | +#pragma warning restore CS8604 | |
| 87 | +#pragma warning restore CS8625 | |
| 88 | +#pragma warning restore CS8765 |
Aschema-dartdefault / TopLevel.dart+69 −0
| @@ -0,0 +1,69 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String zebra; | |
| 13 | + final double mango; | |
| 14 | + final bool apple; | |
| 15 | + final String delta; | |
| 16 | + final int banana; | |
| 17 | + final Ordered ordered; | |
| 18 | + | |
| 19 | + TopLevel({ | |
| 20 | + required this.zebra, | |
| 21 | + required this.mango, | |
| 22 | + required this.apple, | |
| 23 | + required this.delta, | |
| 24 | + required this.banana, | |
| 25 | + required this.ordered, | |
| 26 | + }); | |
| 27 | + | |
| 28 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 29 | + zebra: json["zebra"], | |
| 30 | + mango: json["mango"]?.toDouble(), | |
| 31 | + apple: json["apple"], | |
| 32 | + delta: json["delta"], | |
| 33 | + banana: json["banana"], | |
| 34 | + ordered: Ordered.fromJson(json["ordered"]), | |
| 35 | + ); | |
| 36 | + | |
| 37 | + Map<String, dynamic> toJson() => { | |
| 38 | + "zebra": zebra, | |
| 39 | + "mango": mango, | |
| 40 | + "apple": apple, | |
| 41 | + "delta": delta, | |
| 42 | + "banana": banana, | |
| 43 | + "ordered": ordered.toJson(), | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +class Ordered { | |
| 48 | + final double mango; | |
| 49 | + final String zebra; | |
| 50 | + final bool apple; | |
| 51 | + | |
| 52 | + Ordered({ | |
| 53 | + required this.mango, | |
| 54 | + required this.zebra, | |
| 55 | + required this.apple, | |
| 56 | + }); | |
| 57 | + | |
| 58 | + factory Ordered.fromJson(Map<String, dynamic> json) => Ordered( | |
| 59 | + mango: json["mango"]?.toDouble(), | |
| 60 | + zebra: json["zebra"], | |
| 61 | + apple: json["apple"], | |
| 62 | + ); | |
| 63 | + | |
| 64 | + Map<String, dynamic> toJson() => { | |
| 65 | + "mango": mango, | |
| 66 | + "zebra": zebra, | |
| 67 | + "apple": apple, | |
| 68 | + }; | |
| 69 | +} |
Aschema-elmdefault / QuickType.elm+88 −0
| @@ -0,0 +1,88 @@ | ||
| 1 | +-- To decode the JSON data, add this file to your project, run | |
| 2 | +-- | |
| 3 | +-- elm install NoRedInk/elm-json-decode-pipeline | |
| 4 | +-- | |
| 5 | +-- add these imports | |
| 6 | +-- | |
| 7 | +-- import Json.Decode exposing (decodeString) | |
| 8 | +-- import QuickType exposing (quickType) | |
| 9 | +-- | |
| 10 | +-- and you're off to the races with | |
| 11 | +-- | |
| 12 | +-- decodeString quickType myJsonString | |
| 13 | + | |
| 14 | +module QuickType exposing | |
| 15 | + ( QuickType | |
| 16 | + , quickTypeToString | |
| 17 | + , quickType | |
| 18 | + , Ordered | |
| 19 | + ) | |
| 20 | + | |
| 21 | +import Json.Decode as Jdec | |
| 22 | +import Json.Decode.Pipeline as Jpipe | |
| 23 | +import Json.Encode as Jenc | |
| 24 | +import Dict exposing (Dict) | |
| 25 | + | |
| 26 | +type alias QuickType = | |
| 27 | + { zebra : String | |
| 28 | + , mango : Float | |
| 29 | + , apple : Bool | |
| 30 | + , delta : String | |
| 31 | + , banana : Int | |
| 32 | + , ordered : Ordered | |
| 33 | + } | |
| 34 | + | |
| 35 | +type alias Ordered = | |
| 36 | + { mango : Float | |
| 37 | + , zebra : String | |
| 38 | + , apple : Bool | |
| 39 | + } | |
| 40 | + | |
| 41 | +-- decoders and encoders | |
| 42 | + | |
| 43 | +quickTypeToString : QuickType -> String | |
| 44 | +quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | |
| 45 | + | |
| 46 | +quickType : Jdec.Decoder QuickType | |
| 47 | +quickType = | |
| 48 | + Jdec.succeed QuickType | |
| 49 | + |> Jpipe.required "zebra" Jdec.string | |
| 50 | + |> Jpipe.required "mango" Jdec.float | |
| 51 | + |> Jpipe.required "apple" Jdec.bool | |
| 52 | + |> Jpipe.required "delta" Jdec.string | |
| 53 | + |> Jpipe.required "banana" Jdec.int | |
| 54 | + |> Jpipe.required "ordered" ordered | |
| 55 | + | |
| 56 | +encodeQuickType : QuickType -> Jenc.Value | |
| 57 | +encodeQuickType x = | |
| 58 | + Jenc.object | |
| 59 | + [ ("zebra", Jenc.string x.zebra) | |
| 60 | + , ("mango", Jenc.float x.mango) | |
| 61 | + , ("apple", Jenc.bool x.apple) | |
| 62 | + , ("delta", Jenc.string x.delta) | |
| 63 | + , ("banana", Jenc.int x.banana) | |
| 64 | + , ("ordered", encodeOrdered x.ordered) | |
| 65 | + ] | |
| 66 | + | |
| 67 | +ordered : Jdec.Decoder Ordered | |
| 68 | +ordered = | |
| 69 | + Jdec.succeed Ordered | |
| 70 | + |> Jpipe.required "mango" Jdec.float | |
| 71 | + |> Jpipe.required "zebra" Jdec.string | |
| 72 | + |> Jpipe.required "apple" Jdec.bool | |
| 73 | + | |
| 74 | +encodeOrdered : Ordered -> Jenc.Value | |
| 75 | +encodeOrdered x = | |
| 76 | + Jenc.object | |
| 77 | + [ ("mango", Jenc.float x.mango) | |
| 78 | + , ("zebra", Jenc.string x.zebra) | |
| 79 | + , ("apple", Jenc.bool x.apple) | |
| 80 | + ] | |
| 81 | + | |
| 82 | +--- encoder helpers | |
| 83 | + | |
| 84 | +makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value | |
| 85 | +makeNullableEncoder f m = | |
| 86 | + case m of | |
| 87 | + Just x -> f x | |
| 88 | + Nothing -> Jenc.null |
Aschema-flowdefault / TopLevel.js+209 −0
| @@ -0,0 +1,209 @@ | ||
| 1 | +// @flow | |
| 2 | + | |
| 3 | +// To parse this data: | |
| 4 | +// | |
| 5 | +// const Convert = require("./TopLevel"); | |
| 6 | +// | |
| 7 | +// const topLevel = Convert.toTopLevel(json); | |
| 8 | +// | |
| 9 | +// These functions will throw an error if the JSON doesn't | |
| 10 | +// match the expected interface, even if the JSON is valid. | |
| 11 | + | |
| 12 | +export type TopLevel = { | |
| 13 | + zebra: string; | |
| 14 | + mango: number; | |
| 15 | + apple: boolean; | |
| 16 | + delta: string; | |
| 17 | + banana: number; | |
| 18 | + ordered: Ordered; | |
| 19 | +}; | |
| 20 | + | |
| 21 | +export type Ordered = { | |
| 22 | + mango: number; | |
| 23 | + zebra: string; | |
| 24 | + apple: boolean; | |
| 25 | +}; | |
| 26 | + | |
| 27 | +// Converts JSON strings to/from your types | |
| 28 | +// and asserts the results of JSON.parse at runtime | |
| 29 | +function toTopLevel(json: string): TopLevel { | |
| 30 | + return cast(JSON.parse(json), r("TopLevel")); | |
| 31 | +} | |
| 32 | + | |
| 33 | +function topLevelToJson(value: TopLevel): string { | |
| 34 | + return JSON.stringify(uncast(value, r("TopLevel")), null, 2); | |
| 35 | +} | |
| 36 | + | |
| 37 | +function invalidValue(typ: any, val: any, key: any, parent: any = '') { | |
| 38 | + const prettyTyp = prettyTypeName(typ); | |
| 39 | + const parentText = parent ? ` on ${parent}` : ''; | |
| 40 | + const keyText = key ? ` for key "${key}"` : ''; | |
| 41 | + throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); | |
| 42 | +} | |
| 43 | + | |
| 44 | +function prettyTypeName(typ: any): string { | |
| 45 | + if (Array.isArray(typ)) { | |
| 46 | + if (typ.length === 2 && typ[0] === undefined) { | |
| 47 | + return `an optional ${prettyTypeName(typ[1])}`; | |
| 48 | + } else { | |
| 49 | + return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`; | |
| 50 | + } | |
| 51 | + } else if (typeof typ === "object" && typ.literal !== undefined) { | |
| 52 | + return typ.literal; | |
| 53 | + } else { | |
| 54 | + return typeof typ; | |
| 55 | + } | |
| 56 | +} | |
| 57 | + | |
| 58 | +function jsonToJSProps(typ: any): any { | |
| 59 | + if (typ.jsonToJS === undefined) { | |
| 60 | + const map: any = {}; | |
| 61 | + typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ }); | |
| 62 | + typ.jsonToJS = map; | |
| 63 | + } | |
| 64 | + return typ.jsonToJS; | |
| 65 | +} | |
| 66 | + | |
| 67 | +function jsToJSONProps(typ: any): any { | |
| 68 | + if (typ.jsToJSON === undefined) { | |
| 69 | + const map: any = {}; | |
| 70 | + typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ }); | |
| 71 | + typ.jsToJSON = map; | |
| 72 | + } | |
| 73 | + return typ.jsToJSON; | |
| 74 | +} | |
| 75 | + | |
| 76 | +function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any { | |
| 77 | + function transformPrimitive(typ: string, val: any): any { | |
| 78 | + if (typeof typ === typeof val) return val; | |
| 79 | + return invalidValue(typ, val, key, parent); | |
| 80 | + } | |
| 81 | + | |
| 82 | + function transformUnion(typs: any[], val: any): any { | |
| 83 | + // val must validate against one typ in typs | |
| 84 | + const l = typs.length; | |
| 85 | + for (let i = 0; i < l; i++) { | |
| 86 | + const typ = typs[i]; | |
| 87 | + try { | |
| 88 | + return transform(val, typ, getProps); | |
| 89 | + } catch (_) {} | |
| 90 | + } | |
| 91 | + return invalidValue(typs, val, key, parent); | |
| 92 | + } | |
| 93 | + | |
| 94 | + function transformEnum(cases: string[], val: any): any { | |
| 95 | + if (cases.indexOf(val) !== -1) return val; | |
| 96 | + return invalidValue(cases.map(a => { return l(a); }), val, key, parent); | |
| 97 | + } | |
| 98 | + | |
| 99 | + function transformArray(typ: any, val: any): any { | |
| 100 | + // val must be an array with no invalid elements | |
| 101 | + if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent); | |
| 102 | + return val.map(el => transform(el, typ, getProps)); | |
| 103 | + } | |
| 104 | + | |
| 105 | + function transformDate(val: any): any { | |
| 106 | + if (val === null) { | |
| 107 | + return null; | |
| 108 | + } | |
| 109 | + const d = new Date(val); | |
| 110 | + if (isNaN(d.valueOf())) { | |
| 111 | + return invalidValue(l("Date"), val, key, parent); | |
| 112 | + } | |
| 113 | + return d; | |
| 114 | + } | |
| 115 | + | |
| 116 | + function transformObject(props: { [k: string]: any }, additional: any, val: any): any { | |
| 117 | + if (val === null || typeof val !== "object" || Array.isArray(val)) { | |
| 118 | + return invalidValue(l(ref || "object"), val, key, parent); | |
| 119 | + } | |
| 120 | + const result: any = {}; | |
| 121 | + Object.getOwnPropertyNames(props).forEach(key => { | |
| 122 | + const prop = props[key]; | |
| 123 | + const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; | |
| 124 | + result[prop.key] = transform(v, prop.typ, getProps, key, ref); | |
| 125 | + }); | |
| 126 | + Object.getOwnPropertyNames(val).forEach(key => { | |
| 127 | + if (!Object.prototype.hasOwnProperty.call(props, key)) { | |
| 128 | + result[key] = transform(val[key], additional, getProps, key, ref); | |
| 129 | + } | |
| 130 | + }); | |
| 131 | + return result; | |
| 132 | + } | |
| 133 | + | |
| 134 | + if (typ === "any") return val; | |
| 135 | + if (typ === null) { | |
| 136 | + if (val === null) return val; | |
| 137 | + return invalidValue(typ, val, key, parent); | |
| 138 | + } | |
| 139 | + if (typ === false) return invalidValue(typ, val, key, parent); | |
| 140 | + let ref: any = undefined; | |
| 141 | + while (typeof typ === "object" && typ.ref !== undefined) { | |
| 142 | + ref = typ.ref; | |
| 143 | + typ = typeMap[typ.ref]; | |
| 144 | + } | |
| 145 | + if (Array.isArray(typ)) return transformEnum(typ, val); | |
| 146 | + if (typeof typ === "object") { | |
| 147 | + return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val) | |
| 148 | + : typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val) | |
| 149 | + : typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val) | |
| 150 | + : invalidValue(typ, val, key, parent); | |
| 151 | + } | |
| 152 | + // Numbers can be parsed by Date but shouldn't be. | |
| 153 | + if (typ === Date && typeof val !== "number") return transformDate(val); | |
| 154 | + return transformPrimitive(typ, val); | |
| 155 | +} | |
| 156 | + | |
| 157 | +function cast<T>(val: any, typ: any): T { | |
| 158 | + return transform(val, typ, jsonToJSProps); | |
| 159 | +} | |
| 160 | + | |
| 161 | +function uncast<T>(val: T, typ: any): any { | |
| 162 | + return transform(val, typ, jsToJSONProps); | |
| 163 | +} | |
| 164 | + | |
| 165 | +function l(typ: any) { | |
| 166 | + return { literal: typ }; | |
| 167 | +} | |
| 168 | + | |
| 169 | +function a(typ: any) { | |
| 170 | + return { arrayItems: typ }; | |
| 171 | +} | |
| 172 | + | |
| 173 | +function u(...typs: any[]) { | |
| 174 | + return { unionMembers: typs }; | |
| 175 | +} | |
| 176 | + | |
| 177 | +function o(props: any[], additional: any) { | |
| 178 | + return { props, additional }; | |
| 179 | +} | |
| 180 | + | |
| 181 | +function m(additional: any) { | |
| 182 | + const props: any[] = []; | |
| 183 | + return { props, additional }; | |
| 184 | +} | |
| 185 | + | |
| 186 | +function r(name: string) { | |
| 187 | + return { ref: name }; | |
| 188 | +} | |
| 189 | + | |
| 190 | +const typeMap: any = { | |
| 191 | + "TopLevel": o([ | |
| 192 | + { json: "zebra", js: "zebra", typ: "" }, | |
| 193 | + { json: "mango", js: "mango", typ: 3.14 }, | |
| 194 | + { json: "apple", js: "apple", typ: true }, | |
| 195 | + { json: "delta", js: "delta", typ: "" }, | |
| 196 | + { json: "banana", js: "banana", typ: 0 }, | |
| 197 | + { json: "ordered", js: "ordered", typ: r("Ordered") }, | |
| 198 | + ], false), | |
| 199 | + "Ordered": o([ | |
| 200 | + { json: "mango", js: "mango", typ: 3.14 }, | |
| 201 | + { json: "zebra", js: "zebra", typ: "" }, | |
| 202 | + { json: "apple", js: "apple", typ: true }, | |
| 203 | + ], false), | |
| 204 | +}; | |
| 205 | + | |
| 206 | +module.exports = { | |
| 207 | + "topLevelToJson": topLevelToJson, | |
| 208 | + "toTopLevel": toTopLevel, | |
| 209 | +}; |
Aschema-golangdefault / quicktype.go+34 −0
| @@ -0,0 +1,34 @@ | ||
| 1 | +// Code generated from JSON Schema using quicktype. DO NOT EDIT. | |
| 2 | +// To parse and unparse this JSON data, add this code to your project and do: | |
| 3 | +// | |
| 4 | +// topLevel, err := UnmarshalTopLevel(bytes) | |
| 5 | +// bytes, err = topLevel.Marshal() | |
| 6 | + | |
| 7 | +package main | |
| 8 | + | |
| 9 | +import "encoding/json" | |
| 10 | + | |
| 11 | +func UnmarshalTopLevel(data []byte) (TopLevel, error) { | |
| 12 | + var r TopLevel | |
| 13 | + err := json.Unmarshal(data, &r) | |
| 14 | + return r, err | |
| 15 | +} | |
| 16 | + | |
| 17 | +func (r *TopLevel) Marshal() ([]byte, error) { | |
| 18 | + return json.Marshal(r) | |
| 19 | +} | |
| 20 | + | |
| 21 | +type TopLevel struct { | |
| 22 | + Zebra string `json:"zebra"` | |
| 23 | + Mango float64 `json:"mango"` | |
| 24 | + Apple bool `json:"apple"` | |
| 25 | + Delta string `json:"delta"` | |
| 26 | + Banana int64 `json:"banana"` | |
| 27 | + Ordered Ordered `json:"ordered"` | |
| 28 | +} | |
| 29 | + | |
| 30 | +type Ordered struct { | |
| 31 | + Mango float64 `json:"mango"` | |
| 32 | + Zebra string `json:"zebra"` | |
| 33 | + Apple bool `json:"apple"` | |
| 34 | +} |
Aschema-java-datetime-legacydefault / src / main / java / io / quicktype / Converter.java+121 −0
| @@ -0,0 +1,121 @@ | ||
| 1 | +// To use this code, add the following Maven dependency to your project: | |
| 2 | +// | |
| 3 | +// | |
| 4 | +// com.fasterxml.jackson.core : jackson-databind : 2.9.0 | |
| 5 | +// | |
| 6 | +// | |
| 7 | +// Import this package: | |
| 8 | +// | |
| 9 | +// import io.quicktype.Converter; | |
| 10 | +// | |
| 11 | +// Then you can deserialize a JSON string with | |
| 12 | +// | |
| 13 | +// TopLevel data = Converter.fromJsonString(jsonString); | |
| 14 | + | |
| 15 | +package io.quicktype; | |
| 16 | + | |
| 17 | +import java.io.IOException; | |
| 18 | +import com.fasterxml.jackson.databind.*; | |
| 19 | +import com.fasterxml.jackson.databind.module.SimpleModule; | |
| 20 | +import com.fasterxml.jackson.core.JsonParser; | |
| 21 | +import com.fasterxml.jackson.core.JsonProcessingException; | |
| 22 | +import java.util.*; | |
| 23 | +import java.util.Date; | |
| 24 | +import java.text.SimpleDateFormat; | |
| 25 | + | |
| 26 | +public class Converter { | |
| 27 | + // Date-time helpers | |
| 28 | + | |
| 29 | + private static final String[] DATE_TIME_FORMATS = { | |
| 30 | + "yyyy-MM-dd'T'HH:mm:ss.SX", | |
| 31 | + "yyyy-MM-dd'T'HH:mm:ss.S", | |
| 32 | + "yyyy-MM-dd'T'HH:mm:ssX", | |
| 33 | + "yyyy-MM-dd'T'HH:mm:ss", | |
| 34 | + "yyyy-MM-dd HH:mm:ss.SX", | |
| 35 | + "yyyy-MM-dd HH:mm:ss.S", | |
| 36 | + "yyyy-MM-dd HH:mm:ssX", | |
| 37 | + "yyyy-MM-dd HH:mm:ss", | |
| 38 | + "HH:mm:ss.SZ", | |
| 39 | + "HH:mm:ss.S", | |
| 40 | + "HH:mm:ssZ", | |
| 41 | + "HH:mm:ss", | |
| 42 | + "yyyy-MM-dd", | |
| 43 | + }; | |
| 44 | + | |
| 45 | + public static Date parseAllDateTimeString(String str) { | |
| 46 | + for (String format : DATE_TIME_FORMATS) { | |
| 47 | + try { | |
| 48 | + return new SimpleDateFormat(format).parse(str); | |
| 49 | + } catch (Exception ex) { | |
| 50 | + // Ignored | |
| 51 | + } | |
| 52 | + } | |
| 53 | + return null; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public static String serializeDateTime(Date datetime) { | |
| 57 | + return new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ssZ").format(datetime); | |
| 58 | + } | |
| 59 | + | |
| 60 | + public static String serializeDate(Date datetime) { | |
| 61 | + return new SimpleDateFormat("yyyy-MM-dd").format(datetime); | |
| 62 | + } | |
| 63 | + | |
| 64 | + public static String serializeTime(Date datetime) { | |
| 65 | + return new SimpleDateFormat("hh:mm:ssZ").format(datetime); | |
| 66 | + } | |
| 67 | + // Serialize/deserialize helpers | |
| 68 | + | |
| 69 | + public static TopLevel fromJsonString(String json) throws IOException { | |
| 70 | + return getObjectReader().readValue(json); | |
| 71 | + } | |
| 72 | + | |
| 73 | + public static String toJsonString(TopLevel obj) throws JsonProcessingException { | |
| 74 | + return getObjectWriter().writeValueAsString(obj); | |
| 75 | + } | |
| 76 | + | |
| 77 | + private static ObjectReader reader; | |
| 78 | + private static ObjectWriter writer; | |
| 79 | + | |
| 80 | + private static void instantiateMapper() { | |
| 81 | + ObjectMapper mapper = new ObjectMapper(); | |
| 82 | + mapper.findAndRegisterModules(); | |
| 83 | + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | |
| 84 | + mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); | |
| 85 | + SimpleModule module = new SimpleModule(); | |
| 86 | + module.addDeserializer(Date.class, new JsonDeserializer<Date>() { | |
| 87 | + @Override | |
| 88 | + public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { | |
| 89 | + String value = jsonParser.getText(); | |
| 90 | + return Converter.parseAllDateTimeString(value); | |
| 91 | + } | |
| 92 | + }); | |
| 93 | + module.addDeserializer(Date.class, new JsonDeserializer<Date>() { | |
| 94 | + @Override | |
| 95 | + public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { | |
| 96 | + String value = jsonParser.getText(); | |
| 97 | + return Converter.parseAllDateTimeString(value); | |
| 98 | + } | |
| 99 | + }); | |
| 100 | + module.addDeserializer(Date.class, new JsonDeserializer<Date>() { | |
| 101 | + @Override | |
| 102 | + public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { | |
| 103 | + String value = jsonParser.getText(); | |
| 104 | + return Converter.parseAllDateTimeString(value); | |
| 105 | + } | |
| 106 | + }); | |
| 107 | + mapper.registerModule(module); | |
| 108 | + reader = mapper.readerFor(TopLevel.class); | |
| 109 | + writer = mapper.writerFor(TopLevel.class); | |
| 110 | + } | |
| 111 | + | |
| 112 | + private static ObjectReader getObjectReader() { | |
| 113 | + if (reader == null) instantiateMapper(); | |
| 114 | + return reader; | |
| 115 | + } | |
| 116 | + | |
| 117 | + private static ObjectWriter getObjectWriter() { | |
| 118 | + if (writer == null) instantiateMapper(); | |
| 119 | + return writer; | |
| 120 | + } | |
| 121 | +} |
Aschema-java-datetime-legacydefault / src / main / java / io / quicktype / Ordered.java+24 −0
| @@ -0,0 +1,24 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.*; | |
| 4 | + | |
| 5 | +public class Ordered { | |
| 6 | + private double mango; | |
| 7 | + private String zebra; | |
| 8 | + private boolean apple; | |
| 9 | + | |
| 10 | + @JsonProperty("mango") | |
| 11 | + public double getMango() { return mango; } | |
| 12 | + @JsonProperty("mango") | |
| 13 | + public void setMango(double value) { this.mango = value; } | |
| 14 | + | |
| 15 | + @JsonProperty("zebra") | |
| 16 | + public String getZebra() { return zebra; } | |
| 17 | + @JsonProperty("zebra") | |
| 18 | + public void setZebra(String value) { this.zebra = value; } | |
| 19 | + | |
| 20 | + @JsonProperty("apple") | |
| 21 | + public boolean getApple() { return apple; } | |
| 22 | + @JsonProperty("apple") | |
| 23 | + public void setApple(boolean value) { this.apple = value; } | |
| 24 | +} |
Aschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+42 −0
| @@ -0,0 +1,42 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.*; | |
| 4 | + | |
| 5 | +public class TopLevel { | |
| 6 | + private String zebra; | |
| 7 | + private double mango; | |
| 8 | + private boolean apple; | |
| 9 | + private String delta; | |
| 10 | + private long banana; | |
| 11 | + private Ordered ordered; | |
| 12 | + | |
| 13 | + @JsonProperty("zebra") | |
| 14 | + public String getZebra() { return zebra; } | |
| 15 | + @JsonProperty("zebra") | |
| 16 | + public void setZebra(String value) { this.zebra = value; } | |
| 17 | + | |
| 18 | + @JsonProperty("mango") | |
| 19 | + public double getMango() { return mango; } | |
| 20 | + @JsonProperty("mango") | |
| 21 | + public void setMango(double value) { this.mango = value; } | |
| 22 | + | |
| 23 | + @JsonProperty("apple") | |
| 24 | + public boolean getApple() { return apple; } | |
| 25 | + @JsonProperty("apple") | |
| 26 | + public void setApple(boolean value) { this.apple = value; } | |
| 27 | + | |
| 28 | + @JsonProperty("delta") | |
| 29 | + public String getDelta() { return delta; } | |
| 30 | + @JsonProperty("delta") | |
| 31 | + public void setDelta(String value) { this.delta = value; } | |
| 32 | + | |
| 33 | + @JsonProperty("banana") | |
| 34 | + public long getBanana() { return banana; } | |
| 35 | + @JsonProperty("banana") | |
| 36 | + public void setBanana(long value) { this.banana = value; } | |
| 37 | + | |
| 38 | + @JsonProperty("ordered") | |
| 39 | + public Ordered getOrdered() { return ordered; } | |
| 40 | + @JsonProperty("ordered") | |
| 41 | + public void setOrdered(Ordered value) { this.ordered = value; } | |
| 42 | +} |
Aschema-java-lombokdefault / src / main / java / io / quicktype / Converter.java+101 −0
| @@ -0,0 +1,101 @@ | ||
| 1 | +// To use this code, add the following Maven dependency to your project: | |
| 2 | +// | |
| 3 | +// | |
| 4 | +// com.fasterxml.jackson.core : jackson-databind : 2.9.0 | |
| 5 | +// com.fasterxml.jackson.datatype : jackson-datatype-jsr310 : 2.9.0 | |
| 6 | +// | |
| 7 | +// Import this package: | |
| 8 | +// | |
| 9 | +// import io.quicktype.Converter; | |
| 10 | +// | |
| 11 | +// Then you can deserialize a JSON string with | |
| 12 | +// | |
| 13 | +// TopLevel data = Converter.fromJsonString(jsonString); | |
| 14 | + | |
| 15 | +package io.quicktype; | |
| 16 | + | |
| 17 | +import java.io.IOException; | |
| 18 | +import com.fasterxml.jackson.databind.*; | |
| 19 | +import com.fasterxml.jackson.databind.module.SimpleModule; | |
| 20 | +import com.fasterxml.jackson.core.JsonParser; | |
| 21 | +import com.fasterxml.jackson.core.JsonProcessingException; | |
| 22 | +import java.util.*; | |
| 23 | +import java.time.LocalDate; | |
| 24 | +import java.time.OffsetDateTime; | |
| 25 | +import java.time.OffsetTime; | |
| 26 | +import java.time.ZoneOffset; | |
| 27 | +import java.time.ZonedDateTime; | |
| 28 | +import java.time.format.DateTimeFormatter; | |
| 29 | +import java.time.format.DateTimeFormatterBuilder; | |
| 30 | +import java.time.temporal.ChronoField; | |
| 31 | + | |
| 32 | +public class Converter { | |
| 33 | + // Date-time helpers | |
| 34 | + | |
| 35 | + private static final DateTimeFormatter DATE_TIME_FORMATTER = new DateTimeFormatterBuilder() | |
| 36 | + .appendOptional(DateTimeFormatter.ISO_DATE_TIME) | |
| 37 | + .appendOptional(DateTimeFormatter.ISO_OFFSET_DATE_TIME) | |
| 38 | + .appendOptional(DateTimeFormatter.ISO_INSTANT) | |
| 39 | + .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SX")) | |
| 40 | + .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ssX")) | |
| 41 | + .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) | |
| 42 | + .toFormatter() | |
| 43 | + .withZone(ZoneOffset.UTC); | |
| 44 | + | |
| 45 | + public static OffsetDateTime parseDateTimeString(String str) { | |
| 46 | + return ZonedDateTime.from(Converter.DATE_TIME_FORMATTER.parse(str)).toOffsetDateTime(); | |
| 47 | + } | |
| 48 | + | |
| 49 | + private static final DateTimeFormatter TIME_FORMATTER = new DateTimeFormatterBuilder() | |
| 50 | + .appendOptional(DateTimeFormatter.ISO_TIME) | |
| 51 | + .appendOptional(DateTimeFormatter.ISO_OFFSET_TIME) | |
| 52 | + .parseDefaulting(ChronoField.YEAR, 2020) | |
| 53 | + .parseDefaulting(ChronoField.MONTH_OF_YEAR, 1) | |
| 54 | + .parseDefaulting(ChronoField.DAY_OF_MONTH, 1) | |
| 55 | + .toFormatter() | |
| 56 | + .withZone(ZoneOffset.UTC); | |
| 57 | + | |
| 58 | + public static OffsetTime parseTimeString(String str) { | |
| 59 | + return ZonedDateTime.from(Converter.TIME_FORMATTER.parse(str)).toOffsetDateTime().toOffsetTime(); | |
| 60 | + } | |
| 61 | + // Serialize/deserialize helpers | |
| 62 | + | |
| 63 | + public static TopLevel fromJsonString(String json) throws IOException { | |
| 64 | + return getObjectReader().readValue(json); | |
| 65 | + } | |
| 66 | + | |
| 67 | + public static String toJsonString(TopLevel obj) throws JsonProcessingException { | |
| 68 | + return getObjectWriter().writeValueAsString(obj); | |
| 69 | + } | |
| 70 | + | |
| 71 | + private static ObjectReader reader; | |
| 72 | + private static ObjectWriter writer; | |
| 73 | + | |
| 74 | + private static void instantiateMapper() { | |
| 75 | + ObjectMapper mapper = new ObjectMapper(); | |
| 76 | + mapper.findAndRegisterModules(); | |
| 77 | + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | |
| 78 | + mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); | |
| 79 | + SimpleModule module = new SimpleModule(); | |
| 80 | + module.addDeserializer(OffsetDateTime.class, new JsonDeserializer<OffsetDateTime>() { | |
| 81 | + @Override | |
| 82 | + public OffsetDateTime deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { | |
| 83 | + String value = jsonParser.getText(); | |
| 84 | + return Converter.parseDateTimeString(value); | |
| 85 | + } | |
| 86 | + }); | |
| 87 | + mapper.registerModule(module); | |
| 88 | + reader = mapper.readerFor(TopLevel.class); | |
| 89 | + writer = mapper.writerFor(TopLevel.class); | |
| 90 | + } | |
| 91 | + | |
| 92 | + private static ObjectReader getObjectReader() { | |
| 93 | + if (reader == null) instantiateMapper(); | |
| 94 | + return reader; | |
| 95 | + } | |
| 96 | + | |
| 97 | + private static ObjectWriter getObjectWriter() { | |
| 98 | + if (writer == null) instantiateMapper(); | |
| 99 | + return writer; | |
| 100 | + } | |
| 101 | +} |
Aschema-java-lombokdefault / src / main / java / io / quicktype / Ordered.java+24 −0
| @@ -0,0 +1,24 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.*; | |
| 4 | + | |
| 5 | +public class Ordered { | |
| 6 | + private double mango; | |
| 7 | + private String zebra; | |
| 8 | + private boolean apple; | |
| 9 | + | |
| 10 | + @JsonProperty("mango") | |
| 11 | + public double getMango() { return mango; } | |
| 12 | + @JsonProperty("mango") | |
| 13 | + public void setMango(double value) { this.mango = value; } | |
| 14 | + | |
| 15 | + @JsonProperty("zebra") | |
| 16 | + public String getZebra() { return zebra; } | |
| 17 | + @JsonProperty("zebra") | |
| 18 | + public void setZebra(String value) { this.zebra = value; } | |
| 19 | + | |
| 20 | + @JsonProperty("apple") | |
| 21 | + public boolean getApple() { return apple; } | |
| 22 | + @JsonProperty("apple") | |
| 23 | + public void setApple(boolean value) { this.apple = value; } | |
| 24 | +} |
Aschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+42 −0
| @@ -0,0 +1,42 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.*; | |
| 4 | + | |
| 5 | +public class TopLevel { | |
| 6 | + private String zebra; | |
| 7 | + private double mango; | |
| 8 | + private boolean apple; | |
| 9 | + private String delta; | |
| 10 | + private long banana; | |
| 11 | + private Ordered ordered; | |
| 12 | + | |
| 13 | + @JsonProperty("zebra") | |
| 14 | + public String getZebra() { return zebra; } | |
| 15 | + @JsonProperty("zebra") | |
| 16 | + public void setZebra(String value) { this.zebra = value; } | |
| 17 | + | |
| 18 | + @JsonProperty("mango") | |
| 19 | + public double getMango() { return mango; } | |
| 20 | + @JsonProperty("mango") | |
| 21 | + public void setMango(double value) { this.mango = value; } | |
| 22 | + | |
| 23 | + @JsonProperty("apple") | |
| 24 | + public boolean getApple() { return apple; } | |
| 25 | + @JsonProperty("apple") | |
| 26 | + public void setApple(boolean value) { this.apple = value; } | |
| 27 | + | |
| 28 | + @JsonProperty("delta") | |
| 29 | + public String getDelta() { return delta; } | |
| 30 | + @JsonProperty("delta") | |
| 31 | + public void setDelta(String value) { this.delta = value; } | |
| 32 | + | |
| 33 | + @JsonProperty("banana") | |
| 34 | + public long getBanana() { return banana; } | |
| 35 | + @JsonProperty("banana") | |
| 36 | + public void setBanana(long value) { this.banana = value; } | |
| 37 | + | |
| 38 | + @JsonProperty("ordered") | |
| 39 | + public Ordered getOrdered() { return ordered; } | |
| 40 | + @JsonProperty("ordered") | |
| 41 | + public void setOrdered(Ordered value) { this.ordered = value; } | |
| 42 | +} |
Aschema-javadefault / src / main / java / io / quicktype / Converter.java+101 −0
| @@ -0,0 +1,101 @@ | ||
| 1 | +// To use this code, add the following Maven dependency to your project: | |
| 2 | +// | |
| 3 | +// | |
| 4 | +// com.fasterxml.jackson.core : jackson-databind : 2.9.0 | |
| 5 | +// com.fasterxml.jackson.datatype : jackson-datatype-jsr310 : 2.9.0 | |
| 6 | +// | |
| 7 | +// Import this package: | |
| 8 | +// | |
| 9 | +// import io.quicktype.Converter; | |
| 10 | +// | |
| 11 | +// Then you can deserialize a JSON string with | |
| 12 | +// | |
| 13 | +// TopLevel data = Converter.fromJsonString(jsonString); | |
| 14 | + | |
| 15 | +package io.quicktype; | |
| 16 | + | |
| 17 | +import java.io.IOException; | |
| 18 | +import com.fasterxml.jackson.databind.*; | |
| 19 | +import com.fasterxml.jackson.databind.module.SimpleModule; | |
| 20 | +import com.fasterxml.jackson.core.JsonParser; | |
| 21 | +import com.fasterxml.jackson.core.JsonProcessingException; | |
| 22 | +import java.util.*; | |
| 23 | +import java.time.LocalDate; | |
| 24 | +import java.time.OffsetDateTime; | |
| 25 | +import java.time.OffsetTime; | |
| 26 | +import java.time.ZoneOffset; | |
| 27 | +import java.time.ZonedDateTime; | |
| 28 | +import java.time.format.DateTimeFormatter; | |
| 29 | +import java.time.format.DateTimeFormatterBuilder; | |
| 30 | +import java.time.temporal.ChronoField; | |
| 31 | + | |
| 32 | +public class Converter { | |
| 33 | + // Date-time helpers | |
| 34 | + | |
| 35 | + private static final DateTimeFormatter DATE_TIME_FORMATTER = new DateTimeFormatterBuilder() | |
| 36 | + .appendOptional(DateTimeFormatter.ISO_DATE_TIME) | |
| 37 | + .appendOptional(DateTimeFormatter.ISO_OFFSET_DATE_TIME) | |
| 38 | + .appendOptional(DateTimeFormatter.ISO_INSTANT) | |
| 39 | + .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SX")) | |
| 40 | + .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ssX")) | |
| 41 | + .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) | |
| 42 | + .toFormatter() | |
| 43 | + .withZone(ZoneOffset.UTC); | |
| 44 | + | |
| 45 | + public static OffsetDateTime parseDateTimeString(String str) { | |
| 46 | + return ZonedDateTime.from(Converter.DATE_TIME_FORMATTER.parse(str)).toOffsetDateTime(); | |
| 47 | + } | |
| 48 | + | |
| 49 | + private static final DateTimeFormatter TIME_FORMATTER = new DateTimeFormatterBuilder() | |
| 50 | + .appendOptional(DateTimeFormatter.ISO_TIME) | |
| 51 | + .appendOptional(DateTimeFormatter.ISO_OFFSET_TIME) | |
| 52 | + .parseDefaulting(ChronoField.YEAR, 2020) | |
| 53 | + .parseDefaulting(ChronoField.MONTH_OF_YEAR, 1) | |
| 54 | + .parseDefaulting(ChronoField.DAY_OF_MONTH, 1) | |
| 55 | + .toFormatter() | |
| 56 | + .withZone(ZoneOffset.UTC); | |
| 57 | + | |
| 58 | + public static OffsetTime parseTimeString(String str) { | |
| 59 | + return ZonedDateTime.from(Converter.TIME_FORMATTER.parse(str)).toOffsetDateTime().toOffsetTime(); | |
| 60 | + } | |
| 61 | + // Serialize/deserialize helpers | |
| 62 | + | |
| 63 | + public static TopLevel fromJsonString(String json) throws IOException { | |
| 64 | + return getObjectReader().readValue(json); | |
| 65 | + } | |
| 66 | + | |
| 67 | + public static String toJsonString(TopLevel obj) throws JsonProcessingException { | |
| 68 | + return getObjectWriter().writeValueAsString(obj); | |
| 69 | + } | |
| 70 | + | |
| 71 | + private static ObjectReader reader; | |
| 72 | + private static ObjectWriter writer; | |
| 73 | + | |
| 74 | + private static void instantiateMapper() { | |
| 75 | + ObjectMapper mapper = new ObjectMapper(); | |
| 76 | + mapper.findAndRegisterModules(); | |
| 77 | + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | |
| 78 | + mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); | |
| 79 | + SimpleModule module = new SimpleModule(); | |
| 80 | + module.addDeserializer(OffsetDateTime.class, new JsonDeserializer<OffsetDateTime>() { | |
| 81 | + @Override | |
| 82 | + public OffsetDateTime deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { | |
| 83 | + String value = jsonParser.getText(); | |
| 84 | + return Converter.parseDateTimeString(value); | |
| 85 | + } | |
| 86 | + }); | |
| 87 | + mapper.registerModule(module); | |
| 88 | + reader = mapper.readerFor(TopLevel.class); | |
| 89 | + writer = mapper.writerFor(TopLevel.class); | |
| 90 | + } | |
| 91 | + | |
| 92 | + private static ObjectReader getObjectReader() { | |
| 93 | + if (reader == null) instantiateMapper(); | |
| 94 | + return reader; | |
| 95 | + } | |
| 96 | + | |
| 97 | + private static ObjectWriter getObjectWriter() { | |
| 98 | + if (writer == null) instantiateMapper(); | |
| 99 | + return writer; | |
| 100 | + } | |
| 101 | +} |
Aschema-javadefault / src / main / java / io / quicktype / Ordered.java+24 −0
| @@ -0,0 +1,24 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.*; | |
| 4 | + | |
| 5 | +public class Ordered { | |
| 6 | + private double mango; | |
| 7 | + private String zebra; | |
| 8 | + private boolean apple; | |
| 9 | + | |
| 10 | + @JsonProperty("mango") | |
| 11 | + public double getMango() { return mango; } | |
| 12 | + @JsonProperty("mango") | |
| 13 | + public void setMango(double value) { this.mango = value; } | |
| 14 | + | |
| 15 | + @JsonProperty("zebra") | |
| 16 | + public String getZebra() { return zebra; } | |
| 17 | + @JsonProperty("zebra") | |
| 18 | + public void setZebra(String value) { this.zebra = value; } | |
| 19 | + | |
| 20 | + @JsonProperty("apple") | |
| 21 | + public boolean getApple() { return apple; } | |
| 22 | + @JsonProperty("apple") | |
| 23 | + public void setApple(boolean value) { this.apple = value; } | |
| 24 | +} |
Aschema-javadefault / src / main / java / io / quicktype / TopLevel.java+42 −0
| @@ -0,0 +1,42 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.*; | |
| 4 | + | |
| 5 | +public class TopLevel { | |
| 6 | + private String zebra; | |
| 7 | + private double mango; | |
| 8 | + private boolean apple; | |
| 9 | + private String delta; | |
| 10 | + private long banana; | |
| 11 | + private Ordered ordered; | |
| 12 | + | |
| 13 | + @JsonProperty("zebra") | |
| 14 | + public String getZebra() { return zebra; } | |
| 15 | + @JsonProperty("zebra") | |
| 16 | + public void setZebra(String value) { this.zebra = value; } | |
| 17 | + | |
| 18 | + @JsonProperty("mango") | |
| 19 | + public double getMango() { return mango; } | |
| 20 | + @JsonProperty("mango") | |
| 21 | + public void setMango(double value) { this.mango = value; } | |
| 22 | + | |
| 23 | + @JsonProperty("apple") | |
| 24 | + public boolean getApple() { return apple; } | |
| 25 | + @JsonProperty("apple") | |
| 26 | + public void setApple(boolean value) { this.apple = value; } | |
| 27 | + | |
| 28 | + @JsonProperty("delta") | |
| 29 | + public String getDelta() { return delta; } | |
| 30 | + @JsonProperty("delta") | |
| 31 | + public void setDelta(String value) { this.delta = value; } | |
| 32 | + | |
| 33 | + @JsonProperty("banana") | |
| 34 | + public long getBanana() { return banana; } | |
| 35 | + @JsonProperty("banana") | |
| 36 | + public void setBanana(long value) { this.banana = value; } | |
| 37 | + | |
| 38 | + @JsonProperty("ordered") | |
| 39 | + public Ordered getOrdered() { return ordered; } | |
| 40 | + @JsonProperty("ordered") | |
| 41 | + public void setOrdered(Ordered value) { this.ordered = value; } | |
| 42 | +} |
Aschema-javascriptdefault / TopLevel.js+192 −0
| @@ -0,0 +1,192 @@ | ||
| 1 | +// To parse this data: | |
| 2 | +// | |
| 3 | +// const Convert = require("./TopLevel"); | |
| 4 | +// | |
| 5 | +// const topLevel = Convert.toTopLevel(json); | |
| 6 | +// | |
| 7 | +// These functions will throw an error if the JSON doesn't | |
| 8 | +// match the expected interface, even if the JSON is valid. | |
| 9 | + | |
| 10 | +// Converts JSON strings to/from your types | |
| 11 | +// and asserts the results of JSON.parse at runtime | |
| 12 | +function toTopLevel(json) { | |
| 13 | + return cast(JSON.parse(json), r("TopLevel")); | |
| 14 | +} | |
| 15 | + | |
| 16 | +function topLevelToJson(value) { | |
| 17 | + return JSON.stringify(uncast(value, r("TopLevel")), null, 2); | |
| 18 | +} | |
| 19 | + | |
| 20 | +function invalidValue(typ, val, key, parent = '') { | |
| 21 | + const prettyTyp = prettyTypeName(typ); | |
| 22 | + const parentText = parent ? ` on ${parent}` : ''; | |
| 23 | + const keyText = key ? ` for key "${key}"` : ''; | |
| 24 | + throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); | |
| 25 | +} | |
| 26 | + | |
| 27 | +function prettyTypeName(typ) { | |
| 28 | + if (Array.isArray(typ)) { | |
| 29 | + if (typ.length === 2 && typ[0] === undefined) { | |
| 30 | + return `an optional ${prettyTypeName(typ[1])}`; | |
| 31 | + } else { | |
| 32 | + return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`; | |
| 33 | + } | |
| 34 | + } else if (typeof typ === "object" && typ.literal !== undefined) { | |
| 35 | + return typ.literal; | |
| 36 | + } else { | |
| 37 | + return typeof typ; | |
| 38 | + } | |
| 39 | +} | |
| 40 | + | |
| 41 | +function jsonToJSProps(typ) { | |
| 42 | + if (typ.jsonToJS === undefined) { | |
| 43 | + const map = {}; | |
| 44 | + typ.props.forEach((p) => map[p.json] = { key: p.js, typ: p.typ }); | |
| 45 | + typ.jsonToJS = map; | |
| 46 | + } | |
| 47 | + return typ.jsonToJS; | |
| 48 | +} | |
| 49 | + | |
| 50 | +function jsToJSONProps(typ) { | |
| 51 | + if (typ.jsToJSON === undefined) { | |
| 52 | + const map = {}; | |
| 53 | + typ.props.forEach((p) => map[p.js] = { key: p.json, typ: p.typ }); | |
| 54 | + typ.jsToJSON = map; | |
| 55 | + } | |
| 56 | + return typ.jsToJSON; | |
| 57 | +} | |
| 58 | + | |
| 59 | +function transform(val, typ, getProps, key = '', parent = '') { | |
| 60 | + function transformPrimitive(typ, val) { | |
| 61 | + if (typeof typ === typeof val) return val; | |
| 62 | + return invalidValue(typ, val, key, parent); | |
| 63 | + } | |
| 64 | + | |
| 65 | + function transformUnion(typs, val) { | |
| 66 | + // val must validate against one typ in typs | |
| 67 | + const l = typs.length; | |
| 68 | + for (let i = 0; i < l; i++) { | |
| 69 | + const typ = typs[i]; | |
| 70 | + try { | |
| 71 | + return transform(val, typ, getProps); | |
| 72 | + } catch (_) {} | |
| 73 | + } | |
| 74 | + return invalidValue(typs, val, key, parent); | |
| 75 | + } | |
| 76 | + | |
| 77 | + function transformEnum(cases, val) { | |
| 78 | + if (cases.indexOf(val) !== -1) return val; | |
| 79 | + return invalidValue(cases.map(a => { return l(a); }), val, key, parent); | |
| 80 | + } | |
| 81 | + | |
| 82 | + function transformArray(typ, val) { | |
| 83 | + // val must be an array with no invalid elements | |
| 84 | + if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent); | |
| 85 | + return val.map(el => transform(el, typ, getProps)); | |
| 86 | + } | |
| 87 | + | |
| 88 | + function transformDate(val) { | |
| 89 | + if (val === null) { | |
| 90 | + return null; | |
| 91 | + } | |
| 92 | + const d = new Date(val); | |
| 93 | + if (isNaN(d.valueOf())) { | |
| 94 | + return invalidValue(l("Date"), val, key, parent); | |
| 95 | + } | |
| 96 | + return d; | |
| 97 | + } | |
| 98 | + | |
| 99 | + function transformObject(props, additional, val) { | |
| 100 | + if (val === null || typeof val !== "object" || Array.isArray(val)) { | |
| 101 | + return invalidValue(l(ref || "object"), val, key, parent); | |
| 102 | + } | |
| 103 | + const result = {}; | |
| 104 | + Object.getOwnPropertyNames(props).forEach(key => { | |
| 105 | + const prop = props[key]; | |
| 106 | + const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; | |
| 107 | + result[prop.key] = transform(v, prop.typ, getProps, key, ref); | |
| 108 | + }); | |
| 109 | + Object.getOwnPropertyNames(val).forEach(key => { | |
| 110 | + if (!Object.prototype.hasOwnProperty.call(props, key)) { | |
| 111 | + result[key] = transform(val[key], additional, getProps, key, ref); | |
| 112 | + } | |
| 113 | + }); | |
| 114 | + return result; | |
| 115 | + } | |
| 116 | + | |
| 117 | + if (typ === "any") return val; | |
| 118 | + if (typ === null) { | |
| 119 | + if (val === null) return val; | |
| 120 | + return invalidValue(typ, val, key, parent); | |
| 121 | + } | |
| 122 | + if (typ === false) return invalidValue(typ, val, key, parent); | |
| 123 | + let ref = undefined; | |
| 124 | + while (typeof typ === "object" && typ.ref !== undefined) { | |
| 125 | + ref = typ.ref; | |
| 126 | + typ = typeMap[typ.ref]; | |
| 127 | + } | |
| 128 | + if (Array.isArray(typ)) return transformEnum(typ, val); | |
| 129 | + if (typeof typ === "object") { | |
| 130 | + return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val) | |
| 131 | + : typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val) | |
| 132 | + : typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val) | |
| 133 | + : invalidValue(typ, val, key, parent); | |
| 134 | + } | |
| 135 | + // Numbers can be parsed by Date but shouldn't be. | |
| 136 | + if (typ === Date && typeof val !== "number") return transformDate(val); | |
| 137 | + return transformPrimitive(typ, val); | |
| 138 | +} | |
| 139 | + | |
| 140 | +function cast(val, typ) { | |
| 141 | + return transform(val, typ, jsonToJSProps); | |
| 142 | +} | |
| 143 | + | |
| 144 | +function uncast(val, typ) { | |
| 145 | + return transform(val, typ, jsToJSONProps); | |
| 146 | +} | |
| 147 | + | |
| 148 | +function l(typ) { | |
| 149 | + return { literal: typ }; | |
| 150 | +} | |
| 151 | + | |
| 152 | +function a(typ) { | |
| 153 | + return { arrayItems: typ }; | |
| 154 | +} | |
| 155 | + | |
| 156 | +function u(...typs) { | |
| 157 | + return { unionMembers: typs }; | |
| 158 | +} | |
| 159 | + | |
| 160 | +function o(props, additional) { | |
| 161 | + return { props, additional }; | |
| 162 | +} | |
| 163 | + | |
| 164 | +function m(additional) { | |
| 165 | + const props = []; | |
| 166 | + return { props, additional }; | |
| 167 | +} | |
| 168 | + | |
| 169 | +function r(name) { | |
| 170 | + return { ref: name }; | |
| 171 | +} | |
| 172 | + | |
| 173 | +const typeMap = { | |
| 174 | + "TopLevel": o([ | |
| 175 | + { json: "zebra", js: "zebra", typ: "" }, | |
| 176 | + { json: "mango", js: "mango", typ: 3.14 }, | |
| 177 | + { json: "apple", js: "apple", typ: true }, | |
| 178 | + { json: "delta", js: "delta", typ: "" }, | |
| 179 | + { json: "banana", js: "banana", typ: 0 }, | |
| 180 | + { json: "ordered", js: "ordered", typ: r("Ordered") }, | |
| 181 | + ], false), | |
| 182 | + "Ordered": o([ | |
| 183 | + { json: "mango", js: "mango", typ: 3.14 }, | |
| 184 | + { json: "zebra", js: "zebra", typ: "" }, | |
| 185 | + { json: "apple", js: "apple", typ: true }, | |
| 186 | + ], false), | |
| 187 | +}; | |
| 188 | + | |
| 189 | +module.exports = { | |
| 190 | + "topLevelToJson": topLevelToJson, | |
| 191 | + "toTopLevel": toTopLevel, | |
| 192 | +}; |
Aschema-kotlin-jacksondefault / TopLevel.kt+56 −0
| @@ -0,0 +1,56 @@ | ||
| 1 | +// To parse the JSON, install jackson-module-kotlin and do: | |
| 2 | +// | |
| 3 | +// val topLevel = TopLevel.fromJson(jsonString) | |
| 4 | + | |
| 5 | +package quicktype | |
| 6 | + | |
| 7 | +import com.fasterxml.jackson.annotation.* | |
| 8 | +import com.fasterxml.jackson.core.* | |
| 9 | +import com.fasterxml.jackson.databind.* | |
| 10 | +import com.fasterxml.jackson.databind.deser.std.StdDeserializer | |
| 11 | +import com.fasterxml.jackson.databind.module.SimpleModule | |
| 12 | +import com.fasterxml.jackson.databind.node.* | |
| 13 | +import com.fasterxml.jackson.databind.ser.std.StdSerializer | |
| 14 | +import com.fasterxml.jackson.module.kotlin.* | |
| 15 | + | |
| 16 | +val mapper = jacksonObjectMapper().apply { | |
| 17 | + propertyNamingStrategy = PropertyNamingStrategy.LOWER_CAMEL_CASE | |
| 18 | + setSerializationInclusion(JsonInclude.Include.NON_NULL) | |
| 19 | +} | |
| 20 | + | |
| 21 | +data class TopLevel ( | |
| 22 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 23 | + val zebra: String, | |
| 24 | + | |
| 25 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 26 | + val mango: Double, | |
| 27 | + | |
| 28 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 29 | + val apple: Boolean, | |
| 30 | + | |
| 31 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 32 | + val delta: String, | |
| 33 | + | |
| 34 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 35 | + val banana: Long, | |
| 36 | + | |
| 37 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 38 | + val ordered: Ordered | |
| 39 | +) { | |
| 40 | + fun toJson() = mapper.writeValueAsString(this) | |
| 41 | + | |
| 42 | + companion object { | |
| 43 | + fun fromJson(json: String) = mapper.readValue<TopLevel>(json) | |
| 44 | + } | |
| 45 | +} | |
| 46 | + | |
| 47 | +data class Ordered ( | |
| 48 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 49 | + val mango: Double, | |
| 50 | + | |
| 51 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 52 | + val zebra: String, | |
| 53 | + | |
| 54 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 55 | + val apple: Boolean | |
| 56 | +) |
Aschema-kotlindefault / TopLevel.kt+30 −0
| @@ -0,0 +1,30 @@ | ||
| 1 | +// To parse the JSON, install Klaxon and do: | |
| 2 | +// | |
| 3 | +// val topLevel = TopLevel.fromJson(jsonString) | |
| 4 | + | |
| 5 | +package quicktype | |
| 6 | + | |
| 7 | +import com.beust.klaxon.* | |
| 8 | + | |
| 9 | +private val klaxon = Klaxon() | |
| 10 | + | |
| 11 | +data class TopLevel ( | |
| 12 | + val zebra: String, | |
| 13 | + val mango: Double, | |
| 14 | + val apple: Boolean, | |
| 15 | + val delta: String, | |
| 16 | + val banana: Long, | |
| 17 | + val ordered: Ordered | |
| 18 | +) { | |
| 19 | + public fun toJson() = klaxon.toJsonString(this) | |
| 20 | + | |
| 21 | + companion object { | |
| 22 | + public fun fromJson(json: String) = klaxon.parse<TopLevel>(json) | |
| 23 | + } | |
| 24 | +} | |
| 25 | + | |
| 26 | +data class Ordered ( | |
| 27 | + val mango: Double, | |
| 28 | + val zebra: String, | |
| 29 | + val apple: Boolean | |
| 30 | +) |
Aschema-kotlinxdefault / TopLevel.kt+28 −0
| @@ -0,0 +1,28 @@ | ||
| 1 | +// To parse the JSON, install kotlin's serialization plugin and do: | |
| 2 | +// | |
| 3 | +// val json = Json { allowStructuredMapKeys = true } | |
| 4 | +// val topLevel = json.parse(TopLevel.serializer(), jsonString) | |
| 5 | + | |
| 6 | +package quicktype | |
| 7 | + | |
| 8 | +import kotlinx.serialization.* | |
| 9 | +import kotlinx.serialization.json.* | |
| 10 | +import kotlinx.serialization.descriptors.* | |
| 11 | +import kotlinx.serialization.encoding.* | |
| 12 | + | |
| 13 | +@Serializable | |
| 14 | +data class TopLevel ( | |
| 15 | + val zebra: String, | |
| 16 | + val mango: Double, | |
| 17 | + val apple: Boolean, | |
| 18 | + val delta: String, | |
| 19 | + val banana: Long, | |
| 20 | + val ordered: Ordered | |
| 21 | +) | |
| 22 | + | |
| 23 | +@Serializable | |
| 24 | +data class Ordered ( | |
| 25 | + val mango: Double, | |
| 26 | + val zebra: String, | |
| 27 | + val apple: Boolean | |
| 28 | +) |
Aschema-phpdefault / TopLevel.php+577 −0
| @@ -0,0 +1,577 @@ | ||
| 1 | +<?php | |
| 2 | +declare(strict_types=1); | |
| 3 | + | |
| 4 | +// This is an autogenerated file:TopLevel | |
| 5 | + | |
| 6 | +class TopLevel { | |
| 7 | + private string $zebra; // json:zebra Required | |
| 8 | + private float $mango; // json:mango Required | |
| 9 | + private bool $apple; // json:apple Required | |
| 10 | + private string $delta; // json:delta Required | |
| 11 | + private int $banana; // json:banana Required | |
| 12 | + private Ordered $ordered; // json:ordered Required | |
| 13 | + | |
| 14 | + /** | |
| 15 | + * @param string $zebra | |
| 16 | + * @param float $mango | |
| 17 | + * @param bool $apple | |
| 18 | + * @param string $delta | |
| 19 | + * @param int $banana | |
| 20 | + * @param Ordered $ordered | |
| 21 | + */ | |
| 22 | + public function __construct(string $zebra, float $mango, bool $apple, string $delta, int $banana, Ordered $ordered) { | |
| 23 | + $this->zebra = $zebra; | |
| 24 | + $this->mango = $mango; | |
| 25 | + $this->apple = $apple; | |
| 26 | + $this->delta = $delta; | |
| 27 | + $this->banana = $banana; | |
| 28 | + $this->ordered = $ordered; | |
| 29 | + } | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * @param string $value | |
| 33 | + * @throws Exception | |
| 34 | + * @return string | |
| 35 | + */ | |
| 36 | + public static function fromZebra(string $value): string { | |
| 37 | + return $value; /*string*/ | |
| 38 | + } | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * @throws Exception | |
| 42 | + * @return string | |
| 43 | + */ | |
| 44 | + public function toZebra(): string { | |
| 45 | + if (TopLevel::validateZebra($this->zebra)) { | |
| 46 | + return $this->zebra; /*string*/ | |
| 47 | + } | |
| 48 | + throw new Exception('never get to this TopLevel::zebra'); | |
| 49 | + } | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * @param string | |
| 53 | + * @return bool | |
| 54 | + * @throws Exception | |
| 55 | + */ | |
| 56 | + public static function validateZebra(string $value): bool { | |
| 57 | + return true; | |
| 58 | + } | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * @throws Exception | |
| 62 | + * @return string | |
| 63 | + */ | |
| 64 | + public function getZebra(): string { | |
| 65 | + if (TopLevel::validateZebra($this->zebra)) { | |
| 66 | + return $this->zebra; | |
| 67 | + } | |
| 68 | + throw new Exception('never get to getZebra TopLevel::zebra'); | |
| 69 | + } | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * @return string | |
| 73 | + */ | |
| 74 | + public static function sampleZebra(): string { | |
| 75 | + return 'TopLevel::zebra::31'; /*31:zebra*/ | |
| 76 | + } | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * @param float $value | |
| 80 | + * @throws Exception | |
| 81 | + * @return float | |
| 82 | + */ | |
| 83 | + public static function fromMango(float $value): float { | |
| 84 | + return $value; /*float*/ | |
| 85 | + } | |
| 86 | + | |
| 87 | + /** | |
| 88 | + * @throws Exception | |
| 89 | + * @return float | |
| 90 | + */ | |
| 91 | + public function toMango(): float { | |
| 92 | + if (TopLevel::validateMango($this->mango)) { | |
| 93 | + return $this->mango; /*float*/ | |
| 94 | + } | |
| 95 | + throw new Exception('never get to this TopLevel::mango'); | |
| 96 | + } | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * @param float | |
| 100 | + * @return bool | |
| 101 | + * @throws Exception | |
| 102 | + */ | |
| 103 | + public static function validateMango(float $value): bool { | |
| 104 | + return true; | |
| 105 | + } | |
| 106 | + | |
| 107 | + /** | |
| 108 | + * @throws Exception | |
| 109 | + * @return float | |
| 110 | + */ | |
| 111 | + public function getMango(): float { | |
| 112 | + if (TopLevel::validateMango($this->mango)) { | |
| 113 | + return $this->mango; | |
| 114 | + } | |
| 115 | + throw new Exception('never get to getMango TopLevel::mango'); | |
| 116 | + } | |
| 117 | + | |
| 118 | + /** | |
| 119 | + * @return float | |
| 120 | + */ | |
| 121 | + public static function sampleMango(): float { | |
| 122 | + return 32.032; /*32:mango*/ | |
| 123 | + } | |
| 124 | + | |
| 125 | + /** | |
| 126 | + * @param bool $value | |
| 127 | + * @throws Exception | |
| 128 | + * @return bool | |
| 129 | + */ | |
| 130 | + public static function fromApple(bool $value): bool { | |
| 131 | + return $value; /*bool*/ | |
| 132 | + } | |
| 133 | + | |
| 134 | + /** | |
| 135 | + * @throws Exception | |
| 136 | + * @return bool | |
| 137 | + */ | |
| 138 | + public function toApple(): bool { | |
| 139 | + if (TopLevel::validateApple($this->apple)) { | |
| 140 | + return $this->apple; /*bool*/ | |
| 141 | + } | |
| 142 | + throw new Exception('never get to this TopLevel::apple'); | |
| 143 | + } | |
| 144 | + | |
| 145 | + /** | |
| 146 | + * @param bool | |
| 147 | + * @return bool | |
| 148 | + * @throws Exception | |
| 149 | + */ | |
| 150 | + public static function validateApple(bool $value): bool { | |
| 151 | + return true; | |
| 152 | + } | |
| 153 | + | |
| 154 | + /** | |
| 155 | + * @throws Exception | |
| 156 | + * @return bool | |
| 157 | + */ | |
| 158 | + public function getApple(): bool { | |
| 159 | + if (TopLevel::validateApple($this->apple)) { | |
| 160 | + return $this->apple; | |
| 161 | + } | |
| 162 | + throw new Exception('never get to getApple TopLevel::apple'); | |
| 163 | + } | |
| 164 | + | |
| 165 | + /** | |
| 166 | + * @return bool | |
| 167 | + */ | |
| 168 | + public static function sampleApple(): bool { | |
| 169 | + return true; /*33:apple*/ | |
| 170 | + } | |
| 171 | + | |
| 172 | + /** | |
| 173 | + * @param string $value | |
| 174 | + * @throws Exception | |
| 175 | + * @return string | |
| 176 | + */ | |
| 177 | + public static function fromDelta(string $value): string { | |
| 178 | + return $value; /*string*/ | |
| 179 | + } | |
| 180 | + | |
| 181 | + /** | |
| 182 | + * @throws Exception | |
| 183 | + * @return string | |
| 184 | + */ | |
| 185 | + public function toDelta(): string { | |
| 186 | + if (TopLevel::validateDelta($this->delta)) { | |
| 187 | + return $this->delta; /*string*/ | |
| 188 | + } | |
| 189 | + throw new Exception('never get to this TopLevel::delta'); | |
| 190 | + } | |
| 191 | + | |
| 192 | + /** | |
| 193 | + * @param string | |
| 194 | + * @return bool | |
| 195 | + * @throws Exception | |
| 196 | + */ | |
| 197 | + public static function validateDelta(string $value): bool { | |
| 198 | + return true; | |
| 199 | + } | |
| 200 | + | |
| 201 | + /** | |
| 202 | + * @throws Exception | |
| 203 | + * @return string | |
| 204 | + */ | |
| 205 | + public function getDelta(): string { | |
| 206 | + if (TopLevel::validateDelta($this->delta)) { | |
| 207 | + return $this->delta; | |
| 208 | + } | |
| 209 | + throw new Exception('never get to getDelta TopLevel::delta'); | |
| 210 | + } | |
| 211 | + | |
| 212 | + /** | |
| 213 | + * @return string | |
| 214 | + */ | |
| 215 | + public static function sampleDelta(): string { | |
| 216 | + return 'TopLevel::delta::34'; /*34:delta*/ | |
| 217 | + } | |
| 218 | + | |
| 219 | + /** | |
| 220 | + * @param int $value | |
| 221 | + * @throws Exception | |
| 222 | + * @return int | |
| 223 | + */ | |
| 224 | + public static function fromBanana(int $value): int { | |
| 225 | + return $value; /*int*/ | |
| 226 | + } | |
| 227 | + | |
| 228 | + /** | |
| 229 | + * @throws Exception | |
| 230 | + * @return int | |
| 231 | + */ | |
| 232 | + public function toBanana(): int { | |
| 233 | + if (TopLevel::validateBanana($this->banana)) { | |
| 234 | + return $this->banana; /*int*/ | |
| 235 | + } | |
| 236 | + throw new Exception('never get to this TopLevel::banana'); | |
| 237 | + } | |
| 238 | + | |
| 239 | + /** | |
| 240 | + * @param int | |
| 241 | + * @return bool | |
| 242 | + * @throws Exception | |
| 243 | + */ | |
| 244 | + public static function validateBanana(int $value): bool { | |
| 245 | + return true; | |
| 246 | + } | |
| 247 | + | |
| 248 | + /** | |
| 249 | + * @throws Exception | |
| 250 | + * @return int | |
| 251 | + */ | |
| 252 | + public function getBanana(): int { | |
| 253 | + if (TopLevel::validateBanana($this->banana)) { | |
| 254 | + return $this->banana; | |
| 255 | + } | |
| 256 | + throw new Exception('never get to getBanana TopLevel::banana'); | |
| 257 | + } | |
| 258 | + | |
| 259 | + /** | |
| 260 | + * @return int | |
| 261 | + */ | |
| 262 | + public static function sampleBanana(): int { | |
| 263 | + return 35; /*35:banana*/ | |
| 264 | + } | |
| 265 | + | |
| 266 | + /** | |
| 267 | + * @param stdClass $value | |
| 268 | + * @throws Exception | |
| 269 | + * @return Ordered | |
| 270 | + */ | |
| 271 | + public static function fromOrdered(stdClass $value): Ordered { | |
| 272 | + return Ordered::from($value); /*class*/ | |
| 273 | + } | |
| 274 | + | |
| 275 | + /** | |
| 276 | + * @throws Exception | |
| 277 | + * @return stdClass | |
| 278 | + */ | |
| 279 | + public function toOrdered(): stdClass { | |
| 280 | + if (TopLevel::validateOrdered($this->ordered)) { | |
| 281 | + return $this->ordered->to(); /*class*/ | |
| 282 | + } | |
| 283 | + throw new Exception('never get to this TopLevel::ordered'); | |
| 284 | + } | |
| 285 | + | |
| 286 | + /** | |
| 287 | + * @param Ordered | |
| 288 | + * @return bool | |
| 289 | + * @throws Exception | |
| 290 | + */ | |
| 291 | + public static function validateOrdered(Ordered $value): bool { | |
| 292 | + $value->validate(); | |
| 293 | + return true; | |
| 294 | + } | |
| 295 | + | |
| 296 | + /** | |
| 297 | + * @throws Exception | |
| 298 | + * @return Ordered | |
| 299 | + */ | |
| 300 | + public function getOrdered(): Ordered { | |
| 301 | + if (TopLevel::validateOrdered($this->ordered)) { | |
| 302 | + return $this->ordered; | |
| 303 | + } | |
| 304 | + throw new Exception('never get to getOrdered TopLevel::ordered'); | |
| 305 | + } | |
| 306 | + | |
| 307 | + /** | |
| 308 | + * @return Ordered | |
| 309 | + */ | |
| 310 | + public static function sampleOrdered(): Ordered { | |
| 311 | + return Ordered::sample(); /*36:ordered*/ | |
| 312 | + } | |
| 313 | + | |
| 314 | + /** | |
| 315 | + * @throws Exception | |
| 316 | + * @return bool | |
| 317 | + */ | |
| 318 | + public function validate(): bool { | |
| 319 | + return TopLevel::validateZebra($this->zebra) | |
| 320 | + || TopLevel::validateMango($this->mango) | |
| 321 | + || TopLevel::validateApple($this->apple) | |
| 322 | + || TopLevel::validateDelta($this->delta) | |
| 323 | + || TopLevel::validateBanana($this->banana) | |
| 324 | + || TopLevel::validateOrdered($this->ordered); | |
| 325 | + } | |
| 326 | + | |
| 327 | + /** | |
| 328 | + * @return stdClass | |
| 329 | + * @throws Exception | |
| 330 | + */ | |
| 331 | + public function to(): stdClass { | |
| 332 | + $out = new stdClass(); | |
| 333 | + $out->{'zebra'} = $this->toZebra(); | |
| 334 | + $out->{'mango'} = $this->toMango(); | |
| 335 | + $out->{'apple'} = $this->toApple(); | |
| 336 | + $out->{'delta'} = $this->toDelta(); | |
| 337 | + $out->{'banana'} = $this->toBanana(); | |
| 338 | + $out->{'ordered'} = $this->toOrdered(); | |
| 339 | + return $out; | |
| 340 | + } | |
| 341 | + | |
| 342 | + /** | |
| 343 | + * @param stdClass $obj | |
| 344 | + * @return TopLevel | |
| 345 | + * @throws Exception | |
| 346 | + */ | |
| 347 | + public static function from(stdClass $obj): TopLevel { | |
| 348 | + return new TopLevel( | |
| 349 | + TopLevel::fromZebra($obj->{'zebra'}) | |
| 350 | + ,TopLevel::fromMango($obj->{'mango'}) | |
| 351 | + ,TopLevel::fromApple($obj->{'apple'}) | |
| 352 | + ,TopLevel::fromDelta($obj->{'delta'}) | |
| 353 | + ,TopLevel::fromBanana($obj->{'banana'}) | |
| 354 | + ,TopLevel::fromOrdered($obj->{'ordered'}) | |
| 355 | + ); | |
| 356 | + } | |
| 357 | + | |
| 358 | + /** | |
| 359 | + * @return TopLevel | |
| 360 | + */ | |
| 361 | + public static function sample(): TopLevel { | |
| 362 | + return new TopLevel( | |
| 363 | + TopLevel::sampleZebra() | |
| 364 | + ,TopLevel::sampleMango() | |
| 365 | + ,TopLevel::sampleApple() | |
| 366 | + ,TopLevel::sampleDelta() | |
| 367 | + ,TopLevel::sampleBanana() | |
| 368 | + ,TopLevel::sampleOrdered() | |
| 369 | + ); | |
| 370 | + } | |
| 371 | +} | |
| 372 | + | |
| 373 | +// This is an autogenerated file:Ordered | |
| 374 | + | |
| 375 | +class Ordered { | |
| 376 | + private float $mango; // json:mango Required | |
| 377 | + private string $zebra; // json:zebra Required | |
| 378 | + private bool $apple; // json:apple Required | |
| 379 | + | |
| 380 | + /** | |
| 381 | + * @param float $mango | |
| 382 | + * @param string $zebra | |
| 383 | + * @param bool $apple | |
| 384 | + */ | |
| 385 | + public function __construct(float $mango, string $zebra, bool $apple) { | |
| 386 | + $this->mango = $mango; | |
| 387 | + $this->zebra = $zebra; | |
| 388 | + $this->apple = $apple; | |
| 389 | + } | |
| 390 | + | |
| 391 | + /** | |
| 392 | + * @param float $value | |
| 393 | + * @throws Exception | |
| 394 | + * @return float | |
| 395 | + */ | |
| 396 | + public static function fromMango(float $value): float { | |
| 397 | + return $value; /*float*/ | |
| 398 | + } | |
| 399 | + | |
| 400 | + /** | |
| 401 | + * @throws Exception | |
| 402 | + * @return float | |
| 403 | + */ | |
| 404 | + public function toMango(): float { | |
| 405 | + if (Ordered::validateMango($this->mango)) { | |
| 406 | + return $this->mango; /*float*/ | |
| 407 | + } | |
| 408 | + throw new Exception('never get to this Ordered::mango'); | |
| 409 | + } | |
| 410 | + | |
| 411 | + /** | |
| 412 | + * @param float | |
| 413 | + * @return bool | |
| 414 | + * @throws Exception | |
| 415 | + */ | |
| 416 | + public static function validateMango(float $value): bool { | |
| 417 | + return true; | |
| 418 | + } | |
| 419 | + | |
| 420 | + /** | |
| 421 | + * @throws Exception | |
| 422 | + * @return float | |
| 423 | + */ | |
| 424 | + public function getMango(): float { | |
| 425 | + if (Ordered::validateMango($this->mango)) { | |
| 426 | + return $this->mango; | |
| 427 | + } | |
| 428 | + throw new Exception('never get to getMango Ordered::mango'); | |
| 429 | + } | |
| 430 | + | |
| 431 | + /** | |
| 432 | + * @return float | |
| 433 | + */ | |
| 434 | + public static function sampleMango(): float { | |
| 435 | + return 31.031; /*31:mango*/ | |
| 436 | + } | |
| 437 | + | |
| 438 | + /** | |
| 439 | + * @param string $value | |
| 440 | + * @throws Exception | |
| 441 | + * @return string | |
| 442 | + */ | |
| 443 | + public static function fromZebra(string $value): string { | |
| 444 | + return $value; /*string*/ | |
| 445 | + } | |
| 446 | + | |
| 447 | + /** | |
| 448 | + * @throws Exception | |
| 449 | + * @return string | |
| 450 | + */ | |
| 451 | + public function toZebra(): string { | |
| 452 | + if (Ordered::validateZebra($this->zebra)) { | |
| 453 | + return $this->zebra; /*string*/ | |
| 454 | + } | |
| 455 | + throw new Exception('never get to this Ordered::zebra'); | |
| 456 | + } | |
| 457 | + | |
| 458 | + /** | |
| 459 | + * @param string | |
| 460 | + * @return bool | |
| 461 | + * @throws Exception | |
| 462 | + */ | |
| 463 | + public static function validateZebra(string $value): bool { | |
| 464 | + return true; | |
| 465 | + } | |
| 466 | + | |
| 467 | + /** | |
| 468 | + * @throws Exception | |
| 469 | + * @return string | |
| 470 | + */ | |
| 471 | + public function getZebra(): string { | |
| 472 | + if (Ordered::validateZebra($this->zebra)) { | |
| 473 | + return $this->zebra; | |
| 474 | + } | |
| 475 | + throw new Exception('never get to getZebra Ordered::zebra'); | |
| 476 | + } | |
| 477 | + | |
| 478 | + /** | |
| 479 | + * @return string | |
| 480 | + */ | |
| 481 | + public static function sampleZebra(): string { | |
| 482 | + return 'Ordered::zebra::32'; /*32:zebra*/ | |
| 483 | + } | |
| 484 | + | |
| 485 | + /** | |
| 486 | + * @param bool $value | |
| 487 | + * @throws Exception | |
| 488 | + * @return bool | |
| 489 | + */ | |
| 490 | + public static function fromApple(bool $value): bool { | |
| 491 | + return $value; /*bool*/ | |
| 492 | + } | |
| 493 | + | |
| 494 | + /** | |
| 495 | + * @throws Exception | |
| 496 | + * @return bool | |
| 497 | + */ | |
| 498 | + public function toApple(): bool { | |
| 499 | + if (Ordered::validateApple($this->apple)) { | |
| 500 | + return $this->apple; /*bool*/ | |
| 501 | + } | |
| 502 | + throw new Exception('never get to this Ordered::apple'); | |
| 503 | + } | |
| 504 | + | |
| 505 | + /** | |
| 506 | + * @param bool | |
| 507 | + * @return bool | |
| 508 | + * @throws Exception | |
| 509 | + */ | |
| 510 | + public static function validateApple(bool $value): bool { | |
| 511 | + return true; | |
| 512 | + } | |
| 513 | + | |
| 514 | + /** | |
| 515 | + * @throws Exception | |
| 516 | + * @return bool | |
| 517 | + */ | |
| 518 | + public function getApple(): bool { | |
| 519 | + if (Ordered::validateApple($this->apple)) { | |
| 520 | + return $this->apple; | |
| 521 | + } | |
| 522 | + throw new Exception('never get to getApple Ordered::apple'); | |
| 523 | + } | |
| 524 | + | |
| 525 | + /** | |
| 526 | + * @return bool | |
| 527 | + */ | |
| 528 | + public static function sampleApple(): bool { | |
| 529 | + return true; /*33:apple*/ | |
| 530 | + } | |
| 531 | + | |
| 532 | + /** | |
| 533 | + * @throws Exception | |
| 534 | + * @return bool | |
| 535 | + */ | |
| 536 | + public function validate(): bool { | |
| 537 | + return Ordered::validateMango($this->mango) | |
| 538 | + || Ordered::validateZebra($this->zebra) | |
| 539 | + || Ordered::validateApple($this->apple); | |
| 540 | + } | |
| 541 | + | |
| 542 | + /** | |
| 543 | + * @return stdClass | |
| 544 | + * @throws Exception | |
| 545 | + */ | |
| 546 | + public function to(): stdClass { | |
| 547 | + $out = new stdClass(); | |
| 548 | + $out->{'mango'} = $this->toMango(); | |
| 549 | + $out->{'zebra'} = $this->toZebra(); | |
| 550 | + $out->{'apple'} = $this->toApple(); | |
| 551 | + return $out; | |
| 552 | + } | |
| 553 | + | |
| 554 | + /** | |
| 555 | + * @param stdClass $obj | |
| 556 | + * @return Ordered | |
| 557 | + * @throws Exception | |
| 558 | + */ | |
| 559 | + public static function from(stdClass $obj): Ordered { | |
| 560 | + return new Ordered( | |
| 561 | + Ordered::fromMango($obj->{'mango'}) | |
| 562 | + ,Ordered::fromZebra($obj->{'zebra'}) | |
| 563 | + ,Ordered::fromApple($obj->{'apple'}) | |
| 564 | + ); | |
| 565 | + } | |
| 566 | + | |
| 567 | + /** | |
| 568 | + * @return Ordered | |
| 569 | + */ | |
| 570 | + public static function sample(): Ordered { | |
| 571 | + return new Ordered( | |
| 572 | + Ordered::sampleMango() | |
| 573 | + ,Ordered::sampleZebra() | |
| 574 | + ,Ordered::sampleApple() | |
| 575 | + ); | |
| 576 | + } | |
| 577 | +} |
Aschema-pikedefault / TopLevel.pmod+74 −0
| @@ -0,0 +1,74 @@ | ||
| 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 | + string zebra; // json: "zebra" | |
| 17 | + float mango; // json: "mango" | |
| 18 | + bool apple; // json: "apple" | |
| 19 | + string delta; // json: "delta" | |
| 20 | + int banana; // json: "banana" | |
| 21 | + Ordered ordered; // json: "ordered" | |
| 22 | + | |
| 23 | + string encode_json() { | |
| 24 | + mapping(string:mixed) json = ([ | |
| 25 | + "zebra" : zebra, | |
| 26 | + "mango" : mango, | |
| 27 | + "apple" : apple, | |
| 28 | + "delta" : delta, | |
| 29 | + "banana" : banana, | |
| 30 | + "ordered" : ordered, | |
| 31 | + ]); | |
| 32 | + | |
| 33 | + return Standards.JSON.encode(json); | |
| 34 | + } | |
| 35 | +} | |
| 36 | + | |
| 37 | +TopLevel TopLevel_from_JSON(mixed json) { | |
| 38 | + TopLevel retval = TopLevel(); | |
| 39 | + | |
| 40 | + retval.zebra = json["zebra"]; | |
| 41 | + retval.mango = json["mango"]; | |
| 42 | + retval.apple = json["apple"]; | |
| 43 | + retval.delta = json["delta"]; | |
| 44 | + retval.banana = json["banana"]; | |
| 45 | + retval.ordered = json["ordered"]; | |
| 46 | + | |
| 47 | + return retval; | |
| 48 | +} | |
| 49 | + | |
| 50 | +class Ordered { | |
| 51 | + float mango; // json: "mango" | |
| 52 | + string zebra; // json: "zebra" | |
| 53 | + bool apple; // json: "apple" | |
| 54 | + | |
| 55 | + string encode_json() { | |
| 56 | + mapping(string:mixed) json = ([ | |
| 57 | + "mango" : mango, | |
| 58 | + "zebra" : zebra, | |
| 59 | + "apple" : apple, | |
| 60 | + ]); | |
| 61 | + | |
| 62 | + return Standards.JSON.encode(json); | |
| 63 | + } | |
| 64 | +} | |
| 65 | + | |
| 66 | +Ordered Ordered_from_JSON(mixed json) { | |
| 67 | + Ordered retval = Ordered(); | |
| 68 | + | |
| 69 | + retval.mango = json["mango"]; | |
| 70 | + retval.zebra = json["zebra"]; | |
| 71 | + retval.apple = json["apple"]; | |
| 72 | + | |
| 73 | + return retval; | |
| 74 | +} |
Aschema-pythondefault / quicktype.py+96 −0
| @@ -0,0 +1,96 @@ | ||
| 1 | +from dataclasses import dataclass | |
| 2 | +from typing import Any, TypeVar, Type, cast | |
| 3 | + | |
| 4 | + | |
| 5 | +T = TypeVar("T") | |
| 6 | + | |
| 7 | + | |
| 8 | +def from_float(x: Any) -> float: | |
| 9 | + assert isinstance(x, (float, int)) and not isinstance(x, bool) | |
| 10 | + return float(x) | |
| 11 | + | |
| 12 | + | |
| 13 | +def from_str(x: Any) -> str: | |
| 14 | + assert isinstance(x, str) | |
| 15 | + return x | |
| 16 | + | |
| 17 | + | |
| 18 | +def from_bool(x: Any) -> bool: | |
| 19 | + assert isinstance(x, bool) | |
| 20 | + return x | |
| 21 | + | |
| 22 | + | |
| 23 | +def to_float(x: Any) -> float: | |
| 24 | + assert isinstance(x, (int, float)) | |
| 25 | + return x | |
| 26 | + | |
| 27 | + | |
| 28 | +def from_int(x: Any) -> int: | |
| 29 | + assert isinstance(x, int) and not isinstance(x, bool) | |
| 30 | + return x | |
| 31 | + | |
| 32 | + | |
| 33 | +def to_class(c: Type[T], x: Any) -> dict: | |
| 34 | + assert isinstance(x, c) | |
| 35 | + return cast(Any, x).to_dict() | |
| 36 | + | |
| 37 | + | |
| 38 | +@dataclass | |
| 39 | +class Ordered: | |
| 40 | + mango: float | |
| 41 | + zebra: str | |
| 42 | + apple: bool | |
| 43 | + | |
| 44 | + @staticmethod | |
| 45 | + def from_dict(obj: Any) -> 'Ordered': | |
| 46 | + assert isinstance(obj, dict) | |
| 47 | + mango = from_float(obj.get("mango")) | |
| 48 | + zebra = from_str(obj.get("zebra")) | |
| 49 | + apple = from_bool(obj.get("apple")) | |
| 50 | + return Ordered(mango, zebra, apple) | |
| 51 | + | |
| 52 | + def to_dict(self) -> dict: | |
| 53 | + result: dict = {} | |
| 54 | + result["mango"] = to_float(self.mango) | |
| 55 | + result["zebra"] = from_str(self.zebra) | |
| 56 | + result["apple"] = from_bool(self.apple) | |
| 57 | + return result | |
| 58 | + | |
| 59 | + | |
| 60 | +@dataclass | |
| 61 | +class TopLevel: | |
| 62 | + zebra: str | |
| 63 | + mango: float | |
| 64 | + apple: bool | |
| 65 | + delta: str | |
| 66 | + banana: int | |
| 67 | + ordered: Ordered | |
| 68 | + | |
| 69 | + @staticmethod | |
| 70 | + def from_dict(obj: Any) -> 'TopLevel': | |
| 71 | + assert isinstance(obj, dict) | |
| 72 | + zebra = from_str(obj.get("zebra")) | |
| 73 | + mango = from_float(obj.get("mango")) | |
| 74 | + apple = from_bool(obj.get("apple")) | |
| 75 | + delta = from_str(obj.get("delta")) | |
| 76 | + banana = from_int(obj.get("banana")) | |
| 77 | + ordered = Ordered.from_dict(obj.get("ordered")) | |
| 78 | + return TopLevel(zebra, mango, apple, delta, banana, ordered) | |
| 79 | + | |
| 80 | + def to_dict(self) -> dict: | |
| 81 | + result: dict = {} | |
| 82 | + result["zebra"] = from_str(self.zebra) | |
| 83 | + result["mango"] = to_float(self.mango) | |
| 84 | + result["apple"] = from_bool(self.apple) | |
| 85 | + result["delta"] = from_str(self.delta) | |
| 86 | + result["banana"] = from_int(self.banana) | |
| 87 | + result["ordered"] = to_class(Ordered, self.ordered) | |
| 88 | + return result | |
| 89 | + | |
| 90 | + | |
| 91 | +def top_level_from_dict(s: Any) -> TopLevel: | |
| 92 | + return TopLevel.from_dict(s) | |
| 93 | + | |
| 94 | + | |
| 95 | +def top_level_to_dict(x: TopLevel) -> Any: | |
| 96 | + return to_class(TopLevel, x) |
Aschema-rubydefault / TopLevel.rb+94 −0
| @@ -0,0 +1,94 @@ | ||
| 1 | +# This code may look unusually verbose for Ruby (and it is), but | |
| 2 | +# it performs some subtle and complex validation of JSON data. | |
| 3 | +# | |
| 4 | +# To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: | |
| 5 | +# | |
| 6 | +# top_level = TopLevel.from_json! "{…}" | |
| 7 | +# puts top_level.ordered.mango | |
| 8 | +# | |
| 9 | +# If from_json! succeeds, the value returned matches the schema. | |
| 10 | + | |
| 11 | +require 'json' | |
| 12 | +require 'dry-types' | |
| 13 | +require 'dry-struct' | |
| 14 | + | |
| 15 | +module Types | |
| 16 | + include Dry.Types(default: :nominal) | |
| 17 | + | |
| 18 | + Integer = Strict::Integer | |
| 19 | + Bool = Strict::Bool | |
| 20 | + Hash = Strict::Hash | |
| 21 | + String = Strict::String | |
| 22 | + Double = Strict::Float | Strict::Integer | |
| 23 | +end | |
| 24 | + | |
| 25 | +class Ordered < Dry::Struct | |
| 26 | + attribute :mango, Types::Double | |
| 27 | + attribute :zebra, Types::String | |
| 28 | + attribute :apple, Types::Bool | |
| 29 | + | |
| 30 | + def self.from_dynamic!(d) | |
| 31 | + d = Types::Hash[d] | |
| 32 | + new( | |
| 33 | + mango: d.fetch("mango"), | |
| 34 | + zebra: d.fetch("zebra"), | |
| 35 | + apple: d.fetch("apple"), | |
| 36 | + ) | |
| 37 | + end | |
| 38 | + | |
| 39 | + def self.from_json!(json) | |
| 40 | + from_dynamic!(JSON.parse(json)) | |
| 41 | + end | |
| 42 | + | |
| 43 | + def to_dynamic | |
| 44 | + { | |
| 45 | + "mango" => mango, | |
| 46 | + "zebra" => zebra, | |
| 47 | + "apple" => apple, | |
| 48 | + } | |
| 49 | + end | |
| 50 | + | |
| 51 | + def to_json(options = nil) | |
| 52 | + JSON.generate(to_dynamic, options) | |
| 53 | + end | |
| 54 | +end | |
| 55 | + | |
| 56 | +class TopLevel < Dry::Struct | |
| 57 | + attribute :zebra, Types::String | |
| 58 | + attribute :mango, Types::Double | |
| 59 | + attribute :apple, Types::Bool | |
| 60 | + attribute :delta, Types::String | |
| 61 | + attribute :banana, Types::Integer | |
| 62 | + attribute :ordered, Ordered | |
| 63 | + | |
| 64 | + def self.from_dynamic!(d) | |
| 65 | + d = Types::Hash[d] | |
| 66 | + new( | |
| 67 | + zebra: d.fetch("zebra"), | |
| 68 | + mango: d.fetch("mango"), | |
| 69 | + apple: d.fetch("apple"), | |
| 70 | + delta: d.fetch("delta"), | |
| 71 | + banana: d.fetch("banana"), | |
| 72 | + ordered: Ordered.from_dynamic!(d.fetch("ordered")), | |
| 73 | + ) | |
| 74 | + end | |
| 75 | + | |
| 76 | + def self.from_json!(json) | |
| 77 | + from_dynamic!(JSON.parse(json)) | |
| 78 | + end | |
| 79 | + | |
| 80 | + def to_dynamic | |
| 81 | + { | |
| 82 | + "zebra" => zebra, | |
| 83 | + "mango" => mango, | |
| 84 | + "apple" => apple, | |
| 85 | + "delta" => delta, | |
| 86 | + "banana" => banana, | |
| 87 | + "ordered" => ordered.to_dynamic, | |
| 88 | + } | |
| 89 | + end | |
| 90 | + | |
| 91 | + def to_json(options = nil) | |
| 92 | + JSON.generate(to_dynamic, options) | |
| 93 | + end | |
| 94 | +end |
Aschema-rustdefault / module_under_test.rs+38 −0
| @@ -0,0 +1,38 @@ | ||
| 1 | +// Example code that deserializes and serializes the model. | |
| 2 | +// extern crate serde; | |
| 3 | +// #[macro_use] | |
| 4 | +// extern crate serde_derive; | |
| 5 | +// extern crate serde_json; | |
| 6 | +// | |
| 7 | +// use generated_module::TopLevel; | |
| 8 | +// | |
| 9 | +// fn main() { | |
| 10 | +// let json = r#"{"answer": 42}"#; | |
| 11 | +// let model: TopLevel = serde_json::from_str(&json).unwrap(); | |
| 12 | +// } | |
| 13 | + | |
| 14 | +use serde::{Serialize, Deserialize}; | |
| 15 | + | |
| 16 | +#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 17 | +pub struct TopLevel { | |
| 18 | + pub zebra: String, | |
| 19 | + | |
| 20 | + pub mango: f64, | |
| 21 | + | |
| 22 | + pub apple: bool, | |
| 23 | + | |
| 24 | + pub delta: String, | |
| 25 | + | |
| 26 | + pub banana: i64, | |
| 27 | + | |
| 28 | + pub ordered: Ordered, | |
| 29 | +} | |
| 30 | + | |
| 31 | +#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 32 | +pub struct Ordered { | |
| 33 | + pub mango: f64, | |
| 34 | + | |
| 35 | + pub zebra: String, | |
| 36 | + | |
| 37 | + pub apple: bool, | |
| 38 | +} |
Aschema-scala3-upickledefault / TopLevel.scala+81 −0
| @@ -0,0 +1,81 @@ | ||
| 1 | +package quicktype | |
| 2 | + | |
| 3 | +// Custom pickler so that missing keys and JSON nulls both read as None, | |
| 4 | +// and None is left out when writing (upickle's default for Option is a | |
| 5 | +// JSON array). | |
| 6 | +object OptionPickler extends upickle.AttributeTagged: | |
| 7 | + import upickle.default.Writer | |
| 8 | + import upickle.default.Reader | |
| 9 | + override implicit def OptionWriter[T: Writer]: Writer[Option[T]] = | |
| 10 | + implicitly[Writer[T]].comap[Option[T]] { | |
| 11 | + case None => null.asInstanceOf[T] | |
| 12 | + case Some(x) => x | |
| 13 | + } | |
| 14 | + | |
| 15 | + override implicit def OptionReader[T: Reader]: Reader[Option[T]] = { | |
| 16 | + new Reader.Delegate[Any, Option[T]](implicitly[Reader[T]].map(Some(_))){ | |
| 17 | + override def visitNull(index: Int) = None | |
| 18 | + } | |
| 19 | + } | |
| 20 | +end OptionPickler | |
| 21 | + | |
| 22 | +// If a union has a null in, then we'll need this too... | |
| 23 | +type NullValue = None.type | |
| 24 | +given OptionPickler.ReadWriter[NullValue] = OptionPickler.readwriter[ujson.Value].bimap[NullValue]( | |
| 25 | + _ => ujson.Null, | |
| 26 | + json => if json.isNull then None else throw new upickle.core.Abort("not null") | |
| 27 | +) | |
| 28 | + | |
| 29 | +object JsonExt: | |
| 30 | + val valueReader = OptionPickler.readwriter[ujson.Value] | |
| 31 | + | |
| 32 | + // upickle's built-in primitive readers are lenient -- the numeric and | |
| 33 | + // boolean readers accept strings, and the string reader accepts | |
| 34 | + // numbers and booleans -- so untagged unions need strict readers to | |
| 35 | + // pick the right member. | |
| 36 | + val strictString: OptionPickler.Reader[String] = valueReader.map { | |
| 37 | + case ujson.Str(s) => s | |
| 38 | + case json => throw new upickle.core.Abort("expected string, got " + json) | |
| 39 | + } | |
| 40 | + val strictLong: OptionPickler.Reader[Long] = valueReader.map { | |
| 41 | + case ujson.Num(n) if n.isWhole => n.toLong | |
| 42 | + case json => throw new upickle.core.Abort("expected integer, got " + json) | |
| 43 | + } | |
| 44 | + val strictDouble: OptionPickler.Reader[Double] = valueReader.map { | |
| 45 | + case ujson.Num(n) => n | |
| 46 | + case json => throw new upickle.core.Abort("expected number, got " + json) | |
| 47 | + } | |
| 48 | + val strictBoolean: OptionPickler.Reader[Boolean] = valueReader.map { | |
| 49 | + case ujson.Bool(b) => b | |
| 50 | + case json => throw new upickle.core.Abort("expected boolean, got " + json) | |
| 51 | + } | |
| 52 | + | |
| 53 | + def badMerge[T](r1: => OptionPickler.Reader[?], rest: OptionPickler.Reader[?]*): OptionPickler.Reader[T] = valueReader.map { json => | |
| 54 | + var t: T | Null = null | |
| 55 | + val stack = Vector.newBuilder[Throwable] | |
| 56 | + (r1 +: rest).foreach { reader => | |
| 57 | + if t == null then | |
| 58 | + try | |
| 59 | + t = OptionPickler.read[T](json, trace = true)(using reader.asInstanceOf[OptionPickler.Reader[T]]) | |
| 60 | + catch | |
| 61 | + case exc => stack += exc | |
| 62 | + } | |
| 63 | + if t != null then t.nn else throw new Exception(json.toString(), stack.result().headOption.getOrElse(null)) | |
| 64 | + } | |
| 65 | +end JsonExt | |
| 66 | + | |
| 67 | + | |
| 68 | +case class TopLevel ( | |
| 69 | + val zebra : String, | |
| 70 | + val mango : Double, | |
| 71 | + val apple : Boolean, | |
| 72 | + val delta : String, | |
| 73 | + val banana : Long, | |
| 74 | + val ordered : Ordered | |
| 75 | +) derives OptionPickler.ReadWriter | |
| 76 | + | |
| 77 | +case class Ordered ( | |
| 78 | + val mango : Double, | |
| 79 | + val zebra : String, | |
| 80 | + val apple : Boolean | |
| 81 | +) derives OptionPickler.ReadWriter |
Aschema-scala3default / TopLevel.scala+23 −0
| @@ -0,0 +1,23 @@ | ||
| 1 | +package quicktype | |
| 2 | + | |
| 3 | +import io.circe.syntax._ | |
| 4 | +import io.circe._ | |
| 5 | +import cats.syntax.functor._ | |
| 6 | + | |
| 7 | +// If a union has a null in, then we'll need this too... | |
| 8 | +type NullValue = None.type | |
| 9 | + | |
| 10 | +case class TopLevel ( | |
| 11 | + val zebra : String, | |
| 12 | + val mango : Double, | |
| 13 | + val apple : Boolean, | |
| 14 | + val delta : String, | |
| 15 | + val banana : Long, | |
| 16 | + val ordered : Ordered | |
| 17 | +) derives Encoder.AsObject, Decoder | |
| 18 | + | |
| 19 | +case class Ordered ( | |
| 20 | + val mango : Double, | |
| 21 | + val zebra : String, | |
| 22 | + val apple : Boolean | |
| 23 | +) derives Encoder.AsObject, Decoder |
Aschema-schemadefault / TopLevel.schema+60 −0
| @@ -0,0 +1,60 @@ | ||
| 1 | +{ | |
| 2 | + "$schema": "http://json-schema.org/draft-06/schema#", | |
| 3 | + "$ref": "#/definitions/TopLevel", | |
| 4 | + "definitions": { | |
| 5 | + "TopLevel": { | |
| 6 | + "type": "object", | |
| 7 | + "additionalProperties": false, | |
| 8 | + "properties": { | |
| 9 | + "zebra": { | |
| 10 | + "type": "string" | |
| 11 | + }, | |
| 12 | + "mango": { | |
| 13 | + "type": "number" | |
| 14 | + }, | |
| 15 | + "apple": { | |
| 16 | + "type": "boolean" | |
| 17 | + }, | |
| 18 | + "delta": { | |
| 19 | + "type": "string" | |
| 20 | + }, | |
| 21 | + "banana": { | |
| 22 | + "type": "integer" | |
| 23 | + }, | |
| 24 | + "ordered": { | |
| 25 | + "$ref": "#/definitions/Ordered" | |
| 26 | + } | |
| 27 | + }, | |
| 28 | + "required": [ | |
| 29 | + "apple", | |
| 30 | + "banana", | |
| 31 | + "delta", | |
| 32 | + "mango", | |
| 33 | + "ordered", | |
| 34 | + "zebra" | |
| 35 | + ], | |
| 36 | + "title": "TopLevel" | |
| 37 | + }, | |
| 38 | + "Ordered": { | |
| 39 | + "type": "object", | |
| 40 | + "additionalProperties": false, | |
| 41 | + "properties": { | |
| 42 | + "mango": { | |
| 43 | + "type": "number" | |
| 44 | + }, | |
| 45 | + "zebra": { | |
| 46 | + "type": "string" | |
| 47 | + }, | |
| 48 | + "apple": { | |
| 49 | + "type": "boolean" | |
| 50 | + } | |
| 51 | + }, | |
| 52 | + "required": [ | |
| 53 | + "apple", | |
| 54 | + "mango", | |
| 55 | + "zebra" | |
| 56 | + ], | |
| 57 | + "title": "Ordered" | |
| 58 | + } | |
| 59 | + } | |
| 60 | +} |
Aschema-swiftdefault / quicktype.swift+158 −0
| @@ -0,0 +1,158 @@ | ||
| 1 | +// This file was generated from JSON Schema using quicktype, do not modify it directly. | |
| 2 | +// To parse the JSON, add this file to your project and do: | |
| 3 | +// | |
| 4 | +// let topLevel = try TopLevel(json) | |
| 5 | + | |
| 6 | +import Foundation | |
| 7 | + | |
| 8 | +// MARK: - TopLevel | |
| 9 | +struct TopLevel: Codable { | |
| 10 | + let zebra: String | |
| 11 | + let mango: Double | |
| 12 | + let apple: Bool | |
| 13 | + let delta: String | |
| 14 | + let banana: Int | |
| 15 | + let ordered: Ordered | |
| 16 | + | |
| 17 | + enum CodingKeys: String, CodingKey { | |
| 18 | + case zebra = "zebra" | |
| 19 | + case mango = "mango" | |
| 20 | + case apple = "apple" | |
| 21 | + case delta = "delta" | |
| 22 | + case banana = "banana" | |
| 23 | + case ordered = "ordered" | |
| 24 | + } | |
| 25 | +} | |
| 26 | + | |
| 27 | +// MARK: TopLevel convenience initializers and mutators | |
| 28 | + | |
| 29 | +extension TopLevel { | |
| 30 | + init(data: Data) throws { | |
| 31 | + self = try newJSONDecoder().decode(TopLevel.self, from: data) | |
| 32 | + } | |
| 33 | + | |
| 34 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 35 | + guard let data = json.data(using: encoding) else { | |
| 36 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 37 | + } | |
| 38 | + try self.init(data: data) | |
| 39 | + } | |
| 40 | + | |
| 41 | + init(fromURL url: URL) throws { | |
| 42 | + try self.init(data: try Data(contentsOf: url)) | |
| 43 | + } | |
| 44 | + | |
| 45 | + func with( | |
| 46 | + zebra: String? = nil, | |
| 47 | + mango: Double? = nil, | |
| 48 | + apple: Bool? = nil, | |
| 49 | + delta: String? = nil, | |
| 50 | + banana: Int? = nil, | |
| 51 | + ordered: Ordered? = nil | |
| 52 | + ) -> TopLevel { | |
| 53 | + return TopLevel( | |
| 54 | + zebra: zebra ?? self.zebra, | |
| 55 | + mango: mango ?? self.mango, | |
| 56 | + apple: apple ?? self.apple, | |
| 57 | + delta: delta ?? self.delta, | |
| 58 | + banana: banana ?? self.banana, | |
| 59 | + ordered: ordered ?? self.ordered | |
| 60 | + ) | |
| 61 | + } | |
| 62 | + | |
| 63 | + func jsonData() throws -> Data { | |
| 64 | + return try newJSONEncoder().encode(self) | |
| 65 | + } | |
| 66 | + | |
| 67 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 68 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 69 | + } | |
| 70 | +} | |
| 71 | + | |
| 72 | +// MARK: - Ordered | |
| 73 | +struct Ordered: Codable { | |
| 74 | + let mango: Double | |
| 75 | + let zebra: String | |
| 76 | + let apple: Bool | |
| 77 | + | |
| 78 | + enum CodingKeys: String, CodingKey { | |
| 79 | + case mango = "mango" | |
| 80 | + case zebra = "zebra" | |
| 81 | + case apple = "apple" | |
| 82 | + } | |
| 83 | +} | |
| 84 | + | |
| 85 | +// MARK: Ordered convenience initializers and mutators | |
| 86 | + | |
| 87 | +extension Ordered { | |
| 88 | + init(data: Data) throws { | |
| 89 | + self = try newJSONDecoder().decode(Ordered.self, from: data) | |
| 90 | + } | |
| 91 | + | |
| 92 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 93 | + guard let data = json.data(using: encoding) else { | |
| 94 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 95 | + } | |
| 96 | + try self.init(data: data) | |
| 97 | + } | |
| 98 | + | |
| 99 | + init(fromURL url: URL) throws { | |
| 100 | + try self.init(data: try Data(contentsOf: url)) | |
| 101 | + } | |
| 102 | + | |
| 103 | + func with( | |
| 104 | + mango: Double? = nil, | |
| 105 | + zebra: String? = nil, | |
| 106 | + apple: Bool? = nil | |
| 107 | + ) -> Ordered { | |
| 108 | + return Ordered( | |
| 109 | + mango: mango ?? self.mango, | |
| 110 | + zebra: zebra ?? self.zebra, | |
| 111 | + apple: apple ?? self.apple | |
| 112 | + ) | |
| 113 | + } | |
| 114 | + | |
| 115 | + func jsonData() throws -> Data { | |
| 116 | + return try newJSONEncoder().encode(self) | |
| 117 | + } | |
| 118 | + | |
| 119 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 120 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 121 | + } | |
| 122 | +} | |
| 123 | + | |
| 124 | +// MARK: - Helper functions for creating encoders and decoders | |
| 125 | + | |
| 126 | +func newJSONDecoder() -> JSONDecoder { | |
| 127 | + let decoder = JSONDecoder() | |
| 128 | + decoder.dateDecodingStrategy = .custom({ (decoder) -> Date in | |
| 129 | + let container = try decoder.singleValueContainer() | |
| 130 | + let dateStr = try container.decode(String.self) | |
| 131 | + | |
| 132 | + let formatter = DateFormatter() | |
| 133 | + formatter.calendar = Calendar(identifier: .iso8601) | |
| 134 | + formatter.locale = Locale(identifier: "en_US_POSIX") | |
| 135 | + formatter.timeZone = TimeZone(secondsFromGMT: 0) | |
| 136 | + formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" | |
| 137 | + if let date = formatter.date(from: dateStr) { | |
| 138 | + return date | |
| 139 | + } | |
| 140 | + formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssXXXXX" | |
| 141 | + if let date = formatter.date(from: dateStr) { | |
| 142 | + return date | |
| 143 | + } | |
| 144 | + throw DecodingError.typeMismatch(Date.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "Could not decode date")) | |
| 145 | + }) | |
| 146 | + return decoder | |
| 147 | +} | |
| 148 | + | |
| 149 | +func newJSONEncoder() -> JSONEncoder { | |
| 150 | + let encoder = JSONEncoder() | |
| 151 | + let formatter = DateFormatter() | |
| 152 | + formatter.calendar = Calendar(identifier: .iso8601) | |
| 153 | + formatter.locale = Locale(identifier: "en_US_POSIX") | |
| 154 | + formatter.timeZone = TimeZone(secondsFromGMT: 0) | |
| 155 | + formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssXXXXX" | |
| 156 | + encoder.dateEncodingStrategy = .formatted(formatter) | |
| 157 | + return encoder | |
| 158 | +} |
Aschema-typescript-zoddefault / TopLevel.ts+19 −0
| @@ -0,0 +1,19 @@ | ||
| 1 | +import * as z from "zod"; | |
| 2 | + | |
| 3 | + | |
| 4 | +export const OrderedSchema = z.object({ | |
| 5 | + "mango": z.number(), | |
| 6 | + "zebra": z.string(), | |
| 7 | + "apple": z.boolean(), | |
| 8 | +}); | |
| 9 | +export type Ordered = z.infer<typeof OrderedSchema>; | |
| 10 | + | |
| 11 | +export const TopLevelSchema = z.object({ | |
| 12 | + "zebra": z.string(), | |
| 13 | + "mango": z.number(), | |
| 14 | + "apple": z.boolean(), | |
| 15 | + "delta": z.string(), | |
| 16 | + "banana": z.number(), | |
| 17 | + "ordered": OrderedSchema, | |
| 18 | +}); | |
| 19 | +export type TopLevel = z.infer<typeof TopLevelSchema>; |
Aschema-typescriptdefault / TopLevel.ts+204 −0
| @@ -0,0 +1,204 @@ | ||
| 1 | +// To parse this data: | |
| 2 | +// | |
| 3 | +// import { Convert, TopLevel } from "./TopLevel"; | |
| 4 | +// | |
| 5 | +// const topLevel = Convert.toTopLevel(json); | |
| 6 | +// | |
| 7 | +// These functions will throw an error if the JSON doesn't | |
| 8 | +// match the expected interface, even if the JSON is valid. | |
| 9 | + | |
| 10 | +export interface TopLevel { | |
| 11 | + zebra: string; | |
| 12 | + mango: number; | |
| 13 | + apple: boolean; | |
| 14 | + delta: string; | |
| 15 | + banana: number; | |
| 16 | + ordered: Ordered; | |
| 17 | +} | |
| 18 | + | |
| 19 | +export interface Ordered { | |
| 20 | + mango: number; | |
| 21 | + zebra: string; | |
| 22 | + apple: boolean; | |
| 23 | +} | |
| 24 | + | |
| 25 | +// Converts JSON strings to/from your types | |
| 26 | +// and asserts the results of JSON.parse at runtime | |
| 27 | +export class Convert { | |
| 28 | + public static toTopLevel(json: string): TopLevel { | |
| 29 | + return cast(JSON.parse(json), r("TopLevel")); | |
| 30 | + } | |
| 31 | + | |
| 32 | + public static topLevelToJson(value: TopLevel): string { | |
| 33 | + return JSON.stringify(uncast(value, r("TopLevel")), null, 2); | |
| 34 | + } | |
| 35 | +} | |
| 36 | + | |
| 37 | +function invalidValue(typ: any, val: any, key: any, parent: any = ''): never { | |
| 38 | + const prettyTyp = prettyTypeName(typ); | |
| 39 | + const parentText = parent ? ` on ${parent}` : ''; | |
| 40 | + const keyText = key ? ` for key "${key}"` : ''; | |
| 41 | + throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); | |
| 42 | +} | |
| 43 | + | |
| 44 | +function prettyTypeName(typ: any): string { | |
| 45 | + if (Array.isArray(typ)) { | |
| 46 | + if (typ.length === 2 && typ[0] === undefined) { | |
| 47 | + return `an optional ${prettyTypeName(typ[1])}`; | |
| 48 | + } else { | |
| 49 | + return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`; | |
| 50 | + } | |
| 51 | + } else if (typeof typ === "object" && typ.literal !== undefined) { | |
| 52 | + return typ.literal; | |
| 53 | + } else { | |
| 54 | + return typeof typ; | |
| 55 | + } | |
| 56 | +} | |
| 57 | + | |
| 58 | +function jsonToJSProps(typ: any): any { | |
| 59 | + if (typ.jsonToJS === undefined) { | |
| 60 | + const map: any = {}; | |
| 61 | + typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ }); | |
| 62 | + typ.jsonToJS = map; | |
| 63 | + } | |
| 64 | + return typ.jsonToJS; | |
| 65 | +} | |
| 66 | + | |
| 67 | +function jsToJSONProps(typ: any): any { | |
| 68 | + if (typ.jsToJSON === undefined) { | |
| 69 | + const map: any = {}; | |
| 70 | + typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ }); | |
| 71 | + typ.jsToJSON = map; | |
| 72 | + } | |
| 73 | + return typ.jsToJSON; | |
| 74 | +} | |
| 75 | + | |
| 76 | +function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any { | |
| 77 | + function transformPrimitive(typ: string, val: any): any { | |
| 78 | + if (typeof typ === typeof val) return val; | |
| 79 | + return invalidValue(typ, val, key, parent); | |
| 80 | + } | |
| 81 | + | |
| 82 | + function transformUnion(typs: any[], val: any): any { | |
| 83 | + // val must validate against one typ in typs | |
| 84 | + const l = typs.length; | |
| 85 | + for (let i = 0; i < l; i++) { | |
| 86 | + const typ = typs[i]; | |
| 87 | + try { | |
| 88 | + return transform(val, typ, getProps); | |
| 89 | + } catch (_) {} | |
| 90 | + } | |
| 91 | + return invalidValue(typs, val, key, parent); | |
| 92 | + } | |
| 93 | + | |
| 94 | + function transformEnum(cases: string[], val: any): any { | |
| 95 | + if (cases.indexOf(val) !== -1) return val; | |
| 96 | + return invalidValue(cases.map(a => { return l(a); }), val, key, parent); | |
| 97 | + } | |
| 98 | + | |
| 99 | + function transformArray(typ: any, val: any): any { | |
| 100 | + // val must be an array with no invalid elements | |
| 101 | + if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent); | |
| 102 | + return val.map(el => transform(el, typ, getProps)); | |
| 103 | + } | |
| 104 | + | |
| 105 | + function transformDate(val: any): any { | |
| 106 | + if (val === null) { | |
| 107 | + return null; | |
| 108 | + } | |
| 109 | + const d = new Date(val); | |
| 110 | + if (isNaN(d.valueOf())) { | |
| 111 | + return invalidValue(l("Date"), val, key, parent); | |
| 112 | + } | |
| 113 | + return d; | |
| 114 | + } | |
| 115 | + | |
| 116 | + function transformObject(props: { [k: string]: any }, additional: any, val: any): any { | |
| 117 | + if (val === null || typeof val !== "object" || Array.isArray(val)) { | |
| 118 | + return invalidValue(l(ref || "object"), val, key, parent); | |
| 119 | + } | |
| 120 | + const result: any = {}; | |
| 121 | + Object.getOwnPropertyNames(props).forEach(key => { | |
| 122 | + const prop = props[key]; | |
| 123 | + const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; | |
| 124 | + result[prop.key] = transform(v, prop.typ, getProps, key, ref); | |
| 125 | + }); | |
| 126 | + Object.getOwnPropertyNames(val).forEach(key => { | |
| 127 | + if (!Object.prototype.hasOwnProperty.call(props, key)) { | |
| 128 | + result[key] = transform(val[key], additional, getProps, key, ref); | |
| 129 | + } | |
| 130 | + }); | |
| 131 | + return result; | |
| 132 | + } | |
| 133 | + | |
| 134 | + if (typ === "any") return val; | |
| 135 | + if (typ === null) { | |
| 136 | + if (val === null) return val; | |
| 137 | + return invalidValue(typ, val, key, parent); | |
| 138 | + } | |
| 139 | + if (typ === false) return invalidValue(typ, val, key, parent); | |
| 140 | + let ref: any = undefined; | |
| 141 | + while (typeof typ === "object" && typ.ref !== undefined) { | |
| 142 | + ref = typ.ref; | |
| 143 | + typ = typeMap[typ.ref]; | |
| 144 | + } | |
| 145 | + if (Array.isArray(typ)) return transformEnum(typ, val); | |
| 146 | + if (typeof typ === "object") { | |
| 147 | + return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val) | |
| 148 | + : typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val) | |
| 149 | + : typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val) | |
| 150 | + : invalidValue(typ, val, key, parent); | |
| 151 | + } | |
| 152 | + // Numbers can be parsed by Date but shouldn't be. | |
| 153 | + if (typ === Date && typeof val !== "number") return transformDate(val); | |
| 154 | + return transformPrimitive(typ, val); | |
| 155 | +} | |
| 156 | + | |
| 157 | +function cast<T>(val: any, typ: any): T { | |
| 158 | + return transform(val, typ, jsonToJSProps); | |
| 159 | +} | |
| 160 | + | |
| 161 | +function uncast<T>(val: T, typ: any): any { | |
| 162 | + return transform(val, typ, jsToJSONProps); | |
| 163 | +} | |
| 164 | + | |
| 165 | +function l(typ: any) { | |
| 166 | + return { literal: typ }; | |
| 167 | +} | |
| 168 | + | |
| 169 | +function a(typ: any) { | |
| 170 | + return { arrayItems: typ }; | |
| 171 | +} | |
| 172 | + | |
| 173 | +function u(...typs: any[]) { | |
| 174 | + return { unionMembers: typs }; | |
| 175 | +} | |
| 176 | + | |
| 177 | +function o(props: any[], additional: any) { | |
| 178 | + return { props, additional }; | |
| 179 | +} | |
| 180 | + | |
| 181 | +function m(additional: any) { | |
| 182 | + const props: any[] = []; | |
| 183 | + return { props, additional }; | |
| 184 | +} | |
| 185 | + | |
| 186 | +function r(name: string) { | |
| 187 | + return { ref: name }; | |
| 188 | +} | |
| 189 | + | |
| 190 | +const typeMap: any = { | |
| 191 | + "TopLevel": o([ | |
| 192 | + { json: "zebra", js: "zebra", typ: "" }, | |
| 193 | + { json: "mango", js: "mango", typ: 3.14 }, | |
| 194 | + { json: "apple", js: "apple", typ: true }, | |
| 195 | + { json: "delta", js: "delta", typ: "" }, | |
| 196 | + { json: "banana", js: "banana", typ: 0 }, | |
| 197 | + { json: "ordered", js: "ordered", typ: r("Ordered") }, | |
| 198 | + ], false), | |
| 199 | + "Ordered": o([ | |
| 200 | + { json: "mango", js: "mango", typ: 3.14 }, | |
| 201 | + { json: "zebra", js: "zebra", typ: "" }, | |
| 202 | + { json: "apple", js: "apple", typ: true }, | |
| 203 | + ], false), | |
| 204 | +}; |
Test case
45 generated files · +1,165 −1,165test/inputs/schema/renaming-bug.schema
Mschema-cjsondefault / TopLevel.c+76 −76
| @@ -198,15 +198,15 @@ struct Part * cJSON_GetPartValue(const cJSON * j) { | ||
| 198 | 198 | if (NULL != j) { |
| 199 | 199 | if (NULL != (x = cJSON_malloc(sizeof(struct Part)))) { |
| 200 | 200 | memset(x, 0, sizeof(struct Part)); |
| 201 | - if (cJSON_HasObjectItem(j, "depth")) { | |
| 202 | - x->depth = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "depth"))); | |
| 203 | - } | |
| 204 | 201 | if (cJSON_HasObjectItem(j, "length")) { |
| 205 | 202 | x->length = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "length"))); |
| 206 | 203 | } |
| 207 | 204 | if (cJSON_HasObjectItem(j, "width")) { |
| 208 | 205 | x->width = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "width"))); |
| 209 | 206 | } |
| 207 | + if (cJSON_HasObjectItem(j, "depth")) { | |
| 208 | + x->depth = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "depth"))); | |
| 209 | + } | |
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | return x; |
| @@ -216,15 +216,15 @@ cJSON * cJSON_CreatePart(const struct Part * x) { | ||
| 216 | 216 | cJSON * j = NULL; |
| 217 | 217 | if (NULL != x) { |
| 218 | 218 | if (NULL != (j = cJSON_CreateObject())) { |
| 219 | - if (NULL != x->depth) { | |
| 220 | - cJSON_AddStringToObject(j, "depth", x->depth); | |
| 221 | - } | |
| 222 | 219 | if (NULL != x->length) { |
| 223 | 220 | cJSON_AddStringToObject(j, "length", x->length); |
| 224 | 221 | } |
| 225 | 222 | if (NULL != x->width) { |
| 226 | 223 | cJSON_AddStringToObject(j, "width", x->width); |
| 227 | 224 | } |
| 225 | + if (NULL != x->depth) { | |
| 226 | + cJSON_AddStringToObject(j, "depth", x->depth); | |
| 227 | + } | |
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | return j; |
| @@ -244,15 +244,15 @@ char * cJSON_PrintPart(const struct Part * x) { | ||
| 244 | 244 | |
| 245 | 245 | void cJSON_DeletePart(struct Part * x) { |
| 246 | 246 | if (NULL != x) { |
| 247 | - if (NULL != x->depth) { | |
| 248 | - cJSON_free(x->depth); | |
| 249 | - } | |
| 250 | 247 | if (NULL != x->length) { |
| 251 | 248 | cJSON_free(x->length); |
| 252 | 249 | } |
| 253 | 250 | if (NULL != x->width) { |
| 254 | 251 | cJSON_free(x->width); |
| 255 | 252 | } |
| 253 | + if (NULL != x->depth) { | |
| 254 | + cJSON_free(x->depth); | |
| 255 | + } | |
| 256 | 256 | cJSON_free(x); |
| 257 | 257 | } |
| 258 | 258 | } |
| @@ -497,12 +497,12 @@ struct Shape * cJSON_GetShapeValue(const cJSON * j) { | ||
| 497 | 497 | if (NULL != j) { |
| 498 | 498 | if (NULL != (x = cJSON_malloc(sizeof(struct Shape)))) { |
| 499 | 499 | memset(x, 0, sizeof(struct Shape)); |
| 500 | - if (cJSON_HasObjectItem(j, "geometry")) { | |
| 501 | - x->geometry = cJSON_GetGeometryValue(cJSON_GetObjectItemCaseSensitive(j, "geometry")); | |
| 502 | - } | |
| 503 | 500 | if (cJSON_HasObjectItem(j, "history")) { |
| 504 | 501 | x->history = cJSON_GetHistoryValue(cJSON_GetObjectItemCaseSensitive(j, "history")); |
| 505 | 502 | } |
| 503 | + if (cJSON_HasObjectItem(j, "geometry")) { | |
| 504 | + x->geometry = cJSON_GetGeometryValue(cJSON_GetObjectItemCaseSensitive(j, "geometry")); | |
| 505 | + } | |
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | 508 | return x; |
| @@ -512,12 +512,12 @@ cJSON * cJSON_CreateShape(const struct Shape * x) { | ||
| 512 | 512 | cJSON * j = NULL; |
| 513 | 513 | if (NULL != x) { |
| 514 | 514 | if (NULL != (j = cJSON_CreateObject())) { |
| 515 | - if (NULL != x->geometry) { | |
| 516 | - cJSON_AddItemToObject(j, "geometry", cJSON_CreateGeometry(x->geometry)); | |
| 517 | - } | |
| 518 | 515 | if (NULL != x->history) { |
| 519 | 516 | cJSON_AddItemToObject(j, "history", cJSON_CreateHistory(x->history)); |
| 520 | 517 | } |
| 518 | + if (NULL != x->geometry) { | |
| 519 | + cJSON_AddItemToObject(j, "geometry", cJSON_CreateGeometry(x->geometry)); | |
| 520 | + } | |
| 521 | 521 | } |
| 522 | 522 | } |
| 523 | 523 | return j; |
| @@ -537,12 +537,12 @@ char * cJSON_PrintShape(const struct Shape * x) { | ||
| 537 | 537 | |
| 538 | 538 | void cJSON_DeleteShape(struct Shape * x) { |
| 539 | 539 | if (NULL != x) { |
| 540 | - if (NULL != x->geometry) { | |
| 541 | - cJSON_DeleteGeometry(x->geometry); | |
| 542 | - } | |
| 543 | 540 | if (NULL != x->history) { |
| 544 | 541 | cJSON_DeleteHistory(x->history); |
| 545 | 542 | } |
| 543 | + if (NULL != x->geometry) { | |
| 544 | + cJSON_DeleteGeometry(x->geometry); | |
| 545 | + } | |
| 546 | 546 | cJSON_free(x); |
| 547 | 547 | } |
| 548 | 548 | } |
| @@ -564,12 +564,12 @@ struct Berry * cJSON_GetBerryValue(const cJSON * j) { | ||
| 564 | 564 | if (NULL != j) { |
| 565 | 565 | if (NULL != (x = cJSON_malloc(sizeof(struct Berry)))) { |
| 566 | 566 | memset(x, 0, sizeof(struct Berry)); |
| 567 | - if (cJSON_HasObjectItem(j, "color")) { | |
| 568 | - x->color = cJSON_GetColorValue(cJSON_GetObjectItemCaseSensitive(j, "color")); | |
| 569 | - } | |
| 570 | 567 | if (cJSON_HasObjectItem(j, "name")) { |
| 571 | 568 | x->name = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "name"))); |
| 572 | 569 | } |
| 570 | + if (cJSON_HasObjectItem(j, "color")) { | |
| 571 | + x->color = cJSON_GetColorValue(cJSON_GetObjectItemCaseSensitive(j, "color")); | |
| 572 | + } | |
| 573 | 573 | if (cJSON_HasObjectItem(j, "shapes")) { |
| 574 | 574 | list_t * x1 = list_create(false, NULL); |
| 575 | 575 | if (NULL != x1) { |
| @@ -590,12 +590,12 @@ cJSON * cJSON_CreateBerry(const struct Berry * x) { | ||
| 590 | 590 | cJSON * j = NULL; |
| 591 | 591 | if (NULL != x) { |
| 592 | 592 | if (NULL != (j = cJSON_CreateObject())) { |
| 593 | - if (NULL != x->color) { | |
| 594 | - cJSON_AddItemToObject(j, "color", cJSON_CreateColor(x->color)); | |
| 595 | - } | |
| 596 | 593 | if (NULL != x->name) { |
| 597 | 594 | cJSON_AddStringToObject(j, "name", x->name); |
| 598 | 595 | } |
| 596 | + if (NULL != x->color) { | |
| 597 | + cJSON_AddItemToObject(j, "color", cJSON_CreateColor(x->color)); | |
| 598 | + } | |
| 599 | 599 | if (NULL != x->shapes) { |
| 600 | 600 | cJSON * j1 = cJSON_AddArrayToObject(j, "shapes"); |
| 601 | 601 | if (NULL != j1) { |
| @@ -625,12 +625,12 @@ char * cJSON_PrintBerry(const struct Berry * x) { | ||
| 625 | 625 | |
| 626 | 626 | void cJSON_DeleteBerry(struct Berry * x) { |
| 627 | 627 | if (NULL != x) { |
| 628 | - if (NULL != x->color) { | |
| 629 | - cJSON_DeleteColor(x->color); | |
| 630 | - } | |
| 631 | 628 | if (NULL != x->name) { |
| 632 | 629 | cJSON_free(x->name); |
| 633 | 630 | } |
| 631 | + if (NULL != x->color) { | |
| 632 | + cJSON_DeleteColor(x->color); | |
| 633 | + } | |
| 634 | 634 | if (NULL != x->shapes) { |
| 635 | 635 | struct Shape * x1 = list_get_head(x->shapes); |
| 636 | 636 | while (NULL != x1) { |
| @@ -665,6 +665,11 @@ struct Fruit * cJSON_GetFruitValue(const cJSON * j) { | ||
| 665 | 665 | *x->apple = cJSON_IsTrue(cJSON_GetObjectItemCaseSensitive(j, "apple")); |
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | + if (cJSON_HasObjectItem(j, "orange")) { | |
| 669 | + if (NULL != (x->orange = cJSON_malloc(sizeof(bool)))) { | |
| 670 | + *x->orange = cJSON_IsTrue(cJSON_GetObjectItemCaseSensitive(j, "orange")); | |
| 671 | + } | |
| 672 | + } | |
| 668 | 673 | if (cJSON_HasObjectItem(j, "berries")) { |
| 669 | 674 | list_t * x1 = list_create(false, NULL); |
| 670 | 675 | if (NULL != x1) { |
| @@ -676,11 +681,6 @@ struct Fruit * cJSON_GetFruitValue(const cJSON * j) { | ||
| 676 | 681 | x->berries = x1; |
| 677 | 682 | } |
| 678 | 683 | } |
| 679 | - if (cJSON_HasObjectItem(j, "orange")) { | |
| 680 | - if (NULL != (x->orange = cJSON_malloc(sizeof(bool)))) { | |
| 681 | - *x->orange = cJSON_IsTrue(cJSON_GetObjectItemCaseSensitive(j, "orange")); | |
| 682 | - } | |
| 683 | - } | |
| 684 | 684 | } |
| 685 | 685 | } |
| 686 | 686 | return x; |
| @@ -693,6 +693,9 @@ cJSON * cJSON_CreateFruit(const struct Fruit * x) { | ||
| 693 | 693 | if (NULL != x->apple) { |
| 694 | 694 | cJSON_AddBoolToObject(j, "apple", *x->apple); |
| 695 | 695 | } |
| 696 | + if (NULL != x->orange) { | |
| 697 | + cJSON_AddBoolToObject(j, "orange", *x->orange); | |
| 698 | + } | |
| 696 | 699 | if (NULL != x->berries) { |
| 697 | 700 | cJSON * j1 = cJSON_AddArrayToObject(j, "berries"); |
| 698 | 701 | if (NULL != j1) { |
| @@ -703,9 +706,6 @@ cJSON * cJSON_CreateFruit(const struct Fruit * x) { | ||
| 703 | 706 | } |
| 704 | 707 | } |
| 705 | 708 | } |
| 706 | - if (NULL != x->orange) { | |
| 707 | - cJSON_AddBoolToObject(j, "orange", *x->orange); | |
| 708 | - } | |
| 709 | 709 | } |
| 710 | 710 | } |
| 711 | 711 | return j; |
| @@ -728,6 +728,9 @@ void cJSON_DeleteFruit(struct Fruit * x) { | ||
| 728 | 728 | if (NULL != x->apple) { |
| 729 | 729 | cJSON_free(x->apple); |
| 730 | 730 | } |
| 731 | + if (NULL != x->orange) { | |
| 732 | + cJSON_free(x->orange); | |
| 733 | + } | |
| 731 | 734 | if (NULL != x->berries) { |
| 732 | 735 | struct Berry * x1 = list_get_head(x->berries); |
| 733 | 736 | while (NULL != x1) { |
| @@ -736,9 +739,6 @@ void cJSON_DeleteFruit(struct Fruit * x) { | ||
| 736 | 739 | } |
| 737 | 740 | list_release(x->berries); |
| 738 | 741 | } |
| 739 | - if (NULL != x->orange) { | |
| 740 | - cJSON_free(x->orange); | |
| 741 | - } | |
| 742 | 742 | cJSON_free(x); |
| 743 | 743 | } |
| 744 | 744 | } |
| @@ -760,16 +760,16 @@ struct Limit * cJSON_GetLimitValue(const cJSON * j) { | ||
| 760 | 760 | if (NULL != j) { |
| 761 | 761 | if (NULL != (x = cJSON_malloc(sizeof(struct Limit)))) { |
| 762 | 762 | memset(x, 0, sizeof(struct Limit)); |
| 763 | - if (cJSON_HasObjectItem(j, "maximum")) { | |
| 764 | - if (NULL != (x->maximum = cJSON_malloc(sizeof(double)))) { | |
| 765 | - *x->maximum = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "maximum")); | |
| 766 | - } | |
| 767 | - } | |
| 768 | 763 | if (cJSON_HasObjectItem(j, "minimum")) { |
| 769 | 764 | if (NULL != (x->minimum = cJSON_malloc(sizeof(double)))) { |
| 770 | 765 | *x->minimum = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "minimum")); |
| 771 | 766 | } |
| 772 | 767 | } |
| 768 | + if (cJSON_HasObjectItem(j, "maximum")) { | |
| 769 | + if (NULL != (x->maximum = cJSON_malloc(sizeof(double)))) { | |
| 770 | + *x->maximum = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "maximum")); | |
| 771 | + } | |
| 772 | + } | |
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | 775 | return x; |
| @@ -779,12 +779,12 @@ cJSON * cJSON_CreateLimit(const struct Limit * x) { | ||
| 779 | 779 | cJSON * j = NULL; |
| 780 | 780 | if (NULL != x) { |
| 781 | 781 | if (NULL != (j = cJSON_CreateObject())) { |
| 782 | - if (NULL != x->maximum) { | |
| 783 | - cJSON_AddNumberToObject(j, "maximum", *x->maximum); | |
| 784 | - } | |
| 785 | 782 | if (NULL != x->minimum) { |
| 786 | 783 | cJSON_AddNumberToObject(j, "minimum", *x->minimum); |
| 787 | 784 | } |
| 785 | + if (NULL != x->maximum) { | |
| 786 | + cJSON_AddNumberToObject(j, "maximum", *x->maximum); | |
| 787 | + } | |
| 788 | 788 | } |
| 789 | 789 | } |
| 790 | 790 | return j; |
| @@ -804,12 +804,12 @@ char * cJSON_PrintLimit(const struct Limit * x) { | ||
| 804 | 804 | |
| 805 | 805 | void cJSON_DeleteLimit(struct Limit * x) { |
| 806 | 806 | if (NULL != x) { |
| 807 | - if (NULL != x->maximum) { | |
| 808 | - cJSON_free(x->maximum); | |
| 809 | - } | |
| 810 | 807 | if (NULL != x->minimum) { |
| 811 | 808 | cJSON_free(x->minimum); |
| 812 | 809 | } |
| 810 | + if (NULL != x->maximum) { | |
| 811 | + cJSON_free(x->maximum); | |
| 812 | + } | |
| 813 | 813 | cJSON_free(x); |
| 814 | 814 | } |
| 815 | 815 | } |
| @@ -971,26 +971,26 @@ struct Vehicle * cJSON_GetVehicleValue(const cJSON * j) { | ||
| 971 | 971 | if (NULL != j) { |
| 972 | 972 | if (NULL != (x = cJSON_malloc(sizeof(struct Vehicle)))) { |
| 973 | 973 | memset(x, 0, sizeof(struct Vehicle)); |
| 974 | - if (cJSON_HasObjectItem(j, "brand")) { | |
| 975 | - x->brand = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "brand"))); | |
| 976 | - } | |
| 977 | 974 | if (cJSON_HasObjectItem(j, "id")) { |
| 978 | 975 | x->id = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "id"))); |
| 979 | 976 | } |
| 977 | + if (cJSON_HasObjectItem(j, "type")) { | |
| 978 | + x->type = cJSON_GetVehicleTypeValue(cJSON_GetObjectItemCaseSensitive(j, "type")); | |
| 979 | + } | |
| 980 | 980 | if (cJSON_HasObjectItem(j, "speed")) { |
| 981 | 981 | x->speed = cJSON_GetSpeedValue(cJSON_GetObjectItemCaseSensitive(j, "speed")); |
| 982 | 982 | } |
| 983 | + if (cJSON_HasObjectItem(j, "year")) { | |
| 984 | + x->year = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "year"))); | |
| 985 | + } | |
| 986 | + if (cJSON_HasObjectItem(j, "brand")) { | |
| 987 | + x->brand = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "brand"))); | |
| 988 | + } | |
| 983 | 989 | if (cJSON_HasObjectItem(j, "subModule")) { |
| 984 | 990 | if (NULL != (x->sub_module = cJSON_malloc(sizeof(bool)))) { |
| 985 | 991 | *x->sub_module = cJSON_IsTrue(cJSON_GetObjectItemCaseSensitive(j, "subModule")); |
| 986 | 992 | } |
| 987 | 993 | } |
| 988 | - if (cJSON_HasObjectItem(j, "type")) { | |
| 989 | - x->type = cJSON_GetVehicleTypeValue(cJSON_GetObjectItemCaseSensitive(j, "type")); | |
| 990 | - } | |
| 991 | - if (cJSON_HasObjectItem(j, "year")) { | |
| 992 | - x->year = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "year"))); | |
| 993 | - } | |
| 994 | 994 | } |
| 995 | 995 | } |
| 996 | 996 | return x; |
| @@ -1000,24 +1000,24 @@ cJSON * cJSON_CreateVehicle(const struct Vehicle * x) { | ||
| 1000 | 1000 | cJSON * j = NULL; |
| 1001 | 1001 | if (NULL != x) { |
| 1002 | 1002 | if (NULL != (j = cJSON_CreateObject())) { |
| 1003 | - if (NULL != x->brand) { | |
| 1004 | - cJSON_AddStringToObject(j, "brand", x->brand); | |
| 1005 | - } | |
| 1006 | 1003 | if (NULL != x->id) { |
| 1007 | 1004 | cJSON_AddStringToObject(j, "id", x->id); |
| 1008 | 1005 | } |
| 1009 | - if (NULL != x->speed) { | |
| 1010 | - cJSON_AddItemToObject(j, "speed", cJSON_CreateSpeed(x->speed)); | |
| 1011 | - } | |
| 1012 | - if (NULL != x->sub_module) { | |
| 1013 | - cJSON_AddBoolToObject(j, "subModule", *x->sub_module); | |
| 1014 | - } | |
| 1015 | 1006 | if (NULL != x->type) { |
| 1016 | 1007 | cJSON_AddItemToObject(j, "type", cJSON_CreateVehicleType(x->type)); |
| 1017 | 1008 | } |
| 1009 | + if (NULL != x->speed) { | |
| 1010 | + cJSON_AddItemToObject(j, "speed", cJSON_CreateSpeed(x->speed)); | |
| 1011 | + } | |
| 1018 | 1012 | if (NULL != x->year) { |
| 1019 | 1013 | cJSON_AddStringToObject(j, "year", x->year); |
| 1020 | 1014 | } |
| 1015 | + if (NULL != x->brand) { | |
| 1016 | + cJSON_AddStringToObject(j, "brand", x->brand); | |
| 1017 | + } | |
| 1018 | + if (NULL != x->sub_module) { | |
| 1019 | + cJSON_AddBoolToObject(j, "subModule", *x->sub_module); | |
| 1020 | + } | |
| 1021 | 1021 | } |
| 1022 | 1022 | } |
| 1023 | 1023 | return j; |
| @@ -1037,24 +1037,24 @@ char * cJSON_PrintVehicle(const struct Vehicle * x) { | ||
| 1037 | 1037 | |
| 1038 | 1038 | void cJSON_DeleteVehicle(struct Vehicle * x) { |
| 1039 | 1039 | if (NULL != x) { |
| 1040 | - if (NULL != x->brand) { | |
| 1041 | - cJSON_free(x->brand); | |
| 1042 | - } | |
| 1043 | 1040 | if (NULL != x->id) { |
| 1044 | 1041 | cJSON_free(x->id); |
| 1045 | 1042 | } |
| 1046 | - if (NULL != x->speed) { | |
| 1047 | - cJSON_DeleteSpeed(x->speed); | |
| 1048 | - } | |
| 1049 | - if (NULL != x->sub_module) { | |
| 1050 | - cJSON_free(x->sub_module); | |
| 1051 | - } | |
| 1052 | 1043 | if (NULL != x->type) { |
| 1053 | 1044 | cJSON_DeleteVehicleType(x->type); |
| 1054 | 1045 | } |
| 1046 | + if (NULL != x->speed) { | |
| 1047 | + cJSON_DeleteSpeed(x->speed); | |
| 1048 | + } | |
| 1055 | 1049 | if (NULL != x->year) { |
| 1056 | 1050 | cJSON_free(x->year); |
| 1057 | 1051 | } |
| 1052 | + if (NULL != x->brand) { | |
| 1053 | + cJSON_free(x->brand); | |
| 1054 | + } | |
| 1055 | + if (NULL != x->sub_module) { | |
| 1056 | + cJSON_free(x->sub_module); | |
| 1057 | + } | |
| 1058 | 1058 | cJSON_free(x); |
| 1059 | 1059 | } |
| 1060 | 1060 | } |
Mschema-cjsondefault / TopLevel.h+8 −8
| @@ -43,9 +43,9 @@ struct CircularShape { | ||
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | 45 | struct Part { |
| 46 | - char * depth; | |
| 47 | 46 | char * length; |
| 48 | 47 | char * width; |
| 48 | + char * depth; | |
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | 51 | struct RectShape { |
| @@ -62,25 +62,25 @@ struct History { | ||
| 62 | 62 | }; |
| 63 | 63 | |
| 64 | 64 | struct Shape { |
| 65 | - struct Geometry * geometry; | |
| 66 | 65 | struct History * history; |
| 66 | + struct Geometry * geometry; | |
| 67 | 67 | }; |
| 68 | 68 | |
| 69 | 69 | struct Berry { |
| 70 | - struct Color * color; | |
| 71 | 70 | char * name; |
| 71 | + struct Color * color; | |
| 72 | 72 | list_t * shapes; |
| 73 | 73 | }; |
| 74 | 74 | |
| 75 | 75 | struct Fruit { |
| 76 | 76 | bool * apple; |
| 77 | - list_t * berries; | |
| 78 | 77 | bool * orange; |
| 78 | + list_t * berries; | |
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | 81 | struct Limit { |
| 82 | - double * maximum; | |
| 83 | 82 | double * minimum; |
| 83 | + double * maximum; | |
| 84 | 84 | }; |
| 85 | 85 | |
| 86 | 86 | struct Speed { |
| @@ -115,12 +115,12 @@ struct VehicleType { | ||
| 115 | 115 | }; |
| 116 | 116 | |
| 117 | 117 | struct Vehicle { |
| 118 | - char * brand; | |
| 119 | 118 | char * id; |
| 120 | - struct Speed * speed; | |
| 121 | - bool * sub_module; | |
| 122 | 119 | struct VehicleType * type; |
| 120 | + struct Speed * speed; | |
| 123 | 121 | char * year; |
| 122 | + char * brand; | |
| 123 | + bool * sub_module; | |
| 124 | 124 | }; |
| 125 | 125 | |
| 126 | 126 | struct TopLevel { |
Mschema-cplusplusdefault / quicktype.hpp+56 −56
| @@ -253,15 +253,11 @@ namespace quicktype { | ||
| 253 | 253 | virtual ~Part() = default; |
| 254 | 254 | |
| 255 | 255 | private: |
| 256 | - std::optional<std::string> depth; | |
| 257 | 256 | std::optional<std::string> length; |
| 258 | 257 | std::optional<std::string> width; |
| 258 | + std::optional<std::string> depth; | |
| 259 | 259 | |
| 260 | 260 | public: |
| 261 | - const std::optional<std::string> & get_depth() const { return depth; } | |
| 262 | - std::optional<std::string> & get_mutable_depth() { return depth; } | |
| 263 | - void set_depth(const std::optional<std::string> & value) { this->depth = value; } | |
| 264 | - | |
| 265 | 261 | const std::optional<std::string> & get_length() const { return length; } |
| 266 | 262 | std::optional<std::string> & get_mutable_length() { return length; } |
| 267 | 263 | void set_length(const std::optional<std::string> & value) { this->length = value; } |
| @@ -269,6 +265,10 @@ namespace quicktype { | ||
| 269 | 265 | const std::optional<std::string> & get_width() const { return width; } |
| 270 | 266 | std::optional<std::string> & get_mutable_width() { return width; } |
| 271 | 267 | void set_width(const std::optional<std::string> & value) { this->width = value; } |
| 268 | + | |
| 269 | + const std::optional<std::string> & get_depth() const { return depth; } | |
| 270 | + std::optional<std::string> & get_mutable_depth() { return depth; } | |
| 271 | + void set_depth(const std::optional<std::string> & value) { this->depth = value; } | |
| 272 | 272 | }; |
| 273 | 273 | |
| 274 | 274 | class RectShape { |
| @@ -324,17 +324,17 @@ namespace quicktype { | ||
| 324 | 324 | virtual ~Shape() = default; |
| 325 | 325 | |
| 326 | 326 | private: |
| 327 | - std::optional<Geometry> geometry; | |
| 328 | 327 | std::optional<History> history; |
| 328 | + std::optional<Geometry> geometry; | |
| 329 | 329 | |
| 330 | 330 | public: |
| 331 | - const std::optional<Geometry> & get_geometry() const { return geometry; } | |
| 332 | - std::optional<Geometry> & get_mutable_geometry() { return geometry; } | |
| 333 | - void set_geometry(const std::optional<Geometry> & value) { this->geometry = value; } | |
| 334 | - | |
| 335 | 331 | const std::optional<History> & get_history() const { return history; } |
| 336 | 332 | std::optional<History> & get_mutable_history() { return history; } |
| 337 | 333 | void set_history(const std::optional<History> & value) { this->history = value; } |
| 334 | + | |
| 335 | + const std::optional<Geometry> & get_geometry() const { return geometry; } | |
| 336 | + std::optional<Geometry> & get_mutable_geometry() { return geometry; } | |
| 337 | + void set_geometry(const std::optional<Geometry> & value) { this->geometry = value; } | |
| 338 | 338 | }; |
| 339 | 339 | |
| 340 | 340 | class Berry { |
| @@ -345,20 +345,20 @@ namespace quicktype { | ||
| 345 | 345 | virtual ~Berry() = default; |
| 346 | 346 | |
| 347 | 347 | private: |
| 348 | - std::optional<Color> color; | |
| 349 | 348 | std::optional<std::string> name; |
| 350 | 349 | ClassMemberConstraints name_constraint; |
| 350 | + std::optional<Color> color; | |
| 351 | 351 | std::optional<std::vector<Shape>> shapes; |
| 352 | 352 | |
| 353 | 353 | public: |
| 354 | - const std::optional<Color> & get_color() const { return color; } | |
| 355 | - std::optional<Color> & get_mutable_color() { return color; } | |
| 356 | - void set_color(const std::optional<Color> & value) { this->color = value; } | |
| 357 | - | |
| 358 | 354 | const std::optional<std::string> & get_name() const { return name; } |
| 359 | 355 | std::optional<std::string> & get_mutable_name() { return name; } |
| 360 | 356 | void set_name(const std::optional<std::string> & value) { CheckConstraint("name", name_constraint, value); this->name = value; } |
| 361 | 357 | |
| 358 | + const std::optional<Color> & get_color() const { return color; } | |
| 359 | + std::optional<Color> & get_mutable_color() { return color; } | |
| 360 | + void set_color(const std::optional<Color> & value) { this->color = value; } | |
| 361 | + | |
| 362 | 362 | const std::optional<std::vector<Shape>> & get_shapes() const { return shapes; } |
| 363 | 363 | std::optional<std::vector<Shape>> & get_mutable_shapes() { return shapes; } |
| 364 | 364 | void set_shapes(const std::optional<std::vector<Shape>> & value) { this->shapes = value; } |
| @@ -371,21 +371,21 @@ namespace quicktype { | ||
| 371 | 371 | |
| 372 | 372 | private: |
| 373 | 373 | std::optional<bool> apple; |
| 374 | - std::optional<std::vector<Berry>> berries; | |
| 375 | 374 | std::optional<bool> orange; |
| 375 | + std::optional<std::vector<Berry>> berries; | |
| 376 | 376 | |
| 377 | 377 | public: |
| 378 | 378 | const std::optional<bool> & get_apple() const { return apple; } |
| 379 | 379 | std::optional<bool> & get_mutable_apple() { return apple; } |
| 380 | 380 | void set_apple(const std::optional<bool> & value) { this->apple = value; } |
| 381 | 381 | |
| 382 | - const std::optional<std::vector<Berry>> & get_berries() const { return berries; } | |
| 383 | - std::optional<std::vector<Berry>> & get_mutable_berries() { return berries; } | |
| 384 | - void set_berries(const std::optional<std::vector<Berry>> & value) { this->berries = value; } | |
| 385 | - | |
| 386 | 382 | const std::optional<bool> & get_orange() const { return orange; } |
| 387 | 383 | std::optional<bool> & get_mutable_orange() { return orange; } |
| 388 | 384 | void set_orange(const std::optional<bool> & value) { this->orange = value; } |
| 385 | + | |
| 386 | + const std::optional<std::vector<Berry>> & get_berries() const { return berries; } | |
| 387 | + std::optional<std::vector<Berry>> & get_mutable_berries() { return berries; } | |
| 388 | + void set_berries(const std::optional<std::vector<Berry>> & value) { this->berries = value; } | |
| 389 | 389 | }; |
| 390 | 390 | |
| 391 | 391 | class Limit { |
| @@ -394,17 +394,17 @@ namespace quicktype { | ||
| 394 | 394 | virtual ~Limit() = default; |
| 395 | 395 | |
| 396 | 396 | private: |
| 397 | - std::optional<double> maximum; | |
| 398 | 397 | std::optional<double> minimum; |
| 398 | + std::optional<double> maximum; | |
| 399 | 399 | |
| 400 | 400 | public: |
| 401 | - const std::optional<double> & get_maximum() const { return maximum; } | |
| 402 | - std::optional<double> & get_mutable_maximum() { return maximum; } | |
| 403 | - void set_maximum(const std::optional<double> & value) { this->maximum = value; } | |
| 404 | - | |
| 405 | 401 | const std::optional<double> & get_minimum() const { return minimum; } |
| 406 | 402 | std::optional<double> & get_mutable_minimum() { return minimum; } |
| 407 | 403 | void set_minimum(const std::optional<double> & value) { this->minimum = value; } |
| 404 | + | |
| 405 | + const std::optional<double> & get_maximum() const { return maximum; } | |
| 406 | + std::optional<double> & get_mutable_maximum() { return maximum; } | |
| 407 | + void set_maximum(const std::optional<double> & value) { this->maximum = value; } | |
| 408 | 408 | }; |
| 409 | 409 | |
| 410 | 410 | class Speed { |
| @@ -457,38 +457,38 @@ namespace quicktype { | ||
| 457 | 457 | virtual ~Vehicle() = default; |
| 458 | 458 | |
| 459 | 459 | private: |
| 460 | - std::optional<std::string> brand; | |
| 461 | 460 | std::optional<std::string> id; |
| 462 | 461 | ClassMemberConstraints id_constraint; |
| 463 | - std::optional<Speed> speed; | |
| 464 | - std::optional<bool> sub_module; | |
| 465 | 462 | std::optional<VehicleType> type; |
| 463 | + std::optional<Speed> speed; | |
| 466 | 464 | std::optional<std::string> year; |
| 465 | + std::optional<std::string> brand; | |
| 466 | + std::optional<bool> sub_module; | |
| 467 | 467 | |
| 468 | 468 | public: |
| 469 | - const std::optional<std::string> & get_brand() const { return brand; } | |
| 470 | - std::optional<std::string> & get_mutable_brand() { return brand; } | |
| 471 | - void set_brand(const std::optional<std::string> & value) { this->brand = value; } | |
| 472 | - | |
| 473 | 469 | const std::optional<std::string> & get_id() const { return id; } |
| 474 | 470 | std::optional<std::string> & get_mutable_id() { return id; } |
| 475 | 471 | void set_id(const std::optional<std::string> & value) { CheckConstraint("id", id_constraint, value); this->id = value; } |
| 476 | 472 | |
| 477 | - const std::optional<Speed> & get_speed() const { return speed; } | |
| 478 | - std::optional<Speed> & get_mutable_speed() { return speed; } | |
| 479 | - void set_speed(const std::optional<Speed> & value) { this->speed = value; } | |
| 480 | - | |
| 481 | - const std::optional<bool> & get_sub_module() const { return sub_module; } | |
| 482 | - std::optional<bool> & get_mutable_sub_module() { return sub_module; } | |
| 483 | - void set_sub_module(const std::optional<bool> & value) { this->sub_module = value; } | |
| 484 | - | |
| 485 | 473 | const std::optional<VehicleType> & get_type() const { return type; } |
| 486 | 474 | std::optional<VehicleType> & get_mutable_type() { return type; } |
| 487 | 475 | void set_type(const std::optional<VehicleType> & value) { this->type = value; } |
| 488 | 476 | |
| 477 | + const std::optional<Speed> & get_speed() const { return speed; } | |
| 478 | + std::optional<Speed> & get_mutable_speed() { return speed; } | |
| 479 | + void set_speed(const std::optional<Speed> & value) { this->speed = value; } | |
| 480 | + | |
| 489 | 481 | const std::optional<std::string> & get_year() const { return year; } |
| 490 | 482 | std::optional<std::string> & get_mutable_year() { return year; } |
| 491 | 483 | void set_year(const std::optional<std::string> & value) { this->year = value; } |
| 484 | + | |
| 485 | + const std::optional<std::string> & get_brand() const { return brand; } | |
| 486 | + std::optional<std::string> & get_mutable_brand() { return brand; } | |
| 487 | + void set_brand(const std::optional<std::string> & value) { this->brand = value; } | |
| 488 | + | |
| 489 | + const std::optional<bool> & get_sub_module() const { return sub_module; } | |
| 490 | + std::optional<bool> & get_mutable_sub_module() { return sub_module; } | |
| 491 | + void set_sub_module(const std::optional<bool> & value) { this->sub_module = value; } | |
| 492 | 492 | }; |
| 493 | 493 | |
| 494 | 494 | class TopLevel { |
| @@ -587,16 +587,16 @@ namespace quicktype { | ||
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | inline void from_json(const json & j, Part& x) { |
| 590 | - x.set_depth(get_stack_optional<std::string>(j, "depth")); | |
| 591 | 590 | x.set_length(get_stack_optional<std::string>(j, "length")); |
| 592 | 591 | x.set_width(get_stack_optional<std::string>(j, "width")); |
| 592 | + x.set_depth(get_stack_optional<std::string>(j, "depth")); | |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | inline void to_json(json & j, const Part & x) { |
| 596 | 596 | j = json::object(); |
| 597 | - j["depth"] = x.get_depth(); | |
| 598 | 597 | j["length"] = x.get_length(); |
| 599 | 598 | j["width"] = x.get_width(); |
| 599 | + j["depth"] = x.get_depth(); | |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | inline void from_json(const json & j, RectShape& x) { |
| @@ -629,51 +629,51 @@ namespace quicktype { | ||
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | inline void from_json(const json & j, Shape& x) { |
| 632 | - x.set_geometry(get_stack_optional<Geometry>(j, "geometry")); | |
| 633 | 632 | x.set_history(get_stack_optional<History>(j, "history")); |
| 633 | + x.set_geometry(get_stack_optional<Geometry>(j, "geometry")); | |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | inline void to_json(json & j, const Shape & x) { |
| 637 | 637 | j = json::object(); |
| 638 | - j["geometry"] = x.get_geometry(); | |
| 639 | 638 | j["history"] = x.get_history(); |
| 639 | + j["geometry"] = x.get_geometry(); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | inline void from_json(const json & j, Berry& x) { |
| 643 | - x.set_color(get_stack_optional<Color>(j, "color")); | |
| 644 | 643 | x.set_name(get_stack_optional<std::string>(j, "name")); |
| 644 | + x.set_color(get_stack_optional<Color>(j, "color")); | |
| 645 | 645 | x.set_shapes(get_stack_optional<std::vector<Shape>>(j, "shapes")); |
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | inline void to_json(json & j, const Berry & x) { |
| 649 | 649 | j = json::object(); |
| 650 | - j["color"] = x.get_color(); | |
| 651 | 650 | j["name"] = x.get_name(); |
| 651 | + j["color"] = x.get_color(); | |
| 652 | 652 | j["shapes"] = x.get_shapes(); |
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | inline void from_json(const json & j, Fruit& x) { |
| 656 | 656 | x.set_apple(get_stack_optional<bool>(j, "apple")); |
| 657 | - x.set_berries(get_stack_optional<std::vector<Berry>>(j, "berries")); | |
| 658 | 657 | x.set_orange(get_stack_optional<bool>(j, "orange")); |
| 658 | + x.set_berries(get_stack_optional<std::vector<Berry>>(j, "berries")); | |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | inline void to_json(json & j, const Fruit & x) { |
| 662 | 662 | j = json::object(); |
| 663 | 663 | j["apple"] = x.get_apple(); |
| 664 | - j["berries"] = x.get_berries(); | |
| 665 | 664 | j["orange"] = x.get_orange(); |
| 665 | + j["berries"] = x.get_berries(); | |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | inline void from_json(const json & j, Limit& x) { |
| 669 | - x.set_maximum(get_stack_optional<double>(j, "maximum")); | |
| 670 | 669 | x.set_minimum(get_stack_optional<double>(j, "minimum")); |
| 670 | + x.set_maximum(get_stack_optional<double>(j, "maximum")); | |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | inline void to_json(json & j, const Limit & x) { |
| 674 | 674 | j = json::object(); |
| 675 | - j["maximum"] = x.get_maximum(); | |
| 676 | 675 | j["minimum"] = x.get_minimum(); |
| 676 | + j["maximum"] = x.get_maximum(); | |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | inline void from_json(const json & j, Speed& x) { |
| @@ -699,22 +699,22 @@ namespace quicktype { | ||
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | inline void from_json(const json & j, Vehicle& x) { |
| 702 | - x.set_brand(get_stack_optional<std::string>(j, "brand")); | |
| 703 | 702 | x.set_id(get_stack_optional<std::string>(j, "id")); |
| 704 | - x.set_speed(get_stack_optional<Speed>(j, "speed")); | |
| 705 | - x.set_sub_module(get_stack_optional<bool>(j, "subModule")); | |
| 706 | 703 | x.set_type(get_stack_optional<VehicleType>(j, "type")); |
| 704 | + x.set_speed(get_stack_optional<Speed>(j, "speed")); | |
| 707 | 705 | x.set_year(get_stack_optional<std::string>(j, "year")); |
| 706 | + x.set_brand(get_stack_optional<std::string>(j, "brand")); | |
| 707 | + x.set_sub_module(get_stack_optional<bool>(j, "subModule")); | |
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | inline void to_json(json & j, const Vehicle & x) { |
| 711 | 711 | j = json::object(); |
| 712 | - j["brand"] = x.get_brand(); | |
| 713 | 712 | j["id"] = x.get_id(); |
| 714 | - j["speed"] = x.get_speed(); | |
| 715 | - j["subModule"] = x.get_sub_module(); | |
| 716 | 713 | j["type"] = x.get_type(); |
| 714 | + j["speed"] = x.get_speed(); | |
| 717 | 715 | j["year"] = x.get_year(); |
| 716 | + j["brand"] = x.get_brand(); | |
| 717 | + j["subModule"] = x.get_sub_module(); | |
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | inline void from_json(const json & j, TopLevel& x) { |
Mschema-csharp-recordsdefault / QuickType.cs+24 −24
| @@ -40,22 +40,22 @@ namespace QuickType | ||
| 40 | 40 | [JsonProperty("apple", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 41 | 41 | public bool? Apple { get; set; } |
| 42 | 42 | |
| 43 | - [JsonProperty("berries", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 44 | - public Berry[]? Berries { get; set; } | |
| 45 | - | |
| 46 | 43 | [JsonProperty("orange", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 47 | 44 | public bool? Orange { get; set; } |
| 45 | + | |
| 46 | + [JsonProperty("berries", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 47 | + public Berry[]? Berries { get; set; } | |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public partial record Berry |
| 51 | 51 | { |
| 52 | - [JsonProperty("color", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 53 | - public Color? Color { get; set; } | |
| 54 | - | |
| 55 | 52 | [JsonProperty("name", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 56 | 53 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 57 | 54 | public string? Name { get; set; } |
| 58 | 55 | |
| 56 | + [JsonProperty("color", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 57 | + public Color? Color { get; set; } | |
| 58 | + | |
| 59 | 59 | [JsonProperty("shapes", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 60 | 60 | public Shape[]? Shapes { get; set; } |
| 61 | 61 | } |
| @@ -68,11 +68,11 @@ namespace QuickType | ||
| 68 | 68 | |
| 69 | 69 | public partial record Shape |
| 70 | 70 | { |
| 71 | - [JsonProperty("geometry", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 72 | - public Geometry? Geometry { get; set; } | |
| 73 | - | |
| 74 | 71 | [JsonProperty("history", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 75 | 72 | public History? History { get; set; } |
| 73 | + | |
| 74 | + [JsonProperty("geometry", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 75 | + public Geometry? Geometry { get; set; } | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public partial record Geometry |
| @@ -98,14 +98,14 @@ namespace QuickType | ||
| 98 | 98 | |
| 99 | 99 | public partial record Part |
| 100 | 100 | { |
| 101 | - [JsonProperty("depth", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 102 | - public string? Depth { get; set; } | |
| 103 | - | |
| 104 | 101 | [JsonProperty("length", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 105 | 102 | public string? Length { get; set; } |
| 106 | 103 | |
| 107 | 104 | [JsonProperty("width", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 108 | 105 | public string? Width { get; set; } |
| 106 | + | |
| 107 | + [JsonProperty("depth", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 108 | + public string? Depth { get; set; } | |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | public partial record History |
| @@ -116,24 +116,24 @@ namespace QuickType | ||
| 116 | 116 | |
| 117 | 117 | public partial record Vehicle |
| 118 | 118 | { |
| 119 | - [JsonProperty("brand", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 120 | - public string? Brand { get; set; } | |
| 121 | - | |
| 122 | 119 | [JsonProperty("id", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 123 | 120 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 124 | 121 | public string? Id { get; set; } |
| 125 | 122 | |
| 126 | - [JsonProperty("speed", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 127 | - public Speed? Speed { get; set; } | |
| 128 | - | |
| 129 | - [JsonProperty("subModule", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 130 | - public bool? SubModule { get; set; } | |
| 131 | - | |
| 132 | 123 | [JsonProperty("type", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 133 | 124 | public VehicleType? Type { get; set; } |
| 134 | 125 | |
| 126 | + [JsonProperty("speed", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 127 | + public Speed? Speed { get; set; } | |
| 128 | + | |
| 135 | 129 | [JsonProperty("year", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 136 | 130 | public string? Year { get; set; } |
| 131 | + | |
| 132 | + [JsonProperty("brand", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 133 | + public string? Brand { get; set; } | |
| 134 | + | |
| 135 | + [JsonProperty("subModule", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 136 | + public bool? SubModule { get; set; } | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | public partial record Speed |
| @@ -144,11 +144,11 @@ namespace QuickType | ||
| 144 | 144 | |
| 145 | 145 | public partial record Limit |
| 146 | 146 | { |
| 147 | - [JsonProperty("maximum", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 148 | - public double? Maximum { get; set; } | |
| 149 | - | |
| 150 | 147 | [JsonProperty("minimum", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 151 | 148 | public double? Minimum { get; set; } |
| 149 | + | |
| 150 | + [JsonProperty("maximum", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 151 | + public double? Maximum { get; set; } | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | public partial record VehicleType |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+30 −30
| @@ -41,26 +41,26 @@ namespace QuickType | ||
| 41 | 41 | [JsonPropertyName("apple")] |
| 42 | 42 | public bool? Apple { get; set; } |
| 43 | 43 | |
| 44 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 45 | - [JsonPropertyName("berries")] | |
| 46 | - public Berry[]? Berries { get; set; } | |
| 47 | - | |
| 48 | 44 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 49 | 45 | [JsonPropertyName("orange")] |
| 50 | 46 | public bool? Orange { get; set; } |
| 47 | + | |
| 48 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 49 | + [JsonPropertyName("berries")] | |
| 50 | + public Berry[]? Berries { get; set; } | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public partial class Berry |
| 54 | 54 | { |
| 55 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 56 | - [JsonPropertyName("color")] | |
| 57 | - public Color? Color { get; set; } | |
| 58 | - | |
| 59 | 55 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 60 | 56 | [JsonPropertyName("name")] |
| 61 | 57 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 62 | 58 | public string? Name { get; set; } |
| 63 | 59 | |
| 60 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 61 | + [JsonPropertyName("color")] | |
| 62 | + public Color? Color { get; set; } | |
| 63 | + | |
| 64 | 64 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 65 | 65 | [JsonPropertyName("shapes")] |
| 66 | 66 | public Shape[]? Shapes { get; set; } |
| @@ -75,13 +75,13 @@ namespace QuickType | ||
| 75 | 75 | |
| 76 | 76 | public partial class Shape |
| 77 | 77 | { |
| 78 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 79 | - [JsonPropertyName("geometry")] | |
| 80 | - public Geometry? Geometry { get; set; } | |
| 81 | - | |
| 82 | 78 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 83 | 79 | [JsonPropertyName("history")] |
| 84 | 80 | public History? History { get; set; } |
| 81 | + | |
| 82 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 83 | + [JsonPropertyName("geometry")] | |
| 84 | + public Geometry? Geometry { get; set; } | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | public partial class Geometry |
| @@ -111,10 +111,6 @@ namespace QuickType | ||
| 111 | 111 | |
| 112 | 112 | public partial class Part |
| 113 | 113 | { |
| 114 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 115 | - [JsonPropertyName("depth")] | |
| 116 | - public string? Depth { get; set; } | |
| 117 | - | |
| 118 | 114 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 119 | 115 | [JsonPropertyName("length")] |
| 120 | 116 | public string? Length { get; set; } |
| @@ -122,6 +118,10 @@ namespace QuickType | ||
| 122 | 118 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 123 | 119 | [JsonPropertyName("width")] |
| 124 | 120 | public string? Width { get; set; } |
| 121 | + | |
| 122 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 123 | + [JsonPropertyName("depth")] | |
| 124 | + public string? Depth { get; set; } | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | public partial class History |
| @@ -133,30 +133,30 @@ namespace QuickType | ||
| 133 | 133 | |
| 134 | 134 | public partial class Vehicle |
| 135 | 135 | { |
| 136 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 137 | - [JsonPropertyName("brand")] | |
| 138 | - public string? Brand { get; set; } | |
| 139 | - | |
| 140 | 136 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 141 | 137 | [JsonPropertyName("id")] |
| 142 | 138 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 143 | 139 | public string? Id { get; set; } |
| 144 | 140 | |
| 141 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 142 | + [JsonPropertyName("type")] | |
| 143 | + public VehicleType? Type { get; set; } | |
| 144 | + | |
| 145 | 145 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 146 | 146 | [JsonPropertyName("speed")] |
| 147 | 147 | public Speed? Speed { get; set; } |
| 148 | 148 | |
| 149 | 149 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 150 | - [JsonPropertyName("subModule")] | |
| 151 | - public bool? SubModule { get; set; } | |
| 150 | + [JsonPropertyName("year")] | |
| 151 | + public string? Year { get; set; } | |
| 152 | 152 | |
| 153 | 153 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 154 | - [JsonPropertyName("type")] | |
| 155 | - public VehicleType? Type { get; set; } | |
| 154 | + [JsonPropertyName("brand")] | |
| 155 | + public string? Brand { get; set; } | |
| 156 | 156 | |
| 157 | 157 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 158 | - [JsonPropertyName("year")] | |
| 159 | - public string? Year { get; set; } | |
| 158 | + [JsonPropertyName("subModule")] | |
| 159 | + public bool? SubModule { get; set; } | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | public partial class Speed |
| @@ -168,13 +168,13 @@ namespace QuickType | ||
| 168 | 168 | |
| 169 | 169 | public partial class Limit |
| 170 | 170 | { |
| 171 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 172 | - [JsonPropertyName("maximum")] | |
| 173 | - public double? Maximum { get; set; } | |
| 174 | - | |
| 175 | 171 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 176 | 172 | [JsonPropertyName("minimum")] |
| 177 | 173 | public double? Minimum { get; set; } |
| 174 | + | |
| 175 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 176 | + [JsonPropertyName("maximum")] | |
| 177 | + public double? Maximum { get; set; } | |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | public partial class VehicleType |
Mschema-csharpdefault / QuickType.cs+24 −24
| @@ -40,22 +40,22 @@ namespace QuickType | ||
| 40 | 40 | [JsonProperty("apple", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 41 | 41 | public bool? Apple { get; set; } |
| 42 | 42 | |
| 43 | - [JsonProperty("berries", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 44 | - public Berry[]? Berries { get; set; } | |
| 45 | - | |
| 46 | 43 | [JsonProperty("orange", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 47 | 44 | public bool? Orange { get; set; } |
| 45 | + | |
| 46 | + [JsonProperty("berries", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 47 | + public Berry[]? Berries { get; set; } | |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public partial class Berry |
| 51 | 51 | { |
| 52 | - [JsonProperty("color", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 53 | - public Color? Color { get; set; } | |
| 54 | - | |
| 55 | 52 | [JsonProperty("name", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 56 | 53 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 57 | 54 | public string? Name { get; set; } |
| 58 | 55 | |
| 56 | + [JsonProperty("color", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 57 | + public Color? Color { get; set; } | |
| 58 | + | |
| 59 | 59 | [JsonProperty("shapes", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 60 | 60 | public Shape[]? Shapes { get; set; } |
| 61 | 61 | } |
| @@ -68,11 +68,11 @@ namespace QuickType | ||
| 68 | 68 | |
| 69 | 69 | public partial class Shape |
| 70 | 70 | { |
| 71 | - [JsonProperty("geometry", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 72 | - public Geometry? Geometry { get; set; } | |
| 73 | - | |
| 74 | 71 | [JsonProperty("history", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 75 | 72 | public History? History { get; set; } |
| 73 | + | |
| 74 | + [JsonProperty("geometry", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 75 | + public Geometry? Geometry { get; set; } | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public partial class Geometry |
| @@ -98,14 +98,14 @@ namespace QuickType | ||
| 98 | 98 | |
| 99 | 99 | public partial class Part |
| 100 | 100 | { |
| 101 | - [JsonProperty("depth", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 102 | - public string? Depth { get; set; } | |
| 103 | - | |
| 104 | 101 | [JsonProperty("length", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 105 | 102 | public string? Length { get; set; } |
| 106 | 103 | |
| 107 | 104 | [JsonProperty("width", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 108 | 105 | public string? Width { get; set; } |
| 106 | + | |
| 107 | + [JsonProperty("depth", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 108 | + public string? Depth { get; set; } | |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | public partial class History |
| @@ -116,24 +116,24 @@ namespace QuickType | ||
| 116 | 116 | |
| 117 | 117 | public partial class Vehicle |
| 118 | 118 | { |
| 119 | - [JsonProperty("brand", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 120 | - public string? Brand { get; set; } | |
| 121 | - | |
| 122 | 119 | [JsonProperty("id", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 123 | 120 | [JsonConverter(typeof(MinMaxLengthCheckConverter))] |
| 124 | 121 | public string? Id { get; set; } |
| 125 | 122 | |
| 126 | - [JsonProperty("speed", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 127 | - public Speed? Speed { get; set; } | |
| 128 | - | |
| 129 | - [JsonProperty("subModule", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 130 | - public bool? SubModule { get; set; } | |
| 131 | - | |
| 132 | 123 | [JsonProperty("type", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 133 | 124 | public VehicleType? Type { get; set; } |
| 134 | 125 | |
| 126 | + [JsonProperty("speed", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 127 | + public Speed? Speed { get; set; } | |
| 128 | + | |
| 135 | 129 | [JsonProperty("year", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 136 | 130 | public string? Year { get; set; } |
| 131 | + | |
| 132 | + [JsonProperty("brand", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 133 | + public string? Brand { get; set; } | |
| 134 | + | |
| 135 | + [JsonProperty("subModule", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 136 | + public bool? SubModule { get; set; } | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | public partial class Speed |
| @@ -144,11 +144,11 @@ namespace QuickType | ||
| 144 | 144 | |
| 145 | 145 | public partial class Limit |
| 146 | 146 | { |
| 147 | - [JsonProperty("maximum", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 148 | - public double? Maximum { get; set; } | |
| 149 | - | |
| 150 | 147 | [JsonProperty("minimum", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 151 | 148 | public double? Minimum { get; set; } |
| 149 | + | |
| 150 | + [JsonProperty("maximum", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 151 | + public double? Maximum { get; set; } | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | public partial class VehicleType |
Mschema-dartdefault / TopLevel.dart+32 −32
| @@ -34,48 +34,48 @@ class TopLevel { | ||
| 34 | 34 | |
| 35 | 35 | class Fruit { |
| 36 | 36 | final bool? apple; |
| 37 | - final List<Berry>? berries; | |
| 38 | 37 | final bool? orange; |
| 38 | + final List<Berry>? berries; | |
| 39 | 39 | |
| 40 | 40 | Fruit({ |
| 41 | 41 | this.apple, |
| 42 | - this.berries, | |
| 43 | 42 | this.orange, |
| 43 | + this.berries, | |
| 44 | 44 | }); |
| 45 | 45 | |
| 46 | 46 | factory Fruit.fromJson(Map<String, dynamic> json) => Fruit( |
| 47 | 47 | apple: json["apple"], |
| 48 | - berries: json["berries"] == null ? null : List<Berry>.from(json["berries"]!.map((x) => Berry.fromJson(x))), | |
| 49 | 48 | orange: json["orange"], |
| 49 | + berries: json["berries"] == null ? null : List<Berry>.from(json["berries"]!.map((x) => Berry.fromJson(x))), | |
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | 52 | Map<String, dynamic> toJson() => { |
| 53 | 53 | "apple": apple, |
| 54 | - "berries": berries == null ? null : List<dynamic>.from(berries!.map((x) => x.toJson())), | |
| 55 | 54 | "orange": orange, |
| 55 | + "berries": berries == null ? null : List<dynamic>.from(berries!.map((x) => x.toJson())), | |
| 56 | 56 | }; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | class Berry { |
| 60 | - final Color? color; | |
| 61 | 60 | final String? name; |
| 61 | + final Color? color; | |
| 62 | 62 | final List<Shape>? shapes; |
| 63 | 63 | |
| 64 | 64 | Berry({ |
| 65 | - this.color, | |
| 66 | 65 | this.name, |
| 66 | + this.color, | |
| 67 | 67 | this.shapes, |
| 68 | 68 | }); |
| 69 | 69 | |
| 70 | 70 | factory Berry.fromJson(Map<String, dynamic> json) => Berry( |
| 71 | - color: json["color"] == null ? null : Color.fromJson(json["color"]), | |
| 72 | 71 | name: json["name"], |
| 72 | + color: json["color"] == null ? null : Color.fromJson(json["color"]), | |
| 73 | 73 | shapes: json["shapes"] == null ? null : List<Shape>.from(json["shapes"]!.map((x) => Shape.fromJson(x))), |
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | 76 | Map<String, dynamic> toJson() => { |
| 77 | - "color": color?.toJson(), | |
| 78 | 77 | "name": name, |
| 78 | + "color": color?.toJson(), | |
| 79 | 79 | "shapes": shapes == null ? null : List<dynamic>.from(shapes!.map((x) => x.toJson())), |
| 80 | 80 | }; |
| 81 | 81 | } |
| @@ -97,22 +97,22 @@ class Color { | ||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | class Shape { |
| 100 | - final Geometry? geometry; | |
| 101 | 100 | final History? history; |
| 101 | + final Geometry? geometry; | |
| 102 | 102 | |
| 103 | 103 | Shape({ |
| 104 | - this.geometry, | |
| 105 | 104 | this.history, |
| 105 | + this.geometry, | |
| 106 | 106 | }); |
| 107 | 107 | |
| 108 | 108 | factory Shape.fromJson(Map<String, dynamic> json) => Shape( |
| 109 | - geometry: json["geometry"] == null ? null : Geometry.fromJson(json["geometry"]), | |
| 110 | 109 | history: json["history"] == null ? null : History.fromJson(json["history"]), |
| 110 | + geometry: json["geometry"] == null ? null : Geometry.fromJson(json["geometry"]), | |
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | 113 | Map<String, dynamic> toJson() => { |
| 114 | - "geometry": geometry?.toJson(), | |
| 115 | 114 | "history": history?.toJson(), |
| 115 | + "geometry": geometry?.toJson(), | |
| 116 | 116 | }; |
| 117 | 117 | } |
| 118 | 118 | |
| @@ -169,26 +169,26 @@ class RectShape { | ||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | class Part { |
| 172 | - final String? depth; | |
| 173 | 172 | final String? length; |
| 174 | 173 | final String? width; |
| 174 | + final String? depth; | |
| 175 | 175 | |
| 176 | 176 | Part({ |
| 177 | - this.depth, | |
| 178 | 177 | this.length, |
| 179 | 178 | this.width, |
| 179 | + this.depth, | |
| 180 | 180 | }); |
| 181 | 181 | |
| 182 | 182 | factory Part.fromJson(Map<String, dynamic> json) => Part( |
| 183 | - depth: json["depth"], | |
| 184 | 183 | length: json["length"], |
| 185 | 184 | width: json["width"], |
| 185 | + depth: json["depth"], | |
| 186 | 186 | ); |
| 187 | 187 | |
| 188 | 188 | Map<String, dynamic> toJson() => { |
| 189 | - "depth": depth, | |
| 190 | 189 | "length": length, |
| 191 | 190 | "width": width, |
| 191 | + "depth": depth, | |
| 192 | 192 | }; |
| 193 | 193 | } |
| 194 | 194 | |
| @@ -209,38 +209,38 @@ class History { | ||
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | class Vehicle { |
| 212 | - final String? brand; | |
| 213 | 212 | final String? id; |
| 214 | - final Speed? speed; | |
| 215 | - final bool? subModule; | |
| 216 | 213 | final VehicleType? type; |
| 214 | + final Speed? speed; | |
| 217 | 215 | final String? year; |
| 216 | + final String? brand; | |
| 217 | + final bool? subModule; | |
| 218 | 218 | |
| 219 | 219 | Vehicle({ |
| 220 | - this.brand, | |
| 221 | 220 | this.id, |
| 222 | - this.speed, | |
| 223 | - this.subModule, | |
| 224 | 221 | this.type, |
| 222 | + this.speed, | |
| 225 | 223 | this.year, |
| 224 | + this.brand, | |
| 225 | + this.subModule, | |
| 226 | 226 | }); |
| 227 | 227 | |
| 228 | 228 | factory Vehicle.fromJson(Map<String, dynamic> json) => Vehicle( |
| 229 | - brand: json["brand"], | |
| 230 | 229 | id: json["id"], |
| 231 | - speed: json["speed"] == null ? null : Speed.fromJson(json["speed"]), | |
| 232 | - subModule: json["subModule"], | |
| 233 | 230 | type: json["type"] == null ? null : VehicleType.fromJson(json["type"]), |
| 231 | + speed: json["speed"] == null ? null : Speed.fromJson(json["speed"]), | |
| 234 | 232 | year: json["year"], |
| 233 | + brand: json["brand"], | |
| 234 | + subModule: json["subModule"], | |
| 235 | 235 | ); |
| 236 | 236 | |
| 237 | 237 | Map<String, dynamic> toJson() => { |
| 238 | - "brand": brand, | |
| 239 | 238 | "id": id, |
| 240 | - "speed": speed?.toJson(), | |
| 241 | - "subModule": subModule, | |
| 242 | 239 | "type": type?.toJson(), |
| 240 | + "speed": speed?.toJson(), | |
| 243 | 241 | "year": year, |
| 242 | + "brand": brand, | |
| 243 | + "subModule": subModule, | |
| 244 | 244 | }; |
| 245 | 245 | } |
| 246 | 246 | |
| @@ -261,22 +261,22 @@ class Speed { | ||
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | class Limit { |
| 264 | - final double? maximum; | |
| 265 | 264 | final double? minimum; |
| 265 | + final double? maximum; | |
| 266 | 266 | |
| 267 | 267 | Limit({ |
| 268 | - this.maximum, | |
| 269 | 268 | this.minimum, |
| 269 | + this.maximum, | |
| 270 | 270 | }); |
| 271 | 271 | |
| 272 | 272 | factory Limit.fromJson(Map<String, dynamic> json) => Limit( |
| 273 | - maximum: json["maximum"]?.toDouble(), | |
| 274 | 273 | minimum: json["minimum"]?.toDouble(), |
| 274 | + maximum: json["maximum"]?.toDouble(), | |
| 275 | 275 | ); |
| 276 | 276 | |
| 277 | 277 | Map<String, dynamic> toJson() => { |
| 278 | - "maximum": maximum, | |
| 279 | 278 | "minimum": minimum, |
| 279 | + "maximum": maximum, | |
| 280 | 280 | }; |
| 281 | 281 | } |
Mschema-elixirdefault / QuickType.ex+35 −35
| @@ -70,19 +70,19 @@ defmodule CircularShape do | ||
| 70 | 70 | end |
| 71 | 71 | |
| 72 | 72 | defmodule Part do |
| 73 | - defstruct [:depth, :length, :width] | |
| 73 | + defstruct [:length, :width, :depth] | |
| 74 | 74 | |
| 75 | 75 | @type t :: %__MODULE__{ |
| 76 | - depth: String.t() | nil, | |
| 77 | 76 | length: String.t() | nil, |
| 78 | - width: String.t() | nil | |
| 77 | + width: String.t() | nil, | |
| 78 | + depth: String.t() | nil | |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | def from_map(m) do |
| 82 | 82 | %Part{ |
| 83 | - depth: m["depth"], | |
| 84 | 83 | length: m["length"], |
| 85 | 84 | width: m["width"], |
| 85 | + depth: m["depth"], | |
| 86 | 86 | } |
| 87 | 87 | end |
| 88 | 88 | |
| @@ -94,9 +94,9 @@ defmodule Part do | ||
| 94 | 94 | |
| 95 | 95 | def to_map(struct) do |
| 96 | 96 | %{ |
| 97 | - "depth" => struct.depth, | |
| 98 | 97 | "length" => struct.length, |
| 99 | 98 | "width" => struct.width, |
| 99 | + "depth" => struct.depth, | |
| 100 | 100 | } |
| 101 | 101 | end |
| 102 | 102 | |
| @@ -207,17 +207,17 @@ defmodule History do | ||
| 207 | 207 | end |
| 208 | 208 | |
| 209 | 209 | defmodule Shape do |
| 210 | - defstruct [:geometry, :history] | |
| 210 | + defstruct [:history, :geometry] | |
| 211 | 211 | |
| 212 | 212 | @type t :: %__MODULE__{ |
| 213 | - geometry: Geometry.t() | nil, | |
| 214 | - history: History.t() | nil | |
| 213 | + history: History.t() | nil, | |
| 214 | + geometry: Geometry.t() | nil | |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | def from_map(m) do |
| 218 | 218 | %Shape{ |
| 219 | - geometry: m["geometry"] && Geometry.from_map(m["geometry"]), | |
| 220 | 219 | history: m["history"] && History.from_map(m["history"]), |
| 220 | + geometry: m["geometry"] && Geometry.from_map(m["geometry"]), | |
| 221 | 221 | } |
| 222 | 222 | end |
| 223 | 223 | |
| @@ -229,8 +229,8 @@ defmodule Shape do | ||
| 229 | 229 | |
| 230 | 230 | def to_map(struct) do |
| 231 | 231 | %{ |
| 232 | - "geometry" => struct.geometry && Geometry.to_map(struct.geometry), | |
| 233 | 232 | "history" => struct.history && History.to_map(struct.history), |
| 233 | + "geometry" => struct.geometry && Geometry.to_map(struct.geometry), | |
| 234 | 234 | } |
| 235 | 235 | end |
| 236 | 236 | |
| @@ -242,18 +242,18 @@ defmodule Shape do | ||
| 242 | 242 | end |
| 243 | 243 | |
| 244 | 244 | defmodule Berry do |
| 245 | - defstruct [:color, :name, :shapes] | |
| 245 | + defstruct [:name, :color, :shapes] | |
| 246 | 246 | |
| 247 | 247 | @type t :: %__MODULE__{ |
| 248 | - color: Color.t() | nil, | |
| 249 | 248 | name: String.t() | nil, |
| 249 | + color: Color.t() | nil, | |
| 250 | 250 | shapes: [Shape.t()] | nil |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | def from_map(m) do |
| 254 | 254 | %Berry{ |
| 255 | - color: m["color"] && Color.from_map(m["color"]), | |
| 256 | 255 | name: m["name"], |
| 256 | + color: m["color"] && Color.from_map(m["color"]), | |
| 257 | 257 | shapes: m["shapes"] && Enum.map(m["shapes"], &Shape.from_map/1), |
| 258 | 258 | } |
| 259 | 259 | end |
| @@ -266,8 +266,8 @@ defmodule Berry do | ||
| 266 | 266 | |
| 267 | 267 | def to_map(struct) do |
| 268 | 268 | %{ |
| 269 | - "color" => struct.color && Color.to_map(struct.color), | |
| 270 | 269 | "name" => struct.name, |
| 270 | + "color" => struct.color && Color.to_map(struct.color), | |
| 271 | 271 | "shapes" => struct.shapes && Enum.map(struct.shapes, &Shape.to_map/1), |
| 272 | 272 | } |
| 273 | 273 | end |
| @@ -280,19 +280,19 @@ defmodule Berry do | ||
| 280 | 280 | end |
| 281 | 281 | |
| 282 | 282 | defmodule Fruit do |
| 283 | - defstruct [:apple, :berries, :orange] | |
| 283 | + defstruct [:apple, :orange, :berries] | |
| 284 | 284 | |
| 285 | 285 | @type t :: %__MODULE__{ |
| 286 | 286 | apple: boolean() | nil, |
| 287 | - berries: [Berry.t()] | nil, | |
| 288 | - orange: boolean() | nil | |
| 287 | + orange: boolean() | nil, | |
| 288 | + berries: [Berry.t()] | nil | |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | def from_map(m) do |
| 292 | 292 | %Fruit{ |
| 293 | 293 | apple: m["apple"], |
| 294 | - berries: m["berries"] && Enum.map(m["berries"], &Berry.from_map/1), | |
| 295 | 294 | orange: m["orange"], |
| 295 | + berries: m["berries"] && Enum.map(m["berries"], &Berry.from_map/1), | |
| 296 | 296 | } |
| 297 | 297 | end |
| 298 | 298 | |
| @@ -305,8 +305,8 @@ defmodule Fruit do | ||
| 305 | 305 | def to_map(struct) do |
| 306 | 306 | %{ |
| 307 | 307 | "apple" => struct.apple, |
| 308 | - "berries" => struct.berries && Enum.map(struct.berries, &Berry.to_map/1), | |
| 309 | 308 | "orange" => struct.orange, |
| 309 | + "berries" => struct.berries && Enum.map(struct.berries, &Berry.to_map/1), | |
| 310 | 310 | } |
| 311 | 311 | end |
| 312 | 312 | |
| @@ -318,17 +318,17 @@ defmodule Fruit do | ||
| 318 | 318 | end |
| 319 | 319 | |
| 320 | 320 | defmodule Limit do |
| 321 | - defstruct [:maximum, :minimum] | |
| 321 | + defstruct [:minimum, :maximum] | |
| 322 | 322 | |
| 323 | 323 | @type t :: %__MODULE__{ |
| 324 | - maximum: float() | nil, | |
| 325 | - minimum: float() | nil | |
| 324 | + minimum: float() | nil, | |
| 325 | + maximum: float() | nil | |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | def from_map(m) do |
| 329 | 329 | %Limit{ |
| 330 | - maximum: m["maximum"], | |
| 331 | 330 | minimum: m["minimum"], |
| 331 | + maximum: m["maximum"], | |
| 332 | 332 | } |
| 333 | 333 | end |
| 334 | 334 | |
| @@ -340,8 +340,8 @@ defmodule Limit do | ||
| 340 | 340 | |
| 341 | 341 | def to_map(struct) do |
| 342 | 342 | %{ |
| 343 | - "maximum" => struct.maximum, | |
| 344 | 343 | "minimum" => struct.minimum, |
| 344 | + "maximum" => struct.maximum, | |
| 345 | 345 | } |
| 346 | 346 | end |
| 347 | 347 | |
| @@ -526,25 +526,25 @@ defmodule VehicleType do | ||
| 526 | 526 | end |
| 527 | 527 | |
| 528 | 528 | defmodule Vehicle do |
| 529 | - defstruct [:brand, :id, :speed, :sub_module, :type, :year] | |
| 529 | + defstruct [:id, :type, :speed, :year, :brand, :sub_module] | |
| 530 | 530 | |
| 531 | 531 | @type t :: %__MODULE__{ |
| 532 | - brand: String.t() | nil, | |
| 533 | 532 | id: String.t() | nil, |
| 534 | - speed: Speed.t() | nil, | |
| 535 | - sub_module: boolean() | nil, | |
| 536 | 533 | type: VehicleType.t() | nil, |
| 537 | - year: String.t() | nil | |
| 534 | + speed: Speed.t() | nil, | |
| 535 | + year: String.t() | nil, | |
| 536 | + brand: String.t() | nil, | |
| 537 | + sub_module: boolean() | nil | |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | def from_map(m) do |
| 541 | 541 | %Vehicle{ |
| 542 | - brand: m["brand"], | |
| 543 | 542 | id: m["id"], |
| 544 | - speed: m["speed"] && Speed.from_map(m["speed"]), | |
| 545 | - sub_module: m["subModule"], | |
| 546 | 543 | type: m["type"] && VehicleType.from_map(m["type"]), |
| 544 | + speed: m["speed"] && Speed.from_map(m["speed"]), | |
| 547 | 545 | year: m["year"], |
| 546 | + brand: m["brand"], | |
| 547 | + sub_module: m["subModule"], | |
| 548 | 548 | } |
| 549 | 549 | end |
| 550 | 550 | |
| @@ -556,12 +556,12 @@ defmodule Vehicle do | ||
| 556 | 556 | |
| 557 | 557 | def to_map(struct) do |
| 558 | 558 | %{ |
| 559 | - "brand" => struct.brand, | |
| 560 | 559 | "id" => struct.id, |
| 561 | - "speed" => struct.speed && Speed.to_map(struct.speed), | |
| 562 | - "subModule" => struct.sub_module, | |
| 563 | 560 | "type" => struct.type && VehicleType.to_map(struct.type), |
| 561 | + "speed" => struct.speed && Speed.to_map(struct.speed), | |
| 564 | 562 | "year" => struct.year, |
| 563 | + "brand" => struct.brand, | |
| 564 | + "subModule" => struct.sub_module, | |
| 565 | 565 | } |
| 566 | 566 | end |
Mschema-elmdefault / QuickType.elm+34 −34
| @@ -45,13 +45,13 @@ type alias QuickType = | ||
| 45 | 45 | |
| 46 | 46 | type alias Fruit = |
| 47 | 47 | { apple : Maybe Bool |
| 48 | - , berries : Maybe (List Berry) | |
| 49 | 48 | , orange : Maybe Bool |
| 49 | + , berries : Maybe (List Berry) | |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | type alias Berry = |
| 53 | - { color : Maybe Color | |
| 54 | - , name : Maybe String | |
| 53 | + { name : Maybe String | |
| 54 | + , color : Maybe Color | |
| 55 | 55 | , shapes : Maybe (List Shape) |
| 56 | 56 | } |
| 57 | 57 | |
| @@ -60,8 +60,8 @@ type alias Color = | ||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | type alias Shape = |
| 63 | - { geometry : Maybe Geometry | |
| 64 | - , history : Maybe History | |
| 63 | + { history : Maybe History | |
| 64 | + , geometry : Maybe Geometry | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | type alias Geometry = |
| @@ -78,9 +78,9 @@ type alias RectShape = | ||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | type alias Part = |
| 81 | - { depth : Maybe String | |
| 82 | - , length : Maybe String | |
| 81 | + { length : Maybe String | |
| 83 | 82 | , width : Maybe String |
| 83 | + , depth : Maybe String | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | type alias History = |
| @@ -88,12 +88,12 @@ type alias History = | ||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | type alias Vehicle = |
| 91 | - { brand : Maybe String | |
| 92 | - , id : Maybe String | |
| 93 | - , speed : Maybe Speed | |
| 94 | - , subModule : Maybe Bool | |
| 91 | + { id : Maybe String | |
| 95 | 92 | , vehicleType : Maybe VehicleType |
| 93 | + , speed : Maybe Speed | |
| 96 | 94 | , year : Maybe String |
| 95 | + , brand : Maybe String | |
| 96 | + , subModule : Maybe Bool | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | type alias Speed = |
| @@ -101,8 +101,8 @@ type alias Speed = | ||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | type alias Limit = |
| 104 | - { maximum : Maybe Float | |
| 105 | - , minimum : Maybe Float | |
| 104 | + { minimum : Maybe Float | |
| 105 | + , maximum : Maybe Float | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | type alias VehicleType = |
| @@ -154,29 +154,29 @@ fruit : Jdec.Decoder Fruit | ||
| 154 | 154 | fruit = |
| 155 | 155 | Jdec.succeed Fruit |
| 156 | 156 | |> Jpipe.optional "apple" (Jdec.nullable Jdec.bool) Nothing |
| 157 | - |> Jpipe.optional "berries" (Jdec.nullable (Jdec.list berry)) Nothing | |
| 158 | 157 | |> Jpipe.optional "orange" (Jdec.nullable Jdec.bool) Nothing |
| 158 | + |> Jpipe.optional "berries" (Jdec.nullable (Jdec.list berry)) Nothing | |
| 159 | 159 | |
| 160 | 160 | encodeFruit : Fruit -> Jenc.Value |
| 161 | 161 | encodeFruit x = |
| 162 | 162 | Jenc.object |
| 163 | 163 | [ ("apple", makeNullableEncoder Jenc.bool x.apple) |
| 164 | - , ("berries", makeNullableEncoder (Jenc.list encodeBerry) x.berries) | |
| 165 | 164 | , ("orange", makeNullableEncoder Jenc.bool x.orange) |
| 165 | + , ("berries", makeNullableEncoder (Jenc.list encodeBerry) x.berries) | |
| 166 | 166 | ] |
| 167 | 167 | |
| 168 | 168 | berry : Jdec.Decoder Berry |
| 169 | 169 | berry = |
| 170 | 170 | Jdec.succeed Berry |
| 171 | - |> Jpipe.optional "color" (Jdec.nullable color) Nothing | |
| 172 | 171 | |> Jpipe.optional "name" (Jdec.nullable Jdec.string) Nothing |
| 172 | + |> Jpipe.optional "color" (Jdec.nullable color) Nothing | |
| 173 | 173 | |> Jpipe.optional "shapes" (Jdec.nullable (Jdec.list shape)) Nothing |
| 174 | 174 | |
| 175 | 175 | encodeBerry : Berry -> Jenc.Value |
| 176 | 176 | encodeBerry x = |
| 177 | 177 | Jenc.object |
| 178 | - [ ("color", makeNullableEncoder encodeColor x.color) | |
| 179 | - , ("name", makeNullableEncoder Jenc.string x.name) | |
| 178 | + [ ("name", makeNullableEncoder Jenc.string x.name) | |
| 179 | + , ("color", makeNullableEncoder encodeColor x.color) | |
| 180 | 180 | , ("shapes", makeNullableEncoder (Jenc.list encodeShape) x.shapes) |
| 181 | 181 | ] |
| 182 | 182 | |
| @@ -194,14 +194,14 @@ encodeColor x = | ||
| 194 | 194 | shape : Jdec.Decoder Shape |
| 195 | 195 | shape = |
| 196 | 196 | Jdec.succeed Shape |
| 197 | - |> Jpipe.optional "geometry" (Jdec.nullable geometry) Nothing | |
| 198 | 197 | |> Jpipe.optional "history" (Jdec.nullable history) Nothing |
| 198 | + |> Jpipe.optional "geometry" (Jdec.nullable geometry) Nothing | |
| 199 | 199 | |
| 200 | 200 | encodeShape : Shape -> Jenc.Value |
| 201 | 201 | encodeShape x = |
| 202 | 202 | Jenc.object |
| 203 | - [ ("geometry", makeNullableEncoder encodeGeometry x.geometry) | |
| 204 | - , ("history", makeNullableEncoder encodeHistory x.history) | |
| 203 | + [ ("history", makeNullableEncoder encodeHistory x.history) | |
| 204 | + , ("geometry", makeNullableEncoder encodeGeometry x.geometry) | |
| 205 | 205 | ] |
| 206 | 206 | |
| 207 | 207 | geometry : Jdec.Decoder Geometry |
| @@ -242,16 +242,16 @@ encodeRectShape x = | ||
| 242 | 242 | part : Jdec.Decoder Part |
| 243 | 243 | part = |
| 244 | 244 | Jdec.succeed Part |
| 245 | - |> Jpipe.optional "depth" (Jdec.nullable Jdec.string) Nothing | |
| 246 | 245 | |> Jpipe.optional "length" (Jdec.nullable Jdec.string) Nothing |
| 247 | 246 | |> Jpipe.optional "width" (Jdec.nullable Jdec.string) Nothing |
| 247 | + |> Jpipe.optional "depth" (Jdec.nullable Jdec.string) Nothing | |
| 248 | 248 | |
| 249 | 249 | encodePart : Part -> Jenc.Value |
| 250 | 250 | encodePart x = |
| 251 | 251 | Jenc.object |
| 252 | - [ ("depth", makeNullableEncoder Jenc.string x.depth) | |
| 253 | - , ("length", makeNullableEncoder Jenc.string x.length) | |
| 252 | + [ ("length", makeNullableEncoder Jenc.string x.length) | |
| 254 | 253 | , ("width", makeNullableEncoder Jenc.string x.width) |
| 254 | + , ("depth", makeNullableEncoder Jenc.string x.depth) | |
| 255 | 255 | ] |
| 256 | 256 | |
| 257 | 257 | history : Jdec.Decoder History |
| @@ -268,22 +268,22 @@ encodeHistory x = | ||
| 268 | 268 | vehicle : Jdec.Decoder Vehicle |
| 269 | 269 | vehicle = |
| 270 | 270 | Jdec.succeed Vehicle |
| 271 | - |> Jpipe.optional "brand" (Jdec.nullable Jdec.string) Nothing | |
| 272 | 271 | |> Jpipe.optional "id" (Jdec.nullable Jdec.string) Nothing |
| 273 | - |> Jpipe.optional "speed" (Jdec.nullable speed) Nothing | |
| 274 | - |> Jpipe.optional "subModule" (Jdec.nullable Jdec.bool) Nothing | |
| 275 | 272 | |> Jpipe.optional "type" (Jdec.nullable vehicleType) Nothing |
| 273 | + |> Jpipe.optional "speed" (Jdec.nullable speed) Nothing | |
| 276 | 274 | |> Jpipe.optional "year" (Jdec.nullable Jdec.string) Nothing |
| 275 | + |> Jpipe.optional "brand" (Jdec.nullable Jdec.string) Nothing | |
| 276 | + |> Jpipe.optional "subModule" (Jdec.nullable Jdec.bool) Nothing | |
| 277 | 277 | |
| 278 | 278 | encodeVehicle : Vehicle -> Jenc.Value |
| 279 | 279 | encodeVehicle x = |
| 280 | 280 | Jenc.object |
| 281 | - [ ("brand", makeNullableEncoder Jenc.string x.brand) | |
| 282 | - , ("id", makeNullableEncoder Jenc.string x.id) | |
| 283 | - , ("speed", makeNullableEncoder encodeSpeed x.speed) | |
| 284 | - , ("subModule", makeNullableEncoder Jenc.bool x.subModule) | |
| 281 | + [ ("id", makeNullableEncoder Jenc.string x.id) | |
| 285 | 282 | , ("type", makeNullableEncoder encodeVehicleType x.vehicleType) |
| 283 | + , ("speed", makeNullableEncoder encodeSpeed x.speed) | |
| 286 | 284 | , ("year", makeNullableEncoder Jenc.string x.year) |
| 285 | + , ("brand", makeNullableEncoder Jenc.string x.brand) | |
| 286 | + , ("subModule", makeNullableEncoder Jenc.bool x.subModule) | |
| 287 | 287 | ] |
| 288 | 288 | |
| 289 | 289 | speed : Jdec.Decoder Speed |
| @@ -300,14 +300,14 @@ encodeSpeed x = | ||
| 300 | 300 | limit : Jdec.Decoder Limit |
| 301 | 301 | limit = |
| 302 | 302 | Jdec.succeed Limit |
| 303 | - |> Jpipe.optional "maximum" (Jdec.nullable Jdec.float) Nothing | |
| 304 | 303 | |> Jpipe.optional "minimum" (Jdec.nullable Jdec.float) Nothing |
| 304 | + |> Jpipe.optional "maximum" (Jdec.nullable Jdec.float) Nothing | |
| 305 | 305 | |
| 306 | 306 | encodeLimit : Limit -> Jenc.Value |
| 307 | 307 | encodeLimit x = |
| 308 | 308 | Jenc.object |
| 309 | - [ ("maximum", makeNullableEncoder Jenc.float x.maximum) | |
| 310 | - , ("minimum", makeNullableEncoder Jenc.float x.minimum) | |
| 309 | + [ ("minimum", makeNullableEncoder Jenc.float x.minimum) | |
| 310 | + , ("maximum", makeNullableEncoder Jenc.float x.maximum) | |
| 311 | 311 | ] |
| 312 | 312 | |
| 313 | 313 | vehicleType : Jdec.Decoder VehicleType |
Mschema-flowdefault / TopLevel.js+16 −16
| @@ -18,14 +18,14 @@ export type TopLevel = { | ||
| 18 | 18 | |
| 19 | 19 | export type Fruit = { |
| 20 | 20 | apple?: boolean; |
| 21 | - berries?: Berry[]; | |
| 22 | 21 | orange?: boolean; |
| 22 | + berries?: Berry[]; | |
| 23 | 23 | [property: string]: mixed; |
| 24 | 24 | }; |
| 25 | 25 | |
| 26 | 26 | export type Berry = { |
| 27 | - color?: Color; | |
| 28 | 27 | name?: string; |
| 28 | + color?: Color; | |
| 29 | 29 | shapes?: Shape[]; |
| 30 | 30 | [property: string]: mixed; |
| 31 | 31 | }; |
| @@ -36,8 +36,8 @@ export type Color = { | ||
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | 38 | export type Shape = { |
| 39 | - geometry?: Geometry; | |
| 40 | 39 | history?: History; |
| 40 | + geometry?: Geometry; | |
| 41 | 41 | [property: string]: mixed; |
| 42 | 42 | }; |
| 43 | 43 | |
| @@ -58,9 +58,9 @@ export type RectShape = { | ||
| 58 | 58 | }; |
| 59 | 59 | |
| 60 | 60 | export type Part = { |
| 61 | - depth?: string; | |
| 62 | 61 | length?: string; |
| 63 | 62 | width?: string; |
| 63 | + depth?: string; | |
| 64 | 64 | [property: string]: mixed; |
| 65 | 65 | }; |
| 66 | 66 | |
| @@ -70,12 +70,12 @@ export type History = { | ||
| 70 | 70 | }; |
| 71 | 71 | |
| 72 | 72 | export type Vehicle = { |
| 73 | - brand?: string; | |
| 74 | 73 | id?: string; |
| 75 | - speed?: Speed; | |
| 76 | - subModule?: boolean; | |
| 77 | 74 | type?: VehicleType; |
| 75 | + speed?: Speed; | |
| 78 | 76 | year?: string; |
| 77 | + brand?: string; | |
| 78 | + subModule?: boolean; | |
| 79 | 79 | [property: string]: mixed; |
| 80 | 80 | }; |
| 81 | 81 | |
| @@ -85,8 +85,8 @@ export type Speed = { | ||
| 85 | 85 | }; |
| 86 | 86 | |
| 87 | 87 | export type Limit = { |
| 88 | - maximum?: number; | |
| 89 | 88 | minimum?: number; |
| 89 | + maximum?: number; | |
| 90 | 90 | [property: string]: mixed; |
| 91 | 91 | }; |
| 92 | 92 | |
| @@ -287,20 +287,20 @@ const typeMap: any = { | ||
| 287 | 287 | ], "any"), |
| 288 | 288 | "Fruit": o([ |
| 289 | 289 | { json: "apple", js: "apple", typ: u(undefined, true) }, |
| 290 | - { json: "berries", js: "berries", typ: u(undefined, a(r("Berry"))) }, | |
| 291 | 290 | { json: "orange", js: "orange", typ: u(undefined, true) }, |
| 291 | + { json: "berries", js: "berries", typ: u(undefined, a(r("Berry"))) }, | |
| 292 | 292 | ], "any"), |
| 293 | 293 | "Berry": o([ |
| 294 | - { json: "color", js: "color", typ: u(undefined, r("Color")) }, | |
| 295 | 294 | { json: "name", js: "name", typ: u(undefined, "") }, |
| 295 | + { json: "color", js: "color", typ: u(undefined, r("Color")) }, | |
| 296 | 296 | { json: "shapes", js: "shapes", typ: u(undefined, a(r("Shape"))) }, |
| 297 | 297 | ], "any"), |
| 298 | 298 | "Color": o([ |
| 299 | 299 | { json: "rgb", js: "rgb", typ: u(undefined, 3.14) }, |
| 300 | 300 | ], "any"), |
| 301 | 301 | "Shape": o([ |
| 302 | - { json: "geometry", js: "geometry", typ: u(undefined, r("Geometry")) }, | |
| 303 | 302 | { json: "history", js: "history", typ: u(undefined, r("History")) }, |
| 303 | + { json: "geometry", js: "geometry", typ: u(undefined, r("Geometry")) }, | |
| 304 | 304 | ], "any"), |
| 305 | 305 | "Geometry": o([ |
| 306 | 306 | { json: "rectShape", js: "rectShape", typ: u(undefined, r("RectShape")) }, |
| @@ -313,27 +313,27 @@ const typeMap: any = { | ||
| 313 | 313 | { json: "parts", js: "parts", typ: u(undefined, a(r("Part"))) }, |
| 314 | 314 | ], "any"), |
| 315 | 315 | "Part": o([ |
| 316 | - { json: "depth", js: "depth", typ: u(undefined, "") }, | |
| 317 | 316 | { json: "length", js: "length", typ: u(undefined, "") }, |
| 318 | 317 | { json: "width", js: "width", typ: u(undefined, "") }, |
| 318 | + { json: "depth", js: "depth", typ: u(undefined, "") }, | |
| 319 | 319 | ], "any"), |
| 320 | 320 | "History": o([ |
| 321 | 321 | { json: "class", js: "class", typ: u(undefined, "") }, |
| 322 | 322 | ], "any"), |
| 323 | 323 | "Vehicle": o([ |
| 324 | - { json: "brand", js: "brand", typ: u(undefined, "") }, | |
| 325 | 324 | { json: "id", js: "id", typ: u(undefined, "") }, |
| 326 | - { json: "speed", js: "speed", typ: u(undefined, r("Speed")) }, | |
| 327 | - { json: "subModule", js: "subModule", typ: u(undefined, true) }, | |
| 328 | 325 | { json: "type", js: "type", typ: u(undefined, r("VehicleType")) }, |
| 326 | + { json: "speed", js: "speed", typ: u(undefined, r("Speed")) }, | |
| 329 | 327 | { json: "year", js: "year", typ: u(undefined, "") }, |
| 328 | + { json: "brand", js: "brand", typ: u(undefined, "") }, | |
| 329 | + { json: "subModule", js: "subModule", typ: u(undefined, true) }, | |
| 330 | 330 | ], "any"), |
| 331 | 331 | "Speed": o([ |
| 332 | 332 | { json: "velocity", js: "velocity", typ: u(undefined, r("Limit")) }, |
| 333 | 333 | ], "any"), |
| 334 | 334 | "Limit": o([ |
| 335 | - { json: "maximum", js: "maximum", typ: u(undefined, 3.14) }, | |
| 336 | 335 | { json: "minimum", js: "minimum", typ: u(undefined, 3.14) }, |
| 336 | + { json: "maximum", js: "maximum", typ: u(undefined, 3.14) }, | |
| 337 | 337 | ], "any"), |
| 338 | 338 | "VehicleType": o([ |
| 339 | 339 | { json: "name", js: "name", typ: u(undefined, r("Name")) }, |
Mschema-golangdefault / quicktype.go+8 −8
| @@ -26,13 +26,13 @@ type TopLevel struct { | ||
| 26 | 26 | |
| 27 | 27 | type Fruit struct { |
| 28 | 28 | Apple *bool `json:"apple,omitempty"` |
| 29 | - Berries []Berry `json:"berries,omitempty"` | |
| 30 | 29 | Orange *bool `json:"orange,omitempty"` |
| 30 | + Berries []Berry `json:"berries,omitempty"` | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | type Berry struct { |
| 34 | - Color *Color `json:"color,omitempty"` | |
| 35 | 34 | Name *string `json:"name,omitempty"` |
| 35 | + Color *Color `json:"color,omitempty"` | |
| 36 | 36 | Shapes []Shape `json:"shapes,omitempty"` |
| 37 | 37 | } |
| 38 | 38 | |
| @@ -41,8 +41,8 @@ type Color struct { | ||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | type Shape struct { |
| 44 | - Geometry *Geometry `json:"geometry,omitempty"` | |
| 45 | 44 | History *History `json:"history,omitempty"` |
| 45 | + Geometry *Geometry `json:"geometry,omitempty"` | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | type Geometry struct { |
| @@ -59,9 +59,9 @@ type RectShape struct { | ||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | type Part struct { |
| 62 | - Depth *string `json:"depth,omitempty"` | |
| 63 | 62 | Length *string `json:"length,omitempty"` |
| 64 | 63 | Width *string `json:"width,omitempty"` |
| 64 | + Depth *string `json:"depth,omitempty"` | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | type History struct { |
| @@ -69,12 +69,12 @@ type History struct { | ||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | type Vehicle struct { |
| 72 | - Brand *string `json:"brand,omitempty"` | |
| 73 | 72 | ID *string `json:"id,omitempty"` |
| 74 | - Speed *Speed `json:"speed,omitempty"` | |
| 75 | - SubModule *bool `json:"subModule,omitempty"` | |
| 76 | 73 | Type *VehicleType `json:"type,omitempty"` |
| 74 | + Speed *Speed `json:"speed,omitempty"` | |
| 77 | 75 | Year *string `json:"year,omitempty"` |
| 76 | + Brand *string `json:"brand,omitempty"` | |
| 77 | + SubModule *bool `json:"subModule,omitempty"` | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | type Speed struct { |
| @@ -82,8 +82,8 @@ type Speed struct { | ||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | type Limit struct { |
| 85 | - Maximum *float64 `json:"maximum,omitempty"` | |
| 86 | 85 | Minimum *float64 `json:"minimum,omitempty"` |
| 86 | + Maximum *float64 `json:"maximum,omitempty"` | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | type VehicleType struct { |
Mschema-haskelldefault / QuickType.hs+45 −45
| @@ -35,13 +35,13 @@ data QuickType = QuickType | ||
| 35 | 35 | |
| 36 | 36 | data Fruit = Fruit |
| 37 | 37 | { appleFruit :: Maybe Bool |
| 38 | - , berriesFruit :: Maybe ([Berry]) | |
| 39 | 38 | , orangeFruit :: Maybe Bool |
| 39 | + , berriesFruit :: Maybe ([Berry]) | |
| 40 | 40 | } deriving (Show) |
| 41 | 41 | |
| 42 | 42 | data Berry = Berry |
| 43 | - { colorBerry :: Maybe Color | |
| 44 | - , nameBerry :: Maybe Text | |
| 43 | + { nameBerry :: Maybe Text | |
| 44 | + , colorBerry :: Maybe Color | |
| 45 | 45 | , shapesBerry :: Maybe ([Shape]) |
| 46 | 46 | } deriving (Show) |
| 47 | 47 | |
| @@ -50,8 +50,8 @@ data Color = Color | ||
| 50 | 50 | } deriving (Show) |
| 51 | 51 | |
| 52 | 52 | data Shape = Shape |
| 53 | - { geometryShape :: Maybe Geometry | |
| 54 | - , historyShape :: Maybe History | |
| 53 | + { historyShape :: Maybe History | |
| 54 | + , geometryShape :: Maybe Geometry | |
| 55 | 55 | } deriving (Show) |
| 56 | 56 | |
| 57 | 57 | data Geometry = Geometry |
| @@ -68,9 +68,9 @@ data RectShape = RectShape | ||
| 68 | 68 | } deriving (Show) |
| 69 | 69 | |
| 70 | 70 | data Part = Part |
| 71 | - { depthPart :: Maybe Text | |
| 72 | - , lengthPart :: Maybe Text | |
| 71 | + { lengthPart :: Maybe Text | |
| 73 | 72 | , widthPart :: Maybe Text |
| 73 | + , depthPart :: Maybe Text | |
| 74 | 74 | } deriving (Show) |
| 75 | 75 | |
| 76 | 76 | data History = History |
| @@ -78,12 +78,12 @@ data History = History | ||
| 78 | 78 | } deriving (Show) |
| 79 | 79 | |
| 80 | 80 | data Vehicle = Vehicle |
| 81 | - { brandVehicle :: Maybe Text | |
| 82 | - , vehicleIDVehicle :: Maybe Text | |
| 83 | - , speedVehicle :: Maybe Speed | |
| 84 | - , subModuleVehicle :: Maybe Bool | |
| 81 | + { vehicleIDVehicle :: Maybe Text | |
| 85 | 82 | , vehicleTypeVehicle :: Maybe VehicleType |
| 83 | + , speedVehicle :: Maybe Speed | |
| 86 | 84 | , yearVehicle :: Maybe Text |
| 85 | + , brandVehicle :: Maybe Text | |
| 86 | + , subModuleVehicle :: Maybe Bool | |
| 87 | 87 | } deriving (Show) |
| 88 | 88 | |
| 89 | 89 | data Speed = Speed |
| @@ -91,8 +91,8 @@ data Speed = Speed | ||
| 91 | 91 | } deriving (Show) |
| 92 | 92 | |
| 93 | 93 | data Limit = Limit |
| 94 | - { maximumLimit :: Maybe Float | |
| 95 | - , minimumLimit :: Maybe Float | |
| 94 | + { minimumLimit :: Maybe Float | |
| 95 | + , maximumLimit :: Maybe Float | |
| 96 | 96 | } deriving (Show) |
| 97 | 97 | |
| 98 | 98 | data VehicleType = VehicleType |
| @@ -140,31 +140,31 @@ instance FromJSON QuickType where | ||
| 140 | 140 | <*> v .:? "vehicles" |
| 141 | 141 | |
| 142 | 142 | instance ToJSON Fruit where |
| 143 | - toJSON (Fruit appleFruit berriesFruit orangeFruit) = | |
| 143 | + toJSON (Fruit appleFruit orangeFruit berriesFruit) = | |
| 144 | 144 | object |
| 145 | 145 | [ "apple" .= appleFruit |
| 146 | - , "berries" .= berriesFruit | |
| 147 | 146 | , "orange" .= orangeFruit |
| 147 | + , "berries" .= berriesFruit | |
| 148 | 148 | ] |
| 149 | 149 | |
| 150 | 150 | instance FromJSON Fruit where |
| 151 | 151 | parseJSON (Object v) = Fruit |
| 152 | 152 | <$> v .:? "apple" |
| 153 | - <*> v .:? "berries" | |
| 154 | 153 | <*> v .:? "orange" |
| 154 | + <*> v .:? "berries" | |
| 155 | 155 | |
| 156 | 156 | instance ToJSON Berry where |
| 157 | - toJSON (Berry colorBerry nameBerry shapesBerry) = | |
| 157 | + toJSON (Berry nameBerry colorBerry shapesBerry) = | |
| 158 | 158 | object |
| 159 | - [ "color" .= colorBerry | |
| 160 | - , "name" .= nameBerry | |
| 159 | + [ "name" .= nameBerry | |
| 160 | + , "color" .= colorBerry | |
| 161 | 161 | , "shapes" .= shapesBerry |
| 162 | 162 | ] |
| 163 | 163 | |
| 164 | 164 | instance FromJSON Berry where |
| 165 | 165 | parseJSON (Object v) = Berry |
| 166 | - <$> v .:? "color" | |
| 167 | - <*> v .:? "name" | |
| 166 | + <$> v .:? "name" | |
| 167 | + <*> v .:? "color" | |
| 168 | 168 | <*> v .:? "shapes" |
| 169 | 169 | |
| 170 | 170 | instance ToJSON Color where |
| @@ -178,16 +178,16 @@ instance FromJSON Color where | ||
| 178 | 178 | <$> v .:? "rgb" |
| 179 | 179 | |
| 180 | 180 | instance ToJSON Shape where |
| 181 | - toJSON (Shape geometryShape historyShape) = | |
| 181 | + toJSON (Shape historyShape geometryShape) = | |
| 182 | 182 | object |
| 183 | - [ "geometry" .= geometryShape | |
| 184 | - , "history" .= historyShape | |
| 183 | + [ "history" .= historyShape | |
| 184 | + , "geometry" .= geometryShape | |
| 185 | 185 | ] |
| 186 | 186 | |
| 187 | 187 | instance FromJSON Shape where |
| 188 | 188 | parseJSON (Object v) = Shape |
| 189 | - <$> v .:? "geometry" | |
| 190 | - <*> v .:? "history" | |
| 189 | + <$> v .:? "history" | |
| 190 | + <*> v .:? "geometry" | |
| 191 | 191 | |
| 192 | 192 | instance ToJSON Geometry where |
| 193 | 193 | toJSON (Geometry rectShapeGeometry circularShapeGeometry) = |
| @@ -222,18 +222,18 @@ instance FromJSON RectShape where | ||
| 222 | 222 | <$> v .:? "parts" |
| 223 | 223 | |
| 224 | 224 | instance ToJSON Part where |
| 225 | - toJSON (Part depthPart lengthPart widthPart) = | |
| 225 | + toJSON (Part lengthPart widthPart depthPart) = | |
| 226 | 226 | object |
| 227 | - [ "depth" .= depthPart | |
| 228 | - , "length" .= lengthPart | |
| 227 | + [ "length" .= lengthPart | |
| 229 | 228 | , "width" .= widthPart |
| 229 | + , "depth" .= depthPart | |
| 230 | 230 | ] |
| 231 | 231 | |
| 232 | 232 | instance FromJSON Part where |
| 233 | 233 | parseJSON (Object v) = Part |
| 234 | - <$> v .:? "depth" | |
| 235 | - <*> v .:? "length" | |
| 234 | + <$> v .:? "length" | |
| 236 | 235 | <*> v .:? "width" |
| 236 | + <*> v .:? "depth" | |
| 237 | 237 | |
| 238 | 238 | instance ToJSON History where |
| 239 | 239 | toJSON (History historyClassHistory) = |
| @@ -246,24 +246,24 @@ instance FromJSON History where | ||
| 246 | 246 | <$> v .:? "class" |
| 247 | 247 | |
| 248 | 248 | instance ToJSON Vehicle where |
| 249 | - toJSON (Vehicle brandVehicle vehicleIDVehicle speedVehicle subModuleVehicle vehicleTypeVehicle yearVehicle) = | |
| 249 | + toJSON (Vehicle vehicleIDVehicle vehicleTypeVehicle speedVehicle yearVehicle brandVehicle subModuleVehicle) = | |
| 250 | 250 | object |
| 251 | - [ "brand" .= brandVehicle | |
| 252 | - , "id" .= vehicleIDVehicle | |
| 253 | - , "speed" .= speedVehicle | |
| 254 | - , "subModule" .= subModuleVehicle | |
| 251 | + [ "id" .= vehicleIDVehicle | |
| 255 | 252 | , "type" .= vehicleTypeVehicle |
| 253 | + , "speed" .= speedVehicle | |
| 256 | 254 | , "year" .= yearVehicle |
| 255 | + , "brand" .= brandVehicle | |
| 256 | + , "subModule" .= subModuleVehicle | |
| 257 | 257 | ] |
| 258 | 258 | |
| 259 | 259 | instance FromJSON Vehicle where |
| 260 | 260 | parseJSON (Object v) = Vehicle |
| 261 | - <$> v .:? "brand" | |
| 262 | - <*> v .:? "id" | |
| 263 | - <*> v .:? "speed" | |
| 264 | - <*> v .:? "subModule" | |
| 261 | + <$> v .:? "id" | |
| 265 | 262 | <*> v .:? "type" |
| 263 | + <*> v .:? "speed" | |
| 266 | 264 | <*> v .:? "year" |
| 265 | + <*> v .:? "brand" | |
| 266 | + <*> v .:? "subModule" | |
| 267 | 267 | |
| 268 | 268 | instance ToJSON Speed where |
| 269 | 269 | toJSON (Speed velocitySpeed) = |
| @@ -276,16 +276,16 @@ instance FromJSON Speed where | ||
| 276 | 276 | <$> v .:? "velocity" |
| 277 | 277 | |
| 278 | 278 | instance ToJSON Limit where |
| 279 | - toJSON (Limit maximumLimit minimumLimit) = | |
| 279 | + toJSON (Limit minimumLimit maximumLimit) = | |
| 280 | 280 | object |
| 281 | - [ "maximum" .= maximumLimit | |
| 282 | - , "minimum" .= minimumLimit | |
| 281 | + [ "minimum" .= minimumLimit | |
| 282 | + , "maximum" .= maximumLimit | |
| 283 | 283 | ] |
| 284 | 284 | |
| 285 | 285 | instance FromJSON Limit where |
| 286 | 286 | parseJSON (Object v) = Limit |
| 287 | - <$> v .:? "maximum" | |
| 288 | - <*> v .:? "minimum" | |
| 287 | + <$> v .:? "minimum" | |
| 288 | + <*> v .:? "maximum" | |
| 289 | 289 | |
| 290 | 290 | instance ToJSON VehicleType where |
| 291 | 291 | toJSON (VehicleType nameVehicleType widthVehicleType lengthVehicleType) = |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / Berry.java+6 −6
| @@ -4,20 +4,20 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class Berry { |
| 7 | - private Color color; | |
| 8 | 7 | private String name; |
| 8 | + private Color color; | |
| 9 | 9 | private List<Shape> shapes; |
| 10 | 10 | |
| 11 | - @JsonProperty("color") | |
| 12 | - public Color getColor() { return color; } | |
| 13 | - @JsonProperty("color") | |
| 14 | - public void setColor(Color value) { this.color = value; } | |
| 15 | - | |
| 16 | 11 | @JsonProperty("name") |
| 17 | 12 | public String getName() { return name; } |
| 18 | 13 | @JsonProperty("name") |
| 19 | 14 | public void setName(String value) { this.name = value; } |
| 20 | 15 | |
| 16 | + @JsonProperty("color") | |
| 17 | + public Color getColor() { return color; } | |
| 18 | + @JsonProperty("color") | |
| 19 | + public void setColor(Color value) { this.color = value; } | |
| 20 | + | |
| 21 | 21 | @JsonProperty("shapes") |
| 22 | 22 | public List<Shape> getShapes() { return shapes; } |
| 23 | 23 | @JsonProperty("shapes") |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / Fruit.java+6 −6
| @@ -5,21 +5,21 @@ import java.util.List; | ||
| 5 | 5 | |
| 6 | 6 | public class Fruit { |
| 7 | 7 | private Boolean apple; |
| 8 | - private List<Berry> berries; | |
| 9 | 8 | private Boolean orange; |
| 9 | + private List<Berry> berries; | |
| 10 | 10 | |
| 11 | 11 | @JsonProperty("apple") |
| 12 | 12 | public Boolean getApple() { return apple; } |
| 13 | 13 | @JsonProperty("apple") |
| 14 | 14 | public void setApple(Boolean value) { this.apple = value; } |
| 15 | 15 | |
| 16 | - @JsonProperty("berries") | |
| 17 | - public List<Berry> getBerries() { return berries; } | |
| 18 | - @JsonProperty("berries") | |
| 19 | - public void setBerries(List<Berry> value) { this.berries = value; } | |
| 20 | - | |
| 21 | 16 | @JsonProperty("orange") |
| 22 | 17 | public Boolean getOrange() { return orange; } |
| 23 | 18 | @JsonProperty("orange") |
| 24 | 19 | public void setOrange(Boolean value) { this.orange = value; } |
| 20 | + | |
| 21 | + @JsonProperty("berries") | |
| 22 | + public List<Berry> getBerries() { return berries; } | |
| 23 | + @JsonProperty("berries") | |
| 24 | + public void setBerries(List<Berry> value) { this.berries = value; } | |
| 25 | 25 | } |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / Limit.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Limit { |
| 6 | - private Double maximum; | |
| 7 | 6 | private Double minimum; |
| 8 | - | |
| 9 | - @JsonProperty("maximum") | |
| 10 | - public Double getMaximum() { return maximum; } | |
| 11 | - @JsonProperty("maximum") | |
| 12 | - public void setMaximum(Double value) { this.maximum = value; } | |
| 7 | + private Double maximum; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("minimum") |
| 15 | 10 | public Double getMinimum() { return minimum; } |
| 16 | 11 | @JsonProperty("minimum") |
| 17 | 12 | public void setMinimum(Double value) { this.minimum = value; } |
| 13 | + | |
| 14 | + @JsonProperty("maximum") | |
| 15 | + public Double getMaximum() { return maximum; } | |
| 16 | + @JsonProperty("maximum") | |
| 17 | + public void setMaximum(Double value) { this.maximum = value; } | |
| 18 | 18 | } |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / Part.java+6 −6
| @@ -3,14 +3,9 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Part { |
| 6 | - private String depth; | |
| 7 | 6 | private String length; |
| 8 | 7 | private String width; |
| 9 | - | |
| 10 | - @JsonProperty("depth") | |
| 11 | - public String getDepth() { return depth; } | |
| 12 | - @JsonProperty("depth") | |
| 13 | - public void setDepth(String value) { this.depth = value; } | |
| 8 | + private String depth; | |
| 14 | 9 | |
| 15 | 10 | @JsonProperty("length") |
| 16 | 11 | public String getLength() { return length; } |
| @@ -21,4 +16,9 @@ public class Part { | ||
| 21 | 16 | public String getWidth() { return width; } |
| 22 | 17 | @JsonProperty("width") |
| 23 | 18 | public void setWidth(String value) { this.width = value; } |
| 19 | + | |
| 20 | + @JsonProperty("depth") | |
| 21 | + public String getDepth() { return depth; } | |
| 22 | + @JsonProperty("depth") | |
| 23 | + public void setDepth(String value) { this.depth = value; } | |
| 24 | 24 | } |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / Shape.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Shape { |
| 6 | - private Geometry geometry; | |
| 7 | 6 | private History history; |
| 8 | - | |
| 9 | - @JsonProperty("geometry") | |
| 10 | - public Geometry getGeometry() { return geometry; } | |
| 11 | - @JsonProperty("geometry") | |
| 12 | - public void setGeometry(Geometry value) { this.geometry = value; } | |
| 7 | + private Geometry geometry; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("history") |
| 15 | 10 | public History getHistory() { return history; } |
| 16 | 11 | @JsonProperty("history") |
| 17 | 12 | public void setHistory(History value) { this.history = value; } |
| 13 | + | |
| 14 | + @JsonProperty("geometry") | |
| 15 | + public Geometry getGeometry() { return geometry; } | |
| 16 | + @JsonProperty("geometry") | |
| 17 | + public void setGeometry(Geometry value) { this.geometry = value; } | |
| 18 | 18 | } |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / Vehicle.java+18 −18
| @@ -3,40 +3,40 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Vehicle { |
| 6 | - private String brand; | |
| 7 | 6 | private String id; |
| 8 | - private Speed speed; | |
| 9 | - private Boolean subModule; | |
| 10 | 7 | private VehicleType type; |
| 8 | + private Speed speed; | |
| 11 | 9 | private String year; |
| 12 | - | |
| 13 | - @JsonProperty("brand") | |
| 14 | - public String getBrand() { return brand; } | |
| 15 | - @JsonProperty("brand") | |
| 16 | - public void setBrand(String value) { this.brand = value; } | |
| 10 | + private String brand; | |
| 11 | + private Boolean subModule; | |
| 17 | 12 | |
| 18 | 13 | @JsonProperty("id") |
| 19 | 14 | public String getID() { return id; } |
| 20 | 15 | @JsonProperty("id") |
| 21 | 16 | public void setID(String value) { this.id = value; } |
| 22 | 17 | |
| 23 | - @JsonProperty("speed") | |
| 24 | - public Speed getSpeed() { return speed; } | |
| 25 | - @JsonProperty("speed") | |
| 26 | - public void setSpeed(Speed value) { this.speed = value; } | |
| 27 | - | |
| 28 | - @JsonProperty("subModule") | |
| 29 | - public Boolean getSubModule() { return subModule; } | |
| 30 | - @JsonProperty("subModule") | |
| 31 | - public void setSubModule(Boolean value) { this.subModule = value; } | |
| 32 | - | |
| 33 | 18 | @JsonProperty("type") |
| 34 | 19 | public VehicleType getType() { return type; } |
| 35 | 20 | @JsonProperty("type") |
| 36 | 21 | public void setType(VehicleType value) { this.type = value; } |
| 37 | 22 | |
| 23 | + @JsonProperty("speed") | |
| 24 | + public Speed getSpeed() { return speed; } | |
| 25 | + @JsonProperty("speed") | |
| 26 | + public void setSpeed(Speed value) { this.speed = value; } | |
| 27 | + | |
| 38 | 28 | @JsonProperty("year") |
| 39 | 29 | public String getYear() { return year; } |
| 40 | 30 | @JsonProperty("year") |
| 41 | 31 | public void setYear(String value) { this.year = value; } |
| 32 | + | |
| 33 | + @JsonProperty("brand") | |
| 34 | + public String getBrand() { return brand; } | |
| 35 | + @JsonProperty("brand") | |
| 36 | + public void setBrand(String value) { this.brand = value; } | |
| 37 | + | |
| 38 | + @JsonProperty("subModule") | |
| 39 | + public Boolean getSubModule() { return subModule; } | |
| 40 | + @JsonProperty("subModule") | |
| 41 | + public void setSubModule(Boolean value) { this.subModule = value; } | |
| 42 | 42 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / Berry.java+6 −6
| @@ -4,20 +4,20 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class Berry { |
| 7 | - private Color color; | |
| 8 | 7 | private String name; |
| 8 | + private Color color; | |
| 9 | 9 | private List<Shape> shapes; |
| 10 | 10 | |
| 11 | - @JsonProperty("color") | |
| 12 | - public Color getColor() { return color; } | |
| 13 | - @JsonProperty("color") | |
| 14 | - public void setColor(Color value) { this.color = value; } | |
| 15 | - | |
| 16 | 11 | @JsonProperty("name") |
| 17 | 12 | public String getName() { return name; } |
| 18 | 13 | @JsonProperty("name") |
| 19 | 14 | public void setName(String value) { this.name = value; } |
| 20 | 15 | |
| 16 | + @JsonProperty("color") | |
| 17 | + public Color getColor() { return color; } | |
| 18 | + @JsonProperty("color") | |
| 19 | + public void setColor(Color value) { this.color = value; } | |
| 20 | + | |
| 21 | 21 | @JsonProperty("shapes") |
| 22 | 22 | public List<Shape> getShapes() { return shapes; } |
| 23 | 23 | @JsonProperty("shapes") |
Mschema-java-lombokdefault / src / main / java / io / quicktype / Fruit.java+6 −6
| @@ -5,21 +5,21 @@ import java.util.List; | ||
| 5 | 5 | |
| 6 | 6 | public class Fruit { |
| 7 | 7 | private Boolean apple; |
| 8 | - private List<Berry> berries; | |
| 9 | 8 | private Boolean orange; |
| 9 | + private List<Berry> berries; | |
| 10 | 10 | |
| 11 | 11 | @JsonProperty("apple") |
| 12 | 12 | public Boolean getApple() { return apple; } |
| 13 | 13 | @JsonProperty("apple") |
| 14 | 14 | public void setApple(Boolean value) { this.apple = value; } |
| 15 | 15 | |
| 16 | - @JsonProperty("berries") | |
| 17 | - public List<Berry> getBerries() { return berries; } | |
| 18 | - @JsonProperty("berries") | |
| 19 | - public void setBerries(List<Berry> value) { this.berries = value; } | |
| 20 | - | |
| 21 | 16 | @JsonProperty("orange") |
| 22 | 17 | public Boolean getOrange() { return orange; } |
| 23 | 18 | @JsonProperty("orange") |
| 24 | 19 | public void setOrange(Boolean value) { this.orange = value; } |
| 20 | + | |
| 21 | + @JsonProperty("berries") | |
| 22 | + public List<Berry> getBerries() { return berries; } | |
| 23 | + @JsonProperty("berries") | |
| 24 | + public void setBerries(List<Berry> value) { this.berries = value; } | |
| 25 | 25 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / Limit.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Limit { |
| 6 | - private Double maximum; | |
| 7 | 6 | private Double minimum; |
| 8 | - | |
| 9 | - @JsonProperty("maximum") | |
| 10 | - public Double getMaximum() { return maximum; } | |
| 11 | - @JsonProperty("maximum") | |
| 12 | - public void setMaximum(Double value) { this.maximum = value; } | |
| 7 | + private Double maximum; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("minimum") |
| 15 | 10 | public Double getMinimum() { return minimum; } |
| 16 | 11 | @JsonProperty("minimum") |
| 17 | 12 | public void setMinimum(Double value) { this.minimum = value; } |
| 13 | + | |
| 14 | + @JsonProperty("maximum") | |
| 15 | + public Double getMaximum() { return maximum; } | |
| 16 | + @JsonProperty("maximum") | |
| 17 | + public void setMaximum(Double value) { this.maximum = value; } | |
| 18 | 18 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / Part.java+6 −6
| @@ -3,14 +3,9 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Part { |
| 6 | - private String depth; | |
| 7 | 6 | private String length; |
| 8 | 7 | private String width; |
| 9 | - | |
| 10 | - @JsonProperty("depth") | |
| 11 | - public String getDepth() { return depth; } | |
| 12 | - @JsonProperty("depth") | |
| 13 | - public void setDepth(String value) { this.depth = value; } | |
| 8 | + private String depth; | |
| 14 | 9 | |
| 15 | 10 | @JsonProperty("length") |
| 16 | 11 | public String getLength() { return length; } |
| @@ -21,4 +16,9 @@ public class Part { | ||
| 21 | 16 | public String getWidth() { return width; } |
| 22 | 17 | @JsonProperty("width") |
| 23 | 18 | public void setWidth(String value) { this.width = value; } |
| 19 | + | |
| 20 | + @JsonProperty("depth") | |
| 21 | + public String getDepth() { return depth; } | |
| 22 | + @JsonProperty("depth") | |
| 23 | + public void setDepth(String value) { this.depth = value; } | |
| 24 | 24 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / Shape.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Shape { |
| 6 | - private Geometry geometry; | |
| 7 | 6 | private History history; |
| 8 | - | |
| 9 | - @JsonProperty("geometry") | |
| 10 | - public Geometry getGeometry() { return geometry; } | |
| 11 | - @JsonProperty("geometry") | |
| 12 | - public void setGeometry(Geometry value) { this.geometry = value; } | |
| 7 | + private Geometry geometry; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("history") |
| 15 | 10 | public History getHistory() { return history; } |
| 16 | 11 | @JsonProperty("history") |
| 17 | 12 | public void setHistory(History value) { this.history = value; } |
| 13 | + | |
| 14 | + @JsonProperty("geometry") | |
| 15 | + public Geometry getGeometry() { return geometry; } | |
| 16 | + @JsonProperty("geometry") | |
| 17 | + public void setGeometry(Geometry value) { this.geometry = value; } | |
| 18 | 18 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / Vehicle.java+18 −18
| @@ -3,40 +3,40 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Vehicle { |
| 6 | - private String brand; | |
| 7 | 6 | private String id; |
| 8 | - private Speed speed; | |
| 9 | - private Boolean subModule; | |
| 10 | 7 | private VehicleType type; |
| 8 | + private Speed speed; | |
| 11 | 9 | private String year; |
| 12 | - | |
| 13 | - @JsonProperty("brand") | |
| 14 | - public String getBrand() { return brand; } | |
| 15 | - @JsonProperty("brand") | |
| 16 | - public void setBrand(String value) { this.brand = value; } | |
| 10 | + private String brand; | |
| 11 | + private Boolean subModule; | |
| 17 | 12 | |
| 18 | 13 | @JsonProperty("id") |
| 19 | 14 | public String getID() { return id; } |
| 20 | 15 | @JsonProperty("id") |
| 21 | 16 | public void setID(String value) { this.id = value; } |
| 22 | 17 | |
| 23 | - @JsonProperty("speed") | |
| 24 | - public Speed getSpeed() { return speed; } | |
| 25 | - @JsonProperty("speed") | |
| 26 | - public void setSpeed(Speed value) { this.speed = value; } | |
| 27 | - | |
| 28 | - @JsonProperty("subModule") | |
| 29 | - public Boolean getSubModule() { return subModule; } | |
| 30 | - @JsonProperty("subModule") | |
| 31 | - public void setSubModule(Boolean value) { this.subModule = value; } | |
| 32 | - | |
| 33 | 18 | @JsonProperty("type") |
| 34 | 19 | public VehicleType getType() { return type; } |
| 35 | 20 | @JsonProperty("type") |
| 36 | 21 | public void setType(VehicleType value) { this.type = value; } |
| 37 | 22 | |
| 23 | + @JsonProperty("speed") | |
| 24 | + public Speed getSpeed() { return speed; } | |
| 25 | + @JsonProperty("speed") | |
| 26 | + public void setSpeed(Speed value) { this.speed = value; } | |
| 27 | + | |
| 38 | 28 | @JsonProperty("year") |
| 39 | 29 | public String getYear() { return year; } |
| 40 | 30 | @JsonProperty("year") |
| 41 | 31 | public void setYear(String value) { this.year = value; } |
| 32 | + | |
| 33 | + @JsonProperty("brand") | |
| 34 | + public String getBrand() { return brand; } | |
| 35 | + @JsonProperty("brand") | |
| 36 | + public void setBrand(String value) { this.brand = value; } | |
| 37 | + | |
| 38 | + @JsonProperty("subModule") | |
| 39 | + public Boolean getSubModule() { return subModule; } | |
| 40 | + @JsonProperty("subModule") | |
| 41 | + public void setSubModule(Boolean value) { this.subModule = value; } | |
| 42 | 42 | } |
Mschema-javadefault / src / main / java / io / quicktype / Berry.java+6 −6
| @@ -4,20 +4,20 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class Berry { |
| 7 | - private Color color; | |
| 8 | 7 | private String name; |
| 8 | + private Color color; | |
| 9 | 9 | private List<Shape> shapes; |
| 10 | 10 | |
| 11 | - @JsonProperty("color") | |
| 12 | - public Color getColor() { return color; } | |
| 13 | - @JsonProperty("color") | |
| 14 | - public void setColor(Color value) { this.color = value; } | |
| 15 | - | |
| 16 | 11 | @JsonProperty("name") |
| 17 | 12 | public String getName() { return name; } |
| 18 | 13 | @JsonProperty("name") |
| 19 | 14 | public void setName(String value) { this.name = value; } |
| 20 | 15 | |
| 16 | + @JsonProperty("color") | |
| 17 | + public Color getColor() { return color; } | |
| 18 | + @JsonProperty("color") | |
| 19 | + public void setColor(Color value) { this.color = value; } | |
| 20 | + | |
| 21 | 21 | @JsonProperty("shapes") |
| 22 | 22 | public List<Shape> getShapes() { return shapes; } |
| 23 | 23 | @JsonProperty("shapes") |
Mschema-javadefault / src / main / java / io / quicktype / Fruit.java+6 −6
| @@ -5,21 +5,21 @@ import java.util.List; | ||
| 5 | 5 | |
| 6 | 6 | public class Fruit { |
| 7 | 7 | private Boolean apple; |
| 8 | - private List<Berry> berries; | |
| 9 | 8 | private Boolean orange; |
| 9 | + private List<Berry> berries; | |
| 10 | 10 | |
| 11 | 11 | @JsonProperty("apple") |
| 12 | 12 | public Boolean getApple() { return apple; } |
| 13 | 13 | @JsonProperty("apple") |
| 14 | 14 | public void setApple(Boolean value) { this.apple = value; } |
| 15 | 15 | |
| 16 | - @JsonProperty("berries") | |
| 17 | - public List<Berry> getBerries() { return berries; } | |
| 18 | - @JsonProperty("berries") | |
| 19 | - public void setBerries(List<Berry> value) { this.berries = value; } | |
| 20 | - | |
| 21 | 16 | @JsonProperty("orange") |
| 22 | 17 | public Boolean getOrange() { return orange; } |
| 23 | 18 | @JsonProperty("orange") |
| 24 | 19 | public void setOrange(Boolean value) { this.orange = value; } |
| 20 | + | |
| 21 | + @JsonProperty("berries") | |
| 22 | + public List<Berry> getBerries() { return berries; } | |
| 23 | + @JsonProperty("berries") | |
| 24 | + public void setBerries(List<Berry> value) { this.berries = value; } | |
| 25 | 25 | } |
Mschema-javadefault / src / main / java / io / quicktype / Limit.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Limit { |
| 6 | - private Double maximum; | |
| 7 | 6 | private Double minimum; |
| 8 | - | |
| 9 | - @JsonProperty("maximum") | |
| 10 | - public Double getMaximum() { return maximum; } | |
| 11 | - @JsonProperty("maximum") | |
| 12 | - public void setMaximum(Double value) { this.maximum = value; } | |
| 7 | + private Double maximum; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("minimum") |
| 15 | 10 | public Double getMinimum() { return minimum; } |
| 16 | 11 | @JsonProperty("minimum") |
| 17 | 12 | public void setMinimum(Double value) { this.minimum = value; } |
| 13 | + | |
| 14 | + @JsonProperty("maximum") | |
| 15 | + public Double getMaximum() { return maximum; } | |
| 16 | + @JsonProperty("maximum") | |
| 17 | + public void setMaximum(Double value) { this.maximum = value; } | |
| 18 | 18 | } |
Mschema-javadefault / src / main / java / io / quicktype / Part.java+6 −6
| @@ -3,14 +3,9 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Part { |
| 6 | - private String depth; | |
| 7 | 6 | private String length; |
| 8 | 7 | private String width; |
| 9 | - | |
| 10 | - @JsonProperty("depth") | |
| 11 | - public String getDepth() { return depth; } | |
| 12 | - @JsonProperty("depth") | |
| 13 | - public void setDepth(String value) { this.depth = value; } | |
| 8 | + private String depth; | |
| 14 | 9 | |
| 15 | 10 | @JsonProperty("length") |
| 16 | 11 | public String getLength() { return length; } |
| @@ -21,4 +16,9 @@ public class Part { | ||
| 21 | 16 | public String getWidth() { return width; } |
| 22 | 17 | @JsonProperty("width") |
| 23 | 18 | public void setWidth(String value) { this.width = value; } |
| 19 | + | |
| 20 | + @JsonProperty("depth") | |
| 21 | + public String getDepth() { return depth; } | |
| 22 | + @JsonProperty("depth") | |
| 23 | + public void setDepth(String value) { this.depth = value; } | |
| 24 | 24 | } |
Mschema-javadefault / src / main / java / io / quicktype / Shape.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Shape { |
| 6 | - private Geometry geometry; | |
| 7 | 6 | private History history; |
| 8 | - | |
| 9 | - @JsonProperty("geometry") | |
| 10 | - public Geometry getGeometry() { return geometry; } | |
| 11 | - @JsonProperty("geometry") | |
| 12 | - public void setGeometry(Geometry value) { this.geometry = value; } | |
| 7 | + private Geometry geometry; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("history") |
| 15 | 10 | public History getHistory() { return history; } |
| 16 | 11 | @JsonProperty("history") |
| 17 | 12 | public void setHistory(History value) { this.history = value; } |
| 13 | + | |
| 14 | + @JsonProperty("geometry") | |
| 15 | + public Geometry getGeometry() { return geometry; } | |
| 16 | + @JsonProperty("geometry") | |
| 17 | + public void setGeometry(Geometry value) { this.geometry = value; } | |
| 18 | 18 | } |
Mschema-javadefault / src / main / java / io / quicktype / Vehicle.java+18 −18
| @@ -3,40 +3,40 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Vehicle { |
| 6 | - private String brand; | |
| 7 | 6 | private String id; |
| 8 | - private Speed speed; | |
| 9 | - private Boolean subModule; | |
| 10 | 7 | private VehicleType type; |
| 8 | + private Speed speed; | |
| 11 | 9 | private String year; |
| 12 | - | |
| 13 | - @JsonProperty("brand") | |
| 14 | - public String getBrand() { return brand; } | |
| 15 | - @JsonProperty("brand") | |
| 16 | - public void setBrand(String value) { this.brand = value; } | |
| 10 | + private String brand; | |
| 11 | + private Boolean subModule; | |
| 17 | 12 | |
| 18 | 13 | @JsonProperty("id") |
| 19 | 14 | public String getID() { return id; } |
| 20 | 15 | @JsonProperty("id") |
| 21 | 16 | public void setID(String value) { this.id = value; } |
| 22 | 17 | |
| 23 | - @JsonProperty("speed") | |
| 24 | - public Speed getSpeed() { return speed; } | |
| 25 | - @JsonProperty("speed") | |
| 26 | - public void setSpeed(Speed value) { this.speed = value; } | |
| 27 | - | |
| 28 | - @JsonProperty("subModule") | |
| 29 | - public Boolean getSubModule() { return subModule; } | |
| 30 | - @JsonProperty("subModule") | |
| 31 | - public void setSubModule(Boolean value) { this.subModule = value; } | |
| 32 | - | |
| 33 | 18 | @JsonProperty("type") |
| 34 | 19 | public VehicleType getType() { return type; } |
| 35 | 20 | @JsonProperty("type") |
| 36 | 21 | public void setType(VehicleType value) { this.type = value; } |
| 37 | 22 | |
| 23 | + @JsonProperty("speed") | |
| 24 | + public Speed getSpeed() { return speed; } | |
| 25 | + @JsonProperty("speed") | |
| 26 | + public void setSpeed(Speed value) { this.speed = value; } | |
| 27 | + | |
| 38 | 28 | @JsonProperty("year") |
| 39 | 29 | public String getYear() { return year; } |
| 40 | 30 | @JsonProperty("year") |
| 41 | 31 | public void setYear(String value) { this.year = value; } |
| 32 | + | |
| 33 | + @JsonProperty("brand") | |
| 34 | + public String getBrand() { return brand; } | |
| 35 | + @JsonProperty("brand") | |
| 36 | + public void setBrand(String value) { this.brand = value; } | |
| 37 | + | |
| 38 | + @JsonProperty("subModule") | |
| 39 | + public Boolean getSubModule() { return subModule; } | |
| 40 | + @JsonProperty("subModule") | |
| 41 | + public void setSubModule(Boolean value) { this.subModule = value; } | |
| 42 | 42 | } |
Mschema-javascriptdefault / TopLevel.js+8 −8
| @@ -178,20 +178,20 @@ const typeMap = { | ||
| 178 | 178 | ], "any"), |
| 179 | 179 | "Fruit": o([ |
| 180 | 180 | { json: "apple", js: "apple", typ: u(undefined, true) }, |
| 181 | - { json: "berries", js: "berries", typ: u(undefined, a(r("Berry"))) }, | |
| 182 | 181 | { json: "orange", js: "orange", typ: u(undefined, true) }, |
| 182 | + { json: "berries", js: "berries", typ: u(undefined, a(r("Berry"))) }, | |
| 183 | 183 | ], "any"), |
| 184 | 184 | "Berry": o([ |
| 185 | - { json: "color", js: "color", typ: u(undefined, r("Color")) }, | |
| 186 | 185 | { json: "name", js: "name", typ: u(undefined, "") }, |
| 186 | + { json: "color", js: "color", typ: u(undefined, r("Color")) }, | |
| 187 | 187 | { json: "shapes", js: "shapes", typ: u(undefined, a(r("Shape"))) }, |
| 188 | 188 | ], "any"), |
| 189 | 189 | "Color": o([ |
| 190 | 190 | { json: "rgb", js: "rgb", typ: u(undefined, 3.14) }, |
| 191 | 191 | ], "any"), |
| 192 | 192 | "Shape": o([ |
| 193 | - { json: "geometry", js: "geometry", typ: u(undefined, r("Geometry")) }, | |
| 194 | 193 | { json: "history", js: "history", typ: u(undefined, r("History")) }, |
| 194 | + { json: "geometry", js: "geometry", typ: u(undefined, r("Geometry")) }, | |
| 195 | 195 | ], "any"), |
| 196 | 196 | "Geometry": o([ |
| 197 | 197 | { json: "rectShape", js: "rectShape", typ: u(undefined, r("RectShape")) }, |
| @@ -204,27 +204,27 @@ const typeMap = { | ||
| 204 | 204 | { json: "parts", js: "parts", typ: u(undefined, a(r("Part"))) }, |
| 205 | 205 | ], "any"), |
| 206 | 206 | "Part": o([ |
| 207 | - { json: "depth", js: "depth", typ: u(undefined, "") }, | |
| 208 | 207 | { json: "length", js: "length", typ: u(undefined, "") }, |
| 209 | 208 | { json: "width", js: "width", typ: u(undefined, "") }, |
| 209 | + { json: "depth", js: "depth", typ: u(undefined, "") }, | |
| 210 | 210 | ], "any"), |
| 211 | 211 | "History": o([ |
| 212 | 212 | { json: "class", js: "class", typ: u(undefined, "") }, |
| 213 | 213 | ], "any"), |
| 214 | 214 | "Vehicle": o([ |
| 215 | - { json: "brand", js: "brand", typ: u(undefined, "") }, | |
| 216 | 215 | { json: "id", js: "id", typ: u(undefined, "") }, |
| 217 | - { json: "speed", js: "speed", typ: u(undefined, r("Speed")) }, | |
| 218 | - { json: "subModule", js: "subModule", typ: u(undefined, true) }, | |
| 219 | 216 | { json: "type", js: "type", typ: u(undefined, r("VehicleType")) }, |
| 217 | + { json: "speed", js: "speed", typ: u(undefined, r("Speed")) }, | |
| 220 | 218 | { json: "year", js: "year", typ: u(undefined, "") }, |
| 219 | + { json: "brand", js: "brand", typ: u(undefined, "") }, | |
| 220 | + { json: "subModule", js: "subModule", typ: u(undefined, true) }, | |
| 221 | 221 | ], "any"), |
| 222 | 222 | "Speed": o([ |
| 223 | 223 | { json: "velocity", js: "velocity", typ: u(undefined, r("Limit")) }, |
| 224 | 224 | ], "any"), |
| 225 | 225 | "Limit": o([ |
| 226 | - { json: "maximum", js: "maximum", typ: u(undefined, 3.14) }, | |
| 227 | 226 | { json: "minimum", js: "minimum", typ: u(undefined, 3.14) }, |
| 227 | + { json: "maximum", js: "maximum", typ: u(undefined, 3.14) }, | |
| 228 | 228 | ], "any"), |
| 229 | 229 | "VehicleType": o([ |
| 230 | 230 | { json: "name", js: "name", typ: u(undefined, r("Name")) }, |
Mschema-kotlin-jacksondefault / TopLevel.kt+13 −13
| @@ -45,13 +45,13 @@ data class TopLevel ( | ||
| 45 | 45 | |
| 46 | 46 | data class Fruit ( |
| 47 | 47 | val apple: Boolean? = null, |
| 48 | - val berries: List<Berry>? = null, | |
| 49 | - val orange: Boolean? = null | |
| 48 | + val orange: Boolean? = null, | |
| 49 | + val berries: List<Berry>? = null | |
| 50 | 50 | ) |
| 51 | 51 | |
| 52 | 52 | data class Berry ( |
| 53 | - val color: Color? = null, | |
| 54 | 53 | val name: String? = null, |
| 54 | + val color: Color? = null, | |
| 55 | 55 | val shapes: List<Shape>? = null |
| 56 | 56 | ) |
| 57 | 57 | |
| @@ -60,8 +60,8 @@ data class Color ( | ||
| 60 | 60 | ) |
| 61 | 61 | |
| 62 | 62 | data class Shape ( |
| 63 | - val geometry: Geometry? = null, | |
| 64 | - val history: History? = null | |
| 63 | + val history: History? = null, | |
| 64 | + val geometry: Geometry? = null | |
| 65 | 65 | ) |
| 66 | 66 | |
| 67 | 67 | data class Geometry ( |
| @@ -78,9 +78,9 @@ data class RectShape ( | ||
| 78 | 78 | ) |
| 79 | 79 | |
| 80 | 80 | data class Part ( |
| 81 | - val depth: String? = null, | |
| 82 | 81 | val length: String? = null, |
| 83 | - val width: String? = null | |
| 82 | + val width: String? = null, | |
| 83 | + val depth: String? = null | |
| 84 | 84 | ) |
| 85 | 85 | |
| 86 | 86 | data class History ( |
| @@ -89,12 +89,12 @@ data class History ( | ||
| 89 | 89 | ) |
| 90 | 90 | |
| 91 | 91 | data class Vehicle ( |
| 92 | - val brand: String? = null, | |
| 93 | 92 | val id: String? = null, |
| 94 | - val speed: Speed? = null, | |
| 95 | - val subModule: Boolean? = null, | |
| 96 | 93 | val type: VehicleType? = null, |
| 97 | - val year: String? = null | |
| 94 | + val speed: Speed? = null, | |
| 95 | + val year: String? = null, | |
| 96 | + val brand: String? = null, | |
| 97 | + val subModule: Boolean? = null | |
| 98 | 98 | ) |
| 99 | 99 | |
| 100 | 100 | data class Speed ( |
| @@ -102,8 +102,8 @@ data class Speed ( | ||
| 102 | 102 | ) |
| 103 | 103 | |
| 104 | 104 | data class Limit ( |
| 105 | - val maximum: Double? = null, | |
| 106 | - val minimum: Double? = null | |
| 105 | + val minimum: Double? = null, | |
| 106 | + val maximum: Double? = null | |
| 107 | 107 | ) |
| 108 | 108 | |
| 109 | 109 | data class VehicleType ( |
Mschema-kotlindefault / TopLevel.kt+13 −13
| @@ -32,13 +32,13 @@ data class TopLevel ( | ||
| 32 | 32 | |
| 33 | 33 | data class Fruit ( |
| 34 | 34 | val apple: Boolean? = null, |
| 35 | - val berries: List<Berry>? = null, | |
| 36 | - val orange: Boolean? = null | |
| 35 | + val orange: Boolean? = null, | |
| 36 | + val berries: List<Berry>? = null | |
| 37 | 37 | ) |
| 38 | 38 | |
| 39 | 39 | data class Berry ( |
| 40 | - val color: Color? = null, | |
| 41 | 40 | val name: String? = null, |
| 41 | + val color: Color? = null, | |
| 42 | 42 | val shapes: List<Shape>? = null |
| 43 | 43 | ) |
| 44 | 44 | |
| @@ -47,8 +47,8 @@ data class Color ( | ||
| 47 | 47 | ) |
| 48 | 48 | |
| 49 | 49 | data class Shape ( |
| 50 | - val geometry: Geometry? = null, | |
| 51 | - val history: History? = null | |
| 50 | + val history: History? = null, | |
| 51 | + val geometry: Geometry? = null | |
| 52 | 52 | ) |
| 53 | 53 | |
| 54 | 54 | data class Geometry ( |
| @@ -65,9 +65,9 @@ data class RectShape ( | ||
| 65 | 65 | ) |
| 66 | 66 | |
| 67 | 67 | data class Part ( |
| 68 | - val depth: String? = null, | |
| 69 | 68 | val length: String? = null, |
| 70 | - val width: String? = null | |
| 69 | + val width: String? = null, | |
| 70 | + val depth: String? = null | |
| 71 | 71 | ) |
| 72 | 72 | |
| 73 | 73 | data class History ( |
| @@ -76,12 +76,12 @@ data class History ( | ||
| 76 | 76 | ) |
| 77 | 77 | |
| 78 | 78 | data class Vehicle ( |
| 79 | - val brand: String? = null, | |
| 80 | 79 | val id: String? = null, |
| 81 | - val speed: Speed? = null, | |
| 82 | - val subModule: Boolean? = null, | |
| 83 | 80 | val type: VehicleType? = null, |
| 84 | - val year: String? = null | |
| 81 | + val speed: Speed? = null, | |
| 82 | + val year: String? = null, | |
| 83 | + val brand: String? = null, | |
| 84 | + val subModule: Boolean? = null | |
| 85 | 85 | ) |
| 86 | 86 | |
| 87 | 87 | data class Speed ( |
| @@ -89,8 +89,8 @@ data class Speed ( | ||
| 89 | 89 | ) |
| 90 | 90 | |
| 91 | 91 | data class Limit ( |
| 92 | - val maximum: Double? = null, | |
| 93 | - val minimum: Double? = null | |
| 92 | + val minimum: Double? = null, | |
| 93 | + val maximum: Double? = null | |
| 94 | 94 | ) |
| 95 | 95 | |
| 96 | 96 | data class VehicleType ( |
Mschema-kotlinxdefault / TopLevel.kt+13 −13
| @@ -20,14 +20,14 @@ data class TopLevel ( | ||
| 20 | 20 | @Serializable |
| 21 | 21 | data class Fruit ( |
| 22 | 22 | val apple: Boolean? = null, |
| 23 | - val berries: List<Berry>? = null, | |
| 24 | - val orange: Boolean? = null | |
| 23 | + val orange: Boolean? = null, | |
| 24 | + val berries: List<Berry>? = null | |
| 25 | 25 | ) |
| 26 | 26 | |
| 27 | 27 | @Serializable |
| 28 | 28 | data class Berry ( |
| 29 | - val color: Color? = null, | |
| 30 | 29 | val name: String? = null, |
| 30 | + val color: Color? = null, | |
| 31 | 31 | val shapes: List<Shape>? = null |
| 32 | 32 | ) |
| 33 | 33 | |
| @@ -38,8 +38,8 @@ data class Color ( | ||
| 38 | 38 | |
| 39 | 39 | @Serializable |
| 40 | 40 | data class Shape ( |
| 41 | - val geometry: Geometry? = null, | |
| 42 | - val history: History? = null | |
| 41 | + val history: History? = null, | |
| 42 | + val geometry: Geometry? = null | |
| 43 | 43 | ) |
| 44 | 44 | |
| 45 | 45 | @Serializable |
| @@ -60,9 +60,9 @@ data class RectShape ( | ||
| 60 | 60 | |
| 61 | 61 | @Serializable |
| 62 | 62 | data class Part ( |
| 63 | - val depth: String? = null, | |
| 64 | 63 | val length: String? = null, |
| 65 | - val width: String? = null | |
| 64 | + val width: String? = null, | |
| 65 | + val depth: String? = null | |
| 66 | 66 | ) |
| 67 | 67 | |
| 68 | 68 | @Serializable |
| @@ -73,12 +73,12 @@ data class History ( | ||
| 73 | 73 | |
| 74 | 74 | @Serializable |
| 75 | 75 | data class Vehicle ( |
| 76 | - val brand: String? = null, | |
| 77 | 76 | val id: String? = null, |
| 78 | - val speed: Speed? = null, | |
| 79 | - val subModule: Boolean? = null, | |
| 80 | 77 | val type: VehicleType? = null, |
| 81 | - val year: String? = null | |
| 78 | + val speed: Speed? = null, | |
| 79 | + val year: String? = null, | |
| 80 | + val brand: String? = null, | |
| 81 | + val subModule: Boolean? = null | |
| 82 | 82 | ) |
| 83 | 83 | |
| 84 | 84 | @Serializable |
| @@ -88,8 +88,8 @@ data class Speed ( | ||
| 88 | 88 | |
| 89 | 89 | @Serializable |
| 90 | 90 | data class Limit ( |
| 91 | - val maximum: Double? = null, | |
| 92 | - val minimum: Double? = null | |
| 91 | + val minimum: Double? = null, | |
| 92 | + val maximum: Double? = null | |
| 93 | 93 | ) |
| 94 | 94 | |
| 95 | 95 | @Serializable |
Mschema-phpdefault / TopLevel.php+368 −368
| @@ -265,18 +265,18 @@ class TopLevel { | ||
| 265 | 265 | |
| 266 | 266 | class Fruit { |
| 267 | 267 | private ?bool $apple; // json:apple Optional |
| 268 | - private ?array $berries; // json:berries Optional | |
| 269 | 268 | private ?bool $orange; // json:orange Optional |
| 269 | + private ?array $berries; // json:berries Optional | |
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | 272 | * @param bool|null $apple |
| 273 | - * @param array|null $berries | |
| 274 | 273 | * @param bool|null $orange |
| 274 | + * @param array|null $berries | |
| 275 | 275 | */ |
| 276 | - public function __construct(?bool $apple, ?array $berries, ?bool $orange) { | |
| 276 | + public function __construct(?bool $apple, ?bool $orange, ?array $berries) { | |
| 277 | 277 | $this->apple = $apple; |
| 278 | - $this->berries = $berries; | |
| 279 | 278 | $this->orange = $orange; |
| 279 | + $this->berries = $berries; | |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | /** |
| @@ -337,15 +337,13 @@ class Fruit { | ||
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
| 340 | - * @param ?array $value | |
| 340 | + * @param ?bool $value | |
| 341 | 341 | * @throws Exception |
| 342 | - * @return ?array | |
| 342 | + * @return ?bool | |
| 343 | 343 | */ |
| 344 | - public static function fromBerries(?array $value): ?array { | |
| 344 | + public static function fromOrange(?bool $value): ?bool { | |
| 345 | 345 | if (!is_null($value)) { |
| 346 | - return array_map(function ($value) { | |
| 347 | - return Berry::from($value); /*class*/ | |
| 348 | - }, $value); | |
| 346 | + return $value; /*bool*/ | |
| 349 | 347 | } else { |
| 350 | 348 | return null; |
| 351 | 349 | } |
| @@ -353,66 +351,58 @@ class Fruit { | ||
| 353 | 351 | |
| 354 | 352 | /** |
| 355 | 353 | * @throws Exception |
| 356 | - * @return ?array | |
| 354 | + * @return ?bool | |
| 357 | 355 | */ |
| 358 | - public function toBerries(): ?array { | |
| 359 | - if (Fruit::validateBerries($this->berries)) { | |
| 360 | - if (!is_null($this->berries)) { | |
| 361 | - return array_map(function ($value) { | |
| 362 | - return $value->to(); /*class*/ | |
| 363 | - }, $this->berries); | |
| 356 | + public function toOrange(): ?bool { | |
| 357 | + if (Fruit::validateOrange($this->orange)) { | |
| 358 | + if (!is_null($this->orange)) { | |
| 359 | + return $this->orange; /*bool*/ | |
| 364 | 360 | } else { |
| 365 | 361 | return null; |
| 366 | 362 | } |
| 367 | 363 | } |
| 368 | - throw new Exception('never get to this Fruit::berries'); | |
| 364 | + throw new Exception('never get to this Fruit::orange'); | |
| 369 | 365 | } |
| 370 | 366 | |
| 371 | 367 | /** |
| 372 | - * @param array|null | |
| 368 | + * @param bool|null | |
| 373 | 369 | * @return bool |
| 374 | 370 | * @throws Exception |
| 375 | 371 | */ |
| 376 | - public static function validateBerries(?array $value): bool { | |
| 372 | + public static function validateOrange(?bool $value): bool { | |
| 377 | 373 | if (!is_null($value)) { |
| 378 | - if (!is_array($value)) { | |
| 379 | - throw new Exception("Attribute Error:Fruit::berries"); | |
| 380 | - } | |
| 381 | - array_walk($value, function($value_v) { | |
| 382 | - $value_v->validate(); | |
| 383 | - }); | |
| 384 | 374 | } |
| 385 | 375 | return true; |
| 386 | 376 | } |
| 387 | 377 | |
| 388 | 378 | /** |
| 389 | 379 | * @throws Exception |
| 390 | - * @return ?array | |
| 380 | + * @return ?bool | |
| 391 | 381 | */ |
| 392 | - public function getBerries(): ?array { | |
| 393 | - if (Fruit::validateBerries($this->berries)) { | |
| 394 | - return $this->berries; | |
| 382 | + public function getOrange(): ?bool { | |
| 383 | + if (Fruit::validateOrange($this->orange)) { | |
| 384 | + return $this->orange; | |
| 395 | 385 | } |
| 396 | - throw new Exception('never get to getBerries Fruit::berries'); | |
| 386 | + throw new Exception('never get to getOrange Fruit::orange'); | |
| 397 | 387 | } |
| 398 | 388 | |
| 399 | 389 | /** |
| 400 | - * @return ?array | |
| 390 | + * @return ?bool | |
| 401 | 391 | */ |
| 402 | - public static function sampleBerries(): ?array { | |
| 403 | - return array( | |
| 404 | - Berry::sample() /*32:*/ | |
| 405 | - ); /* 32:berries*/ | |
| 392 | + public static function sampleOrange(): ?bool { | |
| 393 | + return true; /*32:orange*/ | |
| 406 | 394 | } |
| 407 | 395 | |
| 408 | 396 | /** |
| 409 | - * @param ?bool $value | |
| 397 | + * @param ?array $value | |
| 410 | 398 | * @throws Exception |
| 411 | - * @return ?bool | |
| 399 | + * @return ?array | |
| 412 | 400 | */ |
| 413 | - public static function fromOrange(?bool $value): ?bool { | |
| 401 | + public static function fromBerries(?array $value): ?array { | |
| 414 | 402 | if (!is_null($value)) { |
| 415 | - return $value; /*bool*/ | |
| 403 | + return array_map(function ($value) { | |
| 404 | + return Berry::from($value); /*class*/ | |
| 405 | + }, $value); | |
| 416 | 406 | } else { |
| 417 | 407 | return null; |
| 418 | 408 | } |
| @@ -420,46 +410,56 @@ class Fruit { | ||
| 420 | 410 | |
| 421 | 411 | /** |
| 422 | 412 | * @throws Exception |
| 423 | - * @return ?bool | |
| 413 | + * @return ?array | |
| 424 | 414 | */ |
| 425 | - public function toOrange(): ?bool { | |
| 426 | - if (Fruit::validateOrange($this->orange)) { | |
| 427 | - if (!is_null($this->orange)) { | |
| 428 | - return $this->orange; /*bool*/ | |
| 415 | + public function toBerries(): ?array { | |
| 416 | + if (Fruit::validateBerries($this->berries)) { | |
| 417 | + if (!is_null($this->berries)) { | |
| 418 | + return array_map(function ($value) { | |
| 419 | + return $value->to(); /*class*/ | |
| 420 | + }, $this->berries); | |
| 429 | 421 | } else { |
| 430 | 422 | return null; |
| 431 | 423 | } |
| 432 | 424 | } |
| 433 | - throw new Exception('never get to this Fruit::orange'); | |
| 425 | + throw new Exception('never get to this Fruit::berries'); | |
| 434 | 426 | } |
| 435 | 427 | |
| 436 | 428 | /** |
| 437 | - * @param bool|null | |
| 429 | + * @param array|null | |
| 438 | 430 | * @return bool |
| 439 | 431 | * @throws Exception |
| 440 | 432 | */ |
| 441 | - public static function validateOrange(?bool $value): bool { | |
| 433 | + public static function validateBerries(?array $value): bool { | |
| 442 | 434 | if (!is_null($value)) { |
| 435 | + if (!is_array($value)) { | |
| 436 | + throw new Exception("Attribute Error:Fruit::berries"); | |
| 437 | + } | |
| 438 | + array_walk($value, function($value_v) { | |
| 439 | + $value_v->validate(); | |
| 440 | + }); | |
| 443 | 441 | } |
| 444 | 442 | return true; |
| 445 | 443 | } |
| 446 | 444 | |
| 447 | 445 | /** |
| 448 | 446 | * @throws Exception |
| 449 | - * @return ?bool | |
| 447 | + * @return ?array | |
| 450 | 448 | */ |
| 451 | - public function getOrange(): ?bool { | |
| 452 | - if (Fruit::validateOrange($this->orange)) { | |
| 453 | - return $this->orange; | |
| 449 | + public function getBerries(): ?array { | |
| 450 | + if (Fruit::validateBerries($this->berries)) { | |
| 451 | + return $this->berries; | |
| 454 | 452 | } |
| 455 | - throw new Exception('never get to getOrange Fruit::orange'); | |
| 453 | + throw new Exception('never get to getBerries Fruit::berries'); | |
| 456 | 454 | } |
| 457 | 455 | |
| 458 | 456 | /** |
| 459 | - * @return ?bool | |
| 457 | + * @return ?array | |
| 460 | 458 | */ |
| 461 | - public static function sampleOrange(): ?bool { | |
| 462 | - return true; /*33:orange*/ | |
| 459 | + public static function sampleBerries(): ?array { | |
| 460 | + return array( | |
| 461 | + Berry::sample() /*33:*/ | |
| 462 | + ); /* 33:berries*/ | |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | /** |
| @@ -468,8 +468,8 @@ class Fruit { | ||
| 468 | 468 | */ |
| 469 | 469 | public function validate(): bool { |
| 470 | 470 | return Fruit::validateApple($this->apple) |
| 471 | - || Fruit::validateBerries($this->berries) | |
| 472 | - || Fruit::validateOrange($this->orange); | |
| 471 | + || Fruit::validateOrange($this->orange) | |
| 472 | + || Fruit::validateBerries($this->berries); | |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | /** |
| @@ -479,8 +479,8 @@ class Fruit { | ||
| 479 | 479 | public function to(): stdClass { |
| 480 | 480 | $out = new stdClass(); |
| 481 | 481 | $out->{'apple'} = $this->toApple(); |
| 482 | - $out->{'berries'} = $this->toBerries(); | |
| 483 | 482 | $out->{'orange'} = $this->toOrange(); |
| 483 | + $out->{'berries'} = $this->toBerries(); | |
| 484 | 484 | return $out; |
| 485 | 485 | } |
| 486 | 486 | |
| @@ -492,8 +492,8 @@ class Fruit { | ||
| 492 | 492 | public static function from(stdClass $obj): Fruit { |
| 493 | 493 | return new Fruit( |
| 494 | 494 | Fruit::fromApple($obj->{'apple'}) |
| 495 | - ,Fruit::fromBerries($obj->{'berries'}) | |
| 496 | 495 | ,Fruit::fromOrange($obj->{'orange'}) |
| 496 | + ,Fruit::fromBerries($obj->{'berries'}) | |
| 497 | 497 | ); |
| 498 | 498 | } |
| 499 | 499 | |
| @@ -503,8 +503,8 @@ class Fruit { | ||
| 503 | 503 | public static function sample(): Fruit { |
| 504 | 504 | return new Fruit( |
| 505 | 505 | Fruit::sampleApple() |
| 506 | - ,Fruit::sampleBerries() | |
| 507 | 506 | ,Fruit::sampleOrange() |
| 507 | + ,Fruit::sampleBerries() | |
| 508 | 508 | ); |
| 509 | 509 | } |
| 510 | 510 | } |
| @@ -512,29 +512,29 @@ class Fruit { | ||
| 512 | 512 | // This is an autogenerated file:Berry |
| 513 | 513 | |
| 514 | 514 | class Berry { |
| 515 | - private ?Color $color; // json:color Optional | |
| 516 | 515 | private ?string $name; // json:name Optional |
| 516 | + private ?Color $color; // json:color Optional | |
| 517 | 517 | private ?array $shapes; // json:shapes Optional |
| 518 | 518 | |
| 519 | 519 | /** |
| 520 | - * @param Color|null $color | |
| 521 | 520 | * @param string|null $name |
| 521 | + * @param Color|null $color | |
| 522 | 522 | * @param array|null $shapes |
| 523 | 523 | */ |
| 524 | - public function __construct(?Color $color, ?string $name, ?array $shapes) { | |
| 525 | - $this->color = $color; | |
| 524 | + public function __construct(?string $name, ?Color $color, ?array $shapes) { | |
| 526 | 525 | $this->name = $name; |
| 526 | + $this->color = $color; | |
| 527 | 527 | $this->shapes = $shapes; |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | /** |
| 531 | - * @param ?stdClass $value | |
| 531 | + * @param ?string $value | |
| 532 | 532 | * @throws Exception |
| 533 | - * @return ?Color | |
| 533 | + * @return ?string | |
| 534 | 534 | */ |
| 535 | - public static function fromColor(?stdClass $value): ?Color { | |
| 535 | + public static function fromName(?string $value): ?string { | |
| 536 | 536 | if (!is_null($value)) { |
| 537 | - return Color::from($value); /*class*/ | |
| 537 | + return $value; /*string*/ | |
| 538 | 538 | } else { |
| 539 | 539 | return null; |
| 540 | 540 | } |
| @@ -542,57 +542,56 @@ class Berry { | ||
| 542 | 542 | |
| 543 | 543 | /** |
| 544 | 544 | * @throws Exception |
| 545 | - * @return ?stdClass | |
| 545 | + * @return ?string | |
| 546 | 546 | */ |
| 547 | - public function toColor(): ?stdClass { | |
| 548 | - if (Berry::validateColor($this->color)) { | |
| 549 | - if (!is_null($this->color)) { | |
| 550 | - return $this->color->to(); /*class*/ | |
| 547 | + public function toName(): ?string { | |
| 548 | + if (Berry::validateName($this->name)) { | |
| 549 | + if (!is_null($this->name)) { | |
| 550 | + return $this->name; /*string*/ | |
| 551 | 551 | } else { |
| 552 | 552 | return null; |
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | - throw new Exception('never get to this Berry::color'); | |
| 555 | + throw new Exception('never get to this Berry::name'); | |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | /** |
| 559 | - * @param Color|null | |
| 559 | + * @param string|null | |
| 560 | 560 | * @return bool |
| 561 | 561 | * @throws Exception |
| 562 | 562 | */ |
| 563 | - public static function validateColor(?Color $value): bool { | |
| 563 | + public static function validateName(?string $value): bool { | |
| 564 | 564 | if (!is_null($value)) { |
| 565 | - $value->validate(); | |
| 566 | 565 | } |
| 567 | 566 | return true; |
| 568 | 567 | } |
| 569 | 568 | |
| 570 | 569 | /** |
| 571 | 570 | * @throws Exception |
| 572 | - * @return ?Color | |
| 571 | + * @return ?string | |
| 573 | 572 | */ |
| 574 | - public function getColor(): ?Color { | |
| 575 | - if (Berry::validateColor($this->color)) { | |
| 576 | - return $this->color; | |
| 573 | + public function getName(): ?string { | |
| 574 | + if (Berry::validateName($this->name)) { | |
| 575 | + return $this->name; | |
| 577 | 576 | } |
| 578 | - throw new Exception('never get to getColor Berry::color'); | |
| 577 | + throw new Exception('never get to getName Berry::name'); | |
| 579 | 578 | } |
| 580 | 579 | |
| 581 | 580 | /** |
| 582 | - * @return ?Color | |
| 581 | + * @return ?string | |
| 583 | 582 | */ |
| 584 | - public static function sampleColor(): ?Color { | |
| 585 | - return Color::sample(); /*31:color*/ | |
| 583 | + public static function sampleName(): ?string { | |
| 584 | + return 'Berry::name::31'; /*31:name*/ | |
| 586 | 585 | } |
| 587 | 586 | |
| 588 | 587 | /** |
| 589 | - * @param ?string $value | |
| 588 | + * @param ?stdClass $value | |
| 590 | 589 | * @throws Exception |
| 591 | - * @return ?string | |
| 590 | + * @return ?Color | |
| 592 | 591 | */ |
| 593 | - public static function fromName(?string $value): ?string { | |
| 592 | + public static function fromColor(?stdClass $value): ?Color { | |
| 594 | 593 | if (!is_null($value)) { |
| 595 | - return $value; /*string*/ | |
| 594 | + return Color::from($value); /*class*/ | |
| 596 | 595 | } else { |
| 597 | 596 | return null; |
| 598 | 597 | } |
| @@ -600,46 +599,47 @@ class Berry { | ||
| 600 | 599 | |
| 601 | 600 | /** |
| 602 | 601 | * @throws Exception |
| 603 | - * @return ?string | |
| 602 | + * @return ?stdClass | |
| 604 | 603 | */ |
| 605 | - public function toName(): ?string { | |
| 606 | - if (Berry::validateName($this->name)) { | |
| 607 | - if (!is_null($this->name)) { | |
| 608 | - return $this->name; /*string*/ | |
| 604 | + public function toColor(): ?stdClass { | |
| 605 | + if (Berry::validateColor($this->color)) { | |
| 606 | + if (!is_null($this->color)) { | |
| 607 | + return $this->color->to(); /*class*/ | |
| 609 | 608 | } else { |
| 610 | 609 | return null; |
| 611 | 610 | } |
| 612 | 611 | } |
| 613 | - throw new Exception('never get to this Berry::name'); | |
| 612 | + throw new Exception('never get to this Berry::color'); | |
| 614 | 613 | } |
| 615 | 614 | |
| 616 | 615 | /** |
| 617 | - * @param string|null | |
| 616 | + * @param Color|null | |
| 618 | 617 | * @return bool |
| 619 | 618 | * @throws Exception |
| 620 | 619 | */ |
| 621 | - public static function validateName(?string $value): bool { | |
| 620 | + public static function validateColor(?Color $value): bool { | |
| 622 | 621 | if (!is_null($value)) { |
| 622 | + $value->validate(); | |
| 623 | 623 | } |
| 624 | 624 | return true; |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | /** |
| 628 | 628 | * @throws Exception |
| 629 | - * @return ?string | |
| 629 | + * @return ?Color | |
| 630 | 630 | */ |
| 631 | - public function getName(): ?string { | |
| 632 | - if (Berry::validateName($this->name)) { | |
| 633 | - return $this->name; | |
| 631 | + public function getColor(): ?Color { | |
| 632 | + if (Berry::validateColor($this->color)) { | |
| 633 | + return $this->color; | |
| 634 | 634 | } |
| 635 | - throw new Exception('never get to getName Berry::name'); | |
| 635 | + throw new Exception('never get to getColor Berry::color'); | |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | /** |
| 639 | - * @return ?string | |
| 639 | + * @return ?Color | |
| 640 | 640 | */ |
| 641 | - public static function sampleName(): ?string { | |
| 642 | - return 'Berry::name::32'; /*32:name*/ | |
| 641 | + public static function sampleColor(): ?Color { | |
| 642 | + return Color::sample(); /*32:color*/ | |
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | /** |
| @@ -716,8 +716,8 @@ class Berry { | ||
| 716 | 716 | * @return bool |
| 717 | 717 | */ |
| 718 | 718 | public function validate(): bool { |
| 719 | - return Berry::validateColor($this->color) | |
| 720 | - || Berry::validateName($this->name) | |
| 719 | + return Berry::validateName($this->name) | |
| 720 | + || Berry::validateColor($this->color) | |
| 721 | 721 | || Berry::validateShapes($this->shapes); |
| 722 | 722 | } |
| 723 | 723 | |
| @@ -727,8 +727,8 @@ class Berry { | ||
| 727 | 727 | */ |
| 728 | 728 | public function to(): stdClass { |
| 729 | 729 | $out = new stdClass(); |
| 730 | - $out->{'color'} = $this->toColor(); | |
| 731 | 730 | $out->{'name'} = $this->toName(); |
| 731 | + $out->{'color'} = $this->toColor(); | |
| 732 | 732 | $out->{'shapes'} = $this->toShapes(); |
| 733 | 733 | return $out; |
| 734 | 734 | } |
| @@ -740,8 +740,8 @@ class Berry { | ||
| 740 | 740 | */ |
| 741 | 741 | public static function from(stdClass $obj): Berry { |
| 742 | 742 | return new Berry( |
| 743 | - Berry::fromColor($obj->{'color'}) | |
| 744 | - ,Berry::fromName($obj->{'name'}) | |
| 743 | + Berry::fromName($obj->{'name'}) | |
| 744 | + ,Berry::fromColor($obj->{'color'}) | |
| 745 | 745 | ,Berry::fromShapes($obj->{'shapes'}) |
| 746 | 746 | ); |
| 747 | 747 | } |
| @@ -751,8 +751,8 @@ class Berry { | ||
| 751 | 751 | */ |
| 752 | 752 | public static function sample(): Berry { |
| 753 | 753 | return new Berry( |
| 754 | - Berry::sampleColor() | |
| 755 | - ,Berry::sampleName() | |
| 754 | + Berry::sampleName() | |
| 755 | + ,Berry::sampleColor() | |
| 756 | 756 | ,Berry::sampleShapes() |
| 757 | 757 | ); |
| 758 | 758 | } |
| @@ -869,26 +869,26 @@ class Color { | ||
| 869 | 869 | // This is an autogenerated file:Shape |
| 870 | 870 | |
| 871 | 871 | class Shape { |
| 872 | - private ?Geometry $geometry; // json:geometry Optional | |
| 873 | 872 | private ?History $history; // json:history Optional |
| 873 | + private ?Geometry $geometry; // json:geometry Optional | |
| 874 | 874 | |
| 875 | 875 | /** |
| 876 | - * @param Geometry|null $geometry | |
| 877 | 876 | * @param History|null $history |
| 877 | + * @param Geometry|null $geometry | |
| 878 | 878 | */ |
| 879 | - public function __construct(?Geometry $geometry, ?History $history) { | |
| 880 | - $this->geometry = $geometry; | |
| 879 | + public function __construct(?History $history, ?Geometry $geometry) { | |
| 881 | 880 | $this->history = $history; |
| 881 | + $this->geometry = $geometry; | |
| 882 | 882 | } |
| 883 | 883 | |
| 884 | 884 | /** |
| 885 | 885 | * @param ?stdClass $value |
| 886 | 886 | * @throws Exception |
| 887 | - * @return ?Geometry | |
| 887 | + * @return ?History | |
| 888 | 888 | */ |
| 889 | - public static function fromGeometry(?stdClass $value): ?Geometry { | |
| 889 | + public static function fromHistory(?stdClass $value): ?History { | |
| 890 | 890 | if (!is_null($value)) { |
| 891 | - return Geometry::from($value); /*class*/ | |
| 891 | + return History::from($value); /*class*/ | |
| 892 | 892 | } else { |
| 893 | 893 | return null; |
| 894 | 894 | } |
| @@ -898,23 +898,23 @@ class Shape { | ||
| 898 | 898 | * @throws Exception |
| 899 | 899 | * @return ?stdClass |
| 900 | 900 | */ |
| 901 | - public function toGeometry(): ?stdClass { | |
| 902 | - if (Shape::validateGeometry($this->geometry)) { | |
| 903 | - if (!is_null($this->geometry)) { | |
| 904 | - return $this->geometry->to(); /*class*/ | |
| 901 | + public function toHistory(): ?stdClass { | |
| 902 | + if (Shape::validateHistory($this->history)) { | |
| 903 | + if (!is_null($this->history)) { | |
| 904 | + return $this->history->to(); /*class*/ | |
| 905 | 905 | } else { |
| 906 | 906 | return null; |
| 907 | 907 | } |
| 908 | 908 | } |
| 909 | - throw new Exception('never get to this Shape::geometry'); | |
| 909 | + throw new Exception('never get to this Shape::history'); | |
| 910 | 910 | } |
| 911 | 911 | |
| 912 | 912 | /** |
| 913 | - * @param Geometry|null | |
| 913 | + * @param History|null | |
| 914 | 914 | * @return bool |
| 915 | 915 | * @throws Exception |
| 916 | 916 | */ |
| 917 | - public static function validateGeometry(?Geometry $value): bool { | |
| 917 | + public static function validateHistory(?History $value): bool { | |
| 918 | 918 | if (!is_null($value)) { |
| 919 | 919 | $value->validate(); |
| 920 | 920 | } |
| @@ -923,30 +923,30 @@ class Shape { | ||
| 923 | 923 | |
| 924 | 924 | /** |
| 925 | 925 | * @throws Exception |
| 926 | - * @return ?Geometry | |
| 926 | + * @return ?History | |
| 927 | 927 | */ |
| 928 | - public function getGeometry(): ?Geometry { | |
| 929 | - if (Shape::validateGeometry($this->geometry)) { | |
| 930 | - return $this->geometry; | |
| 928 | + public function getHistory(): ?History { | |
| 929 | + if (Shape::validateHistory($this->history)) { | |
| 930 | + return $this->history; | |
| 931 | 931 | } |
| 932 | - throw new Exception('never get to getGeometry Shape::geometry'); | |
| 932 | + throw new Exception('never get to getHistory Shape::history'); | |
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | /** |
| 936 | - * @return ?Geometry | |
| 936 | + * @return ?History | |
| 937 | 937 | */ |
| 938 | - public static function sampleGeometry(): ?Geometry { | |
| 939 | - return Geometry::sample(); /*31:geometry*/ | |
| 938 | + public static function sampleHistory(): ?History { | |
| 939 | + return History::sample(); /*31:history*/ | |
| 940 | 940 | } |
| 941 | 941 | |
| 942 | 942 | /** |
| 943 | 943 | * @param ?stdClass $value |
| 944 | 944 | * @throws Exception |
| 945 | - * @return ?History | |
| 945 | + * @return ?Geometry | |
| 946 | 946 | */ |
| 947 | - public static function fromHistory(?stdClass $value): ?History { | |
| 947 | + public static function fromGeometry(?stdClass $value): ?Geometry { | |
| 948 | 948 | if (!is_null($value)) { |
| 949 | - return History::from($value); /*class*/ | |
| 949 | + return Geometry::from($value); /*class*/ | |
| 950 | 950 | } else { |
| 951 | 951 | return null; |
| 952 | 952 | } |
| @@ -956,23 +956,23 @@ class Shape { | ||
| 956 | 956 | * @throws Exception |
| 957 | 957 | * @return ?stdClass |
| 958 | 958 | */ |
| 959 | - public function toHistory(): ?stdClass { | |
| 960 | - if (Shape::validateHistory($this->history)) { | |
| 961 | - if (!is_null($this->history)) { | |
| 962 | - return $this->history->to(); /*class*/ | |
| 959 | + public function toGeometry(): ?stdClass { | |
| 960 | + if (Shape::validateGeometry($this->geometry)) { | |
| 961 | + if (!is_null($this->geometry)) { | |
| 962 | + return $this->geometry->to(); /*class*/ | |
| 963 | 963 | } else { |
| 964 | 964 | return null; |
| 965 | 965 | } |
| 966 | 966 | } |
| 967 | - throw new Exception('never get to this Shape::history'); | |
| 967 | + throw new Exception('never get to this Shape::geometry'); | |
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | /** |
| 971 | - * @param History|null | |
| 971 | + * @param Geometry|null | |
| 972 | 972 | * @return bool |
| 973 | 973 | * @throws Exception |
| 974 | 974 | */ |
| 975 | - public static function validateHistory(?History $value): bool { | |
| 975 | + public static function validateGeometry(?Geometry $value): bool { | |
| 976 | 976 | if (!is_null($value)) { |
| 977 | 977 | $value->validate(); |
| 978 | 978 | } |
| @@ -981,20 +981,20 @@ class Shape { | ||
| 981 | 981 | |
| 982 | 982 | /** |
| 983 | 983 | * @throws Exception |
| 984 | - * @return ?History | |
| 984 | + * @return ?Geometry | |
| 985 | 985 | */ |
| 986 | - public function getHistory(): ?History { | |
| 987 | - if (Shape::validateHistory($this->history)) { | |
| 988 | - return $this->history; | |
| 986 | + public function getGeometry(): ?Geometry { | |
| 987 | + if (Shape::validateGeometry($this->geometry)) { | |
| 988 | + return $this->geometry; | |
| 989 | 989 | } |
| 990 | - throw new Exception('never get to getHistory Shape::history'); | |
| 990 | + throw new Exception('never get to getGeometry Shape::geometry'); | |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | 993 | /** |
| 994 | - * @return ?History | |
| 994 | + * @return ?Geometry | |
| 995 | 995 | */ |
| 996 | - public static function sampleHistory(): ?History { | |
| 997 | - return History::sample(); /*32:history*/ | |
| 996 | + public static function sampleGeometry(): ?Geometry { | |
| 997 | + return Geometry::sample(); /*32:geometry*/ | |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | /** |
| @@ -1002,8 +1002,8 @@ class Shape { | ||
| 1002 | 1002 | * @return bool |
| 1003 | 1003 | */ |
| 1004 | 1004 | public function validate(): bool { |
| 1005 | - return Shape::validateGeometry($this->geometry) | |
| 1006 | - || Shape::validateHistory($this->history); | |
| 1005 | + return Shape::validateHistory($this->history) | |
| 1006 | + || Shape::validateGeometry($this->geometry); | |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | 1009 | /** |
| @@ -1012,8 +1012,8 @@ class Shape { | ||
| 1012 | 1012 | */ |
| 1013 | 1013 | public function to(): stdClass { |
| 1014 | 1014 | $out = new stdClass(); |
| 1015 | - $out->{'geometry'} = $this->toGeometry(); | |
| 1016 | 1015 | $out->{'history'} = $this->toHistory(); |
| 1016 | + $out->{'geometry'} = $this->toGeometry(); | |
| 1017 | 1017 | return $out; |
| 1018 | 1018 | } |
| 1019 | 1019 | |
| @@ -1024,8 +1024,8 @@ class Shape { | ||
| 1024 | 1024 | */ |
| 1025 | 1025 | public static function from(stdClass $obj): Shape { |
| 1026 | 1026 | return new Shape( |
| 1027 | - Shape::fromGeometry($obj->{'geometry'}) | |
| 1028 | - ,Shape::fromHistory($obj->{'history'}) | |
| 1027 | + Shape::fromHistory($obj->{'history'}) | |
| 1028 | + ,Shape::fromGeometry($obj->{'geometry'}) | |
| 1029 | 1029 | ); |
| 1030 | 1030 | } |
| 1031 | 1031 | |
| @@ -1034,8 +1034,8 @@ class Shape { | ||
| 1034 | 1034 | */ |
| 1035 | 1035 | public static function sample(): Shape { |
| 1036 | 1036 | return new Shape( |
| 1037 | - Shape::sampleGeometry() | |
| 1038 | - ,Shape::sampleHistory() | |
| 1037 | + Shape::sampleHistory() | |
| 1038 | + ,Shape::sampleGeometry() | |
| 1039 | 1039 | ); |
| 1040 | 1040 | } |
| 1041 | 1041 | } |
| @@ -1456,19 +1456,19 @@ class RectShape { | ||
| 1456 | 1456 | // This is an autogenerated file:Part |
| 1457 | 1457 | |
| 1458 | 1458 | class Part { |
| 1459 | - private ?string $depth; // json:depth Optional | |
| 1460 | 1459 | private ?string $length; // json:length Optional |
| 1461 | 1460 | private ?string $width; // json:width Optional |
| 1461 | + private ?string $depth; // json:depth Optional | |
| 1462 | 1462 | |
| 1463 | 1463 | /** |
| 1464 | - * @param string|null $depth | |
| 1465 | 1464 | * @param string|null $length |
| 1466 | 1465 | * @param string|null $width |
| 1466 | + * @param string|null $depth | |
| 1467 | 1467 | */ |
| 1468 | - public function __construct(?string $depth, ?string $length, ?string $width) { | |
| 1469 | - $this->depth = $depth; | |
| 1468 | + public function __construct(?string $length, ?string $width, ?string $depth) { | |
| 1470 | 1469 | $this->length = $length; |
| 1471 | 1470 | $this->width = $width; |
| 1471 | + $this->depth = $depth; | |
| 1472 | 1472 | } |
| 1473 | 1473 | |
| 1474 | 1474 | /** |
| @@ -1476,7 +1476,7 @@ class Part { | ||
| 1476 | 1476 | * @throws Exception |
| 1477 | 1477 | * @return ?string |
| 1478 | 1478 | */ |
| 1479 | - public static function fromDepth(?string $value): ?string { | |
| 1479 | + public static function fromLength(?string $value): ?string { | |
| 1480 | 1480 | if (!is_null($value)) { |
| 1481 | 1481 | return $value; /*string*/ |
| 1482 | 1482 | } else { |
| @@ -1488,15 +1488,15 @@ class Part { | ||
| 1488 | 1488 | * @throws Exception |
| 1489 | 1489 | * @return ?string |
| 1490 | 1490 | */ |
| 1491 | - public function toDepth(): ?string { | |
| 1492 | - if (Part::validateDepth($this->depth)) { | |
| 1493 | - if (!is_null($this->depth)) { | |
| 1494 | - return $this->depth; /*string*/ | |
| 1491 | + public function toLength(): ?string { | |
| 1492 | + if (Part::validateLength($this->length)) { | |
| 1493 | + if (!is_null($this->length)) { | |
| 1494 | + return $this->length; /*string*/ | |
| 1495 | 1495 | } else { |
| 1496 | 1496 | return null; |
| 1497 | 1497 | } |
| 1498 | 1498 | } |
| 1499 | - throw new Exception('never get to this Part::depth'); | |
| 1499 | + throw new Exception('never get to this Part::length'); | |
| 1500 | 1500 | } |
| 1501 | 1501 | |
| 1502 | 1502 | /** |
| @@ -1504,7 +1504,7 @@ class Part { | ||
| 1504 | 1504 | * @return bool |
| 1505 | 1505 | * @throws Exception |
| 1506 | 1506 | */ |
| 1507 | - public static function validateDepth(?string $value): bool { | |
| 1507 | + public static function validateLength(?string $value): bool { | |
| 1508 | 1508 | if (!is_null($value)) { |
| 1509 | 1509 | } |
| 1510 | 1510 | return true; |
| @@ -1514,18 +1514,18 @@ class Part { | ||
| 1514 | 1514 | * @throws Exception |
| 1515 | 1515 | * @return ?string |
| 1516 | 1516 | */ |
| 1517 | - public function getDepth(): ?string { | |
| 1518 | - if (Part::validateDepth($this->depth)) { | |
| 1519 | - return $this->depth; | |
| 1517 | + public function getLength(): ?string { | |
| 1518 | + if (Part::validateLength($this->length)) { | |
| 1519 | + return $this->length; | |
| 1520 | 1520 | } |
| 1521 | - throw new Exception('never get to getDepth Part::depth'); | |
| 1521 | + throw new Exception('never get to getLength Part::length'); | |
| 1522 | 1522 | } |
| 1523 | 1523 | |
| 1524 | 1524 | /** |
| 1525 | 1525 | * @return ?string |
| 1526 | 1526 | */ |
| 1527 | - public static function sampleDepth(): ?string { | |
| 1528 | - return 'Part::depth::31'; /*31:depth*/ | |
| 1527 | + public static function sampleLength(): ?string { | |
| 1528 | + return 'Part::length::31'; /*31:length*/ | |
| 1529 | 1529 | } |
| 1530 | 1530 | |
| 1531 | 1531 | /** |
| @@ -1533,7 +1533,7 @@ class Part { | ||
| 1533 | 1533 | * @throws Exception |
| 1534 | 1534 | * @return ?string |
| 1535 | 1535 | */ |
| 1536 | - public static function fromLength(?string $value): ?string { | |
| 1536 | + public static function fromWidth(?string $value): ?string { | |
| 1537 | 1537 | if (!is_null($value)) { |
| 1538 | 1538 | return $value; /*string*/ |
| 1539 | 1539 | } else { |
| @@ -1545,15 +1545,15 @@ class Part { | ||
| 1545 | 1545 | * @throws Exception |
| 1546 | 1546 | * @return ?string |
| 1547 | 1547 | */ |
| 1548 | - public function toLength(): ?string { | |
| 1549 | - if (Part::validateLength($this->length)) { | |
| 1550 | - if (!is_null($this->length)) { | |
| 1551 | - return $this->length; /*string*/ | |
| 1548 | + public function toWidth(): ?string { | |
| 1549 | + if (Part::validateWidth($this->width)) { | |
| 1550 | + if (!is_null($this->width)) { | |
| 1551 | + return $this->width; /*string*/ | |
| 1552 | 1552 | } else { |
| 1553 | 1553 | return null; |
| 1554 | 1554 | } |
| 1555 | 1555 | } |
| 1556 | - throw new Exception('never get to this Part::length'); | |
| 1556 | + throw new Exception('never get to this Part::width'); | |
| 1557 | 1557 | } |
| 1558 | 1558 | |
| 1559 | 1559 | /** |
| @@ -1561,7 +1561,7 @@ class Part { | ||
| 1561 | 1561 | * @return bool |
| 1562 | 1562 | * @throws Exception |
| 1563 | 1563 | */ |
| 1564 | - public static function validateLength(?string $value): bool { | |
| 1564 | + public static function validateWidth(?string $value): bool { | |
| 1565 | 1565 | if (!is_null($value)) { |
| 1566 | 1566 | } |
| 1567 | 1567 | return true; |
| @@ -1571,18 +1571,18 @@ class Part { | ||
| 1571 | 1571 | * @throws Exception |
| 1572 | 1572 | * @return ?string |
| 1573 | 1573 | */ |
| 1574 | - public function getLength(): ?string { | |
| 1575 | - if (Part::validateLength($this->length)) { | |
| 1576 | - return $this->length; | |
| 1574 | + public function getWidth(): ?string { | |
| 1575 | + if (Part::validateWidth($this->width)) { | |
| 1576 | + return $this->width; | |
| 1577 | 1577 | } |
| 1578 | - throw new Exception('never get to getLength Part::length'); | |
| 1578 | + throw new Exception('never get to getWidth Part::width'); | |
| 1579 | 1579 | } |
| 1580 | 1580 | |
| 1581 | 1581 | /** |
| 1582 | 1582 | * @return ?string |
| 1583 | 1583 | */ |
| 1584 | - public static function sampleLength(): ?string { | |
| 1585 | - return 'Part::length::32'; /*32:length*/ | |
| 1584 | + public static function sampleWidth(): ?string { | |
| 1585 | + return 'Part::width::32'; /*32:width*/ | |
| 1586 | 1586 | } |
| 1587 | 1587 | |
| 1588 | 1588 | /** |
| @@ -1590,7 +1590,7 @@ class Part { | ||
| 1590 | 1590 | * @throws Exception |
| 1591 | 1591 | * @return ?string |
| 1592 | 1592 | */ |
| 1593 | - public static function fromWidth(?string $value): ?string { | |
| 1593 | + public static function fromDepth(?string $value): ?string { | |
| 1594 | 1594 | if (!is_null($value)) { |
| 1595 | 1595 | return $value; /*string*/ |
| 1596 | 1596 | } else { |
| @@ -1602,15 +1602,15 @@ class Part { | ||
| 1602 | 1602 | * @throws Exception |
| 1603 | 1603 | * @return ?string |
| 1604 | 1604 | */ |
| 1605 | - public function toWidth(): ?string { | |
| 1606 | - if (Part::validateWidth($this->width)) { | |
| 1607 | - if (!is_null($this->width)) { | |
| 1608 | - return $this->width; /*string*/ | |
| 1605 | + public function toDepth(): ?string { | |
| 1606 | + if (Part::validateDepth($this->depth)) { | |
| 1607 | + if (!is_null($this->depth)) { | |
| 1608 | + return $this->depth; /*string*/ | |
| 1609 | 1609 | } else { |
| 1610 | 1610 | return null; |
| 1611 | 1611 | } |
| 1612 | 1612 | } |
| 1613 | - throw new Exception('never get to this Part::width'); | |
| 1613 | + throw new Exception('never get to this Part::depth'); | |
| 1614 | 1614 | } |
| 1615 | 1615 | |
| 1616 | 1616 | /** |
| @@ -1618,7 +1618,7 @@ class Part { | ||
| 1618 | 1618 | * @return bool |
| 1619 | 1619 | * @throws Exception |
| 1620 | 1620 | */ |
| 1621 | - public static function validateWidth(?string $value): bool { | |
| 1621 | + public static function validateDepth(?string $value): bool { | |
| 1622 | 1622 | if (!is_null($value)) { |
| 1623 | 1623 | } |
| 1624 | 1624 | return true; |
| @@ -1628,18 +1628,18 @@ class Part { | ||
| 1628 | 1628 | * @throws Exception |
| 1629 | 1629 | * @return ?string |
| 1630 | 1630 | */ |
| 1631 | - public function getWidth(): ?string { | |
| 1632 | - if (Part::validateWidth($this->width)) { | |
| 1633 | - return $this->width; | |
| 1631 | + public function getDepth(): ?string { | |
| 1632 | + if (Part::validateDepth($this->depth)) { | |
| 1633 | + return $this->depth; | |
| 1634 | 1634 | } |
| 1635 | - throw new Exception('never get to getWidth Part::width'); | |
| 1635 | + throw new Exception('never get to getDepth Part::depth'); | |
| 1636 | 1636 | } |
| 1637 | 1637 | |
| 1638 | 1638 | /** |
| 1639 | 1639 | * @return ?string |
| 1640 | 1640 | */ |
| 1641 | - public static function sampleWidth(): ?string { | |
| 1642 | - return 'Part::width::33'; /*33:width*/ | |
| 1641 | + public static function sampleDepth(): ?string { | |
| 1642 | + return 'Part::depth::33'; /*33:depth*/ | |
| 1643 | 1643 | } |
| 1644 | 1644 | |
| 1645 | 1645 | /** |
| @@ -1647,9 +1647,9 @@ class Part { | ||
| 1647 | 1647 | * @return bool |
| 1648 | 1648 | */ |
| 1649 | 1649 | public function validate(): bool { |
| 1650 | - return Part::validateDepth($this->depth) | |
| 1651 | - || Part::validateLength($this->length) | |
| 1652 | - || Part::validateWidth($this->width); | |
| 1650 | + return Part::validateLength($this->length) | |
| 1651 | + || Part::validateWidth($this->width) | |
| 1652 | + || Part::validateDepth($this->depth); | |
| 1653 | 1653 | } |
| 1654 | 1654 | |
| 1655 | 1655 | /** |
| @@ -1658,9 +1658,9 @@ class Part { | ||
| 1658 | 1658 | */ |
| 1659 | 1659 | public function to(): stdClass { |
| 1660 | 1660 | $out = new stdClass(); |
| 1661 | - $out->{'depth'} = $this->toDepth(); | |
| 1662 | 1661 | $out->{'length'} = $this->toLength(); |
| 1663 | 1662 | $out->{'width'} = $this->toWidth(); |
| 1663 | + $out->{'depth'} = $this->toDepth(); | |
| 1664 | 1664 | return $out; |
| 1665 | 1665 | } |
| 1666 | 1666 | |
| @@ -1671,9 +1671,9 @@ class Part { | ||
| 1671 | 1671 | */ |
| 1672 | 1672 | public static function from(stdClass $obj): Part { |
| 1673 | 1673 | return new Part( |
| 1674 | - Part::fromDepth($obj->{'depth'}) | |
| 1675 | - ,Part::fromLength($obj->{'length'}) | |
| 1674 | + Part::fromLength($obj->{'length'}) | |
| 1676 | 1675 | ,Part::fromWidth($obj->{'width'}) |
| 1676 | + ,Part::fromDepth($obj->{'depth'}) | |
| 1677 | 1677 | ); |
| 1678 | 1678 | } |
| 1679 | 1679 | |
| @@ -1682,9 +1682,9 @@ class Part { | ||
| 1682 | 1682 | */ |
| 1683 | 1683 | public static function sample(): Part { |
| 1684 | 1684 | return new Part( |
| 1685 | - Part::sampleDepth() | |
| 1686 | - ,Part::sampleLength() | |
| 1685 | + Part::sampleLength() | |
| 1687 | 1686 | ,Part::sampleWidth() |
| 1687 | + ,Part::sampleDepth() | |
| 1688 | 1688 | ); |
| 1689 | 1689 | } |
| 1690 | 1690 | } |
| @@ -1800,28 +1800,28 @@ class History { | ||
| 1800 | 1800 | // This is an autogenerated file:Vehicle |
| 1801 | 1801 | |
| 1802 | 1802 | class Vehicle { |
| 1803 | - private ?string $brand; // json:brand Optional | |
| 1804 | 1803 | private ?string $id; // json:id Optional |
| 1805 | - private ?Speed $speed; // json:speed Optional | |
| 1806 | - private ?bool $subModule; // json:subModule Optional | |
| 1807 | 1804 | private ?VehicleType $type; // json:type Optional |
| 1805 | + private ?Speed $speed; // json:speed Optional | |
| 1808 | 1806 | private ?string $year; // json:year Optional |
| 1807 | + private ?string $brand; // json:brand Optional | |
| 1808 | + private ?bool $subModule; // json:subModule Optional | |
| 1809 | 1809 | |
| 1810 | 1810 | /** |
| 1811 | - * @param string|null $brand | |
| 1812 | 1811 | * @param string|null $id |
| 1813 | - * @param Speed|null $speed | |
| 1814 | - * @param bool|null $subModule | |
| 1815 | 1812 | * @param VehicleType|null $type |
| 1813 | + * @param Speed|null $speed | |
| 1816 | 1814 | * @param string|null $year |
| 1815 | + * @param string|null $brand | |
| 1816 | + * @param bool|null $subModule | |
| 1817 | 1817 | */ |
| 1818 | - public function __construct(?string $brand, ?string $id, ?Speed $speed, ?bool $subModule, ?VehicleType $type, ?string $year) { | |
| 1819 | - $this->brand = $brand; | |
| 1818 | + public function __construct(?string $id, ?VehicleType $type, ?Speed $speed, ?string $year, ?string $brand, ?bool $subModule) { | |
| 1820 | 1819 | $this->id = $id; |
| 1821 | - $this->speed = $speed; | |
| 1822 | - $this->subModule = $subModule; | |
| 1823 | 1820 | $this->type = $type; |
| 1821 | + $this->speed = $speed; | |
| 1824 | 1822 | $this->year = $year; |
| 1823 | + $this->brand = $brand; | |
| 1824 | + $this->subModule = $subModule; | |
| 1825 | 1825 | } |
| 1826 | 1826 | |
| 1827 | 1827 | /** |
| @@ -1829,7 +1829,7 @@ class Vehicle { | ||
| 1829 | 1829 | * @throws Exception |
| 1830 | 1830 | * @return ?string |
| 1831 | 1831 | */ |
| 1832 | - public static function fromBrand(?string $value): ?string { | |
| 1832 | + public static function fromID(?string $value): ?string { | |
| 1833 | 1833 | if (!is_null($value)) { |
| 1834 | 1834 | return $value; /*string*/ |
| 1835 | 1835 | } else { |
| @@ -1841,15 +1841,15 @@ class Vehicle { | ||
| 1841 | 1841 | * @throws Exception |
| 1842 | 1842 | * @return ?string |
| 1843 | 1843 | */ |
| 1844 | - public function toBrand(): ?string { | |
| 1845 | - if (Vehicle::validateBrand($this->brand)) { | |
| 1846 | - if (!is_null($this->brand)) { | |
| 1847 | - return $this->brand; /*string*/ | |
| 1844 | + public function toID(): ?string { | |
| 1845 | + if (Vehicle::validateID($this->id)) { | |
| 1846 | + if (!is_null($this->id)) { | |
| 1847 | + return $this->id; /*string*/ | |
| 1848 | 1848 | } else { |
| 1849 | 1849 | return null; |
| 1850 | 1850 | } |
| 1851 | 1851 | } |
| 1852 | - throw new Exception('never get to this Vehicle::brand'); | |
| 1852 | + throw new Exception('never get to this Vehicle::id'); | |
| 1853 | 1853 | } |
| 1854 | 1854 | |
| 1855 | 1855 | /** |
| @@ -1857,7 +1857,7 @@ class Vehicle { | ||
| 1857 | 1857 | * @return bool |
| 1858 | 1858 | * @throws Exception |
| 1859 | 1859 | */ |
| 1860 | - public static function validateBrand(?string $value): bool { | |
| 1860 | + public static function validateID(?string $value): bool { | |
| 1861 | 1861 | if (!is_null($value)) { |
| 1862 | 1862 | } |
| 1863 | 1863 | return true; |
| @@ -1867,28 +1867,28 @@ class Vehicle { | ||
| 1867 | 1867 | * @throws Exception |
| 1868 | 1868 | * @return ?string |
| 1869 | 1869 | */ |
| 1870 | - public function getBrand(): ?string { | |
| 1871 | - if (Vehicle::validateBrand($this->brand)) { | |
| 1872 | - return $this->brand; | |
| 1870 | + public function getID(): ?string { | |
| 1871 | + if (Vehicle::validateID($this->id)) { | |
| 1872 | + return $this->id; | |
| 1873 | 1873 | } |
| 1874 | - throw new Exception('never get to getBrand Vehicle::brand'); | |
| 1874 | + throw new Exception('never get to getID Vehicle::id'); | |
| 1875 | 1875 | } |
| 1876 | 1876 | |
| 1877 | 1877 | /** |
| 1878 | 1878 | * @return ?string |
| 1879 | 1879 | */ |
| 1880 | - public static function sampleBrand(): ?string { | |
| 1881 | - return 'Vehicle::brand::31'; /*31:brand*/ | |
| 1880 | + public static function sampleID(): ?string { | |
| 1881 | + return 'Vehicle::id::31'; /*31:id*/ | |
| 1882 | 1882 | } |
| 1883 | 1883 | |
| 1884 | 1884 | /** |
| 1885 | - * @param ?string $value | |
| 1885 | + * @param ?stdClass $value | |
| 1886 | 1886 | * @throws Exception |
| 1887 | - * @return ?string | |
| 1887 | + * @return ?VehicleType | |
| 1888 | 1888 | */ |
| 1889 | - public static function fromID(?string $value): ?string { | |
| 1889 | + public static function fromType(?stdClass $value): ?VehicleType { | |
| 1890 | 1890 | if (!is_null($value)) { |
| 1891 | - return $value; /*string*/ | |
| 1891 | + return VehicleType::from($value); /*class*/ | |
| 1892 | 1892 | } else { |
| 1893 | 1893 | return null; |
| 1894 | 1894 | } |
| @@ -1896,46 +1896,47 @@ class Vehicle { | ||
| 1896 | 1896 | |
| 1897 | 1897 | /** |
| 1898 | 1898 | * @throws Exception |
| 1899 | - * @return ?string | |
| 1899 | + * @return ?stdClass | |
| 1900 | 1900 | */ |
| 1901 | - public function toID(): ?string { | |
| 1902 | - if (Vehicle::validateID($this->id)) { | |
| 1903 | - if (!is_null($this->id)) { | |
| 1904 | - return $this->id; /*string*/ | |
| 1901 | + public function toType(): ?stdClass { | |
| 1902 | + if (Vehicle::validateType($this->type)) { | |
| 1903 | + if (!is_null($this->type)) { | |
| 1904 | + return $this->type->to(); /*class*/ | |
| 1905 | 1905 | } else { |
| 1906 | 1906 | return null; |
| 1907 | 1907 | } |
| 1908 | 1908 | } |
| 1909 | - throw new Exception('never get to this Vehicle::id'); | |
| 1909 | + throw new Exception('never get to this Vehicle::type'); | |
| 1910 | 1910 | } |
| 1911 | 1911 | |
| 1912 | 1912 | /** |
| 1913 | - * @param string|null | |
| 1913 | + * @param VehicleType|null | |
| 1914 | 1914 | * @return bool |
| 1915 | 1915 | * @throws Exception |
| 1916 | 1916 | */ |
| 1917 | - public static function validateID(?string $value): bool { | |
| 1917 | + public static function validateType(?VehicleType $value): bool { | |
| 1918 | 1918 | if (!is_null($value)) { |
| 1919 | + $value->validate(); | |
| 1919 | 1920 | } |
| 1920 | 1921 | return true; |
| 1921 | 1922 | } |
| 1922 | 1923 | |
| 1923 | 1924 | /** |
| 1924 | 1925 | * @throws Exception |
| 1925 | - * @return ?string | |
| 1926 | + * @return ?VehicleType | |
| 1926 | 1927 | */ |
| 1927 | - public function getID(): ?string { | |
| 1928 | - if (Vehicle::validateID($this->id)) { | |
| 1929 | - return $this->id; | |
| 1928 | + public function getType(): ?VehicleType { | |
| 1929 | + if (Vehicle::validateType($this->type)) { | |
| 1930 | + return $this->type; | |
| 1930 | 1931 | } |
| 1931 | - throw new Exception('never get to getID Vehicle::id'); | |
| 1932 | + throw new Exception('never get to getType Vehicle::type'); | |
| 1932 | 1933 | } |
| 1933 | 1934 | |
| 1934 | 1935 | /** |
| 1935 | - * @return ?string | |
| 1936 | + * @return ?VehicleType | |
| 1936 | 1937 | */ |
| 1937 | - public static function sampleID(): ?string { | |
| 1938 | - return 'Vehicle::id::32'; /*32:id*/ | |
| 1938 | + public static function sampleType(): ?VehicleType { | |
| 1939 | + return VehicleType::sample(); /*32:type*/ | |
| 1939 | 1940 | } |
| 1940 | 1941 | |
| 1941 | 1942 | /** |
| @@ -1997,13 +1998,13 @@ class Vehicle { | ||
| 1997 | 1998 | } |
| 1998 | 1999 | |
| 1999 | 2000 | /** |
| 2000 | - * @param ?bool $value | |
| 2001 | + * @param ?string $value | |
| 2001 | 2002 | * @throws Exception |
| 2002 | - * @return ?bool | |
| 2003 | + * @return ?string | |
| 2003 | 2004 | */ |
| 2004 | - public static function fromSubModule(?bool $value): ?bool { | |
| 2005 | + public static function fromYear(?string $value): ?string { | |
| 2005 | 2006 | if (!is_null($value)) { |
| 2006 | - return $value; /*bool*/ | |
| 2007 | + return $value; /*string*/ | |
| 2007 | 2008 | } else { |
| 2008 | 2009 | return null; |
| 2009 | 2010 | } |
| @@ -2011,25 +2012,25 @@ class Vehicle { | ||
| 2011 | 2012 | |
| 2012 | 2013 | /** |
| 2013 | 2014 | * @throws Exception |
| 2014 | - * @return ?bool | |
| 2015 | + * @return ?string | |
| 2015 | 2016 | */ |
| 2016 | - public function toSubModule(): ?bool { | |
| 2017 | - if (Vehicle::validateSubModule($this->subModule)) { | |
| 2018 | - if (!is_null($this->subModule)) { | |
| 2019 | - return $this->subModule; /*bool*/ | |
| 2017 | + public function toYear(): ?string { | |
| 2018 | + if (Vehicle::validateYear($this->year)) { | |
| 2019 | + if (!is_null($this->year)) { | |
| 2020 | + return $this->year; /*string*/ | |
| 2020 | 2021 | } else { |
| 2021 | 2022 | return null; |
| 2022 | 2023 | } |
| 2023 | 2024 | } |
| 2024 | - throw new Exception('never get to this Vehicle::subModule'); | |
| 2025 | + throw new Exception('never get to this Vehicle::year'); | |
| 2025 | 2026 | } |
| 2026 | 2027 | |
| 2027 | 2028 | /** |
| 2028 | - * @param bool|null | |
| 2029 | + * @param string|null | |
| 2029 | 2030 | * @return bool |
| 2030 | 2031 | * @throws Exception |
| 2031 | 2032 | */ |
| 2032 | - public static function validateSubModule(?bool $value): bool { | |
| 2033 | + public static function validateYear(?string $value): bool { | |
| 2033 | 2034 | if (!is_null($value)) { |
| 2034 | 2035 | } |
| 2035 | 2036 | return true; |
| @@ -2037,30 +2038,30 @@ class Vehicle { | ||
| 2037 | 2038 | |
| 2038 | 2039 | /** |
| 2039 | 2040 | * @throws Exception |
| 2040 | - * @return ?bool | |
| 2041 | + * @return ?string | |
| 2041 | 2042 | */ |
| 2042 | - public function getSubModule(): ?bool { | |
| 2043 | - if (Vehicle::validateSubModule($this->subModule)) { | |
| 2044 | - return $this->subModule; | |
| 2043 | + public function getYear(): ?string { | |
| 2044 | + if (Vehicle::validateYear($this->year)) { | |
| 2045 | + return $this->year; | |
| 2045 | 2046 | } |
| 2046 | - throw new Exception('never get to getSubModule Vehicle::subModule'); | |
| 2047 | + throw new Exception('never get to getYear Vehicle::year'); | |
| 2047 | 2048 | } |
| 2048 | 2049 | |
| 2049 | 2050 | /** |
| 2050 | - * @return ?bool | |
| 2051 | + * @return ?string | |
| 2051 | 2052 | */ |
| 2052 | - public static function sampleSubModule(): ?bool { | |
| 2053 | - return true; /*34:subModule*/ | |
| 2053 | + public static function sampleYear(): ?string { | |
| 2054 | + return 'Vehicle::year::34'; /*34:year*/ | |
| 2054 | 2055 | } |
| 2055 | 2056 | |
| 2056 | 2057 | /** |
| 2057 | - * @param ?stdClass $value | |
| 2058 | + * @param ?string $value | |
| 2058 | 2059 | * @throws Exception |
| 2059 | - * @return ?VehicleType | |
| 2060 | + * @return ?string | |
| 2060 | 2061 | */ |
| 2061 | - public static function fromType(?stdClass $value): ?VehicleType { | |
| 2062 | + public static function fromBrand(?string $value): ?string { | |
| 2062 | 2063 | if (!is_null($value)) { |
| 2063 | - return VehicleType::from($value); /*class*/ | |
| 2064 | + return $value; /*string*/ | |
| 2064 | 2065 | } else { |
| 2065 | 2066 | return null; |
| 2066 | 2067 | } |
| @@ -2068,57 +2069,56 @@ class Vehicle { | ||
| 2068 | 2069 | |
| 2069 | 2070 | /** |
| 2070 | 2071 | * @throws Exception |
| 2071 | - * @return ?stdClass | |
| 2072 | + * @return ?string | |
| 2072 | 2073 | */ |
| 2073 | - public function toType(): ?stdClass { | |
| 2074 | - if (Vehicle::validateType($this->type)) { | |
| 2075 | - if (!is_null($this->type)) { | |
| 2076 | - return $this->type->to(); /*class*/ | |
| 2074 | + public function toBrand(): ?string { | |
| 2075 | + if (Vehicle::validateBrand($this->brand)) { | |
| 2076 | + if (!is_null($this->brand)) { | |
| 2077 | + return $this->brand; /*string*/ | |
| 2077 | 2078 | } else { |
| 2078 | 2079 | return null; |
| 2079 | 2080 | } |
| 2080 | 2081 | } |
| 2081 | - throw new Exception('never get to this Vehicle::type'); | |
| 2082 | + throw new Exception('never get to this Vehicle::brand'); | |
| 2082 | 2083 | } |
| 2083 | 2084 | |
| 2084 | 2085 | /** |
| 2085 | - * @param VehicleType|null | |
| 2086 | + * @param string|null | |
| 2086 | 2087 | * @return bool |
| 2087 | 2088 | * @throws Exception |
| 2088 | 2089 | */ |
| 2089 | - public static function validateType(?VehicleType $value): bool { | |
| 2090 | + public static function validateBrand(?string $value): bool { | |
| 2090 | 2091 | if (!is_null($value)) { |
| 2091 | - $value->validate(); | |
| 2092 | 2092 | } |
| 2093 | 2093 | return true; |
| 2094 | 2094 | } |
| 2095 | 2095 | |
| 2096 | 2096 | /** |
| 2097 | 2097 | * @throws Exception |
| 2098 | - * @return ?VehicleType | |
| 2098 | + * @return ?string | |
| 2099 | 2099 | */ |
| 2100 | - public function getType(): ?VehicleType { | |
| 2101 | - if (Vehicle::validateType($this->type)) { | |
| 2102 | - return $this->type; | |
| 2100 | + public function getBrand(): ?string { | |
| 2101 | + if (Vehicle::validateBrand($this->brand)) { | |
| 2102 | + return $this->brand; | |
| 2103 | 2103 | } |
| 2104 | - throw new Exception('never get to getType Vehicle::type'); | |
| 2104 | + throw new Exception('never get to getBrand Vehicle::brand'); | |
| 2105 | 2105 | } |
| 2106 | 2106 | |
| 2107 | 2107 | /** |
| 2108 | - * @return ?VehicleType | |
| 2108 | + * @return ?string | |
| 2109 | 2109 | */ |
| 2110 | - public static function sampleType(): ?VehicleType { | |
| 2111 | - return VehicleType::sample(); /*35:type*/ | |
| 2110 | + public static function sampleBrand(): ?string { | |
| 2111 | + return 'Vehicle::brand::35'; /*35:brand*/ | |
| 2112 | 2112 | } |
| 2113 | 2113 | |
| 2114 | 2114 | /** |
| 2115 | - * @param ?string $value | |
| 2115 | + * @param ?bool $value | |
| 2116 | 2116 | * @throws Exception |
| 2117 | - * @return ?string | |
| 2117 | + * @return ?bool | |
| 2118 | 2118 | */ |
| 2119 | - public static function fromYear(?string $value): ?string { | |
| 2119 | + public static function fromSubModule(?bool $value): ?bool { | |
| 2120 | 2120 | if (!is_null($value)) { |
| 2121 | - return $value; /*string*/ | |
| 2121 | + return $value; /*bool*/ | |
| 2122 | 2122 | } else { |
| 2123 | 2123 | return null; |
| 2124 | 2124 | } |
| @@ -2126,25 +2126,25 @@ class Vehicle { | ||
| 2126 | 2126 | |
| 2127 | 2127 | /** |
| 2128 | 2128 | * @throws Exception |
| 2129 | - * @return ?string | |
| 2129 | + * @return ?bool | |
| 2130 | 2130 | */ |
| 2131 | - public function toYear(): ?string { | |
| 2132 | - if (Vehicle::validateYear($this->year)) { | |
| 2133 | - if (!is_null($this->year)) { | |
| 2134 | - return $this->year; /*string*/ | |
| 2131 | + public function toSubModule(): ?bool { | |
| 2132 | + if (Vehicle::validateSubModule($this->subModule)) { | |
| 2133 | + if (!is_null($this->subModule)) { | |
| 2134 | + return $this->subModule; /*bool*/ | |
| 2135 | 2135 | } else { |
| 2136 | 2136 | return null; |
| 2137 | 2137 | } |
| 2138 | 2138 | } |
| 2139 | - throw new Exception('never get to this Vehicle::year'); | |
| 2139 | + throw new Exception('never get to this Vehicle::subModule'); | |
| 2140 | 2140 | } |
| 2141 | 2141 | |
| 2142 | 2142 | /** |
| 2143 | - * @param string|null | |
| 2143 | + * @param bool|null | |
| 2144 | 2144 | * @return bool |
| 2145 | 2145 | * @throws Exception |
| 2146 | 2146 | */ |
| 2147 | - public static function validateYear(?string $value): bool { | |
| 2147 | + public static function validateSubModule(?bool $value): bool { | |
| 2148 | 2148 | if (!is_null($value)) { |
| 2149 | 2149 | } |
| 2150 | 2150 | return true; |
| @@ -2152,20 +2152,20 @@ class Vehicle { | ||
| 2152 | 2152 | |
| 2153 | 2153 | /** |
| 2154 | 2154 | * @throws Exception |
| 2155 | - * @return ?string | |
| 2155 | + * @return ?bool | |
| 2156 | 2156 | */ |
| 2157 | - public function getYear(): ?string { | |
| 2158 | - if (Vehicle::validateYear($this->year)) { | |
| 2159 | - return $this->year; | |
| 2157 | + public function getSubModule(): ?bool { | |
| 2158 | + if (Vehicle::validateSubModule($this->subModule)) { | |
| 2159 | + return $this->subModule; | |
| 2160 | 2160 | } |
| 2161 | - throw new Exception('never get to getYear Vehicle::year'); | |
| 2161 | + throw new Exception('never get to getSubModule Vehicle::subModule'); | |
| 2162 | 2162 | } |
| 2163 | 2163 | |
| 2164 | 2164 | /** |
| 2165 | - * @return ?string | |
| 2165 | + * @return ?bool | |
| 2166 | 2166 | */ |
| 2167 | - public static function sampleYear(): ?string { | |
| 2168 | - return 'Vehicle::year::36'; /*36:year*/ | |
| 2167 | + public static function sampleSubModule(): ?bool { | |
| 2168 | + return true; /*36:subModule*/ | |
| 2169 | 2169 | } |
| 2170 | 2170 | |
| 2171 | 2171 | /** |
| @@ -2173,12 +2173,12 @@ class Vehicle { | ||
| 2173 | 2173 | * @return bool |
| 2174 | 2174 | */ |
| 2175 | 2175 | public function validate(): bool { |
| 2176 | - return Vehicle::validateBrand($this->brand) | |
| 2177 | - || Vehicle::validateID($this->id) | |
| 2178 | - || Vehicle::validateSpeed($this->speed) | |
| 2179 | - || Vehicle::validateSubModule($this->subModule) | |
| 2176 | + return Vehicle::validateID($this->id) | |
| 2180 | 2177 | || Vehicle::validateType($this->type) |
| 2181 | - || Vehicle::validateYear($this->year); | |
| 2178 | + || Vehicle::validateSpeed($this->speed) | |
| 2179 | + || Vehicle::validateYear($this->year) | |
| 2180 | + || Vehicle::validateBrand($this->brand) | |
| 2181 | + || Vehicle::validateSubModule($this->subModule); | |
| 2182 | 2182 | } |
| 2183 | 2183 | |
| 2184 | 2184 | /** |
| @@ -2187,12 +2187,12 @@ class Vehicle { | ||
| 2187 | 2187 | */ |
| 2188 | 2188 | public function to(): stdClass { |
| 2189 | 2189 | $out = new stdClass(); |
| 2190 | - $out->{'brand'} = $this->toBrand(); | |
| 2191 | 2190 | $out->{'id'} = $this->toID(); |
| 2192 | - $out->{'speed'} = $this->toSpeed(); | |
| 2193 | - $out->{'subModule'} = $this->toSubModule(); | |
| 2194 | 2191 | $out->{'type'} = $this->toType(); |
| 2192 | + $out->{'speed'} = $this->toSpeed(); | |
| 2195 | 2193 | $out->{'year'} = $this->toYear(); |
| 2194 | + $out->{'brand'} = $this->toBrand(); | |
| 2195 | + $out->{'subModule'} = $this->toSubModule(); | |
| 2196 | 2196 | return $out; |
| 2197 | 2197 | } |
| 2198 | 2198 | |
| @@ -2203,12 +2203,12 @@ class Vehicle { | ||
| 2203 | 2203 | */ |
| 2204 | 2204 | public static function from(stdClass $obj): Vehicle { |
| 2205 | 2205 | return new Vehicle( |
| 2206 | - Vehicle::fromBrand($obj->{'brand'}) | |
| 2207 | - ,Vehicle::fromID($obj->{'id'}) | |
| 2208 | - ,Vehicle::fromSpeed($obj->{'speed'}) | |
| 2209 | - ,Vehicle::fromSubModule($obj->{'subModule'}) | |
| 2206 | + Vehicle::fromID($obj->{'id'}) | |
| 2210 | 2207 | ,Vehicle::fromType($obj->{'type'}) |
| 2208 | + ,Vehicle::fromSpeed($obj->{'speed'}) | |
| 2211 | 2209 | ,Vehicle::fromYear($obj->{'year'}) |
| 2210 | + ,Vehicle::fromBrand($obj->{'brand'}) | |
| 2211 | + ,Vehicle::fromSubModule($obj->{'subModule'}) | |
| 2212 | 2212 | ); |
| 2213 | 2213 | } |
| 2214 | 2214 | |
| @@ -2217,12 +2217,12 @@ class Vehicle { | ||
| 2217 | 2217 | */ |
| 2218 | 2218 | public static function sample(): Vehicle { |
| 2219 | 2219 | return new Vehicle( |
| 2220 | - Vehicle::sampleBrand() | |
| 2221 | - ,Vehicle::sampleID() | |
| 2222 | - ,Vehicle::sampleSpeed() | |
| 2223 | - ,Vehicle::sampleSubModule() | |
| 2220 | + Vehicle::sampleID() | |
| 2224 | 2221 | ,Vehicle::sampleType() |
| 2222 | + ,Vehicle::sampleSpeed() | |
| 2225 | 2223 | ,Vehicle::sampleYear() |
| 2224 | + ,Vehicle::sampleBrand() | |
| 2225 | + ,Vehicle::sampleSubModule() | |
| 2226 | 2226 | ); |
| 2227 | 2227 | } |
| 2228 | 2228 | } |
| @@ -2339,16 +2339,16 @@ class Speed { | ||
| 2339 | 2339 | // This is an autogenerated file:Limit |
| 2340 | 2340 | |
| 2341 | 2341 | class Limit { |
| 2342 | - private ?float $maximum; // json:maximum Optional | |
| 2343 | 2342 | private ?float $minimum; // json:minimum Optional |
| 2343 | + private ?float $maximum; // json:maximum Optional | |
| 2344 | 2344 | |
| 2345 | 2345 | /** |
| 2346 | - * @param float|null $maximum | |
| 2347 | 2346 | * @param float|null $minimum |
| 2347 | + * @param float|null $maximum | |
| 2348 | 2348 | */ |
| 2349 | - public function __construct(?float $maximum, ?float $minimum) { | |
| 2350 | - $this->maximum = $maximum; | |
| 2349 | + public function __construct(?float $minimum, ?float $maximum) { | |
| 2351 | 2350 | $this->minimum = $minimum; |
| 2351 | + $this->maximum = $maximum; | |
| 2352 | 2352 | } |
| 2353 | 2353 | |
| 2354 | 2354 | /** |
| @@ -2356,7 +2356,7 @@ class Limit { | ||
| 2356 | 2356 | * @throws Exception |
| 2357 | 2357 | * @return ?float |
| 2358 | 2358 | */ |
| 2359 | - public static function fromMaximum(?float $value): ?float { | |
| 2359 | + public static function fromMinimum(?float $value): ?float { | |
| 2360 | 2360 | if (!is_null($value)) { |
| 2361 | 2361 | return $value; /*float*/ |
| 2362 | 2362 | } else { |
| @@ -2368,15 +2368,15 @@ class Limit { | ||
| 2368 | 2368 | * @throws Exception |
| 2369 | 2369 | * @return ?float |
| 2370 | 2370 | */ |
| 2371 | - public function toMaximum(): ?float { | |
| 2372 | - if (Limit::validateMaximum($this->maximum)) { | |
| 2373 | - if (!is_null($this->maximum)) { | |
| 2374 | - return $this->maximum; /*float*/ | |
| 2371 | + public function toMinimum(): ?float { | |
| 2372 | + if (Limit::validateMinimum($this->minimum)) { | |
| 2373 | + if (!is_null($this->minimum)) { | |
| 2374 | + return $this->minimum; /*float*/ | |
| 2375 | 2375 | } else { |
| 2376 | 2376 | return null; |
| 2377 | 2377 | } |
| 2378 | 2378 | } |
| 2379 | - throw new Exception('never get to this Limit::maximum'); | |
| 2379 | + throw new Exception('never get to this Limit::minimum'); | |
| 2380 | 2380 | } |
| 2381 | 2381 | |
| 2382 | 2382 | /** |
| @@ -2384,7 +2384,7 @@ class Limit { | ||
| 2384 | 2384 | * @return bool |
| 2385 | 2385 | * @throws Exception |
| 2386 | 2386 | */ |
| 2387 | - public static function validateMaximum(?float $value): bool { | |
| 2387 | + public static function validateMinimum(?float $value): bool { | |
| 2388 | 2388 | if (!is_null($value)) { |
| 2389 | 2389 | } |
| 2390 | 2390 | return true; |
| @@ -2394,18 +2394,18 @@ class Limit { | ||
| 2394 | 2394 | * @throws Exception |
| 2395 | 2395 | * @return ?float |
| 2396 | 2396 | */ |
| 2397 | - public function getMaximum(): ?float { | |
| 2398 | - if (Limit::validateMaximum($this->maximum)) { | |
| 2399 | - return $this->maximum; | |
| 2397 | + public function getMinimum(): ?float { | |
| 2398 | + if (Limit::validateMinimum($this->minimum)) { | |
| 2399 | + return $this->minimum; | |
| 2400 | 2400 | } |
| 2401 | - throw new Exception('never get to getMaximum Limit::maximum'); | |
| 2401 | + throw new Exception('never get to getMinimum Limit::minimum'); | |
| 2402 | 2402 | } |
| 2403 | 2403 | |
| 2404 | 2404 | /** |
| 2405 | 2405 | * @return ?float |
| 2406 | 2406 | */ |
| 2407 | - public static function sampleMaximum(): ?float { | |
| 2408 | - return 31.031; /*31:maximum*/ | |
| 2407 | + public static function sampleMinimum(): ?float { | |
| 2408 | + return 31.031; /*31:minimum*/ | |
| 2409 | 2409 | } |
| 2410 | 2410 | |
| 2411 | 2411 | /** |
| @@ -2413,7 +2413,7 @@ class Limit { | ||
| 2413 | 2413 | * @throws Exception |
| 2414 | 2414 | * @return ?float |
| 2415 | 2415 | */ |
| 2416 | - public static function fromMinimum(?float $value): ?float { | |
| 2416 | + public static function fromMaximum(?float $value): ?float { | |
| 2417 | 2417 | if (!is_null($value)) { |
| 2418 | 2418 | return $value; /*float*/ |
| 2419 | 2419 | } else { |
| @@ -2425,15 +2425,15 @@ class Limit { | ||
| 2425 | 2425 | * @throws Exception |
| 2426 | 2426 | * @return ?float |
| 2427 | 2427 | */ |
| 2428 | - public function toMinimum(): ?float { | |
| 2429 | - if (Limit::validateMinimum($this->minimum)) { | |
| 2430 | - if (!is_null($this->minimum)) { | |
| 2431 | - return $this->minimum; /*float*/ | |
| 2428 | + public function toMaximum(): ?float { | |
| 2429 | + if (Limit::validateMaximum($this->maximum)) { | |
| 2430 | + if (!is_null($this->maximum)) { | |
| 2431 | + return $this->maximum; /*float*/ | |
| 2432 | 2432 | } else { |
| 2433 | 2433 | return null; |
| 2434 | 2434 | } |
| 2435 | 2435 | } |
| 2436 | - throw new Exception('never get to this Limit::minimum'); | |
| 2436 | + throw new Exception('never get to this Limit::maximum'); | |
| 2437 | 2437 | } |
| 2438 | 2438 | |
| 2439 | 2439 | /** |
| @@ -2441,7 +2441,7 @@ class Limit { | ||
| 2441 | 2441 | * @return bool |
| 2442 | 2442 | * @throws Exception |
| 2443 | 2443 | */ |
| 2444 | - public static function validateMinimum(?float $value): bool { | |
| 2444 | + public static function validateMaximum(?float $value): bool { | |
| 2445 | 2445 | if (!is_null($value)) { |
| 2446 | 2446 | } |
| 2447 | 2447 | return true; |
| @@ -2451,18 +2451,18 @@ class Limit { | ||
| 2451 | 2451 | * @throws Exception |
| 2452 | 2452 | * @return ?float |
| 2453 | 2453 | */ |
| 2454 | - public function getMinimum(): ?float { | |
| 2455 | - if (Limit::validateMinimum($this->minimum)) { | |
| 2456 | - return $this->minimum; | |
| 2454 | + public function getMaximum(): ?float { | |
| 2455 | + if (Limit::validateMaximum($this->maximum)) { | |
| 2456 | + return $this->maximum; | |
| 2457 | 2457 | } |
| 2458 | - throw new Exception('never get to getMinimum Limit::minimum'); | |
| 2458 | + throw new Exception('never get to getMaximum Limit::maximum'); | |
| 2459 | 2459 | } |
| 2460 | 2460 | |
| 2461 | 2461 | /** |
| 2462 | 2462 | * @return ?float |
| 2463 | 2463 | */ |
| 2464 | - public static function sampleMinimum(): ?float { | |
| 2465 | - return 32.032; /*32:minimum*/ | |
| 2464 | + public static function sampleMaximum(): ?float { | |
| 2465 | + return 32.032; /*32:maximum*/ | |
| 2466 | 2466 | } |
| 2467 | 2467 | |
| 2468 | 2468 | /** |
| @@ -2470,8 +2470,8 @@ class Limit { | ||
| 2470 | 2470 | * @return bool |
| 2471 | 2471 | */ |
| 2472 | 2472 | public function validate(): bool { |
| 2473 | - return Limit::validateMaximum($this->maximum) | |
| 2474 | - || Limit::validateMinimum($this->minimum); | |
| 2473 | + return Limit::validateMinimum($this->minimum) | |
| 2474 | + || Limit::validateMaximum($this->maximum); | |
| 2475 | 2475 | } |
| 2476 | 2476 | |
| 2477 | 2477 | /** |
| @@ -2480,8 +2480,8 @@ class Limit { | ||
| 2480 | 2480 | */ |
| 2481 | 2481 | public function to(): stdClass { |
| 2482 | 2482 | $out = new stdClass(); |
| 2483 | - $out->{'maximum'} = $this->toMaximum(); | |
| 2484 | 2483 | $out->{'minimum'} = $this->toMinimum(); |
| 2484 | + $out->{'maximum'} = $this->toMaximum(); | |
| 2485 | 2485 | return $out; |
| 2486 | 2486 | } |
| 2487 | 2487 | |
| @@ -2492,8 +2492,8 @@ class Limit { | ||
| 2492 | 2492 | */ |
| 2493 | 2493 | public static function from(stdClass $obj): Limit { |
| 2494 | 2494 | return new Limit( |
| 2495 | - Limit::fromMaximum($obj->{'maximum'}) | |
| 2496 | - ,Limit::fromMinimum($obj->{'minimum'}) | |
| 2495 | + Limit::fromMinimum($obj->{'minimum'}) | |
| 2496 | + ,Limit::fromMaximum($obj->{'maximum'}) | |
| 2497 | 2497 | ); |
| 2498 | 2498 | } |
| 2499 | 2499 | |
| @@ -2502,8 +2502,8 @@ class Limit { | ||
| 2502 | 2502 | */ |
| 2503 | 2503 | public static function sample(): Limit { |
| 2504 | 2504 | return new Limit( |
| 2505 | - Limit::sampleMaximum() | |
| 2506 | - ,Limit::sampleMinimum() | |
| 2505 | + Limit::sampleMinimum() | |
| 2506 | + ,Limit::sampleMaximum() | |
| 2507 | 2507 | ); |
| 2508 | 2508 | } |
| 2509 | 2509 | } |
Mschema-pikedefault / TopLevel.pmod+24 −24
| @@ -40,14 +40,14 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 40 | 40 | |
| 41 | 41 | class Fruit { |
| 42 | 42 | bool|mixed apple; // json: "apple" |
| 43 | - array(Berry)|mixed berries; // json: "berries" | |
| 44 | 43 | bool|mixed orange; // json: "orange" |
| 44 | + array(Berry)|mixed berries; // json: "berries" | |
| 45 | 45 | |
| 46 | 46 | string encode_json() { |
| 47 | 47 | mapping(string:mixed) json = ([ |
| 48 | 48 | "apple" : apple, |
| 49 | - "berries" : berries, | |
| 50 | 49 | "orange" : orange, |
| 50 | + "berries" : berries, | |
| 51 | 51 | ]); |
| 52 | 52 | |
| 53 | 53 | return Standards.JSON.encode(json); |
| @@ -58,21 +58,21 @@ Fruit Fruit_from_JSON(mixed json) { | ||
| 58 | 58 | Fruit retval = Fruit(); |
| 59 | 59 | |
| 60 | 60 | retval.apple = json["apple"]; |
| 61 | - retval.berries = json["berries"]; | |
| 62 | 61 | retval.orange = json["orange"]; |
| 62 | + retval.berries = json["berries"]; | |
| 63 | 63 | |
| 64 | 64 | return retval; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | class Berry { |
| 68 | - Color|mixed color; // json: "color" | |
| 69 | 68 | mixed|string name; // json: "name" |
| 69 | + Color|mixed color; // json: "color" | |
| 70 | 70 | array(Shape)|mixed shapes; // json: "shapes" |
| 71 | 71 | |
| 72 | 72 | string encode_json() { |
| 73 | 73 | mapping(string:mixed) json = ([ |
| 74 | - "color" : color, | |
| 75 | 74 | "name" : name, |
| 75 | + "color" : color, | |
| 76 | 76 | "shapes" : shapes, |
| 77 | 77 | ]); |
| 78 | 78 | |
| @@ -83,8 +83,8 @@ class Berry { | ||
| 83 | 83 | Berry Berry_from_JSON(mixed json) { |
| 84 | 84 | Berry retval = Berry(); |
| 85 | 85 | |
| 86 | - retval.color = json["color"]; | |
| 87 | 86 | retval.name = json["name"]; |
| 87 | + retval.color = json["color"]; | |
| 88 | 88 | retval.shapes = json["shapes"]; |
| 89 | 89 | |
| 90 | 90 | return retval; |
| @@ -111,13 +111,13 @@ Color Color_from_JSON(mixed json) { | ||
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | class Shape { |
| 114 | - Geometry|mixed geometry; // json: "geometry" | |
| 115 | 114 | History|mixed history; // json: "history" |
| 115 | + Geometry|mixed geometry; // json: "geometry" | |
| 116 | 116 | |
| 117 | 117 | string encode_json() { |
| 118 | 118 | mapping(string:mixed) json = ([ |
| 119 | - "geometry" : geometry, | |
| 120 | 119 | "history" : history, |
| 120 | + "geometry" : geometry, | |
| 121 | 121 | ]); |
| 122 | 122 | |
| 123 | 123 | return Standards.JSON.encode(json); |
| @@ -127,8 +127,8 @@ class Shape { | ||
| 127 | 127 | Shape Shape_from_JSON(mixed json) { |
| 128 | 128 | Shape retval = Shape(); |
| 129 | 129 | |
| 130 | - retval.geometry = json["geometry"]; | |
| 131 | 130 | retval.history = json["history"]; |
| 131 | + retval.geometry = json["geometry"]; | |
| 132 | 132 | |
| 133 | 133 | return retval; |
| 134 | 134 | } |
| @@ -197,15 +197,15 @@ RectShape RectShape_from_JSON(mixed json) { | ||
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | class Part { |
| 200 | - mixed|string depth; // json: "depth" | |
| 201 | 200 | mixed|string length; // json: "length" |
| 202 | 201 | mixed|string width; // json: "width" |
| 202 | + mixed|string depth; // json: "depth" | |
| 203 | 203 | |
| 204 | 204 | string encode_json() { |
| 205 | 205 | mapping(string:mixed) json = ([ |
| 206 | - "depth" : depth, | |
| 207 | 206 | "length" : length, |
| 208 | 207 | "width" : width, |
| 208 | + "depth" : depth, | |
| 209 | 209 | ]); |
| 210 | 210 | |
| 211 | 211 | return Standards.JSON.encode(json); |
| @@ -215,9 +215,9 @@ class Part { | ||
| 215 | 215 | Part Part_from_JSON(mixed json) { |
| 216 | 216 | Part retval = Part(); |
| 217 | 217 | |
| 218 | - retval.depth = json["depth"]; | |
| 219 | 218 | retval.length = json["length"]; |
| 220 | 219 | retval.width = json["width"]; |
| 220 | + retval.depth = json["depth"]; | |
| 221 | 221 | |
| 222 | 222 | return retval; |
| 223 | 223 | } |
| @@ -243,21 +243,21 @@ History History_from_JSON(mixed json) { | ||
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | class Vehicle { |
| 246 | - mixed|string brand; // json: "brand" | |
| 247 | 246 | mixed|string id; // json: "id" |
| 248 | - Speed|mixed speed; // json: "speed" | |
| 249 | - bool|mixed sub_module; // json: "subModule" | |
| 250 | 247 | VehicleType|mixed type; // json: "type" |
| 248 | + Speed|mixed speed; // json: "speed" | |
| 251 | 249 | mixed|string year; // json: "year" |
| 250 | + mixed|string brand; // json: "brand" | |
| 251 | + bool|mixed sub_module; // json: "subModule" | |
| 252 | 252 | |
| 253 | 253 | string encode_json() { |
| 254 | 254 | mapping(string:mixed) json = ([ |
| 255 | - "brand" : brand, | |
| 256 | 255 | "id" : id, |
| 257 | - "speed" : speed, | |
| 258 | - "subModule" : sub_module, | |
| 259 | 256 | "type" : type, |
| 257 | + "speed" : speed, | |
| 260 | 258 | "year" : year, |
| 259 | + "brand" : brand, | |
| 260 | + "subModule" : sub_module, | |
| 261 | 261 | ]); |
| 262 | 262 | |
| 263 | 263 | return Standards.JSON.encode(json); |
| @@ -267,12 +267,12 @@ class Vehicle { | ||
| 267 | 267 | Vehicle Vehicle_from_JSON(mixed json) { |
| 268 | 268 | Vehicle retval = Vehicle(); |
| 269 | 269 | |
| 270 | - retval.brand = json["brand"]; | |
| 271 | 270 | retval.id = json["id"]; |
| 272 | - retval.speed = json["speed"]; | |
| 273 | - retval.sub_module = json["subModule"]; | |
| 274 | 271 | retval.type = json["type"]; |
| 272 | + retval.speed = json["speed"]; | |
| 275 | 273 | retval.year = json["year"]; |
| 274 | + retval.brand = json["brand"]; | |
| 275 | + retval.sub_module = json["subModule"]; | |
| 276 | 276 | |
| 277 | 277 | return retval; |
| 278 | 278 | } |
| @@ -298,13 +298,13 @@ Speed Speed_from_JSON(mixed json) { | ||
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | class Limit { |
| 301 | - float|mixed maximum; // json: "maximum" | |
| 302 | 301 | float|mixed minimum; // json: "minimum" |
| 302 | + float|mixed maximum; // json: "maximum" | |
| 303 | 303 | |
| 304 | 304 | string encode_json() { |
| 305 | 305 | mapping(string:mixed) json = ([ |
| 306 | - "maximum" : maximum, | |
| 307 | 306 | "minimum" : minimum, |
| 307 | + "maximum" : maximum, | |
| 308 | 308 | ]); |
| 309 | 309 | |
| 310 | 310 | return Standards.JSON.encode(json); |
| @@ -314,8 +314,8 @@ class Limit { | ||
| 314 | 314 | Limit Limit_from_JSON(mixed json) { |
| 315 | 315 | Limit retval = Limit(); |
| 316 | 316 | |
| 317 | - retval.maximum = json["maximum"]; | |
| 318 | 317 | retval.minimum = json["minimum"]; |
| 318 | + retval.maximum = json["maximum"]; | |
| 319 | 319 | |
| 320 | 320 | return retval; |
| 321 | 321 | } |
Mschema-pythondefault / quicktype.py+38 −38
| @@ -92,26 +92,26 @@ class CircularShape: | ||
| 92 | 92 | |
| 93 | 93 | @dataclass |
| 94 | 94 | class Part: |
| 95 | - depth: str | None = None | |
| 96 | 95 | length: str | None = None |
| 97 | 96 | width: str | None = None |
| 97 | + depth: str | None = None | |
| 98 | 98 | |
| 99 | 99 | @staticmethod |
| 100 | 100 | def from_dict(obj: Any) -> 'Part': |
| 101 | 101 | assert isinstance(obj, dict) |
| 102 | - depth = from_union([from_str, from_none], obj.get("depth")) | |
| 103 | 102 | length = from_union([from_str, from_none], obj.get("length")) |
| 104 | 103 | width = from_union([from_str, from_none], obj.get("width")) |
| 105 | - return Part(depth, length, width) | |
| 104 | + depth = from_union([from_str, from_none], obj.get("depth")) | |
| 105 | + return Part(length, width, depth) | |
| 106 | 106 | |
| 107 | 107 | def to_dict(self) -> dict: |
| 108 | 108 | result: dict = {} |
| 109 | - if self.depth is not None: | |
| 110 | - result["depth"] = from_union([from_str, from_none], self.depth) | |
| 111 | 109 | if self.length is not None: |
| 112 | 110 | result["length"] = from_union([from_str, from_none], self.length) |
| 113 | 111 | if self.width is not None: |
| 114 | 112 | result["width"] = from_union([from_str, from_none], self.width) |
| 113 | + if self.depth is not None: | |
| 114 | + result["depth"] = from_union([from_str, from_none], self.depth) | |
| 115 | 115 | return result |
| 116 | 116 | |
| 117 | 117 | |
| @@ -172,45 +172,45 @@ class History: | ||
| 172 | 172 | |
| 173 | 173 | @dataclass |
| 174 | 174 | class Shape: |
| 175 | - geometry: Geometry | None = None | |
| 176 | 175 | history: History | None = None |
| 176 | + geometry: Geometry | None = None | |
| 177 | 177 | |
| 178 | 178 | @staticmethod |
| 179 | 179 | def from_dict(obj: Any) -> 'Shape': |
| 180 | 180 | assert isinstance(obj, dict) |
| 181 | - geometry = from_union([Geometry.from_dict, from_none], obj.get("geometry")) | |
| 182 | 181 | history = from_union([History.from_dict, from_none], obj.get("history")) |
| 183 | - return Shape(geometry, history) | |
| 182 | + geometry = from_union([Geometry.from_dict, from_none], obj.get("geometry")) | |
| 183 | + return Shape(history, geometry) | |
| 184 | 184 | |
| 185 | 185 | def to_dict(self) -> dict: |
| 186 | 186 | result: dict = {} |
| 187 | - if self.geometry is not None: | |
| 188 | - result["geometry"] = from_union([lambda x: to_class(Geometry, x), from_none], self.geometry) | |
| 189 | 187 | if self.history is not None: |
| 190 | 188 | result["history"] = from_union([lambda x: to_class(History, x), from_none], self.history) |
| 189 | + if self.geometry is not None: | |
| 190 | + result["geometry"] = from_union([lambda x: to_class(Geometry, x), from_none], self.geometry) | |
| 191 | 191 | return result |
| 192 | 192 | |
| 193 | 193 | |
| 194 | 194 | @dataclass |
| 195 | 195 | class Berry: |
| 196 | - color: Color | None = None | |
| 197 | 196 | name: str | None = None |
| 197 | + color: Color | None = None | |
| 198 | 198 | shapes: list[Shape] | None = None |
| 199 | 199 | |
| 200 | 200 | @staticmethod |
| 201 | 201 | def from_dict(obj: Any) -> 'Berry': |
| 202 | 202 | assert isinstance(obj, dict) |
| 203 | - color = from_union([Color.from_dict, from_none], obj.get("color")) | |
| 204 | 203 | name = from_union([from_str, from_none], obj.get("name")) |
| 204 | + color = from_union([Color.from_dict, from_none], obj.get("color")) | |
| 205 | 205 | shapes = from_union([lambda x: from_list(Shape.from_dict, x), from_none], obj.get("shapes")) |
| 206 | - return Berry(color, name, shapes) | |
| 206 | + return Berry(name, color, shapes) | |
| 207 | 207 | |
| 208 | 208 | def to_dict(self) -> dict: |
| 209 | 209 | result: dict = {} |
| 210 | - if self.color is not None: | |
| 211 | - result["color"] = from_union([lambda x: to_class(Color, x), from_none], self.color) | |
| 212 | 210 | if self.name is not None: |
| 213 | 211 | result["name"] = from_union([from_str, from_none], self.name) |
| 212 | + if self.color is not None: | |
| 213 | + result["color"] = from_union([lambda x: to_class(Color, x), from_none], self.color) | |
| 214 | 214 | if self.shapes is not None: |
| 215 | 215 | result["shapes"] = from_union([lambda x: from_list(lambda x: to_class(Shape, x), x), from_none], self.shapes) |
| 216 | 216 | return result |
| @@ -219,46 +219,46 @@ class Berry: | ||
| 219 | 219 | @dataclass |
| 220 | 220 | class Fruit: |
| 221 | 221 | apple: bool | None = None |
| 222 | - berries: list[Berry] | None = None | |
| 223 | 222 | orange: bool | None = None |
| 223 | + berries: list[Berry] | None = None | |
| 224 | 224 | |
| 225 | 225 | @staticmethod |
| 226 | 226 | def from_dict(obj: Any) -> 'Fruit': |
| 227 | 227 | assert isinstance(obj, dict) |
| 228 | 228 | apple = from_union([from_bool, from_none], obj.get("apple")) |
| 229 | - berries = from_union([lambda x: from_list(Berry.from_dict, x), from_none], obj.get("berries")) | |
| 230 | 229 | orange = from_union([from_bool, from_none], obj.get("orange")) |
| 231 | - return Fruit(apple, berries, orange) | |
| 230 | + berries = from_union([lambda x: from_list(Berry.from_dict, x), from_none], obj.get("berries")) | |
| 231 | + return Fruit(apple, orange, berries) | |
| 232 | 232 | |
| 233 | 233 | def to_dict(self) -> dict: |
| 234 | 234 | result: dict = {} |
| 235 | 235 | if self.apple is not None: |
| 236 | 236 | result["apple"] = from_union([from_bool, from_none], self.apple) |
| 237 | - if self.berries is not None: | |
| 238 | - result["berries"] = from_union([lambda x: from_list(lambda x: to_class(Berry, x), x), from_none], self.berries) | |
| 239 | 237 | if self.orange is not None: |
| 240 | 238 | result["orange"] = from_union([from_bool, from_none], self.orange) |
| 239 | + if self.berries is not None: | |
| 240 | + result["berries"] = from_union([lambda x: from_list(lambda x: to_class(Berry, x), x), from_none], self.berries) | |
| 241 | 241 | return result |
| 242 | 242 | |
| 243 | 243 | |
| 244 | 244 | @dataclass |
| 245 | 245 | class Limit: |
| 246 | - maximum: float | None = None | |
| 247 | 246 | minimum: float | None = None |
| 247 | + maximum: float | None = None | |
| 248 | 248 | |
| 249 | 249 | @staticmethod |
| 250 | 250 | def from_dict(obj: Any) -> 'Limit': |
| 251 | 251 | assert isinstance(obj, dict) |
| 252 | - maximum = from_union([from_float, from_none], obj.get("maximum")) | |
| 253 | 252 | minimum = from_union([from_float, from_none], obj.get("minimum")) |
| 254 | - return Limit(maximum, minimum) | |
| 253 | + maximum = from_union([from_float, from_none], obj.get("maximum")) | |
| 254 | + return Limit(minimum, maximum) | |
| 255 | 255 | |
| 256 | 256 | def to_dict(self) -> dict: |
| 257 | 257 | result: dict = {} |
| 258 | - if self.maximum is not None: | |
| 259 | - result["maximum"] = from_union([to_float, from_none], self.maximum) | |
| 260 | 258 | if self.minimum is not None: |
| 261 | 259 | result["minimum"] = from_union([to_float, from_none], self.minimum) |
| 260 | + if self.maximum is not None: | |
| 261 | + result["maximum"] = from_union([to_float, from_none], self.maximum) | |
| 262 | 262 | return result |
| 263 | 263 | |
| 264 | 264 | |
| @@ -327,38 +327,38 @@ class VehicleType: | ||
| 327 | 327 | |
| 328 | 328 | @dataclass |
| 329 | 329 | class Vehicle: |
| 330 | - brand: str | None = None | |
| 331 | 330 | id: str | None = None |
| 332 | - speed: Speed | None = None | |
| 333 | - sub_module: bool | None = None | |
| 334 | 331 | type: VehicleType | None = None |
| 332 | + speed: Speed | None = None | |
| 335 | 333 | year: str | None = None |
| 334 | + brand: str | None = None | |
| 335 | + sub_module: bool | None = None | |
| 336 | 336 | |
| 337 | 337 | @staticmethod |
| 338 | 338 | def from_dict(obj: Any) -> 'Vehicle': |
| 339 | 339 | assert isinstance(obj, dict) |
| 340 | - brand = from_union([from_str, from_none], obj.get("brand")) | |
| 341 | 340 | id = from_union([from_str, from_none], obj.get("id")) |
| 342 | - speed = from_union([Speed.from_dict, from_none], obj.get("speed")) | |
| 343 | - sub_module = from_union([from_bool, from_none], obj.get("subModule")) | |
| 344 | 341 | type = from_union([VehicleType.from_dict, from_none], obj.get("type")) |
| 342 | + speed = from_union([Speed.from_dict, from_none], obj.get("speed")) | |
| 345 | 343 | year = from_union([from_str, from_none], obj.get("year")) |
| 346 | - return Vehicle(brand, id, speed, sub_module, type, year) | |
| 344 | + brand = from_union([from_str, from_none], obj.get("brand")) | |
| 345 | + sub_module = from_union([from_bool, from_none], obj.get("subModule")) | |
| 346 | + return Vehicle(id, type, speed, year, brand, sub_module) | |
| 347 | 347 | |
| 348 | 348 | def to_dict(self) -> dict: |
| 349 | 349 | result: dict = {} |
| 350 | - if self.brand is not None: | |
| 351 | - result["brand"] = from_union([from_str, from_none], self.brand) | |
| 352 | 350 | if self.id is not None: |
| 353 | 351 | result["id"] = from_union([from_str, from_none], self.id) |
| 354 | - if self.speed is not None: | |
| 355 | - result["speed"] = from_union([lambda x: to_class(Speed, x), from_none], self.speed) | |
| 356 | - if self.sub_module is not None: | |
| 357 | - result["subModule"] = from_union([from_bool, from_none], self.sub_module) | |
| 358 | 352 | if self.type is not None: |
| 359 | 353 | result["type"] = from_union([lambda x: to_class(VehicleType, x), from_none], self.type) |
| 354 | + if self.speed is not None: | |
| 355 | + result["speed"] = from_union([lambda x: to_class(Speed, x), from_none], self.speed) | |
| 360 | 356 | if self.year is not None: |
| 361 | 357 | result["year"] = from_union([from_str, from_none], self.year) |
| 358 | + if self.brand is not None: | |
| 359 | + result["brand"] = from_union([from_str, from_none], self.brand) | |
| 360 | + if self.sub_module is not None: | |
| 361 | + result["subModule"] = from_union([from_bool, from_none], self.sub_module) | |
| 362 | 362 | return result |
Mschema-rubydefault / TopLevel.rb+25 −25
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.vehicles&.first.vehicle_type&.vehicle_type_name == Name::Truck | |
| 7 | +# puts top_level.vehicles&.first.speed&.velocity&.minimum | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -74,16 +74,16 @@ class CircularShape < Dry::Struct | ||
| 74 | 74 | end |
| 75 | 75 | |
| 76 | 76 | class Part < Dry::Struct |
| 77 | - attribute :depth, Types::String.optional | |
| 78 | 77 | attribute :length, Types::String.optional |
| 79 | 78 | attribute :width, Types::String.optional |
| 79 | + attribute :depth, Types::String.optional | |
| 80 | 80 | |
| 81 | 81 | def self.from_dynamic!(d) |
| 82 | 82 | d = Types::Hash[d] |
| 83 | 83 | new( |
| 84 | - depth: d["depth"], | |
| 85 | 84 | length: d["length"], |
| 86 | 85 | width: d["width"], |
| 86 | + depth: d["depth"], | |
| 87 | 87 | ) |
| 88 | 88 | end |
| 89 | 89 | |
| @@ -93,9 +93,9 @@ class Part < Dry::Struct | ||
| 93 | 93 | |
| 94 | 94 | def to_dynamic |
| 95 | 95 | { |
| 96 | - "depth" => depth, | |
| 97 | 96 | "length" => length, |
| 98 | 97 | "width" => width, |
| 98 | + "depth" => depth, | |
| 99 | 99 | } |
| 100 | 100 | end |
| 101 | 101 | |
| @@ -183,14 +183,14 @@ class History < Dry::Struct | ||
| 183 | 183 | end |
| 184 | 184 | |
| 185 | 185 | class Shape < Dry::Struct |
| 186 | - attribute :geometry, Geometry.optional | |
| 187 | 186 | attribute :history, History.optional |
| 187 | + attribute :geometry, Geometry.optional | |
| 188 | 188 | |
| 189 | 189 | def self.from_dynamic!(d) |
| 190 | 190 | d = Types::Hash[d] |
| 191 | 191 | new( |
| 192 | - geometry: d["geometry"] ? Geometry.from_dynamic!(d["geometry"]) : nil, | |
| 193 | 192 | history: d["history"] ? History.from_dynamic!(d["history"]) : nil, |
| 193 | + geometry: d["geometry"] ? Geometry.from_dynamic!(d["geometry"]) : nil, | |
| 194 | 194 | ) |
| 195 | 195 | end |
| 196 | 196 | |
| @@ -200,8 +200,8 @@ class Shape < Dry::Struct | ||
| 200 | 200 | |
| 201 | 201 | def to_dynamic |
| 202 | 202 | { |
| 203 | - "geometry" => geometry&.to_dynamic, | |
| 204 | 203 | "history" => history&.to_dynamic, |
| 204 | + "geometry" => geometry&.to_dynamic, | |
| 205 | 205 | } |
| 206 | 206 | end |
| 207 | 207 | |
| @@ -211,15 +211,15 @@ class Shape < Dry::Struct | ||
| 211 | 211 | end |
| 212 | 212 | |
| 213 | 213 | class Berry < Dry::Struct |
| 214 | - attribute :color, Color.optional | |
| 215 | 214 | attribute :berry_name, Types::String.optional |
| 215 | + attribute :color, Color.optional | |
| 216 | 216 | attribute :shapes, Types.Array(Shape).optional |
| 217 | 217 | |
| 218 | 218 | def self.from_dynamic!(d) |
| 219 | 219 | d = Types::Hash[d] |
| 220 | 220 | new( |
| 221 | - color: d["color"] ? Color.from_dynamic!(d["color"]) : nil, | |
| 222 | 221 | berry_name: d["name"], |
| 222 | + color: d["color"] ? Color.from_dynamic!(d["color"]) : nil, | |
| 223 | 223 | shapes: d["shapes"]&.map { |x| Shape.from_dynamic!(x) }, |
| 224 | 224 | ) |
| 225 | 225 | end |
| @@ -230,8 +230,8 @@ class Berry < Dry::Struct | ||
| 230 | 230 | |
| 231 | 231 | def to_dynamic |
| 232 | 232 | { |
| 233 | - "color" => color&.to_dynamic, | |
| 234 | 233 | "name" => berry_name, |
| 234 | + "color" => color&.to_dynamic, | |
| 235 | 235 | "shapes" => shapes&.map { |x| x.to_dynamic }, |
| 236 | 236 | } |
| 237 | 237 | end |
| @@ -243,15 +243,15 @@ end | ||
| 243 | 243 | |
| 244 | 244 | class Fruit < Dry::Struct |
| 245 | 245 | attribute :apple, Types::Bool.optional |
| 246 | - attribute :berries, Types.Array(Berry).optional | |
| 247 | 246 | attribute :orange, Types::Bool.optional |
| 247 | + attribute :berries, Types.Array(Berry).optional | |
| 248 | 248 | |
| 249 | 249 | def self.from_dynamic!(d) |
| 250 | 250 | d = Types::Hash[d] |
| 251 | 251 | new( |
| 252 | 252 | apple: d["apple"], |
| 253 | - berries: d["berries"]&.map { |x| Berry.from_dynamic!(x) }, | |
| 254 | 253 | orange: d["orange"], |
| 254 | + berries: d["berries"]&.map { |x| Berry.from_dynamic!(x) }, | |
| 255 | 255 | ) |
| 256 | 256 | end |
| 257 | 257 | |
| @@ -262,8 +262,8 @@ class Fruit < Dry::Struct | ||
| 262 | 262 | def to_dynamic |
| 263 | 263 | { |
| 264 | 264 | "apple" => apple, |
| 265 | - "berries" => berries&.map { |x| x.to_dynamic }, | |
| 266 | 265 | "orange" => orange, |
| 266 | + "berries" => berries&.map { |x| x.to_dynamic }, | |
| 267 | 267 | } |
| 268 | 268 | end |
| 269 | 269 | |
| @@ -273,14 +273,14 @@ class Fruit < Dry::Struct | ||
| 273 | 273 | end |
| 274 | 274 | |
| 275 | 275 | class Limit < Dry::Struct |
| 276 | - attribute :maximum, Types::Double.optional | |
| 277 | 276 | attribute :minimum, Types::Double.optional |
| 277 | + attribute :maximum, Types::Double.optional | |
| 278 | 278 | |
| 279 | 279 | def self.from_dynamic!(d) |
| 280 | 280 | d = Types::Hash[d] |
| 281 | 281 | new( |
| 282 | - maximum: d["maximum"], | |
| 283 | 282 | minimum: d["minimum"], |
| 283 | + maximum: d["maximum"], | |
| 284 | 284 | ) |
| 285 | 285 | end |
| 286 | 286 | |
| @@ -290,8 +290,8 @@ class Limit < Dry::Struct | ||
| 290 | 290 | |
| 291 | 291 | def to_dynamic |
| 292 | 292 | { |
| 293 | - "maximum" => maximum, | |
| 294 | 293 | "minimum" => minimum, |
| 294 | + "maximum" => maximum, | |
| 295 | 295 | } |
| 296 | 296 | end |
| 297 | 297 | |
| @@ -378,22 +378,22 @@ class VehicleType < Dry::Struct | ||
| 378 | 378 | end |
| 379 | 379 | |
| 380 | 380 | class Vehicle < Dry::Struct |
| 381 | - attribute :brand, Types::String.optional | |
| 382 | 381 | attribute :id, Types::String.optional |
| 383 | - attribute :speed, Speed.optional | |
| 384 | - attribute :sub_module, Types::Bool.optional | |
| 385 | 382 | attribute :vehicle_type, VehicleType.optional |
| 383 | + attribute :speed, Speed.optional | |
| 386 | 384 | attribute :year, Types::String.optional |
| 385 | + attribute :brand, Types::String.optional | |
| 386 | + attribute :sub_module, Types::Bool.optional | |
| 387 | 387 | |
| 388 | 388 | def self.from_dynamic!(d) |
| 389 | 389 | d = Types::Hash[d] |
| 390 | 390 | new( |
| 391 | - brand: d["brand"], | |
| 392 | 391 | id: d["id"], |
| 393 | - speed: d["speed"] ? Speed.from_dynamic!(d["speed"]) : nil, | |
| 394 | - sub_module: d["subModule"], | |
| 395 | 392 | vehicle_type: d["type"] ? VehicleType.from_dynamic!(d["type"]) : nil, |
| 393 | + speed: d["speed"] ? Speed.from_dynamic!(d["speed"]) : nil, | |
| 396 | 394 | year: d["year"], |
| 395 | + brand: d["brand"], | |
| 396 | + sub_module: d["subModule"], | |
| 397 | 397 | ) |
| 398 | 398 | end |
| 399 | 399 | |
| @@ -403,12 +403,12 @@ class Vehicle < Dry::Struct | ||
| 403 | 403 | |
| 404 | 404 | def to_dynamic |
| 405 | 405 | { |
| 406 | - "brand" => brand, | |
| 407 | 406 | "id" => id, |
| 408 | - "speed" => speed&.to_dynamic, | |
| 409 | - "subModule" => sub_module, | |
| 410 | 407 | "type" => vehicle_type&.to_dynamic, |
| 408 | + "speed" => speed&.to_dynamic, | |
| 411 | 409 | "year" => year, |
| 410 | + "brand" => brand, | |
| 411 | + "subModule" => sub_module, | |
| 412 | 412 | } |
| 413 | 413 | end |
Mschema-rustdefault / module_under_test.rs+16 −16
| @@ -26,17 +26,17 @@ pub struct TopLevel { | ||
| 26 | 26 | pub struct Fruit { |
| 27 | 27 | pub apple: Option<bool>, |
| 28 | 28 | |
| 29 | - pub berries: Option<Vec<Berry>>, | |
| 30 | - | |
| 31 | 29 | pub orange: Option<bool>, |
| 30 | + | |
| 31 | + pub berries: Option<Vec<Berry>>, | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 35 | 35 | pub struct Berry { |
| 36 | - pub color: Option<Color>, | |
| 37 | - | |
| 38 | 36 | pub name: Option<String>, |
| 39 | 37 | |
| 38 | + pub color: Option<Color>, | |
| 39 | + | |
| 40 | 40 | pub shapes: Option<Vec<Shape>>, |
| 41 | 41 | } |
| 42 | 42 | |
| @@ -47,9 +47,9 @@ pub struct Color { | ||
| 47 | 47 | |
| 48 | 48 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 49 | 49 | pub struct Shape { |
| 50 | - pub geometry: Option<Geometry>, | |
| 51 | - | |
| 52 | 50 | pub history: Option<History>, |
| 51 | + | |
| 52 | + pub geometry: Option<Geometry>, | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| @@ -73,11 +73,11 @@ pub struct RectShape { | ||
| 73 | 73 | |
| 74 | 74 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 75 | 75 | pub struct Part { |
| 76 | - pub depth: Option<String>, | |
| 77 | - | |
| 78 | 76 | pub length: Option<String>, |
| 79 | 77 | |
| 80 | 78 | pub width: Option<String>, |
| 79 | + | |
| 80 | + pub depth: Option<String>, | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| @@ -88,18 +88,18 @@ pub struct History { | ||
| 88 | 88 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 89 | 89 | #[serde(rename_all = "camelCase")] |
| 90 | 90 | pub struct Vehicle { |
| 91 | - pub brand: Option<String>, | |
| 92 | - | |
| 93 | 91 | pub id: Option<String>, |
| 94 | 92 | |
| 95 | - pub speed: Option<Speed>, | |
| 96 | - | |
| 97 | - pub sub_module: Option<bool>, | |
| 98 | - | |
| 99 | 93 | #[serde(rename = "type")] |
| 100 | 94 | pub vehicle_type: Option<VehicleType>, |
| 101 | 95 | |
| 96 | + pub speed: Option<Speed>, | |
| 97 | + | |
| 102 | 98 | pub year: Option<String>, |
| 99 | + | |
| 100 | + pub brand: Option<String>, | |
| 101 | + | |
| 102 | + pub sub_module: Option<bool>, | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| @@ -109,9 +109,9 @@ pub struct Speed { | ||
| 109 | 109 | |
| 110 | 110 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 111 | 111 | pub struct Limit { |
| 112 | - pub maximum: Option<f64>, | |
| 113 | - | |
| 114 | 112 | pub minimum: Option<f64>, |
| 113 | + | |
| 114 | + pub maximum: Option<f64>, | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | #[derive(Debug, Clone, Serialize, Deserialize)] |
Mschema-scala3-upickledefault / TopLevel.scala+13 −13
| @@ -73,13 +73,13 @@ case class TopLevel ( | ||
| 73 | 73 | |
| 74 | 74 | case class Fruit ( |
| 75 | 75 | val apple : Option[Boolean] = None, |
| 76 | - val berries : Option[Seq[Berry]] = None, | |
| 77 | - val orange : Option[Boolean] = None | |
| 76 | + val orange : Option[Boolean] = None, | |
| 77 | + val berries : Option[Seq[Berry]] = None | |
| 78 | 78 | ) derives OptionPickler.ReadWriter |
| 79 | 79 | |
| 80 | 80 | case class Berry ( |
| 81 | - val color : Option[Color] = None, | |
| 82 | 81 | val name : Option[String] = None, |
| 82 | + val color : Option[Color] = None, | |
| 83 | 83 | val shapes : Option[Seq[Shape]] = None |
| 84 | 84 | ) derives OptionPickler.ReadWriter |
| 85 | 85 | |
| @@ -88,8 +88,8 @@ case class Color ( | ||
| 88 | 88 | ) derives OptionPickler.ReadWriter |
| 89 | 89 | |
| 90 | 90 | case class Shape ( |
| 91 | - val geometry : Option[Geometry] = None, | |
| 92 | - val history : Option[History] = None | |
| 91 | + val history : Option[History] = None, | |
| 92 | + val geometry : Option[Geometry] = None | |
| 93 | 93 | ) derives OptionPickler.ReadWriter |
| 94 | 94 | |
| 95 | 95 | case class Geometry ( |
| @@ -106,9 +106,9 @@ case class RectShape ( | ||
| 106 | 106 | ) derives OptionPickler.ReadWriter |
| 107 | 107 | |
| 108 | 108 | case class Part ( |
| 109 | - val depth : Option[String] = None, | |
| 110 | 109 | val length : Option[String] = None, |
| 111 | - val width : Option[String] = None | |
| 110 | + val width : Option[String] = None, | |
| 111 | + val depth : Option[String] = None | |
| 112 | 112 | ) derives OptionPickler.ReadWriter |
| 113 | 113 | |
| 114 | 114 | case class History ( |
| @@ -116,12 +116,12 @@ case class History ( | ||
| 116 | 116 | ) derives OptionPickler.ReadWriter |
| 117 | 117 | |
| 118 | 118 | case class Vehicle ( |
| 119 | - val brand : Option[String] = None, | |
| 120 | 119 | val id : Option[String] = None, |
| 121 | - val speed : Option[Speed] = None, | |
| 122 | - val subModule : Option[Boolean] = None, | |
| 123 | 120 | val `type` : Option[VehicleType] = None, |
| 124 | - val year : Option[String] = None | |
| 121 | + val speed : Option[Speed] = None, | |
| 122 | + val year : Option[String] = None, | |
| 123 | + val brand : Option[String] = None, | |
| 124 | + val subModule : Option[Boolean] = None | |
| 125 | 125 | ) derives OptionPickler.ReadWriter |
| 126 | 126 | |
| 127 | 127 | case class Speed ( |
| @@ -129,8 +129,8 @@ case class Speed ( | ||
| 129 | 129 | ) derives OptionPickler.ReadWriter |
| 130 | 130 | |
| 131 | 131 | case class Limit ( |
| 132 | - val maximum : Option[Double] = None, | |
| 133 | - val minimum : Option[Double] = None | |
| 132 | + val minimum : Option[Double] = None, | |
| 133 | + val maximum : Option[Double] = None | |
| 134 | 134 | ) derives OptionPickler.ReadWriter |
| 135 | 135 | |
| 136 | 136 | case class VehicleType ( |
Mschema-scala3default / TopLevel.scala+13 −13
| @@ -15,13 +15,13 @@ case class TopLevel ( | ||
| 15 | 15 | |
| 16 | 16 | case class Fruit ( |
| 17 | 17 | val apple : Option[Boolean] = None, |
| 18 | - val berries : Option[Seq[Berry]] = None, | |
| 19 | - val orange : Option[Boolean] = None | |
| 18 | + val orange : Option[Boolean] = None, | |
| 19 | + val berries : Option[Seq[Berry]] = None | |
| 20 | 20 | ) derives Encoder.AsObject, Decoder |
| 21 | 21 | |
| 22 | 22 | case class Berry ( |
| 23 | - val color : Option[Color] = None, | |
| 24 | 23 | val name : Option[String] = None, |
| 24 | + val color : Option[Color] = None, | |
| 25 | 25 | val shapes : Option[Seq[Shape]] = None |
| 26 | 26 | ) derives Encoder.AsObject, Decoder |
| 27 | 27 | |
| @@ -30,8 +30,8 @@ case class Color ( | ||
| 30 | 30 | ) derives Encoder.AsObject, Decoder |
| 31 | 31 | |
| 32 | 32 | case class Shape ( |
| 33 | - val geometry : Option[Geometry] = None, | |
| 34 | - val history : Option[History] = None | |
| 33 | + val history : Option[History] = None, | |
| 34 | + val geometry : Option[Geometry] = None | |
| 35 | 35 | ) derives Encoder.AsObject, Decoder |
| 36 | 36 | |
| 37 | 37 | case class Geometry ( |
| @@ -48,9 +48,9 @@ case class RectShape ( | ||
| 48 | 48 | ) derives Encoder.AsObject, Decoder |
| 49 | 49 | |
| 50 | 50 | case class Part ( |
| 51 | - val depth : Option[String] = None, | |
| 52 | 51 | val length : Option[String] = None, |
| 53 | - val width : Option[String] = None | |
| 52 | + val width : Option[String] = None, | |
| 53 | + val depth : Option[String] = None | |
| 54 | 54 | ) derives Encoder.AsObject, Decoder |
| 55 | 55 | |
| 56 | 56 | case class History ( |
| @@ -58,12 +58,12 @@ case class History ( | ||
| 58 | 58 | ) derives Encoder.AsObject, Decoder |
| 59 | 59 | |
| 60 | 60 | case class Vehicle ( |
| 61 | - val brand : Option[String] = None, | |
| 62 | 61 | val id : Option[String] = None, |
| 63 | - val speed : Option[Speed] = None, | |
| 64 | - val subModule : Option[Boolean] = None, | |
| 65 | 62 | val `type` : Option[VehicleType] = None, |
| 66 | - val year : Option[String] = None | |
| 63 | + val speed : Option[Speed] = None, | |
| 64 | + val year : Option[String] = None, | |
| 65 | + val brand : Option[String] = None, | |
| 66 | + val subModule : Option[Boolean] = None | |
| 67 | 67 | ) derives Encoder.AsObject, Decoder |
| 68 | 68 | |
| 69 | 69 | case class Speed ( |
| @@ -71,8 +71,8 @@ case class Speed ( | ||
| 71 | 71 | ) derives Encoder.AsObject, Decoder |
| 72 | 72 | |
| 73 | 73 | case class Limit ( |
| 74 | - val maximum : Option[Double] = None, | |
| 75 | - val minimum : Option[Double] = None | |
| 74 | + val minimum : Option[Double] = None, | |
| 75 | + val maximum : Option[Double] = None | |
| 76 | 76 | ) derives Encoder.AsObject, Decoder |
| 77 | 77 | |
| 78 | 78 | case class VehicleType ( |
Mschema-schemadefault / TopLevel.schema+23 −23
| @@ -33,14 +33,14 @@ | ||
| 33 | 33 | "apple": { |
| 34 | 34 | "type": "boolean" |
| 35 | 35 | }, |
| 36 | + "orange": { | |
| 37 | + "type": "boolean" | |
| 38 | + }, | |
| 36 | 39 | "berries": { |
| 37 | 40 | "type": "array", |
| 38 | 41 | "items": { |
| 39 | 42 | "$ref": "#/definitions/Berry" |
| 40 | 43 | } |
| 41 | - }, | |
| 42 | - "orange": { | |
| 43 | - "type": "boolean" | |
| 44 | 44 | } |
| 45 | 45 | }, |
| 46 | 46 | "required": [], |
| @@ -50,13 +50,13 @@ | ||
| 50 | 50 | "type": "object", |
| 51 | 51 | "additionalProperties": {}, |
| 52 | 52 | "properties": { |
| 53 | - "color": { | |
| 54 | - "$ref": "#/definitions/Color" | |
| 55 | - }, | |
| 56 | 53 | "name": { |
| 57 | 54 | "type": "string", |
| 58 | 55 | "minLength": 1 |
| 59 | 56 | }, |
| 57 | + "color": { | |
| 58 | + "$ref": "#/definitions/Color" | |
| 59 | + }, | |
| 60 | 60 | "shapes": { |
| 61 | 61 | "type": "array", |
| 62 | 62 | "items": { |
| @@ -82,11 +82,11 @@ | ||
| 82 | 82 | "type": "object", |
| 83 | 83 | "additionalProperties": {}, |
| 84 | 84 | "properties": { |
| 85 | - "geometry": { | |
| 86 | - "$ref": "#/definitions/Geometry" | |
| 87 | - }, | |
| 88 | 85 | "history": { |
| 89 | 86 | "$ref": "#/definitions/History" |
| 87 | + }, | |
| 88 | + "geometry": { | |
| 89 | + "$ref": "#/definitions/Geometry" | |
| 90 | 90 | } |
| 91 | 91 | }, |
| 92 | 92 | "required": [], |
| @@ -138,14 +138,14 @@ | ||
| 138 | 138 | "type": "object", |
| 139 | 139 | "additionalProperties": {}, |
| 140 | 140 | "properties": { |
| 141 | - "depth": { | |
| 142 | - "type": "string" | |
| 143 | - }, | |
| 144 | 141 | "length": { |
| 145 | 142 | "type": "string" |
| 146 | 143 | }, |
| 147 | 144 | "width": { |
| 148 | 145 | "type": "string" |
| 146 | + }, | |
| 147 | + "depth": { | |
| 148 | + "type": "string" | |
| 149 | 149 | } |
| 150 | 150 | }, |
| 151 | 151 | "required": [], |
| @@ -166,24 +166,24 @@ | ||
| 166 | 166 | "type": "object", |
| 167 | 167 | "additionalProperties": {}, |
| 168 | 168 | "properties": { |
| 169 | - "brand": { | |
| 170 | - "type": "string" | |
| 171 | - }, | |
| 172 | 169 | "id": { |
| 173 | 170 | "type": "string", |
| 174 | 171 | "minLength": 1 |
| 175 | 172 | }, |
| 176 | - "speed": { | |
| 177 | - "$ref": "#/definitions/Speed" | |
| 178 | - }, | |
| 179 | - "subModule": { | |
| 180 | - "type": "boolean" | |
| 181 | - }, | |
| 182 | 173 | "type": { |
| 183 | 174 | "$ref": "#/definitions/VehicleType" |
| 184 | 175 | }, |
| 176 | + "speed": { | |
| 177 | + "$ref": "#/definitions/Speed" | |
| 178 | + }, | |
| 185 | 179 | "year": { |
| 186 | 180 | "type": "string" |
| 181 | + }, | |
| 182 | + "brand": { | |
| 183 | + "type": "string" | |
| 184 | + }, | |
| 185 | + "subModule": { | |
| 186 | + "type": "boolean" | |
| 187 | 187 | } |
| 188 | 188 | }, |
| 189 | 189 | "required": [], |
| @@ -204,10 +204,10 @@ | ||
| 204 | 204 | "type": "object", |
| 205 | 205 | "additionalProperties": {}, |
| 206 | 206 | "properties": { |
| 207 | - "maximum": { | |
| 207 | + "minimum": { | |
| 208 | 208 | "type": "number" |
| 209 | 209 | }, |
| 210 | - "minimum": { | |
| 210 | + "maximum": { | |
| 211 | 211 | "type": "number" |
| 212 | 212 | } |
| 213 | 213 | }, |
Mschema-swiftdefault / quicktype.swift+42 −42
| @@ -60,13 +60,13 @@ extension TopLevel { | ||
| 60 | 60 | // MARK: - Fruit |
| 61 | 61 | struct Fruit: Codable { |
| 62 | 62 | let apple: Bool? |
| 63 | - let berries: [Berry]? | |
| 64 | 63 | let orange: Bool? |
| 64 | + let berries: [Berry]? | |
| 65 | 65 | |
| 66 | 66 | enum CodingKeys: String, CodingKey { |
| 67 | 67 | case apple = "apple" |
| 68 | - case berries = "berries" | |
| 69 | 68 | case orange = "orange" |
| 69 | + case berries = "berries" | |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| @@ -90,13 +90,13 @@ extension Fruit { | ||
| 90 | 90 | |
| 91 | 91 | func with( |
| 92 | 92 | apple: Bool?? = nil, |
| 93 | - berries: [Berry]?? = nil, | |
| 94 | - orange: Bool?? = nil | |
| 93 | + orange: Bool?? = nil, | |
| 94 | + berries: [Berry]?? = nil | |
| 95 | 95 | ) -> Fruit { |
| 96 | 96 | return Fruit( |
| 97 | 97 | apple: apple ?? self.apple, |
| 98 | - berries: berries ?? self.berries, | |
| 99 | - orange: orange ?? self.orange | |
| 98 | + orange: orange ?? self.orange, | |
| 99 | + berries: berries ?? self.berries | |
| 100 | 100 | ) |
| 101 | 101 | } |
| 102 | 102 | |
| @@ -111,13 +111,13 @@ extension Fruit { | ||
| 111 | 111 | |
| 112 | 112 | // MARK: - Berry |
| 113 | 113 | struct Berry: Codable { |
| 114 | - let color: Color? | |
| 115 | 114 | let name: String? |
| 115 | + let color: Color? | |
| 116 | 116 | let shapes: [Shape]? |
| 117 | 117 | |
| 118 | 118 | enum CodingKeys: String, CodingKey { |
| 119 | - case color = "color" | |
| 120 | 119 | case name = "name" |
| 120 | + case color = "color" | |
| 121 | 121 | case shapes = "shapes" |
| 122 | 122 | } |
| 123 | 123 | } |
| @@ -141,13 +141,13 @@ extension Berry { | ||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | func with( |
| 144 | - color: Color?? = nil, | |
| 145 | 144 | name: String?? = nil, |
| 145 | + color: Color?? = nil, | |
| 146 | 146 | shapes: [Shape]?? = nil |
| 147 | 147 | ) -> Berry { |
| 148 | 148 | return Berry( |
| 149 | - color: color ?? self.color, | |
| 150 | 149 | name: name ?? self.name, |
| 150 | + color: color ?? self.color, | |
| 151 | 151 | shapes: shapes ?? self.shapes |
| 152 | 152 | ) |
| 153 | 153 | } |
| @@ -207,12 +207,12 @@ extension Color { | ||
| 207 | 207 | |
| 208 | 208 | // MARK: - Shape |
| 209 | 209 | struct Shape: Codable { |
| 210 | - let geometry: Geometry? | |
| 211 | 210 | let history: History? |
| 211 | + let geometry: Geometry? | |
| 212 | 212 | |
| 213 | 213 | enum CodingKeys: String, CodingKey { |
| 214 | - case geometry = "geometry" | |
| 215 | 214 | case history = "history" |
| 215 | + case geometry = "geometry" | |
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | |
| @@ -235,12 +235,12 @@ extension Shape { | ||
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | func with( |
| 238 | - geometry: Geometry?? = nil, | |
| 239 | - history: History?? = nil | |
| 238 | + history: History?? = nil, | |
| 239 | + geometry: Geometry?? = nil | |
| 240 | 240 | ) -> Shape { |
| 241 | 241 | return Shape( |
| 242 | - geometry: geometry ?? self.geometry, | |
| 243 | - history: history ?? self.history | |
| 242 | + history: history ?? self.history, | |
| 243 | + geometry: geometry ?? self.geometry | |
| 244 | 244 | ) |
| 245 | 245 | } |
| 246 | 246 | |
| @@ -391,14 +391,14 @@ extension RectShape { | ||
| 391 | 391 | |
| 392 | 392 | // MARK: - Part |
| 393 | 393 | struct Part: Codable { |
| 394 | - let depth: String? | |
| 395 | 394 | let length: String? |
| 396 | 395 | let width: String? |
| 396 | + let depth: String? | |
| 397 | 397 | |
| 398 | 398 | enum CodingKeys: String, CodingKey { |
| 399 | - case depth = "depth" | |
| 400 | 399 | case length = "length" |
| 401 | 400 | case width = "width" |
| 401 | + case depth = "depth" | |
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | |
| @@ -421,14 +421,14 @@ extension Part { | ||
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | func with( |
| 424 | - depth: String?? = nil, | |
| 425 | 424 | length: String?? = nil, |
| 426 | - width: String?? = nil | |
| 425 | + width: String?? = nil, | |
| 426 | + depth: String?? = nil | |
| 427 | 427 | ) -> Part { |
| 428 | 428 | return Part( |
| 429 | - depth: depth ?? self.depth, | |
| 430 | 429 | length: length ?? self.length, |
| 431 | - width: width ?? self.width | |
| 430 | + width: width ?? self.width, | |
| 431 | + depth: depth ?? self.depth | |
| 432 | 432 | ) |
| 433 | 433 | } |
| 434 | 434 | |
| @@ -487,20 +487,20 @@ extension History { | ||
| 487 | 487 | |
| 488 | 488 | // MARK: - Vehicle |
| 489 | 489 | struct Vehicle: Codable { |
| 490 | - let brand: String? | |
| 491 | 490 | let id: String? |
| 492 | - let speed: Speed? | |
| 493 | - let subModule: Bool? | |
| 494 | 491 | let type: VehicleType? |
| 492 | + let speed: Speed? | |
| 495 | 493 | let year: String? |
| 494 | + let brand: String? | |
| 495 | + let subModule: Bool? | |
| 496 | 496 | |
| 497 | 497 | enum CodingKeys: String, CodingKey { |
| 498 | - case brand = "brand" | |
| 499 | 498 | case id = "id" |
| 500 | - case speed = "speed" | |
| 501 | - case subModule = "subModule" | |
| 502 | 499 | case type = "type" |
| 500 | + case speed = "speed" | |
| 503 | 501 | case year = "year" |
| 502 | + case brand = "brand" | |
| 503 | + case subModule = "subModule" | |
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | 506 | |
| @@ -523,20 +523,20 @@ extension Vehicle { | ||
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | func with( |
| 526 | - brand: String?? = nil, | |
| 527 | 526 | id: String?? = nil, |
| 528 | - speed: Speed?? = nil, | |
| 529 | - subModule: Bool?? = nil, | |
| 530 | 527 | type: VehicleType?? = nil, |
| 531 | - year: String?? = nil | |
| 528 | + speed: Speed?? = nil, | |
| 529 | + year: String?? = nil, | |
| 530 | + brand: String?? = nil, | |
| 531 | + subModule: Bool?? = nil | |
| 532 | 532 | ) -> Vehicle { |
| 533 | 533 | return Vehicle( |
| 534 | - brand: brand ?? self.brand, | |
| 535 | 534 | id: id ?? self.id, |
| 536 | - speed: speed ?? self.speed, | |
| 537 | - subModule: subModule ?? self.subModule, | |
| 538 | 535 | type: type ?? self.type, |
| 539 | - year: year ?? self.year | |
| 536 | + speed: speed ?? self.speed, | |
| 537 | + year: year ?? self.year, | |
| 538 | + brand: brand ?? self.brand, | |
| 539 | + subModule: subModule ?? self.subModule | |
| 540 | 540 | ) |
| 541 | 541 | } |
| 542 | 542 | |
| @@ -595,12 +595,12 @@ extension Speed { | ||
| 595 | 595 | |
| 596 | 596 | // MARK: - Limit |
| 597 | 597 | struct Limit: Codable { |
| 598 | - let maximum: Double? | |
| 599 | 598 | let minimum: Double? |
| 599 | + let maximum: Double? | |
| 600 | 600 | |
| 601 | 601 | enum CodingKeys: String, CodingKey { |
| 602 | - case maximum = "maximum" | |
| 603 | 602 | case minimum = "minimum" |
| 603 | + case maximum = "maximum" | |
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | 606 | |
| @@ -623,12 +623,12 @@ extension Limit { | ||
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | func with( |
| 626 | - maximum: Double?? = nil, | |
| 627 | - minimum: Double?? = nil | |
| 626 | + minimum: Double?? = nil, | |
| 627 | + maximum: Double?? = nil | |
| 628 | 628 | ) -> Limit { |
| 629 | 629 | return Limit( |
| 630 | - maximum: maximum ?? self.maximum, | |
| 631 | - minimum: minimum ?? self.minimum | |
| 630 | + minimum: minimum ?? self.minimum, | |
| 631 | + maximum: maximum ?? self.maximum | |
| 632 | 632 | ) |
| 633 | 633 | } |
Mschema-typescript-zoddefault / TopLevel.ts+8 −8
| @@ -36,9 +36,9 @@ export const CircularShapeSchema = z.object({ | ||
| 36 | 36 | export type CircularShape = z.infer<typeof CircularShapeSchema>; |
| 37 | 37 | |
| 38 | 38 | export const PartSchema = z.object({ |
| 39 | - "depth": z.string().optional(), | |
| 40 | 39 | "length": z.string().optional(), |
| 41 | 40 | "width": z.string().optional(), |
| 41 | + "depth": z.string().optional(), | |
| 42 | 42 | }); |
| 43 | 43 | export type Part = z.infer<typeof PartSchema>; |
| 44 | 44 | |
| @@ -48,8 +48,8 @@ export const HistorySchema = z.object({ | ||
| 48 | 48 | export type History = z.infer<typeof HistorySchema>; |
| 49 | 49 | |
| 50 | 50 | export const LimitSchema = z.object({ |
| 51 | - "maximum": z.number().optional(), | |
| 52 | 51 | "minimum": z.number().optional(), |
| 52 | + "maximum": z.number().optional(), | |
| 53 | 53 | }); |
| 54 | 54 | export type Limit = z.infer<typeof LimitSchema>; |
| 55 | 55 | |
| @@ -77,32 +77,32 @@ export const GeometrySchema = z.object({ | ||
| 77 | 77 | export type Geometry = z.infer<typeof GeometrySchema>; |
| 78 | 78 | |
| 79 | 79 | export const VehicleSchema = z.object({ |
| 80 | - "brand": z.string().optional(), | |
| 81 | 80 | "id": z.string().optional(), |
| 82 | - "speed": SpeedSchema.optional(), | |
| 83 | - "subModule": z.boolean().optional(), | |
| 84 | 81 | "type": VehicleTypeSchema.optional(), |
| 82 | + "speed": SpeedSchema.optional(), | |
| 85 | 83 | "year": z.string().optional(), |
| 84 | + "brand": z.string().optional(), | |
| 85 | + "subModule": z.boolean().optional(), | |
| 86 | 86 | }); |
| 87 | 87 | export type Vehicle = z.infer<typeof VehicleSchema>; |
| 88 | 88 | |
| 89 | 89 | export const ShapeSchema = z.object({ |
| 90 | - "geometry": GeometrySchema.optional(), | |
| 91 | 90 | "history": HistorySchema.optional(), |
| 91 | + "geometry": GeometrySchema.optional(), | |
| 92 | 92 | }); |
| 93 | 93 | export type Shape = z.infer<typeof ShapeSchema>; |
| 94 | 94 | |
| 95 | 95 | export const BerrySchema = z.object({ |
| 96 | - "color": ColorSchema.optional(), | |
| 97 | 96 | "name": z.string().optional(), |
| 97 | + "color": ColorSchema.optional(), | |
| 98 | 98 | "shapes": z.array(ShapeSchema).optional(), |
| 99 | 99 | }); |
| 100 | 100 | export type Berry = z.infer<typeof BerrySchema>; |
| 101 | 101 | |
| 102 | 102 | export const FruitSchema = z.object({ |
| 103 | 103 | "apple": z.boolean().optional(), |
| 104 | - "berries": z.array(BerrySchema).optional(), | |
| 105 | 104 | "orange": z.boolean().optional(), |
| 105 | + "berries": z.array(BerrySchema).optional(), | |
| 106 | 106 | }); |
| 107 | 107 | export type Fruit = z.infer<typeof FruitSchema>; |
Mschema-typescriptdefault / TopLevel.ts+16 −16
| @@ -16,14 +16,14 @@ export interface TopLevel { | ||
| 16 | 16 | |
| 17 | 17 | export interface Fruit { |
| 18 | 18 | apple?: boolean; |
| 19 | - berries?: Berry[]; | |
| 20 | 19 | orange?: boolean; |
| 20 | + berries?: Berry[]; | |
| 21 | 21 | [property: string]: unknown; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | export interface Berry { |
| 25 | - color?: Color; | |
| 26 | 25 | name?: string; |
| 26 | + color?: Color; | |
| 27 | 27 | shapes?: Shape[]; |
| 28 | 28 | [property: string]: unknown; |
| 29 | 29 | } |
| @@ -34,8 +34,8 @@ export interface Color { | ||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | export interface Shape { |
| 37 | - geometry?: Geometry; | |
| 38 | 37 | history?: History; |
| 38 | + geometry?: Geometry; | |
| 39 | 39 | [property: string]: unknown; |
| 40 | 40 | } |
| 41 | 41 | |
| @@ -56,9 +56,9 @@ export interface RectShape { | ||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | export interface Part { |
| 59 | - depth?: string; | |
| 60 | 59 | length?: string; |
| 61 | 60 | width?: string; |
| 61 | + depth?: string; | |
| 62 | 62 | [property: string]: unknown; |
| 63 | 63 | } |
| 64 | 64 | |
| @@ -68,12 +68,12 @@ export interface History { | ||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | export interface Vehicle { |
| 71 | - brand?: string; | |
| 72 | 71 | id?: string; |
| 73 | - speed?: Speed; | |
| 74 | - subModule?: boolean; | |
| 75 | 72 | type?: VehicleType; |
| 73 | + speed?: Speed; | |
| 76 | 74 | year?: string; |
| 75 | + brand?: string; | |
| 76 | + subModule?: boolean; | |
| 77 | 77 | [property: string]: unknown; |
| 78 | 78 | } |
| 79 | 79 | |
| @@ -83,8 +83,8 @@ export interface Speed { | ||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | export interface Limit { |
| 86 | - maximum?: number; | |
| 87 | 86 | minimum?: number; |
| 87 | + maximum?: number; | |
| 88 | 88 | [property: string]: unknown; |
| 89 | 89 | } |
| 90 | 90 | |
| @@ -272,20 +272,20 @@ const typeMap: any = { | ||
| 272 | 272 | ], "any"), |
| 273 | 273 | "Fruit": o([ |
| 274 | 274 | { json: "apple", js: "apple", typ: u(undefined, true) }, |
| 275 | - { json: "berries", js: "berries", typ: u(undefined, a(r("Berry"))) }, | |
| 276 | 275 | { json: "orange", js: "orange", typ: u(undefined, true) }, |
| 276 | + { json: "berries", js: "berries", typ: u(undefined, a(r("Berry"))) }, | |
| 277 | 277 | ], "any"), |
| 278 | 278 | "Berry": o([ |
| 279 | - { json: "color", js: "color", typ: u(undefined, r("Color")) }, | |
| 280 | 279 | { json: "name", js: "name", typ: u(undefined, "") }, |
| 280 | + { json: "color", js: "color", typ: u(undefined, r("Color")) }, | |
| 281 | 281 | { json: "shapes", js: "shapes", typ: u(undefined, a(r("Shape"))) }, |
| 282 | 282 | ], "any"), |
| 283 | 283 | "Color": o([ |
| 284 | 284 | { json: "rgb", js: "rgb", typ: u(undefined, 3.14) }, |
| 285 | 285 | ], "any"), |
| 286 | 286 | "Shape": o([ |
| 287 | - { json: "geometry", js: "geometry", typ: u(undefined, r("Geometry")) }, | |
| 288 | 287 | { json: "history", js: "history", typ: u(undefined, r("History")) }, |
| 288 | + { json: "geometry", js: "geometry", typ: u(undefined, r("Geometry")) }, | |
| 289 | 289 | ], "any"), |
| 290 | 290 | "Geometry": o([ |
| 291 | 291 | { json: "rectShape", js: "rectShape", typ: u(undefined, r("RectShape")) }, |
| @@ -298,27 +298,27 @@ const typeMap: any = { | ||
| 298 | 298 | { json: "parts", js: "parts", typ: u(undefined, a(r("Part"))) }, |
| 299 | 299 | ], "any"), |
| 300 | 300 | "Part": o([ |
| 301 | - { json: "depth", js: "depth", typ: u(undefined, "") }, | |
| 302 | 301 | { json: "length", js: "length", typ: u(undefined, "") }, |
| 303 | 302 | { json: "width", js: "width", typ: u(undefined, "") }, |
| 303 | + { json: "depth", js: "depth", typ: u(undefined, "") }, | |
| 304 | 304 | ], "any"), |
| 305 | 305 | "History": o([ |
| 306 | 306 | { json: "class", js: "class", typ: u(undefined, "") }, |
| 307 | 307 | ], "any"), |
| 308 | 308 | "Vehicle": o([ |
| 309 | - { json: "brand", js: "brand", typ: u(undefined, "") }, | |
| 310 | 309 | { json: "id", js: "id", typ: u(undefined, "") }, |
| 311 | - { json: "speed", js: "speed", typ: u(undefined, r("Speed")) }, | |
| 312 | - { json: "subModule", js: "subModule", typ: u(undefined, true) }, | |
| 313 | 310 | { json: "type", js: "type", typ: u(undefined, r("VehicleType")) }, |
| 311 | + { json: "speed", js: "speed", typ: u(undefined, r("Speed")) }, | |
| 314 | 312 | { json: "year", js: "year", typ: u(undefined, "") }, |
| 313 | + { json: "brand", js: "brand", typ: u(undefined, "") }, | |
| 314 | + { json: "subModule", js: "subModule", typ: u(undefined, true) }, | |
| 315 | 315 | ], "any"), |
| 316 | 316 | "Speed": o([ |
| 317 | 317 | { json: "velocity", js: "velocity", typ: u(undefined, r("Limit")) }, |
| 318 | 318 | ], "any"), |
| 319 | 319 | "Limit": o([ |
| 320 | - { json: "maximum", js: "maximum", typ: u(undefined, 3.14) }, | |
| 321 | 320 | { json: "minimum", js: "minimum", typ: u(undefined, 3.14) }, |
| 321 | + { json: "maximum", js: "maximum", typ: u(undefined, 3.14) }, | |
| 322 | 322 | ], "any"), |
| 323 | 323 | "VehicleType": o([ |
| 324 | 324 | { json: "name", js: "name", typ: u(undefined, r("Name")) }, |
Test case
28 generated files · +284 −284test/inputs/schema/rust-cycle-breaker-union.schema
Mschema-cplusplusdefault / quicktype.hpp+12 −12
| @@ -99,16 +99,16 @@ namespace quicktype { | ||
| 99 | 99 | virtual ~Node() = default; |
| 100 | 100 | |
| 101 | 101 | private: |
| 102 | - Next next; | |
| 103 | 102 | std::string value; |
| 103 | + Next next; | |
| 104 | 104 | |
| 105 | 105 | public: |
| 106 | - Next get_next() const { return next; } | |
| 107 | - void set_next(Next value) { this->next = value; } | |
| 108 | - | |
| 109 | 106 | const std::string & get_value() const { return value; } |
| 110 | 107 | std::string & get_mutable_value() { return value; } |
| 111 | 108 | void set_value(const std::string & value) { this->value = value; } |
| 109 | + | |
| 110 | + Next get_next() const { return next; } | |
| 111 | + void set_next(Next value) { this->next = value; } | |
| 112 | 112 | }; |
| 113 | 113 | |
| 114 | 114 | class TopLevel { |
| @@ -117,16 +117,16 @@ namespace quicktype { | ||
| 117 | 117 | virtual ~TopLevel() = default; |
| 118 | 118 | |
| 119 | 119 | private: |
| 120 | - Next next; | |
| 121 | 120 | std::string value; |
| 121 | + Next next; | |
| 122 | 122 | |
| 123 | 123 | public: |
| 124 | - Next get_next() const { return next; } | |
| 125 | - void set_next(Next value) { this->next = value; } | |
| 126 | - | |
| 127 | 124 | const std::string & get_value() const { return value; } |
| 128 | 125 | std::string & get_mutable_value() { return value; } |
| 129 | 126 | void set_value(const std::string & value) { this->value = value; } |
| 127 | + | |
| 128 | + Next get_next() const { return next; } | |
| 129 | + void set_next(Next value) { this->next = value; } | |
| 130 | 130 | }; |
| 131 | 131 | } |
| 132 | 132 | |
| @@ -146,25 +146,25 @@ struct adl_serializer<std::variant<std::shared_ptr<quicktype::Node>, std::string | ||
| 146 | 146 | } |
| 147 | 147 | namespace quicktype { |
| 148 | 148 | inline void from_json(const json & j, Node& x) { |
| 149 | - x.set_next(get_heap_optional<std::variant<std::shared_ptr<Node>, std::string>>(j, "next")); | |
| 150 | 149 | x.set_value(j.at("value").get<std::string>()); |
| 150 | + x.set_next(get_heap_optional<std::variant<std::shared_ptr<Node>, std::string>>(j, "next")); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | inline void to_json(json & j, const Node & x) { |
| 154 | 154 | j = json::object(); |
| 155 | - j["next"] = x.get_next(); | |
| 156 | 155 | j["value"] = x.get_value(); |
| 156 | + j["next"] = x.get_next(); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | inline void from_json(const json & j, TopLevel& x) { |
| 160 | - x.set_next(get_heap_optional<std::variant<std::shared_ptr<Node>, std::string>>(j, "next")); | |
| 161 | 160 | x.set_value(j.at("value").get<std::string>()); |
| 161 | + x.set_next(get_heap_optional<std::variant<std::shared_ptr<Node>, std::string>>(j, "next")); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | inline void to_json(json & j, const TopLevel & x) { |
| 165 | 165 | j = json::object(); |
| 166 | - j["next"] = x.get_next(); | |
| 167 | 166 | j["value"] = x.get_value(); |
| 167 | + j["next"] = x.get_next(); | |
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | namespace nlohmann { |
Mschema-csharp-recordsdefault / QuickType.cs+6 −6
| @@ -25,20 +25,20 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("next")] | |
| 29 | - public Next? Next { get; set; } | |
| 30 | - | |
| 31 | 28 | [JsonProperty("value", Required = Required.Always)] |
| 32 | 29 | public string Value { get; set; } |
| 33 | - } | |
| 34 | 30 | |
| 35 | - public partial record Node | |
| 36 | - { | |
| 37 | 31 | [JsonProperty("next")] |
| 38 | 32 | public Next? Next { get; set; } |
| 33 | + } | |
| 39 | 34 | |
| 35 | + public partial record Node | |
| 36 | + { | |
| 40 | 37 | [JsonProperty("value", Required = Required.Always)] |
| 41 | 38 | public string Value { get; set; } |
| 39 | + | |
| 40 | + [JsonProperty("next")] | |
| 41 | + public Next? Next { get; set; } | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public partial struct Next |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+6 −6
| @@ -22,22 +22,22 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | - [JsonPropertyName("next")] | |
| 26 | - public Next? Next { get; set; } | |
| 27 | - | |
| 28 | 25 | [JsonRequired] |
| 29 | 26 | [JsonPropertyName("value")] |
| 30 | 27 | public string Value { get; set; } |
| 31 | - } | |
| 32 | 28 | |
| 33 | - public partial class Node | |
| 34 | - { | |
| 35 | 29 | [JsonPropertyName("next")] |
| 36 | 30 | public Next? Next { get; set; } |
| 31 | + } | |
| 37 | 32 | |
| 33 | + public partial class Node | |
| 34 | + { | |
| 38 | 35 | [JsonRequired] |
| 39 | 36 | [JsonPropertyName("value")] |
| 40 | 37 | public string Value { get; set; } |
| 38 | + | |
| 39 | + [JsonPropertyName("next")] | |
| 40 | + public Next? Next { get; set; } | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public partial struct Next |
Mschema-csharpdefault / QuickType.cs+6 −6
| @@ -25,20 +25,20 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("next")] | |
| 29 | - public Next? Next { get; set; } | |
| 30 | - | |
| 31 | 28 | [JsonProperty("value", Required = Required.Always)] |
| 32 | 29 | public string Value { get; set; } |
| 33 | - } | |
| 34 | 30 | |
| 35 | - public partial class Node | |
| 36 | - { | |
| 37 | 31 | [JsonProperty("next")] |
| 38 | 32 | public Next? Next { get; set; } |
| 33 | + } | |
| 39 | 34 | |
| 35 | + public partial class Node | |
| 36 | + { | |
| 40 | 37 | [JsonProperty("value", Required = Required.Always)] |
| 41 | 38 | public string Value { get; set; } |
| 39 | + | |
| 40 | + [JsonProperty("next")] | |
| 41 | + public Next? Next { get; set; } | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public partial struct Next |
Mschema-dartdefault / TopLevel.dart+8 −8
| @@ -9,41 +9,41 @@ TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | ||
| 9 | 9 | String topLevelToJson(TopLevel data) => json.encode(data.toJson()); |
| 10 | 10 | |
| 11 | 11 | class TopLevel { |
| 12 | - final dynamic next; | |
| 13 | 12 | final String value; |
| 13 | + final dynamic next; | |
| 14 | 14 | |
| 15 | 15 | TopLevel({ |
| 16 | - this.next, | |
| 17 | 16 | required this.value, |
| 17 | + this.next, | |
| 18 | 18 | }); |
| 19 | 19 | |
| 20 | 20 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 21 | - next: json["next"], | |
| 22 | 21 | value: json["value"], |
| 22 | + next: json["next"], | |
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | Map<String, dynamic> toJson() => { |
| 26 | - "next": next, | |
| 27 | 26 | "value": value, |
| 27 | + "next": next, | |
| 28 | 28 | }; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | class Node { |
| 32 | - final dynamic next; | |
| 33 | 32 | final String value; |
| 33 | + final dynamic next; | |
| 34 | 34 | |
| 35 | 35 | Node({ |
| 36 | - this.next, | |
| 37 | 36 | required this.value, |
| 37 | + this.next, | |
| 38 | 38 | }); |
| 39 | 39 | |
| 40 | 40 | factory Node.fromJson(Map<String, dynamic> json) => Node( |
| 41 | - next: json["next"], | |
| 42 | 41 | value: json["value"], |
| 42 | + next: json["next"], | |
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | 45 | Map<String, dynamic> toJson() => { |
| 46 | - "next": next, | |
| 47 | 46 | "value": value, |
| 47 | + "next": next, | |
| 48 | 48 | }; |
| 49 | 49 | } |
Mschema-elixirdefault / QuickType.ex+10 −10
| @@ -7,11 +7,11 @@ | ||
| 7 | 7 | |
| 8 | 8 | defmodule NodeClass do |
| 9 | 9 | @enforce_keys [:value] |
| 10 | - defstruct [:next, :value] | |
| 10 | + defstruct [:value, :next] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | - next: NodeClass.t() | nil | String.t() | nil, | |
| 14 | - value: String.t() | |
| 13 | + value: String.t(), | |
| 14 | + next: NodeClass.t() | nil | String.t() | nil | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | def decode_next(%{"value" => _,} = value), do: NodeClass.from_map(value) |
| @@ -26,8 +26,8 @@ defmodule NodeClass do | ||
| 26 | 26 | |
| 27 | 27 | def from_map(m) do |
| 28 | 28 | %NodeClass{ |
| 29 | - next: decode_next(m["next"]), | |
| 30 | 29 | value: m["value"], |
| 30 | + next: decode_next(m["next"]), | |
| 31 | 31 | } |
| 32 | 32 | end |
| 33 | 33 | |
| @@ -39,8 +39,8 @@ defmodule NodeClass do | ||
| 39 | 39 | |
| 40 | 40 | def to_map(struct) do |
| 41 | 41 | %{ |
| 42 | - "next" => encode_next(struct.next), | |
| 43 | 42 | "value" => struct.value, |
| 43 | + "next" => encode_next(struct.next), | |
| 44 | 44 | } |
| 45 | 45 | end |
| 46 | 46 | |
| @@ -53,11 +53,11 @@ end | ||
| 53 | 53 | |
| 54 | 54 | defmodule TopLevel do |
| 55 | 55 | @enforce_keys [:value] |
| 56 | - defstruct [:next, :value] | |
| 56 | + defstruct [:value, :next] | |
| 57 | 57 | |
| 58 | 58 | @type t :: %__MODULE__{ |
| 59 | - next: NodeClass.t() | nil | String.t() | nil, | |
| 60 | - value: String.t() | |
| 59 | + value: String.t(), | |
| 60 | + next: NodeClass.t() | nil | String.t() | nil | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | def decode_next(%{"value" => _,} = value), do: NodeClass.from_map(value) |
| @@ -72,8 +72,8 @@ defmodule TopLevel do | ||
| 72 | 72 | |
| 73 | 73 | def from_map(m) do |
| 74 | 74 | %TopLevel{ |
| 75 | - next: decode_next(m["next"]), | |
| 76 | 75 | value: m["value"], |
| 76 | + next: decode_next(m["next"]), | |
| 77 | 77 | } |
| 78 | 78 | end |
| 79 | 79 | |
| @@ -85,8 +85,8 @@ defmodule TopLevel do | ||
| 85 | 85 | |
| 86 | 86 | def to_map(struct) do |
| 87 | 87 | %{ |
| 88 | - "next" => encode_next(struct.next), | |
| 89 | 88 | "value" => struct.value, |
| 89 | + "next" => encode_next(struct.next), | |
| 90 | 90 | } |
| 91 | 91 | end |
Mschema-flowdefault / TopLevel.js+4 −4
| @@ -10,14 +10,14 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - next?: Next; | |
| 14 | 13 | value: string; |
| 14 | + next?: Next; | |
| 15 | 15 | [property: string]: mixed; |
| 16 | 16 | }; |
| 17 | 17 | |
| 18 | 18 | export type Node = { |
| 19 | - next?: Next; | |
| 20 | 19 | value: string; |
| 20 | + next?: Next; | |
| 21 | 21 | [property: string]: mixed; |
| 22 | 22 | }; |
| 23 | 23 | |
| @@ -188,12 +188,12 @@ function r(name: string) { | ||
| 188 | 188 | |
| 189 | 189 | const typeMap: any = { |
| 190 | 190 | "TopLevel": o([ |
| 191 | - { json: "next", js: "next", typ: u(undefined, u(null, r("Node"), "")) }, | |
| 192 | 191 | { json: "value", js: "value", typ: "" }, |
| 192 | + { json: "next", js: "next", typ: u(undefined, u(null, r("Node"), "")) }, | |
| 193 | 193 | ], "any"), |
| 194 | 194 | "Node": o([ |
| 195 | - { json: "next", js: "next", typ: u(undefined, u(null, r("Node"), "")) }, | |
| 196 | 195 | { json: "value", js: "value", typ: "" }, |
| 196 | + { json: "next", js: "next", typ: u(undefined, u(null, r("Node"), "")) }, | |
| 197 | 197 | ], "any"), |
| 198 | 198 | }; |
Mschema-golangdefault / quicktype.go+2 −2
| @@ -22,13 +22,13 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | type TopLevel struct { |
| 25 | - Next *Next `json:"next"` | |
| 26 | 25 | Value string `json:"value"` |
| 26 | + Next *Next `json:"next"` | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | type Node struct { |
| 30 | - Next *Next `json:"next"` | |
| 31 | 30 | Value string `json:"value"` |
| 31 | + Next *Next `json:"next"` | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | type Next struct { |
Mschema-haskelldefault / QuickType.hs+14 −14
| @@ -15,13 +15,13 @@ import Data.HashMap.Strict (HashMap) | ||
| 15 | 15 | import Data.Text (Text) |
| 16 | 16 | |
| 17 | 17 | data QuickType = QuickType |
| 18 | - { nextQuickType :: Maybe Next | |
| 19 | - , valueQuickType :: Text | |
| 18 | + { valueQuickType :: Text | |
| 19 | + , nextQuickType :: Maybe Next | |
| 20 | 20 | } deriving (Show) |
| 21 | 21 | |
| 22 | 22 | data Node = Node |
| 23 | - { nextNode :: Maybe Next | |
| 24 | - , valueNode :: Text | |
| 23 | + { valueNode :: Text | |
| 24 | + , nextNode :: Maybe Next | |
| 25 | 25 | } deriving (Show) |
| 26 | 26 | |
| 27 | 27 | data Next |
| @@ -34,28 +34,28 @@ decodeTopLevel :: ByteString -> Maybe QuickType | ||
| 34 | 34 | decodeTopLevel = decode |
| 35 | 35 | |
| 36 | 36 | instance ToJSON QuickType where |
| 37 | - toJSON (QuickType nextQuickType valueQuickType) = | |
| 37 | + toJSON (QuickType valueQuickType nextQuickType) = | |
| 38 | 38 | object |
| 39 | - [ "next" .= nextQuickType | |
| 40 | - , "value" .= valueQuickType | |
| 39 | + [ "value" .= valueQuickType | |
| 40 | + , "next" .= nextQuickType | |
| 41 | 41 | ] |
| 42 | 42 | |
| 43 | 43 | instance FromJSON QuickType where |
| 44 | 44 | parseJSON (Object v) = QuickType |
| 45 | - <$> v .:? "next" | |
| 46 | - <*> v .: "value" | |
| 45 | + <$> v .: "value" | |
| 46 | + <*> v .:? "next" | |
| 47 | 47 | |
| 48 | 48 | instance ToJSON Node where |
| 49 | - toJSON (Node nextNode valueNode) = | |
| 49 | + toJSON (Node valueNode nextNode) = | |
| 50 | 50 | object |
| 51 | - [ "next" .= nextNode | |
| 52 | - , "value" .= valueNode | |
| 51 | + [ "value" .= valueNode | |
| 52 | + , "next" .= nextNode | |
| 53 | 53 | ] |
| 54 | 54 | |
| 55 | 55 | instance FromJSON Node where |
| 56 | 56 | parseJSON (Object v) = Node |
| 57 | - <$> v .:? "next" | |
| 58 | - <*> v .: "value" | |
| 57 | + <$> v .: "value" | |
| 58 | + <*> v .:? "next" | |
| 59 | 59 | |
| 60 | 60 | instance ToJSON Next where |
| 61 | 61 | toJSON (NodeInNext x) = toJSON x |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / Node.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Node { |
| 6 | - private Next next; | |
| 7 | 6 | private String value; |
| 8 | - | |
| 9 | - @JsonProperty("next") | |
| 10 | - public Next getNext() { return next; } | |
| 11 | - @JsonProperty("next") | |
| 12 | - public void setNext(Next value) { this.next = value; } | |
| 7 | + private Next next; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("value") |
| 15 | 10 | public String getValue() { return value; } |
| 16 | 11 | @JsonProperty("value") |
| 17 | 12 | public void setValue(String value) { this.value = value; } |
| 13 | + | |
| 14 | + @JsonProperty("next") | |
| 15 | + public Next getNext() { return next; } | |
| 16 | + @JsonProperty("next") | |
| 17 | + public void setNext(Next value) { this.next = value; } | |
| 18 | 18 | } |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private Next next; | |
| 7 | 6 | private String value; |
| 8 | - | |
| 9 | - @JsonProperty("next") | |
| 10 | - public Next getNext() { return next; } | |
| 11 | - @JsonProperty("next") | |
| 12 | - public void setNext(Next value) { this.next = value; } | |
| 7 | + private Next next; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("value") |
| 15 | 10 | public String getValue() { return value; } |
| 16 | 11 | @JsonProperty("value") |
| 17 | 12 | public void setValue(String value) { this.value = value; } |
| 13 | + | |
| 14 | + @JsonProperty("next") | |
| 15 | + public Next getNext() { return next; } | |
| 16 | + @JsonProperty("next") | |
| 17 | + public void setNext(Next value) { this.next = value; } | |
| 18 | 18 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / Node.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Node { |
| 6 | - private Next next; | |
| 7 | 6 | private String value; |
| 8 | - | |
| 9 | - @JsonProperty("next") | |
| 10 | - public Next getNext() { return next; } | |
| 11 | - @JsonProperty("next") | |
| 12 | - public void setNext(Next value) { this.next = value; } | |
| 7 | + private Next next; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("value") |
| 15 | 10 | public String getValue() { return value; } |
| 16 | 11 | @JsonProperty("value") |
| 17 | 12 | public void setValue(String value) { this.value = value; } |
| 13 | + | |
| 14 | + @JsonProperty("next") | |
| 15 | + public Next getNext() { return next; } | |
| 16 | + @JsonProperty("next") | |
| 17 | + public void setNext(Next value) { this.next = value; } | |
| 18 | 18 | } |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private Next next; | |
| 7 | 6 | private String value; |
| 8 | - | |
| 9 | - @JsonProperty("next") | |
| 10 | - public Next getNext() { return next; } | |
| 11 | - @JsonProperty("next") | |
| 12 | - public void setNext(Next value) { this.next = value; } | |
| 7 | + private Next next; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("value") |
| 15 | 10 | public String getValue() { return value; } |
| 16 | 11 | @JsonProperty("value") |
| 17 | 12 | public void setValue(String value) { this.value = value; } |
| 13 | + | |
| 14 | + @JsonProperty("next") | |
| 15 | + public Next getNext() { return next; } | |
| 16 | + @JsonProperty("next") | |
| 17 | + public void setNext(Next value) { this.next = value; } | |
| 18 | 18 | } |
Mschema-javadefault / src / main / java / io / quicktype / Node.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class Node { |
| 6 | - private Next next; | |
| 7 | 6 | private String value; |
| 8 | - | |
| 9 | - @JsonProperty("next") | |
| 10 | - public Next getNext() { return next; } | |
| 11 | - @JsonProperty("next") | |
| 12 | - public void setNext(Next value) { this.next = value; } | |
| 7 | + private Next next; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("value") |
| 15 | 10 | public String getValue() { return value; } |
| 16 | 11 | @JsonProperty("value") |
| 17 | 12 | public void setValue(String value) { this.value = value; } |
| 13 | + | |
| 14 | + @JsonProperty("next") | |
| 15 | + public Next getNext() { return next; } | |
| 16 | + @JsonProperty("next") | |
| 17 | + public void setNext(Next value) { this.next = value; } | |
| 18 | 18 | } |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+6 −6
| @@ -3,16 +3,16 @@ package io.quicktype; | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.*; |
| 4 | 4 | |
| 5 | 5 | public class TopLevel { |
| 6 | - private Next next; | |
| 7 | 6 | private String value; |
| 8 | - | |
| 9 | - @JsonProperty("next") | |
| 10 | - public Next getNext() { return next; } | |
| 11 | - @JsonProperty("next") | |
| 12 | - public void setNext(Next value) { this.next = value; } | |
| 7 | + private Next next; | |
| 13 | 8 | |
| 14 | 9 | @JsonProperty("value") |
| 15 | 10 | public String getValue() { return value; } |
| 16 | 11 | @JsonProperty("value") |
| 17 | 12 | public void setValue(String value) { this.value = value; } |
| 13 | + | |
| 14 | + @JsonProperty("next") | |
| 15 | + public Next getNext() { return next; } | |
| 16 | + @JsonProperty("next") | |
| 17 | + public void setNext(Next value) { this.next = value; } | |
| 18 | 18 | } |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -172,12 +172,12 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "next", js: "next", typ: u(undefined, u(null, r("Node"), "")) }, | |
| 176 | 175 | { json: "value", js: "value", typ: "" }, |
| 176 | + { json: "next", js: "next", typ: u(undefined, u(null, r("Node"), "")) }, | |
| 177 | 177 | ], "any"), |
| 178 | 178 | "Node": o([ |
| 179 | - { json: "next", js: "next", typ: u(undefined, u(null, r("Node"), "")) }, | |
| 180 | 179 | { json: "value", js: "value", typ: "" }, |
| 180 | + { json: "next", js: "next", typ: u(undefined, u(null, r("Node"), "")) }, | |
| 181 | 181 | ], "any"), |
| 182 | 182 | }; |
Mschema-kotlin-jacksondefault / TopLevel.kt+6 −6
| @@ -31,10 +31,10 @@ val mapper = jacksonObjectMapper().apply { | ||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | data class TopLevel ( |
| 34 | - val next: Next? = null, | |
| 35 | - | |
| 36 | 34 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 37 | - val value: String | |
| 35 | + val value: String, | |
| 36 | + | |
| 37 | + val next: Next? = null | |
| 38 | 38 | ) { |
| 39 | 39 | fun toJson() = mapper.writeValueAsString(this) |
| 40 | 40 | |
| @@ -44,10 +44,10 @@ data class TopLevel ( | ||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | data class Node ( |
| 47 | - val next: Next? = null, | |
| 48 | - | |
| 49 | 47 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 50 | - val value: String | |
| 48 | + val value: String, | |
| 49 | + | |
| 50 | + val next: Next? = null | |
| 51 | 51 | ) |
| 52 | 52 | |
| 53 | 53 | sealed class Next { |
Mschema-kotlindefault / TopLevel.kt+4 −4
| @@ -18,8 +18,8 @@ private val klaxon = Klaxon() | ||
| 18 | 18 | .convert(Next::class, { Next.fromJson(it) }, { it.toJson() }, true) |
| 19 | 19 | |
| 20 | 20 | data class TopLevel ( |
| 21 | - val next: Next? = null, | |
| 22 | - val value: String | |
| 21 | + val value: String, | |
| 22 | + val next: Next? = null | |
| 23 | 23 | ) { |
| 24 | 24 | public fun toJson() = klaxon.toJsonString(this) |
| 25 | 25 | |
| @@ -29,8 +29,8 @@ data class TopLevel ( | ||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | data class Node ( |
| 32 | - val next: Next? = null, | |
| 33 | - val value: String | |
| 32 | + val value: String, | |
| 33 | + val next: Next? = null | |
| 34 | 34 | ) |
| 35 | 35 | |
| 36 | 36 | sealed class Next { |
Mschema-phpdefault / TopLevel.php+118 −118
| @@ -4,16 +4,63 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private Node|string|null $next; // json:next Optional | |
| 8 | 7 | private string $value; // json:value Required |
| 8 | + private Node|string|null $next; // json:next Optional | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | - * @param Node|string|null $next | |
| 12 | 11 | * @param string $value |
| 12 | + * @param Node|string|null $next | |
| 13 | 13 | */ |
| 14 | - public function __construct(Node|string|null $next, string $value) { | |
| 15 | - $this->next = $next; | |
| 14 | + public function __construct(string $value, Node|string|null $next) { | |
| 16 | 15 | $this->value = $value; |
| 16 | + $this->next = $next; | |
| 17 | + } | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * @param string $value | |
| 21 | + * @throws Exception | |
| 22 | + * @return string | |
| 23 | + */ | |
| 24 | + public static function fromValue(string $value): string { | |
| 25 | + return $value; /*string*/ | |
| 26 | + } | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * @throws Exception | |
| 30 | + * @return string | |
| 31 | + */ | |
| 32 | + public function toValue(): string { | |
| 33 | + if (TopLevel::validateValue($this->value)) { | |
| 34 | + return $this->value; /*string*/ | |
| 35 | + } | |
| 36 | + throw new Exception('never get to this TopLevel::value'); | |
| 37 | + } | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * @param string | |
| 41 | + * @return bool | |
| 42 | + * @throws Exception | |
| 43 | + */ | |
| 44 | + public static function validateValue(string $value): bool { | |
| 45 | + return true; | |
| 46 | + } | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * @throws Exception | |
| 50 | + * @return string | |
| 51 | + */ | |
| 52 | + public function getValue(): string { | |
| 53 | + if (TopLevel::validateValue($this->value)) { | |
| 54 | + return $this->value; | |
| 55 | + } | |
| 56 | + throw new Exception('never get to getValue TopLevel::value'); | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * @return string | |
| 61 | + */ | |
| 62 | + public static function sampleValue(): string { | |
| 63 | + return 'TopLevel::value::31'; /*31:value*/ | |
| 17 | 64 | } |
| 18 | 65 | |
| 19 | 66 | /** |
| @@ -89,54 +136,7 @@ class TopLevel { | ||
| 89 | 136 | * @return Node|string|null |
| 90 | 137 | */ |
| 91 | 138 | public static function sampleNext(): Node|string|null { |
| 92 | - return Node::sample(); /*31:next*/ | |
| 93 | - } | |
| 94 | - | |
| 95 | - /** | |
| 96 | - * @param string $value | |
| 97 | - * @throws Exception | |
| 98 | - * @return string | |
| 99 | - */ | |
| 100 | - public static function fromValue(string $value): string { | |
| 101 | - return $value; /*string*/ | |
| 102 | - } | |
| 103 | - | |
| 104 | - /** | |
| 105 | - * @throws Exception | |
| 106 | - * @return string | |
| 107 | - */ | |
| 108 | - public function toValue(): string { | |
| 109 | - if (TopLevel::validateValue($this->value)) { | |
| 110 | - return $this->value; /*string*/ | |
| 111 | - } | |
| 112 | - throw new Exception('never get to this TopLevel::value'); | |
| 113 | - } | |
| 114 | - | |
| 115 | - /** | |
| 116 | - * @param string | |
| 117 | - * @return bool | |
| 118 | - * @throws Exception | |
| 119 | - */ | |
| 120 | - public static function validateValue(string $value): bool { | |
| 121 | - return true; | |
| 122 | - } | |
| 123 | - | |
| 124 | - /** | |
| 125 | - * @throws Exception | |
| 126 | - * @return string | |
| 127 | - */ | |
| 128 | - public function getValue(): string { | |
| 129 | - if (TopLevel::validateValue($this->value)) { | |
| 130 | - return $this->value; | |
| 131 | - } | |
| 132 | - throw new Exception('never get to getValue TopLevel::value'); | |
| 133 | - } | |
| 134 | - | |
| 135 | - /** | |
| 136 | - * @return string | |
| 137 | - */ | |
| 138 | - public static function sampleValue(): string { | |
| 139 | - return 'TopLevel::value::32'; /*32:value*/ | |
| 139 | + return Node::sample(); /*32:next*/ | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
| @@ -144,8 +144,8 @@ class TopLevel { | ||
| 144 | 144 | * @return bool |
| 145 | 145 | */ |
| 146 | 146 | public function validate(): bool { |
| 147 | - return TopLevel::validateNext($this->next) | |
| 148 | - || TopLevel::validateValue($this->value); | |
| 147 | + return TopLevel::validateValue($this->value) | |
| 148 | + || TopLevel::validateNext($this->next); | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
| @@ -154,8 +154,8 @@ class TopLevel { | ||
| 154 | 154 | */ |
| 155 | 155 | public function to(): stdClass { |
| 156 | 156 | $out = new stdClass(); |
| 157 | - $out->{'next'} = $this->toNext(); | |
| 158 | 157 | $out->{'value'} = $this->toValue(); |
| 158 | + $out->{'next'} = $this->toNext(); | |
| 159 | 159 | return $out; |
| 160 | 160 | } |
| 161 | 161 | |
| @@ -166,8 +166,8 @@ class TopLevel { | ||
| 166 | 166 | */ |
| 167 | 167 | public static function from(stdClass $obj): TopLevel { |
| 168 | 168 | return new TopLevel( |
| 169 | - TopLevel::fromNext($obj->{'next'}) | |
| 170 | - ,TopLevel::fromValue($obj->{'value'}) | |
| 169 | + TopLevel::fromValue($obj->{'value'}) | |
| 170 | + ,TopLevel::fromNext($obj->{'next'}) | |
| 171 | 171 | ); |
| 172 | 172 | } |
| 173 | 173 | |
| @@ -176,8 +176,8 @@ class TopLevel { | ||
| 176 | 176 | */ |
| 177 | 177 | public static function sample(): TopLevel { |
| 178 | 178 | return new TopLevel( |
| 179 | - TopLevel::sampleNext() | |
| 180 | - ,TopLevel::sampleValue() | |
| 179 | + TopLevel::sampleValue() | |
| 180 | + ,TopLevel::sampleNext() | |
| 181 | 181 | ); |
| 182 | 182 | } |
| 183 | 183 | } |
| @@ -185,16 +185,63 @@ class TopLevel { | ||
| 185 | 185 | // This is an autogenerated file:Node |
| 186 | 186 | |
| 187 | 187 | class Node { |
| 188 | - private Node|string|null $next; // json:next Optional | |
| 189 | 188 | private string $value; // json:value Required |
| 189 | + private Node|string|null $next; // json:next Optional | |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * @param Node|string|null $next | |
| 193 | 192 | * @param string $value |
| 193 | + * @param Node|string|null $next | |
| 194 | 194 | */ |
| 195 | - public function __construct(Node|string|null $next, string $value) { | |
| 196 | - $this->next = $next; | |
| 195 | + public function __construct(string $value, Node|string|null $next) { | |
| 197 | 196 | $this->value = $value; |
| 197 | + $this->next = $next; | |
| 198 | + } | |
| 199 | + | |
| 200 | + /** | |
| 201 | + * @param string $value | |
| 202 | + * @throws Exception | |
| 203 | + * @return string | |
| 204 | + */ | |
| 205 | + public static function fromValue(string $value): string { | |
| 206 | + return $value; /*string*/ | |
| 207 | + } | |
| 208 | + | |
| 209 | + /** | |
| 210 | + * @throws Exception | |
| 211 | + * @return string | |
| 212 | + */ | |
| 213 | + public function toValue(): string { | |
| 214 | + if (Node::validateValue($this->value)) { | |
| 215 | + return $this->value; /*string*/ | |
| 216 | + } | |
| 217 | + throw new Exception('never get to this Node::value'); | |
| 218 | + } | |
| 219 | + | |
| 220 | + /** | |
| 221 | + * @param string | |
| 222 | + * @return bool | |
| 223 | + * @throws Exception | |
| 224 | + */ | |
| 225 | + public static function validateValue(string $value): bool { | |
| 226 | + return true; | |
| 227 | + } | |
| 228 | + | |
| 229 | + /** | |
| 230 | + * @throws Exception | |
| 231 | + * @return string | |
| 232 | + */ | |
| 233 | + public function getValue(): string { | |
| 234 | + if (Node::validateValue($this->value)) { | |
| 235 | + return $this->value; | |
| 236 | + } | |
| 237 | + throw new Exception('never get to getValue Node::value'); | |
| 238 | + } | |
| 239 | + | |
| 240 | + /** | |
| 241 | + * @return string | |
| 242 | + */ | |
| 243 | + public static function sampleValue(): string { | |
| 244 | + return 'Node::value::31'; /*31:value*/ | |
| 198 | 245 | } |
| 199 | 246 | |
| 200 | 247 | /** |
| @@ -270,54 +317,7 @@ class Node { | ||
| 270 | 317 | * @return Node|string|null |
| 271 | 318 | */ |
| 272 | 319 | public static function sampleNext(): Node|string|null { |
| 273 | - return Node::sample(); /*31:next*/ | |
| 274 | - } | |
| 275 | - | |
| 276 | - /** | |
| 277 | - * @param string $value | |
| 278 | - * @throws Exception | |
| 279 | - * @return string | |
| 280 | - */ | |
| 281 | - public static function fromValue(string $value): string { | |
| 282 | - return $value; /*string*/ | |
| 283 | - } | |
| 284 | - | |
| 285 | - /** | |
| 286 | - * @throws Exception | |
| 287 | - * @return string | |
| 288 | - */ | |
| 289 | - public function toValue(): string { | |
| 290 | - if (Node::validateValue($this->value)) { | |
| 291 | - return $this->value; /*string*/ | |
| 292 | - } | |
| 293 | - throw new Exception('never get to this Node::value'); | |
| 294 | - } | |
| 295 | - | |
| 296 | - /** | |
| 297 | - * @param string | |
| 298 | - * @return bool | |
| 299 | - * @throws Exception | |
| 300 | - */ | |
| 301 | - public static function validateValue(string $value): bool { | |
| 302 | - return true; | |
| 303 | - } | |
| 304 | - | |
| 305 | - /** | |
| 306 | - * @throws Exception | |
| 307 | - * @return string | |
| 308 | - */ | |
| 309 | - public function getValue(): string { | |
| 310 | - if (Node::validateValue($this->value)) { | |
| 311 | - return $this->value; | |
| 312 | - } | |
| 313 | - throw new Exception('never get to getValue Node::value'); | |
| 314 | - } | |
| 315 | - | |
| 316 | - /** | |
| 317 | - * @return string | |
| 318 | - */ | |
| 319 | - public static function sampleValue(): string { | |
| 320 | - return 'Node::value::32'; /*32:value*/ | |
| 320 | + return Node::sample(); /*32:next*/ | |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
| @@ -325,8 +325,8 @@ class Node { | ||
| 325 | 325 | * @return bool |
| 326 | 326 | */ |
| 327 | 327 | public function validate(): bool { |
| 328 | - return Node::validateNext($this->next) | |
| 329 | - || Node::validateValue($this->value); | |
| 328 | + return Node::validateValue($this->value) | |
| 329 | + || Node::validateNext($this->next); | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | /** |
| @@ -335,8 +335,8 @@ class Node { | ||
| 335 | 335 | */ |
| 336 | 336 | public function to(): stdClass { |
| 337 | 337 | $out = new stdClass(); |
| 338 | - $out->{'next'} = $this->toNext(); | |
| 339 | 338 | $out->{'value'} = $this->toValue(); |
| 339 | + $out->{'next'} = $this->toNext(); | |
| 340 | 340 | return $out; |
| 341 | 341 | } |
| 342 | 342 | |
| @@ -347,8 +347,8 @@ class Node { | ||
| 347 | 347 | */ |
| 348 | 348 | public static function from(stdClass $obj): Node { |
| 349 | 349 | return new Node( |
| 350 | - Node::fromNext($obj->{'next'}) | |
| 351 | - ,Node::fromValue($obj->{'value'}) | |
| 350 | + Node::fromValue($obj->{'value'}) | |
| 351 | + ,Node::fromNext($obj->{'next'}) | |
| 352 | 352 | ); |
| 353 | 353 | } |
| 354 | 354 | |
| @@ -357,8 +357,8 @@ class Node { | ||
| 357 | 357 | */ |
| 358 | 358 | public static function sample(): Node { |
| 359 | 359 | return new Node( |
| 360 | - Node::sampleNext() | |
| 361 | - ,Node::sampleValue() | |
| 360 | + Node::sampleValue() | |
| 361 | + ,Node::sampleNext() | |
| 362 | 362 | ); |
| 363 | 363 | } |
| 364 | 364 | } |
Mschema-pikedefault / TopLevel.pmod+6 −6
| @@ -13,13 +13,13 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - Next next; // json: "next" | |
| 17 | 16 | string value; // json: "value" |
| 17 | + Next next; // json: "next" | |
| 18 | 18 | |
| 19 | 19 | string encode_json() { |
| 20 | 20 | mapping(string:mixed) json = ([ |
| 21 | - "next" : next, | |
| 22 | 21 | "value" : value, |
| 22 | + "next" : next, | |
| 23 | 23 | ]); |
| 24 | 24 | |
| 25 | 25 | return Standards.JSON.encode(json); |
| @@ -29,20 +29,20 @@ class TopLevel { | ||
| 29 | 29 | TopLevel TopLevel_from_JSON(mixed json) { |
| 30 | 30 | TopLevel retval = TopLevel(); |
| 31 | 31 | |
| 32 | - retval.next = json["next"]; | |
| 33 | 32 | retval.value = json["value"]; |
| 33 | + retval.next = json["next"]; | |
| 34 | 34 | |
| 35 | 35 | return retval; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | class Node { |
| 39 | - Next next; // json: "next" | |
| 40 | 39 | string value; // json: "value" |
| 40 | + Next next; // json: "next" | |
| 41 | 41 | |
| 42 | 42 | string encode_json() { |
| 43 | 43 | mapping(string:mixed) json = ([ |
| 44 | - "next" : next, | |
| 45 | 44 | "value" : value, |
| 45 | + "next" : next, | |
| 46 | 46 | ]); |
| 47 | 47 | |
| 48 | 48 | return Standards.JSON.encode(json); |
| @@ -52,8 +52,8 @@ class Node { | ||
| 52 | 52 | Node Node_from_JSON(mixed json) { |
| 53 | 53 | Node retval = Node(); |
| 54 | 54 | |
| 55 | - retval.next = json["next"]; | |
| 56 | 55 | retval.value = json["value"]; |
| 56 | + retval.next = json["next"]; | |
| 57 | 57 | |
| 58 | 58 | return retval; |
| 59 | 59 | } |
Mschema-rubydefault / TopLevel.rb+7 −7
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.top_level_next | |
| 7 | +# puts top_level.value | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -65,14 +65,14 @@ class Next < Dry::Struct | ||
| 65 | 65 | end |
| 66 | 66 | |
| 67 | 67 | class Node < Dry::Struct |
| 68 | - attribute :node_next, Types.Instance(Next).optional | |
| 69 | 68 | attribute :value, Types::String |
| 69 | + attribute :node_next, Types.Instance(Next).optional | |
| 70 | 70 | |
| 71 | 71 | def self.from_dynamic!(d) |
| 72 | 72 | d = Types::Hash[d] |
| 73 | 73 | new( |
| 74 | - node_next: d["next"] ? Next.from_dynamic!(d["next"]) : nil, | |
| 75 | 74 | value: d.fetch("value"), |
| 75 | + node_next: d["next"] ? Next.from_dynamic!(d["next"]) : nil, | |
| 76 | 76 | ) |
| 77 | 77 | end |
| 78 | 78 | |
| @@ -82,8 +82,8 @@ class Node < Dry::Struct | ||
| 82 | 82 | |
| 83 | 83 | def to_dynamic |
| 84 | 84 | { |
| 85 | - "next" => node_next&.to_dynamic, | |
| 86 | 85 | "value" => value, |
| 86 | + "next" => node_next&.to_dynamic, | |
| 87 | 87 | } |
| 88 | 88 | end |
| 89 | 89 | |
| @@ -93,14 +93,14 @@ class Node < Dry::Struct | ||
| 93 | 93 | end |
| 94 | 94 | |
| 95 | 95 | class TopLevel < Dry::Struct |
| 96 | - attribute :top_level_next, Types.Instance(Next).optional | |
| 97 | 96 | attribute :value, Types::String |
| 97 | + attribute :top_level_next, Types.Instance(Next).optional | |
| 98 | 98 | |
| 99 | 99 | def self.from_dynamic!(d) |
| 100 | 100 | d = Types::Hash[d] |
| 101 | 101 | new( |
| 102 | - top_level_next: d["next"] ? Next.from_dynamic!(d["next"]) : nil, | |
| 103 | 102 | value: d.fetch("value"), |
| 103 | + top_level_next: d["next"] ? Next.from_dynamic!(d["next"]) : nil, | |
| 104 | 104 | ) |
| 105 | 105 | end |
| 106 | 106 | |
| @@ -110,8 +110,8 @@ class TopLevel < Dry::Struct | ||
| 110 | 110 | |
| 111 | 111 | def to_dynamic |
| 112 | 112 | { |
| 113 | - "next" => top_level_next&.to_dynamic, | |
| 114 | 113 | "value" => value, |
| 114 | + "next" => top_level_next&.to_dynamic, | |
| 115 | 115 | } |
| 116 | 116 | end |
Mschema-rustdefault / module_under_test.rs+4 −4
| @@ -15,16 +15,16 @@ use serde::{Serialize, Deserialize}; | ||
| 15 | 15 | |
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | pub struct TopLevel { |
| 18 | - pub next: Option<Box<Next>>, | |
| 19 | - | |
| 20 | 18 | pub value: String, |
| 19 | + | |
| 20 | + pub next: Option<Box<Next>>, | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 24 | 24 | pub struct Node { |
| 25 | - pub next: Option<Box<Next>>, | |
| 26 | - | |
| 27 | 25 | pub value: String, |
| 26 | + | |
| 27 | + pub next: Option<Box<Next>>, | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | #[derive(Debug, Clone, Serialize, Deserialize)] |
Mschema-scala3-upickledefault / TopLevel.scala+4 −4
| @@ -66,13 +66,13 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val next : Option[Next] = None, | |
| 70 | - val value : String | |
| 69 | + val value : String, | |
| 70 | + val next : Option[Next] = None | |
| 71 | 71 | ) derives OptionPickler.ReadWriter |
| 72 | 72 | |
| 73 | 73 | case class Node ( |
| 74 | - val next : Option[Next] = None, | |
| 75 | - val value : String | |
| 74 | + val value : String, | |
| 75 | + val next : Option[Next] = None | |
| 76 | 76 | ) derives OptionPickler.ReadWriter |
| 77 | 77 | |
| 78 | 78 | type Next = Node | String | NullValue |
Mschema-scala3default / TopLevel.scala+4 −4
| @@ -8,13 +8,13 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val next : Option[Next] = None, | |
| 12 | - val value : String | |
| 11 | + val value : String, | |
| 12 | + val next : Option[Next] = None | |
| 13 | 13 | ) derives Encoder.AsObject, Decoder |
| 14 | 14 | |
| 15 | 15 | case class Node ( |
| 16 | - val next : Option[Next] = None, | |
| 17 | - val value : String | |
| 16 | + val value : String, | |
| 17 | + val next : Option[Next] = None | |
| 18 | 18 | ) derives Encoder.AsObject, Decoder |
| 19 | 19 | |
| 20 | 20 | type Next = Node | String | NullValue |
Mschema-schemadefault / TopLevel.schema+6 −6
| @@ -6,11 +6,11 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": {}, |
| 8 | 8 | "properties": { |
| 9 | - "next": { | |
| 10 | - "$ref": "#/definitions/Next" | |
| 11 | - }, | |
| 12 | 9 | "value": { |
| 13 | 10 | "type": "string" |
| 11 | + }, | |
| 12 | + "next": { | |
| 13 | + "$ref": "#/definitions/Next" | |
| 14 | 14 | } |
| 15 | 15 | }, |
| 16 | 16 | "required": [ |
| @@ -22,11 +22,11 @@ | ||
| 22 | 22 | "type": "object", |
| 23 | 23 | "additionalProperties": {}, |
| 24 | 24 | "properties": { |
| 25 | - "next": { | |
| 26 | - "$ref": "#/definitions/Next" | |
| 27 | - }, | |
| 28 | 25 | "value": { |
| 29 | 26 | "type": "string" |
| 27 | + }, | |
| 28 | + "next": { | |
| 29 | + "$ref": "#/definitions/Next" | |
| 30 | 30 | } |
| 31 | 31 | }, |
| 32 | 32 | "required": [ |
Mschema-swiftdefault / quicktype.swift+12 −12
| @@ -7,12 +7,12 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | - let next: Next? | |
| 11 | 10 | let value: String |
| 11 | + let next: Next? | |
| 12 | 12 | |
| 13 | 13 | enum CodingKeys: String, CodingKey { |
| 14 | - case next = "next" | |
| 15 | 14 | case value = "value" |
| 15 | + case next = "next" | |
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | |
| @@ -35,12 +35,12 @@ extension TopLevel { | ||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | func with( |
| 38 | - next: Next?? = nil, | |
| 39 | - value: String? = nil | |
| 38 | + value: String? = nil, | |
| 39 | + next: Next?? = nil | |
| 40 | 40 | ) -> TopLevel { |
| 41 | 41 | return TopLevel( |
| 42 | - next: next ?? self.next, | |
| 43 | - value: value ?? self.value | |
| 42 | + value: value ?? self.value, | |
| 43 | + next: next ?? self.next | |
| 44 | 44 | ) |
| 45 | 45 | } |
| 46 | 46 | |
| @@ -55,12 +55,12 @@ extension TopLevel { | ||
| 55 | 55 | |
| 56 | 56 | // MARK: - Node |
| 57 | 57 | struct Node: Codable { |
| 58 | - let next: Next? | |
| 59 | 58 | let value: String |
| 59 | + let next: Next? | |
| 60 | 60 | |
| 61 | 61 | enum CodingKeys: String, CodingKey { |
| 62 | - case next = "next" | |
| 63 | 62 | case value = "value" |
| 63 | + case next = "next" | |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| @@ -83,12 +83,12 @@ extension Node { | ||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | func with( |
| 86 | - next: Next?? = nil, | |
| 87 | - value: String? = nil | |
| 86 | + value: String? = nil, | |
| 87 | + next: Next?? = nil | |
| 88 | 88 | ) -> Node { |
| 89 | 89 | return Node( |
| 90 | - next: next ?? self.next, | |
| 91 | - value: value ?? self.value | |
| 90 | + value: value ?? self.value, | |
| 91 | + next: next ?? self.next | |
| 92 | 92 | ) |
| 93 | 93 | } |
Mschema-typescript-zoddefault / TopLevel.ts+3 −3
| @@ -2,18 +2,18 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export type Node = { |
| 5 | - "next"?: Node | null | string; | |
| 6 | 5 | "value": string; |
| 6 | + "next"?: Node | null | string; | |
| 7 | 7 | }; |
| 8 | 8 | export const NodeSchema: z.ZodType<Node> = z.lazy(() => |
| 9 | 9 | z.object({ |
| 10 | - "next": z.union([z.null(), NodeSchema, z.string()]).optional(), | |
| 11 | 10 | "value": z.string(), |
| 11 | + "next": z.union([z.null(), NodeSchema, z.string()]).optional(), | |
| 12 | 12 | }) |
| 13 | 13 | ); |
| 14 | 14 | |
| 15 | 15 | export const TopLevelSchema = z.object({ |
| 16 | - "next": z.union([z.null(), NodeSchema, z.string()]).optional(), | |
| 17 | 16 | "value": z.string(), |
| 17 | + "next": z.union([z.null(), NodeSchema, z.string()]).optional(), | |
| 18 | 18 | }); |
| 19 | 19 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+4 −4
| @@ -8,14 +8,14 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - next?: Next; | |
| 12 | 11 | value: string; |
| 12 | + next?: Next; | |
| 13 | 13 | [property: string]: unknown; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | export interface Node { |
| 17 | - next?: Next; | |
| 18 | 17 | value: string; |
| 18 | + next?: Next; | |
| 19 | 19 | [property: string]: unknown; |
| 20 | 20 | } |
| 21 | 21 | |
| @@ -188,11 +188,11 @@ function r(name: string) { | ||
| 188 | 188 | |
| 189 | 189 | const typeMap: any = { |
| 190 | 190 | "TopLevel": o([ |
| 191 | - { json: "next", js: "next", typ: u(undefined, u(null, r("Node"), "")) }, | |
| 192 | 191 | { json: "value", js: "value", typ: "" }, |
| 192 | + { json: "next", js: "next", typ: u(undefined, u(null, r("Node"), "")) }, | |
| 193 | 193 | ], "any"), |
| 194 | 194 | "Node": o([ |
| 195 | - { json: "next", js: "next", typ: u(undefined, u(null, r("Node"), "")) }, | |
| 196 | 195 | { json: "value", js: "value", typ: "" }, |
| 196 | + { json: "next", js: "next", typ: u(undefined, u(null, r("Node"), "")) }, | |
| 197 | 197 | ], "any"), |
| 198 | 198 | }; |
Test case
27 generated files · +471 −471test/inputs/schema/uuid.schema
Mschema-cjsondefault / TopLevel.c+67 −67
| @@ -22,6 +22,31 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 22 | 22 | if (NULL != j) { |
| 23 | 23 | if (NULL != (x = cJSON_malloc(sizeof(struct TopLevel)))) { |
| 24 | 24 | memset(x, 0, sizeof(struct TopLevel)); |
| 25 | + if (cJSON_HasObjectItem(j, "one")) { | |
| 26 | + x->one = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "one"))); | |
| 27 | + } | |
| 28 | + else { | |
| 29 | + if (NULL != (x->one = cJSON_malloc(sizeof(char)))) { | |
| 30 | + x->one[0] = '\0'; | |
| 31 | + } | |
| 32 | + } | |
| 33 | + if (cJSON_HasObjectItem(j, "optional")) { | |
| 34 | + x->optional = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "optional"))); | |
| 35 | + } | |
| 36 | + if ((cJSON_HasObjectItem(j, "nullable")) && (!cJSON_IsNull(cJSON_GetObjectItemCaseSensitive(j, "nullable")))) { | |
| 37 | + x->nullable = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "nullable"))); | |
| 38 | + } | |
| 39 | + if (cJSON_HasObjectItem(j, "arrOne")) { | |
| 40 | + list_t * x1 = list_create(false, NULL); | |
| 41 | + if (NULL != x1) { | |
| 42 | + cJSON * e1 = NULL; | |
| 43 | + cJSON * j1 = cJSON_GetObjectItemCaseSensitive(j, "arrOne"); | |
| 44 | + cJSON_ArrayForEach(e1, j1) { | |
| 45 | + list_add_tail(x1, strdup(cJSON_GetStringValue(e1)), sizeof(char *)); | |
| 46 | + } | |
| 47 | + x->arr_one = x1; | |
| 48 | + } | |
| 49 | + } | |
| 25 | 50 | if (cJSON_HasObjectItem(j, "arrNullable")) { |
| 26 | 51 | list_t * x1 = list_create(false, NULL); |
| 27 | 52 | if (NULL != x1) { |
| @@ -38,31 +63,6 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 38 | 63 | x->arr_nullable = x1; |
| 39 | 64 | } |
| 40 | 65 | } |
| 41 | - if (cJSON_HasObjectItem(j, "arrOne")) { | |
| 42 | - list_t * x1 = list_create(false, NULL); | |
| 43 | - if (NULL != x1) { | |
| 44 | - cJSON * e1 = NULL; | |
| 45 | - cJSON * j1 = cJSON_GetObjectItemCaseSensitive(j, "arrOne"); | |
| 46 | - cJSON_ArrayForEach(e1, j1) { | |
| 47 | - list_add_tail(x1, strdup(cJSON_GetStringValue(e1)), sizeof(char *)); | |
| 48 | - } | |
| 49 | - x->arr_one = x1; | |
| 50 | - } | |
| 51 | - } | |
| 52 | - if ((cJSON_HasObjectItem(j, "nullable")) && (!cJSON_IsNull(cJSON_GetObjectItemCaseSensitive(j, "nullable")))) { | |
| 53 | - x->nullable = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "nullable"))); | |
| 54 | - } | |
| 55 | - if (cJSON_HasObjectItem(j, "one")) { | |
| 56 | - x->one = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "one"))); | |
| 57 | - } | |
| 58 | - else { | |
| 59 | - if (NULL != (x->one = cJSON_malloc(sizeof(char)))) { | |
| 60 | - x->one[0] = '\0'; | |
| 61 | - } | |
| 62 | - } | |
| 63 | - if (cJSON_HasObjectItem(j, "optional")) { | |
| 64 | - x->optional = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "optional"))); | |
| 65 | - } | |
| 66 | 66 | if (cJSON_HasObjectItem(j, "unionWithEnum")) { |
| 67 | 67 | x->union_with_enum = strdup(cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(j, "unionWithEnum"))); |
| 68 | 68 | } |
| @@ -80,6 +80,31 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 80 | 80 | cJSON * j = NULL; |
| 81 | 81 | if (NULL != x) { |
| 82 | 82 | if (NULL != (j = cJSON_CreateObject())) { |
| 83 | + if (NULL != x->one) { | |
| 84 | + cJSON_AddStringToObject(j, "one", x->one); | |
| 85 | + } | |
| 86 | + else { | |
| 87 | + cJSON_AddStringToObject(j, "one", ""); | |
| 88 | + } | |
| 89 | + if (NULL != x->optional) { | |
| 90 | + cJSON_AddStringToObject(j, "optional", x->optional); | |
| 91 | + } | |
| 92 | + if (NULL != x->nullable) { | |
| 93 | + cJSON_AddStringToObject(j, "nullable", x->nullable); | |
| 94 | + } | |
| 95 | + else { | |
| 96 | + cJSON_AddNullToObject(j, "nullable"); | |
| 97 | + } | |
| 98 | + if (NULL != x->arr_one) { | |
| 99 | + cJSON * j1 = cJSON_AddArrayToObject(j, "arrOne"); | |
| 100 | + if (NULL != j1) { | |
| 101 | + char * x1 = list_get_head(x->arr_one); | |
| 102 | + while (NULL != x1) { | |
| 103 | + cJSON_AddItemToArray(j1, cJSON_CreateString(x1)); | |
| 104 | + x1 = list_get_next(x->arr_one); | |
| 105 | + } | |
| 106 | + } | |
| 107 | + } | |
| 83 | 108 | if (NULL != x->arr_nullable) { |
| 84 | 109 | cJSON * j1 = cJSON_AddArrayToObject(j, "arrNullable"); |
| 85 | 110 | if (NULL != j1) { |
| @@ -95,31 +120,6 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 95 | 120 | } |
| 96 | 121 | } |
| 97 | 122 | } |
| 98 | - if (NULL != x->arr_one) { | |
| 99 | - cJSON * j1 = cJSON_AddArrayToObject(j, "arrOne"); | |
| 100 | - if (NULL != j1) { | |
| 101 | - char * x1 = list_get_head(x->arr_one); | |
| 102 | - while (NULL != x1) { | |
| 103 | - cJSON_AddItemToArray(j1, cJSON_CreateString(x1)); | |
| 104 | - x1 = list_get_next(x->arr_one); | |
| 105 | - } | |
| 106 | - } | |
| 107 | - } | |
| 108 | - if (NULL != x->nullable) { | |
| 109 | - cJSON_AddStringToObject(j, "nullable", x->nullable); | |
| 110 | - } | |
| 111 | - else { | |
| 112 | - cJSON_AddNullToObject(j, "nullable"); | |
| 113 | - } | |
| 114 | - if (NULL != x->one) { | |
| 115 | - cJSON_AddStringToObject(j, "one", x->one); | |
| 116 | - } | |
| 117 | - else { | |
| 118 | - cJSON_AddStringToObject(j, "one", ""); | |
| 119 | - } | |
| 120 | - if (NULL != x->optional) { | |
| 121 | - cJSON_AddStringToObject(j, "optional", x->optional); | |
| 122 | - } | |
| 123 | 123 | if (NULL != x->union_with_enum) { |
| 124 | 124 | cJSON_AddStringToObject(j, "unionWithEnum", x->union_with_enum); |
| 125 | 125 | } |
| @@ -145,15 +145,14 @@ char * cJSON_PrintTopLevel(const struct TopLevel * x) { | ||
| 145 | 145 | |
| 146 | 146 | void cJSON_DeleteTopLevel(struct TopLevel * x) { |
| 147 | 147 | if (NULL != x) { |
| 148 | - if (NULL != x->arr_nullable) { | |
| 149 | - char * x1 = list_get_head(x->arr_nullable); | |
| 150 | - while (NULL != x1) { | |
| 151 | - if ((void *)0xDEADBEEF != x1) { | |
| 152 | - cJSON_free(x1); | |
| 153 | - } | |
| 154 | - x1 = list_get_next(x->arr_nullable); | |
| 155 | - } | |
| 156 | - list_release(x->arr_nullable); | |
| 148 | + if (NULL != x->one) { | |
| 149 | + cJSON_free(x->one); | |
| 150 | + } | |
| 151 | + if (NULL != x->optional) { | |
| 152 | + cJSON_free(x->optional); | |
| 153 | + } | |
| 154 | + if (NULL != x->nullable) { | |
| 155 | + cJSON_free(x->nullable); | |
| 157 | 156 | } |
| 158 | 157 | if (NULL != x->arr_one) { |
| 159 | 158 | char * x1 = list_get_head(x->arr_one); |
| @@ -163,14 +162,15 @@ void cJSON_DeleteTopLevel(struct TopLevel * x) { | ||
| 163 | 162 | } |
| 164 | 163 | list_release(x->arr_one); |
| 165 | 164 | } |
| 166 | - if (NULL != x->nullable) { | |
| 167 | - cJSON_free(x->nullable); | |
| 168 | - } | |
| 169 | - if (NULL != x->one) { | |
| 170 | - cJSON_free(x->one); | |
| 171 | - } | |
| 172 | - if (NULL != x->optional) { | |
| 173 | - cJSON_free(x->optional); | |
| 165 | + if (NULL != x->arr_nullable) { | |
| 166 | + char * x1 = list_get_head(x->arr_nullable); | |
| 167 | + while (NULL != x1) { | |
| 168 | + if ((void *)0xDEADBEEF != x1) { | |
| 169 | + cJSON_free(x1); | |
| 170 | + } | |
| 171 | + x1 = list_get_next(x->arr_nullable); | |
| 172 | + } | |
| 173 | + list_release(x->arr_nullable); | |
| 174 | 174 | } |
| 175 | 175 | if (NULL != x->union_with_enum) { |
| 176 | 176 | cJSON_free(x->union_with_enum); |
Mschema-cjsondefault / TopLevel.h+3 −3
| @@ -35,11 +35,11 @@ extern "C" { | ||
| 35 | 35 | #endif |
| 36 | 36 | |
| 37 | 37 | struct TopLevel { |
| 38 | - list_t * arr_nullable; | |
| 39 | - list_t * arr_one; | |
| 40 | - char * nullable; | |
| 41 | 38 | char * one; |
| 42 | 39 | char * optional; |
| 40 | + char * nullable; | |
| 41 | + list_t * arr_one; | |
| 42 | + list_t * arr_nullable; | |
| 43 | 43 | char * union_with_enum; |
| 44 | 44 | }; |
Mschema-cplusplusdefault / quicktype.hpp+20 −20
| @@ -94,25 +94,14 @@ namespace quicktype { | ||
| 94 | 94 | virtual ~TopLevel() = default; |
| 95 | 95 | |
| 96 | 96 | private: |
| 97 | - std::optional<std::vector<std::optional<std::string>>> arr_nullable; | |
| 98 | - std::optional<std::vector<std::string>> arr_one; | |
| 99 | - std::optional<std::string> nullable; | |
| 100 | 97 | std::string one; |
| 101 | 98 | std::optional<std::string> optional; |
| 99 | + std::optional<std::string> nullable; | |
| 100 | + std::optional<std::vector<std::string>> arr_one; | |
| 101 | + std::optional<std::vector<std::optional<std::string>>> arr_nullable; | |
| 102 | 102 | std::string union_with_enum; |
| 103 | 103 | |
| 104 | 104 | public: |
| 105 | - const std::optional<std::vector<std::optional<std::string>>> & get_arr_nullable() const { return arr_nullable; } | |
| 106 | - std::optional<std::vector<std::optional<std::string>>> & get_mutable_arr_nullable() { return arr_nullable; } | |
| 107 | - void set_arr_nullable(const std::optional<std::vector<std::optional<std::string>>> & value) { this->arr_nullable = value; } | |
| 108 | - | |
| 109 | - const std::optional<std::vector<std::string>> & get_arr_one() const { return arr_one; } | |
| 110 | - std::optional<std::vector<std::string>> & get_mutable_arr_one() { return arr_one; } | |
| 111 | - void set_arr_one(const std::optional<std::vector<std::string>> & value) { this->arr_one = value; } | |
| 112 | - | |
| 113 | - std::optional<std::string> get_nullable() const { return nullable; } | |
| 114 | - void set_nullable(std::optional<std::string> value) { this->nullable = value; } | |
| 115 | - | |
| 116 | 105 | const std::string & get_one() const { return one; } |
| 117 | 106 | std::string & get_mutable_one() { return one; } |
| 118 | 107 | void set_one(const std::string & value) { this->one = value; } |
| @@ -121,6 +110,17 @@ namespace quicktype { | ||
| 121 | 110 | std::optional<std::string> & get_mutable_optional() { return optional; } |
| 122 | 111 | void set_optional(const std::optional<std::string> & value) { this->optional = value; } |
| 123 | 112 | |
| 113 | + std::optional<std::string> get_nullable() const { return nullable; } | |
| 114 | + void set_nullable(std::optional<std::string> value) { this->nullable = value; } | |
| 115 | + | |
| 116 | + const std::optional<std::vector<std::string>> & get_arr_one() const { return arr_one; } | |
| 117 | + std::optional<std::vector<std::string>> & get_mutable_arr_one() { return arr_one; } | |
| 118 | + void set_arr_one(const std::optional<std::vector<std::string>> & value) { this->arr_one = value; } | |
| 119 | + | |
| 120 | + const std::optional<std::vector<std::optional<std::string>>> & get_arr_nullable() const { return arr_nullable; } | |
| 121 | + std::optional<std::vector<std::optional<std::string>>> & get_mutable_arr_nullable() { return arr_nullable; } | |
| 122 | + void set_arr_nullable(const std::optional<std::vector<std::optional<std::string>>> & value) { this->arr_nullable = value; } | |
| 123 | + | |
| 124 | 124 | const std::string & get_union_with_enum() const { return union_with_enum; } |
| 125 | 125 | std::string & get_mutable_union_with_enum() { return union_with_enum; } |
| 126 | 126 | void set_union_with_enum(const std::string & value) { this->union_with_enum = value; } |
| @@ -132,21 +132,21 @@ namespace quicktype { | ||
| 132 | 132 | void to_json(json & j, const TopLevel & x); |
| 133 | 133 | |
| 134 | 134 | inline void from_json(const json & j, TopLevel& x) { |
| 135 | - x.set_arr_nullable(get_stack_optional<std::vector<std::optional<std::string>>>(j, "arrNullable")); | |
| 136 | - x.set_arr_one(get_stack_optional<std::vector<std::string>>(j, "arrOne")); | |
| 137 | - x.set_nullable(get_stack_optional<std::string>(j, "nullable")); | |
| 138 | 135 | x.set_one(j.at("one").get<std::string>()); |
| 139 | 136 | x.set_optional(get_stack_optional<std::string>(j, "optional")); |
| 137 | + x.set_nullable(get_stack_optional<std::string>(j, "nullable")); | |
| 138 | + x.set_arr_one(get_stack_optional<std::vector<std::string>>(j, "arrOne")); | |
| 139 | + x.set_arr_nullable(get_stack_optional<std::vector<std::optional<std::string>>>(j, "arrNullable")); | |
| 140 | 140 | x.set_union_with_enum(j.at("unionWithEnum").get<std::string>()); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | inline void to_json(json & j, const TopLevel & x) { |
| 144 | 144 | j = json::object(); |
| 145 | - j["arrNullable"] = x.get_arr_nullable(); | |
| 146 | - j["arrOne"] = x.get_arr_one(); | |
| 147 | - j["nullable"] = x.get_nullable(); | |
| 148 | 145 | j["one"] = x.get_one(); |
| 149 | 146 | j["optional"] = x.get_optional(); |
| 147 | + j["nullable"] = x.get_nullable(); | |
| 148 | + j["arrOne"] = x.get_arr_one(); | |
| 149 | + j["arrNullable"] = x.get_arr_nullable(); | |
| 150 | 150 | j["unionWithEnum"] = x.get_union_with_enum(); |
| 151 | 151 | } |
| 152 | 152 | } |
Mschema-csharp-recordsdefault / QuickType.cs+8 −8
| @@ -25,20 +25,20 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial record TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("arrNullable", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 29 | - public Guid?[]? ArrNullable { get; set; } | |
| 28 | + [JsonProperty("one", Required = Required.Always)] | |
| 29 | + public Guid One { get; set; } | |
| 30 | 30 | |
| 31 | - [JsonProperty("arrOne", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 32 | - public Guid[]? ArrOne { get; set; } | |
| 31 | + [JsonProperty("optional", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 32 | + public Guid? Optional { get; set; } | |
| 33 | 33 | |
| 34 | 34 | [JsonProperty("nullable", Required = Required.AllowNull)] |
| 35 | 35 | public Guid? Nullable { get; set; } |
| 36 | 36 | |
| 37 | - [JsonProperty("one", Required = Required.Always)] | |
| 38 | - public Guid One { get; set; } | |
| 37 | + [JsonProperty("arrOne", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 38 | + public Guid[]? ArrOne { get; set; } | |
| 39 | 39 | |
| 40 | - [JsonProperty("optional", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 41 | - public Guid? Optional { get; set; } | |
| 40 | + [JsonProperty("arrNullable", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 41 | + public Guid?[]? ArrNullable { get; set; } | |
| 42 | 42 | |
| 43 | 43 | [JsonProperty("unionWithEnum", Required = Required.Always)] |
| 44 | 44 | public UnionWithEnumUnion UnionWithEnum { get; set; } |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+10 −10
| @@ -22,25 +22,25 @@ namespace QuickType | ||
| 22 | 22 | |
| 23 | 23 | public partial class TopLevel |
| 24 | 24 | { |
| 25 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 26 | - [JsonPropertyName("arrNullable")] | |
| 27 | - public Guid?[]? ArrNullable { get; set; } | |
| 25 | + [JsonRequired] | |
| 26 | + [JsonPropertyName("one")] | |
| 27 | + public Guid One { get; set; } | |
| 28 | 28 | |
| 29 | 29 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 30 | - [JsonPropertyName("arrOne")] | |
| 31 | - public Guid[]? ArrOne { get; set; } | |
| 30 | + [JsonPropertyName("optional")] | |
| 31 | + public Guid? Optional { get; set; } | |
| 32 | 32 | |
| 33 | 33 | [JsonRequired] |
| 34 | 34 | [JsonPropertyName("nullable")] |
| 35 | 35 | public Guid? Nullable { get; set; } |
| 36 | 36 | |
| 37 | - [JsonRequired] | |
| 38 | - [JsonPropertyName("one")] | |
| 39 | - public Guid One { get; set; } | |
| 37 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 38 | + [JsonPropertyName("arrOne")] | |
| 39 | + public Guid[]? ArrOne { get; set; } | |
| 40 | 40 | |
| 41 | 41 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 42 | - [JsonPropertyName("optional")] | |
| 43 | - public Guid? Optional { get; set; } | |
| 42 | + [JsonPropertyName("arrNullable")] | |
| 43 | + public Guid?[]? ArrNullable { get; set; } | |
| 44 | 44 | |
| 45 | 45 | [JsonRequired] |
| 46 | 46 | [JsonPropertyName("unionWithEnum")] |
Mschema-csharpdefault / QuickType.cs+8 −8
| @@ -25,20 +25,20 @@ namespace QuickType | ||
| 25 | 25 | |
| 26 | 26 | public partial class TopLevel |
| 27 | 27 | { |
| 28 | - [JsonProperty("arrNullable", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 29 | - public Guid?[]? ArrNullable { get; set; } | |
| 28 | + [JsonProperty("one", Required = Required.Always)] | |
| 29 | + public Guid One { get; set; } | |
| 30 | 30 | |
| 31 | - [JsonProperty("arrOne", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 32 | - public Guid[]? ArrOne { get; set; } | |
| 31 | + [JsonProperty("optional", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 32 | + public Guid? Optional { get; set; } | |
| 33 | 33 | |
| 34 | 34 | [JsonProperty("nullable", Required = Required.AllowNull)] |
| 35 | 35 | public Guid? Nullable { get; set; } |
| 36 | 36 | |
| 37 | - [JsonProperty("one", Required = Required.Always)] | |
| 38 | - public Guid One { get; set; } | |
| 37 | + [JsonProperty("arrOne", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 38 | + public Guid[]? ArrOne { get; set; } | |
| 39 | 39 | |
| 40 | - [JsonProperty("optional", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 41 | - public Guid? Optional { get; set; } | |
| 40 | + [JsonProperty("arrNullable", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 41 | + public Guid?[]? ArrNullable { get; set; } | |
| 42 | 42 | |
| 43 | 43 | [JsonProperty("unionWithEnum", Required = Required.Always)] |
| 44 | 44 | public UnionWithEnumUnion UnionWithEnum { get; set; } |
Mschema-elixirdefault / QuickType.ex+11 −11
| @@ -6,15 +6,15 @@ | ||
| 6 | 6 | # Encode into a JSON string: TopLevel.to_json(struct) |
| 7 | 7 | |
| 8 | 8 | defmodule TopLevel do |
| 9 | - @enforce_keys [:nullable, :one, :union_with_enum] | |
| 10 | - defstruct [:arr_nullable, :arr_one, :nullable, :one, :optional, :union_with_enum] | |
| 9 | + @enforce_keys [:one, :nullable, :union_with_enum] | |
| 10 | + defstruct [:one, :optional, :nullable, :arr_one, :arr_nullable, :union_with_enum] | |
| 11 | 11 | |
| 12 | 12 | @type t :: %__MODULE__{ |
| 13 | - arr_nullable: [nil | String.t()] | nil, | |
| 14 | - arr_one: [String.t()] | nil, | |
| 15 | - nullable: nil | String.t(), | |
| 16 | 13 | one: String.t(), |
| 17 | 14 | optional: String.t() | nil, |
| 15 | + nullable: nil | String.t(), | |
| 16 | + arr_one: [String.t()] | nil, | |
| 17 | + arr_nullable: [nil | String.t()] | nil, | |
| 18 | 18 | union_with_enum: String.t() |
| 19 | 19 | } |
| 20 | 20 | |
| @@ -28,11 +28,11 @@ defmodule TopLevel do | ||
| 28 | 28 | |
| 29 | 29 | def from_map(m) do |
| 30 | 30 | %TopLevel{ |
| 31 | - arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1), | |
| 32 | - arr_one: m["arrOne"], | |
| 33 | - nullable: m["nullable"], | |
| 34 | 31 | one: m["one"], |
| 35 | 32 | optional: m["optional"], |
| 33 | + nullable: m["nullable"], | |
| 34 | + arr_one: m["arrOne"], | |
| 35 | + arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1), | |
| 36 | 36 | union_with_enum: m["unionWithEnum"], |
| 37 | 37 | } |
| 38 | 38 | end |
| @@ -45,11 +45,11 @@ defmodule TopLevel do | ||
| 45 | 45 | |
| 46 | 46 | def to_map(struct) do |
| 47 | 47 | %{ |
| 48 | - "arrNullable" => struct.arr_nullable && Enum.map(struct.arr_nullable, &encode_arr_nullable_element/1), | |
| 49 | - "arrOne" => struct.arr_one, | |
| 50 | - "nullable" => struct.nullable, | |
| 51 | 48 | "one" => struct.one, |
| 52 | 49 | "optional" => struct.optional, |
| 50 | + "nullable" => struct.nullable, | |
| 51 | + "arrOne" => struct.arr_one, | |
| 52 | + "arrNullable" => struct.arr_nullable && Enum.map(struct.arr_nullable, &encode_arr_nullable_element/1), | |
| 53 | 53 | "unionWithEnum" => struct.union_with_enum, |
| 54 | 54 | } |
| 55 | 55 | end |
Mschema-elmdefault / QuickType.elm+11 −11
| @@ -23,11 +23,11 @@ import Json.Encode as Jenc | ||
| 23 | 23 | import Dict exposing (Dict) |
| 24 | 24 | |
| 25 | 25 | type alias QuickType = |
| 26 | - { arrNullable : Maybe (List (Maybe String)) | |
| 27 | - , arrOne : Maybe (List String) | |
| 28 | - , nullable : Maybe String | |
| 29 | - , one : String | |
| 26 | + { one : String | |
| 30 | 27 | , optional : Maybe String |
| 28 | + , nullable : Maybe String | |
| 29 | + , arrOne : Maybe (List String) | |
| 30 | + , arrNullable : Maybe (List (Maybe String)) | |
| 31 | 31 | , unionWithEnum : String |
| 32 | 32 | } |
| 33 | 33 | |
| @@ -39,21 +39,21 @@ quickTypeToString r = Jenc.encode 0 (encodeQuickType r) | ||
| 39 | 39 | quickType : Jdec.Decoder QuickType |
| 40 | 40 | quickType = |
| 41 | 41 | Jdec.succeed QuickType |
| 42 | - |> Jpipe.optional "arrNullable" (Jdec.nullable (Jdec.list (Jdec.nullable Jdec.string))) Nothing | |
| 43 | - |> Jpipe.optional "arrOne" (Jdec.nullable (Jdec.list Jdec.string)) Nothing | |
| 44 | - |> Jpipe.optional "nullable" (Jdec.nullable Jdec.string) Nothing | |
| 45 | 42 | |> Jpipe.required "one" Jdec.string |
| 46 | 43 | |> Jpipe.optional "optional" (Jdec.nullable Jdec.string) Nothing |
| 44 | + |> Jpipe.optional "nullable" (Jdec.nullable Jdec.string) Nothing | |
| 45 | + |> Jpipe.optional "arrOne" (Jdec.nullable (Jdec.list Jdec.string)) Nothing | |
| 46 | + |> Jpipe.optional "arrNullable" (Jdec.nullable (Jdec.list (Jdec.nullable Jdec.string))) Nothing | |
| 47 | 47 | |> Jpipe.required "unionWithEnum" Jdec.string |
| 48 | 48 | |
| 49 | 49 | encodeQuickType : QuickType -> Jenc.Value |
| 50 | 50 | encodeQuickType x = |
| 51 | 51 | Jenc.object |
| 52 | - [ ("arrNullable", makeNullableEncoder (Jenc.list (makeNullableEncoder Jenc.string)) x.arrNullable) | |
| 53 | - , ("arrOne", makeNullableEncoder (Jenc.list Jenc.string) x.arrOne) | |
| 54 | - , ("nullable", makeNullableEncoder Jenc.string x.nullable) | |
| 55 | - , ("one", Jenc.string x.one) | |
| 52 | + [ ("one", Jenc.string x.one) | |
| 56 | 53 | , ("optional", makeNullableEncoder Jenc.string x.optional) |
| 54 | + , ("nullable", makeNullableEncoder Jenc.string x.nullable) | |
| 55 | + , ("arrOne", makeNullableEncoder (Jenc.list Jenc.string) x.arrOne) | |
| 56 | + , ("arrNullable", makeNullableEncoder (Jenc.list (makeNullableEncoder Jenc.string)) x.arrNullable) | |
| 57 | 57 | , ("unionWithEnum", Jenc.string x.unionWithEnum) |
| 58 | 58 | ] |
Mschema-flowdefault / TopLevel.js+6 −6
| @@ -10,11 +10,11 @@ | ||
| 10 | 10 | // match the expected interface, even if the JSON is valid. |
| 11 | 11 | |
| 12 | 12 | export type TopLevel = { |
| 13 | - arrNullable?: (null | string)[]; | |
| 14 | - arrOne?: string[]; | |
| 15 | - nullable: null | string; | |
| 16 | 13 | one: string; |
| 17 | 14 | optional?: string; |
| 15 | + nullable: null | string; | |
| 16 | + arrOne?: string[]; | |
| 17 | + arrNullable?: (null | string)[]; | |
| 18 | 18 | unionWithEnum: string; |
| 19 | 19 | [property: string]: mixed; |
| 20 | 20 | }; |
| @@ -184,11 +184,11 @@ function r(name: string) { | ||
| 184 | 184 | |
| 185 | 185 | const typeMap: any = { |
| 186 | 186 | "TopLevel": o([ |
| 187 | - { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 188 | - { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 189 | - { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 190 | 187 | { json: "one", js: "one", typ: "" }, |
| 191 | 188 | { json: "optional", js: "optional", typ: u(undefined, "") }, |
| 189 | + { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 190 | + { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 191 | + { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 192 | 192 | { json: "unionWithEnum", js: "unionWithEnum", typ: "" }, |
| 193 | 193 | ], "any"), |
| 194 | 194 | }; |
Mschema-golangdefault / quicktype.go+3 −3
| @@ -19,10 +19,10 @@ func (r *TopLevel) Marshal() ([]byte, error) { | ||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | type TopLevel struct { |
| 22 | - ArrNullable []*string `json:"arrNullable,omitempty"` | |
| 23 | - ArrOne []string `json:"arrOne,omitempty"` | |
| 24 | - Nullable *string `json:"nullable"` | |
| 25 | 22 | One string `json:"one"` |
| 26 | 23 | Optional *string `json:"optional,omitempty"` |
| 24 | + Nullable *string `json:"nullable"` | |
| 25 | + ArrOne []string `json:"arrOne,omitempty"` | |
| 26 | + ArrNullable []*string `json:"arrNullable,omitempty"` | |
| 27 | 27 | UnionWithEnum string `json:"unionWithEnum"` |
| 28 | 28 | } |
Mschema-haskelldefault / QuickType.hs+13 −13
| @@ -13,11 +13,11 @@ import Data.HashMap.Strict (HashMap) | ||
| 13 | 13 | import Data.Text (Text) |
| 14 | 14 | |
| 15 | 15 | data QuickType = QuickType |
| 16 | - { arrNullableQuickType :: Maybe ([(Maybe Text)]) | |
| 17 | - , arrOneQuickType :: Maybe ([Text]) | |
| 18 | - , nullableQuickType :: Maybe Text | |
| 19 | - , oneQuickType :: Text | |
| 16 | + { oneQuickType :: Text | |
| 20 | 17 | , optionalQuickType :: Maybe Text |
| 18 | + , nullableQuickType :: Maybe Text | |
| 19 | + , arrOneQuickType :: Maybe ([Text]) | |
| 20 | + , arrNullableQuickType :: Maybe ([(Maybe Text)]) | |
| 21 | 21 | , unionWithEnumQuickType :: Text |
| 22 | 22 | } deriving (Show) |
| 23 | 23 | |
| @@ -25,21 +25,21 @@ decodeTopLevel :: ByteString -> Maybe QuickType | ||
| 25 | 25 | decodeTopLevel = decode |
| 26 | 26 | |
| 27 | 27 | instance ToJSON QuickType where |
| 28 | - toJSON (QuickType arrNullableQuickType arrOneQuickType nullableQuickType oneQuickType optionalQuickType unionWithEnumQuickType) = | |
| 28 | + toJSON (QuickType oneQuickType optionalQuickType nullableQuickType arrOneQuickType arrNullableQuickType unionWithEnumQuickType) = | |
| 29 | 29 | object |
| 30 | - [ "arrNullable" .= arrNullableQuickType | |
| 31 | - , "arrOne" .= arrOneQuickType | |
| 32 | - , "nullable" .= nullableQuickType | |
| 33 | - , "one" .= oneQuickType | |
| 30 | + [ "one" .= oneQuickType | |
| 34 | 31 | , "optional" .= optionalQuickType |
| 32 | + , "nullable" .= nullableQuickType | |
| 33 | + , "arrOne" .= arrOneQuickType | |
| 34 | + , "arrNullable" .= arrNullableQuickType | |
| 35 | 35 | , "unionWithEnum" .= unionWithEnumQuickType |
| 36 | 36 | ] |
| 37 | 37 | |
| 38 | 38 | instance FromJSON QuickType where |
| 39 | 39 | parseJSON (Object v) = QuickType |
| 40 | - <$> v .:? "arrNullable" | |
| 41 | - <*> v .:? "arrOne" | |
| 42 | - <*> v .: "nullable" | |
| 43 | - <*> v .: "one" | |
| 40 | + <$> v .: "one" | |
| 44 | 41 | <*> v .:? "optional" |
| 42 | + <*> v .: "nullable" | |
| 43 | + <*> v .:? "arrOne" | |
| 44 | + <*> v .:? "arrNullable" | |
| 45 | 45 | <*> v .: "unionWithEnum" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+18 −18
| @@ -5,28 +5,13 @@ import java.util.List; | ||
| 5 | 5 | import java.util.UUID; |
| 6 | 6 | |
| 7 | 7 | public class TopLevel { |
| 8 | - private List<UUID> arrNullable; | |
| 9 | - private List<UUID> arrOne; | |
| 10 | - private UUID nullable; | |
| 11 | 8 | private UUID one; |
| 12 | 9 | private UUID optional; |
| 10 | + private UUID nullable; | |
| 11 | + private List<UUID> arrOne; | |
| 12 | + private List<UUID> arrNullable; | |
| 13 | 13 | private UnionWithEnumUnion unionWithEnum; |
| 14 | 14 | |
| 15 | - @JsonProperty("arrNullable") | |
| 16 | - public List<UUID> getArrNullable() { return arrNullable; } | |
| 17 | - @JsonProperty("arrNullable") | |
| 18 | - public void setArrNullable(List<UUID> value) { this.arrNullable = value; } | |
| 19 | - | |
| 20 | - @JsonProperty("arrOne") | |
| 21 | - public List<UUID> getArrOne() { return arrOne; } | |
| 22 | - @JsonProperty("arrOne") | |
| 23 | - public void setArrOne(List<UUID> value) { this.arrOne = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("nullable") | |
| 26 | - public UUID getNullable() { return nullable; } | |
| 27 | - @JsonProperty("nullable") | |
| 28 | - public void setNullable(UUID value) { this.nullable = value; } | |
| 29 | - | |
| 30 | 15 | @JsonProperty("one") |
| 31 | 16 | public UUID getOne() { return one; } |
| 32 | 17 | @JsonProperty("one") |
| @@ -37,6 +22,21 @@ public class TopLevel { | ||
| 37 | 22 | @JsonProperty("optional") |
| 38 | 23 | public void setOptional(UUID value) { this.optional = value; } |
| 39 | 24 | |
| 25 | + @JsonProperty("nullable") | |
| 26 | + public UUID getNullable() { return nullable; } | |
| 27 | + @JsonProperty("nullable") | |
| 28 | + public void setNullable(UUID value) { this.nullable = value; } | |
| 29 | + | |
| 30 | + @JsonProperty("arrOne") | |
| 31 | + public List<UUID> getArrOne() { return arrOne; } | |
| 32 | + @JsonProperty("arrOne") | |
| 33 | + public void setArrOne(List<UUID> value) { this.arrOne = value; } | |
| 34 | + | |
| 35 | + @JsonProperty("arrNullable") | |
| 36 | + public List<UUID> getArrNullable() { return arrNullable; } | |
| 37 | + @JsonProperty("arrNullable") | |
| 38 | + public void setArrNullable(List<UUID> value) { this.arrNullable = value; } | |
| 39 | + | |
| 40 | 40 | @JsonProperty("unionWithEnum") |
| 41 | 41 | public UnionWithEnumUnion getUnionWithEnum() { return unionWithEnum; } |
| 42 | 42 | @JsonProperty("unionWithEnum") |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+18 −18
| @@ -5,28 +5,13 @@ import java.util.List; | ||
| 5 | 5 | import java.util.UUID; |
| 6 | 6 | |
| 7 | 7 | public class TopLevel { |
| 8 | - private List<UUID> arrNullable; | |
| 9 | - private List<UUID> arrOne; | |
| 10 | - private UUID nullable; | |
| 11 | 8 | private UUID one; |
| 12 | 9 | private UUID optional; |
| 10 | + private UUID nullable; | |
| 11 | + private List<UUID> arrOne; | |
| 12 | + private List<UUID> arrNullable; | |
| 13 | 13 | private UnionWithEnumUnion unionWithEnum; |
| 14 | 14 | |
| 15 | - @JsonProperty("arrNullable") | |
| 16 | - public List<UUID> getArrNullable() { return arrNullable; } | |
| 17 | - @JsonProperty("arrNullable") | |
| 18 | - public void setArrNullable(List<UUID> value) { this.arrNullable = value; } | |
| 19 | - | |
| 20 | - @JsonProperty("arrOne") | |
| 21 | - public List<UUID> getArrOne() { return arrOne; } | |
| 22 | - @JsonProperty("arrOne") | |
| 23 | - public void setArrOne(List<UUID> value) { this.arrOne = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("nullable") | |
| 26 | - public UUID getNullable() { return nullable; } | |
| 27 | - @JsonProperty("nullable") | |
| 28 | - public void setNullable(UUID value) { this.nullable = value; } | |
| 29 | - | |
| 30 | 15 | @JsonProperty("one") |
| 31 | 16 | public UUID getOne() { return one; } |
| 32 | 17 | @JsonProperty("one") |
| @@ -37,6 +22,21 @@ public class TopLevel { | ||
| 37 | 22 | @JsonProperty("optional") |
| 38 | 23 | public void setOptional(UUID value) { this.optional = value; } |
| 39 | 24 | |
| 25 | + @JsonProperty("nullable") | |
| 26 | + public UUID getNullable() { return nullable; } | |
| 27 | + @JsonProperty("nullable") | |
| 28 | + public void setNullable(UUID value) { this.nullable = value; } | |
| 29 | + | |
| 30 | + @JsonProperty("arrOne") | |
| 31 | + public List<UUID> getArrOne() { return arrOne; } | |
| 32 | + @JsonProperty("arrOne") | |
| 33 | + public void setArrOne(List<UUID> value) { this.arrOne = value; } | |
| 34 | + | |
| 35 | + @JsonProperty("arrNullable") | |
| 36 | + public List<UUID> getArrNullable() { return arrNullable; } | |
| 37 | + @JsonProperty("arrNullable") | |
| 38 | + public void setArrNullable(List<UUID> value) { this.arrNullable = value; } | |
| 39 | + | |
| 40 | 40 | @JsonProperty("unionWithEnum") |
| 41 | 41 | public UnionWithEnumUnion getUnionWithEnum() { return unionWithEnum; } |
| 42 | 42 | @JsonProperty("unionWithEnum") |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+18 −18
| @@ -5,28 +5,13 @@ import java.util.List; | ||
| 5 | 5 | import java.util.UUID; |
| 6 | 6 | |
| 7 | 7 | public class TopLevel { |
| 8 | - private List<UUID> arrNullable; | |
| 9 | - private List<UUID> arrOne; | |
| 10 | - private UUID nullable; | |
| 11 | 8 | private UUID one; |
| 12 | 9 | private UUID optional; |
| 10 | + private UUID nullable; | |
| 11 | + private List<UUID> arrOne; | |
| 12 | + private List<UUID> arrNullable; | |
| 13 | 13 | private UnionWithEnumUnion unionWithEnum; |
| 14 | 14 | |
| 15 | - @JsonProperty("arrNullable") | |
| 16 | - public List<UUID> getArrNullable() { return arrNullable; } | |
| 17 | - @JsonProperty("arrNullable") | |
| 18 | - public void setArrNullable(List<UUID> value) { this.arrNullable = value; } | |
| 19 | - | |
| 20 | - @JsonProperty("arrOne") | |
| 21 | - public List<UUID> getArrOne() { return arrOne; } | |
| 22 | - @JsonProperty("arrOne") | |
| 23 | - public void setArrOne(List<UUID> value) { this.arrOne = value; } | |
| 24 | - | |
| 25 | - @JsonProperty("nullable") | |
| 26 | - public UUID getNullable() { return nullable; } | |
| 27 | - @JsonProperty("nullable") | |
| 28 | - public void setNullable(UUID value) { this.nullable = value; } | |
| 29 | - | |
| 30 | 15 | @JsonProperty("one") |
| 31 | 16 | public UUID getOne() { return one; } |
| 32 | 17 | @JsonProperty("one") |
| @@ -37,6 +22,21 @@ public class TopLevel { | ||
| 37 | 22 | @JsonProperty("optional") |
| 38 | 23 | public void setOptional(UUID value) { this.optional = value; } |
| 39 | 24 | |
| 25 | + @JsonProperty("nullable") | |
| 26 | + public UUID getNullable() { return nullable; } | |
| 27 | + @JsonProperty("nullable") | |
| 28 | + public void setNullable(UUID value) { this.nullable = value; } | |
| 29 | + | |
| 30 | + @JsonProperty("arrOne") | |
| 31 | + public List<UUID> getArrOne() { return arrOne; } | |
| 32 | + @JsonProperty("arrOne") | |
| 33 | + public void setArrOne(List<UUID> value) { this.arrOne = value; } | |
| 34 | + | |
| 35 | + @JsonProperty("arrNullable") | |
| 36 | + public List<UUID> getArrNullable() { return arrNullable; } | |
| 37 | + @JsonProperty("arrNullable") | |
| 38 | + public void setArrNullable(List<UUID> value) { this.arrNullable = value; } | |
| 39 | + | |
| 40 | 40 | @JsonProperty("unionWithEnum") |
| 41 | 41 | public UnionWithEnumUnion getUnionWithEnum() { return unionWithEnum; } |
| 42 | 42 | @JsonProperty("unionWithEnum") |
Mschema-javascriptdefault / TopLevel.js+3 −3
| @@ -172,11 +172,11 @@ function r(name) { | ||
| 172 | 172 | |
| 173 | 173 | const typeMap = { |
| 174 | 174 | "TopLevel": o([ |
| 175 | - { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 176 | - { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 177 | - { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 178 | 175 | { json: "one", js: "one", typ: "" }, |
| 179 | 176 | { json: "optional", js: "optional", typ: u(undefined, "") }, |
| 177 | + { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 178 | + { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 179 | + { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 180 | 180 | { json: "unionWithEnum", js: "unionWithEnum", typ: "" }, |
| 181 | 181 | ], "any"), |
| 182 | 182 | }; |
Mschema-kotlinxdefault / TopLevel.kt+3 −3
| @@ -12,10 +12,10 @@ import kotlinx.serialization.encoding.* | ||
| 12 | 12 | |
| 13 | 13 | @Serializable |
| 14 | 14 | data class TopLevel ( |
| 15 | - val arrNullable: List<String?>? = null, | |
| 16 | - val arrOne: List<String>? = null, | |
| 17 | - val nullable: String? = null, | |
| 18 | 15 | val one: String, |
| 19 | 16 | val optional: String? = null, |
| 17 | + val nullable: String? = null, | |
| 18 | + val arrOne: List<String>? = null, | |
| 19 | + val arrNullable: List<String?>? = null, | |
| 20 | 20 | val unionWithEnum: String |
| 21 | 21 | ) |
Mschema-phpdefault / TopLevel.php+159 −159
| @@ -4,124 +4,88 @@ declare(strict_types=1); | ||
| 4 | 4 | // This is an autogenerated file:TopLevel |
| 5 | 5 | |
| 6 | 6 | class TopLevel { |
| 7 | - private ?array $arrNullable; // json:arrNullable Optional | |
| 8 | - private ?array $arrOne; // json:arrOne Optional | |
| 9 | - private ?string $nullable; // json:nullable Optional | |
| 10 | 7 | private string $one; // json:one Required |
| 11 | 8 | private ?string $optional; // json:optional Optional |
| 9 | + private ?string $nullable; // json:nullable Optional | |
| 10 | + private ?array $arrOne; // json:arrOne Optional | |
| 11 | + private ?array $arrNullable; // json:arrNullable Optional | |
| 12 | 12 | private UnionWithEnum|string $unionWithEnum; // json:unionWithEnum Required |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * @param array|null $arrNullable | |
| 16 | - * @param array|null $arrOne | |
| 17 | - * @param string|null $nullable | |
| 18 | 15 | * @param string $one |
| 19 | 16 | * @param string|null $optional |
| 17 | + * @param string|null $nullable | |
| 18 | + * @param array|null $arrOne | |
| 19 | + * @param array|null $arrNullable | |
| 20 | 20 | * @param UnionWithEnum|string $unionWithEnum |
| 21 | 21 | */ |
| 22 | - public function __construct(?array $arrNullable, ?array $arrOne, ?string $nullable, string $one, ?string $optional, UnionWithEnum|string $unionWithEnum) { | |
| 23 | - $this->arrNullable = $arrNullable; | |
| 24 | - $this->arrOne = $arrOne; | |
| 25 | - $this->nullable = $nullable; | |
| 22 | + public function __construct(string $one, ?string $optional, ?string $nullable, ?array $arrOne, ?array $arrNullable, UnionWithEnum|string $unionWithEnum) { | |
| 26 | 23 | $this->one = $one; |
| 27 | 24 | $this->optional = $optional; |
| 25 | + $this->nullable = $nullable; | |
| 26 | + $this->arrOne = $arrOne; | |
| 27 | + $this->arrNullable = $arrNullable; | |
| 28 | 28 | $this->unionWithEnum = $unionWithEnum; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * @param ?array $value | |
| 32 | + * @param string $value | |
| 33 | 33 | * @throws Exception |
| 34 | - * @return ?array | |
| 34 | + * @return string | |
| 35 | 35 | */ |
| 36 | - public static function fromArrNullable(?array $value): ?array { | |
| 37 | - if (!is_null($value)) { | |
| 38 | - return array_map(function ($value) { | |
| 39 | - if (!is_null($value)) { | |
| 40 | - return $value; /*uuid*/ | |
| 41 | - } else { | |
| 42 | - return null; | |
| 43 | - } | |
| 44 | - }, $value); | |
| 45 | - } else { | |
| 46 | - return null; | |
| 47 | - } | |
| 36 | + public static function fromOne(string $value): string { | |
| 37 | + return $value; /*uuid*/ | |
| 48 | 38 | } |
| 49 | 39 | |
| 50 | 40 | /** |
| 51 | 41 | * @throws Exception |
| 52 | - * @return ?array | |
| 42 | + * @return string | |
| 53 | 43 | */ |
| 54 | - public function toArrNullable(): ?array { | |
| 55 | - if (TopLevel::validateArrNullable($this->arrNullable)) { | |
| 56 | - if (!is_null($this->arrNullable)) { | |
| 57 | - return array_map(function ($value) { | |
| 58 | - if (!is_null($value)) { | |
| 59 | - return $value; /*uuid*/ | |
| 60 | - } else { | |
| 61 | - return null; | |
| 62 | - } | |
| 63 | - }, $this->arrNullable); | |
| 64 | - } else { | |
| 65 | - return null; | |
| 66 | - } | |
| 44 | + public function toOne(): string { | |
| 45 | + if (TopLevel::validateOne($this->one)) { | |
| 46 | + return $this->one; /*uuid*/ | |
| 67 | 47 | } |
| 68 | - throw new Exception('never get to this TopLevel::arrNullable'); | |
| 48 | + throw new Exception('never get to this TopLevel::one'); | |
| 69 | 49 | } |
| 70 | 50 | |
| 71 | 51 | /** |
| 72 | - * @param array|null | |
| 52 | + * @param string | |
| 73 | 53 | * @return bool |
| 74 | 54 | * @throws Exception |
| 75 | 55 | */ |
| 76 | - public static function validateArrNullable(?array $value): bool { | |
| 77 | - if (!is_null($value)) { | |
| 78 | - if (!is_array($value)) { | |
| 79 | - throw new Exception("Attribute Error:TopLevel::arrNullable"); | |
| 80 | - } | |
| 81 | - array_walk($value, function($value_v) { | |
| 82 | - if (!is_null($value_v)) { | |
| 83 | - if (!is_string($value_v)) { | |
| 84 | - throw new Exception("Attribute Error:TopLevel::arrNullable"); | |
| 85 | - } | |
| 86 | - if (!preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $value_v)) { | |
| 87 | - throw new Exception("Attribute Error:TopLevel::arrNullable"); | |
| 88 | - } | |
| 89 | - } | |
| 90 | - }); | |
| 56 | + public static function validateOne(string $value): bool { | |
| 57 | + if (!preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $value)) { | |
| 58 | + throw new Exception("Attribute Error:TopLevel::one"); | |
| 91 | 59 | } |
| 92 | 60 | return true; |
| 93 | 61 | } |
| 94 | 62 | |
| 95 | 63 | /** |
| 96 | 64 | * @throws Exception |
| 97 | - * @return ?array | |
| 65 | + * @return string | |
| 98 | 66 | */ |
| 99 | - public function getArrNullable(): ?array { | |
| 100 | - if (TopLevel::validateArrNullable($this->arrNullable)) { | |
| 101 | - return $this->arrNullable; | |
| 67 | + public function getOne(): string { | |
| 68 | + if (TopLevel::validateOne($this->one)) { | |
| 69 | + return $this->one; | |
| 102 | 70 | } |
| 103 | - throw new Exception('never get to getArrNullable TopLevel::arrNullable'); | |
| 71 | + throw new Exception('never get to getOne TopLevel::one'); | |
| 104 | 72 | } |
| 105 | 73 | |
| 106 | 74 | /** |
| 107 | - * @return ?array | |
| 75 | + * @return string | |
| 108 | 76 | */ |
| 109 | - public static function sampleArrNullable(): ?array { | |
| 110 | - return array( | |
| 111 | - '9277b8fb-2a65-4663-a36c-8d417e2d284b' /*31:*/ | |
| 112 | - ); /* 31:arrNullable*/ | |
| 77 | + public static function sampleOne(): string { | |
| 78 | + return '9277b8fb-2a65-4663-a36c-8d417e2d284b'; /*31:one*/ | |
| 113 | 79 | } |
| 114 | 80 | |
| 115 | 81 | /** |
| 116 | - * @param ?array $value | |
| 82 | + * @param ?string $value | |
| 117 | 83 | * @throws Exception |
| 118 | - * @return ?array | |
| 84 | + * @return ?string | |
| 119 | 85 | */ |
| 120 | - public static function fromArrOne(?array $value): ?array { | |
| 86 | + public static function fromOptional(?string $value): ?string { | |
| 121 | 87 | if (!is_null($value)) { |
| 122 | - return array_map(function ($value) { | |
| 123 | - return $value; /*uuid*/ | |
| 124 | - }, $value); | |
| 88 | + return $value; /*uuid*/ | |
| 125 | 89 | } else { |
| 126 | 90 | return null; |
| 127 | 91 | } |
| @@ -129,61 +93,49 @@ class TopLevel { | ||
| 129 | 93 | |
| 130 | 94 | /** |
| 131 | 95 | * @throws Exception |
| 132 | - * @return ?array | |
| 96 | + * @return ?string | |
| 133 | 97 | */ |
| 134 | - public function toArrOne(): ?array { | |
| 135 | - if (TopLevel::validateArrOne($this->arrOne)) { | |
| 136 | - if (!is_null($this->arrOne)) { | |
| 137 | - return array_map(function ($value) { | |
| 138 | - return $value; /*uuid*/ | |
| 139 | - }, $this->arrOne); | |
| 98 | + public function toOptional(): ?string { | |
| 99 | + if (TopLevel::validateOptional($this->optional)) { | |
| 100 | + if (!is_null($this->optional)) { | |
| 101 | + return $this->optional; /*uuid*/ | |
| 140 | 102 | } else { |
| 141 | 103 | return null; |
| 142 | 104 | } |
| 143 | 105 | } |
| 144 | - throw new Exception('never get to this TopLevel::arrOne'); | |
| 106 | + throw new Exception('never get to this TopLevel::optional'); | |
| 145 | 107 | } |
| 146 | 108 | |
| 147 | 109 | /** |
| 148 | - * @param array|null | |
| 110 | + * @param string|null | |
| 149 | 111 | * @return bool |
| 150 | 112 | * @throws Exception |
| 151 | 113 | */ |
| 152 | - public static function validateArrOne(?array $value): bool { | |
| 114 | + public static function validateOptional(?string $value): bool { | |
| 153 | 115 | if (!is_null($value)) { |
| 154 | - if (!is_array($value)) { | |
| 155 | - throw new Exception("Attribute Error:TopLevel::arrOne"); | |
| 116 | + if (!preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $value)) { | |
| 117 | + throw new Exception("Attribute Error:TopLevel::optional"); | |
| 156 | 118 | } |
| 157 | - array_walk($value, function($value_v) { | |
| 158 | - if (!is_string($value_v)) { | |
| 159 | - throw new Exception("Attribute Error:TopLevel::arrOne"); | |
| 160 | - } | |
| 161 | - if (!preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $value_v)) { | |
| 162 | - throw new Exception("Attribute Error:TopLevel::arrOne"); | |
| 163 | - } | |
| 164 | - }); | |
| 165 | 119 | } |
| 166 | 120 | return true; |
| 167 | 121 | } |
| 168 | 122 | |
| 169 | 123 | /** |
| 170 | 124 | * @throws Exception |
| 171 | - * @return ?array | |
| 125 | + * @return ?string | |
| 172 | 126 | */ |
| 173 | - public function getArrOne(): ?array { | |
| 174 | - if (TopLevel::validateArrOne($this->arrOne)) { | |
| 175 | - return $this->arrOne; | |
| 127 | + public function getOptional(): ?string { | |
| 128 | + if (TopLevel::validateOptional($this->optional)) { | |
| 129 | + return $this->optional; | |
| 176 | 130 | } |
| 177 | - throw new Exception('never get to getArrOne TopLevel::arrOne'); | |
| 131 | + throw new Exception('never get to getOptional TopLevel::optional'); | |
| 178 | 132 | } |
| 179 | 133 | |
| 180 | 134 | /** |
| 181 | - * @return ?array | |
| 135 | + * @return ?string | |
| 182 | 136 | */ |
| 183 | - public static function sampleArrOne(): ?array { | |
| 184 | - return array( | |
| 185 | - '9277b8fb-2a65-4663-a36c-8d417e2d284b' /*32:*/ | |
| 186 | - ); /* 32:arrOne*/ | |
| 137 | + public static function sampleOptional(): ?string { | |
| 138 | + return '9277b8fb-2a65-4663-a36c-8d417e2d284b'; /*32:optional*/ | |
| 187 | 139 | } |
| 188 | 140 | |
| 189 | 141 | /** |
| @@ -247,63 +199,93 @@ class TopLevel { | ||
| 247 | 199 | } |
| 248 | 200 | |
| 249 | 201 | /** |
| 250 | - * @param string $value | |
| 202 | + * @param ?array $value | |
| 251 | 203 | * @throws Exception |
| 252 | - * @return string | |
| 204 | + * @return ?array | |
| 253 | 205 | */ |
| 254 | - public static function fromOne(string $value): string { | |
| 255 | - return $value; /*uuid*/ | |
| 206 | + public static function fromArrOne(?array $value): ?array { | |
| 207 | + if (!is_null($value)) { | |
| 208 | + return array_map(function ($value) { | |
| 209 | + return $value; /*uuid*/ | |
| 210 | + }, $value); | |
| 211 | + } else { | |
| 212 | + return null; | |
| 213 | + } | |
| 256 | 214 | } |
| 257 | 215 | |
| 258 | 216 | /** |
| 259 | 217 | * @throws Exception |
| 260 | - * @return string | |
| 218 | + * @return ?array | |
| 261 | 219 | */ |
| 262 | - public function toOne(): string { | |
| 263 | - if (TopLevel::validateOne($this->one)) { | |
| 264 | - return $this->one; /*uuid*/ | |
| 220 | + public function toArrOne(): ?array { | |
| 221 | + if (TopLevel::validateArrOne($this->arrOne)) { | |
| 222 | + if (!is_null($this->arrOne)) { | |
| 223 | + return array_map(function ($value) { | |
| 224 | + return $value; /*uuid*/ | |
| 225 | + }, $this->arrOne); | |
| 226 | + } else { | |
| 227 | + return null; | |
| 228 | + } | |
| 265 | 229 | } |
| 266 | - throw new Exception('never get to this TopLevel::one'); | |
| 230 | + throw new Exception('never get to this TopLevel::arrOne'); | |
| 267 | 231 | } |
| 268 | 232 | |
| 269 | 233 | /** |
| 270 | - * @param string | |
| 234 | + * @param array|null | |
| 271 | 235 | * @return bool |
| 272 | 236 | * @throws Exception |
| 273 | 237 | */ |
| 274 | - public static function validateOne(string $value): bool { | |
| 275 | - if (!preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $value)) { | |
| 276 | - throw new Exception("Attribute Error:TopLevel::one"); | |
| 238 | + public static function validateArrOne(?array $value): bool { | |
| 239 | + if (!is_null($value)) { | |
| 240 | + if (!is_array($value)) { | |
| 241 | + throw new Exception("Attribute Error:TopLevel::arrOne"); | |
| 242 | + } | |
| 243 | + array_walk($value, function($value_v) { | |
| 244 | + if (!is_string($value_v)) { | |
| 245 | + throw new Exception("Attribute Error:TopLevel::arrOne"); | |
| 246 | + } | |
| 247 | + if (!preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $value_v)) { | |
| 248 | + throw new Exception("Attribute Error:TopLevel::arrOne"); | |
| 249 | + } | |
| 250 | + }); | |
| 277 | 251 | } |
| 278 | 252 | return true; |
| 279 | 253 | } |
| 280 | 254 | |
| 281 | 255 | /** |
| 282 | 256 | * @throws Exception |
| 283 | - * @return string | |
| 257 | + * @return ?array | |
| 284 | 258 | */ |
| 285 | - public function getOne(): string { | |
| 286 | - if (TopLevel::validateOne($this->one)) { | |
| 287 | - return $this->one; | |
| 259 | + public function getArrOne(): ?array { | |
| 260 | + if (TopLevel::validateArrOne($this->arrOne)) { | |
| 261 | + return $this->arrOne; | |
| 288 | 262 | } |
| 289 | - throw new Exception('never get to getOne TopLevel::one'); | |
| 263 | + throw new Exception('never get to getArrOne TopLevel::arrOne'); | |
| 290 | 264 | } |
| 291 | 265 | |
| 292 | 266 | /** |
| 293 | - * @return string | |
| 267 | + * @return ?array | |
| 294 | 268 | */ |
| 295 | - public static function sampleOne(): string { | |
| 296 | - return '9277b8fb-2a65-4663-a36c-8d417e2d284b'; /*34:one*/ | |
| 269 | + public static function sampleArrOne(): ?array { | |
| 270 | + return array( | |
| 271 | + '9277b8fb-2a65-4663-a36c-8d417e2d284b' /*34:*/ | |
| 272 | + ); /* 34:arrOne*/ | |
| 297 | 273 | } |
| 298 | 274 | |
| 299 | 275 | /** |
| 300 | - * @param ?string $value | |
| 276 | + * @param ?array $value | |
| 301 | 277 | * @throws Exception |
| 302 | - * @return ?string | |
| 278 | + * @return ?array | |
| 303 | 279 | */ |
| 304 | - public static function fromOptional(?string $value): ?string { | |
| 280 | + public static function fromArrNullable(?array $value): ?array { | |
| 305 | 281 | if (!is_null($value)) { |
| 306 | - return $value; /*uuid*/ | |
| 282 | + return array_map(function ($value) { | |
| 283 | + if (!is_null($value)) { | |
| 284 | + return $value; /*uuid*/ | |
| 285 | + } else { | |
| 286 | + return null; | |
| 287 | + } | |
| 288 | + }, $value); | |
| 307 | 289 | } else { |
| 308 | 290 | return null; |
| 309 | 291 | } |
| @@ -311,49 +293,67 @@ class TopLevel { | ||
| 311 | 293 | |
| 312 | 294 | /** |
| 313 | 295 | * @throws Exception |
| 314 | - * @return ?string | |
| 296 | + * @return ?array | |
| 315 | 297 | */ |
| 316 | - public function toOptional(): ?string { | |
| 317 | - if (TopLevel::validateOptional($this->optional)) { | |
| 318 | - if (!is_null($this->optional)) { | |
| 319 | - return $this->optional; /*uuid*/ | |
| 298 | + public function toArrNullable(): ?array { | |
| 299 | + if (TopLevel::validateArrNullable($this->arrNullable)) { | |
| 300 | + if (!is_null($this->arrNullable)) { | |
| 301 | + return array_map(function ($value) { | |
| 302 | + if (!is_null($value)) { | |
| 303 | + return $value; /*uuid*/ | |
| 304 | + } else { | |
| 305 | + return null; | |
| 306 | + } | |
| 307 | + }, $this->arrNullable); | |
| 320 | 308 | } else { |
| 321 | 309 | return null; |
| 322 | 310 | } |
| 323 | 311 | } |
| 324 | - throw new Exception('never get to this TopLevel::optional'); | |
| 312 | + throw new Exception('never get to this TopLevel::arrNullable'); | |
| 325 | 313 | } |
| 326 | 314 | |
| 327 | 315 | /** |
| 328 | - * @param string|null | |
| 316 | + * @param array|null | |
| 329 | 317 | * @return bool |
| 330 | 318 | * @throws Exception |
| 331 | 319 | */ |
| 332 | - public static function validateOptional(?string $value): bool { | |
| 320 | + public static function validateArrNullable(?array $value): bool { | |
| 333 | 321 | if (!is_null($value)) { |
| 334 | - if (!preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $value)) { | |
| 335 | - throw new Exception("Attribute Error:TopLevel::optional"); | |
| 322 | + if (!is_array($value)) { | |
| 323 | + throw new Exception("Attribute Error:TopLevel::arrNullable"); | |
| 336 | 324 | } |
| 325 | + array_walk($value, function($value_v) { | |
| 326 | + if (!is_null($value_v)) { | |
| 327 | + if (!is_string($value_v)) { | |
| 328 | + throw new Exception("Attribute Error:TopLevel::arrNullable"); | |
| 329 | + } | |
| 330 | + if (!preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $value_v)) { | |
| 331 | + throw new Exception("Attribute Error:TopLevel::arrNullable"); | |
| 332 | + } | |
| 333 | + } | |
| 334 | + }); | |
| 337 | 335 | } |
| 338 | 336 | return true; |
| 339 | 337 | } |
| 340 | 338 | |
| 341 | 339 | /** |
| 342 | 340 | * @throws Exception |
| 343 | - * @return ?string | |
| 341 | + * @return ?array | |
| 344 | 342 | */ |
| 345 | - public function getOptional(): ?string { | |
| 346 | - if (TopLevel::validateOptional($this->optional)) { | |
| 347 | - return $this->optional; | |
| 343 | + public function getArrNullable(): ?array { | |
| 344 | + if (TopLevel::validateArrNullable($this->arrNullable)) { | |
| 345 | + return $this->arrNullable; | |
| 348 | 346 | } |
| 349 | - throw new Exception('never get to getOptional TopLevel::optional'); | |
| 347 | + throw new Exception('never get to getArrNullable TopLevel::arrNullable'); | |
| 350 | 348 | } |
| 351 | 349 | |
| 352 | 350 | /** |
| 353 | - * @return ?string | |
| 351 | + * @return ?array | |
| 354 | 352 | */ |
| 355 | - public static function sampleOptional(): ?string { | |
| 356 | - return '9277b8fb-2a65-4663-a36c-8d417e2d284b'; /*35:optional*/ | |
| 353 | + public static function sampleArrNullable(): ?array { | |
| 354 | + return array( | |
| 355 | + '9277b8fb-2a65-4663-a36c-8d417e2d284b' /*35:*/ | |
| 356 | + ); /* 35:arrNullable*/ | |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | /** |
| @@ -432,11 +432,11 @@ class TopLevel { | ||
| 432 | 432 | * @return bool |
| 433 | 433 | */ |
| 434 | 434 | public function validate(): bool { |
| 435 | - return TopLevel::validateArrNullable($this->arrNullable) | |
| 436 | - || TopLevel::validateArrOne($this->arrOne) | |
| 437 | - || TopLevel::validateNullable($this->nullable) | |
| 438 | - || TopLevel::validateOne($this->one) | |
| 435 | + return TopLevel::validateOne($this->one) | |
| 439 | 436 | || TopLevel::validateOptional($this->optional) |
| 437 | + || TopLevel::validateNullable($this->nullable) | |
| 438 | + || TopLevel::validateArrOne($this->arrOne) | |
| 439 | + || TopLevel::validateArrNullable($this->arrNullable) | |
| 440 | 440 | || TopLevel::validateUnionWithEnum($this->unionWithEnum); |
| 441 | 441 | } |
| 442 | 442 | |
| @@ -446,11 +446,11 @@ class TopLevel { | ||
| 446 | 446 | */ |
| 447 | 447 | public function to(): stdClass { |
| 448 | 448 | $out = new stdClass(); |
| 449 | - $out->{'arrNullable'} = $this->toArrNullable(); | |
| 450 | - $out->{'arrOne'} = $this->toArrOne(); | |
| 451 | - $out->{'nullable'} = $this->toNullable(); | |
| 452 | 449 | $out->{'one'} = $this->toOne(); |
| 453 | 450 | $out->{'optional'} = $this->toOptional(); |
| 451 | + $out->{'nullable'} = $this->toNullable(); | |
| 452 | + $out->{'arrOne'} = $this->toArrOne(); | |
| 453 | + $out->{'arrNullable'} = $this->toArrNullable(); | |
| 454 | 454 | $out->{'unionWithEnum'} = $this->toUnionWithEnum(); |
| 455 | 455 | return $out; |
| 456 | 456 | } |
| @@ -462,11 +462,11 @@ class TopLevel { | ||
| 462 | 462 | */ |
| 463 | 463 | public static function from(stdClass $obj): TopLevel { |
| 464 | 464 | return new TopLevel( |
| 465 | - TopLevel::fromArrNullable($obj->{'arrNullable'}) | |
| 466 | - ,TopLevel::fromArrOne($obj->{'arrOne'}) | |
| 467 | - ,TopLevel::fromNullable($obj->{'nullable'}) | |
| 468 | - ,TopLevel::fromOne($obj->{'one'}) | |
| 465 | + TopLevel::fromOne($obj->{'one'}) | |
| 469 | 466 | ,TopLevel::fromOptional($obj->{'optional'}) |
| 467 | + ,TopLevel::fromNullable($obj->{'nullable'}) | |
| 468 | + ,TopLevel::fromArrOne($obj->{'arrOne'}) | |
| 469 | + ,TopLevel::fromArrNullable($obj->{'arrNullable'}) | |
| 470 | 470 | ,TopLevel::fromUnionWithEnum($obj->{'unionWithEnum'}) |
| 471 | 471 | ); |
| 472 | 472 | } |
| @@ -476,11 +476,11 @@ class TopLevel { | ||
| 476 | 476 | */ |
| 477 | 477 | public static function sample(): TopLevel { |
| 478 | 478 | return new TopLevel( |
| 479 | - TopLevel::sampleArrNullable() | |
| 480 | - ,TopLevel::sampleArrOne() | |
| 481 | - ,TopLevel::sampleNullable() | |
| 482 | - ,TopLevel::sampleOne() | |
| 479 | + TopLevel::sampleOne() | |
| 483 | 480 | ,TopLevel::sampleOptional() |
| 481 | + ,TopLevel::sampleNullable() | |
| 482 | + ,TopLevel::sampleArrOne() | |
| 483 | + ,TopLevel::sampleArrNullable() | |
| 484 | 484 | ,TopLevel::sampleUnionWithEnum() |
| 485 | 485 | ); |
| 486 | 486 | } |
Mschema-pikedefault / TopLevel.pmod+9 −9
| @@ -13,20 +13,20 @@ | ||
| 13 | 13 | // match the expected interface, even if the JSON itself is valid. |
| 14 | 14 | |
| 15 | 15 | class TopLevel { |
| 16 | - array(mixed|string)|mixed arr_nullable; // json: "arrNullable" | |
| 17 | - array(string)|mixed arr_one; // json: "arrOne" | |
| 18 | - mixed|string nullable; // json: "nullable" | |
| 19 | 16 | string one; // json: "one" |
| 20 | 17 | mixed|string top_level_optional; // json: "optional" |
| 18 | + mixed|string nullable; // json: "nullable" | |
| 19 | + array(string)|mixed arr_one; // json: "arrOne" | |
| 20 | + array(mixed|string)|mixed arr_nullable; // json: "arrNullable" | |
| 21 | 21 | string union_with_enum; // json: "unionWithEnum" |
| 22 | 22 | |
| 23 | 23 | string encode_json() { |
| 24 | 24 | mapping(string:mixed) json = ([ |
| 25 | - "arrNullable" : arr_nullable, | |
| 26 | - "arrOne" : arr_one, | |
| 27 | - "nullable" : nullable, | |
| 28 | 25 | "one" : one, |
| 29 | 26 | "optional" : top_level_optional, |
| 27 | + "nullable" : nullable, | |
| 28 | + "arrOne" : arr_one, | |
| 29 | + "arrNullable" : arr_nullable, | |
| 30 | 30 | "unionWithEnum" : union_with_enum, |
| 31 | 31 | ]); |
| 32 | 32 | |
| @@ -37,11 +37,11 @@ class TopLevel { | ||
| 37 | 37 | TopLevel TopLevel_from_JSON(mixed json) { |
| 38 | 38 | TopLevel retval = TopLevel(); |
| 39 | 39 | |
| 40 | - retval.arr_nullable = json["arrNullable"]; | |
| 41 | - retval.arr_one = json["arrOne"]; | |
| 42 | - retval.nullable = json["nullable"]; | |
| 43 | 40 | retval.one = json["one"]; |
| 44 | 41 | retval.top_level_optional = json["optional"]; |
| 42 | + retval.nullable = json["nullable"]; | |
| 43 | + retval.arr_one = json["arrOne"]; | |
| 44 | + retval.arr_nullable = json["arrNullable"]; | |
| 45 | 45 | retval.union_with_enum = json["unionWithEnum"]; |
| 46 | 46 | |
| 47 | 47 | return retval; |
Mschema-pythondefault / quicktype.py+17 −17
| @@ -17,16 +17,16 @@ def from_union(fs, x): | ||
| 17 | 17 | assert False |
| 18 | 18 | |
| 19 | 19 | |
| 20 | -def from_list(f: Callable[[Any], T], x: Any) -> list[T]: | |
| 21 | - assert isinstance(x, list) | |
| 22 | - return [f(y) for y in x] | |
| 23 | - | |
| 24 | - | |
| 25 | 20 | def from_none(x: Any) -> Any: |
| 26 | 21 | assert x is None |
| 27 | 22 | return x |
| 28 | 23 | |
| 29 | 24 | |
| 25 | +def from_list(f: Callable[[Any], T], x: Any) -> list[T]: | |
| 26 | + assert isinstance(x, list) | |
| 27 | + return [f(y) for y in x] | |
| 28 | + | |
| 29 | + | |
| 30 | 30 | def to_enum(c: Type[EnumT], x: Any) -> EnumT: |
| 31 | 31 | assert isinstance(x, c) |
| 32 | 32 | return x.value |
| @@ -45,33 +45,33 @@ class UnionWithEnumEnum(Enum): | ||
| 45 | 45 | class TopLevel: |
| 46 | 46 | one: UUID |
| 47 | 47 | union_with_enum: UnionWithEnumEnum | UUID |
| 48 | - arr_nullable: list[UUID | None] | None = None | |
| 49 | - arr_one: list[UUID] | None = None | |
| 50 | - nullable: UUID | None = None | |
| 51 | 48 | optional: UUID | None = None |
| 49 | + nullable: UUID | None = None | |
| 50 | + arr_one: list[UUID] | None = None | |
| 51 | + arr_nullable: list[UUID | None] | None = None | |
| 52 | 52 | |
| 53 | 53 | @staticmethod |
| 54 | 54 | def from_dict(obj: Any) -> 'TopLevel': |
| 55 | 55 | assert isinstance(obj, dict) |
| 56 | 56 | one = UUID(obj.get("one")) |
| 57 | 57 | union_with_enum = from_union([UnionWithEnumEnum, lambda x: UUID(x)], obj.get("unionWithEnum")) |
| 58 | - arr_nullable = from_union([lambda x: from_list(lambda x: from_union([from_none, lambda x: UUID(x)], x), x), from_none], obj.get("arrNullable")) | |
| 59 | - arr_one = from_union([lambda x: from_list(lambda x: UUID(x), x), from_none], obj.get("arrOne")) | |
| 60 | - nullable = from_union([from_none, lambda x: UUID(x)], obj.get("nullable")) | |
| 61 | 58 | optional = from_union([from_none, lambda x: UUID(x)], obj.get("optional")) |
| 62 | - return TopLevel(one, union_with_enum, arr_nullable, arr_one, nullable, optional) | |
| 59 | + nullable = from_union([from_none, lambda x: UUID(x)], obj.get("nullable")) | |
| 60 | + arr_one = from_union([lambda x: from_list(lambda x: UUID(x), x), from_none], obj.get("arrOne")) | |
| 61 | + arr_nullable = from_union([lambda x: from_list(lambda x: from_union([from_none, lambda x: UUID(x)], x), x), from_none], obj.get("arrNullable")) | |
| 62 | + return TopLevel(one, union_with_enum, optional, nullable, arr_one, arr_nullable) | |
| 63 | 63 | |
| 64 | 64 | def to_dict(self) -> dict: |
| 65 | 65 | result: dict = {} |
| 66 | 66 | result["one"] = str(self.one) |
| 67 | 67 | result["unionWithEnum"] = from_union([lambda x: to_enum(UnionWithEnumEnum, x), lambda x: str(x)], self.union_with_enum) |
| 68 | - if self.arr_nullable is not None: | |
| 69 | - result["arrNullable"] = from_union([lambda x: from_list(lambda x: from_union([from_none, lambda x: str(x)], x), x), from_none], self.arr_nullable) | |
| 70 | - if self.arr_one is not None: | |
| 71 | - result["arrOne"] = from_union([lambda x: from_list(lambda x: str(x), x), from_none], self.arr_one) | |
| 72 | - result["nullable"] = from_union([from_none, lambda x: str(x)], self.nullable) | |
| 73 | 68 | if self.optional is not None: |
| 74 | 69 | result["optional"] = from_union([from_none, lambda x: str(x)], self.optional) |
| 70 | + result["nullable"] = from_union([from_none, lambda x: str(x)], self.nullable) | |
| 71 | + if self.arr_one is not None: | |
| 72 | + result["arrOne"] = from_union([lambda x: from_list(lambda x: str(x), x), from_none], self.arr_one) | |
| 73 | + if self.arr_nullable is not None: | |
| 74 | + result["arrNullable"] = from_union([lambda x: from_list(lambda x: from_union([from_none, lambda x: str(x)], x), x), from_none], self.arr_nullable) | |
| 75 | 75 | return result |
Mschema-rubydefault / TopLevel.rb+10 −10
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do: |
| 5 | 5 | # |
| 6 | 6 | # top_level = TopLevel.from_json! "{…}" |
| 7 | -# puts top_level.arr_one&.first | |
| 7 | +# puts top_level.arr_nullable&.first.nil? | |
| 8 | 8 | # |
| 9 | 9 | # If from_json! succeeds, the value returned matches the schema. |
| 10 | 10 | |
| @@ -21,21 +21,21 @@ module Types | ||
| 21 | 21 | end |
| 22 | 22 | |
| 23 | 23 | class TopLevel < Dry::Struct |
| 24 | - attribute :arr_nullable, Types.Array(Types::String.optional).optional | |
| 25 | - attribute :arr_one, Types.Array(Types::String).optional | |
| 26 | - attribute :nullable, Types::String.optional | |
| 27 | 24 | attribute :one, Types::String |
| 28 | 25 | attribute :top_level_optional, Types::String.optional |
| 26 | + attribute :nullable, Types::String.optional | |
| 27 | + attribute :arr_one, Types.Array(Types::String).optional | |
| 28 | + attribute :arr_nullable, Types.Array(Types::String.optional).optional | |
| 29 | 29 | attribute :union_with_enum, Types::String |
| 30 | 30 | |
| 31 | 31 | def self.from_dynamic!(d) |
| 32 | 32 | d = Types::Hash[d] |
| 33 | 33 | new( |
| 34 | - arr_nullable: d["arrNullable"], | |
| 35 | - arr_one: d["arrOne"], | |
| 36 | - nullable: d.fetch("nullable"), | |
| 37 | 34 | one: d.fetch("one"), |
| 38 | 35 | top_level_optional: d["optional"], |
| 36 | + nullable: d.fetch("nullable"), | |
| 37 | + arr_one: d["arrOne"], | |
| 38 | + arr_nullable: d["arrNullable"], | |
| 39 | 39 | union_with_enum: d.fetch("unionWithEnum"), |
| 40 | 40 | ) |
| 41 | 41 | end |
| @@ -46,11 +46,11 @@ class TopLevel < Dry::Struct | ||
| 46 | 46 | |
| 47 | 47 | def to_dynamic |
| 48 | 48 | { |
| 49 | - "arrNullable" => arr_nullable, | |
| 50 | - "arrOne" => arr_one, | |
| 51 | - "nullable" => nullable, | |
| 52 | 49 | "one" => one, |
| 53 | 50 | "optional" => top_level_optional, |
| 51 | + "nullable" => nullable, | |
| 52 | + "arrOne" => arr_one, | |
| 53 | + "arrNullable" => arr_nullable, | |
| 54 | 54 | "unionWithEnum" => union_with_enum, |
| 55 | 55 | } |
| 56 | 56 | end |
Mschema-rustdefault / module_under_test.rs+4 −4
| @@ -16,15 +16,15 @@ use serde::{Serialize, Deserialize}; | ||
| 16 | 16 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 17 | 17 | #[serde(rename_all = "camelCase")] |
| 18 | 18 | pub struct TopLevel { |
| 19 | - pub arr_nullable: Option<Vec<Option<String>>>, | |
| 19 | + pub one: String, | |
| 20 | 20 | |
| 21 | - pub arr_one: Option<Vec<String>>, | |
| 21 | + pub optional: Option<String>, | |
| 22 | 22 | |
| 23 | 23 | pub nullable: Option<String>, |
| 24 | 24 | |
| 25 | - pub one: String, | |
| 25 | + pub arr_one: Option<Vec<String>>, | |
| 26 | 26 | |
| 27 | - pub optional: Option<String>, | |
| 27 | + pub arr_nullable: Option<Vec<Option<String>>>, | |
| 28 | 28 | |
| 29 | 29 | pub union_with_enum: String, |
| 30 | 30 | } |
Mschema-scala3-upickledefault / TopLevel.scala+3 −3
| @@ -66,10 +66,10 @@ end JsonExt | ||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | case class TopLevel ( |
| 69 | - val arrNullable : Option[Seq[Option[String]]] = None, | |
| 70 | - val arrOne : Option[Seq[String]] = None, | |
| 71 | - val nullable : Option[String] = None, | |
| 72 | 69 | val one : String, |
| 73 | 70 | val optional : Option[String] = None, |
| 71 | + val nullable : Option[String] = None, | |
| 72 | + val arrOne : Option[Seq[String]] = None, | |
| 73 | + val arrNullable : Option[Seq[Option[String]]] = None, | |
| 74 | 74 | val unionWithEnum : String |
| 75 | 75 | ) derives OptionPickler.ReadWriter |
Mschema-scala3default / TopLevel.scala+3 −3
| @@ -8,10 +8,10 @@ import cats.syntax.functor._ | ||
| 8 | 8 | type NullValue = None.type |
| 9 | 9 | |
| 10 | 10 | case class TopLevel ( |
| 11 | - val arrNullable : Option[Seq[Option[String]]] = None, | |
| 12 | - val arrOne : Option[Seq[String]] = None, | |
| 13 | - val nullable : Option[String] = None, | |
| 14 | 11 | val one : String, |
| 15 | 12 | val optional : Option[String] = None, |
| 13 | + val nullable : Option[String] = None, | |
| 14 | + val arrOne : Option[Seq[String]] = None, | |
| 15 | + val arrNullable : Option[Seq[Option[String]]] = None, | |
| 16 | 16 | val unionWithEnum : String |
| 17 | 17 | ) derives Encoder.AsObject, Decoder |
Mschema-schemadefault / TopLevel.schema+25 −25
| @@ -6,26 +6,13 @@ | ||
| 6 | 6 | "type": "object", |
| 7 | 7 | "additionalProperties": {}, |
| 8 | 8 | "properties": { |
| 9 | - "arrNullable": { | |
| 10 | - "type": "array", | |
| 11 | - "items": { | |
| 12 | - "anyOf": [ | |
| 13 | - { | |
| 14 | - "type": "null" | |
| 15 | - }, | |
| 16 | - { | |
| 17 | - "type": "string", | |
| 18 | - "format": "uuid" | |
| 19 | - } | |
| 20 | - ] | |
| 21 | - } | |
| 9 | + "one": { | |
| 10 | + "type": "string", | |
| 11 | + "format": "uuid" | |
| 22 | 12 | }, |
| 23 | - "arrOne": { | |
| 24 | - "type": "array", | |
| 25 | - "items": { | |
| 26 | - "type": "string", | |
| 27 | - "format": "uuid" | |
| 28 | - } | |
| 13 | + "optional": { | |
| 14 | + "type": "string", | |
| 15 | + "format": "uuid" | |
| 29 | 16 | }, |
| 30 | 17 | "nullable": { |
| 31 | 18 | "anyOf": [ |
| @@ -38,13 +25,26 @@ | ||
| 38 | 25 | } |
| 39 | 26 | ] |
| 40 | 27 | }, |
| 41 | - "one": { | |
| 42 | - "type": "string", | |
| 43 | - "format": "uuid" | |
| 28 | + "arrOne": { | |
| 29 | + "type": "array", | |
| 30 | + "items": { | |
| 31 | + "type": "string", | |
| 32 | + "format": "uuid" | |
| 33 | + } | |
| 44 | 34 | }, |
| 45 | - "optional": { | |
| 46 | - "type": "string", | |
| 47 | - "format": "uuid" | |
| 35 | + "arrNullable": { | |
| 36 | + "type": "array", | |
| 37 | + "items": { | |
| 38 | + "anyOf": [ | |
| 39 | + { | |
| 40 | + "type": "null" | |
| 41 | + }, | |
| 42 | + { | |
| 43 | + "type": "string", | |
| 44 | + "format": "uuid" | |
| 45 | + } | |
| 46 | + ] | |
| 47 | + } | |
| 48 | 48 | }, |
| 49 | 49 | "unionWithEnum": { |
| 50 | 50 | "$ref": "#/definitions/UnionWithEnumUnion" |
Mschema-swiftdefault / quicktype.swift+12 −12
| @@ -7,19 +7,19 @@ import Foundation | ||
| 7 | 7 | |
| 8 | 8 | // MARK: - TopLevel |
| 9 | 9 | struct TopLevel: Codable { |
| 10 | - let arrNullable: [String?]? | |
| 11 | - let arrOne: [String]? | |
| 12 | - let nullable: String? | |
| 13 | 10 | let one: String |
| 14 | 11 | let topLevelOptional: String? |
| 12 | + let nullable: String? | |
| 13 | + let arrOne: [String]? | |
| 14 | + let arrNullable: [String?]? | |
| 15 | 15 | let unionWithEnum: String |
| 16 | 16 | |
| 17 | 17 | enum CodingKeys: String, CodingKey { |
| 18 | - case arrNullable = "arrNullable" | |
| 19 | - case arrOne = "arrOne" | |
| 20 | - case nullable = "nullable" | |
| 21 | 18 | case one = "one" |
| 22 | 19 | case topLevelOptional = "optional" |
| 20 | + case nullable = "nullable" | |
| 21 | + case arrOne = "arrOne" | |
| 22 | + case arrNullable = "arrNullable" | |
| 23 | 23 | case unionWithEnum = "unionWithEnum" |
| 24 | 24 | } |
| 25 | 25 | } |
| @@ -43,19 +43,19 @@ extension TopLevel { | ||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | func with( |
| 46 | - arrNullable: [String?]?? = nil, | |
| 47 | - arrOne: [String]?? = nil, | |
| 48 | - nullable: String?? = nil, | |
| 49 | 46 | one: String? = nil, |
| 50 | 47 | topLevelOptional: String?? = nil, |
| 48 | + nullable: String?? = nil, | |
| 49 | + arrOne: [String]?? = nil, | |
| 50 | + arrNullable: [String?]?? = nil, | |
| 51 | 51 | unionWithEnum: String? = nil |
| 52 | 52 | ) -> TopLevel { |
| 53 | 53 | return TopLevel( |
| 54 | - arrNullable: arrNullable ?? self.arrNullable, | |
| 55 | - arrOne: arrOne ?? self.arrOne, | |
| 56 | - nullable: nullable ?? self.nullable, | |
| 57 | 54 | one: one ?? self.one, |
| 58 | 55 | topLevelOptional: topLevelOptional ?? self.topLevelOptional, |
| 56 | + nullable: nullable ?? self.nullable, | |
| 57 | + arrOne: arrOne ?? self.arrOne, | |
| 58 | + arrNullable: arrNullable ?? self.arrNullable, | |
| 59 | 59 | unionWithEnum: unionWithEnum ?? self.unionWithEnum |
| 60 | 60 | ) |
| 61 | 61 | } |
Mschema-typescript-zoddefault / TopLevel.ts+3 −3
| @@ -2,11 +2,11 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "arrNullable": z.array(z.union([z.null(), z.string()])).optional(), | |
| 6 | - "arrOne": z.array(z.string()).optional(), | |
| 7 | - "nullable": z.union([z.null(), z.string()]), | |
| 8 | 5 | "one": z.string(), |
| 9 | 6 | "optional": z.string().optional(), |
| 7 | + "nullable": z.union([z.null(), z.string()]), | |
| 8 | + "arrOne": z.array(z.string()).optional(), | |
| 9 | + "arrNullable": z.array(z.union([z.null(), z.string()])).optional(), | |
| 10 | 10 | "unionWithEnum": z.string(), |
| 11 | 11 | }); |
| 12 | 12 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Mschema-typescriptdefault / TopLevel.ts+6 −6
| @@ -8,11 +8,11 @@ | ||
| 8 | 8 | // match the expected interface, even if the JSON is valid. |
| 9 | 9 | |
| 10 | 10 | export interface TopLevel { |
| 11 | - arrNullable?: (null | string)[]; | |
| 12 | - arrOne?: string[]; | |
| 13 | - nullable: null | string; | |
| 14 | 11 | one: string; |
| 15 | 12 | optional?: string; |
| 13 | + nullable: null | string; | |
| 14 | + arrOne?: string[]; | |
| 15 | + arrNullable?: (null | string)[]; | |
| 16 | 16 | unionWithEnum: string; |
| 17 | 17 | [property: string]: unknown; |
| 18 | 18 | } |
| @@ -184,11 +184,11 @@ function r(name: string) { | ||
| 184 | 184 | |
| 185 | 185 | const typeMap: any = { |
| 186 | 186 | "TopLevel": o([ |
| 187 | - { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 188 | - { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 189 | - { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 190 | 187 | { json: "one", js: "one", typ: "" }, |
| 191 | 188 | { json: "optional", js: "optional", typ: u(undefined, "") }, |
| 189 | + { json: "nullable", js: "nullable", typ: u(null, "") }, | |
| 190 | + { json: "arrOne", js: "arrOne", typ: u(undefined, a("")) }, | |
| 191 | + { json: "arrNullable", js: "arrNullable", typ: u(undefined, a(u(null, ""))) }, | |
| 192 | 192 | { json: "unionWithEnum", js: "unionWithEnum", typ: "" }, |
| 193 | 193 | ], "any"), |
| 194 | 194 | }; |
Test case
46 generated files · +1,880 −1,880test/inputs/schema/vega-lite.schema
Mschema-cplusplusdefault / quicktype.hpp+90 −90
| @@ -397,9 +397,9 @@ namespace quicktype { | ||
| 397 | 397 | std::optional<double> dx; |
| 398 | 398 | std::optional<double> dy; |
| 399 | 399 | std::optional<std::string> fill; |
| 400 | - std::optional<bool> filled; | |
| 401 | 400 | std::optional<double> fill_opacity; |
| 402 | 401 | ClassMemberConstraints fill_opacity_constraint; |
| 402 | + std::optional<bool> filled; | |
| 403 | 403 | std::optional<std::string> font; |
| 404 | 404 | std::optional<double> font_size; |
| 405 | 405 | ClassMemberConstraints font_size_constraint; |
| @@ -497,6 +497,15 @@ namespace quicktype { | ||
| 497 | 497 | std::optional<std::string> & get_mutable_fill() { return fill; } |
| 498 | 498 | void set_fill(const std::optional<std::string> & value) { this->fill = value; } |
| 499 | 499 | |
| 500 | + /** | |
| 501 | + * The fill opacity (value between [0,1]). | |
| 502 | + * | |
| 503 | + * __Default value:__ `1` | |
| 504 | + */ | |
| 505 | + const std::optional<double> & get_fill_opacity() const { return fill_opacity; } | |
| 506 | + std::optional<double> & get_mutable_fill_opacity() { return fill_opacity; } | |
| 507 | + void set_fill_opacity(const std::optional<double> & value) { CheckConstraint("fill_opacity", fill_opacity_constraint, value); this->fill_opacity = value; } | |
| 508 | + | |
| 500 | 509 | /** |
| 501 | 510 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 502 | 511 | * |
| @@ -510,15 +519,6 @@ namespace quicktype { | ||
| 510 | 519 | std::optional<bool> & get_mutable_filled() { return filled; } |
| 511 | 520 | void set_filled(const std::optional<bool> & value) { this->filled = value; } |
| 512 | 521 | |
| 513 | - /** | |
| 514 | - * The fill opacity (value between [0,1]). | |
| 515 | - * | |
| 516 | - * __Default value:__ `1` | |
| 517 | - */ | |
| 518 | - const std::optional<double> & get_fill_opacity() const { return fill_opacity; } | |
| 519 | - std::optional<double> & get_mutable_fill_opacity() { return fill_opacity; } | |
| 520 | - void set_fill_opacity(const std::optional<double> & value) { CheckConstraint("fill_opacity", fill_opacity_constraint, value); this->fill_opacity = value; } | |
| 521 | - | |
| 522 | 522 | /** |
| 523 | 523 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 524 | 524 | */ |
| @@ -759,11 +759,11 @@ namespace quicktype { | ||
| 759 | 759 | std::optional<bool> short_time_labels; |
| 760 | 760 | std::optional<std::string> tick_color; |
| 761 | 761 | std::optional<bool> tick_round; |
| 762 | - std::optional<bool> ticks; | |
| 763 | 762 | std::optional<double> tick_size; |
| 764 | 763 | ClassMemberConstraints tick_size_constraint; |
| 765 | 764 | std::optional<double> tick_width; |
| 766 | 765 | ClassMemberConstraints tick_width_constraint; |
| 766 | + std::optional<bool> ticks; | |
| 767 | 767 | std::optional<std::string> title_align; |
| 768 | 768 | std::optional<double> title_angle; |
| 769 | 769 | std::optional<std::string> title_baseline; |
| @@ -994,13 +994,6 @@ namespace quicktype { | ||
| 994 | 994 | std::optional<bool> & get_mutable_tick_round() { return tick_round; } |
| 995 | 995 | void set_tick_round(const std::optional<bool> & value) { this->tick_round = value; } |
| 996 | 996 | |
| 997 | - /** | |
| 998 | - * Boolean value that determines whether the axis should include ticks. | |
| 999 | - */ | |
| 1000 | - const std::optional<bool> & get_ticks() const { return ticks; } | |
| 1001 | - std::optional<bool> & get_mutable_ticks() { return ticks; } | |
| 1002 | - void set_ticks(const std::optional<bool> & value) { this->ticks = value; } | |
| 1003 | - | |
| 1004 | 997 | /** |
| 1005 | 998 | * The size in pixels of axis ticks. |
| 1006 | 999 | */ |
| @@ -1015,6 +1008,13 @@ namespace quicktype { | ||
| 1015 | 1008 | std::optional<double> & get_mutable_tick_width() { return tick_width; } |
| 1016 | 1009 | void set_tick_width(const std::optional<double> & value) { CheckConstraint("tick_width", tick_width_constraint, value); this->tick_width = value; } |
| 1017 | 1010 | |
| 1011 | + /** | |
| 1012 | + * Boolean value that determines whether the axis should include ticks. | |
| 1013 | + */ | |
| 1014 | + const std::optional<bool> & get_ticks() const { return ticks; } | |
| 1015 | + std::optional<bool> & get_mutable_ticks() { return ticks; } | |
| 1016 | + void set_ticks(const std::optional<bool> & value) { this->ticks = value; } | |
| 1017 | + | |
| 1018 | 1018 | /** |
| 1019 | 1019 | * Horizontal text alignment of axis titles. |
| 1020 | 1020 | */ |
| @@ -1157,11 +1157,11 @@ namespace quicktype { | ||
| 1157 | 1157 | std::optional<double> min_extent; |
| 1158 | 1158 | std::optional<std::string> tick_color; |
| 1159 | 1159 | std::optional<bool> tick_round; |
| 1160 | - std::optional<bool> ticks; | |
| 1161 | 1160 | std::optional<double> tick_size; |
| 1162 | 1161 | ClassMemberConstraints tick_size_constraint; |
| 1163 | 1162 | std::optional<double> tick_width; |
| 1164 | 1163 | ClassMemberConstraints tick_width_constraint; |
| 1164 | + std::optional<bool> ticks; | |
| 1165 | 1165 | std::optional<std::string> title_align; |
| 1166 | 1166 | std::optional<double> title_angle; |
| 1167 | 1167 | std::optional<std::string> title_baseline; |
| @@ -1383,13 +1383,6 @@ namespace quicktype { | ||
| 1383 | 1383 | std::optional<bool> & get_mutable_tick_round() { return tick_round; } |
| 1384 | 1384 | void set_tick_round(const std::optional<bool> & value) { this->tick_round = value; } |
| 1385 | 1385 | |
| 1386 | - /** | |
| 1387 | - * Boolean value that determines whether the axis should include ticks. | |
| 1388 | - */ | |
| 1389 | - const std::optional<bool> & get_ticks() const { return ticks; } | |
| 1390 | - std::optional<bool> & get_mutable_ticks() { return ticks; } | |
| 1391 | - void set_ticks(const std::optional<bool> & value) { this->ticks = value; } | |
| 1392 | - | |
| 1393 | 1386 | /** |
| 1394 | 1387 | * The size in pixels of axis ticks. |
| 1395 | 1388 | */ |
| @@ -1404,6 +1397,13 @@ namespace quicktype { | ||
| 1404 | 1397 | std::optional<double> & get_mutable_tick_width() { return tick_width; } |
| 1405 | 1398 | void set_tick_width(const std::optional<double> & value) { CheckConstraint("tick_width", tick_width_constraint, value); this->tick_width = value; } |
| 1406 | 1399 | |
| 1400 | + /** | |
| 1401 | + * Boolean value that determines whether the axis should include ticks. | |
| 1402 | + */ | |
| 1403 | + const std::optional<bool> & get_ticks() const { return ticks; } | |
| 1404 | + std::optional<bool> & get_mutable_ticks() { return ticks; } | |
| 1405 | + void set_ticks(const std::optional<bool> & value) { this->ticks = value; } | |
| 1406 | + | |
| 1407 | 1407 | /** |
| 1408 | 1408 | * Horizontal text alignment of axis titles. |
| 1409 | 1409 | */ |
| @@ -1527,9 +1527,9 @@ namespace quicktype { | ||
| 1527 | 1527 | std::optional<double> dx; |
| 1528 | 1528 | std::optional<double> dy; |
| 1529 | 1529 | std::optional<std::string> fill; |
| 1530 | - std::optional<bool> filled; | |
| 1531 | 1530 | std::optional<double> fill_opacity; |
| 1532 | 1531 | ClassMemberConstraints fill_opacity_constraint; |
| 1532 | + std::optional<bool> filled; | |
| 1533 | 1533 | std::optional<std::string> font; |
| 1534 | 1534 | std::optional<double> font_size; |
| 1535 | 1535 | ClassMemberConstraints font_size_constraint; |
| @@ -1654,6 +1654,15 @@ namespace quicktype { | ||
| 1654 | 1654 | std::optional<std::string> & get_mutable_fill() { return fill; } |
| 1655 | 1655 | void set_fill(const std::optional<std::string> & value) { this->fill = value; } |
| 1656 | 1656 | |
| 1657 | + /** | |
| 1658 | + * The fill opacity (value between [0,1]). | |
| 1659 | + * | |
| 1660 | + * __Default value:__ `1` | |
| 1661 | + */ | |
| 1662 | + const std::optional<double> & get_fill_opacity() const { return fill_opacity; } | |
| 1663 | + std::optional<double> & get_mutable_fill_opacity() { return fill_opacity; } | |
| 1664 | + void set_fill_opacity(const std::optional<double> & value) { CheckConstraint("fill_opacity", fill_opacity_constraint, value); this->fill_opacity = value; } | |
| 1665 | + | |
| 1657 | 1666 | /** |
| 1658 | 1667 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 1659 | 1668 | * |
| @@ -1667,15 +1676,6 @@ namespace quicktype { | ||
| 1667 | 1676 | std::optional<bool> & get_mutable_filled() { return filled; } |
| 1668 | 1677 | void set_filled(const std::optional<bool> & value) { this->filled = value; } |
| 1669 | 1678 | |
| 1670 | - /** | |
| 1671 | - * The fill opacity (value between [0,1]). | |
| 1672 | - * | |
| 1673 | - * __Default value:__ `1` | |
| 1674 | - */ | |
| 1675 | - const std::optional<double> & get_fill_opacity() const { return fill_opacity; } | |
| 1676 | - std::optional<double> & get_mutable_fill_opacity() { return fill_opacity; } | |
| 1677 | - void set_fill_opacity(const std::optional<double> & value) { CheckConstraint("fill_opacity", fill_opacity_constraint, value); this->fill_opacity = value; } | |
| 1678 | - | |
| 1679 | 1679 | /** |
| 1680 | 1680 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1681 | 1681 | */ |
| @@ -3488,9 +3488,9 @@ namespace quicktype { | ||
| 3488 | 3488 | std::optional<double> dx; |
| 3489 | 3489 | std::optional<double> dy; |
| 3490 | 3490 | std::optional<std::string> fill; |
| 3491 | - std::optional<bool> filled; | |
| 3492 | 3491 | std::optional<double> fill_opacity; |
| 3493 | 3492 | ClassMemberConstraints fill_opacity_constraint; |
| 3493 | + std::optional<bool> filled; | |
| 3494 | 3494 | std::optional<std::string> font; |
| 3495 | 3495 | std::optional<double> font_size; |
| 3496 | 3496 | ClassMemberConstraints font_size_constraint; |
| @@ -3589,6 +3589,15 @@ namespace quicktype { | ||
| 3589 | 3589 | std::optional<std::string> & get_mutable_fill() { return fill; } |
| 3590 | 3590 | void set_fill(const std::optional<std::string> & value) { this->fill = value; } |
| 3591 | 3591 | |
| 3592 | + /** | |
| 3593 | + * The fill opacity (value between [0,1]). | |
| 3594 | + * | |
| 3595 | + * __Default value:__ `1` | |
| 3596 | + */ | |
| 3597 | + const std::optional<double> & get_fill_opacity() const { return fill_opacity; } | |
| 3598 | + std::optional<double> & get_mutable_fill_opacity() { return fill_opacity; } | |
| 3599 | + void set_fill_opacity(const std::optional<double> & value) { CheckConstraint("fill_opacity", fill_opacity_constraint, value); this->fill_opacity = value; } | |
| 3600 | + | |
| 3592 | 3601 | /** |
| 3593 | 3602 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 3594 | 3603 | * |
| @@ -3602,15 +3611,6 @@ namespace quicktype { | ||
| 3602 | 3611 | std::optional<bool> & get_mutable_filled() { return filled; } |
| 3603 | 3612 | void set_filled(const std::optional<bool> & value) { this->filled = value; } |
| 3604 | 3613 | |
| 3605 | - /** | |
| 3606 | - * The fill opacity (value between [0,1]). | |
| 3607 | - * | |
| 3608 | - * __Default value:__ `1` | |
| 3609 | - */ | |
| 3610 | - const std::optional<double> & get_fill_opacity() const { return fill_opacity; } | |
| 3611 | - std::optional<double> & get_mutable_fill_opacity() { return fill_opacity; } | |
| 3612 | - void set_fill_opacity(const std::optional<double> & value) { CheckConstraint("fill_opacity", fill_opacity_constraint, value); this->fill_opacity = value; } | |
| 3613 | - | |
| 3614 | 3614 | /** |
| 3615 | 3615 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3616 | 3616 | */ |
| @@ -3835,9 +3835,9 @@ namespace quicktype { | ||
| 3835 | 3835 | std::optional<double> dx; |
| 3836 | 3836 | std::optional<double> dy; |
| 3837 | 3837 | std::optional<std::string> fill; |
| 3838 | - std::optional<bool> filled; | |
| 3839 | 3838 | std::optional<double> fill_opacity; |
| 3840 | 3839 | ClassMemberConstraints fill_opacity_constraint; |
| 3840 | + std::optional<bool> filled; | |
| 3841 | 3841 | std::optional<std::string> font; |
| 3842 | 3842 | std::optional<double> font_size; |
| 3843 | 3843 | ClassMemberConstraints font_size_constraint; |
| @@ -3946,6 +3946,15 @@ namespace quicktype { | ||
| 3946 | 3946 | std::optional<std::string> & get_mutable_fill() { return fill; } |
| 3947 | 3947 | void set_fill(const std::optional<std::string> & value) { this->fill = value; } |
| 3948 | 3948 | |
| 3949 | + /** | |
| 3950 | + * The fill opacity (value between [0,1]). | |
| 3951 | + * | |
| 3952 | + * __Default value:__ `1` | |
| 3953 | + */ | |
| 3954 | + const std::optional<double> & get_fill_opacity() const { return fill_opacity; } | |
| 3955 | + std::optional<double> & get_mutable_fill_opacity() { return fill_opacity; } | |
| 3956 | + void set_fill_opacity(const std::optional<double> & value) { CheckConstraint("fill_opacity", fill_opacity_constraint, value); this->fill_opacity = value; } | |
| 3957 | + | |
| 3949 | 3958 | /** |
| 3950 | 3959 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 3951 | 3960 | * |
| @@ -3959,15 +3968,6 @@ namespace quicktype { | ||
| 3959 | 3968 | std::optional<bool> & get_mutable_filled() { return filled; } |
| 3960 | 3969 | void set_filled(const std::optional<bool> & value) { this->filled = value; } |
| 3961 | 3970 | |
| 3962 | - /** | |
| 3963 | - * The fill opacity (value between [0,1]). | |
| 3964 | - * | |
| 3965 | - * __Default value:__ `1` | |
| 3966 | - */ | |
| 3967 | - const std::optional<double> & get_fill_opacity() const { return fill_opacity; } | |
| 3968 | - std::optional<double> & get_mutable_fill_opacity() { return fill_opacity; } | |
| 3969 | - void set_fill_opacity(const std::optional<double> & value) { CheckConstraint("fill_opacity", fill_opacity_constraint, value); this->fill_opacity = value; } | |
| 3970 | - | |
| 3971 | 3971 | /** |
| 3972 | 3972 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3973 | 3973 | */ |
| @@ -7021,9 +7021,9 @@ namespace quicktype { | ||
| 7021 | 7021 | std::optional<TitleOrient> orient; |
| 7022 | 7022 | std::optional<double> position; |
| 7023 | 7023 | std::optional<double> tick_count; |
| 7024 | - std::optional<bool> ticks; | |
| 7025 | 7024 | std::optional<double> tick_size; |
| 7026 | 7025 | ClassMemberConstraints tick_size_constraint; |
| 7026 | + std::optional<bool> ticks; | |
| 7027 | 7027 | std::optional<std::string> title; |
| 7028 | 7028 | std::optional<double> title_max_length; |
| 7029 | 7029 | std::optional<double> title_padding; |
| @@ -7196,13 +7196,6 @@ namespace quicktype { | ||
| 7196 | 7196 | std::optional<double> & get_mutable_tick_count() { return tick_count; } |
| 7197 | 7197 | void set_tick_count(const std::optional<double> & value) { this->tick_count = value; } |
| 7198 | 7198 | |
| 7199 | - /** | |
| 7200 | - * Boolean value that determines whether the axis should include ticks. | |
| 7201 | - */ | |
| 7202 | - const std::optional<bool> & get_ticks() const { return ticks; } | |
| 7203 | - std::optional<bool> & get_mutable_ticks() { return ticks; } | |
| 7204 | - void set_ticks(const std::optional<bool> & value) { this->ticks = value; } | |
| 7205 | - | |
| 7206 | 7199 | /** |
| 7207 | 7200 | * The size in pixels of axis ticks. |
| 7208 | 7201 | */ |
| @@ -7210,6 +7203,13 @@ namespace quicktype { | ||
| 7210 | 7203 | std::optional<double> & get_mutable_tick_size() { return tick_size; } |
| 7211 | 7204 | void set_tick_size(const std::optional<double> & value) { CheckConstraint("tick_size", tick_size_constraint, value); this->tick_size = value; } |
| 7212 | 7205 | |
| 7206 | + /** | |
| 7207 | + * Boolean value that determines whether the axis should include ticks. | |
| 7208 | + */ | |
| 7209 | + const std::optional<bool> & get_ticks() const { return ticks; } | |
| 7210 | + std::optional<bool> & get_mutable_ticks() { return ticks; } | |
| 7211 | + void set_ticks(const std::optional<bool> & value) { this->ticks = value; } | |
| 7212 | + | |
| 7213 | 7213 | /** |
| 7214 | 7214 | * A title for the field. If `null`, the title will be removed. |
| 7215 | 7215 | * |
| @@ -7864,9 +7864,9 @@ namespace quicktype { | ||
| 7864 | 7864 | std::optional<double> dx; |
| 7865 | 7865 | std::optional<double> dy; |
| 7866 | 7866 | std::optional<std::string> fill; |
| 7867 | - std::optional<bool> filled; | |
| 7868 | 7867 | std::optional<double> fill_opacity; |
| 7869 | 7868 | ClassMemberConstraints fill_opacity_constraint; |
| 7869 | + std::optional<bool> filled; | |
| 7870 | 7870 | std::optional<std::string> font; |
| 7871 | 7871 | std::optional<double> font_size; |
| 7872 | 7872 | ClassMemberConstraints font_size_constraint; |
| @@ -7973,6 +7973,15 @@ namespace quicktype { | ||
| 7973 | 7973 | std::optional<std::string> & get_mutable_fill() { return fill; } |
| 7974 | 7974 | void set_fill(const std::optional<std::string> & value) { this->fill = value; } |
| 7975 | 7975 | |
| 7976 | + /** | |
| 7977 | + * The fill opacity (value between [0,1]). | |
| 7978 | + * | |
| 7979 | + * __Default value:__ `1` | |
| 7980 | + */ | |
| 7981 | + const std::optional<double> & get_fill_opacity() const { return fill_opacity; } | |
| 7982 | + std::optional<double> & get_mutable_fill_opacity() { return fill_opacity; } | |
| 7983 | + void set_fill_opacity(const std::optional<double> & value) { CheckConstraint("fill_opacity", fill_opacity_constraint, value); this->fill_opacity = value; } | |
| 7984 | + | |
| 7976 | 7985 | /** |
| 7977 | 7986 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 7978 | 7987 | * |
| @@ -7986,15 +7995,6 @@ namespace quicktype { | ||
| 7986 | 7995 | std::optional<bool> & get_mutable_filled() { return filled; } |
| 7987 | 7996 | void set_filled(const std::optional<bool> & value) { this->filled = value; } |
| 7988 | 7997 | |
| 7989 | - /** | |
| 7990 | - * The fill opacity (value between [0,1]). | |
| 7991 | - * | |
| 7992 | - * __Default value:__ `1` | |
| 7993 | - */ | |
| 7994 | - const std::optional<double> & get_fill_opacity() const { return fill_opacity; } | |
| 7995 | - std::optional<double> & get_mutable_fill_opacity() { return fill_opacity; } | |
| 7996 | - void set_fill_opacity(const std::optional<double> & value) { CheckConstraint("fill_opacity", fill_opacity_constraint, value); this->fill_opacity = value; } | |
| 7997 | - | |
| 7998 | 7998 | /** |
| 7999 | 7999 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 8000 | 8000 | */ |
| @@ -10074,8 +10074,8 @@ namespace quicktype { | ||
| 10074 | 10074 | x.set_dx(get_stack_optional<double>(j, "dx")); |
| 10075 | 10075 | x.set_dy(get_stack_optional<double>(j, "dy")); |
| 10076 | 10076 | x.set_fill(get_stack_optional<std::string>(j, "fill")); |
| 10077 | - x.set_filled(get_stack_optional<bool>(j, "filled")); | |
| 10078 | 10077 | x.set_fill_opacity(get_stack_optional<double>(j, "fillOpacity")); |
| 10078 | + x.set_filled(get_stack_optional<bool>(j, "filled")); | |
| 10079 | 10079 | x.set_font(get_stack_optional<std::string>(j, "font")); |
| 10080 | 10080 | x.set_font_size(get_stack_optional<double>(j, "fontSize")); |
| 10081 | 10081 | x.set_font_style(get_stack_optional<FontStyle>(j, "fontStyle")); |
| @@ -10108,8 +10108,8 @@ namespace quicktype { | ||
| 10108 | 10108 | j["dx"] = x.get_dx(); |
| 10109 | 10109 | j["dy"] = x.get_dy(); |
| 10110 | 10110 | j["fill"] = x.get_fill(); |
| 10111 | - j["filled"] = x.get_filled(); | |
| 10112 | 10111 | j["fillOpacity"] = x.get_fill_opacity(); |
| 10112 | + j["filled"] = x.get_filled(); | |
| 10113 | 10113 | j["font"] = x.get_font(); |
| 10114 | 10114 | j["fontSize"] = x.get_font_size(); |
| 10115 | 10115 | j["fontStyle"] = x.get_font_style(); |
| @@ -10157,9 +10157,9 @@ namespace quicktype { | ||
| 10157 | 10157 | x.set_short_time_labels(get_stack_optional<bool>(j, "shortTimeLabels")); |
| 10158 | 10158 | x.set_tick_color(get_stack_optional<std::string>(j, "tickColor")); |
| 10159 | 10159 | x.set_tick_round(get_stack_optional<bool>(j, "tickRound")); |
| 10160 | - x.set_ticks(get_stack_optional<bool>(j, "ticks")); | |
| 10161 | 10160 | x.set_tick_size(get_stack_optional<double>(j, "tickSize")); |
| 10162 | 10161 | x.set_tick_width(get_stack_optional<double>(j, "tickWidth")); |
| 10162 | + x.set_ticks(get_stack_optional<bool>(j, "ticks")); | |
| 10163 | 10163 | x.set_title_align(get_stack_optional<std::string>(j, "titleAlign")); |
| 10164 | 10164 | x.set_title_angle(get_stack_optional<double>(j, "titleAngle")); |
| 10165 | 10165 | x.set_title_baseline(get_stack_optional<std::string>(j, "titleBaseline")); |
| @@ -10200,9 +10200,9 @@ namespace quicktype { | ||
| 10200 | 10200 | j["shortTimeLabels"] = x.get_short_time_labels(); |
| 10201 | 10201 | j["tickColor"] = x.get_tick_color(); |
| 10202 | 10202 | j["tickRound"] = x.get_tick_round(); |
| 10203 | - j["ticks"] = x.get_ticks(); | |
| 10204 | 10203 | j["tickSize"] = x.get_tick_size(); |
| 10205 | 10204 | j["tickWidth"] = x.get_tick_width(); |
| 10205 | + j["ticks"] = x.get_ticks(); | |
| 10206 | 10206 | j["titleAlign"] = x.get_title_align(); |
| 10207 | 10207 | j["titleAngle"] = x.get_title_angle(); |
| 10208 | 10208 | j["titleBaseline"] = x.get_title_baseline(); |
| @@ -10241,9 +10241,9 @@ namespace quicktype { | ||
| 10241 | 10241 | x.set_min_extent(get_stack_optional<double>(j, "minExtent")); |
| 10242 | 10242 | x.set_tick_color(get_stack_optional<std::string>(j, "tickColor")); |
| 10243 | 10243 | x.set_tick_round(get_stack_optional<bool>(j, "tickRound")); |
| 10244 | - x.set_ticks(get_stack_optional<bool>(j, "ticks")); | |
| 10245 | 10244 | x.set_tick_size(get_stack_optional<double>(j, "tickSize")); |
| 10246 | 10245 | x.set_tick_width(get_stack_optional<double>(j, "tickWidth")); |
| 10246 | + x.set_ticks(get_stack_optional<bool>(j, "ticks")); | |
| 10247 | 10247 | x.set_title_align(get_stack_optional<std::string>(j, "titleAlign")); |
| 10248 | 10248 | x.set_title_angle(get_stack_optional<double>(j, "titleAngle")); |
| 10249 | 10249 | x.set_title_baseline(get_stack_optional<std::string>(j, "titleBaseline")); |
| @@ -10283,9 +10283,9 @@ namespace quicktype { | ||
| 10283 | 10283 | j["minExtent"] = x.get_min_extent(); |
| 10284 | 10284 | j["tickColor"] = x.get_tick_color(); |
| 10285 | 10285 | j["tickRound"] = x.get_tick_round(); |
| 10286 | - j["ticks"] = x.get_ticks(); | |
| 10287 | 10286 | j["tickSize"] = x.get_tick_size(); |
| 10288 | 10287 | j["tickWidth"] = x.get_tick_width(); |
| 10288 | + j["ticks"] = x.get_ticks(); | |
| 10289 | 10289 | j["titleAlign"] = x.get_title_align(); |
| 10290 | 10290 | j["titleAngle"] = x.get_title_angle(); |
| 10291 | 10291 | j["titleBaseline"] = x.get_title_baseline(); |
| @@ -10312,8 +10312,8 @@ namespace quicktype { | ||
| 10312 | 10312 | x.set_dx(get_stack_optional<double>(j, "dx")); |
| 10313 | 10313 | x.set_dy(get_stack_optional<double>(j, "dy")); |
| 10314 | 10314 | x.set_fill(get_stack_optional<std::string>(j, "fill")); |
| 10315 | - x.set_filled(get_stack_optional<bool>(j, "filled")); | |
| 10316 | 10315 | x.set_fill_opacity(get_stack_optional<double>(j, "fillOpacity")); |
| 10316 | + x.set_filled(get_stack_optional<bool>(j, "filled")); | |
| 10317 | 10317 | x.set_font(get_stack_optional<std::string>(j, "font")); |
| 10318 | 10318 | x.set_font_size(get_stack_optional<double>(j, "fontSize")); |
| 10319 | 10319 | x.set_font_style(get_stack_optional<FontStyle>(j, "fontStyle")); |
| @@ -10349,8 +10349,8 @@ namespace quicktype { | ||
| 10349 | 10349 | j["dx"] = x.get_dx(); |
| 10350 | 10350 | j["dy"] = x.get_dy(); |
| 10351 | 10351 | j["fill"] = x.get_fill(); |
| 10352 | - j["filled"] = x.get_filled(); | |
| 10353 | 10352 | j["fillOpacity"] = x.get_fill_opacity(); |
| 10353 | + j["filled"] = x.get_filled(); | |
| 10354 | 10354 | j["font"] = x.get_font(); |
| 10355 | 10355 | j["fontSize"] = x.get_font_size(); |
| 10356 | 10356 | j["fontStyle"] = x.get_font_style(); |
| @@ -10756,8 +10756,8 @@ namespace quicktype { | ||
| 10756 | 10756 | x.set_dx(get_stack_optional<double>(j, "dx")); |
| 10757 | 10757 | x.set_dy(get_stack_optional<double>(j, "dy")); |
| 10758 | 10758 | x.set_fill(get_stack_optional<std::string>(j, "fill")); |
| 10759 | - x.set_filled(get_stack_optional<bool>(j, "filled")); | |
| 10760 | 10759 | x.set_fill_opacity(get_stack_optional<double>(j, "fillOpacity")); |
| 10760 | + x.set_filled(get_stack_optional<bool>(j, "filled")); | |
| 10761 | 10761 | x.set_font(get_stack_optional<std::string>(j, "font")); |
| 10762 | 10762 | x.set_font_size(get_stack_optional<double>(j, "fontSize")); |
| 10763 | 10763 | x.set_font_style(get_stack_optional<FontStyle>(j, "fontStyle")); |
| @@ -10791,8 +10791,8 @@ namespace quicktype { | ||
| 10791 | 10791 | j["dx"] = x.get_dx(); |
| 10792 | 10792 | j["dy"] = x.get_dy(); |
| 10793 | 10793 | j["fill"] = x.get_fill(); |
| 10794 | - j["filled"] = x.get_filled(); | |
| 10795 | 10794 | j["fillOpacity"] = x.get_fill_opacity(); |
| 10795 | + j["filled"] = x.get_filled(); | |
| 10796 | 10796 | j["font"] = x.get_font(); |
| 10797 | 10797 | j["fontSize"] = x.get_font_size(); |
| 10798 | 10798 | j["fontStyle"] = x.get_font_style(); |
| @@ -10826,8 +10826,8 @@ namespace quicktype { | ||
| 10826 | 10826 | x.set_dx(get_stack_optional<double>(j, "dx")); |
| 10827 | 10827 | x.set_dy(get_stack_optional<double>(j, "dy")); |
| 10828 | 10828 | x.set_fill(get_stack_optional<std::string>(j, "fill")); |
| 10829 | - x.set_filled(get_stack_optional<bool>(j, "filled")); | |
| 10830 | 10829 | x.set_fill_opacity(get_stack_optional<double>(j, "fillOpacity")); |
| 10830 | + x.set_filled(get_stack_optional<bool>(j, "filled")); | |
| 10831 | 10831 | x.set_font(get_stack_optional<std::string>(j, "font")); |
| 10832 | 10832 | x.set_font_size(get_stack_optional<double>(j, "fontSize")); |
| 10833 | 10833 | x.set_font_style(get_stack_optional<FontStyle>(j, "fontStyle")); |
| @@ -10862,8 +10862,8 @@ namespace quicktype { | ||
| 10862 | 10862 | j["dx"] = x.get_dx(); |
| 10863 | 10863 | j["dy"] = x.get_dy(); |
| 10864 | 10864 | j["fill"] = x.get_fill(); |
| 10865 | - j["filled"] = x.get_filled(); | |
| 10866 | 10865 | j["fillOpacity"] = x.get_fill_opacity(); |
| 10866 | + j["filled"] = x.get_filled(); | |
| 10867 | 10867 | j["font"] = x.get_font(); |
| 10868 | 10868 | j["fontSize"] = x.get_font_size(); |
| 10869 | 10869 | j["fontStyle"] = x.get_font_style(); |
| @@ -11521,8 +11521,8 @@ namespace quicktype { | ||
| 11521 | 11521 | x.set_orient(get_stack_optional<TitleOrient>(j, "orient")); |
| 11522 | 11522 | x.set_position(get_stack_optional<double>(j, "position")); |
| 11523 | 11523 | x.set_tick_count(get_stack_optional<double>(j, "tickCount")); |
| 11524 | - x.set_ticks(get_stack_optional<bool>(j, "ticks")); | |
| 11525 | 11524 | x.set_tick_size(get_stack_optional<double>(j, "tickSize")); |
| 11525 | + x.set_ticks(get_stack_optional<bool>(j, "ticks")); | |
| 11526 | 11526 | x.set_title(get_stack_optional<std::string>(j, "title")); |
| 11527 | 11527 | x.set_title_max_length(get_stack_optional<double>(j, "titleMaxLength")); |
| 11528 | 11528 | x.set_title_padding(get_stack_optional<double>(j, "titlePadding")); |
| @@ -11547,8 +11547,8 @@ namespace quicktype { | ||
| 11547 | 11547 | j["orient"] = x.get_orient(); |
| 11548 | 11548 | j["position"] = x.get_position(); |
| 11549 | 11549 | j["tickCount"] = x.get_tick_count(); |
| 11550 | - j["ticks"] = x.get_ticks(); | |
| 11551 | 11550 | j["tickSize"] = x.get_tick_size(); |
| 11551 | + j["ticks"] = x.get_ticks(); | |
| 11552 | 11552 | j["title"] = x.get_title(); |
| 11553 | 11553 | j["titleMaxLength"] = x.get_title_max_length(); |
| 11554 | 11554 | j["titlePadding"] = x.get_title_padding(); |
| @@ -11693,8 +11693,8 @@ namespace quicktype { | ||
| 11693 | 11693 | x.set_dx(get_stack_optional<double>(j, "dx")); |
| 11694 | 11694 | x.set_dy(get_stack_optional<double>(j, "dy")); |
| 11695 | 11695 | x.set_fill(get_stack_optional<std::string>(j, "fill")); |
| 11696 | - x.set_filled(get_stack_optional<bool>(j, "filled")); | |
| 11697 | 11696 | x.set_fill_opacity(get_stack_optional<double>(j, "fillOpacity")); |
| 11697 | + x.set_filled(get_stack_optional<bool>(j, "filled")); | |
| 11698 | 11698 | x.set_font(get_stack_optional<std::string>(j, "font")); |
| 11699 | 11699 | x.set_font_size(get_stack_optional<double>(j, "fontSize")); |
| 11700 | 11700 | x.set_font_style(get_stack_optional<FontStyle>(j, "fontStyle")); |
| @@ -11730,8 +11730,8 @@ namespace quicktype { | ||
| 11730 | 11730 | j["dx"] = x.get_dx(); |
| 11731 | 11731 | j["dy"] = x.get_dy(); |
| 11732 | 11732 | j["fill"] = x.get_fill(); |
| 11733 | - j["filled"] = x.get_filled(); | |
| 11734 | 11733 | j["fillOpacity"] = x.get_fill_opacity(); |
| 11734 | + j["filled"] = x.get_filled(); | |
| 11735 | 11735 | j["font"] = x.get_font(); |
| 11736 | 11736 | j["fontSize"] = x.get_font_size(); |
| 11737 | 11737 | j["fontStyle"] = x.get_font_style(); |
Mschema-csharp-recordsdefault / QuickType.cs+63 −63
| @@ -625,6 +625,15 @@ namespace QuickType | ||
| 625 | 625 | [JsonProperty("fill", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 626 | 626 | public string? Fill { get; set; } |
| 627 | 627 | |
| 628 | + /// <summary> | |
| 629 | + /// The fill opacity (value between [0,1]). | |
| 630 | + /// | |
| 631 | + /// __Default value:__ `1` | |
| 632 | + /// </summary> | |
| 633 | + [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 634 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 635 | + public double? FillOpacity { get; set; } | |
| 636 | + | |
| 628 | 637 | /// <summary> |
| 629 | 638 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 630 | 639 | /// |
| @@ -637,15 +646,6 @@ namespace QuickType | ||
| 637 | 646 | [JsonProperty("filled", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 638 | 647 | public bool? Filled { get; set; } |
| 639 | 648 | |
| 640 | - /// <summary> | |
| 641 | - /// The fill opacity (value between [0,1]). | |
| 642 | - /// | |
| 643 | - /// __Default value:__ `1` | |
| 644 | - /// </summary> | |
| 645 | - [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 646 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 647 | - public double? FillOpacity { get; set; } | |
| 648 | - | |
| 649 | 649 | /// <summary> |
| 650 | 650 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 651 | 651 | /// </summary> |
| @@ -1020,12 +1020,6 @@ namespace QuickType | ||
| 1020 | 1020 | [JsonProperty("tickRound", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 1021 | 1021 | public bool? TickRound { get; set; } |
| 1022 | 1022 | |
| 1023 | - /// <summary> | |
| 1024 | - /// Boolean value that determines whether the axis should include ticks. | |
| 1025 | - /// </summary> | |
| 1026 | - [JsonProperty("ticks", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 1027 | - public bool? Ticks { get; set; } | |
| 1028 | - | |
| 1029 | 1023 | /// <summary> |
| 1030 | 1024 | /// The size in pixels of axis ticks. |
| 1031 | 1025 | /// </summary> |
| @@ -1040,6 +1034,12 @@ namespace QuickType | ||
| 1040 | 1034 | [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] |
| 1041 | 1035 | public double? TickWidth { get; set; } |
| 1042 | 1036 | |
| 1037 | + /// <summary> | |
| 1038 | + /// Boolean value that determines whether the axis should include ticks. | |
| 1039 | + /// </summary> | |
| 1040 | + [JsonProperty("ticks", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 1041 | + public bool? Ticks { get; set; } | |
| 1042 | + | |
| 1043 | 1043 | /// <summary> |
| 1044 | 1044 | /// Horizontal text alignment of axis titles. |
| 1045 | 1045 | /// </summary> |
| @@ -1319,12 +1319,6 @@ namespace QuickType | ||
| 1319 | 1319 | [JsonProperty("tickRound", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 1320 | 1320 | public bool? TickRound { get; set; } |
| 1321 | 1321 | |
| 1322 | - /// <summary> | |
| 1323 | - /// Boolean value that determines whether the axis should include ticks. | |
| 1324 | - /// </summary> | |
| 1325 | - [JsonProperty("ticks", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 1326 | - public bool? Ticks { get; set; } | |
| 1327 | - | |
| 1328 | 1322 | /// <summary> |
| 1329 | 1323 | /// The size in pixels of axis ticks. |
| 1330 | 1324 | /// </summary> |
| @@ -1339,6 +1333,12 @@ namespace QuickType | ||
| 1339 | 1333 | [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] |
| 1340 | 1334 | public double? TickWidth { get; set; } |
| 1341 | 1335 | |
| 1336 | + /// <summary> | |
| 1337 | + /// Boolean value that determines whether the axis should include ticks. | |
| 1338 | + /// </summary> | |
| 1339 | + [JsonProperty("ticks", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 1340 | + public bool? Ticks { get; set; } | |
| 1341 | + | |
| 1342 | 1342 | /// <summary> |
| 1343 | 1343 | /// Horizontal text alignment of axis titles. |
| 1344 | 1344 | /// </summary> |
| @@ -1507,6 +1507,15 @@ namespace QuickType | ||
| 1507 | 1507 | [JsonProperty("fill", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 1508 | 1508 | public string? Fill { get; set; } |
| 1509 | 1509 | |
| 1510 | + /// <summary> | |
| 1511 | + /// The fill opacity (value between [0,1]). | |
| 1512 | + /// | |
| 1513 | + /// __Default value:__ `1` | |
| 1514 | + /// </summary> | |
| 1515 | + [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 1516 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 1517 | + public double? FillOpacity { get; set; } | |
| 1518 | + | |
| 1510 | 1519 | /// <summary> |
| 1511 | 1520 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 1512 | 1521 | /// |
| @@ -1519,15 +1528,6 @@ namespace QuickType | ||
| 1519 | 1528 | [JsonProperty("filled", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 1520 | 1529 | public bool? Filled { get; set; } |
| 1521 | 1530 | |
| 1522 | - /// <summary> | |
| 1523 | - /// The fill opacity (value between [0,1]). | |
| 1524 | - /// | |
| 1525 | - /// __Default value:__ `1` | |
| 1526 | - /// </summary> | |
| 1527 | - [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 1528 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 1529 | - public double? FillOpacity { get; set; } | |
| 1530 | - | |
| 1531 | 1531 | /// <summary> |
| 1532 | 1532 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1533 | 1533 | /// </summary> |
| @@ -2899,6 +2899,15 @@ namespace QuickType | ||
| 2899 | 2899 | [JsonProperty("fill", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 2900 | 2900 | public string? Fill { get; set; } |
| 2901 | 2901 | |
| 2902 | + /// <summary> | |
| 2903 | + /// The fill opacity (value between [0,1]). | |
| 2904 | + /// | |
| 2905 | + /// __Default value:__ `1` | |
| 2906 | + /// </summary> | |
| 2907 | + [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 2908 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 2909 | + public double? FillOpacity { get; set; } | |
| 2910 | + | |
| 2902 | 2911 | /// <summary> |
| 2903 | 2912 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 2904 | 2913 | /// |
| @@ -2911,15 +2920,6 @@ namespace QuickType | ||
| 2911 | 2920 | [JsonProperty("filled", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 2912 | 2921 | public bool? Filled { get; set; } |
| 2913 | 2922 | |
| 2914 | - /// <summary> | |
| 2915 | - /// The fill opacity (value between [0,1]). | |
| 2916 | - /// | |
| 2917 | - /// __Default value:__ `1` | |
| 2918 | - /// </summary> | |
| 2919 | - [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 2920 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 2921 | - public double? FillOpacity { get; set; } | |
| 2922 | - | |
| 2923 | 2923 | /// <summary> |
| 2924 | 2924 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 2925 | 2925 | /// </summary> |
| @@ -3173,6 +3173,15 @@ namespace QuickType | ||
| 3173 | 3173 | [JsonProperty("fill", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 3174 | 3174 | public string? Fill { get; set; } |
| 3175 | 3175 | |
| 3176 | + /// <summary> | |
| 3177 | + /// The fill opacity (value between [0,1]). | |
| 3178 | + /// | |
| 3179 | + /// __Default value:__ `1` | |
| 3180 | + /// </summary> | |
| 3181 | + [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 3182 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 3183 | + public double? FillOpacity { get; set; } | |
| 3184 | + | |
| 3176 | 3185 | /// <summary> |
| 3177 | 3186 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 3178 | 3187 | /// |
| @@ -3185,15 +3194,6 @@ namespace QuickType | ||
| 3185 | 3194 | [JsonProperty("filled", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 3186 | 3195 | public bool? Filled { get; set; } |
| 3187 | 3196 | |
| 3188 | - /// <summary> | |
| 3189 | - /// The fill opacity (value between [0,1]). | |
| 3190 | - /// | |
| 3191 | - /// __Default value:__ `1` | |
| 3192 | - /// </summary> | |
| 3193 | - [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 3194 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 3195 | - public double? FillOpacity { get; set; } | |
| 3196 | - | |
| 3197 | 3197 | /// <summary> |
| 3198 | 3198 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3199 | 3199 | /// </summary> |
| @@ -5556,12 +5556,6 @@ namespace QuickType | ||
| 5556 | 5556 | [JsonProperty("tickCount", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 5557 | 5557 | public double? TickCount { get; set; } |
| 5558 | 5558 | |
| 5559 | - /// <summary> | |
| 5560 | - /// Boolean value that determines whether the axis should include ticks. | |
| 5561 | - /// </summary> | |
| 5562 | - [JsonProperty("ticks", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 5563 | - public bool? Ticks { get; set; } | |
| 5564 | - | |
| 5565 | 5559 | /// <summary> |
| 5566 | 5560 | /// The size in pixels of axis ticks. |
| 5567 | 5561 | /// </summary> |
| @@ -5569,6 +5563,12 @@ namespace QuickType | ||
| 5569 | 5563 | [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] |
| 5570 | 5564 | public double? TickSize { get; set; } |
| 5571 | 5565 | |
| 5566 | + /// <summary> | |
| 5567 | + /// Boolean value that determines whether the axis should include ticks. | |
| 5568 | + /// </summary> | |
| 5569 | + [JsonProperty("ticks", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 5570 | + public bool? Ticks { get; set; } | |
| 5571 | + | |
| 5572 | 5572 | /// <summary> |
| 5573 | 5573 | /// A title for the field. If `null`, the title will be removed. |
| 5574 | 5574 | /// |
| @@ -6183,6 +6183,15 @@ namespace QuickType | ||
| 6183 | 6183 | [JsonProperty("fill", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 6184 | 6184 | public string? Fill { get; set; } |
| 6185 | 6185 | |
| 6186 | + /// <summary> | |
| 6187 | + /// The fill opacity (value between [0,1]). | |
| 6188 | + /// | |
| 6189 | + /// __Default value:__ `1` | |
| 6190 | + /// </summary> | |
| 6191 | + [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 6192 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 6193 | + public double? FillOpacity { get; set; } | |
| 6194 | + | |
| 6186 | 6195 | /// <summary> |
| 6187 | 6196 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 6188 | 6197 | /// |
| @@ -6195,15 +6204,6 @@ namespace QuickType | ||
| 6195 | 6204 | [JsonProperty("filled", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 6196 | 6205 | public bool? Filled { get; set; } |
| 6197 | 6206 | |
| 6198 | - /// <summary> | |
| 6199 | - /// The fill opacity (value between [0,1]). | |
| 6200 | - /// | |
| 6201 | - /// __Default value:__ `1` | |
| 6202 | - /// </summary> | |
| 6203 | - [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 6204 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 6205 | - public double? FillOpacity { get; set; } | |
| 6206 | - | |
| 6207 | 6207 | /// <summary> |
| 6208 | 6208 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 6209 | 6209 | /// </summary> |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+71 −71
| @@ -693,6 +693,16 @@ namespace QuickType | ||
| 693 | 693 | [JsonPropertyName("fill")] |
| 694 | 694 | public string? Fill { get; set; } |
| 695 | 695 | |
| 696 | + /// <summary> | |
| 697 | + /// The fill opacity (value between [0,1]). | |
| 698 | + /// | |
| 699 | + /// __Default value:__ `1` | |
| 700 | + /// </summary> | |
| 701 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 702 | + [JsonPropertyName("fillOpacity")] | |
| 703 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 704 | + public double? FillOpacity { get; set; } | |
| 705 | + | |
| 696 | 706 | /// <summary> |
| 697 | 707 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 698 | 708 | /// |
| @@ -706,16 +716,6 @@ namespace QuickType | ||
| 706 | 716 | [JsonPropertyName("filled")] |
| 707 | 717 | public bool? Filled { get; set; } |
| 708 | 718 | |
| 709 | - /// <summary> | |
| 710 | - /// The fill opacity (value between [0,1]). | |
| 711 | - /// | |
| 712 | - /// __Default value:__ `1` | |
| 713 | - /// </summary> | |
| 714 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 715 | - [JsonPropertyName("fillOpacity")] | |
| 716 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 717 | - public double? FillOpacity { get; set; } | |
| 718 | - | |
| 719 | 719 | /// <summary> |
| 720 | 720 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 721 | 721 | /// </summary> |
| @@ -1134,13 +1134,6 @@ namespace QuickType | ||
| 1134 | 1134 | [JsonPropertyName("tickRound")] |
| 1135 | 1135 | public bool? TickRound { get; set; } |
| 1136 | 1136 | |
| 1137 | - /// <summary> | |
| 1138 | - /// Boolean value that determines whether the axis should include ticks. | |
| 1139 | - /// </summary> | |
| 1140 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 1141 | - [JsonPropertyName("ticks")] | |
| 1142 | - public bool? Ticks { get; set; } | |
| 1143 | - | |
| 1144 | 1137 | /// <summary> |
| 1145 | 1138 | /// The size in pixels of axis ticks. |
| 1146 | 1139 | /// </summary> |
| @@ -1157,6 +1150,13 @@ namespace QuickType | ||
| 1157 | 1150 | [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] |
| 1158 | 1151 | public double? TickWidth { get; set; } |
| 1159 | 1152 | |
| 1153 | + /// <summary> | |
| 1154 | + /// Boolean value that determines whether the axis should include ticks. | |
| 1155 | + /// </summary> | |
| 1156 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 1157 | + [JsonPropertyName("ticks")] | |
| 1158 | + public bool? Ticks { get; set; } | |
| 1159 | + | |
| 1160 | 1160 | /// <summary> |
| 1161 | 1161 | /// Horizontal text alignment of axis titles. |
| 1162 | 1162 | /// </summary> |
| @@ -1471,13 +1471,6 @@ namespace QuickType | ||
| 1471 | 1471 | [JsonPropertyName("tickRound")] |
| 1472 | 1472 | public bool? TickRound { get; set; } |
| 1473 | 1473 | |
| 1474 | - /// <summary> | |
| 1475 | - /// Boolean value that determines whether the axis should include ticks. | |
| 1476 | - /// </summary> | |
| 1477 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 1478 | - [JsonPropertyName("ticks")] | |
| 1479 | - public bool? Ticks { get; set; } | |
| 1480 | - | |
| 1481 | 1474 | /// <summary> |
| 1482 | 1475 | /// The size in pixels of axis ticks. |
| 1483 | 1476 | /// </summary> |
| @@ -1494,6 +1487,13 @@ namespace QuickType | ||
| 1494 | 1487 | [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] |
| 1495 | 1488 | public double? TickWidth { get; set; } |
| 1496 | 1489 | |
| 1490 | + /// <summary> | |
| 1491 | + /// Boolean value that determines whether the axis should include ticks. | |
| 1492 | + /// </summary> | |
| 1493 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 1494 | + [JsonPropertyName("ticks")] | |
| 1495 | + public bool? Ticks { get; set; } | |
| 1496 | + | |
| 1497 | 1497 | /// <summary> |
| 1498 | 1498 | /// Horizontal text alignment of axis titles. |
| 1499 | 1499 | /// </summary> |
| @@ -1685,6 +1685,16 @@ namespace QuickType | ||
| 1685 | 1685 | [JsonPropertyName("fill")] |
| 1686 | 1686 | public string? Fill { get; set; } |
| 1687 | 1687 | |
| 1688 | + /// <summary> | |
| 1689 | + /// The fill opacity (value between [0,1]). | |
| 1690 | + /// | |
| 1691 | + /// __Default value:__ `1` | |
| 1692 | + /// </summary> | |
| 1693 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 1694 | + [JsonPropertyName("fillOpacity")] | |
| 1695 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 1696 | + public double? FillOpacity { get; set; } | |
| 1697 | + | |
| 1688 | 1698 | /// <summary> |
| 1689 | 1699 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 1690 | 1700 | /// |
| @@ -1698,16 +1708,6 @@ namespace QuickType | ||
| 1698 | 1708 | [JsonPropertyName("filled")] |
| 1699 | 1709 | public bool? Filled { get; set; } |
| 1700 | 1710 | |
| 1701 | - /// <summary> | |
| 1702 | - /// The fill opacity (value between [0,1]). | |
| 1703 | - /// | |
| 1704 | - /// __Default value:__ `1` | |
| 1705 | - /// </summary> | |
| 1706 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 1707 | - [JsonPropertyName("fillOpacity")] | |
| 1708 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 1709 | - public double? FillOpacity { get; set; } | |
| 1710 | - | |
| 1711 | 1711 | /// <summary> |
| 1712 | 1712 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1713 | 1713 | /// </summary> |
| @@ -3248,6 +3248,16 @@ namespace QuickType | ||
| 3248 | 3248 | [JsonPropertyName("fill")] |
| 3249 | 3249 | public string? Fill { get; set; } |
| 3250 | 3250 | |
| 3251 | + /// <summary> | |
| 3252 | + /// The fill opacity (value between [0,1]). | |
| 3253 | + /// | |
| 3254 | + /// __Default value:__ `1` | |
| 3255 | + /// </summary> | |
| 3256 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 3257 | + [JsonPropertyName("fillOpacity")] | |
| 3258 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 3259 | + public double? FillOpacity { get; set; } | |
| 3260 | + | |
| 3251 | 3261 | /// <summary> |
| 3252 | 3262 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 3253 | 3263 | /// |
| @@ -3261,16 +3271,6 @@ namespace QuickType | ||
| 3261 | 3271 | [JsonPropertyName("filled")] |
| 3262 | 3272 | public bool? Filled { get; set; } |
| 3263 | 3273 | |
| 3264 | - /// <summary> | |
| 3265 | - /// The fill opacity (value between [0,1]). | |
| 3266 | - /// | |
| 3267 | - /// __Default value:__ `1` | |
| 3268 | - /// </summary> | |
| 3269 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 3270 | - [JsonPropertyName("fillOpacity")] | |
| 3271 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 3272 | - public double? FillOpacity { get; set; } | |
| 3273 | - | |
| 3274 | 3274 | /// <summary> |
| 3275 | 3275 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3276 | 3276 | /// </summary> |
| @@ -3554,6 +3554,16 @@ namespace QuickType | ||
| 3554 | 3554 | [JsonPropertyName("fill")] |
| 3555 | 3555 | public string? Fill { get; set; } |
| 3556 | 3556 | |
| 3557 | + /// <summary> | |
| 3558 | + /// The fill opacity (value between [0,1]). | |
| 3559 | + /// | |
| 3560 | + /// __Default value:__ `1` | |
| 3561 | + /// </summary> | |
| 3562 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 3563 | + [JsonPropertyName("fillOpacity")] | |
| 3564 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 3565 | + public double? FillOpacity { get; set; } | |
| 3566 | + | |
| 3557 | 3567 | /// <summary> |
| 3558 | 3568 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 3559 | 3569 | /// |
| @@ -3567,16 +3577,6 @@ namespace QuickType | ||
| 3567 | 3577 | [JsonPropertyName("filled")] |
| 3568 | 3578 | public bool? Filled { get; set; } |
| 3569 | 3579 | |
| 3570 | - /// <summary> | |
| 3571 | - /// The fill opacity (value between [0,1]). | |
| 3572 | - /// | |
| 3573 | - /// __Default value:__ `1` | |
| 3574 | - /// </summary> | |
| 3575 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 3576 | - [JsonPropertyName("fillOpacity")] | |
| 3577 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 3578 | - public double? FillOpacity { get; set; } | |
| 3579 | - | |
| 3580 | 3580 | /// <summary> |
| 3581 | 3581 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3582 | 3582 | /// </summary> |
| @@ -6161,13 +6161,6 @@ namespace QuickType | ||
| 6161 | 6161 | [JsonPropertyName("tickCount")] |
| 6162 | 6162 | public double? TickCount { get; set; } |
| 6163 | 6163 | |
| 6164 | - /// <summary> | |
| 6165 | - /// Boolean value that determines whether the axis should include ticks. | |
| 6166 | - /// </summary> | |
| 6167 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 6168 | - [JsonPropertyName("ticks")] | |
| 6169 | - public bool? Ticks { get; set; } | |
| 6170 | - | |
| 6171 | 6164 | /// <summary> |
| 6172 | 6165 | /// The size in pixels of axis ticks. |
| 6173 | 6166 | /// </summary> |
| @@ -6176,6 +6169,13 @@ namespace QuickType | ||
| 6176 | 6169 | [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] |
| 6177 | 6170 | public double? TickSize { get; set; } |
| 6178 | 6171 | |
| 6172 | + /// <summary> | |
| 6173 | + /// Boolean value that determines whether the axis should include ticks. | |
| 6174 | + /// </summary> | |
| 6175 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 6176 | + [JsonPropertyName("ticks")] | |
| 6177 | + public bool? Ticks { get; set; } | |
| 6178 | + | |
| 6179 | 6179 | /// <summary> |
| 6180 | 6180 | /// A title for the field. If `null`, the title will be removed. |
| 6181 | 6181 | /// |
| @@ -6855,6 +6855,16 @@ namespace QuickType | ||
| 6855 | 6855 | [JsonPropertyName("fill")] |
| 6856 | 6856 | public string? Fill { get; set; } |
| 6857 | 6857 | |
| 6858 | + /// <summary> | |
| 6859 | + /// The fill opacity (value between [0,1]). | |
| 6860 | + /// | |
| 6861 | + /// __Default value:__ `1` | |
| 6862 | + /// </summary> | |
| 6863 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 6864 | + [JsonPropertyName("fillOpacity")] | |
| 6865 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 6866 | + public double? FillOpacity { get; set; } | |
| 6867 | + | |
| 6858 | 6868 | /// <summary> |
| 6859 | 6869 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 6860 | 6870 | /// |
| @@ -6868,16 +6878,6 @@ namespace QuickType | ||
| 6868 | 6878 | [JsonPropertyName("filled")] |
| 6869 | 6879 | public bool? Filled { get; set; } |
| 6870 | 6880 | |
| 6871 | - /// <summary> | |
| 6872 | - /// The fill opacity (value between [0,1]). | |
| 6873 | - /// | |
| 6874 | - /// __Default value:__ `1` | |
| 6875 | - /// </summary> | |
| 6876 | - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 6877 | - [JsonPropertyName("fillOpacity")] | |
| 6878 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 6879 | - public double? FillOpacity { get; set; } | |
| 6880 | - | |
| 6881 | 6881 | /// <summary> |
| 6882 | 6882 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 6883 | 6883 | /// </summary> |
Mschema-csharpdefault / QuickType.cs+63 −63
| @@ -625,6 +625,15 @@ namespace QuickType | ||
| 625 | 625 | [JsonProperty("fill", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 626 | 626 | public string? Fill { get; set; } |
| 627 | 627 | |
| 628 | + /// <summary> | |
| 629 | + /// The fill opacity (value between [0,1]). | |
| 630 | + /// | |
| 631 | + /// __Default value:__ `1` | |
| 632 | + /// </summary> | |
| 633 | + [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 634 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 635 | + public double? FillOpacity { get; set; } | |
| 636 | + | |
| 628 | 637 | /// <summary> |
| 629 | 638 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 630 | 639 | /// |
| @@ -637,15 +646,6 @@ namespace QuickType | ||
| 637 | 646 | [JsonProperty("filled", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 638 | 647 | public bool? Filled { get; set; } |
| 639 | 648 | |
| 640 | - /// <summary> | |
| 641 | - /// The fill opacity (value between [0,1]). | |
| 642 | - /// | |
| 643 | - /// __Default value:__ `1` | |
| 644 | - /// </summary> | |
| 645 | - [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 646 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 647 | - public double? FillOpacity { get; set; } | |
| 648 | - | |
| 649 | 649 | /// <summary> |
| 650 | 650 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 651 | 651 | /// </summary> |
| @@ -1020,12 +1020,6 @@ namespace QuickType | ||
| 1020 | 1020 | [JsonProperty("tickRound", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 1021 | 1021 | public bool? TickRound { get; set; } |
| 1022 | 1022 | |
| 1023 | - /// <summary> | |
| 1024 | - /// Boolean value that determines whether the axis should include ticks. | |
| 1025 | - /// </summary> | |
| 1026 | - [JsonProperty("ticks", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 1027 | - public bool? Ticks { get; set; } | |
| 1028 | - | |
| 1029 | 1023 | /// <summary> |
| 1030 | 1024 | /// The size in pixels of axis ticks. |
| 1031 | 1025 | /// </summary> |
| @@ -1040,6 +1034,12 @@ namespace QuickType | ||
| 1040 | 1034 | [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] |
| 1041 | 1035 | public double? TickWidth { get; set; } |
| 1042 | 1036 | |
| 1037 | + /// <summary> | |
| 1038 | + /// Boolean value that determines whether the axis should include ticks. | |
| 1039 | + /// </summary> | |
| 1040 | + [JsonProperty("ticks", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 1041 | + public bool? Ticks { get; set; } | |
| 1042 | + | |
| 1043 | 1043 | /// <summary> |
| 1044 | 1044 | /// Horizontal text alignment of axis titles. |
| 1045 | 1045 | /// </summary> |
| @@ -1319,12 +1319,6 @@ namespace QuickType | ||
| 1319 | 1319 | [JsonProperty("tickRound", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 1320 | 1320 | public bool? TickRound { get; set; } |
| 1321 | 1321 | |
| 1322 | - /// <summary> | |
| 1323 | - /// Boolean value that determines whether the axis should include ticks. | |
| 1324 | - /// </summary> | |
| 1325 | - [JsonProperty("ticks", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 1326 | - public bool? Ticks { get; set; } | |
| 1327 | - | |
| 1328 | 1322 | /// <summary> |
| 1329 | 1323 | /// The size in pixels of axis ticks. |
| 1330 | 1324 | /// </summary> |
| @@ -1339,6 +1333,12 @@ namespace QuickType | ||
| 1339 | 1333 | [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] |
| 1340 | 1334 | public double? TickWidth { get; set; } |
| 1341 | 1335 | |
| 1336 | + /// <summary> | |
| 1337 | + /// Boolean value that determines whether the axis should include ticks. | |
| 1338 | + /// </summary> | |
| 1339 | + [JsonProperty("ticks", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 1340 | + public bool? Ticks { get; set; } | |
| 1341 | + | |
| 1342 | 1342 | /// <summary> |
| 1343 | 1343 | /// Horizontal text alignment of axis titles. |
| 1344 | 1344 | /// </summary> |
| @@ -1507,6 +1507,15 @@ namespace QuickType | ||
| 1507 | 1507 | [JsonProperty("fill", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 1508 | 1508 | public string? Fill { get; set; } |
| 1509 | 1509 | |
| 1510 | + /// <summary> | |
| 1511 | + /// The fill opacity (value between [0,1]). | |
| 1512 | + /// | |
| 1513 | + /// __Default value:__ `1` | |
| 1514 | + /// </summary> | |
| 1515 | + [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 1516 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 1517 | + public double? FillOpacity { get; set; } | |
| 1518 | + | |
| 1510 | 1519 | /// <summary> |
| 1511 | 1520 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 1512 | 1521 | /// |
| @@ -1519,15 +1528,6 @@ namespace QuickType | ||
| 1519 | 1528 | [JsonProperty("filled", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 1520 | 1529 | public bool? Filled { get; set; } |
| 1521 | 1530 | |
| 1522 | - /// <summary> | |
| 1523 | - /// The fill opacity (value between [0,1]). | |
| 1524 | - /// | |
| 1525 | - /// __Default value:__ `1` | |
| 1526 | - /// </summary> | |
| 1527 | - [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 1528 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 1529 | - public double? FillOpacity { get; set; } | |
| 1530 | - | |
| 1531 | 1531 | /// <summary> |
| 1532 | 1532 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1533 | 1533 | /// </summary> |
| @@ -2899,6 +2899,15 @@ namespace QuickType | ||
| 2899 | 2899 | [JsonProperty("fill", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 2900 | 2900 | public string? Fill { get; set; } |
| 2901 | 2901 | |
| 2902 | + /// <summary> | |
| 2903 | + /// The fill opacity (value between [0,1]). | |
| 2904 | + /// | |
| 2905 | + /// __Default value:__ `1` | |
| 2906 | + /// </summary> | |
| 2907 | + [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 2908 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 2909 | + public double? FillOpacity { get; set; } | |
| 2910 | + | |
| 2902 | 2911 | /// <summary> |
| 2903 | 2912 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 2904 | 2913 | /// |
| @@ -2911,15 +2920,6 @@ namespace QuickType | ||
| 2911 | 2920 | [JsonProperty("filled", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 2912 | 2921 | public bool? Filled { get; set; } |
| 2913 | 2922 | |
| 2914 | - /// <summary> | |
| 2915 | - /// The fill opacity (value between [0,1]). | |
| 2916 | - /// | |
| 2917 | - /// __Default value:__ `1` | |
| 2918 | - /// </summary> | |
| 2919 | - [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 2920 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 2921 | - public double? FillOpacity { get; set; } | |
| 2922 | - | |
| 2923 | 2923 | /// <summary> |
| 2924 | 2924 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 2925 | 2925 | /// </summary> |
| @@ -3173,6 +3173,15 @@ namespace QuickType | ||
| 3173 | 3173 | [JsonProperty("fill", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 3174 | 3174 | public string? Fill { get; set; } |
| 3175 | 3175 | |
| 3176 | + /// <summary> | |
| 3177 | + /// The fill opacity (value between [0,1]). | |
| 3178 | + /// | |
| 3179 | + /// __Default value:__ `1` | |
| 3180 | + /// </summary> | |
| 3181 | + [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 3182 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 3183 | + public double? FillOpacity { get; set; } | |
| 3184 | + | |
| 3176 | 3185 | /// <summary> |
| 3177 | 3186 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 3178 | 3187 | /// |
| @@ -3185,15 +3194,6 @@ namespace QuickType | ||
| 3185 | 3194 | [JsonProperty("filled", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 3186 | 3195 | public bool? Filled { get; set; } |
| 3187 | 3196 | |
| 3188 | - /// <summary> | |
| 3189 | - /// The fill opacity (value between [0,1]). | |
| 3190 | - /// | |
| 3191 | - /// __Default value:__ `1` | |
| 3192 | - /// </summary> | |
| 3193 | - [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 3194 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 3195 | - public double? FillOpacity { get; set; } | |
| 3196 | - | |
| 3197 | 3197 | /// <summary> |
| 3198 | 3198 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3199 | 3199 | /// </summary> |
| @@ -5556,12 +5556,6 @@ namespace QuickType | ||
| 5556 | 5556 | [JsonProperty("tickCount", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 5557 | 5557 | public double? TickCount { get; set; } |
| 5558 | 5558 | |
| 5559 | - /// <summary> | |
| 5560 | - /// Boolean value that determines whether the axis should include ticks. | |
| 5561 | - /// </summary> | |
| 5562 | - [JsonProperty("ticks", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 5563 | - public bool? Ticks { get; set; } | |
| 5564 | - | |
| 5565 | 5559 | /// <summary> |
| 5566 | 5560 | /// The size in pixels of axis ticks. |
| 5567 | 5561 | /// </summary> |
| @@ -5569,6 +5563,12 @@ namespace QuickType | ||
| 5569 | 5563 | [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))] |
| 5570 | 5564 | public double? TickSize { get; set; } |
| 5571 | 5565 | |
| 5566 | + /// <summary> | |
| 5567 | + /// Boolean value that determines whether the axis should include ticks. | |
| 5568 | + /// </summary> | |
| 5569 | + [JsonProperty("ticks", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 5570 | + public bool? Ticks { get; set; } | |
| 5571 | + | |
| 5572 | 5572 | /// <summary> |
| 5573 | 5573 | /// A title for the field. If `null`, the title will be removed. |
| 5574 | 5574 | /// |
| @@ -6183,6 +6183,15 @@ namespace QuickType | ||
| 6183 | 6183 | [JsonProperty("fill", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 6184 | 6184 | public string? Fill { get; set; } |
| 6185 | 6185 | |
| 6186 | + /// <summary> | |
| 6187 | + /// The fill opacity (value between [0,1]). | |
| 6188 | + /// | |
| 6189 | + /// __Default value:__ `1` | |
| 6190 | + /// </summary> | |
| 6191 | + [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 6192 | + [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 6193 | + public double? FillOpacity { get; set; } | |
| 6194 | + | |
| 6186 | 6195 | /// <summary> |
| 6187 | 6196 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 6188 | 6197 | /// |
| @@ -6195,15 +6204,6 @@ namespace QuickType | ||
| 6195 | 6204 | [JsonProperty("filled", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 6196 | 6205 | public bool? Filled { get; set; } |
| 6197 | 6206 | |
| 6198 | - /// <summary> | |
| 6199 | - /// The fill opacity (value between [0,1]). | |
| 6200 | - /// | |
| 6201 | - /// __Default value:__ `1` | |
| 6202 | - /// </summary> | |
| 6203 | - [JsonProperty("fillOpacity", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 6204 | - [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))] | |
| 6205 | - public double? FillOpacity { get; set; } | |
| 6206 | - | |
| 6207 | 6207 | /// <summary> |
| 6208 | 6208 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 6209 | 6209 | /// </summary> |
Mschema-dartdefault / TopLevel.dart+58 −58
| @@ -646,6 +646,11 @@ class MarkConfig { | ||
| 646 | 646 | ///__Default value:__ (None) |
| 647 | 647 | final String? fill; |
| 648 | 648 | |
| 649 | + ///The fill opacity (value between [0,1]). | |
| 650 | + /// | |
| 651 | + ///__Default value:__ `1` | |
| 652 | + final double? fillOpacity; | |
| 653 | + | |
| 649 | 654 | ///Whether the mark's color should be used as fill color instead of stroke color. |
| 650 | 655 | /// |
| 651 | 656 | ///__Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -655,11 +660,6 @@ class MarkConfig { | ||
| 655 | 660 | ///__Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 656 | 661 | final bool? filled; |
| 657 | 662 | |
| 658 | - ///The fill opacity (value between [0,1]). | |
| 659 | - /// | |
| 660 | - ///__Default value:__ `1` | |
| 661 | - final double? fillOpacity; | |
| 662 | - | |
| 663 | 663 | ///The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 664 | 664 | final String? font; |
| 665 | 665 | |
| @@ -773,8 +773,8 @@ class MarkConfig { | ||
| 773 | 773 | this.dx, |
| 774 | 774 | this.dy, |
| 775 | 775 | this.fill, |
| 776 | - this.filled, | |
| 777 | 776 | this.fillOpacity, |
| 777 | + this.filled, | |
| 778 | 778 | this.font, |
| 779 | 779 | this.fontSize, |
| 780 | 780 | this.fontStyle, |
| @@ -806,8 +806,8 @@ class MarkConfig { | ||
| 806 | 806 | dx: json["dx"]?.toDouble(), |
| 807 | 807 | dy: json["dy"]?.toDouble(), |
| 808 | 808 | fill: json["fill"], |
| 809 | - filled: json["filled"], | |
| 810 | 809 | fillOpacity: json["fillOpacity"]?.toDouble(), |
| 810 | + filled: json["filled"], | |
| 811 | 811 | font: json["font"], |
| 812 | 812 | fontSize: json["fontSize"]?.toDouble(), |
| 813 | 813 | fontStyle: fontStyleValues.map[json["fontStyle"]], |
| @@ -839,8 +839,8 @@ class MarkConfig { | ||
| 839 | 839 | "dx": dx, |
| 840 | 840 | "dy": dy, |
| 841 | 841 | "fill": fill, |
| 842 | - "filled": filled, | |
| 843 | 842 | "fillOpacity": fillOpacity, |
| 843 | + "filled": filled, | |
| 844 | 844 | "font": font, |
| 845 | 845 | "fontSize": fontSize, |
| 846 | 846 | "fontStyle": fontStyleValues.reverse[fontStyle], |
| @@ -1195,15 +1195,15 @@ class AxisConfig { | ||
| 1195 | 1195 | ///Boolean flag indicating if pixel position values should be rounded to the nearest integer. |
| 1196 | 1196 | final bool? tickRound; |
| 1197 | 1197 | |
| 1198 | - ///Boolean value that determines whether the axis should include ticks. | |
| 1199 | - final bool? ticks; | |
| 1200 | - | |
| 1201 | 1198 | ///The size in pixels of axis ticks. |
| 1202 | 1199 | final double? tickSize; |
| 1203 | 1200 | |
| 1204 | 1201 | ///The width, in pixels, of ticks. |
| 1205 | 1202 | final double? tickWidth; |
| 1206 | 1203 | |
| 1204 | + ///Boolean value that determines whether the axis should include ticks. | |
| 1205 | + final bool? ticks; | |
| 1206 | + | |
| 1207 | 1207 | ///Horizontal text alignment of axis titles. |
| 1208 | 1208 | final String? titleAlign; |
| 1209 | 1209 | |
| @@ -1266,9 +1266,9 @@ class AxisConfig { | ||
| 1266 | 1266 | this.shortTimeLabels, |
| 1267 | 1267 | this.tickColor, |
| 1268 | 1268 | this.tickRound, |
| 1269 | - this.ticks, | |
| 1270 | 1269 | this.tickSize, |
| 1271 | 1270 | this.tickWidth, |
| 1271 | + this.ticks, | |
| 1272 | 1272 | this.titleAlign, |
| 1273 | 1273 | this.titleAngle, |
| 1274 | 1274 | this.titleBaseline, |
| @@ -1308,9 +1308,9 @@ class AxisConfig { | ||
| 1308 | 1308 | shortTimeLabels: json["shortTimeLabels"], |
| 1309 | 1309 | tickColor: json["tickColor"], |
| 1310 | 1310 | tickRound: json["tickRound"], |
| 1311 | - ticks: json["ticks"], | |
| 1312 | 1311 | tickSize: json["tickSize"]?.toDouble(), |
| 1313 | 1312 | tickWidth: json["tickWidth"]?.toDouble(), |
| 1313 | + ticks: json["ticks"], | |
| 1314 | 1314 | titleAlign: json["titleAlign"], |
| 1315 | 1315 | titleAngle: json["titleAngle"]?.toDouble(), |
| 1316 | 1316 | titleBaseline: json["titleBaseline"], |
| @@ -1350,9 +1350,9 @@ class AxisConfig { | ||
| 1350 | 1350 | "shortTimeLabels": shortTimeLabels, |
| 1351 | 1351 | "tickColor": tickColor, |
| 1352 | 1352 | "tickRound": tickRound, |
| 1353 | - "ticks": ticks, | |
| 1354 | 1353 | "tickSize": tickSize, |
| 1355 | 1354 | "tickWidth": tickWidth, |
| 1355 | + "ticks": ticks, | |
| 1356 | 1356 | "titleAlign": titleAlign, |
| 1357 | 1357 | "titleAngle": titleAngle, |
| 1358 | 1358 | "titleBaseline": titleBaseline, |
| @@ -1508,15 +1508,15 @@ class VgAxisConfig { | ||
| 1508 | 1508 | ///Boolean flag indicating if pixel position values should be rounded to the nearest integer. |
| 1509 | 1509 | final bool? tickRound; |
| 1510 | 1510 | |
| 1511 | - ///Boolean value that determines whether the axis should include ticks. | |
| 1512 | - final bool? ticks; | |
| 1513 | - | |
| 1514 | 1511 | ///The size in pixels of axis ticks. |
| 1515 | 1512 | final double? tickSize; |
| 1516 | 1513 | |
| 1517 | 1514 | ///The width, in pixels, of ticks. |
| 1518 | 1515 | final double? tickWidth; |
| 1519 | 1516 | |
| 1517 | + ///Boolean value that determines whether the axis should include ticks. | |
| 1518 | + final bool? ticks; | |
| 1519 | + | |
| 1520 | 1520 | ///Horizontal text alignment of axis titles. |
| 1521 | 1521 | final String? titleAlign; |
| 1522 | 1522 | |
| @@ -1578,9 +1578,9 @@ class VgAxisConfig { | ||
| 1578 | 1578 | this.minExtent, |
| 1579 | 1579 | this.tickColor, |
| 1580 | 1580 | this.tickRound, |
| 1581 | - this.ticks, | |
| 1582 | 1581 | this.tickSize, |
| 1583 | 1582 | this.tickWidth, |
| 1583 | + this.ticks, | |
| 1584 | 1584 | this.titleAlign, |
| 1585 | 1585 | this.titleAngle, |
| 1586 | 1586 | this.titleBaseline, |
| @@ -1619,9 +1619,9 @@ class VgAxisConfig { | ||
| 1619 | 1619 | minExtent: json["minExtent"]?.toDouble(), |
| 1620 | 1620 | tickColor: json["tickColor"], |
| 1621 | 1621 | tickRound: json["tickRound"], |
| 1622 | - ticks: json["ticks"], | |
| 1623 | 1622 | tickSize: json["tickSize"]?.toDouble(), |
| 1624 | 1623 | tickWidth: json["tickWidth"]?.toDouble(), |
| 1624 | + ticks: json["ticks"], | |
| 1625 | 1625 | titleAlign: json["titleAlign"], |
| 1626 | 1626 | titleAngle: json["titleAngle"]?.toDouble(), |
| 1627 | 1627 | titleBaseline: json["titleBaseline"], |
| @@ -1660,9 +1660,9 @@ class VgAxisConfig { | ||
| 1660 | 1660 | "minExtent": minExtent, |
| 1661 | 1661 | "tickColor": tickColor, |
| 1662 | 1662 | "tickRound": tickRound, |
| 1663 | - "ticks": ticks, | |
| 1664 | 1663 | "tickSize": tickSize, |
| 1665 | 1664 | "tickWidth": tickWidth, |
| 1665 | + "ticks": ticks, | |
| 1666 | 1666 | "titleAlign": titleAlign, |
| 1667 | 1667 | "titleAngle": titleAngle, |
| 1668 | 1668 | "titleBaseline": titleBaseline, |
| @@ -1733,6 +1733,11 @@ class BarConfig { | ||
| 1733 | 1733 | ///__Default value:__ (None) |
| 1734 | 1734 | final String? fill; |
| 1735 | 1735 | |
| 1736 | + ///The fill opacity (value between [0,1]). | |
| 1737 | + /// | |
| 1738 | + ///__Default value:__ `1` | |
| 1739 | + final double? fillOpacity; | |
| 1740 | + | |
| 1736 | 1741 | ///Whether the mark's color should be used as fill color instead of stroke color. |
| 1737 | 1742 | /// |
| 1738 | 1743 | ///__Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -1742,11 +1747,6 @@ class BarConfig { | ||
| 1742 | 1747 | ///__Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 1743 | 1748 | final bool? filled; |
| 1744 | 1749 | |
| 1745 | - ///The fill opacity (value between [0,1]). | |
| 1746 | - /// | |
| 1747 | - ///__Default value:__ `1` | |
| 1748 | - final double? fillOpacity; | |
| 1749 | - | |
| 1750 | 1750 | ///The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1751 | 1751 | final String? font; |
| 1752 | 1752 | |
| @@ -1863,8 +1863,8 @@ class BarConfig { | ||
| 1863 | 1863 | this.dx, |
| 1864 | 1864 | this.dy, |
| 1865 | 1865 | this.fill, |
| 1866 | - this.filled, | |
| 1867 | 1866 | this.fillOpacity, |
| 1867 | + this.filled, | |
| 1868 | 1868 | this.font, |
| 1869 | 1869 | this.fontSize, |
| 1870 | 1870 | this.fontStyle, |
| @@ -1899,8 +1899,8 @@ class BarConfig { | ||
| 1899 | 1899 | dx: json["dx"]?.toDouble(), |
| 1900 | 1900 | dy: json["dy"]?.toDouble(), |
| 1901 | 1901 | fill: json["fill"], |
| 1902 | - filled: json["filled"], | |
| 1903 | 1902 | fillOpacity: json["fillOpacity"]?.toDouble(), |
| 1903 | + filled: json["filled"], | |
| 1904 | 1904 | font: json["font"], |
| 1905 | 1905 | fontSize: json["fontSize"]?.toDouble(), |
| 1906 | 1906 | fontStyle: fontStyleValues.map[json["fontStyle"]], |
| @@ -1935,8 +1935,8 @@ class BarConfig { | ||
| 1935 | 1935 | "dx": dx, |
| 1936 | 1936 | "dy": dy, |
| 1937 | 1937 | "fill": fill, |
| 1938 | - "filled": filled, | |
| 1939 | 1938 | "fillOpacity": fillOpacity, |
| 1939 | + "filled": filled, | |
| 1940 | 1940 | "font": font, |
| 1941 | 1941 | "fontSize": fontSize, |
| 1942 | 1942 | "fontStyle": fontStyleValues.reverse[fontStyle], |
| @@ -3410,6 +3410,11 @@ class TextConfig { | ||
| 3410 | 3410 | ///__Default value:__ (None) |
| 3411 | 3411 | final String? fill; |
| 3412 | 3412 | |
| 3413 | + ///The fill opacity (value between [0,1]). | |
| 3414 | + /// | |
| 3415 | + ///__Default value:__ `1` | |
| 3416 | + final double? fillOpacity; | |
| 3417 | + | |
| 3413 | 3418 | ///Whether the mark's color should be used as fill color instead of stroke color. |
| 3414 | 3419 | /// |
| 3415 | 3420 | ///__Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -3419,11 +3424,6 @@ class TextConfig { | ||
| 3419 | 3424 | ///__Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 3420 | 3425 | final bool? filled; |
| 3421 | 3426 | |
| 3422 | - ///The fill opacity (value between [0,1]). | |
| 3423 | - /// | |
| 3424 | - ///__Default value:__ `1` | |
| 3425 | - final double? fillOpacity; | |
| 3426 | - | |
| 3427 | 3427 | ///The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3428 | 3428 | final String? font; |
| 3429 | 3429 | |
| @@ -3540,8 +3540,8 @@ class TextConfig { | ||
| 3540 | 3540 | this.dx, |
| 3541 | 3541 | this.dy, |
| 3542 | 3542 | this.fill, |
| 3543 | - this.filled, | |
| 3544 | 3543 | this.fillOpacity, |
| 3544 | + this.filled, | |
| 3545 | 3545 | this.font, |
| 3546 | 3546 | this.fontSize, |
| 3547 | 3547 | this.fontStyle, |
| @@ -3574,8 +3574,8 @@ class TextConfig { | ||
| 3574 | 3574 | dx: json["dx"]?.toDouble(), |
| 3575 | 3575 | dy: json["dy"]?.toDouble(), |
| 3576 | 3576 | fill: json["fill"], |
| 3577 | - filled: json["filled"], | |
| 3578 | 3577 | fillOpacity: json["fillOpacity"]?.toDouble(), |
| 3578 | + filled: json["filled"], | |
| 3579 | 3579 | font: json["font"], |
| 3580 | 3580 | fontSize: json["fontSize"]?.toDouble(), |
| 3581 | 3581 | fontStyle: fontStyleValues.map[json["fontStyle"]], |
| @@ -3608,8 +3608,8 @@ class TextConfig { | ||
| 3608 | 3608 | "dx": dx, |
| 3609 | 3609 | "dy": dy, |
| 3610 | 3610 | "fill": fill, |
| 3611 | - "filled": filled, | |
| 3612 | 3611 | "fillOpacity": fillOpacity, |
| 3612 | + "filled": filled, | |
| 3613 | 3613 | "font": font, |
| 3614 | 3614 | "fontSize": fontSize, |
| 3615 | 3615 | "fontStyle": fontStyleValues.reverse[fontStyle], |
| @@ -3679,6 +3679,11 @@ class TickConfig { | ||
| 3679 | 3679 | ///__Default value:__ (None) |
| 3680 | 3680 | final String? fill; |
| 3681 | 3681 | |
| 3682 | + ///The fill opacity (value between [0,1]). | |
| 3683 | + /// | |
| 3684 | + ///__Default value:__ `1` | |
| 3685 | + final double? fillOpacity; | |
| 3686 | + | |
| 3682 | 3687 | ///Whether the mark's color should be used as fill color instead of stroke color. |
| 3683 | 3688 | /// |
| 3684 | 3689 | ///__Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -3688,11 +3693,6 @@ class TickConfig { | ||
| 3688 | 3693 | ///__Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 3689 | 3694 | final bool? filled; |
| 3690 | 3695 | |
| 3691 | - ///The fill opacity (value between [0,1]). | |
| 3692 | - /// | |
| 3693 | - ///__Default value:__ `1` | |
| 3694 | - final double? fillOpacity; | |
| 3695 | - | |
| 3696 | 3696 | ///The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3697 | 3697 | final String? font; |
| 3698 | 3698 | |
| @@ -3812,8 +3812,8 @@ class TickConfig { | ||
| 3812 | 3812 | this.dx, |
| 3813 | 3813 | this.dy, |
| 3814 | 3814 | this.fill, |
| 3815 | - this.filled, | |
| 3816 | 3815 | this.fillOpacity, |
| 3816 | + this.filled, | |
| 3817 | 3817 | this.font, |
| 3818 | 3818 | this.fontSize, |
| 3819 | 3819 | this.fontStyle, |
| @@ -3847,8 +3847,8 @@ class TickConfig { | ||
| 3847 | 3847 | dx: json["dx"]?.toDouble(), |
| 3848 | 3848 | dy: json["dy"]?.toDouble(), |
| 3849 | 3849 | fill: json["fill"], |
| 3850 | - filled: json["filled"], | |
| 3851 | 3850 | fillOpacity: json["fillOpacity"]?.toDouble(), |
| 3851 | + filled: json["filled"], | |
| 3852 | 3852 | font: json["font"], |
| 3853 | 3853 | fontSize: json["fontSize"]?.toDouble(), |
| 3854 | 3854 | fontStyle: fontStyleValues.map[json["fontStyle"]], |
| @@ -3882,8 +3882,8 @@ class TickConfig { | ||
| 3882 | 3882 | "dx": dx, |
| 3883 | 3883 | "dy": dy, |
| 3884 | 3884 | "fill": fill, |
| 3885 | - "filled": filled, | |
| 3886 | 3885 | "fillOpacity": fillOpacity, |
| 3886 | + "filled": filled, | |
| 3887 | 3887 | "font": font, |
| 3888 | 3888 | "fontSize": fontSize, |
| 3889 | 3889 | "fontStyle": fontStyleValues.reverse[fontStyle], |
| @@ -6684,12 +6684,12 @@ class Axis { | ||
| 6684 | 6684 | ///underlying scale's range. |
| 6685 | 6685 | final double? tickCount; |
| 6686 | 6686 | |
| 6687 | - ///Boolean value that determines whether the axis should include ticks. | |
| 6688 | - final bool? ticks; | |
| 6689 | - | |
| 6690 | 6687 | ///The size in pixels of axis ticks. |
| 6691 | 6688 | final double? tickSize; |
| 6692 | 6689 | |
| 6690 | + ///Boolean value that determines whether the axis should include ticks. | |
| 6691 | + final bool? ticks; | |
| 6692 | + | |
| 6693 | 6693 | ///A title for the field. If `null`, the title will be removed. |
| 6694 | 6694 | /// |
| 6695 | 6695 | ///__Default value:__ derived from the field's name and transformation function |
| @@ -6738,8 +6738,8 @@ class Axis { | ||
| 6738 | 6738 | this.orient, |
| 6739 | 6739 | this.position, |
| 6740 | 6740 | this.tickCount, |
| 6741 | - this.ticks, | |
| 6742 | 6741 | this.tickSize, |
| 6742 | + this.ticks, | |
| 6743 | 6743 | this.title, |
| 6744 | 6744 | this.titleMaxLength, |
| 6745 | 6745 | this.titlePadding, |
| @@ -6763,8 +6763,8 @@ class Axis { | ||
| 6763 | 6763 | orient: titleOrientValues.map[json["orient"]], |
| 6764 | 6764 | position: json["position"]?.toDouble(), |
| 6765 | 6765 | tickCount: json["tickCount"]?.toDouble(), |
| 6766 | - ticks: json["ticks"], | |
| 6767 | 6766 | tickSize: json["tickSize"]?.toDouble(), |
| 6767 | + ticks: json["ticks"], | |
| 6768 | 6768 | title: json["title"], |
| 6769 | 6769 | titleMaxLength: json["titleMaxLength"]?.toDouble(), |
| 6770 | 6770 | titlePadding: json["titlePadding"]?.toDouble(), |
| @@ -6788,8 +6788,8 @@ class Axis { | ||
| 6788 | 6788 | "orient": titleOrientValues.reverse[orient], |
| 6789 | 6789 | "position": position, |
| 6790 | 6790 | "tickCount": tickCount, |
| 6791 | - "ticks": ticks, | |
| 6792 | 6791 | "tickSize": tickSize, |
| 6792 | + "ticks": ticks, | |
| 6793 | 6793 | "title": title, |
| 6794 | 6794 | "titleMaxLength": titleMaxLength, |
| 6795 | 6795 | "titlePadding": titlePadding, |
| @@ -7375,6 +7375,11 @@ class MarkDef { | ||
| 7375 | 7375 | ///__Default value:__ (None) |
| 7376 | 7376 | final String? fill; |
| 7377 | 7377 | |
| 7378 | + ///The fill opacity (value between [0,1]). | |
| 7379 | + /// | |
| 7380 | + ///__Default value:__ `1` | |
| 7381 | + final double? fillOpacity; | |
| 7382 | + | |
| 7378 | 7383 | ///Whether the mark's color should be used as fill color instead of stroke color. |
| 7379 | 7384 | /// |
| 7380 | 7385 | ///__Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -7384,11 +7389,6 @@ class MarkDef { | ||
| 7384 | 7389 | ///__Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 7385 | 7390 | final bool? filled; |
| 7386 | 7391 | |
| 7387 | - ///The fill opacity (value between [0,1]). | |
| 7388 | - /// | |
| 7389 | - ///__Default value:__ `1` | |
| 7390 | - final double? fillOpacity; | |
| 7391 | - | |
| 7392 | 7392 | ///The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 7393 | 7393 | final String? font; |
| 7394 | 7394 | |
| @@ -7521,8 +7521,8 @@ class MarkDef { | ||
| 7521 | 7521 | this.dx, |
| 7522 | 7522 | this.dy, |
| 7523 | 7523 | this.fill, |
| 7524 | - this.filled, | |
| 7525 | 7524 | this.fillOpacity, |
| 7525 | + this.filled, | |
| 7526 | 7526 | this.font, |
| 7527 | 7527 | this.fontSize, |
| 7528 | 7528 | this.fontStyle, |
| @@ -7557,8 +7557,8 @@ class MarkDef { | ||
| 7557 | 7557 | dx: json["dx"]?.toDouble(), |
| 7558 | 7558 | dy: json["dy"]?.toDouble(), |
| 7559 | 7559 | fill: json["fill"], |
| 7560 | - filled: json["filled"], | |
| 7561 | 7560 | fillOpacity: json["fillOpacity"]?.toDouble(), |
| 7561 | + filled: json["filled"], | |
| 7562 | 7562 | font: json["font"], |
| 7563 | 7563 | fontSize: json["fontSize"]?.toDouble(), |
| 7564 | 7564 | fontStyle: fontStyleValues.map[json["fontStyle"]], |
| @@ -7593,8 +7593,8 @@ class MarkDef { | ||
| 7593 | 7593 | "dx": dx, |
| 7594 | 7594 | "dy": dy, |
| 7595 | 7595 | "fill": fill, |
| 7596 | - "filled": filled, | |
| 7597 | 7596 | "fillOpacity": fillOpacity, |
| 7597 | + "filled": filled, | |
| 7598 | 7598 | "font": font, |
| 7599 | 7599 | "fontSize": fontSize, |
| 7600 | 7600 | "fontStyle": fontStyleValues.reverse[fontStyle], |
Mschema-elixirdefault / QuickType.ex+40 −40
| @@ -602,8 +602,8 @@ defmodule MarkConfig do | ||
| 602 | 602 | - `:dx` - The horizontal offset, in pixels, between the text label and its anchor point. The offsetis applied after rotation by the _angle_ property. |
| 603 | 603 | - `:dy` - The vertical offset, in pixels, between the text label and its anchor point. The offsetis applied after rotation by the _angle_ property. |
| 604 | 604 | - `:fill` - Default Fill Color. This has higher precedence than config.color__Default value:__ (None) |
| 605 | - - `:filled` - Whether the mark's color should be used as fill color instead of stroke color.__Default value:__ `true` for all marks except `point` and `false` for `point`.__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.__Note:__ This property cannot be used in a [style config](mark.html#style-config). | |
| 606 | 605 | - `:fill_opacity` - The fill opacity (value between [0,1]).__Default value:__ `1` |
| 606 | + - `:filled` - Whether the mark's color should be used as fill color instead of stroke color.__Default value:__ `true` for all marks except `point` and `false` for `point`.__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.__Note:__ This property cannot be used in a [style config](mark.html#style-config). | |
| 607 | 607 | - `:font` - The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 608 | 608 | - `:font_size` - The font size, in pixels. |
| 609 | 609 | - `:font_style` - The font style (e.g., `"italic"`). |
| @@ -626,7 +626,7 @@ defmodule MarkConfig do | ||
| 626 | 626 | - `:theta` - Polar coordinate angle, in radians, of the text label from the origin determined by the`x` and `y` properties. Values for `theta` follow the same convention of `arc` mark`startAngle` and `endAngle` properties: angles are measured in radians, with `0`indicating "north". |
| 627 | 627 | """ |
| 628 | 628 | |
| 629 | - defstruct [:align, :angle, :baseline, :color, :cursor, :dx, :dy, :fill, :filled, :fill_opacity, :font, :font_size, :font_style, :font_weight, :href, :interpolate, :limit, :opacity, :orient, :radius, :shape, :size, :stroke, :stroke_dash, :stroke_dash_offset, :stroke_opacity, :stroke_width, :tension, :text, :theta] | |
| 629 | + defstruct [:align, :angle, :baseline, :color, :cursor, :dx, :dy, :fill, :fill_opacity, :filled, :font, :font_size, :font_style, :font_weight, :href, :interpolate, :limit, :opacity, :orient, :radius, :shape, :size, :stroke, :stroke_dash, :stroke_dash_offset, :stroke_opacity, :stroke_width, :tension, :text, :theta] | |
| 630 | 630 | |
| 631 | 631 | @type t :: %__MODULE__{ |
| 632 | 632 | align: HorizontalAlign.t() | nil, |
| @@ -637,8 +637,8 @@ defmodule MarkConfig do | ||
| 637 | 637 | dx: float() | nil, |
| 638 | 638 | dy: float() | nil, |
| 639 | 639 | fill: String.t() | nil, |
| 640 | - filled: boolean() | nil, | |
| 641 | 640 | fill_opacity: float() | nil, |
| 641 | + filled: boolean() | nil, | |
| 642 | 642 | font: String.t() | nil, |
| 643 | 643 | font_size: float() | nil, |
| 644 | 644 | font_style: FontStyle.t() | nil, |
| @@ -683,8 +683,8 @@ defmodule MarkConfig do | ||
| 683 | 683 | dx: m["dx"], |
| 684 | 684 | dy: m["dy"], |
| 685 | 685 | fill: m["fill"], |
| 686 | - filled: m["filled"], | |
| 687 | 686 | fill_opacity: m["fillOpacity"], |
| 687 | + filled: m["filled"], | |
| 688 | 688 | font: m["font"], |
| 689 | 689 | font_size: m["fontSize"], |
| 690 | 690 | font_style: m["fontStyle"] && FontStyle.decode(m["fontStyle"]), |
| @@ -724,8 +724,8 @@ defmodule MarkConfig do | ||
| 724 | 724 | "dx" => struct.dx, |
| 725 | 725 | "dy" => struct.dy, |
| 726 | 726 | "fill" => struct.fill, |
| 727 | - "filled" => struct.filled, | |
| 728 | 727 | "fillOpacity" => struct.fill_opacity, |
| 728 | + "filled" => struct.filled, | |
| 729 | 729 | "font" => struct.font, |
| 730 | 730 | "fontSize" => struct.font_size, |
| 731 | 731 | "fontStyle" => struct.font_style && FontStyle.encode(struct.font_style), |
| @@ -831,9 +831,9 @@ defmodule AxisConfig do | ||
| 831 | 831 | - `:short_time_labels` - Whether month names and weekday names should be abbreviated.__Default value:__ `false` |
| 832 | 832 | - `:tick_color` - The color of the axis's tick. |
| 833 | 833 | - `:tick_round` - Boolean flag indicating if pixel position values should be rounded to the nearest integer. |
| 834 | - - `:ticks` - Boolean value that determines whether the axis should include ticks. | |
| 835 | 834 | - `:tick_size` - The size in pixels of axis ticks. |
| 836 | 835 | - `:tick_width` - The width, in pixels, of ticks. |
| 836 | + - `:ticks` - Boolean value that determines whether the axis should include ticks. | |
| 837 | 837 | - `:title_align` - Horizontal text alignment of axis titles. |
| 838 | 838 | - `:title_angle` - Angle in degrees of axis titles. |
| 839 | 839 | - `:title_baseline` - Vertical text baseline for axis titles. |
| @@ -848,7 +848,7 @@ defmodule AxisConfig do | ||
| 848 | 848 | - `:title_y` - Y-coordinate of the axis title relative to the axis group. |
| 849 | 849 | """ |
| 850 | 850 | |
| 851 | - defstruct [:band_position, :domain, :domain_color, :domain_width, :grid, :grid_color, :grid_dash, :grid_opacity, :grid_width, :label_angle, :label_bound, :label_color, :label_flush, :label_font, :label_font_size, :label_limit, :label_overlap, :label_padding, :labels, :max_extent, :min_extent, :short_time_labels, :tick_color, :tick_round, :ticks, :tick_size, :tick_width, :title_align, :title_angle, :title_baseline, :title_color, :title_font, :title_font_size, :title_font_weight, :title_limit, :title_max_length, :title_padding, :title_x, :title_y] | |
| 851 | + defstruct [:band_position, :domain, :domain_color, :domain_width, :grid, :grid_color, :grid_dash, :grid_opacity, :grid_width, :label_angle, :label_bound, :label_color, :label_flush, :label_font, :label_font_size, :label_limit, :label_overlap, :label_padding, :labels, :max_extent, :min_extent, :short_time_labels, :tick_color, :tick_round, :tick_size, :tick_width, :ticks, :title_align, :title_angle, :title_baseline, :title_color, :title_font, :title_font_size, :title_font_weight, :title_limit, :title_max_length, :title_padding, :title_x, :title_y] | |
| 852 | 852 | |
| 853 | 853 | @type t :: %__MODULE__{ |
| 854 | 854 | band_position: float() | nil, |
| @@ -875,9 +875,9 @@ defmodule AxisConfig do | ||
| 875 | 875 | short_time_labels: boolean() | nil, |
| 876 | 876 | tick_color: String.t() | nil, |
| 877 | 877 | tick_round: boolean() | nil, |
| 878 | - ticks: boolean() | nil, | |
| 879 | 878 | tick_size: float() | nil, |
| 880 | 879 | tick_width: float() | nil, |
| 880 | + ticks: boolean() | nil, | |
| 881 | 881 | title_align: String.t() | nil, |
| 882 | 882 | title_angle: float() | nil, |
| 883 | 883 | title_baseline: String.t() | nil, |
| @@ -928,9 +928,9 @@ defmodule AxisConfig do | ||
| 928 | 928 | short_time_labels: m["shortTimeLabels"], |
| 929 | 929 | tick_color: m["tickColor"], |
| 930 | 930 | tick_round: m["tickRound"], |
| 931 | - ticks: m["ticks"], | |
| 932 | 931 | tick_size: m["tickSize"], |
| 933 | 932 | tick_width: m["tickWidth"], |
| 933 | + ticks: m["ticks"], | |
| 934 | 934 | title_align: m["titleAlign"], |
| 935 | 935 | title_angle: m["titleAngle"], |
| 936 | 936 | title_baseline: m["titleBaseline"], |
| @@ -978,9 +978,9 @@ defmodule AxisConfig do | ||
| 978 | 978 | "shortTimeLabels" => struct.short_time_labels, |
| 979 | 979 | "tickColor" => struct.tick_color, |
| 980 | 980 | "tickRound" => struct.tick_round, |
| 981 | - "ticks" => struct.ticks, | |
| 982 | 981 | "tickSize" => struct.tick_size, |
| 983 | 982 | "tickWidth" => struct.tick_width, |
| 983 | + "ticks" => struct.ticks, | |
| 984 | 984 | "titleAlign" => struct.title_align, |
| 985 | 985 | "titleAngle" => struct.title_angle, |
| 986 | 986 | "titleBaseline" => struct.title_baseline, |
| @@ -1041,9 +1041,9 @@ defmodule VGAxisConfig do | ||
| 1041 | 1041 | - `:min_extent` - The minimum extent in pixels that axis ticks and labels should use. This determines aminimum offset value for axis titles.__Default value:__ `30` for y-axis; `undefined` for x-axis. |
| 1042 | 1042 | - `:tick_color` - The color of the axis's tick. |
| 1043 | 1043 | - `:tick_round` - Boolean flag indicating if pixel position values should be rounded to the nearest integer. |
| 1044 | - - `:ticks` - Boolean value that determines whether the axis should include ticks. | |
| 1045 | 1044 | - `:tick_size` - The size in pixels of axis ticks. |
| 1046 | 1045 | - `:tick_width` - The width, in pixels, of ticks. |
| 1046 | + - `:ticks` - Boolean value that determines whether the axis should include ticks. | |
| 1047 | 1047 | - `:title_align` - Horizontal text alignment of axis titles. |
| 1048 | 1048 | - `:title_angle` - Angle in degrees of axis titles. |
| 1049 | 1049 | - `:title_baseline` - Vertical text baseline for axis titles. |
| @@ -1058,7 +1058,7 @@ defmodule VGAxisConfig do | ||
| 1058 | 1058 | - `:title_y` - Y-coordinate of the axis title relative to the axis group. |
| 1059 | 1059 | """ |
| 1060 | 1060 | |
| 1061 | - defstruct [:band_position, :domain, :domain_color, :domain_width, :grid, :grid_color, :grid_dash, :grid_opacity, :grid_width, :label_angle, :label_bound, :label_color, :label_flush, :label_font, :label_font_size, :label_limit, :label_overlap, :label_padding, :labels, :max_extent, :min_extent, :tick_color, :tick_round, :ticks, :tick_size, :tick_width, :title_align, :title_angle, :title_baseline, :title_color, :title_font, :title_font_size, :title_font_weight, :title_limit, :title_max_length, :title_padding, :title_x, :title_y] | |
| 1061 | + defstruct [:band_position, :domain, :domain_color, :domain_width, :grid, :grid_color, :grid_dash, :grid_opacity, :grid_width, :label_angle, :label_bound, :label_color, :label_flush, :label_font, :label_font_size, :label_limit, :label_overlap, :label_padding, :labels, :max_extent, :min_extent, :tick_color, :tick_round, :tick_size, :tick_width, :ticks, :title_align, :title_angle, :title_baseline, :title_color, :title_font, :title_font_size, :title_font_weight, :title_limit, :title_max_length, :title_padding, :title_x, :title_y] | |
| 1062 | 1062 | |
| 1063 | 1063 | @type t :: %__MODULE__{ |
| 1064 | 1064 | band_position: float() | nil, |
| @@ -1084,9 +1084,9 @@ defmodule VGAxisConfig do | ||
| 1084 | 1084 | min_extent: float() | nil, |
| 1085 | 1085 | tick_color: String.t() | nil, |
| 1086 | 1086 | tick_round: boolean() | nil, |
| 1087 | - ticks: boolean() | nil, | |
| 1088 | 1087 | tick_size: float() | nil, |
| 1089 | 1088 | tick_width: float() | nil, |
| 1089 | + ticks: boolean() | nil, | |
| 1090 | 1090 | title_align: String.t() | nil, |
| 1091 | 1091 | title_angle: float() | nil, |
| 1092 | 1092 | title_baseline: String.t() | nil, |
| @@ -1136,9 +1136,9 @@ defmodule VGAxisConfig do | ||
| 1136 | 1136 | min_extent: m["minExtent"], |
| 1137 | 1137 | tick_color: m["tickColor"], |
| 1138 | 1138 | tick_round: m["tickRound"], |
| 1139 | - ticks: m["ticks"], | |
| 1140 | 1139 | tick_size: m["tickSize"], |
| 1141 | 1140 | tick_width: m["tickWidth"], |
| 1141 | + ticks: m["ticks"], | |
| 1142 | 1142 | title_align: m["titleAlign"], |
| 1143 | 1143 | title_angle: m["titleAngle"], |
| 1144 | 1144 | title_baseline: m["titleBaseline"], |
| @@ -1185,9 +1185,9 @@ defmodule VGAxisConfig do | ||
| 1185 | 1185 | "minExtent" => struct.min_extent, |
| 1186 | 1186 | "tickColor" => struct.tick_color, |
| 1187 | 1187 | "tickRound" => struct.tick_round, |
| 1188 | - "ticks" => struct.ticks, | |
| 1189 | 1188 | "tickSize" => struct.tick_size, |
| 1190 | 1189 | "tickWidth" => struct.tick_width, |
| 1190 | + "ticks" => struct.ticks, | |
| 1191 | 1191 | "titleAlign" => struct.title_align, |
| 1192 | 1192 | "titleAngle" => struct.title_angle, |
| 1193 | 1193 | "titleBaseline" => struct.title_baseline, |
| @@ -1224,8 +1224,8 @@ defmodule BarConfig do | ||
| 1224 | 1224 | - `:dx` - The horizontal offset, in pixels, between the text label and its anchor point. The offsetis applied after rotation by the _angle_ property. |
| 1225 | 1225 | - `:dy` - The vertical offset, in pixels, between the text label and its anchor point. The offsetis applied after rotation by the _angle_ property. |
| 1226 | 1226 | - `:fill` - Default Fill Color. This has higher precedence than config.color__Default value:__ (None) |
| 1227 | - - `:filled` - Whether the mark's color should be used as fill color instead of stroke color.__Default value:__ `true` for all marks except `point` and `false` for `point`.__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.__Note:__ This property cannot be used in a [style config](mark.html#style-config). | |
| 1228 | 1227 | - `:fill_opacity` - The fill opacity (value between [0,1]).__Default value:__ `1` |
| 1228 | + - `:filled` - Whether the mark's color should be used as fill color instead of stroke color.__Default value:__ `true` for all marks except `point` and `false` for `point`.__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.__Note:__ This property cannot be used in a [style config](mark.html#style-config). | |
| 1229 | 1229 | - `:font` - The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1230 | 1230 | - `:font_size` - The font size, in pixels. |
| 1231 | 1231 | - `:font_style` - The font style (e.g., `"italic"`). |
| @@ -1248,7 +1248,7 @@ defmodule BarConfig do | ||
| 1248 | 1248 | - `:theta` - Polar coordinate angle, in radians, of the text label from the origin determined by the`x` and `y` properties. Values for `theta` follow the same convention of `arc` mark`startAngle` and `endAngle` properties: angles are measured in radians, with `0`indicating "north". |
| 1249 | 1249 | """ |
| 1250 | 1250 | |
| 1251 | - defstruct [:align, :angle, :baseline, :bin_spacing, :color, :continuous_band_size, :cursor, :discrete_band_size, :dx, :dy, :fill, :filled, :fill_opacity, :font, :font_size, :font_style, :font_weight, :href, :interpolate, :limit, :opacity, :orient, :radius, :shape, :size, :stroke, :stroke_dash, :stroke_dash_offset, :stroke_opacity, :stroke_width, :tension, :text, :theta] | |
| 1251 | + defstruct [:align, :angle, :baseline, :bin_spacing, :color, :continuous_band_size, :cursor, :discrete_band_size, :dx, :dy, :fill, :fill_opacity, :filled, :font, :font_size, :font_style, :font_weight, :href, :interpolate, :limit, :opacity, :orient, :radius, :shape, :size, :stroke, :stroke_dash, :stroke_dash_offset, :stroke_opacity, :stroke_width, :tension, :text, :theta] | |
| 1252 | 1252 | |
| 1253 | 1253 | @type t :: %__MODULE__{ |
| 1254 | 1254 | align: HorizontalAlign.t() | nil, |
| @@ -1262,8 +1262,8 @@ defmodule BarConfig do | ||
| 1262 | 1262 | dx: float() | nil, |
| 1263 | 1263 | dy: float() | nil, |
| 1264 | 1264 | fill: String.t() | nil, |
| 1265 | - filled: boolean() | nil, | |
| 1266 | 1265 | fill_opacity: float() | nil, |
| 1266 | + filled: boolean() | nil, | |
| 1267 | 1267 | font: String.t() | nil, |
| 1268 | 1268 | font_size: float() | nil, |
| 1269 | 1269 | font_style: FontStyle.t() | nil, |
| @@ -1311,8 +1311,8 @@ defmodule BarConfig do | ||
| 1311 | 1311 | dx: m["dx"], |
| 1312 | 1312 | dy: m["dy"], |
| 1313 | 1313 | fill: m["fill"], |
| 1314 | - filled: m["filled"], | |
| 1315 | 1314 | fill_opacity: m["fillOpacity"], |
| 1315 | + filled: m["filled"], | |
| 1316 | 1316 | font: m["font"], |
| 1317 | 1317 | font_size: m["fontSize"], |
| 1318 | 1318 | font_style: m["fontStyle"] && FontStyle.decode(m["fontStyle"]), |
| @@ -1355,8 +1355,8 @@ defmodule BarConfig do | ||
| 1355 | 1355 | "dx" => struct.dx, |
| 1356 | 1356 | "dy" => struct.dy, |
| 1357 | 1357 | "fill" => struct.fill, |
| 1358 | - "filled" => struct.filled, | |
| 1359 | 1358 | "fillOpacity" => struct.fill_opacity, |
| 1359 | + "filled" => struct.filled, | |
| 1360 | 1360 | "font" => struct.font, |
| 1361 | 1361 | "fontSize" => struct.font_size, |
| 1362 | 1362 | "fontStyle" => struct.font_style && FontStyle.encode(struct.font_style), |
| @@ -2879,8 +2879,8 @@ defmodule TextConfig do | ||
| 2879 | 2879 | - `:dx` - The horizontal offset, in pixels, between the text label and its anchor point. The offsetis applied after rotation by the _angle_ property. |
| 2880 | 2880 | - `:dy` - The vertical offset, in pixels, between the text label and its anchor point. The offsetis applied after rotation by the _angle_ property. |
| 2881 | 2881 | - `:fill` - Default Fill Color. This has higher precedence than config.color__Default value:__ (None) |
| 2882 | - - `:filled` - Whether the mark's color should be used as fill color instead of stroke color.__Default value:__ `true` for all marks except `point` and `false` for `point`.__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.__Note:__ This property cannot be used in a [style config](mark.html#style-config). | |
| 2883 | 2882 | - `:fill_opacity` - The fill opacity (value between [0,1]).__Default value:__ `1` |
| 2883 | + - `:filled` - Whether the mark's color should be used as fill color instead of stroke color.__Default value:__ `true` for all marks except `point` and `false` for `point`.__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.__Note:__ This property cannot be used in a [style config](mark.html#style-config). | |
| 2884 | 2884 | - `:font` - The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 2885 | 2885 | - `:font_size` - The font size, in pixels. |
| 2886 | 2886 | - `:font_style` - The font style (e.g., `"italic"`). |
| @@ -2904,7 +2904,7 @@ defmodule TextConfig do | ||
| 2904 | 2904 | - `:theta` - Polar coordinate angle, in radians, of the text label from the origin determined by the`x` and `y` properties. Values for `theta` follow the same convention of `arc` mark`startAngle` and `endAngle` properties: angles are measured in radians, with `0`indicating "north". |
| 2905 | 2905 | """ |
| 2906 | 2906 | |
| 2907 | - defstruct [:align, :angle, :baseline, :color, :cursor, :dx, :dy, :fill, :filled, :fill_opacity, :font, :font_size, :font_style, :font_weight, :href, :interpolate, :limit, :opacity, :orient, :radius, :shape, :short_time_labels, :size, :stroke, :stroke_dash, :stroke_dash_offset, :stroke_opacity, :stroke_width, :tension, :text, :theta] | |
| 2907 | + defstruct [:align, :angle, :baseline, :color, :cursor, :dx, :dy, :fill, :fill_opacity, :filled, :font, :font_size, :font_style, :font_weight, :href, :interpolate, :limit, :opacity, :orient, :radius, :shape, :short_time_labels, :size, :stroke, :stroke_dash, :stroke_dash_offset, :stroke_opacity, :stroke_width, :tension, :text, :theta] | |
| 2908 | 2908 | |
| 2909 | 2909 | @type t :: %__MODULE__{ |
| 2910 | 2910 | align: HorizontalAlign.t() | nil, |
| @@ -2915,8 +2915,8 @@ defmodule TextConfig do | ||
| 2915 | 2915 | dx: float() | nil, |
| 2916 | 2916 | dy: float() | nil, |
| 2917 | 2917 | fill: String.t() | nil, |
| 2918 | - filled: boolean() | nil, | |
| 2919 | 2918 | fill_opacity: float() | nil, |
| 2919 | + filled: boolean() | nil, | |
| 2920 | 2920 | font: String.t() | nil, |
| 2921 | 2921 | font_size: float() | nil, |
| 2922 | 2922 | font_style: FontStyle.t() | nil, |
| @@ -2962,8 +2962,8 @@ defmodule TextConfig do | ||
| 2962 | 2962 | dx: m["dx"], |
| 2963 | 2963 | dy: m["dy"], |
| 2964 | 2964 | fill: m["fill"], |
| 2965 | - filled: m["filled"], | |
| 2966 | 2965 | fill_opacity: m["fillOpacity"], |
| 2966 | + filled: m["filled"], | |
| 2967 | 2967 | font: m["font"], |
| 2968 | 2968 | font_size: m["fontSize"], |
| 2969 | 2969 | font_style: m["fontStyle"] && FontStyle.decode(m["fontStyle"]), |
| @@ -3004,8 +3004,8 @@ defmodule TextConfig do | ||
| 3004 | 3004 | "dx" => struct.dx, |
| 3005 | 3005 | "dy" => struct.dy, |
| 3006 | 3006 | "fill" => struct.fill, |
| 3007 | - "filled" => struct.filled, | |
| 3008 | 3007 | "fillOpacity" => struct.fill_opacity, |
| 3008 | + "filled" => struct.filled, | |
| 3009 | 3009 | "font" => struct.font, |
| 3010 | 3010 | "fontSize" => struct.font_size, |
| 3011 | 3011 | "fontStyle" => struct.font_style && FontStyle.encode(struct.font_style), |
| @@ -3049,8 +3049,8 @@ defmodule TickConfig do | ||
| 3049 | 3049 | - `:dx` - The horizontal offset, in pixels, between the text label and its anchor point. The offsetis applied after rotation by the _angle_ property. |
| 3050 | 3050 | - `:dy` - The vertical offset, in pixels, between the text label and its anchor point. The offsetis applied after rotation by the _angle_ property. |
| 3051 | 3051 | - `:fill` - Default Fill Color. This has higher precedence than config.color__Default value:__ (None) |
| 3052 | - - `:filled` - Whether the mark's color should be used as fill color instead of stroke color.__Default value:__ `true` for all marks except `point` and `false` for `point`.__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.__Note:__ This property cannot be used in a [style config](mark.html#style-config). | |
| 3053 | 3052 | - `:fill_opacity` - The fill opacity (value between [0,1]).__Default value:__ `1` |
| 3053 | + - `:filled` - Whether the mark's color should be used as fill color instead of stroke color.__Default value:__ `true` for all marks except `point` and `false` for `point`.__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.__Note:__ This property cannot be used in a [style config](mark.html#style-config). | |
| 3054 | 3054 | - `:font` - The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3055 | 3055 | - `:font_size` - The font size, in pixels. |
| 3056 | 3056 | - `:font_style` - The font style (e.g., `"italic"`). |
| @@ -3074,7 +3074,7 @@ defmodule TickConfig do | ||
| 3074 | 3074 | - `:thickness` - Thickness of the tick mark.__Default value:__ `1` |
| 3075 | 3075 | """ |
| 3076 | 3076 | |
| 3077 | - defstruct [:align, :angle, :band_size, :baseline, :color, :cursor, :dx, :dy, :fill, :filled, :fill_opacity, :font, :font_size, :font_style, :font_weight, :href, :interpolate, :limit, :opacity, :orient, :radius, :shape, :size, :stroke, :stroke_dash, :stroke_dash_offset, :stroke_opacity, :stroke_width, :tension, :text, :theta, :thickness] | |
| 3077 | + defstruct [:align, :angle, :band_size, :baseline, :color, :cursor, :dx, :dy, :fill, :fill_opacity, :filled, :font, :font_size, :font_style, :font_weight, :href, :interpolate, :limit, :opacity, :orient, :radius, :shape, :size, :stroke, :stroke_dash, :stroke_dash_offset, :stroke_opacity, :stroke_width, :tension, :text, :theta, :thickness] | |
| 3078 | 3078 | |
| 3079 | 3079 | @type t :: %__MODULE__{ |
| 3080 | 3080 | align: HorizontalAlign.t() | nil, |
| @@ -3086,8 +3086,8 @@ defmodule TickConfig do | ||
| 3086 | 3086 | dx: float() | nil, |
| 3087 | 3087 | dy: float() | nil, |
| 3088 | 3088 | fill: String.t() | nil, |
| 3089 | - filled: boolean() | nil, | |
| 3090 | 3089 | fill_opacity: float() | nil, |
| 3090 | + filled: boolean() | nil, | |
| 3091 | 3091 | font: String.t() | nil, |
| 3092 | 3092 | font_size: float() | nil, |
| 3093 | 3093 | font_style: FontStyle.t() | nil, |
| @@ -3134,8 +3134,8 @@ defmodule TickConfig do | ||
| 3134 | 3134 | dx: m["dx"], |
| 3135 | 3135 | dy: m["dy"], |
| 3136 | 3136 | fill: m["fill"], |
| 3137 | - filled: m["filled"], | |
| 3138 | 3137 | fill_opacity: m["fillOpacity"], |
| 3138 | + filled: m["filled"], | |
| 3139 | 3139 | font: m["font"], |
| 3140 | 3140 | font_size: m["fontSize"], |
| 3141 | 3141 | font_style: m["fontStyle"] && FontStyle.decode(m["fontStyle"]), |
| @@ -3177,8 +3177,8 @@ defmodule TickConfig do | ||
| 3177 | 3177 | "dx" => struct.dx, |
| 3178 | 3178 | "dy" => struct.dy, |
| 3179 | 3179 | "fill" => struct.fill, |
| 3180 | - "filled" => struct.filled, | |
| 3181 | 3180 | "fillOpacity" => struct.fill_opacity, |
| 3181 | + "filled" => struct.filled, | |
| 3182 | 3182 | "font" => struct.font, |
| 3183 | 3183 | "fontSize" => struct.font_size, |
| 3184 | 3184 | "fontStyle" => struct.font_style && FontStyle.encode(struct.font_style), |
| @@ -6443,8 +6443,8 @@ defmodule Axis do | ||
| 6443 | 6443 | - `:orient` - The orientation of the axis. One of `"top"`, `"bottom"`, `"left"` or `"right"`. Theorientation can be used to further specialize the axis type (e.g., a y axis oriented forthe right edge of the chart).__Default value:__ `"bottom"` for x-axes and `"left"` for y-axes. |
| 6444 | 6444 | - `:position` - The anchor position of the axis in pixels. For x-axis with top or bottom orientation,this sets the axis group x coordinate. For y-axis with left or right orientation, thissets the axis group y coordinate.__Default value__: `0` |
| 6445 | 6445 | - `:tick_count` - A desired number of ticks, for axes visualizing quantitative scales. The resulting numbermay be different so that values are "nice" (multiples of 2, 5, 10) and lie within theunderlying scale's range. |
| 6446 | - - `:ticks` - Boolean value that determines whether the axis should include ticks. | |
| 6447 | 6446 | - `:tick_size` - The size in pixels of axis ticks. |
| 6447 | + - `:ticks` - Boolean value that determines whether the axis should include ticks. | |
| 6448 | 6448 | - `:title` - A title for the field. If `null`, the title will be removed.__Default value:__ derived from the field's name and transformation function(`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, thefunction is displayed as a part of the title (e.g., `"Sum of Profit"`). If the field isbinned or has a time unit applied, the applied function will be denoted in parentheses(e.g., `"Profit (binned)"`, `"Transaction Date (year-month)"`). Otherwise, the title issimply the field name.__Note__: You can customize the default field title format by providing the [`fieldTitle`property in the [config](config.html) or [`fieldTitle` function via the `compile`function's options](compile.html#field-title). |
| 6449 | 6449 | - `:title_max_length` - Max length for axis title if the title is automatically generated from the field'sdescription. |
| 6450 | 6450 | - `:title_padding` - The padding, in pixels, between title and axis. |
| @@ -6452,7 +6452,7 @@ defmodule Axis do | ||
| 6452 | 6452 | - `:zindex` - A non-positive integer indicating z-index of the axis.If zindex is 0, axes should be drawn behind all chart elements.To put them in front, use `"zindex = 1"`.__Default value:__ `1` (in front of the marks) for actual axis and `0` (behind the marks)for grids. |
| 6453 | 6453 | """ |
| 6454 | 6454 | |
| 6455 | - defstruct [:domain, :format, :grid, :label_angle, :label_bound, :label_flush, :label_overlap, :label_padding, :labels, :max_extent, :min_extent, :offset, :orient, :position, :tick_count, :ticks, :tick_size, :title, :title_max_length, :title_padding, :values, :zindex] | |
| 6455 | + defstruct [:domain, :format, :grid, :label_angle, :label_bound, :label_flush, :label_overlap, :label_padding, :labels, :max_extent, :min_extent, :offset, :orient, :position, :tick_count, :tick_size, :ticks, :title, :title_max_length, :title_padding, :values, :zindex] | |
| 6456 | 6456 | |
| 6457 | 6457 | @type t :: %__MODULE__{ |
| 6458 | 6458 | domain: boolean() | nil, |
| @@ -6470,8 +6470,8 @@ defmodule Axis do | ||
| 6470 | 6470 | orient: TitleOrient.t() | nil, |
| 6471 | 6471 | position: float() | nil, |
| 6472 | 6472 | tick_count: float() | nil, |
| 6473 | - ticks: boolean() | nil, | |
| 6474 | 6473 | tick_size: float() | nil, |
| 6474 | + ticks: boolean() | nil, | |
| 6475 | 6475 | title: nil | String.t() | nil, |
| 6476 | 6476 | title_max_length: float() | nil, |
| 6477 | 6477 | title_padding: float() | nil, |
| @@ -6516,8 +6516,8 @@ defmodule Axis do | ||
| 6516 | 6516 | orient: m["orient"] && TitleOrient.decode(m["orient"]), |
| 6517 | 6517 | position: m["position"], |
| 6518 | 6518 | tick_count: m["tickCount"], |
| 6519 | - ticks: m["ticks"], | |
| 6520 | 6519 | tick_size: m["tickSize"], |
| 6520 | + ticks: m["ticks"], | |
| 6521 | 6521 | title: m["title"], |
| 6522 | 6522 | title_max_length: m["titleMaxLength"], |
| 6523 | 6523 | title_padding: m["titlePadding"], |
| @@ -6549,8 +6549,8 @@ defmodule Axis do | ||
| 6549 | 6549 | "orient" => struct.orient && TitleOrient.encode(struct.orient), |
| 6550 | 6550 | "position" => struct.position, |
| 6551 | 6551 | "tickCount" => struct.tick_count, |
| 6552 | - "ticks" => struct.ticks, | |
| 6553 | 6552 | "tickSize" => struct.tick_size, |
| 6553 | + "ticks" => struct.ticks, | |
| 6554 | 6554 | "title" => struct.title, |
| 6555 | 6555 | "titleMaxLength" => struct.title_max_length, |
| 6556 | 6556 | "titlePadding" => struct.title_padding, |
| @@ -7089,8 +7089,8 @@ defmodule MarkDef do | ||
| 7089 | 7089 | - `:dx` - The horizontal offset, in pixels, between the text label and its anchor point. The offsetis applied after rotation by the _angle_ property. |
| 7090 | 7090 | - `:dy` - The vertical offset, in pixels, between the text label and its anchor point. The offsetis applied after rotation by the _angle_ property. |
| 7091 | 7091 | - `:fill` - Default Fill Color. This has higher precedence than config.color__Default value:__ (None) |
| 7092 | - - `:filled` - Whether the mark's color should be used as fill color instead of stroke color.__Default value:__ `true` for all marks except `point` and `false` for `point`.__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.__Note:__ This property cannot be used in a [style config](mark.html#style-config). | |
| 7093 | 7092 | - `:fill_opacity` - The fill opacity (value between [0,1]).__Default value:__ `1` |
| 7093 | + - `:filled` - Whether the mark's color should be used as fill color instead of stroke color.__Default value:__ `true` for all marks except `point` and `false` for `point`.__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.__Note:__ This property cannot be used in a [style config](mark.html#style-config). | |
| 7094 | 7094 | - `:font` - The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 7095 | 7095 | - `:font_size` - The font size, in pixels. |
| 7096 | 7096 | - `:font_style` - The font style (e.g., `"italic"`). |
| @@ -7116,7 +7116,7 @@ defmodule MarkDef do | ||
| 7116 | 7116 | """ |
| 7117 | 7117 | |
| 7118 | 7118 | @enforce_keys [:type] |
| 7119 | - defstruct [:align, :angle, :baseline, :clip, :color, :cursor, :dx, :dy, :fill, :filled, :fill_opacity, :font, :font_size, :font_style, :font_weight, :href, :interpolate, :limit, :opacity, :orient, :radius, :shape, :size, :stroke, :stroke_dash, :stroke_dash_offset, :stroke_opacity, :stroke_width, :style, :tension, :text, :theta, :type] | |
| 7119 | + defstruct [:align, :angle, :baseline, :clip, :color, :cursor, :dx, :dy, :fill, :fill_opacity, :filled, :font, :font_size, :font_style, :font_weight, :href, :interpolate, :limit, :opacity, :orient, :radius, :shape, :size, :stroke, :stroke_dash, :stroke_dash_offset, :stroke_opacity, :stroke_width, :style, :tension, :text, :theta, :type] | |
| 7120 | 7120 | |
| 7121 | 7121 | @type t :: %__MODULE__{ |
| 7122 | 7122 | align: HorizontalAlign.t() | nil, |
| @@ -7128,8 +7128,8 @@ defmodule MarkDef do | ||
| 7128 | 7128 | dx: float() | nil, |
| 7129 | 7129 | dy: float() | nil, |
| 7130 | 7130 | fill: String.t() | nil, |
| 7131 | - filled: boolean() | nil, | |
| 7132 | 7131 | fill_opacity: float() | nil, |
| 7132 | + filled: boolean() | nil, | |
| 7133 | 7133 | font: String.t() | nil, |
| 7134 | 7134 | font_size: float() | nil, |
| 7135 | 7135 | font_style: FontStyle.t() | nil, |
| @@ -7187,8 +7187,8 @@ defmodule MarkDef do | ||
| 7187 | 7187 | dx: m["dx"], |
| 7188 | 7188 | dy: m["dy"], |
| 7189 | 7189 | fill: m["fill"], |
| 7190 | - filled: m["filled"], | |
| 7191 | 7190 | fill_opacity: m["fillOpacity"], |
| 7191 | + filled: m["filled"], | |
| 7192 | 7192 | font: m["font"], |
| 7193 | 7193 | font_size: m["fontSize"], |
| 7194 | 7194 | font_style: m["fontStyle"] && FontStyle.decode(m["fontStyle"]), |
| @@ -7231,8 +7231,8 @@ defmodule MarkDef do | ||
| 7231 | 7231 | "dx" => struct.dx, |
| 7232 | 7232 | "dy" => struct.dy, |
| 7233 | 7233 | "fill" => struct.fill, |
| 7234 | - "filled" => struct.filled, | |
| 7235 | 7234 | "fillOpacity" => struct.fill_opacity, |
| 7235 | + "filled" => struct.filled, | |
| 7236 | 7236 | "font" => struct.font, |
| 7237 | 7237 | "fontSize" => struct.font_size, |
| 7238 | 7238 | "fontStyle" => struct.font_style && FontStyle.encode(struct.font_style), |
Mschema-flowdefault / TopLevel.js+50 −50
| @@ -503,6 +503,12 @@ export type MarkConfig = { | ||
| 503 | 503 | * __Default value:__ (None) |
| 504 | 504 | */ |
| 505 | 505 | fill?: string; |
| 506 | + /** | |
| 507 | + * The fill opacity (value between [0,1]). | |
| 508 | + * | |
| 509 | + * __Default value:__ `1` | |
| 510 | + */ | |
| 511 | + fillOpacity?: number; | |
| 506 | 512 | /** |
| 507 | 513 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 508 | 514 | * |
| @@ -513,12 +519,6 @@ export type MarkConfig = { | ||
| 513 | 519 | * __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 514 | 520 | */ |
| 515 | 521 | filled?: boolean; |
| 516 | - /** | |
| 517 | - * The fill opacity (value between [0,1]). | |
| 518 | - * | |
| 519 | - * __Default value:__ `1` | |
| 520 | - */ | |
| 521 | - fillOpacity?: number; | |
| 522 | 522 | /** |
| 523 | 523 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 524 | 524 | */ |
| @@ -924,10 +924,6 @@ export type AxisConfig = { | ||
| 924 | 924 | * Boolean flag indicating if pixel position values should be rounded to the nearest integer. |
| 925 | 925 | */ |
| 926 | 926 | tickRound?: boolean; |
| 927 | - /** | |
| 928 | - * Boolean value that determines whether the axis should include ticks. | |
| 929 | - */ | |
| 930 | - ticks?: boolean; | |
| 931 | 927 | /** |
| 932 | 928 | * The size in pixels of axis ticks. |
| 933 | 929 | */ |
| @@ -936,6 +932,10 @@ export type AxisConfig = { | ||
| 936 | 932 | * The width, in pixels, of ticks. |
| 937 | 933 | */ |
| 938 | 934 | tickWidth?: number; |
| 935 | + /** | |
| 936 | + * Boolean value that determines whether the axis should include ticks. | |
| 937 | + */ | |
| 938 | + ticks?: boolean; | |
| 939 | 939 | /** |
| 940 | 940 | * Horizontal text alignment of axis titles. |
| 941 | 941 | */ |
| @@ -1174,10 +1174,6 @@ export type VGAxisConfig = { | ||
| 1174 | 1174 | * Boolean flag indicating if pixel position values should be rounded to the nearest integer. |
| 1175 | 1175 | */ |
| 1176 | 1176 | tickRound?: boolean; |
| 1177 | - /** | |
| 1178 | - * Boolean value that determines whether the axis should include ticks. | |
| 1179 | - */ | |
| 1180 | - ticks?: boolean; | |
| 1181 | 1177 | /** |
| 1182 | 1178 | * The size in pixels of axis ticks. |
| 1183 | 1179 | */ |
| @@ -1186,6 +1182,10 @@ export type VGAxisConfig = { | ||
| 1186 | 1182 | * The width, in pixels, of ticks. |
| 1187 | 1183 | */ |
| 1188 | 1184 | tickWidth?: number; |
| 1185 | + /** | |
| 1186 | + * Boolean value that determines whether the axis should include ticks. | |
| 1187 | + */ | |
| 1188 | + ticks?: boolean; | |
| 1189 | 1189 | /** |
| 1190 | 1190 | * Horizontal text alignment of axis titles. |
| 1191 | 1191 | */ |
| @@ -1303,6 +1303,12 @@ export type BarConfig = { | ||
| 1303 | 1303 | * __Default value:__ (None) |
| 1304 | 1304 | */ |
| 1305 | 1305 | fill?: string; |
| 1306 | + /** | |
| 1307 | + * The fill opacity (value between [0,1]). | |
| 1308 | + * | |
| 1309 | + * __Default value:__ `1` | |
| 1310 | + */ | |
| 1311 | + fillOpacity?: number; | |
| 1306 | 1312 | /** |
| 1307 | 1313 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 1308 | 1314 | * |
| @@ -1313,12 +1319,6 @@ export type BarConfig = { | ||
| 1313 | 1319 | * __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 1314 | 1320 | */ |
| 1315 | 1321 | filled?: boolean; |
| 1316 | - /** | |
| 1317 | - * The fill opacity (value between [0,1]). | |
| 1318 | - * | |
| 1319 | - * __Default value:__ `1` | |
| 1320 | - */ | |
| 1321 | - fillOpacity?: number; | |
| 1322 | 1322 | /** |
| 1323 | 1323 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1324 | 1324 | */ |
| @@ -2525,6 +2525,12 @@ export type TextConfig = { | ||
| 2525 | 2525 | * __Default value:__ (None) |
| 2526 | 2526 | */ |
| 2527 | 2527 | fill?: string; |
| 2528 | + /** | |
| 2529 | + * The fill opacity (value between [0,1]). | |
| 2530 | + * | |
| 2531 | + * __Default value:__ `1` | |
| 2532 | + */ | |
| 2533 | + fillOpacity?: number; | |
| 2528 | 2534 | /** |
| 2529 | 2535 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 2530 | 2536 | * |
| @@ -2535,12 +2541,6 @@ export type TextConfig = { | ||
| 2535 | 2541 | * __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 2536 | 2542 | */ |
| 2537 | 2543 | filled?: boolean; |
| 2538 | - /** | |
| 2539 | - * The fill opacity (value between [0,1]). | |
| 2540 | - * | |
| 2541 | - * __Default value:__ `1` | |
| 2542 | - */ | |
| 2543 | - fillOpacity?: number; | |
| 2544 | 2544 | /** |
| 2545 | 2545 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 2546 | 2546 | */ |
| @@ -2725,6 +2725,12 @@ export type TickConfig = { | ||
| 2725 | 2725 | * __Default value:__ (None) |
| 2726 | 2726 | */ |
| 2727 | 2727 | fill?: string; |
| 2728 | + /** | |
| 2729 | + * The fill opacity (value between [0,1]). | |
| 2730 | + * | |
| 2731 | + * __Default value:__ `1` | |
| 2732 | + */ | |
| 2733 | + fillOpacity?: number; | |
| 2728 | 2734 | /** |
| 2729 | 2735 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 2730 | 2736 | * |
| @@ -2735,12 +2741,6 @@ export type TickConfig = { | ||
| 2735 | 2741 | * __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 2736 | 2742 | */ |
| 2737 | 2743 | filled?: boolean; |
| 2738 | - /** | |
| 2739 | - * The fill opacity (value between [0,1]). | |
| 2740 | - * | |
| 2741 | - * __Default value:__ `1` | |
| 2742 | - */ | |
| 2743 | - fillOpacity?: number; | |
| 2744 | 2744 | /** |
| 2745 | 2745 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 2746 | 2746 | */ |
| @@ -5025,14 +5025,14 @@ export type Axis = { | ||
| 5025 | 5025 | * underlying scale's range. |
| 5026 | 5026 | */ |
| 5027 | 5027 | tickCount?: number; |
| 5028 | - /** | |
| 5029 | - * Boolean value that determines whether the axis should include ticks. | |
| 5030 | - */ | |
| 5031 | - ticks?: boolean; | |
| 5032 | 5028 | /** |
| 5033 | 5029 | * The size in pixels of axis ticks. |
| 5034 | 5030 | */ |
| 5035 | 5031 | tickSize?: number; |
| 5032 | + /** | |
| 5033 | + * Boolean value that determines whether the axis should include ticks. | |
| 5034 | + */ | |
| 5035 | + ticks?: boolean; | |
| 5036 | 5036 | /** |
| 5037 | 5037 | * A title for the field. If `null`, the title will be removed. |
| 5038 | 5038 | * |
| @@ -5523,6 +5523,12 @@ export type MarkDef = { | ||
| 5523 | 5523 | * __Default value:__ (None) |
| 5524 | 5524 | */ |
| 5525 | 5525 | fill?: string; |
| 5526 | + /** | |
| 5527 | + * The fill opacity (value between [0,1]). | |
| 5528 | + * | |
| 5529 | + * __Default value:__ `1` | |
| 5530 | + */ | |
| 5531 | + fillOpacity?: number; | |
| 5526 | 5532 | /** |
| 5527 | 5533 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 5528 | 5534 | * |
| @@ -5533,12 +5539,6 @@ export type MarkDef = { | ||
| 5533 | 5539 | * __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 5534 | 5540 | */ |
| 5535 | 5541 | filled?: boolean; |
| 5536 | - /** | |
| 5537 | - * The fill opacity (value between [0,1]). | |
| 5538 | - * | |
| 5539 | - * __Default value:__ `1` | |
| 5540 | - */ | |
| 5541 | - fillOpacity?: number; | |
| 5542 | 5542 | /** |
| 5543 | 5543 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 5544 | 5544 | */ |
| @@ -6347,8 +6347,8 @@ const typeMap: any = { | ||
| 6347 | 6347 | { json: "dx", js: "dx", typ: u(undefined, 3.14) }, |
| 6348 | 6348 | { json: "dy", js: "dy", typ: u(undefined, 3.14) }, |
| 6349 | 6349 | { json: "fill", js: "fill", typ: u(undefined, "") }, |
| 6350 | - { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 6351 | 6350 | { json: "fillOpacity", js: "fillOpacity", typ: u(undefined, 3.14) }, |
| 6351 | + { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 6352 | 6352 | { json: "font", js: "font", typ: u(undefined, "") }, |
| 6353 | 6353 | { json: "fontSize", js: "fontSize", typ: u(undefined, 3.14) }, |
| 6354 | 6354 | { json: "fontStyle", js: "fontStyle", typ: u(undefined, r("FontStyle")) }, |
| @@ -6395,9 +6395,9 @@ const typeMap: any = { | ||
| 6395 | 6395 | { json: "shortTimeLabels", js: "shortTimeLabels", typ: u(undefined, true) }, |
| 6396 | 6396 | { json: "tickColor", js: "tickColor", typ: u(undefined, "") }, |
| 6397 | 6397 | { json: "tickRound", js: "tickRound", typ: u(undefined, true) }, |
| 6398 | - { json: "ticks", js: "ticks", typ: u(undefined, true) }, | |
| 6399 | 6398 | { json: "tickSize", js: "tickSize", typ: u(undefined, 3.14) }, |
| 6400 | 6399 | { json: "tickWidth", js: "tickWidth", typ: u(undefined, 3.14) }, |
| 6400 | + { json: "ticks", js: "ticks", typ: u(undefined, true) }, | |
| 6401 | 6401 | { json: "titleAlign", js: "titleAlign", typ: u(undefined, "") }, |
| 6402 | 6402 | { json: "titleAngle", js: "titleAngle", typ: u(undefined, 3.14) }, |
| 6403 | 6403 | { json: "titleBaseline", js: "titleBaseline", typ: u(undefined, "") }, |
| @@ -6435,9 +6435,9 @@ const typeMap: any = { | ||
| 6435 | 6435 | { json: "minExtent", js: "minExtent", typ: u(undefined, 3.14) }, |
| 6436 | 6436 | { json: "tickColor", js: "tickColor", typ: u(undefined, "") }, |
| 6437 | 6437 | { json: "tickRound", js: "tickRound", typ: u(undefined, true) }, |
| 6438 | - { json: "ticks", js: "ticks", typ: u(undefined, true) }, | |
| 6439 | 6438 | { json: "tickSize", js: "tickSize", typ: u(undefined, 3.14) }, |
| 6440 | 6439 | { json: "tickWidth", js: "tickWidth", typ: u(undefined, 3.14) }, |
| 6440 | + { json: "ticks", js: "ticks", typ: u(undefined, true) }, | |
| 6441 | 6441 | { json: "titleAlign", js: "titleAlign", typ: u(undefined, "") }, |
| 6442 | 6442 | { json: "titleAngle", js: "titleAngle", typ: u(undefined, 3.14) }, |
| 6443 | 6443 | { json: "titleBaseline", js: "titleBaseline", typ: u(undefined, "") }, |
| @@ -6463,8 +6463,8 @@ const typeMap: any = { | ||
| 6463 | 6463 | { json: "dx", js: "dx", typ: u(undefined, 3.14) }, |
| 6464 | 6464 | { json: "dy", js: "dy", typ: u(undefined, 3.14) }, |
| 6465 | 6465 | { json: "fill", js: "fill", typ: u(undefined, "") }, |
| 6466 | - { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 6467 | 6466 | { json: "fillOpacity", js: "fillOpacity", typ: u(undefined, 3.14) }, |
| 6467 | + { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 6468 | 6468 | { json: "font", js: "font", typ: u(undefined, "") }, |
| 6469 | 6469 | { json: "fontSize", js: "fontSize", typ: u(undefined, 3.14) }, |
| 6470 | 6470 | { json: "fontStyle", js: "fontStyle", typ: u(undefined, r("FontStyle")) }, |
| @@ -6680,8 +6680,8 @@ const typeMap: any = { | ||
| 6680 | 6680 | { json: "dx", js: "dx", typ: u(undefined, 3.14) }, |
| 6681 | 6681 | { json: "dy", js: "dy", typ: u(undefined, 3.14) }, |
| 6682 | 6682 | { json: "fill", js: "fill", typ: u(undefined, "") }, |
| 6683 | - { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 6684 | 6683 | { json: "fillOpacity", js: "fillOpacity", typ: u(undefined, 3.14) }, |
| 6684 | + { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 6685 | 6685 | { json: "font", js: "font", typ: u(undefined, "") }, |
| 6686 | 6686 | { json: "fontSize", js: "fontSize", typ: u(undefined, 3.14) }, |
| 6687 | 6687 | { json: "fontStyle", js: "fontStyle", typ: u(undefined, r("FontStyle")) }, |
| @@ -6714,8 +6714,8 @@ const typeMap: any = { | ||
| 6714 | 6714 | { json: "dx", js: "dx", typ: u(undefined, 3.14) }, |
| 6715 | 6715 | { json: "dy", js: "dy", typ: u(undefined, 3.14) }, |
| 6716 | 6716 | { json: "fill", js: "fill", typ: u(undefined, "") }, |
| 6717 | - { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 6718 | 6717 | { json: "fillOpacity", js: "fillOpacity", typ: u(undefined, 3.14) }, |
| 6718 | + { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 6719 | 6719 | { json: "font", js: "font", typ: u(undefined, "") }, |
| 6720 | 6720 | { json: "fontSize", js: "fontSize", typ: u(undefined, 3.14) }, |
| 6721 | 6721 | { json: "fontStyle", js: "fontStyle", typ: u(undefined, r("FontStyle")) }, |
| @@ -7011,8 +7011,8 @@ const typeMap: any = { | ||
| 7011 | 7011 | { json: "orient", js: "orient", typ: u(undefined, r("TitleOrient")) }, |
| 7012 | 7012 | { json: "position", js: "position", typ: u(undefined, 3.14) }, |
| 7013 | 7013 | { json: "tickCount", js: "tickCount", typ: u(undefined, 3.14) }, |
| 7014 | - { json: "ticks", js: "ticks", typ: u(undefined, true) }, | |
| 7015 | 7014 | { json: "tickSize", js: "tickSize", typ: u(undefined, 3.14) }, |
| 7015 | + { json: "ticks", js: "ticks", typ: u(undefined, true) }, | |
| 7016 | 7016 | { json: "title", js: "title", typ: u(undefined, u(null, "")) }, |
| 7017 | 7017 | { json: "titleMaxLength", js: "titleMaxLength", typ: u(undefined, 3.14) }, |
| 7018 | 7018 | { json: "titlePadding", js: "titlePadding", typ: u(undefined, 3.14) }, |
| @@ -7091,8 +7091,8 @@ const typeMap: any = { | ||
| 7091 | 7091 | { json: "dx", js: "dx", typ: u(undefined, 3.14) }, |
| 7092 | 7092 | { json: "dy", js: "dy", typ: u(undefined, 3.14) }, |
| 7093 | 7093 | { json: "fill", js: "fill", typ: u(undefined, "") }, |
| 7094 | - { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 7095 | 7094 | { json: "fillOpacity", js: "fillOpacity", typ: u(undefined, 3.14) }, |
| 7095 | + { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 7096 | 7096 | { json: "font", js: "font", typ: u(undefined, "") }, |
| 7097 | 7097 | { json: "fontSize", js: "fontSize", typ: u(undefined, 3.14) }, |
| 7098 | 7098 | { json: "fontStyle", js: "fontStyle", typ: u(undefined, r("FontStyle")) }, |
Mschema-golangdefault / quicktype.go+26 −26
| @@ -333,6 +333,10 @@ type MarkConfig struct { | ||
| 333 | 333 | // |
| 334 | 334 | // __Default value:__ (None) |
| 335 | 335 | Fill *string `json:"fill,omitempty"` |
| 336 | + // The fill opacity (value between [0,1]). | |
| 337 | + // | |
| 338 | + // __Default value:__ `1` | |
| 339 | + FillOpacity *float64 `json:"fillOpacity,omitempty"` | |
| 336 | 340 | // Whether the mark's color should be used as fill color instead of stroke color. |
| 337 | 341 | // |
| 338 | 342 | // __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -341,10 +345,6 @@ type MarkConfig struct { | ||
| 341 | 345 | // |
| 342 | 346 | // __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 343 | 347 | Filled *bool `json:"filled,omitempty"` |
| 344 | - // The fill opacity (value between [0,1]). | |
| 345 | - // | |
| 346 | - // __Default value:__ `1` | |
| 347 | - FillOpacity *float64 `json:"fillOpacity,omitempty"` | |
| 348 | 348 | // The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 349 | 349 | Font *string `json:"font,omitempty"` |
| 350 | 350 | // The font size, in pixels. |
| @@ -530,12 +530,12 @@ type AxisConfig struct { | ||
| 530 | 530 | TickColor *string `json:"tickColor,omitempty"` |
| 531 | 531 | // Boolean flag indicating if pixel position values should be rounded to the nearest integer. |
| 532 | 532 | TickRound *bool `json:"tickRound,omitempty"` |
| 533 | - // Boolean value that determines whether the axis should include ticks. | |
| 534 | - Ticks *bool `json:"ticks,omitempty"` | |
| 535 | 533 | // The size in pixels of axis ticks. |
| 536 | 534 | TickSize *float64 `json:"tickSize,omitempty"` |
| 537 | 535 | // The width, in pixels, of ticks. |
| 538 | 536 | TickWidth *float64 `json:"tickWidth,omitempty"` |
| 537 | + // Boolean value that determines whether the axis should include ticks. | |
| 538 | + Ticks *bool `json:"ticks,omitempty"` | |
| 539 | 539 | // Horizontal text alignment of axis titles. |
| 540 | 540 | TitleAlign *string `json:"titleAlign,omitempty"` |
| 541 | 541 | // Angle in degrees of axis titles. |
| @@ -668,12 +668,12 @@ type VGAxisConfig struct { | ||
| 668 | 668 | TickColor *string `json:"tickColor,omitempty"` |
| 669 | 669 | // Boolean flag indicating if pixel position values should be rounded to the nearest integer. |
| 670 | 670 | TickRound *bool `json:"tickRound,omitempty"` |
| 671 | - // Boolean value that determines whether the axis should include ticks. | |
| 672 | - Ticks *bool `json:"ticks,omitempty"` | |
| 673 | 671 | // The size in pixels of axis ticks. |
| 674 | 672 | TickSize *float64 `json:"tickSize,omitempty"` |
| 675 | 673 | // The width, in pixels, of ticks. |
| 676 | 674 | TickWidth *float64 `json:"tickWidth,omitempty"` |
| 675 | + // Boolean value that determines whether the axis should include ticks. | |
| 676 | + Ticks *bool `json:"ticks,omitempty"` | |
| 677 | 677 | // Horizontal text alignment of axis titles. |
| 678 | 678 | TitleAlign *string `json:"titleAlign,omitempty"` |
| 679 | 679 | // Angle in degrees of axis titles. |
| @@ -743,6 +743,10 @@ type BarConfig struct { | ||
| 743 | 743 | // |
| 744 | 744 | // __Default value:__ (None) |
| 745 | 745 | Fill *string `json:"fill,omitempty"` |
| 746 | + // The fill opacity (value between [0,1]). | |
| 747 | + // | |
| 748 | + // __Default value:__ `1` | |
| 749 | + FillOpacity *float64 `json:"fillOpacity,omitempty"` | |
| 746 | 750 | // Whether the mark's color should be used as fill color instead of stroke color. |
| 747 | 751 | // |
| 748 | 752 | // __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -751,10 +755,6 @@ type BarConfig struct { | ||
| 751 | 755 | // |
| 752 | 756 | // __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 753 | 757 | Filled *bool `json:"filled,omitempty"` |
| 754 | - // The fill opacity (value between [0,1]). | |
| 755 | - // | |
| 756 | - // __Default value:__ `1` | |
| 757 | - FillOpacity *float64 `json:"fillOpacity,omitempty"` | |
| 758 | 758 | // The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 759 | 759 | Font *string `json:"font,omitempty"` |
| 760 | 760 | // The font size, in pixels. |
| @@ -1422,6 +1422,10 @@ type TextConfig struct { | ||
| 1422 | 1422 | // |
| 1423 | 1423 | // __Default value:__ (None) |
| 1424 | 1424 | Fill *string `json:"fill,omitempty"` |
| 1425 | + // The fill opacity (value between [0,1]). | |
| 1426 | + // | |
| 1427 | + // __Default value:__ `1` | |
| 1428 | + FillOpacity *float64 `json:"fillOpacity,omitempty"` | |
| 1425 | 1429 | // Whether the mark's color should be used as fill color instead of stroke color. |
| 1426 | 1430 | // |
| 1427 | 1431 | // __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -1430,10 +1434,6 @@ type TextConfig struct { | ||
| 1430 | 1434 | // |
| 1431 | 1435 | // __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 1432 | 1436 | Filled *bool `json:"filled,omitempty"` |
| 1433 | - // The fill opacity (value between [0,1]). | |
| 1434 | - // | |
| 1435 | - // __Default value:__ `1` | |
| 1436 | - FillOpacity *float64 `json:"fillOpacity,omitempty"` | |
| 1437 | 1437 | // The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1438 | 1438 | Font *string `json:"font,omitempty"` |
| 1439 | 1439 | // The font size, in pixels. |
| @@ -1556,6 +1556,10 @@ type TickConfig struct { | ||
| 1556 | 1556 | // |
| 1557 | 1557 | // __Default value:__ (None) |
| 1558 | 1558 | Fill *string `json:"fill,omitempty"` |
| 1559 | + // The fill opacity (value between [0,1]). | |
| 1560 | + // | |
| 1561 | + // __Default value:__ `1` | |
| 1562 | + FillOpacity *float64 `json:"fillOpacity,omitempty"` | |
| 1559 | 1563 | // Whether the mark's color should be used as fill color instead of stroke color. |
| 1560 | 1564 | // |
| 1561 | 1565 | // __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -1564,10 +1568,6 @@ type TickConfig struct { | ||
| 1564 | 1568 | // |
| 1565 | 1569 | // __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 1566 | 1570 | Filled *bool `json:"filled,omitempty"` |
| 1567 | - // The fill opacity (value between [0,1]). | |
| 1568 | - // | |
| 1569 | - // __Default value:__ `1` | |
| 1570 | - FillOpacity *float64 `json:"fillOpacity,omitempty"` | |
| 1571 | 1571 | // The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1572 | 1572 | Font *string `json:"font,omitempty"` |
| 1573 | 1573 | // The font size, in pixels. |
| @@ -2962,10 +2962,10 @@ type Axis struct { | ||
| 2962 | 2962 | // may be different so that values are "nice" (multiples of 2, 5, 10) and lie within the |
| 2963 | 2963 | // underlying scale's range. |
| 2964 | 2964 | TickCount *float64 `json:"tickCount,omitempty"` |
| 2965 | - // Boolean value that determines whether the axis should include ticks. | |
| 2966 | - Ticks *bool `json:"ticks,omitempty"` | |
| 2967 | 2965 | // The size in pixels of axis ticks. |
| 2968 | 2966 | TickSize *float64 `json:"tickSize,omitempty"` |
| 2967 | + // Boolean value that determines whether the axis should include ticks. | |
| 2968 | + Ticks *bool `json:"ticks,omitempty"` | |
| 2969 | 2969 | // A title for the field. If `null`, the title will be removed. |
| 2970 | 2970 | // |
| 2971 | 2971 | // __Default value:__ derived from the field's name and transformation function |
| @@ -3304,6 +3304,10 @@ type MarkDef struct { | ||
| 3304 | 3304 | // |
| 3305 | 3305 | // __Default value:__ (None) |
| 3306 | 3306 | Fill *string `json:"fill,omitempty"` |
| 3307 | + // The fill opacity (value between [0,1]). | |
| 3308 | + // | |
| 3309 | + // __Default value:__ `1` | |
| 3310 | + FillOpacity *float64 `json:"fillOpacity,omitempty"` | |
| 3307 | 3311 | // Whether the mark's color should be used as fill color instead of stroke color. |
| 3308 | 3312 | // |
| 3309 | 3313 | // __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -3312,10 +3316,6 @@ type MarkDef struct { | ||
| 3312 | 3316 | // |
| 3313 | 3317 | // __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 3314 | 3318 | Filled *bool `json:"filled,omitempty"` |
| 3315 | - // The fill opacity (value between [0,1]). | |
| 3316 | - // | |
| 3317 | - // __Default value:__ `1` | |
| 3318 | - FillOpacity *float64 `json:"fillOpacity,omitempty"` | |
| 3319 | 3319 | // The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3320 | 3320 | Font *string `json:"font,omitempty"` |
| 3321 | 3321 | // The font size, in pixels. |
Mschema-haskelldefault / QuickType.hs+66 −66
| @@ -637,6 +637,11 @@ Default Fill Color. This has higher precedence than config.color | ||
| 637 | 637 | |
| 638 | 638 | __Default value:__ (None) |
| 639 | 639 | |
| 640 | +fillOpacity: | |
| 641 | +The fill opacity (value between [0,1]). | |
| 642 | + | |
| 643 | +__Default value:__ `1` | |
| 644 | + | |
| 640 | 645 | filled: |
| 641 | 646 | Whether the mark's color should be used as fill color instead of stroke color. |
| 642 | 647 | |
| @@ -646,11 +651,6 @@ __Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks. | ||
| 646 | 651 | |
| 647 | 652 | __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 648 | 653 | |
| 649 | -fillOpacity: | |
| 650 | -The fill opacity (value between [0,1]). | |
| 651 | - | |
| 652 | -__Default value:__ `1` | |
| 653 | - | |
| 654 | 654 | font: |
| 655 | 655 | The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 656 | 656 | |
| @@ -764,8 +764,8 @@ data MarkConfig = MarkConfig | ||
| 764 | 764 | , dxMarkConfig :: Maybe Float |
| 765 | 765 | , dyMarkConfig :: Maybe Float |
| 766 | 766 | , fillMarkConfig :: Maybe Text |
| 767 | - , filledMarkConfig :: Maybe Bool | |
| 768 | 767 | , fillOpacityMarkConfig :: Maybe Float |
| 768 | + , filledMarkConfig :: Maybe Bool | |
| 769 | 769 | , fontMarkConfig :: Maybe Text |
| 770 | 770 | , fontSizeMarkConfig :: Maybe Float |
| 771 | 771 | , fontStyleMarkConfig :: Maybe FontStyle |
| @@ -1044,15 +1044,15 @@ The color of the axis's tick. | ||
| 1044 | 1044 | tickRound: |
| 1045 | 1045 | Boolean flag indicating if pixel position values should be rounded to the nearest integer. |
| 1046 | 1046 | |
| 1047 | -ticks: | |
| 1048 | -Boolean value that determines whether the axis should include ticks. | |
| 1049 | - | |
| 1050 | 1047 | tickSize: |
| 1051 | 1048 | The size in pixels of axis ticks. |
| 1052 | 1049 | |
| 1053 | 1050 | tickWidth: |
| 1054 | 1051 | The width, in pixels, of ticks. |
| 1055 | 1052 | |
| 1053 | +ticks: | |
| 1054 | +Boolean value that determines whether the axis should include ticks. | |
| 1055 | + | |
| 1056 | 1056 | titleAlign: |
| 1057 | 1057 | Horizontal text alignment of axis titles. |
| 1058 | 1058 | |
| @@ -1115,9 +1115,9 @@ data AxisConfig = AxisConfig | ||
| 1115 | 1115 | , shortTimeLabelsAxisConfig :: Maybe Bool |
| 1116 | 1116 | , tickColorAxisConfig :: Maybe Text |
| 1117 | 1117 | , tickRoundAxisConfig :: Maybe Bool |
| 1118 | - , ticksAxisConfig :: Maybe Bool | |
| 1119 | 1118 | , tickSizeAxisConfig :: Maybe Float |
| 1120 | 1119 | , tickWidthAxisConfig :: Maybe Float |
| 1120 | + , ticksAxisConfig :: Maybe Bool | |
| 1121 | 1121 | , titleAlignAxisConfig :: Maybe Text |
| 1122 | 1122 | , titleAngleAxisConfig :: Maybe Float |
| 1123 | 1123 | , titleBaselineAxisConfig :: Maybe Text |
| @@ -1302,15 +1302,15 @@ The color of the axis's tick. | ||
| 1302 | 1302 | tickRound: |
| 1303 | 1303 | Boolean flag indicating if pixel position values should be rounded to the nearest integer. |
| 1304 | 1304 | |
| 1305 | -ticks: | |
| 1306 | -Boolean value that determines whether the axis should include ticks. | |
| 1307 | - | |
| 1308 | 1305 | tickSize: |
| 1309 | 1306 | The size in pixels of axis ticks. |
| 1310 | 1307 | |
| 1311 | 1308 | tickWidth: |
| 1312 | 1309 | The width, in pixels, of ticks. |
| 1313 | 1310 | |
| 1311 | +ticks: | |
| 1312 | +Boolean value that determines whether the axis should include ticks. | |
| 1313 | + | |
| 1314 | 1314 | titleAlign: |
| 1315 | 1315 | Horizontal text alignment of axis titles. |
| 1316 | 1316 | |
| @@ -1372,9 +1372,9 @@ data VGAxisConfig = VGAxisConfig | ||
| 1372 | 1372 | , minExtentVGAxisConfig :: Maybe Float |
| 1373 | 1373 | , tickColorVGAxisConfig :: Maybe Text |
| 1374 | 1374 | , tickRoundVGAxisConfig :: Maybe Bool |
| 1375 | - , ticksVGAxisConfig :: Maybe Bool | |
| 1376 | 1375 | , tickSizeVGAxisConfig :: Maybe Float |
| 1377 | 1376 | , tickWidthVGAxisConfig :: Maybe Float |
| 1377 | + , ticksVGAxisConfig :: Maybe Bool | |
| 1378 | 1378 | , titleAlignVGAxisConfig :: Maybe Text |
| 1379 | 1379 | , titleAngleVGAxisConfig :: Maybe Float |
| 1380 | 1380 | , titleBaselineVGAxisConfig :: Maybe Text |
| @@ -1442,6 +1442,11 @@ Default Fill Color. This has higher precedence than config.color | ||
| 1442 | 1442 | |
| 1443 | 1443 | __Default value:__ (None) |
| 1444 | 1444 | |
| 1445 | +fillOpacity: | |
| 1446 | +The fill opacity (value between [0,1]). | |
| 1447 | + | |
| 1448 | +__Default value:__ `1` | |
| 1449 | + | |
| 1445 | 1450 | filled: |
| 1446 | 1451 | Whether the mark's color should be used as fill color instead of stroke color. |
| 1447 | 1452 | |
| @@ -1451,11 +1456,6 @@ __Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks. | ||
| 1451 | 1456 | |
| 1452 | 1457 | __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 1453 | 1458 | |
| 1454 | -fillOpacity: | |
| 1455 | -The fill opacity (value between [0,1]). | |
| 1456 | - | |
| 1457 | -__Default value:__ `1` | |
| 1458 | - | |
| 1459 | 1459 | font: |
| 1460 | 1460 | The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1461 | 1461 | |
| @@ -1572,8 +1572,8 @@ data BarConfig = BarConfig | ||
| 1572 | 1572 | , dxBarConfig :: Maybe Float |
| 1573 | 1573 | , dyBarConfig :: Maybe Float |
| 1574 | 1574 | , fillBarConfig :: Maybe Text |
| 1575 | - , filledBarConfig :: Maybe Bool | |
| 1576 | 1575 | , fillOpacityBarConfig :: Maybe Float |
| 1576 | + , filledBarConfig :: Maybe Bool | |
| 1577 | 1577 | , fontBarConfig :: Maybe Text |
| 1578 | 1578 | , fontSizeBarConfig :: Maybe Float |
| 1579 | 1579 | , fontStyleBarConfig :: Maybe FontStyle |
| @@ -1634,6 +1634,11 @@ Default Fill Color. This has higher precedence than config.color | ||
| 1634 | 1634 | |
| 1635 | 1635 | __Default value:__ (None) |
| 1636 | 1636 | |
| 1637 | +fillOpacity: | |
| 1638 | +The fill opacity (value between [0,1]). | |
| 1639 | + | |
| 1640 | +__Default value:__ `1` | |
| 1641 | + | |
| 1637 | 1642 | filled: |
| 1638 | 1643 | Whether the mark's color should be used as fill color instead of stroke color. |
| 1639 | 1644 | |
| @@ -1643,11 +1648,6 @@ __Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks. | ||
| 1643 | 1648 | |
| 1644 | 1649 | __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 1645 | 1650 | |
| 1646 | -fillOpacity: | |
| 1647 | -The fill opacity (value between [0,1]). | |
| 1648 | - | |
| 1649 | -__Default value:__ `1` | |
| 1650 | - | |
| 1651 | 1651 | font: |
| 1652 | 1652 | The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1653 | 1653 | |
| @@ -1764,8 +1764,8 @@ data TextConfig = TextConfig | ||
| 1764 | 1764 | , dxTextConfig :: Maybe Float |
| 1765 | 1765 | , dyTextConfig :: Maybe Float |
| 1766 | 1766 | , fillTextConfig :: Maybe Text |
| 1767 | - , filledTextConfig :: Maybe Bool | |
| 1768 | 1767 | , fillOpacityTextConfig :: Maybe Float |
| 1768 | + , filledTextConfig :: Maybe Bool | |
| 1769 | 1769 | , fontTextConfig :: Maybe Text |
| 1770 | 1770 | , fontSizeTextConfig :: Maybe Float |
| 1771 | 1771 | , fontStyleTextConfig :: Maybe FontStyle |
| @@ -2796,6 +2796,11 @@ Default Fill Color. This has higher precedence than config.color | ||
| 2796 | 2796 | |
| 2797 | 2797 | __Default value:__ (None) |
| 2798 | 2798 | |
| 2799 | +fillOpacity: | |
| 2800 | +The fill opacity (value between [0,1]). | |
| 2801 | + | |
| 2802 | +__Default value:__ `1` | |
| 2803 | + | |
| 2799 | 2804 | filled: |
| 2800 | 2805 | Whether the mark's color should be used as fill color instead of stroke color. |
| 2801 | 2806 | |
| @@ -2805,11 +2810,6 @@ __Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks. | ||
| 2805 | 2810 | |
| 2806 | 2811 | __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 2807 | 2812 | |
| 2808 | -fillOpacity: | |
| 2809 | -The fill opacity (value between [0,1]). | |
| 2810 | - | |
| 2811 | -__Default value:__ `1` | |
| 2812 | - | |
| 2813 | 2813 | font: |
| 2814 | 2814 | The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 2815 | 2815 | |
| @@ -2929,8 +2929,8 @@ data TickConfig = TickConfig | ||
| 2929 | 2929 | , dxTickConfig :: Maybe Float |
| 2930 | 2930 | , dyTickConfig :: Maybe Float |
| 2931 | 2931 | , fillTickConfig :: Maybe Text |
| 2932 | - , filledTickConfig :: Maybe Bool | |
| 2933 | 2932 | , fillOpacityTickConfig :: Maybe Float |
| 2933 | + , filledTickConfig :: Maybe Bool | |
| 2934 | 2934 | , fontTickConfig :: Maybe Text |
| 2935 | 2935 | , fontSizeTickConfig :: Maybe Float |
| 2936 | 2936 | , fontStyleTickConfig :: Maybe FontStyle |
| @@ -5024,12 +5024,12 @@ A desired number of ticks, for axes visualizing quantitative scales. The resulti | ||
| 5024 | 5024 | may be different so that values are "nice" (multiples of 2, 5, 10) and lie within the |
| 5025 | 5025 | underlying scale's range. |
| 5026 | 5026 | |
| 5027 | -ticks: | |
| 5028 | -Boolean value that determines whether the axis should include ticks. | |
| 5029 | - | |
| 5030 | 5027 | tickSize: |
| 5031 | 5028 | The size in pixels of axis ticks. |
| 5032 | 5029 | |
| 5030 | +ticks: | |
| 5031 | +Boolean value that determines whether the axis should include ticks. | |
| 5032 | + | |
| 5033 | 5033 | title: |
| 5034 | 5034 | A title for the field. If `null`, the title will be removed. |
| 5035 | 5035 | |
| @@ -5078,8 +5078,8 @@ data Axis = Axis | ||
| 5078 | 5078 | , orientAxis :: Maybe TitleOrient |
| 5079 | 5079 | , positionAxis :: Maybe Float |
| 5080 | 5080 | , tickCountAxis :: Maybe Float |
| 5081 | - , ticksAxis :: Maybe Bool | |
| 5082 | 5081 | , tickSizeAxis :: Maybe Float |
| 5082 | + , ticksAxis :: Maybe Bool | |
| 5083 | 5083 | , titleAxis :: Maybe Text |
| 5084 | 5084 | , titleMaxLengthAxis :: Maybe Float |
| 5085 | 5085 | , titlePaddingAxis :: Maybe Float |
| @@ -5655,6 +5655,11 @@ Default Fill Color. This has higher precedence than config.color | ||
| 5655 | 5655 | |
| 5656 | 5656 | __Default value:__ (None) |
| 5657 | 5657 | |
| 5658 | +fillOpacity: | |
| 5659 | +The fill opacity (value between [0,1]). | |
| 5660 | + | |
| 5661 | +__Default value:__ `1` | |
| 5662 | + | |
| 5658 | 5663 | filled: |
| 5659 | 5664 | Whether the mark's color should be used as fill color instead of stroke color. |
| 5660 | 5665 | |
| @@ -5664,11 +5669,6 @@ __Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks. | ||
| 5664 | 5669 | |
| 5665 | 5670 | __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 5666 | 5671 | |
| 5667 | -fillOpacity: | |
| 5668 | -The fill opacity (value between [0,1]). | |
| 5669 | - | |
| 5670 | -__Default value:__ `1` | |
| 5671 | - | |
| 5672 | 5672 | font: |
| 5673 | 5673 | The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 5674 | 5674 | |
| @@ -5801,8 +5801,8 @@ data MarkDef = MarkDef | ||
| 5801 | 5801 | , dxMarkDef :: Maybe Float |
| 5802 | 5802 | , dyMarkDef :: Maybe Float |
| 5803 | 5803 | , fillMarkDef :: Maybe Text |
| 5804 | - , filledMarkDef :: Maybe Bool | |
| 5805 | 5804 | , fillOpacityMarkDef :: Maybe Float |
| 5805 | + , filledMarkDef :: Maybe Bool | |
| 5806 | 5806 | , fontMarkDef :: Maybe Text |
| 5807 | 5807 | , fontSizeMarkDef :: Maybe Float |
| 5808 | 5808 | , fontStyleMarkDef :: Maybe FontStyle |
| @@ -6421,7 +6421,7 @@ instance FromJSON Config where | ||
| 6421 | 6421 | <*> v .:? "view" |
| 6422 | 6422 | |
| 6423 | 6423 | instance ToJSON MarkConfig where |
| 6424 | - toJSON (MarkConfig alignMarkConfig angleMarkConfig baselineMarkConfig colorMarkConfig cursorMarkConfig dxMarkConfig dyMarkConfig fillMarkConfig filledMarkConfig fillOpacityMarkConfig fontMarkConfig fontSizeMarkConfig fontStyleMarkConfig fontWeightMarkConfig hrefMarkConfig interpolateMarkConfig limitMarkConfig opacityMarkConfig orientMarkConfig radiusMarkConfig shapeMarkConfig sizeMarkConfig strokeMarkConfig strokeDashMarkConfig strokeDashOffsetMarkConfig strokeOpacityMarkConfig strokeWidthMarkConfig tensionMarkConfig markConfigTextMarkConfig thetaMarkConfig) = | |
| 6424 | + toJSON (MarkConfig alignMarkConfig angleMarkConfig baselineMarkConfig colorMarkConfig cursorMarkConfig dxMarkConfig dyMarkConfig fillMarkConfig fillOpacityMarkConfig filledMarkConfig fontMarkConfig fontSizeMarkConfig fontStyleMarkConfig fontWeightMarkConfig hrefMarkConfig interpolateMarkConfig limitMarkConfig opacityMarkConfig orientMarkConfig radiusMarkConfig shapeMarkConfig sizeMarkConfig strokeMarkConfig strokeDashMarkConfig strokeDashOffsetMarkConfig strokeOpacityMarkConfig strokeWidthMarkConfig tensionMarkConfig markConfigTextMarkConfig thetaMarkConfig) = | |
| 6425 | 6425 | object |
| 6426 | 6426 | [ "align" .= alignMarkConfig |
| 6427 | 6427 | , "angle" .= angleMarkConfig |
| @@ -6431,8 +6431,8 @@ instance ToJSON MarkConfig where | ||
| 6431 | 6431 | , "dx" .= dxMarkConfig |
| 6432 | 6432 | , "dy" .= dyMarkConfig |
| 6433 | 6433 | , "fill" .= fillMarkConfig |
| 6434 | - , "filled" .= filledMarkConfig | |
| 6435 | 6434 | , "fillOpacity" .= fillOpacityMarkConfig |
| 6435 | + , "filled" .= filledMarkConfig | |
| 6436 | 6436 | , "font" .= fontMarkConfig |
| 6437 | 6437 | , "fontSize" .= fontSizeMarkConfig |
| 6438 | 6438 | , "fontStyle" .= fontStyleMarkConfig |
| @@ -6465,8 +6465,8 @@ instance FromJSON MarkConfig where | ||
| 6465 | 6465 | <*> v .:? "dx" |
| 6466 | 6466 | <*> v .:? "dy" |
| 6467 | 6467 | <*> v .:? "fill" |
| 6468 | - <*> v .:? "filled" | |
| 6469 | 6468 | <*> v .:? "fillOpacity" |
| 6469 | + <*> v .:? "filled" | |
| 6470 | 6470 | <*> v .:? "font" |
| 6471 | 6471 | <*> v .:? "fontSize" |
| 6472 | 6472 | <*> v .:? "fontStyle" |
| @@ -6661,7 +6661,7 @@ instance FromJSON Orient where | ||
| 6661 | 6661 | parseText "vertical" = return VerticalOrient |
| 6662 | 6662 | |
| 6663 | 6663 | instance ToJSON AxisConfig where |
| 6664 | - toJSON (AxisConfig bandPositionAxisConfig domainAxisConfig domainColorAxisConfig domainWidthAxisConfig gridAxisConfig gridColorAxisConfig gridDashAxisConfig gridOpacityAxisConfig gridWidthAxisConfig labelAngleAxisConfig labelBoundAxisConfig labelColorAxisConfig labelFlushAxisConfig labelFontAxisConfig labelFontSizeAxisConfig labelLimitAxisConfig labelOverlapAxisConfig labelPaddingAxisConfig labelsAxisConfig maxExtentAxisConfig minExtentAxisConfig shortTimeLabelsAxisConfig tickColorAxisConfig tickRoundAxisConfig ticksAxisConfig tickSizeAxisConfig tickWidthAxisConfig titleAlignAxisConfig titleAngleAxisConfig titleBaselineAxisConfig titleColorAxisConfig titleFontAxisConfig titleFontSizeAxisConfig titleFontWeightAxisConfig titleLimitAxisConfig titleMaxLengthAxisConfig titlePaddingAxisConfig titleXAxisConfig titleYAxisConfig) = | |
| 6664 | + toJSON (AxisConfig bandPositionAxisConfig domainAxisConfig domainColorAxisConfig domainWidthAxisConfig gridAxisConfig gridColorAxisConfig gridDashAxisConfig gridOpacityAxisConfig gridWidthAxisConfig labelAngleAxisConfig labelBoundAxisConfig labelColorAxisConfig labelFlushAxisConfig labelFontAxisConfig labelFontSizeAxisConfig labelLimitAxisConfig labelOverlapAxisConfig labelPaddingAxisConfig labelsAxisConfig maxExtentAxisConfig minExtentAxisConfig shortTimeLabelsAxisConfig tickColorAxisConfig tickRoundAxisConfig tickSizeAxisConfig tickWidthAxisConfig ticksAxisConfig titleAlignAxisConfig titleAngleAxisConfig titleBaselineAxisConfig titleColorAxisConfig titleFontAxisConfig titleFontSizeAxisConfig titleFontWeightAxisConfig titleLimitAxisConfig titleMaxLengthAxisConfig titlePaddingAxisConfig titleXAxisConfig titleYAxisConfig) = | |
| 6665 | 6665 | object |
| 6666 | 6666 | [ "bandPosition" .= bandPositionAxisConfig |
| 6667 | 6667 | , "domain" .= domainAxisConfig |
| @@ -6687,9 +6687,9 @@ instance ToJSON AxisConfig where | ||
| 6687 | 6687 | , "shortTimeLabels" .= shortTimeLabelsAxisConfig |
| 6688 | 6688 | , "tickColor" .= tickColorAxisConfig |
| 6689 | 6689 | , "tickRound" .= tickRoundAxisConfig |
| 6690 | - , "ticks" .= ticksAxisConfig | |
| 6691 | 6690 | , "tickSize" .= tickSizeAxisConfig |
| 6692 | 6691 | , "tickWidth" .= tickWidthAxisConfig |
| 6692 | + , "ticks" .= ticksAxisConfig | |
| 6693 | 6693 | , "titleAlign" .= titleAlignAxisConfig |
| 6694 | 6694 | , "titleAngle" .= titleAngleAxisConfig |
| 6695 | 6695 | , "titleBaseline" .= titleBaselineAxisConfig |
| @@ -6730,9 +6730,9 @@ instance FromJSON AxisConfig where | ||
| 6730 | 6730 | <*> v .:? "shortTimeLabels" |
| 6731 | 6731 | <*> v .:? "tickColor" |
| 6732 | 6732 | <*> v .:? "tickRound" |
| 6733 | - <*> v .:? "ticks" | |
| 6734 | 6733 | <*> v .:? "tickSize" |
| 6735 | 6734 | <*> v .:? "tickWidth" |
| 6735 | + <*> v .:? "ticks" | |
| 6736 | 6736 | <*> v .:? "titleAlign" |
| 6737 | 6737 | <*> v .:? "titleAngle" |
| 6738 | 6738 | <*> v .:? "titleBaseline" |
| @@ -6781,7 +6781,7 @@ instance FromJSON TitleFontWeight where | ||
| 6781 | 6781 | parseJSON xs@(String _) = (fmap StringInTitleFontWeight . parseJSON) xs |
| 6782 | 6782 | |
| 6783 | 6783 | instance ToJSON VGAxisConfig where |
| 6784 | - toJSON (VGAxisConfig bandPositionVGAxisConfig domainVGAxisConfig domainColorVGAxisConfig domainWidthVGAxisConfig gridVGAxisConfig gridColorVGAxisConfig gridDashVGAxisConfig gridOpacityVGAxisConfig gridWidthVGAxisConfig labelAngleVGAxisConfig labelBoundVGAxisConfig labelColorVGAxisConfig labelFlushVGAxisConfig labelFontVGAxisConfig labelFontSizeVGAxisConfig labelLimitVGAxisConfig labelOverlapVGAxisConfig labelPaddingVGAxisConfig labelsVGAxisConfig maxExtentVGAxisConfig minExtentVGAxisConfig tickColorVGAxisConfig tickRoundVGAxisConfig ticksVGAxisConfig tickSizeVGAxisConfig tickWidthVGAxisConfig titleAlignVGAxisConfig titleAngleVGAxisConfig titleBaselineVGAxisConfig titleColorVGAxisConfig titleFontVGAxisConfig titleFontSizeVGAxisConfig titleFontWeightVGAxisConfig titleLimitVGAxisConfig titleMaxLengthVGAxisConfig titlePaddingVGAxisConfig titleXVGAxisConfig titleYVGAxisConfig) = | |
| 6784 | + toJSON (VGAxisConfig bandPositionVGAxisConfig domainVGAxisConfig domainColorVGAxisConfig domainWidthVGAxisConfig gridVGAxisConfig gridColorVGAxisConfig gridDashVGAxisConfig gridOpacityVGAxisConfig gridWidthVGAxisConfig labelAngleVGAxisConfig labelBoundVGAxisConfig labelColorVGAxisConfig labelFlushVGAxisConfig labelFontVGAxisConfig labelFontSizeVGAxisConfig labelLimitVGAxisConfig labelOverlapVGAxisConfig labelPaddingVGAxisConfig labelsVGAxisConfig maxExtentVGAxisConfig minExtentVGAxisConfig tickColorVGAxisConfig tickRoundVGAxisConfig tickSizeVGAxisConfig tickWidthVGAxisConfig ticksVGAxisConfig titleAlignVGAxisConfig titleAngleVGAxisConfig titleBaselineVGAxisConfig titleColorVGAxisConfig titleFontVGAxisConfig titleFontSizeVGAxisConfig titleFontWeightVGAxisConfig titleLimitVGAxisConfig titleMaxLengthVGAxisConfig titlePaddingVGAxisConfig titleXVGAxisConfig titleYVGAxisConfig) = | |
| 6785 | 6785 | object |
| 6786 | 6786 | [ "bandPosition" .= bandPositionVGAxisConfig |
| 6787 | 6787 | , "domain" .= domainVGAxisConfig |
| @@ -6806,9 +6806,9 @@ instance ToJSON VGAxisConfig where | ||
| 6806 | 6806 | , "minExtent" .= minExtentVGAxisConfig |
| 6807 | 6807 | , "tickColor" .= tickColorVGAxisConfig |
| 6808 | 6808 | , "tickRound" .= tickRoundVGAxisConfig |
| 6809 | - , "ticks" .= ticksVGAxisConfig | |
| 6810 | 6809 | , "tickSize" .= tickSizeVGAxisConfig |
| 6811 | 6810 | , "tickWidth" .= tickWidthVGAxisConfig |
| 6811 | + , "ticks" .= ticksVGAxisConfig | |
| 6812 | 6812 | , "titleAlign" .= titleAlignVGAxisConfig |
| 6813 | 6813 | , "titleAngle" .= titleAngleVGAxisConfig |
| 6814 | 6814 | , "titleBaseline" .= titleBaselineVGAxisConfig |
| @@ -6848,9 +6848,9 @@ instance FromJSON VGAxisConfig where | ||
| 6848 | 6848 | <*> v .:? "minExtent" |
| 6849 | 6849 | <*> v .:? "tickColor" |
| 6850 | 6850 | <*> v .:? "tickRound" |
| 6851 | - <*> v .:? "ticks" | |
| 6852 | 6851 | <*> v .:? "tickSize" |
| 6853 | 6852 | <*> v .:? "tickWidth" |
| 6853 | + <*> v .:? "ticks" | |
| 6854 | 6854 | <*> v .:? "titleAlign" |
| 6855 | 6855 | <*> v .:? "titleAngle" |
| 6856 | 6856 | <*> v .:? "titleBaseline" |
| @@ -6865,7 +6865,7 @@ instance FromJSON VGAxisConfig where | ||
| 6865 | 6865 | <*> v .:? "titleY" |
| 6866 | 6866 | |
| 6867 | 6867 | instance ToJSON BarConfig where |
| 6868 | - toJSON (BarConfig alignBarConfig angleBarConfig baselineBarConfig binSpacingBarConfig colorBarConfig continuousBandSizeBarConfig cursorBarConfig discreteBandSizeBarConfig dxBarConfig dyBarConfig fillBarConfig filledBarConfig fillOpacityBarConfig fontBarConfig fontSizeBarConfig fontStyleBarConfig fontWeightBarConfig hrefBarConfig interpolateBarConfig limitBarConfig opacityBarConfig orientBarConfig radiusBarConfig shapeBarConfig sizeBarConfig strokeBarConfig strokeDashBarConfig strokeDashOffsetBarConfig strokeOpacityBarConfig strokeWidthBarConfig tensionBarConfig barConfigTextBarConfig thetaBarConfig) = | |
| 6868 | + toJSON (BarConfig alignBarConfig angleBarConfig baselineBarConfig binSpacingBarConfig colorBarConfig continuousBandSizeBarConfig cursorBarConfig discreteBandSizeBarConfig dxBarConfig dyBarConfig fillBarConfig fillOpacityBarConfig filledBarConfig fontBarConfig fontSizeBarConfig fontStyleBarConfig fontWeightBarConfig hrefBarConfig interpolateBarConfig limitBarConfig opacityBarConfig orientBarConfig radiusBarConfig shapeBarConfig sizeBarConfig strokeBarConfig strokeDashBarConfig strokeDashOffsetBarConfig strokeOpacityBarConfig strokeWidthBarConfig tensionBarConfig barConfigTextBarConfig thetaBarConfig) = | |
| 6869 | 6869 | object |
| 6870 | 6870 | [ "align" .= alignBarConfig |
| 6871 | 6871 | , "angle" .= angleBarConfig |
| @@ -6878,8 +6878,8 @@ instance ToJSON BarConfig where | ||
| 6878 | 6878 | , "dx" .= dxBarConfig |
| 6879 | 6879 | , "dy" .= dyBarConfig |
| 6880 | 6880 | , "fill" .= fillBarConfig |
| 6881 | - , "filled" .= filledBarConfig | |
| 6882 | 6881 | , "fillOpacity" .= fillOpacityBarConfig |
| 6882 | + , "filled" .= filledBarConfig | |
| 6883 | 6883 | , "font" .= fontBarConfig |
| 6884 | 6884 | , "fontSize" .= fontSizeBarConfig |
| 6885 | 6885 | , "fontStyle" .= fontStyleBarConfig |
| @@ -6915,8 +6915,8 @@ instance FromJSON BarConfig where | ||
| 6915 | 6915 | <*> v .:? "dx" |
| 6916 | 6916 | <*> v .:? "dy" |
| 6917 | 6917 | <*> v .:? "fill" |
| 6918 | - <*> v .:? "filled" | |
| 6919 | 6918 | <*> v .:? "fillOpacity" |
| 6919 | + <*> v .:? "filled" | |
| 6920 | 6920 | <*> v .:? "font" |
| 6921 | 6921 | <*> v .:? "fontSize" |
| 6922 | 6922 | <*> v .:? "fontStyle" |
| @@ -6939,7 +6939,7 @@ instance FromJSON BarConfig where | ||
| 6939 | 6939 | <*> v .:? "theta" |
| 6940 | 6940 | |
| 6941 | 6941 | instance ToJSON TextConfig where |
| 6942 | - toJSON (TextConfig alignTextConfig angleTextConfig baselineTextConfig colorTextConfig cursorTextConfig dxTextConfig dyTextConfig fillTextConfig filledTextConfig fillOpacityTextConfig fontTextConfig fontSizeTextConfig fontStyleTextConfig fontWeightTextConfig hrefTextConfig interpolateTextConfig limitTextConfig opacityTextConfig orientTextConfig radiusTextConfig shapeTextConfig shortTimeLabelsTextConfig sizeTextConfig strokeTextConfig strokeDashTextConfig strokeDashOffsetTextConfig strokeOpacityTextConfig strokeWidthTextConfig tensionTextConfig textConfigTextTextConfig thetaTextConfig) = | |
| 6942 | + toJSON (TextConfig alignTextConfig angleTextConfig baselineTextConfig colorTextConfig cursorTextConfig dxTextConfig dyTextConfig fillTextConfig fillOpacityTextConfig filledTextConfig fontTextConfig fontSizeTextConfig fontStyleTextConfig fontWeightTextConfig hrefTextConfig interpolateTextConfig limitTextConfig opacityTextConfig orientTextConfig radiusTextConfig shapeTextConfig shortTimeLabelsTextConfig sizeTextConfig strokeTextConfig strokeDashTextConfig strokeDashOffsetTextConfig strokeOpacityTextConfig strokeWidthTextConfig tensionTextConfig textConfigTextTextConfig thetaTextConfig) = | |
| 6943 | 6943 | object |
| 6944 | 6944 | [ "align" .= alignTextConfig |
| 6945 | 6945 | , "angle" .= angleTextConfig |
| @@ -6949,8 +6949,8 @@ instance ToJSON TextConfig where | ||
| 6949 | 6949 | , "dx" .= dxTextConfig |
| 6950 | 6950 | , "dy" .= dyTextConfig |
| 6951 | 6951 | , "fill" .= fillTextConfig |
| 6952 | - , "filled" .= filledTextConfig | |
| 6953 | 6952 | , "fillOpacity" .= fillOpacityTextConfig |
| 6953 | + , "filled" .= filledTextConfig | |
| 6954 | 6954 | , "font" .= fontTextConfig |
| 6955 | 6955 | , "fontSize" .= fontSizeTextConfig |
| 6956 | 6956 | , "fontStyle" .= fontStyleTextConfig |
| @@ -6984,8 +6984,8 @@ instance FromJSON TextConfig where | ||
| 6984 | 6984 | <*> v .:? "dx" |
| 6985 | 6985 | <*> v .:? "dy" |
| 6986 | 6986 | <*> v .:? "fill" |
| 6987 | - <*> v .:? "filled" | |
| 6988 | 6987 | <*> v .:? "fillOpacity" |
| 6988 | + <*> v .:? "filled" | |
| 6989 | 6989 | <*> v .:? "font" |
| 6990 | 6990 | <*> v .:? "fontSize" |
| 6991 | 6991 | <*> v .:? "fontStyle" |
| @@ -7565,7 +7565,7 @@ instance FromJSON VGMarkConfig where | ||
| 7565 | 7565 | <*> v .:? "theta" |
| 7566 | 7566 | |
| 7567 | 7567 | instance ToJSON TickConfig where |
| 7568 | - toJSON (TickConfig alignTickConfig angleTickConfig bandSizeTickConfig baselineTickConfig colorTickConfig cursorTickConfig dxTickConfig dyTickConfig fillTickConfig filledTickConfig fillOpacityTickConfig fontTickConfig fontSizeTickConfig fontStyleTickConfig fontWeightTickConfig hrefTickConfig interpolateTickConfig limitTickConfig opacityTickConfig orientTickConfig radiusTickConfig shapeTickConfig sizeTickConfig strokeTickConfig strokeDashTickConfig strokeDashOffsetTickConfig strokeOpacityTickConfig strokeWidthTickConfig tensionTickConfig tickConfigTextTickConfig thetaTickConfig thicknessTickConfig) = | |
| 7568 | + toJSON (TickConfig alignTickConfig angleTickConfig bandSizeTickConfig baselineTickConfig colorTickConfig cursorTickConfig dxTickConfig dyTickConfig fillTickConfig fillOpacityTickConfig filledTickConfig fontTickConfig fontSizeTickConfig fontStyleTickConfig fontWeightTickConfig hrefTickConfig interpolateTickConfig limitTickConfig opacityTickConfig orientTickConfig radiusTickConfig shapeTickConfig sizeTickConfig strokeTickConfig strokeDashTickConfig strokeDashOffsetTickConfig strokeOpacityTickConfig strokeWidthTickConfig tensionTickConfig tickConfigTextTickConfig thetaTickConfig thicknessTickConfig) = | |
| 7569 | 7569 | object |
| 7570 | 7570 | [ "align" .= alignTickConfig |
| 7571 | 7571 | , "angle" .= angleTickConfig |
| @@ -7576,8 +7576,8 @@ instance ToJSON TickConfig where | ||
| 7576 | 7576 | , "dx" .= dxTickConfig |
| 7577 | 7577 | , "dy" .= dyTickConfig |
| 7578 | 7578 | , "fill" .= fillTickConfig |
| 7579 | - , "filled" .= filledTickConfig | |
| 7580 | 7579 | , "fillOpacity" .= fillOpacityTickConfig |
| 7580 | + , "filled" .= filledTickConfig | |
| 7581 | 7581 | , "font" .= fontTickConfig |
| 7582 | 7582 | , "fontSize" .= fontSizeTickConfig |
| 7583 | 7583 | , "fontStyle" .= fontStyleTickConfig |
| @@ -7612,8 +7612,8 @@ instance FromJSON TickConfig where | ||
| 7612 | 7612 | <*> v .:? "dx" |
| 7613 | 7613 | <*> v .:? "dy" |
| 7614 | 7614 | <*> v .:? "fill" |
| 7615 | - <*> v .:? "filled" | |
| 7616 | 7615 | <*> v .:? "fillOpacity" |
| 7616 | + <*> v .:? "filled" | |
| 7617 | 7617 | <*> v .:? "font" |
| 7618 | 7618 | <*> v .:? "fontSize" |
| 7619 | 7619 | <*> v .:? "fontStyle" |
| @@ -8707,7 +8707,7 @@ instance FromJSON XClass where | ||
| 8707 | 8707 | <*> v .:? "value" |
| 8708 | 8708 | |
| 8709 | 8709 | instance ToJSON Axis where |
| 8710 | - toJSON (Axis domainAxis formatAxis gridAxis labelAngleAxis labelBoundAxis labelFlushAxis labelOverlapAxis labelPaddingAxis labelsAxis maxExtentAxis minExtentAxis offsetAxis orientAxis positionAxis tickCountAxis ticksAxis tickSizeAxis titleAxis titleMaxLengthAxis titlePaddingAxis valuesAxis zindexAxis) = | |
| 8710 | + toJSON (Axis domainAxis formatAxis gridAxis labelAngleAxis labelBoundAxis labelFlushAxis labelOverlapAxis labelPaddingAxis labelsAxis maxExtentAxis minExtentAxis offsetAxis orientAxis positionAxis tickCountAxis tickSizeAxis ticksAxis titleAxis titleMaxLengthAxis titlePaddingAxis valuesAxis zindexAxis) = | |
| 8711 | 8711 | object |
| 8712 | 8712 | [ "domain" .= domainAxis |
| 8713 | 8713 | , "format" .= formatAxis |
| @@ -8724,8 +8724,8 @@ instance ToJSON Axis where | ||
| 8724 | 8724 | , "orient" .= orientAxis |
| 8725 | 8725 | , "position" .= positionAxis |
| 8726 | 8726 | , "tickCount" .= tickCountAxis |
| 8727 | - , "ticks" .= ticksAxis | |
| 8728 | 8727 | , "tickSize" .= tickSizeAxis |
| 8728 | + , "ticks" .= ticksAxis | |
| 8729 | 8729 | , "title" .= titleAxis |
| 8730 | 8730 | , "titleMaxLength" .= titleMaxLengthAxis |
| 8731 | 8731 | , "titlePadding" .= titlePaddingAxis |
| @@ -8750,8 +8750,8 @@ instance FromJSON Axis where | ||
| 8750 | 8750 | <*> v .:? "orient" |
| 8751 | 8751 | <*> v .:? "position" |
| 8752 | 8752 | <*> v .:? "tickCount" |
| 8753 | - <*> v .:? "ticks" | |
| 8754 | 8753 | <*> v .:? "tickSize" |
| 8754 | + <*> v .:? "ticks" | |
| 8755 | 8755 | <*> v .:? "title" |
| 8756 | 8756 | <*> v .:? "titleMaxLength" |
| 8757 | 8757 | <*> v .:? "titlePadding" |
| @@ -9005,7 +9005,7 @@ instance FromJSON AnyMark where | ||
| 9005 | 9005 | parseJSON xs@(Object _) = (fmap MarkDefInAnyMark . parseJSON) xs |
| 9006 | 9006 | |
| 9007 | 9007 | instance ToJSON MarkDef where |
| 9008 | - toJSON (MarkDef alignMarkDef angleMarkDef baselineMarkDef clipMarkDef colorMarkDef cursorMarkDef dxMarkDef dyMarkDef fillMarkDef filledMarkDef fillOpacityMarkDef fontMarkDef fontSizeMarkDef fontStyleMarkDef fontWeightMarkDef hrefMarkDef interpolateMarkDef limitMarkDef opacityMarkDef orientMarkDef radiusMarkDef shapeMarkDef sizeMarkDef strokeMarkDef strokeDashMarkDef strokeDashOffsetMarkDef strokeOpacityMarkDef strokeWidthMarkDef styleMarkDef tensionMarkDef markDefTextMarkDef thetaMarkDef markDefTypeMarkDef) = | |
| 9008 | + toJSON (MarkDef alignMarkDef angleMarkDef baselineMarkDef clipMarkDef colorMarkDef cursorMarkDef dxMarkDef dyMarkDef fillMarkDef fillOpacityMarkDef filledMarkDef fontMarkDef fontSizeMarkDef fontStyleMarkDef fontWeightMarkDef hrefMarkDef interpolateMarkDef limitMarkDef opacityMarkDef orientMarkDef radiusMarkDef shapeMarkDef sizeMarkDef strokeMarkDef strokeDashMarkDef strokeDashOffsetMarkDef strokeOpacityMarkDef strokeWidthMarkDef styleMarkDef tensionMarkDef markDefTextMarkDef thetaMarkDef markDefTypeMarkDef) = | |
| 9009 | 9009 | object |
| 9010 | 9010 | [ "align" .= alignMarkDef |
| 9011 | 9011 | , "angle" .= angleMarkDef |
| @@ -9016,8 +9016,8 @@ instance ToJSON MarkDef where | ||
| 9016 | 9016 | , "dx" .= dxMarkDef |
| 9017 | 9017 | , "dy" .= dyMarkDef |
| 9018 | 9018 | , "fill" .= fillMarkDef |
| 9019 | - , "filled" .= filledMarkDef | |
| 9020 | 9019 | , "fillOpacity" .= fillOpacityMarkDef |
| 9020 | + , "filled" .= filledMarkDef | |
| 9021 | 9021 | , "font" .= fontMarkDef |
| 9022 | 9022 | , "fontSize" .= fontSizeMarkDef |
| 9023 | 9023 | , "fontStyle" .= fontStyleMarkDef |
| @@ -9053,8 +9053,8 @@ instance FromJSON MarkDef where | ||
| 9053 | 9053 | <*> v .:? "dx" |
| 9054 | 9054 | <*> v .:? "dy" |
| 9055 | 9055 | <*> v .:? "fill" |
| 9056 | - <*> v .:? "filled" | |
| 9057 | 9056 | <*> v .:? "fillOpacity" |
| 9057 | + <*> v .:? "filled" | |
| 9058 | 9058 | <*> v .:? "font" |
| 9059 | 9059 | <*> v .:? "fontSize" |
| 9060 | 9060 | <*> v .:? "fontStyle" |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / Axis.java+9 −9
| @@ -19,8 +19,8 @@ public class Axis { | ||
| 19 | 19 | private TitleOrient orient; |
| 20 | 20 | private Double position; |
| 21 | 21 | private Double tickCount; |
| 22 | - private Boolean ticks; | |
| 23 | 22 | private Double tickSize; |
| 23 | + private Boolean ticks; | |
| 24 | 24 | private String title; |
| 25 | 25 | private Double titleMaxLength; |
| 26 | 26 | private Double titlePadding; |
| @@ -206,14 +206,6 @@ public class Axis { | ||
| 206 | 206 | @JsonProperty("tickCount") |
| 207 | 207 | public void setTickCount(Double value) { this.tickCount = value; } |
| 208 | 208 | |
| 209 | - /** | |
| 210 | - * Boolean value that determines whether the axis should include ticks. | |
| 211 | - */ | |
| 212 | - @JsonProperty("ticks") | |
| 213 | - public Boolean getTicks() { return ticks; } | |
| 214 | - @JsonProperty("ticks") | |
| 215 | - public void setTicks(Boolean value) { this.ticks = value; } | |
| 216 | - | |
| 217 | 209 | /** |
| 218 | 210 | * The size in pixels of axis ticks. |
| 219 | 211 | */ |
| @@ -222,6 +214,14 @@ public class Axis { | ||
| 222 | 214 | @JsonProperty("tickSize") |
| 223 | 215 | public void setTickSize(Double value) { this.tickSize = value; } |
| 224 | 216 | |
| 217 | + /** | |
| 218 | + * Boolean value that determines whether the axis should include ticks. | |
| 219 | + */ | |
| 220 | + @JsonProperty("ticks") | |
| 221 | + public Boolean getTicks() { return ticks; } | |
| 222 | + @JsonProperty("ticks") | |
| 223 | + public void setTicks(Boolean value) { this.ticks = value; } | |
| 224 | + | |
| 225 | 225 | /** |
| 226 | 226 | * A title for the field. If `null`, the title will be removed. |
| 227 | 227 | * |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / AxisConfig.java+9 −9
| @@ -33,9 +33,9 @@ public class AxisConfig { | ||
| 33 | 33 | private Boolean shortTimeLabels; |
| 34 | 34 | private String tickColor; |
| 35 | 35 | private Boolean tickRound; |
| 36 | - private Boolean ticks; | |
| 37 | 36 | private Double tickSize; |
| 38 | 37 | private Double tickWidth; |
| 38 | + private Boolean ticks; | |
| 39 | 39 | private String titleAlign; |
| 40 | 40 | private Double titleAngle; |
| 41 | 41 | private String titleBaseline; |
| @@ -288,14 +288,6 @@ public class AxisConfig { | ||
| 288 | 288 | @JsonProperty("tickRound") |
| 289 | 289 | public void setTickRound(Boolean value) { this.tickRound = value; } |
| 290 | 290 | |
| 291 | - /** | |
| 292 | - * Boolean value that determines whether the axis should include ticks. | |
| 293 | - */ | |
| 294 | - @JsonProperty("ticks") | |
| 295 | - public Boolean getTicks() { return ticks; } | |
| 296 | - @JsonProperty("ticks") | |
| 297 | - public void setTicks(Boolean value) { this.ticks = value; } | |
| 298 | - | |
| 299 | 291 | /** |
| 300 | 292 | * The size in pixels of axis ticks. |
| 301 | 293 | */ |
| @@ -312,6 +304,14 @@ public class AxisConfig { | ||
| 312 | 304 | @JsonProperty("tickWidth") |
| 313 | 305 | public void setTickWidth(Double value) { this.tickWidth = value; } |
| 314 | 306 | |
| 307 | + /** | |
| 308 | + * Boolean value that determines whether the axis should include ticks. | |
| 309 | + */ | |
| 310 | + @JsonProperty("ticks") | |
| 311 | + public Boolean getTicks() { return ticks; } | |
| 312 | + @JsonProperty("ticks") | |
| 313 | + public void setTicks(Boolean value) { this.ticks = value; } | |
| 314 | + | |
| 315 | 315 | /** |
| 316 | 316 | * Horizontal text alignment of axis titles. |
| 317 | 317 | */ |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / BarConfig.java+11 −11
| @@ -18,8 +18,8 @@ public class BarConfig { | ||
| 18 | 18 | private Double dx; |
| 19 | 19 | private Double dy; |
| 20 | 20 | private String fill; |
| 21 | - private Boolean filled; | |
| 22 | 21 | private Double fillOpacity; |
| 22 | + private Boolean filled; | |
| 23 | 23 | private String font; |
| 24 | 24 | private Double fontSize; |
| 25 | 25 | private FontStyle fontStyle; |
| @@ -147,6 +147,16 @@ public class BarConfig { | ||
| 147 | 147 | @JsonProperty("fill") |
| 148 | 148 | public void setFill(String value) { this.fill = value; } |
| 149 | 149 | |
| 150 | + /** | |
| 151 | + * The fill opacity (value between [0,1]). | |
| 152 | + * | |
| 153 | + * __Default value:__ `1` | |
| 154 | + */ | |
| 155 | + @JsonProperty("fillOpacity") | |
| 156 | + public Double getFillOpacity() { return fillOpacity; } | |
| 157 | + @JsonProperty("fillOpacity") | |
| 158 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 159 | + | |
| 150 | 160 | /** |
| 151 | 161 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 152 | 162 | * |
| @@ -161,16 +171,6 @@ public class BarConfig { | ||
| 161 | 171 | @JsonProperty("filled") |
| 162 | 172 | public void setFilled(Boolean value) { this.filled = value; } |
| 163 | 173 | |
| 164 | - /** | |
| 165 | - * The fill opacity (value between [0,1]). | |
| 166 | - * | |
| 167 | - * __Default value:__ `1` | |
| 168 | - */ | |
| 169 | - @JsonProperty("fillOpacity") | |
| 170 | - public Double getFillOpacity() { return fillOpacity; } | |
| 171 | - @JsonProperty("fillOpacity") | |
| 172 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 173 | - | |
| 174 | 174 | /** |
| 175 | 175 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 176 | 176 | */ |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / MarkConfig.java+11 −11
| @@ -31,8 +31,8 @@ public class MarkConfig { | ||
| 31 | 31 | private Double dx; |
| 32 | 32 | private Double dy; |
| 33 | 33 | private String fill; |
| 34 | - private Boolean filled; | |
| 35 | 34 | private Double fillOpacity; |
| 35 | + private Boolean filled; | |
| 36 | 36 | private String font; |
| 37 | 37 | private Double fontSize; |
| 38 | 38 | private FontStyle fontStyle; |
| @@ -130,6 +130,16 @@ public class MarkConfig { | ||
| 130 | 130 | @JsonProperty("fill") |
| 131 | 131 | public void setFill(String value) { this.fill = value; } |
| 132 | 132 | |
| 133 | + /** | |
| 134 | + * The fill opacity (value between [0,1]). | |
| 135 | + * | |
| 136 | + * __Default value:__ `1` | |
| 137 | + */ | |
| 138 | + @JsonProperty("fillOpacity") | |
| 139 | + public Double getFillOpacity() { return fillOpacity; } | |
| 140 | + @JsonProperty("fillOpacity") | |
| 141 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 142 | + | |
| 133 | 143 | /** |
| 134 | 144 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 135 | 145 | * |
| @@ -144,16 +154,6 @@ public class MarkConfig { | ||
| 144 | 154 | @JsonProperty("filled") |
| 145 | 155 | public void setFilled(Boolean value) { this.filled = value; } |
| 146 | 156 | |
| 147 | - /** | |
| 148 | - * The fill opacity (value between [0,1]). | |
| 149 | - * | |
| 150 | - * __Default value:__ `1` | |
| 151 | - */ | |
| 152 | - @JsonProperty("fillOpacity") | |
| 153 | - public Double getFillOpacity() { return fillOpacity; } | |
| 154 | - @JsonProperty("fillOpacity") | |
| 155 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 156 | - | |
| 157 | 157 | /** |
| 158 | 158 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 159 | 159 | */ |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / MarkDef.java+11 −11
| @@ -13,8 +13,8 @@ public class MarkDef { | ||
| 13 | 13 | private Double dx; |
| 14 | 14 | private Double dy; |
| 15 | 15 | private String fill; |
| 16 | - private Boolean filled; | |
| 17 | 16 | private Double fillOpacity; |
| 17 | + private Boolean filled; | |
| 18 | 18 | private String font; |
| 19 | 19 | private Double fontSize; |
| 20 | 20 | private FontStyle fontStyle; |
| @@ -122,6 +122,16 @@ public class MarkDef { | ||
| 122 | 122 | @JsonProperty("fill") |
| 123 | 123 | public void setFill(String value) { this.fill = value; } |
| 124 | 124 | |
| 125 | + /** | |
| 126 | + * The fill opacity (value between [0,1]). | |
| 127 | + * | |
| 128 | + * __Default value:__ `1` | |
| 129 | + */ | |
| 130 | + @JsonProperty("fillOpacity") | |
| 131 | + public Double getFillOpacity() { return fillOpacity; } | |
| 132 | + @JsonProperty("fillOpacity") | |
| 133 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 134 | + | |
| 125 | 135 | /** |
| 126 | 136 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 127 | 137 | * |
| @@ -136,16 +146,6 @@ public class MarkDef { | ||
| 136 | 146 | @JsonProperty("filled") |
| 137 | 147 | public void setFilled(Boolean value) { this.filled = value; } |
| 138 | 148 | |
| 139 | - /** | |
| 140 | - * The fill opacity (value between [0,1]). | |
| 141 | - * | |
| 142 | - * __Default value:__ `1` | |
| 143 | - */ | |
| 144 | - @JsonProperty("fillOpacity") | |
| 145 | - public Double getFillOpacity() { return fillOpacity; } | |
| 146 | - @JsonProperty("fillOpacity") | |
| 147 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 148 | - | |
| 149 | 149 | /** |
| 150 | 150 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 151 | 151 | */ |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TextConfig.java+11 −11
| @@ -15,8 +15,8 @@ public class TextConfig { | ||
| 15 | 15 | private Double dx; |
| 16 | 16 | private Double dy; |
| 17 | 17 | private String fill; |
| 18 | - private Boolean filled; | |
| 19 | 18 | private Double fillOpacity; |
| 19 | + private Boolean filled; | |
| 20 | 20 | private String font; |
| 21 | 21 | private Double fontSize; |
| 22 | 22 | private FontStyle fontStyle; |
| @@ -115,6 +115,16 @@ public class TextConfig { | ||
| 115 | 115 | @JsonProperty("fill") |
| 116 | 116 | public void setFill(String value) { this.fill = value; } |
| 117 | 117 | |
| 118 | + /** | |
| 119 | + * The fill opacity (value between [0,1]). | |
| 120 | + * | |
| 121 | + * __Default value:__ `1` | |
| 122 | + */ | |
| 123 | + @JsonProperty("fillOpacity") | |
| 124 | + public Double getFillOpacity() { return fillOpacity; } | |
| 125 | + @JsonProperty("fillOpacity") | |
| 126 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 127 | + | |
| 118 | 128 | /** |
| 119 | 129 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 120 | 130 | * |
| @@ -129,16 +139,6 @@ public class TextConfig { | ||
| 129 | 139 | @JsonProperty("filled") |
| 130 | 140 | public void setFilled(Boolean value) { this.filled = value; } |
| 131 | 141 | |
| 132 | - /** | |
| 133 | - * The fill opacity (value between [0,1]). | |
| 134 | - * | |
| 135 | - * __Default value:__ `1` | |
| 136 | - */ | |
| 137 | - @JsonProperty("fillOpacity") | |
| 138 | - public Double getFillOpacity() { return fillOpacity; } | |
| 139 | - @JsonProperty("fillOpacity") | |
| 140 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 141 | - | |
| 142 | 142 | /** |
| 143 | 143 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 144 | 144 | */ |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TickConfig.java+11 −11
| @@ -16,8 +16,8 @@ public class TickConfig { | ||
| 16 | 16 | private Double dx; |
| 17 | 17 | private Double dy; |
| 18 | 18 | private String fill; |
| 19 | - private Boolean filled; | |
| 20 | 19 | private Double fillOpacity; |
| 20 | + private Boolean filled; | |
| 21 | 21 | private String font; |
| 22 | 22 | private Double fontSize; |
| 23 | 23 | private FontStyle fontStyle; |
| @@ -126,6 +126,16 @@ public class TickConfig { | ||
| 126 | 126 | @JsonProperty("fill") |
| 127 | 127 | public void setFill(String value) { this.fill = value; } |
| 128 | 128 | |
| 129 | + /** | |
| 130 | + * The fill opacity (value between [0,1]). | |
| 131 | + * | |
| 132 | + * __Default value:__ `1` | |
| 133 | + */ | |
| 134 | + @JsonProperty("fillOpacity") | |
| 135 | + public Double getFillOpacity() { return fillOpacity; } | |
| 136 | + @JsonProperty("fillOpacity") | |
| 137 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 138 | + | |
| 129 | 139 | /** |
| 130 | 140 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 131 | 141 | * |
| @@ -140,16 +150,6 @@ public class TickConfig { | ||
| 140 | 150 | @JsonProperty("filled") |
| 141 | 151 | public void setFilled(Boolean value) { this.filled = value; } |
| 142 | 152 | |
| 143 | - /** | |
| 144 | - * The fill opacity (value between [0,1]). | |
| 145 | - * | |
| 146 | - * __Default value:__ `1` | |
| 147 | - */ | |
| 148 | - @JsonProperty("fillOpacity") | |
| 149 | - public Double getFillOpacity() { return fillOpacity; } | |
| 150 | - @JsonProperty("fillOpacity") | |
| 151 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 152 | - | |
| 153 | 153 | /** |
| 154 | 154 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 155 | 155 | */ |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / VGAxisConfig.java+9 −9
| @@ -42,9 +42,9 @@ public class VGAxisConfig { | ||
| 42 | 42 | private Double minExtent; |
| 43 | 43 | private String tickColor; |
| 44 | 44 | private Boolean tickRound; |
| 45 | - private Boolean ticks; | |
| 46 | 45 | private Double tickSize; |
| 47 | 46 | private Double tickWidth; |
| 47 | + private Boolean ticks; | |
| 48 | 48 | private String titleAlign; |
| 49 | 49 | private Double titleAngle; |
| 50 | 50 | private String titleBaseline; |
| @@ -287,14 +287,6 @@ public class VGAxisConfig { | ||
| 287 | 287 | @JsonProperty("tickRound") |
| 288 | 288 | public void setTickRound(Boolean value) { this.tickRound = value; } |
| 289 | 289 | |
| 290 | - /** | |
| 291 | - * Boolean value that determines whether the axis should include ticks. | |
| 292 | - */ | |
| 293 | - @JsonProperty("ticks") | |
| 294 | - public Boolean getTicks() { return ticks; } | |
| 295 | - @JsonProperty("ticks") | |
| 296 | - public void setTicks(Boolean value) { this.ticks = value; } | |
| 297 | - | |
| 298 | 290 | /** |
| 299 | 291 | * The size in pixels of axis ticks. |
| 300 | 292 | */ |
| @@ -311,6 +303,14 @@ public class VGAxisConfig { | ||
| 311 | 303 | @JsonProperty("tickWidth") |
| 312 | 304 | public void setTickWidth(Double value) { this.tickWidth = value; } |
| 313 | 305 | |
| 306 | + /** | |
| 307 | + * Boolean value that determines whether the axis should include ticks. | |
| 308 | + */ | |
| 309 | + @JsonProperty("ticks") | |
| 310 | + public Boolean getTicks() { return ticks; } | |
| 311 | + @JsonProperty("ticks") | |
| 312 | + public void setTicks(Boolean value) { this.ticks = value; } | |
| 313 | + | |
| 314 | 314 | /** |
| 315 | 315 | * Horizontal text alignment of axis titles. |
| 316 | 316 | */ |
Mschema-java-lombokdefault / src / main / java / io / quicktype / Axis.java+9 −9
| @@ -19,8 +19,8 @@ public class Axis { | ||
| 19 | 19 | private TitleOrient orient; |
| 20 | 20 | private Double position; |
| 21 | 21 | private Double tickCount; |
| 22 | - private Boolean ticks; | |
| 23 | 22 | private Double tickSize; |
| 23 | + private Boolean ticks; | |
| 24 | 24 | private String title; |
| 25 | 25 | private Double titleMaxLength; |
| 26 | 26 | private Double titlePadding; |
| @@ -206,14 +206,6 @@ public class Axis { | ||
| 206 | 206 | @JsonProperty("tickCount") |
| 207 | 207 | public void setTickCount(Double value) { this.tickCount = value; } |
| 208 | 208 | |
| 209 | - /** | |
| 210 | - * Boolean value that determines whether the axis should include ticks. | |
| 211 | - */ | |
| 212 | - @JsonProperty("ticks") | |
| 213 | - public Boolean getTicks() { return ticks; } | |
| 214 | - @JsonProperty("ticks") | |
| 215 | - public void setTicks(Boolean value) { this.ticks = value; } | |
| 216 | - | |
| 217 | 209 | /** |
| 218 | 210 | * The size in pixels of axis ticks. |
| 219 | 211 | */ |
| @@ -222,6 +214,14 @@ public class Axis { | ||
| 222 | 214 | @JsonProperty("tickSize") |
| 223 | 215 | public void setTickSize(Double value) { this.tickSize = value; } |
| 224 | 216 | |
| 217 | + /** | |
| 218 | + * Boolean value that determines whether the axis should include ticks. | |
| 219 | + */ | |
| 220 | + @JsonProperty("ticks") | |
| 221 | + public Boolean getTicks() { return ticks; } | |
| 222 | + @JsonProperty("ticks") | |
| 223 | + public void setTicks(Boolean value) { this.ticks = value; } | |
| 224 | + | |
| 225 | 225 | /** |
| 226 | 226 | * A title for the field. If `null`, the title will be removed. |
| 227 | 227 | * |
Mschema-java-lombokdefault / src / main / java / io / quicktype / AxisConfig.java+9 −9
| @@ -33,9 +33,9 @@ public class AxisConfig { | ||
| 33 | 33 | private Boolean shortTimeLabels; |
| 34 | 34 | private String tickColor; |
| 35 | 35 | private Boolean tickRound; |
| 36 | - private Boolean ticks; | |
| 37 | 36 | private Double tickSize; |
| 38 | 37 | private Double tickWidth; |
| 38 | + private Boolean ticks; | |
| 39 | 39 | private String titleAlign; |
| 40 | 40 | private Double titleAngle; |
| 41 | 41 | private String titleBaseline; |
| @@ -288,14 +288,6 @@ public class AxisConfig { | ||
| 288 | 288 | @JsonProperty("tickRound") |
| 289 | 289 | public void setTickRound(Boolean value) { this.tickRound = value; } |
| 290 | 290 | |
| 291 | - /** | |
| 292 | - * Boolean value that determines whether the axis should include ticks. | |
| 293 | - */ | |
| 294 | - @JsonProperty("ticks") | |
| 295 | - public Boolean getTicks() { return ticks; } | |
| 296 | - @JsonProperty("ticks") | |
| 297 | - public void setTicks(Boolean value) { this.ticks = value; } | |
| 298 | - | |
| 299 | 291 | /** |
| 300 | 292 | * The size in pixels of axis ticks. |
| 301 | 293 | */ |
| @@ -312,6 +304,14 @@ public class AxisConfig { | ||
| 312 | 304 | @JsonProperty("tickWidth") |
| 313 | 305 | public void setTickWidth(Double value) { this.tickWidth = value; } |
| 314 | 306 | |
| 307 | + /** | |
| 308 | + * Boolean value that determines whether the axis should include ticks. | |
| 309 | + */ | |
| 310 | + @JsonProperty("ticks") | |
| 311 | + public Boolean getTicks() { return ticks; } | |
| 312 | + @JsonProperty("ticks") | |
| 313 | + public void setTicks(Boolean value) { this.ticks = value; } | |
| 314 | + | |
| 315 | 315 | /** |
| 316 | 316 | * Horizontal text alignment of axis titles. |
| 317 | 317 | */ |
Mschema-java-lombokdefault / src / main / java / io / quicktype / BarConfig.java+11 −11
| @@ -18,8 +18,8 @@ public class BarConfig { | ||
| 18 | 18 | private Double dx; |
| 19 | 19 | private Double dy; |
| 20 | 20 | private String fill; |
| 21 | - private Boolean filled; | |
| 22 | 21 | private Double fillOpacity; |
| 22 | + private Boolean filled; | |
| 23 | 23 | private String font; |
| 24 | 24 | private Double fontSize; |
| 25 | 25 | private FontStyle fontStyle; |
| @@ -147,6 +147,16 @@ public class BarConfig { | ||
| 147 | 147 | @JsonProperty("fill") |
| 148 | 148 | public void setFill(String value) { this.fill = value; } |
| 149 | 149 | |
| 150 | + /** | |
| 151 | + * The fill opacity (value between [0,1]). | |
| 152 | + * | |
| 153 | + * __Default value:__ `1` | |
| 154 | + */ | |
| 155 | + @JsonProperty("fillOpacity") | |
| 156 | + public Double getFillOpacity() { return fillOpacity; } | |
| 157 | + @JsonProperty("fillOpacity") | |
| 158 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 159 | + | |
| 150 | 160 | /** |
| 151 | 161 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 152 | 162 | * |
| @@ -161,16 +171,6 @@ public class BarConfig { | ||
| 161 | 171 | @JsonProperty("filled") |
| 162 | 172 | public void setFilled(Boolean value) { this.filled = value; } |
| 163 | 173 | |
| 164 | - /** | |
| 165 | - * The fill opacity (value between [0,1]). | |
| 166 | - * | |
| 167 | - * __Default value:__ `1` | |
| 168 | - */ | |
| 169 | - @JsonProperty("fillOpacity") | |
| 170 | - public Double getFillOpacity() { return fillOpacity; } | |
| 171 | - @JsonProperty("fillOpacity") | |
| 172 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 173 | - | |
| 174 | 174 | /** |
| 175 | 175 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 176 | 176 | */ |
Mschema-java-lombokdefault / src / main / java / io / quicktype / MarkConfig.java+11 −11
| @@ -31,8 +31,8 @@ public class MarkConfig { | ||
| 31 | 31 | private Double dx; |
| 32 | 32 | private Double dy; |
| 33 | 33 | private String fill; |
| 34 | - private Boolean filled; | |
| 35 | 34 | private Double fillOpacity; |
| 35 | + private Boolean filled; | |
| 36 | 36 | private String font; |
| 37 | 37 | private Double fontSize; |
| 38 | 38 | private FontStyle fontStyle; |
| @@ -130,6 +130,16 @@ public class MarkConfig { | ||
| 130 | 130 | @JsonProperty("fill") |
| 131 | 131 | public void setFill(String value) { this.fill = value; } |
| 132 | 132 | |
| 133 | + /** | |
| 134 | + * The fill opacity (value between [0,1]). | |
| 135 | + * | |
| 136 | + * __Default value:__ `1` | |
| 137 | + */ | |
| 138 | + @JsonProperty("fillOpacity") | |
| 139 | + public Double getFillOpacity() { return fillOpacity; } | |
| 140 | + @JsonProperty("fillOpacity") | |
| 141 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 142 | + | |
| 133 | 143 | /** |
| 134 | 144 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 135 | 145 | * |
| @@ -144,16 +154,6 @@ public class MarkConfig { | ||
| 144 | 154 | @JsonProperty("filled") |
| 145 | 155 | public void setFilled(Boolean value) { this.filled = value; } |
| 146 | 156 | |
| 147 | - /** | |
| 148 | - * The fill opacity (value between [0,1]). | |
| 149 | - * | |
| 150 | - * __Default value:__ `1` | |
| 151 | - */ | |
| 152 | - @JsonProperty("fillOpacity") | |
| 153 | - public Double getFillOpacity() { return fillOpacity; } | |
| 154 | - @JsonProperty("fillOpacity") | |
| 155 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 156 | - | |
| 157 | 157 | /** |
| 158 | 158 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 159 | 159 | */ |
Mschema-java-lombokdefault / src / main / java / io / quicktype / MarkDef.java+11 −11
| @@ -13,8 +13,8 @@ public class MarkDef { | ||
| 13 | 13 | private Double dx; |
| 14 | 14 | private Double dy; |
| 15 | 15 | private String fill; |
| 16 | - private Boolean filled; | |
| 17 | 16 | private Double fillOpacity; |
| 17 | + private Boolean filled; | |
| 18 | 18 | private String font; |
| 19 | 19 | private Double fontSize; |
| 20 | 20 | private FontStyle fontStyle; |
| @@ -122,6 +122,16 @@ public class MarkDef { | ||
| 122 | 122 | @JsonProperty("fill") |
| 123 | 123 | public void setFill(String value) { this.fill = value; } |
| 124 | 124 | |
| 125 | + /** | |
| 126 | + * The fill opacity (value between [0,1]). | |
| 127 | + * | |
| 128 | + * __Default value:__ `1` | |
| 129 | + */ | |
| 130 | + @JsonProperty("fillOpacity") | |
| 131 | + public Double getFillOpacity() { return fillOpacity; } | |
| 132 | + @JsonProperty("fillOpacity") | |
| 133 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 134 | + | |
| 125 | 135 | /** |
| 126 | 136 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 127 | 137 | * |
| @@ -136,16 +146,6 @@ public class MarkDef { | ||
| 136 | 146 | @JsonProperty("filled") |
| 137 | 147 | public void setFilled(Boolean value) { this.filled = value; } |
| 138 | 148 | |
| 139 | - /** | |
| 140 | - * The fill opacity (value between [0,1]). | |
| 141 | - * | |
| 142 | - * __Default value:__ `1` | |
| 143 | - */ | |
| 144 | - @JsonProperty("fillOpacity") | |
| 145 | - public Double getFillOpacity() { return fillOpacity; } | |
| 146 | - @JsonProperty("fillOpacity") | |
| 147 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 148 | - | |
| 149 | 149 | /** |
| 150 | 150 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 151 | 151 | */ |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TextConfig.java+11 −11
| @@ -15,8 +15,8 @@ public class TextConfig { | ||
| 15 | 15 | private Double dx; |
| 16 | 16 | private Double dy; |
| 17 | 17 | private String fill; |
| 18 | - private Boolean filled; | |
| 19 | 18 | private Double fillOpacity; |
| 19 | + private Boolean filled; | |
| 20 | 20 | private String font; |
| 21 | 21 | private Double fontSize; |
| 22 | 22 | private FontStyle fontStyle; |
| @@ -115,6 +115,16 @@ public class TextConfig { | ||
| 115 | 115 | @JsonProperty("fill") |
| 116 | 116 | public void setFill(String value) { this.fill = value; } |
| 117 | 117 | |
| 118 | + /** | |
| 119 | + * The fill opacity (value between [0,1]). | |
| 120 | + * | |
| 121 | + * __Default value:__ `1` | |
| 122 | + */ | |
| 123 | + @JsonProperty("fillOpacity") | |
| 124 | + public Double getFillOpacity() { return fillOpacity; } | |
| 125 | + @JsonProperty("fillOpacity") | |
| 126 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 127 | + | |
| 118 | 128 | /** |
| 119 | 129 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 120 | 130 | * |
| @@ -129,16 +139,6 @@ public class TextConfig { | ||
| 129 | 139 | @JsonProperty("filled") |
| 130 | 140 | public void setFilled(Boolean value) { this.filled = value; } |
| 131 | 141 | |
| 132 | - /** | |
| 133 | - * The fill opacity (value between [0,1]). | |
| 134 | - * | |
| 135 | - * __Default value:__ `1` | |
| 136 | - */ | |
| 137 | - @JsonProperty("fillOpacity") | |
| 138 | - public Double getFillOpacity() { return fillOpacity; } | |
| 139 | - @JsonProperty("fillOpacity") | |
| 140 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 141 | - | |
| 142 | 142 | /** |
| 143 | 143 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 144 | 144 | */ |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TickConfig.java+11 −11
| @@ -16,8 +16,8 @@ public class TickConfig { | ||
| 16 | 16 | private Double dx; |
| 17 | 17 | private Double dy; |
| 18 | 18 | private String fill; |
| 19 | - private Boolean filled; | |
| 20 | 19 | private Double fillOpacity; |
| 20 | + private Boolean filled; | |
| 21 | 21 | private String font; |
| 22 | 22 | private Double fontSize; |
| 23 | 23 | private FontStyle fontStyle; |
| @@ -126,6 +126,16 @@ public class TickConfig { | ||
| 126 | 126 | @JsonProperty("fill") |
| 127 | 127 | public void setFill(String value) { this.fill = value; } |
| 128 | 128 | |
| 129 | + /** | |
| 130 | + * The fill opacity (value between [0,1]). | |
| 131 | + * | |
| 132 | + * __Default value:__ `1` | |
| 133 | + */ | |
| 134 | + @JsonProperty("fillOpacity") | |
| 135 | + public Double getFillOpacity() { return fillOpacity; } | |
| 136 | + @JsonProperty("fillOpacity") | |
| 137 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 138 | + | |
| 129 | 139 | /** |
| 130 | 140 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 131 | 141 | * |
| @@ -140,16 +150,6 @@ public class TickConfig { | ||
| 140 | 150 | @JsonProperty("filled") |
| 141 | 151 | public void setFilled(Boolean value) { this.filled = value; } |
| 142 | 152 | |
| 143 | - /** | |
| 144 | - * The fill opacity (value between [0,1]). | |
| 145 | - * | |
| 146 | - * __Default value:__ `1` | |
| 147 | - */ | |
| 148 | - @JsonProperty("fillOpacity") | |
| 149 | - public Double getFillOpacity() { return fillOpacity; } | |
| 150 | - @JsonProperty("fillOpacity") | |
| 151 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 152 | - | |
| 153 | 153 | /** |
| 154 | 154 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 155 | 155 | */ |
Mschema-java-lombokdefault / src / main / java / io / quicktype / VGAxisConfig.java+9 −9
| @@ -42,9 +42,9 @@ public class VGAxisConfig { | ||
| 42 | 42 | private Double minExtent; |
| 43 | 43 | private String tickColor; |
| 44 | 44 | private Boolean tickRound; |
| 45 | - private Boolean ticks; | |
| 46 | 45 | private Double tickSize; |
| 47 | 46 | private Double tickWidth; |
| 47 | + private Boolean ticks; | |
| 48 | 48 | private String titleAlign; |
| 49 | 49 | private Double titleAngle; |
| 50 | 50 | private String titleBaseline; |
| @@ -287,14 +287,6 @@ public class VGAxisConfig { | ||
| 287 | 287 | @JsonProperty("tickRound") |
| 288 | 288 | public void setTickRound(Boolean value) { this.tickRound = value; } |
| 289 | 289 | |
| 290 | - /** | |
| 291 | - * Boolean value that determines whether the axis should include ticks. | |
| 292 | - */ | |
| 293 | - @JsonProperty("ticks") | |
| 294 | - public Boolean getTicks() { return ticks; } | |
| 295 | - @JsonProperty("ticks") | |
| 296 | - public void setTicks(Boolean value) { this.ticks = value; } | |
| 297 | - | |
| 298 | 290 | /** |
| 299 | 291 | * The size in pixels of axis ticks. |
| 300 | 292 | */ |
| @@ -311,6 +303,14 @@ public class VGAxisConfig { | ||
| 311 | 303 | @JsonProperty("tickWidth") |
| 312 | 304 | public void setTickWidth(Double value) { this.tickWidth = value; } |
| 313 | 305 | |
| 306 | + /** | |
| 307 | + * Boolean value that determines whether the axis should include ticks. | |
| 308 | + */ | |
| 309 | + @JsonProperty("ticks") | |
| 310 | + public Boolean getTicks() { return ticks; } | |
| 311 | + @JsonProperty("ticks") | |
| 312 | + public void setTicks(Boolean value) { this.ticks = value; } | |
| 313 | + | |
| 314 | 314 | /** |
| 315 | 315 | * Horizontal text alignment of axis titles. |
| 316 | 316 | */ |
Mschema-javadefault / src / main / java / io / quicktype / Axis.java+9 −9
| @@ -19,8 +19,8 @@ public class Axis { | ||
| 19 | 19 | private TitleOrient orient; |
| 20 | 20 | private Double position; |
| 21 | 21 | private Double tickCount; |
| 22 | - private Boolean ticks; | |
| 23 | 22 | private Double tickSize; |
| 23 | + private Boolean ticks; | |
| 24 | 24 | private String title; |
| 25 | 25 | private Double titleMaxLength; |
| 26 | 26 | private Double titlePadding; |
| @@ -206,14 +206,6 @@ public class Axis { | ||
| 206 | 206 | @JsonProperty("tickCount") |
| 207 | 207 | public void setTickCount(Double value) { this.tickCount = value; } |
| 208 | 208 | |
| 209 | - /** | |
| 210 | - * Boolean value that determines whether the axis should include ticks. | |
| 211 | - */ | |
| 212 | - @JsonProperty("ticks") | |
| 213 | - public Boolean getTicks() { return ticks; } | |
| 214 | - @JsonProperty("ticks") | |
| 215 | - public void setTicks(Boolean value) { this.ticks = value; } | |
| 216 | - | |
| 217 | 209 | /** |
| 218 | 210 | * The size in pixels of axis ticks. |
| 219 | 211 | */ |
| @@ -222,6 +214,14 @@ public class Axis { | ||
| 222 | 214 | @JsonProperty("tickSize") |
| 223 | 215 | public void setTickSize(Double value) { this.tickSize = value; } |
| 224 | 216 | |
| 217 | + /** | |
| 218 | + * Boolean value that determines whether the axis should include ticks. | |
| 219 | + */ | |
| 220 | + @JsonProperty("ticks") | |
| 221 | + public Boolean getTicks() { return ticks; } | |
| 222 | + @JsonProperty("ticks") | |
| 223 | + public void setTicks(Boolean value) { this.ticks = value; } | |
| 224 | + | |
| 225 | 225 | /** |
| 226 | 226 | * A title for the field. If `null`, the title will be removed. |
| 227 | 227 | * |
Mschema-javadefault / src / main / java / io / quicktype / AxisConfig.java+9 −9
| @@ -33,9 +33,9 @@ public class AxisConfig { | ||
| 33 | 33 | private Boolean shortTimeLabels; |
| 34 | 34 | private String tickColor; |
| 35 | 35 | private Boolean tickRound; |
| 36 | - private Boolean ticks; | |
| 37 | 36 | private Double tickSize; |
| 38 | 37 | private Double tickWidth; |
| 38 | + private Boolean ticks; | |
| 39 | 39 | private String titleAlign; |
| 40 | 40 | private Double titleAngle; |
| 41 | 41 | private String titleBaseline; |
| @@ -288,14 +288,6 @@ public class AxisConfig { | ||
| 288 | 288 | @JsonProperty("tickRound") |
| 289 | 289 | public void setTickRound(Boolean value) { this.tickRound = value; } |
| 290 | 290 | |
| 291 | - /** | |
| 292 | - * Boolean value that determines whether the axis should include ticks. | |
| 293 | - */ | |
| 294 | - @JsonProperty("ticks") | |
| 295 | - public Boolean getTicks() { return ticks; } | |
| 296 | - @JsonProperty("ticks") | |
| 297 | - public void setTicks(Boolean value) { this.ticks = value; } | |
| 298 | - | |
| 299 | 291 | /** |
| 300 | 292 | * The size in pixels of axis ticks. |
| 301 | 293 | */ |
| @@ -312,6 +304,14 @@ public class AxisConfig { | ||
| 312 | 304 | @JsonProperty("tickWidth") |
| 313 | 305 | public void setTickWidth(Double value) { this.tickWidth = value; } |
| 314 | 306 | |
| 307 | + /** | |
| 308 | + * Boolean value that determines whether the axis should include ticks. | |
| 309 | + */ | |
| 310 | + @JsonProperty("ticks") | |
| 311 | + public Boolean getTicks() { return ticks; } | |
| 312 | + @JsonProperty("ticks") | |
| 313 | + public void setTicks(Boolean value) { this.ticks = value; } | |
| 314 | + | |
| 315 | 315 | /** |
| 316 | 316 | * Horizontal text alignment of axis titles. |
| 317 | 317 | */ |
Mschema-javadefault / src / main / java / io / quicktype / BarConfig.java+11 −11
| @@ -18,8 +18,8 @@ public class BarConfig { | ||
| 18 | 18 | private Double dx; |
| 19 | 19 | private Double dy; |
| 20 | 20 | private String fill; |
| 21 | - private Boolean filled; | |
| 22 | 21 | private Double fillOpacity; |
| 22 | + private Boolean filled; | |
| 23 | 23 | private String font; |
| 24 | 24 | private Double fontSize; |
| 25 | 25 | private FontStyle fontStyle; |
| @@ -147,6 +147,16 @@ public class BarConfig { | ||
| 147 | 147 | @JsonProperty("fill") |
| 148 | 148 | public void setFill(String value) { this.fill = value; } |
| 149 | 149 | |
| 150 | + /** | |
| 151 | + * The fill opacity (value between [0,1]). | |
| 152 | + * | |
| 153 | + * __Default value:__ `1` | |
| 154 | + */ | |
| 155 | + @JsonProperty("fillOpacity") | |
| 156 | + public Double getFillOpacity() { return fillOpacity; } | |
| 157 | + @JsonProperty("fillOpacity") | |
| 158 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 159 | + | |
| 150 | 160 | /** |
| 151 | 161 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 152 | 162 | * |
| @@ -161,16 +171,6 @@ public class BarConfig { | ||
| 161 | 171 | @JsonProperty("filled") |
| 162 | 172 | public void setFilled(Boolean value) { this.filled = value; } |
| 163 | 173 | |
| 164 | - /** | |
| 165 | - * The fill opacity (value between [0,1]). | |
| 166 | - * | |
| 167 | - * __Default value:__ `1` | |
| 168 | - */ | |
| 169 | - @JsonProperty("fillOpacity") | |
| 170 | - public Double getFillOpacity() { return fillOpacity; } | |
| 171 | - @JsonProperty("fillOpacity") | |
| 172 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 173 | - | |
| 174 | 174 | /** |
| 175 | 175 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 176 | 176 | */ |
Mschema-javadefault / src / main / java / io / quicktype / MarkConfig.java+11 −11
| @@ -31,8 +31,8 @@ public class MarkConfig { | ||
| 31 | 31 | private Double dx; |
| 32 | 32 | private Double dy; |
| 33 | 33 | private String fill; |
| 34 | - private Boolean filled; | |
| 35 | 34 | private Double fillOpacity; |
| 35 | + private Boolean filled; | |
| 36 | 36 | private String font; |
| 37 | 37 | private Double fontSize; |
| 38 | 38 | private FontStyle fontStyle; |
| @@ -130,6 +130,16 @@ public class MarkConfig { | ||
| 130 | 130 | @JsonProperty("fill") |
| 131 | 131 | public void setFill(String value) { this.fill = value; } |
| 132 | 132 | |
| 133 | + /** | |
| 134 | + * The fill opacity (value between [0,1]). | |
| 135 | + * | |
| 136 | + * __Default value:__ `1` | |
| 137 | + */ | |
| 138 | + @JsonProperty("fillOpacity") | |
| 139 | + public Double getFillOpacity() { return fillOpacity; } | |
| 140 | + @JsonProperty("fillOpacity") | |
| 141 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 142 | + | |
| 133 | 143 | /** |
| 134 | 144 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 135 | 145 | * |
| @@ -144,16 +154,6 @@ public class MarkConfig { | ||
| 144 | 154 | @JsonProperty("filled") |
| 145 | 155 | public void setFilled(Boolean value) { this.filled = value; } |
| 146 | 156 | |
| 147 | - /** | |
| 148 | - * The fill opacity (value between [0,1]). | |
| 149 | - * | |
| 150 | - * __Default value:__ `1` | |
| 151 | - */ | |
| 152 | - @JsonProperty("fillOpacity") | |
| 153 | - public Double getFillOpacity() { return fillOpacity; } | |
| 154 | - @JsonProperty("fillOpacity") | |
| 155 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 156 | - | |
| 157 | 157 | /** |
| 158 | 158 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 159 | 159 | */ |
Mschema-javadefault / src / main / java / io / quicktype / MarkDef.java+11 −11
| @@ -13,8 +13,8 @@ public class MarkDef { | ||
| 13 | 13 | private Double dx; |
| 14 | 14 | private Double dy; |
| 15 | 15 | private String fill; |
| 16 | - private Boolean filled; | |
| 17 | 16 | private Double fillOpacity; |
| 17 | + private Boolean filled; | |
| 18 | 18 | private String font; |
| 19 | 19 | private Double fontSize; |
| 20 | 20 | private FontStyle fontStyle; |
| @@ -122,6 +122,16 @@ public class MarkDef { | ||
| 122 | 122 | @JsonProperty("fill") |
| 123 | 123 | public void setFill(String value) { this.fill = value; } |
| 124 | 124 | |
| 125 | + /** | |
| 126 | + * The fill opacity (value between [0,1]). | |
| 127 | + * | |
| 128 | + * __Default value:__ `1` | |
| 129 | + */ | |
| 130 | + @JsonProperty("fillOpacity") | |
| 131 | + public Double getFillOpacity() { return fillOpacity; } | |
| 132 | + @JsonProperty("fillOpacity") | |
| 133 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 134 | + | |
| 125 | 135 | /** |
| 126 | 136 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 127 | 137 | * |
| @@ -136,16 +146,6 @@ public class MarkDef { | ||
| 136 | 146 | @JsonProperty("filled") |
| 137 | 147 | public void setFilled(Boolean value) { this.filled = value; } |
| 138 | 148 | |
| 139 | - /** | |
| 140 | - * The fill opacity (value between [0,1]). | |
| 141 | - * | |
| 142 | - * __Default value:__ `1` | |
| 143 | - */ | |
| 144 | - @JsonProperty("fillOpacity") | |
| 145 | - public Double getFillOpacity() { return fillOpacity; } | |
| 146 | - @JsonProperty("fillOpacity") | |
| 147 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 148 | - | |
| 149 | 149 | /** |
| 150 | 150 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 151 | 151 | */ |
Mschema-javadefault / src / main / java / io / quicktype / TextConfig.java+11 −11
| @@ -15,8 +15,8 @@ public class TextConfig { | ||
| 15 | 15 | private Double dx; |
| 16 | 16 | private Double dy; |
| 17 | 17 | private String fill; |
| 18 | - private Boolean filled; | |
| 19 | 18 | private Double fillOpacity; |
| 19 | + private Boolean filled; | |
| 20 | 20 | private String font; |
| 21 | 21 | private Double fontSize; |
| 22 | 22 | private FontStyle fontStyle; |
| @@ -115,6 +115,16 @@ public class TextConfig { | ||
| 115 | 115 | @JsonProperty("fill") |
| 116 | 116 | public void setFill(String value) { this.fill = value; } |
| 117 | 117 | |
| 118 | + /** | |
| 119 | + * The fill opacity (value between [0,1]). | |
| 120 | + * | |
| 121 | + * __Default value:__ `1` | |
| 122 | + */ | |
| 123 | + @JsonProperty("fillOpacity") | |
| 124 | + public Double getFillOpacity() { return fillOpacity; } | |
| 125 | + @JsonProperty("fillOpacity") | |
| 126 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 127 | + | |
| 118 | 128 | /** |
| 119 | 129 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 120 | 130 | * |
| @@ -129,16 +139,6 @@ public class TextConfig { | ||
| 129 | 139 | @JsonProperty("filled") |
| 130 | 140 | public void setFilled(Boolean value) { this.filled = value; } |
| 131 | 141 | |
| 132 | - /** | |
| 133 | - * The fill opacity (value between [0,1]). | |
| 134 | - * | |
| 135 | - * __Default value:__ `1` | |
| 136 | - */ | |
| 137 | - @JsonProperty("fillOpacity") | |
| 138 | - public Double getFillOpacity() { return fillOpacity; } | |
| 139 | - @JsonProperty("fillOpacity") | |
| 140 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 141 | - | |
| 142 | 142 | /** |
| 143 | 143 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 144 | 144 | */ |
Mschema-javadefault / src / main / java / io / quicktype / TickConfig.java+11 −11
| @@ -16,8 +16,8 @@ public class TickConfig { | ||
| 16 | 16 | private Double dx; |
| 17 | 17 | private Double dy; |
| 18 | 18 | private String fill; |
| 19 | - private Boolean filled; | |
| 20 | 19 | private Double fillOpacity; |
| 20 | + private Boolean filled; | |
| 21 | 21 | private String font; |
| 22 | 22 | private Double fontSize; |
| 23 | 23 | private FontStyle fontStyle; |
| @@ -126,6 +126,16 @@ public class TickConfig { | ||
| 126 | 126 | @JsonProperty("fill") |
| 127 | 127 | public void setFill(String value) { this.fill = value; } |
| 128 | 128 | |
| 129 | + /** | |
| 130 | + * The fill opacity (value between [0,1]). | |
| 131 | + * | |
| 132 | + * __Default value:__ `1` | |
| 133 | + */ | |
| 134 | + @JsonProperty("fillOpacity") | |
| 135 | + public Double getFillOpacity() { return fillOpacity; } | |
| 136 | + @JsonProperty("fillOpacity") | |
| 137 | + public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 138 | + | |
| 129 | 139 | /** |
| 130 | 140 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 131 | 141 | * |
| @@ -140,16 +150,6 @@ public class TickConfig { | ||
| 140 | 150 | @JsonProperty("filled") |
| 141 | 151 | public void setFilled(Boolean value) { this.filled = value; } |
| 142 | 152 | |
| 143 | - /** | |
| 144 | - * The fill opacity (value between [0,1]). | |
| 145 | - * | |
| 146 | - * __Default value:__ `1` | |
| 147 | - */ | |
| 148 | - @JsonProperty("fillOpacity") | |
| 149 | - public Double getFillOpacity() { return fillOpacity; } | |
| 150 | - @JsonProperty("fillOpacity") | |
| 151 | - public void setFillOpacity(Double value) { this.fillOpacity = value; } | |
| 152 | - | |
| 153 | 153 | /** |
| 154 | 154 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 155 | 155 | */ |
Mschema-javadefault / src / main / java / io / quicktype / VGAxisConfig.java+9 −9
| @@ -42,9 +42,9 @@ public class VGAxisConfig { | ||
| 42 | 42 | private Double minExtent; |
| 43 | 43 | private String tickColor; |
| 44 | 44 | private Boolean tickRound; |
| 45 | - private Boolean ticks; | |
| 46 | 45 | private Double tickSize; |
| 47 | 46 | private Double tickWidth; |
| 47 | + private Boolean ticks; | |
| 48 | 48 | private String titleAlign; |
| 49 | 49 | private Double titleAngle; |
| 50 | 50 | private String titleBaseline; |
| @@ -287,14 +287,6 @@ public class VGAxisConfig { | ||
| 287 | 287 | @JsonProperty("tickRound") |
| 288 | 288 | public void setTickRound(Boolean value) { this.tickRound = value; } |
| 289 | 289 | |
| 290 | - /** | |
| 291 | - * Boolean value that determines whether the axis should include ticks. | |
| 292 | - */ | |
| 293 | - @JsonProperty("ticks") | |
| 294 | - public Boolean getTicks() { return ticks; } | |
| 295 | - @JsonProperty("ticks") | |
| 296 | - public void setTicks(Boolean value) { this.ticks = value; } | |
| 297 | - | |
| 298 | 290 | /** |
| 299 | 291 | * The size in pixels of axis ticks. |
| 300 | 292 | */ |
| @@ -311,6 +303,14 @@ public class VGAxisConfig { | ||
| 311 | 303 | @JsonProperty("tickWidth") |
| 312 | 304 | public void setTickWidth(Double value) { this.tickWidth = value; } |
| 313 | 305 | |
| 306 | + /** | |
| 307 | + * Boolean value that determines whether the axis should include ticks. | |
| 308 | + */ | |
| 309 | + @JsonProperty("ticks") | |
| 310 | + public Boolean getTicks() { return ticks; } | |
| 311 | + @JsonProperty("ticks") | |
| 312 | + public void setTicks(Boolean value) { this.ticks = value; } | |
| 313 | + | |
| 314 | 314 | /** |
| 315 | 315 | * Horizontal text alignment of axis titles. |
| 316 | 316 | */ |
Mschema-javascriptdefault / TopLevel.js+8 −8
| @@ -249,8 +249,8 @@ const typeMap = { | ||
| 249 | 249 | { json: "dx", js: "dx", typ: u(undefined, 3.14) }, |
| 250 | 250 | { json: "dy", js: "dy", typ: u(undefined, 3.14) }, |
| 251 | 251 | { json: "fill", js: "fill", typ: u(undefined, "") }, |
| 252 | - { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 253 | 252 | { json: "fillOpacity", js: "fillOpacity", typ: u(undefined, 3.14) }, |
| 253 | + { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 254 | 254 | { json: "font", js: "font", typ: u(undefined, "") }, |
| 255 | 255 | { json: "fontSize", js: "fontSize", typ: u(undefined, 3.14) }, |
| 256 | 256 | { json: "fontStyle", js: "fontStyle", typ: u(undefined, r("FontStyle")) }, |
| @@ -297,9 +297,9 @@ const typeMap = { | ||
| 297 | 297 | { json: "shortTimeLabels", js: "shortTimeLabels", typ: u(undefined, true) }, |
| 298 | 298 | { json: "tickColor", js: "tickColor", typ: u(undefined, "") }, |
| 299 | 299 | { json: "tickRound", js: "tickRound", typ: u(undefined, true) }, |
| 300 | - { json: "ticks", js: "ticks", typ: u(undefined, true) }, | |
| 301 | 300 | { json: "tickSize", js: "tickSize", typ: u(undefined, 3.14) }, |
| 302 | 301 | { json: "tickWidth", js: "tickWidth", typ: u(undefined, 3.14) }, |
| 302 | + { json: "ticks", js: "ticks", typ: u(undefined, true) }, | |
| 303 | 303 | { json: "titleAlign", js: "titleAlign", typ: u(undefined, "") }, |
| 304 | 304 | { json: "titleAngle", js: "titleAngle", typ: u(undefined, 3.14) }, |
| 305 | 305 | { json: "titleBaseline", js: "titleBaseline", typ: u(undefined, "") }, |
| @@ -337,9 +337,9 @@ const typeMap = { | ||
| 337 | 337 | { json: "minExtent", js: "minExtent", typ: u(undefined, 3.14) }, |
| 338 | 338 | { json: "tickColor", js: "tickColor", typ: u(undefined, "") }, |
| 339 | 339 | { json: "tickRound", js: "tickRound", typ: u(undefined, true) }, |
| 340 | - { json: "ticks", js: "ticks", typ: u(undefined, true) }, | |
| 341 | 340 | { json: "tickSize", js: "tickSize", typ: u(undefined, 3.14) }, |
| 342 | 341 | { json: "tickWidth", js: "tickWidth", typ: u(undefined, 3.14) }, |
| 342 | + { json: "ticks", js: "ticks", typ: u(undefined, true) }, | |
| 343 | 343 | { json: "titleAlign", js: "titleAlign", typ: u(undefined, "") }, |
| 344 | 344 | { json: "titleAngle", js: "titleAngle", typ: u(undefined, 3.14) }, |
| 345 | 345 | { json: "titleBaseline", js: "titleBaseline", typ: u(undefined, "") }, |
| @@ -365,8 +365,8 @@ const typeMap = { | ||
| 365 | 365 | { json: "dx", js: "dx", typ: u(undefined, 3.14) }, |
| 366 | 366 | { json: "dy", js: "dy", typ: u(undefined, 3.14) }, |
| 367 | 367 | { json: "fill", js: "fill", typ: u(undefined, "") }, |
| 368 | - { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 369 | 368 | { json: "fillOpacity", js: "fillOpacity", typ: u(undefined, 3.14) }, |
| 369 | + { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 370 | 370 | { json: "font", js: "font", typ: u(undefined, "") }, |
| 371 | 371 | { json: "fontSize", js: "fontSize", typ: u(undefined, 3.14) }, |
| 372 | 372 | { json: "fontStyle", js: "fontStyle", typ: u(undefined, r("FontStyle")) }, |
| @@ -582,8 +582,8 @@ const typeMap = { | ||
| 582 | 582 | { json: "dx", js: "dx", typ: u(undefined, 3.14) }, |
| 583 | 583 | { json: "dy", js: "dy", typ: u(undefined, 3.14) }, |
| 584 | 584 | { json: "fill", js: "fill", typ: u(undefined, "") }, |
| 585 | - { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 586 | 585 | { json: "fillOpacity", js: "fillOpacity", typ: u(undefined, 3.14) }, |
| 586 | + { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 587 | 587 | { json: "font", js: "font", typ: u(undefined, "") }, |
| 588 | 588 | { json: "fontSize", js: "fontSize", typ: u(undefined, 3.14) }, |
| 589 | 589 | { json: "fontStyle", js: "fontStyle", typ: u(undefined, r("FontStyle")) }, |
| @@ -616,8 +616,8 @@ const typeMap = { | ||
| 616 | 616 | { json: "dx", js: "dx", typ: u(undefined, 3.14) }, |
| 617 | 617 | { json: "dy", js: "dy", typ: u(undefined, 3.14) }, |
| 618 | 618 | { json: "fill", js: "fill", typ: u(undefined, "") }, |
| 619 | - { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 620 | 619 | { json: "fillOpacity", js: "fillOpacity", typ: u(undefined, 3.14) }, |
| 620 | + { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 621 | 621 | { json: "font", js: "font", typ: u(undefined, "") }, |
| 622 | 622 | { json: "fontSize", js: "fontSize", typ: u(undefined, 3.14) }, |
| 623 | 623 | { json: "fontStyle", js: "fontStyle", typ: u(undefined, r("FontStyle")) }, |
| @@ -913,8 +913,8 @@ const typeMap = { | ||
| 913 | 913 | { json: "orient", js: "orient", typ: u(undefined, r("TitleOrient")) }, |
| 914 | 914 | { json: "position", js: "position", typ: u(undefined, 3.14) }, |
| 915 | 915 | { json: "tickCount", js: "tickCount", typ: u(undefined, 3.14) }, |
| 916 | - { json: "ticks", js: "ticks", typ: u(undefined, true) }, | |
| 917 | 916 | { json: "tickSize", js: "tickSize", typ: u(undefined, 3.14) }, |
| 917 | + { json: "ticks", js: "ticks", typ: u(undefined, true) }, | |
| 918 | 918 | { json: "title", js: "title", typ: u(undefined, u(null, "")) }, |
| 919 | 919 | { json: "titleMaxLength", js: "titleMaxLength", typ: u(undefined, 3.14) }, |
| 920 | 920 | { json: "titlePadding", js: "titlePadding", typ: u(undefined, 3.14) }, |
| @@ -993,8 +993,8 @@ const typeMap = { | ||
| 993 | 993 | { json: "dx", js: "dx", typ: u(undefined, 3.14) }, |
| 994 | 994 | { json: "dy", js: "dy", typ: u(undefined, 3.14) }, |
| 995 | 995 | { json: "fill", js: "fill", typ: u(undefined, "") }, |
| 996 | - { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 997 | 996 | { json: "fillOpacity", js: "fillOpacity", typ: u(undefined, 3.14) }, |
| 997 | + { json: "filled", js: "filled", typ: u(undefined, true) }, | |
| 998 | 998 | { json: "font", js: "font", typ: u(undefined, "") }, |
| 999 | 999 | { json: "fontSize", js: "fontSize", typ: u(undefined, 3.14) }, |
| 1000 | 1000 | { json: "fontStyle", js: "fontStyle", typ: u(undefined, r("FontStyle")) }, |
Mschema-kotlin-jacksondefault / TopLevel.kt+49 −49
| @@ -706,6 +706,13 @@ data class MarkConfig ( | ||
| 706 | 706 | */ |
| 707 | 707 | val fill: String? = null, |
| 708 | 708 | |
| 709 | + /** | |
| 710 | + * The fill opacity (value between [0,1]). | |
| 711 | + * | |
| 712 | + * __Default value:__ `1` | |
| 713 | + */ | |
| 714 | + val fillOpacity: Double? = null, | |
| 715 | + | |
| 709 | 716 | /** |
| 710 | 717 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 711 | 718 | * |
| @@ -717,13 +724,6 @@ data class MarkConfig ( | ||
| 717 | 724 | */ |
| 718 | 725 | val filled: Boolean? = null, |
| 719 | 726 | |
| 720 | - /** | |
| 721 | - * The fill opacity (value between [0,1]). | |
| 722 | - * | |
| 723 | - * __Default value:__ `1` | |
| 724 | - */ | |
| 725 | - val fillOpacity: Double? = null, | |
| 726 | - | |
| 727 | 727 | /** |
| 728 | 728 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 729 | 729 | */ |
| @@ -1298,11 +1298,6 @@ data class AxisConfig ( | ||
| 1298 | 1298 | */ |
| 1299 | 1299 | val tickRound: Boolean? = null, |
| 1300 | 1300 | |
| 1301 | - /** | |
| 1302 | - * Boolean value that determines whether the axis should include ticks. | |
| 1303 | - */ | |
| 1304 | - val ticks: Boolean? = null, | |
| 1305 | - | |
| 1306 | 1301 | /** |
| 1307 | 1302 | * The size in pixels of axis ticks. |
| 1308 | 1303 | */ |
| @@ -1313,6 +1308,11 @@ data class AxisConfig ( | ||
| 1313 | 1308 | */ |
| 1314 | 1309 | val tickWidth: Double? = null, |
| 1315 | 1310 | |
| 1311 | + /** | |
| 1312 | + * Boolean value that determines whether the axis should include ticks. | |
| 1313 | + */ | |
| 1314 | + val ticks: Boolean? = null, | |
| 1315 | + | |
| 1316 | 1316 | /** |
| 1317 | 1317 | * Horizontal text alignment of axis titles. |
| 1318 | 1318 | */ |
| @@ -1642,11 +1642,6 @@ data class VGAxisConfig ( | ||
| 1642 | 1642 | */ |
| 1643 | 1643 | val tickRound: Boolean? = null, |
| 1644 | 1644 | |
| 1645 | - /** | |
| 1646 | - * Boolean value that determines whether the axis should include ticks. | |
| 1647 | - */ | |
| 1648 | - val ticks: Boolean? = null, | |
| 1649 | - | |
| 1650 | 1645 | /** |
| 1651 | 1646 | * The size in pixels of axis ticks. |
| 1652 | 1647 | */ |
| @@ -1657,6 +1652,11 @@ data class VGAxisConfig ( | ||
| 1657 | 1652 | */ |
| 1658 | 1653 | val tickWidth: Double? = null, |
| 1659 | 1654 | |
| 1655 | + /** | |
| 1656 | + * Boolean value that determines whether the axis should include ticks. | |
| 1657 | + */ | |
| 1658 | + val ticks: Boolean? = null, | |
| 1659 | + | |
| 1660 | 1660 | /** |
| 1661 | 1661 | * Horizontal text alignment of axis titles. |
| 1662 | 1662 | */ |
| @@ -1796,6 +1796,13 @@ data class BarConfig ( | ||
| 1796 | 1796 | */ |
| 1797 | 1797 | val fill: String? = null, |
| 1798 | 1798 | |
| 1799 | + /** | |
| 1800 | + * The fill opacity (value between [0,1]). | |
| 1801 | + * | |
| 1802 | + * __Default value:__ `1` | |
| 1803 | + */ | |
| 1804 | + val fillOpacity: Double? = null, | |
| 1805 | + | |
| 1799 | 1806 | /** |
| 1800 | 1807 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 1801 | 1808 | * |
| @@ -1807,13 +1814,6 @@ data class BarConfig ( | ||
| 1807 | 1814 | */ |
| 1808 | 1815 | val filled: Boolean? = null, |
| 1809 | 1816 | |
| 1810 | - /** | |
| 1811 | - * The fill opacity (value between [0,1]). | |
| 1812 | - * | |
| 1813 | - * __Default value:__ `1` | |
| 1814 | - */ | |
| 1815 | - val fillOpacity: Double? = null, | |
| 1816 | - | |
| 1817 | 1817 | /** |
| 1818 | 1818 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1819 | 1819 | */ |
| @@ -3255,6 +3255,13 @@ data class TextConfig ( | ||
| 3255 | 3255 | */ |
| 3256 | 3256 | val fill: String? = null, |
| 3257 | 3257 | |
| 3258 | + /** | |
| 3259 | + * The fill opacity (value between [0,1]). | |
| 3260 | + * | |
| 3261 | + * __Default value:__ `1` | |
| 3262 | + */ | |
| 3263 | + val fillOpacity: Double? = null, | |
| 3264 | + | |
| 3258 | 3265 | /** |
| 3259 | 3266 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 3260 | 3267 | * |
| @@ -3266,13 +3273,6 @@ data class TextConfig ( | ||
| 3266 | 3273 | */ |
| 3267 | 3274 | val filled: Boolean? = null, |
| 3268 | 3275 | |
| 3269 | - /** | |
| 3270 | - * The fill opacity (value between [0,1]). | |
| 3271 | - * | |
| 3272 | - * __Default value:__ `1` | |
| 3273 | - */ | |
| 3274 | - val fillOpacity: Double? = null, | |
| 3275 | - | |
| 3276 | 3276 | /** |
| 3277 | 3277 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3278 | 3278 | */ |
| @@ -3486,6 +3486,13 @@ data class TickConfig ( | ||
| 3486 | 3486 | */ |
| 3487 | 3487 | val fill: String? = null, |
| 3488 | 3488 | |
| 3489 | + /** | |
| 3490 | + * The fill opacity (value between [0,1]). | |
| 3491 | + * | |
| 3492 | + * __Default value:__ `1` | |
| 3493 | + */ | |
| 3494 | + val fillOpacity: Double? = null, | |
| 3495 | + | |
| 3489 | 3496 | /** |
| 3490 | 3497 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 3491 | 3498 | * |
| @@ -3497,13 +3504,6 @@ data class TickConfig ( | ||
| 3497 | 3504 | */ |
| 3498 | 3505 | val filled: Boolean? = null, |
| 3499 | 3506 | |
| 3500 | - /** | |
| 3501 | - * The fill opacity (value between [0,1]). | |
| 3502 | - * | |
| 3503 | - * __Default value:__ `1` | |
| 3504 | - */ | |
| 3505 | - val fillOpacity: Double? = null, | |
| 3506 | - | |
| 3507 | 3507 | /** |
| 3508 | 3508 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3509 | 3509 | */ |
| @@ -6632,14 +6632,14 @@ data class Axis ( | ||
| 6632 | 6632 | val tickCount: Double? = null, |
| 6633 | 6633 | |
| 6634 | 6634 | /** |
| 6635 | - * Boolean value that determines whether the axis should include ticks. | |
| 6635 | + * The size in pixels of axis ticks. | |
| 6636 | 6636 | */ |
| 6637 | - val ticks: Boolean? = null, | |
| 6637 | + val tickSize: Double? = null, | |
| 6638 | 6638 | |
| 6639 | 6639 | /** |
| 6640 | - * The size in pixels of axis ticks. | |
| 6640 | + * Boolean value that determines whether the axis should include ticks. | |
| 6641 | 6641 | */ |
| 6642 | - val tickSize: Double? = null, | |
| 6642 | + val ticks: Boolean? = null, | |
| 6643 | 6643 | |
| 6644 | 6644 | /** |
| 6645 | 6645 | * A title for the field. If `null`, the title will be removed. |
| @@ -7223,6 +7223,13 @@ data class MarkDef ( | ||
| 7223 | 7223 | */ |
| 7224 | 7224 | val fill: String? = null, |
| 7225 | 7225 | |
| 7226 | + /** | |
| 7227 | + * The fill opacity (value between [0,1]). | |
| 7228 | + * | |
| 7229 | + * __Default value:__ `1` | |
| 7230 | + */ | |
| 7231 | + val fillOpacity: Double? = null, | |
| 7232 | + | |
| 7226 | 7233 | /** |
| 7227 | 7234 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 7228 | 7235 | * |
| @@ -7234,13 +7241,6 @@ data class MarkDef ( | ||
| 7234 | 7241 | */ |
| 7235 | 7242 | val filled: Boolean? = null, |
| 7236 | 7243 | |
| 7237 | - /** | |
| 7238 | - * The fill opacity (value between [0,1]). | |
| 7239 | - * | |
| 7240 | - * __Default value:__ `1` | |
| 7241 | - */ | |
| 7242 | - val fillOpacity: Double? = null, | |
| 7243 | - | |
| 7244 | 7244 | /** |
| 7245 | 7245 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 7246 | 7246 | */ |
Mschema-kotlindefault / TopLevel.kt+49 −49
| @@ -693,6 +693,13 @@ data class MarkConfig ( | ||
| 693 | 693 | */ |
| 694 | 694 | val fill: String? = null, |
| 695 | 695 | |
| 696 | + /** | |
| 697 | + * The fill opacity (value between [0,1]). | |
| 698 | + * | |
| 699 | + * __Default value:__ `1` | |
| 700 | + */ | |
| 701 | + val fillOpacity: Double? = null, | |
| 702 | + | |
| 696 | 703 | /** |
| 697 | 704 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 698 | 705 | * |
| @@ -704,13 +711,6 @@ data class MarkConfig ( | ||
| 704 | 711 | */ |
| 705 | 712 | val filled: Boolean? = null, |
| 706 | 713 | |
| 707 | - /** | |
| 708 | - * The fill opacity (value between [0,1]). | |
| 709 | - * | |
| 710 | - * __Default value:__ `1` | |
| 711 | - */ | |
| 712 | - val fillOpacity: Double? = null, | |
| 713 | - | |
| 714 | 714 | /** |
| 715 | 715 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 716 | 716 | */ |
| @@ -1285,11 +1285,6 @@ data class AxisConfig ( | ||
| 1285 | 1285 | */ |
| 1286 | 1286 | val tickRound: Boolean? = null, |
| 1287 | 1287 | |
| 1288 | - /** | |
| 1289 | - * Boolean value that determines whether the axis should include ticks. | |
| 1290 | - */ | |
| 1291 | - val ticks: Boolean? = null, | |
| 1292 | - | |
| 1293 | 1288 | /** |
| 1294 | 1289 | * The size in pixels of axis ticks. |
| 1295 | 1290 | */ |
| @@ -1300,6 +1295,11 @@ data class AxisConfig ( | ||
| 1300 | 1295 | */ |
| 1301 | 1296 | val tickWidth: Double? = null, |
| 1302 | 1297 | |
| 1298 | + /** | |
| 1299 | + * Boolean value that determines whether the axis should include ticks. | |
| 1300 | + */ | |
| 1301 | + val ticks: Boolean? = null, | |
| 1302 | + | |
| 1303 | 1303 | /** |
| 1304 | 1304 | * Horizontal text alignment of axis titles. |
| 1305 | 1305 | */ |
| @@ -1629,11 +1629,6 @@ data class VGAxisConfig ( | ||
| 1629 | 1629 | */ |
| 1630 | 1630 | val tickRound: Boolean? = null, |
| 1631 | 1631 | |
| 1632 | - /** | |
| 1633 | - * Boolean value that determines whether the axis should include ticks. | |
| 1634 | - */ | |
| 1635 | - val ticks: Boolean? = null, | |
| 1636 | - | |
| 1637 | 1632 | /** |
| 1638 | 1633 | * The size in pixels of axis ticks. |
| 1639 | 1634 | */ |
| @@ -1644,6 +1639,11 @@ data class VGAxisConfig ( | ||
| 1644 | 1639 | */ |
| 1645 | 1640 | val tickWidth: Double? = null, |
| 1646 | 1641 | |
| 1642 | + /** | |
| 1643 | + * Boolean value that determines whether the axis should include ticks. | |
| 1644 | + */ | |
| 1645 | + val ticks: Boolean? = null, | |
| 1646 | + | |
| 1647 | 1647 | /** |
| 1648 | 1648 | * Horizontal text alignment of axis titles. |
| 1649 | 1649 | */ |
| @@ -1783,6 +1783,13 @@ data class BarConfig ( | ||
| 1783 | 1783 | */ |
| 1784 | 1784 | val fill: String? = null, |
| 1785 | 1785 | |
| 1786 | + /** | |
| 1787 | + * The fill opacity (value between [0,1]). | |
| 1788 | + * | |
| 1789 | + * __Default value:__ `1` | |
| 1790 | + */ | |
| 1791 | + val fillOpacity: Double? = null, | |
| 1792 | + | |
| 1786 | 1793 | /** |
| 1787 | 1794 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 1788 | 1795 | * |
| @@ -1794,13 +1801,6 @@ data class BarConfig ( | ||
| 1794 | 1801 | */ |
| 1795 | 1802 | val filled: Boolean? = null, |
| 1796 | 1803 | |
| 1797 | - /** | |
| 1798 | - * The fill opacity (value between [0,1]). | |
| 1799 | - * | |
| 1800 | - * __Default value:__ `1` | |
| 1801 | - */ | |
| 1802 | - val fillOpacity: Double? = null, | |
| 1803 | - | |
| 1804 | 1804 | /** |
| 1805 | 1805 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1806 | 1806 | */ |
| @@ -3239,6 +3239,13 @@ data class TextConfig ( | ||
| 3239 | 3239 | */ |
| 3240 | 3240 | val fill: String? = null, |
| 3241 | 3241 | |
| 3242 | + /** | |
| 3243 | + * The fill opacity (value between [0,1]). | |
| 3244 | + * | |
| 3245 | + * __Default value:__ `1` | |
| 3246 | + */ | |
| 3247 | + val fillOpacity: Double? = null, | |
| 3248 | + | |
| 3242 | 3249 | /** |
| 3243 | 3250 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 3244 | 3251 | * |
| @@ -3250,13 +3257,6 @@ data class TextConfig ( | ||
| 3250 | 3257 | */ |
| 3251 | 3258 | val filled: Boolean? = null, |
| 3252 | 3259 | |
| 3253 | - /** | |
| 3254 | - * The fill opacity (value between [0,1]). | |
| 3255 | - * | |
| 3256 | - * __Default value:__ `1` | |
| 3257 | - */ | |
| 3258 | - val fillOpacity: Double? = null, | |
| 3259 | - | |
| 3260 | 3260 | /** |
| 3261 | 3261 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3262 | 3262 | */ |
| @@ -3470,6 +3470,13 @@ data class TickConfig ( | ||
| 3470 | 3470 | */ |
| 3471 | 3471 | val fill: String? = null, |
| 3472 | 3472 | |
| 3473 | + /** | |
| 3474 | + * The fill opacity (value between [0,1]). | |
| 3475 | + * | |
| 3476 | + * __Default value:__ `1` | |
| 3477 | + */ | |
| 3478 | + val fillOpacity: Double? = null, | |
| 3479 | + | |
| 3473 | 3480 | /** |
| 3474 | 3481 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 3475 | 3482 | * |
| @@ -3481,13 +3488,6 @@ data class TickConfig ( | ||
| 3481 | 3488 | */ |
| 3482 | 3489 | val filled: Boolean? = null, |
| 3483 | 3490 | |
| 3484 | - /** | |
| 3485 | - * The fill opacity (value between [0,1]). | |
| 3486 | - * | |
| 3487 | - * __Default value:__ `1` | |
| 3488 | - */ | |
| 3489 | - val fillOpacity: Double? = null, | |
| 3490 | - | |
| 3491 | 3491 | /** |
| 3492 | 3492 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3493 | 3493 | */ |
| @@ -6603,14 +6603,14 @@ data class Axis ( | ||
| 6603 | 6603 | val tickCount: Double? = null, |
| 6604 | 6604 | |
| 6605 | 6605 | /** |
| 6606 | - * Boolean value that determines whether the axis should include ticks. | |
| 6606 | + * The size in pixels of axis ticks. | |
| 6607 | 6607 | */ |
| 6608 | - val ticks: Boolean? = null, | |
| 6608 | + val tickSize: Double? = null, | |
| 6609 | 6609 | |
| 6610 | 6610 | /** |
| 6611 | - * The size in pixels of axis ticks. | |
| 6611 | + * Boolean value that determines whether the axis should include ticks. | |
| 6612 | 6612 | */ |
| 6613 | - val tickSize: Double? = null, | |
| 6613 | + val ticks: Boolean? = null, | |
| 6614 | 6614 | |
| 6615 | 6615 | /** |
| 6616 | 6616 | * A title for the field. If `null`, the title will be removed. |
| @@ -7194,6 +7194,13 @@ data class MarkDef ( | ||
| 7194 | 7194 | */ |
| 7195 | 7195 | val fill: String? = null, |
| 7196 | 7196 | |
| 7197 | + /** | |
| 7198 | + * The fill opacity (value between [0,1]). | |
| 7199 | + * | |
| 7200 | + * __Default value:__ `1` | |
| 7201 | + */ | |
| 7202 | + val fillOpacity: Double? = null, | |
| 7203 | + | |
| 7197 | 7204 | /** |
| 7198 | 7205 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 7199 | 7206 | * |
| @@ -7205,13 +7212,6 @@ data class MarkDef ( | ||
| 7205 | 7212 | */ |
| 7206 | 7213 | val filled: Boolean? = null, |
| 7207 | 7214 | |
| 7208 | - /** | |
| 7209 | - * The fill opacity (value between [0,1]). | |
| 7210 | - * | |
| 7211 | - * __Default value:__ `1` | |
| 7212 | - */ | |
| 7213 | - val fillOpacity: Double? = null, | |
| 7214 | - | |
| 7215 | 7215 | /** |
| 7216 | 7216 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 7217 | 7217 | */ |
Mschema-kotlinxdefault / TopLevel.kt+49 −49
| @@ -585,6 +585,13 @@ data class MarkConfig ( | ||
| 585 | 585 | */ |
| 586 | 586 | val fill: String? = null, |
| 587 | 587 | |
| 588 | + /** | |
| 589 | + * The fill opacity (value between [0,1]). | |
| 590 | + * | |
| 591 | + * __Default value:__ `1` | |
| 592 | + */ | |
| 593 | + val fillOpacity: Double? = null, | |
| 594 | + | |
| 588 | 595 | /** |
| 589 | 596 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 590 | 597 | * |
| @@ -596,13 +603,6 @@ data class MarkConfig ( | ||
| 596 | 603 | */ |
| 597 | 604 | val filled: Boolean? = null, |
| 598 | 605 | |
| 599 | - /** | |
| 600 | - * The fill opacity (value between [0,1]). | |
| 601 | - * | |
| 602 | - * __Default value:__ `1` | |
| 603 | - */ | |
| 604 | - val fillOpacity: Double? = null, | |
| 605 | - | |
| 606 | 606 | /** |
| 607 | 607 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 608 | 608 | */ |
| @@ -1070,11 +1070,6 @@ data class AxisConfig ( | ||
| 1070 | 1070 | */ |
| 1071 | 1071 | val tickRound: Boolean? = null, |
| 1072 | 1072 | |
| 1073 | - /** | |
| 1074 | - * Boolean value that determines whether the axis should include ticks. | |
| 1075 | - */ | |
| 1076 | - val ticks: Boolean? = null, | |
| 1077 | - | |
| 1078 | 1073 | /** |
| 1079 | 1074 | * The size in pixels of axis ticks. |
| 1080 | 1075 | */ |
| @@ -1085,6 +1080,11 @@ data class AxisConfig ( | ||
| 1085 | 1080 | */ |
| 1086 | 1081 | val tickWidth: Double? = null, |
| 1087 | 1082 | |
| 1083 | + /** | |
| 1084 | + * Boolean value that determines whether the axis should include ticks. | |
| 1085 | + */ | |
| 1086 | + val ticks: Boolean? = null, | |
| 1087 | + | |
| 1088 | 1088 | /** |
| 1089 | 1089 | * Horizontal text alignment of axis titles. |
| 1090 | 1090 | */ |
| @@ -1372,11 +1372,6 @@ data class VGAxisConfig ( | ||
| 1372 | 1372 | */ |
| 1373 | 1373 | val tickRound: Boolean? = null, |
| 1374 | 1374 | |
| 1375 | - /** | |
| 1376 | - * Boolean value that determines whether the axis should include ticks. | |
| 1377 | - */ | |
| 1378 | - val ticks: Boolean? = null, | |
| 1379 | - | |
| 1380 | 1375 | /** |
| 1381 | 1376 | * The size in pixels of axis ticks. |
| 1382 | 1377 | */ |
| @@ -1387,6 +1382,11 @@ data class VGAxisConfig ( | ||
| 1387 | 1382 | */ |
| 1388 | 1383 | val tickWidth: Double? = null, |
| 1389 | 1384 | |
| 1385 | + /** | |
| 1386 | + * Boolean value that determines whether the axis should include ticks. | |
| 1387 | + */ | |
| 1388 | + val ticks: Boolean? = null, | |
| 1389 | + | |
| 1390 | 1390 | /** |
| 1391 | 1391 | * Horizontal text alignment of axis titles. |
| 1392 | 1392 | */ |
| @@ -1527,6 +1527,13 @@ data class BarConfig ( | ||
| 1527 | 1527 | */ |
| 1528 | 1528 | val fill: String? = null, |
| 1529 | 1529 | |
| 1530 | + /** | |
| 1531 | + * The fill opacity (value between [0,1]). | |
| 1532 | + * | |
| 1533 | + * __Default value:__ `1` | |
| 1534 | + */ | |
| 1535 | + val fillOpacity: Double? = null, | |
| 1536 | + | |
| 1530 | 1537 | /** |
| 1531 | 1538 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 1532 | 1539 | * |
| @@ -1538,13 +1545,6 @@ data class BarConfig ( | ||
| 1538 | 1545 | */ |
| 1539 | 1546 | val filled: Boolean? = null, |
| 1540 | 1547 | |
| 1541 | - /** | |
| 1542 | - * The fill opacity (value between [0,1]). | |
| 1543 | - * | |
| 1544 | - * __Default value:__ `1` | |
| 1545 | - */ | |
| 1546 | - val fillOpacity: Double? = null, | |
| 1547 | - | |
| 1548 | 1548 | /** |
| 1549 | 1549 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1550 | 1550 | */ |
| @@ -2869,6 +2869,13 @@ data class TextConfig ( | ||
| 2869 | 2869 | */ |
| 2870 | 2870 | val fill: String? = null, |
| 2871 | 2871 | |
| 2872 | + /** | |
| 2873 | + * The fill opacity (value between [0,1]). | |
| 2874 | + * | |
| 2875 | + * __Default value:__ `1` | |
| 2876 | + */ | |
| 2877 | + val fillOpacity: Double? = null, | |
| 2878 | + | |
| 2872 | 2879 | /** |
| 2873 | 2880 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 2874 | 2881 | * |
| @@ -2880,13 +2887,6 @@ data class TextConfig ( | ||
| 2880 | 2887 | */ |
| 2881 | 2888 | val filled: Boolean? = null, |
| 2882 | 2889 | |
| 2883 | - /** | |
| 2884 | - * The fill opacity (value between [0,1]). | |
| 2885 | - * | |
| 2886 | - * __Default value:__ `1` | |
| 2887 | - */ | |
| 2888 | - val fillOpacity: Double? = null, | |
| 2889 | - | |
| 2890 | 2890 | /** |
| 2891 | 2891 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 2892 | 2892 | */ |
| @@ -3101,6 +3101,13 @@ data class TickConfig ( | ||
| 3101 | 3101 | */ |
| 3102 | 3102 | val fill: String? = null, |
| 3103 | 3103 | |
| 3104 | + /** | |
| 3105 | + * The fill opacity (value between [0,1]). | |
| 3106 | + * | |
| 3107 | + * __Default value:__ `1` | |
| 3108 | + */ | |
| 3109 | + val fillOpacity: Double? = null, | |
| 3110 | + | |
| 3104 | 3111 | /** |
| 3105 | 3112 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 3106 | 3113 | * |
| @@ -3112,13 +3119,6 @@ data class TickConfig ( | ||
| 3112 | 3119 | */ |
| 3113 | 3120 | val filled: Boolean? = null, |
| 3114 | 3121 | |
| 3115 | - /** | |
| 3116 | - * The fill opacity (value between [0,1]). | |
| 3117 | - * | |
| 3118 | - * __Default value:__ `1` | |
| 3119 | - */ | |
| 3120 | - val fillOpacity: Double? = null, | |
| 3121 | - | |
| 3122 | 3122 | /** |
| 3123 | 3123 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3124 | 3124 | */ |
| @@ -5769,14 +5769,14 @@ data class Axis ( | ||
| 5769 | 5769 | val tickCount: Double? = null, |
| 5770 | 5770 | |
| 5771 | 5771 | /** |
| 5772 | - * Boolean value that determines whether the axis should include ticks. | |
| 5772 | + * The size in pixels of axis ticks. | |
| 5773 | 5773 | */ |
| 5774 | - val ticks: Boolean? = null, | |
| 5774 | + val tickSize: Double? = null, | |
| 5775 | 5775 | |
| 5776 | 5776 | /** |
| 5777 | - * The size in pixels of axis ticks. | |
| 5777 | + * Boolean value that determines whether the axis should include ticks. | |
| 5778 | 5778 | */ |
| 5779 | - val tickSize: Double? = null, | |
| 5779 | + val ticks: Boolean? = null, | |
| 5780 | 5780 | |
| 5781 | 5781 | /** |
| 5782 | 5782 | * A title for the field. If `null`, the title will be removed. |
| @@ -6342,6 +6342,13 @@ data class MarkDef ( | ||
| 6342 | 6342 | */ |
| 6343 | 6343 | val fill: String? = null, |
| 6344 | 6344 | |
| 6345 | + /** | |
| 6346 | + * The fill opacity (value between [0,1]). | |
| 6347 | + * | |
| 6348 | + * __Default value:__ `1` | |
| 6349 | + */ | |
| 6350 | + val fillOpacity: Double? = null, | |
| 6351 | + | |
| 6345 | 6352 | /** |
| 6346 | 6353 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 6347 | 6354 | * |
| @@ -6353,13 +6360,6 @@ data class MarkDef ( | ||
| 6353 | 6360 | */ |
| 6354 | 6361 | val filled: Boolean? = null, |
| 6355 | 6362 | |
| 6356 | - /** | |
| 6357 | - * The fill opacity (value between [0,1]). | |
| 6358 | - * | |
| 6359 | - * __Default value:__ `1` | |
| 6360 | - */ | |
| 6361 | - val fillOpacity: Double? = null, | |
| 6362 | - | |
| 6363 | 6363 | /** |
| 6364 | 6364 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 6365 | 6365 | */ |
Mschema-phpdefault / TopLevel.php+640 −640
| @@ -5858,8 +5858,8 @@ class MarkConfig { | ||
| 5858 | 5858 | private ?float $dx; // json:dx Optional |
| 5859 | 5859 | private ?float $dy; // json:dy Optional |
| 5860 | 5860 | private ?string $fill; // json:fill Optional |
| 5861 | - private ?bool $filled; // json:filled Optional | |
| 5862 | 5861 | private ?float $fillOpacity; // json:fillOpacity Optional |
| 5862 | + private ?bool $filled; // json:filled Optional | |
| 5863 | 5863 | private ?string $font; // json:font Optional |
| 5864 | 5864 | private ?float $fontSize; // json:fontSize Optional |
| 5865 | 5865 | private ?FontStyle $fontStyle; // json:fontStyle Optional |
| @@ -5890,8 +5890,8 @@ class MarkConfig { | ||
| 5890 | 5890 | * @param float|null $dx |
| 5891 | 5891 | * @param float|null $dy |
| 5892 | 5892 | * @param string|null $fill |
| 5893 | - * @param bool|null $filled | |
| 5894 | 5893 | * @param float|null $fillOpacity |
| 5894 | + * @param bool|null $filled | |
| 5895 | 5895 | * @param string|null $font |
| 5896 | 5896 | * @param float|null $fontSize |
| 5897 | 5897 | * @param FontStyle|null $fontStyle |
| @@ -5913,7 +5913,7 @@ class MarkConfig { | ||
| 5913 | 5913 | * @param string|null $text |
| 5914 | 5914 | * @param float|null $theta |
| 5915 | 5915 | */ |
| 5916 | - public function __construct(?HorizontalAlign $align, ?float $angle, ?VerticalAlign $baseline, ?string $color, ?Cursor $cursor, ?float $dx, ?float $dy, ?string $fill, ?bool $filled, ?float $fillOpacity, ?string $font, ?float $fontSize, ?FontStyle $fontStyle, FontWeight|float|null $fontWeight, ?string $href, ?Interpolate $interpolate, ?float $limit, ?float $opacity, ?Orient $orient, ?float $radius, ?string $shape, ?float $size, ?string $stroke, ?array $strokeDash, ?float $strokeDashOffset, ?float $strokeOpacity, ?float $strokeWidth, ?float $tension, ?string $text, ?float $theta) { | |
| 5916 | + public function __construct(?HorizontalAlign $align, ?float $angle, ?VerticalAlign $baseline, ?string $color, ?Cursor $cursor, ?float $dx, ?float $dy, ?string $fill, ?float $fillOpacity, ?bool $filled, ?string $font, ?float $fontSize, ?FontStyle $fontStyle, FontWeight|float|null $fontWeight, ?string $href, ?Interpolate $interpolate, ?float $limit, ?float $opacity, ?Orient $orient, ?float $radius, ?string $shape, ?float $size, ?string $stroke, ?array $strokeDash, ?float $strokeDashOffset, ?float $strokeOpacity, ?float $strokeWidth, ?float $tension, ?string $text, ?float $theta) { | |
| 5917 | 5917 | $this->align = $align; |
| 5918 | 5918 | $this->angle = $angle; |
| 5919 | 5919 | $this->baseline = $baseline; |
| @@ -5922,8 +5922,8 @@ class MarkConfig { | ||
| 5922 | 5922 | $this->dx = $dx; |
| 5923 | 5923 | $this->dy = $dy; |
| 5924 | 5924 | $this->fill = $fill; |
| 5925 | - $this->filled = $filled; | |
| 5926 | 5925 | $this->fillOpacity = $fillOpacity; |
| 5926 | + $this->filled = $filled; | |
| 5927 | 5927 | $this->font = $font; |
| 5928 | 5928 | $this->fontSize = $fontSize; |
| 5929 | 5929 | $this->fontStyle = $fontStyle; |
| @@ -6545,6 +6545,83 @@ class MarkConfig { | ||
| 6545 | 6545 | return 'MarkConfig::fill::38'; /*38:fill*/ |
| 6546 | 6546 | } |
| 6547 | 6547 | |
| 6548 | + /** | |
| 6549 | + * The fill opacity (value between [0,1]). | |
| 6550 | + * | |
| 6551 | + * __Default value:__ `1` | |
| 6552 | + * | |
| 6553 | + * @param ?float $value | |
| 6554 | + * @throws Exception | |
| 6555 | + * @return ?float | |
| 6556 | + */ | |
| 6557 | + public static function fromFillOpacity(?float $value): ?float { | |
| 6558 | + if (!is_null($value)) { | |
| 6559 | + return $value; /*float*/ | |
| 6560 | + } else { | |
| 6561 | + return null; | |
| 6562 | + } | |
| 6563 | + } | |
| 6564 | + | |
| 6565 | + /** | |
| 6566 | + * The fill opacity (value between [0,1]). | |
| 6567 | + * | |
| 6568 | + * __Default value:__ `1` | |
| 6569 | + * | |
| 6570 | + * @throws Exception | |
| 6571 | + * @return ?float | |
| 6572 | + */ | |
| 6573 | + public function toFillOpacity(): ?float { | |
| 6574 | + if (MarkConfig::validateFillOpacity($this->fillOpacity)) { | |
| 6575 | + if (!is_null($this->fillOpacity)) { | |
| 6576 | + return $this->fillOpacity; /*float*/ | |
| 6577 | + } else { | |
| 6578 | + return null; | |
| 6579 | + } | |
| 6580 | + } | |
| 6581 | + throw new Exception('never get to this MarkConfig::fillOpacity'); | |
| 6582 | + } | |
| 6583 | + | |
| 6584 | + /** | |
| 6585 | + * The fill opacity (value between [0,1]). | |
| 6586 | + * | |
| 6587 | + * __Default value:__ `1` | |
| 6588 | + * | |
| 6589 | + * @param float|null | |
| 6590 | + * @return bool | |
| 6591 | + * @throws Exception | |
| 6592 | + */ | |
| 6593 | + public static function validateFillOpacity(?float $value): bool { | |
| 6594 | + if (!is_null($value)) { | |
| 6595 | + } | |
| 6596 | + return true; | |
| 6597 | + } | |
| 6598 | + | |
| 6599 | + /** | |
| 6600 | + * The fill opacity (value between [0,1]). | |
| 6601 | + * | |
| 6602 | + * __Default value:__ `1` | |
| 6603 | + * | |
| 6604 | + * @throws Exception | |
| 6605 | + * @return ?float | |
| 6606 | + */ | |
| 6607 | + public function getFillOpacity(): ?float { | |
| 6608 | + if (MarkConfig::validateFillOpacity($this->fillOpacity)) { | |
| 6609 | + return $this->fillOpacity; | |
| 6610 | + } | |
| 6611 | + throw new Exception('never get to getFillOpacity MarkConfig::fillOpacity'); | |
| 6612 | + } | |
| 6613 | + | |
| 6614 | + /** | |
| 6615 | + * The fill opacity (value between [0,1]). | |
| 6616 | + * | |
| 6617 | + * __Default value:__ `1` | |
| 6618 | + * | |
| 6619 | + * @return ?float | |
| 6620 | + */ | |
| 6621 | + public static function sampleFillOpacity(): ?float { | |
| 6622 | + return 39.039; /*39:fillOpacity*/ | |
| 6623 | + } | |
| 6624 | + | |
| 6548 | 6625 | /** |
| 6549 | 6626 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 6550 | 6627 | * |
| @@ -6639,84 +6716,7 @@ class MarkConfig { | ||
| 6639 | 6716 | * @return ?bool |
| 6640 | 6717 | */ |
| 6641 | 6718 | public static function sampleFilled(): ?bool { |
| 6642 | - return true; /*39:filled*/ | |
| 6643 | - } | |
| 6644 | - | |
| 6645 | - /** | |
| 6646 | - * The fill opacity (value between [0,1]). | |
| 6647 | - * | |
| 6648 | - * __Default value:__ `1` | |
| 6649 | - * | |
| 6650 | - * @param ?float $value | |
| 6651 | - * @throws Exception | |
| 6652 | - * @return ?float | |
| 6653 | - */ | |
| 6654 | - public static function fromFillOpacity(?float $value): ?float { | |
| 6655 | - if (!is_null($value)) { | |
| 6656 | - return $value; /*float*/ | |
| 6657 | - } else { | |
| 6658 | - return null; | |
| 6659 | - } | |
| 6660 | - } | |
| 6661 | - | |
| 6662 | - /** | |
| 6663 | - * The fill opacity (value between [0,1]). | |
| 6664 | - * | |
| 6665 | - * __Default value:__ `1` | |
| 6666 | - * | |
| 6667 | - * @throws Exception | |
| 6668 | - * @return ?float | |
| 6669 | - */ | |
| 6670 | - public function toFillOpacity(): ?float { | |
| 6671 | - if (MarkConfig::validateFillOpacity($this->fillOpacity)) { | |
| 6672 | - if (!is_null($this->fillOpacity)) { | |
| 6673 | - return $this->fillOpacity; /*float*/ | |
| 6674 | - } else { | |
| 6675 | - return null; | |
| 6676 | - } | |
| 6677 | - } | |
| 6678 | - throw new Exception('never get to this MarkConfig::fillOpacity'); | |
| 6679 | - } | |
| 6680 | - | |
| 6681 | - /** | |
| 6682 | - * The fill opacity (value between [0,1]). | |
| 6683 | - * | |
| 6684 | - * __Default value:__ `1` | |
| 6685 | - * | |
| 6686 | - * @param float|null | |
| 6687 | - * @return bool | |
| 6688 | - * @throws Exception | |
| 6689 | - */ | |
| 6690 | - public static function validateFillOpacity(?float $value): bool { | |
| 6691 | - if (!is_null($value)) { | |
| 6692 | - } | |
| 6693 | - return true; | |
| 6694 | - } | |
| 6695 | - | |
| 6696 | - /** | |
| 6697 | - * The fill opacity (value between [0,1]). | |
| 6698 | - * | |
| 6699 | - * __Default value:__ `1` | |
| 6700 | - * | |
| 6701 | - * @throws Exception | |
| 6702 | - * @return ?float | |
| 6703 | - */ | |
| 6704 | - public function getFillOpacity(): ?float { | |
| 6705 | - if (MarkConfig::validateFillOpacity($this->fillOpacity)) { | |
| 6706 | - return $this->fillOpacity; | |
| 6707 | - } | |
| 6708 | - throw new Exception('never get to getFillOpacity MarkConfig::fillOpacity'); | |
| 6709 | - } | |
| 6710 | - | |
| 6711 | - /** | |
| 6712 | - * The fill opacity (value between [0,1]). | |
| 6713 | - * | |
| 6714 | - * __Default value:__ `1` | |
| 6715 | - * | |
| 6716 | - * @return ?float | |
| 6717 | - */ | |
| 6718 | - public static function sampleFillOpacity(): ?float { | |
| 6719 | - return 40.04; /*40:fillOpacity*/ | |
| 6719 | + return true; /*40:filled*/ | |
| 6720 | 6720 | } |
| 6721 | 6721 | |
| 6722 | 6722 | /** |
| @@ -8328,8 +8328,8 @@ class MarkConfig { | ||
| 8328 | 8328 | || MarkConfig::validateDx($this->dx) |
| 8329 | 8329 | || MarkConfig::validateDy($this->dy) |
| 8330 | 8330 | || MarkConfig::validateFill($this->fill) |
| 8331 | - || MarkConfig::validateFilled($this->filled) | |
| 8332 | 8331 | || MarkConfig::validateFillOpacity($this->fillOpacity) |
| 8332 | + || MarkConfig::validateFilled($this->filled) | |
| 8333 | 8333 | || MarkConfig::validateFont($this->font) |
| 8334 | 8334 | || MarkConfig::validateFontSize($this->fontSize) |
| 8335 | 8335 | || MarkConfig::validateFontStyle($this->fontStyle) |
| @@ -8366,8 +8366,8 @@ class MarkConfig { | ||
| 8366 | 8366 | $out->{'dx'} = $this->toDx(); |
| 8367 | 8367 | $out->{'dy'} = $this->toDy(); |
| 8368 | 8368 | $out->{'fill'} = $this->toFill(); |
| 8369 | - $out->{'filled'} = $this->toFilled(); | |
| 8370 | 8369 | $out->{'fillOpacity'} = $this->toFillOpacity(); |
| 8370 | + $out->{'filled'} = $this->toFilled(); | |
| 8371 | 8371 | $out->{'font'} = $this->toFont(); |
| 8372 | 8372 | $out->{'fontSize'} = $this->toFontSize(); |
| 8373 | 8373 | $out->{'fontStyle'} = $this->toFontStyle(); |
| @@ -8406,8 +8406,8 @@ class MarkConfig { | ||
| 8406 | 8406 | ,MarkConfig::fromDx($obj->{'dx'}) |
| 8407 | 8407 | ,MarkConfig::fromDy($obj->{'dy'}) |
| 8408 | 8408 | ,MarkConfig::fromFill($obj->{'fill'}) |
| 8409 | - ,MarkConfig::fromFilled($obj->{'filled'}) | |
| 8410 | 8409 | ,MarkConfig::fromFillOpacity($obj->{'fillOpacity'}) |
| 8410 | + ,MarkConfig::fromFilled($obj->{'filled'}) | |
| 8411 | 8411 | ,MarkConfig::fromFont($obj->{'font'}) |
| 8412 | 8412 | ,MarkConfig::fromFontSize($obj->{'fontSize'}) |
| 8413 | 8413 | ,MarkConfig::fromFontStyle($obj->{'fontStyle'}) |
| @@ -8444,8 +8444,8 @@ class MarkConfig { | ||
| 8444 | 8444 | ,MarkConfig::sampleDx() |
| 8445 | 8445 | ,MarkConfig::sampleDy() |
| 8446 | 8446 | ,MarkConfig::sampleFill() |
| 8447 | - ,MarkConfig::sampleFilled() | |
| 8448 | 8447 | ,MarkConfig::sampleFillOpacity() |
| 8448 | + ,MarkConfig::sampleFilled() | |
| 8449 | 8449 | ,MarkConfig::sampleFont() |
| 8450 | 8450 | ,MarkConfig::sampleFontSize() |
| 8451 | 8451 | ,MarkConfig::sampleFontStyle() |
| @@ -9076,9 +9076,9 @@ class AxisConfig { | ||
| 9076 | 9076 | private ?bool $shortTimeLabels; // json:shortTimeLabels Optional |
| 9077 | 9077 | private ?string $tickColor; // json:tickColor Optional |
| 9078 | 9078 | private ?bool $tickRound; // json:tickRound Optional |
| 9079 | - private ?bool $ticks; // json:ticks Optional | |
| 9080 | 9079 | private ?float $tickSize; // json:tickSize Optional |
| 9081 | 9080 | private ?float $tickWidth; // json:tickWidth Optional |
| 9081 | + private ?bool $ticks; // json:ticks Optional | |
| 9082 | 9082 | private ?string $titleAlign; // json:titleAlign Optional |
| 9083 | 9083 | private ?float $titleAngle; // json:titleAngle Optional |
| 9084 | 9084 | private ?string $titleBaseline; // json:titleBaseline Optional |
| @@ -9117,9 +9117,9 @@ class AxisConfig { | ||
| 9117 | 9117 | * @param bool|null $shortTimeLabels |
| 9118 | 9118 | * @param string|null $tickColor |
| 9119 | 9119 | * @param bool|null $tickRound |
| 9120 | - * @param bool|null $ticks | |
| 9121 | 9120 | * @param float|null $tickSize |
| 9122 | 9121 | * @param float|null $tickWidth |
| 9122 | + * @param bool|null $ticks | |
| 9123 | 9123 | * @param string|null $titleAlign |
| 9124 | 9124 | * @param float|null $titleAngle |
| 9125 | 9125 | * @param string|null $titleBaseline |
| @@ -9133,7 +9133,7 @@ class AxisConfig { | ||
| 9133 | 9133 | * @param float|null $titleX |
| 9134 | 9134 | * @param float|null $titleY |
| 9135 | 9135 | */ |
| 9136 | - public function __construct(?float $bandPosition, ?bool $domain, ?string $domainColor, ?float $domainWidth, ?bool $grid, ?string $gridColor, ?array $gridDash, ?float $gridOpacity, ?float $gridWidth, ?float $labelAngle, bool|float|null $labelBound, ?string $labelColor, bool|float|null $labelFlush, ?string $labelFont, ?float $labelFontSize, ?float $labelLimit, LabelOverlap|bool|null $labelOverlap, ?float $labelPadding, ?bool $labels, ?float $maxExtent, ?float $minExtent, ?bool $shortTimeLabels, ?string $tickColor, ?bool $tickRound, ?bool $ticks, ?float $tickSize, ?float $tickWidth, ?string $titleAlign, ?float $titleAngle, ?string $titleBaseline, ?string $titleColor, ?string $titleFont, ?float $titleFontSize, float|string|null $titleFontWeight, ?float $titleLimit, ?float $titleMaxLength, ?float $titlePadding, ?float $titleX, ?float $titleY) { | |
| 9136 | + public function __construct(?float $bandPosition, ?bool $domain, ?string $domainColor, ?float $domainWidth, ?bool $grid, ?string $gridColor, ?array $gridDash, ?float $gridOpacity, ?float $gridWidth, ?float $labelAngle, bool|float|null $labelBound, ?string $labelColor, bool|float|null $labelFlush, ?string $labelFont, ?float $labelFontSize, ?float $labelLimit, LabelOverlap|bool|null $labelOverlap, ?float $labelPadding, ?bool $labels, ?float $maxExtent, ?float $minExtent, ?bool $shortTimeLabels, ?string $tickColor, ?bool $tickRound, ?float $tickSize, ?float $tickWidth, ?bool $ticks, ?string $titleAlign, ?float $titleAngle, ?string $titleBaseline, ?string $titleColor, ?string $titleFont, ?float $titleFontSize, float|string|null $titleFontWeight, ?float $titleLimit, ?float $titleMaxLength, ?float $titlePadding, ?float $titleX, ?float $titleY) { | |
| 9137 | 9137 | $this->bandPosition = $bandPosition; |
| 9138 | 9138 | $this->domain = $domain; |
| 9139 | 9139 | $this->domainColor = $domainColor; |
| @@ -9158,9 +9158,9 @@ class AxisConfig { | ||
| 9158 | 9158 | $this->shortTimeLabels = $shortTimeLabels; |
| 9159 | 9159 | $this->tickColor = $tickColor; |
| 9160 | 9160 | $this->tickRound = $tickRound; |
| 9161 | - $this->ticks = $ticks; | |
| 9162 | 9161 | $this->tickSize = $tickSize; |
| 9163 | 9162 | $this->tickWidth = $tickWidth; |
| 9163 | + $this->ticks = $ticks; | |
| 9164 | 9164 | $this->titleAlign = $titleAlign; |
| 9165 | 9165 | $this->titleAngle = $titleAngle; |
| 9166 | 9166 | $this->titleBaseline = $titleBaseline; |
| @@ -11094,80 +11094,80 @@ class AxisConfig { | ||
| 11094 | 11094 | } |
| 11095 | 11095 | |
| 11096 | 11096 | /** |
| 11097 | - * Boolean value that determines whether the axis should include ticks. | |
| 11097 | + * The size in pixels of axis ticks. | |
| 11098 | 11098 | * |
| 11099 | - * @param ?bool $value | |
| 11099 | + * @param ?float $value | |
| 11100 | 11100 | * @throws Exception |
| 11101 | - * @return ?bool | |
| 11101 | + * @return ?float | |
| 11102 | 11102 | */ |
| 11103 | - public static function fromTicks(?bool $value): ?bool { | |
| 11103 | + public static function fromTickSize(?float $value): ?float { | |
| 11104 | 11104 | if (!is_null($value)) { |
| 11105 | - return $value; /*bool*/ | |
| 11105 | + return $value; /*float*/ | |
| 11106 | 11106 | } else { |
| 11107 | 11107 | return null; |
| 11108 | 11108 | } |
| 11109 | 11109 | } |
| 11110 | 11110 | |
| 11111 | 11111 | /** |
| 11112 | - * Boolean value that determines whether the axis should include ticks. | |
| 11112 | + * The size in pixels of axis ticks. | |
| 11113 | 11113 | * |
| 11114 | 11114 | * @throws Exception |
| 11115 | - * @return ?bool | |
| 11115 | + * @return ?float | |
| 11116 | 11116 | */ |
| 11117 | - public function toTicks(): ?bool { | |
| 11118 | - if (AxisConfig::validateTicks($this->ticks)) { | |
| 11119 | - if (!is_null($this->ticks)) { | |
| 11120 | - return $this->ticks; /*bool*/ | |
| 11117 | + public function toTickSize(): ?float { | |
| 11118 | + if (AxisConfig::validateTickSize($this->tickSize)) { | |
| 11119 | + if (!is_null($this->tickSize)) { | |
| 11120 | + return $this->tickSize; /*float*/ | |
| 11121 | 11121 | } else { |
| 11122 | 11122 | return null; |
| 11123 | 11123 | } |
| 11124 | 11124 | } |
| 11125 | - throw new Exception('never get to this AxisConfig::ticks'); | |
| 11125 | + throw new Exception('never get to this AxisConfig::tickSize'); | |
| 11126 | 11126 | } |
| 11127 | 11127 | |
| 11128 | 11128 | /** |
| 11129 | - * Boolean value that determines whether the axis should include ticks. | |
| 11129 | + * The size in pixels of axis ticks. | |
| 11130 | 11130 | * |
| 11131 | - * @param bool|null | |
| 11131 | + * @param float|null | |
| 11132 | 11132 | * @return bool |
| 11133 | 11133 | * @throws Exception |
| 11134 | 11134 | */ |
| 11135 | - public static function validateTicks(?bool $value): bool { | |
| 11135 | + public static function validateTickSize(?float $value): bool { | |
| 11136 | 11136 | if (!is_null($value)) { |
| 11137 | 11137 | } |
| 11138 | 11138 | return true; |
| 11139 | 11139 | } |
| 11140 | 11140 | |
| 11141 | 11141 | /** |
| 11142 | - * Boolean value that determines whether the axis should include ticks. | |
| 11142 | + * The size in pixels of axis ticks. | |
| 11143 | 11143 | * |
| 11144 | 11144 | * @throws Exception |
| 11145 | - * @return ?bool | |
| 11145 | + * @return ?float | |
| 11146 | 11146 | */ |
| 11147 | - public function getTicks(): ?bool { | |
| 11148 | - if (AxisConfig::validateTicks($this->ticks)) { | |
| 11149 | - return $this->ticks; | |
| 11147 | + public function getTickSize(): ?float { | |
| 11148 | + if (AxisConfig::validateTickSize($this->tickSize)) { | |
| 11149 | + return $this->tickSize; | |
| 11150 | 11150 | } |
| 11151 | - throw new Exception('never get to getTicks AxisConfig::ticks'); | |
| 11151 | + throw new Exception('never get to getTickSize AxisConfig::tickSize'); | |
| 11152 | 11152 | } |
| 11153 | 11153 | |
| 11154 | 11154 | /** |
| 11155 | - * Boolean value that determines whether the axis should include ticks. | |
| 11155 | + * The size in pixels of axis ticks. | |
| 11156 | 11156 | * |
| 11157 | - * @return ?bool | |
| 11157 | + * @return ?float | |
| 11158 | 11158 | */ |
| 11159 | - public static function sampleTicks(): ?bool { | |
| 11160 | - return true; /*55:ticks*/ | |
| 11159 | + public static function sampleTickSize(): ?float { | |
| 11160 | + return 55.055; /*55:tickSize*/ | |
| 11161 | 11161 | } |
| 11162 | 11162 | |
| 11163 | 11163 | /** |
| 11164 | - * The size in pixels of axis ticks. | |
| 11164 | + * The width, in pixels, of ticks. | |
| 11165 | 11165 | * |
| 11166 | 11166 | * @param ?float $value |
| 11167 | 11167 | * @throws Exception |
| 11168 | 11168 | * @return ?float |
| 11169 | 11169 | */ |
| 11170 | - public static function fromTickSize(?float $value): ?float { | |
| 11170 | + public static function fromTickWidth(?float $value): ?float { | |
| 11171 | 11171 | if (!is_null($value)) { |
| 11172 | 11172 | return $value; /*float*/ |
| 11173 | 11173 | } else { |
| @@ -11176,122 +11176,122 @@ class AxisConfig { | ||
| 11176 | 11176 | } |
| 11177 | 11177 | |
| 11178 | 11178 | /** |
| 11179 | - * The size in pixels of axis ticks. | |
| 11179 | + * The width, in pixels, of ticks. | |
| 11180 | 11180 | * |
| 11181 | 11181 | * @throws Exception |
| 11182 | 11182 | * @return ?float |
| 11183 | 11183 | */ |
| 11184 | - public function toTickSize(): ?float { | |
| 11185 | - if (AxisConfig::validateTickSize($this->tickSize)) { | |
| 11186 | - if (!is_null($this->tickSize)) { | |
| 11187 | - return $this->tickSize; /*float*/ | |
| 11184 | + public function toTickWidth(): ?float { | |
| 11185 | + if (AxisConfig::validateTickWidth($this->tickWidth)) { | |
| 11186 | + if (!is_null($this->tickWidth)) { | |
| 11187 | + return $this->tickWidth; /*float*/ | |
| 11188 | 11188 | } else { |
| 11189 | 11189 | return null; |
| 11190 | 11190 | } |
| 11191 | 11191 | } |
| 11192 | - throw new Exception('never get to this AxisConfig::tickSize'); | |
| 11192 | + throw new Exception('never get to this AxisConfig::tickWidth'); | |
| 11193 | 11193 | } |
| 11194 | 11194 | |
| 11195 | 11195 | /** |
| 11196 | - * The size in pixels of axis ticks. | |
| 11196 | + * The width, in pixels, of ticks. | |
| 11197 | 11197 | * |
| 11198 | 11198 | * @param float|null |
| 11199 | 11199 | * @return bool |
| 11200 | 11200 | * @throws Exception |
| 11201 | 11201 | */ |
| 11202 | - public static function validateTickSize(?float $value): bool { | |
| 11202 | + public static function validateTickWidth(?float $value): bool { | |
| 11203 | 11203 | if (!is_null($value)) { |
| 11204 | 11204 | } |
| 11205 | 11205 | return true; |
| 11206 | 11206 | } |
| 11207 | 11207 | |
| 11208 | 11208 | /** |
| 11209 | - * The size in pixels of axis ticks. | |
| 11209 | + * The width, in pixels, of ticks. | |
| 11210 | 11210 | * |
| 11211 | 11211 | * @throws Exception |
| 11212 | 11212 | * @return ?float |
| 11213 | 11213 | */ |
| 11214 | - public function getTickSize(): ?float { | |
| 11215 | - if (AxisConfig::validateTickSize($this->tickSize)) { | |
| 11216 | - return $this->tickSize; | |
| 11214 | + public function getTickWidth(): ?float { | |
| 11215 | + if (AxisConfig::validateTickWidth($this->tickWidth)) { | |
| 11216 | + return $this->tickWidth; | |
| 11217 | 11217 | } |
| 11218 | - throw new Exception('never get to getTickSize AxisConfig::tickSize'); | |
| 11218 | + throw new Exception('never get to getTickWidth AxisConfig::tickWidth'); | |
| 11219 | 11219 | } |
| 11220 | 11220 | |
| 11221 | 11221 | /** |
| 11222 | - * The size in pixels of axis ticks. | |
| 11222 | + * The width, in pixels, of ticks. | |
| 11223 | 11223 | * |
| 11224 | 11224 | * @return ?float |
| 11225 | 11225 | */ |
| 11226 | - public static function sampleTickSize(): ?float { | |
| 11227 | - return 56.056; /*56:tickSize*/ | |
| 11226 | + public static function sampleTickWidth(): ?float { | |
| 11227 | + return 56.056; /*56:tickWidth*/ | |
| 11228 | 11228 | } |
| 11229 | 11229 | |
| 11230 | 11230 | /** |
| 11231 | - * The width, in pixels, of ticks. | |
| 11231 | + * Boolean value that determines whether the axis should include ticks. | |
| 11232 | 11232 | * |
| 11233 | - * @param ?float $value | |
| 11233 | + * @param ?bool $value | |
| 11234 | 11234 | * @throws Exception |
| 11235 | - * @return ?float | |
| 11235 | + * @return ?bool | |
| 11236 | 11236 | */ |
| 11237 | - public static function fromTickWidth(?float $value): ?float { | |
| 11237 | + public static function fromTicks(?bool $value): ?bool { | |
| 11238 | 11238 | if (!is_null($value)) { |
| 11239 | - return $value; /*float*/ | |
| 11239 | + return $value; /*bool*/ | |
| 11240 | 11240 | } else { |
| 11241 | 11241 | return null; |
| 11242 | 11242 | } |
| 11243 | 11243 | } |
| 11244 | 11244 | |
| 11245 | 11245 | /** |
| 11246 | - * The width, in pixels, of ticks. | |
| 11246 | + * Boolean value that determines whether the axis should include ticks. | |
| 11247 | 11247 | * |
| 11248 | 11248 | * @throws Exception |
| 11249 | - * @return ?float | |
| 11249 | + * @return ?bool | |
| 11250 | 11250 | */ |
| 11251 | - public function toTickWidth(): ?float { | |
| 11252 | - if (AxisConfig::validateTickWidth($this->tickWidth)) { | |
| 11253 | - if (!is_null($this->tickWidth)) { | |
| 11254 | - return $this->tickWidth; /*float*/ | |
| 11251 | + public function toTicks(): ?bool { | |
| 11252 | + if (AxisConfig::validateTicks($this->ticks)) { | |
| 11253 | + if (!is_null($this->ticks)) { | |
| 11254 | + return $this->ticks; /*bool*/ | |
| 11255 | 11255 | } else { |
| 11256 | 11256 | return null; |
| 11257 | 11257 | } |
| 11258 | 11258 | } |
| 11259 | - throw new Exception('never get to this AxisConfig::tickWidth'); | |
| 11259 | + throw new Exception('never get to this AxisConfig::ticks'); | |
| 11260 | 11260 | } |
| 11261 | 11261 | |
| 11262 | 11262 | /** |
| 11263 | - * The width, in pixels, of ticks. | |
| 11263 | + * Boolean value that determines whether the axis should include ticks. | |
| 11264 | 11264 | * |
| 11265 | - * @param float|null | |
| 11265 | + * @param bool|null | |
| 11266 | 11266 | * @return bool |
| 11267 | 11267 | * @throws Exception |
| 11268 | 11268 | */ |
| 11269 | - public static function validateTickWidth(?float $value): bool { | |
| 11269 | + public static function validateTicks(?bool $value): bool { | |
| 11270 | 11270 | if (!is_null($value)) { |
| 11271 | 11271 | } |
| 11272 | 11272 | return true; |
| 11273 | 11273 | } |
| 11274 | 11274 | |
| 11275 | 11275 | /** |
| 11276 | - * The width, in pixels, of ticks. | |
| 11276 | + * Boolean value that determines whether the axis should include ticks. | |
| 11277 | 11277 | * |
| 11278 | 11278 | * @throws Exception |
| 11279 | - * @return ?float | |
| 11279 | + * @return ?bool | |
| 11280 | 11280 | */ |
| 11281 | - public function getTickWidth(): ?float { | |
| 11282 | - if (AxisConfig::validateTickWidth($this->tickWidth)) { | |
| 11283 | - return $this->tickWidth; | |
| 11281 | + public function getTicks(): ?bool { | |
| 11282 | + if (AxisConfig::validateTicks($this->ticks)) { | |
| 11283 | + return $this->ticks; | |
| 11284 | 11284 | } |
| 11285 | - throw new Exception('never get to getTickWidth AxisConfig::tickWidth'); | |
| 11285 | + throw new Exception('never get to getTicks AxisConfig::ticks'); | |
| 11286 | 11286 | } |
| 11287 | 11287 | |
| 11288 | 11288 | /** |
| 11289 | - * The width, in pixels, of ticks. | |
| 11289 | + * Boolean value that determines whether the axis should include ticks. | |
| 11290 | 11290 | * |
| 11291 | - * @return ?float | |
| 11291 | + * @return ?bool | |
| 11292 | 11292 | */ |
| 11293 | - public static function sampleTickWidth(): ?float { | |
| 11294 | - return 57.057; /*57:tickWidth*/ | |
| 11293 | + public static function sampleTicks(): ?bool { | |
| 11294 | + return true; /*57:ticks*/ | |
| 11295 | 11295 | } |
| 11296 | 11296 | |
| 11297 | 11297 | /** |
| @@ -12153,9 +12153,9 @@ class AxisConfig { | ||
| 12153 | 12153 | || AxisConfig::validateShortTimeLabels($this->shortTimeLabels) |
| 12154 | 12154 | || AxisConfig::validateTickColor($this->tickColor) |
| 12155 | 12155 | || AxisConfig::validateTickRound($this->tickRound) |
| 12156 | - || AxisConfig::validateTicks($this->ticks) | |
| 12157 | 12156 | || AxisConfig::validateTickSize($this->tickSize) |
| 12158 | 12157 | || AxisConfig::validateTickWidth($this->tickWidth) |
| 12158 | + || AxisConfig::validateTicks($this->ticks) | |
| 12159 | 12159 | || AxisConfig::validateTitleAlign($this->titleAlign) |
| 12160 | 12160 | || AxisConfig::validateTitleAngle($this->titleAngle) |
| 12161 | 12161 | || AxisConfig::validateTitleBaseline($this->titleBaseline) |
| @@ -12200,9 +12200,9 @@ class AxisConfig { | ||
| 12200 | 12200 | $out->{'shortTimeLabels'} = $this->toShortTimeLabels(); |
| 12201 | 12201 | $out->{'tickColor'} = $this->toTickColor(); |
| 12202 | 12202 | $out->{'tickRound'} = $this->toTickRound(); |
| 12203 | - $out->{'ticks'} = $this->toTicks(); | |
| 12204 | 12203 | $out->{'tickSize'} = $this->toTickSize(); |
| 12205 | 12204 | $out->{'tickWidth'} = $this->toTickWidth(); |
| 12205 | + $out->{'ticks'} = $this->toTicks(); | |
| 12206 | 12206 | $out->{'titleAlign'} = $this->toTitleAlign(); |
| 12207 | 12207 | $out->{'titleAngle'} = $this->toTitleAngle(); |
| 12208 | 12208 | $out->{'titleBaseline'} = $this->toTitleBaseline(); |
| @@ -12249,9 +12249,9 @@ class AxisConfig { | ||
| 12249 | 12249 | ,AxisConfig::fromShortTimeLabels($obj->{'shortTimeLabels'}) |
| 12250 | 12250 | ,AxisConfig::fromTickColor($obj->{'tickColor'}) |
| 12251 | 12251 | ,AxisConfig::fromTickRound($obj->{'tickRound'}) |
| 12252 | - ,AxisConfig::fromTicks($obj->{'ticks'}) | |
| 12253 | 12252 | ,AxisConfig::fromTickSize($obj->{'tickSize'}) |
| 12254 | 12253 | ,AxisConfig::fromTickWidth($obj->{'tickWidth'}) |
| 12254 | + ,AxisConfig::fromTicks($obj->{'ticks'}) | |
| 12255 | 12255 | ,AxisConfig::fromTitleAlign($obj->{'titleAlign'}) |
| 12256 | 12256 | ,AxisConfig::fromTitleAngle($obj->{'titleAngle'}) |
| 12257 | 12257 | ,AxisConfig::fromTitleBaseline($obj->{'titleBaseline'}) |
| @@ -12296,9 +12296,9 @@ class AxisConfig { | ||
| 12296 | 12296 | ,AxisConfig::sampleShortTimeLabels() |
| 12297 | 12297 | ,AxisConfig::sampleTickColor() |
| 12298 | 12298 | ,AxisConfig::sampleTickRound() |
| 12299 | - ,AxisConfig::sampleTicks() | |
| 12300 | 12299 | ,AxisConfig::sampleTickSize() |
| 12301 | 12300 | ,AxisConfig::sampleTickWidth() |
| 12301 | + ,AxisConfig::sampleTicks() | |
| 12302 | 12302 | ,AxisConfig::sampleTitleAlign() |
| 12303 | 12303 | ,AxisConfig::sampleTitleAngle() |
| 12304 | 12304 | ,AxisConfig::sampleTitleBaseline() |
| @@ -12390,9 +12390,9 @@ class VGAxisConfig { | ||
| 12390 | 12390 | private ?float $minExtent; // json:minExtent Optional |
| 12391 | 12391 | private ?string $tickColor; // json:tickColor Optional |
| 12392 | 12392 | private ?bool $tickRound; // json:tickRound Optional |
| 12393 | - private ?bool $ticks; // json:ticks Optional | |
| 12394 | 12393 | private ?float $tickSize; // json:tickSize Optional |
| 12395 | 12394 | private ?float $tickWidth; // json:tickWidth Optional |
| 12395 | + private ?bool $ticks; // json:ticks Optional | |
| 12396 | 12396 | private ?string $titleAlign; // json:titleAlign Optional |
| 12397 | 12397 | private ?float $titleAngle; // json:titleAngle Optional |
| 12398 | 12398 | private ?string $titleBaseline; // json:titleBaseline Optional |
| @@ -12430,9 +12430,9 @@ class VGAxisConfig { | ||
| 12430 | 12430 | * @param float|null $minExtent |
| 12431 | 12431 | * @param string|null $tickColor |
| 12432 | 12432 | * @param bool|null $tickRound |
| 12433 | - * @param bool|null $ticks | |
| 12434 | 12433 | * @param float|null $tickSize |
| 12435 | 12434 | * @param float|null $tickWidth |
| 12435 | + * @param bool|null $ticks | |
| 12436 | 12436 | * @param string|null $titleAlign |
| 12437 | 12437 | * @param float|null $titleAngle |
| 12438 | 12438 | * @param string|null $titleBaseline |
| @@ -12446,7 +12446,7 @@ class VGAxisConfig { | ||
| 12446 | 12446 | * @param float|null $titleX |
| 12447 | 12447 | * @param float|null $titleY |
| 12448 | 12448 | */ |
| 12449 | - public function __construct(?float $bandPosition, ?bool $domain, ?string $domainColor, ?float $domainWidth, ?bool $grid, ?string $gridColor, ?array $gridDash, ?float $gridOpacity, ?float $gridWidth, ?float $labelAngle, bool|float|null $labelBound, ?string $labelColor, bool|float|null $labelFlush, ?string $labelFont, ?float $labelFontSize, ?float $labelLimit, LabelOverlap|bool|null $labelOverlap, ?float $labelPadding, ?bool $labels, ?float $maxExtent, ?float $minExtent, ?string $tickColor, ?bool $tickRound, ?bool $ticks, ?float $tickSize, ?float $tickWidth, ?string $titleAlign, ?float $titleAngle, ?string $titleBaseline, ?string $titleColor, ?string $titleFont, ?float $titleFontSize, float|string|null $titleFontWeight, ?float $titleLimit, ?float $titleMaxLength, ?float $titlePadding, ?float $titleX, ?float $titleY) { | |
| 12449 | + public function __construct(?float $bandPosition, ?bool $domain, ?string $domainColor, ?float $domainWidth, ?bool $grid, ?string $gridColor, ?array $gridDash, ?float $gridOpacity, ?float $gridWidth, ?float $labelAngle, bool|float|null $labelBound, ?string $labelColor, bool|float|null $labelFlush, ?string $labelFont, ?float $labelFontSize, ?float $labelLimit, LabelOverlap|bool|null $labelOverlap, ?float $labelPadding, ?bool $labels, ?float $maxExtent, ?float $minExtent, ?string $tickColor, ?bool $tickRound, ?float $tickSize, ?float $tickWidth, ?bool $ticks, ?string $titleAlign, ?float $titleAngle, ?string $titleBaseline, ?string $titleColor, ?string $titleFont, ?float $titleFontSize, float|string|null $titleFontWeight, ?float $titleLimit, ?float $titleMaxLength, ?float $titlePadding, ?float $titleX, ?float $titleY) { | |
| 12450 | 12450 | $this->bandPosition = $bandPosition; |
| 12451 | 12451 | $this->domain = $domain; |
| 12452 | 12452 | $this->domainColor = $domainColor; |
| @@ -12470,9 +12470,9 @@ class VGAxisConfig { | ||
| 12470 | 12470 | $this->minExtent = $minExtent; |
| 12471 | 12471 | $this->tickColor = $tickColor; |
| 12472 | 12472 | $this->tickRound = $tickRound; |
| 12473 | - $this->ticks = $ticks; | |
| 12474 | 12473 | $this->tickSize = $tickSize; |
| 12475 | 12474 | $this->tickWidth = $tickWidth; |
| 12475 | + $this->ticks = $ticks; | |
| 12476 | 12476 | $this->titleAlign = $titleAlign; |
| 12477 | 12477 | $this->titleAngle = $titleAngle; |
| 12478 | 12478 | $this->titleBaseline = $titleBaseline; |
| @@ -14329,80 +14329,80 @@ class VGAxisConfig { | ||
| 14329 | 14329 | } |
| 14330 | 14330 | |
| 14331 | 14331 | /** |
| 14332 | - * Boolean value that determines whether the axis should include ticks. | |
| 14332 | + * The size in pixels of axis ticks. | |
| 14333 | 14333 | * |
| 14334 | - * @param ?bool $value | |
| 14334 | + * @param ?float $value | |
| 14335 | 14335 | * @throws Exception |
| 14336 | - * @return ?bool | |
| 14336 | + * @return ?float | |
| 14337 | 14337 | */ |
| 14338 | - public static function fromTicks(?bool $value): ?bool { | |
| 14338 | + public static function fromTickSize(?float $value): ?float { | |
| 14339 | 14339 | if (!is_null($value)) { |
| 14340 | - return $value; /*bool*/ | |
| 14340 | + return $value; /*float*/ | |
| 14341 | 14341 | } else { |
| 14342 | 14342 | return null; |
| 14343 | 14343 | } |
| 14344 | 14344 | } |
| 14345 | 14345 | |
| 14346 | 14346 | /** |
| 14347 | - * Boolean value that determines whether the axis should include ticks. | |
| 14347 | + * The size in pixels of axis ticks. | |
| 14348 | 14348 | * |
| 14349 | 14349 | * @throws Exception |
| 14350 | - * @return ?bool | |
| 14350 | + * @return ?float | |
| 14351 | 14351 | */ |
| 14352 | - public function toTicks(): ?bool { | |
| 14353 | - if (VGAxisConfig::validateTicks($this->ticks)) { | |
| 14354 | - if (!is_null($this->ticks)) { | |
| 14355 | - return $this->ticks; /*bool*/ | |
| 14352 | + public function toTickSize(): ?float { | |
| 14353 | + if (VGAxisConfig::validateTickSize($this->tickSize)) { | |
| 14354 | + if (!is_null($this->tickSize)) { | |
| 14355 | + return $this->tickSize; /*float*/ | |
| 14356 | 14356 | } else { |
| 14357 | 14357 | return null; |
| 14358 | 14358 | } |
| 14359 | 14359 | } |
| 14360 | - throw new Exception('never get to this VGAxisConfig::ticks'); | |
| 14360 | + throw new Exception('never get to this VGAxisConfig::tickSize'); | |
| 14361 | 14361 | } |
| 14362 | 14362 | |
| 14363 | 14363 | /** |
| 14364 | - * Boolean value that determines whether the axis should include ticks. | |
| 14364 | + * The size in pixels of axis ticks. | |
| 14365 | 14365 | * |
| 14366 | - * @param bool|null | |
| 14366 | + * @param float|null | |
| 14367 | 14367 | * @return bool |
| 14368 | 14368 | * @throws Exception |
| 14369 | 14369 | */ |
| 14370 | - public static function validateTicks(?bool $value): bool { | |
| 14370 | + public static function validateTickSize(?float $value): bool { | |
| 14371 | 14371 | if (!is_null($value)) { |
| 14372 | 14372 | } |
| 14373 | 14373 | return true; |
| 14374 | 14374 | } |
| 14375 | 14375 | |
| 14376 | 14376 | /** |
| 14377 | - * Boolean value that determines whether the axis should include ticks. | |
| 14377 | + * The size in pixels of axis ticks. | |
| 14378 | 14378 | * |
| 14379 | 14379 | * @throws Exception |
| 14380 | - * @return ?bool | |
| 14380 | + * @return ?float | |
| 14381 | 14381 | */ |
| 14382 | - public function getTicks(): ?bool { | |
| 14383 | - if (VGAxisConfig::validateTicks($this->ticks)) { | |
| 14384 | - return $this->ticks; | |
| 14382 | + public function getTickSize(): ?float { | |
| 14383 | + if (VGAxisConfig::validateTickSize($this->tickSize)) { | |
| 14384 | + return $this->tickSize; | |
| 14385 | 14385 | } |
| 14386 | - throw new Exception('never get to getTicks VGAxisConfig::ticks'); | |
| 14386 | + throw new Exception('never get to getTickSize VGAxisConfig::tickSize'); | |
| 14387 | 14387 | } |
| 14388 | 14388 | |
| 14389 | 14389 | /** |
| 14390 | - * Boolean value that determines whether the axis should include ticks. | |
| 14390 | + * The size in pixels of axis ticks. | |
| 14391 | 14391 | * |
| 14392 | - * @return ?bool | |
| 14392 | + * @return ?float | |
| 14393 | 14393 | */ |
| 14394 | - public static function sampleTicks(): ?bool { | |
| 14395 | - return true; /*54:ticks*/ | |
| 14394 | + public static function sampleTickSize(): ?float { | |
| 14395 | + return 54.054; /*54:tickSize*/ | |
| 14396 | 14396 | } |
| 14397 | 14397 | |
| 14398 | 14398 | /** |
| 14399 | - * The size in pixels of axis ticks. | |
| 14399 | + * The width, in pixels, of ticks. | |
| 14400 | 14400 | * |
| 14401 | 14401 | * @param ?float $value |
| 14402 | 14402 | * @throws Exception |
| 14403 | 14403 | * @return ?float |
| 14404 | 14404 | */ |
| 14405 | - public static function fromTickSize(?float $value): ?float { | |
| 14405 | + public static function fromTickWidth(?float $value): ?float { | |
| 14406 | 14406 | if (!is_null($value)) { |
| 14407 | 14407 | return $value; /*float*/ |
| 14408 | 14408 | } else { |
| @@ -14411,122 +14411,122 @@ class VGAxisConfig { | ||
| 14411 | 14411 | } |
| 14412 | 14412 | |
| 14413 | 14413 | /** |
| 14414 | - * The size in pixels of axis ticks. | |
| 14414 | + * The width, in pixels, of ticks. | |
| 14415 | 14415 | * |
| 14416 | 14416 | * @throws Exception |
| 14417 | 14417 | * @return ?float |
| 14418 | 14418 | */ |
| 14419 | - public function toTickSize(): ?float { | |
| 14420 | - if (VGAxisConfig::validateTickSize($this->tickSize)) { | |
| 14421 | - if (!is_null($this->tickSize)) { | |
| 14422 | - return $this->tickSize; /*float*/ | |
| 14419 | + public function toTickWidth(): ?float { | |
| 14420 | + if (VGAxisConfig::validateTickWidth($this->tickWidth)) { | |
| 14421 | + if (!is_null($this->tickWidth)) { | |
| 14422 | + return $this->tickWidth; /*float*/ | |
| 14423 | 14423 | } else { |
| 14424 | 14424 | return null; |
| 14425 | 14425 | } |
| 14426 | 14426 | } |
| 14427 | - throw new Exception('never get to this VGAxisConfig::tickSize'); | |
| 14427 | + throw new Exception('never get to this VGAxisConfig::tickWidth'); | |
| 14428 | 14428 | } |
| 14429 | 14429 | |
| 14430 | 14430 | /** |
| 14431 | - * The size in pixels of axis ticks. | |
| 14431 | + * The width, in pixels, of ticks. | |
| 14432 | 14432 | * |
| 14433 | 14433 | * @param float|null |
| 14434 | 14434 | * @return bool |
| 14435 | 14435 | * @throws Exception |
| 14436 | 14436 | */ |
| 14437 | - public static function validateTickSize(?float $value): bool { | |
| 14437 | + public static function validateTickWidth(?float $value): bool { | |
| 14438 | 14438 | if (!is_null($value)) { |
| 14439 | 14439 | } |
| 14440 | 14440 | return true; |
| 14441 | 14441 | } |
| 14442 | 14442 | |
| 14443 | 14443 | /** |
| 14444 | - * The size in pixels of axis ticks. | |
| 14444 | + * The width, in pixels, of ticks. | |
| 14445 | 14445 | * |
| 14446 | 14446 | * @throws Exception |
| 14447 | 14447 | * @return ?float |
| 14448 | 14448 | */ |
| 14449 | - public function getTickSize(): ?float { | |
| 14450 | - if (VGAxisConfig::validateTickSize($this->tickSize)) { | |
| 14451 | - return $this->tickSize; | |
| 14449 | + public function getTickWidth(): ?float { | |
| 14450 | + if (VGAxisConfig::validateTickWidth($this->tickWidth)) { | |
| 14451 | + return $this->tickWidth; | |
| 14452 | 14452 | } |
| 14453 | - throw new Exception('never get to getTickSize VGAxisConfig::tickSize'); | |
| 14453 | + throw new Exception('never get to getTickWidth VGAxisConfig::tickWidth'); | |
| 14454 | 14454 | } |
| 14455 | 14455 | |
| 14456 | 14456 | /** |
| 14457 | - * The size in pixels of axis ticks. | |
| 14457 | + * The width, in pixels, of ticks. | |
| 14458 | 14458 | * |
| 14459 | 14459 | * @return ?float |
| 14460 | 14460 | */ |
| 14461 | - public static function sampleTickSize(): ?float { | |
| 14462 | - return 55.055; /*55:tickSize*/ | |
| 14461 | + public static function sampleTickWidth(): ?float { | |
| 14462 | + return 55.055; /*55:tickWidth*/ | |
| 14463 | 14463 | } |
| 14464 | 14464 | |
| 14465 | 14465 | /** |
| 14466 | - * The width, in pixels, of ticks. | |
| 14466 | + * Boolean value that determines whether the axis should include ticks. | |
| 14467 | 14467 | * |
| 14468 | - * @param ?float $value | |
| 14468 | + * @param ?bool $value | |
| 14469 | 14469 | * @throws Exception |
| 14470 | - * @return ?float | |
| 14470 | + * @return ?bool | |
| 14471 | 14471 | */ |
| 14472 | - public static function fromTickWidth(?float $value): ?float { | |
| 14472 | + public static function fromTicks(?bool $value): ?bool { | |
| 14473 | 14473 | if (!is_null($value)) { |
| 14474 | - return $value; /*float*/ | |
| 14474 | + return $value; /*bool*/ | |
| 14475 | 14475 | } else { |
| 14476 | 14476 | return null; |
| 14477 | 14477 | } |
| 14478 | 14478 | } |
| 14479 | 14479 | |
| 14480 | 14480 | /** |
| 14481 | - * The width, in pixels, of ticks. | |
| 14481 | + * Boolean value that determines whether the axis should include ticks. | |
| 14482 | 14482 | * |
| 14483 | 14483 | * @throws Exception |
| 14484 | - * @return ?float | |
| 14484 | + * @return ?bool | |
| 14485 | 14485 | */ |
| 14486 | - public function toTickWidth(): ?float { | |
| 14487 | - if (VGAxisConfig::validateTickWidth($this->tickWidth)) { | |
| 14488 | - if (!is_null($this->tickWidth)) { | |
| 14489 | - return $this->tickWidth; /*float*/ | |
| 14486 | + public function toTicks(): ?bool { | |
| 14487 | + if (VGAxisConfig::validateTicks($this->ticks)) { | |
| 14488 | + if (!is_null($this->ticks)) { | |
| 14489 | + return $this->ticks; /*bool*/ | |
| 14490 | 14490 | } else { |
| 14491 | 14491 | return null; |
| 14492 | 14492 | } |
| 14493 | 14493 | } |
| 14494 | - throw new Exception('never get to this VGAxisConfig::tickWidth'); | |
| 14494 | + throw new Exception('never get to this VGAxisConfig::ticks'); | |
| 14495 | 14495 | } |
| 14496 | 14496 | |
| 14497 | 14497 | /** |
| 14498 | - * The width, in pixels, of ticks. | |
| 14498 | + * Boolean value that determines whether the axis should include ticks. | |
| 14499 | 14499 | * |
| 14500 | - * @param float|null | |
| 14500 | + * @param bool|null | |
| 14501 | 14501 | * @return bool |
| 14502 | 14502 | * @throws Exception |
| 14503 | 14503 | */ |
| 14504 | - public static function validateTickWidth(?float $value): bool { | |
| 14504 | + public static function validateTicks(?bool $value): bool { | |
| 14505 | 14505 | if (!is_null($value)) { |
| 14506 | 14506 | } |
| 14507 | 14507 | return true; |
| 14508 | 14508 | } |
| 14509 | 14509 | |
| 14510 | 14510 | /** |
| 14511 | - * The width, in pixels, of ticks. | |
| 14511 | + * Boolean value that determines whether the axis should include ticks. | |
| 14512 | 14512 | * |
| 14513 | 14513 | * @throws Exception |
| 14514 | - * @return ?float | |
| 14514 | + * @return ?bool | |
| 14515 | 14515 | */ |
| 14516 | - public function getTickWidth(): ?float { | |
| 14517 | - if (VGAxisConfig::validateTickWidth($this->tickWidth)) { | |
| 14518 | - return $this->tickWidth; | |
| 14516 | + public function getTicks(): ?bool { | |
| 14517 | + if (VGAxisConfig::validateTicks($this->ticks)) { | |
| 14518 | + return $this->ticks; | |
| 14519 | 14519 | } |
| 14520 | - throw new Exception('never get to getTickWidth VGAxisConfig::tickWidth'); | |
| 14520 | + throw new Exception('never get to getTicks VGAxisConfig::ticks'); | |
| 14521 | 14521 | } |
| 14522 | 14522 | |
| 14523 | 14523 | /** |
| 14524 | - * The width, in pixels, of ticks. | |
| 14524 | + * Boolean value that determines whether the axis should include ticks. | |
| 14525 | 14525 | * |
| 14526 | - * @return ?float | |
| 14526 | + * @return ?bool | |
| 14527 | 14527 | */ |
| 14528 | - public static function sampleTickWidth(): ?float { | |
| 14529 | - return 56.056; /*56:tickWidth*/ | |
| 14528 | + public static function sampleTicks(): ?bool { | |
| 14529 | + return true; /*56:ticks*/ | |
| 14530 | 14530 | } |
| 14531 | 14531 | |
| 14532 | 14532 | /** |
| @@ -15387,9 +15387,9 @@ class VGAxisConfig { | ||
| 15387 | 15387 | || VGAxisConfig::validateMinExtent($this->minExtent) |
| 15388 | 15388 | || VGAxisConfig::validateTickColor($this->tickColor) |
| 15389 | 15389 | || VGAxisConfig::validateTickRound($this->tickRound) |
| 15390 | - || VGAxisConfig::validateTicks($this->ticks) | |
| 15391 | 15390 | || VGAxisConfig::validateTickSize($this->tickSize) |
| 15392 | 15391 | || VGAxisConfig::validateTickWidth($this->tickWidth) |
| 15392 | + || VGAxisConfig::validateTicks($this->ticks) | |
| 15393 | 15393 | || VGAxisConfig::validateTitleAlign($this->titleAlign) |
| 15394 | 15394 | || VGAxisConfig::validateTitleAngle($this->titleAngle) |
| 15395 | 15395 | || VGAxisConfig::validateTitleBaseline($this->titleBaseline) |
| @@ -15433,9 +15433,9 @@ class VGAxisConfig { | ||
| 15433 | 15433 | $out->{'minExtent'} = $this->toMinExtent(); |
| 15434 | 15434 | $out->{'tickColor'} = $this->toTickColor(); |
| 15435 | 15435 | $out->{'tickRound'} = $this->toTickRound(); |
| 15436 | - $out->{'ticks'} = $this->toTicks(); | |
| 15437 | 15436 | $out->{'tickSize'} = $this->toTickSize(); |
| 15438 | 15437 | $out->{'tickWidth'} = $this->toTickWidth(); |
| 15438 | + $out->{'ticks'} = $this->toTicks(); | |
| 15439 | 15439 | $out->{'titleAlign'} = $this->toTitleAlign(); |
| 15440 | 15440 | $out->{'titleAngle'} = $this->toTitleAngle(); |
| 15441 | 15441 | $out->{'titleBaseline'} = $this->toTitleBaseline(); |
| @@ -15481,9 +15481,9 @@ class VGAxisConfig { | ||
| 15481 | 15481 | ,VGAxisConfig::fromMinExtent($obj->{'minExtent'}) |
| 15482 | 15482 | ,VGAxisConfig::fromTickColor($obj->{'tickColor'}) |
| 15483 | 15483 | ,VGAxisConfig::fromTickRound($obj->{'tickRound'}) |
| 15484 | - ,VGAxisConfig::fromTicks($obj->{'ticks'}) | |
| 15485 | 15484 | ,VGAxisConfig::fromTickSize($obj->{'tickSize'}) |
| 15486 | 15485 | ,VGAxisConfig::fromTickWidth($obj->{'tickWidth'}) |
| 15486 | + ,VGAxisConfig::fromTicks($obj->{'ticks'}) | |
| 15487 | 15487 | ,VGAxisConfig::fromTitleAlign($obj->{'titleAlign'}) |
| 15488 | 15488 | ,VGAxisConfig::fromTitleAngle($obj->{'titleAngle'}) |
| 15489 | 15489 | ,VGAxisConfig::fromTitleBaseline($obj->{'titleBaseline'}) |
| @@ -15527,9 +15527,9 @@ class VGAxisConfig { | ||
| 15527 | 15527 | ,VGAxisConfig::sampleMinExtent() |
| 15528 | 15528 | ,VGAxisConfig::sampleTickColor() |
| 15529 | 15529 | ,VGAxisConfig::sampleTickRound() |
| 15530 | - ,VGAxisConfig::sampleTicks() | |
| 15531 | 15530 | ,VGAxisConfig::sampleTickSize() |
| 15532 | 15531 | ,VGAxisConfig::sampleTickWidth() |
| 15532 | + ,VGAxisConfig::sampleTicks() | |
| 15533 | 15533 | ,VGAxisConfig::sampleTitleAlign() |
| 15534 | 15534 | ,VGAxisConfig::sampleTitleAngle() |
| 15535 | 15535 | ,VGAxisConfig::sampleTitleBaseline() |
| @@ -15560,8 +15560,8 @@ class BarConfig { | ||
| 15560 | 15560 | private ?float $dx; // json:dx Optional |
| 15561 | 15561 | private ?float $dy; // json:dy Optional |
| 15562 | 15562 | private ?string $fill; // json:fill Optional |
| 15563 | - private ?bool $filled; // json:filled Optional | |
| 15564 | 15563 | private ?float $fillOpacity; // json:fillOpacity Optional |
| 15564 | + private ?bool $filled; // json:filled Optional | |
| 15565 | 15565 | private ?string $font; // json:font Optional |
| 15566 | 15566 | private ?float $fontSize; // json:fontSize Optional |
| 15567 | 15567 | private ?FontStyle $fontStyle; // json:fontStyle Optional |
| @@ -15595,8 +15595,8 @@ class BarConfig { | ||
| 15595 | 15595 | * @param float|null $dx |
| 15596 | 15596 | * @param float|null $dy |
| 15597 | 15597 | * @param string|null $fill |
| 15598 | - * @param bool|null $filled | |
| 15599 | 15598 | * @param float|null $fillOpacity |
| 15599 | + * @param bool|null $filled | |
| 15600 | 15600 | * @param string|null $font |
| 15601 | 15601 | * @param float|null $fontSize |
| 15602 | 15602 | * @param FontStyle|null $fontStyle |
| @@ -15618,7 +15618,7 @@ class BarConfig { | ||
| 15618 | 15618 | * @param string|null $text |
| 15619 | 15619 | * @param float|null $theta |
| 15620 | 15620 | */ |
| 15621 | - public function __construct(?HorizontalAlign $align, ?float $angle, ?VerticalAlign $baseline, ?float $binSpacing, ?string $color, ?float $continuousBandSize, ?Cursor $cursor, ?float $discreteBandSize, ?float $dx, ?float $dy, ?string $fill, ?bool $filled, ?float $fillOpacity, ?string $font, ?float $fontSize, ?FontStyle $fontStyle, FontWeight|float|null $fontWeight, ?string $href, ?Interpolate $interpolate, ?float $limit, ?float $opacity, ?Orient $orient, ?float $radius, ?string $shape, ?float $size, ?string $stroke, ?array $strokeDash, ?float $strokeDashOffset, ?float $strokeOpacity, ?float $strokeWidth, ?float $tension, ?string $text, ?float $theta) { | |
| 15621 | + public function __construct(?HorizontalAlign $align, ?float $angle, ?VerticalAlign $baseline, ?float $binSpacing, ?string $color, ?float $continuousBandSize, ?Cursor $cursor, ?float $discreteBandSize, ?float $dx, ?float $dy, ?string $fill, ?float $fillOpacity, ?bool $filled, ?string $font, ?float $fontSize, ?FontStyle $fontStyle, FontWeight|float|null $fontWeight, ?string $href, ?Interpolate $interpolate, ?float $limit, ?float $opacity, ?Orient $orient, ?float $radius, ?string $shape, ?float $size, ?string $stroke, ?array $strokeDash, ?float $strokeDashOffset, ?float $strokeOpacity, ?float $strokeWidth, ?float $tension, ?string $text, ?float $theta) { | |
| 15622 | 15622 | $this->align = $align; |
| 15623 | 15623 | $this->angle = $angle; |
| 15624 | 15624 | $this->baseline = $baseline; |
| @@ -15630,8 +15630,8 @@ class BarConfig { | ||
| 15630 | 15630 | $this->dx = $dx; |
| 15631 | 15631 | $this->dy = $dy; |
| 15632 | 15632 | $this->fill = $fill; |
| 15633 | - $this->filled = $filled; | |
| 15634 | 15633 | $this->fillOpacity = $fillOpacity; |
| 15634 | + $this->filled = $filled; | |
| 15635 | 15635 | $this->font = $font; |
| 15636 | 15636 | $this->fontSize = $fontSize; |
| 15637 | 15637 | $this->fontStyle = $fontStyle; |
| @@ -16484,6 +16484,83 @@ class BarConfig { | ||
| 16484 | 16484 | return 'BarConfig::fill::41'; /*41:fill*/ |
| 16485 | 16485 | } |
| 16486 | 16486 | |
| 16487 | + /** | |
| 16488 | + * The fill opacity (value between [0,1]). | |
| 16489 | + * | |
| 16490 | + * __Default value:__ `1` | |
| 16491 | + * | |
| 16492 | + * @param ?float $value | |
| 16493 | + * @throws Exception | |
| 16494 | + * @return ?float | |
| 16495 | + */ | |
| 16496 | + public static function fromFillOpacity(?float $value): ?float { | |
| 16497 | + if (!is_null($value)) { | |
| 16498 | + return $value; /*float*/ | |
| 16499 | + } else { | |
| 16500 | + return null; | |
| 16501 | + } | |
| 16502 | + } | |
| 16503 | + | |
| 16504 | + /** | |
| 16505 | + * The fill opacity (value between [0,1]). | |
| 16506 | + * | |
| 16507 | + * __Default value:__ `1` | |
| 16508 | + * | |
| 16509 | + * @throws Exception | |
| 16510 | + * @return ?float | |
| 16511 | + */ | |
| 16512 | + public function toFillOpacity(): ?float { | |
| 16513 | + if (BarConfig::validateFillOpacity($this->fillOpacity)) { | |
| 16514 | + if (!is_null($this->fillOpacity)) { | |
| 16515 | + return $this->fillOpacity; /*float*/ | |
| 16516 | + } else { | |
| 16517 | + return null; | |
| 16518 | + } | |
| 16519 | + } | |
| 16520 | + throw new Exception('never get to this BarConfig::fillOpacity'); | |
| 16521 | + } | |
| 16522 | + | |
| 16523 | + /** | |
| 16524 | + * The fill opacity (value between [0,1]). | |
| 16525 | + * | |
| 16526 | + * __Default value:__ `1` | |
| 16527 | + * | |
| 16528 | + * @param float|null | |
| 16529 | + * @return bool | |
| 16530 | + * @throws Exception | |
| 16531 | + */ | |
| 16532 | + public static function validateFillOpacity(?float $value): bool { | |
| 16533 | + if (!is_null($value)) { | |
| 16534 | + } | |
| 16535 | + return true; | |
| 16536 | + } | |
| 16537 | + | |
| 16538 | + /** | |
| 16539 | + * The fill opacity (value between [0,1]). | |
| 16540 | + * | |
| 16541 | + * __Default value:__ `1` | |
| 16542 | + * | |
| 16543 | + * @throws Exception | |
| 16544 | + * @return ?float | |
| 16545 | + */ | |
| 16546 | + public function getFillOpacity(): ?float { | |
| 16547 | + if (BarConfig::validateFillOpacity($this->fillOpacity)) { | |
| 16548 | + return $this->fillOpacity; | |
| 16549 | + } | |
| 16550 | + throw new Exception('never get to getFillOpacity BarConfig::fillOpacity'); | |
| 16551 | + } | |
| 16552 | + | |
| 16553 | + /** | |
| 16554 | + * The fill opacity (value between [0,1]). | |
| 16555 | + * | |
| 16556 | + * __Default value:__ `1` | |
| 16557 | + * | |
| 16558 | + * @return ?float | |
| 16559 | + */ | |
| 16560 | + public static function sampleFillOpacity(): ?float { | |
| 16561 | + return 42.042; /*42:fillOpacity*/ | |
| 16562 | + } | |
| 16563 | + | |
| 16487 | 16564 | /** |
| 16488 | 16565 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 16489 | 16566 | * |
| @@ -16578,84 +16655,7 @@ class BarConfig { | ||
| 16578 | 16655 | * @return ?bool |
| 16579 | 16656 | */ |
| 16580 | 16657 | public static function sampleFilled(): ?bool { |
| 16581 | - return true; /*42:filled*/ | |
| 16582 | - } | |
| 16583 | - | |
| 16584 | - /** | |
| 16585 | - * The fill opacity (value between [0,1]). | |
| 16586 | - * | |
| 16587 | - * __Default value:__ `1` | |
| 16588 | - * | |
| 16589 | - * @param ?float $value | |
| 16590 | - * @throws Exception | |
| 16591 | - * @return ?float | |
| 16592 | - */ | |
| 16593 | - public static function fromFillOpacity(?float $value): ?float { | |
| 16594 | - if (!is_null($value)) { | |
| 16595 | - return $value; /*float*/ | |
| 16596 | - } else { | |
| 16597 | - return null; | |
| 16598 | - } | |
| 16599 | - } | |
| 16600 | - | |
| 16601 | - /** | |
| 16602 | - * The fill opacity (value between [0,1]). | |
| 16603 | - * | |
| 16604 | - * __Default value:__ `1` | |
| 16605 | - * | |
| 16606 | - * @throws Exception | |
| 16607 | - * @return ?float | |
| 16608 | - */ | |
| 16609 | - public function toFillOpacity(): ?float { | |
| 16610 | - if (BarConfig::validateFillOpacity($this->fillOpacity)) { | |
| 16611 | - if (!is_null($this->fillOpacity)) { | |
| 16612 | - return $this->fillOpacity; /*float*/ | |
| 16613 | - } else { | |
| 16614 | - return null; | |
| 16615 | - } | |
| 16616 | - } | |
| 16617 | - throw new Exception('never get to this BarConfig::fillOpacity'); | |
| 16618 | - } | |
| 16619 | - | |
| 16620 | - /** | |
| 16621 | - * The fill opacity (value between [0,1]). | |
| 16622 | - * | |
| 16623 | - * __Default value:__ `1` | |
| 16624 | - * | |
| 16625 | - * @param float|null | |
| 16626 | - * @return bool | |
| 16627 | - * @throws Exception | |
| 16628 | - */ | |
| 16629 | - public static function validateFillOpacity(?float $value): bool { | |
| 16630 | - if (!is_null($value)) { | |
| 16631 | - } | |
| 16632 | - return true; | |
| 16633 | - } | |
| 16634 | - | |
| 16635 | - /** | |
| 16636 | - * The fill opacity (value between [0,1]). | |
| 16637 | - * | |
| 16638 | - * __Default value:__ `1` | |
| 16639 | - * | |
| 16640 | - * @throws Exception | |
| 16641 | - * @return ?float | |
| 16642 | - */ | |
| 16643 | - public function getFillOpacity(): ?float { | |
| 16644 | - if (BarConfig::validateFillOpacity($this->fillOpacity)) { | |
| 16645 | - return $this->fillOpacity; | |
| 16646 | - } | |
| 16647 | - throw new Exception('never get to getFillOpacity BarConfig::fillOpacity'); | |
| 16648 | - } | |
| 16649 | - | |
| 16650 | - /** | |
| 16651 | - * The fill opacity (value between [0,1]). | |
| 16652 | - * | |
| 16653 | - * __Default value:__ `1` | |
| 16654 | - * | |
| 16655 | - * @return ?float | |
| 16656 | - */ | |
| 16657 | - public static function sampleFillOpacity(): ?float { | |
| 16658 | - return 43.043; /*43:fillOpacity*/ | |
| 16658 | + return true; /*43:filled*/ | |
| 16659 | 16659 | } |
| 16660 | 16660 | |
| 16661 | 16661 | /** |
| @@ -18270,8 +18270,8 @@ class BarConfig { | ||
| 18270 | 18270 | || BarConfig::validateDx($this->dx) |
| 18271 | 18271 | || BarConfig::validateDy($this->dy) |
| 18272 | 18272 | || BarConfig::validateFill($this->fill) |
| 18273 | - || BarConfig::validateFilled($this->filled) | |
| 18274 | 18273 | || BarConfig::validateFillOpacity($this->fillOpacity) |
| 18274 | + || BarConfig::validateFilled($this->filled) | |
| 18275 | 18275 | || BarConfig::validateFont($this->font) |
| 18276 | 18276 | || BarConfig::validateFontSize($this->fontSize) |
| 18277 | 18277 | || BarConfig::validateFontStyle($this->fontStyle) |
| @@ -18311,8 +18311,8 @@ class BarConfig { | ||
| 18311 | 18311 | $out->{'dx'} = $this->toDx(); |
| 18312 | 18312 | $out->{'dy'} = $this->toDy(); |
| 18313 | 18313 | $out->{'fill'} = $this->toFill(); |
| 18314 | - $out->{'filled'} = $this->toFilled(); | |
| 18315 | 18314 | $out->{'fillOpacity'} = $this->toFillOpacity(); |
| 18315 | + $out->{'filled'} = $this->toFilled(); | |
| 18316 | 18316 | $out->{'font'} = $this->toFont(); |
| 18317 | 18317 | $out->{'fontSize'} = $this->toFontSize(); |
| 18318 | 18318 | $out->{'fontStyle'} = $this->toFontStyle(); |
| @@ -18354,8 +18354,8 @@ class BarConfig { | ||
| 18354 | 18354 | ,BarConfig::fromDx($obj->{'dx'}) |
| 18355 | 18355 | ,BarConfig::fromDy($obj->{'dy'}) |
| 18356 | 18356 | ,BarConfig::fromFill($obj->{'fill'}) |
| 18357 | - ,BarConfig::fromFilled($obj->{'filled'}) | |
| 18358 | 18357 | ,BarConfig::fromFillOpacity($obj->{'fillOpacity'}) |
| 18358 | + ,BarConfig::fromFilled($obj->{'filled'}) | |
| 18359 | 18359 | ,BarConfig::fromFont($obj->{'font'}) |
| 18360 | 18360 | ,BarConfig::fromFontSize($obj->{'fontSize'}) |
| 18361 | 18361 | ,BarConfig::fromFontStyle($obj->{'fontStyle'}) |
| @@ -18395,8 +18395,8 @@ class BarConfig { | ||
| 18395 | 18395 | ,BarConfig::sampleDx() |
| 18396 | 18396 | ,BarConfig::sampleDy() |
| 18397 | 18397 | ,BarConfig::sampleFill() |
| 18398 | - ,BarConfig::sampleFilled() | |
| 18399 | 18398 | ,BarConfig::sampleFillOpacity() |
| 18399 | + ,BarConfig::sampleFilled() | |
| 18400 | 18400 | ,BarConfig::sampleFont() |
| 18401 | 18401 | ,BarConfig::sampleFontSize() |
| 18402 | 18402 | ,BarConfig::sampleFontStyle() |
| @@ -31466,8 +31466,8 @@ class TextConfig { | ||
| 31466 | 31466 | private ?float $dx; // json:dx Optional |
| 31467 | 31467 | private ?float $dy; // json:dy Optional |
| 31468 | 31468 | private ?string $fill; // json:fill Optional |
| 31469 | - private ?bool $filled; // json:filled Optional | |
| 31470 | 31469 | private ?float $fillOpacity; // json:fillOpacity Optional |
| 31470 | + private ?bool $filled; // json:filled Optional | |
| 31471 | 31471 | private ?string $font; // json:font Optional |
| 31472 | 31472 | private ?float $fontSize; // json:fontSize Optional |
| 31473 | 31473 | private ?FontStyle $fontStyle; // json:fontStyle Optional |
| @@ -31499,8 +31499,8 @@ class TextConfig { | ||
| 31499 | 31499 | * @param float|null $dx |
| 31500 | 31500 | * @param float|null $dy |
| 31501 | 31501 | * @param string|null $fill |
| 31502 | - * @param bool|null $filled | |
| 31503 | 31502 | * @param float|null $fillOpacity |
| 31503 | + * @param bool|null $filled | |
| 31504 | 31504 | * @param string|null $font |
| 31505 | 31505 | * @param float|null $fontSize |
| 31506 | 31506 | * @param FontStyle|null $fontStyle |
| @@ -31523,7 +31523,7 @@ class TextConfig { | ||
| 31523 | 31523 | * @param string|null $text |
| 31524 | 31524 | * @param float|null $theta |
| 31525 | 31525 | */ |
| 31526 | - public function __construct(?HorizontalAlign $align, ?float $angle, ?VerticalAlign $baseline, ?string $color, ?Cursor $cursor, ?float $dx, ?float $dy, ?string $fill, ?bool $filled, ?float $fillOpacity, ?string $font, ?float $fontSize, ?FontStyle $fontStyle, FontWeight|float|null $fontWeight, ?string $href, ?Interpolate $interpolate, ?float $limit, ?float $opacity, ?Orient $orient, ?float $radius, ?string $shape, ?bool $shortTimeLabels, ?float $size, ?string $stroke, ?array $strokeDash, ?float $strokeDashOffset, ?float $strokeOpacity, ?float $strokeWidth, ?float $tension, ?string $text, ?float $theta) { | |
| 31526 | + public function __construct(?HorizontalAlign $align, ?float $angle, ?VerticalAlign $baseline, ?string $color, ?Cursor $cursor, ?float $dx, ?float $dy, ?string $fill, ?float $fillOpacity, ?bool $filled, ?string $font, ?float $fontSize, ?FontStyle $fontStyle, FontWeight|float|null $fontWeight, ?string $href, ?Interpolate $interpolate, ?float $limit, ?float $opacity, ?Orient $orient, ?float $radius, ?string $shape, ?bool $shortTimeLabels, ?float $size, ?string $stroke, ?array $strokeDash, ?float $strokeDashOffset, ?float $strokeOpacity, ?float $strokeWidth, ?float $tension, ?string $text, ?float $theta) { | |
| 31527 | 31527 | $this->align = $align; |
| 31528 | 31528 | $this->angle = $angle; |
| 31529 | 31529 | $this->baseline = $baseline; |
| @@ -31532,8 +31532,8 @@ class TextConfig { | ||
| 31532 | 31532 | $this->dx = $dx; |
| 31533 | 31533 | $this->dy = $dy; |
| 31534 | 31534 | $this->fill = $fill; |
| 31535 | - $this->filled = $filled; | |
| 31536 | 31535 | $this->fillOpacity = $fillOpacity; |
| 31536 | + $this->filled = $filled; | |
| 31537 | 31537 | $this->font = $font; |
| 31538 | 31538 | $this->fontSize = $fontSize; |
| 31539 | 31539 | $this->fontStyle = $fontStyle; |
| @@ -32156,6 +32156,83 @@ class TextConfig { | ||
| 32156 | 32156 | return 'TextConfig::fill::38'; /*38:fill*/ |
| 32157 | 32157 | } |
| 32158 | 32158 | |
| 32159 | + /** | |
| 32160 | + * The fill opacity (value between [0,1]). | |
| 32161 | + * | |
| 32162 | + * __Default value:__ `1` | |
| 32163 | + * | |
| 32164 | + * @param ?float $value | |
| 32165 | + * @throws Exception | |
| 32166 | + * @return ?float | |
| 32167 | + */ | |
| 32168 | + public static function fromFillOpacity(?float $value): ?float { | |
| 32169 | + if (!is_null($value)) { | |
| 32170 | + return $value; /*float*/ | |
| 32171 | + } else { | |
| 32172 | + return null; | |
| 32173 | + } | |
| 32174 | + } | |
| 32175 | + | |
| 32176 | + /** | |
| 32177 | + * The fill opacity (value between [0,1]). | |
| 32178 | + * | |
| 32179 | + * __Default value:__ `1` | |
| 32180 | + * | |
| 32181 | + * @throws Exception | |
| 32182 | + * @return ?float | |
| 32183 | + */ | |
| 32184 | + public function toFillOpacity(): ?float { | |
| 32185 | + if (TextConfig::validateFillOpacity($this->fillOpacity)) { | |
| 32186 | + if (!is_null($this->fillOpacity)) { | |
| 32187 | + return $this->fillOpacity; /*float*/ | |
| 32188 | + } else { | |
| 32189 | + return null; | |
| 32190 | + } | |
| 32191 | + } | |
| 32192 | + throw new Exception('never get to this TextConfig::fillOpacity'); | |
| 32193 | + } | |
| 32194 | + | |
| 32195 | + /** | |
| 32196 | + * The fill opacity (value between [0,1]). | |
| 32197 | + * | |
| 32198 | + * __Default value:__ `1` | |
| 32199 | + * | |
| 32200 | + * @param float|null | |
| 32201 | + * @return bool | |
| 32202 | + * @throws Exception | |
| 32203 | + */ | |
| 32204 | + public static function validateFillOpacity(?float $value): bool { | |
| 32205 | + if (!is_null($value)) { | |
| 32206 | + } | |
| 32207 | + return true; | |
| 32208 | + } | |
| 32209 | + | |
| 32210 | + /** | |
| 32211 | + * The fill opacity (value between [0,1]). | |
| 32212 | + * | |
| 32213 | + * __Default value:__ `1` | |
| 32214 | + * | |
| 32215 | + * @throws Exception | |
| 32216 | + * @return ?float | |
| 32217 | + */ | |
| 32218 | + public function getFillOpacity(): ?float { | |
| 32219 | + if (TextConfig::validateFillOpacity($this->fillOpacity)) { | |
| 32220 | + return $this->fillOpacity; | |
| 32221 | + } | |
| 32222 | + throw new Exception('never get to getFillOpacity TextConfig::fillOpacity'); | |
| 32223 | + } | |
| 32224 | + | |
| 32225 | + /** | |
| 32226 | + * The fill opacity (value between [0,1]). | |
| 32227 | + * | |
| 32228 | + * __Default value:__ `1` | |
| 32229 | + * | |
| 32230 | + * @return ?float | |
| 32231 | + */ | |
| 32232 | + public static function sampleFillOpacity(): ?float { | |
| 32233 | + return 39.039; /*39:fillOpacity*/ | |
| 32234 | + } | |
| 32235 | + | |
| 32159 | 32236 | /** |
| 32160 | 32237 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 32161 | 32238 | * |
| @@ -32250,84 +32327,7 @@ class TextConfig { | ||
| 32250 | 32327 | * @return ?bool |
| 32251 | 32328 | */ |
| 32252 | 32329 | public static function sampleFilled(): ?bool { |
| 32253 | - return true; /*39:filled*/ | |
| 32254 | - } | |
| 32255 | - | |
| 32256 | - /** | |
| 32257 | - * The fill opacity (value between [0,1]). | |
| 32258 | - * | |
| 32259 | - * __Default value:__ `1` | |
| 32260 | - * | |
| 32261 | - * @param ?float $value | |
| 32262 | - * @throws Exception | |
| 32263 | - * @return ?float | |
| 32264 | - */ | |
| 32265 | - public static function fromFillOpacity(?float $value): ?float { | |
| 32266 | - if (!is_null($value)) { | |
| 32267 | - return $value; /*float*/ | |
| 32268 | - } else { | |
| 32269 | - return null; | |
| 32270 | - } | |
| 32271 | - } | |
| 32272 | - | |
| 32273 | - /** | |
| 32274 | - * The fill opacity (value between [0,1]). | |
| 32275 | - * | |
| 32276 | - * __Default value:__ `1` | |
| 32277 | - * | |
| 32278 | - * @throws Exception | |
| 32279 | - * @return ?float | |
| 32280 | - */ | |
| 32281 | - public function toFillOpacity(): ?float { | |
| 32282 | - if (TextConfig::validateFillOpacity($this->fillOpacity)) { | |
| 32283 | - if (!is_null($this->fillOpacity)) { | |
| 32284 | - return $this->fillOpacity; /*float*/ | |
| 32285 | - } else { | |
| 32286 | - return null; | |
| 32287 | - } | |
| 32288 | - } | |
| 32289 | - throw new Exception('never get to this TextConfig::fillOpacity'); | |
| 32290 | - } | |
| 32291 | - | |
| 32292 | - /** | |
| 32293 | - * The fill opacity (value between [0,1]). | |
| 32294 | - * | |
| 32295 | - * __Default value:__ `1` | |
| 32296 | - * | |
| 32297 | - * @param float|null | |
| 32298 | - * @return bool | |
| 32299 | - * @throws Exception | |
| 32300 | - */ | |
| 32301 | - public static function validateFillOpacity(?float $value): bool { | |
| 32302 | - if (!is_null($value)) { | |
| 32303 | - } | |
| 32304 | - return true; | |
| 32305 | - } | |
| 32306 | - | |
| 32307 | - /** | |
| 32308 | - * The fill opacity (value between [0,1]). | |
| 32309 | - * | |
| 32310 | - * __Default value:__ `1` | |
| 32311 | - * | |
| 32312 | - * @throws Exception | |
| 32313 | - * @return ?float | |
| 32314 | - */ | |
| 32315 | - public function getFillOpacity(): ?float { | |
| 32316 | - if (TextConfig::validateFillOpacity($this->fillOpacity)) { | |
| 32317 | - return $this->fillOpacity; | |
| 32318 | - } | |
| 32319 | - throw new Exception('never get to getFillOpacity TextConfig::fillOpacity'); | |
| 32320 | - } | |
| 32321 | - | |
| 32322 | - /** | |
| 32323 | - * The fill opacity (value between [0,1]). | |
| 32324 | - * | |
| 32325 | - * __Default value:__ `1` | |
| 32326 | - * | |
| 32327 | - * @return ?float | |
| 32328 | - */ | |
| 32329 | - public static function sampleFillOpacity(): ?float { | |
| 32330 | - return 40.04; /*40:fillOpacity*/ | |
| 32330 | + return true; /*40:filled*/ | |
| 32331 | 32331 | } |
| 32332 | 32332 | |
| 32333 | 32333 | /** |
| @@ -34006,8 +34006,8 @@ class TextConfig { | ||
| 34006 | 34006 | || TextConfig::validateDx($this->dx) |
| 34007 | 34007 | || TextConfig::validateDy($this->dy) |
| 34008 | 34008 | || TextConfig::validateFill($this->fill) |
| 34009 | - || TextConfig::validateFilled($this->filled) | |
| 34010 | 34009 | || TextConfig::validateFillOpacity($this->fillOpacity) |
| 34010 | + || TextConfig::validateFilled($this->filled) | |
| 34011 | 34011 | || TextConfig::validateFont($this->font) |
| 34012 | 34012 | || TextConfig::validateFontSize($this->fontSize) |
| 34013 | 34013 | || TextConfig::validateFontStyle($this->fontStyle) |
| @@ -34045,8 +34045,8 @@ class TextConfig { | ||
| 34045 | 34045 | $out->{'dx'} = $this->toDx(); |
| 34046 | 34046 | $out->{'dy'} = $this->toDy(); |
| 34047 | 34047 | $out->{'fill'} = $this->toFill(); |
| 34048 | - $out->{'filled'} = $this->toFilled(); | |
| 34049 | 34048 | $out->{'fillOpacity'} = $this->toFillOpacity(); |
| 34049 | + $out->{'filled'} = $this->toFilled(); | |
| 34050 | 34050 | $out->{'font'} = $this->toFont(); |
| 34051 | 34051 | $out->{'fontSize'} = $this->toFontSize(); |
| 34052 | 34052 | $out->{'fontStyle'} = $this->toFontStyle(); |
| @@ -34086,8 +34086,8 @@ class TextConfig { | ||
| 34086 | 34086 | ,TextConfig::fromDx($obj->{'dx'}) |
| 34087 | 34087 | ,TextConfig::fromDy($obj->{'dy'}) |
| 34088 | 34088 | ,TextConfig::fromFill($obj->{'fill'}) |
| 34089 | - ,TextConfig::fromFilled($obj->{'filled'}) | |
| 34090 | 34089 | ,TextConfig::fromFillOpacity($obj->{'fillOpacity'}) |
| 34090 | + ,TextConfig::fromFilled($obj->{'filled'}) | |
| 34091 | 34091 | ,TextConfig::fromFont($obj->{'font'}) |
| 34092 | 34092 | ,TextConfig::fromFontSize($obj->{'fontSize'}) |
| 34093 | 34093 | ,TextConfig::fromFontStyle($obj->{'fontStyle'}) |
| @@ -34125,8 +34125,8 @@ class TextConfig { | ||
| 34125 | 34125 | ,TextConfig::sampleDx() |
| 34126 | 34126 | ,TextConfig::sampleDy() |
| 34127 | 34127 | ,TextConfig::sampleFill() |
| 34128 | - ,TextConfig::sampleFilled() | |
| 34129 | 34128 | ,TextConfig::sampleFillOpacity() |
| 34129 | + ,TextConfig::sampleFilled() | |
| 34130 | 34130 | ,TextConfig::sampleFont() |
| 34131 | 34131 | ,TextConfig::sampleFontSize() |
| 34132 | 34132 | ,TextConfig::sampleFontStyle() |
| @@ -34164,8 +34164,8 @@ class TickConfig { | ||
| 34164 | 34164 | private ?float $dx; // json:dx Optional |
| 34165 | 34165 | private ?float $dy; // json:dy Optional |
| 34166 | 34166 | private ?string $fill; // json:fill Optional |
| 34167 | - private ?bool $filled; // json:filled Optional | |
| 34168 | 34167 | private ?float $fillOpacity; // json:fillOpacity Optional |
| 34168 | + private ?bool $filled; // json:filled Optional | |
| 34169 | 34169 | private ?string $font; // json:font Optional |
| 34170 | 34170 | private ?float $fontSize; // json:fontSize Optional |
| 34171 | 34171 | private ?FontStyle $fontStyle; // json:fontStyle Optional |
| @@ -34198,8 +34198,8 @@ class TickConfig { | ||
| 34198 | 34198 | * @param float|null $dx |
| 34199 | 34199 | * @param float|null $dy |
| 34200 | 34200 | * @param string|null $fill |
| 34201 | - * @param bool|null $filled | |
| 34202 | 34201 | * @param float|null $fillOpacity |
| 34202 | + * @param bool|null $filled | |
| 34203 | 34203 | * @param string|null $font |
| 34204 | 34204 | * @param float|null $fontSize |
| 34205 | 34205 | * @param FontStyle|null $fontStyle |
| @@ -34222,7 +34222,7 @@ class TickConfig { | ||
| 34222 | 34222 | * @param float|null $theta |
| 34223 | 34223 | * @param float|null $thickness |
| 34224 | 34224 | */ |
| 34225 | - public function __construct(?HorizontalAlign $align, ?float $angle, ?float $bandSize, ?VerticalAlign $baseline, ?string $color, ?Cursor $cursor, ?float $dx, ?float $dy, ?string $fill, ?bool $filled, ?float $fillOpacity, ?string $font, ?float $fontSize, ?FontStyle $fontStyle, FontWeight|float|null $fontWeight, ?string $href, ?Interpolate $interpolate, ?float $limit, ?float $opacity, ?Orient $orient, ?float $radius, ?string $shape, ?float $size, ?string $stroke, ?array $strokeDash, ?float $strokeDashOffset, ?float $strokeOpacity, ?float $strokeWidth, ?float $tension, ?string $text, ?float $theta, ?float $thickness) { | |
| 34225 | + public function __construct(?HorizontalAlign $align, ?float $angle, ?float $bandSize, ?VerticalAlign $baseline, ?string $color, ?Cursor $cursor, ?float $dx, ?float $dy, ?string $fill, ?float $fillOpacity, ?bool $filled, ?string $font, ?float $fontSize, ?FontStyle $fontStyle, FontWeight|float|null $fontWeight, ?string $href, ?Interpolate $interpolate, ?float $limit, ?float $opacity, ?Orient $orient, ?float $radius, ?string $shape, ?float $size, ?string $stroke, ?array $strokeDash, ?float $strokeDashOffset, ?float $strokeOpacity, ?float $strokeWidth, ?float $tension, ?string $text, ?float $theta, ?float $thickness) { | |
| 34226 | 34226 | $this->align = $align; |
| 34227 | 34227 | $this->angle = $angle; |
| 34228 | 34228 | $this->bandSize = $bandSize; |
| @@ -34232,8 +34232,8 @@ class TickConfig { | ||
| 34232 | 34232 | $this->dx = $dx; |
| 34233 | 34233 | $this->dy = $dy; |
| 34234 | 34234 | $this->fill = $fill; |
| 34235 | - $this->filled = $filled; | |
| 34236 | 34235 | $this->fillOpacity = $fillOpacity; |
| 34236 | + $this->filled = $filled; | |
| 34237 | 34237 | $this->font = $font; |
| 34238 | 34238 | $this->fontSize = $fontSize; |
| 34239 | 34239 | $this->fontStyle = $fontStyle; |
| @@ -34933,6 +34933,83 @@ class TickConfig { | ||
| 34933 | 34933 | return 'TickConfig::fill::39'; /*39:fill*/ |
| 34934 | 34934 | } |
| 34935 | 34935 | |
| 34936 | + /** | |
| 34937 | + * The fill opacity (value between [0,1]). | |
| 34938 | + * | |
| 34939 | + * __Default value:__ `1` | |
| 34940 | + * | |
| 34941 | + * @param ?float $value | |
| 34942 | + * @throws Exception | |
| 34943 | + * @return ?float | |
| 34944 | + */ | |
| 34945 | + public static function fromFillOpacity(?float $value): ?float { | |
| 34946 | + if (!is_null($value)) { | |
| 34947 | + return $value; /*float*/ | |
| 34948 | + } else { | |
| 34949 | + return null; | |
| 34950 | + } | |
| 34951 | + } | |
| 34952 | + | |
| 34953 | + /** | |
| 34954 | + * The fill opacity (value between [0,1]). | |
| 34955 | + * | |
| 34956 | + * __Default value:__ `1` | |
| 34957 | + * | |
| 34958 | + * @throws Exception | |
| 34959 | + * @return ?float | |
| 34960 | + */ | |
| 34961 | + public function toFillOpacity(): ?float { | |
| 34962 | + if (TickConfig::validateFillOpacity($this->fillOpacity)) { | |
| 34963 | + if (!is_null($this->fillOpacity)) { | |
| 34964 | + return $this->fillOpacity; /*float*/ | |
| 34965 | + } else { | |
| 34966 | + return null; | |
| 34967 | + } | |
| 34968 | + } | |
| 34969 | + throw new Exception('never get to this TickConfig::fillOpacity'); | |
| 34970 | + } | |
| 34971 | + | |
| 34972 | + /** | |
| 34973 | + * The fill opacity (value between [0,1]). | |
| 34974 | + * | |
| 34975 | + * __Default value:__ `1` | |
| 34976 | + * | |
| 34977 | + * @param float|null | |
| 34978 | + * @return bool | |
| 34979 | + * @throws Exception | |
| 34980 | + */ | |
| 34981 | + public static function validateFillOpacity(?float $value): bool { | |
| 34982 | + if (!is_null($value)) { | |
| 34983 | + } | |
| 34984 | + return true; | |
| 34985 | + } | |
| 34986 | + | |
| 34987 | + /** | |
| 34988 | + * The fill opacity (value between [0,1]). | |
| 34989 | + * | |
| 34990 | + * __Default value:__ `1` | |
| 34991 | + * | |
| 34992 | + * @throws Exception | |
| 34993 | + * @return ?float | |
| 34994 | + */ | |
| 34995 | + public function getFillOpacity(): ?float { | |
| 34996 | + if (TickConfig::validateFillOpacity($this->fillOpacity)) { | |
| 34997 | + return $this->fillOpacity; | |
| 34998 | + } | |
| 34999 | + throw new Exception('never get to getFillOpacity TickConfig::fillOpacity'); | |
| 35000 | + } | |
| 35001 | + | |
| 35002 | + /** | |
| 35003 | + * The fill opacity (value between [0,1]). | |
| 35004 | + * | |
| 35005 | + * __Default value:__ `1` | |
| 35006 | + * | |
| 35007 | + * @return ?float | |
| 35008 | + */ | |
| 35009 | + public static function sampleFillOpacity(): ?float { | |
| 35010 | + return 40.04; /*40:fillOpacity*/ | |
| 35011 | + } | |
| 35012 | + | |
| 34936 | 35013 | /** |
| 34937 | 35014 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 34938 | 35015 | * |
| @@ -35027,84 +35104,7 @@ class TickConfig { | ||
| 35027 | 35104 | * @return ?bool |
| 35028 | 35105 | */ |
| 35029 | 35106 | public static function sampleFilled(): ?bool { |
| 35030 | - return true; /*40:filled*/ | |
| 35031 | - } | |
| 35032 | - | |
| 35033 | - /** | |
| 35034 | - * The fill opacity (value between [0,1]). | |
| 35035 | - * | |
| 35036 | - * __Default value:__ `1` | |
| 35037 | - * | |
| 35038 | - * @param ?float $value | |
| 35039 | - * @throws Exception | |
| 35040 | - * @return ?float | |
| 35041 | - */ | |
| 35042 | - public static function fromFillOpacity(?float $value): ?float { | |
| 35043 | - if (!is_null($value)) { | |
| 35044 | - return $value; /*float*/ | |
| 35045 | - } else { | |
| 35046 | - return null; | |
| 35047 | - } | |
| 35048 | - } | |
| 35049 | - | |
| 35050 | - /** | |
| 35051 | - * The fill opacity (value between [0,1]). | |
| 35052 | - * | |
| 35053 | - * __Default value:__ `1` | |
| 35054 | - * | |
| 35055 | - * @throws Exception | |
| 35056 | - * @return ?float | |
| 35057 | - */ | |
| 35058 | - public function toFillOpacity(): ?float { | |
| 35059 | - if (TickConfig::validateFillOpacity($this->fillOpacity)) { | |
| 35060 | - if (!is_null($this->fillOpacity)) { | |
| 35061 | - return $this->fillOpacity; /*float*/ | |
| 35062 | - } else { | |
| 35063 | - return null; | |
| 35064 | - } | |
| 35065 | - } | |
| 35066 | - throw new Exception('never get to this TickConfig::fillOpacity'); | |
| 35067 | - } | |
| 35068 | - | |
| 35069 | - /** | |
| 35070 | - * The fill opacity (value between [0,1]). | |
| 35071 | - * | |
| 35072 | - * __Default value:__ `1` | |
| 35073 | - * | |
| 35074 | - * @param float|null | |
| 35075 | - * @return bool | |
| 35076 | - * @throws Exception | |
| 35077 | - */ | |
| 35078 | - public static function validateFillOpacity(?float $value): bool { | |
| 35079 | - if (!is_null($value)) { | |
| 35080 | - } | |
| 35081 | - return true; | |
| 35082 | - } | |
| 35083 | - | |
| 35084 | - /** | |
| 35085 | - * The fill opacity (value between [0,1]). | |
| 35086 | - * | |
| 35087 | - * __Default value:__ `1` | |
| 35088 | - * | |
| 35089 | - * @throws Exception | |
| 35090 | - * @return ?float | |
| 35091 | - */ | |
| 35092 | - public function getFillOpacity(): ?float { | |
| 35093 | - if (TickConfig::validateFillOpacity($this->fillOpacity)) { | |
| 35094 | - return $this->fillOpacity; | |
| 35095 | - } | |
| 35096 | - throw new Exception('never get to getFillOpacity TickConfig::fillOpacity'); | |
| 35097 | - } | |
| 35098 | - | |
| 35099 | - /** | |
| 35100 | - * The fill opacity (value between [0,1]). | |
| 35101 | - * | |
| 35102 | - * __Default value:__ `1` | |
| 35103 | - * | |
| 35104 | - * @return ?float | |
| 35105 | - */ | |
| 35106 | - public static function sampleFillOpacity(): ?float { | |
| 35107 | - return 41.041; /*41:fillOpacity*/ | |
| 35107 | + return true; /*41:filled*/ | |
| 35108 | 35108 | } |
| 35109 | 35109 | |
| 35110 | 35110 | /** |
| @@ -36794,8 +36794,8 @@ class TickConfig { | ||
| 36794 | 36794 | || TickConfig::validateDx($this->dx) |
| 36795 | 36795 | || TickConfig::validateDy($this->dy) |
| 36796 | 36796 | || TickConfig::validateFill($this->fill) |
| 36797 | - || TickConfig::validateFilled($this->filled) | |
| 36798 | 36797 | || TickConfig::validateFillOpacity($this->fillOpacity) |
| 36798 | + || TickConfig::validateFilled($this->filled) | |
| 36799 | 36799 | || TickConfig::validateFont($this->font) |
| 36800 | 36800 | || TickConfig::validateFontSize($this->fontSize) |
| 36801 | 36801 | || TickConfig::validateFontStyle($this->fontStyle) |
| @@ -36834,8 +36834,8 @@ class TickConfig { | ||
| 36834 | 36834 | $out->{'dx'} = $this->toDx(); |
| 36835 | 36835 | $out->{'dy'} = $this->toDy(); |
| 36836 | 36836 | $out->{'fill'} = $this->toFill(); |
| 36837 | - $out->{'filled'} = $this->toFilled(); | |
| 36838 | 36837 | $out->{'fillOpacity'} = $this->toFillOpacity(); |
| 36838 | + $out->{'filled'} = $this->toFilled(); | |
| 36839 | 36839 | $out->{'font'} = $this->toFont(); |
| 36840 | 36840 | $out->{'fontSize'} = $this->toFontSize(); |
| 36841 | 36841 | $out->{'fontStyle'} = $this->toFontStyle(); |
| @@ -36876,8 +36876,8 @@ class TickConfig { | ||
| 36876 | 36876 | ,TickConfig::fromDx($obj->{'dx'}) |
| 36877 | 36877 | ,TickConfig::fromDy($obj->{'dy'}) |
| 36878 | 36878 | ,TickConfig::fromFill($obj->{'fill'}) |
| 36879 | - ,TickConfig::fromFilled($obj->{'filled'}) | |
| 36880 | 36879 | ,TickConfig::fromFillOpacity($obj->{'fillOpacity'}) |
| 36880 | + ,TickConfig::fromFilled($obj->{'filled'}) | |
| 36881 | 36881 | ,TickConfig::fromFont($obj->{'font'}) |
| 36882 | 36882 | ,TickConfig::fromFontSize($obj->{'fontSize'}) |
| 36883 | 36883 | ,TickConfig::fromFontStyle($obj->{'fontStyle'}) |
| @@ -36916,8 +36916,8 @@ class TickConfig { | ||
| 36916 | 36916 | ,TickConfig::sampleDx() |
| 36917 | 36917 | ,TickConfig::sampleDy() |
| 36918 | 36918 | ,TickConfig::sampleFill() |
| 36919 | - ,TickConfig::sampleFilled() | |
| 36920 | 36919 | ,TickConfig::sampleFillOpacity() |
| 36920 | + ,TickConfig::sampleFilled() | |
| 36921 | 36921 | ,TickConfig::sampleFont() |
| 36922 | 36922 | ,TickConfig::sampleFontSize() |
| 36923 | 36923 | ,TickConfig::sampleFontStyle() |
| @@ -58822,8 +58822,8 @@ class Axis { | ||
| 58822 | 58822 | private ?TitleOrient $orient; // json:orient Optional |
| 58823 | 58823 | private ?float $position; // json:position Optional |
| 58824 | 58824 | private ?float $tickCount; // json:tickCount Optional |
| 58825 | - private ?bool $ticks; // json:ticks Optional | |
| 58826 | 58825 | private ?float $tickSize; // json:tickSize Optional |
| 58826 | + private ?bool $ticks; // json:ticks Optional | |
| 58827 | 58827 | private ?string $title; // json:title Optional |
| 58828 | 58828 | private ?float $titleMaxLength; // json:titleMaxLength Optional |
| 58829 | 58829 | private ?float $titlePadding; // json:titlePadding Optional |
| @@ -58846,15 +58846,15 @@ class Axis { | ||
| 58846 | 58846 | * @param TitleOrient|null $orient |
| 58847 | 58847 | * @param float|null $position |
| 58848 | 58848 | * @param float|null $tickCount |
| 58849 | - * @param bool|null $ticks | |
| 58850 | 58849 | * @param float|null $tickSize |
| 58850 | + * @param bool|null $ticks | |
| 58851 | 58851 | * @param string|null $title |
| 58852 | 58852 | * @param float|null $titleMaxLength |
| 58853 | 58853 | * @param float|null $titlePadding |
| 58854 | 58854 | * @param array|null $values |
| 58855 | 58855 | * @param float|null $zindex |
| 58856 | 58856 | */ |
| 58857 | - public function __construct(?bool $domain, ?string $format, ?bool $grid, ?float $labelAngle, bool|float|null $labelBound, bool|float|null $labelFlush, LabelOverlap|bool|null $labelOverlap, ?float $labelPadding, ?bool $labels, ?float $maxExtent, ?float $minExtent, ?float $offset, ?TitleOrient $orient, ?float $position, ?float $tickCount, ?bool $ticks, ?float $tickSize, ?string $title, ?float $titleMaxLength, ?float $titlePadding, ?array $values, ?float $zindex) { | |
| 58857 | + public function __construct(?bool $domain, ?string $format, ?bool $grid, ?float $labelAngle, bool|float|null $labelBound, bool|float|null $labelFlush, LabelOverlap|bool|null $labelOverlap, ?float $labelPadding, ?bool $labels, ?float $maxExtent, ?float $minExtent, ?float $offset, ?TitleOrient $orient, ?float $position, ?float $tickCount, ?float $tickSize, ?bool $ticks, ?string $title, ?float $titleMaxLength, ?float $titlePadding, ?array $values, ?float $zindex) { | |
| 58858 | 58858 | $this->domain = $domain; |
| 58859 | 58859 | $this->format = $format; |
| 58860 | 58860 | $this->grid = $grid; |
| @@ -58870,8 +58870,8 @@ class Axis { | ||
| 58870 | 58870 | $this->orient = $orient; |
| 58871 | 58871 | $this->position = $position; |
| 58872 | 58872 | $this->tickCount = $tickCount; |
| 58873 | - $this->ticks = $ticks; | |
| 58874 | 58873 | $this->tickSize = $tickSize; |
| 58874 | + $this->ticks = $ticks; | |
| 58875 | 58875 | $this->title = $title; |
| 58876 | 58876 | $this->titleMaxLength = $titleMaxLength; |
| 58877 | 58877 | $this->titlePadding = $titlePadding; |
| @@ -60242,137 +60242,137 @@ class Axis { | ||
| 60242 | 60242 | } |
| 60243 | 60243 | |
| 60244 | 60244 | /** |
| 60245 | - * Boolean value that determines whether the axis should include ticks. | |
| 60245 | + * The size in pixels of axis ticks. | |
| 60246 | 60246 | * |
| 60247 | - * @param ?bool $value | |
| 60247 | + * @param ?float $value | |
| 60248 | 60248 | * @throws Exception |
| 60249 | - * @return ?bool | |
| 60249 | + * @return ?float | |
| 60250 | 60250 | */ |
| 60251 | - public static function fromTicks(?bool $value): ?bool { | |
| 60251 | + public static function fromTickSize(?float $value): ?float { | |
| 60252 | 60252 | if (!is_null($value)) { |
| 60253 | - return $value; /*bool*/ | |
| 60253 | + return $value; /*float*/ | |
| 60254 | 60254 | } else { |
| 60255 | 60255 | return null; |
| 60256 | 60256 | } |
| 60257 | 60257 | } |
| 60258 | 60258 | |
| 60259 | 60259 | /** |
| 60260 | - * Boolean value that determines whether the axis should include ticks. | |
| 60260 | + * The size in pixels of axis ticks. | |
| 60261 | 60261 | * |
| 60262 | 60262 | * @throws Exception |
| 60263 | - * @return ?bool | |
| 60263 | + * @return ?float | |
| 60264 | 60264 | */ |
| 60265 | - public function toTicks(): ?bool { | |
| 60266 | - if (Axis::validateTicks($this->ticks)) { | |
| 60267 | - if (!is_null($this->ticks)) { | |
| 60268 | - return $this->ticks; /*bool*/ | |
| 60265 | + public function toTickSize(): ?float { | |
| 60266 | + if (Axis::validateTickSize($this->tickSize)) { | |
| 60267 | + if (!is_null($this->tickSize)) { | |
| 60268 | + return $this->tickSize; /*float*/ | |
| 60269 | 60269 | } else { |
| 60270 | 60270 | return null; |
| 60271 | 60271 | } |
| 60272 | 60272 | } |
| 60273 | - throw new Exception('never get to this Axis::ticks'); | |
| 60273 | + throw new Exception('never get to this Axis::tickSize'); | |
| 60274 | 60274 | } |
| 60275 | 60275 | |
| 60276 | 60276 | /** |
| 60277 | - * Boolean value that determines whether the axis should include ticks. | |
| 60277 | + * The size in pixels of axis ticks. | |
| 60278 | 60278 | * |
| 60279 | - * @param bool|null | |
| 60279 | + * @param float|null | |
| 60280 | 60280 | * @return bool |
| 60281 | 60281 | * @throws Exception |
| 60282 | 60282 | */ |
| 60283 | - public static function validateTicks(?bool $value): bool { | |
| 60283 | + public static function validateTickSize(?float $value): bool { | |
| 60284 | 60284 | if (!is_null($value)) { |
| 60285 | 60285 | } |
| 60286 | 60286 | return true; |
| 60287 | 60287 | } |
| 60288 | 60288 | |
| 60289 | 60289 | /** |
| 60290 | - * Boolean value that determines whether the axis should include ticks. | |
| 60290 | + * The size in pixels of axis ticks. | |
| 60291 | 60291 | * |
| 60292 | 60292 | * @throws Exception |
| 60293 | - * @return ?bool | |
| 60293 | + * @return ?float | |
| 60294 | 60294 | */ |
| 60295 | - public function getTicks(): ?bool { | |
| 60296 | - if (Axis::validateTicks($this->ticks)) { | |
| 60297 | - return $this->ticks; | |
| 60295 | + public function getTickSize(): ?float { | |
| 60296 | + if (Axis::validateTickSize($this->tickSize)) { | |
| 60297 | + return $this->tickSize; | |
| 60298 | 60298 | } |
| 60299 | - throw new Exception('never get to getTicks Axis::ticks'); | |
| 60299 | + throw new Exception('never get to getTickSize Axis::tickSize'); | |
| 60300 | 60300 | } |
| 60301 | 60301 | |
| 60302 | 60302 | /** |
| 60303 | - * Boolean value that determines whether the axis should include ticks. | |
| 60303 | + * The size in pixels of axis ticks. | |
| 60304 | 60304 | * |
| 60305 | - * @return ?bool | |
| 60305 | + * @return ?float | |
| 60306 | 60306 | */ |
| 60307 | - public static function sampleTicks(): ?bool { | |
| 60308 | - return true; /*46:ticks*/ | |
| 60307 | + public static function sampleTickSize(): ?float { | |
| 60308 | + return 46.046; /*46:tickSize*/ | |
| 60309 | 60309 | } |
| 60310 | 60310 | |
| 60311 | 60311 | /** |
| 60312 | - * The size in pixels of axis ticks. | |
| 60312 | + * Boolean value that determines whether the axis should include ticks. | |
| 60313 | 60313 | * |
| 60314 | - * @param ?float $value | |
| 60314 | + * @param ?bool $value | |
| 60315 | 60315 | * @throws Exception |
| 60316 | - * @return ?float | |
| 60316 | + * @return ?bool | |
| 60317 | 60317 | */ |
| 60318 | - public static function fromTickSize(?float $value): ?float { | |
| 60318 | + public static function fromTicks(?bool $value): ?bool { | |
| 60319 | 60319 | if (!is_null($value)) { |
| 60320 | - return $value; /*float*/ | |
| 60320 | + return $value; /*bool*/ | |
| 60321 | 60321 | } else { |
| 60322 | 60322 | return null; |
| 60323 | 60323 | } |
| 60324 | 60324 | } |
| 60325 | 60325 | |
| 60326 | 60326 | /** |
| 60327 | - * The size in pixels of axis ticks. | |
| 60327 | + * Boolean value that determines whether the axis should include ticks. | |
| 60328 | 60328 | * |
| 60329 | 60329 | * @throws Exception |
| 60330 | - * @return ?float | |
| 60330 | + * @return ?bool | |
| 60331 | 60331 | */ |
| 60332 | - public function toTickSize(): ?float { | |
| 60333 | - if (Axis::validateTickSize($this->tickSize)) { | |
| 60334 | - if (!is_null($this->tickSize)) { | |
| 60335 | - return $this->tickSize; /*float*/ | |
| 60332 | + public function toTicks(): ?bool { | |
| 60333 | + if (Axis::validateTicks($this->ticks)) { | |
| 60334 | + if (!is_null($this->ticks)) { | |
| 60335 | + return $this->ticks; /*bool*/ | |
| 60336 | 60336 | } else { |
| 60337 | 60337 | return null; |
| 60338 | 60338 | } |
| 60339 | 60339 | } |
| 60340 | - throw new Exception('never get to this Axis::tickSize'); | |
| 60340 | + throw new Exception('never get to this Axis::ticks'); | |
| 60341 | 60341 | } |
| 60342 | 60342 | |
| 60343 | 60343 | /** |
| 60344 | - * The size in pixels of axis ticks. | |
| 60344 | + * Boolean value that determines whether the axis should include ticks. | |
| 60345 | 60345 | * |
| 60346 | - * @param float|null | |
| 60346 | + * @param bool|null | |
| 60347 | 60347 | * @return bool |
| 60348 | 60348 | * @throws Exception |
| 60349 | 60349 | */ |
| 60350 | - public static function validateTickSize(?float $value): bool { | |
| 60350 | + public static function validateTicks(?bool $value): bool { | |
| 60351 | 60351 | if (!is_null($value)) { |
| 60352 | 60352 | } |
| 60353 | 60353 | return true; |
| 60354 | 60354 | } |
| 60355 | 60355 | |
| 60356 | 60356 | /** |
| 60357 | - * The size in pixels of axis ticks. | |
| 60357 | + * Boolean value that determines whether the axis should include ticks. | |
| 60358 | 60358 | * |
| 60359 | 60359 | * @throws Exception |
| 60360 | - * @return ?float | |
| 60360 | + * @return ?bool | |
| 60361 | 60361 | */ |
| 60362 | - public function getTickSize(): ?float { | |
| 60363 | - if (Axis::validateTickSize($this->tickSize)) { | |
| 60364 | - return $this->tickSize; | |
| 60362 | + public function getTicks(): ?bool { | |
| 60363 | + if (Axis::validateTicks($this->ticks)) { | |
| 60364 | + return $this->ticks; | |
| 60365 | 60365 | } |
| 60366 | - throw new Exception('never get to getTickSize Axis::tickSize'); | |
| 60366 | + throw new Exception('never get to getTicks Axis::ticks'); | |
| 60367 | 60367 | } |
| 60368 | 60368 | |
| 60369 | 60369 | /** |
| 60370 | - * The size in pixels of axis ticks. | |
| 60370 | + * Boolean value that determines whether the axis should include ticks. | |
| 60371 | 60371 | * |
| 60372 | - * @return ?float | |
| 60372 | + * @return ?bool | |
| 60373 | 60373 | */ |
| 60374 | - public static function sampleTickSize(): ?float { | |
| 60375 | - return 47.047; /*47:tickSize*/ | |
| 60374 | + public static function sampleTicks(): ?bool { | |
| 60375 | + return true; /*47:ticks*/ | |
| 60376 | 60376 | } |
| 60377 | 60377 | |
| 60378 | 60378 | /** |
| @@ -60847,8 +60847,8 @@ class Axis { | ||
| 60847 | 60847 | || Axis::validateOrient($this->orient) |
| 60848 | 60848 | || Axis::validatePosition($this->position) |
| 60849 | 60849 | || Axis::validateTickCount($this->tickCount) |
| 60850 | - || Axis::validateTicks($this->ticks) | |
| 60851 | 60850 | || Axis::validateTickSize($this->tickSize) |
| 60851 | + || Axis::validateTicks($this->ticks) | |
| 60852 | 60852 | || Axis::validateTitle($this->title) |
| 60853 | 60853 | || Axis::validateTitleMaxLength($this->titleMaxLength) |
| 60854 | 60854 | || Axis::validateTitlePadding($this->titlePadding) |
| @@ -60877,8 +60877,8 @@ class Axis { | ||
| 60877 | 60877 | $out->{'orient'} = $this->toOrient(); |
| 60878 | 60878 | $out->{'position'} = $this->toPosition(); |
| 60879 | 60879 | $out->{'tickCount'} = $this->toTickCount(); |
| 60880 | - $out->{'ticks'} = $this->toTicks(); | |
| 60881 | 60880 | $out->{'tickSize'} = $this->toTickSize(); |
| 60881 | + $out->{'ticks'} = $this->toTicks(); | |
| 60882 | 60882 | $out->{'title'} = $this->toTitle(); |
| 60883 | 60883 | $out->{'titleMaxLength'} = $this->toTitleMaxLength(); |
| 60884 | 60884 | $out->{'titlePadding'} = $this->toTitlePadding(); |
| @@ -60909,8 +60909,8 @@ class Axis { | ||
| 60909 | 60909 | ,Axis::fromOrient($obj->{'orient'}) |
| 60910 | 60910 | ,Axis::fromPosition($obj->{'position'}) |
| 60911 | 60911 | ,Axis::fromTickCount($obj->{'tickCount'}) |
| 60912 | - ,Axis::fromTicks($obj->{'ticks'}) | |
| 60913 | 60912 | ,Axis::fromTickSize($obj->{'tickSize'}) |
| 60913 | + ,Axis::fromTicks($obj->{'ticks'}) | |
| 60914 | 60914 | ,Axis::fromTitle($obj->{'title'}) |
| 60915 | 60915 | ,Axis::fromTitleMaxLength($obj->{'titleMaxLength'}) |
| 60916 | 60916 | ,Axis::fromTitlePadding($obj->{'titlePadding'}) |
| @@ -60939,8 +60939,8 @@ class Axis { | ||
| 60939 | 60939 | ,Axis::sampleOrient() |
| 60940 | 60940 | ,Axis::samplePosition() |
| 60941 | 60941 | ,Axis::sampleTickCount() |
| 60942 | - ,Axis::sampleTicks() | |
| 60943 | 60942 | ,Axis::sampleTickSize() |
| 60943 | + ,Axis::sampleTicks() | |
| 60944 | 60944 | ,Axis::sampleTitle() |
| 60945 | 60945 | ,Axis::sampleTitleMaxLength() |
| 60946 | 60946 | ,Axis::sampleTitlePadding() |
| @@ -66085,8 +66085,8 @@ class MarkDef { | ||
| 66085 | 66085 | private ?float $dx; // json:dx Optional |
| 66086 | 66086 | private ?float $dy; // json:dy Optional |
| 66087 | 66087 | private ?string $fill; // json:fill Optional |
| 66088 | - private ?bool $filled; // json:filled Optional | |
| 66089 | 66088 | private ?float $fillOpacity; // json:fillOpacity Optional |
| 66089 | + private ?bool $filled; // json:filled Optional | |
| 66090 | 66090 | private ?string $font; // json:font Optional |
| 66091 | 66091 | private ?float $fontSize; // json:fontSize Optional |
| 66092 | 66092 | private ?FontStyle $fontStyle; // json:fontStyle Optional |
| @@ -66120,8 +66120,8 @@ class MarkDef { | ||
| 66120 | 66120 | * @param float|null $dx |
| 66121 | 66121 | * @param float|null $dy |
| 66122 | 66122 | * @param string|null $fill |
| 66123 | - * @param bool|null $filled | |
| 66124 | 66123 | * @param float|null $fillOpacity |
| 66124 | + * @param bool|null $filled | |
| 66125 | 66125 | * @param string|null $font |
| 66126 | 66126 | * @param float|null $fontSize |
| 66127 | 66127 | * @param FontStyle|null $fontStyle |
| @@ -66145,7 +66145,7 @@ class MarkDef { | ||
| 66145 | 66145 | * @param float|null $theta |
| 66146 | 66146 | * @param Mark $type |
| 66147 | 66147 | */ |
| 66148 | - public function __construct(?HorizontalAlign $align, ?float $angle, ?VerticalAlign $baseline, ?bool $clip, ?string $color, ?Cursor $cursor, ?float $dx, ?float $dy, ?string $fill, ?bool $filled, ?float $fillOpacity, ?string $font, ?float $fontSize, ?FontStyle $fontStyle, FontWeight|float|null $fontWeight, ?string $href, ?Interpolate $interpolate, ?float $limit, ?float $opacity, ?Orient $orient, ?float $radius, ?string $shape, ?float $size, ?string $stroke, ?array $strokeDash, ?float $strokeDashOffset, ?float $strokeOpacity, ?float $strokeWidth, array|string|null $style, ?float $tension, ?string $text, ?float $theta, Mark $type) { | |
| 66148 | + public function __construct(?HorizontalAlign $align, ?float $angle, ?VerticalAlign $baseline, ?bool $clip, ?string $color, ?Cursor $cursor, ?float $dx, ?float $dy, ?string $fill, ?float $fillOpacity, ?bool $filled, ?string $font, ?float $fontSize, ?FontStyle $fontStyle, FontWeight|float|null $fontWeight, ?string $href, ?Interpolate $interpolate, ?float $limit, ?float $opacity, ?Orient $orient, ?float $radius, ?string $shape, ?float $size, ?string $stroke, ?array $strokeDash, ?float $strokeDashOffset, ?float $strokeOpacity, ?float $strokeWidth, array|string|null $style, ?float $tension, ?string $text, ?float $theta, Mark $type) { | |
| 66149 | 66149 | $this->align = $align; |
| 66150 | 66150 | $this->angle = $angle; |
| 66151 | 66151 | $this->baseline = $baseline; |
| @@ -66155,8 +66155,8 @@ class MarkDef { | ||
| 66155 | 66155 | $this->dx = $dx; |
| 66156 | 66156 | $this->dy = $dy; |
| 66157 | 66157 | $this->fill = $fill; |
| 66158 | - $this->filled = $filled; | |
| 66159 | 66158 | $this->fillOpacity = $fillOpacity; |
| 66159 | + $this->filled = $filled; | |
| 66160 | 66160 | $this->font = $font; |
| 66161 | 66161 | $this->fontSize = $fontSize; |
| 66162 | 66162 | $this->fontStyle = $fontStyle; |
| @@ -66847,6 +66847,83 @@ class MarkDef { | ||
| 66847 | 66847 | return 'MarkDef::fill::39'; /*39:fill*/ |
| 66848 | 66848 | } |
| 66849 | 66849 | |
| 66850 | + /** | |
| 66851 | + * The fill opacity (value between [0,1]). | |
| 66852 | + * | |
| 66853 | + * __Default value:__ `1` | |
| 66854 | + * | |
| 66855 | + * @param ?float $value | |
| 66856 | + * @throws Exception | |
| 66857 | + * @return ?float | |
| 66858 | + */ | |
| 66859 | + public static function fromFillOpacity(?float $value): ?float { | |
| 66860 | + if (!is_null($value)) { | |
| 66861 | + return $value; /*float*/ | |
| 66862 | + } else { | |
| 66863 | + return null; | |
| 66864 | + } | |
| 66865 | + } | |
| 66866 | + | |
| 66867 | + /** | |
| 66868 | + * The fill opacity (value between [0,1]). | |
| 66869 | + * | |
| 66870 | + * __Default value:__ `1` | |
| 66871 | + * | |
| 66872 | + * @throws Exception | |
| 66873 | + * @return ?float | |
| 66874 | + */ | |
| 66875 | + public function toFillOpacity(): ?float { | |
| 66876 | + if (MarkDef::validateFillOpacity($this->fillOpacity)) { | |
| 66877 | + if (!is_null($this->fillOpacity)) { | |
| 66878 | + return $this->fillOpacity; /*float*/ | |
| 66879 | + } else { | |
| 66880 | + return null; | |
| 66881 | + } | |
| 66882 | + } | |
| 66883 | + throw new Exception('never get to this MarkDef::fillOpacity'); | |
| 66884 | + } | |
| 66885 | + | |
| 66886 | + /** | |
| 66887 | + * The fill opacity (value between [0,1]). | |
| 66888 | + * | |
| 66889 | + * __Default value:__ `1` | |
| 66890 | + * | |
| 66891 | + * @param float|null | |
| 66892 | + * @return bool | |
| 66893 | + * @throws Exception | |
| 66894 | + */ | |
| 66895 | + public static function validateFillOpacity(?float $value): bool { | |
| 66896 | + if (!is_null($value)) { | |
| 66897 | + } | |
| 66898 | + return true; | |
| 66899 | + } | |
| 66900 | + | |
| 66901 | + /** | |
| 66902 | + * The fill opacity (value between [0,1]). | |
| 66903 | + * | |
| 66904 | + * __Default value:__ `1` | |
| 66905 | + * | |
| 66906 | + * @throws Exception | |
| 66907 | + * @return ?float | |
| 66908 | + */ | |
| 66909 | + public function getFillOpacity(): ?float { | |
| 66910 | + if (MarkDef::validateFillOpacity($this->fillOpacity)) { | |
| 66911 | + return $this->fillOpacity; | |
| 66912 | + } | |
| 66913 | + throw new Exception('never get to getFillOpacity MarkDef::fillOpacity'); | |
| 66914 | + } | |
| 66915 | + | |
| 66916 | + /** | |
| 66917 | + * The fill opacity (value between [0,1]). | |
| 66918 | + * | |
| 66919 | + * __Default value:__ `1` | |
| 66920 | + * | |
| 66921 | + * @return ?float | |
| 66922 | + */ | |
| 66923 | + public static function sampleFillOpacity(): ?float { | |
| 66924 | + return 40.04; /*40:fillOpacity*/ | |
| 66925 | + } | |
| 66926 | + | |
| 66850 | 66927 | /** |
| 66851 | 66928 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 66852 | 66929 | * |
| @@ -66941,84 +67018,7 @@ class MarkDef { | ||
| 66941 | 67018 | * @return ?bool |
| 66942 | 67019 | */ |
| 66943 | 67020 | public static function sampleFilled(): ?bool { |
| 66944 | - return true; /*40:filled*/ | |
| 66945 | - } | |
| 66946 | - | |
| 66947 | - /** | |
| 66948 | - * The fill opacity (value between [0,1]). | |
| 66949 | - * | |
| 66950 | - * __Default value:__ `1` | |
| 66951 | - * | |
| 66952 | - * @param ?float $value | |
| 66953 | - * @throws Exception | |
| 66954 | - * @return ?float | |
| 66955 | - */ | |
| 66956 | - public static function fromFillOpacity(?float $value): ?float { | |
| 66957 | - if (!is_null($value)) { | |
| 66958 | - return $value; /*float*/ | |
| 66959 | - } else { | |
| 66960 | - return null; | |
| 66961 | - } | |
| 66962 | - } | |
| 66963 | - | |
| 66964 | - /** | |
| 66965 | - * The fill opacity (value between [0,1]). | |
| 66966 | - * | |
| 66967 | - * __Default value:__ `1` | |
| 66968 | - * | |
| 66969 | - * @throws Exception | |
| 66970 | - * @return ?float | |
| 66971 | - */ | |
| 66972 | - public function toFillOpacity(): ?float { | |
| 66973 | - if (MarkDef::validateFillOpacity($this->fillOpacity)) { | |
| 66974 | - if (!is_null($this->fillOpacity)) { | |
| 66975 | - return $this->fillOpacity; /*float*/ | |
| 66976 | - } else { | |
| 66977 | - return null; | |
| 66978 | - } | |
| 66979 | - } | |
| 66980 | - throw new Exception('never get to this MarkDef::fillOpacity'); | |
| 66981 | - } | |
| 66982 | - | |
| 66983 | - /** | |
| 66984 | - * The fill opacity (value between [0,1]). | |
| 66985 | - * | |
| 66986 | - * __Default value:__ `1` | |
| 66987 | - * | |
| 66988 | - * @param float|null | |
| 66989 | - * @return bool | |
| 66990 | - * @throws Exception | |
| 66991 | - */ | |
| 66992 | - public static function validateFillOpacity(?float $value): bool { | |
| 66993 | - if (!is_null($value)) { | |
| 66994 | - } | |
| 66995 | - return true; | |
| 66996 | - } | |
| 66997 | - | |
| 66998 | - /** | |
| 66999 | - * The fill opacity (value between [0,1]). | |
| 67000 | - * | |
| 67001 | - * __Default value:__ `1` | |
| 67002 | - * | |
| 67003 | - * @throws Exception | |
| 67004 | - * @return ?float | |
| 67005 | - */ | |
| 67006 | - public function getFillOpacity(): ?float { | |
| 67007 | - if (MarkDef::validateFillOpacity($this->fillOpacity)) { | |
| 67008 | - return $this->fillOpacity; | |
| 67009 | - } | |
| 67010 | - throw new Exception('never get to getFillOpacity MarkDef::fillOpacity'); | |
| 67011 | - } | |
| 67012 | - | |
| 67013 | - /** | |
| 67014 | - * The fill opacity (value between [0,1]). | |
| 67015 | - * | |
| 67016 | - * __Default value:__ `1` | |
| 67017 | - * | |
| 67018 | - * @return ?float | |
| 67019 | - */ | |
| 67020 | - public static function sampleFillOpacity(): ?float { | |
| 67021 | - return 41.041; /*41:fillOpacity*/ | |
| 67021 | + return true; /*41:filled*/ | |
| 67022 | 67022 | } |
| 67023 | 67023 | |
| 67024 | 67024 | /** |
| @@ -68848,8 +68848,8 @@ class MarkDef { | ||
| 68848 | 68848 | || MarkDef::validateDx($this->dx) |
| 68849 | 68849 | || MarkDef::validateDy($this->dy) |
| 68850 | 68850 | || MarkDef::validateFill($this->fill) |
| 68851 | - || MarkDef::validateFilled($this->filled) | |
| 68852 | 68851 | || MarkDef::validateFillOpacity($this->fillOpacity) |
| 68852 | + || MarkDef::validateFilled($this->filled) | |
| 68853 | 68853 | || MarkDef::validateFont($this->font) |
| 68854 | 68854 | || MarkDef::validateFontSize($this->fontSize) |
| 68855 | 68855 | || MarkDef::validateFontStyle($this->fontStyle) |
| @@ -68889,8 +68889,8 @@ class MarkDef { | ||
| 68889 | 68889 | $out->{'dx'} = $this->toDx(); |
| 68890 | 68890 | $out->{'dy'} = $this->toDy(); |
| 68891 | 68891 | $out->{'fill'} = $this->toFill(); |
| 68892 | - $out->{'filled'} = $this->toFilled(); | |
| 68893 | 68892 | $out->{'fillOpacity'} = $this->toFillOpacity(); |
| 68893 | + $out->{'filled'} = $this->toFilled(); | |
| 68894 | 68894 | $out->{'font'} = $this->toFont(); |
| 68895 | 68895 | $out->{'fontSize'} = $this->toFontSize(); |
| 68896 | 68896 | $out->{'fontStyle'} = $this->toFontStyle(); |
| @@ -68932,8 +68932,8 @@ class MarkDef { | ||
| 68932 | 68932 | ,MarkDef::fromDx($obj->{'dx'}) |
| 68933 | 68933 | ,MarkDef::fromDy($obj->{'dy'}) |
| 68934 | 68934 | ,MarkDef::fromFill($obj->{'fill'}) |
| 68935 | - ,MarkDef::fromFilled($obj->{'filled'}) | |
| 68936 | 68935 | ,MarkDef::fromFillOpacity($obj->{'fillOpacity'}) |
| 68936 | + ,MarkDef::fromFilled($obj->{'filled'}) | |
| 68937 | 68937 | ,MarkDef::fromFont($obj->{'font'}) |
| 68938 | 68938 | ,MarkDef::fromFontSize($obj->{'fontSize'}) |
| 68939 | 68939 | ,MarkDef::fromFontStyle($obj->{'fontStyle'}) |
| @@ -68973,8 +68973,8 @@ class MarkDef { | ||
| 68973 | 68973 | ,MarkDef::sampleDx() |
| 68974 | 68974 | ,MarkDef::sampleDy() |
| 68975 | 68975 | ,MarkDef::sampleFill() |
| 68976 | - ,MarkDef::sampleFilled() | |
| 68977 | 68976 | ,MarkDef::sampleFillOpacity() |
| 68977 | + ,MarkDef::sampleFilled() | |
| 68978 | 68978 | ,MarkDef::sampleFont() |
| 68979 | 68979 | ,MarkDef::sampleFontSize() |
| 68980 | 68980 | ,MarkDef::sampleFontStyle() |
Mschema-pikedefault / TopLevel.pmod+24 −24
| @@ -304,8 +304,8 @@ class MarkConfig { | ||
| 304 | 304 | float|mixed dx; // json: "dx" |
| 305 | 305 | float|mixed dy; // json: "dy" |
| 306 | 306 | mixed|string fill; // json: "fill" |
| 307 | - bool|mixed filled; // json: "filled" | |
| 308 | 307 | float|mixed fill_opacity; // json: "fillOpacity" |
| 308 | + bool|mixed filled; // json: "filled" | |
| 309 | 309 | mixed|string font; // json: "font" |
| 310 | 310 | float|mixed font_size; // json: "fontSize" |
| 311 | 311 | FontStyle|mixed font_style; // json: "fontStyle" |
| @@ -337,8 +337,8 @@ class MarkConfig { | ||
| 337 | 337 | "dx" : dx, |
| 338 | 338 | "dy" : dy, |
| 339 | 339 | "fill" : fill, |
| 340 | - "filled" : filled, | |
| 341 | 340 | "fillOpacity" : fill_opacity, |
| 341 | + "filled" : filled, | |
| 342 | 342 | "font" : font, |
| 343 | 343 | "fontSize" : font_size, |
| 344 | 344 | "fontStyle" : font_style, |
| @@ -376,8 +376,8 @@ MarkConfig MarkConfig_from_JSON(mixed json) { | ||
| 376 | 376 | retval.dx = json["dx"]; |
| 377 | 377 | retval.dy = json["dy"]; |
| 378 | 378 | retval.fill = json["fill"]; |
| 379 | - retval.filled = json["filled"]; | |
| 380 | 379 | retval.fill_opacity = json["fillOpacity"]; |
| 380 | + retval.filled = json["filled"]; | |
| 381 | 381 | retval.font = json["font"]; |
| 382 | 382 | retval.font_size = json["fontSize"]; |
| 383 | 383 | retval.font_style = json["fontStyle"]; |
| @@ -521,9 +521,9 @@ class AxisConfig { | ||
| 521 | 521 | bool|mixed short_time_labels; // json: "shortTimeLabels" |
| 522 | 522 | mixed|string tick_color; // json: "tickColor" |
| 523 | 523 | bool|mixed tick_round; // json: "tickRound" |
| 524 | - bool|mixed ticks; // json: "ticks" | |
| 525 | 524 | float|mixed tick_size; // json: "tickSize" |
| 526 | 525 | float|mixed tick_width; // json: "tickWidth" |
| 526 | + bool|mixed ticks; // json: "ticks" | |
| 527 | 527 | mixed|string title_align; // json: "titleAlign" |
| 528 | 528 | float|mixed title_angle; // json: "titleAngle" |
| 529 | 529 | mixed|string title_baseline; // json: "titleBaseline" |
| @@ -563,9 +563,9 @@ class AxisConfig { | ||
| 563 | 563 | "shortTimeLabels" : short_time_labels, |
| 564 | 564 | "tickColor" : tick_color, |
| 565 | 565 | "tickRound" : tick_round, |
| 566 | - "ticks" : ticks, | |
| 567 | 566 | "tickSize" : tick_size, |
| 568 | 567 | "tickWidth" : tick_width, |
| 568 | + "ticks" : ticks, | |
| 569 | 569 | "titleAlign" : title_align, |
| 570 | 570 | "titleAngle" : title_angle, |
| 571 | 571 | "titleBaseline" : title_baseline, |
| @@ -611,9 +611,9 @@ AxisConfig AxisConfig_from_JSON(mixed json) { | ||
| 611 | 611 | retval.short_time_labels = json["shortTimeLabels"]; |
| 612 | 612 | retval.tick_color = json["tickColor"]; |
| 613 | 613 | retval.tick_round = json["tickRound"]; |
| 614 | - retval.ticks = json["ticks"]; | |
| 615 | 614 | retval.tick_size = json["tickSize"]; |
| 616 | 615 | retval.tick_width = json["tickWidth"]; |
| 616 | + retval.ticks = json["ticks"]; | |
| 617 | 617 | retval.title_align = json["titleAlign"]; |
| 618 | 618 | retval.title_angle = json["titleAngle"]; |
| 619 | 619 | retval.title_baseline = json["titleBaseline"]; |
| @@ -710,9 +710,9 @@ class VgAxisConfig { | ||
| 710 | 710 | float|mixed min_extent; // json: "minExtent" |
| 711 | 711 | mixed|string tick_color; // json: "tickColor" |
| 712 | 712 | bool|mixed tick_round; // json: "tickRound" |
| 713 | - bool|mixed ticks; // json: "ticks" | |
| 714 | 713 | float|mixed tick_size; // json: "tickSize" |
| 715 | 714 | float|mixed tick_width; // json: "tickWidth" |
| 715 | + bool|mixed ticks; // json: "ticks" | |
| 716 | 716 | mixed|string title_align; // json: "titleAlign" |
| 717 | 717 | float|mixed title_angle; // json: "titleAngle" |
| 718 | 718 | mixed|string title_baseline; // json: "titleBaseline" |
| @@ -751,9 +751,9 @@ class VgAxisConfig { | ||
| 751 | 751 | "minExtent" : min_extent, |
| 752 | 752 | "tickColor" : tick_color, |
| 753 | 753 | "tickRound" : tick_round, |
| 754 | - "ticks" : ticks, | |
| 755 | 754 | "tickSize" : tick_size, |
| 756 | 755 | "tickWidth" : tick_width, |
| 756 | + "ticks" : ticks, | |
| 757 | 757 | "titleAlign" : title_align, |
| 758 | 758 | "titleAngle" : title_angle, |
| 759 | 759 | "titleBaseline" : title_baseline, |
| @@ -798,9 +798,9 @@ VgAxisConfig VgAxisConfig_from_JSON(mixed json) { | ||
| 798 | 798 | retval.min_extent = json["minExtent"]; |
| 799 | 799 | retval.tick_color = json["tickColor"]; |
| 800 | 800 | retval.tick_round = json["tickRound"]; |
| 801 | - retval.ticks = json["ticks"]; | |
| 802 | 801 | retval.tick_size = json["tickSize"]; |
| 803 | 802 | retval.tick_width = json["tickWidth"]; |
| 803 | + retval.ticks = json["ticks"]; | |
| 804 | 804 | retval.title_align = json["titleAlign"]; |
| 805 | 805 | retval.title_angle = json["titleAngle"]; |
| 806 | 806 | retval.title_baseline = json["titleBaseline"]; |
| @@ -830,8 +830,8 @@ class BarConfig { | ||
| 830 | 830 | float|mixed dx; // json: "dx" |
| 831 | 831 | float|mixed dy; // json: "dy" |
| 832 | 832 | mixed|string fill; // json: "fill" |
| 833 | - bool|mixed filled; // json: "filled" | |
| 834 | 833 | float|mixed fill_opacity; // json: "fillOpacity" |
| 834 | + bool|mixed filled; // json: "filled" | |
| 835 | 835 | mixed|string font; // json: "font" |
| 836 | 836 | float|mixed font_size; // json: "fontSize" |
| 837 | 837 | FontStyle|mixed font_style; // json: "fontStyle" |
| @@ -866,8 +866,8 @@ class BarConfig { | ||
| 866 | 866 | "dx" : dx, |
| 867 | 867 | "dy" : dy, |
| 868 | 868 | "fill" : fill, |
| 869 | - "filled" : filled, | |
| 870 | 869 | "fillOpacity" : fill_opacity, |
| 870 | + "filled" : filled, | |
| 871 | 871 | "font" : font, |
| 872 | 872 | "fontSize" : font_size, |
| 873 | 873 | "fontStyle" : font_style, |
| @@ -908,8 +908,8 @@ BarConfig BarConfig_from_JSON(mixed json) { | ||
| 908 | 908 | retval.dx = json["dx"]; |
| 909 | 909 | retval.dy = json["dy"]; |
| 910 | 910 | retval.fill = json["fill"]; |
| 911 | - retval.filled = json["filled"]; | |
| 912 | 911 | retval.fill_opacity = json["fillOpacity"]; |
| 912 | + retval.filled = json["filled"]; | |
| 913 | 913 | retval.font = json["font"]; |
| 914 | 914 | retval.font_size = json["fontSize"]; |
| 915 | 915 | retval.font_style = json["fontStyle"]; |
| @@ -1748,8 +1748,8 @@ class TextConfig { | ||
| 1748 | 1748 | float|mixed dx; // json: "dx" |
| 1749 | 1749 | float|mixed dy; // json: "dy" |
| 1750 | 1750 | mixed|string fill; // json: "fill" |
| 1751 | - bool|mixed filled; // json: "filled" | |
| 1752 | 1751 | float|mixed fill_opacity; // json: "fillOpacity" |
| 1752 | + bool|mixed filled; // json: "filled" | |
| 1753 | 1753 | mixed|string font; // json: "font" |
| 1754 | 1754 | float|mixed font_size; // json: "fontSize" |
| 1755 | 1755 | FontStyle|mixed font_style; // json: "fontStyle" |
| @@ -1782,8 +1782,8 @@ class TextConfig { | ||
| 1782 | 1782 | "dx" : dx, |
| 1783 | 1783 | "dy" : dy, |
| 1784 | 1784 | "fill" : fill, |
| 1785 | - "filled" : filled, | |
| 1786 | 1785 | "fillOpacity" : fill_opacity, |
| 1786 | + "filled" : filled, | |
| 1787 | 1787 | "font" : font, |
| 1788 | 1788 | "fontSize" : font_size, |
| 1789 | 1789 | "fontStyle" : font_style, |
| @@ -1822,8 +1822,8 @@ TextConfig TextConfig_from_JSON(mixed json) { | ||
| 1822 | 1822 | retval.dx = json["dx"]; |
| 1823 | 1823 | retval.dy = json["dy"]; |
| 1824 | 1824 | retval.fill = json["fill"]; |
| 1825 | - retval.filled = json["filled"]; | |
| 1826 | 1825 | retval.fill_opacity = json["fillOpacity"]; |
| 1826 | + retval.filled = json["filled"]; | |
| 1827 | 1827 | retval.font = json["font"]; |
| 1828 | 1828 | retval.font_size = json["fontSize"]; |
| 1829 | 1829 | retval.font_style = json["fontStyle"]; |
| @@ -1860,8 +1860,8 @@ class TickConfig { | ||
| 1860 | 1860 | float|mixed dx; // json: "dx" |
| 1861 | 1861 | float|mixed dy; // json: "dy" |
| 1862 | 1862 | mixed|string fill; // json: "fill" |
| 1863 | - bool|mixed filled; // json: "filled" | |
| 1864 | 1863 | float|mixed fill_opacity; // json: "fillOpacity" |
| 1864 | + bool|mixed filled; // json: "filled" | |
| 1865 | 1865 | mixed|string font; // json: "font" |
| 1866 | 1866 | float|mixed font_size; // json: "fontSize" |
| 1867 | 1867 | FontStyle|mixed font_style; // json: "fontStyle" |
| @@ -1895,8 +1895,8 @@ class TickConfig { | ||
| 1895 | 1895 | "dx" : dx, |
| 1896 | 1896 | "dy" : dy, |
| 1897 | 1897 | "fill" : fill, |
| 1898 | - "filled" : filled, | |
| 1899 | 1898 | "fillOpacity" : fill_opacity, |
| 1899 | + "filled" : filled, | |
| 1900 | 1900 | "font" : font, |
| 1901 | 1901 | "fontSize" : font_size, |
| 1902 | 1902 | "fontStyle" : font_style, |
| @@ -1936,8 +1936,8 @@ TickConfig TickConfig_from_JSON(mixed json) { | ||
| 1936 | 1936 | retval.dx = json["dx"]; |
| 1937 | 1937 | retval.dy = json["dy"]; |
| 1938 | 1938 | retval.fill = json["fill"]; |
| 1939 | - retval.filled = json["filled"]; | |
| 1940 | 1939 | retval.fill_opacity = json["fillOpacity"]; |
| 1940 | + retval.filled = json["filled"]; | |
| 1941 | 1941 | retval.font = json["font"]; |
| 1942 | 1942 | retval.font_size = json["fontSize"]; |
| 1943 | 1943 | retval.font_style = json["fontStyle"]; |
| @@ -3625,8 +3625,8 @@ class Axis { | ||
| 3625 | 3625 | TitleOrient|mixed orient; // json: "orient" |
| 3626 | 3626 | float|mixed position; // json: "position" |
| 3627 | 3627 | float|mixed tick_count; // json: "tickCount" |
| 3628 | - bool|mixed ticks; // json: "ticks" | |
| 3629 | 3628 | float|mixed tick_size; // json: "tickSize" |
| 3629 | + bool|mixed ticks; // json: "ticks" | |
| 3630 | 3630 | mixed|string title; // json: "title" |
| 3631 | 3631 | float|mixed title_max_length; // json: "titleMaxLength" |
| 3632 | 3632 | float|mixed title_padding; // json: "titlePadding" |
| @@ -3650,8 +3650,8 @@ class Axis { | ||
| 3650 | 3650 | "orient" : orient, |
| 3651 | 3651 | "position" : position, |
| 3652 | 3652 | "tickCount" : tick_count, |
| 3653 | - "ticks" : ticks, | |
| 3654 | 3653 | "tickSize" : tick_size, |
| 3654 | + "ticks" : ticks, | |
| 3655 | 3655 | "title" : title, |
| 3656 | 3656 | "titleMaxLength" : title_max_length, |
| 3657 | 3657 | "titlePadding" : title_padding, |
| @@ -3681,8 +3681,8 @@ Axis Axis_from_JSON(mixed json) { | ||
| 3681 | 3681 | retval.orient = json["orient"]; |
| 3682 | 3682 | retval.position = json["position"]; |
| 3683 | 3683 | retval.tick_count = json["tickCount"]; |
| 3684 | - retval.ticks = json["ticks"]; | |
| 3685 | 3684 | retval.tick_size = json["tickSize"]; |
| 3685 | + retval.ticks = json["ticks"]; | |
| 3686 | 3686 | retval.title = json["title"]; |
| 3687 | 3687 | retval.title_max_length = json["titleMaxLength"]; |
| 3688 | 3688 | retval.title_padding = json["titlePadding"]; |
| @@ -3971,8 +3971,8 @@ class MarkDef { | ||
| 3971 | 3971 | float|mixed dx; // json: "dx" |
| 3972 | 3972 | float|mixed dy; // json: "dy" |
| 3973 | 3973 | mixed|string fill; // json: "fill" |
| 3974 | - bool|mixed filled; // json: "filled" | |
| 3975 | 3974 | float|mixed fill_opacity; // json: "fillOpacity" |
| 3975 | + bool|mixed filled; // json: "filled" | |
| 3976 | 3976 | mixed|string font; // json: "font" |
| 3977 | 3977 | float|mixed font_size; // json: "fontSize" |
| 3978 | 3978 | FontStyle|mixed font_style; // json: "fontStyle" |
| @@ -4007,8 +4007,8 @@ class MarkDef { | ||
| 4007 | 4007 | "dx" : dx, |
| 4008 | 4008 | "dy" : dy, |
| 4009 | 4009 | "fill" : fill, |
| 4010 | - "filled" : filled, | |
| 4011 | 4010 | "fillOpacity" : fill_opacity, |
| 4011 | + "filled" : filled, | |
| 4012 | 4012 | "font" : font, |
| 4013 | 4013 | "fontSize" : font_size, |
| 4014 | 4014 | "fontStyle" : font_style, |
| @@ -4049,8 +4049,8 @@ MarkDef MarkDef_from_JSON(mixed json) { | ||
| 4049 | 4049 | retval.dx = json["dx"]; |
| 4050 | 4050 | retval.dy = json["dy"]; |
| 4051 | 4051 | retval.fill = json["fill"]; |
| 4052 | - retval.filled = json["filled"]; | |
| 4053 | 4052 | retval.fill_opacity = json["fillOpacity"]; |
| 4053 | + retval.filled = json["filled"]; | |
| 4054 | 4054 | retval.font = json["font"]; |
| 4055 | 4055 | retval.font_size = json["fontSize"]; |
| 4056 | 4056 | retval.font_style = json["fontStyle"]; |
Mschema-pythondefault / quicktype.py+66 −66
| @@ -310,6 +310,11 @@ class MarkConfig: | ||
| 310 | 310 | |
| 311 | 311 | __Default value:__ (None) |
| 312 | 312 | """ |
| 313 | + fill_opacity: float | None = None | |
| 314 | + """The fill opacity (value between [0,1]). | |
| 315 | + | |
| 316 | + __Default value:__ `1` | |
| 317 | + """ | |
| 313 | 318 | filled: bool | None = None |
| 314 | 319 | """Whether the mark's color should be used as fill color instead of stroke color. |
| 315 | 320 | |
| @@ -319,11 +324,6 @@ class MarkConfig: | ||
| 319 | 324 | |
| 320 | 325 | __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 321 | 326 | """ |
| 322 | - fill_opacity: float | None = None | |
| 323 | - """The fill opacity (value between [0,1]). | |
| 324 | - | |
| 325 | - __Default value:__ `1` | |
| 326 | - """ | |
| 327 | 327 | font: str | None = None |
| 328 | 328 | """The typeface to set the text in (e.g., `"Helvetica Neue"`).""" |
| 329 | 329 | |
| @@ -440,8 +440,8 @@ class MarkConfig: | ||
| 440 | 440 | dx = from_union([from_float, from_none], obj.get("dx")) |
| 441 | 441 | dy = from_union([from_float, from_none], obj.get("dy")) |
| 442 | 442 | fill = from_union([from_str, from_none], obj.get("fill")) |
| 443 | - filled = from_union([from_bool, from_none], obj.get("filled")) | |
| 444 | 443 | fill_opacity = from_union([from_float, from_none], obj.get("fillOpacity")) |
| 444 | + filled = from_union([from_bool, from_none], obj.get("filled")) | |
| 445 | 445 | font = from_union([from_str, from_none], obj.get("font")) |
| 446 | 446 | font_size = from_union([from_float, from_none], obj.get("fontSize")) |
| 447 | 447 | font_style = from_union([FontStyle, from_none], obj.get("fontStyle")) |
| @@ -462,7 +462,7 @@ class MarkConfig: | ||
| 462 | 462 | tension = from_union([from_float, from_none], obj.get("tension")) |
| 463 | 463 | text = from_union([from_str, from_none], obj.get("text")) |
| 464 | 464 | theta = from_union([from_float, from_none], obj.get("theta")) |
| 465 | - return MarkConfig(align, angle, baseline, color, cursor, dx, dy, fill, filled, fill_opacity, font, font_size, font_style, font_weight, href, interpolate, limit, opacity, orient, radius, shape, size, stroke, stroke_dash, stroke_dash_offset, stroke_opacity, stroke_width, tension, text, theta) | |
| 465 | + return MarkConfig(align, angle, baseline, color, cursor, dx, dy, fill, fill_opacity, filled, font, font_size, font_style, font_weight, href, interpolate, limit, opacity, orient, radius, shape, size, stroke, stroke_dash, stroke_dash_offset, stroke_opacity, stroke_width, tension, text, theta) | |
| 466 | 466 | |
| 467 | 467 | def to_dict(self) -> dict: |
| 468 | 468 | result: dict = {} |
| @@ -482,10 +482,10 @@ class MarkConfig: | ||
| 482 | 482 | result["dy"] = from_union([to_float, from_none], self.dy) |
| 483 | 483 | if self.fill is not None: |
| 484 | 484 | result["fill"] = from_union([from_str, from_none], self.fill) |
| 485 | - if self.filled is not None: | |
| 486 | - result["filled"] = from_union([from_bool, from_none], self.filled) | |
| 487 | 485 | if self.fill_opacity is not None: |
| 488 | 486 | result["fillOpacity"] = from_union([to_float, from_none], self.fill_opacity) |
| 487 | + if self.filled is not None: | |
| 488 | + result["filled"] = from_union([from_bool, from_none], self.filled) | |
| 489 | 489 | if self.font is not None: |
| 490 | 490 | result["font"] = from_union([from_str, from_none], self.font) |
| 491 | 491 | if self.font_size is not None: |
| @@ -659,15 +659,15 @@ class AxisConfig: | ||
| 659 | 659 | tick_round: bool | None = None |
| 660 | 660 | """Boolean flag indicating if pixel position values should be rounded to the nearest integer.""" |
| 661 | 661 | |
| 662 | - ticks: bool | None = None | |
| 663 | - """Boolean value that determines whether the axis should include ticks.""" | |
| 664 | - | |
| 665 | 662 | tick_size: float | None = None |
| 666 | 663 | """The size in pixels of axis ticks.""" |
| 667 | 664 | |
| 668 | 665 | tick_width: float | None = None |
| 669 | 666 | """The width, in pixels, of ticks.""" |
| 670 | 667 | |
| 668 | + ticks: bool | None = None | |
| 669 | + """Boolean value that determines whether the axis should include ticks.""" | |
| 670 | + | |
| 671 | 671 | title_align: str | None = None |
| 672 | 672 | """Horizontal text alignment of axis titles.""" |
| 673 | 673 | |
| @@ -732,9 +732,9 @@ class AxisConfig: | ||
| 732 | 732 | short_time_labels = from_union([from_bool, from_none], obj.get("shortTimeLabels")) |
| 733 | 733 | tick_color = from_union([from_str, from_none], obj.get("tickColor")) |
| 734 | 734 | tick_round = from_union([from_bool, from_none], obj.get("tickRound")) |
| 735 | - ticks = from_union([from_bool, from_none], obj.get("ticks")) | |
| 736 | 735 | tick_size = from_union([from_float, from_none], obj.get("tickSize")) |
| 737 | 736 | tick_width = from_union([from_float, from_none], obj.get("tickWidth")) |
| 737 | + ticks = from_union([from_bool, from_none], obj.get("ticks")) | |
| 738 | 738 | title_align = from_union([from_str, from_none], obj.get("titleAlign")) |
| 739 | 739 | title_angle = from_union([from_float, from_none], obj.get("titleAngle")) |
| 740 | 740 | title_baseline = from_union([from_str, from_none], obj.get("titleBaseline")) |
| @@ -747,7 +747,7 @@ class AxisConfig: | ||
| 747 | 747 | title_padding = from_union([from_float, from_none], obj.get("titlePadding")) |
| 748 | 748 | title_x = from_union([from_float, from_none], obj.get("titleX")) |
| 749 | 749 | title_y = from_union([from_float, from_none], obj.get("titleY")) |
| 750 | - return AxisConfig(band_position, domain, domain_color, domain_width, grid, grid_color, grid_dash, grid_opacity, grid_width, label_angle, label_bound, label_color, label_flush, label_font, label_font_size, label_limit, label_overlap, label_padding, labels, max_extent, min_extent, short_time_labels, tick_color, tick_round, ticks, tick_size, tick_width, title_align, title_angle, title_baseline, title_color, title_font, title_font_size, title_font_weight, title_limit, title_max_length, title_padding, title_x, title_y) | |
| 750 | + return AxisConfig(band_position, domain, domain_color, domain_width, grid, grid_color, grid_dash, grid_opacity, grid_width, label_angle, label_bound, label_color, label_flush, label_font, label_font_size, label_limit, label_overlap, label_padding, labels, max_extent, min_extent, short_time_labels, tick_color, tick_round, tick_size, tick_width, ticks, title_align, title_angle, title_baseline, title_color, title_font, title_font_size, title_font_weight, title_limit, title_max_length, title_padding, title_x, title_y) | |
| 751 | 751 | |
| 752 | 752 | def to_dict(self) -> dict: |
| 753 | 753 | result: dict = {} |
| @@ -799,12 +799,12 @@ class AxisConfig: | ||
| 799 | 799 | result["tickColor"] = from_union([from_str, from_none], self.tick_color) |
| 800 | 800 | if self.tick_round is not None: |
| 801 | 801 | result["tickRound"] = from_union([from_bool, from_none], self.tick_round) |
| 802 | - if self.ticks is not None: | |
| 803 | - result["ticks"] = from_union([from_bool, from_none], self.ticks) | |
| 804 | 802 | if self.tick_size is not None: |
| 805 | 803 | result["tickSize"] = from_union([to_float, from_none], self.tick_size) |
| 806 | 804 | if self.tick_width is not None: |
| 807 | 805 | result["tickWidth"] = from_union([to_float, from_none], self.tick_width) |
| 806 | + if self.ticks is not None: | |
| 807 | + result["ticks"] = from_union([from_bool, from_none], self.ticks) | |
| 808 | 808 | if self.title_align is not None: |
| 809 | 809 | result["titleAlign"] = from_union([from_str, from_none], self.title_align) |
| 810 | 810 | if self.title_angle is not None: |
| @@ -962,15 +962,15 @@ class VGAxisConfig: | ||
| 962 | 962 | tick_round: bool | None = None |
| 963 | 963 | """Boolean flag indicating if pixel position values should be rounded to the nearest integer.""" |
| 964 | 964 | |
| 965 | - ticks: bool | None = None | |
| 966 | - """Boolean value that determines whether the axis should include ticks.""" | |
| 967 | - | |
| 968 | 965 | tick_size: float | None = None |
| 969 | 966 | """The size in pixels of axis ticks.""" |
| 970 | 967 | |
| 971 | 968 | tick_width: float | None = None |
| 972 | 969 | """The width, in pixels, of ticks.""" |
| 973 | 970 | |
| 971 | + ticks: bool | None = None | |
| 972 | + """Boolean value that determines whether the axis should include ticks.""" | |
| 973 | + | |
| 974 | 974 | title_align: str | None = None |
| 975 | 975 | """Horizontal text alignment of axis titles.""" |
| 976 | 976 | |
| @@ -1034,9 +1034,9 @@ class VGAxisConfig: | ||
| 1034 | 1034 | min_extent = from_union([from_float, from_none], obj.get("minExtent")) |
| 1035 | 1035 | tick_color = from_union([from_str, from_none], obj.get("tickColor")) |
| 1036 | 1036 | tick_round = from_union([from_bool, from_none], obj.get("tickRound")) |
| 1037 | - ticks = from_union([from_bool, from_none], obj.get("ticks")) | |
| 1038 | 1037 | tick_size = from_union([from_float, from_none], obj.get("tickSize")) |
| 1039 | 1038 | tick_width = from_union([from_float, from_none], obj.get("tickWidth")) |
| 1039 | + ticks = from_union([from_bool, from_none], obj.get("ticks")) | |
| 1040 | 1040 | title_align = from_union([from_str, from_none], obj.get("titleAlign")) |
| 1041 | 1041 | title_angle = from_union([from_float, from_none], obj.get("titleAngle")) |
| 1042 | 1042 | title_baseline = from_union([from_str, from_none], obj.get("titleBaseline")) |
| @@ -1049,7 +1049,7 @@ class VGAxisConfig: | ||
| 1049 | 1049 | title_padding = from_union([from_float, from_none], obj.get("titlePadding")) |
| 1050 | 1050 | title_x = from_union([from_float, from_none], obj.get("titleX")) |
| 1051 | 1051 | title_y = from_union([from_float, from_none], obj.get("titleY")) |
| 1052 | - return VGAxisConfig(band_position, domain, domain_color, domain_width, grid, grid_color, grid_dash, grid_opacity, grid_width, label_angle, label_bound, label_color, label_flush, label_font, label_font_size, label_limit, label_overlap, label_padding, labels, max_extent, min_extent, tick_color, tick_round, ticks, tick_size, tick_width, title_align, title_angle, title_baseline, title_color, title_font, title_font_size, title_font_weight, title_limit, title_max_length, title_padding, title_x, title_y) | |
| 1052 | + return VGAxisConfig(band_position, domain, domain_color, domain_width, grid, grid_color, grid_dash, grid_opacity, grid_width, label_angle, label_bound, label_color, label_flush, label_font, label_font_size, label_limit, label_overlap, label_padding, labels, max_extent, min_extent, tick_color, tick_round, tick_size, tick_width, ticks, title_align, title_angle, title_baseline, title_color, title_font, title_font_size, title_font_weight, title_limit, title_max_length, title_padding, title_x, title_y) | |
| 1053 | 1053 | |
| 1054 | 1054 | def to_dict(self) -> dict: |
| 1055 | 1055 | result: dict = {} |
| @@ -1099,12 +1099,12 @@ class VGAxisConfig: | ||
| 1099 | 1099 | result["tickColor"] = from_union([from_str, from_none], self.tick_color) |
| 1100 | 1100 | if self.tick_round is not None: |
| 1101 | 1101 | result["tickRound"] = from_union([from_bool, from_none], self.tick_round) |
| 1102 | - if self.ticks is not None: | |
| 1103 | - result["ticks"] = from_union([from_bool, from_none], self.ticks) | |
| 1104 | 1102 | if self.tick_size is not None: |
| 1105 | 1103 | result["tickSize"] = from_union([to_float, from_none], self.tick_size) |
| 1106 | 1104 | if self.tick_width is not None: |
| 1107 | 1105 | result["tickWidth"] = from_union([to_float, from_none], self.tick_width) |
| 1106 | + if self.ticks is not None: | |
| 1107 | + result["ticks"] = from_union([from_bool, from_none], self.ticks) | |
| 1108 | 1108 | if self.title_align is not None: |
| 1109 | 1109 | result["titleAlign"] = from_union([from_str, from_none], self.title_align) |
| 1110 | 1110 | if self.title_angle is not None: |
| @@ -1187,6 +1187,11 @@ class BarConfig: | ||
| 1187 | 1187 | |
| 1188 | 1188 | __Default value:__ (None) |
| 1189 | 1189 | """ |
| 1190 | + fill_opacity: float | None = None | |
| 1191 | + """The fill opacity (value between [0,1]). | |
| 1192 | + | |
| 1193 | + __Default value:__ `1` | |
| 1194 | + """ | |
| 1190 | 1195 | filled: bool | None = None |
| 1191 | 1196 | """Whether the mark's color should be used as fill color instead of stroke color. |
| 1192 | 1197 | |
| @@ -1196,11 +1201,6 @@ class BarConfig: | ||
| 1196 | 1201 | |
| 1197 | 1202 | __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 1198 | 1203 | """ |
| 1199 | - fill_opacity: float | None = None | |
| 1200 | - """The fill opacity (value between [0,1]). | |
| 1201 | - | |
| 1202 | - __Default value:__ `1` | |
| 1203 | - """ | |
| 1204 | 1204 | font: str | None = None |
| 1205 | 1205 | """The typeface to set the text in (e.g., `"Helvetica Neue"`).""" |
| 1206 | 1206 | |
| @@ -1320,8 +1320,8 @@ class BarConfig: | ||
| 1320 | 1320 | dx = from_union([from_float, from_none], obj.get("dx")) |
| 1321 | 1321 | dy = from_union([from_float, from_none], obj.get("dy")) |
| 1322 | 1322 | fill = from_union([from_str, from_none], obj.get("fill")) |
| 1323 | - filled = from_union([from_bool, from_none], obj.get("filled")) | |
| 1324 | 1323 | fill_opacity = from_union([from_float, from_none], obj.get("fillOpacity")) |
| 1324 | + filled = from_union([from_bool, from_none], obj.get("filled")) | |
| 1325 | 1325 | font = from_union([from_str, from_none], obj.get("font")) |
| 1326 | 1326 | font_size = from_union([from_float, from_none], obj.get("fontSize")) |
| 1327 | 1327 | font_style = from_union([FontStyle, from_none], obj.get("fontStyle")) |
| @@ -1342,7 +1342,7 @@ class BarConfig: | ||
| 1342 | 1342 | tension = from_union([from_float, from_none], obj.get("tension")) |
| 1343 | 1343 | text = from_union([from_str, from_none], obj.get("text")) |
| 1344 | 1344 | theta = from_union([from_float, from_none], obj.get("theta")) |
| 1345 | - return BarConfig(align, angle, baseline, bin_spacing, color, continuous_band_size, cursor, discrete_band_size, dx, dy, fill, filled, fill_opacity, font, font_size, font_style, font_weight, href, interpolate, limit, opacity, orient, radius, shape, size, stroke, stroke_dash, stroke_dash_offset, stroke_opacity, stroke_width, tension, text, theta) | |
| 1345 | + return BarConfig(align, angle, baseline, bin_spacing, color, continuous_band_size, cursor, discrete_band_size, dx, dy, fill, fill_opacity, filled, font, font_size, font_style, font_weight, href, interpolate, limit, opacity, orient, radius, shape, size, stroke, stroke_dash, stroke_dash_offset, stroke_opacity, stroke_width, tension, text, theta) | |
| 1346 | 1346 | |
| 1347 | 1347 | def to_dict(self) -> dict: |
| 1348 | 1348 | result: dict = {} |
| @@ -1368,10 +1368,10 @@ class BarConfig: | ||
| 1368 | 1368 | result["dy"] = from_union([to_float, from_none], self.dy) |
| 1369 | 1369 | if self.fill is not None: |
| 1370 | 1370 | result["fill"] = from_union([from_str, from_none], self.fill) |
| 1371 | - if self.filled is not None: | |
| 1372 | - result["filled"] = from_union([from_bool, from_none], self.filled) | |
| 1373 | 1371 | if self.fill_opacity is not None: |
| 1374 | 1372 | result["fillOpacity"] = from_union([to_float, from_none], self.fill_opacity) |
| 1373 | + if self.filled is not None: | |
| 1374 | + result["filled"] = from_union([from_bool, from_none], self.filled) | |
| 1375 | 1375 | if self.font is not None: |
| 1376 | 1376 | result["font"] = from_union([from_str, from_none], self.font) |
| 1377 | 1377 | if self.font_size is not None: |
| @@ -2801,6 +2801,11 @@ class TextConfig: | ||
| 2801 | 2801 | |
| 2802 | 2802 | __Default value:__ (None) |
| 2803 | 2803 | """ |
| 2804 | + fill_opacity: float | None = None | |
| 2805 | + """The fill opacity (value between [0,1]). | |
| 2806 | + | |
| 2807 | + __Default value:__ `1` | |
| 2808 | + """ | |
| 2804 | 2809 | filled: bool | None = None |
| 2805 | 2810 | """Whether the mark's color should be used as fill color instead of stroke color. |
| 2806 | 2811 | |
| @@ -2810,11 +2815,6 @@ class TextConfig: | ||
| 2810 | 2815 | |
| 2811 | 2816 | __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 2812 | 2817 | """ |
| 2813 | - fill_opacity: float | None = None | |
| 2814 | - """The fill opacity (value between [0,1]). | |
| 2815 | - | |
| 2816 | - __Default value:__ `1` | |
| 2817 | - """ | |
| 2818 | 2818 | font: str | None = None |
| 2819 | 2819 | """The typeface to set the text in (e.g., `"Helvetica Neue"`).""" |
| 2820 | 2820 | |
| @@ -2934,8 +2934,8 @@ class TextConfig: | ||
| 2934 | 2934 | dx = from_union([from_float, from_none], obj.get("dx")) |
| 2935 | 2935 | dy = from_union([from_float, from_none], obj.get("dy")) |
| 2936 | 2936 | fill = from_union([from_str, from_none], obj.get("fill")) |
| 2937 | - filled = from_union([from_bool, from_none], obj.get("filled")) | |
| 2938 | 2937 | fill_opacity = from_union([from_float, from_none], obj.get("fillOpacity")) |
| 2938 | + filled = from_union([from_bool, from_none], obj.get("filled")) | |
| 2939 | 2939 | font = from_union([from_str, from_none], obj.get("font")) |
| 2940 | 2940 | font_size = from_union([from_float, from_none], obj.get("fontSize")) |
| 2941 | 2941 | font_style = from_union([FontStyle, from_none], obj.get("fontStyle")) |
| @@ -2957,7 +2957,7 @@ class TextConfig: | ||
| 2957 | 2957 | tension = from_union([from_float, from_none], obj.get("tension")) |
| 2958 | 2958 | text = from_union([from_str, from_none], obj.get("text")) |
| 2959 | 2959 | theta = from_union([from_float, from_none], obj.get("theta")) |
| 2960 | - return TextConfig(align, angle, baseline, color, cursor, dx, dy, fill, filled, fill_opacity, font, font_size, font_style, font_weight, href, interpolate, limit, opacity, orient, radius, shape, short_time_labels, size, stroke, stroke_dash, stroke_dash_offset, stroke_opacity, stroke_width, tension, text, theta) | |
| 2960 | + return TextConfig(align, angle, baseline, color, cursor, dx, dy, fill, fill_opacity, filled, font, font_size, font_style, font_weight, href, interpolate, limit, opacity, orient, radius, shape, short_time_labels, size, stroke, stroke_dash, stroke_dash_offset, stroke_opacity, stroke_width, tension, text, theta) | |
| 2961 | 2961 | |
| 2962 | 2962 | def to_dict(self) -> dict: |
| 2963 | 2963 | result: dict = {} |
| @@ -2977,10 +2977,10 @@ class TextConfig: | ||
| 2977 | 2977 | result["dy"] = from_union([to_float, from_none], self.dy) |
| 2978 | 2978 | if self.fill is not None: |
| 2979 | 2979 | result["fill"] = from_union([from_str, from_none], self.fill) |
| 2980 | - if self.filled is not None: | |
| 2981 | - result["filled"] = from_union([from_bool, from_none], self.filled) | |
| 2982 | 2980 | if self.fill_opacity is not None: |
| 2983 | 2981 | result["fillOpacity"] = from_union([to_float, from_none], self.fill_opacity) |
| 2982 | + if self.filled is not None: | |
| 2983 | + result["filled"] = from_union([from_bool, from_none], self.filled) | |
| 2984 | 2984 | if self.font is not None: |
| 2985 | 2985 | result["font"] = from_union([from_str, from_none], self.font) |
| 2986 | 2986 | if self.font_size is not None: |
| @@ -3071,6 +3071,11 @@ class TickConfig: | ||
| 3071 | 3071 | |
| 3072 | 3072 | __Default value:__ (None) |
| 3073 | 3073 | """ |
| 3074 | + fill_opacity: float | None = None | |
| 3075 | + """The fill opacity (value between [0,1]). | |
| 3076 | + | |
| 3077 | + __Default value:__ `1` | |
| 3078 | + """ | |
| 3074 | 3079 | filled: bool | None = None |
| 3075 | 3080 | """Whether the mark's color should be used as fill color instead of stroke color. |
| 3076 | 3081 | |
| @@ -3080,11 +3085,6 @@ class TickConfig: | ||
| 3080 | 3085 | |
| 3081 | 3086 | __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 3082 | 3087 | """ |
| 3083 | - fill_opacity: float | None = None | |
| 3084 | - """The fill opacity (value between [0,1]). | |
| 3085 | - | |
| 3086 | - __Default value:__ `1` | |
| 3087 | - """ | |
| 3088 | 3088 | font: str | None = None |
| 3089 | 3089 | """The typeface to set the text in (e.g., `"Helvetica Neue"`).""" |
| 3090 | 3090 | |
| @@ -3207,8 +3207,8 @@ class TickConfig: | ||
| 3207 | 3207 | dx = from_union([from_float, from_none], obj.get("dx")) |
| 3208 | 3208 | dy = from_union([from_float, from_none], obj.get("dy")) |
| 3209 | 3209 | fill = from_union([from_str, from_none], obj.get("fill")) |
| 3210 | - filled = from_union([from_bool, from_none], obj.get("filled")) | |
| 3211 | 3210 | fill_opacity = from_union([from_float, from_none], obj.get("fillOpacity")) |
| 3211 | + filled = from_union([from_bool, from_none], obj.get("filled")) | |
| 3212 | 3212 | font = from_union([from_str, from_none], obj.get("font")) |
| 3213 | 3213 | font_size = from_union([from_float, from_none], obj.get("fontSize")) |
| 3214 | 3214 | font_style = from_union([FontStyle, from_none], obj.get("fontStyle")) |
| @@ -3230,7 +3230,7 @@ class TickConfig: | ||
| 3230 | 3230 | text = from_union([from_str, from_none], obj.get("text")) |
| 3231 | 3231 | theta = from_union([from_float, from_none], obj.get("theta")) |
| 3232 | 3232 | thickness = from_union([from_float, from_none], obj.get("thickness")) |
| 3233 | - return TickConfig(align, angle, band_size, baseline, color, cursor, dx, dy, fill, filled, fill_opacity, font, font_size, font_style, font_weight, href, interpolate, limit, opacity, orient, radius, shape, size, stroke, stroke_dash, stroke_dash_offset, stroke_opacity, stroke_width, tension, text, theta, thickness) | |
| 3233 | + return TickConfig(align, angle, band_size, baseline, color, cursor, dx, dy, fill, fill_opacity, filled, font, font_size, font_style, font_weight, href, interpolate, limit, opacity, orient, radius, shape, size, stroke, stroke_dash, stroke_dash_offset, stroke_opacity, stroke_width, tension, text, theta, thickness) | |
| 3234 | 3234 | |
| 3235 | 3235 | def to_dict(self) -> dict: |
| 3236 | 3236 | result: dict = {} |
| @@ -3252,10 +3252,10 @@ class TickConfig: | ||
| 3252 | 3252 | result["dy"] = from_union([to_float, from_none], self.dy) |
| 3253 | 3253 | if self.fill is not None: |
| 3254 | 3254 | result["fill"] = from_union([from_str, from_none], self.fill) |
| 3255 | - if self.filled is not None: | |
| 3256 | - result["filled"] = from_union([from_bool, from_none], self.filled) | |
| 3257 | 3255 | if self.fill_opacity is not None: |
| 3258 | 3256 | result["fillOpacity"] = from_union([to_float, from_none], self.fill_opacity) |
| 3257 | + if self.filled is not None: | |
| 3258 | + result["filled"] = from_union([from_bool, from_none], self.filled) | |
| 3259 | 3259 | if self.font is not None: |
| 3260 | 3260 | result["font"] = from_union([from_str, from_none], self.font) |
| 3261 | 3261 | if self.font_size is not None: |
| @@ -5949,12 +5949,12 @@ class Axis: | ||
| 5949 | 5949 | may be different so that values are "nice" (multiples of 2, 5, 10) and lie within the |
| 5950 | 5950 | underlying scale's range. |
| 5951 | 5951 | """ |
| 5952 | - ticks: bool | None = None | |
| 5953 | - """Boolean value that determines whether the axis should include ticks.""" | |
| 5954 | - | |
| 5955 | 5952 | tick_size: float | None = None |
| 5956 | 5953 | """The size in pixels of axis ticks.""" |
| 5957 | 5954 | |
| 5955 | + ticks: bool | None = None | |
| 5956 | + """Boolean value that determines whether the axis should include ticks.""" | |
| 5957 | + | |
| 5958 | 5958 | title: str | None = None |
| 5959 | 5959 | """A title for the field. If `null`, the title will be removed. |
| 5960 | 5960 | |
| @@ -6006,14 +6006,14 @@ class Axis: | ||
| 6006 | 6006 | orient = from_union([TitleOrient, from_none], obj.get("orient")) |
| 6007 | 6007 | position = from_union([from_float, from_none], obj.get("position")) |
| 6008 | 6008 | tick_count = from_union([from_float, from_none], obj.get("tickCount")) |
| 6009 | - ticks = from_union([from_bool, from_none], obj.get("ticks")) | |
| 6010 | 6009 | tick_size = from_union([from_float, from_none], obj.get("tickSize")) |
| 6010 | + ticks = from_union([from_bool, from_none], obj.get("ticks")) | |
| 6011 | 6011 | title = from_union([from_none, from_str], obj.get("title")) |
| 6012 | 6012 | title_max_length = from_union([from_float, from_none], obj.get("titleMaxLength")) |
| 6013 | 6013 | title_padding = from_union([from_float, from_none], obj.get("titlePadding")) |
| 6014 | 6014 | values = from_union([lambda x: from_list(lambda x: from_union([from_float, DateTime.from_dict], x), x), from_none], obj.get("values")) |
| 6015 | 6015 | zindex = from_union([from_float, from_none], obj.get("zindex")) |
| 6016 | - return Axis(domain, format, grid, label_angle, label_bound, label_flush, label_overlap, label_padding, labels, max_extent, min_extent, offset, orient, position, tick_count, ticks, tick_size, title, title_max_length, title_padding, values, zindex) | |
| 6016 | + return Axis(domain, format, grid, label_angle, label_bound, label_flush, label_overlap, label_padding, labels, max_extent, min_extent, offset, orient, position, tick_count, tick_size, ticks, title, title_max_length, title_padding, values, zindex) | |
| 6017 | 6017 | |
| 6018 | 6018 | def to_dict(self) -> dict: |
| 6019 | 6019 | result: dict = {} |
| @@ -6047,10 +6047,10 @@ class Axis: | ||
| 6047 | 6047 | result["position"] = from_union([to_float, from_none], self.position) |
| 6048 | 6048 | if self.tick_count is not None: |
| 6049 | 6049 | result["tickCount"] = from_union([to_float, from_none], self.tick_count) |
| 6050 | - if self.ticks is not None: | |
| 6051 | - result["ticks"] = from_union([from_bool, from_none], self.ticks) | |
| 6052 | 6050 | if self.tick_size is not None: |
| 6053 | 6051 | result["tickSize"] = from_union([to_float, from_none], self.tick_size) |
| 6052 | + if self.ticks is not None: | |
| 6053 | + result["ticks"] = from_union([from_bool, from_none], self.ticks) | |
| 6054 | 6054 | if self.title is not None: |
| 6055 | 6055 | result["title"] = from_union([from_none, from_str], self.title) |
| 6056 | 6056 | if self.title_max_length is not None: |
| @@ -6618,6 +6618,11 @@ class MarkDef: | ||
| 6618 | 6618 | |
| 6619 | 6619 | __Default value:__ (None) |
| 6620 | 6620 | """ |
| 6621 | + fill_opacity: float | None = None | |
| 6622 | + """The fill opacity (value between [0,1]). | |
| 6623 | + | |
| 6624 | + __Default value:__ `1` | |
| 6625 | + """ | |
| 6621 | 6626 | filled: bool | None = None |
| 6622 | 6627 | """Whether the mark's color should be used as fill color instead of stroke color. |
| 6623 | 6628 | |
| @@ -6627,11 +6632,6 @@ class MarkDef: | ||
| 6627 | 6632 | |
| 6628 | 6633 | __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 6629 | 6634 | """ |
| 6630 | - fill_opacity: float | None = None | |
| 6631 | - """The fill opacity (value between [0,1]). | |
| 6632 | - | |
| 6633 | - __Default value:__ `1` | |
| 6634 | - """ | |
| 6635 | 6635 | font: str | None = None |
| 6636 | 6636 | """The typeface to set the text in (e.g., `"Helvetica Neue"`).""" |
| 6637 | 6637 | |
| @@ -6763,8 +6763,8 @@ class MarkDef: | ||
| 6763 | 6763 | dx = from_union([from_float, from_none], obj.get("dx")) |
| 6764 | 6764 | dy = from_union([from_float, from_none], obj.get("dy")) |
| 6765 | 6765 | fill = from_union([from_str, from_none], obj.get("fill")) |
| 6766 | - filled = from_union([from_bool, from_none], obj.get("filled")) | |
| 6767 | 6766 | fill_opacity = from_union([from_float, from_none], obj.get("fillOpacity")) |
| 6767 | + filled = from_union([from_bool, from_none], obj.get("filled")) | |
| 6768 | 6768 | font = from_union([from_str, from_none], obj.get("font")) |
| 6769 | 6769 | font_size = from_union([from_float, from_none], obj.get("fontSize")) |
| 6770 | 6770 | font_style = from_union([FontStyle, from_none], obj.get("fontStyle")) |
| @@ -6786,7 +6786,7 @@ class MarkDef: | ||
| 6786 | 6786 | tension = from_union([from_float, from_none], obj.get("tension")) |
| 6787 | 6787 | text = from_union([from_str, from_none], obj.get("text")) |
| 6788 | 6788 | theta = from_union([from_float, from_none], obj.get("theta")) |
| 6789 | - return MarkDef(type, align, angle, baseline, clip, color, cursor, dx, dy, fill, filled, fill_opacity, font, font_size, font_style, font_weight, href, interpolate, limit, opacity, orient, radius, shape, size, stroke, stroke_dash, stroke_dash_offset, stroke_opacity, stroke_width, style, tension, text, theta) | |
| 6789 | + return MarkDef(type, align, angle, baseline, clip, color, cursor, dx, dy, fill, fill_opacity, filled, font, font_size, font_style, font_weight, href, interpolate, limit, opacity, orient, radius, shape, size, stroke, stroke_dash, stroke_dash_offset, stroke_opacity, stroke_width, style, tension, text, theta) | |
| 6790 | 6790 | |
| 6791 | 6791 | def to_dict(self) -> dict: |
| 6792 | 6792 | result: dict = {} |
| @@ -6809,10 +6809,10 @@ class MarkDef: | ||
| 6809 | 6809 | result["dy"] = from_union([to_float, from_none], self.dy) |
| 6810 | 6810 | if self.fill is not None: |
| 6811 | 6811 | result["fill"] = from_union([from_str, from_none], self.fill) |
| 6812 | - if self.filled is not None: | |
| 6813 | - result["filled"] = from_union([from_bool, from_none], self.filled) | |
| 6814 | 6812 | if self.fill_opacity is not None: |
| 6815 | 6813 | result["fillOpacity"] = from_union([to_float, from_none], self.fill_opacity) |
| 6814 | + if self.filled is not None: | |
| 6815 | + result["filled"] = from_union([from_bool, from_none], self.filled) | |
| 6816 | 6816 | if self.font is not None: |
| 6817 | 6817 | result["font"] = from_union([from_str, from_none], self.font) |
| 6818 | 6818 | if self.font_size is not None: |
Mschema-rubydefault / TopLevel.rb+50 −50
| @@ -386,6 +386,11 @@ class MarkConfig < Dry::Struct | ||
| 386 | 386 | # __Default value:__ (None) |
| 387 | 387 | attribute :fill, Types::String.optional |
| 388 | 388 | |
| 389 | + # The fill opacity (value between [0,1]). | |
| 390 | + # | |
| 391 | + # __Default value:__ `1` | |
| 392 | + attribute :fill_opacity, Types::Double.optional | |
| 393 | + | |
| 389 | 394 | # Whether the mark's color should be used as fill color instead of stroke color. |
| 390 | 395 | # |
| 391 | 396 | # __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -395,11 +400,6 @@ class MarkConfig < Dry::Struct | ||
| 395 | 400 | # __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 396 | 401 | attribute :filled, Types::Bool.optional |
| 397 | 402 | |
| 398 | - # The fill opacity (value between [0,1]). | |
| 399 | - # | |
| 400 | - # __Default value:__ `1` | |
| 401 | - attribute :fill_opacity, Types::Double.optional | |
| 402 | - | |
| 403 | 403 | # The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 404 | 404 | attribute :font, Types::String.optional |
| 405 | 405 | |
| @@ -515,8 +515,8 @@ class MarkConfig < Dry::Struct | ||
| 515 | 515 | dx: d["dx"], |
| 516 | 516 | dy: d["dy"], |
| 517 | 517 | fill: d["fill"], |
| 518 | - filled: d["filled"], | |
| 519 | 518 | fill_opacity: d["fillOpacity"], |
| 519 | + filled: d["filled"], | |
| 520 | 520 | font: d["font"], |
| 521 | 521 | font_size: d["fontSize"], |
| 522 | 522 | font_style: d["fontStyle"], |
| @@ -554,8 +554,8 @@ class MarkConfig < Dry::Struct | ||
| 554 | 554 | "dx" => dx, |
| 555 | 555 | "dy" => dy, |
| 556 | 556 | "fill" => fill, |
| 557 | - "filled" => filled, | |
| 558 | 557 | "fillOpacity" => fill_opacity, |
| 558 | + "filled" => filled, | |
| 559 | 559 | "font" => font, |
| 560 | 560 | "fontSize" => font_size, |
| 561 | 561 | "fontStyle" => font_style, |
| @@ -826,15 +826,15 @@ class AxisConfig < Dry::Struct | ||
| 826 | 826 | # Boolean flag indicating if pixel position values should be rounded to the nearest integer. |
| 827 | 827 | attribute :tick_round, Types::Bool.optional |
| 828 | 828 | |
| 829 | - # Boolean value that determines whether the axis should include ticks. | |
| 830 | - attribute :ticks, Types::Bool.optional | |
| 831 | - | |
| 832 | 829 | # The size in pixels of axis ticks. |
| 833 | 830 | attribute :tick_size, Types::Double.optional |
| 834 | 831 | |
| 835 | 832 | # The width, in pixels, of ticks. |
| 836 | 833 | attribute :tick_width, Types::Double.optional |
| 837 | 834 | |
| 835 | + # Boolean value that determines whether the axis should include ticks. | |
| 836 | + attribute :ticks, Types::Bool.optional | |
| 837 | + | |
| 838 | 838 | # Horizontal text alignment of axis titles. |
| 839 | 839 | attribute :title_align, Types::String.optional |
| 840 | 840 | |
| @@ -899,9 +899,9 @@ class AxisConfig < Dry::Struct | ||
| 899 | 899 | short_time_labels: d["shortTimeLabels"], |
| 900 | 900 | tick_color: d["tickColor"], |
| 901 | 901 | tick_round: d["tickRound"], |
| 902 | - ticks: d["ticks"], | |
| 903 | 902 | tick_size: d["tickSize"], |
| 904 | 903 | tick_width: d["tickWidth"], |
| 904 | + ticks: d["ticks"], | |
| 905 | 905 | title_align: d["titleAlign"], |
| 906 | 906 | title_angle: d["titleAngle"], |
| 907 | 907 | title_baseline: d["titleBaseline"], |
| @@ -947,9 +947,9 @@ class AxisConfig < Dry::Struct | ||
| 947 | 947 | "shortTimeLabels" => short_time_labels, |
| 948 | 948 | "tickColor" => tick_color, |
| 949 | 949 | "tickRound" => tick_round, |
| 950 | - "ticks" => ticks, | |
| 951 | 950 | "tickSize" => tick_size, |
| 952 | 951 | "tickWidth" => tick_width, |
| 952 | + "ticks" => ticks, | |
| 953 | 953 | "titleAlign" => title_align, |
| 954 | 954 | "titleAngle" => title_angle, |
| 955 | 955 | "titleBaseline" => title_baseline, |
| @@ -1099,15 +1099,15 @@ class VGAxisConfig < Dry::Struct | ||
| 1099 | 1099 | # Boolean flag indicating if pixel position values should be rounded to the nearest integer. |
| 1100 | 1100 | attribute :tick_round, Types::Bool.optional |
| 1101 | 1101 | |
| 1102 | - # Boolean value that determines whether the axis should include ticks. | |
| 1103 | - attribute :ticks, Types::Bool.optional | |
| 1104 | - | |
| 1105 | 1102 | # The size in pixels of axis ticks. |
| 1106 | 1103 | attribute :tick_size, Types::Double.optional |
| 1107 | 1104 | |
| 1108 | 1105 | # The width, in pixels, of ticks. |
| 1109 | 1106 | attribute :tick_width, Types::Double.optional |
| 1110 | 1107 | |
| 1108 | + # Boolean value that determines whether the axis should include ticks. | |
| 1109 | + attribute :ticks, Types::Bool.optional | |
| 1110 | + | |
| 1111 | 1111 | # Horizontal text alignment of axis titles. |
| 1112 | 1112 | attribute :title_align, Types::String.optional |
| 1113 | 1113 | |
| @@ -1171,9 +1171,9 @@ class VGAxisConfig < Dry::Struct | ||
| 1171 | 1171 | min_extent: d["minExtent"], |
| 1172 | 1172 | tick_color: d["tickColor"], |
| 1173 | 1173 | tick_round: d["tickRound"], |
| 1174 | - ticks: d["ticks"], | |
| 1175 | 1174 | tick_size: d["tickSize"], |
| 1176 | 1175 | tick_width: d["tickWidth"], |
| 1176 | + ticks: d["ticks"], | |
| 1177 | 1177 | title_align: d["titleAlign"], |
| 1178 | 1178 | title_angle: d["titleAngle"], |
| 1179 | 1179 | title_baseline: d["titleBaseline"], |
| @@ -1218,9 +1218,9 @@ class VGAxisConfig < Dry::Struct | ||
| 1218 | 1218 | "minExtent" => min_extent, |
| 1219 | 1219 | "tickColor" => tick_color, |
| 1220 | 1220 | "tickRound" => tick_round, |
| 1221 | - "ticks" => ticks, | |
| 1222 | 1221 | "tickSize" => tick_size, |
| 1223 | 1222 | "tickWidth" => tick_width, |
| 1223 | + "ticks" => ticks, | |
| 1224 | 1224 | "titleAlign" => title_align, |
| 1225 | 1225 | "titleAngle" => title_angle, |
| 1226 | 1226 | "titleBaseline" => title_baseline, |
| @@ -1295,6 +1295,11 @@ class BarConfig < Dry::Struct | ||
| 1295 | 1295 | # __Default value:__ (None) |
| 1296 | 1296 | attribute :fill, Types::String.optional |
| 1297 | 1297 | |
| 1298 | + # The fill opacity (value between [0,1]). | |
| 1299 | + # | |
| 1300 | + # __Default value:__ `1` | |
| 1301 | + attribute :fill_opacity, Types::Double.optional | |
| 1302 | + | |
| 1298 | 1303 | # Whether the mark's color should be used as fill color instead of stroke color. |
| 1299 | 1304 | # |
| 1300 | 1305 | # __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -1304,11 +1309,6 @@ class BarConfig < Dry::Struct | ||
| 1304 | 1309 | # __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 1305 | 1310 | attribute :filled, Types::Bool.optional |
| 1306 | 1311 | |
| 1307 | - # The fill opacity (value between [0,1]). | |
| 1308 | - # | |
| 1309 | - # __Default value:__ `1` | |
| 1310 | - attribute :fill_opacity, Types::Double.optional | |
| 1311 | - | |
| 1312 | 1312 | # The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1313 | 1313 | attribute :font, Types::String.optional |
| 1314 | 1314 | |
| @@ -1427,8 +1427,8 @@ class BarConfig < Dry::Struct | ||
| 1427 | 1427 | dx: d["dx"], |
| 1428 | 1428 | dy: d["dy"], |
| 1429 | 1429 | fill: d["fill"], |
| 1430 | - filled: d["filled"], | |
| 1431 | 1430 | fill_opacity: d["fillOpacity"], |
| 1431 | + filled: d["filled"], | |
| 1432 | 1432 | font: d["font"], |
| 1433 | 1433 | font_size: d["fontSize"], |
| 1434 | 1434 | font_style: d["fontStyle"], |
| @@ -1469,8 +1469,8 @@ class BarConfig < Dry::Struct | ||
| 1469 | 1469 | "dx" => dx, |
| 1470 | 1470 | "dy" => dy, |
| 1471 | 1471 | "fill" => fill, |
| 1472 | - "filled" => filled, | |
| 1473 | 1472 | "fillOpacity" => fill_opacity, |
| 1473 | + "filled" => filled, | |
| 1474 | 1474 | "font" => font, |
| 1475 | 1475 | "fontSize" => font_size, |
| 1476 | 1476 | "fontStyle" => font_style, |
| @@ -2973,6 +2973,11 @@ class TextConfig < Dry::Struct | ||
| 2973 | 2973 | # __Default value:__ (None) |
| 2974 | 2974 | attribute :fill, Types::String.optional |
| 2975 | 2975 | |
| 2976 | + # The fill opacity (value between [0,1]). | |
| 2977 | + # | |
| 2978 | + # __Default value:__ `1` | |
| 2979 | + attribute :fill_opacity, Types::Double.optional | |
| 2980 | + | |
| 2976 | 2981 | # Whether the mark's color should be used as fill color instead of stroke color. |
| 2977 | 2982 | # |
| 2978 | 2983 | # __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -2982,11 +2987,6 @@ class TextConfig < Dry::Struct | ||
| 2982 | 2987 | # __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 2983 | 2988 | attribute :filled, Types::Bool.optional |
| 2984 | 2989 | |
| 2985 | - # The fill opacity (value between [0,1]). | |
| 2986 | - # | |
| 2987 | - # __Default value:__ `1` | |
| 2988 | - attribute :fill_opacity, Types::Double.optional | |
| 2989 | - | |
| 2990 | 2990 | # The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 2991 | 2991 | attribute :font, Types::String.optional |
| 2992 | 2992 | |
| @@ -3105,8 +3105,8 @@ class TextConfig < Dry::Struct | ||
| 3105 | 3105 | dx: d["dx"], |
| 3106 | 3106 | dy: d["dy"], |
| 3107 | 3107 | fill: d["fill"], |
| 3108 | - filled: d["filled"], | |
| 3109 | 3108 | fill_opacity: d["fillOpacity"], |
| 3109 | + filled: d["filled"], | |
| 3110 | 3110 | font: d["font"], |
| 3111 | 3111 | font_size: d["fontSize"], |
| 3112 | 3112 | font_style: d["fontStyle"], |
| @@ -3145,8 +3145,8 @@ class TextConfig < Dry::Struct | ||
| 3145 | 3145 | "dx" => dx, |
| 3146 | 3146 | "dy" => dy, |
| 3147 | 3147 | "fill" => fill, |
| 3148 | - "filled" => filled, | |
| 3149 | 3148 | "fillOpacity" => fill_opacity, |
| 3149 | + "filled" => filled, | |
| 3150 | 3150 | "font" => font, |
| 3151 | 3151 | "fontSize" => font_size, |
| 3152 | 3152 | "fontStyle" => font_style, |
| @@ -3220,6 +3220,11 @@ class TickConfig < Dry::Struct | ||
| 3220 | 3220 | # __Default value:__ (None) |
| 3221 | 3221 | attribute :fill, Types::String.optional |
| 3222 | 3222 | |
| 3223 | + # The fill opacity (value between [0,1]). | |
| 3224 | + # | |
| 3225 | + # __Default value:__ `1` | |
| 3226 | + attribute :fill_opacity, Types::Double.optional | |
| 3227 | + | |
| 3223 | 3228 | # Whether the mark's color should be used as fill color instead of stroke color. |
| 3224 | 3229 | # |
| 3225 | 3230 | # __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -3229,11 +3234,6 @@ class TickConfig < Dry::Struct | ||
| 3229 | 3234 | # __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 3230 | 3235 | attribute :filled, Types::Bool.optional |
| 3231 | 3236 | |
| 3232 | - # The fill opacity (value between [0,1]). | |
| 3233 | - # | |
| 3234 | - # __Default value:__ `1` | |
| 3235 | - attribute :fill_opacity, Types::Double.optional | |
| 3236 | - | |
| 3237 | 3237 | # The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3238 | 3238 | attribute :font, Types::String.optional |
| 3239 | 3239 | |
| @@ -3355,8 +3355,8 @@ class TickConfig < Dry::Struct | ||
| 3355 | 3355 | dx: d["dx"], |
| 3356 | 3356 | dy: d["dy"], |
| 3357 | 3357 | fill: d["fill"], |
| 3358 | - filled: d["filled"], | |
| 3359 | 3358 | fill_opacity: d["fillOpacity"], |
| 3359 | + filled: d["filled"], | |
| 3360 | 3360 | font: d["font"], |
| 3361 | 3361 | font_size: d["fontSize"], |
| 3362 | 3362 | font_style: d["fontStyle"], |
| @@ -3396,8 +3396,8 @@ class TickConfig < Dry::Struct | ||
| 3396 | 3396 | "dx" => dx, |
| 3397 | 3397 | "dy" => dy, |
| 3398 | 3398 | "fill" => fill, |
| 3399 | - "filled" => filled, | |
| 3400 | 3399 | "fillOpacity" => fill_opacity, |
| 3400 | + "filled" => filled, | |
| 3401 | 3401 | "font" => font, |
| 3402 | 3402 | "fontSize" => font_size, |
| 3403 | 3403 | "fontStyle" => font_style, |
| @@ -7184,12 +7184,12 @@ class Axis < Dry::Struct | ||
| 7184 | 7184 | # underlying scale's range. |
| 7185 | 7185 | attribute :tick_count, Types::Double.optional |
| 7186 | 7186 | |
| 7187 | - # Boolean value that determines whether the axis should include ticks. | |
| 7188 | - attribute :ticks, Types::Bool.optional | |
| 7189 | - | |
| 7190 | 7187 | # The size in pixels of axis ticks. |
| 7191 | 7188 | attribute :tick_size, Types::Double.optional |
| 7192 | 7189 | |
| 7190 | + # Boolean value that determines whether the axis should include ticks. | |
| 7191 | + attribute :ticks, Types::Bool.optional | |
| 7192 | + | |
| 7193 | 7193 | # A title for the field. If `null`, the title will be removed. |
| 7194 | 7194 | # |
| 7195 | 7195 | # __Default value:__ derived from the field's name and transformation function |
| @@ -7240,8 +7240,8 @@ class Axis < Dry::Struct | ||
| 7240 | 7240 | orient: d["orient"], |
| 7241 | 7241 | position: d["position"], |
| 7242 | 7242 | tick_count: d["tickCount"], |
| 7243 | - ticks: d["ticks"], | |
| 7244 | 7243 | tick_size: d["tickSize"], |
| 7244 | + ticks: d["ticks"], | |
| 7245 | 7245 | title: d["title"], |
| 7246 | 7246 | title_max_length: d["titleMaxLength"], |
| 7247 | 7247 | title_padding: d["titlePadding"], |
| @@ -7271,8 +7271,8 @@ class Axis < Dry::Struct | ||
| 7271 | 7271 | "orient" => orient, |
| 7272 | 7272 | "position" => position, |
| 7273 | 7273 | "tickCount" => tick_count, |
| 7274 | - "ticks" => ticks, | |
| 7275 | 7274 | "tickSize" => tick_size, |
| 7275 | + "ticks" => ticks, | |
| 7276 | 7276 | "title" => title, |
| 7277 | 7277 | "titleMaxLength" => title_max_length, |
| 7278 | 7278 | "titlePadding" => title_padding, |
| @@ -7877,6 +7877,11 @@ class MarkDef < Dry::Struct | ||
| 7877 | 7877 | # __Default value:__ (None) |
| 7878 | 7878 | attribute :fill, Types::String.optional |
| 7879 | 7879 | |
| 7880 | + # The fill opacity (value between [0,1]). | |
| 7881 | + # | |
| 7882 | + # __Default value:__ `1` | |
| 7883 | + attribute :fill_opacity, Types::Double.optional | |
| 7884 | + | |
| 7880 | 7885 | # Whether the mark's color should be used as fill color instead of stroke color. |
| 7881 | 7886 | # |
| 7882 | 7887 | # __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -7886,11 +7891,6 @@ class MarkDef < Dry::Struct | ||
| 7886 | 7891 | # __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 7887 | 7892 | attribute :filled, Types::Bool.optional |
| 7888 | 7893 | |
| 7889 | - # The fill opacity (value between [0,1]). | |
| 7890 | - # | |
| 7891 | - # __Default value:__ `1` | |
| 7892 | - attribute :fill_opacity, Types::Double.optional | |
| 7893 | - | |
| 7894 | 7894 | # The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 7895 | 7895 | attribute :font, Types::String.optional |
| 7896 | 7896 | |
| @@ -8025,8 +8025,8 @@ class MarkDef < Dry::Struct | ||
| 8025 | 8025 | dx: d["dx"], |
| 8026 | 8026 | dy: d["dy"], |
| 8027 | 8027 | fill: d["fill"], |
| 8028 | - filled: d["filled"], | |
| 8029 | 8028 | fill_opacity: d["fillOpacity"], |
| 8029 | + filled: d["filled"], | |
| 8030 | 8030 | font: d["font"], |
| 8031 | 8031 | font_size: d["fontSize"], |
| 8032 | 8032 | font_style: d["fontStyle"], |
| @@ -8067,8 +8067,8 @@ class MarkDef < Dry::Struct | ||
| 8067 | 8067 | "dx" => dx, |
| 8068 | 8068 | "dy" => dy, |
| 8069 | 8069 | "fill" => fill, |
| 8070 | - "filled" => filled, | |
| 8071 | 8070 | "fillOpacity" => fill_opacity, |
| 8071 | + "filled" => filled, | |
| 8072 | 8072 | "font" => font, |
| 8073 | 8073 | "fontSize" => font_size, |
| 8074 | 8074 | "fontStyle" => font_style, |
Mschema-rustdefault / module_under_test.rs+34 −34
| @@ -448,6 +448,11 @@ pub struct MarkConfig { | ||
| 448 | 448 | /// __Default value:__ (None) |
| 449 | 449 | pub fill: Option<String>, |
| 450 | 450 | |
| 451 | + /// The fill opacity (value between [0,1]). | |
| 452 | + /// | |
| 453 | + /// __Default value:__ `1` | |
| 454 | + pub fill_opacity: Option<f64>, | |
| 455 | + | |
| 451 | 456 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 452 | 457 | /// |
| 453 | 458 | /// __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -457,11 +462,6 @@ pub struct MarkConfig { | ||
| 457 | 462 | /// __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 458 | 463 | pub filled: Option<bool>, |
| 459 | 464 | |
| 460 | - /// The fill opacity (value between [0,1]). | |
| 461 | - /// | |
| 462 | - /// __Default value:__ `1` | |
| 463 | - pub fill_opacity: Option<f64>, | |
| 464 | - | |
| 465 | 465 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 466 | 466 | pub font: Option<String>, |
| 467 | 467 | |
| @@ -918,15 +918,15 @@ pub struct AxisConfig { | ||
| 918 | 918 | /// Boolean flag indicating if pixel position values should be rounded to the nearest integer. |
| 919 | 919 | pub tick_round: Option<bool>, |
| 920 | 920 | |
| 921 | - /// Boolean value that determines whether the axis should include ticks. | |
| 922 | - pub ticks: Option<bool>, | |
| 923 | - | |
| 924 | 921 | /// The size in pixels of axis ticks. |
| 925 | 922 | pub tick_size: Option<f64>, |
| 926 | 923 | |
| 927 | 924 | /// The width, in pixels, of ticks. |
| 928 | 925 | pub tick_width: Option<f64>, |
| 929 | 926 | |
| 927 | + /// Boolean value that determines whether the axis should include ticks. | |
| 928 | + pub ticks: Option<bool>, | |
| 929 | + | |
| 930 | 930 | /// Horizontal text alignment of axis titles. |
| 931 | 931 | pub title_align: Option<String>, |
| 932 | 932 | |
| @@ -1147,15 +1147,15 @@ pub struct VgAxisConfig { | ||
| 1147 | 1147 | /// Boolean flag indicating if pixel position values should be rounded to the nearest integer. |
| 1148 | 1148 | pub tick_round: Option<bool>, |
| 1149 | 1149 | |
| 1150 | - /// Boolean value that determines whether the axis should include ticks. | |
| 1151 | - pub ticks: Option<bool>, | |
| 1152 | - | |
| 1153 | 1150 | /// The size in pixels of axis ticks. |
| 1154 | 1151 | pub tick_size: Option<f64>, |
| 1155 | 1152 | |
| 1156 | 1153 | /// The width, in pixels, of ticks. |
| 1157 | 1154 | pub tick_width: Option<f64>, |
| 1158 | 1155 | |
| 1156 | + /// Boolean value that determines whether the axis should include ticks. | |
| 1157 | + pub ticks: Option<bool>, | |
| 1158 | + | |
| 1159 | 1159 | /// Horizontal text alignment of axis titles. |
| 1160 | 1160 | pub title_align: Option<String>, |
| 1161 | 1161 | |
| @@ -1249,6 +1249,11 @@ pub struct BarConfig { | ||
| 1249 | 1249 | /// __Default value:__ (None) |
| 1250 | 1250 | pub fill: Option<String>, |
| 1251 | 1251 | |
| 1252 | + /// The fill opacity (value between [0,1]). | |
| 1253 | + /// | |
| 1254 | + /// __Default value:__ `1` | |
| 1255 | + pub fill_opacity: Option<f64>, | |
| 1256 | + | |
| 1252 | 1257 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 1253 | 1258 | /// |
| 1254 | 1259 | /// __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -1258,11 +1263,6 @@ pub struct BarConfig { | ||
| 1258 | 1263 | /// __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 1259 | 1264 | pub filled: Option<bool>, |
| 1260 | 1265 | |
| 1261 | - /// The fill opacity (value between [0,1]). | |
| 1262 | - /// | |
| 1263 | - /// __Default value:__ `1` | |
| 1264 | - pub fill_opacity: Option<f64>, | |
| 1265 | - | |
| 1266 | 1266 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1267 | 1267 | pub font: Option<String>, |
| 1268 | 1268 | |
| @@ -2349,6 +2349,11 @@ pub struct TextConfig { | ||
| 2349 | 2349 | /// __Default value:__ (None) |
| 2350 | 2350 | pub fill: Option<String>, |
| 2351 | 2351 | |
| 2352 | + /// The fill opacity (value between [0,1]). | |
| 2353 | + /// | |
| 2354 | + /// __Default value:__ `1` | |
| 2355 | + pub fill_opacity: Option<f64>, | |
| 2356 | + | |
| 2352 | 2357 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 2353 | 2358 | /// |
| 2354 | 2359 | /// __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -2358,11 +2363,6 @@ pub struct TextConfig { | ||
| 2358 | 2363 | /// __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 2359 | 2364 | pub filled: Option<bool>, |
| 2360 | 2365 | |
| 2361 | - /// The fill opacity (value between [0,1]). | |
| 2362 | - /// | |
| 2363 | - /// __Default value:__ `1` | |
| 2364 | - pub fill_opacity: Option<f64>, | |
| 2365 | - | |
| 2366 | 2366 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 2367 | 2367 | pub font: Option<String>, |
| 2368 | 2368 | |
| @@ -2516,6 +2516,11 @@ pub struct TickConfig { | ||
| 2516 | 2516 | /// __Default value:__ (None) |
| 2517 | 2517 | pub fill: Option<String>, |
| 2518 | 2518 | |
| 2519 | + /// The fill opacity (value between [0,1]). | |
| 2520 | + /// | |
| 2521 | + /// __Default value:__ `1` | |
| 2522 | + pub fill_opacity: Option<f64>, | |
| 2523 | + | |
| 2519 | 2524 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 2520 | 2525 | /// |
| 2521 | 2526 | /// __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -2525,11 +2530,6 @@ pub struct TickConfig { | ||
| 2525 | 2530 | /// __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 2526 | 2531 | pub filled: Option<bool>, |
| 2527 | 2532 | |
| 2528 | - /// The fill opacity (value between [0,1]). | |
| 2529 | - /// | |
| 2530 | - /// __Default value:__ `1` | |
| 2531 | - pub fill_opacity: Option<f64>, | |
| 2532 | - | |
| 2533 | 2533 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 2534 | 2534 | pub font: Option<String>, |
| 2535 | 2535 | |
| @@ -4929,12 +4929,12 @@ pub struct Axis { | ||
| 4929 | 4929 | /// underlying scale's range. |
| 4930 | 4930 | pub tick_count: Option<f64>, |
| 4931 | 4931 | |
| 4932 | - /// Boolean value that determines whether the axis should include ticks. | |
| 4933 | - pub ticks: Option<bool>, | |
| 4934 | - | |
| 4935 | 4932 | /// The size in pixels of axis ticks. |
| 4936 | 4933 | pub tick_size: Option<f64>, |
| 4937 | 4934 | |
| 4935 | + /// Boolean value that determines whether the axis should include ticks. | |
| 4936 | + pub ticks: Option<bool>, | |
| 4937 | + | |
| 4938 | 4938 | /// A title for the field. If `null`, the title will be removed. |
| 4939 | 4939 | /// |
| 4940 | 4940 | /// __Default value:__ derived from the field's name and transformation function |
| @@ -5362,6 +5362,11 @@ pub struct MarkDef { | ||
| 5362 | 5362 | /// __Default value:__ (None) |
| 5363 | 5363 | pub fill: Option<String>, |
| 5364 | 5364 | |
| 5365 | + /// The fill opacity (value between [0,1]). | |
| 5366 | + /// | |
| 5367 | + /// __Default value:__ `1` | |
| 5368 | + pub fill_opacity: Option<f64>, | |
| 5369 | + | |
| 5365 | 5370 | /// Whether the mark's color should be used as fill color instead of stroke color. |
| 5366 | 5371 | /// |
| 5367 | 5372 | /// __Default value:__ `true` for all marks except `point` and `false` for `point`. |
| @@ -5371,11 +5376,6 @@ pub struct MarkDef { | ||
| 5371 | 5376 | /// __Note:__ This property cannot be used in a [style config](mark.html#style-config). |
| 5372 | 5377 | pub filled: Option<bool>, |
| 5373 | 5378 | |
| 5374 | - /// The fill opacity (value between [0,1]). | |
| 5375 | - /// | |
| 5376 | - /// __Default value:__ `1` | |
| 5377 | - pub fill_opacity: Option<f64>, | |
| 5378 | - | |
| 5379 | 5379 | /// The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 5380 | 5380 | pub font: Option<String>, |
Mschema-scala3-upickledefault / TopLevel.scala+49 −49
| @@ -665,6 +665,13 @@ case class MarkConfig ( | ||
| 665 | 665 | */ |
| 666 | 666 | val fill : Option[String] = None, |
| 667 | 667 | |
| 668 | + /** | |
| 669 | + * The fill opacity (value between [0,1]). | |
| 670 | + * | |
| 671 | + * __Default value:__ `1` | |
| 672 | + */ | |
| 673 | + val fillOpacity : Option[Double] = None, | |
| 674 | + | |
| 668 | 675 | /** |
| 669 | 676 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 670 | 677 | * |
| @@ -676,13 +683,6 @@ case class MarkConfig ( | ||
| 676 | 683 | */ |
| 677 | 684 | val filled : Option[Boolean] = None, |
| 678 | 685 | |
| 679 | - /** | |
| 680 | - * The fill opacity (value between [0,1]). | |
| 681 | - * | |
| 682 | - * __Default value:__ `1` | |
| 683 | - */ | |
| 684 | - val fillOpacity : Option[Double] = None, | |
| 685 | - | |
| 686 | 686 | /** |
| 687 | 687 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 688 | 688 | */ |
| @@ -1325,11 +1325,6 @@ case class AxisConfig ( | ||
| 1325 | 1325 | */ |
| 1326 | 1326 | val tickRound : Option[Boolean] = None, |
| 1327 | 1327 | |
| 1328 | - /** | |
| 1329 | - * Boolean value that determines whether the axis should include ticks. | |
| 1330 | - */ | |
| 1331 | - val ticks : Option[Boolean] = None, | |
| 1332 | - | |
| 1333 | 1328 | /** |
| 1334 | 1329 | * The size in pixels of axis ticks. |
| 1335 | 1330 | */ |
| @@ -1340,6 +1335,11 @@ case class AxisConfig ( | ||
| 1340 | 1335 | */ |
| 1341 | 1336 | val tickWidth : Option[Double] = None, |
| 1342 | 1337 | |
| 1338 | + /** | |
| 1339 | + * Boolean value that determines whether the axis should include ticks. | |
| 1340 | + */ | |
| 1341 | + val ticks : Option[Boolean] = None, | |
| 1342 | + | |
| 1343 | 1343 | /** |
| 1344 | 1344 | * Horizontal text alignment of axis titles. |
| 1345 | 1345 | */ |
| @@ -1654,11 +1654,6 @@ case class VGAxisConfig ( | ||
| 1654 | 1654 | */ |
| 1655 | 1655 | val tickRound : Option[Boolean] = None, |
| 1656 | 1656 | |
| 1657 | - /** | |
| 1658 | - * Boolean value that determines whether the axis should include ticks. | |
| 1659 | - */ | |
| 1660 | - val ticks : Option[Boolean] = None, | |
| 1661 | - | |
| 1662 | 1657 | /** |
| 1663 | 1658 | * The size in pixels of axis ticks. |
| 1664 | 1659 | */ |
| @@ -1669,6 +1664,11 @@ case class VGAxisConfig ( | ||
| 1669 | 1664 | */ |
| 1670 | 1665 | val tickWidth : Option[Double] = None, |
| 1671 | 1666 | |
| 1667 | + /** | |
| 1668 | + * Boolean value that determines whether the axis should include ticks. | |
| 1669 | + */ | |
| 1670 | + val ticks : Option[Boolean] = None, | |
| 1671 | + | |
| 1672 | 1672 | /** |
| 1673 | 1673 | * Horizontal text alignment of axis titles. |
| 1674 | 1674 | */ |
| @@ -1808,6 +1808,13 @@ case class BarConfig ( | ||
| 1808 | 1808 | */ |
| 1809 | 1809 | val fill : Option[String] = None, |
| 1810 | 1810 | |
| 1811 | + /** | |
| 1812 | + * The fill opacity (value between [0,1]). | |
| 1813 | + * | |
| 1814 | + * __Default value:__ `1` | |
| 1815 | + */ | |
| 1816 | + val fillOpacity : Option[Double] = None, | |
| 1817 | + | |
| 1811 | 1818 | /** |
| 1812 | 1819 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 1813 | 1820 | * |
| @@ -1819,13 +1826,6 @@ case class BarConfig ( | ||
| 1819 | 1826 | */ |
| 1820 | 1827 | val filled : Option[Boolean] = None, |
| 1821 | 1828 | |
| 1822 | - /** | |
| 1823 | - * The fill opacity (value between [0,1]). | |
| 1824 | - * | |
| 1825 | - * __Default value:__ `1` | |
| 1826 | - */ | |
| 1827 | - val fillOpacity : Option[Double] = None, | |
| 1828 | - | |
| 1829 | 1829 | /** |
| 1830 | 1830 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1831 | 1831 | */ |
| @@ -3309,6 +3309,13 @@ case class TextConfig ( | ||
| 3309 | 3309 | */ |
| 3310 | 3310 | val fill : Option[String] = None, |
| 3311 | 3311 | |
| 3312 | + /** | |
| 3313 | + * The fill opacity (value between [0,1]). | |
| 3314 | + * | |
| 3315 | + * __Default value:__ `1` | |
| 3316 | + */ | |
| 3317 | + val fillOpacity : Option[Double] = None, | |
| 3318 | + | |
| 3312 | 3319 | /** |
| 3313 | 3320 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 3314 | 3321 | * |
| @@ -3320,13 +3327,6 @@ case class TextConfig ( | ||
| 3320 | 3327 | */ |
| 3321 | 3328 | val filled : Option[Boolean] = None, |
| 3322 | 3329 | |
| 3323 | - /** | |
| 3324 | - * The fill opacity (value between [0,1]). | |
| 3325 | - * | |
| 3326 | - * __Default value:__ `1` | |
| 3327 | - */ | |
| 3328 | - val fillOpacity : Option[Double] = None, | |
| 3329 | - | |
| 3330 | 3330 | /** |
| 3331 | 3331 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3332 | 3332 | */ |
| @@ -3540,6 +3540,13 @@ case class TickConfig ( | ||
| 3540 | 3540 | */ |
| 3541 | 3541 | val fill : Option[String] = None, |
| 3542 | 3542 | |
| 3543 | + /** | |
| 3544 | + * The fill opacity (value between [0,1]). | |
| 3545 | + * | |
| 3546 | + * __Default value:__ `1` | |
| 3547 | + */ | |
| 3548 | + val fillOpacity : Option[Double] = None, | |
| 3549 | + | |
| 3543 | 3550 | /** |
| 3544 | 3551 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 3545 | 3552 | * |
| @@ -3551,13 +3558,6 @@ case class TickConfig ( | ||
| 3551 | 3558 | */ |
| 3552 | 3559 | val filled : Option[Boolean] = None, |
| 3553 | 3560 | |
| 3554 | - /** | |
| 3555 | - * The fill opacity (value between [0,1]). | |
| 3556 | - * | |
| 3557 | - * __Default value:__ `1` | |
| 3558 | - */ | |
| 3559 | - val fillOpacity : Option[Double] = None, | |
| 3560 | - | |
| 3561 | 3561 | /** |
| 3562 | 3562 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3563 | 3563 | */ |
| @@ -6630,14 +6630,14 @@ case class Axis ( | ||
| 6630 | 6630 | val tickCount : Option[Double] = None, |
| 6631 | 6631 | |
| 6632 | 6632 | /** |
| 6633 | - * Boolean value that determines whether the axis should include ticks. | |
| 6633 | + * The size in pixels of axis ticks. | |
| 6634 | 6634 | */ |
| 6635 | - val ticks : Option[Boolean] = None, | |
| 6635 | + val tickSize : Option[Double] = None, | |
| 6636 | 6636 | |
| 6637 | 6637 | /** |
| 6638 | - * The size in pixels of axis ticks. | |
| 6638 | + * Boolean value that determines whether the axis should include ticks. | |
| 6639 | 6639 | */ |
| 6640 | - val tickSize : Option[Double] = None, | |
| 6640 | + val ticks : Option[Boolean] = None, | |
| 6641 | 6641 | |
| 6642 | 6642 | /** |
| 6643 | 6643 | * A title for the field. If `null`, the title will be removed. |
| @@ -7209,6 +7209,13 @@ case class MarkDef ( | ||
| 7209 | 7209 | */ |
| 7210 | 7210 | val fill : Option[String] = None, |
| 7211 | 7211 | |
| 7212 | + /** | |
| 7213 | + * The fill opacity (value between [0,1]). | |
| 7214 | + * | |
| 7215 | + * __Default value:__ `1` | |
| 7216 | + */ | |
| 7217 | + val fillOpacity : Option[Double] = None, | |
| 7218 | + | |
| 7212 | 7219 | /** |
| 7213 | 7220 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 7214 | 7221 | * |
| @@ -7220,13 +7227,6 @@ case class MarkDef ( | ||
| 7220 | 7227 | */ |
| 7221 | 7228 | val filled : Option[Boolean] = None, |
| 7222 | 7229 | |
| 7223 | - /** | |
| 7224 | - * The fill opacity (value between [0,1]). | |
| 7225 | - * | |
| 7226 | - * __Default value:__ `1` | |
| 7227 | - */ | |
| 7228 | - val fillOpacity : Option[Double] = None, | |
| 7229 | - | |
| 7230 | 7230 | /** |
| 7231 | 7231 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 7232 | 7232 | */ |
Mschema-scala3default / TopLevel.scala+49 −49
| @@ -604,6 +604,13 @@ case class MarkConfig ( | ||
| 604 | 604 | */ |
| 605 | 605 | val fill : Option[String] = None, |
| 606 | 606 | |
| 607 | + /** | |
| 608 | + * The fill opacity (value between [0,1]). | |
| 609 | + * | |
| 610 | + * __Default value:__ `1` | |
| 611 | + */ | |
| 612 | + val fillOpacity : Option[Double] = None, | |
| 613 | + | |
| 607 | 614 | /** |
| 608 | 615 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 609 | 616 | * |
| @@ -615,13 +622,6 @@ case class MarkConfig ( | ||
| 615 | 622 | */ |
| 616 | 623 | val filled : Option[Boolean] = None, |
| 617 | 624 | |
| 618 | - /** | |
| 619 | - * The fill opacity (value between [0,1]). | |
| 620 | - * | |
| 621 | - * __Default value:__ `1` | |
| 622 | - */ | |
| 623 | - val fillOpacity : Option[Double] = None, | |
| 624 | - | |
| 625 | 625 | /** |
| 626 | 626 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 627 | 627 | */ |
| @@ -1251,11 +1251,6 @@ case class AxisConfig ( | ||
| 1251 | 1251 | */ |
| 1252 | 1252 | val tickRound : Option[Boolean] = None, |
| 1253 | 1253 | |
| 1254 | - /** | |
| 1255 | - * Boolean value that determines whether the axis should include ticks. | |
| 1256 | - */ | |
| 1257 | - val ticks : Option[Boolean] = None, | |
| 1258 | - | |
| 1259 | 1254 | /** |
| 1260 | 1255 | * The size in pixels of axis ticks. |
| 1261 | 1256 | */ |
| @@ -1266,6 +1261,11 @@ case class AxisConfig ( | ||
| 1266 | 1261 | */ |
| 1267 | 1262 | val tickWidth : Option[Double] = None, |
| 1268 | 1263 | |
| 1264 | + /** | |
| 1265 | + * Boolean value that determines whether the axis should include ticks. | |
| 1266 | + */ | |
| 1267 | + val ticks : Option[Boolean] = None, | |
| 1268 | + | |
| 1269 | 1269 | /** |
| 1270 | 1270 | * Horizontal text alignment of axis titles. |
| 1271 | 1271 | */ |
| @@ -1581,11 +1581,6 @@ case class VGAxisConfig ( | ||
| 1581 | 1581 | */ |
| 1582 | 1582 | val tickRound : Option[Boolean] = None, |
| 1583 | 1583 | |
| 1584 | - /** | |
| 1585 | - * Boolean value that determines whether the axis should include ticks. | |
| 1586 | - */ | |
| 1587 | - val ticks : Option[Boolean] = None, | |
| 1588 | - | |
| 1589 | 1584 | /** |
| 1590 | 1585 | * The size in pixels of axis ticks. |
| 1591 | 1586 | */ |
| @@ -1596,6 +1591,11 @@ case class VGAxisConfig ( | ||
| 1596 | 1591 | */ |
| 1597 | 1592 | val tickWidth : Option[Double] = None, |
| 1598 | 1593 | |
| 1594 | + /** | |
| 1595 | + * Boolean value that determines whether the axis should include ticks. | |
| 1596 | + */ | |
| 1597 | + val ticks : Option[Boolean] = None, | |
| 1598 | + | |
| 1599 | 1599 | /** |
| 1600 | 1600 | * Horizontal text alignment of axis titles. |
| 1601 | 1601 | */ |
| @@ -1735,6 +1735,13 @@ case class BarConfig ( | ||
| 1735 | 1735 | */ |
| 1736 | 1736 | val fill : Option[String] = None, |
| 1737 | 1737 | |
| 1738 | + /** | |
| 1739 | + * The fill opacity (value between [0,1]). | |
| 1740 | + * | |
| 1741 | + * __Default value:__ `1` | |
| 1742 | + */ | |
| 1743 | + val fillOpacity : Option[Double] = None, | |
| 1744 | + | |
| 1738 | 1745 | /** |
| 1739 | 1746 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 1740 | 1747 | * |
| @@ -1746,13 +1753,6 @@ case class BarConfig ( | ||
| 1746 | 1753 | */ |
| 1747 | 1754 | val filled : Option[Boolean] = None, |
| 1748 | 1755 | |
| 1749 | - /** | |
| 1750 | - * The fill opacity (value between [0,1]). | |
| 1751 | - * | |
| 1752 | - * __Default value:__ `1` | |
| 1753 | - */ | |
| 1754 | - val fillOpacity : Option[Double] = None, | |
| 1755 | - | |
| 1756 | 1756 | /** |
| 1757 | 1757 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1758 | 1758 | */ |
| @@ -3221,6 +3221,13 @@ case class TextConfig ( | ||
| 3221 | 3221 | */ |
| 3222 | 3222 | val fill : Option[String] = None, |
| 3223 | 3223 | |
| 3224 | + /** | |
| 3225 | + * The fill opacity (value between [0,1]). | |
| 3226 | + * | |
| 3227 | + * __Default value:__ `1` | |
| 3228 | + */ | |
| 3229 | + val fillOpacity : Option[Double] = None, | |
| 3230 | + | |
| 3224 | 3231 | /** |
| 3225 | 3232 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 3226 | 3233 | * |
| @@ -3232,13 +3239,6 @@ case class TextConfig ( | ||
| 3232 | 3239 | */ |
| 3233 | 3240 | val filled : Option[Boolean] = None, |
| 3234 | 3241 | |
| 3235 | - /** | |
| 3236 | - * The fill opacity (value between [0,1]). | |
| 3237 | - * | |
| 3238 | - * __Default value:__ `1` | |
| 3239 | - */ | |
| 3240 | - val fillOpacity : Option[Double] = None, | |
| 3241 | - | |
| 3242 | 3242 | /** |
| 3243 | 3243 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3244 | 3244 | */ |
| @@ -3452,6 +3452,13 @@ case class TickConfig ( | ||
| 3452 | 3452 | */ |
| 3453 | 3453 | val fill : Option[String] = None, |
| 3454 | 3454 | |
| 3455 | + /** | |
| 3456 | + * The fill opacity (value between [0,1]). | |
| 3457 | + * | |
| 3458 | + * __Default value:__ `1` | |
| 3459 | + */ | |
| 3460 | + val fillOpacity : Option[Double] = None, | |
| 3461 | + | |
| 3455 | 3462 | /** |
| 3456 | 3463 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 3457 | 3464 | * |
| @@ -3463,13 +3470,6 @@ case class TickConfig ( | ||
| 3463 | 3470 | */ |
| 3464 | 3471 | val filled : Option[Boolean] = None, |
| 3465 | 3472 | |
| 3466 | - /** | |
| 3467 | - * The fill opacity (value between [0,1]). | |
| 3468 | - * | |
| 3469 | - * __Default value:__ `1` | |
| 3470 | - */ | |
| 3471 | - val fillOpacity : Option[Double] = None, | |
| 3472 | - | |
| 3473 | 3473 | /** |
| 3474 | 3474 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3475 | 3475 | */ |
| @@ -6536,14 +6536,14 @@ case class Axis ( | ||
| 6536 | 6536 | val tickCount : Option[Double] = None, |
| 6537 | 6537 | |
| 6538 | 6538 | /** |
| 6539 | - * Boolean value that determines whether the axis should include ticks. | |
| 6539 | + * The size in pixels of axis ticks. | |
| 6540 | 6540 | */ |
| 6541 | - val ticks : Option[Boolean] = None, | |
| 6541 | + val tickSize : Option[Double] = None, | |
| 6542 | 6542 | |
| 6543 | 6543 | /** |
| 6544 | - * The size in pixels of axis ticks. | |
| 6544 | + * Boolean value that determines whether the axis should include ticks. | |
| 6545 | 6545 | */ |
| 6546 | - val tickSize : Option[Double] = None, | |
| 6546 | + val ticks : Option[Boolean] = None, | |
| 6547 | 6547 | |
| 6548 | 6548 | /** |
| 6549 | 6549 | * A title for the field. If `null`, the title will be removed. |
| @@ -7117,6 +7117,13 @@ case class MarkDef ( | ||
| 7117 | 7117 | */ |
| 7118 | 7118 | val fill : Option[String] = None, |
| 7119 | 7119 | |
| 7120 | + /** | |
| 7121 | + * The fill opacity (value between [0,1]). | |
| 7122 | + * | |
| 7123 | + * __Default value:__ `1` | |
| 7124 | + */ | |
| 7125 | + val fillOpacity : Option[Double] = None, | |
| 7126 | + | |
| 7120 | 7127 | /** |
| 7121 | 7128 | * Whether the mark's color should be used as fill color instead of stroke color. |
| 7122 | 7129 | * |
| @@ -7128,13 +7135,6 @@ case class MarkDef ( | ||
| 7128 | 7135 | */ |
| 7129 | 7136 | val filled : Option[Boolean] = None, |
| 7130 | 7137 | |
| 7131 | - /** | |
| 7132 | - * The fill opacity (value between [0,1]). | |
| 7133 | - * | |
| 7134 | - * __Default value:__ `1` | |
| 7135 | - */ | |
| 7136 | - val fillOpacity : Option[Double] = None, | |
| 7137 | - | |
| 7138 | 7138 | /** |
| 7139 | 7139 | * The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 7140 | 7140 | */ |
Mschema-schemadefault / TopLevel.schema+32 −32
| @@ -335,16 +335,16 @@ | ||
| 335 | 335 | "type": "string", |
| 336 | 336 | "description": "Default Fill Color. This has higher precedence than config.color\n\n__Default value:__ (None)" |
| 337 | 337 | }, |
| 338 | - "filled": { | |
| 339 | - "type": "boolean", | |
| 340 | - "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `true` for all marks except `point` and `false` for `point`.\n\n__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.\n\n__Note:__ This property cannot be used in a [style config](mark.html#style-config)." | |
| 341 | - }, | |
| 342 | 338 | "fillOpacity": { |
| 343 | 339 | "type": "number", |
| 344 | 340 | "minimum": 0, |
| 345 | 341 | "maximum": 1, |
| 346 | 342 | "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`" |
| 347 | 343 | }, |
| 344 | + "filled": { | |
| 345 | + "type": "boolean", | |
| 346 | + "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `true` for all marks except `point` and `false` for `point`.\n\n__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.\n\n__Note:__ This property cannot be used in a [style config](mark.html#style-config)." | |
| 347 | + }, | |
| 348 | 348 | "font": { |
| 349 | 349 | "type": "string", |
| 350 | 350 | "description": "The typeface to set the text in (e.g., `\"Helvetica Neue\"`)." |
| @@ -552,10 +552,6 @@ | ||
| 552 | 552 | "type": "boolean", |
| 553 | 553 | "description": "Boolean flag indicating if pixel position values should be rounded to the nearest integer." |
| 554 | 554 | }, |
| 555 | - "ticks": { | |
| 556 | - "type": "boolean", | |
| 557 | - "description": "Boolean value that determines whether the axis should include ticks." | |
| 558 | - }, | |
| 559 | 555 | "tickSize": { |
| 560 | 556 | "type": "number", |
| 561 | 557 | "minimum": 0, |
| @@ -566,6 +562,10 @@ | ||
| 566 | 562 | "minimum": 0, |
| 567 | 563 | "description": "The width, in pixels, of ticks." |
| 568 | 564 | }, |
| 565 | + "ticks": { | |
| 566 | + "type": "boolean", | |
| 567 | + "description": "Boolean value that determines whether the axis should include ticks." | |
| 568 | + }, | |
| 569 | 569 | "titleAlign": { |
| 570 | 570 | "type": "string", |
| 571 | 571 | "description": "Horizontal text alignment of axis titles." |
| @@ -725,10 +725,6 @@ | ||
| 725 | 725 | "type": "boolean", |
| 726 | 726 | "description": "Boolean flag indicating if pixel position values should be rounded to the nearest integer." |
| 727 | 727 | }, |
| 728 | - "ticks": { | |
| 729 | - "type": "boolean", | |
| 730 | - "description": "Boolean value that determines whether the axis should include ticks." | |
| 731 | - }, | |
| 732 | 728 | "tickSize": { |
| 733 | 729 | "type": "number", |
| 734 | 730 | "minimum": 0, |
| @@ -739,6 +735,10 @@ | ||
| 739 | 735 | "minimum": 0, |
| 740 | 736 | "description": "The width, in pixels, of ticks." |
| 741 | 737 | }, |
| 738 | + "ticks": { | |
| 739 | + "type": "boolean", | |
| 740 | + "description": "Boolean value that determines whether the axis should include ticks." | |
| 741 | + }, | |
| 742 | 742 | "titleAlign": { |
| 743 | 743 | "type": "string", |
| 744 | 744 | "description": "Horizontal text alignment of axis titles." |
| @@ -846,16 +846,16 @@ | ||
| 846 | 846 | "type": "string", |
| 847 | 847 | "description": "Default Fill Color. This has higher precedence than config.color\n\n__Default value:__ (None)" |
| 848 | 848 | }, |
| 849 | - "filled": { | |
| 850 | - "type": "boolean", | |
| 851 | - "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `true` for all marks except `point` and `false` for `point`.\n\n__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.\n\n__Note:__ This property cannot be used in a [style config](mark.html#style-config)." | |
| 852 | - }, | |
| 853 | 849 | "fillOpacity": { |
| 854 | 850 | "type": "number", |
| 855 | 851 | "minimum": 0, |
| 856 | 852 | "maximum": 1, |
| 857 | 853 | "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`" |
| 858 | 854 | }, |
| 855 | + "filled": { | |
| 856 | + "type": "boolean", | |
| 857 | + "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `true` for all marks except `point` and `false` for `point`.\n\n__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.\n\n__Note:__ This property cannot be used in a [style config](mark.html#style-config)." | |
| 858 | + }, | |
| 859 | 859 | "font": { |
| 860 | 860 | "type": "string", |
| 861 | 861 | "description": "The typeface to set the text in (e.g., `\"Helvetica Neue\"`)." |
| @@ -1795,16 +1795,16 @@ | ||
| 1795 | 1795 | "type": "string", |
| 1796 | 1796 | "description": "Default Fill Color. This has higher precedence than config.color\n\n__Default value:__ (None)" |
| 1797 | 1797 | }, |
| 1798 | - "filled": { | |
| 1799 | - "type": "boolean", | |
| 1800 | - "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `true` for all marks except `point` and `false` for `point`.\n\n__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.\n\n__Note:__ This property cannot be used in a [style config](mark.html#style-config)." | |
| 1801 | - }, | |
| 1802 | 1798 | "fillOpacity": { |
| 1803 | 1799 | "type": "number", |
| 1804 | 1800 | "minimum": 0, |
| 1805 | 1801 | "maximum": 1, |
| 1806 | 1802 | "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`" |
| 1807 | 1803 | }, |
| 1804 | + "filled": { | |
| 1805 | + "type": "boolean", | |
| 1806 | + "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `true` for all marks except `point` and `false` for `point`.\n\n__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.\n\n__Note:__ This property cannot be used in a [style config](mark.html#style-config)." | |
| 1807 | + }, | |
| 1808 | 1808 | "font": { |
| 1809 | 1809 | "type": "string", |
| 1810 | 1810 | "description": "The typeface to set the text in (e.g., `\"Helvetica Neue\"`)." |
| @@ -1950,16 +1950,16 @@ | ||
| 1950 | 1950 | "type": "string", |
| 1951 | 1951 | "description": "Default Fill Color. This has higher precedence than config.color\n\n__Default value:__ (None)" |
| 1952 | 1952 | }, |
| 1953 | - "filled": { | |
| 1954 | - "type": "boolean", | |
| 1955 | - "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `true` for all marks except `point` and `false` for `point`.\n\n__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.\n\n__Note:__ This property cannot be used in a [style config](mark.html#style-config)." | |
| 1956 | - }, | |
| 1957 | 1953 | "fillOpacity": { |
| 1958 | 1954 | "type": "number", |
| 1959 | 1955 | "minimum": 0, |
| 1960 | 1956 | "maximum": 1, |
| 1961 | 1957 | "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`" |
| 1962 | 1958 | }, |
| 1959 | + "filled": { | |
| 1960 | + "type": "boolean", | |
| 1961 | + "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `true` for all marks except `point` and `false` for `point`.\n\n__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.\n\n__Note:__ This property cannot be used in a [style config](mark.html#style-config)." | |
| 1962 | + }, | |
| 1963 | 1963 | "font": { |
| 1964 | 1964 | "type": "string", |
| 1965 | 1965 | "description": "The typeface to set the text in (e.g., `\"Helvetica Neue\"`)." |
| @@ -3316,15 +3316,15 @@ | ||
| 3316 | 3316 | "type": "number", |
| 3317 | 3317 | "description": "A desired number of ticks, for axes visualizing quantitative scales. The resulting number\nmay be different so that values are \"nice\" (multiples of 2, 5, 10) and lie within the\nunderlying scale's range." |
| 3318 | 3318 | }, |
| 3319 | - "ticks": { | |
| 3320 | - "type": "boolean", | |
| 3321 | - "description": "Boolean value that determines whether the axis should include ticks." | |
| 3322 | - }, | |
| 3323 | 3319 | "tickSize": { |
| 3324 | 3320 | "type": "number", |
| 3325 | 3321 | "minimum": 0, |
| 3326 | 3322 | "description": "The size in pixels of axis ticks." |
| 3327 | 3323 | }, |
| 3324 | + "ticks": { | |
| 3325 | + "type": "boolean", | |
| 3326 | + "description": "Boolean value that determines whether the axis should include ticks." | |
| 3327 | + }, | |
| 3328 | 3328 | "title": { |
| 3329 | 3329 | "anyOf": [ |
| 3330 | 3330 | { |
| @@ -3679,16 +3679,16 @@ | ||
| 3679 | 3679 | "type": "string", |
| 3680 | 3680 | "description": "Default Fill Color. This has higher precedence than config.color\n\n__Default value:__ (None)" |
| 3681 | 3681 | }, |
| 3682 | - "filled": { | |
| 3683 | - "type": "boolean", | |
| 3684 | - "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `true` for all marks except `point` and `false` for `point`.\n\n__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.\n\n__Note:__ This property cannot be used in a [style config](mark.html#style-config)." | |
| 3685 | - }, | |
| 3686 | 3682 | "fillOpacity": { |
| 3687 | 3683 | "type": "number", |
| 3688 | 3684 | "minimum": 0, |
| 3689 | 3685 | "maximum": 1, |
| 3690 | 3686 | "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`" |
| 3691 | 3687 | }, |
| 3688 | + "filled": { | |
| 3689 | + "type": "boolean", | |
| 3690 | + "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `true` for all marks except `point` and `false` for `point`.\n\n__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.\n\n__Note:__ This property cannot be used in a [style config](mark.html#style-config)." | |
| 3691 | + }, | |
| 3692 | 3692 | "font": { |
| 3693 | 3693 | "type": "string", |
| 3694 | 3694 | "description": "The typeface to set the text in (e.g., `\"Helvetica Neue\"`)." |
Mschema-typescript-zoddefault / TopLevel.ts+8 −8
| @@ -717,8 +717,8 @@ export const MarkConfigSchema = z.object({ | ||
| 717 | 717 | "dx": z.number().optional(), |
| 718 | 718 | "dy": z.number().optional(), |
| 719 | 719 | "fill": z.string().optional(), |
| 720 | - "filled": z.boolean().optional(), | |
| 721 | 720 | "fillOpacity": z.number().optional(), |
| 721 | + "filled": z.boolean().optional(), | |
| 722 | 722 | "font": z.string().optional(), |
| 723 | 723 | "fontSize": z.number().optional(), |
| 724 | 724 | "fontStyle": FontStyleSchema.optional(), |
| @@ -767,9 +767,9 @@ export const AxisConfigSchema = z.object({ | ||
| 767 | 767 | "shortTimeLabels": z.boolean().optional(), |
| 768 | 768 | "tickColor": z.string().optional(), |
| 769 | 769 | "tickRound": z.boolean().optional(), |
| 770 | - "ticks": z.boolean().optional(), | |
| 771 | 770 | "tickSize": z.number().optional(), |
| 772 | 771 | "tickWidth": z.number().optional(), |
| 772 | + "ticks": z.boolean().optional(), | |
| 773 | 773 | "titleAlign": z.string().optional(), |
| 774 | 774 | "titleAngle": z.number().optional(), |
| 775 | 775 | "titleBaseline": z.string().optional(), |
| @@ -809,9 +809,9 @@ export const VgAxisConfigSchema = z.object({ | ||
| 809 | 809 | "minExtent": z.number().optional(), |
| 810 | 810 | "tickColor": z.string().optional(), |
| 811 | 811 | "tickRound": z.boolean().optional(), |
| 812 | - "ticks": z.boolean().optional(), | |
| 813 | 812 | "tickSize": z.number().optional(), |
| 814 | 813 | "tickWidth": z.number().optional(), |
| 814 | + "ticks": z.boolean().optional(), | |
| 815 | 815 | "titleAlign": z.string().optional(), |
| 816 | 816 | "titleAngle": z.number().optional(), |
| 817 | 817 | "titleBaseline": z.string().optional(), |
| @@ -839,8 +839,8 @@ export const BarConfigSchema = z.object({ | ||
| 839 | 839 | "dx": z.number().optional(), |
| 840 | 840 | "dy": z.number().optional(), |
| 841 | 841 | "fill": z.string().optional(), |
| 842 | - "filled": z.boolean().optional(), | |
| 843 | 842 | "fillOpacity": z.number().optional(), |
| 843 | + "filled": z.boolean().optional(), | |
| 844 | 844 | "font": z.string().optional(), |
| 845 | 845 | "fontSize": z.number().optional(), |
| 846 | 846 | "fontStyle": FontStyleSchema.optional(), |
| @@ -1035,8 +1035,8 @@ export const TextConfigSchema = z.object({ | ||
| 1035 | 1035 | "dx": z.number().optional(), |
| 1036 | 1036 | "dy": z.number().optional(), |
| 1037 | 1037 | "fill": z.string().optional(), |
| 1038 | - "filled": z.boolean().optional(), | |
| 1039 | 1038 | "fillOpacity": z.number().optional(), |
| 1039 | + "filled": z.boolean().optional(), | |
| 1040 | 1040 | "font": z.string().optional(), |
| 1041 | 1041 | "fontSize": z.number().optional(), |
| 1042 | 1042 | "fontStyle": FontStyleSchema.optional(), |
| @@ -1071,8 +1071,8 @@ export const TickConfigSchema = z.object({ | ||
| 1071 | 1071 | "dx": z.number().optional(), |
| 1072 | 1072 | "dy": z.number().optional(), |
| 1073 | 1073 | "fill": z.string().optional(), |
| 1074 | - "filled": z.boolean().optional(), | |
| 1075 | 1074 | "fillOpacity": z.number().optional(), |
| 1075 | + "filled": z.boolean().optional(), | |
| 1076 | 1076 | "font": z.string().optional(), |
| 1077 | 1077 | "fontSize": z.number().optional(), |
| 1078 | 1078 | "fontStyle": FontStyleSchema.optional(), |
| @@ -1285,8 +1285,8 @@ export const AxisSchema = z.object({ | ||
| 1285 | 1285 | "orient": TitleOrientSchema.optional(), |
| 1286 | 1286 | "position": z.number().optional(), |
| 1287 | 1287 | "tickCount": z.number().optional(), |
| 1288 | - "ticks": z.boolean().optional(), | |
| 1289 | 1288 | "tickSize": z.number().optional(), |
| 1289 | + "ticks": z.boolean().optional(), | |
| 1290 | 1290 | "title": z.union([z.null(), z.string()]).optional(), |
| 1291 | 1291 | "titleMaxLength": z.number().optional(), |
| 1292 | 1292 | "titlePadding": z.number().optional(), |
| @@ -1315,8 +1315,8 @@ export const MarkDefSchema = z.object({ | ||
| 1315 | 1315 | "dx": z.number().optional(), |
| 1316 | 1316 | "dy": z.number().optional(), |
| 1317 | 1317 | "fill": z.string().optional(), |
| 1318 | - "filled": z.boolean().optional(), | |
| 1319 | 1318 | "fillOpacity": z.number().optional(), |
| 1319 | + "filled": z.boolean().optional(), | |
| 1320 | 1320 | "font": z.string().optional(), |
| 1321 | 1321 | "fontSize": z.number().optional(), |
| 1322 | 1322 | "fontStyle": FontStyleSchema.optional(), |
No generated files match these filters.