Test case
3 generated files · +6 −6test/inputs/graphql/github1.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github2.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 131 | 131 | return invalidValue(l(ref || "object"), val, key, parent); |
| 132 | 132 | } |
| 133 | - const result: any = {}; | |
| 133 | + const result: any = Object.create(null); | |
| 134 | 134 | Object.getOwnPropertyNames(props).forEach(key => { |
| 135 | 135 | const prop = props[key]; |
| 136 | 136 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -141,7 +141,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 141 | 141 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 142 | 142 | } |
| 143 | 143 | }); |
| 144 | - return result; | |
| 144 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 131 | 131 | return invalidValue(l(ref || "object"), val, key, parent); |
| 132 | 132 | } |
| 133 | - const result: any = {}; | |
| 133 | + const result: any = Object.create(null); | |
| 134 | 134 | Object.getOwnPropertyNames(props).forEach(key => { |
| 135 | 135 | const prop = props[key]; |
| 136 | 136 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -141,7 +141,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 141 | 141 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 142 | 142 | } |
| 143 | 143 | }); |
| 144 | - return result; | |
| 144 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github3.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 139 | 139 | return invalidValue(l(ref || "object"), val, key, parent); |
| 140 | 140 | } |
| 141 | - const result: any = {}; | |
| 141 | + const result: any = Object.create(null); | |
| 142 | 142 | Object.getOwnPropertyNames(props).forEach(key => { |
| 143 | 143 | const prop = props[key]; |
| 144 | 144 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -149,7 +149,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 149 | 149 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 150 | 150 | } |
| 151 | 151 | }); |
| 152 | - return result; | |
| 152 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github4.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -139,7 +139,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 139 | 139 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 140 | 140 | return invalidValue(l(ref || "object"), val, key, parent); |
| 141 | 141 | } |
| 142 | - const result: any = {}; | |
| 142 | + const result: any = Object.create(null); | |
| 143 | 143 | Object.getOwnPropertyNames(props).forEach(key => { |
| 144 | 144 | const prop = props[key]; |
| 145 | 145 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -150,7 +150,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 150 | 150 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 151 | 151 | } |
| 152 | 152 | }); |
| 153 | - return result; | |
| 153 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github5.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github6.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github7.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 143 | 143 | return invalidValue(l(ref || "object"), val, key, parent); |
| 144 | 144 | } |
| 145 | - const result: any = {}; | |
| 145 | + const result: any = Object.create(null); | |
| 146 | 146 | Object.getOwnPropertyNames(props).forEach(key => { |
| 147 | 147 | const prop = props[key]; |
| 148 | 148 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -153,7 +153,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 153 | 153 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 154 | 154 | } |
| 155 | 155 | }); |
| 156 | - return result; | |
| 156 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 143 | 143 | return invalidValue(l(ref || "object"), val, key, parent); |
| 144 | 144 | } |
| 145 | - const result: any = {}; | |
| 145 | + const result: any = Object.create(null); | |
| 146 | 146 | Object.getOwnPropertyNames(props).forEach(key => { |
| 147 | 147 | const prop = props[key]; |
| 148 | 148 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -153,7 +153,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 153 | 153 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 154 | 154 | } |
| 155 | 155 | }); |
| 156 | - return result; | |
| 156 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github8.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 133 | 133 | return invalidValue(l(ref || "object"), val, key, parent); |
| 134 | 134 | } |
| 135 | - const result: any = {}; | |
| 135 | + const result: any = Object.create(null); | |
| 136 | 136 | Object.getOwnPropertyNames(props).forEach(key => { |
| 137 | 137 | const prop = props[key]; |
| 138 | 138 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 144 | 144 | } |
| 145 | 145 | }); |
| 146 | - return result; | |
| 146 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 131 | 131 | return invalidValue(l(ref || "object"), val, key, parent); |
| 132 | 132 | } |
| 133 | - const result: any = {}; | |
| 133 | + const result: any = Object.create(null); | |
| 134 | 134 | Object.getOwnPropertyNames(props).forEach(key => { |
| 135 | 135 | const prop = props[key]; |
| 136 | 136 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -141,7 +141,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 141 | 141 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 142 | 142 | } |
| 143 | 143 | }); |
| 144 | - return result; | |
| 144 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github9.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -139,7 +139,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 139 | 139 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 140 | 140 | return invalidValue(l(ref || "object"), val, key, parent); |
| 141 | 141 | } |
| 142 | - const result: any = {}; | |
| 142 | + const result: any = Object.create(null); | |
| 143 | 143 | Object.getOwnPropertyNames(props).forEach(key => { |
| 144 | 144 | const prop = props[key]; |
| 145 | 145 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -150,7 +150,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 150 | 150 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 151 | 151 | } |
| 152 | 152 | }); |
| 153 | - return result; | |
| 153 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -133,7 +133,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 133 | 133 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 134 | 134 | return invalidValue(l(ref || "object"), val, key, parent); |
| 135 | 135 | } |
| 136 | - const result: any = {}; | |
| 136 | + const result: any = Object.create(null); | |
| 137 | 137 | Object.getOwnPropertyNames(props).forEach(key => { |
| 138 | 138 | const prop = props[key]; |
| 139 | 139 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -144,7 +144,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 144 | 144 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 145 | 145 | } |
| 146 | 146 | }); |
| 147 | - return result; | |
| 147 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/00c36.json
Mflowdefault / TopLevel.js+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 132 | 132 | return invalidValue(l(ref || "object"), val, key, parent); |
| 133 | 133 | } |
| 134 | - const result: any = {}; | |
| 134 | + const result: any = Object.create(null); | |
| 135 | 135 | Object.getOwnPropertyNames(props).forEach(key => { |
| 136 | 136 | const prop = props[key]; |
| 137 | 137 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | - return result; | |
| 145 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/00ec5.json
Melmdefault / QuickType.elm+9 −1
| @@ -160,7 +160,7 @@ provider = | ||
| 160 | 160 | encodeProvider : Provider -> Jenc.Value |
| 161 | 161 | encodeProvider x = |
| 162 | 162 | Jenc.object |
| 163 | - [ ("properties", Jenc.dict identity encodeProperty x.properties) | |
| 163 | + [ ("properties", makeDictEncoder identity encodeProperty x.properties) | |
| 164 | 164 | ] |
| 165 | 165 | |
| 166 | 166 | property : Jdec.Decoder Property |
| @@ -303,6 +303,14 @@ encodeSchema x = | ||
| 303 | 303 | |
| 304 | 304 | --- encoder helpers |
| 305 | 305 | |
| 306 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 307 | +makeDictEncoder f m r = | |
| 308 | + r | |
| 309 | + |> Dict.toList | |
| 310 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 311 | + |> String.join "," | |
| 312 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 313 | + | |
| 306 | 314 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 307 | 315 | makeNullableEncoder f m = |
| 308 | 316 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -174,7 +174,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 174 | 174 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 175 | 175 | return invalidValue(l(ref || "object"), val, key, parent); |
| 176 | 176 | } |
| 177 | - const result: any = {}; | |
| 177 | + const result: any = Object.create(null); | |
| 178 | 178 | Object.getOwnPropertyNames(props).forEach(key => { |
| 179 | 179 | const prop = props[key]; |
| 180 | 180 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -185,7 +185,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 185 | 185 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 186 | 186 | } |
| 187 | 187 | }); |
| 188 | - return result; | |
| 188 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export const Type = S.Literal( |
| 5 | 23 | "string", |
| @@ -56,7 +74,7 @@ export class Property extends S.Class<Property>("Property")({ | ||
| 56 | 74 | }) {} |
| 57 | 75 | |
| 58 | 76 | export class Provider extends S.Class<Provider>("Provider")({ |
| 59 | - "properties": S.Record({ key: S.String, value: Property}), | |
| 77 | + "properties": mapSchema(Property), | |
| 60 | 78 | }) {} |
| 61 | 79 | |
| 62 | 80 | export class Definitions extends S.Class<Definitions>("Definitions")({ |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -173,7 +173,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 173 | 173 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 174 | 174 | return invalidValue(l(ref || "object"), val, key, parent); |
| 175 | 175 | } |
| 176 | - const result: any = {}; | |
| 176 | + const result: any = Object.create(null); | |
| 177 | 177 | Object.getOwnPropertyNames(props).forEach(key => { |
| 178 | 178 | const prop = props[key]; |
| 179 | 179 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -184,7 +184,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 184 | 184 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 185 | 185 | } |
| 186 | 186 | }); |
| 187 | - return result; | |
| 187 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/010b1.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/016af.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/033b1.json
Melmdefault / QuickType.elm+9 −1
| @@ -51,11 +51,19 @@ encodeQuickType x = | ||
| 51 | 51 | Jenc.object |
| 52 | 52 | [ ("base", Jenc.string x.base) |
| 53 | 53 | , ("date", Jenc.string x.date) |
| 54 | - , ("rates", Jenc.dict identity Jenc.float x.rates) | |
| 54 | + , ("rates", makeDictEncoder identity Jenc.float x.rates) | |
| 55 | 55 | ] |
| 56 | 56 | |
| 57 | 57 | --- encoder helpers |
| 58 | 58 | |
| 59 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 60 | +makeDictEncoder f m r = | |
| 61 | + r | |
| 62 | + |> Dict.toList | |
| 63 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 64 | + |> String.join "," | |
| 65 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 66 | + | |
| 59 | 67 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 60 | 68 | makeNullableEncoder f m = |
| 61 | 69 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,8 +1,26 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | 23 | "base": S.String, |
| 6 | 24 | "date": S.String.pipe(S.pattern(/^\d{4}-\d{2}-\d{2}$/)), |
| 7 | - "rates": S.Record({ key: S.String, value: S.Number}), | |
| 25 | + "rates": mapSchema(S.Number), | |
| 8 | 26 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/050b0.json
Mflowdefault / TopLevel.js+2 −2
| @@ -163,7 +163,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 163 | 163 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 164 | 164 | return invalidValue(l(ref || "object"), val, key, parent); |
| 165 | 165 | } |
| 166 | - const result: any = {}; | |
| 166 | + const result: any = Object.create(null); | |
| 167 | 167 | Object.getOwnPropertyNames(props).forEach(key => { |
| 168 | 168 | const prop = props[key]; |
| 169 | 169 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -174,7 +174,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 174 | 174 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 175 | 175 | } |
| 176 | 176 | }); |
| 177 | - return result; | |
| 177 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/06bee.json
Mflowdefault / TopLevel.js+2 −2
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 152 | 152 | return invalidValue(l(ref || "object"), val, key, parent); |
| 153 | 153 | } |
| 154 | - const result: any = {}; | |
| 154 | + const result: any = Object.create(null); | |
| 155 | 155 | Object.getOwnPropertyNames(props).forEach(key => { |
| 156 | 156 | const prop = props[key]; |
| 157 | 157 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -162,7 +162,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 162 | 162 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 163 | 163 | } |
| 164 | 164 | }); |
| 165 | - return result; | |
| 165 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 143 | 143 | return invalidValue(l(ref || "object"), val, key, parent); |
| 144 | 144 | } |
| 145 | - const result: any = {}; | |
| 145 | + const result: any = Object.create(null); | |
| 146 | 146 | Object.getOwnPropertyNames(props).forEach(key => { |
| 147 | 147 | const prop = props[key]; |
| 148 | 148 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -153,7 +153,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 153 | 153 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 154 | 154 | } |
| 155 | 155 | }); |
| 156 | - return result; | |
| 156 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/07540.json
Mflowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/0779f.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/07c75.json
Mflowdefault / TopLevel.js+2 −2
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 133 | 133 | return invalidValue(l(ref || "object"), val, key, parent); |
| 134 | 134 | } |
| 135 | - const result: any = {}; | |
| 135 | + const result: any = Object.create(null); | |
| 136 | 136 | Object.getOwnPropertyNames(props).forEach(key => { |
| 137 | 137 | const prop = props[key]; |
| 138 | 138 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 144 | 144 | } |
| 145 | 145 | }); |
| 146 | - return result; | |
| 146 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 133 | 133 | return invalidValue(l(ref || "object"), val, key, parent); |
| 134 | 134 | } |
| 135 | - const result: any = {}; | |
| 135 | + const result: any = Object.create(null); | |
| 136 | 136 | Object.getOwnPropertyNames(props).forEach(key => { |
| 137 | 137 | const prop = props[key]; |
| 138 | 138 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 144 | 144 | } |
| 145 | 145 | }); |
| 146 | - return result; | |
| 146 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/09f54.json
Melmdefault / QuickType.elm+9 −1
| @@ -61,7 +61,7 @@ quickType = | ||
| 61 | 61 | encodeQuickType : QuickType -> Jenc.Value |
| 62 | 62 | encodeQuickType x = |
| 63 | 63 | Jenc.object |
| 64 | - [ ("data", Jenc.dict identity encodeDatum x.data) | |
| 64 | + [ ("data", makeDictEncoder identity encodeDatum x.data) | |
| 65 | 65 | , ("description", encodeDescription x.description) |
| 66 | 66 | ] |
| 67 | 67 | |
| @@ -97,6 +97,14 @@ encodeDescription x = | ||
| 97 | 97 | |
| 98 | 98 | --- encoder helpers |
| 99 | 99 | |
| 100 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 101 | +makeDictEncoder f m r = | |
| 102 | + r | |
| 103 | + |> Dict.toList | |
| 104 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 105 | + |> String.join "," | |
| 106 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 107 | + | |
| 100 | 108 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 101 | 109 | makeNullableEncoder f m = |
| 102 | 110 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class Description extends S.Class<Description>("Description")({ |
| 5 | 23 | "base_period": S.String, |
| @@ -14,6 +32,6 @@ export class Datum extends S.Class<Datum>("Datum")({ | ||
| 14 | 32 | }) {} |
| 15 | 33 | |
| 16 | 34 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 17 | - "data": S.Record({ key: S.String, value: Datum}), | |
| 35 | + "data": mapSchema(Datum), | |
| 18 | 36 | "description": Description, |
| 19 | 37 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/0a358.json
Mflowdefault / TopLevel.js+2 −2
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 126 | 126 | return invalidValue(l(ref || "object"), val, key, parent); |
| 127 | 127 | } |
| 128 | - const result: any = {}; | |
| 128 | + const result: any = Object.create(null); | |
| 129 | 129 | Object.getOwnPropertyNames(props).forEach(key => { |
| 130 | 130 | const prop = props[key]; |
| 131 | 131 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 137 | 137 | } |
| 138 | 138 | }); |
| 139 | - return result; | |
| 139 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 123 | 123 | return invalidValue(l(ref || "object"), val, key, parent); |
| 124 | 124 | } |
| 125 | - const result: any = {}; | |
| 125 | + const result: any = Object.create(null); | |
| 126 | 126 | Object.getOwnPropertyNames(props).forEach(key => { |
| 127 | 127 | const prop = props[key]; |
| 128 | 128 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -133,7 +133,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 133 | 133 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 134 | 134 | } |
| 135 | 135 | }); |
| 136 | - return result; | |
| 136 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/0a91a.json
Mflowdefault / TopLevel.js+2 −2
| @@ -327,7 +327,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 327 | 327 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 328 | 328 | return invalidValue(l(ref || "object"), val, key, parent); |
| 329 | 329 | } |
| 330 | - const result: any = {}; | |
| 330 | + const result: any = Object.create(null); | |
| 331 | 331 | Object.getOwnPropertyNames(props).forEach(key => { |
| 332 | 332 | const prop = props[key]; |
| 333 | 333 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -338,7 +338,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 338 | 338 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 339 | 339 | } |
| 340 | 340 | }); |
| 341 | - return result; | |
| 341 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -322,7 +322,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 322 | 322 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 323 | 323 | return invalidValue(l(ref || "object"), val, key, parent); |
| 324 | 324 | } |
| 325 | - const result: any = {}; | |
| 325 | + const result: any = Object.create(null); | |
| 326 | 326 | Object.getOwnPropertyNames(props).forEach(key => { |
| 327 | 327 | const prop = props[key]; |
| 328 | 328 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -333,7 +333,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 333 | 333 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 334 | 334 | } |
| 335 | 335 | }); |
| 336 | - return result; | |
| 336 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/0b91a.json
Mflowdefault / TopLevel.js+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/0cffa.json
Mflowdefault / TopLevel.js+2 −2
| @@ -222,7 +222,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 222 | 222 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 223 | 223 | return invalidValue(l(ref || "object"), val, key, parent); |
| 224 | 224 | } |
| 225 | - const result: any = {}; | |
| 225 | + const result: any = Object.create(null); | |
| 226 | 226 | Object.getOwnPropertyNames(props).forEach(key => { |
| 227 | 227 | const prop = props[key]; |
| 228 | 228 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -233,7 +233,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 233 | 233 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 234 | 234 | } |
| 235 | 235 | }); |
| 236 | - return result; | |
| 236 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -215,7 +215,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 215 | 215 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 216 | 216 | return invalidValue(l(ref || "object"), val, key, parent); |
| 217 | 217 | } |
| 218 | - const result: any = {}; | |
| 218 | + const result: any = Object.create(null); | |
| 219 | 219 | Object.getOwnPropertyNames(props).forEach(key => { |
| 220 | 220 | const prop = props[key]; |
| 221 | 221 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -226,7 +226,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 226 | 226 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 227 | 227 | } |
| 228 | 228 | }); |
| 229 | - return result; | |
| 229 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/0e0c2.json
Mflowdefault / TopLevel.js+2 −2
| @@ -184,7 +184,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 184 | 184 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 185 | 185 | return invalidValue(l(ref || "object"), val, key, parent); |
| 186 | 186 | } |
| 187 | - const result: any = {}; | |
| 187 | + const result: any = Object.create(null); | |
| 188 | 188 | Object.getOwnPropertyNames(props).forEach(key => { |
| 189 | 189 | const prop = props[key]; |
| 190 | 190 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -195,7 +195,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 195 | 195 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 196 | 196 | } |
| 197 | 197 | }); |
| 198 | - return result; | |
| 198 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -178,7 +178,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 178 | 178 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 179 | 179 | return invalidValue(l(ref || "object"), val, key, parent); |
| 180 | 180 | } |
| 181 | - const result: any = {}; | |
| 181 | + const result: any = Object.create(null); | |
| 182 | 182 | Object.getOwnPropertyNames(props).forEach(key => { |
| 183 | 183 | const prop = props[key]; |
| 184 | 184 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -189,7 +189,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 189 | 189 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 190 | 190 | } |
| 191 | 191 | }); |
| 192 | - return result; | |
| 192 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/0fecf.json
Mflowdefault / TopLevel.js+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/10be4.json
Mflowdefault / TopLevel.js+2 −2
| @@ -174,7 +174,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 174 | 174 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 175 | 175 | return invalidValue(l(ref || "object"), val, key, parent); |
| 176 | 176 | } |
| 177 | - const result: any = {}; | |
| 177 | + const result: any = Object.create(null); | |
| 178 | 178 | Object.getOwnPropertyNames(props).forEach(key => { |
| 179 | 179 | const prop = props[key]; |
| 180 | 180 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -185,7 +185,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 185 | 185 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 186 | 186 | } |
| 187 | 187 | }); |
| 188 | - return result; | |
| 188 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/112b5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/127a1.json
Mflowdefault / TopLevel.js+2 −2
| @@ -221,7 +221,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 221 | 221 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 222 | 222 | return invalidValue(l(ref || "object"), val, key, parent); |
| 223 | 223 | } |
| 224 | - const result: any = {}; | |
| 224 | + const result: any = Object.create(null); | |
| 225 | 225 | Object.getOwnPropertyNames(props).forEach(key => { |
| 226 | 226 | const prop = props[key]; |
| 227 | 227 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -232,7 +232,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 232 | 232 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 233 | 233 | } |
| 234 | 234 | }); |
| 235 | - return result; | |
| 235 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -215,7 +215,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 215 | 215 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 216 | 216 | return invalidValue(l(ref || "object"), val, key, parent); |
| 217 | 217 | } |
| 218 | - const result: any = {}; | |
| 218 | + const result: any = Object.create(null); | |
| 219 | 219 | Object.getOwnPropertyNames(props).forEach(key => { |
| 220 | 220 | const prop = props[key]; |
| 221 | 221 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -226,7 +226,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 226 | 226 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 227 | 227 | } |
| 228 | 228 | }); |
| 229 | - return result; | |
| 229 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/13d8d.json
Mflowdefault / TopLevel.js+2 −2
| @@ -133,7 +133,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 133 | 133 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 134 | 134 | return invalidValue(l(ref || "object"), val, key, parent); |
| 135 | 135 | } |
| 136 | - const result: any = {}; | |
| 136 | + const result: any = Object.create(null); | |
| 137 | 137 | Object.getOwnPropertyNames(props).forEach(key => { |
| 138 | 138 | const prop = props[key]; |
| 139 | 139 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -144,7 +144,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 144 | 144 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 145 | 145 | } |
| 146 | 146 | }); |
| 147 | - return result; | |
| 147 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -133,7 +133,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 133 | 133 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 134 | 134 | return invalidValue(l(ref || "object"), val, key, parent); |
| 135 | 135 | } |
| 136 | - const result: any = {}; | |
| 136 | + const result: any = Object.create(null); | |
| 137 | 137 | Object.getOwnPropertyNames(props).forEach(key => { |
| 138 | 138 | const prop = props[key]; |
| 139 | 139 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -144,7 +144,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 144 | 144 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 145 | 145 | } |
| 146 | 146 | }); |
| 147 | - return result; | |
| 147 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/14d38.json
Mflowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/167d6.json
Melmdefault / QuickType.elm+9 −1
| @@ -51,11 +51,19 @@ encodeQuickType x = | ||
| 51 | 51 | Jenc.object |
| 52 | 52 | [ ("base", Jenc.string x.base) |
| 53 | 53 | , ("date", Jenc.string x.date) |
| 54 | - , ("rates", Jenc.dict identity Jenc.float x.rates) | |
| 54 | + , ("rates", makeDictEncoder identity Jenc.float x.rates) | |
| 55 | 55 | ] |
| 56 | 56 | |
| 57 | 57 | --- encoder helpers |
| 58 | 58 | |
| 59 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 60 | +makeDictEncoder f m r = | |
| 61 | + r | |
| 62 | + |> Dict.toList | |
| 63 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 64 | + |> String.join "," | |
| 65 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 66 | + | |
| 59 | 67 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 60 | 68 | makeNullableEncoder f m = |
| 61 | 69 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,8 +1,26 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | 23 | "base": S.String, |
| 6 | 24 | "date": S.String.pipe(S.pattern(/^\d{4}-\d{2}-\d{2}$/)), |
| 7 | - "rates": S.Record({ key: S.String, value: S.Number}), | |
| 25 | + "rates": mapSchema(S.Number), | |
| 8 | 26 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/16bc5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/176f1.json
Mflowdefault / TopLevel.js+2 −2
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 133 | 133 | return invalidValue(l(ref || "object"), val, key, parent); |
| 134 | 134 | } |
| 135 | - const result: any = {}; | |
| 135 | + const result: any = Object.create(null); | |
| 136 | 136 | Object.getOwnPropertyNames(props).forEach(key => { |
| 137 | 137 | const prop = props[key]; |
| 138 | 138 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 144 | 144 | } |
| 145 | 145 | }); |
| 146 | - return result; | |
| 146 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 133 | 133 | return invalidValue(l(ref || "object"), val, key, parent); |
| 134 | 134 | } |
| 135 | - const result: any = {}; | |
| 135 | + const result: any = Object.create(null); | |
| 136 | 136 | Object.getOwnPropertyNames(props).forEach(key => { |
| 137 | 137 | const prop = props[key]; |
| 138 | 138 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 144 | 144 | } |
| 145 | 145 | }); |
| 146 | - return result; | |
| 146 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/1a7f5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/1b28c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/1b409.json
Mflowdefault / TopLevel.js+2 −2
| @@ -198,7 +198,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 198 | 198 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 199 | 199 | return invalidValue(l(ref || "object"), val, key, parent); |
| 200 | 200 | } |
| 201 | - const result: any = {}; | |
| 201 | + const result: any = Object.create(null); | |
| 202 | 202 | Object.getOwnPropertyNames(props).forEach(key => { |
| 203 | 203 | const prop = props[key]; |
| 204 | 204 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -209,7 +209,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 209 | 209 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 210 | 210 | } |
| 211 | 211 | }); |
| 212 | - return result; | |
| 212 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -181,7 +181,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 181 | 181 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 182 | 182 | return invalidValue(l(ref || "object"), val, key, parent); |
| 183 | 183 | } |
| 184 | - const result: any = {}; | |
| 184 | + const result: any = Object.create(null); | |
| 185 | 185 | Object.getOwnPropertyNames(props).forEach(key => { |
| 186 | 186 | const prop = props[key]; |
| 187 | 187 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -192,7 +192,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 192 | 192 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 193 | 193 | } |
| 194 | 194 | }); |
| 195 | - return result; | |
| 195 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/2465e.json
Mflowdefault / TopLevel.js+2 −2
| @@ -180,7 +180,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 180 | 180 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 181 | 181 | return invalidValue(l(ref || "object"), val, key, parent); |
| 182 | 182 | } |
| 183 | - const result: any = {}; | |
| 183 | + const result: any = Object.create(null); | |
| 184 | 184 | Object.getOwnPropertyNames(props).forEach(key => { |
| 185 | 185 | const prop = props[key]; |
| 186 | 186 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -191,7 +191,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 191 | 191 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 192 | 192 | } |
| 193 | 193 | }); |
| 194 | - return result; | |
| 194 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -180,7 +180,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 180 | 180 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 181 | 181 | return invalidValue(l(ref || "object"), val, key, parent); |
| 182 | 182 | } |
| 183 | - const result: any = {}; | |
| 183 | + const result: any = Object.create(null); | |
| 184 | 184 | Object.getOwnPropertyNames(props).forEach(key => { |
| 185 | 185 | const prop = props[key]; |
| 186 | 186 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -191,7 +191,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 191 | 191 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 192 | 192 | } |
| 193 | 193 | }); |
| 194 | - return result; | |
| 194 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/24f52.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/262f0.json
Mflowdefault / TopLevel.js+2 −2
| @@ -210,7 +210,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 210 | 210 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 211 | 211 | return invalidValue(l(ref || "object"), val, key, parent); |
| 212 | 212 | } |
| 213 | - const result: any = {}; | |
| 213 | + const result: any = Object.create(null); | |
| 214 | 214 | Object.getOwnPropertyNames(props).forEach(key => { |
| 215 | 215 | const prop = props[key]; |
| 216 | 216 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -221,7 +221,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 221 | 221 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 222 | 222 | } |
| 223 | 223 | }); |
| 224 | - return result; | |
| 224 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -207,7 +207,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 207 | 207 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 208 | 208 | return invalidValue(l(ref || "object"), val, key, parent); |
| 209 | 209 | } |
| 210 | - const result: any = {}; | |
| 210 | + const result: any = Object.create(null); | |
| 211 | 211 | Object.getOwnPropertyNames(props).forEach(key => { |
| 212 | 212 | const prop = props[key]; |
| 213 | 213 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -218,7 +218,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 218 | 218 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 219 | 219 | } |
| 220 | 220 | }); |
| 221 | - return result; | |
| 221 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/26b49.json
Mflowdefault / TopLevel.js+2 −2
| @@ -219,7 +219,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 219 | 219 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 220 | 220 | return invalidValue(l(ref || "object"), val, key, parent); |
| 221 | 221 | } |
| 222 | - const result: any = {}; | |
| 222 | + const result: any = Object.create(null); | |
| 223 | 223 | Object.getOwnPropertyNames(props).forEach(key => { |
| 224 | 224 | const prop = props[key]; |
| 225 | 225 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -230,7 +230,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 230 | 230 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 231 | 231 | } |
| 232 | 232 | }); |
| 233 | - return result; | |
| 233 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -214,7 +214,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 214 | 214 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 215 | 215 | return invalidValue(l(ref || "object"), val, key, parent); |
| 216 | 216 | } |
| 217 | - const result: any = {}; | |
| 217 | + const result: any = Object.create(null); | |
| 218 | 218 | Object.getOwnPropertyNames(props).forEach(key => { |
| 219 | 219 | const prop = props[key]; |
| 220 | 220 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -225,7 +225,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 225 | 225 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 226 | 226 | } |
| 227 | 227 | }); |
| 228 | - return result; | |
| 228 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/26c9c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -294,7 +294,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 294 | 294 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 295 | 295 | return invalidValue(l(ref || "object"), val, key, parent); |
| 296 | 296 | } |
| 297 | - const result: any = {}; | |
| 297 | + const result: any = Object.create(null); | |
| 298 | 298 | Object.getOwnPropertyNames(props).forEach(key => { |
| 299 | 299 | const prop = props[key]; |
| 300 | 300 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -305,7 +305,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 305 | 305 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 306 | 306 | } |
| 307 | 307 | }); |
| 308 | - return result; | |
| 308 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -294,7 +294,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 294 | 294 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 295 | 295 | return invalidValue(l(ref || "object"), val, key, parent); |
| 296 | 296 | } |
| 297 | - const result: any = {}; | |
| 297 | + const result: any = Object.create(null); | |
| 298 | 298 | Object.getOwnPropertyNames(props).forEach(key => { |
| 299 | 299 | const prop = props[key]; |
| 300 | 300 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -305,7 +305,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 305 | 305 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 306 | 306 | } |
| 307 | 307 | }); |
| 308 | - return result; | |
| 308 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/27332.json
Mflowdefault / TopLevel.js+2 −2
| @@ -260,7 +260,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 260 | 260 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 261 | 261 | return invalidValue(l(ref || "object"), val, key, parent); |
| 262 | 262 | } |
| 263 | - const result: any = {}; | |
| 263 | + const result: any = Object.create(null); | |
| 264 | 264 | Object.getOwnPropertyNames(props).forEach(key => { |
| 265 | 265 | const prop = props[key]; |
| 266 | 266 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -271,7 +271,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 271 | 271 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 272 | 272 | } |
| 273 | 273 | }); |
| 274 | - return result; | |
| 274 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -246,7 +246,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 246 | 246 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 247 | 247 | return invalidValue(l(ref || "object"), val, key, parent); |
| 248 | 248 | } |
| 249 | - const result: any = {}; | |
| 249 | + const result: any = Object.create(null); | |
| 250 | 250 | Object.getOwnPropertyNames(props).forEach(key => { |
| 251 | 251 | const prop = props[key]; |
| 252 | 252 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -257,7 +257,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 257 | 257 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 258 | 258 | } |
| 259 | 259 | }); |
| 260 | - return result; | |
| 260 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/29f47.json
Mflowdefault / TopLevel.js+2 −2
| @@ -246,7 +246,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 246 | 246 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 247 | 247 | return invalidValue(l(ref || "object"), val, key, parent); |
| 248 | 248 | } |
| 249 | - const result: any = {}; | |
| 249 | + const result: any = Object.create(null); | |
| 250 | 250 | Object.getOwnPropertyNames(props).forEach(key => { |
| 251 | 251 | const prop = props[key]; |
| 252 | 252 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -257,7 +257,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 257 | 257 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 258 | 258 | } |
| 259 | 259 | }); |
| 260 | - return result; | |
| 260 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -233,7 +233,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 233 | 233 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 234 | 234 | return invalidValue(l(ref || "object"), val, key, parent); |
| 235 | 235 | } |
| 236 | - const result: any = {}; | |
| 236 | + const result: any = Object.create(null); | |
| 237 | 237 | Object.getOwnPropertyNames(props).forEach(key => { |
| 238 | 238 | const prop = props[key]; |
| 239 | 239 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -244,7 +244,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 244 | 244 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 245 | 245 | } |
| 246 | 246 | }); |
| 247 | - return result; | |
| 247 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/2d4e2.json
Mflowdefault / TopLevel.js+2 −2
| @@ -214,7 +214,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 214 | 214 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 215 | 215 | return invalidValue(l(ref || "object"), val, key, parent); |
| 216 | 216 | } |
| 217 | - const result: any = {}; | |
| 217 | + const result: any = Object.create(null); | |
| 218 | 218 | Object.getOwnPropertyNames(props).forEach(key => { |
| 219 | 219 | const prop = props[key]; |
| 220 | 220 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -225,7 +225,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 225 | 225 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 226 | 226 | } |
| 227 | 227 | }); |
| 228 | - return result; | |
| 228 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -191,7 +191,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 191 | 191 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 192 | 192 | return invalidValue(l(ref || "object"), val, key, parent); |
| 193 | 193 | } |
| 194 | - const result: any = {}; | |
| 194 | + const result: any = Object.create(null); | |
| 195 | 195 | Object.getOwnPropertyNames(props).forEach(key => { |
| 196 | 196 | const prop = props[key]; |
| 197 | 197 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -202,7 +202,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 202 | 202 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 203 | 203 | } |
| 204 | 204 | }); |
| 205 | - return result; | |
| 205 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/2df80.json
Mflowdefault / TopLevel.js+2 −2
| @@ -180,7 +180,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 180 | 180 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 181 | 181 | return invalidValue(l(ref || "object"), val, key, parent); |
| 182 | 182 | } |
| 183 | - const result: any = {}; | |
| 183 | + const result: any = Object.create(null); | |
| 184 | 184 | Object.getOwnPropertyNames(props).forEach(key => { |
| 185 | 185 | const prop = props[key]; |
| 186 | 186 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -191,7 +191,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 191 | 191 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 192 | 192 | } |
| 193 | 193 | }); |
| 194 | - return result; | |
| 194 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/31189.json
Mflowdefault / TopLevel.js+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -134,7 +134,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 134 | 134 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 135 | 135 | return invalidValue(l(ref || "object"), val, key, parent); |
| 136 | 136 | } |
| 137 | - const result: any = {}; | |
| 137 | + const result: any = Object.create(null); | |
| 138 | 138 | Object.getOwnPropertyNames(props).forEach(key => { |
| 139 | 139 | const prop = props[key]; |
| 140 | 140 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -145,7 +145,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 145 | 145 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 146 | 146 | } |
| 147 | 147 | }); |
| 148 | - return result; | |
| 148 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/32431.json
Mflowdefault / TopLevel.js+2 −2
| @@ -178,7 +178,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 178 | 178 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 179 | 179 | return invalidValue(l(ref || "object"), val, key, parent); |
| 180 | 180 | } |
| 181 | - const result: any = {}; | |
| 181 | + const result: any = Object.create(null); | |
| 182 | 182 | Object.getOwnPropertyNames(props).forEach(key => { |
| 183 | 183 | const prop = props[key]; |
| 184 | 184 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -189,7 +189,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 189 | 189 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 190 | 190 | } |
| 191 | 191 | }); |
| 192 | - return result; | |
| 192 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -170,7 +170,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 170 | 170 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 171 | 171 | return invalidValue(l(ref || "object"), val, key, parent); |
| 172 | 172 | } |
| 173 | - const result: any = {}; | |
| 173 | + const result: any = Object.create(null); | |
| 174 | 174 | Object.getOwnPropertyNames(props).forEach(key => { |
| 175 | 175 | const prop = props[key]; |
| 176 | 176 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -181,7 +181,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 181 | 181 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 182 | 182 | } |
| 183 | 183 | }); |
| 184 | - return result; | |
| 184 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/32d5c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/337ed.json
Mflowdefault / TopLevel.js+2 −2
| @@ -175,7 +175,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 175 | 175 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 176 | 176 | return invalidValue(l(ref || "object"), val, key, parent); |
| 177 | 177 | } |
| 178 | - const result: any = {}; | |
| 178 | + const result: any = Object.create(null); | |
| 179 | 179 | Object.getOwnPropertyNames(props).forEach(key => { |
| 180 | 180 | const prop = props[key]; |
| 181 | 181 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -186,7 +186,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 186 | 186 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 187 | 187 | } |
| 188 | 188 | }); |
| 189 | - return result; | |
| 189 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -165,7 +165,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 165 | 165 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 166 | 166 | return invalidValue(l(ref || "object"), val, key, parent); |
| 167 | 167 | } |
| 168 | - const result: any = {}; | |
| 168 | + const result: any = Object.create(null); | |
| 169 | 169 | Object.getOwnPropertyNames(props).forEach(key => { |
| 170 | 170 | const prop = props[key]; |
| 171 | 171 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -176,7 +176,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 176 | 176 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 177 | 177 | } |
| 178 | 178 | }); |
| 179 | - return result; | |
| 179 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/33d2e.json
Mflowdefault / TopLevel.js+2 −2
| @@ -160,7 +160,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 160 | 160 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 161 | 161 | return invalidValue(l(ref || "object"), val, key, parent); |
| 162 | 162 | } |
| 163 | - const result: any = {}; | |
| 163 | + const result: any = Object.create(null); | |
| 164 | 164 | Object.getOwnPropertyNames(props).forEach(key => { |
| 165 | 165 | const prop = props[key]; |
| 166 | 166 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -171,7 +171,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 171 | 171 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 172 | 172 | } |
| 173 | 173 | }); |
| 174 | - return result; | |
| 174 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -148,7 +148,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 148 | 148 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 149 | 149 | return invalidValue(l(ref || "object"), val, key, parent); |
| 150 | 150 | } |
| 151 | - const result: any = {}; | |
| 151 | + const result: any = Object.create(null); | |
| 152 | 152 | Object.getOwnPropertyNames(props).forEach(key => { |
| 153 | 153 | const prop = props[key]; |
| 154 | 154 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -159,7 +159,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 159 | 159 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 160 | 160 | } |
| 161 | 161 | }); |
| 162 | - return result; | |
| 162 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/34702.json
Mflowdefault / TopLevel.js+2 −2
| @@ -195,7 +195,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 195 | 195 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 196 | 196 | return invalidValue(l(ref || "object"), val, key, parent); |
| 197 | 197 | } |
| 198 | - const result: any = {}; | |
| 198 | + const result: any = Object.create(null); | |
| 199 | 199 | Object.getOwnPropertyNames(props).forEach(key => { |
| 200 | 200 | const prop = props[key]; |
| 201 | 201 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -206,7 +206,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 206 | 206 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 207 | 207 | } |
| 208 | 208 | }); |
| 209 | - return result; | |
| 209 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -162,7 +162,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 162 | 162 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 163 | 163 | return invalidValue(l(ref || "object"), val, key, parent); |
| 164 | 164 | } |
| 165 | - const result: any = {}; | |
| 165 | + const result: any = Object.create(null); | |
| 166 | 166 | Object.getOwnPropertyNames(props).forEach(key => { |
| 167 | 167 | const prop = props[key]; |
| 168 | 168 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -173,7 +173,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 173 | 173 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 174 | 174 | } |
| 175 | 175 | }); |
| 176 | - return result; | |
| 176 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/3536b.json
Mflowdefault / TopLevel.js+2 −2
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 143 | 143 | return invalidValue(l(ref || "object"), val, key, parent); |
| 144 | 144 | } |
| 145 | - const result: any = {}; | |
| 145 | + const result: any = Object.create(null); | |
| 146 | 146 | Object.getOwnPropertyNames(props).forEach(key => { |
| 147 | 147 | const prop = props[key]; |
| 148 | 148 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -153,7 +153,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 153 | 153 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 154 | 154 | } |
| 155 | 155 | }); |
| 156 | - return result; | |
| 156 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/3659d.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/36d5d.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/3a6b3.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/3e9a3.json
Mflowdefault / TopLevel.js+2 −2
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 133 | 133 | return invalidValue(l(ref || "object"), val, key, parent); |
| 134 | 134 | } |
| 135 | - const result: any = {}; | |
| 135 | + const result: any = Object.create(null); | |
| 136 | 136 | Object.getOwnPropertyNames(props).forEach(key => { |
| 137 | 137 | const prop = props[key]; |
| 138 | 138 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 144 | 144 | } |
| 145 | 145 | }); |
| 146 | - return result; | |
| 146 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 133 | 133 | return invalidValue(l(ref || "object"), val, key, parent); |
| 134 | 134 | } |
| 135 | - const result: any = {}; | |
| 135 | + const result: any = Object.create(null); | |
| 136 | 136 | Object.getOwnPropertyNames(props).forEach(key => { |
| 137 | 137 | const prop = props[key]; |
| 138 | 138 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 144 | 144 | } |
| 145 | 145 | }); |
| 146 | - return result; | |
| 146 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/3f1ce.json
Mflowdefault / TopLevel.js+2 −2
| @@ -208,7 +208,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 208 | 208 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 209 | 209 | return invalidValue(l(ref || "object"), val, key, parent); |
| 210 | 210 | } |
| 211 | - const result: any = {}; | |
| 211 | + const result: any = Object.create(null); | |
| 212 | 212 | Object.getOwnPropertyNames(props).forEach(key => { |
| 213 | 213 | const prop = props[key]; |
| 214 | 214 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -219,7 +219,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 219 | 219 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 220 | 220 | } |
| 221 | 221 | }); |
| 222 | - return result; | |
| 222 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -207,7 +207,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 207 | 207 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 208 | 208 | return invalidValue(l(ref || "object"), val, key, parent); |
| 209 | 209 | } |
| 210 | - const result: any = {}; | |
| 210 | + const result: any = Object.create(null); | |
| 211 | 211 | Object.getOwnPropertyNames(props).forEach(key => { |
| 212 | 212 | const prop = props[key]; |
| 213 | 213 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -218,7 +218,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 218 | 218 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 219 | 219 | } |
| 220 | 220 | }); |
| 221 | - return result; | |
| 221 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/421d4.json
Mflowdefault / TopLevel.js+2 −2
| @@ -221,7 +221,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 221 | 221 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 222 | 222 | return invalidValue(l(ref || "object"), val, key, parent); |
| 223 | 223 | } |
| 224 | - const result: any = {}; | |
| 224 | + const result: any = Object.create(null); | |
| 225 | 225 | Object.getOwnPropertyNames(props).forEach(key => { |
| 226 | 226 | const prop = props[key]; |
| 227 | 227 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -232,7 +232,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 232 | 232 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 233 | 233 | } |
| 234 | 234 | }); |
| 235 | - return result; | |
| 235 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -218,7 +218,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 218 | 218 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 219 | 219 | return invalidValue(l(ref || "object"), val, key, parent); |
| 220 | 220 | } |
| 221 | - const result: any = {}; | |
| 221 | + const result: any = Object.create(null); | |
| 222 | 222 | Object.getOwnPropertyNames(props).forEach(key => { |
| 223 | 223 | const prop = props[key]; |
| 224 | 224 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -229,7 +229,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 229 | 229 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 230 | 230 | } |
| 231 | 231 | }); |
| 232 | - return result; | |
| 232 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/437e7.json
Mflowdefault / TopLevel.js+2 −2
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 217 | 217 | return invalidValue(l(ref || "object"), val, key, parent); |
| 218 | 218 | } |
| 219 | - const result: any = {}; | |
| 219 | + const result: any = Object.create(null); | |
| 220 | 220 | Object.getOwnPropertyNames(props).forEach(key => { |
| 221 | 221 | const prop = props[key]; |
| 222 | 222 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -227,7 +227,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 227 | 227 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 228 | 228 | } |
| 229 | 229 | }); |
| 230 | - return result; | |
| 230 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -211,7 +211,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 211 | 211 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 212 | 212 | return invalidValue(l(ref || "object"), val, key, parent); |
| 213 | 213 | } |
| 214 | - const result: any = {}; | |
| 214 | + const result: any = Object.create(null); | |
| 215 | 215 | Object.getOwnPropertyNames(props).forEach(key => { |
| 216 | 216 | const prop = props[key]; |
| 217 | 217 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -222,7 +222,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 222 | 222 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 223 | 223 | } |
| 224 | 224 | }); |
| 225 | - return result; | |
| 225 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/43970.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/43eaf.json
Melmdefault / QuickType.elm+9 −1
| @@ -51,11 +51,19 @@ encodeQuickType x = | ||
| 51 | 51 | Jenc.object |
| 52 | 52 | [ ("base", Jenc.string x.base) |
| 53 | 53 | , ("date", Jenc.string x.date) |
| 54 | - , ("rates", Jenc.dict identity Jenc.float x.rates) | |
| 54 | + , ("rates", makeDictEncoder identity Jenc.float x.rates) | |
| 55 | 55 | ] |
| 56 | 56 | |
| 57 | 57 | --- encoder helpers |
| 58 | 58 | |
| 59 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 60 | +makeDictEncoder f m r = | |
| 61 | + r | |
| 62 | + |> Dict.toList | |
| 63 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 64 | + |> String.join "," | |
| 65 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 66 | + | |
| 59 | 67 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 60 | 68 | makeNullableEncoder f m = |
| 61 | 69 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,8 +1,26 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | 23 | "base": S.String, |
| 6 | 24 | "date": S.String.pipe(S.pattern(/^\d{4}-\d{2}-\d{2}$/)), |
| 7 | - "rates": S.Record({ key: S.String, value: S.Number}), | |
| 25 | + "rates": mapSchema(S.Number), | |
| 8 | 26 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/458db.json
Mflowdefault / TopLevel.js+2 −2
| @@ -149,7 +149,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 149 | 149 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 150 | 150 | return invalidValue(l(ref || "object"), val, key, parent); |
| 151 | 151 | } |
| 152 | - const result: any = {}; | |
| 152 | + const result: any = Object.create(null); | |
| 153 | 153 | Object.getOwnPropertyNames(props).forEach(key => { |
| 154 | 154 | const prop = props[key]; |
| 155 | 155 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -160,7 +160,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 160 | 160 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 161 | 161 | } |
| 162 | 162 | }); |
| 163 | - return result; | |
| 163 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -148,7 +148,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 148 | 148 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 149 | 149 | return invalidValue(l(ref || "object"), val, key, parent); |
| 150 | 150 | } |
| 151 | - const result: any = {}; | |
| 151 | + const result: any = Object.create(null); | |
| 152 | 152 | Object.getOwnPropertyNames(props).forEach(key => { |
| 153 | 153 | const prop = props[key]; |
| 154 | 154 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -159,7 +159,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 159 | 159 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 160 | 160 | } |
| 161 | 161 | }); |
| 162 | - return result; | |
| 162 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/4961a.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/4a0d7.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/4a455.json
Mflowdefault / TopLevel.js+2 −2
| @@ -150,7 +150,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 150 | 150 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 151 | 151 | return invalidValue(l(ref || "object"), val, key, parent); |
| 152 | 152 | } |
| 153 | - const result: any = {}; | |
| 153 | + const result: any = Object.create(null); | |
| 154 | 154 | Object.getOwnPropertyNames(props).forEach(key => { |
| 155 | 155 | const prop = props[key]; |
| 156 | 156 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -161,7 +161,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 161 | 161 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 162 | 162 | } |
| 163 | 163 | }); |
| 164 | - return result; | |
| 164 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/4c547.json
Mflowdefault / TopLevel.js+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/4d6fb.json
Mflowdefault / TopLevel.js+2 −2
| @@ -255,7 +255,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 255 | 255 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 256 | 256 | return invalidValue(l(ref || "object"), val, key, parent); |
| 257 | 257 | } |
| 258 | - const result: any = {}; | |
| 258 | + const result: any = Object.create(null); | |
| 259 | 259 | Object.getOwnPropertyNames(props).forEach(key => { |
| 260 | 260 | const prop = props[key]; |
| 261 | 261 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -266,7 +266,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 266 | 266 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 267 | 267 | } |
| 268 | 268 | }); |
| 269 | - return result; | |
| 269 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -245,7 +245,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 245 | 245 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 246 | 246 | return invalidValue(l(ref || "object"), val, key, parent); |
| 247 | 247 | } |
| 248 | - const result: any = {}; | |
| 248 | + const result: any = Object.create(null); | |
| 249 | 249 | Object.getOwnPropertyNames(props).forEach(key => { |
| 250 | 250 | const prop = props[key]; |
| 251 | 251 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -256,7 +256,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 256 | 256 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 257 | 257 | } |
| 258 | 258 | }); |
| 259 | - return result; | |
| 259 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/4e336.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/54147.json
Mflowdefault / TopLevel.js+2 −2
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 124 | 124 | return invalidValue(l(ref || "object"), val, key, parent); |
| 125 | 125 | } |
| 126 | - const result: any = {}; | |
| 126 | + const result: any = Object.create(null); | |
| 127 | 127 | Object.getOwnPropertyNames(props).forEach(key => { |
| 128 | 128 | const prop = props[key]; |
| 129 | 129 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -134,7 +134,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 134 | 134 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 135 | 135 | } |
| 136 | 136 | }); |
| 137 | - return result; | |
| 137 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/54d32.json
Mflowdefault / TopLevel.js+2 −2
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 130 | 130 | return invalidValue(l(ref || "object"), val, key, parent); |
| 131 | 131 | } |
| 132 | - const result: any = {}; | |
| 132 | + const result: any = Object.create(null); | |
| 133 | 133 | Object.getOwnPropertyNames(props).forEach(key => { |
| 134 | 134 | const prop = props[key]; |
| 135 | 135 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 141 | 141 | } |
| 142 | 142 | }); |
| 143 | - return result; | |
| 143 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 125 | 125 | return invalidValue(l(ref || "object"), val, key, parent); |
| 126 | 126 | } |
| 127 | - const result: any = {}; | |
| 127 | + const result: any = Object.create(null); | |
| 128 | 128 | Object.getOwnPropertyNames(props).forEach(key => { |
| 129 | 129 | const prop = props[key]; |
| 130 | 130 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 136 | 136 | } |
| 137 | 137 | }); |
| 138 | - return result; | |
| 138 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/570ec.json
Mflowdefault / TopLevel.js+2 −2
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 143 | 143 | return invalidValue(l(ref || "object"), val, key, parent); |
| 144 | 144 | } |
| 145 | - const result: any = {}; | |
| 145 | + const result: any = Object.create(null); | |
| 146 | 146 | Object.getOwnPropertyNames(props).forEach(key => { |
| 147 | 147 | const prop = props[key]; |
| 148 | 148 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -153,7 +153,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 153 | 153 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 154 | 154 | } |
| 155 | 155 | }); |
| 156 | - return result; | |
| 156 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -139,7 +139,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 139 | 139 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 140 | 140 | return invalidValue(l(ref || "object"), val, key, parent); |
| 141 | 141 | } |
| 142 | - const result: any = {}; | |
| 142 | + const result: any = Object.create(null); | |
| 143 | 143 | Object.getOwnPropertyNames(props).forEach(key => { |
| 144 | 144 | const prop = props[key]; |
| 145 | 145 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -150,7 +150,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 150 | 150 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 151 | 151 | } |
| 152 | 152 | }); |
| 153 | - return result; | |
| 153 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/5dd0d.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/5eae5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/5eb20.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/5f3a1.json
Melmdefault / QuickType.elm+9 −1
| @@ -51,11 +51,19 @@ encodeQuickType x = | ||
| 51 | 51 | Jenc.object |
| 52 | 52 | [ ("base", Jenc.string x.base) |
| 53 | 53 | , ("date", Jenc.string x.date) |
| 54 | - , ("rates", Jenc.dict identity Jenc.float x.rates) | |
| 54 | + , ("rates", makeDictEncoder identity Jenc.float x.rates) | |
| 55 | 55 | ] |
| 56 | 56 | |
| 57 | 57 | --- encoder helpers |
| 58 | 58 | |
| 59 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 60 | +makeDictEncoder f m r = | |
| 61 | + r | |
| 62 | + |> Dict.toList | |
| 63 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 64 | + |> String.join "," | |
| 65 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 66 | + | |
| 59 | 67 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 60 | 68 | makeNullableEncoder f m = |
| 61 | 69 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,8 +1,26 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | 23 | "base": S.String, |
| 6 | 24 | "date": S.String.pipe(S.pattern(/^\d{4}-\d{2}-\d{2}$/)), |
| 7 | - "rates": S.Record({ key: S.String, value: S.Number}), | |
| 25 | + "rates": mapSchema(S.Number), | |
| 8 | 26 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/5f7fe.json
Mflowdefault / TopLevel.js+2 −2
| @@ -295,7 +295,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 295 | 295 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 296 | 296 | return invalidValue(l(ref || "object"), val, key, parent); |
| 297 | 297 | } |
| 298 | - const result: any = {}; | |
| 298 | + const result: any = Object.create(null); | |
| 299 | 299 | Object.getOwnPropertyNames(props).forEach(key => { |
| 300 | 300 | const prop = props[key]; |
| 301 | 301 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -306,7 +306,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 306 | 306 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 307 | 307 | } |
| 308 | 308 | }); |
| 309 | - return result; | |
| 309 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -292,7 +292,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 292 | 292 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 293 | 293 | return invalidValue(l(ref || "object"), val, key, parent); |
| 294 | 294 | } |
| 295 | - const result: any = {}; | |
| 295 | + const result: any = Object.create(null); | |
| 296 | 296 | Object.getOwnPropertyNames(props).forEach(key => { |
| 297 | 297 | const prop = props[key]; |
| 298 | 298 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -303,7 +303,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 303 | 303 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 304 | 304 | } |
| 305 | 305 | }); |
| 306 | - return result; | |
| 306 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/617e8.json
Mflowdefault / TopLevel.js+2 −2
| @@ -294,7 +294,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 294 | 294 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 295 | 295 | return invalidValue(l(ref || "object"), val, key, parent); |
| 296 | 296 | } |
| 297 | - const result: any = {}; | |
| 297 | + const result: any = Object.create(null); | |
| 298 | 298 | Object.getOwnPropertyNames(props).forEach(key => { |
| 299 | 299 | const prop = props[key]; |
| 300 | 300 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -305,7 +305,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 305 | 305 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 306 | 306 | } |
| 307 | 307 | }); |
| 308 | - return result; | |
| 308 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -291,7 +291,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 291 | 291 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 292 | 292 | return invalidValue(l(ref || "object"), val, key, parent); |
| 293 | 293 | } |
| 294 | - const result: any = {}; | |
| 294 | + const result: any = Object.create(null); | |
| 295 | 295 | Object.getOwnPropertyNames(props).forEach(key => { |
| 296 | 296 | const prop = props[key]; |
| 297 | 297 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -302,7 +302,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 302 | 302 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 303 | 303 | } |
| 304 | 304 | }); |
| 305 | - return result; | |
| 305 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/61b66.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/6260a.json
Melmdefault / QuickType.elm+9 −1
| @@ -51,11 +51,19 @@ encodeQuickType x = | ||
| 51 | 51 | Jenc.object |
| 52 | 52 | [ ("base", Jenc.string x.base) |
| 53 | 53 | , ("date", Jenc.string x.date) |
| 54 | - , ("rates", Jenc.dict identity Jenc.float x.rates) | |
| 54 | + , ("rates", makeDictEncoder identity Jenc.float x.rates) | |
| 55 | 55 | ] |
| 56 | 56 | |
| 57 | 57 | --- encoder helpers |
| 58 | 58 | |
| 59 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 60 | +makeDictEncoder f m r = | |
| 61 | + r | |
| 62 | + |> Dict.toList | |
| 63 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 64 | + |> String.join "," | |
| 65 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 66 | + | |
| 59 | 67 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 60 | 68 | makeNullableEncoder f m = |
| 61 | 69 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,8 +1,26 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | 23 | "base": S.String, |
| 6 | 24 | "date": S.String.pipe(S.pattern(/^\d{4}-\d{2}-\d{2}$/)), |
| 7 | - "rates": S.Record({ key: S.String, value: S.Number}), | |
| 25 | + "rates": mapSchema(S.Number), | |
| 8 | 26 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/65dec.json
Mflowdefault / TopLevel.js+2 −2
| @@ -194,7 +194,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 194 | 194 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 195 | 195 | return invalidValue(l(ref || "object"), val, key, parent); |
| 196 | 196 | } |
| 197 | - const result: any = {}; | |
| 197 | + const result: any = Object.create(null); | |
| 198 | 198 | Object.getOwnPropertyNames(props).forEach(key => { |
| 199 | 199 | const prop = props[key]; |
| 200 | 200 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 206 | 206 | } |
| 207 | 207 | }); |
| 208 | - return result; | |
| 208 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -170,7 +170,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 170 | 170 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 171 | 171 | return invalidValue(l(ref || "object"), val, key, parent); |
| 172 | 172 | } |
| 173 | - const result: any = {}; | |
| 173 | + const result: any = Object.create(null); | |
| 174 | 174 | Object.getOwnPropertyNames(props).forEach(key => { |
| 175 | 175 | const prop = props[key]; |
| 176 | 176 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -181,7 +181,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 181 | 181 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 182 | 182 | } |
| 183 | 183 | }); |
| 184 | - return result; | |
| 184 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/66121.json
Mflowdefault / TopLevel.js+2 −2
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 152 | 152 | return invalidValue(l(ref || "object"), val, key, parent); |
| 153 | 153 | } |
| 154 | - const result: any = {}; | |
| 154 | + const result: any = Object.create(null); | |
| 155 | 155 | Object.getOwnPropertyNames(props).forEach(key => { |
| 156 | 156 | const prop = props[key]; |
| 157 | 157 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -162,7 +162,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 162 | 162 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 163 | 163 | } |
| 164 | 164 | }); |
| 165 | - return result; | |
| 165 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 143 | 143 | return invalidValue(l(ref || "object"), val, key, parent); |
| 144 | 144 | } |
| 145 | - const result: any = {}; | |
| 145 | + const result: any = Object.create(null); | |
| 146 | 146 | Object.getOwnPropertyNames(props).forEach(key => { |
| 147 | 147 | const prop = props[key]; |
| 148 | 148 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -153,7 +153,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 153 | 153 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 154 | 154 | } |
| 155 | 155 | }); |
| 156 | - return result; | |
| 156 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/6617c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/67c03.json
Mflowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/68c30.json
Mflowdefault / TopLevel.js+2 −2
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 139 | 139 | return invalidValue(l(ref || "object"), val, key, parent); |
| 140 | 140 | } |
| 141 | - const result: any = {}; | |
| 141 | + const result: any = Object.create(null); | |
| 142 | 142 | Object.getOwnPropertyNames(props).forEach(key => { |
| 143 | 143 | const prop = props[key]; |
| 144 | 144 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -149,7 +149,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 149 | 149 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 150 | 150 | } |
| 151 | 151 | }); |
| 152 | - return result; | |
| 152 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 139 | 139 | return invalidValue(l(ref || "object"), val, key, parent); |
| 140 | 140 | } |
| 141 | - const result: any = {}; | |
| 141 | + const result: any = Object.create(null); | |
| 142 | 142 | Object.getOwnPropertyNames(props).forEach(key => { |
| 143 | 143 | const prop = props[key]; |
| 144 | 144 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -149,7 +149,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 149 | 149 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 150 | 150 | } |
| 151 | 151 | }); |
| 152 | - return result; | |
| 152 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/6c155.json
Mflowdefault / TopLevel.js+2 −2
| @@ -160,7 +160,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 160 | 160 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 161 | 161 | return invalidValue(l(ref || "object"), val, key, parent); |
| 162 | 162 | } |
| 163 | - const result: any = {}; | |
| 163 | + const result: any = Object.create(null); | |
| 164 | 164 | Object.getOwnPropertyNames(props).forEach(key => { |
| 165 | 165 | const prop = props[key]; |
| 166 | 166 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -171,7 +171,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 171 | 171 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 172 | 172 | } |
| 173 | 173 | }); |
| 174 | - return result; | |
| 174 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -160,7 +160,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 160 | 160 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 161 | 161 | return invalidValue(l(ref || "object"), val, key, parent); |
| 162 | 162 | } |
| 163 | - const result: any = {}; | |
| 163 | + const result: any = Object.create(null); | |
| 164 | 164 | Object.getOwnPropertyNames(props).forEach(key => { |
| 165 | 165 | const prop = props[key]; |
| 166 | 166 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -171,7 +171,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 171 | 171 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 172 | 172 | } |
| 173 | 173 | }); |
| 174 | - return result; | |
| 174 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/6de06.json
Mflowdefault / TopLevel.js+2 −2
| @@ -255,7 +255,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 255 | 255 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 256 | 256 | return invalidValue(l(ref || "object"), val, key, parent); |
| 257 | 257 | } |
| 258 | - const result: any = {}; | |
| 258 | + const result: any = Object.create(null); | |
| 259 | 259 | Object.getOwnPropertyNames(props).forEach(key => { |
| 260 | 260 | const prop = props[key]; |
| 261 | 261 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -266,7 +266,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 266 | 266 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 267 | 267 | } |
| 268 | 268 | }); |
| 269 | - return result; | |
| 269 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -250,7 +250,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 250 | 250 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 251 | 251 | return invalidValue(l(ref || "object"), val, key, parent); |
| 252 | 252 | } |
| 253 | - const result: any = {}; | |
| 253 | + const result: any = Object.create(null); | |
| 254 | 254 | Object.getOwnPropertyNames(props).forEach(key => { |
| 255 | 255 | const prop = props[key]; |
| 256 | 256 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -261,7 +261,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 261 | 261 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 262 | 262 | } |
| 263 | 263 | }); |
| 264 | - return result; | |
| 264 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/6dec6.json
Mflowdefault / TopLevel.js+2 −2
| @@ -210,7 +210,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 210 | 210 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 211 | 211 | return invalidValue(l(ref || "object"), val, key, parent); |
| 212 | 212 | } |
| 213 | - const result: any = {}; | |
| 213 | + const result: any = Object.create(null); | |
| 214 | 214 | Object.getOwnPropertyNames(props).forEach(key => { |
| 215 | 215 | const prop = props[key]; |
| 216 | 216 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -221,7 +221,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 221 | 221 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 222 | 222 | } |
| 223 | 223 | }); |
| 224 | - return result; | |
| 224 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -207,7 +207,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 207 | 207 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 208 | 208 | return invalidValue(l(ref || "object"), val, key, parent); |
| 209 | 209 | } |
| 210 | - const result: any = {}; | |
| 210 | + const result: any = Object.create(null); | |
| 211 | 211 | Object.getOwnPropertyNames(props).forEach(key => { |
| 212 | 212 | const prop = props[key]; |
| 213 | 213 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -218,7 +218,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 218 | 218 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 219 | 219 | } |
| 220 | 220 | }); |
| 221 | - return result; | |
| 221 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/6eb00.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/70c77.json
Melmdefault / QuickType.elm+9 −1
| @@ -51,11 +51,19 @@ encodeQuickType x = | ||
| 51 | 51 | Jenc.object |
| 52 | 52 | [ ("base", Jenc.string x.base) |
| 53 | 53 | , ("date", Jenc.string x.date) |
| 54 | - , ("rates", Jenc.dict identity Jenc.float x.rates) | |
| 54 | + , ("rates", makeDictEncoder identity Jenc.float x.rates) | |
| 55 | 55 | ] |
| 56 | 56 | |
| 57 | 57 | --- encoder helpers |
| 58 | 58 | |
| 59 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 60 | +makeDictEncoder f m r = | |
| 61 | + r | |
| 62 | + |> Dict.toList | |
| 63 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 64 | + |> String.join "," | |
| 65 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 66 | + | |
| 59 | 67 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 60 | 68 | makeNullableEncoder f m = |
| 61 | 69 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,8 +1,26 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | 23 | "base": S.String, |
| 6 | 24 | "date": S.String.pipe(S.pattern(/^\d{4}-\d{2}-\d{2}$/)), |
| 7 | - "rates": S.Record({ key: S.String, value: S.Number}), | |
| 25 | + "rates": mapSchema(S.Number), | |
| 8 | 26 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/734ad.json
Mflowdefault / TopLevel.js+2 −2
| @@ -181,7 +181,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 181 | 181 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 182 | 182 | return invalidValue(l(ref || "object"), val, key, parent); |
| 183 | 183 | } |
| 184 | - const result: any = {}; | |
| 184 | + const result: any = Object.create(null); | |
| 185 | 185 | Object.getOwnPropertyNames(props).forEach(key => { |
| 186 | 186 | const prop = props[key]; |
| 187 | 187 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -192,7 +192,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 192 | 192 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 193 | 193 | } |
| 194 | 194 | }); |
| 195 | - return result; | |
| 195 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -176,7 +176,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 176 | 176 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 177 | 177 | return invalidValue(l(ref || "object"), val, key, parent); |
| 178 | 178 | } |
| 179 | - const result: any = {}; | |
| 179 | + const result: any = Object.create(null); | |
| 180 | 180 | Object.getOwnPropertyNames(props).forEach(key => { |
| 181 | 181 | const prop = props[key]; |
| 182 | 182 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -187,7 +187,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 187 | 187 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 188 | 188 | } |
| 189 | 189 | }); |
| 190 | - return result; | |
| 190 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/75912.json
Melmdefault / QuickType.elm+9 −1
| @@ -51,11 +51,19 @@ encodeQuickType x = | ||
| 51 | 51 | Jenc.object |
| 52 | 52 | [ ("base", Jenc.string x.base) |
| 53 | 53 | , ("date", Jenc.string x.date) |
| 54 | - , ("rates", Jenc.dict identity Jenc.float x.rates) | |
| 54 | + , ("rates", makeDictEncoder identity Jenc.float x.rates) | |
| 55 | 55 | ] |
| 56 | 56 | |
| 57 | 57 | --- encoder helpers |
| 58 | 58 | |
| 59 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 60 | +makeDictEncoder f m r = | |
| 61 | + r | |
| 62 | + |> Dict.toList | |
| 63 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 64 | + |> String.join "," | |
| 65 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 66 | + | |
| 59 | 67 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 60 | 68 | makeNullableEncoder f m = |
| 61 | 69 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,8 +1,26 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | 23 | "base": S.String, |
| 6 | 24 | "date": S.String.pipe(S.pattern(/^\d{4}-\d{2}-\d{2}$/)), |
| 7 | - "rates": S.Record({ key: S.String, value: S.Number}), | |
| 25 | + "rates": mapSchema(S.Number), | |
| 8 | 26 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/7681c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -223,7 +223,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 223 | 223 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 224 | 224 | return invalidValue(l(ref || "object"), val, key, parent); |
| 225 | 225 | } |
| 226 | - const result: any = {}; | |
| 226 | + const result: any = Object.create(null); | |
| 227 | 227 | Object.getOwnPropertyNames(props).forEach(key => { |
| 228 | 228 | const prop = props[key]; |
| 229 | 229 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -234,7 +234,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 234 | 234 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 235 | 235 | } |
| 236 | 236 | }); |
| 237 | - return result; | |
| 237 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -215,7 +215,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 215 | 215 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 216 | 216 | return invalidValue(l(ref || "object"), val, key, parent); |
| 217 | 217 | } |
| 218 | - const result: any = {}; | |
| 218 | + const result: any = Object.create(null); | |
| 219 | 219 | Object.getOwnPropertyNames(props).forEach(key => { |
| 220 | 220 | const prop = props[key]; |
| 221 | 221 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -226,7 +226,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 226 | 226 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 227 | 227 | } |
| 228 | 228 | }); |
| 229 | - return result; | |
| 229 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/76ae1.json
Melmdefault / QuickType.elm+9 −1
| @@ -316,7 +316,7 @@ article = | ||
| 316 | 316 | encodeArticle : Article -> Jenc.Value |
| 317 | 317 | encodeArticle x = |
| 318 | 318 | Jenc.object |
| 319 | - [ ("properties", Jenc.dict identity encodeProperty x.properties) | |
| 319 | + [ ("properties", makeDictEncoder identity encodeProperty x.properties) | |
| 320 | 320 | ] |
| 321 | 321 | |
| 322 | 322 | property : Jdec.Decoder Property |
| @@ -722,6 +722,14 @@ encodeSchemaType x = case x of | ||
| 722 | 722 | |
| 723 | 723 | --- encoder helpers |
| 724 | 724 | |
| 725 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 726 | +makeDictEncoder f m r = | |
| 727 | + r | |
| 728 | + |> Dict.toList | |
| 729 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 730 | + |> String.join "," | |
| 731 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 732 | + | |
| 725 | 733 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 726 | 734 | makeNullableEncoder f m = |
| 727 | 735 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -291,7 +291,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 291 | 291 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 292 | 292 | return invalidValue(l(ref || "object"), val, key, parent); |
| 293 | 293 | } |
| 294 | - const result: any = {}; | |
| 294 | + const result: any = Object.create(null); | |
| 295 | 295 | Object.getOwnPropertyNames(props).forEach(key => { |
| 296 | 296 | const prop = props[key]; |
| 297 | 297 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -302,7 +302,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 302 | 302 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 303 | 303 | } |
| 304 | 304 | }); |
| 305 | - return result; | |
| 305 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export const FormatEnum = S.Literal( |
| 5 | 23 | "string", |
| @@ -80,7 +98,7 @@ export class Property extends S.Class<Property>("Property")({ | ||
| 80 | 98 | }) {} |
| 81 | 99 | |
| 82 | 100 | export class Article extends S.Class<Article>("Article")({ |
| 83 | - "properties": S.Record({ key: S.String, value: Property}), | |
| 101 | + "properties": mapSchema(Property), | |
| 84 | 102 | }) {} |
| 85 | 103 | |
| 86 | 104 | export class Definitions extends S.Class<Definitions>("Definitions")({ |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -288,7 +288,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 288 | 288 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 289 | 289 | return invalidValue(l(ref || "object"), val, key, parent); |
| 290 | 290 | } |
| 291 | - const result: any = {}; | |
| 291 | + const result: any = Object.create(null); | |
| 292 | 292 | Object.getOwnPropertyNames(props).forEach(key => { |
| 293 | 293 | const prop = props[key]; |
| 294 | 294 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -299,7 +299,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 299 | 299 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 300 | 300 | } |
| 301 | 301 | }); |
| 302 | - return result; | |
| 302 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/77392.json
Mflowdefault / TopLevel.js+2 −2
| @@ -134,7 +134,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 134 | 134 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 135 | 135 | return invalidValue(l(ref || "object"), val, key, parent); |
| 136 | 136 | } |
| 137 | - const result: any = {}; | |
| 137 | + const result: any = Object.create(null); | |
| 138 | 138 | Object.getOwnPropertyNames(props).forEach(key => { |
| 139 | 139 | const prop = props[key]; |
| 140 | 140 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -145,7 +145,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 145 | 145 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 146 | 146 | } |
| 147 | 147 | }); |
| 148 | - return result; | |
| 148 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 123 | 123 | return invalidValue(l(ref || "object"), val, key, parent); |
| 124 | 124 | } |
| 125 | - const result: any = {}; | |
| 125 | + const result: any = Object.create(null); | |
| 126 | 126 | Object.getOwnPropertyNames(props).forEach(key => { |
| 127 | 127 | const prop = props[key]; |
| 128 | 128 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -133,7 +133,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 133 | 133 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 134 | 134 | } |
| 135 | 135 | }); |
| 136 | - return result; | |
| 136 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/7d397.json
Melmdefault / QuickType.elm+9 −1
| @@ -170,7 +170,7 @@ listClass = | ||
| 170 | 170 | encodeListClass : ListClass -> Jenc.Value |
| 171 | 171 | encodeListClass x = |
| 172 | 172 | Jenc.object |
| 173 | - [ ("properties", Jenc.dict identity encodeProperty x.properties) | |
| 173 | + [ ("properties", makeDictEncoder identity encodeProperty x.properties) | |
| 174 | 174 | ] |
| 175 | 175 | |
| 176 | 176 | property : Jdec.Decoder Property |
| @@ -339,6 +339,14 @@ encodeItems x = | ||
| 339 | 339 | |
| 340 | 340 | --- encoder helpers |
| 341 | 341 | |
| 342 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 343 | +makeDictEncoder f m r = | |
| 344 | + r | |
| 345 | + |> Dict.toList | |
| 346 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 347 | + |> String.join "," | |
| 348 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 349 | + | |
| 342 | 350 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 343 | 351 | makeNullableEncoder f m = |
| 344 | 352 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -182,7 +182,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 182 | 182 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 183 | 183 | return invalidValue(l(ref || "object"), val, key, parent); |
| 184 | 184 | } |
| 185 | - const result: any = {}; | |
| 185 | + const result: any = Object.create(null); | |
| 186 | 186 | Object.getOwnPropertyNames(props).forEach(key => { |
| 187 | 187 | const prop = props[key]; |
| 188 | 188 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -193,7 +193,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 193 | 193 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 194 | 194 | } |
| 195 | 195 | }); |
| 196 | - return result; | |
| 196 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export const Type = S.Literal( |
| 5 | 23 | "string", |
| @@ -67,7 +85,7 @@ export class Property extends S.Class<Property>("Property")({ | ||
| 67 | 85 | }) {} |
| 68 | 86 | |
| 69 | 87 | export class List extends S.Class<List>("List")({ |
| 70 | - "properties": S.Record({ key: S.String, value: Property}), | |
| 88 | + "properties": mapSchema(Property), | |
| 71 | 89 | }) {} |
| 72 | 90 | |
| 73 | 91 | export class Definitions extends S.Class<Definitions>("Definitions")({ |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -180,7 +180,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 180 | 180 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 181 | 181 | return invalidValue(l(ref || "object"), val, key, parent); |
| 182 | 182 | } |
| 183 | - const result: any = {}; | |
| 183 | + const result: any = Object.create(null); | |
| 184 | 184 | Object.getOwnPropertyNames(props).forEach(key => { |
| 185 | 185 | const prop = props[key]; |
| 186 | 186 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -191,7 +191,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 191 | 191 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 192 | 192 | } |
| 193 | 193 | }); |
| 194 | - return result; | |
| 194 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/7d722.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/7df41.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/7dfa6.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/7eb30.json
Mflowdefault / TopLevel.js+2 −2
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 152 | 152 | return invalidValue(l(ref || "object"), val, key, parent); |
| 153 | 153 | } |
| 154 | - const result: any = {}; | |
| 154 | + const result: any = Object.create(null); | |
| 155 | 155 | Object.getOwnPropertyNames(props).forEach(key => { |
| 156 | 156 | const prop = props[key]; |
| 157 | 157 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -162,7 +162,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 162 | 162 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 163 | 163 | } |
| 164 | 164 | }); |
| 165 | - return result; | |
| 165 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -144,7 +144,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 144 | 144 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 145 | 145 | return invalidValue(l(ref || "object"), val, key, parent); |
| 146 | 146 | } |
| 147 | - const result: any = {}; | |
| 147 | + const result: any = Object.create(null); | |
| 148 | 148 | Object.getOwnPropertyNames(props).forEach(key => { |
| 149 | 149 | const prop = props[key]; |
| 150 | 150 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -155,7 +155,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 155 | 155 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 156 | 156 | } |
| 157 | 157 | }); |
| 158 | - return result; | |
| 158 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/7f568.json
Melmdefault / QuickType.elm+9 −1
| @@ -103,7 +103,7 @@ encodeQuickTypeElement x = | ||
| 103 | 103 | , ("commits_url", Jenc.string x.commitsURL) |
| 104 | 104 | , ("created_at", Jenc.string x.createdAt) |
| 105 | 105 | , ("description", makeNullableEncoder Jenc.string x.description) |
| 106 | - , ("files", Jenc.dict identity encodeFile x.files) | |
| 106 | + , ("files", makeDictEncoder identity encodeFile x.files) | |
| 107 | 107 | , ("forks_url", Jenc.string x.forksURL) |
| 108 | 108 | , ("git_pull_url", Jenc.string x.gitPullURL) |
| 109 | 109 | , ("git_push_url", Jenc.string x.gitPushURL) |
| @@ -163,6 +163,14 @@ encodeLanguage x = case x of | ||
| 163 | 163 | |
| 164 | 164 | --- encoder helpers |
| 165 | 165 | |
| 166 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 167 | +makeDictEncoder f m r = | |
| 168 | + r | |
| 169 | + |> Dict.toList | |
| 170 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 171 | + |> String.join "," | |
| 172 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 173 | + | |
| 166 | 174 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 167 | 175 | makeNullableEncoder f m = |
| 168 | 176 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 139 | 139 | return invalidValue(l(ref || "object"), val, key, parent); |
| 140 | 140 | } |
| 141 | - const result: any = {}; | |
| 141 | + const result: any = Object.create(null); | |
| 142 | 142 | Object.getOwnPropertyNames(props).forEach(key => { |
| 143 | 143 | const prop = props[key]; |
| 144 | 144 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -149,7 +149,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 149 | 149 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 150 | 150 | } |
| 151 | 151 | }); |
| 152 | - return result; | |
| 152 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export const Language = S.Literal( |
| 5 | 23 | "Markdown", |
| @@ -26,7 +44,7 @@ export class TopLevelElement extends S.Class<TopLevelElement>("TopLevelElement") | ||
| 26 | 44 | "commits_url": S.String, |
| 27 | 45 | "created_at": S.String.pipe(S.pattern(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/)), |
| 28 | 46 | "description": S.NullOr(S.String), |
| 29 | - "files": S.Record({ key: S.String, value: File}), | |
| 47 | + "files": mapSchema(File), | |
| 30 | 48 | "forks_url": S.String, |
| 31 | 49 | "git_pull_url": S.String, |
| 32 | 50 | "git_push_url": S.String, |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/7fbfb.json
Mflowdefault / TopLevel.js+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 132 | 132 | return invalidValue(l(ref || "object"), val, key, parent); |
| 133 | 133 | } |
| 134 | - const result: any = {}; | |
| 134 | + const result: any = Object.create(null); | |
| 135 | 135 | Object.getOwnPropertyNames(props).forEach(key => { |
| 136 | 136 | const prop = props[key]; |
| 137 | 137 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | - return result; | |
| 145 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/80aff.json
Mflowdefault / TopLevel.js+2 −2
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 127 | 127 | return invalidValue(l(ref || "object"), val, key, parent); |
| 128 | 128 | } |
| 129 | - const result: any = {}; | |
| 129 | + const result: any = Object.create(null); | |
| 130 | 130 | Object.getOwnPropertyNames(props).forEach(key => { |
| 131 | 131 | const prop = props[key]; |
| 132 | 132 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -137,7 +137,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 137 | 137 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 138 | 138 | } |
| 139 | 139 | }); |
| 140 | - return result; | |
| 140 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 124 | 124 | return invalidValue(l(ref || "object"), val, key, parent); |
| 125 | 125 | } |
| 126 | - const result: any = {}; | |
| 126 | + const result: any = Object.create(null); | |
| 127 | 127 | Object.getOwnPropertyNames(props).forEach(key => { |
| 128 | 128 | const prop = props[key]; |
| 129 | 129 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -134,7 +134,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 134 | 134 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 135 | 135 | } |
| 136 | 136 | }); |
| 137 | - return result; | |
| 137 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/82509.json
Mflowdefault / TopLevel.js+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/8592b.json
Mflowdefault / TopLevel.js+2 −2
| @@ -230,7 +230,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 230 | 230 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 231 | 231 | return invalidValue(l(ref || "object"), val, key, parent); |
| 232 | 232 | } |
| 233 | - const result: any = {}; | |
| 233 | + const result: any = Object.create(null); | |
| 234 | 234 | Object.getOwnPropertyNames(props).forEach(key => { |
| 235 | 235 | const prop = props[key]; |
| 236 | 236 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -241,7 +241,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 241 | 241 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 242 | 242 | } |
| 243 | 243 | }); |
| 244 | - return result; | |
| 244 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -219,7 +219,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 219 | 219 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 220 | 220 | return invalidValue(l(ref || "object"), val, key, parent); |
| 221 | 221 | } |
| 222 | - const result: any = {}; | |
| 222 | + const result: any = Object.create(null); | |
| 223 | 223 | Object.getOwnPropertyNames(props).forEach(key => { |
| 224 | 224 | const prop = props[key]; |
| 225 | 225 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -230,7 +230,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 230 | 230 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 231 | 231 | } |
| 232 | 232 | }); |
| 233 | - return result; | |
| 233 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/88130.json
Mflowdefault / TopLevel.js+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/8a62c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/908db.json
Mflowdefault / TopLevel.js+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/9617f.json
Melmdefault / QuickType.elm+9 −1
| @@ -51,11 +51,19 @@ encodeQuickType x = | ||
| 51 | 51 | Jenc.object |
| 52 | 52 | [ ("base", Jenc.string x.base) |
| 53 | 53 | , ("date", Jenc.string x.date) |
| 54 | - , ("rates", Jenc.dict identity Jenc.float x.rates) | |
| 54 | + , ("rates", makeDictEncoder identity Jenc.float x.rates) | |
| 55 | 55 | ] |
| 56 | 56 | |
| 57 | 57 | --- encoder helpers |
| 58 | 58 | |
| 59 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 60 | +makeDictEncoder f m r = | |
| 61 | + r | |
| 62 | + |> Dict.toList | |
| 63 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 64 | + |> String.join "," | |
| 65 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 66 | + | |
| 59 | 67 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 60 | 68 | makeNullableEncoder f m = |
| 61 | 69 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,8 +1,26 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | 23 | "base": S.String, |
| 6 | 24 | "date": S.String.pipe(S.pattern(/^\d{4}-\d{2}-\d{2}$/)), |
| 7 | - "rates": S.Record({ key: S.String, value: S.Number}), | |
| 25 | + "rates": mapSchema(S.Number), | |
| 8 | 26 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/96f7c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/9847b.json
Mflowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/9929c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/996bd.json
Mflowdefault / TopLevel.js+2 −2
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 152 | 152 | return invalidValue(l(ref || "object"), val, key, parent); |
| 153 | 153 | } |
| 154 | - const result: any = {}; | |
| 154 | + const result: any = Object.create(null); | |
| 155 | 155 | Object.getOwnPropertyNames(props).forEach(key => { |
| 156 | 156 | const prop = props[key]; |
| 157 | 157 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -162,7 +162,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 162 | 162 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 163 | 163 | } |
| 164 | 164 | }); |
| 165 | - return result; | |
| 165 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/9a503.json
Mflowdefault / TopLevel.js+2 −2
| @@ -137,7 +137,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 137 | 137 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 138 | 138 | return invalidValue(l(ref || "object"), val, key, parent); |
| 139 | 139 | } |
| 140 | - const result: any = {}; | |
| 140 | + const result: any = Object.create(null); | |
| 141 | 141 | Object.getOwnPropertyNames(props).forEach(key => { |
| 142 | 142 | const prop = props[key]; |
| 143 | 143 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -148,7 +148,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 148 | 148 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 149 | 149 | } |
| 150 | 150 | }); |
| 151 | - return result; | |
| 151 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -134,7 +134,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 134 | 134 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 135 | 135 | return invalidValue(l(ref || "object"), val, key, parent); |
| 136 | 136 | } |
| 137 | - const result: any = {}; | |
| 137 | + const result: any = Object.create(null); | |
| 138 | 138 | Object.getOwnPropertyNames(props).forEach(key => { |
| 139 | 139 | const prop = props[key]; |
| 140 | 140 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -145,7 +145,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 145 | 145 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 146 | 146 | } |
| 147 | 147 | }); |
| 148 | - return result; | |
| 148 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/9ac3b.json
Mflowdefault / TopLevel.js+2 −2
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 139 | 139 | return invalidValue(l(ref || "object"), val, key, parent); |
| 140 | 140 | } |
| 141 | - const result: any = {}; | |
| 141 | + const result: any = Object.create(null); | |
| 142 | 142 | Object.getOwnPropertyNames(props).forEach(key => { |
| 143 | 143 | const prop = props[key]; |
| 144 | 144 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -149,7 +149,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 149 | 149 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 150 | 150 | } |
| 151 | 151 | }); |
| 152 | - return result; | |
| 152 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 132 | 132 | return invalidValue(l(ref || "object"), val, key, parent); |
| 133 | 133 | } |
| 134 | - const result: any = {}; | |
| 134 | + const result: any = Object.create(null); | |
| 135 | 135 | Object.getOwnPropertyNames(props).forEach(key => { |
| 136 | 136 | const prop = props[key]; |
| 137 | 137 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | - return result; | |
| 145 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/9eed5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -134,7 +134,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 134 | 134 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 135 | 135 | return invalidValue(l(ref || "object"), val, key, parent); |
| 136 | 136 | } |
| 137 | - const result: any = {}; | |
| 137 | + const result: any = Object.create(null); | |
| 138 | 138 | Object.getOwnPropertyNames(props).forEach(key => { |
| 139 | 139 | const prop = props[key]; |
| 140 | 140 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -145,7 +145,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 145 | 145 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 146 | 146 | } |
| 147 | 147 | }); |
| 148 | - return result; | |
| 148 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/a0496.json
Mflowdefault / TopLevel.js+2 −2
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 129 | 129 | return invalidValue(l(ref || "object"), val, key, parent); |
| 130 | 130 | } |
| 131 | - const result: any = {}; | |
| 131 | + const result: any = Object.create(null); | |
| 132 | 132 | Object.getOwnPropertyNames(props).forEach(key => { |
| 133 | 133 | const prop = props[key]; |
| 134 | 134 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -139,7 +139,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 139 | 139 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 140 | 140 | } |
| 141 | 141 | }); |
| 142 | - return result; | |
| 142 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 126 | 126 | return invalidValue(l(ref || "object"), val, key, parent); |
| 127 | 127 | } |
| 128 | - const result: any = {}; | |
| 128 | + const result: any = Object.create(null); | |
| 129 | 129 | Object.getOwnPropertyNames(props).forEach(key => { |
| 130 | 130 | const prop = props[key]; |
| 131 | 131 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 137 | 137 | } |
| 138 | 138 | }); |
| 139 | - return result; | |
| 139 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/a1eca.json
Mflowdefault / TopLevel.js+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/a3d8c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -223,7 +223,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 223 | 223 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 224 | 224 | return invalidValue(l(ref || "object"), val, key, parent); |
| 225 | 225 | } |
| 226 | - const result: any = {}; | |
| 226 | + const result: any = Object.create(null); | |
| 227 | 227 | Object.getOwnPropertyNames(props).forEach(key => { |
| 228 | 228 | const prop = props[key]; |
| 229 | 229 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -234,7 +234,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 234 | 234 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 235 | 235 | } |
| 236 | 236 | }); |
| 237 | - return result; | |
| 237 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -217,7 +217,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 217 | 217 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 218 | 218 | return invalidValue(l(ref || "object"), val, key, parent); |
| 219 | 219 | } |
| 220 | - const result: any = {}; | |
| 220 | + const result: any = Object.create(null); | |
| 221 | 221 | Object.getOwnPropertyNames(props).forEach(key => { |
| 222 | 222 | const prop = props[key]; |
| 223 | 223 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -228,7 +228,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 228 | 228 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 229 | 229 | } |
| 230 | 230 | }); |
| 231 | - return result; | |
| 231 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/a45b0.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/a71df.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/a9691.json
Melmdefault / QuickType.elm+9 −1
| @@ -51,11 +51,19 @@ encodeQuickType x = | ||
| 51 | 51 | Jenc.object |
| 52 | 52 | [ ("base", Jenc.string x.base) |
| 53 | 53 | , ("date", Jenc.string x.date) |
| 54 | - , ("rates", Jenc.dict identity Jenc.float x.rates) | |
| 54 | + , ("rates", makeDictEncoder identity Jenc.float x.rates) | |
| 55 | 55 | ] |
| 56 | 56 | |
| 57 | 57 | --- encoder helpers |
| 58 | 58 | |
| 59 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 60 | +makeDictEncoder f m r = | |
| 61 | + r | |
| 62 | + |> Dict.toList | |
| 63 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 64 | + |> String.join "," | |
| 65 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 66 | + | |
| 59 | 67 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 60 | 68 | makeNullableEncoder f m = |
| 61 | 69 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,8 +1,26 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | 23 | "base": S.String, |
| 6 | 24 | "date": S.String.pipe(S.pattern(/^\d{4}-\d{2}-\d{2}$/)), |
| 7 | - "rates": S.Record({ key: S.String, value: S.Number}), | |
| 25 | + "rates": mapSchema(S.Number), | |
| 8 | 26 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/ab0d1.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/abb4b.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/ac944.json
Melmdefault / QuickType.elm+9 −1
| @@ -51,11 +51,19 @@ encodeQuickType x = | ||
| 51 | 51 | Jenc.object |
| 52 | 52 | [ ("base", Jenc.string x.base) |
| 53 | 53 | , ("date", Jenc.string x.date) |
| 54 | - , ("rates", Jenc.dict identity Jenc.float x.rates) | |
| 54 | + , ("rates", makeDictEncoder identity Jenc.float x.rates) | |
| 55 | 55 | ] |
| 56 | 56 | |
| 57 | 57 | --- encoder helpers |
| 58 | 58 | |
| 59 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 60 | +makeDictEncoder f m r = | |
| 61 | + r | |
| 62 | + |> Dict.toList | |
| 63 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 64 | + |> String.join "," | |
| 65 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 66 | + | |
| 59 | 67 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 60 | 68 | makeNullableEncoder f m = |
| 61 | 69 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,8 +1,26 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | 23 | "base": S.String, |
| 6 | 24 | "date": S.String.pipe(S.pattern(/^\d{4}-\d{2}-\d{2}$/)), |
| 7 | - "rates": S.Record({ key: S.String, value: S.Number}), | |
| 25 | + "rates": mapSchema(S.Number), | |
| 8 | 26 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/ad8be.json
Mflowdefault / TopLevel.js+2 −2
| @@ -174,7 +174,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 174 | 174 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 175 | 175 | return invalidValue(l(ref || "object"), val, key, parent); |
| 176 | 176 | } |
| 177 | - const result: any = {}; | |
| 177 | + const result: any = Object.create(null); | |
| 178 | 178 | Object.getOwnPropertyNames(props).forEach(key => { |
| 179 | 179 | const prop = props[key]; |
| 180 | 180 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -185,7 +185,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 185 | 185 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 186 | 186 | } |
| 187 | 187 | }); |
| 188 | - return result; | |
| 188 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/ae7f0.json
Mflowdefault / TopLevel.js+2 −2
| @@ -204,7 +204,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 204 | 204 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 205 | 205 | return invalidValue(l(ref || "object"), val, key, parent); |
| 206 | 206 | } |
| 207 | - const result: any = {}; | |
| 207 | + const result: any = Object.create(null); | |
| 208 | 208 | Object.getOwnPropertyNames(props).forEach(key => { |
| 209 | 209 | const prop = props[key]; |
| 210 | 210 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -215,7 +215,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 215 | 215 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 216 | 216 | } |
| 217 | 217 | }); |
| 218 | - return result; | |
| 218 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -195,7 +195,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 195 | 195 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 196 | 196 | return invalidValue(l(ref || "object"), val, key, parent); |
| 197 | 197 | } |
| 198 | - const result: any = {}; | |
| 198 | + const result: any = Object.create(null); | |
| 199 | 199 | Object.getOwnPropertyNames(props).forEach(key => { |
| 200 | 200 | const prop = props[key]; |
| 201 | 201 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -206,7 +206,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 206 | 206 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 207 | 207 | } |
| 208 | 208 | }); |
| 209 | - return result; | |
| 209 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/ae9ca.json
Mflowdefault / TopLevel.js+2 −2
| @@ -153,7 +153,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 153 | 153 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 154 | 154 | return invalidValue(l(ref || "object"), val, key, parent); |
| 155 | 155 | } |
| 156 | - const result: any = {}; | |
| 156 | + const result: any = Object.create(null); | |
| 157 | 157 | Object.getOwnPropertyNames(props).forEach(key => { |
| 158 | 158 | const prop = props[key]; |
| 159 | 159 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -164,7 +164,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 164 | 164 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 165 | 165 | } |
| 166 | 166 | }); |
| 167 | - return result; | |
| 167 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 144 | 144 | return invalidValue(l(ref || "object"), val, key, parent); |
| 145 | 145 | } |
| 146 | - const result: any = {}; | |
| 146 | + const result: any = Object.create(null); | |
| 147 | 147 | Object.getOwnPropertyNames(props).forEach(key => { |
| 148 | 148 | const prop = props[key]; |
| 149 | 149 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -154,7 +154,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 154 | 154 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 155 | 155 | } |
| 156 | 156 | }); |
| 157 | - return result; | |
| 157 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/af2d1.json
Mflowdefault / TopLevel.js+2 −2
| @@ -215,7 +215,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 215 | 215 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 216 | 216 | return invalidValue(l(ref || "object"), val, key, parent); |
| 217 | 217 | } |
| 218 | - const result: any = {}; | |
| 218 | + const result: any = Object.create(null); | |
| 219 | 219 | Object.getOwnPropertyNames(props).forEach(key => { |
| 220 | 220 | const prop = props[key]; |
| 221 | 221 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -226,7 +226,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 226 | 226 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 227 | 227 | } |
| 228 | 228 | }); |
| 229 | - return result; | |
| 229 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -193,7 +193,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 193 | 193 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 194 | 194 | return invalidValue(l(ref || "object"), val, key, parent); |
| 195 | 195 | } |
| 196 | - const result: any = {}; | |
| 196 | + const result: any = Object.create(null); | |
| 197 | 197 | Object.getOwnPropertyNames(props).forEach(key => { |
| 198 | 198 | const prop = props[key]; |
| 199 | 199 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -204,7 +204,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 204 | 204 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 205 | 205 | } |
| 206 | 206 | }); |
| 207 | - return result; | |
| 207 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/b4865.json
Mflowdefault / TopLevel.js+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 132 | 132 | return invalidValue(l(ref || "object"), val, key, parent); |
| 133 | 133 | } |
| 134 | - const result: any = {}; | |
| 134 | + const result: any = Object.create(null); | |
| 135 | 135 | Object.getOwnPropertyNames(props).forEach(key => { |
| 136 | 136 | const prop = props[key]; |
| 137 | 137 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | - return result; | |
| 145 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/b6f2c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/b6fe5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/b9f64.json
Mflowdefault / TopLevel.js+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/bb1ec.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/be234.json
Mflowdefault / TopLevel.js+2 −2
| @@ -269,7 +269,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 269 | 269 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 270 | 270 | return invalidValue(l(ref || "object"), val, key, parent); |
| 271 | 271 | } |
| 272 | - const result: any = {}; | |
| 272 | + const result: any = Object.create(null); | |
| 273 | 273 | Object.getOwnPropertyNames(props).forEach(key => { |
| 274 | 274 | const prop = props[key]; |
| 275 | 275 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -280,7 +280,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 280 | 280 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 281 | 281 | } |
| 282 | 282 | }); |
| 283 | - return result; | |
| 283 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -256,7 +256,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 256 | 256 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 257 | 257 | return invalidValue(l(ref || "object"), val, key, parent); |
| 258 | 258 | } |
| 259 | - const result: any = {}; | |
| 259 | + const result: any = Object.create(null); | |
| 260 | 260 | Object.getOwnPropertyNames(props).forEach(key => { |
| 261 | 261 | const prop = props[key]; |
| 262 | 262 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -267,7 +267,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 267 | 267 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 268 | 268 | } |
| 269 | 269 | }); |
| 270 | - return result; | |
| 270 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/c0356.json
Melmdefault / QuickType.elm+9 −1
| @@ -60,7 +60,7 @@ quickType = | ||
| 60 | 60 | encodeQuickType : QuickType -> Jenc.Value |
| 61 | 61 | encodeQuickType x = |
| 62 | 62 | Jenc.object |
| 63 | - [ ("data", Jenc.dict identity encodeDatum x.data) | |
| 63 | + [ ("data", makeDictEncoder identity encodeDatum x.data) | |
| 64 | 64 | , ("description", encodeDescription x.description) |
| 65 | 65 | ] |
| 66 | 66 | |
| @@ -94,6 +94,14 @@ encodeDescription x = | ||
| 94 | 94 | |
| 95 | 95 | --- encoder helpers |
| 96 | 96 | |
| 97 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 98 | +makeDictEncoder f m r = | |
| 99 | + r | |
| 100 | + |> Dict.toList | |
| 101 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 102 | + |> String.join "," | |
| 103 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 104 | + | |
| 97 | 105 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 98 | 106 | makeNullableEncoder f m = |
| 99 | 107 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class Description extends S.Class<Description>("Description")({ |
| 5 | 23 | "base_period": S.String, |
| @@ -13,6 +31,6 @@ export class Datum extends S.Class<Datum>("Datum")({ | ||
| 13 | 31 | }) {} |
| 14 | 32 | |
| 15 | 33 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 16 | - "data": S.Record({ key: S.String, value: Datum}), | |
| 34 | + "data": mapSchema(Datum), | |
| 17 | 35 | "description": Description, |
| 18 | 36 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/c0a3a.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/c3303.json
Mflowdefault / TopLevel.js+2 −2
| @@ -220,7 +220,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 220 | 220 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 221 | 221 | return invalidValue(l(ref || "object"), val, key, parent); |
| 222 | 222 | } |
| 223 | - const result: any = {}; | |
| 223 | + const result: any = Object.create(null); | |
| 224 | 224 | Object.getOwnPropertyNames(props).forEach(key => { |
| 225 | 225 | const prop = props[key]; |
| 226 | 226 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -231,7 +231,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 231 | 231 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 232 | 232 | } |
| 233 | 233 | }); |
| 234 | - return result; | |
| 234 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -214,7 +214,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 214 | 214 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 215 | 215 | return invalidValue(l(ref || "object"), val, key, parent); |
| 216 | 216 | } |
| 217 | - const result: any = {}; | |
| 217 | + const result: any = Object.create(null); | |
| 218 | 218 | Object.getOwnPropertyNames(props).forEach(key => { |
| 219 | 219 | const prop = props[key]; |
| 220 | 220 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -225,7 +225,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 225 | 225 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 226 | 226 | } |
| 227 | 227 | }); |
| 228 | - return result; | |
| 228 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/c6cfd.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/c8c7e.json
Mflowdefault / TopLevel.js+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 132 | 132 | return invalidValue(l(ref || "object"), val, key, parent); |
| 133 | 133 | } |
| 134 | - const result: any = {}; | |
| 134 | + const result: any = Object.create(null); | |
| 135 | 135 | Object.getOwnPropertyNames(props).forEach(key => { |
| 136 | 136 | const prop = props[key]; |
| 137 | 137 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | - return result; | |
| 145 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/cb0cc.json
Mflowdefault / TopLevel.js+2 −2
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 131 | 131 | return invalidValue(l(ref || "object"), val, key, parent); |
| 132 | 132 | } |
| 133 | - const result: any = {}; | |
| 133 | + const result: any = Object.create(null); | |
| 134 | 134 | Object.getOwnPropertyNames(props).forEach(key => { |
| 135 | 135 | const prop = props[key]; |
| 136 | 136 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -141,7 +141,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 141 | 141 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 142 | 142 | } |
| 143 | 143 | }); |
| 144 | - return result; | |
| 144 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 125 | 125 | return invalidValue(l(ref || "object"), val, key, parent); |
| 126 | 126 | } |
| 127 | - const result: any = {}; | |
| 127 | + const result: any = Object.create(null); | |
| 128 | 128 | Object.getOwnPropertyNames(props).forEach(key => { |
| 129 | 129 | const prop = props[key]; |
| 130 | 130 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 136 | 136 | } |
| 137 | 137 | }); |
| 138 | - return result; | |
| 138 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/cb81e.json
Melmdefault / QuickType.elm+9 −1
| @@ -55,7 +55,7 @@ quickType = | ||
| 55 | 55 | encodeQuickType : QuickType -> Jenc.Value |
| 56 | 56 | encodeQuickType x = |
| 57 | 57 | Jenc.object |
| 58 | - [ ("data", Jenc.dict identity Jenc.string x.data) | |
| 58 | + [ ("data", makeDictEncoder identity Jenc.string x.data) | |
| 59 | 59 | , ("description", encodeDescription x.description) |
| 60 | 60 | ] |
| 61 | 61 | |
| @@ -78,6 +78,14 @@ encodeDescription x = | ||
| 78 | 78 | |
| 79 | 79 | --- encoder helpers |
| 80 | 80 | |
| 81 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 82 | +makeDictEncoder f m r = | |
| 83 | + r | |
| 84 | + |> Dict.toList | |
| 85 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 86 | + |> String.join "," | |
| 87 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 88 | + | |
| 81 | 89 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 82 | 90 | makeNullableEncoder f m = |
| 83 | 91 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class Description extends S.Class<Description>("Description")({ |
| 5 | 23 | "base_period": S.String, |
| @@ -9,6 +27,6 @@ export class Description extends S.Class<Description>("Description")({ | ||
| 9 | 27 | }) {} |
| 10 | 28 | |
| 11 | 29 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 12 | - "data": S.Record({ key: S.String, value: S.String}), | |
| 30 | + "data": mapSchema(S.String), | |
| 13 | 31 | "description": Description, |
| 14 | 32 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/ccd18.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/cd238.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/cd463.json
Melmdefault / QuickType.elm+9 −1
| @@ -51,11 +51,19 @@ encodeQuickType x = | ||
| 51 | 51 | Jenc.object |
| 52 | 52 | [ ("base", Jenc.string x.base) |
| 53 | 53 | , ("date", Jenc.string x.date) |
| 54 | - , ("rates", Jenc.dict identity Jenc.float x.rates) | |
| 54 | + , ("rates", makeDictEncoder identity Jenc.float x.rates) | |
| 55 | 55 | ] |
| 56 | 56 | |
| 57 | 57 | --- encoder helpers |
| 58 | 58 | |
| 59 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 60 | +makeDictEncoder f m r = | |
| 61 | + r | |
| 62 | + |> Dict.toList | |
| 63 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 64 | + |> String.join "," | |
| 65 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 66 | + | |
| 59 | 67 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 60 | 68 | makeNullableEncoder f m = |
| 61 | 69 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,8 +1,26 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | 23 | "base": S.String, |
| 6 | 24 | "date": S.String.pipe(S.pattern(/^\d{4}-\d{2}-\d{2}$/)), |
| 7 | - "rates": S.Record({ key: S.String, value: S.Number}), | |
| 25 | + "rates": mapSchema(S.Number), | |
| 8 | 26 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/cda6c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 132 | 132 | return invalidValue(l(ref || "object"), val, key, parent); |
| 133 | 133 | } |
| 134 | - const result: any = {}; | |
| 134 | + const result: any = Object.create(null); | |
| 135 | 135 | Object.getOwnPropertyNames(props).forEach(key => { |
| 136 | 136 | const prop = props[key]; |
| 137 | 137 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | - return result; | |
| 145 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/cf0d8.json
Mflowdefault / TopLevel.js+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/cfbce.json
Melmdefault / QuickType.elm+9 −1
| @@ -51,11 +51,19 @@ encodeQuickType x = | ||
| 51 | 51 | Jenc.object |
| 52 | 52 | [ ("base", Jenc.string x.base) |
| 53 | 53 | , ("date", Jenc.string x.date) |
| 54 | - , ("rates", Jenc.dict identity Jenc.float x.rates) | |
| 54 | + , ("rates", makeDictEncoder identity Jenc.float x.rates) | |
| 55 | 55 | ] |
| 56 | 56 | |
| 57 | 57 | --- encoder helpers |
| 58 | 58 | |
| 59 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 60 | +makeDictEncoder f m r = | |
| 61 | + r | |
| 62 | + |> Dict.toList | |
| 63 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 64 | + |> String.join "," | |
| 65 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 66 | + | |
| 59 | 67 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 60 | 68 | makeNullableEncoder f m = |
| 61 | 69 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,8 +1,26 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | 23 | "base": S.String, |
| 6 | 24 | "date": S.String.pipe(S.pattern(/^\d{4}-\d{2}-\d{2}$/)), |
| 7 | - "rates": S.Record({ key: S.String, value: S.Number}), | |
| 25 | + "rates": mapSchema(S.Number), | |
| 8 | 26 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/d0908.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/d23d5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 126 | 126 | return invalidValue(l(ref || "object"), val, key, parent); |
| 127 | 127 | } |
| 128 | - const result: any = {}; | |
| 128 | + const result: any = Object.create(null); | |
| 129 | 129 | Object.getOwnPropertyNames(props).forEach(key => { |
| 130 | 130 | const prop = props[key]; |
| 131 | 131 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 137 | 137 | } |
| 138 | 138 | }); |
| 139 | - return result; | |
| 139 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 123 | 123 | return invalidValue(l(ref || "object"), val, key, parent); |
| 124 | 124 | } |
| 125 | - const result: any = {}; | |
| 125 | + const result: any = Object.create(null); | |
| 126 | 126 | Object.getOwnPropertyNames(props).forEach(key => { |
| 127 | 127 | const prop = props[key]; |
| 128 | 128 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -133,7 +133,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 133 | 133 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 134 | 134 | } |
| 135 | 135 | }); |
| 136 | - return result; | |
| 136 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/dbfb3.json
Mflowdefault / TopLevel.js+2 −2
| @@ -209,7 +209,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 209 | 209 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 210 | 210 | return invalidValue(l(ref || "object"), val, key, parent); |
| 211 | 211 | } |
| 212 | - const result: any = {}; | |
| 212 | + const result: any = Object.create(null); | |
| 213 | 213 | Object.getOwnPropertyNames(props).forEach(key => { |
| 214 | 214 | const prop = props[key]; |
| 215 | 215 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -220,7 +220,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 220 | 220 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 221 | 221 | } |
| 222 | 222 | }); |
| 223 | - return result; | |
| 223 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -207,7 +207,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 207 | 207 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 208 | 208 | return invalidValue(l(ref || "object"), val, key, parent); |
| 209 | 209 | } |
| 210 | - const result: any = {}; | |
| 210 | + const result: any = Object.create(null); | |
| 211 | 211 | Object.getOwnPropertyNames(props).forEach(key => { |
| 212 | 212 | const prop = props[key]; |
| 213 | 213 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -218,7 +218,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 218 | 218 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 219 | 219 | } |
| 220 | 220 | }); |
| 221 | - return result; | |
| 221 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/dc44f.json
Mflowdefault / TopLevel.js+2 −2
| @@ -233,7 +233,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 233 | 233 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 234 | 234 | return invalidValue(l(ref || "object"), val, key, parent); |
| 235 | 235 | } |
| 236 | - const result: any = {}; | |
| 236 | + const result: any = Object.create(null); | |
| 237 | 237 | Object.getOwnPropertyNames(props).forEach(key => { |
| 238 | 238 | const prop = props[key]; |
| 239 | 239 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -244,7 +244,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 244 | 244 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 245 | 245 | } |
| 246 | 246 | }); |
| 247 | - return result; | |
| 247 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -175,7 +175,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 175 | 175 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 176 | 176 | return invalidValue(l(ref || "object"), val, key, parent); |
| 177 | 177 | } |
| 178 | - const result: any = {}; | |
| 178 | + const result: any = Object.create(null); | |
| 179 | 179 | Object.getOwnPropertyNames(props).forEach(key => { |
| 180 | 180 | const prop = props[key]; |
| 181 | 181 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -186,7 +186,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 186 | 186 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 187 | 187 | } |
| 188 | 188 | }); |
| 189 | - return result; | |
| 189 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/dd1ce.json
Mflowdefault / TopLevel.js+2 −2
| @@ -233,7 +233,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 233 | 233 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 234 | 234 | return invalidValue(l(ref || "object"), val, key, parent); |
| 235 | 235 | } |
| 236 | - const result: any = {}; | |
| 236 | + const result: any = Object.create(null); | |
| 237 | 237 | Object.getOwnPropertyNames(props).forEach(key => { |
| 238 | 238 | const prop = props[key]; |
| 239 | 239 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -244,7 +244,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 244 | 244 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 245 | 245 | } |
| 246 | 246 | }); |
| 247 | - return result; | |
| 247 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -175,7 +175,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 175 | 175 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 176 | 176 | return invalidValue(l(ref || "object"), val, key, parent); |
| 177 | 177 | } |
| 178 | - const result: any = {}; | |
| 178 | + const result: any = Object.create(null); | |
| 179 | 179 | Object.getOwnPropertyNames(props).forEach(key => { |
| 180 | 180 | const prop = props[key]; |
| 181 | 181 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -186,7 +186,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 186 | 186 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 187 | 187 | } |
| 188 | 188 | }); |
| 189 | - return result; | |
| 189 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/dec3a.json
Mflowdefault / TopLevel.js+2 −2
| @@ -168,7 +168,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 168 | 168 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 169 | 169 | return invalidValue(l(ref || "object"), val, key, parent); |
| 170 | 170 | } |
| 171 | - const result: any = {}; | |
| 171 | + const result: any = Object.create(null); | |
| 172 | 172 | Object.getOwnPropertyNames(props).forEach(key => { |
| 173 | 173 | const prop = props[key]; |
| 174 | 174 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -179,7 +179,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 179 | 179 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 180 | 180 | } |
| 181 | 181 | }); |
| 182 | - return result; | |
| 182 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -168,7 +168,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 168 | 168 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 169 | 169 | return invalidValue(l(ref || "object"), val, key, parent); |
| 170 | 170 | } |
| 171 | - const result: any = {}; | |
| 171 | + const result: any = Object.create(null); | |
| 172 | 172 | Object.getOwnPropertyNames(props).forEach(key => { |
| 173 | 173 | const prop = props[key]; |
| 174 | 174 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -179,7 +179,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 179 | 179 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 180 | 180 | } |
| 181 | 181 | }); |
| 182 | - return result; | |
| 182 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/df957.json
Mflowdefault / TopLevel.js+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e0ac7.json
Mflowdefault / TopLevel.js+2 −2
| @@ -217,7 +217,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 217 | 217 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 218 | 218 | return invalidValue(l(ref || "object"), val, key, parent); |
| 219 | 219 | } |
| 220 | - const result: any = {}; | |
| 220 | + const result: any = Object.create(null); | |
| 221 | 221 | Object.getOwnPropertyNames(props).forEach(key => { |
| 222 | 222 | const prop = props[key]; |
| 223 | 223 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -228,7 +228,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 228 | 228 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 229 | 229 | } |
| 230 | 230 | }); |
| 231 | - return result; | |
| 231 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -213,7 +213,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 213 | 213 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 214 | 214 | return invalidValue(l(ref || "object"), val, key, parent); |
| 215 | 215 | } |
| 216 | - const result: any = {}; | |
| 216 | + const result: any = Object.create(null); | |
| 217 | 217 | Object.getOwnPropertyNames(props).forEach(key => { |
| 218 | 218 | const prop = props[key]; |
| 219 | 219 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -224,7 +224,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 224 | 224 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 225 | 225 | } |
| 226 | 226 | }); |
| 227 | - return result; | |
| 227 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e2915.json
Mflowdefault / TopLevel.js+2 −2
| @@ -208,7 +208,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 208 | 208 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 209 | 209 | return invalidValue(l(ref || "object"), val, key, parent); |
| 210 | 210 | } |
| 211 | - const result: any = {}; | |
| 211 | + const result: any = Object.create(null); | |
| 212 | 212 | Object.getOwnPropertyNames(props).forEach(key => { |
| 213 | 213 | const prop = props[key]; |
| 214 | 214 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -219,7 +219,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 219 | 219 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 220 | 220 | } |
| 221 | 221 | }); |
| 222 | - return result; | |
| 222 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -207,7 +207,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 207 | 207 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 208 | 208 | return invalidValue(l(ref || "object"), val, key, parent); |
| 209 | 209 | } |
| 210 | - const result: any = {}; | |
| 210 | + const result: any = Object.create(null); | |
| 211 | 211 | Object.getOwnPropertyNames(props).forEach(key => { |
| 212 | 212 | const prop = props[key]; |
| 213 | 213 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -218,7 +218,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 218 | 218 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 219 | 219 | } |
| 220 | 220 | }); |
| 221 | - return result; | |
| 221 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e2a58.json
Mflowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/e324e.json
Melmdefault / QuickType.elm+9 −1
| @@ -166,7 +166,7 @@ rate = | ||
| 166 | 166 | encodeRate : Rate -> Jenc.Value |
| 167 | 167 | encodeRate x = |
| 168 | 168 | Jenc.object |
| 169 | - [ ("properties", Jenc.dict identity encodeProperty x.properties) | |
| 169 | + [ ("properties", makeDictEncoder identity encodeProperty x.properties) | |
| 170 | 170 | ] |
| 171 | 171 | |
| 172 | 172 | property : Jdec.Decoder Property |
| @@ -322,6 +322,14 @@ encodeItems x = | ||
| 322 | 322 | |
| 323 | 323 | --- encoder helpers |
| 324 | 324 | |
| 325 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 326 | +makeDictEncoder f m r = | |
| 327 | + r | |
| 328 | + |> Dict.toList | |
| 329 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 330 | + |> String.join "," | |
| 331 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 332 | + | |
| 325 | 333 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 326 | 334 | makeNullableEncoder f m = |
| 327 | 335 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -179,7 +179,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 179 | 179 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 180 | 180 | return invalidValue(l(ref || "object"), val, key, parent); |
| 181 | 181 | } |
| 182 | - const result: any = {}; | |
| 182 | + const result: any = Object.create(null); | |
| 183 | 183 | Object.getOwnPropertyNames(props).forEach(key => { |
| 184 | 184 | const prop = props[key]; |
| 185 | 185 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -190,7 +190,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 190 | 190 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 191 | 191 | } |
| 192 | 192 | }); |
| 193 | - return result; | |
| 193 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export const Type = S.Literal( |
| 5 | 23 | "string", |
| @@ -61,7 +79,7 @@ export class Property extends S.Class<Property>("Property")({ | ||
| 61 | 79 | }) {} |
| 62 | 80 | |
| 63 | 81 | export class Rate extends S.Class<Rate>("Rate")({ |
| 64 | - "properties": S.Record({ key: S.String, value: Property}), | |
| 82 | + "properties": mapSchema(Property), | |
| 65 | 83 | }) {} |
| 66 | 84 | |
| 67 | 85 | export class Definitions extends S.Class<Definitions>("Definitions")({ |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -178,7 +178,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 178 | 178 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 179 | 179 | return invalidValue(l(ref || "object"), val, key, parent); |
| 180 | 180 | } |
| 181 | - const result: any = {}; | |
| 181 | + const result: any = Object.create(null); | |
| 182 | 182 | Object.getOwnPropertyNames(props).forEach(key => { |
| 183 | 183 | const prop = props[key]; |
| 184 | 184 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -189,7 +189,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 189 | 189 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 190 | 190 | } |
| 191 | 191 | }); |
| 192 | - return result; | |
| 192 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e53b5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 132 | 132 | return invalidValue(l(ref || "object"), val, key, parent); |
| 133 | 133 | } |
| 134 | - const result: any = {}; | |
| 134 | + const result: any = Object.create(null); | |
| 135 | 135 | Object.getOwnPropertyNames(props).forEach(key => { |
| 136 | 136 | const prop = props[key]; |
| 137 | 137 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | - return result; | |
| 145 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e64a0.json
Mflowdefault / TopLevel.js+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e8a0b.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e8b04.json
Mflowdefault / TopLevel.js+2 −2
| @@ -377,7 +377,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 377 | 377 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 378 | 378 | return invalidValue(l(ref || "object"), val, key, parent); |
| 379 | 379 | } |
| 380 | - const result: any = {}; | |
| 380 | + const result: any = Object.create(null); | |
| 381 | 381 | Object.getOwnPropertyNames(props).forEach(key => { |
| 382 | 382 | const prop = props[key]; |
| 383 | 383 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -388,7 +388,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 388 | 388 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 389 | 389 | } |
| 390 | 390 | }); |
| 391 | - return result; | |
| 391 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -338,7 +338,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 338 | 338 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 339 | 339 | return invalidValue(l(ref || "object"), val, key, parent); |
| 340 | 340 | } |
| 341 | - const result: any = {}; | |
| 341 | + const result: any = Object.create(null); | |
| 342 | 342 | Object.getOwnPropertyNames(props).forEach(key => { |
| 343 | 343 | const prop = props[key]; |
| 344 | 344 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -349,7 +349,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 349 | 349 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 350 | 350 | } |
| 351 | 351 | }); |
| 352 | - return result; | |
| 352 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/ed095.json
Melmdefault / QuickType.elm+9 −1
| @@ -36,10 +36,18 @@ quickType : Jdec.Decoder QuickType | ||
| 36 | 36 | quickType = Jdec.dict Jdec.string |
| 37 | 37 | |
| 38 | 38 | quickTypeToString : QuickType -> String |
| 39 | -quickTypeToString r = Jenc.encode 0 (Jenc.dict identity Jenc.string r) | |
| 39 | +quickTypeToString r = Jenc.encode 0 (makeDictEncoder identity Jenc.string r) | |
| 40 | 40 | |
| 41 | 41 | --- encoder helpers |
| 42 | 42 | |
| 43 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 44 | +makeDictEncoder f m r = | |
| 45 | + r | |
| 46 | + |> Dict.toList | |
| 47 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 48 | + |> String.join "," | |
| 49 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 50 | + | |
| 43 | 51 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 44 | 52 | makeNullableEncoder f m = |
| 45 | 53 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,4 +1,22 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | -export const TopLevel = S.Record({ key: S.String, value: S.String}); | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 21 | +export const TopLevel = mapSchema(S.String); | |
| 4 | 22 | export type TopLevel = S.Schema.Type<typeof TopLevel>; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f22f5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -201,7 +201,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 201 | 201 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 202 | 202 | return invalidValue(l(ref || "object"), val, key, parent); |
| 203 | 203 | } |
| 204 | - const result: any = {}; | |
| 204 | + const result: any = Object.create(null); | |
| 205 | 205 | Object.getOwnPropertyNames(props).forEach(key => { |
| 206 | 206 | const prop = props[key]; |
| 207 | 207 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -212,7 +212,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 212 | 212 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 213 | 213 | } |
| 214 | 214 | }); |
| 215 | - return result; | |
| 215 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -193,7 +193,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 193 | 193 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 194 | 194 | return invalidValue(l(ref || "object"), val, key, parent); |
| 195 | 195 | } |
| 196 | - const result: any = {}; | |
| 196 | + const result: any = Object.create(null); | |
| 197 | 197 | Object.getOwnPropertyNames(props).forEach(key => { |
| 198 | 198 | const prop = props[key]; |
| 199 | 199 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -204,7 +204,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 204 | 204 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 205 | 205 | } |
| 206 | 206 | }); |
| 207 | - return result; | |
| 207 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f3139.json
Mflowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f3edf.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f466a.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f6a65.json
Mflowdefault / TopLevel.js+2 −2
| @@ -224,7 +224,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 224 | 224 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 225 | 225 | return invalidValue(l(ref || "object"), val, key, parent); |
| 226 | 226 | } |
| 227 | - const result: any = {}; | |
| 227 | + const result: any = Object.create(null); | |
| 228 | 228 | Object.getOwnPropertyNames(props).forEach(key => { |
| 229 | 229 | const prop = props[key]; |
| 230 | 230 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -235,7 +235,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 235 | 235 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 236 | 236 | } |
| 237 | 237 | }); |
| 238 | - return result; | |
| 238 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -215,7 +215,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 215 | 215 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 216 | 216 | return invalidValue(l(ref || "object"), val, key, parent); |
| 217 | 217 | } |
| 218 | - const result: any = {}; | |
| 218 | + const result: any = Object.create(null); | |
| 219 | 219 | Object.getOwnPropertyNames(props).forEach(key => { |
| 220 | 220 | const prop = props[key]; |
| 221 | 221 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -226,7 +226,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 226 | 226 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 227 | 227 | } |
| 228 | 228 | }); |
| 229 | - return result; | |
| 229 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f74d5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -223,7 +223,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 223 | 223 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 224 | 224 | return invalidValue(l(ref || "object"), val, key, parent); |
| 225 | 225 | } |
| 226 | - const result: any = {}; | |
| 226 | + const result: any = Object.create(null); | |
| 227 | 227 | Object.getOwnPropertyNames(props).forEach(key => { |
| 228 | 228 | const prop = props[key]; |
| 229 | 229 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -234,7 +234,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 234 | 234 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 235 | 235 | } |
| 236 | 236 | }); |
| 237 | - return result; | |
| 237 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -217,7 +217,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 217 | 217 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 218 | 218 | return invalidValue(l(ref || "object"), val, key, parent); |
| 219 | 219 | } |
| 220 | - const result: any = {}; | |
| 220 | + const result: any = Object.create(null); | |
| 221 | 221 | Object.getOwnPropertyNames(props).forEach(key => { |
| 222 | 222 | const prop = props[key]; |
| 223 | 223 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -228,7 +228,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 228 | 228 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 229 | 229 | } |
| 230 | 230 | }); |
| 231 | - return result; | |
| 231 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f82d9.json
Mflowdefault / TopLevel.js+2 −2
| @@ -192,7 +192,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 192 | 192 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 193 | 193 | return invalidValue(l(ref || "object"), val, key, parent); |
| 194 | 194 | } |
| 195 | - const result: any = {}; | |
| 195 | + const result: any = Object.create(null); | |
| 196 | 196 | Object.getOwnPropertyNames(props).forEach(key => { |
| 197 | 197 | const prop = props[key]; |
| 198 | 198 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -203,7 +203,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 203 | 203 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 204 | 204 | } |
| 205 | 205 | }); |
| 206 | - return result; | |
| 206 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -191,7 +191,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 191 | 191 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 192 | 192 | return invalidValue(l(ref || "object"), val, key, parent); |
| 193 | 193 | } |
| 194 | - const result: any = {}; | |
| 194 | + const result: any = Object.create(null); | |
| 195 | 195 | Object.getOwnPropertyNames(props).forEach(key => { |
| 196 | 196 | const prop = props[key]; |
| 197 | 197 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -202,7 +202,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 202 | 202 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 203 | 203 | } |
| 204 | 204 | }); |
| 205 | - return result; | |
| 205 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f974d.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/faff5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/fcca3.json
Mflowdefault / TopLevel.js+2 −2
| @@ -320,7 +320,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 320 | 320 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 321 | 321 | return invalidValue(l(ref || "object"), val, key, parent); |
| 322 | 322 | } |
| 323 | - const result: any = {}; | |
| 323 | + const result: any = Object.create(null); | |
| 324 | 324 | Object.getOwnPropertyNames(props).forEach(key => { |
| 325 | 325 | const prop = props[key]; |
| 326 | 326 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -331,7 +331,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 331 | 331 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 332 | 332 | } |
| 333 | 333 | }); |
| 334 | - return result; | |
| 334 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -317,7 +317,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 317 | 317 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 318 | 318 | return invalidValue(l(ref || "object"), val, key, parent); |
| 319 | 319 | } |
| 320 | - const result: any = {}; | |
| 320 | + const result: any = Object.create(null); | |
| 321 | 321 | Object.getOwnPropertyNames(props).forEach(key => { |
| 322 | 322 | const prop = props[key]; |
| 323 | 323 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -328,7 +328,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 328 | 328 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 329 | 329 | } |
| 330 | 330 | }); |
| 331 | - return result; | |
| 331 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/misc/fd329.json
Melmdefault / QuickType.elm+9 −1
| @@ -61,7 +61,7 @@ quickType = | ||
| 61 | 61 | encodeQuickType : QuickType -> Jenc.Value |
| 62 | 62 | encodeQuickType x = |
| 63 | 63 | Jenc.object |
| 64 | - [ ("data", Jenc.dict identity encodeDatum x.data) | |
| 64 | + [ ("data", makeDictEncoder identity encodeDatum x.data) | |
| 65 | 65 | , ("description", encodeDescription x.description) |
| 66 | 66 | ] |
| 67 | 67 | |
| @@ -97,6 +97,14 @@ encodeDescription x = | ||
| 97 | 97 | |
| 98 | 98 | --- encoder helpers |
| 99 | 99 | |
| 100 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 101 | +makeDictEncoder f m r = | |
| 102 | + r | |
| 103 | + |> Dict.toList | |
| 104 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 105 | + |> String.join "," | |
| 106 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 107 | + | |
| 100 | 108 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 101 | 109 | makeNullableEncoder f m = |
| 102 | 110 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class Description extends S.Class<Description>("Description")({ |
| 5 | 23 | "base_period": S.String, |
| @@ -14,6 +32,6 @@ export class Datum extends S.Class<Datum>("Datum")({ | ||
| 14 | 32 | }) {} |
| 15 | 33 | |
| 16 | 34 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 17 | - "data": S.Record({ key: S.String, value: Datum}), | |
| 35 | + "data": mapSchema(Datum), | |
| 18 | 36 | "description": Description, |
| 19 | 37 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/blns-object.json
Mflowdefault / TopLevel.js+2 −2
| @@ -702,7 +702,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 702 | 702 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 703 | 703 | return invalidValue(l(ref || "object"), val, key, parent); |
| 704 | 704 | } |
| 705 | - const result: any = {}; | |
| 705 | + const result: any = Object.create(null); | |
| 706 | 706 | Object.getOwnPropertyNames(props).forEach(key => { |
| 707 | 707 | const prop = props[key]; |
| 708 | 708 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -713,7 +713,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 713 | 713 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 714 | 714 | } |
| 715 | 715 | }); |
| 716 | - return result; | |
| 716 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -702,7 +702,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 702 | 702 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 703 | 703 | return invalidValue(l(ref || "object"), val, key, parent); |
| 704 | 704 | } |
| 705 | - const result: any = {}; | |
| 705 | + const result: any = Object.create(null); | |
| 706 | 706 | Object.getOwnPropertyNames(props).forEach(key => { |
| 707 | 707 | const prop = props[key]; |
| 708 | 708 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -713,7 +713,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 713 | 713 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 714 | 714 | } |
| 715 | 715 | }); |
| 716 | - return result; | |
| 716 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | if (typ === "any") return val; |
Test case
5 generated files · +38 −12test/inputs/json/priority/bug2037.json
Melmdefault / QuickType.elm+11 −3
| @@ -60,7 +60,7 @@ quickType = | ||
| 60 | 60 | encodeQuickType : QuickType -> Jenc.Value |
| 61 | 61 | encodeQuickType x = |
| 62 | 62 | Jenc.object |
| 63 | - [ ("mission_specs", Jenc.dict identity encodeMissionSpec x.missionSpecs) | |
| 63 | + [ ("mission_specs", makeDictEncoder identity encodeMissionSpec x.missionSpecs) | |
| 64 | 64 | ] |
| 65 | 65 | |
| 66 | 66 | missionSpec : Jdec.Decoder MissionSpec |
| @@ -71,7 +71,7 @@ missionSpec = | ||
| 71 | 71 | encodeMissionSpec : MissionSpec -> Jenc.Value |
| 72 | 72 | encodeMissionSpec x = |
| 73 | 73 | Jenc.object |
| 74 | - [ ("objectives", Jenc.dict identity encodeObjective x.objectives) | |
| 74 | + [ ("objectives", makeDictEncoder identity encodeObjective x.objectives) | |
| 75 | 75 | ] |
| 76 | 76 | |
| 77 | 77 | objective : Jdec.Decoder Objective |
| @@ -82,7 +82,7 @@ objective = | ||
| 82 | 82 | encodeObjective : Objective -> Jenc.Value |
| 83 | 83 | encodeObjective x = |
| 84 | 84 | Jenc.object |
| 85 | - [ ("rewards", Jenc.dict identity encodeReward x.rewards) | |
| 85 | + [ ("rewards", makeDictEncoder identity encodeReward x.rewards) | |
| 86 | 86 | ] |
| 87 | 87 | |
| 88 | 88 | reward : Jdec.Decoder Reward |
| @@ -97,6 +97,14 @@ encodeReward x = | ||
| 97 | 97 | |
| 98 | 98 | --- encoder helpers |
| 99 | 99 | |
| 100 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 101 | +makeDictEncoder f m r = | |
| 102 | + r | |
| 103 | + |> Dict.toList | |
| 104 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 105 | + |> String.join "," | |
| 106 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 107 | + | |
| 100 | 108 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 101 | 109 | makeNullableEncoder f m = |
| 102 | 110 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 119 | 119 | return invalidValue(l(ref || "object"), val, key, parent); |
| 120 | 120 | } |
| 121 | - const result: any = {}; | |
| 121 | + const result: any = Object.create(null); | |
| 122 | 122 | Object.getOwnPropertyNames(props).forEach(key => { |
| 123 | 123 | const prop = props[key]; |
| 124 | 124 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 130 | 130 | } |
| 131 | 131 | }); |
| 132 | - return result; | |
| 132 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+21 −3
| @@ -1,17 +1,35 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class Reward extends S.Class<Reward>("Reward")(S.Struct({}).pipe(S.filter(value => typeof value === "object" && value !== null && !Array.isArray(value))) |
| 5 | 23 | ) {} |
| 6 | 24 | |
| 7 | 25 | export class Objective extends S.Class<Objective>("Objective")({ |
| 8 | - "rewards": S.Record({ key: S.String, value: Reward}), | |
| 26 | + "rewards": mapSchema(Reward), | |
| 9 | 27 | }) {} |
| 10 | 28 | |
| 11 | 29 | export class MissionSpec extends S.Class<MissionSpec>("MissionSpec")({ |
| 12 | - "objectives": S.Record({ key: S.String, value: Objective}), | |
| 30 | + "objectives": mapSchema(Objective), | |
| 13 | 31 | }) {} |
| 14 | 32 | |
| 15 | 33 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 16 | - "mission_specs": S.Record({ key: S.String, value: MissionSpec}), | |
| 34 | + "mission_specs": mapSchema(MissionSpec), | |
| 17 | 35 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug2521.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug2590.json
Mflowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug2663.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug2793.json
Mflowdefault / TopLevel.js+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug427.json
Mflowdefault / TopLevel.js+2 −2
| @@ -718,7 +718,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 718 | 718 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 719 | 719 | return invalidValue(l(ref || "object"), val, key, parent); |
| 720 | 720 | } |
| 721 | - const result: any = {}; | |
| 721 | + const result: any = Object.create(null); | |
| 722 | 722 | Object.getOwnPropertyNames(props).forEach(key => { |
| 723 | 723 | const prop = props[key]; |
| 724 | 724 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -729,7 +729,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 729 | 729 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 730 | 730 | } |
| 731 | 731 | }); |
| 732 | - return result; | |
| 732 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -664,7 +664,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 664 | 664 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 665 | 665 | return invalidValue(l(ref || "object"), val, key, parent); |
| 666 | 666 | } |
| 667 | - const result: any = {}; | |
| 667 | + const result: any = Object.create(null); | |
| 668 | 668 | Object.getOwnPropertyNames(props).forEach(key => { |
| 669 | 669 | const prop = props[key]; |
| 670 | 670 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -675,7 +675,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 675 | 675 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 676 | 676 | } |
| 677 | 677 | }); |
| 678 | - return result; | |
| 678 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug790.json
Mflowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/priority/bug855-short.json
Melmdefault / QuickType.elm+9 −1
| @@ -45,7 +45,7 @@ quickType : Jdec.Decoder QuickType | ||
| 45 | 45 | quickType = Jdec.dict quickTypeValue |
| 46 | 46 | |
| 47 | 47 | quickTypeToString : QuickType -> String |
| 48 | -quickTypeToString r = Jenc.encode 0 (Jenc.dict identity encodeQuickTypeValue r) | |
| 48 | +quickTypeToString r = Jenc.encode 0 (makeDictEncoder identity encodeQuickTypeValue r) | |
| 49 | 49 | |
| 50 | 50 | quickTypeValue : Jdec.Decoder QuickTypeValue |
| 51 | 51 | quickTypeValue = |
| @@ -68,6 +68,14 @@ encodeQuickTypeValue x = | ||
| 68 | 68 | |
| 69 | 69 | --- encoder helpers |
| 70 | 70 | |
| 71 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 72 | +makeDictEncoder f m r = | |
| 73 | + r | |
| 74 | + |> Dict.toList | |
| 75 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 76 | + |> String.join "," | |
| 77 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 78 | + | |
| 71 | 79 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 72 | 80 | makeNullableEncoder f m = |
| 73 | 81 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevelValue extends S.Class<TopLevelValue>("TopLevelValue")({ |
| 5 | 23 | "channel_id": S.String.pipe(S.pattern(/^-?\d+$/)), |
| @@ -9,5 +27,5 @@ export class TopLevelValue extends S.Class<TopLevelValue>("TopLevelValue")({ | ||
| 9 | 27 | "id": S.Int, |
| 10 | 28 | }) {} |
| 11 | 29 | |
| 12 | -export const TopLevel = S.Record({ key: S.String, value: TopLevelValue}); | |
| 30 | +export const TopLevel = mapSchema(TopLevelValue); | |
| 13 | 31 | export type TopLevel = S.Schema.Type<typeof TopLevel>; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug863.json
Mflowdefault / TopLevel.js+2 −2
| @@ -193,7 +193,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 193 | 193 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 194 | 194 | return invalidValue(l(ref || "object"), val, key, parent); |
| 195 | 195 | } |
| 196 | - const result: any = {}; | |
| 196 | + const result: any = Object.create(null); | |
| 197 | 197 | Object.getOwnPropertyNames(props).forEach(key => { |
| 198 | 198 | const prop = props[key]; |
| 199 | 199 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -204,7 +204,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 204 | 204 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 205 | 205 | } |
| 206 | 206 | }); |
| 207 | - return result; | |
| 207 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -177,7 +177,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 177 | 177 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 178 | 178 | return invalidValue(l(ref || "object"), val, key, parent); |
| 179 | 179 | } |
| 180 | - const result: any = {}; | |
| 180 | + const result: any = Object.create(null); | |
| 181 | 181 | Object.getOwnPropertyNames(props).forEach(key => { |
| 182 | 182 | const prop = props[key]; |
| 183 | 183 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -188,7 +188,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 188 | 188 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 189 | 189 | } |
| 190 | 190 | }); |
| 191 | - return result; | |
| 191 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/priority/coin-pairs.json
Melmdefault / QuickType.elm+9 −1
| @@ -59,7 +59,7 @@ quickType = | ||
| 59 | 59 | encodeQuickType : QuickType -> Jenc.Value |
| 60 | 60 | encodeQuickType x = |
| 61 | 61 | Jenc.object |
| 62 | - [ ("pairs", Jenc.dict identity encodePair x.pairs) | |
| 62 | + [ ("pairs", makeDictEncoder identity encodePair x.pairs) | |
| 63 | 63 | , ("server_time", Jenc.int x.serverTime) |
| 64 | 64 | ] |
| 65 | 65 | |
| @@ -90,6 +90,14 @@ encodePair x = | ||
| 90 | 90 | |
| 91 | 91 | --- encoder helpers |
| 92 | 92 | |
| 93 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 94 | +makeDictEncoder f m r = | |
| 95 | + r | |
| 96 | + |> Dict.toList | |
| 97 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 98 | + |> String.join "," | |
| 99 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 100 | + | |
| 93 | 101 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 94 | 102 | makeNullableEncoder f m = |
| 95 | 103 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class Pair extends S.Class<Pair>("Pair")({ |
| 5 | 23 | "decimal_places": S.Int, |
| @@ -13,6 +31,6 @@ export class Pair extends S.Class<Pair>("Pair")({ | ||
| 13 | 31 | }) {} |
| 14 | 32 | |
| 15 | 33 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 16 | - "pairs": S.Record({ key: S.String, value: Pair}), | |
| 34 | + "pairs": mapSchema(Pair), | |
| 17 | 35 | "server_time": S.Int, |
| 18 | 36 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Test case
24 generated files · +128 −76test/inputs/json/priority/combinations1.json
Melmarray-type-array--eed288b23e27 / QuickType.elm+17 −9
| @@ -642,7 +642,7 @@ encodeQuickType x = | ||
| 642 | 642 | , ("fuzzy", Jenc.array encodeFuzzy x.fuzzy) |
| 643 | 643 | , ("gardenwards", Jenc.array encodeGardenward x.gardenwards) |
| 644 | 644 | , ("generalissimo", Jenc.array encodeGeneralissimo x.generalissimo) |
| 645 | - , ("habeas", Jenc.array (makeNullableEncoder (Jenc.dict identity Jenc.int)) x.habeas) | |
| 645 | + , ("habeas", Jenc.array (makeNullableEncoder (makeDictEncoder identity Jenc.int)) x.habeas) | |
| 646 | 646 | , ("hemicrystalline", Jenc.array encodeHemicrystalline x.hemicrystalline) |
| 647 | 647 | , ("hemocoele", Jenc.array encodeHemocoeleElement x.hemocoele) |
| 648 | 648 | , ("hoister", Jenc.array encodeHoister x.hoister) |
| @@ -916,7 +916,7 @@ consilience = | ||
| 916 | 916 | encodeConsilience : Consilience -> Jenc.Value |
| 917 | 917 | encodeConsilience x = case x of |
| 918 | 918 | DoubleInConsilience y -> Jenc.float y |
| 919 | - IntegerMapInConsilience y -> Jenc.dict identity Jenc.int y | |
| 919 | + IntegerMapInConsilience y -> makeDictEncoder identity Jenc.int y | |
| 920 | 920 | |
| 921 | 921 | constructor : Jdec.Decoder Constructor |
| 922 | 922 | constructor = |
| @@ -928,7 +928,7 @@ constructor = | ||
| 928 | 928 | encodeConstructor : Constructor -> Jenc.Value |
| 929 | 929 | encodeConstructor x = case x of |
| 930 | 930 | BoolInConstructor y -> Jenc.bool y |
| 931 | - UnionMapInConstructor y -> Jenc.dict identity (makeNullableEncoder Jenc.int) y | |
| 931 | + UnionMapInConstructor y -> makeDictEncoder identity (makeNullableEncoder Jenc.int) y | |
| 932 | 932 | |
| 933 | 933 | continuative : Jdec.Decoder Continuative |
| 934 | 934 | continuative = |
| @@ -940,7 +940,7 @@ continuative = | ||
| 940 | 940 | encodeContinuative : Continuative -> Jenc.Value |
| 941 | 941 | encodeContinuative x = case x of |
| 942 | 942 | StringInContinuative y -> Jenc.string y |
| 943 | - IntegerMapInContinuative y -> Jenc.dict identity Jenc.int y | |
| 943 | + IntegerMapInContinuative y -> makeDictEncoder identity Jenc.int y | |
| 944 | 944 | |
| 945 | 945 | credulityElement : Jdec.Decoder CredulityElement |
| 946 | 946 | credulityElement = |
| @@ -1017,7 +1017,7 @@ encodeCreviced : Creviced -> Jenc.Value | ||
| 1017 | 1017 | encodeCreviced x = case x of |
| 1018 | 1018 | BoolInCreviced y -> Jenc.bool y |
| 1019 | 1019 | StringInCreviced y -> Jenc.string y |
| 1020 | - IntegerMapInCreviced y -> Jenc.dict identity Jenc.int y | |
| 1020 | + IntegerMapInCreviced y -> makeDictEncoder identity Jenc.int y | |
| 1021 | 1021 | |
| 1022 | 1022 | deruralizeElement : Jdec.Decoder DeruralizeElement |
| 1023 | 1023 | deruralizeElement = |
| @@ -1171,7 +1171,7 @@ encodeEleutheromania : Eleutheromania -> Jenc.Value | ||
| 1171 | 1171 | encodeEleutheromania x = case x of |
| 1172 | 1172 | StringInEleutheromania y -> Jenc.string y |
| 1173 | 1173 | DoubleInEleutheromania y -> Jenc.float y |
| 1174 | - IntegerMapInEleutheromania y -> Jenc.dict identity Jenc.int y | |
| 1174 | + IntegerMapInEleutheromania y -> makeDictEncoder identity Jenc.int y | |
| 1175 | 1175 | |
| 1176 | 1176 | encrust : Jdec.Decoder Encrust |
| 1177 | 1177 | encrust = |
| @@ -1469,7 +1469,7 @@ fuzzy = | ||
| 1469 | 1469 | encodeFuzzy : Fuzzy -> Jenc.Value |
| 1470 | 1470 | encodeFuzzy x = case x of |
| 1471 | 1471 | IntegerInFuzzy y -> Jenc.int y |
| 1472 | - UnionMapInFuzzy y -> Jenc.dict identity (makeNullableEncoder Jenc.int) y | |
| 1472 | + UnionMapInFuzzy y -> makeDictEncoder identity (makeNullableEncoder Jenc.int) y | |
| 1473 | 1473 | |
| 1474 | 1474 | gardenward : Jdec.Decoder Gardenward |
| 1475 | 1475 | gardenward = |
| @@ -1497,7 +1497,7 @@ encodeGeneralissimo : Generalissimo -> Jenc.Value | ||
| 1497 | 1497 | encodeGeneralissimo x = case x of |
| 1498 | 1498 | BoolInGeneralissimo y -> Jenc.bool y |
| 1499 | 1499 | NullInGeneralissimo -> Jenc.null |
| 1500 | - IntegerMapInGeneralissimo y -> Jenc.dict identity Jenc.int y | |
| 1500 | + IntegerMapInGeneralissimo y -> makeDictEncoder identity Jenc.int y | |
| 1501 | 1501 | |
| 1502 | 1502 | hemicrystalline : Jdec.Decoder Hemicrystalline |
| 1503 | 1503 | hemicrystalline = |
| @@ -1695,10 +1695,18 @@ jacutinga = | ||
| 1695 | 1695 | encodeJacutinga : Jacutinga -> Jenc.Value |
| 1696 | 1696 | encodeJacutinga x = case x of |
| 1697 | 1697 | IntegerArrayInJacutinga y -> Jenc.array Jenc.int y |
| 1698 | - UnionMapInJacutinga y -> Jenc.dict identity (makeNullableEncoder Jenc.int) y | |
| 1698 | + UnionMapInJacutinga y -> makeDictEncoder identity (makeNullableEncoder Jenc.int) y | |
| 1699 | 1699 | |
| 1700 | 1700 | --- encoder helpers |
| 1701 | 1701 | |
| 1702 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 1703 | +makeDictEncoder f m r = | |
| 1704 | + r | |
| 1705 | + |> Dict.toList | |
| 1706 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 1707 | + |> String.join "," | |
| 1708 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 1709 | + | |
| 1702 | 1710 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 1703 | 1711 | makeNullableEncoder f m = |
| 1704 | 1712 | case m of |
Melmdefault / QuickType.elm+17 −9
| @@ -641,7 +641,7 @@ encodeQuickType x = | ||
| 641 | 641 | , ("fuzzy", Jenc.list encodeFuzzy x.fuzzy) |
| 642 | 642 | , ("gardenwards", Jenc.list encodeGardenward x.gardenwards) |
| 643 | 643 | , ("generalissimo", Jenc.list encodeGeneralissimo x.generalissimo) |
| 644 | - , ("habeas", Jenc.list (makeNullableEncoder (Jenc.dict identity Jenc.int)) x.habeas) | |
| 644 | + , ("habeas", Jenc.list (makeNullableEncoder (makeDictEncoder identity Jenc.int)) x.habeas) | |
| 645 | 645 | , ("hemicrystalline", Jenc.list encodeHemicrystalline x.hemicrystalline) |
| 646 | 646 | , ("hemocoele", Jenc.list encodeHemocoeleElement x.hemocoele) |
| 647 | 647 | , ("hoister", Jenc.list encodeHoister x.hoister) |
| @@ -915,7 +915,7 @@ consilience = | ||
| 915 | 915 | encodeConsilience : Consilience -> Jenc.Value |
| 916 | 916 | encodeConsilience x = case x of |
| 917 | 917 | DoubleInConsilience y -> Jenc.float y |
| 918 | - IntegerMapInConsilience y -> Jenc.dict identity Jenc.int y | |
| 918 | + IntegerMapInConsilience y -> makeDictEncoder identity Jenc.int y | |
| 919 | 919 | |
| 920 | 920 | constructor : Jdec.Decoder Constructor |
| 921 | 921 | constructor = |
| @@ -927,7 +927,7 @@ constructor = | ||
| 927 | 927 | encodeConstructor : Constructor -> Jenc.Value |
| 928 | 928 | encodeConstructor x = case x of |
| 929 | 929 | BoolInConstructor y -> Jenc.bool y |
| 930 | - UnionMapInConstructor y -> Jenc.dict identity (makeNullableEncoder Jenc.int) y | |
| 930 | + UnionMapInConstructor y -> makeDictEncoder identity (makeNullableEncoder Jenc.int) y | |
| 931 | 931 | |
| 932 | 932 | continuative : Jdec.Decoder Continuative |
| 933 | 933 | continuative = |
| @@ -939,7 +939,7 @@ continuative = | ||
| 939 | 939 | encodeContinuative : Continuative -> Jenc.Value |
| 940 | 940 | encodeContinuative x = case x of |
| 941 | 941 | StringInContinuative y -> Jenc.string y |
| 942 | - IntegerMapInContinuative y -> Jenc.dict identity Jenc.int y | |
| 942 | + IntegerMapInContinuative y -> makeDictEncoder identity Jenc.int y | |
| 943 | 943 | |
| 944 | 944 | credulityElement : Jdec.Decoder CredulityElement |
| 945 | 945 | credulityElement = |
| @@ -1016,7 +1016,7 @@ encodeCreviced : Creviced -> Jenc.Value | ||
| 1016 | 1016 | encodeCreviced x = case x of |
| 1017 | 1017 | BoolInCreviced y -> Jenc.bool y |
| 1018 | 1018 | StringInCreviced y -> Jenc.string y |
| 1019 | - IntegerMapInCreviced y -> Jenc.dict identity Jenc.int y | |
| 1019 | + IntegerMapInCreviced y -> makeDictEncoder identity Jenc.int y | |
| 1020 | 1020 | |
| 1021 | 1021 | deruralizeElement : Jdec.Decoder DeruralizeElement |
| 1022 | 1022 | deruralizeElement = |
| @@ -1170,7 +1170,7 @@ encodeEleutheromania : Eleutheromania -> Jenc.Value | ||
| 1170 | 1170 | encodeEleutheromania x = case x of |
| 1171 | 1171 | StringInEleutheromania y -> Jenc.string y |
| 1172 | 1172 | DoubleInEleutheromania y -> Jenc.float y |
| 1173 | - IntegerMapInEleutheromania y -> Jenc.dict identity Jenc.int y | |
| 1173 | + IntegerMapInEleutheromania y -> makeDictEncoder identity Jenc.int y | |
| 1174 | 1174 | |
| 1175 | 1175 | encrust : Jdec.Decoder Encrust |
| 1176 | 1176 | encrust = |
| @@ -1468,7 +1468,7 @@ fuzzy = | ||
| 1468 | 1468 | encodeFuzzy : Fuzzy -> Jenc.Value |
| 1469 | 1469 | encodeFuzzy x = case x of |
| 1470 | 1470 | IntegerInFuzzy y -> Jenc.int y |
| 1471 | - UnionMapInFuzzy y -> Jenc.dict identity (makeNullableEncoder Jenc.int) y | |
| 1471 | + UnionMapInFuzzy y -> makeDictEncoder identity (makeNullableEncoder Jenc.int) y | |
| 1472 | 1472 | |
| 1473 | 1473 | gardenward : Jdec.Decoder Gardenward |
| 1474 | 1474 | gardenward = |
| @@ -1496,7 +1496,7 @@ encodeGeneralissimo : Generalissimo -> Jenc.Value | ||
| 1496 | 1496 | encodeGeneralissimo x = case x of |
| 1497 | 1497 | BoolInGeneralissimo y -> Jenc.bool y |
| 1498 | 1498 | NullInGeneralissimo -> Jenc.null |
| 1499 | - IntegerMapInGeneralissimo y -> Jenc.dict identity Jenc.int y | |
| 1499 | + IntegerMapInGeneralissimo y -> makeDictEncoder identity Jenc.int y | |
| 1500 | 1500 | |
| 1501 | 1501 | hemicrystalline : Jdec.Decoder Hemicrystalline |
| 1502 | 1502 | hemicrystalline = |
| @@ -1694,10 +1694,18 @@ jacutinga = | ||
| 1694 | 1694 | encodeJacutinga : Jacutinga -> Jenc.Value |
| 1695 | 1695 | encodeJacutinga x = case x of |
| 1696 | 1696 | IntegerArrayInJacutinga y -> Jenc.list Jenc.int y |
| 1697 | - UnionMapInJacutinga y -> Jenc.dict identity (makeNullableEncoder Jenc.int) y | |
| 1697 | + UnionMapInJacutinga y -> makeDictEncoder identity (makeNullableEncoder Jenc.int) y | |
| 1698 | 1698 | |
| 1699 | 1699 | --- encoder helpers |
| 1700 | 1700 | |
| 1701 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 1702 | +makeDictEncoder f m r = | |
| 1703 | + r | |
| 1704 | + |> Dict.toList | |
| 1705 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 1706 | + |> String.join "," | |
| 1707 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 1708 | + | |
| 1701 | 1709 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 1702 | 1710 | makeNullableEncoder f m = |
| 1703 | 1711 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mflownice-property-names-true--f4d7920ee2ce / TopLevel.js+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mflowprefer-unions-false--a5053c0a486d / TopLevel.js+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mflowprefer-unknown-false--f1ab9e45d823 / TopLevel.js+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mflowruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = val[key]; |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mjavascriptconverters-top-level--67aa452ed509 / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptraw-type-any--474b307c39db / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = val[key]; |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+27 −9
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class Interacinar extends S.Class<Interacinar>("Interacinar")({ |
| 5 | 23 | "assapan": S.Number, |
| @@ -293,18 +311,18 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 293 | 311 | "citrated": S.Int, |
| 294 | 312 | "clinodome": S.Array(S.Union(S.Number, S.String)), |
| 295 | 313 | "coadjust": S.Array(S.Union(S.Number, CoadjustClass)), |
| 296 | - "consilience": S.Array(S.Union(S.Number, S.Record({ key: S.String, value: S.Int}))), | |
| 297 | - "constructor": S.Array(S.Union(S.Boolean, S.Record({ key: S.String, value: S.NullOr(S.Int)}))), | |
| 298 | - "continuative": S.Array(S.Union(S.Record({ key: S.String, value: S.Int}), S.String)), | |
| 314 | + "consilience": S.Array(S.Union(S.Number, mapSchema(S.Int))), | |
| 315 | + "constructor": S.Array(S.Union(S.Boolean, mapSchema(S.NullOr(S.Int)))), | |
| 316 | + "continuative": S.Array(S.Union(mapSchema(S.Int), S.String)), | |
| 299 | 317 | "credulity": S.Array(S.Union(S.Int, S.String, CredulityClass)), |
| 300 | - "creviced": S.Array(S.Union(S.Boolean, S.Record({ key: S.String, value: S.Int}), S.String)), | |
| 318 | + "creviced": S.Array(S.Union(S.Boolean, mapSchema(S.Int), S.String)), | |
| 301 | 319 | "cubiculum": S.Array(S.Array(S.NullOr(S.Int))), |
| 302 | 320 | "deruralize": S.Array(S.Union(S.Array(S.Null), S.Boolean, DeruralizeClass)), |
| 303 | 321 | "diaereses": S.Array(S.Union(S.Array(S.Int), S.Boolean, DiaereseClass)), |
| 304 | 322 | "dissolution": S.Array(S.NullOr(S.Array(S.Null))), |
| 305 | 323 | "downstroke": S.Array(S.Union(S.Array(S.Null), S.Boolean, S.String)), |
| 306 | 324 | "electrotautomerism": S.Array(S.NullOr(S.Number)), |
| 307 | - "eleutheromania": S.Array(S.Union(S.Number, S.Record({ key: S.String, value: S.Int}), S.String)), | |
| 325 | + "eleutheromania": S.Array(S.Union(S.Number, mapSchema(S.Int), S.String)), | |
| 308 | 326 | "encrust": Encrust, |
| 309 | 327 | "entomoid": S.Array(S.Union(S.Int, CimeliaClass)), |
| 310 | 328 | "epipaleolithic": S.Array(S.Union(S.Array(S.Int), S.Number)), |
| @@ -314,10 +332,10 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 314 | 332 | "flagmaking": S.Array(S.Union(S.Boolean, S.Number, FlagmakingClass)), |
| 315 | 333 | "fluorometer": S.Array(S.Union(S.Int, S.String, S.Null)), |
| 316 | 334 | "fulsome": S.Array(S.NullOr(S.Int)), |
| 317 | - "fuzzy": S.Array(S.Union(S.Int, S.Record({ key: S.String, value: S.NullOr(S.Int)}))), | |
| 335 | + "fuzzy": S.Array(S.Union(S.Int, mapSchema(S.NullOr(S.Int)))), | |
| 318 | 336 | "gardenwards": S.Array(S.Union(S.Array(S.Int), S.Boolean, S.String)), |
| 319 | - "generalissimo": S.Array(S.Union(S.Boolean, S.Record({ key: S.String, value: S.Int}), S.Null)), | |
| 320 | - "habeas": S.Array(S.NullOr(S.Record({ key: S.String, value: S.Int}))), | |
| 337 | + "generalissimo": S.Array(S.Union(S.Boolean, mapSchema(S.Int), S.Null)), | |
| 338 | + "habeas": S.Array(S.NullOr(mapSchema(S.Int))), | |
| 321 | 339 | "hemicrystalline": S.Array(S.Union(S.String, CimeliaClass)), |
| 322 | 340 | "hemocoele": S.Array(S.Union(S.Array(S.Int), HemocoeleClass)), |
| 323 | 341 | "hoister": S.Array(S.Union(S.String, CimeliaClass, S.Null)), |
| @@ -328,5 +346,5 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 328 | 346 | "intentiveness": S.Array(S.Union(S.Number, S.String, CimeliaClass)), |
| 329 | 347 | "interacinar": Interacinar, |
| 330 | 348 | "intercorrelation": S.Array(S.NullOr(S.Array(S.Int))), |
| 331 | - "jacutinga": S.Array(S.Union(S.Array(S.Int), S.Record({ key: S.String, value: S.NullOr(S.Int)}))), | |
| 349 | + "jacutinga": S.Array(S.Union(S.Array(S.Int), mapSchema(S.NullOr(S.Int)))), | |
| 332 | 350 | }) {} |
Mtypescript-effect-schemajust-schema-true--8c4ca457bcba / TopLevel.ts+27 −9
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class Interacinar extends S.Class<Interacinar>("Interacinar")({ |
| 5 | 23 | "assapan": S.Number, |
| @@ -293,18 +311,18 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 293 | 311 | "citrated": S.Int, |
| 294 | 312 | "clinodome": S.Array(S.Union(S.Number, S.String)), |
| 295 | 313 | "coadjust": S.Array(S.Union(S.Number, CoadjustClass)), |
| 296 | - "consilience": S.Array(S.Union(S.Number, S.Record({ key: S.String, value: S.Int}))), | |
| 297 | - "constructor": S.Array(S.Union(S.Boolean, S.Record({ key: S.String, value: S.NullOr(S.Int)}))), | |
| 298 | - "continuative": S.Array(S.Union(S.Record({ key: S.String, value: S.Int}), S.String)), | |
| 314 | + "consilience": S.Array(S.Union(S.Number, mapSchema(S.Int))), | |
| 315 | + "constructor": S.Array(S.Union(S.Boolean, mapSchema(S.NullOr(S.Int)))), | |
| 316 | + "continuative": S.Array(S.Union(mapSchema(S.Int), S.String)), | |
| 299 | 317 | "credulity": S.Array(S.Union(S.Int, S.String, CredulityClass)), |
| 300 | - "creviced": S.Array(S.Union(S.Boolean, S.Record({ key: S.String, value: S.Int}), S.String)), | |
| 318 | + "creviced": S.Array(S.Union(S.Boolean, mapSchema(S.Int), S.String)), | |
| 301 | 319 | "cubiculum": S.Array(S.Array(S.NullOr(S.Int))), |
| 302 | 320 | "deruralize": S.Array(S.Union(S.Array(S.Null), S.Boolean, DeruralizeClass)), |
| 303 | 321 | "diaereses": S.Array(S.Union(S.Array(S.Int), S.Boolean, DiaereseClass)), |
| 304 | 322 | "dissolution": S.Array(S.NullOr(S.Array(S.Null))), |
| 305 | 323 | "downstroke": S.Array(S.Union(S.Array(S.Null), S.Boolean, S.String)), |
| 306 | 324 | "electrotautomerism": S.Array(S.NullOr(S.Number)), |
| 307 | - "eleutheromania": S.Array(S.Union(S.Number, S.Record({ key: S.String, value: S.Int}), S.String)), | |
| 325 | + "eleutheromania": S.Array(S.Union(S.Number, mapSchema(S.Int), S.String)), | |
| 308 | 326 | "encrust": Encrust, |
| 309 | 327 | "entomoid": S.Array(S.Union(S.Int, CimeliaClass)), |
| 310 | 328 | "epipaleolithic": S.Array(S.Union(S.Array(S.Int), S.Number)), |
| @@ -314,10 +332,10 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 314 | 332 | "flagmaking": S.Array(S.Union(S.Boolean, S.Number, FlagmakingClass)), |
| 315 | 333 | "fluorometer": S.Array(S.Union(S.Int, S.String, S.Null)), |
| 316 | 334 | "fulsome": S.Array(S.NullOr(S.Int)), |
| 317 | - "fuzzy": S.Array(S.Union(S.Int, S.Record({ key: S.String, value: S.NullOr(S.Int)}))), | |
| 335 | + "fuzzy": S.Array(S.Union(S.Int, mapSchema(S.NullOr(S.Int)))), | |
| 318 | 336 | "gardenwards": S.Array(S.Union(S.Array(S.Int), S.Boolean, S.String)), |
| 319 | - "generalissimo": S.Array(S.Union(S.Boolean, S.Record({ key: S.String, value: S.Int}), S.Null)), | |
| 320 | - "habeas": S.Array(S.NullOr(S.Record({ key: S.String, value: S.Int}))), | |
| 337 | + "generalissimo": S.Array(S.Union(S.Boolean, mapSchema(S.Int), S.Null)), | |
| 338 | + "habeas": S.Array(S.NullOr(mapSchema(S.Int))), | |
| 321 | 339 | "hemicrystalline": S.Array(S.Union(S.String, CimeliaClass)), |
| 322 | 340 | "hemocoele": S.Array(S.Union(S.Array(S.Int), HemocoeleClass)), |
| 323 | 341 | "hoister": S.Array(S.Union(S.String, CimeliaClass, S.Null)), |
| @@ -328,5 +346,5 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 328 | 346 | "intentiveness": S.Array(S.Union(S.Number, S.String, CimeliaClass)), |
| 329 | 347 | "interacinar": Interacinar, |
| 330 | 348 | "intercorrelation": S.Array(S.NullOr(S.Array(S.Int))), |
| 331 | - "jacutinga": S.Array(S.Union(S.Array(S.Int), S.Record({ key: S.String, value: S.NullOr(S.Int)}))), | |
| 349 | + "jacutinga": S.Array(S.Union(S.Array(S.Int), mapSchema(S.NullOr(S.Int)))), | |
| 332 | 350 | }) {} |
Mtypescriptacronym-style-pascal--d9e0c1bd777a / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptconverters-all-objects--3a443babd1cb / TopLevel.ts+2 −2
| @@ -603,7 +603,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 603 | 603 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 604 | 604 | return invalidValue(l(ref || "object"), val, key, parent); |
| 605 | 605 | } |
| 606 | - const result: any = {}; | |
| 606 | + const result: any = Object.create(null); | |
| 607 | 607 | Object.getOwnPropertyNames(props).forEach(key => { |
| 608 | 608 | const prop = props[key]; |
| 609 | 609 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -614,7 +614,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 614 | 614 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 615 | 615 | } |
| 616 | 616 | }); |
| 617 | - return result; | |
| 617 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptnice-property-names-true--f4d7920ee2ce / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptprefer-const-values-true--6b26e4d1265c / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptprefer-types-true--df33e18681f9 / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptprefer-unions-false--a5053c0a486d / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptprefer-unknown-false--f1ab9e45d823 / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptraw-type-any--474b307c39db / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptreadonly-true--24da4fc107df / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = val[key]; |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Test case
24 generated files · +140 −88test/inputs/json/priority/combinations2.json
Melmarray-type-array--eed288b23e27 / QuickType.elm+20 −12
| @@ -579,13 +579,13 @@ encodeQuickType x = | ||
| 579 | 579 | , ("amphithyron", Jenc.array (makeNullableEncoder encodeAmphithyron) x.amphithyron) |
| 580 | 580 | , ("Andriana", Jenc.array (makeNullableEncoder Jenc.string) x.andriana) |
| 581 | 581 | , ("ankee", Jenc.array encodeAnkeeElement x.ankee) |
| 582 | - , ("annihilator", Jenc.array (makeNullableEncoder (Jenc.dict identity (makeNullableEncoder Jenc.int))) x.annihilator) | |
| 582 | + , ("annihilator", Jenc.array (makeNullableEncoder (makeDictEncoder identity (makeNullableEncoder Jenc.int))) x.annihilator) | |
| 583 | 583 | , ("annulose", always Jenc.null x.annulose) |
| 584 | 584 | , ("Ansarie", Jenc.array encodeAnsarieElement x.ansarie) |
| 585 | 585 | , ("aphasia", Jenc.array encodeAphasia x.aphasia) |
| 586 | 586 | , ("asprawl", Jenc.array encodeAsprawl x.asprawl) |
| 587 | 587 | , ("attractive", Jenc.array (makeNullableEncoder Jenc.bool) x.attractive) |
| 588 | - , ("barksome", Jenc.dict identity Jenc.int x.barksome) | |
| 588 | + , ("barksome", makeDictEncoder identity Jenc.int x.barksome) | |
| 589 | 589 | , ("bedesman", Jenc.array encodeBedesman x.bedesman) |
| 590 | 590 | , ("belard", Jenc.array encodeBelard x.belard) |
| 591 | 591 | , ("bocking", Jenc.array encodeBocking x.bocking) |
| @@ -612,7 +612,7 @@ encodeQuickType x = | ||
| 612 | 612 | , ("School", Jenc.array encodeSchool x.school) |
| 613 | 613 | , ("Shakespearolater", Jenc.array encodeShakespearolater x.shakespearolater) |
| 614 | 614 | , ("Svan", Jenc.array Jenc.float x.svan) |
| 615 | - , ("Wayao", Jenc.dict identity Jenc.float x.wayao) | |
| 615 | + , ("Wayao", makeDictEncoder identity Jenc.float x.wayao) | |
| 616 | 616 | ] |
| 617 | 617 | |
| 618 | 618 | abranchiata : Jdec.Decoder Abranchiata |
| @@ -641,7 +641,7 @@ encodeAcademe : Academe -> Jenc.Value | ||
| 641 | 641 | encodeAcademe x = case x of |
| 642 | 642 | IntegerArrayInAcademe y -> Jenc.array Jenc.int y |
| 643 | 643 | IntegerInAcademe y -> Jenc.int y |
| 644 | - IntegerMapInAcademe y -> Jenc.dict identity Jenc.int y | |
| 644 | + IntegerMapInAcademe y -> makeDictEncoder identity Jenc.int y | |
| 645 | 645 | |
| 646 | 646 | acquirable : Jdec.Decoder Acquirable |
| 647 | 647 | acquirable = |
| @@ -653,7 +653,7 @@ acquirable = | ||
| 653 | 653 | encodeAcquirable : Acquirable -> Jenc.Value |
| 654 | 654 | encodeAcquirable x = case x of |
| 655 | 655 | UnionArrayInAcquirable y -> Jenc.array (makeNullableEncoder Jenc.int) y |
| 656 | - IntegerMapInAcquirable y -> Jenc.dict identity Jenc.int y | |
| 656 | + IntegerMapInAcquirable y -> makeDictEncoder identity Jenc.int y | |
| 657 | 657 | |
| 658 | 658 | aerometry : Jdec.Decoder Aerometry |
| 659 | 659 | aerometry = |
| @@ -1034,7 +1034,7 @@ encodeBocking : Bocking -> Jenc.Value | ||
| 1034 | 1034 | encodeBocking x = case x of |
| 1035 | 1035 | IntegerArrayInBocking y -> Jenc.array Jenc.int y |
| 1036 | 1036 | BoolInBocking y -> Jenc.bool y |
| 1037 | - IntegerMapInBocking y -> Jenc.dict identity Jenc.int y | |
| 1037 | + IntegerMapInBocking y -> makeDictEncoder identity Jenc.int y | |
| 1038 | 1038 | |
| 1039 | 1039 | brawlingly : Jdec.Decoder Brawlingly |
| 1040 | 1040 | brawlingly = |
| @@ -1046,7 +1046,7 @@ brawlingly = | ||
| 1046 | 1046 | encodeBrawlingly : Brawlingly -> Jenc.Value |
| 1047 | 1047 | encodeBrawlingly x = case x of |
| 1048 | 1048 | NullArrayInBrawlingly y -> Jenc.array (always Jenc.null) y |
| 1049 | - UnionMapInBrawlingly y -> Jenc.dict identity (makeNullableEncoder Jenc.int) y | |
| 1049 | + UnionMapInBrawlingly y -> makeDictEncoder identity (makeNullableEncoder Jenc.int) y | |
| 1050 | 1050 | |
| 1051 | 1051 | brookie : Jdec.Decoder Brookie |
| 1052 | 1052 | brookie = |
| @@ -1098,7 +1098,7 @@ encodeCatallactic : Catallactic -> Jenc.Value | ||
| 1098 | 1098 | encodeCatallactic x = case x of |
| 1099 | 1099 | NullArrayInCatallactic y -> Jenc.array (always Jenc.null) y |
| 1100 | 1100 | BoolInCatallactic y -> Jenc.bool y |
| 1101 | - IntegerMapInCatallactic y -> Jenc.dict identity Jenc.int y | |
| 1101 | + IntegerMapInCatallactic y -> makeDictEncoder identity Jenc.int y | |
| 1102 | 1102 | |
| 1103 | 1103 | cemental : Jdec.Decoder Cemental |
| 1104 | 1104 | cemental = |
| @@ -1112,7 +1112,7 @@ encodeCemental : Cemental -> Jenc.Value | ||
| 1112 | 1112 | encodeCemental x = case x of |
| 1113 | 1113 | IntegerArrayInCemental y -> Jenc.array Jenc.int y |
| 1114 | 1114 | DoubleInCemental y -> Jenc.float y |
| 1115 | - IntegerMapInCemental y -> Jenc.dict identity Jenc.int y | |
| 1115 | + IntegerMapInCemental y -> makeDictEncoder identity Jenc.int y | |
| 1116 | 1116 | |
| 1117 | 1117 | chytridiaceaeElement : Jdec.Decoder ChytridiaceaeElement |
| 1118 | 1118 | chytridiaceaeElement = |
| @@ -1284,7 +1284,7 @@ eupatorium = | ||
| 1284 | 1284 | encodeEupatorium : Eupatorium -> Jenc.Value |
| 1285 | 1285 | encodeEupatorium x = case x of |
| 1286 | 1286 | NullArrayInEupatorium y -> Jenc.array (always Jenc.null) y |
| 1287 | - IntegerMapInEupatorium y -> Jenc.dict identity Jenc.int y | |
| 1287 | + IntegerMapInEupatorium y -> makeDictEncoder identity Jenc.int y | |
| 1288 | 1288 | |
| 1289 | 1289 | gryphosaurusElement : Jdec.Decoder GryphosaurusElement |
| 1290 | 1290 | gryphosaurusElement = |
| @@ -1359,7 +1359,7 @@ koryak = | ||
| 1359 | 1359 | encodeKoryak : Koryak -> Jenc.Value |
| 1360 | 1360 | encodeKoryak x = case x of |
| 1361 | 1361 | StringInKoryak y -> Jenc.string y |
| 1362 | - UnionMapInKoryak y -> Jenc.dict identity (makeNullableEncoder Jenc.int) y | |
| 1362 | + UnionMapInKoryak y -> makeDictEncoder identity (makeNullableEncoder Jenc.int) y | |
| 1363 | 1363 | |
| 1364 | 1364 | laviniaElement : Jdec.Decoder LaviniaElement |
| 1365 | 1365 | laviniaElement = |
| @@ -1547,7 +1547,7 @@ encodeSchool : School -> Jenc.Value | ||
| 1547 | 1547 | encodeSchool x = case x of |
| 1548 | 1548 | IntegerInSchool y -> Jenc.int y |
| 1549 | 1549 | NullInSchool -> Jenc.null |
| 1550 | - IntegerMapInSchool y -> Jenc.dict identity Jenc.int y | |
| 1550 | + IntegerMapInSchool y -> makeDictEncoder identity Jenc.int y | |
| 1551 | 1551 | |
| 1552 | 1552 | shakespearolater : Jdec.Decoder Shakespearolater |
| 1553 | 1553 | shakespearolater = |
| @@ -1565,6 +1565,14 @@ encodeShakespearolater x = case x of | ||
| 1565 | 1565 | |
| 1566 | 1566 | --- encoder helpers |
| 1567 | 1567 | |
| 1568 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 1569 | +makeDictEncoder f m r = | |
| 1570 | + r | |
| 1571 | + |> Dict.toList | |
| 1572 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 1573 | + |> String.join "," | |
| 1574 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 1575 | + | |
| 1568 | 1576 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 1569 | 1577 | makeNullableEncoder f m = |
| 1570 | 1578 | case m of |
Melmdefault / QuickType.elm+20 −12
| @@ -578,13 +578,13 @@ encodeQuickType x = | ||
| 578 | 578 | , ("amphithyron", Jenc.list (makeNullableEncoder encodeAmphithyron) x.amphithyron) |
| 579 | 579 | , ("Andriana", Jenc.list (makeNullableEncoder Jenc.string) x.andriana) |
| 580 | 580 | , ("ankee", Jenc.list encodeAnkeeElement x.ankee) |
| 581 | - , ("annihilator", Jenc.list (makeNullableEncoder (Jenc.dict identity (makeNullableEncoder Jenc.int))) x.annihilator) | |
| 581 | + , ("annihilator", Jenc.list (makeNullableEncoder (makeDictEncoder identity (makeNullableEncoder Jenc.int))) x.annihilator) | |
| 582 | 582 | , ("annulose", always Jenc.null x.annulose) |
| 583 | 583 | , ("Ansarie", Jenc.list encodeAnsarieElement x.ansarie) |
| 584 | 584 | , ("aphasia", Jenc.list encodeAphasia x.aphasia) |
| 585 | 585 | , ("asprawl", Jenc.list encodeAsprawl x.asprawl) |
| 586 | 586 | , ("attractive", Jenc.list (makeNullableEncoder Jenc.bool) x.attractive) |
| 587 | - , ("barksome", Jenc.dict identity Jenc.int x.barksome) | |
| 587 | + , ("barksome", makeDictEncoder identity Jenc.int x.barksome) | |
| 588 | 588 | , ("bedesman", Jenc.list encodeBedesman x.bedesman) |
| 589 | 589 | , ("belard", Jenc.list encodeBelard x.belard) |
| 590 | 590 | , ("bocking", Jenc.list encodeBocking x.bocking) |
| @@ -611,7 +611,7 @@ encodeQuickType x = | ||
| 611 | 611 | , ("School", Jenc.list encodeSchool x.school) |
| 612 | 612 | , ("Shakespearolater", Jenc.list encodeShakespearolater x.shakespearolater) |
| 613 | 613 | , ("Svan", Jenc.list Jenc.float x.svan) |
| 614 | - , ("Wayao", Jenc.dict identity Jenc.float x.wayao) | |
| 614 | + , ("Wayao", makeDictEncoder identity Jenc.float x.wayao) | |
| 615 | 615 | ] |
| 616 | 616 | |
| 617 | 617 | abranchiata : Jdec.Decoder Abranchiata |
| @@ -640,7 +640,7 @@ encodeAcademe : Academe -> Jenc.Value | ||
| 640 | 640 | encodeAcademe x = case x of |
| 641 | 641 | IntegerArrayInAcademe y -> Jenc.list Jenc.int y |
| 642 | 642 | IntegerInAcademe y -> Jenc.int y |
| 643 | - IntegerMapInAcademe y -> Jenc.dict identity Jenc.int y | |
| 643 | + IntegerMapInAcademe y -> makeDictEncoder identity Jenc.int y | |
| 644 | 644 | |
| 645 | 645 | acquirable : Jdec.Decoder Acquirable |
| 646 | 646 | acquirable = |
| @@ -652,7 +652,7 @@ acquirable = | ||
| 652 | 652 | encodeAcquirable : Acquirable -> Jenc.Value |
| 653 | 653 | encodeAcquirable x = case x of |
| 654 | 654 | UnionArrayInAcquirable y -> Jenc.list (makeNullableEncoder Jenc.int) y |
| 655 | - IntegerMapInAcquirable y -> Jenc.dict identity Jenc.int y | |
| 655 | + IntegerMapInAcquirable y -> makeDictEncoder identity Jenc.int y | |
| 656 | 656 | |
| 657 | 657 | aerometry : Jdec.Decoder Aerometry |
| 658 | 658 | aerometry = |
| @@ -1033,7 +1033,7 @@ encodeBocking : Bocking -> Jenc.Value | ||
| 1033 | 1033 | encodeBocking x = case x of |
| 1034 | 1034 | IntegerArrayInBocking y -> Jenc.list Jenc.int y |
| 1035 | 1035 | BoolInBocking y -> Jenc.bool y |
| 1036 | - IntegerMapInBocking y -> Jenc.dict identity Jenc.int y | |
| 1036 | + IntegerMapInBocking y -> makeDictEncoder identity Jenc.int y | |
| 1037 | 1037 | |
| 1038 | 1038 | brawlingly : Jdec.Decoder Brawlingly |
| 1039 | 1039 | brawlingly = |
| @@ -1045,7 +1045,7 @@ brawlingly = | ||
| 1045 | 1045 | encodeBrawlingly : Brawlingly -> Jenc.Value |
| 1046 | 1046 | encodeBrawlingly x = case x of |
| 1047 | 1047 | NullArrayInBrawlingly y -> Jenc.list (always Jenc.null) y |
| 1048 | - UnionMapInBrawlingly y -> Jenc.dict identity (makeNullableEncoder Jenc.int) y | |
| 1048 | + UnionMapInBrawlingly y -> makeDictEncoder identity (makeNullableEncoder Jenc.int) y | |
| 1049 | 1049 | |
| 1050 | 1050 | brookie : Jdec.Decoder Brookie |
| 1051 | 1051 | brookie = |
| @@ -1097,7 +1097,7 @@ encodeCatallactic : Catallactic -> Jenc.Value | ||
| 1097 | 1097 | encodeCatallactic x = case x of |
| 1098 | 1098 | NullArrayInCatallactic y -> Jenc.list (always Jenc.null) y |
| 1099 | 1099 | BoolInCatallactic y -> Jenc.bool y |
| 1100 | - IntegerMapInCatallactic y -> Jenc.dict identity Jenc.int y | |
| 1100 | + IntegerMapInCatallactic y -> makeDictEncoder identity Jenc.int y | |
| 1101 | 1101 | |
| 1102 | 1102 | cemental : Jdec.Decoder Cemental |
| 1103 | 1103 | cemental = |
| @@ -1111,7 +1111,7 @@ encodeCemental : Cemental -> Jenc.Value | ||
| 1111 | 1111 | encodeCemental x = case x of |
| 1112 | 1112 | IntegerArrayInCemental y -> Jenc.list Jenc.int y |
| 1113 | 1113 | DoubleInCemental y -> Jenc.float y |
| 1114 | - IntegerMapInCemental y -> Jenc.dict identity Jenc.int y | |
| 1114 | + IntegerMapInCemental y -> makeDictEncoder identity Jenc.int y | |
| 1115 | 1115 | |
| 1116 | 1116 | chytridiaceaeElement : Jdec.Decoder ChytridiaceaeElement |
| 1117 | 1117 | chytridiaceaeElement = |
| @@ -1283,7 +1283,7 @@ eupatorium = | ||
| 1283 | 1283 | encodeEupatorium : Eupatorium -> Jenc.Value |
| 1284 | 1284 | encodeEupatorium x = case x of |
| 1285 | 1285 | NullArrayInEupatorium y -> Jenc.list (always Jenc.null) y |
| 1286 | - IntegerMapInEupatorium y -> Jenc.dict identity Jenc.int y | |
| 1286 | + IntegerMapInEupatorium y -> makeDictEncoder identity Jenc.int y | |
| 1287 | 1287 | |
| 1288 | 1288 | gryphosaurusElement : Jdec.Decoder GryphosaurusElement |
| 1289 | 1289 | gryphosaurusElement = |
| @@ -1358,7 +1358,7 @@ koryak = | ||
| 1358 | 1358 | encodeKoryak : Koryak -> Jenc.Value |
| 1359 | 1359 | encodeKoryak x = case x of |
| 1360 | 1360 | StringInKoryak y -> Jenc.string y |
| 1361 | - UnionMapInKoryak y -> Jenc.dict identity (makeNullableEncoder Jenc.int) y | |
| 1361 | + UnionMapInKoryak y -> makeDictEncoder identity (makeNullableEncoder Jenc.int) y | |
| 1362 | 1362 | |
| 1363 | 1363 | laviniaElement : Jdec.Decoder LaviniaElement |
| 1364 | 1364 | laviniaElement = |
| @@ -1546,7 +1546,7 @@ encodeSchool : School -> Jenc.Value | ||
| 1546 | 1546 | encodeSchool x = case x of |
| 1547 | 1547 | IntegerInSchool y -> Jenc.int y |
| 1548 | 1548 | NullInSchool -> Jenc.null |
| 1549 | - IntegerMapInSchool y -> Jenc.dict identity Jenc.int y | |
| 1549 | + IntegerMapInSchool y -> makeDictEncoder identity Jenc.int y | |
| 1550 | 1550 | |
| 1551 | 1551 | shakespearolater : Jdec.Decoder Shakespearolater |
| 1552 | 1552 | shakespearolater = |
| @@ -1564,6 +1564,14 @@ encodeShakespearolater x = case x of | ||
| 1564 | 1564 | |
| 1565 | 1565 | --- encoder helpers |
| 1566 | 1566 | |
| 1567 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 1568 | +makeDictEncoder f m r = | |
| 1569 | + r | |
| 1570 | + |> Dict.toList | |
| 1571 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 1572 | + |> String.join "," | |
| 1573 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 1574 | + | |
| 1567 | 1575 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 1568 | 1576 | makeNullableEncoder f m = |
| 1569 | 1577 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mflownice-property-names-true--f4d7920ee2ce / TopLevel.js+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mflowprefer-unions-false--a5053c0a486d / TopLevel.js+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mflowprefer-unknown-false--f1ab9e45d823 / TopLevel.js+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mflowruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = val[key]; |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mjavascriptconverters-top-level--67aa452ed509 / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptraw-type-any--474b307c39db / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = val[key]; |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+30 −12
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class OskarClass extends S.Class<OskarClass>("OskarClass")({ |
| 5 | 23 | "Acrobates": S.Null, |
| @@ -233,8 +251,8 @@ export class AlleviateClass extends S.Class<AlleviateClass>("AlleviateClass")({ | ||
| 233 | 251 | |
| 234 | 252 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 235 | 253 | "Abranchiata": S.Array(S.Union(S.Array(S.Int), S.Int, S.Null)), |
| 236 | - "academe": S.Array(S.Union(S.Array(S.Int), S.Int, S.Record({ key: S.String, value: S.Int}))), | |
| 237 | - "acquirable": S.Array(S.Union(S.Array(S.NullOr(S.Int)), S.Record({ key: S.String, value: S.Int}))), | |
| 254 | + "academe": S.Array(S.Union(S.Array(S.Int), S.Int, mapSchema(S.Int))), | |
| 255 | + "acquirable": S.Array(S.Union(S.Array(S.NullOr(S.Int)), mapSchema(S.Int))), | |
| 238 | 256 | "aerometry": S.Array(S.Union(S.Boolean, S.Number)), |
| 239 | 257 | "alexin": S.Array(S.Union(S.Array(S.Int), S.Boolean)), |
| 240 | 258 | "alleviate": S.Array(S.Union(S.Array(S.NullOr(S.Int)), AlleviateClass)), |
| @@ -243,38 +261,38 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 243 | 261 | "amphithyron": S.Array(S.NullOr(Amphithyron)), |
| 244 | 262 | "Andriana": S.Array(S.NullOr(S.String)), |
| 245 | 263 | "ankee": S.Array(S.Union(S.Array(S.Int), S.Int, AnkeeClass)), |
| 246 | - "annihilator": S.Array(S.NullOr(S.Record({ key: S.String, value: S.NullOr(S.Int)}))), | |
| 264 | + "annihilator": S.Array(S.NullOr(mapSchema(S.NullOr(S.Int)))), | |
| 247 | 265 | "annulose": S.Null, |
| 248 | 266 | "Ansarie": S.Array(S.Union(S.Array(S.Int), AnsarieClass, S.Null)), |
| 249 | 267 | "aphasia": S.Array(S.Union(S.Array(S.Int), S.Int)), |
| 250 | 268 | "asprawl": S.Array(S.Union(S.Number, S.String)), |
| 251 | 269 | "attractive": S.Array(S.NullOr(S.Boolean)), |
| 252 | - "barksome": S.Record({ key: S.String, value: S.Int}), | |
| 270 | + "barksome": mapSchema(S.Int), | |
| 253 | 271 | "bedesman": S.Array(S.Union(S.Boolean, S.Number, S.String)), |
| 254 | 272 | "belard": S.Array(S.Union(S.Array(S.Int), S.Number, Rebecca)), |
| 255 | - "bocking": S.Array(S.Union(S.Array(S.Int), S.Boolean, S.Record({ key: S.String, value: S.Int}))), | |
| 256 | - "brawlingly": S.Array(S.Union(S.Array(S.Null), S.Record({ key: S.String, value: S.NullOr(S.Int)}))), | |
| 273 | + "bocking": S.Array(S.Union(S.Array(S.Int), S.Boolean, mapSchema(S.Int))), | |
| 274 | + "brawlingly": S.Array(S.Union(S.Array(S.Null), mapSchema(S.NullOr(S.Int)))), | |
| 257 | 275 | "brookie": S.Array(S.Union(S.Array(S.Int), Rebecca)), |
| 258 | 276 | "bumboatman": S.Array(S.Union(S.Array(S.Null), S.String, S.Null)), |
| 259 | 277 | "bystreet": S.Array(S.Null), |
| 260 | 278 | "calaverite": S.Array(S.Union(S.Array(S.Int), S.String)), |
| 261 | - "catallactic": S.Array(S.Union(S.Array(S.Null), S.Boolean, S.Record({ key: S.String, value: S.Int}))), | |
| 262 | - "cemental": S.Array(S.Union(S.Array(S.Int), S.Number, S.Record({ key: S.String, value: S.Int}))), | |
| 279 | + "catallactic": S.Array(S.Union(S.Array(S.Null), S.Boolean, mapSchema(S.Int))), | |
| 280 | + "cemental": S.Array(S.Union(S.Array(S.Int), S.Number, mapSchema(S.Int))), | |
| 263 | 281 | "Chytridiaceae": S.Array(S.Union(S.Boolean, ChytridiaceaeClass, S.Null)), |
| 264 | 282 | "Discordia": S.Array(S.Union(S.Array(S.Int), DiscordiaClass)), |
| 265 | 283 | "Endomyces": S.Array(S.Union(S.Int, S.String)), |
| 266 | 284 | "Epinephelidae": S.Array(S.Union(S.Boolean, S.Int, S.String)), |
| 267 | - "Eupatorium": S.Array(S.Union(S.Array(S.Null), S.Record({ key: S.String, value: S.Int}))), | |
| 285 | + "Eupatorium": S.Array(S.Union(S.Array(S.Null), mapSchema(S.Int))), | |
| 268 | 286 | "Gryphosaurus": S.Array(S.Union(S.Array(S.Int), S.String, GryphosaurusClass)), |
| 269 | - "Koryak": S.Array(S.Union(S.Record({ key: S.String, value: S.NullOr(S.Int)}), S.String)), | |
| 287 | + "Koryak": S.Array(S.Union(mapSchema(S.NullOr(S.Int)), S.String)), | |
| 270 | 288 | "Lavinia": S.Array(S.Union(S.String, LaviniaClass)), |
| 271 | 289 | "Oskar": S.Array(S.Union(S.Array(S.Int), OskarClass)), |
| 272 | 290 | "Rebecca": S.Array(S.Union(S.Int, S.String, Rebecca)), |
| 273 | 291 | "Rhomboganoidei": S.Array(S.Union(S.Array(S.Int), S.String, Rebecca)), |
| 274 | 292 | "Rigsmal": S.Boolean, |
| 275 | 293 | "Ruellia": S.Array(S.Union(S.Boolean, S.String, Rebecca)), |
| 276 | - "School": S.Array(S.Union(S.Int, S.Record({ key: S.String, value: S.Int}), S.Null)), | |
| 294 | + "School": S.Array(S.Union(S.Int, mapSchema(S.Int), S.Null)), | |
| 277 | 295 | "Shakespearolater": S.Array(S.Union(S.Array(S.Int), S.Number, S.String)), |
| 278 | 296 | "Svan": S.Array(S.Number), |
| 279 | - "Wayao": S.Record({ key: S.String, value: S.Number}), | |
| 297 | + "Wayao": mapSchema(S.Number), | |
| 280 | 298 | }) {} |
Mtypescript-effect-schemajust-schema-true--8c4ca457bcba / TopLevel.ts+30 −12
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class OskarClass extends S.Class<OskarClass>("OskarClass")({ |
| 5 | 23 | "Acrobates": S.Null, |
| @@ -233,8 +251,8 @@ export class AlleviateClass extends S.Class<AlleviateClass>("AlleviateClass")({ | ||
| 233 | 251 | |
| 234 | 252 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 235 | 253 | "Abranchiata": S.Array(S.Union(S.Array(S.Int), S.Int, S.Null)), |
| 236 | - "academe": S.Array(S.Union(S.Array(S.Int), S.Int, S.Record({ key: S.String, value: S.Int}))), | |
| 237 | - "acquirable": S.Array(S.Union(S.Array(S.NullOr(S.Int)), S.Record({ key: S.String, value: S.Int}))), | |
| 254 | + "academe": S.Array(S.Union(S.Array(S.Int), S.Int, mapSchema(S.Int))), | |
| 255 | + "acquirable": S.Array(S.Union(S.Array(S.NullOr(S.Int)), mapSchema(S.Int))), | |
| 238 | 256 | "aerometry": S.Array(S.Union(S.Boolean, S.Number)), |
| 239 | 257 | "alexin": S.Array(S.Union(S.Array(S.Int), S.Boolean)), |
| 240 | 258 | "alleviate": S.Array(S.Union(S.Array(S.NullOr(S.Int)), AlleviateClass)), |
| @@ -243,38 +261,38 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 243 | 261 | "amphithyron": S.Array(S.NullOr(Amphithyron)), |
| 244 | 262 | "Andriana": S.Array(S.NullOr(S.String)), |
| 245 | 263 | "ankee": S.Array(S.Union(S.Array(S.Int), S.Int, AnkeeClass)), |
| 246 | - "annihilator": S.Array(S.NullOr(S.Record({ key: S.String, value: S.NullOr(S.Int)}))), | |
| 264 | + "annihilator": S.Array(S.NullOr(mapSchema(S.NullOr(S.Int)))), | |
| 247 | 265 | "annulose": S.Null, |
| 248 | 266 | "Ansarie": S.Array(S.Union(S.Array(S.Int), AnsarieClass, S.Null)), |
| 249 | 267 | "aphasia": S.Array(S.Union(S.Array(S.Int), S.Int)), |
| 250 | 268 | "asprawl": S.Array(S.Union(S.Number, S.String)), |
| 251 | 269 | "attractive": S.Array(S.NullOr(S.Boolean)), |
| 252 | - "barksome": S.Record({ key: S.String, value: S.Int}), | |
| 270 | + "barksome": mapSchema(S.Int), | |
| 253 | 271 | "bedesman": S.Array(S.Union(S.Boolean, S.Number, S.String)), |
| 254 | 272 | "belard": S.Array(S.Union(S.Array(S.Int), S.Number, Rebecca)), |
| 255 | - "bocking": S.Array(S.Union(S.Array(S.Int), S.Boolean, S.Record({ key: S.String, value: S.Int}))), | |
| 256 | - "brawlingly": S.Array(S.Union(S.Array(S.Null), S.Record({ key: S.String, value: S.NullOr(S.Int)}))), | |
| 273 | + "bocking": S.Array(S.Union(S.Array(S.Int), S.Boolean, mapSchema(S.Int))), | |
| 274 | + "brawlingly": S.Array(S.Union(S.Array(S.Null), mapSchema(S.NullOr(S.Int)))), | |
| 257 | 275 | "brookie": S.Array(S.Union(S.Array(S.Int), Rebecca)), |
| 258 | 276 | "bumboatman": S.Array(S.Union(S.Array(S.Null), S.String, S.Null)), |
| 259 | 277 | "bystreet": S.Array(S.Null), |
| 260 | 278 | "calaverite": S.Array(S.Union(S.Array(S.Int), S.String)), |
| 261 | - "catallactic": S.Array(S.Union(S.Array(S.Null), S.Boolean, S.Record({ key: S.String, value: S.Int}))), | |
| 262 | - "cemental": S.Array(S.Union(S.Array(S.Int), S.Number, S.Record({ key: S.String, value: S.Int}))), | |
| 279 | + "catallactic": S.Array(S.Union(S.Array(S.Null), S.Boolean, mapSchema(S.Int))), | |
| 280 | + "cemental": S.Array(S.Union(S.Array(S.Int), S.Number, mapSchema(S.Int))), | |
| 263 | 281 | "Chytridiaceae": S.Array(S.Union(S.Boolean, ChytridiaceaeClass, S.Null)), |
| 264 | 282 | "Discordia": S.Array(S.Union(S.Array(S.Int), DiscordiaClass)), |
| 265 | 283 | "Endomyces": S.Array(S.Union(S.Int, S.String)), |
| 266 | 284 | "Epinephelidae": S.Array(S.Union(S.Boolean, S.Int, S.String)), |
| 267 | - "Eupatorium": S.Array(S.Union(S.Array(S.Null), S.Record({ key: S.String, value: S.Int}))), | |
| 285 | + "Eupatorium": S.Array(S.Union(S.Array(S.Null), mapSchema(S.Int))), | |
| 268 | 286 | "Gryphosaurus": S.Array(S.Union(S.Array(S.Int), S.String, GryphosaurusClass)), |
| 269 | - "Koryak": S.Array(S.Union(S.Record({ key: S.String, value: S.NullOr(S.Int)}), S.String)), | |
| 287 | + "Koryak": S.Array(S.Union(mapSchema(S.NullOr(S.Int)), S.String)), | |
| 270 | 288 | "Lavinia": S.Array(S.Union(S.String, LaviniaClass)), |
| 271 | 289 | "Oskar": S.Array(S.Union(S.Array(S.Int), OskarClass)), |
| 272 | 290 | "Rebecca": S.Array(S.Union(S.Int, S.String, Rebecca)), |
| 273 | 291 | "Rhomboganoidei": S.Array(S.Union(S.Array(S.Int), S.String, Rebecca)), |
| 274 | 292 | "Rigsmal": S.Boolean, |
| 275 | 293 | "Ruellia": S.Array(S.Union(S.Boolean, S.String, Rebecca)), |
| 276 | - "School": S.Array(S.Union(S.Int, S.Record({ key: S.String, value: S.Int}), S.Null)), | |
| 294 | + "School": S.Array(S.Union(S.Int, mapSchema(S.Int), S.Null)), | |
| 277 | 295 | "Shakespearolater": S.Array(S.Union(S.Array(S.Int), S.Number, S.String)), |
| 278 | 296 | "Svan": S.Array(S.Number), |
| 279 | - "Wayao": S.Record({ key: S.String, value: S.Number}), | |
| 297 | + "Wayao": mapSchema(S.Number), | |
| 280 | 298 | }) {} |
Mtypescriptacronym-style-pascal--d9e0c1bd777a / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptconverters-all-objects--3a443babd1cb / TopLevel.ts+2 −2
| @@ -531,7 +531,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 531 | 531 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 532 | 532 | return invalidValue(l(ref || "object"), val, key, parent); |
| 533 | 533 | } |
| 534 | - const result: any = {}; | |
| 534 | + const result: any = Object.create(null); | |
| 535 | 535 | Object.getOwnPropertyNames(props).forEach(key => { |
| 536 | 536 | const prop = props[key]; |
| 537 | 537 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -542,7 +542,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 542 | 542 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 543 | 543 | } |
| 544 | 544 | }); |
| 545 | - return result; | |
| 545 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptnice-property-names-true--f4d7920ee2ce / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptprefer-const-values-true--6b26e4d1265c / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptprefer-types-true--df33e18681f9 / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptprefer-unions-false--a5053c0a486d / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptprefer-unknown-false--f1ab9e45d823 / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptraw-type-any--474b307c39db / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptreadonly-true--24da4fc107df / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = val[key]; |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Test case
24 generated files · +120 −68test/inputs/json/priority/combinations3.json
Melmarray-type-array--eed288b23e27 / QuickType.elm+15 −7
| @@ -714,7 +714,7 @@ encodeQuickType x = | ||
| 714 | 714 | , ("prefreshman", Jenc.array encodePrefreshmanElement x.prefreshman) |
| 715 | 715 | , ("prehensility", Jenc.array encodePrehensility x.prehensility) |
| 716 | 716 | , ("prevoidance", Jenc.array encodePrevoidance x.prevoidance) |
| 717 | - , ("probant", Jenc.array (Jenc.dict identity (makeNullableEncoder Jenc.int)) x.probant) | |
| 717 | + , ("probant", Jenc.array (makeDictEncoder identity (makeNullableEncoder Jenc.int)) x.probant) | |
| 718 | 718 | , ("protext", Jenc.array encodeProtext x.protext) |
| 719 | 719 | ] |
| 720 | 720 | |
| @@ -789,7 +789,7 @@ kongoni = | ||
| 789 | 789 | encodeKongoni : Kongoni -> Jenc.Value |
| 790 | 790 | encodeKongoni x = case x of |
| 791 | 791 | IntegerArrayInKongoni y -> Jenc.array Jenc.int y |
| 792 | - IntegerMapInKongoni y -> Jenc.dict identity Jenc.int y | |
| 792 | + IntegerMapInKongoni y -> makeDictEncoder identity Jenc.int y | |
| 793 | 793 | |
| 794 | 794 | ladronismElement : Jdec.Decoder LadronismElement |
| 795 | 795 | ladronismElement = |
| @@ -1462,7 +1462,7 @@ paleographically = | ||
| 1462 | 1462 | encodePaleographically : Paleographically -> Jenc.Value |
| 1463 | 1463 | encodePaleographically x = case x of |
| 1464 | 1464 | DoubleInPaleographically y -> Jenc.float y |
| 1465 | - UnionMapInPaleographically y -> Jenc.dict identity (makeNullableEncoder Jenc.int) y | |
| 1465 | + UnionMapInPaleographically y -> makeDictEncoder identity (makeNullableEncoder Jenc.int) y | |
| 1466 | 1466 | |
| 1467 | 1467 | pamphletwise : Jdec.Decoder Pamphletwise |
| 1468 | 1468 | pamphletwise = |
| @@ -1476,7 +1476,7 @@ encodePamphletwise : Pamphletwise -> Jenc.Value | ||
| 1476 | 1476 | encodePamphletwise x = case x of |
| 1477 | 1477 | IntegerInPamphletwise y -> Jenc.int y |
| 1478 | 1478 | StringInPamphletwise y -> Jenc.string y |
| 1479 | - IntegerMapInPamphletwise y -> Jenc.dict identity Jenc.int y | |
| 1479 | + IntegerMapInPamphletwise y -> makeDictEncoder identity Jenc.int y | |
| 1480 | 1480 | |
| 1481 | 1481 | pediatric : Jdec.Decoder Pediatric |
| 1482 | 1482 | pediatric = |
| @@ -1613,7 +1613,7 @@ placuntiti = | ||
| 1613 | 1613 | encodePlacuntiti : Placuntiti -> Jenc.Value |
| 1614 | 1614 | encodePlacuntiti x = case x of |
| 1615 | 1615 | IntegerInPlacuntiti y -> Jenc.int y |
| 1616 | - IntegerMapInPlacuntiti y -> Jenc.dict identity Jenc.int y | |
| 1616 | + IntegerMapInPlacuntiti y -> makeDictEncoder identity Jenc.int y | |
| 1617 | 1617 | |
| 1618 | 1618 | plectopterous : Jdec.Decoder Plectopterous |
| 1619 | 1619 | plectopterous = |
| @@ -1625,7 +1625,7 @@ plectopterous = | ||
| 1625 | 1625 | encodePlectopterous : Plectopterous -> Jenc.Value |
| 1626 | 1626 | encodePlectopterous x = case x of |
| 1627 | 1627 | DoubleInPlectopterous y -> Jenc.float y |
| 1628 | - IntegerMapInPlectopterous y -> Jenc.dict identity Jenc.int y | |
| 1628 | + IntegerMapInPlectopterous y -> makeDictEncoder identity Jenc.int y | |
| 1629 | 1629 | |
| 1630 | 1630 | pneumocele : Jdec.Decoder Pneumocele |
| 1631 | 1631 | pneumocele = |
| @@ -1710,7 +1710,7 @@ encodePoormaster : Poormaster -> Jenc.Value | ||
| 1710 | 1710 | encodePoormaster x = case x of |
| 1711 | 1711 | IntegerArrayInPoormaster y -> Jenc.array Jenc.int y |
| 1712 | 1712 | NullInPoormaster -> Jenc.null |
| 1713 | - IntegerMapInPoormaster y -> Jenc.dict identity Jenc.int y | |
| 1713 | + IntegerMapInPoormaster y -> makeDictEncoder identity Jenc.int y | |
| 1714 | 1714 | |
| 1715 | 1715 | potwhiskyElement : Jdec.Decoder PotwhiskyElement |
| 1716 | 1716 | potwhiskyElement = |
| @@ -1896,6 +1896,14 @@ encodeProtext x = case x of | ||
| 1896 | 1896 | |
| 1897 | 1897 | --- encoder helpers |
| 1898 | 1898 | |
| 1899 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 1900 | +makeDictEncoder f m r = | |
| 1901 | + r | |
| 1902 | + |> Dict.toList | |
| 1903 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 1904 | + |> String.join "," | |
| 1905 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 1906 | + | |
| 1899 | 1907 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 1900 | 1908 | makeNullableEncoder f m = |
| 1901 | 1909 | case m of |
Melmdefault / QuickType.elm+15 −7
| @@ -713,7 +713,7 @@ encodeQuickType x = | ||
| 713 | 713 | , ("prefreshman", Jenc.list encodePrefreshmanElement x.prefreshman) |
| 714 | 714 | , ("prehensility", Jenc.list encodePrehensility x.prehensility) |
| 715 | 715 | , ("prevoidance", Jenc.list encodePrevoidance x.prevoidance) |
| 716 | - , ("probant", Jenc.list (Jenc.dict identity (makeNullableEncoder Jenc.int)) x.probant) | |
| 716 | + , ("probant", Jenc.list (makeDictEncoder identity (makeNullableEncoder Jenc.int)) x.probant) | |
| 717 | 717 | , ("protext", Jenc.list encodeProtext x.protext) |
| 718 | 718 | ] |
| 719 | 719 | |
| @@ -788,7 +788,7 @@ kongoni = | ||
| 788 | 788 | encodeKongoni : Kongoni -> Jenc.Value |
| 789 | 789 | encodeKongoni x = case x of |
| 790 | 790 | IntegerArrayInKongoni y -> Jenc.list Jenc.int y |
| 791 | - IntegerMapInKongoni y -> Jenc.dict identity Jenc.int y | |
| 791 | + IntegerMapInKongoni y -> makeDictEncoder identity Jenc.int y | |
| 792 | 792 | |
| 793 | 793 | ladronismElement : Jdec.Decoder LadronismElement |
| 794 | 794 | ladronismElement = |
| @@ -1461,7 +1461,7 @@ paleographically = | ||
| 1461 | 1461 | encodePaleographically : Paleographically -> Jenc.Value |
| 1462 | 1462 | encodePaleographically x = case x of |
| 1463 | 1463 | DoubleInPaleographically y -> Jenc.float y |
| 1464 | - UnionMapInPaleographically y -> Jenc.dict identity (makeNullableEncoder Jenc.int) y | |
| 1464 | + UnionMapInPaleographically y -> makeDictEncoder identity (makeNullableEncoder Jenc.int) y | |
| 1465 | 1465 | |
| 1466 | 1466 | pamphletwise : Jdec.Decoder Pamphletwise |
| 1467 | 1467 | pamphletwise = |
| @@ -1475,7 +1475,7 @@ encodePamphletwise : Pamphletwise -> Jenc.Value | ||
| 1475 | 1475 | encodePamphletwise x = case x of |
| 1476 | 1476 | IntegerInPamphletwise y -> Jenc.int y |
| 1477 | 1477 | StringInPamphletwise y -> Jenc.string y |
| 1478 | - IntegerMapInPamphletwise y -> Jenc.dict identity Jenc.int y | |
| 1478 | + IntegerMapInPamphletwise y -> makeDictEncoder identity Jenc.int y | |
| 1479 | 1479 | |
| 1480 | 1480 | pediatric : Jdec.Decoder Pediatric |
| 1481 | 1481 | pediatric = |
| @@ -1612,7 +1612,7 @@ placuntiti = | ||
| 1612 | 1612 | encodePlacuntiti : Placuntiti -> Jenc.Value |
| 1613 | 1613 | encodePlacuntiti x = case x of |
| 1614 | 1614 | IntegerInPlacuntiti y -> Jenc.int y |
| 1615 | - IntegerMapInPlacuntiti y -> Jenc.dict identity Jenc.int y | |
| 1615 | + IntegerMapInPlacuntiti y -> makeDictEncoder identity Jenc.int y | |
| 1616 | 1616 | |
| 1617 | 1617 | plectopterous : Jdec.Decoder Plectopterous |
| 1618 | 1618 | plectopterous = |
| @@ -1624,7 +1624,7 @@ plectopterous = | ||
| 1624 | 1624 | encodePlectopterous : Plectopterous -> Jenc.Value |
| 1625 | 1625 | encodePlectopterous x = case x of |
| 1626 | 1626 | DoubleInPlectopterous y -> Jenc.float y |
| 1627 | - IntegerMapInPlectopterous y -> Jenc.dict identity Jenc.int y | |
| 1627 | + IntegerMapInPlectopterous y -> makeDictEncoder identity Jenc.int y | |
| 1628 | 1628 | |
| 1629 | 1629 | pneumocele : Jdec.Decoder Pneumocele |
| 1630 | 1630 | pneumocele = |
| @@ -1709,7 +1709,7 @@ encodePoormaster : Poormaster -> Jenc.Value | ||
| 1709 | 1709 | encodePoormaster x = case x of |
| 1710 | 1710 | IntegerArrayInPoormaster y -> Jenc.list Jenc.int y |
| 1711 | 1711 | NullInPoormaster -> Jenc.null |
| 1712 | - IntegerMapInPoormaster y -> Jenc.dict identity Jenc.int y | |
| 1712 | + IntegerMapInPoormaster y -> makeDictEncoder identity Jenc.int y | |
| 1713 | 1713 | |
| 1714 | 1714 | potwhiskyElement : Jdec.Decoder PotwhiskyElement |
| 1715 | 1715 | potwhiskyElement = |
| @@ -1895,6 +1895,14 @@ encodeProtext x = case x of | ||
| 1895 | 1895 | |
| 1896 | 1896 | --- encoder helpers |
| 1897 | 1897 | |
| 1898 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 1899 | +makeDictEncoder f m r = | |
| 1900 | + r | |
| 1901 | + |> Dict.toList | |
| 1902 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 1903 | + |> String.join "," | |
| 1904 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 1905 | + | |
| 1898 | 1906 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 1899 | 1907 | makeNullableEncoder f m = |
| 1900 | 1908 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mflownice-property-names-true--f4d7920ee2ce / TopLevel.js+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mflowprefer-unions-false--a5053c0a486d / TopLevel.js+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mflowprefer-unknown-false--f1ab9e45d823 / TopLevel.js+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mflowruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = val[key]; |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mjavascriptconverters-top-level--67aa452ed509 / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptraw-type-any--474b307c39db / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = val[key]; |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+25 −7
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class PrefreshmanClass extends S.Class<PrefreshmanClass>("PrefreshmanClass")({ |
| 5 | 23 | "azorubine": S.Null, |
| @@ -340,7 +358,7 @@ export class JurorClass extends S.Class<JurorClass>("JurorClass")({ | ||
| 340 | 358 | |
| 341 | 359 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 342 | 360 | "juror": S.Array(S.Union(S.Boolean, JurorClass)), |
| 343 | - "kongoni": S.Array(S.Union(S.Array(S.Int), S.Record({ key: S.String, value: S.Int}))), | |
| 361 | + "kongoni": S.Array(S.Union(S.Array(S.Int), mapSchema(S.Int))), | |
| 344 | 362 | "ladronism": S.Array(S.Union(S.Number, S.String, LadronismClass)), |
| 345 | 363 | "landlubberly": S.Array(S.Union(S.Boolean, S.Int, LandlubberlyClass)), |
| 346 | 364 | "listener": S.Array(S.Union(S.Array(S.Null), S.Int)), |
| @@ -361,24 +379,24 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 361 | 379 | "nonvaluation": S.Array(S.Union(S.Array(S.Null), S.Boolean, S.Number)), |
| 362 | 380 | "occupationalist": S.Array(S.Union(S.Array(S.Null), OccupationalistClass, S.Null)), |
| 363 | 381 | "outrival": S.Array(S.Union(S.Number, OutrivalClass, S.Null)), |
| 364 | - "paleographically": S.Array(S.Union(S.Number, S.Record({ key: S.String, value: S.NullOr(S.Int)}))), | |
| 365 | - "pamphletwise": S.Array(S.Union(S.Int, S.Record({ key: S.String, value: S.Int}), S.String)), | |
| 382 | + "paleographically": S.Array(S.Union(S.Number, mapSchema(S.NullOr(S.Int)))), | |
| 383 | + "pamphletwise": S.Array(S.Union(S.Int, mapSchema(S.Int), S.String)), | |
| 366 | 384 | "pediatrics": S.Array(S.Union(S.Boolean, S.Number, S.Null)), |
| 367 | 385 | "perceptive": S.Array(S.Boolean), |
| 368 | 386 | "piaculum": S.Array(S.Union(S.Number, PiaculumClass)), |
| 369 | 387 | "piccadilly": S.Array(S.Union(S.Number, S.String, S.Null)), |
| 370 | 388 | "piffler": S.Array(S.Union(S.Array(S.Null), MonaziteClass)), |
| 371 | 389 | "pithful": S.Array(S.Union(S.Boolean, S.Int, S.Null)), |
| 372 | - "placuntitis": S.Array(S.Union(S.Int, S.Record({ key: S.String, value: S.Int}))), | |
| 373 | - "plectopterous": S.Array(S.Union(S.Number, S.Record({ key: S.String, value: S.Int}))), | |
| 390 | + "placuntitis": S.Array(S.Union(S.Int, mapSchema(S.Int))), | |
| 391 | + "plectopterous": S.Array(S.Union(S.Number, mapSchema(S.Int))), | |
| 374 | 392 | "pneumocele": S.Array(S.NullOr(Pneumocele)), |
| 375 | 393 | "poliorcetic": S.Array(S.Union(S.Boolean, MonaziteClass)), |
| 376 | - "poormaster": S.Array(S.Union(S.Array(S.Int), S.Record({ key: S.String, value: S.Int}), S.Null)), | |
| 394 | + "poormaster": S.Array(S.Union(S.Array(S.Int), mapSchema(S.Int), S.Null)), | |
| 377 | 395 | "potwhisky": S.Array(S.Union(S.Int, PotwhiskyClass, S.Null)), |
| 378 | 396 | "practicalizer": S.Array(S.Union(S.Array(S.Null), S.String, MonaziteClass)), |
| 379 | 397 | "prefreshman": S.Array(S.Union(S.Array(S.Null), S.String, PrefreshmanClass)), |
| 380 | 398 | "prehensility": S.Array(S.Union(S.Array(S.Null), S.Boolean, MonaziteClass)), |
| 381 | 399 | "prevoidance": S.Array(S.Union(S.Array(S.Int), S.Int, MonaziteClass)), |
| 382 | - "probant": S.Array(S.Record({ key: S.String, value: S.NullOr(S.Int)})), | |
| 400 | + "probant": S.Array(mapSchema(S.NullOr(S.Int))), | |
| 383 | 401 | "protext": S.Array(S.Union(S.Array(S.Int), S.Boolean, MonaziteClass)), |
| 384 | 402 | }) {} |
Mtypescript-effect-schemajust-schema-true--8c4ca457bcba / TopLevel.ts+25 −7
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class PrefreshmanClass extends S.Class<PrefreshmanClass>("PrefreshmanClass")({ |
| 5 | 23 | "azorubine": S.Null, |
| @@ -340,7 +358,7 @@ export class JurorClass extends S.Class<JurorClass>("JurorClass")({ | ||
| 340 | 358 | |
| 341 | 359 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 342 | 360 | "juror": S.Array(S.Union(S.Boolean, JurorClass)), |
| 343 | - "kongoni": S.Array(S.Union(S.Array(S.Int), S.Record({ key: S.String, value: S.Int}))), | |
| 361 | + "kongoni": S.Array(S.Union(S.Array(S.Int), mapSchema(S.Int))), | |
| 344 | 362 | "ladronism": S.Array(S.Union(S.Number, S.String, LadronismClass)), |
| 345 | 363 | "landlubberly": S.Array(S.Union(S.Boolean, S.Int, LandlubberlyClass)), |
| 346 | 364 | "listener": S.Array(S.Union(S.Array(S.Null), S.Int)), |
| @@ -361,24 +379,24 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 361 | 379 | "nonvaluation": S.Array(S.Union(S.Array(S.Null), S.Boolean, S.Number)), |
| 362 | 380 | "occupationalist": S.Array(S.Union(S.Array(S.Null), OccupationalistClass, S.Null)), |
| 363 | 381 | "outrival": S.Array(S.Union(S.Number, OutrivalClass, S.Null)), |
| 364 | - "paleographically": S.Array(S.Union(S.Number, S.Record({ key: S.String, value: S.NullOr(S.Int)}))), | |
| 365 | - "pamphletwise": S.Array(S.Union(S.Int, S.Record({ key: S.String, value: S.Int}), S.String)), | |
| 382 | + "paleographically": S.Array(S.Union(S.Number, mapSchema(S.NullOr(S.Int)))), | |
| 383 | + "pamphletwise": S.Array(S.Union(S.Int, mapSchema(S.Int), S.String)), | |
| 366 | 384 | "pediatrics": S.Array(S.Union(S.Boolean, S.Number, S.Null)), |
| 367 | 385 | "perceptive": S.Array(S.Boolean), |
| 368 | 386 | "piaculum": S.Array(S.Union(S.Number, PiaculumClass)), |
| 369 | 387 | "piccadilly": S.Array(S.Union(S.Number, S.String, S.Null)), |
| 370 | 388 | "piffler": S.Array(S.Union(S.Array(S.Null), MonaziteClass)), |
| 371 | 389 | "pithful": S.Array(S.Union(S.Boolean, S.Int, S.Null)), |
| 372 | - "placuntitis": S.Array(S.Union(S.Int, S.Record({ key: S.String, value: S.Int}))), | |
| 373 | - "plectopterous": S.Array(S.Union(S.Number, S.Record({ key: S.String, value: S.Int}))), | |
| 390 | + "placuntitis": S.Array(S.Union(S.Int, mapSchema(S.Int))), | |
| 391 | + "plectopterous": S.Array(S.Union(S.Number, mapSchema(S.Int))), | |
| 374 | 392 | "pneumocele": S.Array(S.NullOr(Pneumocele)), |
| 375 | 393 | "poliorcetic": S.Array(S.Union(S.Boolean, MonaziteClass)), |
| 376 | - "poormaster": S.Array(S.Union(S.Array(S.Int), S.Record({ key: S.String, value: S.Int}), S.Null)), | |
| 394 | + "poormaster": S.Array(S.Union(S.Array(S.Int), mapSchema(S.Int), S.Null)), | |
| 377 | 395 | "potwhisky": S.Array(S.Union(S.Int, PotwhiskyClass, S.Null)), |
| 378 | 396 | "practicalizer": S.Array(S.Union(S.Array(S.Null), S.String, MonaziteClass)), |
| 379 | 397 | "prefreshman": S.Array(S.Union(S.Array(S.Null), S.String, PrefreshmanClass)), |
| 380 | 398 | "prehensility": S.Array(S.Union(S.Array(S.Null), S.Boolean, MonaziteClass)), |
| 381 | 399 | "prevoidance": S.Array(S.Union(S.Array(S.Int), S.Int, MonaziteClass)), |
| 382 | - "probant": S.Array(S.Record({ key: S.String, value: S.NullOr(S.Int)})), | |
| 400 | + "probant": S.Array(mapSchema(S.NullOr(S.Int))), | |
| 383 | 401 | "protext": S.Array(S.Union(S.Array(S.Int), S.Boolean, MonaziteClass)), |
| 384 | 402 | }) {} |
Mtypescriptacronym-style-pascal--d9e0c1bd777a / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptconverters-all-objects--3a443babd1cb / TopLevel.ts+2 −2
| @@ -667,7 +667,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 667 | 667 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 668 | 668 | return invalidValue(l(ref || "object"), val, key, parent); |
| 669 | 669 | } |
| 670 | - const result: any = {}; | |
| 670 | + const result: any = Object.create(null); | |
| 671 | 671 | Object.getOwnPropertyNames(props).forEach(key => { |
| 672 | 672 | const prop = props[key]; |
| 673 | 673 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -678,7 +678,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 678 | 678 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 679 | 679 | } |
| 680 | 680 | }); |
| 681 | - return result; | |
| 681 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptnice-property-names-true--f4d7920ee2ce / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptprefer-const-values-true--6b26e4d1265c / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptprefer-types-true--df33e18681f9 / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptprefer-unions-false--a5053c0a486d / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptprefer-unknown-false--f1ab9e45d823 / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptraw-type-any--474b307c39db / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptreadonly-true--24da4fc107df / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = val[key]; |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Test case
24 generated files · +136 −84test/inputs/json/priority/combinations4.json
Melmarray-type-array--eed288b23e27 / QuickType.elm+19 −11
| @@ -830,7 +830,7 @@ encodeQuickType x = | ||
| 830 | 830 | , ("untasked", Jenc.array encodeUntasked x.untasked) |
| 831 | 831 | , ("unvarying", Jenc.array encodeUnvarying x.unvarying) |
| 832 | 832 | , ("vehemently", Jenc.array encodeVehemently x.vehemently) |
| 833 | - , ("warriorship", Jenc.dict identity Jenc.bool x.warriorship) | |
| 833 | + , ("warriorship", makeDictEncoder identity Jenc.bool x.warriorship) | |
| 834 | 834 | , ("whitepot", Jenc.array encodeWhitepot x.whitepot) |
| 835 | 835 | , ("wrothy", Jenc.array encodeWrothyElement x.wrothy) |
| 836 | 836 | ] |
| @@ -1014,7 +1014,7 @@ querier = | ||
| 1014 | 1014 | encodeQuerier : Querier -> Jenc.Value |
| 1015 | 1015 | encodeQuerier x = case x of |
| 1016 | 1016 | BoolInQuerier y -> Jenc.bool y |
| 1017 | - IntegerMapInQuerier y -> Jenc.dict identity Jenc.int y | |
| 1017 | + IntegerMapInQuerier y -> makeDictEncoder identity Jenc.int y | |
| 1018 | 1018 | |
| 1019 | 1019 | rebarbative : Jdec.Decoder Rebarbative |
| 1020 | 1020 | rebarbative = |
| @@ -1312,7 +1312,7 @@ encodeSaprophilous : Saprophilous -> Jenc.Value | ||
| 1312 | 1312 | encodeSaprophilous x = case x of |
| 1313 | 1313 | NullInSaprophilous -> Jenc.null |
| 1314 | 1314 | StringInSaprophilous y -> Jenc.string y |
| 1315 | - IntegerMapInSaprophilous y -> Jenc.dict identity Jenc.int y | |
| 1315 | + IntegerMapInSaprophilous y -> makeDictEncoder identity Jenc.int y | |
| 1316 | 1316 | |
| 1317 | 1317 | saxtenElement : Jdec.Decoder SaxtenElement |
| 1318 | 1318 | saxtenElement = |
| @@ -1446,7 +1446,7 @@ encodeScoffer : Scoffer -> Jenc.Value | ||
| 1446 | 1446 | encodeScoffer x = case x of |
| 1447 | 1447 | NullArrayInScoffer y -> Jenc.array (always Jenc.null) y |
| 1448 | 1448 | NullInScoffer -> Jenc.null |
| 1449 | - IntegerMapInScoffer y -> Jenc.dict identity Jenc.int y | |
| 1449 | + IntegerMapInScoffer y -> makeDictEncoder identity Jenc.int y | |
| 1450 | 1450 | |
| 1451 | 1451 | scrampum : Jdec.Decoder Scrampum |
| 1452 | 1452 | scrampum = |
| @@ -1632,7 +1632,7 @@ encodeStimulability : Stimulability -> Jenc.Value | ||
| 1632 | 1632 | encodeStimulability x = case x of |
| 1633 | 1633 | BoolInStimulability y -> Jenc.bool y |
| 1634 | 1634 | IntegerInStimulability y -> Jenc.int y |
| 1635 | - IntegerMapInStimulability y -> Jenc.dict identity Jenc.int y | |
| 1635 | + IntegerMapInStimulability y -> makeDictEncoder identity Jenc.int y | |
| 1636 | 1636 | |
| 1637 | 1637 | strangleable : Jdec.Decoder Strangleable |
| 1638 | 1638 | strangleable = |
| @@ -1852,7 +1852,7 @@ encodeUnbeginning : Unbeginning -> Jenc.Value | ||
| 1852 | 1852 | encodeUnbeginning x = case x of |
| 1853 | 1853 | NullArrayInUnbeginning y -> Jenc.array (always Jenc.null) y |
| 1854 | 1854 | StringInUnbeginning y -> Jenc.string y |
| 1855 | - IntegerMapInUnbeginning y -> Jenc.dict identity Jenc.int y | |
| 1855 | + IntegerMapInUnbeginning y -> makeDictEncoder identity Jenc.int y | |
| 1856 | 1856 | |
| 1857 | 1857 | undesirability : Jdec.Decoder Undesirability |
| 1858 | 1858 | undesirability = |
| @@ -1866,7 +1866,7 @@ encodeUndesirability : Undesirability -> Jenc.Value | ||
| 1866 | 1866 | encodeUndesirability x = case x of |
| 1867 | 1867 | IntegerArrayInUndesirability y -> Jenc.array Jenc.int y |
| 1868 | 1868 | StringInUndesirability y -> Jenc.string y |
| 1869 | - IntegerMapInUndesirability y -> Jenc.dict identity Jenc.int y | |
| 1869 | + IntegerMapInUndesirability y -> makeDictEncoder identity Jenc.int y | |
| 1870 | 1870 | |
| 1871 | 1871 | unerasing : Jdec.Decoder Unerasing |
| 1872 | 1872 | unerasing = |
| @@ -1880,7 +1880,7 @@ encodeUnerasing : Unerasing -> Jenc.Value | ||
| 1880 | 1880 | encodeUnerasing x = case x of |
| 1881 | 1881 | NullArrayInUnerasing y -> Jenc.array (always Jenc.null) y |
| 1882 | 1882 | IntegerInUnerasing y -> Jenc.int y |
| 1883 | - IntegerMapInUnerasing y -> Jenc.dict identity Jenc.int y | |
| 1883 | + IntegerMapInUnerasing y -> makeDictEncoder identity Jenc.int y | |
| 1884 | 1884 | |
| 1885 | 1885 | unguentarium : Jdec.Decoder Unguentarium |
| 1886 | 1886 | unguentarium = |
| @@ -1979,7 +1979,7 @@ encodeUnmortgaged : Unmortgaged -> Jenc.Value | ||
| 1979 | 1979 | encodeUnmortgaged x = case x of |
| 1980 | 1980 | NullInUnmortgaged -> Jenc.null |
| 1981 | 1981 | DoubleInUnmortgaged y -> Jenc.float y |
| 1982 | - IntegerMapInUnmortgaged y -> Jenc.dict identity Jenc.int y | |
| 1982 | + IntegerMapInUnmortgaged y -> makeDictEncoder identity Jenc.int y | |
| 1983 | 1983 | |
| 1984 | 1984 | unobstructed : Jdec.Decoder Unobstructed |
| 1985 | 1985 | unobstructed = |
| @@ -2098,7 +2098,7 @@ encodeUntasked : Untasked -> Jenc.Value | ||
| 2098 | 2098 | encodeUntasked x = case x of |
| 2099 | 2099 | NullArrayInUntasked y -> Jenc.array (always Jenc.null) y |
| 2100 | 2100 | DoubleInUntasked y -> Jenc.float y |
| 2101 | - IntegerMapInUntasked y -> Jenc.dict identity Jenc.int y | |
| 2101 | + IntegerMapInUntasked y -> makeDictEncoder identity Jenc.int y | |
| 2102 | 2102 | |
| 2103 | 2103 | unvarying : Jdec.Decoder Unvarying |
| 2104 | 2104 | unvarying = |
| @@ -2112,7 +2112,7 @@ encodeUnvarying : Unvarying -> Jenc.Value | ||
| 2112 | 2112 | encodeUnvarying x = case x of |
| 2113 | 2113 | BoolInUnvarying y -> Jenc.bool y |
| 2114 | 2114 | DoubleInUnvarying y -> Jenc.float y |
| 2115 | - IntegerMapInUnvarying y -> Jenc.dict identity Jenc.int y | |
| 2115 | + IntegerMapInUnvarying y -> makeDictEncoder identity Jenc.int y | |
| 2116 | 2116 | |
| 2117 | 2117 | vehemently : Jdec.Decoder Vehemently |
| 2118 | 2118 | vehemently = |
| @@ -2203,6 +2203,14 @@ encodeWrothyClass x = | ||
| 2203 | 2203 | |
| 2204 | 2204 | --- encoder helpers |
| 2205 | 2205 | |
| 2206 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 2207 | +makeDictEncoder f m r = | |
| 2208 | + r | |
| 2209 | + |> Dict.toList | |
| 2210 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 2211 | + |> String.join "," | |
| 2212 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 2213 | + | |
| 2206 | 2214 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 2207 | 2215 | makeNullableEncoder f m = |
| 2208 | 2216 | case m of |
Melmdefault / QuickType.elm+19 −11
| @@ -829,7 +829,7 @@ encodeQuickType x = | ||
| 829 | 829 | , ("untasked", Jenc.list encodeUntasked x.untasked) |
| 830 | 830 | , ("unvarying", Jenc.list encodeUnvarying x.unvarying) |
| 831 | 831 | , ("vehemently", Jenc.list encodeVehemently x.vehemently) |
| 832 | - , ("warriorship", Jenc.dict identity Jenc.bool x.warriorship) | |
| 832 | + , ("warriorship", makeDictEncoder identity Jenc.bool x.warriorship) | |
| 833 | 833 | , ("whitepot", Jenc.list encodeWhitepot x.whitepot) |
| 834 | 834 | , ("wrothy", Jenc.list encodeWrothyElement x.wrothy) |
| 835 | 835 | ] |
| @@ -1013,7 +1013,7 @@ querier = | ||
| 1013 | 1013 | encodeQuerier : Querier -> Jenc.Value |
| 1014 | 1014 | encodeQuerier x = case x of |
| 1015 | 1015 | BoolInQuerier y -> Jenc.bool y |
| 1016 | - IntegerMapInQuerier y -> Jenc.dict identity Jenc.int y | |
| 1016 | + IntegerMapInQuerier y -> makeDictEncoder identity Jenc.int y | |
| 1017 | 1017 | |
| 1018 | 1018 | rebarbative : Jdec.Decoder Rebarbative |
| 1019 | 1019 | rebarbative = |
| @@ -1311,7 +1311,7 @@ encodeSaprophilous : Saprophilous -> Jenc.Value | ||
| 1311 | 1311 | encodeSaprophilous x = case x of |
| 1312 | 1312 | NullInSaprophilous -> Jenc.null |
| 1313 | 1313 | StringInSaprophilous y -> Jenc.string y |
| 1314 | - IntegerMapInSaprophilous y -> Jenc.dict identity Jenc.int y | |
| 1314 | + IntegerMapInSaprophilous y -> makeDictEncoder identity Jenc.int y | |
| 1315 | 1315 | |
| 1316 | 1316 | saxtenElement : Jdec.Decoder SaxtenElement |
| 1317 | 1317 | saxtenElement = |
| @@ -1445,7 +1445,7 @@ encodeScoffer : Scoffer -> Jenc.Value | ||
| 1445 | 1445 | encodeScoffer x = case x of |
| 1446 | 1446 | NullArrayInScoffer y -> Jenc.list (always Jenc.null) y |
| 1447 | 1447 | NullInScoffer -> Jenc.null |
| 1448 | - IntegerMapInScoffer y -> Jenc.dict identity Jenc.int y | |
| 1448 | + IntegerMapInScoffer y -> makeDictEncoder identity Jenc.int y | |
| 1449 | 1449 | |
| 1450 | 1450 | scrampum : Jdec.Decoder Scrampum |
| 1451 | 1451 | scrampum = |
| @@ -1631,7 +1631,7 @@ encodeStimulability : Stimulability -> Jenc.Value | ||
| 1631 | 1631 | encodeStimulability x = case x of |
| 1632 | 1632 | BoolInStimulability y -> Jenc.bool y |
| 1633 | 1633 | IntegerInStimulability y -> Jenc.int y |
| 1634 | - IntegerMapInStimulability y -> Jenc.dict identity Jenc.int y | |
| 1634 | + IntegerMapInStimulability y -> makeDictEncoder identity Jenc.int y | |
| 1635 | 1635 | |
| 1636 | 1636 | strangleable : Jdec.Decoder Strangleable |
| 1637 | 1637 | strangleable = |
| @@ -1851,7 +1851,7 @@ encodeUnbeginning : Unbeginning -> Jenc.Value | ||
| 1851 | 1851 | encodeUnbeginning x = case x of |
| 1852 | 1852 | NullArrayInUnbeginning y -> Jenc.list (always Jenc.null) y |
| 1853 | 1853 | StringInUnbeginning y -> Jenc.string y |
| 1854 | - IntegerMapInUnbeginning y -> Jenc.dict identity Jenc.int y | |
| 1854 | + IntegerMapInUnbeginning y -> makeDictEncoder identity Jenc.int y | |
| 1855 | 1855 | |
| 1856 | 1856 | undesirability : Jdec.Decoder Undesirability |
| 1857 | 1857 | undesirability = |
| @@ -1865,7 +1865,7 @@ encodeUndesirability : Undesirability -> Jenc.Value | ||
| 1865 | 1865 | encodeUndesirability x = case x of |
| 1866 | 1866 | IntegerArrayInUndesirability y -> Jenc.list Jenc.int y |
| 1867 | 1867 | StringInUndesirability y -> Jenc.string y |
| 1868 | - IntegerMapInUndesirability y -> Jenc.dict identity Jenc.int y | |
| 1868 | + IntegerMapInUndesirability y -> makeDictEncoder identity Jenc.int y | |
| 1869 | 1869 | |
| 1870 | 1870 | unerasing : Jdec.Decoder Unerasing |
| 1871 | 1871 | unerasing = |
| @@ -1879,7 +1879,7 @@ encodeUnerasing : Unerasing -> Jenc.Value | ||
| 1879 | 1879 | encodeUnerasing x = case x of |
| 1880 | 1880 | NullArrayInUnerasing y -> Jenc.list (always Jenc.null) y |
| 1881 | 1881 | IntegerInUnerasing y -> Jenc.int y |
| 1882 | - IntegerMapInUnerasing y -> Jenc.dict identity Jenc.int y | |
| 1882 | + IntegerMapInUnerasing y -> makeDictEncoder identity Jenc.int y | |
| 1883 | 1883 | |
| 1884 | 1884 | unguentarium : Jdec.Decoder Unguentarium |
| 1885 | 1885 | unguentarium = |
| @@ -1978,7 +1978,7 @@ encodeUnmortgaged : Unmortgaged -> Jenc.Value | ||
| 1978 | 1978 | encodeUnmortgaged x = case x of |
| 1979 | 1979 | NullInUnmortgaged -> Jenc.null |
| 1980 | 1980 | DoubleInUnmortgaged y -> Jenc.float y |
| 1981 | - IntegerMapInUnmortgaged y -> Jenc.dict identity Jenc.int y | |
| 1981 | + IntegerMapInUnmortgaged y -> makeDictEncoder identity Jenc.int y | |
| 1982 | 1982 | |
| 1983 | 1983 | unobstructed : Jdec.Decoder Unobstructed |
| 1984 | 1984 | unobstructed = |
| @@ -2097,7 +2097,7 @@ encodeUntasked : Untasked -> Jenc.Value | ||
| 2097 | 2097 | encodeUntasked x = case x of |
| 2098 | 2098 | NullArrayInUntasked y -> Jenc.list (always Jenc.null) y |
| 2099 | 2099 | DoubleInUntasked y -> Jenc.float y |
| 2100 | - IntegerMapInUntasked y -> Jenc.dict identity Jenc.int y | |
| 2100 | + IntegerMapInUntasked y -> makeDictEncoder identity Jenc.int y | |
| 2101 | 2101 | |
| 2102 | 2102 | unvarying : Jdec.Decoder Unvarying |
| 2103 | 2103 | unvarying = |
| @@ -2111,7 +2111,7 @@ encodeUnvarying : Unvarying -> Jenc.Value | ||
| 2111 | 2111 | encodeUnvarying x = case x of |
| 2112 | 2112 | BoolInUnvarying y -> Jenc.bool y |
| 2113 | 2113 | DoubleInUnvarying y -> Jenc.float y |
| 2114 | - IntegerMapInUnvarying y -> Jenc.dict identity Jenc.int y | |
| 2114 | + IntegerMapInUnvarying y -> makeDictEncoder identity Jenc.int y | |
| 2115 | 2115 | |
| 2116 | 2116 | vehemently : Jdec.Decoder Vehemently |
| 2117 | 2117 | vehemently = |
| @@ -2202,6 +2202,14 @@ encodeWrothyClass x = | ||
| 2202 | 2202 | |
| 2203 | 2203 | --- encoder helpers |
| 2204 | 2204 | |
| 2205 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 2206 | +makeDictEncoder f m r = | |
| 2207 | + r | |
| 2208 | + |> Dict.toList | |
| 2209 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 2210 | + |> String.join "," | |
| 2211 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 2212 | + | |
| 2205 | 2213 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 2206 | 2214 | makeNullableEncoder f m = |
| 2207 | 2215 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mflownice-property-names-true--f4d7920ee2ce / TopLevel.js+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mflowprefer-unions-false--a5053c0a486d / TopLevel.js+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mflowprefer-unknown-false--f1ab9e45d823 / TopLevel.js+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mflowruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = val[key]; |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mjavascriptconverters-top-level--67aa452ed509 / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptraw-type-any--474b307c39db / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = val[key]; |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+29 −11
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class WrothyClass extends S.Class<WrothyClass>("WrothyClass")({ |
| 5 | 23 | "Aeschynanthus": S.Null, |
| @@ -389,7 +407,7 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 389 | 407 | "pulpitism": S.Array(S.Union(S.Array(S.Int), S.Number, PulpitismClass)), |
| 390 | 408 | "pyodermia": S.Array(S.Union(S.Int, PyodermiaClass)), |
| 391 | 409 | "quebrachine": S.Array(S.Union(S.Boolean, QuebrachineClass, S.Null)), |
| 392 | - "querier": S.Array(S.Union(S.Boolean, S.Record({ key: S.String, value: S.Int}))), | |
| 410 | + "querier": S.Array(S.Union(S.Boolean, mapSchema(S.Int))), | |
| 393 | 411 | "rebarbative": S.Array(S.Union(S.Array(S.Int), S.Boolean, S.Number)), |
| 394 | 412 | "reimagine": S.Array(Reimagine), |
| 395 | 413 | "ressaut": Ressaut, |
| @@ -398,10 +416,10 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 398 | 416 | "rewrite": S.Array(S.Union(S.Array(S.Null), S.Number, RewriteClass)), |
| 399 | 417 | "saccoderm": S.Array(S.Union(S.Array(S.Int), S.String, S.Null)), |
| 400 | 418 | "santir": S.Array(S.Union(S.Number, SantirClass)), |
| 401 | - "saprophilous": S.Array(S.Union(S.Record({ key: S.String, value: S.Int}), S.String, S.Null)), | |
| 419 | + "saprophilous": S.Array(S.Union(mapSchema(S.Int), S.String, S.Null)), | |
| 402 | 420 | "saxten": S.Array(S.Union(S.String, SaxtenClass)), |
| 403 | 421 | "scatty": S.Array(S.NullOr(Scatty)), |
| 404 | - "scoffer": S.Array(S.Union(S.Array(S.Null), S.Record({ key: S.String, value: S.Int}), S.Null)), | |
| 422 | + "scoffer": S.Array(S.Union(S.Array(S.Null), mapSchema(S.Int), S.Null)), | |
| 405 | 423 | "scrampum": S.Array(S.Union(S.Array(S.Int), S.Boolean, S.Null)), |
| 406 | 424 | "semantic": S.Number, |
| 407 | 425 | "serpentinic": S.Array(S.Union(S.Array(S.Int), S.Number)), |
| @@ -409,7 +427,7 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 409 | 427 | "sistering": S.Array(S.Union(S.Array(S.Null), S.Int, SisteringClass)), |
| 410 | 428 | "staghunting": S.Array(Staghunting), |
| 411 | 429 | "stagmometer": S.Array(S.Union(S.Array(S.NullOr(S.Int)), S.String)), |
| 412 | - "stimulability": S.Array(S.Union(S.Boolean, S.Int, S.Record({ key: S.String, value: S.Int}))), | |
| 430 | + "stimulability": S.Array(S.Union(S.Boolean, S.Int, mapSchema(S.Int))), | |
| 413 | 431 | "strangleable": S.Array(S.Union(S.Array(S.Null), S.Number)), |
| 414 | 432 | "strenuosity": S.Array(S.Union(S.Array(S.Null), StrenuosityClass)), |
| 415 | 433 | "tabaxir": S.Array(S.Union(S.Boolean, S.Number)), |
| @@ -419,22 +437,22 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 419 | 437 | "tortricine": S.Array(S.Union(S.Array(S.NullOr(S.Int)), QuebrachineClass)), |
| 420 | 438 | "truantcy": S.Array(S.Union(S.Boolean, TruantcyClass)), |
| 421 | 439 | "turgesce": S.Array(S.String), |
| 422 | - "unbeginning": S.Array(S.Union(S.Array(S.Null), S.Record({ key: S.String, value: S.Int}), S.String)), | |
| 440 | + "unbeginning": S.Array(S.Union(S.Array(S.Null), mapSchema(S.Int), S.String)), | |
| 423 | 441 | "underdunged": S.Array(S.Number), |
| 424 | - "undesirability": S.Array(S.Union(S.Array(S.Int), S.Record({ key: S.String, value: S.Int}), S.String)), | |
| 425 | - "unerasing": S.Array(S.Union(S.Array(S.Null), S.Int, S.Record({ key: S.String, value: S.Int}))), | |
| 442 | + "undesirability": S.Array(S.Union(S.Array(S.Int), mapSchema(S.Int), S.String)), | |
| 443 | + "unerasing": S.Array(S.Union(S.Array(S.Null), S.Int, mapSchema(S.Int))), | |
| 426 | 444 | "unguentarium": S.Array(S.Union(S.Array(S.Null), S.Int, S.Null)), |
| 427 | 445 | "unimpeachably": S.Array(S.Union(S.Boolean, UnimpeachablyClass)), |
| 428 | - "unmortgaged": S.Array(S.Union(S.Number, S.Record({ key: S.String, value: S.Int}), S.Null)), | |
| 446 | + "unmortgaged": S.Array(S.Union(S.Number, mapSchema(S.Int), S.Null)), | |
| 429 | 447 | "unobstructed": S.Array(S.Union(S.Int, QuebrachineClass, S.Null)), |
| 430 | 448 | "unreceptivity": S.Array(S.Union(S.Array(S.Null), S.Int, S.String)), |
| 431 | 449 | "unsatisfactoriness": S.Array(S.Union(S.Array(S.Int), S.Boolean, S.Int)), |
| 432 | 450 | "unsecurity": S.Array(S.Int), |
| 433 | 451 | "unstressed": S.Array(S.Union(S.Boolean, S.String, UnstressedClass)), |
| 434 | - "untasked": S.Array(S.Union(S.Array(S.Null), S.Number, S.Record({ key: S.String, value: S.Int}))), | |
| 435 | - "unvarying": S.Array(S.Union(S.Boolean, S.Number, S.Record({ key: S.String, value: S.Int}))), | |
| 452 | + "untasked": S.Array(S.Union(S.Array(S.Null), S.Number, mapSchema(S.Int))), | |
| 453 | + "unvarying": S.Array(S.Union(S.Boolean, S.Number, mapSchema(S.Int))), | |
| 436 | 454 | "vehemently": S.Array(S.Union(S.Array(S.Null), S.Boolean, S.Null)), |
| 437 | - "warriorship": S.Record({ key: S.String, value: S.Boolean}), | |
| 455 | + "warriorship": mapSchema(S.Boolean), | |
| 438 | 456 | "whitepot": S.Array(S.Union(S.Number, QuebrachineClass)), |
| 439 | 457 | "wrothy": S.Array(S.Union(S.Array(S.Null), WrothyClass)), |
| 440 | 458 | }) {} |
Mtypescript-effect-schemajust-schema-true--8c4ca457bcba / TopLevel.ts+29 −11
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class WrothyClass extends S.Class<WrothyClass>("WrothyClass")({ |
| 5 | 23 | "Aeschynanthus": S.Null, |
| @@ -389,7 +407,7 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 389 | 407 | "pulpitism": S.Array(S.Union(S.Array(S.Int), S.Number, PulpitismClass)), |
| 390 | 408 | "pyodermia": S.Array(S.Union(S.Int, PyodermiaClass)), |
| 391 | 409 | "quebrachine": S.Array(S.Union(S.Boolean, QuebrachineClass, S.Null)), |
| 392 | - "querier": S.Array(S.Union(S.Boolean, S.Record({ key: S.String, value: S.Int}))), | |
| 410 | + "querier": S.Array(S.Union(S.Boolean, mapSchema(S.Int))), | |
| 393 | 411 | "rebarbative": S.Array(S.Union(S.Array(S.Int), S.Boolean, S.Number)), |
| 394 | 412 | "reimagine": S.Array(Reimagine), |
| 395 | 413 | "ressaut": Ressaut, |
| @@ -398,10 +416,10 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 398 | 416 | "rewrite": S.Array(S.Union(S.Array(S.Null), S.Number, RewriteClass)), |
| 399 | 417 | "saccoderm": S.Array(S.Union(S.Array(S.Int), S.String, S.Null)), |
| 400 | 418 | "santir": S.Array(S.Union(S.Number, SantirClass)), |
| 401 | - "saprophilous": S.Array(S.Union(S.Record({ key: S.String, value: S.Int}), S.String, S.Null)), | |
| 419 | + "saprophilous": S.Array(S.Union(mapSchema(S.Int), S.String, S.Null)), | |
| 402 | 420 | "saxten": S.Array(S.Union(S.String, SaxtenClass)), |
| 403 | 421 | "scatty": S.Array(S.NullOr(Scatty)), |
| 404 | - "scoffer": S.Array(S.Union(S.Array(S.Null), S.Record({ key: S.String, value: S.Int}), S.Null)), | |
| 422 | + "scoffer": S.Array(S.Union(S.Array(S.Null), mapSchema(S.Int), S.Null)), | |
| 405 | 423 | "scrampum": S.Array(S.Union(S.Array(S.Int), S.Boolean, S.Null)), |
| 406 | 424 | "semantic": S.Number, |
| 407 | 425 | "serpentinic": S.Array(S.Union(S.Array(S.Int), S.Number)), |
| @@ -409,7 +427,7 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 409 | 427 | "sistering": S.Array(S.Union(S.Array(S.Null), S.Int, SisteringClass)), |
| 410 | 428 | "staghunting": S.Array(Staghunting), |
| 411 | 429 | "stagmometer": S.Array(S.Union(S.Array(S.NullOr(S.Int)), S.String)), |
| 412 | - "stimulability": S.Array(S.Union(S.Boolean, S.Int, S.Record({ key: S.String, value: S.Int}))), | |
| 430 | + "stimulability": S.Array(S.Union(S.Boolean, S.Int, mapSchema(S.Int))), | |
| 413 | 431 | "strangleable": S.Array(S.Union(S.Array(S.Null), S.Number)), |
| 414 | 432 | "strenuosity": S.Array(S.Union(S.Array(S.Null), StrenuosityClass)), |
| 415 | 433 | "tabaxir": S.Array(S.Union(S.Boolean, S.Number)), |
| @@ -419,22 +437,22 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 419 | 437 | "tortricine": S.Array(S.Union(S.Array(S.NullOr(S.Int)), QuebrachineClass)), |
| 420 | 438 | "truantcy": S.Array(S.Union(S.Boolean, TruantcyClass)), |
| 421 | 439 | "turgesce": S.Array(S.String), |
| 422 | - "unbeginning": S.Array(S.Union(S.Array(S.Null), S.Record({ key: S.String, value: S.Int}), S.String)), | |
| 440 | + "unbeginning": S.Array(S.Union(S.Array(S.Null), mapSchema(S.Int), S.String)), | |
| 423 | 441 | "underdunged": S.Array(S.Number), |
| 424 | - "undesirability": S.Array(S.Union(S.Array(S.Int), S.Record({ key: S.String, value: S.Int}), S.String)), | |
| 425 | - "unerasing": S.Array(S.Union(S.Array(S.Null), S.Int, S.Record({ key: S.String, value: S.Int}))), | |
| 442 | + "undesirability": S.Array(S.Union(S.Array(S.Int), mapSchema(S.Int), S.String)), | |
| 443 | + "unerasing": S.Array(S.Union(S.Array(S.Null), S.Int, mapSchema(S.Int))), | |
| 426 | 444 | "unguentarium": S.Array(S.Union(S.Array(S.Null), S.Int, S.Null)), |
| 427 | 445 | "unimpeachably": S.Array(S.Union(S.Boolean, UnimpeachablyClass)), |
| 428 | - "unmortgaged": S.Array(S.Union(S.Number, S.Record({ key: S.String, value: S.Int}), S.Null)), | |
| 446 | + "unmortgaged": S.Array(S.Union(S.Number, mapSchema(S.Int), S.Null)), | |
| 429 | 447 | "unobstructed": S.Array(S.Union(S.Int, QuebrachineClass, S.Null)), |
| 430 | 448 | "unreceptivity": S.Array(S.Union(S.Array(S.Null), S.Int, S.String)), |
| 431 | 449 | "unsatisfactoriness": S.Array(S.Union(S.Array(S.Int), S.Boolean, S.Int)), |
| 432 | 450 | "unsecurity": S.Array(S.Int), |
| 433 | 451 | "unstressed": S.Array(S.Union(S.Boolean, S.String, UnstressedClass)), |
| 434 | - "untasked": S.Array(S.Union(S.Array(S.Null), S.Number, S.Record({ key: S.String, value: S.Int}))), | |
| 435 | - "unvarying": S.Array(S.Union(S.Boolean, S.Number, S.Record({ key: S.String, value: S.Int}))), | |
| 452 | + "untasked": S.Array(S.Union(S.Array(S.Null), S.Number, mapSchema(S.Int))), | |
| 453 | + "unvarying": S.Array(S.Union(S.Boolean, S.Number, mapSchema(S.Int))), | |
| 436 | 454 | "vehemently": S.Array(S.Union(S.Array(S.Null), S.Boolean, S.Null)), |
| 437 | - "warriorship": S.Record({ key: S.String, value: S.Boolean}), | |
| 455 | + "warriorship": mapSchema(S.Boolean), | |
| 438 | 456 | "whitepot": S.Array(S.Union(S.Number, QuebrachineClass)), |
| 439 | 457 | "wrothy": S.Array(S.Union(S.Array(S.Null), WrothyClass)), |
| 440 | 458 | }) {} |
Mtypescriptacronym-style-pascal--d9e0c1bd777a / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptconverters-all-objects--3a443babd1cb / TopLevel.ts+2 −2
| @@ -753,7 +753,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 753 | 753 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 754 | 754 | return invalidValue(l(ref || "object"), val, key, parent); |
| 755 | 755 | } |
| 756 | - const result: any = {}; | |
| 756 | + const result: any = Object.create(null); | |
| 757 | 757 | Object.getOwnPropertyNames(props).forEach(key => { |
| 758 | 758 | const prop = props[key]; |
| 759 | 759 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -764,7 +764,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 764 | 764 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 765 | 765 | } |
| 766 | 766 | }); |
| 767 | - return result; | |
| 767 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptnice-property-names-true--f4d7920ee2ce / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptprefer-const-values-true--6b26e4d1265c / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptprefer-types-true--df33e18681f9 / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptprefer-unions-false--a5053c0a486d / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptprefer-unknown-false--f1ab9e45d823 / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptraw-type-any--474b307c39db / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptreadonly-true--24da4fc107df / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = val[key]; |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/combined-enum.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/direct-recursive.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/empty-enum.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/identifiers.json
Mflowdefault / TopLevel.js+2 −2
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 139 | 139 | return invalidValue(l(ref || "object"), val, key, parent); |
| 140 | 140 | } |
| 141 | - const result: any = {}; | |
| 141 | + const result: any = Object.create(null); | |
| 142 | 142 | Object.getOwnPropertyNames(props).forEach(key => { |
| 143 | 143 | const prop = props[key]; |
| 144 | 144 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -149,7 +149,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 149 | 149 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 150 | 150 | } |
| 151 | 151 | }); |
| 152 | - return result; | |
| 152 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/issue2680-object-array.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/issue2680-scalar-array.json
Mflowdefault / TopLevel.js+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Test case
50 generated files · +7,509 −6,619test/inputs/json/priority/keywords.json
Mcjsondefault / TopLevel.c+583 −518
| @@ -11031,6 +11031,61 @@ void cJSON_DeleteLock(struct Lock * x) { | ||
| 11031 | 11031 | } |
| 11032 | 11032 | } |
| 11033 | 11033 | |
| 11034 | +struct MakeDictEncoder * cJSON_ParseMakeDictEncoder(const char * s) { | |
| 11035 | + struct MakeDictEncoder * x = NULL; | |
| 11036 | + if (NULL != s) { | |
| 11037 | + cJSON * j = cJSON_Parse(s); | |
| 11038 | + if (NULL != j) { | |
| 11039 | + x = cJSON_GetMakeDictEncoderValue(j); | |
| 11040 | + cJSON_Delete(j); | |
| 11041 | + } | |
| 11042 | + } | |
| 11043 | + return x; | |
| 11044 | +} | |
| 11045 | + | |
| 11046 | +struct MakeDictEncoder * cJSON_GetMakeDictEncoderValue(const cJSON * j) { | |
| 11047 | + struct MakeDictEncoder * x = NULL; | |
| 11048 | + if (NULL != j) { | |
| 11049 | + if (NULL != (x = cJSON_malloc(sizeof(struct MakeDictEncoder)))) { | |
| 11050 | + memset(x, 0, sizeof(struct MakeDictEncoder)); | |
| 11051 | + if (!cJSON_HasObjectItem(j, "makeDictEncoder")) { cJSON_DeleteMakeDictEncoder(x); return NULL; } | |
| 11052 | + if (cJSON_HasObjectItem(j, "makeDictEncoder")) { | |
| 11053 | + if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "makeDictEncoder"))) { cJSON_DeleteMakeDictEncoder(x); return NULL; } | |
| 11054 | + x->make_dict_encoder = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "makeDictEncoder")); | |
| 11055 | + } | |
| 11056 | + } | |
| 11057 | + } | |
| 11058 | + return x; | |
| 11059 | +} | |
| 11060 | + | |
| 11061 | +cJSON * cJSON_CreateMakeDictEncoder(const struct MakeDictEncoder * x) { | |
| 11062 | + cJSON * j = NULL; | |
| 11063 | + if (NULL != x) { | |
| 11064 | + if (NULL != (j = cJSON_CreateObject())) { | |
| 11065 | + cJSON_AddNumberToObject(j, "makeDictEncoder", x->make_dict_encoder); | |
| 11066 | + } | |
| 11067 | + } | |
| 11068 | + return j; | |
| 11069 | +} | |
| 11070 | + | |
| 11071 | +char * cJSON_PrintMakeDictEncoder(const struct MakeDictEncoder * x) { | |
| 11072 | + char * s = NULL; | |
| 11073 | + if (NULL != x) { | |
| 11074 | + cJSON * j = cJSON_CreateMakeDictEncoder(x); | |
| 11075 | + if (NULL != j) { | |
| 11076 | + s = cJSON_Print(j); | |
| 11077 | + cJSON_Delete(j); | |
| 11078 | + } | |
| 11079 | + } | |
| 11080 | + return s; | |
| 11081 | +} | |
| 11082 | + | |
| 11083 | +void cJSON_DeleteMakeDictEncoder(struct MakeDictEncoder * x) { | |
| 11084 | + if (NULL != x) { | |
| 11085 | + cJSON_free(x); | |
| 11086 | + } | |
| 11087 | +} | |
| 11088 | + | |
| 11034 | 11089 | struct Map * cJSON_ParseMap(const char * s) { |
| 11035 | 11090 | struct Map * x = NULL; |
| 11036 | 11091 | if (NULL != s) { |
| @@ -11416,116 +11471,6 @@ void cJSON_DeleteNewtonsoft(struct Newtonsoft * x) { | ||
| 11416 | 11471 | } |
| 11417 | 11472 | } |
| 11418 | 11473 | |
| 11419 | -struct Nil * cJSON_ParseNil(const char * s) { | |
| 11420 | - struct Nil * x = NULL; | |
| 11421 | - if (NULL != s) { | |
| 11422 | - cJSON * j = cJSON_Parse(s); | |
| 11423 | - if (NULL != j) { | |
| 11424 | - x = cJSON_GetNilValue(j); | |
| 11425 | - cJSON_Delete(j); | |
| 11426 | - } | |
| 11427 | - } | |
| 11428 | - return x; | |
| 11429 | -} | |
| 11430 | - | |
| 11431 | -struct Nil * cJSON_GetNilValue(const cJSON * j) { | |
| 11432 | - struct Nil * x = NULL; | |
| 11433 | - if (NULL != j) { | |
| 11434 | - if (NULL != (x = cJSON_malloc(sizeof(struct Nil)))) { | |
| 11435 | - memset(x, 0, sizeof(struct Nil)); | |
| 11436 | - if (!cJSON_HasObjectItem(j, "nil")) { cJSON_DeleteNil(x); return NULL; } | |
| 11437 | - if (cJSON_HasObjectItem(j, "nil")) { | |
| 11438 | - if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "nil"))) { cJSON_DeleteNil(x); return NULL; } | |
| 11439 | - x->nil = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "nil")); | |
| 11440 | - } | |
| 11441 | - } | |
| 11442 | - } | |
| 11443 | - return x; | |
| 11444 | -} | |
| 11445 | - | |
| 11446 | -cJSON * cJSON_CreateNil(const struct Nil * x) { | |
| 11447 | - cJSON * j = NULL; | |
| 11448 | - if (NULL != x) { | |
| 11449 | - if (NULL != (j = cJSON_CreateObject())) { | |
| 11450 | - cJSON_AddNumberToObject(j, "nil", x->nil); | |
| 11451 | - } | |
| 11452 | - } | |
| 11453 | - return j; | |
| 11454 | -} | |
| 11455 | - | |
| 11456 | -char * cJSON_PrintNil(const struct Nil * x) { | |
| 11457 | - char * s = NULL; | |
| 11458 | - if (NULL != x) { | |
| 11459 | - cJSON * j = cJSON_CreateNil(x); | |
| 11460 | - if (NULL != j) { | |
| 11461 | - s = cJSON_Print(j); | |
| 11462 | - cJSON_Delete(j); | |
| 11463 | - } | |
| 11464 | - } | |
| 11465 | - return s; | |
| 11466 | -} | |
| 11467 | - | |
| 11468 | -void cJSON_DeleteNil(struct Nil * x) { | |
| 11469 | - if (NULL != x) { | |
| 11470 | - cJSON_free(x); | |
| 11471 | - } | |
| 11472 | -} | |
| 11473 | - | |
| 11474 | -struct No * cJSON_ParseNo(const char * s) { | |
| 11475 | - struct No * x = NULL; | |
| 11476 | - if (NULL != s) { | |
| 11477 | - cJSON * j = cJSON_Parse(s); | |
| 11478 | - if (NULL != j) { | |
| 11479 | - x = cJSON_GetNoValue(j); | |
| 11480 | - cJSON_Delete(j); | |
| 11481 | - } | |
| 11482 | - } | |
| 11483 | - return x; | |
| 11484 | -} | |
| 11485 | - | |
| 11486 | -struct No * cJSON_GetNoValue(const cJSON * j) { | |
| 11487 | - struct No * x = NULL; | |
| 11488 | - if (NULL != j) { | |
| 11489 | - if (NULL != (x = cJSON_malloc(sizeof(struct No)))) { | |
| 11490 | - memset(x, 0, sizeof(struct No)); | |
| 11491 | - if (!cJSON_HasObjectItem(j, "NO")) { cJSON_DeleteNo(x); return NULL; } | |
| 11492 | - if (cJSON_HasObjectItem(j, "NO")) { | |
| 11493 | - if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "NO"))) { cJSON_DeleteNo(x); return NULL; } | |
| 11494 | - x->no = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "NO")); | |
| 11495 | - } | |
| 11496 | - } | |
| 11497 | - } | |
| 11498 | - return x; | |
| 11499 | -} | |
| 11500 | - | |
| 11501 | -cJSON * cJSON_CreateNo(const struct No * x) { | |
| 11502 | - cJSON * j = NULL; | |
| 11503 | - if (NULL != x) { | |
| 11504 | - if (NULL != (j = cJSON_CreateObject())) { | |
| 11505 | - cJSON_AddNumberToObject(j, "NO", x->no); | |
| 11506 | - } | |
| 11507 | - } | |
| 11508 | - return j; | |
| 11509 | -} | |
| 11510 | - | |
| 11511 | -char * cJSON_PrintNo(const struct No * x) { | |
| 11512 | - char * s = NULL; | |
| 11513 | - if (NULL != x) { | |
| 11514 | - cJSON * j = cJSON_CreateNo(x); | |
| 11515 | - if (NULL != j) { | |
| 11516 | - s = cJSON_Print(j); | |
| 11517 | - cJSON_Delete(j); | |
| 11518 | - } | |
| 11519 | - } | |
| 11520 | - return s; | |
| 11521 | -} | |
| 11522 | - | |
| 11523 | -void cJSON_DeleteNo(struct No * x) { | |
| 11524 | - if (NULL != x) { | |
| 11525 | - cJSON_free(x); | |
| 11526 | - } | |
| 11527 | -} | |
| 11528 | - | |
| 11529 | 11474 | struct Goto * cJSON_ParseGoto(const char * s) { |
| 11530 | 11475 | struct Goto * x = NULL; |
| 11531 | 11476 | if (NULL != s) { |
| @@ -12374,6 +12319,12 @@ struct Obj3 * cJSON_GetObj3Value(const cJSON * j) { | ||
| 12374 | 12319 | x->lock = cJSON_GetLockValue(cJSON_GetObjectItemCaseSensitive(j, "lock")); |
| 12375 | 12320 | if (NULL == x->lock) { cJSON_DeleteObj3(x); return NULL; } |
| 12376 | 12321 | } |
| 12322 | + if (!cJSON_HasObjectItem(j, "makeDictEncoder")) { cJSON_DeleteObj3(x); return NULL; } | |
| 12323 | + if (cJSON_HasObjectItem(j, "makeDictEncoder")) { | |
| 12324 | + if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "makeDictEncoder"))) { cJSON_DeleteObj3(x); return NULL; } | |
| 12325 | + x->make_dict_encoder = cJSON_GetMakeDictEncoderValue(cJSON_GetObjectItemCaseSensitive(j, "makeDictEncoder")); | |
| 12326 | + if (NULL == x->make_dict_encoder) { cJSON_DeleteObj3(x); return NULL; } | |
| 12327 | + } | |
| 12377 | 12328 | if (!cJSON_HasObjectItem(j, "map")) { cJSON_DeleteObj3(x); return NULL; } |
| 12378 | 12329 | if (cJSON_HasObjectItem(j, "map")) { |
| 12379 | 12330 | if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "map"))) { cJSON_DeleteObj3(x); return NULL; } |
| @@ -12416,18 +12367,6 @@ struct Obj3 * cJSON_GetObj3Value(const cJSON * j) { | ||
| 12416 | 12367 | x->newtonsoft = cJSON_GetNewtonsoftValue(cJSON_GetObjectItemCaseSensitive(j, "newtonsoft")); |
| 12417 | 12368 | if (NULL == x->newtonsoft) { cJSON_DeleteObj3(x); return NULL; } |
| 12418 | 12369 | } |
| 12419 | - if (!cJSON_HasObjectItem(j, "nil")) { cJSON_DeleteObj3(x); return NULL; } | |
| 12420 | - if (cJSON_HasObjectItem(j, "nil")) { | |
| 12421 | - if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "nil"))) { cJSON_DeleteObj3(x); return NULL; } | |
| 12422 | - x->nil = cJSON_GetNilValue(cJSON_GetObjectItemCaseSensitive(j, "nil")); | |
| 12423 | - if (NULL == x->nil) { cJSON_DeleteObj3(x); return NULL; } | |
| 12424 | - } | |
| 12425 | - if (!cJSON_HasObjectItem(j, "NO")) { cJSON_DeleteObj3(x); return NULL; } | |
| 12426 | - if (cJSON_HasObjectItem(j, "NO")) { | |
| 12427 | - if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "NO"))) { cJSON_DeleteObj3(x); return NULL; } | |
| 12428 | - x->no = cJSON_GetNoValue(cJSON_GetObjectItemCaseSensitive(j, "NO")); | |
| 12429 | - if (NULL == x->no) { cJSON_DeleteObj3(x); return NULL; } | |
| 12430 | - } | |
| 12431 | 12370 | if (!cJSON_HasObjectItem(j, "goto")) { cJSON_DeleteObj3(x); return NULL; } |
| 12432 | 12371 | if (cJSON_HasObjectItem(j, "goto")) { |
| 12433 | 12372 | if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "goto"))) { cJSON_DeleteObj3(x); return NULL; } |
| @@ -12544,6 +12483,7 @@ cJSON * cJSON_CreateObj3(const struct Obj3 * x) { | ||
| 12544 | 12483 | cJSON_AddItemToObject(j, "list", cJSON_CreateList(x->list)); |
| 12545 | 12484 | cJSON_AddItemToObject(j, "Locale", cJSON_CreateLocale(x->locale)); |
| 12546 | 12485 | cJSON_AddItemToObject(j, "lock", cJSON_CreateLock(x->lock)); |
| 12486 | + cJSON_AddItemToObject(j, "makeDictEncoder", cJSON_CreateMakeDictEncoder(x->make_dict_encoder)); | |
| 12547 | 12487 | cJSON_AddItemToObject(j, "map", cJSON_CreateMap(x->map)); |
| 12548 | 12488 | cJSON_AddItemToObject(j, "MapEntry", cJSON_CreateMapEntry(x->map_entry)); |
| 12549 | 12489 | cJSON_AddItemToObject(j, "MarshalJSON", cJSON_CreateMarshalJson(x->marshal_json)); |
| @@ -12551,8 +12491,6 @@ cJSON * cJSON_CreateObj3(const struct Obj3 * x) { | ||
| 12551 | 12491 | cJSON_AddItemToObject(j, "mutating", cJSON_CreateMutating(x->mutating)); |
| 12552 | 12492 | cJSON_AddItemToObject(j, "native", cJSON_CreateNative(x->native)); |
| 12553 | 12493 | cJSON_AddItemToObject(j, "newtonsoft", cJSON_CreateNewtonsoft(x->newtonsoft)); |
| 12554 | - cJSON_AddItemToObject(j, "nil", cJSON_CreateNil(x->nil)); | |
| 12555 | - cJSON_AddItemToObject(j, "NO", cJSON_CreateNo(x->no)); | |
| 12556 | 12494 | cJSON_AddItemToObject(j, "goto", cJSON_CreateGoto(x->obj3_goto)); |
| 12557 | 12495 | cJSON_AddItemToObject(j, "if", cJSON_CreateIf(x->obj3_if)); |
| 12558 | 12496 | cJSON_AddItemToObject(j, "import", cJSON_CreateImport(x->obj3_import)); |
| @@ -12720,6 +12658,9 @@ void cJSON_DeleteObj3(struct Obj3 * x) { | ||
| 12720 | 12658 | if (NULL != x->lock) { |
| 12721 | 12659 | cJSON_DeleteLock(x->lock); |
| 12722 | 12660 | } |
| 12661 | + if (NULL != x->make_dict_encoder) { | |
| 12662 | + cJSON_DeleteMakeDictEncoder(x->make_dict_encoder); | |
| 12663 | + } | |
| 12723 | 12664 | if (NULL != x->map) { |
| 12724 | 12665 | cJSON_DeleteMap(x->map); |
| 12725 | 12666 | } |
| @@ -12741,12 +12682,6 @@ void cJSON_DeleteObj3(struct Obj3 * x) { | ||
| 12741 | 12682 | if (NULL != x->newtonsoft) { |
| 12742 | 12683 | cJSON_DeleteNewtonsoft(x->newtonsoft); |
| 12743 | 12684 | } |
| 12744 | - if (NULL != x->nil) { | |
| 12745 | - cJSON_DeleteNil(x->nil); | |
| 12746 | - } | |
| 12747 | - if (NULL != x->no) { | |
| 12748 | - cJSON_DeleteNo(x->no); | |
| 12749 | - } | |
| 12750 | 12685 | if (NULL != x->obj3_goto) { |
| 12751 | 12686 | cJSON_DeleteGoto(x->obj3_goto); |
| 12752 | 12687 | } |
| @@ -12781,6 +12716,116 @@ void cJSON_DeleteObj3(struct Obj3 * x) { | ||
| 12781 | 12716 | } |
| 12782 | 12717 | } |
| 12783 | 12718 | |
| 12719 | +struct Nil * cJSON_ParseNil(const char * s) { | |
| 12720 | + struct Nil * x = NULL; | |
| 12721 | + if (NULL != s) { | |
| 12722 | + cJSON * j = cJSON_Parse(s); | |
| 12723 | + if (NULL != j) { | |
| 12724 | + x = cJSON_GetNilValue(j); | |
| 12725 | + cJSON_Delete(j); | |
| 12726 | + } | |
| 12727 | + } | |
| 12728 | + return x; | |
| 12729 | +} | |
| 12730 | + | |
| 12731 | +struct Nil * cJSON_GetNilValue(const cJSON * j) { | |
| 12732 | + struct Nil * x = NULL; | |
| 12733 | + if (NULL != j) { | |
| 12734 | + if (NULL != (x = cJSON_malloc(sizeof(struct Nil)))) { | |
| 12735 | + memset(x, 0, sizeof(struct Nil)); | |
| 12736 | + if (!cJSON_HasObjectItem(j, "nil")) { cJSON_DeleteNil(x); return NULL; } | |
| 12737 | + if (cJSON_HasObjectItem(j, "nil")) { | |
| 12738 | + if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "nil"))) { cJSON_DeleteNil(x); return NULL; } | |
| 12739 | + x->nil = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "nil")); | |
| 12740 | + } | |
| 12741 | + } | |
| 12742 | + } | |
| 12743 | + return x; | |
| 12744 | +} | |
| 12745 | + | |
| 12746 | +cJSON * cJSON_CreateNil(const struct Nil * x) { | |
| 12747 | + cJSON * j = NULL; | |
| 12748 | + if (NULL != x) { | |
| 12749 | + if (NULL != (j = cJSON_CreateObject())) { | |
| 12750 | + cJSON_AddNumberToObject(j, "nil", x->nil); | |
| 12751 | + } | |
| 12752 | + } | |
| 12753 | + return j; | |
| 12754 | +} | |
| 12755 | + | |
| 12756 | +char * cJSON_PrintNil(const struct Nil * x) { | |
| 12757 | + char * s = NULL; | |
| 12758 | + if (NULL != x) { | |
| 12759 | + cJSON * j = cJSON_CreateNil(x); | |
| 12760 | + if (NULL != j) { | |
| 12761 | + s = cJSON_Print(j); | |
| 12762 | + cJSON_Delete(j); | |
| 12763 | + } | |
| 12764 | + } | |
| 12765 | + return s; | |
| 12766 | +} | |
| 12767 | + | |
| 12768 | +void cJSON_DeleteNil(struct Nil * x) { | |
| 12769 | + if (NULL != x) { | |
| 12770 | + cJSON_free(x); | |
| 12771 | + } | |
| 12772 | +} | |
| 12773 | + | |
| 12774 | +struct No * cJSON_ParseNo(const char * s) { | |
| 12775 | + struct No * x = NULL; | |
| 12776 | + if (NULL != s) { | |
| 12777 | + cJSON * j = cJSON_Parse(s); | |
| 12778 | + if (NULL != j) { | |
| 12779 | + x = cJSON_GetNoValue(j); | |
| 12780 | + cJSON_Delete(j); | |
| 12781 | + } | |
| 12782 | + } | |
| 12783 | + return x; | |
| 12784 | +} | |
| 12785 | + | |
| 12786 | +struct No * cJSON_GetNoValue(const cJSON * j) { | |
| 12787 | + struct No * x = NULL; | |
| 12788 | + if (NULL != j) { | |
| 12789 | + if (NULL != (x = cJSON_malloc(sizeof(struct No)))) { | |
| 12790 | + memset(x, 0, sizeof(struct No)); | |
| 12791 | + if (!cJSON_HasObjectItem(j, "NO")) { cJSON_DeleteNo(x); return NULL; } | |
| 12792 | + if (cJSON_HasObjectItem(j, "NO")) { | |
| 12793 | + if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "NO"))) { cJSON_DeleteNo(x); return NULL; } | |
| 12794 | + x->no = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "NO")); | |
| 12795 | + } | |
| 12796 | + } | |
| 12797 | + } | |
| 12798 | + return x; | |
| 12799 | +} | |
| 12800 | + | |
| 12801 | +cJSON * cJSON_CreateNo(const struct No * x) { | |
| 12802 | + cJSON * j = NULL; | |
| 12803 | + if (NULL != x) { | |
| 12804 | + if (NULL != (j = cJSON_CreateObject())) { | |
| 12805 | + cJSON_AddNumberToObject(j, "NO", x->no); | |
| 12806 | + } | |
| 12807 | + } | |
| 12808 | + return j; | |
| 12809 | +} | |
| 12810 | + | |
| 12811 | +char * cJSON_PrintNo(const struct No * x) { | |
| 12812 | + char * s = NULL; | |
| 12813 | + if (NULL != x) { | |
| 12814 | + cJSON * j = cJSON_CreateNo(x); | |
| 12815 | + if (NULL != j) { | |
| 12816 | + s = cJSON_Print(j); | |
| 12817 | + cJSON_Delete(j); | |
| 12818 | + } | |
| 12819 | + } | |
| 12820 | + return s; | |
| 12821 | +} | |
| 12822 | + | |
| 12823 | +void cJSON_DeleteNo(struct No * x) { | |
| 12824 | + if (NULL != x) { | |
| 12825 | + cJSON_free(x); | |
| 12826 | + } | |
| 12827 | +} | |
| 12828 | + | |
| 12784 | 12829 | struct NoSuchMethod * cJSON_ParseNoSuchMethod(const char * s) { |
| 12785 | 12830 | struct NoSuchMethod * x = NULL; |
| 12786 | 12831 | if (NULL != s) { |
| @@ -16204,116 +16249,6 @@ void cJSON_DeleteSbyte(struct Sbyte * x) { | ||
| 16204 | 16249 | } |
| 16205 | 16250 | } |
| 16206 | 16251 | |
| 16207 | -struct Sealed * cJSON_ParseSealed(const char * s) { | |
| 16208 | - struct Sealed * x = NULL; | |
| 16209 | - if (NULL != s) { | |
| 16210 | - cJSON * j = cJSON_Parse(s); | |
| 16211 | - if (NULL != j) { | |
| 16212 | - x = cJSON_GetSealedValue(j); | |
| 16213 | - cJSON_Delete(j); | |
| 16214 | - } | |
| 16215 | - } | |
| 16216 | - return x; | |
| 16217 | -} | |
| 16218 | - | |
| 16219 | -struct Sealed * cJSON_GetSealedValue(const cJSON * j) { | |
| 16220 | - struct Sealed * x = NULL; | |
| 16221 | - if (NULL != j) { | |
| 16222 | - if (NULL != (x = cJSON_malloc(sizeof(struct Sealed)))) { | |
| 16223 | - memset(x, 0, sizeof(struct Sealed)); | |
| 16224 | - if (!cJSON_HasObjectItem(j, "sealed")) { cJSON_DeleteSealed(x); return NULL; } | |
| 16225 | - if (cJSON_HasObjectItem(j, "sealed")) { | |
| 16226 | - if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "sealed"))) { cJSON_DeleteSealed(x); return NULL; } | |
| 16227 | - x->sealed = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "sealed")); | |
| 16228 | - } | |
| 16229 | - } | |
| 16230 | - } | |
| 16231 | - return x; | |
| 16232 | -} | |
| 16233 | - | |
| 16234 | -cJSON * cJSON_CreateSealed(const struct Sealed * x) { | |
| 16235 | - cJSON * j = NULL; | |
| 16236 | - if (NULL != x) { | |
| 16237 | - if (NULL != (j = cJSON_CreateObject())) { | |
| 16238 | - cJSON_AddNumberToObject(j, "sealed", x->sealed); | |
| 16239 | - } | |
| 16240 | - } | |
| 16241 | - return j; | |
| 16242 | -} | |
| 16243 | - | |
| 16244 | -char * cJSON_PrintSealed(const struct Sealed * x) { | |
| 16245 | - char * s = NULL; | |
| 16246 | - if (NULL != x) { | |
| 16247 | - cJSON * j = cJSON_CreateSealed(x); | |
| 16248 | - if (NULL != j) { | |
| 16249 | - s = cJSON_Print(j); | |
| 16250 | - cJSON_Delete(j); | |
| 16251 | - } | |
| 16252 | - } | |
| 16253 | - return s; | |
| 16254 | -} | |
| 16255 | - | |
| 16256 | -void cJSON_DeleteSealed(struct Sealed * x) { | |
| 16257 | - if (NULL != x) { | |
| 16258 | - cJSON_free(x); | |
| 16259 | - } | |
| 16260 | -} | |
| 16261 | - | |
| 16262 | -struct Sel * cJSON_ParseSel(const char * s) { | |
| 16263 | - struct Sel * x = NULL; | |
| 16264 | - if (NULL != s) { | |
| 16265 | - cJSON * j = cJSON_Parse(s); | |
| 16266 | - if (NULL != j) { | |
| 16267 | - x = cJSON_GetSelValue(j); | |
| 16268 | - cJSON_Delete(j); | |
| 16269 | - } | |
| 16270 | - } | |
| 16271 | - return x; | |
| 16272 | -} | |
| 16273 | - | |
| 16274 | -struct Sel * cJSON_GetSelValue(const cJSON * j) { | |
| 16275 | - struct Sel * x = NULL; | |
| 16276 | - if (NULL != j) { | |
| 16277 | - if (NULL != (x = cJSON_malloc(sizeof(struct Sel)))) { | |
| 16278 | - memset(x, 0, sizeof(struct Sel)); | |
| 16279 | - if (!cJSON_HasObjectItem(j, "SEL")) { cJSON_DeleteSel(x); return NULL; } | |
| 16280 | - if (cJSON_HasObjectItem(j, "SEL")) { | |
| 16281 | - if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "SEL"))) { cJSON_DeleteSel(x); return NULL; } | |
| 16282 | - x->sel = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "SEL")); | |
| 16283 | - } | |
| 16284 | - } | |
| 16285 | - } | |
| 16286 | - return x; | |
| 16287 | -} | |
| 16288 | - | |
| 16289 | -cJSON * cJSON_CreateSel(const struct Sel * x) { | |
| 16290 | - cJSON * j = NULL; | |
| 16291 | - if (NULL != x) { | |
| 16292 | - if (NULL != (j = cJSON_CreateObject())) { | |
| 16293 | - cJSON_AddNumberToObject(j, "SEL", x->sel); | |
| 16294 | - } | |
| 16295 | - } | |
| 16296 | - return j; | |
| 16297 | -} | |
| 16298 | - | |
| 16299 | -char * cJSON_PrintSel(const struct Sel * x) { | |
| 16300 | - char * s = NULL; | |
| 16301 | - if (NULL != x) { | |
| 16302 | - cJSON * j = cJSON_CreateSel(x); | |
| 16303 | - if (NULL != j) { | |
| 16304 | - s = cJSON_Print(j); | |
| 16305 | - cJSON_Delete(j); | |
| 16306 | - } | |
| 16307 | - } | |
| 16308 | - return s; | |
| 16309 | -} | |
| 16310 | - | |
| 16311 | -void cJSON_DeleteSel(struct Sel * x) { | |
| 16312 | - if (NULL != x) { | |
| 16313 | - cJSON_free(x); | |
| 16314 | - } | |
| 16315 | -} | |
| 16316 | - | |
| 16317 | 16252 | struct Obj4 * cJSON_ParseObj4(const char * s) { |
| 16318 | 16253 | struct Obj4 * x = NULL; |
| 16319 | 16254 | if (NULL != s) { |
| @@ -16336,6 +16271,18 @@ struct Obj4 * cJSON_GetObj4Value(const cJSON * j) { | ||
| 16336 | 16271 | if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "dummy"))) { cJSON_DeleteObj4(x); return NULL; } |
| 16337 | 16272 | x->dummy = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "dummy")); |
| 16338 | 16273 | } |
| 16274 | + if (!cJSON_HasObjectItem(j, "nil")) { cJSON_DeleteObj4(x); return NULL; } | |
| 16275 | + if (cJSON_HasObjectItem(j, "nil")) { | |
| 16276 | + if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "nil"))) { cJSON_DeleteObj4(x); return NULL; } | |
| 16277 | + x->nil = cJSON_GetNilValue(cJSON_GetObjectItemCaseSensitive(j, "nil")); | |
| 16278 | + if (NULL == x->nil) { cJSON_DeleteObj4(x); return NULL; } | |
| 16279 | + } | |
| 16280 | + if (!cJSON_HasObjectItem(j, "NO")) { cJSON_DeleteObj4(x); return NULL; } | |
| 16281 | + if (cJSON_HasObjectItem(j, "NO")) { | |
| 16282 | + if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "NO"))) { cJSON_DeleteObj4(x); return NULL; } | |
| 16283 | + x->no = cJSON_GetNoValue(cJSON_GetObjectItemCaseSensitive(j, "NO")); | |
| 16284 | + if (NULL == x->no) { cJSON_DeleteObj4(x); return NULL; } | |
| 16285 | + } | |
| 16339 | 16286 | if (!cJSON_HasObjectItem(j, "noSuchMethod")) { cJSON_DeleteObj4(x); return NULL; } |
| 16340 | 16287 | if (cJSON_HasObjectItem(j, "noSuchMethod")) { |
| 16341 | 16288 | if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "noSuchMethod"))) { cJSON_DeleteObj4(x); return NULL; } |
| @@ -16708,18 +16655,6 @@ struct Obj4 * cJSON_GetObj4Value(const cJSON * j) { | ||
| 16708 | 16655 | x->sbyte = cJSON_GetSbyteValue(cJSON_GetObjectItemCaseSensitive(j, "sbyte")); |
| 16709 | 16656 | if (NULL == x->sbyte) { cJSON_DeleteObj4(x); return NULL; } |
| 16710 | 16657 | } |
| 16711 | - if (!cJSON_HasObjectItem(j, "sealed")) { cJSON_DeleteObj4(x); return NULL; } | |
| 16712 | - if (cJSON_HasObjectItem(j, "sealed")) { | |
| 16713 | - if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "sealed"))) { cJSON_DeleteObj4(x); return NULL; } | |
| 16714 | - x->sealed = cJSON_GetSealedValue(cJSON_GetObjectItemCaseSensitive(j, "sealed")); | |
| 16715 | - if (NULL == x->sealed) { cJSON_DeleteObj4(x); return NULL; } | |
| 16716 | - } | |
| 16717 | - if (!cJSON_HasObjectItem(j, "SEL")) { cJSON_DeleteObj4(x); return NULL; } | |
| 16718 | - if (cJSON_HasObjectItem(j, "SEL")) { | |
| 16719 | - if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "SEL"))) { cJSON_DeleteObj4(x); return NULL; } | |
| 16720 | - x->sel = cJSON_GetSelValue(cJSON_GetObjectItemCaseSensitive(j, "SEL")); | |
| 16721 | - if (NULL == x->sel) { cJSON_DeleteObj4(x); return NULL; } | |
| 16722 | - } | |
| 16723 | 16658 | } |
| 16724 | 16659 | } |
| 16725 | 16660 | return x; |
| @@ -16730,6 +16665,8 @@ cJSON * cJSON_CreateObj4(const struct Obj4 * x) { | ||
| 16730 | 16665 | if (NULL != x) { |
| 16731 | 16666 | if (NULL != (j = cJSON_CreateObject())) { |
| 16732 | 16667 | cJSON_AddNumberToObject(j, "dummy", x->dummy); |
| 16668 | + cJSON_AddItemToObject(j, "nil", cJSON_CreateNil(x->nil)); | |
| 16669 | + cJSON_AddItemToObject(j, "NO", cJSON_CreateNo(x->no)); | |
| 16733 | 16670 | cJSON_AddItemToObject(j, "noSuchMethod", cJSON_CreateNoSuchMethod(x->no_such_method)); |
| 16734 | 16671 | cJSON_AddItemToObject(j, "nonatomic", cJSON_CreateNonatomic(x->nonatomic)); |
| 16735 | 16672 | cJSON_AddItemToObject(j, "None", cJSON_CreateNone(x->none)); |
| @@ -16792,8 +16729,6 @@ cJSON * cJSON_CreateObj4(const struct Obj4 * x) { | ||
| 16792 | 16729 | cJSON_AddItemToObject(j, "runtimeType", cJSON_CreateRuntimeType(x->runtime_type)); |
| 16793 | 16730 | cJSON_AddItemToObject(j, "s", cJSON_CreateS(x->s)); |
| 16794 | 16731 | cJSON_AddItemToObject(j, "sbyte", cJSON_CreateSbyte(x->sbyte)); |
| 16795 | - cJSON_AddItemToObject(j, "sealed", cJSON_CreateSealed(x->sealed)); | |
| 16796 | - cJSON_AddItemToObject(j, "SEL", cJSON_CreateSel(x->sel)); | |
| 16797 | 16732 | } |
| 16798 | 16733 | } |
| 16799 | 16734 | return j; |
| @@ -16813,6 +16748,12 @@ char * cJSON_PrintObj4(const struct Obj4 * x) { | ||
| 16813 | 16748 | |
| 16814 | 16749 | void cJSON_DeleteObj4(struct Obj4 * x) { |
| 16815 | 16750 | if (NULL != x) { |
| 16751 | + if (NULL != x->nil) { | |
| 16752 | + cJSON_DeleteNil(x->nil); | |
| 16753 | + } | |
| 16754 | + if (NULL != x->no) { | |
| 16755 | + cJSON_DeleteNo(x->no); | |
| 16756 | + } | |
| 16816 | 16757 | if (NULL != x->no_such_method) { |
| 16817 | 16758 | cJSON_DeleteNoSuchMethod(x->no_such_method); |
| 16818 | 16759 | } |
| @@ -16999,12 +16940,6 @@ void cJSON_DeleteObj4(struct Obj4 * x) { | ||
| 16999 | 16940 | if (NULL != x->sbyte) { |
| 17000 | 16941 | cJSON_DeleteSbyte(x->sbyte); |
| 17001 | 16942 | } |
| 17002 | - if (NULL != x->sealed) { | |
| 17003 | - cJSON_DeleteSealed(x->sealed); | |
| 17004 | - } | |
| 17005 | - if (NULL != x->sel) { | |
| 17006 | - cJSON_DeleteSel(x->sel); | |
| 17007 | - } | |
| 17008 | 16943 | cJSON_free(x); |
| 17009 | 16944 | } |
| 17010 | 16945 | } |
| @@ -18231,35 +18166,145 @@ struct Union * cJSON_ParseUnion(const char * s) { | ||
| 18231 | 18166 | return x; |
| 18232 | 18167 | } |
| 18233 | 18168 | |
| 18234 | -struct Union * cJSON_GetUnionValue(const cJSON * j) { | |
| 18235 | - struct Union * x = NULL; | |
| 18169 | +struct Union * cJSON_GetUnionValue(const cJSON * j) { | |
| 18170 | + struct Union * x = NULL; | |
| 18171 | + if (NULL != j) { | |
| 18172 | + if (NULL != (x = cJSON_malloc(sizeof(struct Union)))) { | |
| 18173 | + memset(x, 0, sizeof(struct Union)); | |
| 18174 | + if (!cJSON_HasObjectItem(j, "union")) { cJSON_DeleteUnion(x); return NULL; } | |
| 18175 | + if (cJSON_HasObjectItem(j, "union")) { | |
| 18176 | + if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "union"))) { cJSON_DeleteUnion(x); return NULL; } | |
| 18177 | + x->union_union = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "union")); | |
| 18178 | + } | |
| 18179 | + } | |
| 18180 | + } | |
| 18181 | + return x; | |
| 18182 | +} | |
| 18183 | + | |
| 18184 | +cJSON * cJSON_CreateUnion(const struct Union * x) { | |
| 18185 | + cJSON * j = NULL; | |
| 18186 | + if (NULL != x) { | |
| 18187 | + if (NULL != (j = cJSON_CreateObject())) { | |
| 18188 | + cJSON_AddNumberToObject(j, "union", x->union_union); | |
| 18189 | + } | |
| 18190 | + } | |
| 18191 | + return j; | |
| 18192 | +} | |
| 18193 | + | |
| 18194 | +char * cJSON_PrintUnion(const struct Union * x) { | |
| 18195 | + char * s = NULL; | |
| 18196 | + if (NULL != x) { | |
| 18197 | + cJSON * j = cJSON_CreateUnion(x); | |
| 18198 | + if (NULL != j) { | |
| 18199 | + s = cJSON_Print(j); | |
| 18200 | + cJSON_Delete(j); | |
| 18201 | + } | |
| 18202 | + } | |
| 18203 | + return s; | |
| 18204 | +} | |
| 18205 | + | |
| 18206 | +void cJSON_DeleteUnion(struct Union * x) { | |
| 18207 | + if (NULL != x) { | |
| 18208 | + cJSON_free(x); | |
| 18209 | + } | |
| 18210 | +} | |
| 18211 | + | |
| 18212 | +struct PrimitiveKind * cJSON_ParsePrimitiveKind(const char * s) { | |
| 18213 | + struct PrimitiveKind * x = NULL; | |
| 18214 | + if (NULL != s) { | |
| 18215 | + cJSON * j = cJSON_Parse(s); | |
| 18216 | + if (NULL != j) { | |
| 18217 | + x = cJSON_GetPrimitiveKindValue(j); | |
| 18218 | + cJSON_Delete(j); | |
| 18219 | + } | |
| 18220 | + } | |
| 18221 | + return x; | |
| 18222 | +} | |
| 18223 | + | |
| 18224 | +struct PrimitiveKind * cJSON_GetPrimitiveKindValue(const cJSON * j) { | |
| 18225 | + struct PrimitiveKind * x = NULL; | |
| 18226 | + if (NULL != j) { | |
| 18227 | + if (NULL != (x = cJSON_malloc(sizeof(struct PrimitiveKind)))) { | |
| 18228 | + memset(x, 0, sizeof(struct PrimitiveKind)); | |
| 18229 | + if (!cJSON_HasObjectItem(j, "PrimitiveKind")) { cJSON_DeletePrimitiveKind(x); return NULL; } | |
| 18230 | + if (cJSON_HasObjectItem(j, "PrimitiveKind")) { | |
| 18231 | + if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "PrimitiveKind"))) { cJSON_DeletePrimitiveKind(x); return NULL; } | |
| 18232 | + x->primitive_kind = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "PrimitiveKind")); | |
| 18233 | + } | |
| 18234 | + } | |
| 18235 | + } | |
| 18236 | + return x; | |
| 18237 | +} | |
| 18238 | + | |
| 18239 | +cJSON * cJSON_CreatePrimitiveKind(const struct PrimitiveKind * x) { | |
| 18240 | + cJSON * j = NULL; | |
| 18241 | + if (NULL != x) { | |
| 18242 | + if (NULL != (j = cJSON_CreateObject())) { | |
| 18243 | + cJSON_AddNumberToObject(j, "PrimitiveKind", x->primitive_kind); | |
| 18244 | + } | |
| 18245 | + } | |
| 18246 | + return j; | |
| 18247 | +} | |
| 18248 | + | |
| 18249 | +char * cJSON_PrintPrimitiveKind(const struct PrimitiveKind * x) { | |
| 18250 | + char * s = NULL; | |
| 18251 | + if (NULL != x) { | |
| 18252 | + cJSON * j = cJSON_CreatePrimitiveKind(x); | |
| 18253 | + if (NULL != j) { | |
| 18254 | + s = cJSON_Print(j); | |
| 18255 | + cJSON_Delete(j); | |
| 18256 | + } | |
| 18257 | + } | |
| 18258 | + return s; | |
| 18259 | +} | |
| 18260 | + | |
| 18261 | +void cJSON_DeletePrimitiveKind(struct PrimitiveKind * x) { | |
| 18262 | + if (NULL != x) { | |
| 18263 | + cJSON_free(x); | |
| 18264 | + } | |
| 18265 | +} | |
| 18266 | + | |
| 18267 | +struct Obj5True * cJSON_ParseObj5True(const char * s) { | |
| 18268 | + struct Obj5True * x = NULL; | |
| 18269 | + if (NULL != s) { | |
| 18270 | + cJSON * j = cJSON_Parse(s); | |
| 18271 | + if (NULL != j) { | |
| 18272 | + x = cJSON_GetObj5TrueValue(j); | |
| 18273 | + cJSON_Delete(j); | |
| 18274 | + } | |
| 18275 | + } | |
| 18276 | + return x; | |
| 18277 | +} | |
| 18278 | + | |
| 18279 | +struct Obj5True * cJSON_GetObj5TrueValue(const cJSON * j) { | |
| 18280 | + struct Obj5True * x = NULL; | |
| 18236 | 18281 | if (NULL != j) { |
| 18237 | - if (NULL != (x = cJSON_malloc(sizeof(struct Union)))) { | |
| 18238 | - memset(x, 0, sizeof(struct Union)); | |
| 18239 | - if (!cJSON_HasObjectItem(j, "union")) { cJSON_DeleteUnion(x); return NULL; } | |
| 18240 | - if (cJSON_HasObjectItem(j, "union")) { | |
| 18241 | - if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "union"))) { cJSON_DeleteUnion(x); return NULL; } | |
| 18242 | - x->union_union = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "union")); | |
| 18282 | + if (NULL != (x = cJSON_malloc(sizeof(struct Obj5True)))) { | |
| 18283 | + memset(x, 0, sizeof(struct Obj5True)); | |
| 18284 | + if (!cJSON_HasObjectItem(j, "true")) { cJSON_DeleteObj5True(x); return NULL; } | |
| 18285 | + if (cJSON_HasObjectItem(j, "true")) { | |
| 18286 | + if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "true"))) { cJSON_DeleteObj5True(x); return NULL; } | |
| 18287 | + x->true_true = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "true")); | |
| 18243 | 18288 | } |
| 18244 | 18289 | } |
| 18245 | 18290 | } |
| 18246 | 18291 | return x; |
| 18247 | 18292 | } |
| 18248 | 18293 | |
| 18249 | -cJSON * cJSON_CreateUnion(const struct Union * x) { | |
| 18294 | +cJSON * cJSON_CreateObj5True(const struct Obj5True * x) { | |
| 18250 | 18295 | cJSON * j = NULL; |
| 18251 | 18296 | if (NULL != x) { |
| 18252 | 18297 | if (NULL != (j = cJSON_CreateObject())) { |
| 18253 | - cJSON_AddNumberToObject(j, "union", x->union_union); | |
| 18298 | + cJSON_AddNumberToObject(j, "true", x->true_true); | |
| 18254 | 18299 | } |
| 18255 | 18300 | } |
| 18256 | 18301 | return j; |
| 18257 | 18302 | } |
| 18258 | 18303 | |
| 18259 | -char * cJSON_PrintUnion(const struct Union * x) { | |
| 18304 | +char * cJSON_PrintObj5True(const struct Obj5True * x) { | |
| 18260 | 18305 | char * s = NULL; |
| 18261 | 18306 | if (NULL != x) { |
| 18262 | - cJSON * j = cJSON_CreateUnion(x); | |
| 18307 | + cJSON * j = cJSON_CreateObj5True(x); | |
| 18263 | 18308 | if (NULL != j) { |
| 18264 | 18309 | s = cJSON_Print(j); |
| 18265 | 18310 | cJSON_Delete(j); |
| @@ -18268,53 +18313,53 @@ char * cJSON_PrintUnion(const struct Union * x) { | ||
| 18268 | 18313 | return s; |
| 18269 | 18314 | } |
| 18270 | 18315 | |
| 18271 | -void cJSON_DeleteUnion(struct Union * x) { | |
| 18316 | +void cJSON_DeleteObj5True(struct Obj5True * x) { | |
| 18272 | 18317 | if (NULL != x) { |
| 18273 | 18318 | cJSON_free(x); |
| 18274 | 18319 | } |
| 18275 | 18320 | } |
| 18276 | 18321 | |
| 18277 | -struct PrimitiveKind * cJSON_ParsePrimitiveKind(const char * s) { | |
| 18278 | - struct PrimitiveKind * x = NULL; | |
| 18322 | +struct Sealed * cJSON_ParseSealed(const char * s) { | |
| 18323 | + struct Sealed * x = NULL; | |
| 18279 | 18324 | if (NULL != s) { |
| 18280 | 18325 | cJSON * j = cJSON_Parse(s); |
| 18281 | 18326 | if (NULL != j) { |
| 18282 | - x = cJSON_GetPrimitiveKindValue(j); | |
| 18327 | + x = cJSON_GetSealedValue(j); | |
| 18283 | 18328 | cJSON_Delete(j); |
| 18284 | 18329 | } |
| 18285 | 18330 | } |
| 18286 | 18331 | return x; |
| 18287 | 18332 | } |
| 18288 | 18333 | |
| 18289 | -struct PrimitiveKind * cJSON_GetPrimitiveKindValue(const cJSON * j) { | |
| 18290 | - struct PrimitiveKind * x = NULL; | |
| 18334 | +struct Sealed * cJSON_GetSealedValue(const cJSON * j) { | |
| 18335 | + struct Sealed * x = NULL; | |
| 18291 | 18336 | if (NULL != j) { |
| 18292 | - if (NULL != (x = cJSON_malloc(sizeof(struct PrimitiveKind)))) { | |
| 18293 | - memset(x, 0, sizeof(struct PrimitiveKind)); | |
| 18294 | - if (!cJSON_HasObjectItem(j, "PrimitiveKind")) { cJSON_DeletePrimitiveKind(x); return NULL; } | |
| 18295 | - if (cJSON_HasObjectItem(j, "PrimitiveKind")) { | |
| 18296 | - if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "PrimitiveKind"))) { cJSON_DeletePrimitiveKind(x); return NULL; } | |
| 18297 | - x->primitive_kind = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "PrimitiveKind")); | |
| 18337 | + if (NULL != (x = cJSON_malloc(sizeof(struct Sealed)))) { | |
| 18338 | + memset(x, 0, sizeof(struct Sealed)); | |
| 18339 | + if (!cJSON_HasObjectItem(j, "sealed")) { cJSON_DeleteSealed(x); return NULL; } | |
| 18340 | + if (cJSON_HasObjectItem(j, "sealed")) { | |
| 18341 | + if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "sealed"))) { cJSON_DeleteSealed(x); return NULL; } | |
| 18342 | + x->sealed = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "sealed")); | |
| 18298 | 18343 | } |
| 18299 | 18344 | } |
| 18300 | 18345 | } |
| 18301 | 18346 | return x; |
| 18302 | 18347 | } |
| 18303 | 18348 | |
| 18304 | -cJSON * cJSON_CreatePrimitiveKind(const struct PrimitiveKind * x) { | |
| 18349 | +cJSON * cJSON_CreateSealed(const struct Sealed * x) { | |
| 18305 | 18350 | cJSON * j = NULL; |
| 18306 | 18351 | if (NULL != x) { |
| 18307 | 18352 | if (NULL != (j = cJSON_CreateObject())) { |
| 18308 | - cJSON_AddNumberToObject(j, "PrimitiveKind", x->primitive_kind); | |
| 18353 | + cJSON_AddNumberToObject(j, "sealed", x->sealed); | |
| 18309 | 18354 | } |
| 18310 | 18355 | } |
| 18311 | 18356 | return j; |
| 18312 | 18357 | } |
| 18313 | 18358 | |
| 18314 | -char * cJSON_PrintPrimitiveKind(const struct PrimitiveKind * x) { | |
| 18359 | +char * cJSON_PrintSealed(const struct Sealed * x) { | |
| 18315 | 18360 | char * s = NULL; |
| 18316 | 18361 | if (NULL != x) { |
| 18317 | - cJSON * j = cJSON_CreatePrimitiveKind(x); | |
| 18362 | + cJSON * j = cJSON_CreateSealed(x); | |
| 18318 | 18363 | if (NULL != j) { |
| 18319 | 18364 | s = cJSON_Print(j); |
| 18320 | 18365 | cJSON_Delete(j); |
| @@ -18323,53 +18368,53 @@ char * cJSON_PrintPrimitiveKind(const struct PrimitiveKind * x) { | ||
| 18323 | 18368 | return s; |
| 18324 | 18369 | } |
| 18325 | 18370 | |
| 18326 | -void cJSON_DeletePrimitiveKind(struct PrimitiveKind * x) { | |
| 18371 | +void cJSON_DeleteSealed(struct Sealed * x) { | |
| 18327 | 18372 | if (NULL != x) { |
| 18328 | 18373 | cJSON_free(x); |
| 18329 | 18374 | } |
| 18330 | 18375 | } |
| 18331 | 18376 | |
| 18332 | -struct Obj5True * cJSON_ParseObj5True(const char * s) { | |
| 18333 | - struct Obj5True * x = NULL; | |
| 18377 | +struct Sel * cJSON_ParseSel(const char * s) { | |
| 18378 | + struct Sel * x = NULL; | |
| 18334 | 18379 | if (NULL != s) { |
| 18335 | 18380 | cJSON * j = cJSON_Parse(s); |
| 18336 | 18381 | if (NULL != j) { |
| 18337 | - x = cJSON_GetObj5TrueValue(j); | |
| 18382 | + x = cJSON_GetSelValue(j); | |
| 18338 | 18383 | cJSON_Delete(j); |
| 18339 | 18384 | } |
| 18340 | 18385 | } |
| 18341 | 18386 | return x; |
| 18342 | 18387 | } |
| 18343 | 18388 | |
| 18344 | -struct Obj5True * cJSON_GetObj5TrueValue(const cJSON * j) { | |
| 18345 | - struct Obj5True * x = NULL; | |
| 18389 | +struct Sel * cJSON_GetSelValue(const cJSON * j) { | |
| 18390 | + struct Sel * x = NULL; | |
| 18346 | 18391 | if (NULL != j) { |
| 18347 | - if (NULL != (x = cJSON_malloc(sizeof(struct Obj5True)))) { | |
| 18348 | - memset(x, 0, sizeof(struct Obj5True)); | |
| 18349 | - if (!cJSON_HasObjectItem(j, "true")) { cJSON_DeleteObj5True(x); return NULL; } | |
| 18350 | - if (cJSON_HasObjectItem(j, "true")) { | |
| 18351 | - if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "true"))) { cJSON_DeleteObj5True(x); return NULL; } | |
| 18352 | - x->true_true = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "true")); | |
| 18392 | + if (NULL != (x = cJSON_malloc(sizeof(struct Sel)))) { | |
| 18393 | + memset(x, 0, sizeof(struct Sel)); | |
| 18394 | + if (!cJSON_HasObjectItem(j, "SEL")) { cJSON_DeleteSel(x); return NULL; } | |
| 18395 | + if (cJSON_HasObjectItem(j, "SEL")) { | |
| 18396 | + if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "SEL"))) { cJSON_DeleteSel(x); return NULL; } | |
| 18397 | + x->sel = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "SEL")); | |
| 18353 | 18398 | } |
| 18354 | 18399 | } |
| 18355 | 18400 | } |
| 18356 | 18401 | return x; |
| 18357 | 18402 | } |
| 18358 | 18403 | |
| 18359 | -cJSON * cJSON_CreateObj5True(const struct Obj5True * x) { | |
| 18404 | +cJSON * cJSON_CreateSel(const struct Sel * x) { | |
| 18360 | 18405 | cJSON * j = NULL; |
| 18361 | 18406 | if (NULL != x) { |
| 18362 | 18407 | if (NULL != (j = cJSON_CreateObject())) { |
| 18363 | - cJSON_AddNumberToObject(j, "true", x->true_true); | |
| 18408 | + cJSON_AddNumberToObject(j, "SEL", x->sel); | |
| 18364 | 18409 | } |
| 18365 | 18410 | } |
| 18366 | 18411 | return j; |
| 18367 | 18412 | } |
| 18368 | 18413 | |
| 18369 | -char * cJSON_PrintObj5True(const struct Obj5True * x) { | |
| 18414 | +char * cJSON_PrintSel(const struct Sel * x) { | |
| 18370 | 18415 | char * s = NULL; |
| 18371 | 18416 | if (NULL != x) { |
| 18372 | - cJSON * j = cJSON_CreateObj5True(x); | |
| 18417 | + cJSON * j = cJSON_CreateSel(x); | |
| 18373 | 18418 | if (NULL != j) { |
| 18374 | 18419 | s = cJSON_Print(j); |
| 18375 | 18420 | cJSON_Delete(j); |
| @@ -18378,7 +18423,7 @@ char * cJSON_PrintObj5True(const struct Obj5True * x) { | ||
| 18378 | 18423 | return s; |
| 18379 | 18424 | } |
| 18380 | 18425 | |
| 18381 | -void cJSON_DeleteObj5True(struct Obj5True * x) { | |
| 18426 | +void cJSON_DeleteSel(struct Sel * x) { | |
| 18382 | 18427 | if (NULL != x) { |
| 18383 | 18428 | cJSON_free(x); |
| 18384 | 18429 | } |
| @@ -20349,172 +20394,7 @@ cJSON * cJSON_CreateUndefined(const struct Undefined * x) { | ||
| 20349 | 20394 | char * cJSON_PrintUndefined(const struct Undefined * x) { |
| 20350 | 20395 | char * s = NULL; |
| 20351 | 20396 | if (NULL != x) { |
| 20352 | - cJSON * j = cJSON_CreateUndefined(x); | |
| 20353 | - if (NULL != j) { | |
| 20354 | - s = cJSON_Print(j); | |
| 20355 | - cJSON_Delete(j); | |
| 20356 | - } | |
| 20357 | - } | |
| 20358 | - return s; | |
| 20359 | -} | |
| 20360 | - | |
| 20361 | -void cJSON_DeleteUndefined(struct Undefined * x) { | |
| 20362 | - if (NULL != x) { | |
| 20363 | - cJSON_free(x); | |
| 20364 | - } | |
| 20365 | -} | |
| 20366 | - | |
| 20367 | -struct UnmarshalJson * cJSON_ParseUnmarshalJson(const char * s) { | |
| 20368 | - struct UnmarshalJson * x = NULL; | |
| 20369 | - if (NULL != s) { | |
| 20370 | - cJSON * j = cJSON_Parse(s); | |
| 20371 | - if (NULL != j) { | |
| 20372 | - x = cJSON_GetUnmarshalJsonValue(j); | |
| 20373 | - cJSON_Delete(j); | |
| 20374 | - } | |
| 20375 | - } | |
| 20376 | - return x; | |
| 20377 | -} | |
| 20378 | - | |
| 20379 | -struct UnmarshalJson * cJSON_GetUnmarshalJsonValue(const cJSON * j) { | |
| 20380 | - struct UnmarshalJson * x = NULL; | |
| 20381 | - if (NULL != j) { | |
| 20382 | - if (NULL != (x = cJSON_malloc(sizeof(struct UnmarshalJson)))) { | |
| 20383 | - memset(x, 0, sizeof(struct UnmarshalJson)); | |
| 20384 | - if (!cJSON_HasObjectItem(j, "UnmarshalJSON")) { cJSON_DeleteUnmarshalJson(x); return NULL; } | |
| 20385 | - if (cJSON_HasObjectItem(j, "UnmarshalJSON")) { | |
| 20386 | - if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "UnmarshalJSON"))) { cJSON_DeleteUnmarshalJson(x); return NULL; } | |
| 20387 | - x->unmarshal_json = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "UnmarshalJSON")); | |
| 20388 | - } | |
| 20389 | - } | |
| 20390 | - } | |
| 20391 | - return x; | |
| 20392 | -} | |
| 20393 | - | |
| 20394 | -cJSON * cJSON_CreateUnmarshalJson(const struct UnmarshalJson * x) { | |
| 20395 | - cJSON * j = NULL; | |
| 20396 | - if (NULL != x) { | |
| 20397 | - if (NULL != (j = cJSON_CreateObject())) { | |
| 20398 | - cJSON_AddNumberToObject(j, "UnmarshalJSON", x->unmarshal_json); | |
| 20399 | - } | |
| 20400 | - } | |
| 20401 | - return j; | |
| 20402 | -} | |
| 20403 | - | |
| 20404 | -char * cJSON_PrintUnmarshalJson(const struct UnmarshalJson * x) { | |
| 20405 | - char * s = NULL; | |
| 20406 | - if (NULL != x) { | |
| 20407 | - cJSON * j = cJSON_CreateUnmarshalJson(x); | |
| 20408 | - if (NULL != j) { | |
| 20409 | - s = cJSON_Print(j); | |
| 20410 | - cJSON_Delete(j); | |
| 20411 | - } | |
| 20412 | - } | |
| 20413 | - return s; | |
| 20414 | -} | |
| 20415 | - | |
| 20416 | -void cJSON_DeleteUnmarshalJson(struct UnmarshalJson * x) { | |
| 20417 | - if (NULL != x) { | |
| 20418 | - cJSON_free(x); | |
| 20419 | - } | |
| 20420 | -} | |
| 20421 | - | |
| 20422 | -struct Unowned * cJSON_ParseUnowned(const char * s) { | |
| 20423 | - struct Unowned * x = NULL; | |
| 20424 | - if (NULL != s) { | |
| 20425 | - cJSON * j = cJSON_Parse(s); | |
| 20426 | - if (NULL != j) { | |
| 20427 | - x = cJSON_GetUnownedValue(j); | |
| 20428 | - cJSON_Delete(j); | |
| 20429 | - } | |
| 20430 | - } | |
| 20431 | - return x; | |
| 20432 | -} | |
| 20433 | - | |
| 20434 | -struct Unowned * cJSON_GetUnownedValue(const cJSON * j) { | |
| 20435 | - struct Unowned * x = NULL; | |
| 20436 | - if (NULL != j) { | |
| 20437 | - if (NULL != (x = cJSON_malloc(sizeof(struct Unowned)))) { | |
| 20438 | - memset(x, 0, sizeof(struct Unowned)); | |
| 20439 | - if (!cJSON_HasObjectItem(j, "unowned")) { cJSON_DeleteUnowned(x); return NULL; } | |
| 20440 | - if (cJSON_HasObjectItem(j, "unowned")) { | |
| 20441 | - if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "unowned"))) { cJSON_DeleteUnowned(x); return NULL; } | |
| 20442 | - x->unowned = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "unowned")); | |
| 20443 | - } | |
| 20444 | - } | |
| 20445 | - } | |
| 20446 | - return x; | |
| 20447 | -} | |
| 20448 | - | |
| 20449 | -cJSON * cJSON_CreateUnowned(const struct Unowned * x) { | |
| 20450 | - cJSON * j = NULL; | |
| 20451 | - if (NULL != x) { | |
| 20452 | - if (NULL != (j = cJSON_CreateObject())) { | |
| 20453 | - cJSON_AddNumberToObject(j, "unowned", x->unowned); | |
| 20454 | - } | |
| 20455 | - } | |
| 20456 | - return j; | |
| 20457 | -} | |
| 20458 | - | |
| 20459 | -char * cJSON_PrintUnowned(const struct Unowned * x) { | |
| 20460 | - char * s = NULL; | |
| 20461 | - if (NULL != x) { | |
| 20462 | - cJSON * j = cJSON_CreateUnowned(x); | |
| 20463 | - if (NULL != j) { | |
| 20464 | - s = cJSON_Print(j); | |
| 20465 | - cJSON_Delete(j); | |
| 20466 | - } | |
| 20467 | - } | |
| 20468 | - return s; | |
| 20469 | -} | |
| 20470 | - | |
| 20471 | -void cJSON_DeleteUnowned(struct Unowned * x) { | |
| 20472 | - if (NULL != x) { | |
| 20473 | - cJSON_free(x); | |
| 20474 | - } | |
| 20475 | -} | |
| 20476 | - | |
| 20477 | -struct Unsafe * cJSON_ParseUnsafe(const char * s) { | |
| 20478 | - struct Unsafe * x = NULL; | |
| 20479 | - if (NULL != s) { | |
| 20480 | - cJSON * j = cJSON_Parse(s); | |
| 20481 | - if (NULL != j) { | |
| 20482 | - x = cJSON_GetUnsafeValue(j); | |
| 20483 | - cJSON_Delete(j); | |
| 20484 | - } | |
| 20485 | - } | |
| 20486 | - return x; | |
| 20487 | -} | |
| 20488 | - | |
| 20489 | -struct Unsafe * cJSON_GetUnsafeValue(const cJSON * j) { | |
| 20490 | - struct Unsafe * x = NULL; | |
| 20491 | - if (NULL != j) { | |
| 20492 | - if (NULL != (x = cJSON_malloc(sizeof(struct Unsafe)))) { | |
| 20493 | - memset(x, 0, sizeof(struct Unsafe)); | |
| 20494 | - if (!cJSON_HasObjectItem(j, "unsafe")) { cJSON_DeleteUnsafe(x); return NULL; } | |
| 20495 | - if (cJSON_HasObjectItem(j, "unsafe")) { | |
| 20496 | - if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "unsafe"))) { cJSON_DeleteUnsafe(x); return NULL; } | |
| 20497 | - x->unsafe = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "unsafe")); | |
| 20498 | - } | |
| 20499 | - } | |
| 20500 | - } | |
| 20501 | - return x; | |
| 20502 | -} | |
| 20503 | - | |
| 20504 | -cJSON * cJSON_CreateUnsafe(const struct Unsafe * x) { | |
| 20505 | - cJSON * j = NULL; | |
| 20506 | - if (NULL != x) { | |
| 20507 | - if (NULL != (j = cJSON_CreateObject())) { | |
| 20508 | - cJSON_AddNumberToObject(j, "unsafe", x->unsafe); | |
| 20509 | - } | |
| 20510 | - } | |
| 20511 | - return j; | |
| 20512 | -} | |
| 20513 | - | |
| 20514 | -char * cJSON_PrintUnsafe(const struct Unsafe * x) { | |
| 20515 | - char * s = NULL; | |
| 20516 | - if (NULL != x) { | |
| 20517 | - cJSON * j = cJSON_CreateUnsafe(x); | |
| 20397 | + cJSON * j = cJSON_CreateUndefined(x); | |
| 20518 | 20398 | if (NULL != j) { |
| 20519 | 20399 | s = cJSON_Print(j); |
| 20520 | 20400 | cJSON_Delete(j); |
| @@ -20523,53 +20403,53 @@ char * cJSON_PrintUnsafe(const struct Unsafe * x) { | ||
| 20523 | 20403 | return s; |
| 20524 | 20404 | } |
| 20525 | 20405 | |
| 20526 | -void cJSON_DeleteUnsafe(struct Unsafe * x) { | |
| 20406 | +void cJSON_DeleteUndefined(struct Undefined * x) { | |
| 20527 | 20407 | if (NULL != x) { |
| 20528 | 20408 | cJSON_free(x); |
| 20529 | 20409 | } |
| 20530 | 20410 | } |
| 20531 | 20411 | |
| 20532 | -struct UseSerializers * cJSON_ParseUseSerializers(const char * s) { | |
| 20533 | - struct UseSerializers * x = NULL; | |
| 20412 | +struct UnmarshalJson * cJSON_ParseUnmarshalJson(const char * s) { | |
| 20413 | + struct UnmarshalJson * x = NULL; | |
| 20534 | 20414 | if (NULL != s) { |
| 20535 | 20415 | cJSON * j = cJSON_Parse(s); |
| 20536 | 20416 | if (NULL != j) { |
| 20537 | - x = cJSON_GetUseSerializersValue(j); | |
| 20417 | + x = cJSON_GetUnmarshalJsonValue(j); | |
| 20538 | 20418 | cJSON_Delete(j); |
| 20539 | 20419 | } |
| 20540 | 20420 | } |
| 20541 | 20421 | return x; |
| 20542 | 20422 | } |
| 20543 | 20423 | |
| 20544 | -struct UseSerializers * cJSON_GetUseSerializersValue(const cJSON * j) { | |
| 20545 | - struct UseSerializers * x = NULL; | |
| 20424 | +struct UnmarshalJson * cJSON_GetUnmarshalJsonValue(const cJSON * j) { | |
| 20425 | + struct UnmarshalJson * x = NULL; | |
| 20546 | 20426 | if (NULL != j) { |
| 20547 | - if (NULL != (x = cJSON_malloc(sizeof(struct UseSerializers)))) { | |
| 20548 | - memset(x, 0, sizeof(struct UseSerializers)); | |
| 20549 | - if (!cJSON_HasObjectItem(j, "UseSerializers")) { cJSON_DeleteUseSerializers(x); return NULL; } | |
| 20550 | - if (cJSON_HasObjectItem(j, "UseSerializers")) { | |
| 20551 | - if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "UseSerializers"))) { cJSON_DeleteUseSerializers(x); return NULL; } | |
| 20552 | - x->use_serializers = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "UseSerializers")); | |
| 20427 | + if (NULL != (x = cJSON_malloc(sizeof(struct UnmarshalJson)))) { | |
| 20428 | + memset(x, 0, sizeof(struct UnmarshalJson)); | |
| 20429 | + if (!cJSON_HasObjectItem(j, "UnmarshalJSON")) { cJSON_DeleteUnmarshalJson(x); return NULL; } | |
| 20430 | + if (cJSON_HasObjectItem(j, "UnmarshalJSON")) { | |
| 20431 | + if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "UnmarshalJSON"))) { cJSON_DeleteUnmarshalJson(x); return NULL; } | |
| 20432 | + x->unmarshal_json = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "UnmarshalJSON")); | |
| 20553 | 20433 | } |
| 20554 | 20434 | } |
| 20555 | 20435 | } |
| 20556 | 20436 | return x; |
| 20557 | 20437 | } |
| 20558 | 20438 | |
| 20559 | -cJSON * cJSON_CreateUseSerializers(const struct UseSerializers * x) { | |
| 20439 | +cJSON * cJSON_CreateUnmarshalJson(const struct UnmarshalJson * x) { | |
| 20560 | 20440 | cJSON * j = NULL; |
| 20561 | 20441 | if (NULL != x) { |
| 20562 | 20442 | if (NULL != (j = cJSON_CreateObject())) { |
| 20563 | - cJSON_AddNumberToObject(j, "UseSerializers", x->use_serializers); | |
| 20443 | + cJSON_AddNumberToObject(j, "UnmarshalJSON", x->unmarshal_json); | |
| 20564 | 20444 | } |
| 20565 | 20445 | } |
| 20566 | 20446 | return j; |
| 20567 | 20447 | } |
| 20568 | 20448 | |
| 20569 | -char * cJSON_PrintUseSerializers(const struct UseSerializers * x) { | |
| 20449 | +char * cJSON_PrintUnmarshalJson(const struct UnmarshalJson * x) { | |
| 20570 | 20450 | char * s = NULL; |
| 20571 | 20451 | if (NULL != x) { |
| 20572 | - cJSON * j = cJSON_CreateUseSerializers(x); | |
| 20452 | + cJSON * j = cJSON_CreateUnmarshalJson(x); | |
| 20573 | 20453 | if (NULL != j) { |
| 20574 | 20454 | s = cJSON_Print(j); |
| 20575 | 20455 | cJSON_Delete(j); |
| @@ -20578,7 +20458,7 @@ char * cJSON_PrintUseSerializers(const struct UseSerializers * x) { | ||
| 20578 | 20458 | return s; |
| 20579 | 20459 | } |
| 20580 | 20460 | |
| 20581 | -void cJSON_DeleteUseSerializers(struct UseSerializers * x) { | |
| 20461 | +void cJSON_DeleteUnmarshalJson(struct UnmarshalJson * x) { | |
| 20582 | 20462 | if (NULL != x) { |
| 20583 | 20463 | cJSON_free(x); |
| 20584 | 20464 | } |
| @@ -20756,6 +20636,18 @@ struct Obj5 * cJSON_GetObj5Value(const cJSON * j) { | ||
| 20756 | 20636 | x->purple_true = cJSON_GetObj5TrueValue(cJSON_GetObjectItemCaseSensitive(j, "true")); |
| 20757 | 20637 | if (NULL == x->purple_true) { cJSON_DeleteObj5(x); return NULL; } |
| 20758 | 20638 | } |
| 20639 | + if (!cJSON_HasObjectItem(j, "sealed")) { cJSON_DeleteObj5(x); return NULL; } | |
| 20640 | + if (cJSON_HasObjectItem(j, "sealed")) { | |
| 20641 | + if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "sealed"))) { cJSON_DeleteObj5(x); return NULL; } | |
| 20642 | + x->sealed = cJSON_GetSealedValue(cJSON_GetObjectItemCaseSensitive(j, "sealed")); | |
| 20643 | + if (NULL == x->sealed) { cJSON_DeleteObj5(x); return NULL; } | |
| 20644 | + } | |
| 20645 | + if (!cJSON_HasObjectItem(j, "SEL")) { cJSON_DeleteObj5(x); return NULL; } | |
| 20646 | + if (cJSON_HasObjectItem(j, "SEL")) { | |
| 20647 | + if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "SEL"))) { cJSON_DeleteObj5(x); return NULL; } | |
| 20648 | + x->sel = cJSON_GetSelValue(cJSON_GetObjectItemCaseSensitive(j, "SEL")); | |
| 20649 | + if (NULL == x->sel) { cJSON_DeleteObj5(x); return NULL; } | |
| 20650 | + } | |
| 20759 | 20651 | if (!cJSON_HasObjectItem(j, "select")) { cJSON_DeleteObj5(x); return NULL; } |
| 20760 | 20652 | if (cJSON_HasObjectItem(j, "select")) { |
| 20761 | 20653 | if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "select"))) { cJSON_DeleteObj5(x); return NULL; } |
| @@ -20978,24 +20870,6 @@ struct Obj5 * cJSON_GetObj5Value(const cJSON * j) { | ||
| 20978 | 20870 | x->unmarshal_json = cJSON_GetUnmarshalJsonValue(cJSON_GetObjectItemCaseSensitive(j, "UnmarshalJSON")); |
| 20979 | 20871 | if (NULL == x->unmarshal_json) { cJSON_DeleteObj5(x); return NULL; } |
| 20980 | 20872 | } |
| 20981 | - if (!cJSON_HasObjectItem(j, "unowned")) { cJSON_DeleteObj5(x); return NULL; } | |
| 20982 | - if (cJSON_HasObjectItem(j, "unowned")) { | |
| 20983 | - if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "unowned"))) { cJSON_DeleteObj5(x); return NULL; } | |
| 20984 | - x->unowned = cJSON_GetUnownedValue(cJSON_GetObjectItemCaseSensitive(j, "unowned")); | |
| 20985 | - if (NULL == x->unowned) { cJSON_DeleteObj5(x); return NULL; } | |
| 20986 | - } | |
| 20987 | - if (!cJSON_HasObjectItem(j, "unsafe")) { cJSON_DeleteObj5(x); return NULL; } | |
| 20988 | - if (cJSON_HasObjectItem(j, "unsafe")) { | |
| 20989 | - if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "unsafe"))) { cJSON_DeleteObj5(x); return NULL; } | |
| 20990 | - x->unsafe = cJSON_GetUnsafeValue(cJSON_GetObjectItemCaseSensitive(j, "unsafe")); | |
| 20991 | - if (NULL == x->unsafe) { cJSON_DeleteObj5(x); return NULL; } | |
| 20992 | - } | |
| 20993 | - if (!cJSON_HasObjectItem(j, "UseSerializers")) { cJSON_DeleteObj5(x); return NULL; } | |
| 20994 | - if (cJSON_HasObjectItem(j, "UseSerializers")) { | |
| 20995 | - if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "UseSerializers"))) { cJSON_DeleteObj5(x); return NULL; } | |
| 20996 | - x->use_serializers = cJSON_GetUseSerializersValue(cJSON_GetObjectItemCaseSensitive(j, "UseSerializers")); | |
| 20997 | - if (NULL == x->use_serializers) { cJSON_DeleteObj5(x); return NULL; } | |
| 20998 | - } | |
| 20999 | 20873 | } |
| 21000 | 20874 | } |
| 21001 | 20875 | return x; |
| @@ -21031,6 +20905,8 @@ cJSON * cJSON_CreateObj5(const struct Obj5 * x) { | ||
| 21031 | 20905 | cJSON_AddItemToObject(j, "union", cJSON_CreateUnion(x->obj5_union)); |
| 21032 | 20906 | cJSON_AddItemToObject(j, "PrimitiveKind", cJSON_CreatePrimitiveKind(x->primitive_kind)); |
| 21033 | 20907 | cJSON_AddItemToObject(j, "true", cJSON_CreateObj5True(x->purple_true)); |
| 20908 | + cJSON_AddItemToObject(j, "sealed", cJSON_CreateSealed(x->sealed)); | |
| 20909 | + cJSON_AddItemToObject(j, "SEL", cJSON_CreateSel(x->sel)); | |
| 21034 | 20910 | cJSON_AddItemToObject(j, "select", cJSON_CreateSelect(x->select)); |
| 21035 | 20911 | cJSON_AddItemToObject(j, "Self", cJSON_CreateSelf(x->self)); |
| 21036 | 20912 | cJSON_AddItemToObject(j, "Sendable", cJSON_CreateSendable(x->sendable)); |
| @@ -21068,9 +20944,6 @@ cJSON * cJSON_CreateObj5(const struct Obj5 * x) { | ||
| 21068 | 20944 | cJSON_AddItemToObject(j, "unchecked", cJSON_CreateUnchecked(x->unchecked)); |
| 21069 | 20945 | cJSON_AddItemToObject(j, "undefined", cJSON_CreateUndefined(x->undefined)); |
| 21070 | 20946 | cJSON_AddItemToObject(j, "UnmarshalJSON", cJSON_CreateUnmarshalJson(x->unmarshal_json)); |
| 21071 | - cJSON_AddItemToObject(j, "unowned", cJSON_CreateUnowned(x->unowned)); | |
| 21072 | - cJSON_AddItemToObject(j, "unsafe", cJSON_CreateUnsafe(x->unsafe)); | |
| 21073 | - cJSON_AddItemToObject(j, "UseSerializers", cJSON_CreateUseSerializers(x->use_serializers)); | |
| 21074 | 20947 | } |
| 21075 | 20948 | } |
| 21076 | 20949 | return j; |
| @@ -21165,6 +21038,12 @@ void cJSON_DeleteObj5(struct Obj5 * x) { | ||
| 21165 | 21038 | if (NULL != x->purple_true) { |
| 21166 | 21039 | cJSON_DeleteObj5True(x->purple_true); |
| 21167 | 21040 | } |
| 21041 | + if (NULL != x->sealed) { | |
| 21042 | + cJSON_DeleteSealed(x->sealed); | |
| 21043 | + } | |
| 21044 | + if (NULL != x->sel) { | |
| 21045 | + cJSON_DeleteSel(x->sel); | |
| 21046 | + } | |
| 21168 | 21047 | if (NULL != x->select) { |
| 21169 | 21048 | cJSON_DeleteSelect(x->select); |
| 21170 | 21049 | } |
| @@ -21276,15 +21155,6 @@ void cJSON_DeleteObj5(struct Obj5 * x) { | ||
| 21276 | 21155 | if (NULL != x->unmarshal_json) { |
| 21277 | 21156 | cJSON_DeleteUnmarshalJson(x->unmarshal_json); |
| 21278 | 21157 | } |
| 21279 | - if (NULL != x->unowned) { | |
| 21280 | - cJSON_DeleteUnowned(x->unowned); | |
| 21281 | - } | |
| 21282 | - if (NULL != x->unsafe) { | |
| 21283 | - cJSON_DeleteUnsafe(x->unsafe); | |
| 21284 | - } | |
| 21285 | - if (NULL != x->use_serializers) { | |
| 21286 | - cJSON_DeleteUseSerializers(x->use_serializers); | |
| 21287 | - } | |
| 21288 | 21158 | cJSON_free(x); |
| 21289 | 21159 | } |
| 21290 | 21160 | } |
| @@ -21784,6 +21654,171 @@ void cJSON_DeleteXorEq(struct XorEq * x) { | ||
| 21784 | 21654 | } |
| 21785 | 21655 | } |
| 21786 | 21656 | |
| 21657 | +struct Unowned * cJSON_ParseUnowned(const char * s) { | |
| 21658 | + struct Unowned * x = NULL; | |
| 21659 | + if (NULL != s) { | |
| 21660 | + cJSON * j = cJSON_Parse(s); | |
| 21661 | + if (NULL != j) { | |
| 21662 | + x = cJSON_GetUnownedValue(j); | |
| 21663 | + cJSON_Delete(j); | |
| 21664 | + } | |
| 21665 | + } | |
| 21666 | + return x; | |
| 21667 | +} | |
| 21668 | + | |
| 21669 | +struct Unowned * cJSON_GetUnownedValue(const cJSON * j) { | |
| 21670 | + struct Unowned * x = NULL; | |
| 21671 | + if (NULL != j) { | |
| 21672 | + if (NULL != (x = cJSON_malloc(sizeof(struct Unowned)))) { | |
| 21673 | + memset(x, 0, sizeof(struct Unowned)); | |
| 21674 | + if (!cJSON_HasObjectItem(j, "unowned")) { cJSON_DeleteUnowned(x); return NULL; } | |
| 21675 | + if (cJSON_HasObjectItem(j, "unowned")) { | |
| 21676 | + if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "unowned"))) { cJSON_DeleteUnowned(x); return NULL; } | |
| 21677 | + x->unowned = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "unowned")); | |
| 21678 | + } | |
| 21679 | + } | |
| 21680 | + } | |
| 21681 | + return x; | |
| 21682 | +} | |
| 21683 | + | |
| 21684 | +cJSON * cJSON_CreateUnowned(const struct Unowned * x) { | |
| 21685 | + cJSON * j = NULL; | |
| 21686 | + if (NULL != x) { | |
| 21687 | + if (NULL != (j = cJSON_CreateObject())) { | |
| 21688 | + cJSON_AddNumberToObject(j, "unowned", x->unowned); | |
| 21689 | + } | |
| 21690 | + } | |
| 21691 | + return j; | |
| 21692 | +} | |
| 21693 | + | |
| 21694 | +char * cJSON_PrintUnowned(const struct Unowned * x) { | |
| 21695 | + char * s = NULL; | |
| 21696 | + if (NULL != x) { | |
| 21697 | + cJSON * j = cJSON_CreateUnowned(x); | |
| 21698 | + if (NULL != j) { | |
| 21699 | + s = cJSON_Print(j); | |
| 21700 | + cJSON_Delete(j); | |
| 21701 | + } | |
| 21702 | + } | |
| 21703 | + return s; | |
| 21704 | +} | |
| 21705 | + | |
| 21706 | +void cJSON_DeleteUnowned(struct Unowned * x) { | |
| 21707 | + if (NULL != x) { | |
| 21708 | + cJSON_free(x); | |
| 21709 | + } | |
| 21710 | +} | |
| 21711 | + | |
| 21712 | +struct Unsafe * cJSON_ParseUnsafe(const char * s) { | |
| 21713 | + struct Unsafe * x = NULL; | |
| 21714 | + if (NULL != s) { | |
| 21715 | + cJSON * j = cJSON_Parse(s); | |
| 21716 | + if (NULL != j) { | |
| 21717 | + x = cJSON_GetUnsafeValue(j); | |
| 21718 | + cJSON_Delete(j); | |
| 21719 | + } | |
| 21720 | + } | |
| 21721 | + return x; | |
| 21722 | +} | |
| 21723 | + | |
| 21724 | +struct Unsafe * cJSON_GetUnsafeValue(const cJSON * j) { | |
| 21725 | + struct Unsafe * x = NULL; | |
| 21726 | + if (NULL != j) { | |
| 21727 | + if (NULL != (x = cJSON_malloc(sizeof(struct Unsafe)))) { | |
| 21728 | + memset(x, 0, sizeof(struct Unsafe)); | |
| 21729 | + if (!cJSON_HasObjectItem(j, "unsafe")) { cJSON_DeleteUnsafe(x); return NULL; } | |
| 21730 | + if (cJSON_HasObjectItem(j, "unsafe")) { | |
| 21731 | + if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "unsafe"))) { cJSON_DeleteUnsafe(x); return NULL; } | |
| 21732 | + x->unsafe = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "unsafe")); | |
| 21733 | + } | |
| 21734 | + } | |
| 21735 | + } | |
| 21736 | + return x; | |
| 21737 | +} | |
| 21738 | + | |
| 21739 | +cJSON * cJSON_CreateUnsafe(const struct Unsafe * x) { | |
| 21740 | + cJSON * j = NULL; | |
| 21741 | + if (NULL != x) { | |
| 21742 | + if (NULL != (j = cJSON_CreateObject())) { | |
| 21743 | + cJSON_AddNumberToObject(j, "unsafe", x->unsafe); | |
| 21744 | + } | |
| 21745 | + } | |
| 21746 | + return j; | |
| 21747 | +} | |
| 21748 | + | |
| 21749 | +char * cJSON_PrintUnsafe(const struct Unsafe * x) { | |
| 21750 | + char * s = NULL; | |
| 21751 | + if (NULL != x) { | |
| 21752 | + cJSON * j = cJSON_CreateUnsafe(x); | |
| 21753 | + if (NULL != j) { | |
| 21754 | + s = cJSON_Print(j); | |
| 21755 | + cJSON_Delete(j); | |
| 21756 | + } | |
| 21757 | + } | |
| 21758 | + return s; | |
| 21759 | +} | |
| 21760 | + | |
| 21761 | +void cJSON_DeleteUnsafe(struct Unsafe * x) { | |
| 21762 | + if (NULL != x) { | |
| 21763 | + cJSON_free(x); | |
| 21764 | + } | |
| 21765 | +} | |
| 21766 | + | |
| 21767 | +struct UseSerializers * cJSON_ParseUseSerializers(const char * s) { | |
| 21768 | + struct UseSerializers * x = NULL; | |
| 21769 | + if (NULL != s) { | |
| 21770 | + cJSON * j = cJSON_Parse(s); | |
| 21771 | + if (NULL != j) { | |
| 21772 | + x = cJSON_GetUseSerializersValue(j); | |
| 21773 | + cJSON_Delete(j); | |
| 21774 | + } | |
| 21775 | + } | |
| 21776 | + return x; | |
| 21777 | +} | |
| 21778 | + | |
| 21779 | +struct UseSerializers * cJSON_GetUseSerializersValue(const cJSON * j) { | |
| 21780 | + struct UseSerializers * x = NULL; | |
| 21781 | + if (NULL != j) { | |
| 21782 | + if (NULL != (x = cJSON_malloc(sizeof(struct UseSerializers)))) { | |
| 21783 | + memset(x, 0, sizeof(struct UseSerializers)); | |
| 21784 | + if (!cJSON_HasObjectItem(j, "UseSerializers")) { cJSON_DeleteUseSerializers(x); return NULL; } | |
| 21785 | + if (cJSON_HasObjectItem(j, "UseSerializers")) { | |
| 21786 | + if (!quicktype_cJSON_IsInteger(cJSON_GetObjectItemCaseSensitive(j, "UseSerializers"))) { cJSON_DeleteUseSerializers(x); return NULL; } | |
| 21787 | + x->use_serializers = cJSON_GetNumberValue(cJSON_GetObjectItemCaseSensitive(j, "UseSerializers")); | |
| 21788 | + } | |
| 21789 | + } | |
| 21790 | + } | |
| 21791 | + return x; | |
| 21792 | +} | |
| 21793 | + | |
| 21794 | +cJSON * cJSON_CreateUseSerializers(const struct UseSerializers * x) { | |
| 21795 | + cJSON * j = NULL; | |
| 21796 | + if (NULL != x) { | |
| 21797 | + if (NULL != (j = cJSON_CreateObject())) { | |
| 21798 | + cJSON_AddNumberToObject(j, "UseSerializers", x->use_serializers); | |
| 21799 | + } | |
| 21800 | + } | |
| 21801 | + return j; | |
| 21802 | +} | |
| 21803 | + | |
| 21804 | +char * cJSON_PrintUseSerializers(const struct UseSerializers * x) { | |
| 21805 | + char * s = NULL; | |
| 21806 | + if (NULL != x) { | |
| 21807 | + cJSON * j = cJSON_CreateUseSerializers(x); | |
| 21808 | + if (NULL != j) { | |
| 21809 | + s = cJSON_Print(j); | |
| 21810 | + cJSON_Delete(j); | |
| 21811 | + } | |
| 21812 | + } | |
| 21813 | + return s; | |
| 21814 | +} | |
| 21815 | + | |
| 21816 | +void cJSON_DeleteUseSerializers(struct UseSerializers * x) { | |
| 21817 | + if (NULL != x) { | |
| 21818 | + cJSON_free(x); | |
| 21819 | + } | |
| 21820 | +} | |
| 21821 | + | |
| 21787 | 21822 | struct Ushort * cJSON_ParseUshort(const char * s) { |
| 21788 | 21823 | struct Ushort * x = NULL; |
| 21789 | 21824 | if (NULL != s) { |
| @@ -22465,6 +22500,24 @@ struct Obj6 * cJSON_GetObj6Value(const cJSON * j) { | ||
| 22465 | 22500 | x->obj6_xor_eq = cJSON_GetXorEqValue(cJSON_GetObjectItemCaseSensitive(j, "xor_eq")); |
| 22466 | 22501 | if (NULL == x->obj6_xor_eq) { cJSON_DeleteObj6(x); return NULL; } |
| 22467 | 22502 | } |
| 22503 | + if (!cJSON_HasObjectItem(j, "unowned")) { cJSON_DeleteObj6(x); return NULL; } | |
| 22504 | + if (cJSON_HasObjectItem(j, "unowned")) { | |
| 22505 | + if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "unowned"))) { cJSON_DeleteObj6(x); return NULL; } | |
| 22506 | + x->unowned = cJSON_GetUnownedValue(cJSON_GetObjectItemCaseSensitive(j, "unowned")); | |
| 22507 | + if (NULL == x->unowned) { cJSON_DeleteObj6(x); return NULL; } | |
| 22508 | + } | |
| 22509 | + if (!cJSON_HasObjectItem(j, "unsafe")) { cJSON_DeleteObj6(x); return NULL; } | |
| 22510 | + if (cJSON_HasObjectItem(j, "unsafe")) { | |
| 22511 | + if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "unsafe"))) { cJSON_DeleteObj6(x); return NULL; } | |
| 22512 | + x->unsafe = cJSON_GetUnsafeValue(cJSON_GetObjectItemCaseSensitive(j, "unsafe")); | |
| 22513 | + if (NULL == x->unsafe) { cJSON_DeleteObj6(x); return NULL; } | |
| 22514 | + } | |
| 22515 | + if (!cJSON_HasObjectItem(j, "UseSerializers")) { cJSON_DeleteObj6(x); return NULL; } | |
| 22516 | + if (cJSON_HasObjectItem(j, "UseSerializers")) { | |
| 22517 | + if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "UseSerializers"))) { cJSON_DeleteObj6(x); return NULL; } | |
| 22518 | + x->use_serializers = cJSON_GetUseSerializersValue(cJSON_GetObjectItemCaseSensitive(j, "UseSerializers")); | |
| 22519 | + if (NULL == x->use_serializers) { cJSON_DeleteObj6(x); return NULL; } | |
| 22520 | + } | |
| 22468 | 22521 | if (!cJSON_HasObjectItem(j, "ushort")) { cJSON_DeleteObj6(x); return NULL; } |
| 22469 | 22522 | if (cJSON_HasObjectItem(j, "ushort")) { |
| 22470 | 22523 | if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "ushort"))) { cJSON_DeleteObj6(x); return NULL; } |
| @@ -22550,6 +22603,9 @@ cJSON * cJSON_CreateObj6(const struct Obj6 * x) { | ||
| 22550 | 22603 | cJSON_AddItemToObject(j, "while", cJSON_CreateWhile(x->obj6_while)); |
| 22551 | 22604 | cJSON_AddItemToObject(j, "xor", cJSON_CreateXor(x->obj6_xor)); |
| 22552 | 22605 | cJSON_AddItemToObject(j, "xor_eq", cJSON_CreateXorEq(x->obj6_xor_eq)); |
| 22606 | + cJSON_AddItemToObject(j, "unowned", cJSON_CreateUnowned(x->unowned)); | |
| 22607 | + cJSON_AddItemToObject(j, "unsafe", cJSON_CreateUnsafe(x->unsafe)); | |
| 22608 | + cJSON_AddItemToObject(j, "UseSerializers", cJSON_CreateUseSerializers(x->use_serializers)); | |
| 22553 | 22609 | cJSON_AddItemToObject(j, "ushort", cJSON_CreateUshort(x->ushort)); |
| 22554 | 22610 | cJSON_AddItemToObject(j, "Utf8JsonReader", cJSON_CreateUtf8JsonReader(x->utf8_json_reader)); |
| 22555 | 22611 | cJSON_AddItemToObject(j, "Utf8JsonWriter", cJSON_CreateUtf8JsonWriter(x->utf8_json_writer)); |
| @@ -22607,6 +22663,15 @@ void cJSON_DeleteObj6(struct Obj6 * x) { | ||
| 22607 | 22663 | if (NULL != x->obj6_xor_eq) { |
| 22608 | 22664 | cJSON_DeleteXorEq(x->obj6_xor_eq); |
| 22609 | 22665 | } |
| 22666 | + if (NULL != x->unowned) { | |
| 22667 | + cJSON_DeleteUnowned(x->unowned); | |
| 22668 | + } | |
| 22669 | + if (NULL != x->unsafe) { | |
| 22670 | + cJSON_DeleteUnsafe(x->unsafe); | |
| 22671 | + } | |
| 22672 | + if (NULL != x->use_serializers) { | |
| 22673 | + cJSON_DeleteUseSerializers(x->use_serializers); | |
| 22674 | + } | |
| 22610 | 22675 | if (NULL != x->ushort) { |
| 22611 | 22676 | cJSON_DeleteUshort(x->ushort); |
| 22612 | 22677 | } |
Mcjsondefault / TopLevel.h+88 −77
| @@ -885,6 +885,10 @@ struct Lock { | ||
| 885 | 885 | int64_t lock; |
| 886 | 886 | }; |
| 887 | 887 | |
| 888 | +struct MakeDictEncoder { | |
| 889 | + int64_t make_dict_encoder; | |
| 890 | +}; | |
| 891 | + | |
| 888 | 892 | struct Map { |
| 889 | 893 | int64_t map; |
| 890 | 894 | }; |
| @@ -913,14 +917,6 @@ struct Newtonsoft { | ||
| 913 | 917 | int64_t newtonsoft; |
| 914 | 918 | }; |
| 915 | 919 | |
| 916 | -struct Nil { | |
| 917 | - int64_t nil; | |
| 918 | -}; | |
| 919 | - | |
| 920 | -struct No { | |
| 921 | - int64_t no; | |
| 922 | -}; | |
| 923 | - | |
| 924 | 920 | struct Goto { |
| 925 | 921 | int64_t goto_goto; |
| 926 | 922 | }; |
| @@ -1009,6 +1005,7 @@ struct Obj3 { | ||
| 1009 | 1005 | struct List * list; |
| 1010 | 1006 | struct Locale * locale; |
| 1011 | 1007 | struct Lock * lock; |
| 1008 | + struct MakeDictEncoder * make_dict_encoder; | |
| 1012 | 1009 | struct Map * map; |
| 1013 | 1010 | struct MapEntry * map_entry; |
| 1014 | 1011 | struct MarshalJson * marshal_json; |
| @@ -1016,8 +1013,6 @@ struct Obj3 { | ||
| 1016 | 1013 | struct Mutating * mutating; |
| 1017 | 1014 | struct Native * native; |
| 1018 | 1015 | struct Newtonsoft * newtonsoft; |
| 1019 | - struct Nil * nil; | |
| 1020 | - struct No * no; | |
| 1021 | 1016 | struct Goto * obj3_goto; |
| 1022 | 1017 | struct If * obj3_if; |
| 1023 | 1018 | struct Import * obj3_import; |
| @@ -1030,6 +1025,14 @@ struct Obj3 { | ||
| 1030 | 1025 | struct New * obj3_new; |
| 1031 | 1026 | }; |
| 1032 | 1027 | |
| 1028 | +struct Nil { | |
| 1029 | + int64_t nil; | |
| 1030 | +}; | |
| 1031 | + | |
| 1032 | +struct No { | |
| 1033 | + int64_t no; | |
| 1034 | +}; | |
| 1035 | + | |
| 1033 | 1036 | struct NoSuchMethod { |
| 1034 | 1037 | int64_t no_such_method; |
| 1035 | 1038 | }; |
| @@ -1278,16 +1281,10 @@ struct Sbyte { | ||
| 1278 | 1281 | int64_t sbyte; |
| 1279 | 1282 | }; |
| 1280 | 1283 | |
| 1281 | -struct Sealed { | |
| 1282 | - int64_t sealed; | |
| 1283 | -}; | |
| 1284 | - | |
| 1285 | -struct Sel { | |
| 1286 | - int64_t sel; | |
| 1287 | -}; | |
| 1288 | - | |
| 1289 | 1284 | struct Obj4 { |
| 1290 | 1285 | int64_t dummy; |
| 1286 | + struct Nil * nil; | |
| 1287 | + struct No * no; | |
| 1291 | 1288 | struct NoSuchMethod * no_such_method; |
| 1292 | 1289 | struct Nonatomic * nonatomic; |
| 1293 | 1290 | struct None * none; |
| @@ -1350,8 +1347,6 @@ struct Obj4 { | ||
| 1350 | 1347 | struct RuntimeType * runtime_type; |
| 1351 | 1348 | struct S * s; |
| 1352 | 1349 | struct Sbyte * sbyte; |
| 1353 | - struct Sealed * sealed; | |
| 1354 | - struct Sel * sel; | |
| 1355 | 1350 | }; |
| 1356 | 1351 | |
| 1357 | 1352 | struct KSerializer { |
| @@ -1454,6 +1449,14 @@ struct Obj5True { | ||
| 1454 | 1449 | int64_t true_true; |
| 1455 | 1450 | }; |
| 1456 | 1451 | |
| 1452 | +struct Sealed { | |
| 1453 | + int64_t sealed; | |
| 1454 | +}; | |
| 1455 | + | |
| 1456 | +struct Sel { | |
| 1457 | + int64_t sel; | |
| 1458 | +}; | |
| 1459 | + | |
| 1457 | 1460 | struct Select { |
| 1458 | 1461 | int64_t select; |
| 1459 | 1462 | }; |
| @@ -1602,18 +1605,6 @@ struct UnmarshalJson { | ||
| 1602 | 1605 | int64_t unmarshal_json; |
| 1603 | 1606 | }; |
| 1604 | 1607 | |
| 1605 | -struct Unowned { | |
| 1606 | - int64_t unowned; | |
| 1607 | -}; | |
| 1608 | - | |
| 1609 | -struct Unsafe { | |
| 1610 | - int64_t unsafe; | |
| 1611 | -}; | |
| 1612 | - | |
| 1613 | -struct UseSerializers { | |
| 1614 | - int64_t use_serializers; | |
| 1615 | -}; | |
| 1616 | - | |
| 1617 | 1608 | struct Obj5 { |
| 1618 | 1609 | int64_t dummy; |
| 1619 | 1610 | struct KSerializer * k_serializer; |
| @@ -1641,6 +1632,8 @@ struct Obj5 { | ||
| 1641 | 1632 | struct Union * obj5_union; |
| 1642 | 1633 | struct PrimitiveKind * primitive_kind; |
| 1643 | 1634 | struct Obj5True * purple_true; |
| 1635 | + struct Sealed * sealed; | |
| 1636 | + struct Sel * sel; | |
| 1644 | 1637 | struct Select * select; |
| 1645 | 1638 | struct Self * self; |
| 1646 | 1639 | struct Sendable * sendable; |
| @@ -1678,9 +1671,6 @@ struct Obj5 { | ||
| 1678 | 1671 | struct Unchecked * unchecked; |
| 1679 | 1672 | struct Undefined * undefined; |
| 1680 | 1673 | struct UnmarshalJson * unmarshal_json; |
| 1681 | - struct Unowned * unowned; | |
| 1682 | - struct Unsafe * unsafe; | |
| 1683 | - struct UseSerializers * use_serializers; | |
| 1684 | 1674 | }; |
| 1685 | 1675 | |
| 1686 | 1676 | struct Unsigned { |
| @@ -1719,6 +1709,18 @@ struct XorEq { | ||
| 1719 | 1709 | int64_t xor_eq_xor_eq; |
| 1720 | 1710 | }; |
| 1721 | 1711 | |
| 1712 | +struct Unowned { | |
| 1713 | + int64_t unowned; | |
| 1714 | +}; | |
| 1715 | + | |
| 1716 | +struct Unsafe { | |
| 1717 | + int64_t unsafe; | |
| 1718 | +}; | |
| 1719 | + | |
| 1720 | +struct UseSerializers { | |
| 1721 | + int64_t use_serializers; | |
| 1722 | +}; | |
| 1723 | + | |
| 1722 | 1724 | struct Ushort { |
| 1723 | 1725 | int64_t ushort; |
| 1724 | 1726 | }; |
| @@ -1774,6 +1776,9 @@ struct Obj6 { | ||
| 1774 | 1776 | struct While * obj6_while; |
| 1775 | 1777 | struct Xor * obj6_xor; |
| 1776 | 1778 | struct XorEq * obj6_xor_eq; |
| 1779 | + struct Unowned * unowned; | |
| 1780 | + struct Unsafe * unsafe; | |
| 1781 | + struct UseSerializers * use_serializers; | |
| 1777 | 1782 | struct Ushort * ushort; |
| 1778 | 1783 | struct Utf8JsonReader * utf8_json_reader; |
| 1779 | 1784 | struct Utf8JsonWriter * utf8_json_writer; |
| @@ -2856,6 +2861,12 @@ cJSON * cJSON_CreateLock(const struct Lock * x); | ||
| 2856 | 2861 | char * cJSON_PrintLock(const struct Lock * x); |
| 2857 | 2862 | void cJSON_DeleteLock(struct Lock * x); |
| 2858 | 2863 | |
| 2864 | +struct MakeDictEncoder * cJSON_ParseMakeDictEncoder(const char * s); | |
| 2865 | +struct MakeDictEncoder * cJSON_GetMakeDictEncoderValue(const cJSON * j); | |
| 2866 | +cJSON * cJSON_CreateMakeDictEncoder(const struct MakeDictEncoder * x); | |
| 2867 | +char * cJSON_PrintMakeDictEncoder(const struct MakeDictEncoder * x); | |
| 2868 | +void cJSON_DeleteMakeDictEncoder(struct MakeDictEncoder * x); | |
| 2869 | + | |
| 2859 | 2870 | struct Map * cJSON_ParseMap(const char * s); |
| 2860 | 2871 | struct Map * cJSON_GetMapValue(const cJSON * j); |
| 2861 | 2872 | cJSON * cJSON_CreateMap(const struct Map * x); |
| @@ -2898,18 +2909,6 @@ cJSON * cJSON_CreateNewtonsoft(const struct Newtonsoft * x); | ||
| 2898 | 2909 | char * cJSON_PrintNewtonsoft(const struct Newtonsoft * x); |
| 2899 | 2910 | void cJSON_DeleteNewtonsoft(struct Newtonsoft * x); |
| 2900 | 2911 | |
| 2901 | -struct Nil * cJSON_ParseNil(const char * s); | |
| 2902 | -struct Nil * cJSON_GetNilValue(const cJSON * j); | |
| 2903 | -cJSON * cJSON_CreateNil(const struct Nil * x); | |
| 2904 | -char * cJSON_PrintNil(const struct Nil * x); | |
| 2905 | -void cJSON_DeleteNil(struct Nil * x); | |
| 2906 | - | |
| 2907 | -struct No * cJSON_ParseNo(const char * s); | |
| 2908 | -struct No * cJSON_GetNoValue(const cJSON * j); | |
| 2909 | -cJSON * cJSON_CreateNo(const struct No * x); | |
| 2910 | -char * cJSON_PrintNo(const struct No * x); | |
| 2911 | -void cJSON_DeleteNo(struct No * x); | |
| 2912 | - | |
| 2913 | 2912 | struct Goto * cJSON_ParseGoto(const char * s); |
| 2914 | 2913 | struct Goto * cJSON_GetGotoValue(const cJSON * j); |
| 2915 | 2914 | cJSON * cJSON_CreateGoto(const struct Goto * x); |
| @@ -2976,6 +2975,18 @@ cJSON * cJSON_CreateObj3(const struct Obj3 * x); | ||
| 2976 | 2975 | char * cJSON_PrintObj3(const struct Obj3 * x); |
| 2977 | 2976 | void cJSON_DeleteObj3(struct Obj3 * x); |
| 2978 | 2977 | |
| 2978 | +struct Nil * cJSON_ParseNil(const char * s); | |
| 2979 | +struct Nil * cJSON_GetNilValue(const cJSON * j); | |
| 2980 | +cJSON * cJSON_CreateNil(const struct Nil * x); | |
| 2981 | +char * cJSON_PrintNil(const struct Nil * x); | |
| 2982 | +void cJSON_DeleteNil(struct Nil * x); | |
| 2983 | + | |
| 2984 | +struct No * cJSON_ParseNo(const char * s); | |
| 2985 | +struct No * cJSON_GetNoValue(const cJSON * j); | |
| 2986 | +cJSON * cJSON_CreateNo(const struct No * x); | |
| 2987 | +char * cJSON_PrintNo(const struct No * x); | |
| 2988 | +void cJSON_DeleteNo(struct No * x); | |
| 2989 | + | |
| 2979 | 2990 | struct NoSuchMethod * cJSON_ParseNoSuchMethod(const char * s); |
| 2980 | 2991 | struct NoSuchMethod * cJSON_GetNoSuchMethodValue(const cJSON * j); |
| 2981 | 2992 | cJSON * cJSON_CreateNoSuchMethod(const struct NoSuchMethod * x); |
| @@ -3348,18 +3359,6 @@ cJSON * cJSON_CreateSbyte(const struct Sbyte * x); | ||
| 3348 | 3359 | char * cJSON_PrintSbyte(const struct Sbyte * x); |
| 3349 | 3360 | void cJSON_DeleteSbyte(struct Sbyte * x); |
| 3350 | 3361 | |
| 3351 | -struct Sealed * cJSON_ParseSealed(const char * s); | |
| 3352 | -struct Sealed * cJSON_GetSealedValue(const cJSON * j); | |
| 3353 | -cJSON * cJSON_CreateSealed(const struct Sealed * x); | |
| 3354 | -char * cJSON_PrintSealed(const struct Sealed * x); | |
| 3355 | -void cJSON_DeleteSealed(struct Sealed * x); | |
| 3356 | - | |
| 3357 | -struct Sel * cJSON_ParseSel(const char * s); | |
| 3358 | -struct Sel * cJSON_GetSelValue(const cJSON * j); | |
| 3359 | -cJSON * cJSON_CreateSel(const struct Sel * x); | |
| 3360 | -char * cJSON_PrintSel(const struct Sel * x); | |
| 3361 | -void cJSON_DeleteSel(struct Sel * x); | |
| 3362 | - | |
| 3363 | 3362 | struct Obj4 * cJSON_ParseObj4(const char * s); |
| 3364 | 3363 | struct Obj4 * cJSON_GetObj4Value(const cJSON * j); |
| 3365 | 3364 | cJSON * cJSON_CreateObj4(const struct Obj4 * x); |
| @@ -3516,6 +3515,18 @@ cJSON * cJSON_CreateObj5True(const struct Obj5True * x); | ||
| 3516 | 3515 | char * cJSON_PrintObj5True(const struct Obj5True * x); |
| 3517 | 3516 | void cJSON_DeleteObj5True(struct Obj5True * x); |
| 3518 | 3517 | |
| 3518 | +struct Sealed * cJSON_ParseSealed(const char * s); | |
| 3519 | +struct Sealed * cJSON_GetSealedValue(const cJSON * j); | |
| 3520 | +cJSON * cJSON_CreateSealed(const struct Sealed * x); | |
| 3521 | +char * cJSON_PrintSealed(const struct Sealed * x); | |
| 3522 | +void cJSON_DeleteSealed(struct Sealed * x); | |
| 3523 | + | |
| 3524 | +struct Sel * cJSON_ParseSel(const char * s); | |
| 3525 | +struct Sel * cJSON_GetSelValue(const cJSON * j); | |
| 3526 | +cJSON * cJSON_CreateSel(const struct Sel * x); | |
| 3527 | +char * cJSON_PrintSel(const struct Sel * x); | |
| 3528 | +void cJSON_DeleteSel(struct Sel * x); | |
| 3529 | + | |
| 3519 | 3530 | struct Select * cJSON_ParseSelect(const char * s); |
| 3520 | 3531 | struct Select * cJSON_GetSelectValue(const cJSON * j); |
| 3521 | 3532 | cJSON * cJSON_CreateSelect(const struct Select * x); |
| @@ -3738,24 +3749,6 @@ cJSON * cJSON_CreateUnmarshalJson(const struct UnmarshalJson * x); | ||
| 3738 | 3749 | char * cJSON_PrintUnmarshalJson(const struct UnmarshalJson * x); |
| 3739 | 3750 | void cJSON_DeleteUnmarshalJson(struct UnmarshalJson * x); |
| 3740 | 3751 | |
| 3741 | -struct Unowned * cJSON_ParseUnowned(const char * s); | |
| 3742 | -struct Unowned * cJSON_GetUnownedValue(const cJSON * j); | |
| 3743 | -cJSON * cJSON_CreateUnowned(const struct Unowned * x); | |
| 3744 | -char * cJSON_PrintUnowned(const struct Unowned * x); | |
| 3745 | -void cJSON_DeleteUnowned(struct Unowned * x); | |
| 3746 | - | |
| 3747 | -struct Unsafe * cJSON_ParseUnsafe(const char * s); | |
| 3748 | -struct Unsafe * cJSON_GetUnsafeValue(const cJSON * j); | |
| 3749 | -cJSON * cJSON_CreateUnsafe(const struct Unsafe * x); | |
| 3750 | -char * cJSON_PrintUnsafe(const struct Unsafe * x); | |
| 3751 | -void cJSON_DeleteUnsafe(struct Unsafe * x); | |
| 3752 | - | |
| 3753 | -struct UseSerializers * cJSON_ParseUseSerializers(const char * s); | |
| 3754 | -struct UseSerializers * cJSON_GetUseSerializersValue(const cJSON * j); | |
| 3755 | -cJSON * cJSON_CreateUseSerializers(const struct UseSerializers * x); | |
| 3756 | -char * cJSON_PrintUseSerializers(const struct UseSerializers * x); | |
| 3757 | -void cJSON_DeleteUseSerializers(struct UseSerializers * x); | |
| 3758 | - | |
| 3759 | 3752 | struct Obj5 * cJSON_ParseObj5(const char * s); |
| 3760 | 3753 | struct Obj5 * cJSON_GetObj5Value(const cJSON * j); |
| 3761 | 3754 | cJSON * cJSON_CreateObj5(const struct Obj5 * x); |
| @@ -3816,6 +3809,24 @@ cJSON * cJSON_CreateXorEq(const struct XorEq * x); | ||
| 3816 | 3809 | char * cJSON_PrintXorEq(const struct XorEq * x); |
| 3817 | 3810 | void cJSON_DeleteXorEq(struct XorEq * x); |
| 3818 | 3811 | |
| 3812 | +struct Unowned * cJSON_ParseUnowned(const char * s); | |
| 3813 | +struct Unowned * cJSON_GetUnownedValue(const cJSON * j); | |
| 3814 | +cJSON * cJSON_CreateUnowned(const struct Unowned * x); | |
| 3815 | +char * cJSON_PrintUnowned(const struct Unowned * x); | |
| 3816 | +void cJSON_DeleteUnowned(struct Unowned * x); | |
| 3817 | + | |
| 3818 | +struct Unsafe * cJSON_ParseUnsafe(const char * s); | |
| 3819 | +struct Unsafe * cJSON_GetUnsafeValue(const cJSON * j); | |
| 3820 | +cJSON * cJSON_CreateUnsafe(const struct Unsafe * x); | |
| 3821 | +char * cJSON_PrintUnsafe(const struct Unsafe * x); | |
| 3822 | +void cJSON_DeleteUnsafe(struct Unsafe * x); | |
| 3823 | + | |
| 3824 | +struct UseSerializers * cJSON_ParseUseSerializers(const char * s); | |
| 3825 | +struct UseSerializers * cJSON_GetUseSerializersValue(const cJSON * j); | |
| 3826 | +cJSON * cJSON_CreateUseSerializers(const struct UseSerializers * x); | |
| 3827 | +char * cJSON_PrintUseSerializers(const struct UseSerializers * x); | |
| 3828 | +void cJSON_DeleteUseSerializers(struct UseSerializers * x); | |
| 3829 | + | |
| 3819 | 3830 | struct Ushort * cJSON_ParseUshort(const char * s); |
| 3820 | 3831 | struct Ushort * cJSON_GetUshortValue(const cJSON * j); |
| 3821 | 3832 | cJSON * cJSON_CreateUshort(const struct Ushort * x); |
Mcplusplusdefault / quicktype.hpp+280 −245
| @@ -3137,6 +3137,20 @@ namespace quicktype { | ||
| 3137 | 3137 | void set_lock(const int64_t & value) { this->lock = value; } |
| 3138 | 3138 | }; |
| 3139 | 3139 | |
| 3140 | + class MakeDictEncoder { | |
| 3141 | + public: | |
| 3142 | + MakeDictEncoder() = default; | |
| 3143 | + virtual ~MakeDictEncoder() = default; | |
| 3144 | + | |
| 3145 | + private: | |
| 3146 | + int64_t make_dict_encoder; | |
| 3147 | + | |
| 3148 | + public: | |
| 3149 | + const int64_t & get_make_dict_encoder() const { return make_dict_encoder; } | |
| 3150 | + int64_t & get_mutable_make_dict_encoder() { return make_dict_encoder; } | |
| 3151 | + void set_make_dict_encoder(const int64_t & value) { this->make_dict_encoder = value; } | |
| 3152 | + }; | |
| 3153 | + | |
| 3140 | 3154 | class Map { |
| 3141 | 3155 | public: |
| 3142 | 3156 | Map() = default; |
| @@ -3235,34 +3249,6 @@ namespace quicktype { | ||
| 3235 | 3249 | void set_newtonsoft(const int64_t & value) { this->newtonsoft = value; } |
| 3236 | 3250 | }; |
| 3237 | 3251 | |
| 3238 | - class Nil { | |
| 3239 | - public: | |
| 3240 | - Nil() = default; | |
| 3241 | - virtual ~Nil() = default; | |
| 3242 | - | |
| 3243 | - private: | |
| 3244 | - int64_t nil; | |
| 3245 | - | |
| 3246 | - public: | |
| 3247 | - const int64_t & get_nil() const { return nil; } | |
| 3248 | - int64_t & get_mutable_nil() { return nil; } | |
| 3249 | - void set_nil(const int64_t & value) { this->nil = value; } | |
| 3250 | - }; | |
| 3251 | - | |
| 3252 | - class No { | |
| 3253 | - public: | |
| 3254 | - No() = default; | |
| 3255 | - virtual ~No() = default; | |
| 3256 | - | |
| 3257 | - private: | |
| 3258 | - int64_t no; | |
| 3259 | - | |
| 3260 | - public: | |
| 3261 | - const int64_t & get_no() const { return no; } | |
| 3262 | - int64_t & get_mutable_no() { return no; } | |
| 3263 | - void set_no(const int64_t & value) { this->no = value; } | |
| 3264 | - }; | |
| 3265 | - | |
| 3266 | 3252 | class Goto { |
| 3267 | 3253 | public: |
| 3268 | 3254 | Goto() = default; |
| @@ -3456,6 +3442,7 @@ namespace quicktype { | ||
| 3456 | 3442 | List list; |
| 3457 | 3443 | Locale locale; |
| 3458 | 3444 | Lock lock; |
| 3445 | + MakeDictEncoder make_dict_encoder; | |
| 3459 | 3446 | Map map; |
| 3460 | 3447 | MapEntry map_entry; |
| 3461 | 3448 | MarshalJson marshal_json; |
| @@ -3463,8 +3450,6 @@ namespace quicktype { | ||
| 3463 | 3450 | Mutating mutating; |
| 3464 | 3451 | Native native; |
| 3465 | 3452 | Newtonsoft newtonsoft; |
| 3466 | - Nil nil; | |
| 3467 | - No no; | |
| 3468 | 3453 | Goto obj3_goto; |
| 3469 | 3454 | If obj3_if; |
| 3470 | 3455 | Import obj3_import; |
| @@ -3665,6 +3650,10 @@ namespace quicktype { | ||
| 3665 | 3650 | Lock & get_mutable_lock() { return lock; } |
| 3666 | 3651 | void set_lock(const Lock & value) { this->lock = value; } |
| 3667 | 3652 | |
| 3653 | + const MakeDictEncoder & get_make_dict_encoder() const { return make_dict_encoder; } | |
| 3654 | + MakeDictEncoder & get_mutable_make_dict_encoder() { return make_dict_encoder; } | |
| 3655 | + void set_make_dict_encoder(const MakeDictEncoder & value) { this->make_dict_encoder = value; } | |
| 3656 | + | |
| 3668 | 3657 | const Map & get_map() const { return map; } |
| 3669 | 3658 | Map & get_mutable_map() { return map; } |
| 3670 | 3659 | void set_map(const Map & value) { this->map = value; } |
| @@ -3693,14 +3682,6 @@ namespace quicktype { | ||
| 3693 | 3682 | Newtonsoft & get_mutable_newtonsoft() { return newtonsoft; } |
| 3694 | 3683 | void set_newtonsoft(const Newtonsoft & value) { this->newtonsoft = value; } |
| 3695 | 3684 | |
| 3696 | - const Nil & get_nil() const { return nil; } | |
| 3697 | - Nil & get_mutable_nil() { return nil; } | |
| 3698 | - void set_nil(const Nil & value) { this->nil = value; } | |
| 3699 | - | |
| 3700 | - const No & get_no() const { return no; } | |
| 3701 | - No & get_mutable_no() { return no; } | |
| 3702 | - void set_no(const No & value) { this->no = value; } | |
| 3703 | - | |
| 3704 | 3685 | const Goto & get_obj3_goto() const { return obj3_goto; } |
| 3705 | 3686 | Goto & get_mutable_obj3_goto() { return obj3_goto; } |
| 3706 | 3687 | void set_obj3_goto(const Goto & value) { this->obj3_goto = value; } |
| @@ -3742,6 +3723,34 @@ namespace quicktype { | ||
| 3742 | 3723 | void set_obj3_new(const New & value) { this->obj3_new = value; } |
| 3743 | 3724 | }; |
| 3744 | 3725 | |
| 3726 | + class Nil { | |
| 3727 | + public: | |
| 3728 | + Nil() = default; | |
| 3729 | + virtual ~Nil() = default; | |
| 3730 | + | |
| 3731 | + private: | |
| 3732 | + int64_t nil; | |
| 3733 | + | |
| 3734 | + public: | |
| 3735 | + const int64_t & get_nil() const { return nil; } | |
| 3736 | + int64_t & get_mutable_nil() { return nil; } | |
| 3737 | + void set_nil(const int64_t & value) { this->nil = value; } | |
| 3738 | + }; | |
| 3739 | + | |
| 3740 | + class No { | |
| 3741 | + public: | |
| 3742 | + No() = default; | |
| 3743 | + virtual ~No() = default; | |
| 3744 | + | |
| 3745 | + private: | |
| 3746 | + int64_t no; | |
| 3747 | + | |
| 3748 | + public: | |
| 3749 | + const int64_t & get_no() const { return no; } | |
| 3750 | + int64_t & get_mutable_no() { return no; } | |
| 3751 | + void set_no(const int64_t & value) { this->no = value; } | |
| 3752 | + }; | |
| 3753 | + | |
| 3745 | 3754 | class NoSuchMethod { |
| 3746 | 3755 | public: |
| 3747 | 3756 | NoSuchMethod() = default; |
| @@ -4610,34 +4619,6 @@ namespace quicktype { | ||
| 4610 | 4619 | void set_sbyte(const int64_t & value) { this->sbyte = value; } |
| 4611 | 4620 | }; |
| 4612 | 4621 | |
| 4613 | - class Sealed { | |
| 4614 | - public: | |
| 4615 | - Sealed() = default; | |
| 4616 | - virtual ~Sealed() = default; | |
| 4617 | - | |
| 4618 | - private: | |
| 4619 | - int64_t sealed; | |
| 4620 | - | |
| 4621 | - public: | |
| 4622 | - const int64_t & get_sealed() const { return sealed; } | |
| 4623 | - int64_t & get_mutable_sealed() { return sealed; } | |
| 4624 | - void set_sealed(const int64_t & value) { this->sealed = value; } | |
| 4625 | - }; | |
| 4626 | - | |
| 4627 | - class Sel { | |
| 4628 | - public: | |
| 4629 | - Sel() = default; | |
| 4630 | - virtual ~Sel() = default; | |
| 4631 | - | |
| 4632 | - private: | |
| 4633 | - int64_t sel; | |
| 4634 | - | |
| 4635 | - public: | |
| 4636 | - const int64_t & get_sel() const { return sel; } | |
| 4637 | - int64_t & get_mutable_sel() { return sel; } | |
| 4638 | - void set_sel(const int64_t & value) { this->sel = value; } | |
| 4639 | - }; | |
| 4640 | - | |
| 4641 | 4622 | class Obj4 { |
| 4642 | 4623 | public: |
| 4643 | 4624 | Obj4() = default; |
| @@ -4645,6 +4626,8 @@ namespace quicktype { | ||
| 4645 | 4626 | |
| 4646 | 4627 | private: |
| 4647 | 4628 | int64_t dummy; |
| 4629 | + Nil nil; | |
| 4630 | + No no; | |
| 4648 | 4631 | NoSuchMethod no_such_method; |
| 4649 | 4632 | Nonatomic nonatomic; |
| 4650 | 4633 | None none; |
| @@ -4707,14 +4690,20 @@ namespace quicktype { | ||
| 4707 | 4690 | RuntimeType runtime_type; |
| 4708 | 4691 | S s; |
| 4709 | 4692 | Sbyte sbyte; |
| 4710 | - Sealed sealed; | |
| 4711 | - Sel sel; | |
| 4712 | 4693 | |
| 4713 | 4694 | public: |
| 4714 | 4695 | const int64_t & get_dummy() const { return dummy; } |
| 4715 | 4696 | int64_t & get_mutable_dummy() { return dummy; } |
| 4716 | 4697 | void set_dummy(const int64_t & value) { this->dummy = value; } |
| 4717 | 4698 | |
| 4699 | + const Nil & get_nil() const { return nil; } | |
| 4700 | + Nil & get_mutable_nil() { return nil; } | |
| 4701 | + void set_nil(const Nil & value) { this->nil = value; } | |
| 4702 | + | |
| 4703 | + const No & get_no() const { return no; } | |
| 4704 | + No & get_mutable_no() { return no; } | |
| 4705 | + void set_no(const No & value) { this->no = value; } | |
| 4706 | + | |
| 4718 | 4707 | const NoSuchMethod & get_no_such_method() const { return no_such_method; } |
| 4719 | 4708 | NoSuchMethod & get_mutable_no_such_method() { return no_such_method; } |
| 4720 | 4709 | void set_no_such_method(const NoSuchMethod & value) { this->no_such_method = value; } |
| @@ -4962,14 +4951,6 @@ namespace quicktype { | ||
| 4962 | 4951 | const Sbyte & get_sbyte() const { return sbyte; } |
| 4963 | 4952 | Sbyte & get_mutable_sbyte() { return sbyte; } |
| 4964 | 4953 | void set_sbyte(const Sbyte & value) { this->sbyte = value; } |
| 4965 | - | |
| 4966 | - const Sealed & get_sealed() const { return sealed; } | |
| 4967 | - Sealed & get_mutable_sealed() { return sealed; } | |
| 4968 | - void set_sealed(const Sealed & value) { this->sealed = value; } | |
| 4969 | - | |
| 4970 | - const Sel & get_sel() const { return sel; } | |
| 4971 | - Sel & get_mutable_sel() { return sel; } | |
| 4972 | - void set_sel(const Sel & value) { this->sel = value; } | |
| 4973 | 4954 | }; |
| 4974 | 4955 | |
| 4975 | 4956 | class KSerializer { |
| @@ -5308,6 +5289,34 @@ namespace quicktype { | ||
| 5308 | 5289 | void set_true_true(const int64_t & value) { this->true_true = value; } |
| 5309 | 5290 | }; |
| 5310 | 5291 | |
| 5292 | + class Sealed { | |
| 5293 | + public: | |
| 5294 | + Sealed() = default; | |
| 5295 | + virtual ~Sealed() = default; | |
| 5296 | + | |
| 5297 | + private: | |
| 5298 | + int64_t sealed; | |
| 5299 | + | |
| 5300 | + public: | |
| 5301 | + const int64_t & get_sealed() const { return sealed; } | |
| 5302 | + int64_t & get_mutable_sealed() { return sealed; } | |
| 5303 | + void set_sealed(const int64_t & value) { this->sealed = value; } | |
| 5304 | + }; | |
| 5305 | + | |
| 5306 | + class Sel { | |
| 5307 | + public: | |
| 5308 | + Sel() = default; | |
| 5309 | + virtual ~Sel() = default; | |
| 5310 | + | |
| 5311 | + private: | |
| 5312 | + int64_t sel; | |
| 5313 | + | |
| 5314 | + public: | |
| 5315 | + const int64_t & get_sel() const { return sel; } | |
| 5316 | + int64_t & get_mutable_sel() { return sel; } | |
| 5317 | + void set_sel(const int64_t & value) { this->sel = value; } | |
| 5318 | + }; | |
| 5319 | + | |
| 5311 | 5320 | class Select { |
| 5312 | 5321 | public: |
| 5313 | 5322 | Select() = default; |
| @@ -5840,48 +5849,6 @@ namespace quicktype { | ||
| 5840 | 5849 | void set_unmarshal_json(const int64_t & value) { this->unmarshal_json = value; } |
| 5841 | 5850 | }; |
| 5842 | 5851 | |
| 5843 | - class Unowned { | |
| 5844 | - public: | |
| 5845 | - Unowned() = default; | |
| 5846 | - virtual ~Unowned() = default; | |
| 5847 | - | |
| 5848 | - private: | |
| 5849 | - int64_t unowned; | |
| 5850 | - | |
| 5851 | - public: | |
| 5852 | - const int64_t & get_unowned() const { return unowned; } | |
| 5853 | - int64_t & get_mutable_unowned() { return unowned; } | |
| 5854 | - void set_unowned(const int64_t & value) { this->unowned = value; } | |
| 5855 | - }; | |
| 5856 | - | |
| 5857 | - class Unsafe { | |
| 5858 | - public: | |
| 5859 | - Unsafe() = default; | |
| 5860 | - virtual ~Unsafe() = default; | |
| 5861 | - | |
| 5862 | - private: | |
| 5863 | - int64_t unsafe; | |
| 5864 | - | |
| 5865 | - public: | |
| 5866 | - const int64_t & get_unsafe() const { return unsafe; } | |
| 5867 | - int64_t & get_mutable_unsafe() { return unsafe; } | |
| 5868 | - void set_unsafe(const int64_t & value) { this->unsafe = value; } | |
| 5869 | - }; | |
| 5870 | - | |
| 5871 | - class UseSerializers { | |
| 5872 | - public: | |
| 5873 | - UseSerializers() = default; | |
| 5874 | - virtual ~UseSerializers() = default; | |
| 5875 | - | |
| 5876 | - private: | |
| 5877 | - int64_t use_serializers; | |
| 5878 | - | |
| 5879 | - public: | |
| 5880 | - const int64_t & get_use_serializers() const { return use_serializers; } | |
| 5881 | - int64_t & get_mutable_use_serializers() { return use_serializers; } | |
| 5882 | - void set_use_serializers(const int64_t & value) { this->use_serializers = value; } | |
| 5883 | - }; | |
| 5884 | - | |
| 5885 | 5852 | class Obj5 { |
| 5886 | 5853 | public: |
| 5887 | 5854 | Obj5() = default; |
| @@ -5913,6 +5880,8 @@ namespace quicktype { | ||
| 5913 | 5880 | Union obj5_union; |
| 5914 | 5881 | PrimitiveKind primitive_kind; |
| 5915 | 5882 | TrueClass purple_true; |
| 5883 | + Sealed sealed; | |
| 5884 | + Sel sel; | |
| 5916 | 5885 | Select select; |
| 5917 | 5886 | Self self; |
| 5918 | 5887 | Sendable sendable; |
| @@ -5951,9 +5920,6 @@ namespace quicktype { | ||
| 5951 | 5920 | Unchecked unchecked; |
| 5952 | 5921 | Undefined undefined; |
| 5953 | 5922 | UnmarshalJson unmarshal_json; |
| 5954 | - Unowned unowned; | |
| 5955 | - Unsafe unsafe; | |
| 5956 | - UseSerializers use_serializers; | |
| 5957 | 5923 | |
| 5958 | 5924 | public: |
| 5959 | 5925 | const int64_t & get_dummy() const { return dummy; } |
| @@ -6056,6 +6022,14 @@ namespace quicktype { | ||
| 6056 | 6022 | TrueClass & get_mutable_purple_true() { return purple_true; } |
| 6057 | 6023 | void set_purple_true(const TrueClass & value) { this->purple_true = value; } |
| 6058 | 6024 | |
| 6025 | + const Sealed & get_sealed() const { return sealed; } | |
| 6026 | + Sealed & get_mutable_sealed() { return sealed; } | |
| 6027 | + void set_sealed(const Sealed & value) { this->sealed = value; } | |
| 6028 | + | |
| 6029 | + const Sel & get_sel() const { return sel; } | |
| 6030 | + Sel & get_mutable_sel() { return sel; } | |
| 6031 | + void set_sel(const Sel & value) { this->sel = value; } | |
| 6032 | + | |
| 6059 | 6033 | const Select & get_select() const { return select; } |
| 6060 | 6034 | Select & get_mutable_select() { return select; } |
| 6061 | 6035 | void set_select(const Select & value) { this->select = value; } |
| @@ -6207,18 +6181,6 @@ namespace quicktype { | ||
| 6207 | 6181 | const UnmarshalJson & get_unmarshal_json() const { return unmarshal_json; } |
| 6208 | 6182 | UnmarshalJson & get_mutable_unmarshal_json() { return unmarshal_json; } |
| 6209 | 6183 | void set_unmarshal_json(const UnmarshalJson & value) { this->unmarshal_json = value; } |
| 6210 | - | |
| 6211 | - const Unowned & get_unowned() const { return unowned; } | |
| 6212 | - Unowned & get_mutable_unowned() { return unowned; } | |
| 6213 | - void set_unowned(const Unowned & value) { this->unowned = value; } | |
| 6214 | - | |
| 6215 | - const Unsafe & get_unsafe() const { return unsafe; } | |
| 6216 | - Unsafe & get_mutable_unsafe() { return unsafe; } | |
| 6217 | - void set_unsafe(const Unsafe & value) { this->unsafe = value; } | |
| 6218 | - | |
| 6219 | - const UseSerializers & get_use_serializers() const { return use_serializers; } | |
| 6220 | - UseSerializers & get_mutable_use_serializers() { return use_serializers; } | |
| 6221 | - void set_use_serializers(const UseSerializers & value) { this->use_serializers = value; } | |
| 6222 | 6184 | }; |
| 6223 | 6185 | |
| 6224 | 6186 | class Unsigned { |
| @@ -6347,6 +6309,48 @@ namespace quicktype { | ||
| 6347 | 6309 | void set_xor_eq_xor_eq(const int64_t & value) { this->xor_eq_xor_eq = value; } |
| 6348 | 6310 | }; |
| 6349 | 6311 | |
| 6312 | + class Unowned { | |
| 6313 | + public: | |
| 6314 | + Unowned() = default; | |
| 6315 | + virtual ~Unowned() = default; | |
| 6316 | + | |
| 6317 | + private: | |
| 6318 | + int64_t unowned; | |
| 6319 | + | |
| 6320 | + public: | |
| 6321 | + const int64_t & get_unowned() const { return unowned; } | |
| 6322 | + int64_t & get_mutable_unowned() { return unowned; } | |
| 6323 | + void set_unowned(const int64_t & value) { this->unowned = value; } | |
| 6324 | + }; | |
| 6325 | + | |
| 6326 | + class Unsafe { | |
| 6327 | + public: | |
| 6328 | + Unsafe() = default; | |
| 6329 | + virtual ~Unsafe() = default; | |
| 6330 | + | |
| 6331 | + private: | |
| 6332 | + int64_t unsafe; | |
| 6333 | + | |
| 6334 | + public: | |
| 6335 | + const int64_t & get_unsafe() const { return unsafe; } | |
| 6336 | + int64_t & get_mutable_unsafe() { return unsafe; } | |
| 6337 | + void set_unsafe(const int64_t & value) { this->unsafe = value; } | |
| 6338 | + }; | |
| 6339 | + | |
| 6340 | + class UseSerializers { | |
| 6341 | + public: | |
| 6342 | + UseSerializers() = default; | |
| 6343 | + virtual ~UseSerializers() = default; | |
| 6344 | + | |
| 6345 | + private: | |
| 6346 | + int64_t use_serializers; | |
| 6347 | + | |
| 6348 | + public: | |
| 6349 | + const int64_t & get_use_serializers() const { return use_serializers; } | |
| 6350 | + int64_t & get_mutable_use_serializers() { return use_serializers; } | |
| 6351 | + void set_use_serializers(const int64_t & value) { this->use_serializers = value; } | |
| 6352 | + }; | |
| 6353 | + | |
| 6350 | 6354 | class Ushort { |
| 6351 | 6355 | public: |
| 6352 | 6356 | Ushort() = default; |
| @@ -6517,6 +6521,9 @@ namespace quicktype { | ||
| 6517 | 6521 | While obj6_while; |
| 6518 | 6522 | Xor obj6_xor; |
| 6519 | 6523 | XorEq obj6_xor_eq; |
| 6524 | + Unowned unowned; | |
| 6525 | + Unsafe unsafe; | |
| 6526 | + UseSerializers use_serializers; | |
| 6520 | 6527 | Ushort ushort; |
| 6521 | 6528 | Utf8JsonReader utf8_json_reader; |
| 6522 | 6529 | Utf8JsonWriter utf8_json_writer; |
| @@ -6570,6 +6577,18 @@ namespace quicktype { | ||
| 6570 | 6577 | XorEq & get_mutable_obj6_xor_eq() { return obj6_xor_eq; } |
| 6571 | 6578 | void set_obj6_xor_eq(const XorEq & value) { this->obj6_xor_eq = value; } |
| 6572 | 6579 | |
| 6580 | + const Unowned & get_unowned() const { return unowned; } | |
| 6581 | + Unowned & get_mutable_unowned() { return unowned; } | |
| 6582 | + void set_unowned(const Unowned & value) { this->unowned = value; } | |
| 6583 | + | |
| 6584 | + const Unsafe & get_unsafe() const { return unsafe; } | |
| 6585 | + Unsafe & get_mutable_unsafe() { return unsafe; } | |
| 6586 | + void set_unsafe(const Unsafe & value) { this->unsafe = value; } | |
| 6587 | + | |
| 6588 | + const UseSerializers & get_use_serializers() const { return use_serializers; } | |
| 6589 | + UseSerializers & get_mutable_use_serializers() { return use_serializers; } | |
| 6590 | + void set_use_serializers(const UseSerializers & value) { this->use_serializers = value; } | |
| 6591 | + | |
| 6573 | 6592 | const Ushort & get_ushort() const { return ushort; } |
| 6574 | 6593 | Ushort & get_mutable_ushort() { return ushort; } |
| 6575 | 6594 | void set_ushort(const Ushort & value) { this->ushort = value; } |
| @@ -7189,6 +7208,9 @@ namespace quicktype { | ||
| 7189 | 7208 | void from_json(const json & j, Lock & x); |
| 7190 | 7209 | void to_json(json & j, const Lock & x); |
| 7191 | 7210 | |
| 7211 | + void from_json(const json & j, MakeDictEncoder & x); | |
| 7212 | + void to_json(json & j, const MakeDictEncoder & x); | |
| 7213 | + | |
| 7192 | 7214 | void from_json(const json & j, Map & x); |
| 7193 | 7215 | void to_json(json & j, const Map & x); |
| 7194 | 7216 | |
| @@ -7210,12 +7232,6 @@ namespace quicktype { | ||
| 7210 | 7232 | void from_json(const json & j, Newtonsoft & x); |
| 7211 | 7233 | void to_json(json & j, const Newtonsoft & x); |
| 7212 | 7234 | |
| 7213 | - void from_json(const json & j, Nil & x); | |
| 7214 | - void to_json(json & j, const Nil & x); | |
| 7215 | - | |
| 7216 | - void from_json(const json & j, No & x); | |
| 7217 | - void to_json(json & j, const No & x); | |
| 7218 | - | |
| 7219 | 7235 | void from_json(const json & j, Goto & x); |
| 7220 | 7236 | void to_json(json & j, const Goto & x); |
| 7221 | 7237 | |
| @@ -7249,6 +7265,12 @@ namespace quicktype { | ||
| 7249 | 7265 | void from_json(const json & j, Obj3 & x); |
| 7250 | 7266 | void to_json(json & j, const Obj3 & x); |
| 7251 | 7267 | |
| 7268 | + void from_json(const json & j, Nil & x); | |
| 7269 | + void to_json(json & j, const Nil & x); | |
| 7270 | + | |
| 7271 | + void from_json(const json & j, No & x); | |
| 7272 | + void to_json(json & j, const No & x); | |
| 7273 | + | |
| 7252 | 7274 | void from_json(const json & j, NoSuchMethod & x); |
| 7253 | 7275 | void to_json(json & j, const NoSuchMethod & x); |
| 7254 | 7276 | |
| @@ -7435,12 +7457,6 @@ namespace quicktype { | ||
| 7435 | 7457 | void from_json(const json & j, Sbyte & x); |
| 7436 | 7458 | void to_json(json & j, const Sbyte & x); |
| 7437 | 7459 | |
| 7438 | - void from_json(const json & j, Sealed & x); | |
| 7439 | - void to_json(json & j, const Sealed & x); | |
| 7440 | - | |
| 7441 | - void from_json(const json & j, Sel & x); | |
| 7442 | - void to_json(json & j, const Sel & x); | |
| 7443 | - | |
| 7444 | 7460 | void from_json(const json & j, Obj4 & x); |
| 7445 | 7461 | void to_json(json & j, const Obj4 & x); |
| 7446 | 7462 | |
| @@ -7516,6 +7532,12 @@ namespace quicktype { | ||
| 7516 | 7532 | void from_json(const json & j, TrueClass & x); |
| 7517 | 7533 | void to_json(json & j, const TrueClass & x); |
| 7518 | 7534 | |
| 7535 | + void from_json(const json & j, Sealed & x); | |
| 7536 | + void to_json(json & j, const Sealed & x); | |
| 7537 | + | |
| 7538 | + void from_json(const json & j, Sel & x); | |
| 7539 | + void to_json(json & j, const Sel & x); | |
| 7540 | + | |
| 7519 | 7541 | void from_json(const json & j, Select & x); |
| 7520 | 7542 | void to_json(json & j, const Select & x); |
| 7521 | 7543 | |
| @@ -7630,15 +7652,6 @@ namespace quicktype { | ||
| 7630 | 7652 | void from_json(const json & j, UnmarshalJson & x); |
| 7631 | 7653 | void to_json(json & j, const UnmarshalJson & x); |
| 7632 | 7654 | |
| 7633 | - void from_json(const json & j, Unowned & x); | |
| 7634 | - void to_json(json & j, const Unowned & x); | |
| 7635 | - | |
| 7636 | - void from_json(const json & j, Unsafe & x); | |
| 7637 | - void to_json(json & j, const Unsafe & x); | |
| 7638 | - | |
| 7639 | - void from_json(const json & j, UseSerializers & x); | |
| 7640 | - void to_json(json & j, const UseSerializers & x); | |
| 7641 | - | |
| 7642 | 7655 | void from_json(const json & j, Obj5 & x); |
| 7643 | 7656 | void to_json(json & j, const Obj5 & x); |
| 7644 | 7657 | |
| @@ -7669,6 +7682,15 @@ namespace quicktype { | ||
| 7669 | 7682 | void from_json(const json & j, XorEq & x); |
| 7670 | 7683 | void to_json(json & j, const XorEq & x); |
| 7671 | 7684 | |
| 7685 | + void from_json(const json & j, Unowned & x); | |
| 7686 | + void to_json(json & j, const Unowned & x); | |
| 7687 | + | |
| 7688 | + void from_json(const json & j, Unsafe & x); | |
| 7689 | + void to_json(json & j, const Unsafe & x); | |
| 7690 | + | |
| 7691 | + void from_json(const json & j, UseSerializers & x); | |
| 7692 | + void to_json(json & j, const UseSerializers & x); | |
| 7693 | + | |
| 7672 | 7694 | void from_json(const json & j, Ushort & x); |
| 7673 | 7695 | void to_json(json & j, const Ushort & x); |
| 7674 | 7696 | |
| @@ -9901,6 +9923,17 @@ namespace quicktype { | ||
| 9901 | 9923 | j["lock"] = x.get_lock(); |
| 9902 | 9924 | } |
| 9903 | 9925 | |
| 9926 | + inline void from_json(const json & j, MakeDictEncoder& x) { | |
| 9927 | + if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 9928 | + if (j.find("makeDictEncoder") != j.end() && !j.at("makeDictEncoder").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 9929 | + x.set_make_dict_encoder(j.at("makeDictEncoder").get<int64_t>()); | |
| 9930 | + } | |
| 9931 | + | |
| 9932 | + inline void to_json(json & j, const MakeDictEncoder & x) { | |
| 9933 | + j = json::object(); | |
| 9934 | + j["makeDictEncoder"] = x.get_make_dict_encoder(); | |
| 9935 | + } | |
| 9936 | + | |
| 9904 | 9937 | inline void from_json(const json & j, Map& x) { |
| 9905 | 9938 | if (!j.is_object()) throw std::runtime_error("Expected object"); |
| 9906 | 9939 | if (j.find("map") != j.end() && !j.at("map").is_number_integer()) throw std::runtime_error("Expected integer"); |
| @@ -9978,28 +10011,6 @@ namespace quicktype { | ||
| 9978 | 10011 | j["newtonsoft"] = x.get_newtonsoft(); |
| 9979 | 10012 | } |
| 9980 | 10013 | |
| 9981 | - inline void from_json(const json & j, Nil& x) { | |
| 9982 | - if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 9983 | - if (j.find("nil") != j.end() && !j.at("nil").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 9984 | - x.set_nil(j.at("nil").get<int64_t>()); | |
| 9985 | - } | |
| 9986 | - | |
| 9987 | - inline void to_json(json & j, const Nil & x) { | |
| 9988 | - j = json::object(); | |
| 9989 | - j["nil"] = x.get_nil(); | |
| 9990 | - } | |
| 9991 | - | |
| 9992 | - inline void from_json(const json & j, No& x) { | |
| 9993 | - if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 9994 | - if (j.find("NO") != j.end() && !j.at("NO").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 9995 | - x.set_no(j.at("NO").get<int64_t>()); | |
| 9996 | - } | |
| 9997 | - | |
| 9998 | - inline void to_json(json & j, const No & x) { | |
| 9999 | - j = json::object(); | |
| 10000 | - j["NO"] = x.get_no(); | |
| 10001 | - } | |
| 10002 | - | |
| 10003 | 10014 | inline void from_json(const json & j, Goto& x) { |
| 10004 | 10015 | if (!j.is_object()) throw std::runtime_error("Expected object"); |
| 10005 | 10016 | if (j.find("goto") != j.end() && !j.at("goto").is_number_integer()) throw std::runtime_error("Expected integer"); |
| @@ -10160,6 +10171,7 @@ namespace quicktype { | ||
| 10160 | 10171 | x.set_list(j.at("list").get<List>()); |
| 10161 | 10172 | x.set_locale(j.at("Locale").get<Locale>()); |
| 10162 | 10173 | x.set_lock(j.at("lock").get<Lock>()); |
| 10174 | + x.set_make_dict_encoder(j.at("makeDictEncoder").get<MakeDictEncoder>()); | |
| 10163 | 10175 | x.set_map(j.at("map").get<Map>()); |
| 10164 | 10176 | x.set_map_entry(j.at("MapEntry").get<MapEntry>()); |
| 10165 | 10177 | x.set_marshal_json(j.at("MarshalJSON").get<MarshalJson>()); |
| @@ -10167,8 +10179,6 @@ namespace quicktype { | ||
| 10167 | 10179 | x.set_mutating(j.at("mutating").get<Mutating>()); |
| 10168 | 10180 | x.set_native(j.at("native").get<Native>()); |
| 10169 | 10181 | x.set_newtonsoft(j.at("newtonsoft").get<Newtonsoft>()); |
| 10170 | - x.set_nil(j.at("nil").get<Nil>()); | |
| 10171 | - x.set_no(j.at("NO").get<No>()); | |
| 10172 | 10182 | x.set_obj3_goto(j.at("goto").get<Goto>()); |
| 10173 | 10183 | x.set_obj3_if(j.at("if").get<If>()); |
| 10174 | 10184 | x.set_obj3_import(j.at("import").get<Import>()); |
| @@ -10230,6 +10240,7 @@ namespace quicktype { | ||
| 10230 | 10240 | j["list"] = x.get_list(); |
| 10231 | 10241 | j["Locale"] = x.get_locale(); |
| 10232 | 10242 | j["lock"] = x.get_lock(); |
| 10243 | + j["makeDictEncoder"] = x.get_make_dict_encoder(); | |
| 10233 | 10244 | j["map"] = x.get_map(); |
| 10234 | 10245 | j["MapEntry"] = x.get_map_entry(); |
| 10235 | 10246 | j["MarshalJSON"] = x.get_marshal_json(); |
| @@ -10237,8 +10248,6 @@ namespace quicktype { | ||
| 10237 | 10248 | j["mutating"] = x.get_mutating(); |
| 10238 | 10249 | j["native"] = x.get_native(); |
| 10239 | 10250 | j["newtonsoft"] = x.get_newtonsoft(); |
| 10240 | - j["nil"] = x.get_nil(); | |
| 10241 | - j["NO"] = x.get_no(); | |
| 10242 | 10251 | j["goto"] = x.get_obj3_goto(); |
| 10243 | 10252 | j["if"] = x.get_obj3_if(); |
| 10244 | 10253 | j["import"] = x.get_obj3_import(); |
| @@ -10251,6 +10260,28 @@ namespace quicktype { | ||
| 10251 | 10260 | j["new"] = x.get_obj3_new(); |
| 10252 | 10261 | } |
| 10253 | 10262 | |
| 10263 | + inline void from_json(const json & j, Nil& x) { | |
| 10264 | + if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 10265 | + if (j.find("nil") != j.end() && !j.at("nil").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 10266 | + x.set_nil(j.at("nil").get<int64_t>()); | |
| 10267 | + } | |
| 10268 | + | |
| 10269 | + inline void to_json(json & j, const Nil & x) { | |
| 10270 | + j = json::object(); | |
| 10271 | + j["nil"] = x.get_nil(); | |
| 10272 | + } | |
| 10273 | + | |
| 10274 | + inline void from_json(const json & j, No& x) { | |
| 10275 | + if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 10276 | + if (j.find("NO") != j.end() && !j.at("NO").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 10277 | + x.set_no(j.at("NO").get<int64_t>()); | |
| 10278 | + } | |
| 10279 | + | |
| 10280 | + inline void to_json(json & j, const No & x) { | |
| 10281 | + j = json::object(); | |
| 10282 | + j["NO"] = x.get_no(); | |
| 10283 | + } | |
| 10284 | + | |
| 10254 | 10285 | inline void from_json(const json & j, NoSuchMethod& x) { |
| 10255 | 10286 | if (!j.is_object()) throw std::runtime_error("Expected object"); |
| 10256 | 10287 | if (j.find("noSuchMethod") != j.end() && !j.at("noSuchMethod").is_number_integer()) throw std::runtime_error("Expected integer"); |
| @@ -10933,32 +10964,12 @@ namespace quicktype { | ||
| 10933 | 10964 | j["sbyte"] = x.get_sbyte(); |
| 10934 | 10965 | } |
| 10935 | 10966 | |
| 10936 | - inline void from_json(const json & j, Sealed& x) { | |
| 10937 | - if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 10938 | - if (j.find("sealed") != j.end() && !j.at("sealed").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 10939 | - x.set_sealed(j.at("sealed").get<int64_t>()); | |
| 10940 | - } | |
| 10941 | - | |
| 10942 | - inline void to_json(json & j, const Sealed & x) { | |
| 10943 | - j = json::object(); | |
| 10944 | - j["sealed"] = x.get_sealed(); | |
| 10945 | - } | |
| 10946 | - | |
| 10947 | - inline void from_json(const json & j, Sel& x) { | |
| 10948 | - if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 10949 | - if (j.find("SEL") != j.end() && !j.at("SEL").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 10950 | - x.set_sel(j.at("SEL").get<int64_t>()); | |
| 10951 | - } | |
| 10952 | - | |
| 10953 | - inline void to_json(json & j, const Sel & x) { | |
| 10954 | - j = json::object(); | |
| 10955 | - j["SEL"] = x.get_sel(); | |
| 10956 | - } | |
| 10957 | - | |
| 10958 | 10967 | inline void from_json(const json & j, Obj4& x) { |
| 10959 | 10968 | if (!j.is_object()) throw std::runtime_error("Expected object"); |
| 10960 | 10969 | if (j.find("dummy") != j.end() && !j.at("dummy").is_number_integer()) throw std::runtime_error("Expected integer"); |
| 10961 | 10970 | x.set_dummy(j.at("dummy").get<int64_t>()); |
| 10971 | + x.set_nil(j.at("nil").get<Nil>()); | |
| 10972 | + x.set_no(j.at("NO").get<No>()); | |
| 10962 | 10973 | x.set_no_such_method(j.at("noSuchMethod").get<NoSuchMethod>()); |
| 10963 | 10974 | x.set_nonatomic(j.at("nonatomic").get<Nonatomic>()); |
| 10964 | 10975 | x.set_none(j.at("None").get<None>()); |
| @@ -11021,13 +11032,13 @@ namespace quicktype { | ||
| 11021 | 11032 | x.set_runtime_type(j.at("runtimeType").get<RuntimeType>()); |
| 11022 | 11033 | x.set_s(j.at("s").get<S>()); |
| 11023 | 11034 | x.set_sbyte(j.at("sbyte").get<Sbyte>()); |
| 11024 | - x.set_sealed(j.at("sealed").get<Sealed>()); | |
| 11025 | - x.set_sel(j.at("SEL").get<Sel>()); | |
| 11026 | 11035 | } |
| 11027 | 11036 | |
| 11028 | 11037 | inline void to_json(json & j, const Obj4 & x) { |
| 11029 | 11038 | j = json::object(); |
| 11030 | 11039 | j["dummy"] = x.get_dummy(); |
| 11040 | + j["nil"] = x.get_nil(); | |
| 11041 | + j["NO"] = x.get_no(); | |
| 11031 | 11042 | j["noSuchMethod"] = x.get_no_such_method(); |
| 11032 | 11043 | j["nonatomic"] = x.get_nonatomic(); |
| 11033 | 11044 | j["None"] = x.get_none(); |
| @@ -11090,8 +11101,6 @@ namespace quicktype { | ||
| 11090 | 11101 | j["runtimeType"] = x.get_runtime_type(); |
| 11091 | 11102 | j["s"] = x.get_s(); |
| 11092 | 11103 | j["sbyte"] = x.get_sbyte(); |
| 11093 | - j["sealed"] = x.get_sealed(); | |
| 11094 | - j["SEL"] = x.get_sel(); | |
| 11095 | 11104 | } |
| 11096 | 11105 | |
| 11097 | 11106 | inline void from_json(const json & j, KSerializer& x) { |
| @@ -11358,6 +11367,28 @@ namespace quicktype { | ||
| 11358 | 11367 | j["true"] = x.get_true_true(); |
| 11359 | 11368 | } |
| 11360 | 11369 | |
| 11370 | + inline void from_json(const json & j, Sealed& x) { | |
| 11371 | + if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 11372 | + if (j.find("sealed") != j.end() && !j.at("sealed").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 11373 | + x.set_sealed(j.at("sealed").get<int64_t>()); | |
| 11374 | + } | |
| 11375 | + | |
| 11376 | + inline void to_json(json & j, const Sealed & x) { | |
| 11377 | + j = json::object(); | |
| 11378 | + j["sealed"] = x.get_sealed(); | |
| 11379 | + } | |
| 11380 | + | |
| 11381 | + inline void from_json(const json & j, Sel& x) { | |
| 11382 | + if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 11383 | + if (j.find("SEL") != j.end() && !j.at("SEL").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 11384 | + x.set_sel(j.at("SEL").get<int64_t>()); | |
| 11385 | + } | |
| 11386 | + | |
| 11387 | + inline void to_json(json & j, const Sel & x) { | |
| 11388 | + j = json::object(); | |
| 11389 | + j["SEL"] = x.get_sel(); | |
| 11390 | + } | |
| 11391 | + | |
| 11361 | 11392 | inline void from_json(const json & j, Select& x) { |
| 11362 | 11393 | if (!j.is_object()) throw std::runtime_error("Expected object"); |
| 11363 | 11394 | if (j.find("select") != j.end() && !j.at("select").is_number_integer()) throw std::runtime_error("Expected integer"); |
| @@ -11776,39 +11807,6 @@ namespace quicktype { | ||
| 11776 | 11807 | j["UnmarshalJSON"] = x.get_unmarshal_json(); |
| 11777 | 11808 | } |
| 11778 | 11809 | |
| 11779 | - inline void from_json(const json & j, Unowned& x) { | |
| 11780 | - if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 11781 | - if (j.find("unowned") != j.end() && !j.at("unowned").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 11782 | - x.set_unowned(j.at("unowned").get<int64_t>()); | |
| 11783 | - } | |
| 11784 | - | |
| 11785 | - inline void to_json(json & j, const Unowned & x) { | |
| 11786 | - j = json::object(); | |
| 11787 | - j["unowned"] = x.get_unowned(); | |
| 11788 | - } | |
| 11789 | - | |
| 11790 | - inline void from_json(const json & j, Unsafe& x) { | |
| 11791 | - if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 11792 | - if (j.find("unsafe") != j.end() && !j.at("unsafe").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 11793 | - x.set_unsafe(j.at("unsafe").get<int64_t>()); | |
| 11794 | - } | |
| 11795 | - | |
| 11796 | - inline void to_json(json & j, const Unsafe & x) { | |
| 11797 | - j = json::object(); | |
| 11798 | - j["unsafe"] = x.get_unsafe(); | |
| 11799 | - } | |
| 11800 | - | |
| 11801 | - inline void from_json(const json & j, UseSerializers& x) { | |
| 11802 | - if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 11803 | - if (j.find("UseSerializers") != j.end() && !j.at("UseSerializers").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 11804 | - x.set_use_serializers(j.at("UseSerializers").get<int64_t>()); | |
| 11805 | - } | |
| 11806 | - | |
| 11807 | - inline void to_json(json & j, const UseSerializers & x) { | |
| 11808 | - j = json::object(); | |
| 11809 | - j["UseSerializers"] = x.get_use_serializers(); | |
| 11810 | - } | |
| 11811 | - | |
| 11812 | 11810 | inline void from_json(const json & j, Obj5& x) { |
| 11813 | 11811 | if (!j.is_object()) throw std::runtime_error("Expected object"); |
| 11814 | 11812 | if (j.find("dummy") != j.end() && !j.at("dummy").is_number_integer()) throw std::runtime_error("Expected integer"); |
| @@ -11837,6 +11835,8 @@ namespace quicktype { | ||
| 11837 | 11835 | x.set_obj5_union(j.at("union").get<Union>()); |
| 11838 | 11836 | x.set_primitive_kind(j.at("PrimitiveKind").get<PrimitiveKind>()); |
| 11839 | 11837 | x.set_purple_true(j.at("true").get<TrueClass>()); |
| 11838 | + x.set_sealed(j.at("sealed").get<Sealed>()); | |
| 11839 | + x.set_sel(j.at("SEL").get<Sel>()); | |
| 11840 | 11840 | x.set_select(j.at("select").get<Select>()); |
| 11841 | 11841 | x.set_self(j.at("Self").get<Self>()); |
| 11842 | 11842 | x.set_sendable(j.at("Sendable").get<Sendable>()); |
| @@ -11875,9 +11875,6 @@ namespace quicktype { | ||
| 11875 | 11875 | x.set_unchecked(j.at("unchecked").get<Unchecked>()); |
| 11876 | 11876 | x.set_undefined(j.at("undefined").get<Undefined>()); |
| 11877 | 11877 | x.set_unmarshal_json(j.at("UnmarshalJSON").get<UnmarshalJson>()); |
| 11878 | - x.set_unowned(j.at("unowned").get<Unowned>()); | |
| 11879 | - x.set_unsafe(j.at("unsafe").get<Unsafe>()); | |
| 11880 | - x.set_use_serializers(j.at("UseSerializers").get<UseSerializers>()); | |
| 11881 | 11878 | } |
| 11882 | 11879 | |
| 11883 | 11880 | inline void to_json(json & j, const Obj5 & x) { |
| @@ -11907,6 +11904,8 @@ namespace quicktype { | ||
| 11907 | 11904 | j["union"] = x.get_obj5_union(); |
| 11908 | 11905 | j["PrimitiveKind"] = x.get_primitive_kind(); |
| 11909 | 11906 | j["true"] = x.get_purple_true(); |
| 11907 | + j["sealed"] = x.get_sealed(); | |
| 11908 | + j["SEL"] = x.get_sel(); | |
| 11910 | 11909 | j["select"] = x.get_select(); |
| 11911 | 11910 | j["Self"] = x.get_self(); |
| 11912 | 11911 | j["Sendable"] = x.get_sendable(); |
| @@ -11945,9 +11944,6 @@ namespace quicktype { | ||
| 11945 | 11944 | j["unchecked"] = x.get_unchecked(); |
| 11946 | 11945 | j["undefined"] = x.get_undefined(); |
| 11947 | 11946 | j["UnmarshalJSON"] = x.get_unmarshal_json(); |
| 11948 | - j["unowned"] = x.get_unowned(); | |
| 11949 | - j["unsafe"] = x.get_unsafe(); | |
| 11950 | - j["UseSerializers"] = x.get_use_serializers(); | |
| 11951 | 11947 | } |
| 11952 | 11948 | |
| 11953 | 11949 | inline void from_json(const json & j, Unsigned& x) { |
| @@ -12049,6 +12045,39 @@ namespace quicktype { | ||
| 12049 | 12045 | j["xor_eq"] = x.get_xor_eq_xor_eq(); |
| 12050 | 12046 | } |
| 12051 | 12047 | |
| 12048 | + inline void from_json(const json & j, Unowned& x) { | |
| 12049 | + if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 12050 | + if (j.find("unowned") != j.end() && !j.at("unowned").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 12051 | + x.set_unowned(j.at("unowned").get<int64_t>()); | |
| 12052 | + } | |
| 12053 | + | |
| 12054 | + inline void to_json(json & j, const Unowned & x) { | |
| 12055 | + j = json::object(); | |
| 12056 | + j["unowned"] = x.get_unowned(); | |
| 12057 | + } | |
| 12058 | + | |
| 12059 | + inline void from_json(const json & j, Unsafe& x) { | |
| 12060 | + if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 12061 | + if (j.find("unsafe") != j.end() && !j.at("unsafe").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 12062 | + x.set_unsafe(j.at("unsafe").get<int64_t>()); | |
| 12063 | + } | |
| 12064 | + | |
| 12065 | + inline void to_json(json & j, const Unsafe & x) { | |
| 12066 | + j = json::object(); | |
| 12067 | + j["unsafe"] = x.get_unsafe(); | |
| 12068 | + } | |
| 12069 | + | |
| 12070 | + inline void from_json(const json & j, UseSerializers& x) { | |
| 12071 | + if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 12072 | + if (j.find("UseSerializers") != j.end() && !j.at("UseSerializers").is_number_integer()) throw std::runtime_error("Expected integer"); | |
| 12073 | + x.set_use_serializers(j.at("UseSerializers").get<int64_t>()); | |
| 12074 | + } | |
| 12075 | + | |
| 12076 | + inline void to_json(json & j, const UseSerializers & x) { | |
| 12077 | + j = json::object(); | |
| 12078 | + j["UseSerializers"] = x.get_use_serializers(); | |
| 12079 | + } | |
| 12080 | + | |
| 12052 | 12081 | inline void from_json(const json & j, Ushort& x) { |
| 12053 | 12082 | if (!j.is_object()) throw std::runtime_error("Expected object"); |
| 12054 | 12083 | if (j.find("ushort") != j.end() && !j.at("ushort").is_number_integer()) throw std::runtime_error("Expected integer"); |
| @@ -12183,6 +12212,9 @@ namespace quicktype { | ||
| 12183 | 12212 | x.set_obj6_while(j.at("while").get<While>()); |
| 12184 | 12213 | x.set_obj6_xor(j.at("xor").get<Xor>()); |
| 12185 | 12214 | x.set_obj6_xor_eq(j.at("xor_eq").get<XorEq>()); |
| 12215 | + x.set_unowned(j.at("unowned").get<Unowned>()); | |
| 12216 | + x.set_unsafe(j.at("unsafe").get<Unsafe>()); | |
| 12217 | + x.set_use_serializers(j.at("UseSerializers").get<UseSerializers>()); | |
| 12186 | 12218 | x.set_ushort(j.at("ushort").get<Ushort>()); |
| 12187 | 12219 | x.set_utf8_json_reader(j.at("Utf8JsonReader").get<Utf8JsonReader>()); |
| 12188 | 12220 | x.set_utf8_json_writer(j.at("Utf8JsonWriter").get<Utf8JsonWriter>()); |
| @@ -12208,6 +12240,9 @@ namespace quicktype { | ||
| 12208 | 12240 | j["while"] = x.get_obj6_while(); |
| 12209 | 12241 | j["xor"] = x.get_obj6_xor(); |
| 12210 | 12242 | j["xor_eq"] = x.get_obj6_xor_eq(); |
| 12243 | + j["unowned"] = x.get_unowned(); | |
| 12244 | + j["unsafe"] = x.get_unsafe(); | |
| 12245 | + j["UseSerializers"] = x.get_use_serializers(); | |
| 12211 | 12246 | j["ushort"] = x.get_ushort(); |
| 12212 | 12247 | j["Utf8JsonReader"] = x.get_utf8_json_reader(); |
| 12213 | 12248 | j["Utf8JsonWriter"] = x.get_utf8_json_writer(); |
Mcrystaldefault / TopLevel.cr+72 −62
| @@ -1255,6 +1255,9 @@ class Obj3 | ||
| 1255 | 1255 | |
| 1256 | 1256 | property long : Long |
| 1257 | 1257 | |
| 1258 | + @[JSON::Field(key: "makeDictEncoder")] | |
| 1259 | + property make_dict_encoder : MakeDictEncoder | |
| 1260 | + | |
| 1258 | 1261 | property map : Map |
| 1259 | 1262 | |
| 1260 | 1263 | @[JSON::Field(key: "MapEntry")] |
| @@ -1277,9 +1280,6 @@ class Obj3 | ||
| 1277 | 1280 | |
| 1278 | 1281 | property newtonsoft : Newtonsoft |
| 1279 | 1282 | |
| 1280 | - @[JSON::Field(key: "NO")] | |
| 1281 | - property no : No | |
| 1282 | - | |
| 1283 | 1283 | @[JSON::Field(key: "if")] |
| 1284 | 1284 | property obj3_if : If |
| 1285 | 1285 | |
| @@ -1288,9 +1288,6 @@ class Obj3 | ||
| 1288 | 1288 | |
| 1289 | 1289 | @[JSON::Field(key: "module")] |
| 1290 | 1290 | property obj3_module : Module |
| 1291 | - | |
| 1292 | - @[JSON::Field(key: "nil")] | |
| 1293 | - property obj3_nil : NilClass | |
| 1294 | 1291 | end |
| 1295 | 1292 | |
| 1296 | 1293 | class Goto |
| @@ -1611,6 +1608,13 @@ class Long | ||
| 1611 | 1608 | property long : Int64 |
| 1612 | 1609 | end |
| 1613 | 1610 | |
| 1611 | +class MakeDictEncoder | |
| 1612 | + include JSON::Serializable | |
| 1613 | + | |
| 1614 | + @[JSON::Field(key: "makeDictEncoder")] | |
| 1615 | + property make_dict_encoder : Int64 | |
| 1616 | +end | |
| 1617 | + | |
| 1614 | 1618 | class Map |
| 1615 | 1619 | include JSON::Serializable |
| 1616 | 1620 | |
| @@ -1673,13 +1677,6 @@ class Newtonsoft | ||
| 1673 | 1677 | property newtonsoft : Int64 |
| 1674 | 1678 | end |
| 1675 | 1679 | |
| 1676 | -class No | |
| 1677 | - include JSON::Serializable | |
| 1678 | - | |
| 1679 | - @[JSON::Field(key: "NO")] | |
| 1680 | - property no : Int64 | |
| 1681 | -end | |
| 1682 | - | |
| 1683 | 1680 | class If |
| 1684 | 1681 | include JSON::Serializable |
| 1685 | 1682 | |
| @@ -1701,18 +1698,14 @@ class Module | ||
| 1701 | 1698 | property module_module : Int64 |
| 1702 | 1699 | end |
| 1703 | 1700 | |
| 1704 | -class NilClass | |
| 1705 | - include JSON::Serializable | |
| 1706 | - | |
| 1707 | - @[JSON::Field(key: "nil")] | |
| 1708 | - property nil_nil : Int64 | |
| 1709 | -end | |
| 1710 | - | |
| 1711 | 1701 | class Obj4 |
| 1712 | 1702 | include JSON::Serializable |
| 1713 | 1703 | |
| 1714 | 1704 | property dummy : Int64 |
| 1715 | 1705 | |
| 1706 | + @[JSON::Field(key: "NO")] | |
| 1707 | + property no : No | |
| 1708 | + | |
| 1716 | 1709 | @[JSON::Field(key: "noSuchMethod")] |
| 1717 | 1710 | property no_such_method : NoSuchMethod |
| 1718 | 1711 | |
| @@ -1747,6 +1740,9 @@ class Obj4 | ||
| 1747 | 1740 | |
| 1748 | 1741 | property number : NumberClass |
| 1749 | 1742 | |
| 1743 | + @[JSON::Field(key: "nil")] | |
| 1744 | + property obj4_nil : NilClass | |
| 1745 | + | |
| 1750 | 1746 | @[JSON::Field(key: "none")] |
| 1751 | 1747 | property obj4_none : NoneClass |
| 1752 | 1748 | |
| @@ -1856,11 +1852,13 @@ class Obj4 | ||
| 1856 | 1852 | property s : S |
| 1857 | 1853 | |
| 1858 | 1854 | property sbyte : Sbyte |
| 1855 | +end | |
| 1859 | 1856 | |
| 1860 | - property sealed : Sealed | |
| 1857 | +class No | |
| 1858 | + include JSON::Serializable | |
| 1861 | 1859 | |
| 1862 | - @[JSON::Field(key: "SEL")] | |
| 1863 | - property sel : Sel | |
| 1860 | + @[JSON::Field(key: "NO")] | |
| 1861 | + property no : Int64 | |
| 1864 | 1862 | end |
| 1865 | 1863 | |
| 1866 | 1864 | class NoSuchMethod |
| @@ -1953,6 +1951,13 @@ class NumberClass | ||
| 1953 | 1951 | property number : Int64 |
| 1954 | 1952 | end |
| 1955 | 1953 | |
| 1954 | +class NilClass | |
| 1955 | + include JSON::Serializable | |
| 1956 | + | |
| 1957 | + @[JSON::Field(key: "nil")] | |
| 1958 | + property nil_nil : Int64 | |
| 1959 | +end | |
| 1960 | + | |
| 1956 | 1961 | class NoneClass |
| 1957 | 1962 | include JSON::Serializable |
| 1958 | 1963 | |
| @@ -2252,19 +2257,6 @@ class Sbyte | ||
| 2252 | 2257 | property sbyte : Int64 |
| 2253 | 2258 | end |
| 2254 | 2259 | |
| 2255 | -class Sealed | |
| 2256 | - include JSON::Serializable | |
| 2257 | - | |
| 2258 | - property sealed : Int64 | |
| 2259 | -end | |
| 2260 | - | |
| 2261 | -class Sel | |
| 2262 | - include JSON::Serializable | |
| 2263 | - | |
| 2264 | - @[JSON::Field(key: "SEL")] | |
| 2265 | - property sel : Int64 | |
| 2266 | -end | |
| 2267 | - | |
| 2268 | 2260 | class Obj5 |
| 2269 | 2261 | include JSON::Serializable |
| 2270 | 2262 | |
| @@ -2318,6 +2310,11 @@ class Obj5 | ||
| 2318 | 2310 | @[JSON::Field(key: "type")] |
| 2319 | 2311 | property purple_type : TypeClass |
| 2320 | 2312 | |
| 2313 | + property sealed : Sealed | |
| 2314 | + | |
| 2315 | + @[JSON::Field(key: "SEL")] | |
| 2316 | + property sel : Sel | |
| 2317 | + | |
| 2321 | 2318 | @[JSON::Field(key: "Sendable")] |
| 2322 | 2319 | property sendable : Sendable |
| 2323 | 2320 | |
| @@ -2423,13 +2420,6 @@ class Obj5 | ||
| 2423 | 2420 | |
| 2424 | 2421 | @[JSON::Field(key: "UnmarshalJSON")] |
| 2425 | 2422 | property unmarshal_json : UnmarshalJson |
| 2426 | - | |
| 2427 | - property unowned : Unowned | |
| 2428 | - | |
| 2429 | - property unsafe : Unsafe | |
| 2430 | - | |
| 2431 | - @[JSON::Field(key: "UseSerializers")] | |
| 2432 | - property use_serializers : UseSerializers | |
| 2433 | 2423 | end |
| 2434 | 2424 | |
| 2435 | 2425 | class KSerializer |
| @@ -2544,6 +2534,19 @@ class TypeClass | ||
| 2544 | 2534 | property type_type : Int64 |
| 2545 | 2535 | end |
| 2546 | 2536 | |
| 2537 | +class Sealed | |
| 2538 | + include JSON::Serializable | |
| 2539 | + | |
| 2540 | + property sealed : Int64 | |
| 2541 | +end | |
| 2542 | + | |
| 2543 | +class Sel | |
| 2544 | + include JSON::Serializable | |
| 2545 | + | |
| 2546 | + @[JSON::Field(key: "SEL")] | |
| 2547 | + property sel : Int64 | |
| 2548 | +end | |
| 2549 | + | |
| 2547 | 2550 | class Sendable |
| 2548 | 2551 | include JSON::Serializable |
| 2549 | 2552 | |
| @@ -2834,25 +2837,6 @@ class UnmarshalJson | ||
| 2834 | 2837 | property unmarshal_json : Int64 |
| 2835 | 2838 | end |
| 2836 | 2839 | |
| 2837 | -class Unowned | |
| 2838 | - include JSON::Serializable | |
| 2839 | - | |
| 2840 | - property unowned : Int64 | |
| 2841 | -end | |
| 2842 | - | |
| 2843 | -class Unsafe | |
| 2844 | - include JSON::Serializable | |
| 2845 | - | |
| 2846 | - property unsafe : Int64 | |
| 2847 | -end | |
| 2848 | - | |
| 2849 | -class UseSerializers | |
| 2850 | - include JSON::Serializable | |
| 2851 | - | |
| 2852 | - @[JSON::Field(key: "UseSerializers")] | |
| 2853 | - property use_serializers : Int64 | |
| 2854 | -end | |
| 2855 | - | |
| 2856 | 2840 | class Obj6 |
| 2857 | 2841 | include JSON::Serializable |
| 2858 | 2842 | |
| @@ -2867,8 +2851,15 @@ class Obj6 | ||
| 2867 | 2851 | @[JSON::Field(key: "yield")] |
| 2868 | 2852 | property obj6_yield : Yield |
| 2869 | 2853 | |
| 2854 | + property unowned : Unowned | |
| 2855 | + | |
| 2856 | + property unsafe : Unsafe | |
| 2857 | + | |
| 2870 | 2858 | property unsigned : Unsigned |
| 2871 | 2859 | |
| 2860 | + @[JSON::Field(key: "UseSerializers")] | |
| 2861 | + property use_serializers : UseSerializers | |
| 2862 | + | |
| 2872 | 2863 | property ushort : Ushort |
| 2873 | 2864 | |
| 2874 | 2865 | property using : Using |
| @@ -2928,12 +2919,31 @@ class Yield | ||
| 2928 | 2919 | property yield_yield : Int64 |
| 2929 | 2920 | end |
| 2930 | 2921 | |
| 2922 | +class Unowned | |
| 2923 | + include JSON::Serializable | |
| 2924 | + | |
| 2925 | + property unowned : Int64 | |
| 2926 | +end | |
| 2927 | + | |
| 2928 | +class Unsafe | |
| 2929 | + include JSON::Serializable | |
| 2930 | + | |
| 2931 | + property unsafe : Int64 | |
| 2932 | +end | |
| 2933 | + | |
| 2931 | 2934 | class Unsigned |
| 2932 | 2935 | include JSON::Serializable |
| 2933 | 2936 | |
| 2934 | 2937 | property unsigned : Int64 |
| 2935 | 2938 | end |
| 2936 | 2939 | |
| 2940 | +class UseSerializers | |
| 2941 | + include JSON::Serializable | |
| 2942 | + | |
| 2943 | + @[JSON::Field(key: "UseSerializers")] | |
| 2944 | + property use_serializers : Int64 | |
| 2945 | +end | |
| 2946 | + | |
| 2937 | 2947 | class Ushort |
| 2938 | 2948 | include JSON::Serializable |
Mcsharp-recordsdefault / QuickType.cs+70 −61
| @@ -1372,6 +1372,9 @@ namespace QuickType | ||
| 1372 | 1372 | [JsonProperty("long", Required = Required.Always)] |
| 1373 | 1373 | public Long Long { get; set; } |
| 1374 | 1374 | |
| 1375 | + [JsonProperty("makeDictEncoder", Required = Required.Always)] | |
| 1376 | + public MakeDictEncoder MakeDictEncoder { get; set; } | |
| 1377 | + | |
| 1375 | 1378 | [JsonProperty("map", Required = Required.Always)] |
| 1376 | 1379 | public Map Map { get; set; } |
| 1377 | 1380 | |
| @@ -1404,12 +1407,6 @@ namespace QuickType | ||
| 1404 | 1407 | |
| 1405 | 1408 | [JsonProperty("newtonsoft", Required = Required.Always)] |
| 1406 | 1409 | public NewtonsoftClass Newtonsoft { get; set; } |
| 1407 | - | |
| 1408 | - [JsonProperty("nil", Required = Required.Always)] | |
| 1409 | - public Nil Nil { get; set; } | |
| 1410 | - | |
| 1411 | - [JsonProperty("NO", Required = Required.Always)] | |
| 1412 | - public No No { get; set; } | |
| 1413 | 1410 | } |
| 1414 | 1411 | |
| 1415 | 1412 | public partial record Goto |
| @@ -1724,6 +1721,12 @@ namespace QuickType | ||
| 1724 | 1721 | public long LongLong { get; set; } |
| 1725 | 1722 | } |
| 1726 | 1723 | |
| 1724 | + public partial record MakeDictEncoder | |
| 1725 | + { | |
| 1726 | + [JsonProperty("makeDictEncoder", Required = Required.Always)] | |
| 1727 | + public long MakeDictEncoderMakeDictEncoder { get; set; } | |
| 1728 | + } | |
| 1729 | + | |
| 1727 | 1730 | public partial record Map |
| 1728 | 1731 | { |
| 1729 | 1732 | [JsonProperty("map", Required = Required.Always)] |
| @@ -1790,23 +1793,17 @@ namespace QuickType | ||
| 1790 | 1793 | public long Newtonsoft { get; set; } |
| 1791 | 1794 | } |
| 1792 | 1795 | |
| 1793 | - public partial record Nil | |
| 1794 | - { | |
| 1795 | - [JsonProperty("nil", Required = Required.Always)] | |
| 1796 | - public long NilNil { get; set; } | |
| 1797 | - } | |
| 1798 | - | |
| 1799 | - public partial record No | |
| 1800 | - { | |
| 1801 | - [JsonProperty("NO", Required = Required.Always)] | |
| 1802 | - public long NoNo { get; set; } | |
| 1803 | - } | |
| 1804 | - | |
| 1805 | 1796 | public partial record Obj4 |
| 1806 | 1797 | { |
| 1807 | 1798 | [JsonProperty("dummy", Required = Required.Always)] |
| 1808 | 1799 | public long Dummy { get; set; } |
| 1809 | 1800 | |
| 1801 | + [JsonProperty("nil", Required = Required.Always)] | |
| 1802 | + public Nil Nil { get; set; } | |
| 1803 | + | |
| 1804 | + [JsonProperty("NO", Required = Required.Always)] | |
| 1805 | + public No No { get; set; } | |
| 1806 | + | |
| 1810 | 1807 | [JsonProperty("noSuchMethod", Required = Required.Always)] |
| 1811 | 1808 | public NoSuchMethod NoSuchMethod { get; set; } |
| 1812 | 1809 | |
| @@ -1992,12 +1989,18 @@ namespace QuickType | ||
| 1992 | 1989 | |
| 1993 | 1990 | [JsonProperty("sbyte", Required = Required.Always)] |
| 1994 | 1991 | public Sbyte Sbyte { get; set; } |
| 1992 | + } | |
| 1995 | 1993 | |
| 1996 | - [JsonProperty("sealed", Required = Required.Always)] | |
| 1997 | - public Sealed Sealed { get; set; } | |
| 1994 | + public partial record Nil | |
| 1995 | + { | |
| 1996 | + [JsonProperty("nil", Required = Required.Always)] | |
| 1997 | + public long NilNil { get; set; } | |
| 1998 | + } | |
| 1998 | 1999 | |
| 1999 | - [JsonProperty("SEL", Required = Required.Always)] | |
| 2000 | - public Sel Sel { get; set; } | |
| 2000 | + public partial record No | |
| 2001 | + { | |
| 2002 | + [JsonProperty("NO", Required = Required.Always)] | |
| 2003 | + public long NoNo { get; set; } | |
| 2001 | 2004 | } |
| 2002 | 2005 | |
| 2003 | 2006 | public partial record NoSuchMethod |
| @@ -2372,18 +2375,6 @@ namespace QuickType | ||
| 2372 | 2375 | public long SbyteSbyte { get; set; } |
| 2373 | 2376 | } |
| 2374 | 2377 | |
| 2375 | - public partial record Sealed | |
| 2376 | - { | |
| 2377 | - [JsonProperty("sealed", Required = Required.Always)] | |
| 2378 | - public long SealedSealed { get; set; } | |
| 2379 | - } | |
| 2380 | - | |
| 2381 | - public partial record Sel | |
| 2382 | - { | |
| 2383 | - [JsonProperty("SEL", Required = Required.Always)] | |
| 2384 | - public long SelSel { get; set; } | |
| 2385 | - } | |
| 2386 | - | |
| 2387 | 2378 | public partial record Obj5 |
| 2388 | 2379 | { |
| 2389 | 2380 | [JsonProperty("dummy", Required = Required.Always)] |
| @@ -2410,6 +2401,12 @@ namespace QuickType | ||
| 2410 | 2401 | [JsonProperty("PrimitiveKind", Required = Required.Always)] |
| 2411 | 2402 | public PrimitiveKind PrimitiveKind { get; set; } |
| 2412 | 2403 | |
| 2404 | + [JsonProperty("sealed", Required = Required.Always)] | |
| 2405 | + public Sealed Sealed { get; set; } | |
| 2406 | + | |
| 2407 | + [JsonProperty("SEL", Required = Required.Always)] | |
| 2408 | + public Sel Sel { get; set; } | |
| 2409 | + | |
| 2413 | 2410 | [JsonProperty("select", Required = Required.Always)] |
| 2414 | 2411 | public Select Select { get; set; } |
| 2415 | 2412 | |
| @@ -2574,15 +2571,6 @@ namespace QuickType | ||
| 2574 | 2571 | |
| 2575 | 2572 | [JsonProperty("UnmarshalJSON", Required = Required.Always)] |
| 2576 | 2573 | public UnmarshalJson UnmarshalJson { get; set; } |
| 2577 | - | |
| 2578 | - [JsonProperty("unowned", Required = Required.Always)] | |
| 2579 | - public Unowned Unowned { get; set; } | |
| 2580 | - | |
| 2581 | - [JsonProperty("unsafe", Required = Required.Always)] | |
| 2582 | - public Unsafe Unsafe { get; set; } | |
| 2583 | - | |
| 2584 | - [JsonProperty("UseSerializers", Required = Required.Always)] | |
| 2585 | - public UseSerializers UseSerializers { get; set; } | |
| 2586 | 2574 | } |
| 2587 | 2575 | |
| 2588 | 2576 | public partial record KSerializer |
| @@ -2627,6 +2615,18 @@ namespace QuickType | ||
| 2627 | 2615 | public long PrimitiveKindPrimitiveKind { get; set; } |
| 2628 | 2616 | } |
| 2629 | 2617 | |
| 2618 | + public partial record Sealed | |
| 2619 | + { | |
| 2620 | + [JsonProperty("sealed", Required = Required.Always)] | |
| 2621 | + public long SealedSealed { get; set; } | |
| 2622 | + } | |
| 2623 | + | |
| 2624 | + public partial record Sel | |
| 2625 | + { | |
| 2626 | + [JsonProperty("SEL", Required = Required.Always)] | |
| 2627 | + public long SelSel { get; set; } | |
| 2628 | + } | |
| 2629 | + | |
| 2630 | 2630 | public partial record Select |
| 2631 | 2631 | { |
| 2632 | 2632 | [JsonProperty("select", Required = Required.Always)] |
| @@ -2957,32 +2957,23 @@ namespace QuickType | ||
| 2957 | 2957 | public long UnmarshalJsonUnmarshalJson { get; set; } |
| 2958 | 2958 | } |
| 2959 | 2959 | |
| 2960 | - public partial record Unowned | |
| 2961 | - { | |
| 2962 | - [JsonProperty("unowned", Required = Required.Always)] | |
| 2963 | - public long UnownedUnowned { get; set; } | |
| 2964 | - } | |
| 2965 | - | |
| 2966 | - public partial record Unsafe | |
| 2967 | - { | |
| 2968 | - [JsonProperty("unsafe", Required = Required.Always)] | |
| 2969 | - public long UnsafeUnsafe { get; set; } | |
| 2970 | - } | |
| 2971 | - | |
| 2972 | - public partial record UseSerializers | |
| 2973 | - { | |
| 2974 | - [JsonProperty("UseSerializers", Required = Required.Always)] | |
| 2975 | - public long UseSerializersUseSerializers { get; set; } | |
| 2976 | - } | |
| 2977 | - | |
| 2978 | 2960 | public partial record Obj6 |
| 2979 | 2961 | { |
| 2980 | 2962 | [JsonProperty("dummy", Required = Required.Always)] |
| 2981 | 2963 | public long Dummy { get; set; } |
| 2982 | 2964 | |
| 2965 | + [JsonProperty("unowned", Required = Required.Always)] | |
| 2966 | + public Unowned Unowned { get; set; } | |
| 2967 | + | |
| 2968 | + [JsonProperty("unsafe", Required = Required.Always)] | |
| 2969 | + public Unsafe Unsafe { get; set; } | |
| 2970 | + | |
| 2983 | 2971 | [JsonProperty("unsigned", Required = Required.Always)] |
| 2984 | 2972 | public Unsigned Unsigned { get; set; } |
| 2985 | 2973 | |
| 2974 | + [JsonProperty("UseSerializers", Required = Required.Always)] | |
| 2975 | + public UseSerializers UseSerializers { get; set; } | |
| 2976 | + | |
| 2986 | 2977 | [JsonProperty("ushort", Required = Required.Always)] |
| 2987 | 2978 | public Ushort Ushort { get; set; } |
| 2988 | 2979 | |
| @@ -3041,12 +3032,30 @@ namespace QuickType | ||
| 3041 | 3032 | public Yield Yield { get; set; } |
| 3042 | 3033 | } |
| 3043 | 3034 | |
| 3035 | + public partial record Unowned | |
| 3036 | + { | |
| 3037 | + [JsonProperty("unowned", Required = Required.Always)] | |
| 3038 | + public long UnownedUnowned { get; set; } | |
| 3039 | + } | |
| 3040 | + | |
| 3041 | + public partial record Unsafe | |
| 3042 | + { | |
| 3043 | + [JsonProperty("unsafe", Required = Required.Always)] | |
| 3044 | + public long UnsafeUnsafe { get; set; } | |
| 3045 | + } | |
| 3046 | + | |
| 3044 | 3047 | public partial record Unsigned |
| 3045 | 3048 | { |
| 3046 | 3049 | [JsonProperty("unsigned", Required = Required.Always)] |
| 3047 | 3050 | public long UnsignedUnsigned { get; set; } |
| 3048 | 3051 | } |
| 3049 | 3052 | |
| 3053 | + public partial record UseSerializers | |
| 3054 | + { | |
| 3055 | + [JsonProperty("UseSerializers", Required = Required.Always)] | |
| 3056 | + public long UseSerializersUseSerializers { get; set; } | |
| 3057 | + } | |
| 3058 | + | |
| 3050 | 3059 | public partial record Ushort |
| 3051 | 3060 | { |
| 3052 | 3061 | [JsonProperty("ushort", Required = Required.Always)] |
Mcsharp-SystemTextJsondefault / QuickType.cs+82 −71
| @@ -1687,6 +1687,10 @@ namespace QuickType | ||
| 1687 | 1687 | [JsonPropertyName("long")] |
| 1688 | 1688 | public Long Long { get; set; } |
| 1689 | 1689 | |
| 1690 | + [JsonRequired] | |
| 1691 | + [JsonPropertyName("makeDictEncoder")] | |
| 1692 | + public MakeDictEncoder MakeDictEncoder { get; set; } | |
| 1693 | + | |
| 1690 | 1694 | [JsonRequired] |
| 1691 | 1695 | [JsonPropertyName("map")] |
| 1692 | 1696 | public Map Map { get; set; } |
| @@ -1730,14 +1734,6 @@ namespace QuickType | ||
| 1730 | 1734 | [JsonRequired] |
| 1731 | 1735 | [JsonPropertyName("newtonsoft")] |
| 1732 | 1736 | public Newtonsoft Newtonsoft { get; set; } |
| 1733 | - | |
| 1734 | - [JsonRequired] | |
| 1735 | - [JsonPropertyName("nil")] | |
| 1736 | - public Nil Nil { get; set; } | |
| 1737 | - | |
| 1738 | - [JsonRequired] | |
| 1739 | - [JsonPropertyName("NO")] | |
| 1740 | - public No No { get; set; } | |
| 1741 | 1737 | } |
| 1742 | 1738 | |
| 1743 | 1739 | public partial class Goto |
| @@ -2104,6 +2100,13 @@ namespace QuickType | ||
| 2104 | 2100 | public long LongLong { get; set; } |
| 2105 | 2101 | } |
| 2106 | 2102 | |
| 2103 | + public partial class MakeDictEncoder | |
| 2104 | + { | |
| 2105 | + [JsonRequired] | |
| 2106 | + [JsonPropertyName("makeDictEncoder")] | |
| 2107 | + public long MakeDictEncoderMakeDictEncoder { get; set; } | |
| 2108 | + } | |
| 2109 | + | |
| 2107 | 2110 | public partial class Map |
| 2108 | 2111 | { |
| 2109 | 2112 | [JsonRequired] |
| @@ -2181,25 +2184,19 @@ namespace QuickType | ||
| 2181 | 2184 | public long NewtonsoftNewtonsoft { get; set; } |
| 2182 | 2185 | } |
| 2183 | 2186 | |
| 2184 | - public partial class Nil | |
| 2187 | + public partial class Obj4 | |
| 2185 | 2188 | { |
| 2186 | 2189 | [JsonRequired] |
| 2187 | - [JsonPropertyName("nil")] | |
| 2188 | - public long NilNil { get; set; } | |
| 2189 | - } | |
| 2190 | + [JsonPropertyName("dummy")] | |
| 2191 | + public long Dummy { get; set; } | |
| 2190 | 2192 | |
| 2191 | - public partial class No | |
| 2192 | - { | |
| 2193 | 2193 | [JsonRequired] |
| 2194 | - [JsonPropertyName("NO")] | |
| 2195 | - public long NoNo { get; set; } | |
| 2196 | - } | |
| 2194 | + [JsonPropertyName("nil")] | |
| 2195 | + public Nil Nil { get; set; } | |
| 2197 | 2196 | |
| 2198 | - public partial class Obj4 | |
| 2199 | - { | |
| 2200 | 2197 | [JsonRequired] |
| 2201 | - [JsonPropertyName("dummy")] | |
| 2202 | - public long Dummy { get; set; } | |
| 2198 | + [JsonPropertyName("NO")] | |
| 2199 | + public No No { get; set; } | |
| 2203 | 2200 | |
| 2204 | 2201 | [JsonRequired] |
| 2205 | 2202 | [JsonPropertyName("noSuchMethod")] |
| @@ -2448,14 +2445,20 @@ namespace QuickType | ||
| 2448 | 2445 | [JsonRequired] |
| 2449 | 2446 | [JsonPropertyName("sbyte")] |
| 2450 | 2447 | public Sbyte Sbyte { get; set; } |
| 2448 | + } | |
| 2451 | 2449 | |
| 2450 | + public partial class Nil | |
| 2451 | + { | |
| 2452 | 2452 | [JsonRequired] |
| 2453 | - [JsonPropertyName("sealed")] | |
| 2454 | - public Sealed Sealed { get; set; } | |
| 2453 | + [JsonPropertyName("nil")] | |
| 2454 | + public long NilNil { get; set; } | |
| 2455 | + } | |
| 2455 | 2456 | |
| 2457 | + public partial class No | |
| 2458 | + { | |
| 2456 | 2459 | [JsonRequired] |
| 2457 | - [JsonPropertyName("SEL")] | |
| 2458 | - public Sel Sel { get; set; } | |
| 2460 | + [JsonPropertyName("NO")] | |
| 2461 | + public long NoNo { get; set; } | |
| 2459 | 2462 | } |
| 2460 | 2463 | |
| 2461 | 2464 | public partial class NoSuchMethod |
| @@ -2892,20 +2895,6 @@ namespace QuickType | ||
| 2892 | 2895 | public long SbyteSbyte { get; set; } |
| 2893 | 2896 | } |
| 2894 | 2897 | |
| 2895 | - public partial class Sealed | |
| 2896 | - { | |
| 2897 | - [JsonRequired] | |
| 2898 | - [JsonPropertyName("sealed")] | |
| 2899 | - public long SealedSealed { get; set; } | |
| 2900 | - } | |
| 2901 | - | |
| 2902 | - public partial class Sel | |
| 2903 | - { | |
| 2904 | - [JsonRequired] | |
| 2905 | - [JsonPropertyName("SEL")] | |
| 2906 | - public long SelSel { get; set; } | |
| 2907 | - } | |
| 2908 | - | |
| 2909 | 2898 | public partial class Obj5 |
| 2910 | 2899 | { |
| 2911 | 2900 | [JsonRequired] |
| @@ -2940,6 +2929,14 @@ namespace QuickType | ||
| 2940 | 2929 | [JsonPropertyName("PrimitiveKind")] |
| 2941 | 2930 | public PrimitiveKind PrimitiveKind { get; set; } |
| 2942 | 2931 | |
| 2932 | + [JsonRequired] | |
| 2933 | + [JsonPropertyName("sealed")] | |
| 2934 | + public Sealed Sealed { get; set; } | |
| 2935 | + | |
| 2936 | + [JsonRequired] | |
| 2937 | + [JsonPropertyName("SEL")] | |
| 2938 | + public Sel Sel { get; set; } | |
| 2939 | + | |
| 2943 | 2940 | [JsonRequired] |
| 2944 | 2941 | [JsonPropertyName("select")] |
| 2945 | 2942 | public Select Select { get; set; } |
| @@ -3159,18 +3156,6 @@ namespace QuickType | ||
| 3159 | 3156 | [JsonRequired] |
| 3160 | 3157 | [JsonPropertyName("UnmarshalJSON")] |
| 3161 | 3158 | public UnmarshalJson UnmarshalJson { get; set; } |
| 3162 | - | |
| 3163 | - [JsonRequired] | |
| 3164 | - [JsonPropertyName("unowned")] | |
| 3165 | - public Unowned Unowned { get; set; } | |
| 3166 | - | |
| 3167 | - [JsonRequired] | |
| 3168 | - [JsonPropertyName("unsafe")] | |
| 3169 | - public Unsafe Unsafe { get; set; } | |
| 3170 | - | |
| 3171 | - [JsonRequired] | |
| 3172 | - [JsonPropertyName("UseSerializers")] | |
| 3173 | - public UseSerializers UseSerializers { get; set; } | |
| 3174 | 3159 | } |
| 3175 | 3160 | |
| 3176 | 3161 | public partial class KSerializer |
| @@ -3222,6 +3207,20 @@ namespace QuickType | ||
| 3222 | 3207 | public long PrimitiveKindPrimitiveKind { get; set; } |
| 3223 | 3208 | } |
| 3224 | 3209 | |
| 3210 | + public partial class Sealed | |
| 3211 | + { | |
| 3212 | + [JsonRequired] | |
| 3213 | + [JsonPropertyName("sealed")] | |
| 3214 | + public long SealedSealed { get; set; } | |
| 3215 | + } | |
| 3216 | + | |
| 3217 | + public partial class Sel | |
| 3218 | + { | |
| 3219 | + [JsonRequired] | |
| 3220 | + [JsonPropertyName("SEL")] | |
| 3221 | + public long SelSel { get; set; } | |
| 3222 | + } | |
| 3223 | + | |
| 3225 | 3224 | public partial class Select |
| 3226 | 3225 | { |
| 3227 | 3226 | [JsonRequired] |
| @@ -3607,37 +3606,28 @@ namespace QuickType | ||
| 3607 | 3606 | public long UnmarshalJsonUnmarshalJson { get; set; } |
| 3608 | 3607 | } |
| 3609 | 3608 | |
| 3610 | - public partial class Unowned | |
| 3611 | - { | |
| 3612 | - [JsonRequired] | |
| 3613 | - [JsonPropertyName("unowned")] | |
| 3614 | - public long UnownedUnowned { get; set; } | |
| 3615 | - } | |
| 3616 | - | |
| 3617 | - public partial class Unsafe | |
| 3609 | + public partial class Obj6 | |
| 3618 | 3610 | { |
| 3619 | 3611 | [JsonRequired] |
| 3620 | - [JsonPropertyName("unsafe")] | |
| 3621 | - public long UnsafeUnsafe { get; set; } | |
| 3622 | - } | |
| 3612 | + [JsonPropertyName("dummy")] | |
| 3613 | + public long Dummy { get; set; } | |
| 3623 | 3614 | |
| 3624 | - public partial class UseSerializers | |
| 3625 | - { | |
| 3626 | 3615 | [JsonRequired] |
| 3627 | - [JsonPropertyName("UseSerializers")] | |
| 3628 | - public long UseSerializersUseSerializers { get; set; } | |
| 3629 | - } | |
| 3616 | + [JsonPropertyName("unowned")] | |
| 3617 | + public Unowned Unowned { get; set; } | |
| 3630 | 3618 | |
| 3631 | - public partial class Obj6 | |
| 3632 | - { | |
| 3633 | 3619 | [JsonRequired] |
| 3634 | - [JsonPropertyName("dummy")] | |
| 3635 | - public long Dummy { get; set; } | |
| 3620 | + [JsonPropertyName("unsafe")] | |
| 3621 | + public Unsafe Unsafe { get; set; } | |
| 3636 | 3622 | |
| 3637 | 3623 | [JsonRequired] |
| 3638 | 3624 | [JsonPropertyName("unsigned")] |
| 3639 | 3625 | public Unsigned Unsigned { get; set; } |
| 3640 | 3626 | |
| 3627 | + [JsonRequired] | |
| 3628 | + [JsonPropertyName("UseSerializers")] | |
| 3629 | + public UseSerializers UseSerializers { get; set; } | |
| 3630 | + | |
| 3641 | 3631 | [JsonRequired] |
| 3642 | 3632 | [JsonPropertyName("ushort")] |
| 3643 | 3633 | public Ushort Ushort { get; set; } |
| @@ -3715,6 +3705,20 @@ namespace QuickType | ||
| 3715 | 3705 | public Yield Yield { get; set; } |
| 3716 | 3706 | } |
| 3717 | 3707 | |
| 3708 | + public partial class Unowned | |
| 3709 | + { | |
| 3710 | + [JsonRequired] | |
| 3711 | + [JsonPropertyName("unowned")] | |
| 3712 | + public long UnownedUnowned { get; set; } | |
| 3713 | + } | |
| 3714 | + | |
| 3715 | + public partial class Unsafe | |
| 3716 | + { | |
| 3717 | + [JsonRequired] | |
| 3718 | + [JsonPropertyName("unsafe")] | |
| 3719 | + public long UnsafeUnsafe { get; set; } | |
| 3720 | + } | |
| 3721 | + | |
| 3718 | 3722 | public partial class Unsigned |
| 3719 | 3723 | { |
| 3720 | 3724 | [JsonRequired] |
| @@ -3722,6 +3726,13 @@ namespace QuickType | ||
| 3722 | 3726 | public long UnsignedUnsigned { get; set; } |
| 3723 | 3727 | } |
| 3724 | 3728 | |
| 3729 | + public partial class UseSerializers | |
| 3730 | + { | |
| 3731 | + [JsonRequired] | |
| 3732 | + [JsonPropertyName("UseSerializers")] | |
| 3733 | + public long UseSerializersUseSerializers { get; set; } | |
| 3734 | + } | |
| 3735 | + | |
| 3725 | 3736 | public partial class Ushort |
| 3726 | 3737 | { |
| 3727 | 3738 | [JsonRequired] |
Mcsharpdefault / QuickType.cs+70 −61
| @@ -1372,6 +1372,9 @@ namespace QuickType | ||
| 1372 | 1372 | [JsonProperty("long", Required = Required.Always)] |
| 1373 | 1373 | public Long Long { get; set; } |
| 1374 | 1374 | |
| 1375 | + [JsonProperty("makeDictEncoder", Required = Required.Always)] | |
| 1376 | + public MakeDictEncoder MakeDictEncoder { get; set; } | |
| 1377 | + | |
| 1375 | 1378 | [JsonProperty("map", Required = Required.Always)] |
| 1376 | 1379 | public Map Map { get; set; } |
| 1377 | 1380 | |
| @@ -1404,12 +1407,6 @@ namespace QuickType | ||
| 1404 | 1407 | |
| 1405 | 1408 | [JsonProperty("newtonsoft", Required = Required.Always)] |
| 1406 | 1409 | public NewtonsoftClass Newtonsoft { get; set; } |
| 1407 | - | |
| 1408 | - [JsonProperty("nil", Required = Required.Always)] | |
| 1409 | - public Nil Nil { get; set; } | |
| 1410 | - | |
| 1411 | - [JsonProperty("NO", Required = Required.Always)] | |
| 1412 | - public No No { get; set; } | |
| 1413 | 1410 | } |
| 1414 | 1411 | |
| 1415 | 1412 | public partial class Goto |
| @@ -1724,6 +1721,12 @@ namespace QuickType | ||
| 1724 | 1721 | public long LongLong { get; set; } |
| 1725 | 1722 | } |
| 1726 | 1723 | |
| 1724 | + public partial class MakeDictEncoder | |
| 1725 | + { | |
| 1726 | + [JsonProperty("makeDictEncoder", Required = Required.Always)] | |
| 1727 | + public long MakeDictEncoderMakeDictEncoder { get; set; } | |
| 1728 | + } | |
| 1729 | + | |
| 1727 | 1730 | public partial class Map |
| 1728 | 1731 | { |
| 1729 | 1732 | [JsonProperty("map", Required = Required.Always)] |
| @@ -1790,23 +1793,17 @@ namespace QuickType | ||
| 1790 | 1793 | public long Newtonsoft { get; set; } |
| 1791 | 1794 | } |
| 1792 | 1795 | |
| 1793 | - public partial class Nil | |
| 1794 | - { | |
| 1795 | - [JsonProperty("nil", Required = Required.Always)] | |
| 1796 | - public long NilNil { get; set; } | |
| 1797 | - } | |
| 1798 | - | |
| 1799 | - public partial class No | |
| 1800 | - { | |
| 1801 | - [JsonProperty("NO", Required = Required.Always)] | |
| 1802 | - public long NoNo { get; set; } | |
| 1803 | - } | |
| 1804 | - | |
| 1805 | 1796 | public partial class Obj4 |
| 1806 | 1797 | { |
| 1807 | 1798 | [JsonProperty("dummy", Required = Required.Always)] |
| 1808 | 1799 | public long Dummy { get; set; } |
| 1809 | 1800 | |
| 1801 | + [JsonProperty("nil", Required = Required.Always)] | |
| 1802 | + public Nil Nil { get; set; } | |
| 1803 | + | |
| 1804 | + [JsonProperty("NO", Required = Required.Always)] | |
| 1805 | + public No No { get; set; } | |
| 1806 | + | |
| 1810 | 1807 | [JsonProperty("noSuchMethod", Required = Required.Always)] |
| 1811 | 1808 | public NoSuchMethod NoSuchMethod { get; set; } |
| 1812 | 1809 | |
| @@ -1992,12 +1989,18 @@ namespace QuickType | ||
| 1992 | 1989 | |
| 1993 | 1990 | [JsonProperty("sbyte", Required = Required.Always)] |
| 1994 | 1991 | public Sbyte Sbyte { get; set; } |
| 1992 | + } | |
| 1995 | 1993 | |
| 1996 | - [JsonProperty("sealed", Required = Required.Always)] | |
| 1997 | - public Sealed Sealed { get; set; } | |
| 1994 | + public partial class Nil | |
| 1995 | + { | |
| 1996 | + [JsonProperty("nil", Required = Required.Always)] | |
| 1997 | + public long NilNil { get; set; } | |
| 1998 | + } | |
| 1998 | 1999 | |
| 1999 | - [JsonProperty("SEL", Required = Required.Always)] | |
| 2000 | - public Sel Sel { get; set; } | |
| 2000 | + public partial class No | |
| 2001 | + { | |
| 2002 | + [JsonProperty("NO", Required = Required.Always)] | |
| 2003 | + public long NoNo { get; set; } | |
| 2001 | 2004 | } |
| 2002 | 2005 | |
| 2003 | 2006 | public partial class NoSuchMethod |
| @@ -2372,18 +2375,6 @@ namespace QuickType | ||
| 2372 | 2375 | public long SbyteSbyte { get; set; } |
| 2373 | 2376 | } |
| 2374 | 2377 | |
| 2375 | - public partial class Sealed | |
| 2376 | - { | |
| 2377 | - [JsonProperty("sealed", Required = Required.Always)] | |
| 2378 | - public long SealedSealed { get; set; } | |
| 2379 | - } | |
| 2380 | - | |
| 2381 | - public partial class Sel | |
| 2382 | - { | |
| 2383 | - [JsonProperty("SEL", Required = Required.Always)] | |
| 2384 | - public long SelSel { get; set; } | |
| 2385 | - } | |
| 2386 | - | |
| 2387 | 2378 | public partial class Obj5 |
| 2388 | 2379 | { |
| 2389 | 2380 | [JsonProperty("dummy", Required = Required.Always)] |
| @@ -2410,6 +2401,12 @@ namespace QuickType | ||
| 2410 | 2401 | [JsonProperty("PrimitiveKind", Required = Required.Always)] |
| 2411 | 2402 | public PrimitiveKind PrimitiveKind { get; set; } |
| 2412 | 2403 | |
| 2404 | + [JsonProperty("sealed", Required = Required.Always)] | |
| 2405 | + public Sealed Sealed { get; set; } | |
| 2406 | + | |
| 2407 | + [JsonProperty("SEL", Required = Required.Always)] | |
| 2408 | + public Sel Sel { get; set; } | |
| 2409 | + | |
| 2413 | 2410 | [JsonProperty("select", Required = Required.Always)] |
| 2414 | 2411 | public Select Select { get; set; } |
| 2415 | 2412 | |
| @@ -2574,15 +2571,6 @@ namespace QuickType | ||
| 2574 | 2571 | |
| 2575 | 2572 | [JsonProperty("UnmarshalJSON", Required = Required.Always)] |
| 2576 | 2573 | public UnmarshalJson UnmarshalJson { get; set; } |
| 2577 | - | |
| 2578 | - [JsonProperty("unowned", Required = Required.Always)] | |
| 2579 | - public Unowned Unowned { get; set; } | |
| 2580 | - | |
| 2581 | - [JsonProperty("unsafe", Required = Required.Always)] | |
| 2582 | - public Unsafe Unsafe { get; set; } | |
| 2583 | - | |
| 2584 | - [JsonProperty("UseSerializers", Required = Required.Always)] | |
| 2585 | - public UseSerializers UseSerializers { get; set; } | |
| 2586 | 2574 | } |
| 2587 | 2575 | |
| 2588 | 2576 | public partial class KSerializer |
| @@ -2627,6 +2615,18 @@ namespace QuickType | ||
| 2627 | 2615 | public long PrimitiveKindPrimitiveKind { get; set; } |
| 2628 | 2616 | } |
| 2629 | 2617 | |
| 2618 | + public partial class Sealed | |
| 2619 | + { | |
| 2620 | + [JsonProperty("sealed", Required = Required.Always)] | |
| 2621 | + public long SealedSealed { get; set; } | |
| 2622 | + } | |
| 2623 | + | |
| 2624 | + public partial class Sel | |
| 2625 | + { | |
| 2626 | + [JsonProperty("SEL", Required = Required.Always)] | |
| 2627 | + public long SelSel { get; set; } | |
| 2628 | + } | |
| 2629 | + | |
| 2630 | 2630 | public partial class Select |
| 2631 | 2631 | { |
| 2632 | 2632 | [JsonProperty("select", Required = Required.Always)] |
| @@ -2957,32 +2957,23 @@ namespace QuickType | ||
| 2957 | 2957 | public long UnmarshalJsonUnmarshalJson { get; set; } |
| 2958 | 2958 | } |
| 2959 | 2959 | |
| 2960 | - public partial class Unowned | |
| 2961 | - { | |
| 2962 | - [JsonProperty("unowned", Required = Required.Always)] | |
| 2963 | - public long UnownedUnowned { get; set; } | |
| 2964 | - } | |
| 2965 | - | |
| 2966 | - public partial class Unsafe | |
| 2967 | - { | |
| 2968 | - [JsonProperty("unsafe", Required = Required.Always)] | |
| 2969 | - public long UnsafeUnsafe { get; set; } | |
| 2970 | - } | |
| 2971 | - | |
| 2972 | - public partial class UseSerializers | |
| 2973 | - { | |
| 2974 | - [JsonProperty("UseSerializers", Required = Required.Always)] | |
| 2975 | - public long UseSerializersUseSerializers { get; set; } | |
| 2976 | - } | |
| 2977 | - | |
| 2978 | 2960 | public partial class Obj6 |
| 2979 | 2961 | { |
| 2980 | 2962 | [JsonProperty("dummy", Required = Required.Always)] |
| 2981 | 2963 | public long Dummy { get; set; } |
| 2982 | 2964 | |
| 2965 | + [JsonProperty("unowned", Required = Required.Always)] | |
| 2966 | + public Unowned Unowned { get; set; } | |
| 2967 | + | |
| 2968 | + [JsonProperty("unsafe", Required = Required.Always)] | |
| 2969 | + public Unsafe Unsafe { get; set; } | |
| 2970 | + | |
| 2983 | 2971 | [JsonProperty("unsigned", Required = Required.Always)] |
| 2984 | 2972 | public Unsigned Unsigned { get; set; } |
| 2985 | 2973 | |
| 2974 | + [JsonProperty("UseSerializers", Required = Required.Always)] | |
| 2975 | + public UseSerializers UseSerializers { get; set; } | |
| 2976 | + | |
| 2986 | 2977 | [JsonProperty("ushort", Required = Required.Always)] |
| 2987 | 2978 | public Ushort Ushort { get; set; } |
| 2988 | 2979 | |
| @@ -3041,12 +3032,30 @@ namespace QuickType | ||
| 3041 | 3032 | public Yield Yield { get; set; } |
| 3042 | 3033 | } |
| 3043 | 3034 | |
| 3035 | + public partial class Unowned | |
| 3036 | + { | |
| 3037 | + [JsonProperty("unowned", Required = Required.Always)] | |
| 3038 | + public long UnownedUnowned { get; set; } | |
| 3039 | + } | |
| 3040 | + | |
| 3041 | + public partial class Unsafe | |
| 3042 | + { | |
| 3043 | + [JsonProperty("unsafe", Required = Required.Always)] | |
| 3044 | + public long UnsafeUnsafe { get; set; } | |
| 3045 | + } | |
| 3046 | + | |
| 3044 | 3047 | public partial class Unsigned |
| 3045 | 3048 | { |
| 3046 | 3049 | [JsonProperty("unsigned", Required = Required.Always)] |
| 3047 | 3050 | public long UnsignedUnsigned { get; set; } |
| 3048 | 3051 | } |
| 3049 | 3052 | |
| 3053 | + public partial class UseSerializers | |
| 3054 | + { | |
| 3055 | + [JsonProperty("UseSerializers", Required = Required.Always)] | |
| 3056 | + public long UseSerializersUseSerializers { get; set; } | |
| 3057 | + } | |
| 3058 | + | |
| 3050 | 3059 | public partial class Ushort |
| 3051 | 3060 | { |
| 3052 | 3061 | [JsonProperty("ushort", Required = Required.Always)] |
Mdartdefault / TopLevel.dart+160 −140
| @@ -2696,6 +2696,7 @@ class Obj3 { | ||
| 2696 | 2696 | final Locale locale; |
| 2697 | 2697 | final Lock lock; |
| 2698 | 2698 | final Long long; |
| 2699 | + final MakeDictEncoder makeDictEncoder; | |
| 2699 | 2700 | final MapClass map; |
| 2700 | 2701 | final MapEntryClass mapEntry; |
| 2701 | 2702 | final MarshalJson marshalJson; |
| @@ -2706,8 +2707,6 @@ class Obj3 { | ||
| 2706 | 2707 | final Namespace namespace; |
| 2707 | 2708 | final Native native; |
| 2708 | 2709 | final Newtonsoft newtonsoft; |
| 2709 | - final Nil nil; | |
| 2710 | - final No no; | |
| 2711 | 2710 | final HashCode obj3HashCode; |
| 2712 | 2711 | final If obj3If; |
| 2713 | 2712 | final Implements obj3Implements; |
| @@ -2764,6 +2763,7 @@ class Obj3 { | ||
| 2764 | 2763 | required this.locale, |
| 2765 | 2764 | required this.lock, |
| 2766 | 2765 | required this.long, |
| 2766 | + required this.makeDictEncoder, | |
| 2767 | 2767 | required this.map, |
| 2768 | 2768 | required this.mapEntry, |
| 2769 | 2769 | required this.marshalJson, |
| @@ -2774,8 +2774,6 @@ class Obj3 { | ||
| 2774 | 2774 | required this.namespace, |
| 2775 | 2775 | required this.native, |
| 2776 | 2776 | required this.newtonsoft, |
| 2777 | - required this.nil, | |
| 2778 | - required this.no, | |
| 2779 | 2777 | required this.obj3HashCode, |
| 2780 | 2778 | required this.obj3If, |
| 2781 | 2779 | required this.obj3Implements, |
| @@ -2833,6 +2831,7 @@ class Obj3 { | ||
| 2833 | 2831 | locale: Locale.fromJson(json["Locale"]), |
| 2834 | 2832 | lock: Lock.fromJson(json["lock"]), |
| 2835 | 2833 | long: Long.fromJson(json["long"]), |
| 2834 | + makeDictEncoder: MakeDictEncoder.fromJson(json["makeDictEncoder"]), | |
| 2836 | 2835 | map: MapClass.fromJson(json["map"]), |
| 2837 | 2836 | mapEntry: MapEntryClass.fromJson(json["MapEntry"]), |
| 2838 | 2837 | marshalJson: MarshalJson.fromJson(json["MarshalJSON"]), |
| @@ -2843,8 +2842,6 @@ class Obj3 { | ||
| 2843 | 2842 | namespace: Namespace.fromJson(json["namespace"]), |
| 2844 | 2843 | native: Native.fromJson(json["native"]), |
| 2845 | 2844 | newtonsoft: Newtonsoft.fromJson(json["newtonsoft"]), |
| 2846 | - nil: Nil.fromJson(json["nil"]), | |
| 2847 | - no: No.fromJson(json["NO"]), | |
| 2848 | 2845 | obj3HashCode: HashCode.fromJson(json["hashCode"]), |
| 2849 | 2846 | obj3If: If.fromJson(json["if"]), |
| 2850 | 2847 | obj3Implements: Implements.fromJson(json["implements"]), |
| @@ -2902,6 +2899,7 @@ class Obj3 { | ||
| 2902 | 2899 | "Locale": locale.toJson(), |
| 2903 | 2900 | "lock": lock.toJson(), |
| 2904 | 2901 | "long": long.toJson(), |
| 2902 | + "makeDictEncoder": makeDictEncoder.toJson(), | |
| 2905 | 2903 | "map": map.toJson(), |
| 2906 | 2904 | "MapEntry": mapEntry.toJson(), |
| 2907 | 2905 | "MarshalJSON": marshalJson.toJson(), |
| @@ -2912,8 +2910,6 @@ class Obj3 { | ||
| 2912 | 2910 | "namespace": namespace.toJson(), |
| 2913 | 2911 | "native": native.toJson(), |
| 2914 | 2912 | "newtonsoft": newtonsoft.toJson(), |
| 2915 | - "nil": nil.toJson(), | |
| 2916 | - "NO": no.toJson(), | |
| 2917 | 2913 | "hashCode": obj3HashCode.toJson(), |
| 2918 | 2914 | "if": obj3If.toJson(), |
| 2919 | 2915 | "implements": obj3Implements.toJson(), |
| @@ -3630,6 +3626,22 @@ class Long { | ||
| 3630 | 3626 | }; |
| 3631 | 3627 | } |
| 3632 | 3628 | |
| 3629 | +class MakeDictEncoder { | |
| 3630 | + final int makeDictEncoder; | |
| 3631 | + | |
| 3632 | + MakeDictEncoder({ | |
| 3633 | + required this.makeDictEncoder, | |
| 3634 | + }); | |
| 3635 | + | |
| 3636 | + factory MakeDictEncoder.fromJson(Map<String, dynamic> json) => MakeDictEncoder( | |
| 3637 | + makeDictEncoder: json["makeDictEncoder"], | |
| 3638 | + ); | |
| 3639 | + | |
| 3640 | + Map<String, dynamic> toJson() => { | |
| 3641 | + "makeDictEncoder": makeDictEncoder, | |
| 3642 | + }; | |
| 3643 | +} | |
| 3644 | + | |
| 3633 | 3645 | class MapClass { |
| 3634 | 3646 | final int map; |
| 3635 | 3647 | |
| @@ -3790,38 +3802,6 @@ class Newtonsoft { | ||
| 3790 | 3802 | }; |
| 3791 | 3803 | } |
| 3792 | 3804 | |
| 3793 | -class Nil { | |
| 3794 | - final int nil; | |
| 3795 | - | |
| 3796 | - Nil({ | |
| 3797 | - required this.nil, | |
| 3798 | - }); | |
| 3799 | - | |
| 3800 | - factory Nil.fromJson(Map<String, dynamic> json) => Nil( | |
| 3801 | - nil: json["nil"], | |
| 3802 | - ); | |
| 3803 | - | |
| 3804 | - Map<String, dynamic> toJson() => { | |
| 3805 | - "nil": nil, | |
| 3806 | - }; | |
| 3807 | -} | |
| 3808 | - | |
| 3809 | -class No { | |
| 3810 | - final int no; | |
| 3811 | - | |
| 3812 | - No({ | |
| 3813 | - required this.no, | |
| 3814 | - }); | |
| 3815 | - | |
| 3816 | - factory No.fromJson(Map<String, dynamic> json) => No( | |
| 3817 | - no: json["NO"], | |
| 3818 | - ); | |
| 3819 | - | |
| 3820 | - Map<String, dynamic> toJson() => { | |
| 3821 | - "NO": no, | |
| 3822 | - }; | |
| 3823 | -} | |
| 3824 | - | |
| 3825 | 3805 | class HashCode { |
| 3826 | 3806 | final int hashCodeHashCode; |
| 3827 | 3807 | |
| @@ -3968,6 +3948,8 @@ class New { | ||
| 3968 | 3948 | |
| 3969 | 3949 | class Obj4 { |
| 3970 | 3950 | final int dummy; |
| 3951 | + final Nil nil; | |
| 3952 | + final No no; | |
| 3971 | 3953 | final Noexcept noexcept; |
| 3972 | 3954 | final Nonatomic nonatomic; |
| 3973 | 3955 | final None none; |
| @@ -4030,11 +4012,11 @@ class Obj4 { | ||
| 4030 | 4012 | final Right right; |
| 4031 | 4013 | final S s; |
| 4032 | 4014 | final Sbyte sbyte; |
| 4033 | - final Sealed sealed; | |
| 4034 | - final Sel sel; | |
| 4035 | 4015 | |
| 4036 | 4016 | Obj4({ |
| 4037 | 4017 | required this.dummy, |
| 4018 | + required this.nil, | |
| 4019 | + required this.no, | |
| 4038 | 4020 | required this.noexcept, |
| 4039 | 4021 | required this.nonatomic, |
| 4040 | 4022 | required this.none, |
| @@ -4097,12 +4079,12 @@ class Obj4 { | ||
| 4097 | 4079 | required this.right, |
| 4098 | 4080 | required this.s, |
| 4099 | 4081 | required this.sbyte, |
| 4100 | - required this.sealed, | |
| 4101 | - required this.sel, | |
| 4102 | 4082 | }); |
| 4103 | 4083 | |
| 4104 | 4084 | factory Obj4.fromJson(Map<String, dynamic> json) => Obj4( |
| 4105 | 4085 | dummy: json["dummy"], |
| 4086 | + nil: Nil.fromJson(json["nil"]), | |
| 4087 | + no: No.fromJson(json["NO"]), | |
| 4106 | 4088 | noexcept: Noexcept.fromJson(json["noexcept"]), |
| 4107 | 4089 | nonatomic: Nonatomic.fromJson(json["nonatomic"]), |
| 4108 | 4090 | none: None.fromJson(json["None"]), |
| @@ -4165,12 +4147,12 @@ class Obj4 { | ||
| 4165 | 4147 | right: Right.fromJson(json["right"]), |
| 4166 | 4148 | s: S.fromJson(json["s"]), |
| 4167 | 4149 | sbyte: Sbyte.fromJson(json["sbyte"]), |
| 4168 | - sealed: Sealed.fromJson(json["sealed"]), | |
| 4169 | - sel: Sel.fromJson(json["SEL"]), | |
| 4170 | 4150 | ); |
| 4171 | 4151 | |
| 4172 | 4152 | Map<String, dynamic> toJson() => { |
| 4173 | 4153 | "dummy": dummy, |
| 4154 | + "nil": nil.toJson(), | |
| 4155 | + "NO": no.toJson(), | |
| 4174 | 4156 | "noexcept": noexcept.toJson(), |
| 4175 | 4157 | "nonatomic": nonatomic.toJson(), |
| 4176 | 4158 | "None": none.toJson(), |
| @@ -4233,8 +4215,38 @@ class Obj4 { | ||
| 4233 | 4215 | "right": right.toJson(), |
| 4234 | 4216 | "s": s.toJson(), |
| 4235 | 4217 | "sbyte": sbyte.toJson(), |
| 4236 | - "sealed": sealed.toJson(), | |
| 4237 | - "SEL": sel.toJson(), | |
| 4218 | + }; | |
| 4219 | +} | |
| 4220 | + | |
| 4221 | +class Nil { | |
| 4222 | + final int nil; | |
| 4223 | + | |
| 4224 | + Nil({ | |
| 4225 | + required this.nil, | |
| 4226 | + }); | |
| 4227 | + | |
| 4228 | + factory Nil.fromJson(Map<String, dynamic> json) => Nil( | |
| 4229 | + nil: json["nil"], | |
| 4230 | + ); | |
| 4231 | + | |
| 4232 | + Map<String, dynamic> toJson() => { | |
| 4233 | + "nil": nil, | |
| 4234 | + }; | |
| 4235 | +} | |
| 4236 | + | |
| 4237 | +class No { | |
| 4238 | + final int no; | |
| 4239 | + | |
| 4240 | + No({ | |
| 4241 | + required this.no, | |
| 4242 | + }); | |
| 4243 | + | |
| 4244 | + factory No.fromJson(Map<String, dynamic> json) => No( | |
| 4245 | + no: json["NO"], | |
| 4246 | + ); | |
| 4247 | + | |
| 4248 | + Map<String, dynamic> toJson() => { | |
| 4249 | + "NO": no, | |
| 4238 | 4250 | }; |
| 4239 | 4251 | } |
| 4240 | 4252 | |
| @@ -5230,38 +5242,6 @@ class Sbyte { | ||
| 5230 | 5242 | }; |
| 5231 | 5243 | } |
| 5232 | 5244 | |
| 5233 | -class Sealed { | |
| 5234 | - final int sealed; | |
| 5235 | - | |
| 5236 | - Sealed({ | |
| 5237 | - required this.sealed, | |
| 5238 | - }); | |
| 5239 | - | |
| 5240 | - factory Sealed.fromJson(Map<String, dynamic> json) => Sealed( | |
| 5241 | - sealed: json["sealed"], | |
| 5242 | - ); | |
| 5243 | - | |
| 5244 | - Map<String, dynamic> toJson() => { | |
| 5245 | - "sealed": sealed, | |
| 5246 | - }; | |
| 5247 | -} | |
| 5248 | - | |
| 5249 | -class Sel { | |
| 5250 | - final int sel; | |
| 5251 | - | |
| 5252 | - Sel({ | |
| 5253 | - required this.sel, | |
| 5254 | - }); | |
| 5255 | - | |
| 5256 | - factory Sel.fromJson(Map<String, dynamic> json) => Sel( | |
| 5257 | - sel: json["SEL"], | |
| 5258 | - ); | |
| 5259 | - | |
| 5260 | - Map<String, dynamic> toJson() => { | |
| 5261 | - "SEL": sel, | |
| 5262 | - }; | |
| 5263 | -} | |
| 5264 | - | |
| 5265 | 5245 | class Obj5 { |
| 5266 | 5246 | final int dummy; |
| 5267 | 5247 | final KSerializer kSerializer; |
| @@ -5280,6 +5260,8 @@ class Obj5 { | ||
| 5280 | 5260 | final Typedef obj5Typedef; |
| 5281 | 5261 | final PrimitiveKind primitiveKind; |
| 5282 | 5262 | final TrueClass purpleTrue; |
| 5263 | + final Sealed sealed; | |
| 5264 | + final Sel sel; | |
| 5283 | 5265 | final Select select; |
| 5284 | 5266 | final Self self; |
| 5285 | 5267 | final Sendable sendable; |
| @@ -5326,9 +5308,6 @@ class Obj5 { | ||
| 5326 | 5308 | final Undefined undefined; |
| 5327 | 5309 | final Union union; |
| 5328 | 5310 | final UnmarshalJson unmarshalJson; |
| 5329 | - final Unowned unowned; | |
| 5330 | - final Unsafe unsafe; | |
| 5331 | - final UseSerializers useSerializers; | |
| 5332 | 5311 | |
| 5333 | 5312 | Obj5({ |
| 5334 | 5313 | required this.dummy, |
| @@ -5348,6 +5327,8 @@ class Obj5 { | ||
| 5348 | 5327 | required this.obj5Typedef, |
| 5349 | 5328 | required this.primitiveKind, |
| 5350 | 5329 | required this.purpleTrue, |
| 5330 | + required this.sealed, | |
| 5331 | + required this.sel, | |
| 5351 | 5332 | required this.select, |
| 5352 | 5333 | required this.self, |
| 5353 | 5334 | required this.sendable, |
| @@ -5394,9 +5375,6 @@ class Obj5 { | ||
| 5394 | 5375 | required this.undefined, |
| 5395 | 5376 | required this.union, |
| 5396 | 5377 | required this.unmarshalJson, |
| 5397 | - required this.unowned, | |
| 5398 | - required this.unsafe, | |
| 5399 | - required this.useSerializers, | |
| 5400 | 5378 | }); |
| 5401 | 5379 | |
| 5402 | 5380 | factory Obj5.fromJson(Map<String, dynamic> json) => Obj5( |
| @@ -5417,6 +5395,8 @@ class Obj5 { | ||
| 5417 | 5395 | obj5Typedef: Typedef.fromJson(json["typedef"]), |
| 5418 | 5396 | primitiveKind: PrimitiveKind.fromJson(json["PrimitiveKind"]), |
| 5419 | 5397 | purpleTrue: TrueClass.fromJson(json["true"]), |
| 5398 | + sealed: Sealed.fromJson(json["sealed"]), | |
| 5399 | + sel: Sel.fromJson(json["SEL"]), | |
| 5420 | 5400 | select: Select.fromJson(json["select"]), |
| 5421 | 5401 | self: Self.fromJson(json["Self"]), |
| 5422 | 5402 | sendable: Sendable.fromJson(json["Sendable"]), |
| @@ -5463,9 +5443,6 @@ class Obj5 { | ||
| 5463 | 5443 | undefined: Undefined.fromJson(json["undefined"]), |
| 5464 | 5444 | union: Union.fromJson(json["union"]), |
| 5465 | 5445 | unmarshalJson: UnmarshalJson.fromJson(json["UnmarshalJSON"]), |
| 5466 | - unowned: Unowned.fromJson(json["unowned"]), | |
| 5467 | - unsafe: Unsafe.fromJson(json["unsafe"]), | |
| 5468 | - useSerializers: UseSerializers.fromJson(json["UseSerializers"]), | |
| 5469 | 5446 | ); |
| 5470 | 5447 | |
| 5471 | 5448 | Map<String, dynamic> toJson() => { |
| @@ -5486,6 +5463,8 @@ class Obj5 { | ||
| 5486 | 5463 | "typedef": obj5Typedef.toJson(), |
| 5487 | 5464 | "PrimitiveKind": primitiveKind.toJson(), |
| 5488 | 5465 | "true": purpleTrue.toJson(), |
| 5466 | + "sealed": sealed.toJson(), | |
| 5467 | + "SEL": sel.toJson(), | |
| 5489 | 5468 | "select": select.toJson(), |
| 5490 | 5469 | "Self": self.toJson(), |
| 5491 | 5470 | "Sendable": sendable.toJson(), |
| @@ -5532,9 +5511,6 @@ class Obj5 { | ||
| 5532 | 5511 | "undefined": undefined.toJson(), |
| 5533 | 5512 | "union": union.toJson(), |
| 5534 | 5513 | "UnmarshalJSON": unmarshalJson.toJson(), |
| 5535 | - "unowned": unowned.toJson(), | |
| 5536 | - "unsafe": unsafe.toJson(), | |
| 5537 | - "UseSerializers": useSerializers.toJson(), | |
| 5538 | 5514 | }; |
| 5539 | 5515 | } |
| 5540 | 5516 | |
| @@ -5794,6 +5770,38 @@ class TrueClass { | ||
| 5794 | 5770 | }; |
| 5795 | 5771 | } |
| 5796 | 5772 | |
| 5773 | +class Sealed { | |
| 5774 | + final int sealed; | |
| 5775 | + | |
| 5776 | + Sealed({ | |
| 5777 | + required this.sealed, | |
| 5778 | + }); | |
| 5779 | + | |
| 5780 | + factory Sealed.fromJson(Map<String, dynamic> json) => Sealed( | |
| 5781 | + sealed: json["sealed"], | |
| 5782 | + ); | |
| 5783 | + | |
| 5784 | + Map<String, dynamic> toJson() => { | |
| 5785 | + "sealed": sealed, | |
| 5786 | + }; | |
| 5787 | +} | |
| 5788 | + | |
| 5789 | +class Sel { | |
| 5790 | + final int sel; | |
| 5791 | + | |
| 5792 | + Sel({ | |
| 5793 | + required this.sel, | |
| 5794 | + }); | |
| 5795 | + | |
| 5796 | + factory Sel.fromJson(Map<String, dynamic> json) => Sel( | |
| 5797 | + sel: json["SEL"], | |
| 5798 | + ); | |
| 5799 | + | |
| 5800 | + Map<String, dynamic> toJson() => { | |
| 5801 | + "SEL": sel, | |
| 5802 | + }; | |
| 5803 | +} | |
| 5804 | + | |
| 5797 | 5805 | class Select { |
| 5798 | 5806 | final int select; |
| 5799 | 5807 | |
| @@ -6530,54 +6538,6 @@ class UnmarshalJson { | ||
| 6530 | 6538 | }; |
| 6531 | 6539 | } |
| 6532 | 6540 | |
| 6533 | -class Unowned { | |
| 6534 | - final int unowned; | |
| 6535 | - | |
| 6536 | - Unowned({ | |
| 6537 | - required this.unowned, | |
| 6538 | - }); | |
| 6539 | - | |
| 6540 | - factory Unowned.fromJson(Map<String, dynamic> json) => Unowned( | |
| 6541 | - unowned: json["unowned"], | |
| 6542 | - ); | |
| 6543 | - | |
| 6544 | - Map<String, dynamic> toJson() => { | |
| 6545 | - "unowned": unowned, | |
| 6546 | - }; | |
| 6547 | -} | |
| 6548 | - | |
| 6549 | -class Unsafe { | |
| 6550 | - final int unsafe; | |
| 6551 | - | |
| 6552 | - Unsafe({ | |
| 6553 | - required this.unsafe, | |
| 6554 | - }); | |
| 6555 | - | |
| 6556 | - factory Unsafe.fromJson(Map<String, dynamic> json) => Unsafe( | |
| 6557 | - unsafe: json["unsafe"], | |
| 6558 | - ); | |
| 6559 | - | |
| 6560 | - Map<String, dynamic> toJson() => { | |
| 6561 | - "unsafe": unsafe, | |
| 6562 | - }; | |
| 6563 | -} | |
| 6564 | - | |
| 6565 | -class UseSerializers { | |
| 6566 | - final int useSerializers; | |
| 6567 | - | |
| 6568 | - UseSerializers({ | |
| 6569 | - required this.useSerializers, | |
| 6570 | - }); | |
| 6571 | - | |
| 6572 | - factory UseSerializers.fromJson(Map<String, dynamic> json) => UseSerializers( | |
| 6573 | - useSerializers: json["UseSerializers"], | |
| 6574 | - ); | |
| 6575 | - | |
| 6576 | - Map<String, dynamic> toJson() => { | |
| 6577 | - "UseSerializers": useSerializers, | |
| 6578 | - }; | |
| 6579 | -} | |
| 6580 | - | |
| 6581 | 6541 | class Obj6 { |
| 6582 | 6542 | final int dummy; |
| 6583 | 6543 | final Var obj6Var; |
| @@ -6585,7 +6545,10 @@ class Obj6 { | ||
| 6585 | 6545 | final While obj6While; |
| 6586 | 6546 | final With obj6With; |
| 6587 | 6547 | final Yield obj6Yield; |
| 6548 | + final Unowned unowned; | |
| 6549 | + final Unsafe unsafe; | |
| 6588 | 6550 | final Unsigned unsigned; |
| 6551 | + final UseSerializers useSerializers; | |
| 6589 | 6552 | final Ushort ushort; |
| 6590 | 6553 | final Using using; |
| 6591 | 6554 | final Utf8JsonReader utf8JsonReader; |
| @@ -6608,7 +6571,10 @@ class Obj6 { | ||
| 6608 | 6571 | required this.obj6While, |
| 6609 | 6572 | required this.obj6With, |
| 6610 | 6573 | required this.obj6Yield, |
| 6574 | + required this.unowned, | |
| 6575 | + required this.unsafe, | |
| 6611 | 6576 | required this.unsigned, |
| 6577 | + required this.useSerializers, | |
| 6612 | 6578 | required this.ushort, |
| 6613 | 6579 | required this.using, |
| 6614 | 6580 | required this.utf8JsonReader, |
| @@ -6632,7 +6598,10 @@ class Obj6 { | ||
| 6632 | 6598 | obj6While: While.fromJson(json["while"]), |
| 6633 | 6599 | obj6With: With.fromJson(json["with"]), |
| 6634 | 6600 | obj6Yield: Yield.fromJson(json["yield"]), |
| 6601 | + unowned: Unowned.fromJson(json["unowned"]), | |
| 6602 | + unsafe: Unsafe.fromJson(json["unsafe"]), | |
| 6635 | 6603 | unsigned: Unsigned.fromJson(json["unsigned"]), |
| 6604 | + useSerializers: UseSerializers.fromJson(json["UseSerializers"]), | |
| 6636 | 6605 | ushort: Ushort.fromJson(json["ushort"]), |
| 6637 | 6606 | using: Using.fromJson(json["using"]), |
| 6638 | 6607 | utf8JsonReader: Utf8JsonReader.fromJson(json["Utf8JsonReader"]), |
| @@ -6656,7 +6625,10 @@ class Obj6 { | ||
| 6656 | 6625 | "while": obj6While.toJson(), |
| 6657 | 6626 | "with": obj6With.toJson(), |
| 6658 | 6627 | "yield": obj6Yield.toJson(), |
| 6628 | + "unowned": unowned.toJson(), | |
| 6629 | + "unsafe": unsafe.toJson(), | |
| 6659 | 6630 | "unsigned": unsigned.toJson(), |
| 6631 | + "UseSerializers": useSerializers.toJson(), | |
| 6660 | 6632 | "ushort": ushort.toJson(), |
| 6661 | 6633 | "using": using.toJson(), |
| 6662 | 6634 | "Utf8JsonReader": utf8JsonReader.toJson(), |
| @@ -6754,6 +6726,38 @@ class Yield { | ||
| 6754 | 6726 | }; |
| 6755 | 6727 | } |
| 6756 | 6728 | |
| 6729 | +class Unowned { | |
| 6730 | + final int unowned; | |
| 6731 | + | |
| 6732 | + Unowned({ | |
| 6733 | + required this.unowned, | |
| 6734 | + }); | |
| 6735 | + | |
| 6736 | + factory Unowned.fromJson(Map<String, dynamic> json) => Unowned( | |
| 6737 | + unowned: json["unowned"], | |
| 6738 | + ); | |
| 6739 | + | |
| 6740 | + Map<String, dynamic> toJson() => { | |
| 6741 | + "unowned": unowned, | |
| 6742 | + }; | |
| 6743 | +} | |
| 6744 | + | |
| 6745 | +class Unsafe { | |
| 6746 | + final int unsafe; | |
| 6747 | + | |
| 6748 | + Unsafe({ | |
| 6749 | + required this.unsafe, | |
| 6750 | + }); | |
| 6751 | + | |
| 6752 | + factory Unsafe.fromJson(Map<String, dynamic> json) => Unsafe( | |
| 6753 | + unsafe: json["unsafe"], | |
| 6754 | + ); | |
| 6755 | + | |
| 6756 | + Map<String, dynamic> toJson() => { | |
| 6757 | + "unsafe": unsafe, | |
| 6758 | + }; | |
| 6759 | +} | |
| 6760 | + | |
| 6757 | 6761 | class Unsigned { |
| 6758 | 6762 | final int unsigned; |
| 6759 | 6763 | |
| @@ -6770,6 +6774,22 @@ class Unsigned { | ||
| 6770 | 6774 | }; |
| 6771 | 6775 | } |
| 6772 | 6776 | |
| 6777 | +class UseSerializers { | |
| 6778 | + final int useSerializers; | |
| 6779 | + | |
| 6780 | + UseSerializers({ | |
| 6781 | + required this.useSerializers, | |
| 6782 | + }); | |
| 6783 | + | |
| 6784 | + factory UseSerializers.fromJson(Map<String, dynamic> json) => UseSerializers( | |
| 6785 | + useSerializers: json["UseSerializers"], | |
| 6786 | + ); | |
| 6787 | + | |
| 6788 | + Map<String, dynamic> toJson() => { | |
| 6789 | + "UseSerializers": useSerializers, | |
| 6790 | + }; | |
| 6791 | +} | |
| 6792 | + | |
| 6773 | 6793 | class Ushort { |
| 6774 | 6794 | final int ushort; |
Melixirdefault / QuickType.ex+347 −305
| @@ -7455,6 +7455,45 @@ defmodule Long do | ||
| 7455 | 7455 | end |
| 7456 | 7456 | end |
| 7457 | 7457 | |
| 7458 | +defmodule MakeDictEncoder do | |
| 7459 | + @enforce_keys [:make_dict_encoder] | |
| 7460 | + defstruct [:make_dict_encoder] | |
| 7461 | + | |
| 7462 | + @type t :: %__MODULE__{ | |
| 7463 | + make_dict_encoder: integer() | |
| 7464 | + } | |
| 7465 | + | |
| 7466 | + def decode_make_dict_encoder(value) when is_integer(value), do: value | |
| 7467 | + def decode_make_dict_encoder(_), do: {:error, "Unexpected type when decoding MakeDictEncoder.make_dict_encoder"} | |
| 7468 | + | |
| 7469 | + def encode_make_dict_encoder(value) when is_integer(value), do: value | |
| 7470 | + def encode_make_dict_encoder(_), do: {:error, "Unexpected type when encoding MakeDictEncoder.make_dict_encoder"} | |
| 7471 | + | |
| 7472 | + def from_map(m) do | |
| 7473 | + %MakeDictEncoder{ | |
| 7474 | + make_dict_encoder: decode_make_dict_encoder(m["makeDictEncoder"]), | |
| 7475 | + } | |
| 7476 | + end | |
| 7477 | + | |
| 7478 | + def from_json(json) do | |
| 7479 | + json | |
| 7480 | + |> Jason.decode!() | |
| 7481 | + |> from_map() | |
| 7482 | + end | |
| 7483 | + | |
| 7484 | + def to_map(struct) do | |
| 7485 | + %{ | |
| 7486 | + "makeDictEncoder" => struct.make_dict_encoder, | |
| 7487 | + } | |
| 7488 | + end | |
| 7489 | + | |
| 7490 | + def to_json(struct) do | |
| 7491 | + struct | |
| 7492 | + |> to_map() | |
| 7493 | + |> Jason.encode!() | |
| 7494 | + end | |
| 7495 | +end | |
| 7496 | + | |
| 7458 | 7497 | defmodule MapClass do |
| 7459 | 7498 | @enforce_keys [:map] |
| 7460 | 7499 | defstruct [:map] |
| @@ -7884,45 +7923,6 @@ defmodule Newtonsoft do | ||
| 7884 | 7923 | end |
| 7885 | 7924 | end |
| 7886 | 7925 | |
| 7887 | -defmodule No do | |
| 7888 | - @enforce_keys [:no] | |
| 7889 | - defstruct [:no] | |
| 7890 | - | |
| 7891 | - @type t :: %__MODULE__{ | |
| 7892 | - no: integer() | |
| 7893 | - } | |
| 7894 | - | |
| 7895 | - def decode_no(value) when is_integer(value), do: value | |
| 7896 | - def decode_no(_), do: {:error, "Unexpected type when decoding No.no"} | |
| 7897 | - | |
| 7898 | - def encode_no(value) when is_integer(value), do: value | |
| 7899 | - def encode_no(_), do: {:error, "Unexpected type when encoding No.no"} | |
| 7900 | - | |
| 7901 | - def from_map(m) do | |
| 7902 | - %No{ | |
| 7903 | - no: decode_no(m["NO"]), | |
| 7904 | - } | |
| 7905 | - end | |
| 7906 | - | |
| 7907 | - def from_json(json) do | |
| 7908 | - json | |
| 7909 | - |> Jason.decode!() | |
| 7910 | - |> from_map() | |
| 7911 | - end | |
| 7912 | - | |
| 7913 | - def to_map(struct) do | |
| 7914 | - %{ | |
| 7915 | - "NO" => struct.no, | |
| 7916 | - } | |
| 7917 | - end | |
| 7918 | - | |
| 7919 | - def to_json(struct) do | |
| 7920 | - struct | |
| 7921 | - |> to_map() | |
| 7922 | - |> Jason.encode!() | |
| 7923 | - end | |
| 7924 | -end | |
| 7925 | - | |
| 7926 | 7926 | defmodule ImportClass do |
| 7927 | 7927 | @enforce_keys [:import_import] |
| 7928 | 7928 | defstruct [:import_import] |
| @@ -8001,48 +8001,9 @@ defmodule InClass do | ||
| 8001 | 8001 | end |
| 8002 | 8002 | end |
| 8003 | 8003 | |
| 8004 | -defmodule NilClass do | |
| 8005 | - @enforce_keys [:nil_nil] | |
| 8006 | - defstruct [:nil_nil] | |
| 8007 | - | |
| 8008 | - @type t :: %__MODULE__{ | |
| 8009 | - nil_nil: integer() | |
| 8010 | - } | |
| 8011 | - | |
| 8012 | - def decode_nil_nil(value) when is_integer(value), do: value | |
| 8013 | - def decode_nil_nil(_), do: {:error, "Unexpected type when decoding NilClass.nil_nil"} | |
| 8014 | - | |
| 8015 | - def encode_nil_nil(value) when is_integer(value), do: value | |
| 8016 | - def encode_nil_nil(_), do: {:error, "Unexpected type when encoding NilClass.nil_nil"} | |
| 8017 | - | |
| 8018 | - def from_map(m) do | |
| 8019 | - %NilClass{ | |
| 8020 | - nil_nil: decode_nil_nil(m["nil"]), | |
| 8021 | - } | |
| 8022 | - end | |
| 8023 | - | |
| 8024 | - def from_json(json) do | |
| 8025 | - json | |
| 8026 | - |> Jason.decode!() | |
| 8027 | - |> from_map() | |
| 8028 | - end | |
| 8029 | - | |
| 8030 | - def to_map(struct) do | |
| 8031 | - %{ | |
| 8032 | - "nil" => struct.nil_nil, | |
| 8033 | - } | |
| 8034 | - end | |
| 8035 | - | |
| 8036 | - def to_json(struct) do | |
| 8037 | - struct | |
| 8038 | - |> to_map() | |
| 8039 | - |> Jason.encode!() | |
| 8040 | - end | |
| 8041 | -end | |
| 8042 | - | |
| 8043 | 8004 | defmodule Obj3 do |
| 8044 | - @enforce_keys [:dummy, :goto, :guard, :has_own_property, :hash_code, :hashable, :hasher, :id, :if, :imp, :implements, :implicit, :indirect, :infix, :init, :inline, :inout, :instanceof, :int, :interface, :internal, :is, :iso_date_time_offset_converter, :iterable, :jdec, :jenc, :jpipe, :json, :json_any, :json_coding_key, :json_converter, :json_decoder, :json_encoder, :json_exception, :json_generator, :json_node, :json_null, :json_parser, :json_reader, :json_serializer, :json_token, :json_token_type, :json_writer, :lambda, :lazy, :left, :let, :list, :locale, :lock, :long, :map, :map_entry, :marshal_json, :metadata_property_handling, :module, :mutable, :mutating, :namespace, :native, :new, :newtonsoft, :no, :obj3_import, :obj3_in, :obj3_nil] | |
| 8045 | - defstruct [:dummy, :goto, :guard, :has_own_property, :hash_code, :hashable, :hasher, :id, :if, :imp, :implements, :implicit, :indirect, :infix, :init, :inline, :inout, :instanceof, :int, :interface, :internal, :is, :iso_date_time_offset_converter, :iterable, :jdec, :jenc, :jpipe, :json, :json_any, :json_coding_key, :json_converter, :json_decoder, :json_encoder, :json_exception, :json_generator, :json_node, :json_null, :json_parser, :json_reader, :json_serializer, :json_token, :json_token_type, :json_writer, :lambda, :lazy, :left, :let, :list, :locale, :lock, :long, :map, :map_entry, :marshal_json, :metadata_property_handling, :module, :mutable, :mutating, :namespace, :native, :new, :newtonsoft, :no, :obj3_import, :obj3_in, :obj3_nil] | |
| 8005 | + @enforce_keys [:dummy, :goto, :guard, :has_own_property, :hash_code, :hashable, :hasher, :id, :if, :imp, :implements, :implicit, :indirect, :infix, :init, :inline, :inout, :instanceof, :int, :interface, :internal, :is, :iso_date_time_offset_converter, :iterable, :jdec, :jenc, :jpipe, :json, :json_any, :json_coding_key, :json_converter, :json_decoder, :json_encoder, :json_exception, :json_generator, :json_node, :json_null, :json_parser, :json_reader, :json_serializer, :json_token, :json_token_type, :json_writer, :lambda, :lazy, :left, :let, :list, :locale, :lock, :long, :make_dict_encoder, :map, :map_entry, :marshal_json, :metadata_property_handling, :module, :mutable, :mutating, :namespace, :native, :new, :newtonsoft, :obj3_import, :obj3_in] | |
| 8006 | + defstruct [:dummy, :goto, :guard, :has_own_property, :hash_code, :hashable, :hasher, :id, :if, :imp, :implements, :implicit, :indirect, :infix, :init, :inline, :inout, :instanceof, :int, :interface, :internal, :is, :iso_date_time_offset_converter, :iterable, :jdec, :jenc, :jpipe, :json, :json_any, :json_coding_key, :json_converter, :json_decoder, :json_encoder, :json_exception, :json_generator, :json_node, :json_null, :json_parser, :json_reader, :json_serializer, :json_token, :json_token_type, :json_writer, :lambda, :lazy, :left, :let, :list, :locale, :lock, :long, :make_dict_encoder, :map, :map_entry, :marshal_json, :metadata_property_handling, :module, :mutable, :mutating, :namespace, :native, :new, :newtonsoft, :obj3_import, :obj3_in] | |
| 8046 | 8007 | |
| 8047 | 8008 | @type t :: %__MODULE__{ |
| 8048 | 8009 | dummy: integer(), |
| @@ -8096,6 +8057,7 @@ defmodule Obj3 do | ||
| 8096 | 8057 | locale: Locale.t(), |
| 8097 | 8058 | lock: Lock.t(), |
| 8098 | 8059 | long: Long.t(), |
| 8060 | + make_dict_encoder: MakeDictEncoder.t(), | |
| 8099 | 8061 | map: MapClass.t(), |
| 8100 | 8062 | map_entry: MapEntry.t(), |
| 8101 | 8063 | marshal_json: MarshalJSON.t(), |
| @@ -8107,10 +8069,8 @@ defmodule Obj3 do | ||
| 8107 | 8069 | native: Native.t(), |
| 8108 | 8070 | new: New.t(), |
| 8109 | 8071 | newtonsoft: Newtonsoft.t(), |
| 8110 | - no: No.t(), | |
| 8111 | 8072 | obj3_import: ImportClass.t(), |
| 8112 | - obj3_in: InClass.t(), | |
| 8113 | - obj3_nil: NilClass.t() | |
| 8073 | + obj3_in: InClass.t() | |
| 8114 | 8074 | } |
| 8115 | 8075 | |
| 8116 | 8076 | def decode_dummy(value) when is_integer(value), do: value |
| @@ -8172,6 +8132,7 @@ defmodule Obj3 do | ||
| 8172 | 8132 | locale: Locale.from_map(m["Locale"]), |
| 8173 | 8133 | lock: Lock.from_map(m["lock"]), |
| 8174 | 8134 | long: Long.from_map(m["long"]), |
| 8135 | + make_dict_encoder: MakeDictEncoder.from_map(m["makeDictEncoder"]), | |
| 8175 | 8136 | map: MapClass.from_map(m["map"]), |
| 8176 | 8137 | map_entry: MapEntry.from_map(m["MapEntry"]), |
| 8177 | 8138 | marshal_json: MarshalJSON.from_map(m["MarshalJSON"]), |
| @@ -8183,10 +8144,8 @@ defmodule Obj3 do | ||
| 8183 | 8144 | native: Native.from_map(m["native"]), |
| 8184 | 8145 | new: New.from_map(m["new"]), |
| 8185 | 8146 | newtonsoft: Newtonsoft.from_map(m["newtonsoft"]), |
| 8186 | - no: No.from_map(m["NO"]), | |
| 8187 | 8147 | obj3_import: ImportClass.from_map(m["import"]), |
| 8188 | 8148 | obj3_in: InClass.from_map(m["in"]), |
| 8189 | - obj3_nil: NilClass.from_map(m["nil"]), | |
| 8190 | 8149 | } |
| 8191 | 8150 | end |
| 8192 | 8151 | |
| @@ -8249,6 +8208,7 @@ defmodule Obj3 do | ||
| 8249 | 8208 | "Locale" => Locale.to_map(struct.locale), |
| 8250 | 8209 | "lock" => Lock.to_map(struct.lock), |
| 8251 | 8210 | "long" => Long.to_map(struct.long), |
| 8211 | + "makeDictEncoder" => MakeDictEncoder.to_map(struct.make_dict_encoder), | |
| 8252 | 8212 | "map" => MapClass.to_map(struct.map), |
| 8253 | 8213 | "MapEntry" => MapEntry.to_map(struct.map_entry), |
| 8254 | 8214 | "MarshalJSON" => MarshalJSON.to_map(struct.marshal_json), |
| @@ -8260,10 +8220,47 @@ defmodule Obj3 do | ||
| 8260 | 8220 | "native" => Native.to_map(struct.native), |
| 8261 | 8221 | "new" => New.to_map(struct.new), |
| 8262 | 8222 | "newtonsoft" => Newtonsoft.to_map(struct.newtonsoft), |
| 8263 | - "NO" => No.to_map(struct.no), | |
| 8264 | 8223 | "import" => ImportClass.to_map(struct.obj3_import), |
| 8265 | 8224 | "in" => InClass.to_map(struct.obj3_in), |
| 8266 | - "nil" => NilClass.to_map(struct.obj3_nil), | |
| 8225 | + } | |
| 8226 | + end | |
| 8227 | + | |
| 8228 | + def to_json(struct) do | |
| 8229 | + struct | |
| 8230 | + |> to_map() | |
| 8231 | + |> Jason.encode!() | |
| 8232 | + end | |
| 8233 | +end | |
| 8234 | + | |
| 8235 | +defmodule No do | |
| 8236 | + @enforce_keys [:no] | |
| 8237 | + defstruct [:no] | |
| 8238 | + | |
| 8239 | + @type t :: %__MODULE__{ | |
| 8240 | + no: integer() | |
| 8241 | + } | |
| 8242 | + | |
| 8243 | + def decode_no(value) when is_integer(value), do: value | |
| 8244 | + def decode_no(_), do: {:error, "Unexpected type when decoding No.no"} | |
| 8245 | + | |
| 8246 | + def encode_no(value) when is_integer(value), do: value | |
| 8247 | + def encode_no(_), do: {:error, "Unexpected type when encoding No.no"} | |
| 8248 | + | |
| 8249 | + def from_map(m) do | |
| 8250 | + %No{ | |
| 8251 | + no: decode_no(m["NO"]), | |
| 8252 | + } | |
| 8253 | + end | |
| 8254 | + | |
| 8255 | + def from_json(json) do | |
| 8256 | + json | |
| 8257 | + |> Jason.decode!() | |
| 8258 | + |> from_map() | |
| 8259 | + end | |
| 8260 | + | |
| 8261 | + def to_map(struct) do | |
| 8262 | + %{ | |
| 8263 | + "NO" => struct.no, | |
| 8267 | 8264 | } |
| 8268 | 8265 | end |
| 8269 | 8266 | |
| @@ -8781,6 +8778,45 @@ defmodule Number do | ||
| 8781 | 8778 | end |
| 8782 | 8779 | end |
| 8783 | 8780 | |
| 8781 | +defmodule NilClass do | |
| 8782 | + @enforce_keys [:nil_nil] | |
| 8783 | + defstruct [:nil_nil] | |
| 8784 | + | |
| 8785 | + @type t :: %__MODULE__{ | |
| 8786 | + nil_nil: integer() | |
| 8787 | + } | |
| 8788 | + | |
| 8789 | + def decode_nil_nil(value) when is_integer(value), do: value | |
| 8790 | + def decode_nil_nil(_), do: {:error, "Unexpected type when decoding NilClass.nil_nil"} | |
| 8791 | + | |
| 8792 | + def encode_nil_nil(value) when is_integer(value), do: value | |
| 8793 | + def encode_nil_nil(_), do: {:error, "Unexpected type when encoding NilClass.nil_nil"} | |
| 8794 | + | |
| 8795 | + def from_map(m) do | |
| 8796 | + %NilClass{ | |
| 8797 | + nil_nil: decode_nil_nil(m["nil"]), | |
| 8798 | + } | |
| 8799 | + end | |
| 8800 | + | |
| 8801 | + def from_json(json) do | |
| 8802 | + json | |
| 8803 | + |> Jason.decode!() | |
| 8804 | + |> from_map() | |
| 8805 | + end | |
| 8806 | + | |
| 8807 | + def to_map(struct) do | |
| 8808 | + %{ | |
| 8809 | + "nil" => struct.nil_nil, | |
| 8810 | + } | |
| 8811 | + end | |
| 8812 | + | |
| 8813 | + def to_json(struct) do | |
| 8814 | + struct | |
| 8815 | + |> to_map() | |
| 8816 | + |> Jason.encode!() | |
| 8817 | + end | |
| 8818 | +end | |
| 8819 | + | |
| 8784 | 8820 | defmodule NoneClass do |
| 8785 | 8821 | @enforce_keys [:none] |
| 8786 | 8822 | defstruct [:none] |
| @@ -10692,90 +10728,13 @@ defmodule Sbyte do | ||
| 10692 | 10728 | end |
| 10693 | 10729 | end |
| 10694 | 10730 | |
| 10695 | -defmodule Sealed do | |
| 10696 | - @enforce_keys [:sealed] | |
| 10697 | - defstruct [:sealed] | |
| 10698 | - | |
| 10699 | - @type t :: %__MODULE__{ | |
| 10700 | - sealed: integer() | |
| 10701 | - } | |
| 10702 | - | |
| 10703 | - def decode_sealed(value) when is_integer(value), do: value | |
| 10704 | - def decode_sealed(_), do: {:error, "Unexpected type when decoding Sealed.sealed"} | |
| 10705 | - | |
| 10706 | - def encode_sealed(value) when is_integer(value), do: value | |
| 10707 | - def encode_sealed(_), do: {:error, "Unexpected type when encoding Sealed.sealed"} | |
| 10708 | - | |
| 10709 | - def from_map(m) do | |
| 10710 | - %Sealed{ | |
| 10711 | - sealed: decode_sealed(m["sealed"]), | |
| 10712 | - } | |
| 10713 | - end | |
| 10714 | - | |
| 10715 | - def from_json(json) do | |
| 10716 | - json | |
| 10717 | - |> Jason.decode!() | |
| 10718 | - |> from_map() | |
| 10719 | - end | |
| 10720 | - | |
| 10721 | - def to_map(struct) do | |
| 10722 | - %{ | |
| 10723 | - "sealed" => struct.sealed, | |
| 10724 | - } | |
| 10725 | - end | |
| 10726 | - | |
| 10727 | - def to_json(struct) do | |
| 10728 | - struct | |
| 10729 | - |> to_map() | |
| 10730 | - |> Jason.encode!() | |
| 10731 | - end | |
| 10732 | -end | |
| 10733 | - | |
| 10734 | -defmodule Sel do | |
| 10735 | - @enforce_keys [:sel] | |
| 10736 | - defstruct [:sel] | |
| 10737 | - | |
| 10738 | - @type t :: %__MODULE__{ | |
| 10739 | - sel: integer() | |
| 10740 | - } | |
| 10741 | - | |
| 10742 | - def decode_sel(value) when is_integer(value), do: value | |
| 10743 | - def decode_sel(_), do: {:error, "Unexpected type when decoding Sel.sel"} | |
| 10744 | - | |
| 10745 | - def encode_sel(value) when is_integer(value), do: value | |
| 10746 | - def encode_sel(_), do: {:error, "Unexpected type when encoding Sel.sel"} | |
| 10747 | - | |
| 10748 | - def from_map(m) do | |
| 10749 | - %Sel{ | |
| 10750 | - sel: decode_sel(m["SEL"]), | |
| 10751 | - } | |
| 10752 | - end | |
| 10753 | - | |
| 10754 | - def from_json(json) do | |
| 10755 | - json | |
| 10756 | - |> Jason.decode!() | |
| 10757 | - |> from_map() | |
| 10758 | - end | |
| 10759 | - | |
| 10760 | - def to_map(struct) do | |
| 10761 | - %{ | |
| 10762 | - "SEL" => struct.sel, | |
| 10763 | - } | |
| 10764 | - end | |
| 10765 | - | |
| 10766 | - def to_json(struct) do | |
| 10767 | - struct | |
| 10768 | - |> to_map() | |
| 10769 | - |> Jason.encode!() | |
| 10770 | - end | |
| 10771 | -end | |
| 10772 | - | |
| 10773 | 10731 | defmodule Obj4 do |
| 10774 | - @enforce_keys [:dummy, :no_such_method, :noexcept, :nonatomic, :none, :nonlocal, :nonmutating, :not_eq, :ns_error, :ns_object, :ns_string, :null, :nullptr, :number, :obj4_none, :obj4_not, :obj4_null, :obj4_or, :obj4_protocol, :object, :object_mapper, :of, :oneway, :open, :operator, :optional, :or_eq, :out, :override, :package, :params, :pass, :port, :postfix, :precedence, :prefix, :print, :print_members, :printf, :private, :protected, :protocol, :public, :quicktype, :raise, :range, :readonly, :ref, :reg_exp, :register, :reinterpret_cast, :repeat, :require, :required, :requires, :restrict, :retain, :rethrows, :return, :right, :runtime_type, :s, :sbyte, :sealed, :sel] | |
| 10775 | - defstruct [:dummy, :no_such_method, :noexcept, :nonatomic, :none, :nonlocal, :nonmutating, :not_eq, :ns_error, :ns_object, :ns_string, :null, :nullptr, :number, :obj4_none, :obj4_not, :obj4_null, :obj4_or, :obj4_protocol, :object, :object_mapper, :of, :oneway, :open, :operator, :optional, :or_eq, :out, :override, :package, :params, :pass, :port, :postfix, :precedence, :prefix, :print, :print_members, :printf, :private, :protected, :protocol, :public, :quicktype, :raise, :range, :readonly, :ref, :reg_exp, :register, :reinterpret_cast, :repeat, :require, :required, :requires, :restrict, :retain, :rethrows, :return, :right, :runtime_type, :s, :sbyte, :sealed, :sel] | |
| 10732 | + @enforce_keys [:dummy, :no, :no_such_method, :noexcept, :nonatomic, :none, :nonlocal, :nonmutating, :not_eq, :ns_error, :ns_object, :ns_string, :null, :nullptr, :number, :obj4_nil, :obj4_none, :obj4_not, :obj4_null, :obj4_or, :obj4_protocol, :object, :object_mapper, :of, :oneway, :open, :operator, :optional, :or_eq, :out, :override, :package, :params, :pass, :port, :postfix, :precedence, :prefix, :print, :print_members, :printf, :private, :protected, :protocol, :public, :quicktype, :raise, :range, :readonly, :ref, :reg_exp, :register, :reinterpret_cast, :repeat, :require, :required, :requires, :restrict, :retain, :rethrows, :return, :right, :runtime_type, :s, :sbyte] | |
| 10733 | + defstruct [:dummy, :no, :no_such_method, :noexcept, :nonatomic, :none, :nonlocal, :nonmutating, :not_eq, :ns_error, :ns_object, :ns_string, :null, :nullptr, :number, :obj4_nil, :obj4_none, :obj4_not, :obj4_null, :obj4_or, :obj4_protocol, :object, :object_mapper, :of, :oneway, :open, :operator, :optional, :or_eq, :out, :override, :package, :params, :pass, :port, :postfix, :precedence, :prefix, :print, :print_members, :printf, :private, :protected, :protocol, :public, :quicktype, :raise, :range, :readonly, :ref, :reg_exp, :register, :reinterpret_cast, :repeat, :require, :required, :requires, :restrict, :retain, :rethrows, :return, :right, :runtime_type, :s, :sbyte] | |
| 10776 | 10734 | |
| 10777 | 10735 | @type t :: %__MODULE__{ |
| 10778 | 10736 | dummy: integer(), |
| 10737 | + no: No.t(), | |
| 10779 | 10738 | no_such_method: NoSuchMethod.t(), |
| 10780 | 10739 | noexcept: Noexcept.t(), |
| 10781 | 10740 | nonatomic: Nonatomic.t(), |
| @@ -10789,6 +10748,7 @@ defmodule Obj4 do | ||
| 10789 | 10748 | null: Null.t(), |
| 10790 | 10749 | nullptr: Nullptr.t(), |
| 10791 | 10750 | number: Number.t(), |
| 10751 | + obj4_nil: NilClass.t(), | |
| 10792 | 10752 | obj4_none: NoneClass.t(), |
| 10793 | 10753 | obj4_not: NotClass.t(), |
| 10794 | 10754 | obj4_null: NullClass.t(), |
| @@ -10837,9 +10797,7 @@ defmodule Obj4 do | ||
| 10837 | 10797 | right: Right.t(), |
| 10838 | 10798 | runtime_type: RuntimeType.t(), |
| 10839 | 10799 | s: S.t(), |
| 10840 | - sbyte: Sbyte.t(), | |
| 10841 | - sealed: Sealed.t(), | |
| 10842 | - sel: Sel.t() | |
| 10800 | + sbyte: Sbyte.t() | |
| 10843 | 10801 | } |
| 10844 | 10802 | |
| 10845 | 10803 | def decode_dummy(value) when is_integer(value), do: value |
| @@ -10851,6 +10809,7 @@ defmodule Obj4 do | ||
| 10851 | 10809 | def from_map(m) do |
| 10852 | 10810 | %Obj4{ |
| 10853 | 10811 | dummy: decode_dummy(m["dummy"]), |
| 10812 | + no: No.from_map(m["NO"]), | |
| 10854 | 10813 | no_such_method: NoSuchMethod.from_map(m["noSuchMethod"]), |
| 10855 | 10814 | noexcept: Noexcept.from_map(m["noexcept"]), |
| 10856 | 10815 | nonatomic: Nonatomic.from_map(m["nonatomic"]), |
| @@ -10864,6 +10823,7 @@ defmodule Obj4 do | ||
| 10864 | 10823 | null: Null.from_map(m["NULL"]), |
| 10865 | 10824 | nullptr: Nullptr.from_map(m["nullptr"]), |
| 10866 | 10825 | number: Number.from_map(m["number"]), |
| 10826 | + obj4_nil: NilClass.from_map(m["nil"]), | |
| 10867 | 10827 | obj4_none: NoneClass.from_map(m["none"]), |
| 10868 | 10828 | obj4_not: NotClass.from_map(m["not"]), |
| 10869 | 10829 | obj4_null: NullClass.from_map(m["null"]), |
| @@ -10913,8 +10873,6 @@ defmodule Obj4 do | ||
| 10913 | 10873 | runtime_type: RuntimeType.from_map(m["runtimeType"]), |
| 10914 | 10874 | s: S.from_map(m["s"]), |
| 10915 | 10875 | sbyte: Sbyte.from_map(m["sbyte"]), |
| 10916 | - sealed: Sealed.from_map(m["sealed"]), | |
| 10917 | - sel: Sel.from_map(m["SEL"]), | |
| 10918 | 10876 | } |
| 10919 | 10877 | end |
| 10920 | 10878 | |
| @@ -10927,6 +10885,7 @@ defmodule Obj4 do | ||
| 10927 | 10885 | def to_map(struct) do |
| 10928 | 10886 | %{ |
| 10929 | 10887 | "dummy" => struct.dummy, |
| 10888 | + "NO" => No.to_map(struct.no), | |
| 10930 | 10889 | "noSuchMethod" => NoSuchMethod.to_map(struct.no_such_method), |
| 10931 | 10890 | "noexcept" => Noexcept.to_map(struct.noexcept), |
| 10932 | 10891 | "nonatomic" => Nonatomic.to_map(struct.nonatomic), |
| @@ -10940,6 +10899,7 @@ defmodule Obj4 do | ||
| 10940 | 10899 | "NULL" => Null.to_map(struct.null), |
| 10941 | 10900 | "nullptr" => Nullptr.to_map(struct.nullptr), |
| 10942 | 10901 | "number" => Number.to_map(struct.number), |
| 10902 | + "nil" => NilClass.to_map(struct.obj4_nil), | |
| 10943 | 10903 | "none" => NoneClass.to_map(struct.obj4_none), |
| 10944 | 10904 | "not" => NotClass.to_map(struct.obj4_not), |
| 10945 | 10905 | "null" => NullClass.to_map(struct.obj4_null), |
| @@ -10989,8 +10949,6 @@ defmodule Obj4 do | ||
| 10989 | 10949 | "runtimeType" => RuntimeType.to_map(struct.runtime_type), |
| 10990 | 10950 | "s" => S.to_map(struct.s), |
| 10991 | 10951 | "sbyte" => Sbyte.to_map(struct.sbyte), |
| 10992 | - "sealed" => Sealed.to_map(struct.sealed), | |
| 10993 | - "SEL" => Sel.to_map(struct.sel), | |
| 10994 | 10952 | } |
| 10995 | 10953 | end |
| 10996 | 10954 | |
| @@ -11196,6 +11154,84 @@ defmodule PrimitiveKind do | ||
| 11196 | 11154 | end |
| 11197 | 11155 | end |
| 11198 | 11156 | |
| 11157 | +defmodule Sealed do | |
| 11158 | + @enforce_keys [:sealed] | |
| 11159 | + defstruct [:sealed] | |
| 11160 | + | |
| 11161 | + @type t :: %__MODULE__{ | |
| 11162 | + sealed: integer() | |
| 11163 | + } | |
| 11164 | + | |
| 11165 | + def decode_sealed(value) when is_integer(value), do: value | |
| 11166 | + def decode_sealed(_), do: {:error, "Unexpected type when decoding Sealed.sealed"} | |
| 11167 | + | |
| 11168 | + def encode_sealed(value) when is_integer(value), do: value | |
| 11169 | + def encode_sealed(_), do: {:error, "Unexpected type when encoding Sealed.sealed"} | |
| 11170 | + | |
| 11171 | + def from_map(m) do | |
| 11172 | + %Sealed{ | |
| 11173 | + sealed: decode_sealed(m["sealed"]), | |
| 11174 | + } | |
| 11175 | + end | |
| 11176 | + | |
| 11177 | + def from_json(json) do | |
| 11178 | + json | |
| 11179 | + |> Jason.decode!() | |
| 11180 | + |> from_map() | |
| 11181 | + end | |
| 11182 | + | |
| 11183 | + def to_map(struct) do | |
| 11184 | + %{ | |
| 11185 | + "sealed" => struct.sealed, | |
| 11186 | + } | |
| 11187 | + end | |
| 11188 | + | |
| 11189 | + def to_json(struct) do | |
| 11190 | + struct | |
| 11191 | + |> to_map() | |
| 11192 | + |> Jason.encode!() | |
| 11193 | + end | |
| 11194 | +end | |
| 11195 | + | |
| 11196 | +defmodule Sel do | |
| 11197 | + @enforce_keys [:sel] | |
| 11198 | + defstruct [:sel] | |
| 11199 | + | |
| 11200 | + @type t :: %__MODULE__{ | |
| 11201 | + sel: integer() | |
| 11202 | + } | |
| 11203 | + | |
| 11204 | + def decode_sel(value) when is_integer(value), do: value | |
| 11205 | + def decode_sel(_), do: {:error, "Unexpected type when decoding Sel.sel"} | |
| 11206 | + | |
| 11207 | + def encode_sel(value) when is_integer(value), do: value | |
| 11208 | + def encode_sel(_), do: {:error, "Unexpected type when encoding Sel.sel"} | |
| 11209 | + | |
| 11210 | + def from_map(m) do | |
| 11211 | + %Sel{ | |
| 11212 | + sel: decode_sel(m["SEL"]), | |
| 11213 | + } | |
| 11214 | + end | |
| 11215 | + | |
| 11216 | + def from_json(json) do | |
| 11217 | + json | |
| 11218 | + |> Jason.decode!() | |
| 11219 | + |> from_map() | |
| 11220 | + end | |
| 11221 | + | |
| 11222 | + def to_map(struct) do | |
| 11223 | + %{ | |
| 11224 | + "SEL" => struct.sel, | |
| 11225 | + } | |
| 11226 | + end | |
| 11227 | + | |
| 11228 | + def to_json(struct) do | |
| 11229 | + struct | |
| 11230 | + |> to_map() | |
| 11231 | + |> Jason.encode!() | |
| 11232 | + end | |
| 11233 | +end | |
| 11234 | + | |
| 11199 | 11235 | defmodule Select do |
| 11200 | 11236 | @enforce_keys [:select] |
| 11201 | 11237 | defstruct [:select] |
| @@ -13419,126 +13455,9 @@ defmodule UnmarshalJSON do | ||
| 13419 | 13455 | end |
| 13420 | 13456 | end |
| 13421 | 13457 | |
| 13422 | -defmodule Unowned do | |
| 13423 | - @enforce_keys [:unowned] | |
| 13424 | - defstruct [:unowned] | |
| 13425 | - | |
| 13426 | - @type t :: %__MODULE__{ | |
| 13427 | - unowned: integer() | |
| 13428 | - } | |
| 13429 | - | |
| 13430 | - def decode_unowned(value) when is_integer(value), do: value | |
| 13431 | - def decode_unowned(_), do: {:error, "Unexpected type when decoding Unowned.unowned"} | |
| 13432 | - | |
| 13433 | - def encode_unowned(value) when is_integer(value), do: value | |
| 13434 | - def encode_unowned(_), do: {:error, "Unexpected type when encoding Unowned.unowned"} | |
| 13435 | - | |
| 13436 | - def from_map(m) do | |
| 13437 | - %Unowned{ | |
| 13438 | - unowned: decode_unowned(m["unowned"]), | |
| 13439 | - } | |
| 13440 | - end | |
| 13441 | - | |
| 13442 | - def from_json(json) do | |
| 13443 | - json | |
| 13444 | - |> Jason.decode!() | |
| 13445 | - |> from_map() | |
| 13446 | - end | |
| 13447 | - | |
| 13448 | - def to_map(struct) do | |
| 13449 | - %{ | |
| 13450 | - "unowned" => struct.unowned, | |
| 13451 | - } | |
| 13452 | - end | |
| 13453 | - | |
| 13454 | - def to_json(struct) do | |
| 13455 | - struct | |
| 13456 | - |> to_map() | |
| 13457 | - |> Jason.encode!() | |
| 13458 | - end | |
| 13459 | -end | |
| 13460 | - | |
| 13461 | -defmodule Unsafe do | |
| 13462 | - @enforce_keys [:unsafe] | |
| 13463 | - defstruct [:unsafe] | |
| 13464 | - | |
| 13465 | - @type t :: %__MODULE__{ | |
| 13466 | - unsafe: integer() | |
| 13467 | - } | |
| 13468 | - | |
| 13469 | - def decode_unsafe(value) when is_integer(value), do: value | |
| 13470 | - def decode_unsafe(_), do: {:error, "Unexpected type when decoding Unsafe.unsafe"} | |
| 13471 | - | |
| 13472 | - def encode_unsafe(value) when is_integer(value), do: value | |
| 13473 | - def encode_unsafe(_), do: {:error, "Unexpected type when encoding Unsafe.unsafe"} | |
| 13474 | - | |
| 13475 | - def from_map(m) do | |
| 13476 | - %Unsafe{ | |
| 13477 | - unsafe: decode_unsafe(m["unsafe"]), | |
| 13478 | - } | |
| 13479 | - end | |
| 13480 | - | |
| 13481 | - def from_json(json) do | |
| 13482 | - json | |
| 13483 | - |> Jason.decode!() | |
| 13484 | - |> from_map() | |
| 13485 | - end | |
| 13486 | - | |
| 13487 | - def to_map(struct) do | |
| 13488 | - %{ | |
| 13489 | - "unsafe" => struct.unsafe, | |
| 13490 | - } | |
| 13491 | - end | |
| 13492 | - | |
| 13493 | - def to_json(struct) do | |
| 13494 | - struct | |
| 13495 | - |> to_map() | |
| 13496 | - |> Jason.encode!() | |
| 13497 | - end | |
| 13498 | -end | |
| 13499 | - | |
| 13500 | -defmodule UseSerializers do | |
| 13501 | - @enforce_keys [:use_serializers] | |
| 13502 | - defstruct [:use_serializers] | |
| 13503 | - | |
| 13504 | - @type t :: %__MODULE__{ | |
| 13505 | - use_serializers: integer() | |
| 13506 | - } | |
| 13507 | - | |
| 13508 | - def decode_use_serializers(value) when is_integer(value), do: value | |
| 13509 | - def decode_use_serializers(_), do: {:error, "Unexpected type when decoding UseSerializers.use_serializers"} | |
| 13510 | - | |
| 13511 | - def encode_use_serializers(value) when is_integer(value), do: value | |
| 13512 | - def encode_use_serializers(_), do: {:error, "Unexpected type when encoding UseSerializers.use_serializers"} | |
| 13513 | - | |
| 13514 | - def from_map(m) do | |
| 13515 | - %UseSerializers{ | |
| 13516 | - use_serializers: decode_use_serializers(m["UseSerializers"]), | |
| 13517 | - } | |
| 13518 | - end | |
| 13519 | - | |
| 13520 | - def from_json(json) do | |
| 13521 | - json | |
| 13522 | - |> Jason.decode!() | |
| 13523 | - |> from_map() | |
| 13524 | - end | |
| 13525 | - | |
| 13526 | - def to_map(struct) do | |
| 13527 | - %{ | |
| 13528 | - "UseSerializers" => struct.use_serializers, | |
| 13529 | - } | |
| 13530 | - end | |
| 13531 | - | |
| 13532 | - def to_json(struct) do | |
| 13533 | - struct | |
| 13534 | - |> to_map() | |
| 13535 | - |> Jason.encode!() | |
| 13536 | - end | |
| 13537 | -end | |
| 13538 | - | |
| 13539 | 13458 | defmodule Obj5 do |
| 13540 | - @enforce_keys [:dummy, :k_serializer, :obj5_self, :obj5_true, :obj5_type, :primitive_kind, :select, :self, :sendable, :serial_descriptor, :serial_name, :serializable, :serialize, :serializer_provider, :set, :short, :signed, :simple_module, :sizeof, :stackalloc, :standards, :static, :static_assert, :static_cast, :std_deserializer, :std_serializer, :strictfp, :string, :struct, :subscript, :super, :switch, :symbol, :synchronized, :system, :template, :then, :this, :thread_local, :throw, :throws, :time_only, :time_only_converter, :time_zone, :to_dict, :to_json, :to_string, :top_level, :transient, :true_1, :try, :type, :typealias, :typedef, :typeid, :typename, :typeof, :uint, :ulong, :unchecked, :undefined, :union, :unmarshal_json, :unowned, :unsafe, :use_serializers] | |
| 13541 | - defstruct [:dummy, :k_serializer, :obj5_self, :obj5_true, :obj5_type, :primitive_kind, :select, :self, :sendable, :serial_descriptor, :serial_name, :serializable, :serialize, :serializer_provider, :set, :short, :signed, :simple_module, :sizeof, :stackalloc, :standards, :static, :static_assert, :static_cast, :std_deserializer, :std_serializer, :strictfp, :string, :struct, :subscript, :super, :switch, :symbol, :synchronized, :system, :template, :then, :this, :thread_local, :throw, :throws, :time_only, :time_only_converter, :time_zone, :to_dict, :to_json, :to_string, :top_level, :transient, :true_1, :try, :type, :typealias, :typedef, :typeid, :typename, :typeof, :uint, :ulong, :unchecked, :undefined, :union, :unmarshal_json, :unowned, :unsafe, :use_serializers] | |
| 13459 | + @enforce_keys [:dummy, :k_serializer, :obj5_self, :obj5_true, :obj5_type, :primitive_kind, :sealed, :sel, :select, :self, :sendable, :serial_descriptor, :serial_name, :serializable, :serialize, :serializer_provider, :set, :short, :signed, :simple_module, :sizeof, :stackalloc, :standards, :static, :static_assert, :static_cast, :std_deserializer, :std_serializer, :strictfp, :string, :struct, :subscript, :super, :switch, :symbol, :synchronized, :system, :template, :then, :this, :thread_local, :throw, :throws, :time_only, :time_only_converter, :time_zone, :to_dict, :to_json, :to_string, :top_level, :transient, :true_1, :try, :type, :typealias, :typedef, :typeid, :typename, :typeof, :uint, :ulong, :unchecked, :undefined, :union, :unmarshal_json] | |
| 13460 | + defstruct [:dummy, :k_serializer, :obj5_self, :obj5_true, :obj5_type, :primitive_kind, :sealed, :sel, :select, :self, :sendable, :serial_descriptor, :serial_name, :serializable, :serialize, :serializer_provider, :set, :short, :signed, :simple_module, :sizeof, :stackalloc, :standards, :static, :static_assert, :static_cast, :std_deserializer, :std_serializer, :strictfp, :string, :struct, :subscript, :super, :switch, :symbol, :synchronized, :system, :template, :then, :this, :thread_local, :throw, :throws, :time_only, :time_only_converter, :time_zone, :to_dict, :to_json, :to_string, :top_level, :transient, :true_1, :try, :type, :typealias, :typedef, :typeid, :typename, :typeof, :uint, :ulong, :unchecked, :undefined, :union, :unmarshal_json] | |
| 13542 | 13461 | |
| 13543 | 13462 | @type t :: %__MODULE__{ |
| 13544 | 13463 | dummy: integer(), |
| @@ -13547,6 +13466,8 @@ defmodule Obj5 do | ||
| 13547 | 13466 | obj5_true: TrueClass.t(), |
| 13548 | 13467 | obj5_type: TypeClass.t(), |
| 13549 | 13468 | primitive_kind: PrimitiveKind.t(), |
| 13469 | + sealed: Sealed.t(), | |
| 13470 | + sel: Sel.t(), | |
| 13550 | 13471 | select: Select.t(), |
| 13551 | 13472 | self: Self.t(), |
| 13552 | 13473 | sendable: Sendable.t(), |
| @@ -13603,10 +13524,7 @@ defmodule Obj5 do | ||
| 13603 | 13524 | unchecked: Unchecked.t(), |
| 13604 | 13525 | undefined: Undefined.t(), |
| 13605 | 13526 | union: Union.t(), |
| 13606 | - unmarshal_json: UnmarshalJSON.t(), | |
| 13607 | - unowned: Unowned.t(), | |
| 13608 | - unsafe: Unsafe.t(), | |
| 13609 | - use_serializers: UseSerializers.t() | |
| 13527 | + unmarshal_json: UnmarshalJSON.t() | |
| 13610 | 13528 | } |
| 13611 | 13529 | |
| 13612 | 13530 | def decode_dummy(value) when is_integer(value), do: value |
| @@ -13623,6 +13541,8 @@ defmodule Obj5 do | ||
| 13623 | 13541 | obj5_true: TrueClass.from_map(m["True"]), |
| 13624 | 13542 | obj5_type: TypeClass.from_map(m["type"]), |
| 13625 | 13543 | primitive_kind: PrimitiveKind.from_map(m["PrimitiveKind"]), |
| 13544 | + sealed: Sealed.from_map(m["sealed"]), | |
| 13545 | + sel: Sel.from_map(m["SEL"]), | |
| 13626 | 13546 | select: Select.from_map(m["select"]), |
| 13627 | 13547 | self: Self.from_map(m["Self"]), |
| 13628 | 13548 | sendable: Sendable.from_map(m["Sendable"]), |
| @@ -13680,9 +13600,6 @@ defmodule Obj5 do | ||
| 13680 | 13600 | undefined: Undefined.from_map(m["undefined"]), |
| 13681 | 13601 | union: Union.from_map(m["union"]), |
| 13682 | 13602 | unmarshal_json: UnmarshalJSON.from_map(m["UnmarshalJSON"]), |
| 13683 | - unowned: Unowned.from_map(m["unowned"]), | |
| 13684 | - unsafe: Unsafe.from_map(m["unsafe"]), | |
| 13685 | - use_serializers: UseSerializers.from_map(m["UseSerializers"]), | |
| 13686 | 13603 | } |
| 13687 | 13604 | end |
| 13688 | 13605 | |
| @@ -13700,6 +13617,8 @@ defmodule Obj5 do | ||
| 13700 | 13617 | "True" => TrueClass.to_map(struct.obj5_true), |
| 13701 | 13618 | "type" => TypeClass.to_map(struct.obj5_type), |
| 13702 | 13619 | "PrimitiveKind" => PrimitiveKind.to_map(struct.primitive_kind), |
| 13620 | + "sealed" => Sealed.to_map(struct.sealed), | |
| 13621 | + "SEL" => Sel.to_map(struct.sel), | |
| 13703 | 13622 | "select" => Select.to_map(struct.select), |
| 13704 | 13623 | "Self" => Self.to_map(struct.self), |
| 13705 | 13624 | "Sendable" => Sendable.to_map(struct.sendable), |
| @@ -13757,9 +13676,84 @@ defmodule Obj5 do | ||
| 13757 | 13676 | "undefined" => Undefined.to_map(struct.undefined), |
| 13758 | 13677 | "union" => Union.to_map(struct.union), |
| 13759 | 13678 | "UnmarshalJSON" => UnmarshalJSON.to_map(struct.unmarshal_json), |
| 13760 | - "unowned" => Unowned.to_map(struct.unowned), | |
| 13761 | - "unsafe" => Unsafe.to_map(struct.unsafe), | |
| 13762 | - "UseSerializers" => UseSerializers.to_map(struct.use_serializers), | |
| 13679 | + } | |
| 13680 | + end | |
| 13681 | + | |
| 13682 | + def to_json(struct) do | |
| 13683 | + struct | |
| 13684 | + |> to_map() | |
| 13685 | + |> Jason.encode!() | |
| 13686 | + end | |
| 13687 | +end | |
| 13688 | + | |
| 13689 | +defmodule Unowned do | |
| 13690 | + @enforce_keys [:unowned] | |
| 13691 | + defstruct [:unowned] | |
| 13692 | + | |
| 13693 | + @type t :: %__MODULE__{ | |
| 13694 | + unowned: integer() | |
| 13695 | + } | |
| 13696 | + | |
| 13697 | + def decode_unowned(value) when is_integer(value), do: value | |
| 13698 | + def decode_unowned(_), do: {:error, "Unexpected type when decoding Unowned.unowned"} | |
| 13699 | + | |
| 13700 | + def encode_unowned(value) when is_integer(value), do: value | |
| 13701 | + def encode_unowned(_), do: {:error, "Unexpected type when encoding Unowned.unowned"} | |
| 13702 | + | |
| 13703 | + def from_map(m) do | |
| 13704 | + %Unowned{ | |
| 13705 | + unowned: decode_unowned(m["unowned"]), | |
| 13706 | + } | |
| 13707 | + end | |
| 13708 | + | |
| 13709 | + def from_json(json) do | |
| 13710 | + json | |
| 13711 | + |> Jason.decode!() | |
| 13712 | + |> from_map() | |
| 13713 | + end | |
| 13714 | + | |
| 13715 | + def to_map(struct) do | |
| 13716 | + %{ | |
| 13717 | + "unowned" => struct.unowned, | |
| 13718 | + } | |
| 13719 | + end | |
| 13720 | + | |
| 13721 | + def to_json(struct) do | |
| 13722 | + struct | |
| 13723 | + |> to_map() | |
| 13724 | + |> Jason.encode!() | |
| 13725 | + end | |
| 13726 | +end | |
| 13727 | + | |
| 13728 | +defmodule Unsafe do | |
| 13729 | + @enforce_keys [:unsafe] | |
| 13730 | + defstruct [:unsafe] | |
| 13731 | + | |
| 13732 | + @type t :: %__MODULE__{ | |
| 13733 | + unsafe: integer() | |
| 13734 | + } | |
| 13735 | + | |
| 13736 | + def decode_unsafe(value) when is_integer(value), do: value | |
| 13737 | + def decode_unsafe(_), do: {:error, "Unexpected type when decoding Unsafe.unsafe"} | |
| 13738 | + | |
| 13739 | + def encode_unsafe(value) when is_integer(value), do: value | |
| 13740 | + def encode_unsafe(_), do: {:error, "Unexpected type when encoding Unsafe.unsafe"} | |
| 13741 | + | |
| 13742 | + def from_map(m) do | |
| 13743 | + %Unsafe{ | |
| 13744 | + unsafe: decode_unsafe(m["unsafe"]), | |
| 13745 | + } | |
| 13746 | + end | |
| 13747 | + | |
| 13748 | + def from_json(json) do | |
| 13749 | + json | |
| 13750 | + |> Jason.decode!() | |
| 13751 | + |> from_map() | |
| 13752 | + end | |
| 13753 | + | |
| 13754 | + def to_map(struct) do | |
| 13755 | + %{ | |
| 13756 | + "unsafe" => struct.unsafe, | |
| 13763 | 13757 | } |
| 13764 | 13758 | end |
| 13765 | 13759 | |
| @@ -13809,6 +13803,45 @@ defmodule Unsigned do | ||
| 13809 | 13803 | end |
| 13810 | 13804 | end |
| 13811 | 13805 | |
| 13806 | +defmodule UseSerializers do | |
| 13807 | + @enforce_keys [:use_serializers] | |
| 13808 | + defstruct [:use_serializers] | |
| 13809 | + | |
| 13810 | + @type t :: %__MODULE__{ | |
| 13811 | + use_serializers: integer() | |
| 13812 | + } | |
| 13813 | + | |
| 13814 | + def decode_use_serializers(value) when is_integer(value), do: value | |
| 13815 | + def decode_use_serializers(_), do: {:error, "Unexpected type when decoding UseSerializers.use_serializers"} | |
| 13816 | + | |
| 13817 | + def encode_use_serializers(value) when is_integer(value), do: value | |
| 13818 | + def encode_use_serializers(_), do: {:error, "Unexpected type when encoding UseSerializers.use_serializers"} | |
| 13819 | + | |
| 13820 | + def from_map(m) do | |
| 13821 | + %UseSerializers{ | |
| 13822 | + use_serializers: decode_use_serializers(m["UseSerializers"]), | |
| 13823 | + } | |
| 13824 | + end | |
| 13825 | + | |
| 13826 | + def from_json(json) do | |
| 13827 | + json | |
| 13828 | + |> Jason.decode!() | |
| 13829 | + |> from_map() | |
| 13830 | + end | |
| 13831 | + | |
| 13832 | + def to_map(struct) do | |
| 13833 | + %{ | |
| 13834 | + "UseSerializers" => struct.use_serializers, | |
| 13835 | + } | |
| 13836 | + end | |
| 13837 | + | |
| 13838 | + def to_json(struct) do | |
| 13839 | + struct | |
| 13840 | + |> to_map() | |
| 13841 | + |> Jason.encode!() | |
| 13842 | + end | |
| 13843 | +end | |
| 13844 | + | |
| 13812 | 13845 | defmodule Ushort do |
| 13813 | 13846 | @enforce_keys [:ushort] |
| 13814 | 13847 | defstruct [:ushort] |
| @@ -14551,12 +14584,15 @@ defmodule Yield do | ||
| 14551 | 14584 | end |
| 14552 | 14585 | |
| 14553 | 14586 | defmodule Obj6 do |
| 14554 | - @enforce_keys [:dummy, :unsigned, :ushort, :using, :utf8_json_reader, :utf8_json_writer, :uuid, :var, :virtual, :void, :volatile, :wchar_t, :weak, :where, :while, :will_set, :with, :xor, :xor_eq, :yes, :yield] | |
| 14555 | - defstruct [:dummy, :unsigned, :ushort, :using, :utf8_json_reader, :utf8_json_writer, :uuid, :var, :virtual, :void, :volatile, :wchar_t, :weak, :where, :while, :will_set, :with, :xor, :xor_eq, :yes, :yield] | |
| 14587 | + @enforce_keys [:dummy, :unowned, :unsafe, :unsigned, :use_serializers, :ushort, :using, :utf8_json_reader, :utf8_json_writer, :uuid, :var, :virtual, :void, :volatile, :wchar_t, :weak, :where, :while, :will_set, :with, :xor, :xor_eq, :yes, :yield] | |
| 14588 | + defstruct [:dummy, :unowned, :unsafe, :unsigned, :use_serializers, :ushort, :using, :utf8_json_reader, :utf8_json_writer, :uuid, :var, :virtual, :void, :volatile, :wchar_t, :weak, :where, :while, :will_set, :with, :xor, :xor_eq, :yes, :yield] | |
| 14556 | 14589 | |
| 14557 | 14590 | @type t :: %__MODULE__{ |
| 14558 | 14591 | dummy: integer(), |
| 14592 | + unowned: Unowned.t(), | |
| 14593 | + unsafe: Unsafe.t(), | |
| 14559 | 14594 | unsigned: Unsigned.t(), |
| 14595 | + use_serializers: UseSerializers.t(), | |
| 14560 | 14596 | ushort: Ushort.t(), |
| 14561 | 14597 | using: Using.t(), |
| 14562 | 14598 | utf8_json_reader: Utf8JSONReader.t(), |
| @@ -14587,7 +14623,10 @@ defmodule Obj6 do | ||
| 14587 | 14623 | def from_map(m) do |
| 14588 | 14624 | %Obj6{ |
| 14589 | 14625 | dummy: decode_dummy(m["dummy"]), |
| 14626 | + unowned: Unowned.from_map(m["unowned"]), | |
| 14627 | + unsafe: Unsafe.from_map(m["unsafe"]), | |
| 14590 | 14628 | unsigned: Unsigned.from_map(m["unsigned"]), |
| 14629 | + use_serializers: UseSerializers.from_map(m["UseSerializers"]), | |
| 14591 | 14630 | ushort: Ushort.from_map(m["ushort"]), |
| 14592 | 14631 | using: Using.from_map(m["using"]), |
| 14593 | 14632 | utf8_json_reader: Utf8JSONReader.from_map(m["Utf8JsonReader"]), |
| @@ -14619,7 +14658,10 @@ defmodule Obj6 do | ||
| 14619 | 14658 | def to_map(struct) do |
| 14620 | 14659 | %{ |
| 14621 | 14660 | "dummy" => struct.dummy, |
| 14661 | + "unowned" => Unowned.to_map(struct.unowned), | |
| 14662 | + "unsafe" => Unsafe.to_map(struct.unsafe), | |
| 14622 | 14663 | "unsigned" => Unsigned.to_map(struct.unsigned), |
| 14664 | + "UseSerializers" => UseSerializers.to_map(struct.use_serializers), | |
| 14623 | 14665 | "ushort" => Ushort.to_map(struct.ushort), |
| 14624 | 14666 | "using" => Using.to_map(struct.using), |
| 14625 | 14667 | "Utf8JsonReader" => Utf8JSONReader.to_map(struct.utf8_json_reader), |
Melmdefault / QuickType.elm+152 −133
| @@ -192,6 +192,7 @@ module QuickType exposing | ||
| 192 | 192 | , Locale |
| 193 | 193 | , Lock |
| 194 | 194 | , Long |
| 195 | + , MakeDictEncoder | |
| 195 | 196 | , Map |
| 196 | 197 | , MapEntry |
| 197 | 198 | , MarshalJSON |
| @@ -202,8 +203,6 @@ module QuickType exposing | ||
| 202 | 203 | , Native |
| 203 | 204 | , New |
| 204 | 205 | , Newtonsoft |
| 205 | - , Nil | |
| 206 | - , No | |
| 207 | 206 | , If |
| 208 | 207 | , Import |
| 209 | 208 | , In |
| @@ -212,6 +211,8 @@ module QuickType exposing | ||
| 212 | 211 | , Let |
| 213 | 212 | , Module |
| 214 | 213 | , Obj4 |
| 214 | + , Nil | |
| 215 | + , No | |
| 215 | 216 | , NoSuchMethod |
| 216 | 217 | , Noexcept |
| 217 | 218 | , Nonatomic |
| @@ -274,8 +275,6 @@ module QuickType exposing | ||
| 274 | 275 | , RuntimeType |
| 275 | 276 | , S |
| 276 | 277 | , Sbyte |
| 277 | - , Sealed | |
| 278 | - , Sel | |
| 279 | 278 | , Obj5 |
| 280 | 279 | , KSerializer |
| 281 | 280 | , SelfClass |
| @@ -285,6 +284,8 @@ module QuickType exposing | ||
| 285 | 284 | , Type |
| 286 | 285 | , PrimitiveKind |
| 287 | 286 | , TypeClass |
| 287 | + , Sealed | |
| 288 | + , Sel | |
| 288 | 289 | , Select |
| 289 | 290 | , Self |
| 290 | 291 | , Sendable |
| @@ -339,12 +340,12 @@ module QuickType exposing | ||
| 339 | 340 | , Undefined |
| 340 | 341 | , Union |
| 341 | 342 | , UnmarshalJSON |
| 342 | - , Unowned | |
| 343 | - , Unsafe | |
| 344 | - , UseSerializers | |
| 345 | 343 | , Obj6 |
| 346 | 344 | , Where |
| 345 | + , Unowned | |
| 346 | + , Unsafe | |
| 347 | 347 | , Unsigned |
| 348 | + , UseSerializers | |
| 348 | 349 | , Ushort |
| 349 | 350 | , Using |
| 350 | 351 | , Utf8JSONReader |
| @@ -1081,6 +1082,7 @@ type alias Obj3 = | ||
| 1081 | 1082 | , locale : Locale |
| 1082 | 1083 | , lock : Lock |
| 1083 | 1084 | , long : Long |
| 1085 | + , makeDictEncoder : MakeDictEncoder | |
| 1084 | 1086 | , map : Map |
| 1085 | 1087 | , mapEntry : MapEntry |
| 1086 | 1088 | , marshalJSON : MarshalJSON |
| @@ -1091,8 +1093,6 @@ type alias Obj3 = | ||
| 1091 | 1093 | , native : Native |
| 1092 | 1094 | , new : New |
| 1093 | 1095 | , newtonsoft : Newtonsoft |
| 1094 | - , nil : Nil | |
| 1095 | - , no : No | |
| 1096 | 1096 | , obj3If : If |
| 1097 | 1097 | , obj3Import : Import |
| 1098 | 1098 | , obj3In : In |
| @@ -1286,6 +1286,10 @@ type alias Long = | ||
| 1286 | 1286 | { long : Int |
| 1287 | 1287 | } |
| 1288 | 1288 | |
| 1289 | +type alias MakeDictEncoder = | |
| 1290 | + { makeDictEncoder : Int | |
| 1291 | + } | |
| 1292 | + | |
| 1289 | 1293 | type alias Map = |
| 1290 | 1294 | { map : Int |
| 1291 | 1295 | } |
| @@ -1326,14 +1330,6 @@ type alias Newtonsoft = | ||
| 1326 | 1330 | { newtonsoft : Int |
| 1327 | 1331 | } |
| 1328 | 1332 | |
| 1329 | -type alias Nil = | |
| 1330 | - { nil : Int | |
| 1331 | - } | |
| 1332 | - | |
| 1333 | -type alias No = | |
| 1334 | - { no : Int | |
| 1335 | - } | |
| 1336 | - | |
| 1337 | 1333 | type alias If = |
| 1338 | 1334 | { ifIf : Int |
| 1339 | 1335 | } |
| @@ -1364,6 +1360,8 @@ type alias Module = | ||
| 1364 | 1360 | |
| 1365 | 1361 | type alias Obj4 = |
| 1366 | 1362 | { dummy : Int |
| 1363 | + , nil : Nil | |
| 1364 | + , no : No | |
| 1367 | 1365 | , noSuchMethod : NoSuchMethod |
| 1368 | 1366 | , noexcept : Noexcept |
| 1369 | 1367 | , nonatomic : Nonatomic |
| @@ -1426,8 +1424,14 @@ type alias Obj4 = | ||
| 1426 | 1424 | , runtimeType : RuntimeType |
| 1427 | 1425 | , s : S |
| 1428 | 1426 | , sbyte : Sbyte |
| 1429 | - , sealed : Sealed | |
| 1430 | - , sel : Sel | |
| 1427 | + } | |
| 1428 | + | |
| 1429 | +type alias Nil = | |
| 1430 | + { nil : Int | |
| 1431 | + } | |
| 1432 | + | |
| 1433 | +type alias No = | |
| 1434 | + { no : Int | |
| 1431 | 1435 | } |
| 1432 | 1436 | |
| 1433 | 1437 | type alias NoSuchMethod = |
| @@ -1678,14 +1682,6 @@ type alias Sbyte = | ||
| 1678 | 1682 | { sbyte : Int |
| 1679 | 1683 | } |
| 1680 | 1684 | |
| 1681 | -type alias Sealed = | |
| 1682 | - { sealed : Int | |
| 1683 | - } | |
| 1684 | - | |
| 1685 | -type alias Sel = | |
| 1686 | - { sel : Int | |
| 1687 | - } | |
| 1688 | - | |
| 1689 | 1685 | type alias Obj5 = |
| 1690 | 1686 | { dummy : Int |
| 1691 | 1687 | , kSerializer : KSerializer |
| @@ -1696,6 +1692,8 @@ type alias Obj5 = | ||
| 1696 | 1692 | , obj5Type : Type |
| 1697 | 1693 | , primitiveKind : PrimitiveKind |
| 1698 | 1694 | , purpleType : TypeClass |
| 1695 | + , sealed : Sealed | |
| 1696 | + , sel : Sel | |
| 1699 | 1697 | , select : Select |
| 1700 | 1698 | , self : Self |
| 1701 | 1699 | , sendable : Sendable |
| @@ -1750,9 +1748,6 @@ type alias Obj5 = | ||
| 1750 | 1748 | , undefined : Undefined |
| 1751 | 1749 | , union : Union |
| 1752 | 1750 | , unmarshalJSON : UnmarshalJSON |
| 1753 | - , unowned : Unowned | |
| 1754 | - , unsafe : Unsafe | |
| 1755 | - , useSerializers : UseSerializers | |
| 1756 | 1751 | } |
| 1757 | 1752 | |
| 1758 | 1753 | type alias KSerializer = |
| @@ -1787,6 +1782,14 @@ type alias TypeClass = | ||
| 1787 | 1782 | { typeType : Int |
| 1788 | 1783 | } |
| 1789 | 1784 | |
| 1785 | +type alias Sealed = | |
| 1786 | + { sealed : Int | |
| 1787 | + } | |
| 1788 | + | |
| 1789 | +type alias Sel = | |
| 1790 | + { sel : Int | |
| 1791 | + } | |
| 1792 | + | |
| 1790 | 1793 | type alias Select = |
| 1791 | 1794 | { select : Int |
| 1792 | 1795 | } |
| @@ -2003,22 +2006,13 @@ type alias UnmarshalJSON = | ||
| 2003 | 2006 | { unmarshalJSON : Int |
| 2004 | 2007 | } |
| 2005 | 2008 | |
| 2006 | -type alias Unowned = | |
| 2007 | - { unowned : Int | |
| 2008 | - } | |
| 2009 | - | |
| 2010 | -type alias Unsafe = | |
| 2011 | - { unsafe : Int | |
| 2012 | - } | |
| 2013 | - | |
| 2014 | -type alias UseSerializers = | |
| 2015 | - { useSerializers : Int | |
| 2016 | - } | |
| 2017 | - | |
| 2018 | 2009 | type alias Obj6 = |
| 2019 | 2010 | { dummy : Int |
| 2020 | 2011 | , obj6Where : Where |
| 2012 | + , unowned : Unowned | |
| 2013 | + , unsafe : Unsafe | |
| 2021 | 2014 | , unsigned : Unsigned |
| 2015 | + , useSerializers : UseSerializers | |
| 2022 | 2016 | , ushort : Ushort |
| 2023 | 2017 | , using : Using |
| 2024 | 2018 | , utf8JSONReader : Utf8JSONReader |
| @@ -2043,10 +2037,22 @@ type alias Where = | ||
| 2043 | 2037 | { whereWhere : Int |
| 2044 | 2038 | } |
| 2045 | 2039 | |
| 2040 | +type alias Unowned = | |
| 2041 | + { unowned : Int | |
| 2042 | + } | |
| 2043 | + | |
| 2044 | +type alias Unsafe = | |
| 2045 | + { unsafe : Int | |
| 2046 | + } | |
| 2047 | + | |
| 2046 | 2048 | type alias Unsigned = |
| 2047 | 2049 | { unsigned : Int |
| 2048 | 2050 | } |
| 2049 | 2051 | |
| 2052 | +type alias UseSerializers = | |
| 2053 | + { useSerializers : Int | |
| 2054 | + } | |
| 2055 | + | |
| 2050 | 2056 | type alias Ushort = |
| 2051 | 2057 | { ushort : Int |
| 2052 | 2058 | } |
| @@ -3904,6 +3910,7 @@ obj3 = | ||
| 3904 | 3910 | |> Jpipe.required "Locale" locale |
| 3905 | 3911 | |> Jpipe.required "lock" lock |
| 3906 | 3912 | |> Jpipe.required "long" long |
| 3913 | + |> Jpipe.required "makeDictEncoder" makeDictEncoder | |
| 3907 | 3914 | |> Jpipe.required "map" map |
| 3908 | 3915 | |> Jpipe.required "MapEntry" mapEntry |
| 3909 | 3916 | |> Jpipe.required "MarshalJSON" marshalJSON |
| @@ -3914,8 +3921,6 @@ obj3 = | ||
| 3914 | 3921 | |> Jpipe.required "native" native |
| 3915 | 3922 | |> Jpipe.required "new" new |
| 3916 | 3923 | |> Jpipe.required "newtonsoft" newtonsoft |
| 3917 | - |> Jpipe.required "nil" nil | |
| 3918 | - |> Jpipe.required "NO" no | |
| 3919 | 3924 | |> Jpipe.required "if" purpleIf |
| 3920 | 3925 | |> Jpipe.required "import" purpleImport |
| 3921 | 3926 | |> Jpipe.required "in" purpleIn |
| @@ -3974,6 +3979,7 @@ encodeObj3 x = | ||
| 3974 | 3979 | , ("Locale", encodeLocale x.locale) |
| 3975 | 3980 | , ("lock", encodeLock x.lock) |
| 3976 | 3981 | , ("long", encodeLong x.long) |
| 3982 | + , ("makeDictEncoder", encodeMakeDictEncoder x.makeDictEncoder) | |
| 3977 | 3983 | , ("map", encodeMap x.map) |
| 3978 | 3984 | , ("MapEntry", encodeMapEntry x.mapEntry) |
| 3979 | 3985 | , ("MarshalJSON", encodeMarshalJSON x.marshalJSON) |
| @@ -3984,8 +3990,6 @@ encodeObj3 x = | ||
| 3984 | 3990 | , ("native", encodeNative x.native) |
| 3985 | 3991 | , ("new", encodeNew x.new) |
| 3986 | 3992 | , ("newtonsoft", encodeNewtonsoft x.newtonsoft) |
| 3987 | - , ("nil", encodeNil x.nil) | |
| 3988 | - , ("NO", encodeNo x.no) | |
| 3989 | 3993 | , ("if", encodeIf x.obj3If) |
| 3990 | 3994 | , ("import", encodeImport x.obj3Import) |
| 3991 | 3995 | , ("in", encodeIn x.obj3In) |
| @@ -4501,6 +4505,17 @@ encodeLong x = | ||
| 4501 | 4505 | [ ("long", Jenc.int x.long) |
| 4502 | 4506 | ] |
| 4503 | 4507 | |
| 4508 | +makeDictEncoder : Jdec.Decoder MakeDictEncoder | |
| 4509 | +makeDictEncoder = | |
| 4510 | + Jdec.succeed MakeDictEncoder | |
| 4511 | + |> Jpipe.required "makeDictEncoder" Jdec.int | |
| 4512 | + | |
| 4513 | +encodeMakeDictEncoder : MakeDictEncoder -> Jenc.Value | |
| 4514 | +encodeMakeDictEncoder x = | |
| 4515 | + Jenc.object | |
| 4516 | + [ ("makeDictEncoder", Jenc.int x.makeDictEncoder) | |
| 4517 | + ] | |
| 4518 | + | |
| 4504 | 4519 | map : Jdec.Decoder Map |
| 4505 | 4520 | map = |
| 4506 | 4521 | Jdec.succeed Map |
| @@ -4611,28 +4626,6 @@ encodeNewtonsoft x = | ||
| 4611 | 4626 | [ ("newtonsoft", Jenc.int x.newtonsoft) |
| 4612 | 4627 | ] |
| 4613 | 4628 | |
| 4614 | -nil : Jdec.Decoder Nil | |
| 4615 | -nil = | |
| 4616 | - Jdec.succeed Nil | |
| 4617 | - |> Jpipe.required "nil" Jdec.int | |
| 4618 | - | |
| 4619 | -encodeNil : Nil -> Jenc.Value | |
| 4620 | -encodeNil x = | |
| 4621 | - Jenc.object | |
| 4622 | - [ ("nil", Jenc.int x.nil) | |
| 4623 | - ] | |
| 4624 | - | |
| 4625 | -no : Jdec.Decoder No | |
| 4626 | -no = | |
| 4627 | - Jdec.succeed No | |
| 4628 | - |> Jpipe.required "NO" Jdec.int | |
| 4629 | - | |
| 4630 | -encodeNo : No -> Jenc.Value | |
| 4631 | -encodeNo x = | |
| 4632 | - Jenc.object | |
| 4633 | - [ ("NO", Jenc.int x.no) | |
| 4634 | - ] | |
| 4635 | - | |
| 4636 | 4629 | purpleIf : Jdec.Decoder If |
| 4637 | 4630 | purpleIf = |
| 4638 | 4631 | Jdec.succeed If |
| @@ -4714,6 +4707,8 @@ obj4 : Jdec.Decoder Obj4 | ||
| 4714 | 4707 | obj4 = |
| 4715 | 4708 | Jdec.succeed Obj4 |
| 4716 | 4709 | |> Jpipe.required "dummy" Jdec.int |
| 4710 | + |> Jpipe.required "nil" nil | |
| 4711 | + |> Jpipe.required "NO" no | |
| 4717 | 4712 | |> Jpipe.required "noSuchMethod" noSuchMethod |
| 4718 | 4713 | |> Jpipe.required "noexcept" noexcept |
| 4719 | 4714 | |> Jpipe.required "nonatomic" nonatomic |
| @@ -4776,13 +4771,13 @@ obj4 = | ||
| 4776 | 4771 | |> Jpipe.required "runtimeType" runtimeType |
| 4777 | 4772 | |> Jpipe.required "s" s |
| 4778 | 4773 | |> Jpipe.required "sbyte" sbyte |
| 4779 | - |> Jpipe.required "sealed" sealed | |
| 4780 | - |> Jpipe.required "SEL" sel | |
| 4781 | 4774 | |
| 4782 | 4775 | encodeObj4 : Obj4 -> Jenc.Value |
| 4783 | 4776 | encodeObj4 x = |
| 4784 | 4777 | Jenc.object |
| 4785 | 4778 | [ ("dummy", Jenc.int x.dummy) |
| 4779 | + , ("nil", encodeNil x.nil) | |
| 4780 | + , ("NO", encodeNo x.no) | |
| 4786 | 4781 | , ("noSuchMethod", encodeNoSuchMethod x.noSuchMethod) |
| 4787 | 4782 | , ("noexcept", encodeNoexcept x.noexcept) |
| 4788 | 4783 | , ("nonatomic", encodeNonatomic x.nonatomic) |
| @@ -4845,8 +4840,28 @@ encodeObj4 x = | ||
| 4845 | 4840 | , ("runtimeType", encodeRuntimeType x.runtimeType) |
| 4846 | 4841 | , ("s", encodeS x.s) |
| 4847 | 4842 | , ("sbyte", encodeSbyte x.sbyte) |
| 4848 | - , ("sealed", encodeSealed x.sealed) | |
| 4849 | - , ("SEL", encodeSel x.sel) | |
| 4843 | + ] | |
| 4844 | + | |
| 4845 | +nil : Jdec.Decoder Nil | |
| 4846 | +nil = | |
| 4847 | + Jdec.succeed Nil | |
| 4848 | + |> Jpipe.required "nil" Jdec.int | |
| 4849 | + | |
| 4850 | +encodeNil : Nil -> Jenc.Value | |
| 4851 | +encodeNil x = | |
| 4852 | + Jenc.object | |
| 4853 | + [ ("nil", Jenc.int x.nil) | |
| 4854 | + ] | |
| 4855 | + | |
| 4856 | +no : Jdec.Decoder No | |
| 4857 | +no = | |
| 4858 | + Jdec.succeed No | |
| 4859 | + |> Jpipe.required "NO" Jdec.int | |
| 4860 | + | |
| 4861 | +encodeNo : No -> Jenc.Value | |
| 4862 | +encodeNo x = | |
| 4863 | + Jenc.object | |
| 4864 | + [ ("NO", Jenc.int x.no) | |
| 4850 | 4865 | ] |
| 4851 | 4866 | |
| 4852 | 4867 | noSuchMethod : Jdec.Decoder NoSuchMethod |
| @@ -5531,28 +5546,6 @@ encodeSbyte x = | ||
| 5531 | 5546 | [ ("sbyte", Jenc.int x.sbyte) |
| 5532 | 5547 | ] |
| 5533 | 5548 | |
| 5534 | -sealed : Jdec.Decoder Sealed | |
| 5535 | -sealed = | |
| 5536 | - Jdec.succeed Sealed | |
| 5537 | - |> Jpipe.required "sealed" Jdec.int | |
| 5538 | - | |
| 5539 | -encodeSealed : Sealed -> Jenc.Value | |
| 5540 | -encodeSealed x = | |
| 5541 | - Jenc.object | |
| 5542 | - [ ("sealed", Jenc.int x.sealed) | |
| 5543 | - ] | |
| 5544 | - | |
| 5545 | -sel : Jdec.Decoder Sel | |
| 5546 | -sel = | |
| 5547 | - Jdec.succeed Sel | |
| 5548 | - |> Jpipe.required "SEL" Jdec.int | |
| 5549 | - | |
| 5550 | -encodeSel : Sel -> Jenc.Value | |
| 5551 | -encodeSel x = | |
| 5552 | - Jenc.object | |
| 5553 | - [ ("SEL", Jenc.int x.sel) | |
| 5554 | - ] | |
| 5555 | - | |
| 5556 | 5549 | obj5 : Jdec.Decoder Obj5 |
| 5557 | 5550 | obj5 = |
| 5558 | 5551 | Jdec.succeed Obj5 |
| @@ -5565,6 +5558,8 @@ obj5 = | ||
| 5565 | 5558 | |> Jpipe.required "Type" purpleType |
| 5566 | 5559 | |> Jpipe.required "PrimitiveKind" primitiveKind |
| 5567 | 5560 | |> Jpipe.required "type" typeClass |
| 5561 | + |> Jpipe.required "sealed" sealed | |
| 5562 | + |> Jpipe.required "SEL" sel | |
| 5568 | 5563 | |> Jpipe.required "select" select |
| 5569 | 5564 | |> Jpipe.required "Self" self |
| 5570 | 5565 | |> Jpipe.required "Sendable" sendable |
| @@ -5619,9 +5614,6 @@ obj5 = | ||
| 5619 | 5614 | |> Jpipe.required "undefined" undefined |
| 5620 | 5615 | |> Jpipe.required "union" union |
| 5621 | 5616 | |> Jpipe.required "UnmarshalJSON" unmarshalJSON |
| 5622 | - |> Jpipe.required "unowned" unowned | |
| 5623 | - |> Jpipe.required "unsafe" unsafe | |
| 5624 | - |> Jpipe.required "UseSerializers" useSerializers | |
| 5625 | 5617 | |
| 5626 | 5618 | encodeObj5 : Obj5 -> Jenc.Value |
| 5627 | 5619 | encodeObj5 x = |
| @@ -5635,6 +5627,8 @@ encodeObj5 x = | ||
| 5635 | 5627 | , ("Type", encodeType x.obj5Type) |
| 5636 | 5628 | , ("PrimitiveKind", encodePrimitiveKind x.primitiveKind) |
| 5637 | 5629 | , ("type", encodeTypeClass x.purpleType) |
| 5630 | + , ("sealed", encodeSealed x.sealed) | |
| 5631 | + , ("SEL", encodeSel x.sel) | |
| 5638 | 5632 | , ("select", encodeSelect x.select) |
| 5639 | 5633 | , ("Self", encodeSelf x.self) |
| 5640 | 5634 | , ("Sendable", encodeSendable x.sendable) |
| @@ -5689,9 +5683,6 @@ encodeObj5 x = | ||
| 5689 | 5683 | , ("undefined", encodeUndefined x.undefined) |
| 5690 | 5684 | , ("union", encodeUnion x.union) |
| 5691 | 5685 | , ("UnmarshalJSON", encodeUnmarshalJSON x.unmarshalJSON) |
| 5692 | - , ("unowned", encodeUnowned x.unowned) | |
| 5693 | - , ("unsafe", encodeUnsafe x.unsafe) | |
| 5694 | - , ("UseSerializers", encodeUseSerializers x.useSerializers) | |
| 5695 | 5686 | ] |
| 5696 | 5687 | |
| 5697 | 5688 | kSerializer : Jdec.Decoder KSerializer |
| @@ -5782,6 +5773,28 @@ encodeTypeClass x = | ||
| 5782 | 5773 | [ ("type", Jenc.int x.typeType) |
| 5783 | 5774 | ] |
| 5784 | 5775 | |
| 5776 | +sealed : Jdec.Decoder Sealed | |
| 5777 | +sealed = | |
| 5778 | + Jdec.succeed Sealed | |
| 5779 | + |> Jpipe.required "sealed" Jdec.int | |
| 5780 | + | |
| 5781 | +encodeSealed : Sealed -> Jenc.Value | |
| 5782 | +encodeSealed x = | |
| 5783 | + Jenc.object | |
| 5784 | + [ ("sealed", Jenc.int x.sealed) | |
| 5785 | + ] | |
| 5786 | + | |
| 5787 | +sel : Jdec.Decoder Sel | |
| 5788 | +sel = | |
| 5789 | + Jdec.succeed Sel | |
| 5790 | + |> Jpipe.required "SEL" Jdec.int | |
| 5791 | + | |
| 5792 | +encodeSel : Sel -> Jenc.Value | |
| 5793 | +encodeSel x = | |
| 5794 | + Jenc.object | |
| 5795 | + [ ("SEL", Jenc.int x.sel) | |
| 5796 | + ] | |
| 5797 | + | |
| 5785 | 5798 | select : Jdec.Decoder Select |
| 5786 | 5799 | select = |
| 5787 | 5800 | Jdec.succeed Select |
| @@ -6376,45 +6389,15 @@ encodeUnmarshalJSON x = | ||
| 6376 | 6389 | [ ("UnmarshalJSON", Jenc.int x.unmarshalJSON) |
| 6377 | 6390 | ] |
| 6378 | 6391 | |
| 6379 | -unowned : Jdec.Decoder Unowned | |
| 6380 | -unowned = | |
| 6381 | - Jdec.succeed Unowned | |
| 6382 | - |> Jpipe.required "unowned" Jdec.int | |
| 6383 | - | |
| 6384 | -encodeUnowned : Unowned -> Jenc.Value | |
| 6385 | -encodeUnowned x = | |
| 6386 | - Jenc.object | |
| 6387 | - [ ("unowned", Jenc.int x.unowned) | |
| 6388 | - ] | |
| 6389 | - | |
| 6390 | -unsafe : Jdec.Decoder Unsafe | |
| 6391 | -unsafe = | |
| 6392 | - Jdec.succeed Unsafe | |
| 6393 | - |> Jpipe.required "unsafe" Jdec.int | |
| 6394 | - | |
| 6395 | -encodeUnsafe : Unsafe -> Jenc.Value | |
| 6396 | -encodeUnsafe x = | |
| 6397 | - Jenc.object | |
| 6398 | - [ ("unsafe", Jenc.int x.unsafe) | |
| 6399 | - ] | |
| 6400 | - | |
| 6401 | -useSerializers : Jdec.Decoder UseSerializers | |
| 6402 | -useSerializers = | |
| 6403 | - Jdec.succeed UseSerializers | |
| 6404 | - |> Jpipe.required "UseSerializers" Jdec.int | |
| 6405 | - | |
| 6406 | -encodeUseSerializers : UseSerializers -> Jenc.Value | |
| 6407 | -encodeUseSerializers x = | |
| 6408 | - Jenc.object | |
| 6409 | - [ ("UseSerializers", Jenc.int x.useSerializers) | |
| 6410 | - ] | |
| 6411 | - | |
| 6412 | 6392 | obj6 : Jdec.Decoder Obj6 |
| 6413 | 6393 | obj6 = |
| 6414 | 6394 | Jdec.succeed Obj6 |
| 6415 | 6395 | |> Jpipe.required "dummy" Jdec.int |
| 6416 | 6396 | |> Jpipe.required "where" purpleWhere |
| 6397 | + |> Jpipe.required "unowned" unowned | |
| 6398 | + |> Jpipe.required "unsafe" unsafe | |
| 6417 | 6399 | |> Jpipe.required "unsigned" unsigned |
| 6400 | + |> Jpipe.required "UseSerializers" useSerializers | |
| 6418 | 6401 | |> Jpipe.required "ushort" ushort |
| 6419 | 6402 | |> Jpipe.required "using" using |
| 6420 | 6403 | |> Jpipe.required "Utf8JsonReader" utf8JSONReader |
| @@ -6439,7 +6422,10 @@ encodeObj6 x = | ||
| 6439 | 6422 | Jenc.object |
| 6440 | 6423 | [ ("dummy", Jenc.int x.dummy) |
| 6441 | 6424 | , ("where", encodeWhere x.obj6Where) |
| 6425 | + , ("unowned", encodeUnowned x.unowned) | |
| 6426 | + , ("unsafe", encodeUnsafe x.unsafe) | |
| 6442 | 6427 | , ("unsigned", encodeUnsigned x.unsigned) |
| 6428 | + , ("UseSerializers", encodeUseSerializers x.useSerializers) | |
| 6443 | 6429 | , ("ushort", encodeUshort x.ushort) |
| 6444 | 6430 | , ("using", encodeUsing x.using) |
| 6445 | 6431 | , ("Utf8JsonReader", encodeUtf8JSONReader x.utf8JSONReader) |
| @@ -6471,6 +6457,28 @@ encodeWhere x = | ||
| 6471 | 6457 | [ ("where", Jenc.int x.whereWhere) |
| 6472 | 6458 | ] |
| 6473 | 6459 | |
| 6460 | +unowned : Jdec.Decoder Unowned | |
| 6461 | +unowned = | |
| 6462 | + Jdec.succeed Unowned | |
| 6463 | + |> Jpipe.required "unowned" Jdec.int | |
| 6464 | + | |
| 6465 | +encodeUnowned : Unowned -> Jenc.Value | |
| 6466 | +encodeUnowned x = | |
| 6467 | + Jenc.object | |
| 6468 | + [ ("unowned", Jenc.int x.unowned) | |
| 6469 | + ] | |
| 6470 | + | |
| 6471 | +unsafe : Jdec.Decoder Unsafe | |
| 6472 | +unsafe = | |
| 6473 | + Jdec.succeed Unsafe | |
| 6474 | + |> Jpipe.required "unsafe" Jdec.int | |
| 6475 | + | |
| 6476 | +encodeUnsafe : Unsafe -> Jenc.Value | |
| 6477 | +encodeUnsafe x = | |
| 6478 | + Jenc.object | |
| 6479 | + [ ("unsafe", Jenc.int x.unsafe) | |
| 6480 | + ] | |
| 6481 | + | |
| 6474 | 6482 | unsigned : Jdec.Decoder Unsigned |
| 6475 | 6483 | unsigned = |
| 6476 | 6484 | Jdec.succeed Unsigned |
| @@ -6482,6 +6490,17 @@ encodeUnsigned x = | ||
| 6482 | 6490 | [ ("unsigned", Jenc.int x.unsigned) |
| 6483 | 6491 | ] |
| 6484 | 6492 | |
| 6493 | +useSerializers : Jdec.Decoder UseSerializers | |
| 6494 | +useSerializers = | |
| 6495 | + Jdec.succeed UseSerializers | |
| 6496 | + |> Jpipe.required "UseSerializers" Jdec.int | |
| 6497 | + | |
| 6498 | +encodeUseSerializers : UseSerializers -> Jenc.Value | |
| 6499 | +encodeUseSerializers x = | |
| 6500 | + Jenc.object | |
| 6501 | + [ ("UseSerializers", Jenc.int x.useSerializers) | |
| 6502 | + ] | |
| 6503 | + | |
| 6485 | 6504 | ushort : Jdec.Decoder Ushort |
| 6486 | 6505 | ushort = |
| 6487 | 6506 | Jdec.succeed Ushort |
Mflowdefault / TopLevel.js+68 −59
| @@ -690,7 +690,6 @@ export type Obj3 = { | ||
| 690 | 690 | Locale: Locale; |
| 691 | 691 | MapEntry: MapEntry; |
| 692 | 692 | MarshalJSON: MarshalJSON; |
| 693 | - NO: No; | |
| 694 | 693 | dummy: number; |
| 695 | 694 | goto: Goto; |
| 696 | 695 | guard: Guard; |
| @@ -728,6 +727,7 @@ export type Obj3 = { | ||
| 728 | 727 | list: List; |
| 729 | 728 | lock: Lock; |
| 730 | 729 | long: Long; |
| 730 | + makeDictEncoder: MakeDictEncoder; | |
| 731 | 731 | map: Map; |
| 732 | 732 | metadata_property_handling: MetadataPropertyHandling; |
| 733 | 733 | module: Module; |
| @@ -737,7 +737,6 @@ export type Obj3 = { | ||
| 737 | 737 | native: Native; |
| 738 | 738 | new: New; |
| 739 | 739 | newtonsoft: Newtonsoft; |
| 740 | - nil: Nil; | |
| 741 | 740 | }; |
| 742 | 741 | |
| 743 | 742 | export type Hashable = { |
| @@ -812,10 +811,6 @@ export type MarshalJSON = { | ||
| 812 | 811 | MarshalJSON: number; |
| 813 | 812 | }; |
| 814 | 813 | |
| 815 | -export type No = { | |
| 816 | - NO: number; | |
| 817 | -}; | |
| 818 | - | |
| 819 | 814 | export type Goto = { |
| 820 | 815 | goto: number; |
| 821 | 816 | }; |
| @@ -960,6 +955,10 @@ export type Long = { | ||
| 960 | 955 | long: number; |
| 961 | 956 | }; |
| 962 | 957 | |
| 958 | +export type MakeDictEncoder = { | |
| 959 | + makeDictEncoder: number; | |
| 960 | +}; | |
| 961 | + | |
| 963 | 962 | export type Map = { |
| 964 | 963 | map: number; |
| 965 | 964 | }; |
| @@ -996,11 +995,8 @@ export type Newtonsoft = { | ||
| 996 | 995 | newtonsoft: number; |
| 997 | 996 | }; |
| 998 | 997 | |
| 999 | -export type Nil = { | |
| 1000 | - nil: number; | |
| 1001 | -}; | |
| 1002 | - | |
| 1003 | 998 | export type Obj4 = { |
| 999 | + NO: No; | |
| 1004 | 1000 | NSError: NSError; |
| 1005 | 1001 | NSObject: NSObject; |
| 1006 | 1002 | NSString: NSString; |
| @@ -1009,8 +1005,8 @@ export type Obj4 = { | ||
| 1009 | 1005 | ObjectMapper: ObjectMapper; |
| 1010 | 1006 | Protocol: Protocol; |
| 1011 | 1007 | RegExp: RegExpClass; |
| 1012 | - SEL: Sel; | |
| 1013 | 1008 | dummy: number; |
| 1009 | + nil: Nil; | |
| 1014 | 1010 | noSuchMethod: NoSuchMethod; |
| 1015 | 1011 | noexcept: Noexcept; |
| 1016 | 1012 | nonatomic: Nonatomic; |
| @@ -1065,7 +1061,10 @@ export type Obj4 = { | ||
| 1065 | 1061 | runtimeType: RuntimeType; |
| 1066 | 1062 | s: S; |
| 1067 | 1063 | sbyte: Sbyte; |
| 1068 | - sealed: Sealed; | |
| 1064 | +}; | |
| 1065 | + | |
| 1066 | +export type No = { | |
| 1067 | + NO: number; | |
| 1069 | 1068 | }; |
| 1070 | 1069 | |
| 1071 | 1070 | export type NSError = { |
| @@ -1100,8 +1099,8 @@ export type RegExpClass = { | ||
| 1100 | 1099 | RegExp: string; |
| 1101 | 1100 | }; |
| 1102 | 1101 | |
| 1103 | -export type Sel = { | |
| 1104 | - SEL: number; | |
| 1102 | +export type Nil = { | |
| 1103 | + nil: number; | |
| 1105 | 1104 | }; |
| 1106 | 1105 | |
| 1107 | 1106 | export type NoSuchMethod = { |
| @@ -1320,13 +1319,10 @@ export type Sbyte = { | ||
| 1320 | 1319 | sbyte: number; |
| 1321 | 1320 | }; |
| 1322 | 1321 | |
| 1323 | -export type Sealed = { | |
| 1324 | - sealed: number; | |
| 1325 | -}; | |
| 1326 | - | |
| 1327 | 1322 | export type Obj5 = { |
| 1328 | 1323 | KSerializer: KSerializer; |
| 1329 | 1324 | PrimitiveKind: PrimitiveKind; |
| 1325 | + SEL: Sel; | |
| 1330 | 1326 | Self: Self; |
| 1331 | 1327 | Sendable: Sendable; |
| 1332 | 1328 | SerialDescriptor: SerialDescriptor; |
| @@ -1343,8 +1339,8 @@ export type Obj5 = { | ||
| 1343 | 1339 | True: True; |
| 1344 | 1340 | Type: Type; |
| 1345 | 1341 | UnmarshalJSON: UnmarshalJSON; |
| 1346 | - UseSerializers: UseSerializers; | |
| 1347 | 1342 | dummy: number; |
| 1343 | + sealed: Sealed; | |
| 1348 | 1344 | select: Select; |
| 1349 | 1345 | self: SelfClass; |
| 1350 | 1346 | serialize: Serialize; |
| @@ -1389,8 +1385,6 @@ export type Obj5 = { | ||
| 1389 | 1385 | unchecked: Unchecked; |
| 1390 | 1386 | undefined: Undefined; |
| 1391 | 1387 | union: Union; |
| 1392 | - unowned: Unowned; | |
| 1393 | - unsafe: Unsafe; | |
| 1394 | 1388 | }; |
| 1395 | 1389 | |
| 1396 | 1390 | export type KSerializer = { |
| @@ -1401,6 +1395,10 @@ export type PrimitiveKind = { | ||
| 1401 | 1395 | PrimitiveKind: number; |
| 1402 | 1396 | }; |
| 1403 | 1397 | |
| 1398 | +export type Sel = { | |
| 1399 | + SEL: number; | |
| 1400 | +}; | |
| 1401 | + | |
| 1404 | 1402 | export type Self = { |
| 1405 | 1403 | Self: number; |
| 1406 | 1404 | }; |
| @@ -1465,8 +1463,8 @@ export type UnmarshalJSON = { | ||
| 1465 | 1463 | UnmarshalJSON: number; |
| 1466 | 1464 | }; |
| 1467 | 1465 | |
| 1468 | -export type UseSerializers = { | |
| 1469 | - UseSerializers: number; | |
| 1466 | +export type Sealed = { | |
| 1467 | + sealed: number; | |
| 1470 | 1468 | }; |
| 1471 | 1469 | |
| 1472 | 1470 | export type Select = { |
| @@ -1645,20 +1643,15 @@ export type Union = { | ||
| 1645 | 1643 | union: number; |
| 1646 | 1644 | }; |
| 1647 | 1645 | |
| 1648 | -export type Unowned = { | |
| 1649 | - unowned: number; | |
| 1650 | -}; | |
| 1651 | - | |
| 1652 | -export type Unsafe = { | |
| 1653 | - unsafe: number; | |
| 1654 | -}; | |
| 1655 | - | |
| 1656 | 1646 | export type Obj6 = { |
| 1657 | 1647 | UUID: UUID; |
| 1648 | + UseSerializers: UseSerializers; | |
| 1658 | 1649 | Utf8JsonReader: Utf8JSONReader; |
| 1659 | 1650 | Utf8JsonWriter: Utf8JSONWriter; |
| 1660 | 1651 | YES: Yes; |
| 1661 | 1652 | dummy: number; |
| 1653 | + unowned: Unowned; | |
| 1654 | + unsafe: Unsafe; | |
| 1662 | 1655 | unsigned: Unsigned; |
| 1663 | 1656 | ushort: Ushort; |
| 1664 | 1657 | using: Using; |
| @@ -1681,6 +1674,10 @@ export type UUID = { | ||
| 1681 | 1674 | UUID: number; |
| 1682 | 1675 | }; |
| 1683 | 1676 | |
| 1677 | +export type UseSerializers = { | |
| 1678 | + UseSerializers: number; | |
| 1679 | +}; | |
| 1680 | + | |
| 1684 | 1681 | export type Utf8JSONReader = { |
| 1685 | 1682 | Utf8JsonReader: number; |
| 1686 | 1683 | }; |
| @@ -1693,6 +1690,14 @@ export type Yes = { | ||
| 1693 | 1690 | YES: number; |
| 1694 | 1691 | }; |
| 1695 | 1692 | |
| 1693 | +export type Unowned = { | |
| 1694 | + unowned: number; | |
| 1695 | +}; | |
| 1696 | + | |
| 1697 | +export type Unsafe = { | |
| 1698 | + unsafe: number; | |
| 1699 | +}; | |
| 1700 | + | |
| 1696 | 1701 | export type Unsigned = { |
| 1697 | 1702 | unsigned: number; |
| 1698 | 1703 | }; |
| @@ -1851,7 +1856,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1851 | 1856 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 1852 | 1857 | return invalidValue(l(ref || "object"), val, key, parent); |
| 1853 | 1858 | } |
| 1854 | - const result: any = {}; | |
| 1859 | + const result: any = Object.create(null); | |
| 1855 | 1860 | Object.getOwnPropertyNames(props).forEach(key => { |
| 1856 | 1861 | const prop = props[key]; |
| 1857 | 1862 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -1862,7 +1867,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1862 | 1867 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 1863 | 1868 | } |
| 1864 | 1869 | }); |
| 1865 | - return result; | |
| 1870 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 1866 | 1871 | } |
| 1867 | 1872 | |
| 1868 | 1873 | if (typ === "any") return val; |
| @@ -2489,7 +2494,6 @@ const typeMap: any = { | ||
| 2489 | 2494 | { json: "Locale", js: "Locale", typ: r("Locale") }, |
| 2490 | 2495 | { json: "MapEntry", js: "MapEntry", typ: r("MapEntry") }, |
| 2491 | 2496 | { json: "MarshalJSON", js: "MarshalJSON", typ: r("MarshalJSON") }, |
| 2492 | - { json: "NO", js: "NO", typ: r("No") }, | |
| 2493 | 2497 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 2494 | 2498 | { json: "goto", js: "goto", typ: r("Goto") }, |
| 2495 | 2499 | { json: "guard", js: "guard", typ: r("Guard") }, |
| @@ -2527,6 +2531,7 @@ const typeMap: any = { | ||
| 2527 | 2531 | { json: "list", js: "list", typ: r("List") }, |
| 2528 | 2532 | { json: "lock", js: "lock", typ: r("Lock") }, |
| 2529 | 2533 | { json: "long", js: "long", typ: r("Long") }, |
| 2534 | + { json: "makeDictEncoder", js: "makeDictEncoder", typ: r("MakeDictEncoder") }, | |
| 2530 | 2535 | { json: "map", js: "map", typ: r("Map") }, |
| 2531 | 2536 | { json: "metadata_property_handling", js: "metadata_property_handling", typ: r("MetadataPropertyHandling") }, |
| 2532 | 2537 | { json: "module", js: "module", typ: r("Module") }, |
| @@ -2536,7 +2541,6 @@ const typeMap: any = { | ||
| 2536 | 2541 | { json: "native", js: "native", typ: r("Native") }, |
| 2537 | 2542 | { json: "new", js: "new", typ: r("New") }, |
| 2538 | 2543 | { json: "newtonsoft", js: "newtonsoft", typ: r("Newtonsoft") }, |
| 2539 | - { json: "nil", js: "nil", typ: r("Nil") }, | |
| 2540 | 2544 | ], false), |
| 2541 | 2545 | "Hashable": o([ |
| 2542 | 2546 | { json: "Hashable", js: "Hashable", typ: i(0) }, |
| @@ -2592,9 +2596,6 @@ const typeMap: any = { | ||
| 2592 | 2596 | "MarshalJSON": o([ |
| 2593 | 2597 | { json: "MarshalJSON", js: "MarshalJSON", typ: i(0) }, |
| 2594 | 2598 | ], false), |
| 2595 | - "No": o([ | |
| 2596 | - { json: "NO", js: "NO", typ: i(0) }, | |
| 2597 | - ], false), | |
| 2598 | 2599 | "Goto": o([ |
| 2599 | 2600 | { json: "goto", js: "goto", typ: i(0) }, |
| 2600 | 2601 | ], false), |
| @@ -2703,6 +2704,9 @@ const typeMap: any = { | ||
| 2703 | 2704 | "Long": o([ |
| 2704 | 2705 | { json: "long", js: "long", typ: i(0) }, |
| 2705 | 2706 | ], false), |
| 2707 | + "MakeDictEncoder": o([ | |
| 2708 | + { json: "makeDictEncoder", js: "makeDictEncoder", typ: i(0) }, | |
| 2709 | + ], false), | |
| 2706 | 2710 | "Map": o([ |
| 2707 | 2711 | { json: "map", js: "map", typ: i(0) }, |
| 2708 | 2712 | ], false), |
| @@ -2730,10 +2734,8 @@ const typeMap: any = { | ||
| 2730 | 2734 | "Newtonsoft": o([ |
| 2731 | 2735 | { json: "newtonsoft", js: "newtonsoft", typ: i(0) }, |
| 2732 | 2736 | ], false), |
| 2733 | - "Nil": o([ | |
| 2734 | - { json: "nil", js: "nil", typ: i(0) }, | |
| 2735 | - ], false), | |
| 2736 | 2737 | "Obj4": o([ |
| 2738 | + { json: "NO", js: "NO", typ: r("No") }, | |
| 2737 | 2739 | { json: "NSError", js: "NSError", typ: r("NSError") }, |
| 2738 | 2740 | { json: "NSObject", js: "NSObject", typ: r("NSObject") }, |
| 2739 | 2741 | { json: "NSString", js: "NSString", typ: r("NSString") }, |
| @@ -2742,8 +2744,8 @@ const typeMap: any = { | ||
| 2742 | 2744 | { json: "ObjectMapper", js: "ObjectMapper", typ: r("ObjectMapper") }, |
| 2743 | 2745 | { json: "Protocol", js: "Protocol", typ: r("Protocol") }, |
| 2744 | 2746 | { json: "RegExp", js: "RegExp", typ: r("RegExpClass") }, |
| 2745 | - { json: "SEL", js: "SEL", typ: r("Sel") }, | |
| 2746 | 2747 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 2748 | + { json: "nil", js: "nil", typ: r("Nil") }, | |
| 2747 | 2749 | { json: "noSuchMethod", js: "noSuchMethod", typ: r("NoSuchMethod") }, |
| 2748 | 2750 | { json: "noexcept", js: "noexcept", typ: r("Noexcept") }, |
| 2749 | 2751 | { json: "nonatomic", js: "nonatomic", typ: r("Nonatomic") }, |
| @@ -2798,7 +2800,9 @@ const typeMap: any = { | ||
| 2798 | 2800 | { json: "runtimeType", js: "runtimeType", typ: r("RuntimeType") }, |
| 2799 | 2801 | { json: "s", js: "s", typ: r("S") }, |
| 2800 | 2802 | { json: "sbyte", js: "sbyte", typ: r("Sbyte") }, |
| 2801 | - { json: "sealed", js: "sealed", typ: r("Sealed") }, | |
| 2803 | + ], false), | |
| 2804 | + "No": o([ | |
| 2805 | + { json: "NO", js: "NO", typ: i(0) }, | |
| 2802 | 2806 | ], false), |
| 2803 | 2807 | "NSError": o([ |
| 2804 | 2808 | { json: "NSError", js: "NSError", typ: i(0) }, |
| @@ -2824,8 +2828,8 @@ const typeMap: any = { | ||
| 2824 | 2828 | "RegExpClass": o([ |
| 2825 | 2829 | { json: "RegExp", js: "RegExp", typ: { uuid: "" } }, |
| 2826 | 2830 | ], false), |
| 2827 | - "Sel": o([ | |
| 2828 | - { json: "SEL", js: "SEL", typ: i(0) }, | |
| 2831 | + "Nil": o([ | |
| 2832 | + { json: "nil", js: "nil", typ: i(0) }, | |
| 2829 | 2833 | ], false), |
| 2830 | 2834 | "NoSuchMethod": o([ |
| 2831 | 2835 | { json: "noSuchMethod", js: "noSuchMethod", typ: i(0) }, |
| @@ -2989,12 +2993,10 @@ const typeMap: any = { | ||
| 2989 | 2993 | "Sbyte": o([ |
| 2990 | 2994 | { json: "sbyte", js: "sbyte", typ: i(0) }, |
| 2991 | 2995 | ], false), |
| 2992 | - "Sealed": o([ | |
| 2993 | - { json: "sealed", js: "sealed", typ: i(0) }, | |
| 2994 | - ], false), | |
| 2995 | 2996 | "Obj5": o([ |
| 2996 | 2997 | { json: "KSerializer", js: "KSerializer", typ: r("KSerializer") }, |
| 2997 | 2998 | { json: "PrimitiveKind", js: "PrimitiveKind", typ: r("PrimitiveKind") }, |
| 2999 | + { json: "SEL", js: "SEL", typ: r("Sel") }, | |
| 2998 | 3000 | { json: "Self", js: "Self", typ: r("Self") }, |
| 2999 | 3001 | { json: "Sendable", js: "Sendable", typ: r("Sendable") }, |
| 3000 | 3002 | { json: "SerialDescriptor", js: "SerialDescriptor", typ: r("SerialDescriptor") }, |
| @@ -3011,8 +3013,8 @@ const typeMap: any = { | ||
| 3011 | 3013 | { json: "True", js: "True", typ: r("True") }, |
| 3012 | 3014 | { json: "Type", js: "Type", typ: r("Type") }, |
| 3013 | 3015 | { json: "UnmarshalJSON", js: "UnmarshalJSON", typ: r("UnmarshalJSON") }, |
| 3014 | - { json: "UseSerializers", js: "UseSerializers", typ: r("UseSerializers") }, | |
| 3015 | 3016 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 3017 | + { json: "sealed", js: "sealed", typ: r("Sealed") }, | |
| 3016 | 3018 | { json: "select", js: "select", typ: r("Select") }, |
| 3017 | 3019 | { json: "self", js: "self", typ: r("SelfClass") }, |
| 3018 | 3020 | { json: "serialize", js: "serialize", typ: r("Serialize") }, |
| @@ -3057,8 +3059,6 @@ const typeMap: any = { | ||
| 3057 | 3059 | { json: "unchecked", js: "unchecked", typ: r("Unchecked") }, |
| 3058 | 3060 | { json: "undefined", js: "undefined", typ: r("Undefined") }, |
| 3059 | 3061 | { json: "union", js: "union", typ: r("Union") }, |
| 3060 | - { json: "unowned", js: "unowned", typ: r("Unowned") }, | |
| 3061 | - { json: "unsafe", js: "unsafe", typ: r("Unsafe") }, | |
| 3062 | 3062 | ], false), |
| 3063 | 3063 | "KSerializer": o([ |
| 3064 | 3064 | { json: "KSerializer", js: "KSerializer", typ: i(0) }, |
| @@ -3066,6 +3066,9 @@ const typeMap: any = { | ||
| 3066 | 3066 | "PrimitiveKind": o([ |
| 3067 | 3067 | { json: "PrimitiveKind", js: "PrimitiveKind", typ: i(0) }, |
| 3068 | 3068 | ], false), |
| 3069 | + "Sel": o([ | |
| 3070 | + { json: "SEL", js: "SEL", typ: i(0) }, | |
| 3071 | + ], false), | |
| 3069 | 3072 | "Self": o([ |
| 3070 | 3073 | { json: "Self", js: "Self", typ: i(0) }, |
| 3071 | 3074 | ], false), |
| @@ -3114,8 +3117,8 @@ const typeMap: any = { | ||
| 3114 | 3117 | "UnmarshalJSON": o([ |
| 3115 | 3118 | { json: "UnmarshalJSON", js: "UnmarshalJSON", typ: i(0) }, |
| 3116 | 3119 | ], false), |
| 3117 | - "UseSerializers": o([ | |
| 3118 | - { json: "UseSerializers", js: "UseSerializers", typ: i(0) }, | |
| 3120 | + "Sealed": o([ | |
| 3121 | + { json: "sealed", js: "sealed", typ: i(0) }, | |
| 3119 | 3122 | ], false), |
| 3120 | 3123 | "Select": o([ |
| 3121 | 3124 | { json: "select", js: "select", typ: i(0) }, |
| @@ -3249,18 +3252,15 @@ const typeMap: any = { | ||
| 3249 | 3252 | "Union": o([ |
| 3250 | 3253 | { json: "union", js: "union", typ: i(0) }, |
| 3251 | 3254 | ], false), |
| 3252 | - "Unowned": o([ | |
| 3253 | - { json: "unowned", js: "unowned", typ: i(0) }, | |
| 3254 | - ], false), | |
| 3255 | - "Unsafe": o([ | |
| 3256 | - { json: "unsafe", js: "unsafe", typ: i(0) }, | |
| 3257 | - ], false), | |
| 3258 | 3255 | "Obj6": o([ |
| 3259 | 3256 | { json: "UUID", js: "UUID", typ: r("UUID") }, |
| 3257 | + { json: "UseSerializers", js: "UseSerializers", typ: r("UseSerializers") }, | |
| 3260 | 3258 | { json: "Utf8JsonReader", js: "Utf8JsonReader", typ: r("Utf8JSONReader") }, |
| 3261 | 3259 | { json: "Utf8JsonWriter", js: "Utf8JsonWriter", typ: r("Utf8JSONWriter") }, |
| 3262 | 3260 | { json: "YES", js: "YES", typ: r("Yes") }, |
| 3263 | 3261 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 3262 | + { json: "unowned", js: "unowned", typ: r("Unowned") }, | |
| 3263 | + { json: "unsafe", js: "unsafe", typ: r("Unsafe") }, | |
| 3264 | 3264 | { json: "unsigned", js: "unsigned", typ: r("Unsigned") }, |
| 3265 | 3265 | { json: "ushort", js: "ushort", typ: r("Ushort") }, |
| 3266 | 3266 | { json: "using", js: "using", typ: r("Using") }, |
| @@ -3281,6 +3281,9 @@ const typeMap: any = { | ||
| 3281 | 3281 | "UUID": o([ |
| 3282 | 3282 | { json: "UUID", js: "UUID", typ: i(0) }, |
| 3283 | 3283 | ], false), |
| 3284 | + "UseSerializers": o([ | |
| 3285 | + { json: "UseSerializers", js: "UseSerializers", typ: i(0) }, | |
| 3286 | + ], false), | |
| 3284 | 3287 | "Utf8JSONReader": o([ |
| 3285 | 3288 | { json: "Utf8JsonReader", js: "Utf8JsonReader", typ: i(0) }, |
| 3286 | 3289 | ], false), |
| @@ -3290,6 +3293,12 @@ const typeMap: any = { | ||
| 3290 | 3293 | "Yes": o([ |
| 3291 | 3294 | { json: "YES", js: "YES", typ: i(0) }, |
| 3292 | 3295 | ], false), |
| 3296 | + "Unowned": o([ | |
| 3297 | + { json: "unowned", js: "unowned", typ: i(0) }, | |
| 3298 | + ], false), | |
| 3299 | + "Unsafe": o([ | |
| 3300 | + { json: "unsafe", js: "unsafe", typ: i(0) }, | |
| 3301 | + ], false), | |
| 3293 | 3302 | "Unsigned": o([ |
| 3294 | 3303 | { json: "unsigned", js: "unsigned", typ: i(0) }, |
| 3295 | 3304 | ], false), |
Mgolangdefault / quicktype.go+40 −35
| @@ -732,6 +732,7 @@ type Obj3 struct { | ||
| 732 | 732 | Locale Locale `json:"Locale"` |
| 733 | 733 | Lock Lock `json:"lock"` |
| 734 | 734 | Long Long `json:"long"` |
| 735 | + MakeDictEncoder MakeDictEncoder `json:"makeDictEncoder"` | |
| 735 | 736 | Map Map `json:"map"` |
| 736 | 737 | MapEntry MapEntry `json:"MapEntry"` |
| 737 | 738 | MarshalJSON MarshalJSON `json:"MarshalJSON"` |
| @@ -743,8 +744,6 @@ type Obj3 struct { | ||
| 743 | 744 | Native Native `json:"native"` |
| 744 | 745 | New New `json:"new"` |
| 745 | 746 | Newtonsoft Newtonsoft `json:"newtonsoft"` |
| 746 | - Nil Nil `json:"nil"` | |
| 747 | - No No `json:"NO"` | |
| 748 | 747 | } |
| 749 | 748 | |
| 750 | 749 | type Goto struct { |
| @@ -955,6 +954,10 @@ type Long struct { | ||
| 955 | 954 | Long int64 `json:"long"` |
| 956 | 955 | } |
| 957 | 956 | |
| 957 | +type MakeDictEncoder struct { | |
| 958 | + MakeDictEncoder int64 `json:"makeDictEncoder"` | |
| 959 | +} | |
| 960 | + | |
| 958 | 961 | type Map struct { |
| 959 | 962 | Map int64 `json:"map"` |
| 960 | 963 | } |
| @@ -999,19 +1002,13 @@ type Newtonsoft struct { | ||
| 999 | 1002 | Newtonsoft int64 `json:"newtonsoft"` |
| 1000 | 1003 | } |
| 1001 | 1004 | |
| 1002 | -type Nil struct { | |
| 1003 | - Nil int64 `json:"nil"` | |
| 1004 | -} | |
| 1005 | - | |
| 1006 | -type No struct { | |
| 1007 | - No int64 `json:"NO"` | |
| 1008 | -} | |
| 1009 | - | |
| 1010 | 1005 | type Obj4 struct { |
| 1011 | 1006 | Dummy int64 `json:"dummy"` |
| 1012 | 1007 | NSError NSError `json:"NSError"` |
| 1013 | 1008 | NSObject NSObject `json:"NSObject"` |
| 1014 | 1009 | NSString NSString `json:"NSString"` |
| 1010 | + Nil Nil `json:"nil"` | |
| 1011 | + No No `json:"NO"` | |
| 1015 | 1012 | NoSuchMethod NoSuchMethod `json:"noSuchMethod"` |
| 1016 | 1013 | Noexcept Noexcept `json:"noexcept"` |
| 1017 | 1014 | Nonatomic Nonatomic `json:"nonatomic"` |
| @@ -1071,8 +1068,6 @@ type Obj4 struct { | ||
| 1071 | 1068 | RuntimeType RuntimeType `json:"runtimeType"` |
| 1072 | 1069 | S S `json:"s"` |
| 1073 | 1070 | Sbyte Sbyte `json:"sbyte"` |
| 1074 | - Sealed Sealed `json:"sealed"` | |
| 1075 | - Sel Sel `json:"SEL"` | |
| 1076 | 1071 | } |
| 1077 | 1072 | |
| 1078 | 1073 | type NSError struct { |
| @@ -1087,6 +1082,14 @@ type NSString struct { | ||
| 1087 | 1082 | NSString int64 `json:"NSString"` |
| 1088 | 1083 | } |
| 1089 | 1084 | |
| 1085 | +type Nil struct { | |
| 1086 | + Nil int64 `json:"nil"` | |
| 1087 | +} | |
| 1088 | + | |
| 1089 | +type No struct { | |
| 1090 | + No int64 `json:"NO"` | |
| 1091 | +} | |
| 1092 | + | |
| 1090 | 1093 | type NoSuchMethod struct { |
| 1091 | 1094 | NoSuchMethod int64 `json:"noSuchMethod"` |
| 1092 | 1095 | } |
| @@ -1323,14 +1326,6 @@ type Sbyte struct { | ||
| 1323 | 1326 | Sbyte int64 `json:"sbyte"` |
| 1324 | 1327 | } |
| 1325 | 1328 | |
| 1326 | -type Sealed struct { | |
| 1327 | - Sealed int64 `json:"sealed"` | |
| 1328 | -} | |
| 1329 | - | |
| 1330 | -type Sel struct { | |
| 1331 | - Sel int64 `json:"SEL"` | |
| 1332 | -} | |
| 1333 | - | |
| 1334 | 1329 | type Obj5 struct { |
| 1335 | 1330 | Dummy int64 `json:"dummy"` |
| 1336 | 1331 | KSerializer KSerializer `json:"KSerializer"` |
| @@ -1338,6 +1333,8 @@ type Obj5 struct { | ||
| 1338 | 1333 | Obj5True TrueClass `json:"true"` |
| 1339 | 1334 | Obj5Type TypeClass `json:"type"` |
| 1340 | 1335 | PrimitiveKind PrimitiveKind `json:"PrimitiveKind"` |
| 1336 | + Sealed Sealed `json:"sealed"` | |
| 1337 | + Sel Sel `json:"SEL"` | |
| 1341 | 1338 | Select Select `json:"select"` |
| 1342 | 1339 | Self Self `json:"Self"` |
| 1343 | 1340 | Sendable Sendable `json:"Sendable"` |
| @@ -1395,9 +1392,6 @@ type Obj5 struct { | ||
| 1395 | 1392 | Undefined Undefined `json:"undefined"` |
| 1396 | 1393 | Union Union `json:"union"` |
| 1397 | 1394 | UnmarshalJSON UnmarshalJSON `json:"UnmarshalJSON"` |
| 1398 | - Unowned Unowned `json:"unowned"` | |
| 1399 | - Unsafe Unsafe `json:"unsafe"` | |
| 1400 | - UseSerializers UseSerializers `json:"UseSerializers"` | |
| 1401 | 1395 | } |
| 1402 | 1396 | |
| 1403 | 1397 | type KSerializer struct { |
| @@ -1420,6 +1414,14 @@ type PrimitiveKind struct { | ||
| 1420 | 1414 | PrimitiveKind int64 `json:"PrimitiveKind"` |
| 1421 | 1415 | } |
| 1422 | 1416 | |
| 1417 | +type Sealed struct { | |
| 1418 | + Sealed int64 `json:"sealed"` | |
| 1419 | +} | |
| 1420 | + | |
| 1421 | +type Sel struct { | |
| 1422 | + Sel int64 `json:"SEL"` | |
| 1423 | +} | |
| 1424 | + | |
| 1423 | 1425 | type Select struct { |
| 1424 | 1426 | Select int64 `json:"select"` |
| 1425 | 1427 | } |
| @@ -1648,22 +1650,13 @@ type UnmarshalJSON struct { | ||
| 1648 | 1650 | UnmarshalJSON int64 `json:"UnmarshalJSON"` |
| 1649 | 1651 | } |
| 1650 | 1652 | |
| 1651 | -type Unowned struct { | |
| 1652 | - Unowned int64 `json:"unowned"` | |
| 1653 | -} | |
| 1654 | - | |
| 1655 | -type Unsafe struct { | |
| 1656 | - Unsafe int64 `json:"unsafe"` | |
| 1657 | -} | |
| 1658 | - | |
| 1659 | -type UseSerializers struct { | |
| 1660 | - UseSerializers int64 `json:"UseSerializers"` | |
| 1661 | -} | |
| 1662 | - | |
| 1663 | 1653 | type Obj6 struct { |
| 1664 | 1654 | Dummy int64 `json:"dummy"` |
| 1665 | 1655 | UUID UUID `json:"UUID"` |
| 1656 | + Unowned Unowned `json:"unowned"` | |
| 1657 | + Unsafe Unsafe `json:"unsafe"` | |
| 1666 | 1658 | Unsigned Unsigned `json:"unsigned"` |
| 1659 | + UseSerializers UseSerializers `json:"UseSerializers"` | |
| 1667 | 1660 | Ushort Ushort `json:"ushort"` |
| 1668 | 1661 | Using Using `json:"using"` |
| 1669 | 1662 | Utf8JSONReader Utf8JSONReader `json:"Utf8JsonReader"` |
| @@ -1688,10 +1681,22 @@ type UUID struct { | ||
| 1688 | 1681 | UUID int64 `json:"UUID"` |
| 1689 | 1682 | } |
| 1690 | 1683 | |
| 1684 | +type Unowned struct { | |
| 1685 | + Unowned int64 `json:"unowned"` | |
| 1686 | +} | |
| 1687 | + | |
| 1688 | +type Unsafe struct { | |
| 1689 | + Unsafe int64 `json:"unsafe"` | |
| 1690 | +} | |
| 1691 | + | |
| 1691 | 1692 | type Unsigned struct { |
| 1692 | 1693 | Unsigned int64 `json:"unsigned"` |
| 1693 | 1694 | } |
| 1694 | 1695 | |
| 1696 | +type UseSerializers struct { | |
| 1697 | + UseSerializers int64 `json:"UseSerializers"` | |
| 1698 | +} | |
| 1699 | + | |
| 1695 | 1700 | type Ushort struct { |
| 1696 | 1701 | Ushort int64 `json:"ushort"` |
| 1697 | 1702 | } |
Mhaskelldefault / QuickType.hs+148 −130
| @@ -180,6 +180,7 @@ module QuickType | ||
| 180 | 180 | , Locale (..) |
| 181 | 181 | , Lock (..) |
| 182 | 182 | , Long (..) |
| 183 | + , MakeDictEncoder (..) | |
| 183 | 184 | , MapClass (..) |
| 184 | 185 | , MapEntry (..) |
| 185 | 186 | , MarshalJSON (..) |
| @@ -190,8 +191,6 @@ module QuickType | ||
| 190 | 191 | , Native (..) |
| 191 | 192 | , New (..) |
| 192 | 193 | , Newtonsoft (..) |
| 193 | - , Nil (..) | |
| 194 | - , No (..) | |
| 195 | 194 | , ID (..) |
| 196 | 195 | , If (..) |
| 197 | 196 | , Import (..) |
| @@ -200,6 +199,8 @@ module QuickType | ||
| 200 | 199 | , Let (..) |
| 201 | 200 | , Module (..) |
| 202 | 201 | , Obj4 (..) |
| 202 | + , Nil (..) | |
| 203 | + , No (..) | |
| 203 | 204 | , NoSuchMethod (..) |
| 204 | 205 | , Noexcept (..) |
| 205 | 206 | , Nonatomic (..) |
| @@ -262,8 +263,6 @@ module QuickType | ||
| 262 | 263 | , RuntimeType (..) |
| 263 | 264 | , S (..) |
| 264 | 265 | , Sbyte (..) |
| 265 | - , Sealed (..) | |
| 266 | - , Sel (..) | |
| 267 | 266 | , Obj5 (..) |
| 268 | 267 | , KSerializer (..) |
| 269 | 268 | , SelfClass (..) |
| @@ -272,6 +271,8 @@ module QuickType | ||
| 272 | 271 | , Type (..) |
| 273 | 272 | , PrimitiveKind (..) |
| 274 | 273 | , TypeClass (..) |
| 274 | + , Sealed (..) | |
| 275 | + , Sel (..) | |
| 275 | 276 | , Select (..) |
| 276 | 277 | , Self (..) |
| 277 | 278 | , Sendable (..) |
| @@ -327,12 +328,12 @@ module QuickType | ||
| 327 | 328 | , Undefined (..) |
| 328 | 329 | , Union (..) |
| 329 | 330 | , UnmarshalJSON (..) |
| 330 | - , Unowned (..) | |
| 331 | - , Unsafe (..) | |
| 332 | - , UseSerializers (..) | |
| 333 | 331 | , Obj6 (..) |
| 334 | 332 | , Where (..) |
| 333 | + , Unowned (..) | |
| 334 | + , Unsafe (..) | |
| 335 | 335 | , Unsigned (..) |
| 336 | + , UseSerializers (..) | |
| 336 | 337 | , Ushort (..) |
| 337 | 338 | , Using (..) |
| 338 | 339 | , Utf8JSONReader (..) |
| @@ -1072,6 +1073,7 @@ data Obj3 = Obj3 | ||
| 1072 | 1073 | , localeObj3 :: Locale |
| 1073 | 1074 | , lockObj3 :: Lock |
| 1074 | 1075 | , longObj3 :: Long |
| 1076 | + , makeDictEncoderObj3 :: MakeDictEncoder | |
| 1075 | 1077 | , mapObj3 :: MapClass |
| 1076 | 1078 | , mapEntryObj3 :: MapEntry |
| 1077 | 1079 | , marshalJSONObj3 :: MarshalJSON |
| @@ -1082,8 +1084,6 @@ data Obj3 = Obj3 | ||
| 1082 | 1084 | , nativeObj3 :: Native |
| 1083 | 1085 | , newObj3 :: New |
| 1084 | 1086 | , newtonsoftObj3 :: Newtonsoft |
| 1085 | - , nilObj3 :: Nil | |
| 1086 | - , noObj3 :: No | |
| 1087 | 1087 | , obj3IDObj3 :: ID |
| 1088 | 1088 | , obj3IfObj3 :: If |
| 1089 | 1089 | , obj3ImportObj3 :: Import |
| @@ -1277,6 +1277,10 @@ data Long = Long | ||
| 1277 | 1277 | { longLong :: Int |
| 1278 | 1278 | } deriving (Show) |
| 1279 | 1279 | |
| 1280 | +data MakeDictEncoder = MakeDictEncoder | |
| 1281 | + { makeDictEncoderMakeDictEncoder :: Int | |
| 1282 | + } deriving (Show) | |
| 1283 | + | |
| 1280 | 1284 | data MapClass = MapClass |
| 1281 | 1285 | { mapMapClass :: Int |
| 1282 | 1286 | } deriving (Show) |
| @@ -1317,14 +1321,6 @@ data Newtonsoft = Newtonsoft | ||
| 1317 | 1321 | { newtonsoftNewtonsoft :: Int |
| 1318 | 1322 | } deriving (Show) |
| 1319 | 1323 | |
| 1320 | -data Nil = Nil | |
| 1321 | - { nilNil :: Int | |
| 1322 | - } deriving (Show) | |
| 1323 | - | |
| 1324 | -data No = No | |
| 1325 | - { noNo :: Int | |
| 1326 | - } deriving (Show) | |
| 1327 | - | |
| 1328 | 1324 | data ID = ID |
| 1329 | 1325 | { idIDID :: Int |
| 1330 | 1326 | } deriving (Show) |
| @@ -1355,6 +1351,8 @@ data Module = Module | ||
| 1355 | 1351 | |
| 1356 | 1352 | data Obj4 = Obj4 |
| 1357 | 1353 | { dummyObj4 :: Int |
| 1354 | + , nilObj4 :: Nil | |
| 1355 | + , noObj4 :: No | |
| 1358 | 1356 | , noSuchMethodObj4 :: NoSuchMethod |
| 1359 | 1357 | , noexceptObj4 :: Noexcept |
| 1360 | 1358 | , nonatomicObj4 :: Nonatomic |
| @@ -1417,8 +1415,14 @@ data Obj4 = Obj4 | ||
| 1417 | 1415 | , runtimeTypeObj4 :: RuntimeType |
| 1418 | 1416 | , sObj4 :: S |
| 1419 | 1417 | , sbyteObj4 :: Sbyte |
| 1420 | - , sealedObj4 :: Sealed | |
| 1421 | - , selObj4 :: Sel | |
| 1418 | + } deriving (Show) | |
| 1419 | + | |
| 1420 | +data Nil = Nil | |
| 1421 | + { nilNil :: Int | |
| 1422 | + } deriving (Show) | |
| 1423 | + | |
| 1424 | +data No = No | |
| 1425 | + { noNo :: Int | |
| 1422 | 1426 | } deriving (Show) |
| 1423 | 1427 | |
| 1424 | 1428 | data NoSuchMethod = NoSuchMethod |
| @@ -1669,14 +1673,6 @@ data Sbyte = Sbyte | ||
| 1669 | 1673 | { sbyteSbyte :: Int |
| 1670 | 1674 | } deriving (Show) |
| 1671 | 1675 | |
| 1672 | -data Sealed = Sealed | |
| 1673 | - { sealedSealed :: Int | |
| 1674 | - } deriving (Show) | |
| 1675 | - | |
| 1676 | -data Sel = Sel | |
| 1677 | - { selSel :: Int | |
| 1678 | - } deriving (Show) | |
| 1679 | - | |
| 1680 | 1676 | data Obj5 = Obj5 |
| 1681 | 1677 | { dummyObj5 :: Int |
| 1682 | 1678 | , kSerializerObj5 :: KSerializer |
| @@ -1686,6 +1682,8 @@ data Obj5 = Obj5 | ||
| 1686 | 1682 | , obj5TypeObj5 :: Type |
| 1687 | 1683 | , primitiveKindObj5 :: PrimitiveKind |
| 1688 | 1684 | , purpleTypeObj5 :: TypeClass |
| 1685 | + , sealedObj5 :: Sealed | |
| 1686 | + , selObj5 :: Sel | |
| 1689 | 1687 | , selectObj5 :: Select |
| 1690 | 1688 | , selfObj5 :: Self |
| 1691 | 1689 | , sendableObj5 :: Sendable |
| @@ -1741,9 +1739,6 @@ data Obj5 = Obj5 | ||
| 1741 | 1739 | , undefinedObj5 :: Undefined |
| 1742 | 1740 | , unionObj5 :: Union |
| 1743 | 1741 | , unmarshalJSONObj5 :: UnmarshalJSON |
| 1744 | - , unownedObj5 :: Unowned | |
| 1745 | - , unsafeObj5 :: Unsafe | |
| 1746 | - , useSerializersObj5 :: UseSerializers | |
| 1747 | 1742 | } deriving (Show) |
| 1748 | 1743 | |
| 1749 | 1744 | data KSerializer = KSerializer |
| @@ -1774,6 +1769,14 @@ data TypeClass = TypeClass | ||
| 1774 | 1769 | { typeTypeTypeClass :: Int |
| 1775 | 1770 | } deriving (Show) |
| 1776 | 1771 | |
| 1772 | +data Sealed = Sealed | |
| 1773 | + { sealedSealed :: Int | |
| 1774 | + } deriving (Show) | |
| 1775 | + | |
| 1776 | +data Sel = Sel | |
| 1777 | + { selSel :: Int | |
| 1778 | + } deriving (Show) | |
| 1779 | + | |
| 1777 | 1780 | data Select = Select |
| 1778 | 1781 | { selectSelect :: Int |
| 1779 | 1782 | } deriving (Show) |
| @@ -1994,22 +1997,13 @@ data UnmarshalJSON = UnmarshalJSON | ||
| 1994 | 1997 | { unmarshalJSONUnmarshalJSON :: Int |
| 1995 | 1998 | } deriving (Show) |
| 1996 | 1999 | |
| 1997 | -data Unowned = Unowned | |
| 1998 | - { unownedUnowned :: Int | |
| 1999 | - } deriving (Show) | |
| 2000 | - | |
| 2001 | -data Unsafe = Unsafe | |
| 2002 | - { unsafeUnsafe :: Int | |
| 2003 | - } deriving (Show) | |
| 2004 | - | |
| 2005 | -data UseSerializers = UseSerializers | |
| 2006 | - { useSerializersUseSerializers :: Int | |
| 2007 | - } deriving (Show) | |
| 2008 | - | |
| 2009 | 2000 | data Obj6 = Obj6 |
| 2010 | 2001 | { dummyObj6 :: Int |
| 2011 | 2002 | , obj6WhereObj6 :: Where |
| 2003 | + , unownedObj6 :: Unowned | |
| 2004 | + , unsafeObj6 :: Unsafe | |
| 2012 | 2005 | , unsignedObj6 :: Unsigned |
| 2006 | + , useSerializersObj6 :: UseSerializers | |
| 2013 | 2007 | , ushortObj6 :: Ushort |
| 2014 | 2008 | , usingObj6 :: Using |
| 2015 | 2009 | , utf8JSONReaderObj6 :: Utf8JSONReader |
| @@ -2034,10 +2028,22 @@ data Where = Where | ||
| 2034 | 2028 | { whereWhereWhere :: Int |
| 2035 | 2029 | } deriving (Show) |
| 2036 | 2030 | |
| 2031 | +data Unowned = Unowned | |
| 2032 | + { unownedUnowned :: Int | |
| 2033 | + } deriving (Show) | |
| 2034 | + | |
| 2035 | +data Unsafe = Unsafe | |
| 2036 | + { unsafeUnsafe :: Int | |
| 2037 | + } deriving (Show) | |
| 2038 | + | |
| 2037 | 2039 | data Unsigned = Unsigned |
| 2038 | 2040 | { unsignedUnsigned :: Int |
| 2039 | 2041 | } deriving (Show) |
| 2040 | 2042 | |
| 2043 | +data UseSerializers = UseSerializers | |
| 2044 | + { useSerializersUseSerializers :: Int | |
| 2045 | + } deriving (Show) | |
| 2046 | + | |
| 2041 | 2047 | data Ushort = Ushort |
| 2042 | 2048 | { ushortUshort :: Int |
| 2043 | 2049 | } deriving (Show) |
| @@ -3702,7 +3708,7 @@ instance FromJSON Obj2False where | ||
| 3702 | 3708 | <$> v .: "false" |
| 3703 | 3709 | |
| 3704 | 3710 | instance ToJSON Obj3 where |
| 3705 | - toJSON (Obj3 dummyObj3 gotoObj3 guardObj3 hasOwnPropertyObj3 hashCodeObj3 hashableObj3 hasherObj3 impObj3 implementsObj3 implicitObj3 indirectObj3 initObj3 inlineObj3 inoutObj3 instanceofObj3 intObj3 interfaceObj3 internalObj3 isObj3 isoDateTimeOffsetConverterObj3 iterableObj3 jdecObj3 jencObj3 jpipeObj3 jsonObj3 jsonAnyObj3 jsonCodingKeyObj3 jsonConverterObj3 jsonDecoderObj3 jsonEncoderObj3 jsonExceptionObj3 jsonGeneratorObj3 jsonNodeObj3 jsonNullObj3 jsonParserObj3 jsonReaderObj3 jsonSerializerObj3 jsonTokenObj3 jsonTokenTypeObj3 jsonWriterObj3 lambdaObj3 lazyObj3 leftObj3 listObj3 localeObj3 lockObj3 longObj3 mapObj3 mapEntryObj3 marshalJSONObj3 metadataPropertyHandlingObj3 mutableObj3 mutatingObj3 namespaceObj3 nativeObj3 newObj3 newtonsoftObj3 nilObj3 noObj3 obj3IDObj3 obj3IfObj3 obj3ImportObj3 obj3InObj3 obj3InfixObj3 obj3LetObj3 obj3ModuleObj3) = | |
| 3711 | + toJSON (Obj3 dummyObj3 gotoObj3 guardObj3 hasOwnPropertyObj3 hashCodeObj3 hashableObj3 hasherObj3 impObj3 implementsObj3 implicitObj3 indirectObj3 initObj3 inlineObj3 inoutObj3 instanceofObj3 intObj3 interfaceObj3 internalObj3 isObj3 isoDateTimeOffsetConverterObj3 iterableObj3 jdecObj3 jencObj3 jpipeObj3 jsonObj3 jsonAnyObj3 jsonCodingKeyObj3 jsonConverterObj3 jsonDecoderObj3 jsonEncoderObj3 jsonExceptionObj3 jsonGeneratorObj3 jsonNodeObj3 jsonNullObj3 jsonParserObj3 jsonReaderObj3 jsonSerializerObj3 jsonTokenObj3 jsonTokenTypeObj3 jsonWriterObj3 lambdaObj3 lazyObj3 leftObj3 listObj3 localeObj3 lockObj3 longObj3 makeDictEncoderObj3 mapObj3 mapEntryObj3 marshalJSONObj3 metadataPropertyHandlingObj3 mutableObj3 mutatingObj3 namespaceObj3 nativeObj3 newObj3 newtonsoftObj3 obj3IDObj3 obj3IfObj3 obj3ImportObj3 obj3InObj3 obj3InfixObj3 obj3LetObj3 obj3ModuleObj3) = | |
| 3706 | 3712 | object $ foldMap (maybe [] pure) |
| 3707 | 3713 | [ Just $ "dummy" .= dummyObj3 |
| 3708 | 3714 | , Just $ "goto" .= gotoObj3 |
| @@ -3751,6 +3757,7 @@ instance ToJSON Obj3 where | ||
| 3751 | 3757 | , Just $ "Locale" .= localeObj3 |
| 3752 | 3758 | , Just $ "lock" .= lockObj3 |
| 3753 | 3759 | , Just $ "long" .= longObj3 |
| 3760 | + , Just $ "makeDictEncoder" .= makeDictEncoderObj3 | |
| 3754 | 3761 | , Just $ "map" .= mapObj3 |
| 3755 | 3762 | , Just $ "MapEntry" .= mapEntryObj3 |
| 3756 | 3763 | , Just $ "MarshalJSON" .= marshalJSONObj3 |
| @@ -3761,8 +3768,6 @@ instance ToJSON Obj3 where | ||
| 3761 | 3768 | , Just $ "native" .= nativeObj3 |
| 3762 | 3769 | , Just $ "new" .= newObj3 |
| 3763 | 3770 | , Just $ "newtonsoft" .= newtonsoftObj3 |
| 3764 | - , Just $ "nil" .= nilObj3 | |
| 3765 | - , Just $ "NO" .= noObj3 | |
| 3766 | 3771 | , Just $ "id" .= obj3IDObj3 |
| 3767 | 3772 | , Just $ "if" .= obj3IfObj3 |
| 3768 | 3773 | , Just $ "import" .= obj3ImportObj3 |
| @@ -3821,6 +3826,7 @@ instance FromJSON Obj3 where | ||
| 3821 | 3826 | <*> v .: "Locale" |
| 3822 | 3827 | <*> v .: "lock" |
| 3823 | 3828 | <*> v .: "long" |
| 3829 | + <*> v .: "makeDictEncoder" | |
| 3824 | 3830 | <*> v .: "map" |
| 3825 | 3831 | <*> v .: "MapEntry" |
| 3826 | 3832 | <*> v .: "MarshalJSON" |
| @@ -3831,8 +3837,6 @@ instance FromJSON Obj3 where | ||
| 3831 | 3837 | <*> v .: "native" |
| 3832 | 3838 | <*> v .: "new" |
| 3833 | 3839 | <*> v .: "newtonsoft" |
| 3834 | - <*> v .: "nil" | |
| 3835 | - <*> v .: "NO" | |
| 3836 | 3840 | <*> v .: "id" |
| 3837 | 3841 | <*> v .: "if" |
| 3838 | 3842 | <*> v .: "import" |
| @@ -4301,6 +4305,16 @@ instance FromJSON Long where | ||
| 4301 | 4305 | parseJSON (Object v) = Long |
| 4302 | 4306 | <$> v .: "long" |
| 4303 | 4307 | |
| 4308 | +instance ToJSON MakeDictEncoder where | |
| 4309 | + toJSON (MakeDictEncoder makeDictEncoderMakeDictEncoder) = | |
| 4310 | + object $ foldMap (maybe [] pure) | |
| 4311 | + [ Just $ "makeDictEncoder" .= makeDictEncoderMakeDictEncoder | |
| 4312 | + ] | |
| 4313 | + | |
| 4314 | +instance FromJSON MakeDictEncoder where | |
| 4315 | + parseJSON (Object v) = MakeDictEncoder | |
| 4316 | + <$> v .: "makeDictEncoder" | |
| 4317 | + | |
| 4304 | 4318 | instance ToJSON MapClass where |
| 4305 | 4319 | toJSON (MapClass mapMapClass) = |
| 4306 | 4320 | object $ foldMap (maybe [] pure) |
| @@ -4401,26 +4415,6 @@ instance FromJSON Newtonsoft where | ||
| 4401 | 4415 | parseJSON (Object v) = Newtonsoft |
| 4402 | 4416 | <$> v .: "newtonsoft" |
| 4403 | 4417 | |
| 4404 | -instance ToJSON Nil where | |
| 4405 | - toJSON (Nil nilNil) = | |
| 4406 | - object $ foldMap (maybe [] pure) | |
| 4407 | - [ Just $ "nil" .= nilNil | |
| 4408 | - ] | |
| 4409 | - | |
| 4410 | -instance FromJSON Nil where | |
| 4411 | - parseJSON (Object v) = Nil | |
| 4412 | - <$> v .: "nil" | |
| 4413 | - | |
| 4414 | -instance ToJSON No where | |
| 4415 | - toJSON (No noNo) = | |
| 4416 | - object $ foldMap (maybe [] pure) | |
| 4417 | - [ Just $ "NO" .= noNo | |
| 4418 | - ] | |
| 4419 | - | |
| 4420 | -instance FromJSON No where | |
| 4421 | - parseJSON (Object v) = No | |
| 4422 | - <$> v .: "NO" | |
| 4423 | - | |
| 4424 | 4418 | instance ToJSON ID where |
| 4425 | 4419 | toJSON (ID idIDID) = |
| 4426 | 4420 | object $ foldMap (maybe [] pure) |
| @@ -4492,9 +4486,11 @@ instance FromJSON Module where | ||
| 4492 | 4486 | <$> v .: "module" |
| 4493 | 4487 | |
| 4494 | 4488 | instance ToJSON Obj4 where |
| 4495 | - toJSON (Obj4 dummyObj4 noSuchMethodObj4 noexceptObj4 nonatomicObj4 noneObj4 nonlocalObj4 nonmutatingObj4 notObj4 notEqObj4 nsErrorObj4 nsObjectObj4 nsStringObj4 nullObj4 nullptrObj4 numberObj4 obj4NoneObj4 obj4NullObj4 obj4OfObj4 obj4ProtocolObj4 objectObj4 objectMapperObj4 onewayObj4 openObj4 operatorObj4 optionalObj4 orObj4 orEqObj4 outObj4 overrideObj4 packageObj4 paramsObj4 passObj4 portObj4 postfixObj4 precedenceObj4 prefixObj4 printObj4 printMembersObj4 printfObj4 privateObj4 protectedObj4 protocolObj4 publicObj4 quicktypeObj4 raiseObj4 rangeObj4 readonlyObj4 refObj4 regExpObj4 registerObj4 reinterpretCastObj4 repeatObj4 requireObj4 requiredObj4 requiresObj4 restrictObj4 retainObj4 rethrowsObj4 returnObj4 rightObj4 runtimeTypeObj4 sObj4 sbyteObj4 sealedObj4 selObj4) = | |
| 4489 | + toJSON (Obj4 dummyObj4 nilObj4 noObj4 noSuchMethodObj4 noexceptObj4 nonatomicObj4 noneObj4 nonlocalObj4 nonmutatingObj4 notObj4 notEqObj4 nsErrorObj4 nsObjectObj4 nsStringObj4 nullObj4 nullptrObj4 numberObj4 obj4NoneObj4 obj4NullObj4 obj4OfObj4 obj4ProtocolObj4 objectObj4 objectMapperObj4 onewayObj4 openObj4 operatorObj4 optionalObj4 orObj4 orEqObj4 outObj4 overrideObj4 packageObj4 paramsObj4 passObj4 portObj4 postfixObj4 precedenceObj4 prefixObj4 printObj4 printMembersObj4 printfObj4 privateObj4 protectedObj4 protocolObj4 publicObj4 quicktypeObj4 raiseObj4 rangeObj4 readonlyObj4 refObj4 regExpObj4 registerObj4 reinterpretCastObj4 repeatObj4 requireObj4 requiredObj4 requiresObj4 restrictObj4 retainObj4 rethrowsObj4 returnObj4 rightObj4 runtimeTypeObj4 sObj4 sbyteObj4) = | |
| 4496 | 4490 | object $ foldMap (maybe [] pure) |
| 4497 | 4491 | [ Just $ "dummy" .= dummyObj4 |
| 4492 | + , Just $ "nil" .= nilObj4 | |
| 4493 | + , Just $ "NO" .= noObj4 | |
| 4498 | 4494 | , Just $ "noSuchMethod" .= noSuchMethodObj4 |
| 4499 | 4495 | , Just $ "noexcept" .= noexceptObj4 |
| 4500 | 4496 | , Just $ "nonatomic" .= nonatomicObj4 |
| @@ -4557,13 +4553,13 @@ instance ToJSON Obj4 where | ||
| 4557 | 4553 | , Just $ "runtimeType" .= runtimeTypeObj4 |
| 4558 | 4554 | , Just $ "s" .= sObj4 |
| 4559 | 4555 | , Just $ "sbyte" .= sbyteObj4 |
| 4560 | - , Just $ "sealed" .= sealedObj4 | |
| 4561 | - , Just $ "SEL" .= selObj4 | |
| 4562 | 4556 | ] |
| 4563 | 4557 | |
| 4564 | 4558 | instance FromJSON Obj4 where |
| 4565 | 4559 | parseJSON (Object v) = Obj4 |
| 4566 | 4560 | <$> v .: "dummy" |
| 4561 | + <*> v .: "nil" | |
| 4562 | + <*> v .: "NO" | |
| 4567 | 4563 | <*> v .: "noSuchMethod" |
| 4568 | 4564 | <*> v .: "noexcept" |
| 4569 | 4565 | <*> v .: "nonatomic" |
| @@ -4626,8 +4622,26 @@ instance FromJSON Obj4 where | ||
| 4626 | 4622 | <*> v .: "runtimeType" |
| 4627 | 4623 | <*> v .: "s" |
| 4628 | 4624 | <*> v .: "sbyte" |
| 4629 | - <*> v .: "sealed" | |
| 4630 | - <*> v .: "SEL" | |
| 4625 | + | |
| 4626 | +instance ToJSON Nil where | |
| 4627 | + toJSON (Nil nilNil) = | |
| 4628 | + object $ foldMap (maybe [] pure) | |
| 4629 | + [ Just $ "nil" .= nilNil | |
| 4630 | + ] | |
| 4631 | + | |
| 4632 | +instance FromJSON Nil where | |
| 4633 | + parseJSON (Object v) = Nil | |
| 4634 | + <$> v .: "nil" | |
| 4635 | + | |
| 4636 | +instance ToJSON No where | |
| 4637 | + toJSON (No noNo) = | |
| 4638 | + object $ foldMap (maybe [] pure) | |
| 4639 | + [ Just $ "NO" .= noNo | |
| 4640 | + ] | |
| 4641 | + | |
| 4642 | +instance FromJSON No where | |
| 4643 | + parseJSON (Object v) = No | |
| 4644 | + <$> v .: "NO" | |
| 4631 | 4645 | |
| 4632 | 4646 | instance ToJSON NoSuchMethod where |
| 4633 | 4647 | toJSON (NoSuchMethod noSuchMethodNoSuchMethod) = |
| @@ -5249,28 +5263,8 @@ instance FromJSON Sbyte where | ||
| 5249 | 5263 | parseJSON (Object v) = Sbyte |
| 5250 | 5264 | <$> v .: "sbyte" |
| 5251 | 5265 | |
| 5252 | -instance ToJSON Sealed where | |
| 5253 | - toJSON (Sealed sealedSealed) = | |
| 5254 | - object $ foldMap (maybe [] pure) | |
| 5255 | - [ Just $ "sealed" .= sealedSealed | |
| 5256 | - ] | |
| 5257 | - | |
| 5258 | -instance FromJSON Sealed where | |
| 5259 | - parseJSON (Object v) = Sealed | |
| 5260 | - <$> v .: "sealed" | |
| 5261 | - | |
| 5262 | -instance ToJSON Sel where | |
| 5263 | - toJSON (Sel selSel) = | |
| 5264 | - object $ foldMap (maybe [] pure) | |
| 5265 | - [ Just $ "SEL" .= selSel | |
| 5266 | - ] | |
| 5267 | - | |
| 5268 | -instance FromJSON Sel where | |
| 5269 | - parseJSON (Object v) = Sel | |
| 5270 | - <$> v .: "SEL" | |
| 5271 | - | |
| 5272 | 5266 | instance ToJSON Obj5 where |
| 5273 | - toJSON (Obj5 dummyObj5 kSerializerObj5 obj5SelfObj5 obj5ThenObj5 obj5TrueObj5 obj5TypeObj5 primitiveKindObj5 purpleTypeObj5 selectObj5 selfObj5 sendableObj5 serialDescriptorObj5 serialNameObj5 serializableObj5 serializeObj5 serializerProviderObj5 setObj5 shortObj5 signedObj5 simpleModuleObj5 sizeofObj5 stackallocObj5 standardsObj5 staticObj5 staticAssertObj5 staticCastObj5 stdDeserializerObj5 stdSerializerObj5 strictfpObj5 stringObj5 structObj5 subscriptObj5 superObj5 switchObj5 symbolObj5 synchronizedObj5 systemObj5 templateObj5 thisObj5 threadLocalObj5 throwObj5 throwsObj5 timeOnlyObj5 timeOnlyConverterObj5 timeZoneObj5 toDictObj5 toJSONObj5 toStringObj5 topLevelObj5 transientObj5 trueObj5 tryObj5 typealiasObj5 typedefObj5 typeidObj5 typenameObj5 typeofObj5 uintObj5 ulongObj5 uncheckedObj5 undefinedObj5 unionObj5 unmarshalJSONObj5 unownedObj5 unsafeObj5 useSerializersObj5) = | |
| 5267 | + toJSON (Obj5 dummyObj5 kSerializerObj5 obj5SelfObj5 obj5ThenObj5 obj5TrueObj5 obj5TypeObj5 primitiveKindObj5 purpleTypeObj5 sealedObj5 selObj5 selectObj5 selfObj5 sendableObj5 serialDescriptorObj5 serialNameObj5 serializableObj5 serializeObj5 serializerProviderObj5 setObj5 shortObj5 signedObj5 simpleModuleObj5 sizeofObj5 stackallocObj5 standardsObj5 staticObj5 staticAssertObj5 staticCastObj5 stdDeserializerObj5 stdSerializerObj5 strictfpObj5 stringObj5 structObj5 subscriptObj5 superObj5 switchObj5 symbolObj5 synchronizedObj5 systemObj5 templateObj5 thisObj5 threadLocalObj5 throwObj5 throwsObj5 timeOnlyObj5 timeOnlyConverterObj5 timeZoneObj5 toDictObj5 toJSONObj5 toStringObj5 topLevelObj5 transientObj5 trueObj5 tryObj5 typealiasObj5 typedefObj5 typeidObj5 typenameObj5 typeofObj5 uintObj5 ulongObj5 uncheckedObj5 undefinedObj5 unionObj5 unmarshalJSONObj5) = | |
| 5274 | 5268 | object $ foldMap (maybe [] pure) |
| 5275 | 5269 | [ Just $ "dummy" .= dummyObj5 |
| 5276 | 5270 | , Just $ "KSerializer" .= kSerializerObj5 |
| @@ -5280,6 +5274,8 @@ instance ToJSON Obj5 where | ||
| 5280 | 5274 | , Just $ "Type" .= obj5TypeObj5 |
| 5281 | 5275 | , Just $ "PrimitiveKind" .= primitiveKindObj5 |
| 5282 | 5276 | , Just $ "type" .= purpleTypeObj5 |
| 5277 | + , Just $ "sealed" .= sealedObj5 | |
| 5278 | + , Just $ "SEL" .= selObj5 | |
| 5283 | 5279 | , Just $ "select" .= selectObj5 |
| 5284 | 5280 | , Just $ "Self" .= selfObj5 |
| 5285 | 5281 | , Just $ "Sendable" .= sendableObj5 |
| @@ -5335,9 +5331,6 @@ instance ToJSON Obj5 where | ||
| 5335 | 5331 | , Just $ "undefined" .= undefinedObj5 |
| 5336 | 5332 | , Just $ "union" .= unionObj5 |
| 5337 | 5333 | , Just $ "UnmarshalJSON" .= unmarshalJSONObj5 |
| 5338 | - , Just $ "unowned" .= unownedObj5 | |
| 5339 | - , Just $ "unsafe" .= unsafeObj5 | |
| 5340 | - , Just $ "UseSerializers" .= useSerializersObj5 | |
| 5341 | 5334 | ] |
| 5342 | 5335 | |
| 5343 | 5336 | instance FromJSON Obj5 where |
| @@ -5350,6 +5343,8 @@ instance FromJSON Obj5 where | ||
| 5350 | 5343 | <*> v .: "Type" |
| 5351 | 5344 | <*> v .: "PrimitiveKind" |
| 5352 | 5345 | <*> v .: "type" |
| 5346 | + <*> v .: "sealed" | |
| 5347 | + <*> v .: "SEL" | |
| 5353 | 5348 | <*> v .: "select" |
| 5354 | 5349 | <*> v .: "Self" |
| 5355 | 5350 | <*> v .: "Sendable" |
| @@ -5405,9 +5400,6 @@ instance FromJSON Obj5 where | ||
| 5405 | 5400 | <*> v .: "undefined" |
| 5406 | 5401 | <*> v .: "union" |
| 5407 | 5402 | <*> v .: "UnmarshalJSON" |
| 5408 | - <*> v .: "unowned" | |
| 5409 | - <*> v .: "unsafe" | |
| 5410 | - <*> v .: "UseSerializers" | |
| 5411 | 5403 | |
| 5412 | 5404 | instance ToJSON KSerializer where |
| 5413 | 5405 | toJSON (KSerializer kSerializerKSerializer) = |
| @@ -5479,6 +5471,26 @@ instance FromJSON TypeClass where | ||
| 5479 | 5471 | parseJSON (Object v) = TypeClass |
| 5480 | 5472 | <$> v .: "type" |
| 5481 | 5473 | |
| 5474 | +instance ToJSON Sealed where | |
| 5475 | + toJSON (Sealed sealedSealed) = | |
| 5476 | + object $ foldMap (maybe [] pure) | |
| 5477 | + [ Just $ "sealed" .= sealedSealed | |
| 5478 | + ] | |
| 5479 | + | |
| 5480 | +instance FromJSON Sealed where | |
| 5481 | + parseJSON (Object v) = Sealed | |
| 5482 | + <$> v .: "sealed" | |
| 5483 | + | |
| 5484 | +instance ToJSON Sel where | |
| 5485 | + toJSON (Sel selSel) = | |
| 5486 | + object $ foldMap (maybe [] pure) | |
| 5487 | + [ Just $ "SEL" .= selSel | |
| 5488 | + ] | |
| 5489 | + | |
| 5490 | +instance FromJSON Sel where | |
| 5491 | + parseJSON (Object v) = Sel | |
| 5492 | + <$> v .: "SEL" | |
| 5493 | + | |
| 5482 | 5494 | instance ToJSON Select where |
| 5483 | 5495 | toJSON (Select selectSelect) = |
| 5484 | 5496 | object $ foldMap (maybe [] pure) |
| @@ -6029,42 +6041,15 @@ instance FromJSON UnmarshalJSON where | ||
| 6029 | 6041 | parseJSON (Object v) = UnmarshalJSON |
| 6030 | 6042 | <$> v .: "UnmarshalJSON" |
| 6031 | 6043 | |
| 6032 | -instance ToJSON Unowned where | |
| 6033 | - toJSON (Unowned unownedUnowned) = | |
| 6034 | - object $ foldMap (maybe [] pure) | |
| 6035 | - [ Just $ "unowned" .= unownedUnowned | |
| 6036 | - ] | |
| 6037 | - | |
| 6038 | -instance FromJSON Unowned where | |
| 6039 | - parseJSON (Object v) = Unowned | |
| 6040 | - <$> v .: "unowned" | |
| 6041 | - | |
| 6042 | -instance ToJSON Unsafe where | |
| 6043 | - toJSON (Unsafe unsafeUnsafe) = | |
| 6044 | - object $ foldMap (maybe [] pure) | |
| 6045 | - [ Just $ "unsafe" .= unsafeUnsafe | |
| 6046 | - ] | |
| 6047 | - | |
| 6048 | -instance FromJSON Unsafe where | |
| 6049 | - parseJSON (Object v) = Unsafe | |
| 6050 | - <$> v .: "unsafe" | |
| 6051 | - | |
| 6052 | -instance ToJSON UseSerializers where | |
| 6053 | - toJSON (UseSerializers useSerializersUseSerializers) = | |
| 6054 | - object $ foldMap (maybe [] pure) | |
| 6055 | - [ Just $ "UseSerializers" .= useSerializersUseSerializers | |
| 6056 | - ] | |
| 6057 | - | |
| 6058 | -instance FromJSON UseSerializers where | |
| 6059 | - parseJSON (Object v) = UseSerializers | |
| 6060 | - <$> v .: "UseSerializers" | |
| 6061 | - | |
| 6062 | 6044 | instance ToJSON Obj6 where |
| 6063 | - toJSON (Obj6 dummyObj6 obj6WhereObj6 unsignedObj6 ushortObj6 usingObj6 utf8JSONReaderObj6 utf8JSONWriterObj6 uuidObj6 varObj6 virtualObj6 voidObj6 volatileObj6 wcharTObj6 weakObj6 whileObj6 willSetObj6 withObj6 xorObj6 xorEqObj6 yesObj6 yieldObj6) = | |
| 6045 | + toJSON (Obj6 dummyObj6 obj6WhereObj6 unownedObj6 unsafeObj6 unsignedObj6 useSerializersObj6 ushortObj6 usingObj6 utf8JSONReaderObj6 utf8JSONWriterObj6 uuidObj6 varObj6 virtualObj6 voidObj6 volatileObj6 wcharTObj6 weakObj6 whileObj6 willSetObj6 withObj6 xorObj6 xorEqObj6 yesObj6 yieldObj6) = | |
| 6064 | 6046 | object $ foldMap (maybe [] pure) |
| 6065 | 6047 | [ Just $ "dummy" .= dummyObj6 |
| 6066 | 6048 | , Just $ "where" .= obj6WhereObj6 |
| 6049 | + , Just $ "unowned" .= unownedObj6 | |
| 6050 | + , Just $ "unsafe" .= unsafeObj6 | |
| 6067 | 6051 | , Just $ "unsigned" .= unsignedObj6 |
| 6052 | + , Just $ "UseSerializers" .= useSerializersObj6 | |
| 6068 | 6053 | , Just $ "ushort" .= ushortObj6 |
| 6069 | 6054 | , Just $ "using" .= usingObj6 |
| 6070 | 6055 | , Just $ "Utf8JsonReader" .= utf8JSONReaderObj6 |
| @@ -6089,7 +6074,10 @@ instance FromJSON Obj6 where | ||
| 6089 | 6074 | parseJSON (Object v) = Obj6 |
| 6090 | 6075 | <$> v .: "dummy" |
| 6091 | 6076 | <*> v .: "where" |
| 6077 | + <*> v .: "unowned" | |
| 6078 | + <*> v .: "unsafe" | |
| 6092 | 6079 | <*> v .: "unsigned" |
| 6080 | + <*> v .: "UseSerializers" | |
| 6093 | 6081 | <*> v .: "ushort" |
| 6094 | 6082 | <*> v .: "using" |
| 6095 | 6083 | <*> v .: "Utf8JsonReader" |
| @@ -6119,6 +6107,26 @@ instance FromJSON Where where | ||
| 6119 | 6107 | parseJSON (Object v) = Where |
| 6120 | 6108 | <$> v .: "where" |
| 6121 | 6109 | |
| 6110 | +instance ToJSON Unowned where | |
| 6111 | + toJSON (Unowned unownedUnowned) = | |
| 6112 | + object $ foldMap (maybe [] pure) | |
| 6113 | + [ Just $ "unowned" .= unownedUnowned | |
| 6114 | + ] | |
| 6115 | + | |
| 6116 | +instance FromJSON Unowned where | |
| 6117 | + parseJSON (Object v) = Unowned | |
| 6118 | + <$> v .: "unowned" | |
| 6119 | + | |
| 6120 | +instance ToJSON Unsafe where | |
| 6121 | + toJSON (Unsafe unsafeUnsafe) = | |
| 6122 | + object $ foldMap (maybe [] pure) | |
| 6123 | + [ Just $ "unsafe" .= unsafeUnsafe | |
| 6124 | + ] | |
| 6125 | + | |
| 6126 | +instance FromJSON Unsafe where | |
| 6127 | + parseJSON (Object v) = Unsafe | |
| 6128 | + <$> v .: "unsafe" | |
| 6129 | + | |
| 6122 | 6130 | instance ToJSON Unsigned where |
| 6123 | 6131 | toJSON (Unsigned unsignedUnsigned) = |
| 6124 | 6132 | object $ foldMap (maybe [] pure) |
| @@ -6129,6 +6137,16 @@ instance FromJSON Unsigned where | ||
| 6129 | 6137 | parseJSON (Object v) = Unsigned |
| 6130 | 6138 | <$> v .: "unsigned" |
| 6131 | 6139 | |
| 6140 | +instance ToJSON UseSerializers where | |
| 6141 | + toJSON (UseSerializers useSerializersUseSerializers) = | |
| 6142 | + object $ foldMap (maybe [] pure) | |
| 6143 | + [ Just $ "UseSerializers" .= useSerializersUseSerializers | |
| 6144 | + ] | |
| 6145 | + | |
| 6146 | +instance FromJSON UseSerializers where | |
| 6147 | + parseJSON (Object v) = UseSerializers | |
| 6148 | + <$> v .: "UseSerializers" | |
| 6149 | + | |
| 6132 | 6150 | instance ToJSON Ushort where |
| 6133 | 6151 | toJSON (Ushort ushortUshort) = |
| 6134 | 6152 | object $ foldMap (maybe [] pure) |
Ajava-datetime-legacydefault / src / main / java / io / quicktype / MakeDictEncoder.java+12 −0
| @@ -0,0 +1,12 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.*; | |
| 4 | + | |
| 5 | +public class MakeDictEncoder { | |
| 6 | + private long makeDictEncoder; | |
| 7 | + | |
| 8 | + @JsonProperty("makeDictEncoder") | |
| 9 | + public long getMakeDictEncoder() { return makeDictEncoder; } | |
| 10 | + @JsonProperty("makeDictEncoder") | |
| 11 | + public void setMakeDictEncoder(long value) { this.makeDictEncoder = value; } | |
| 12 | +} |
Mjava-datetime-legacydefault / src / main / java / io / quicktype / Obj3.java+6 −12
| @@ -48,6 +48,7 @@ public class Obj3 { | ||
| 48 | 48 | private ListClass list; |
| 49 | 49 | private Locale locale; |
| 50 | 50 | private Lock lock; |
| 51 | + private MakeDictEncoder makeDictEncoder; | |
| 51 | 52 | private MapClass map; |
| 52 | 53 | private MapEntry mapEntry; |
| 53 | 54 | private MarshalJSON marshalJSON; |
| @@ -57,8 +58,6 @@ public class Obj3 { | ||
| 57 | 58 | private Mutating mutating; |
| 58 | 59 | private Namespace namespace; |
| 59 | 60 | private Newtonsoft newtonsoft; |
| 60 | - private Nil nil; | |
| 61 | - private No no; | |
| 62 | 61 | private Goto obj3Goto; |
| 63 | 62 | private If obj3If; |
| 64 | 63 | private Implements obj3Implements; |
| @@ -295,6 +294,11 @@ public class Obj3 { | ||
| 295 | 294 | @JsonProperty("lock") |
| 296 | 295 | public void setLock(Lock value) { this.lock = value; } |
| 297 | 296 | |
| 297 | + @JsonProperty("makeDictEncoder") | |
| 298 | + public MakeDictEncoder getMakeDictEncoder() { return makeDictEncoder; } | |
| 299 | + @JsonProperty("makeDictEncoder") | |
| 300 | + public void setMakeDictEncoder(MakeDictEncoder value) { this.makeDictEncoder = value; } | |
| 301 | + | |
| 298 | 302 | @JsonProperty("map") |
| 299 | 303 | public MapClass getMap() { return map; } |
| 300 | 304 | @JsonProperty("map") |
| @@ -340,16 +344,6 @@ public class Obj3 { | ||
| 340 | 344 | @JsonProperty("newtonsoft") |
| 341 | 345 | public void setNewtonsoft(Newtonsoft value) { this.newtonsoft = value; } |
| 342 | 346 | |
| 343 | - @JsonProperty("nil") | |
| 344 | - public Nil getNil() { return nil; } | |
| 345 | - @JsonProperty("nil") | |
| 346 | - public void setNil(Nil value) { this.nil = value; } | |
| 347 | - | |
| 348 | - @JsonProperty("NO") | |
| 349 | - public No getNo() { return no; } | |
| 350 | - @JsonProperty("NO") | |
| 351 | - public void setNo(No value) { this.no = value; } | |
| 352 | - | |
| 353 | 347 | @JsonProperty("goto") |
| 354 | 348 | public Goto getObj3Goto() { return obj3Goto; } |
| 355 | 349 | @JsonProperty("goto") |
Mjava-datetime-legacydefault / src / main / java / io / quicktype / Obj4.java+12 −12
| @@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | |
| 5 | 5 | public class Obj4 { |
| 6 | 6 | private long dummy; |
| 7 | + private Nil nil; | |
| 8 | + private No no; | |
| 7 | 9 | private NoSuchMethod noSuchMethod; |
| 8 | 10 | private Noexcept noexcept; |
| 9 | 11 | private Nonatomic nonatomic; |
| @@ -66,14 +68,22 @@ public class Obj4 { | ||
| 66 | 68 | private RuntimeType runtimeType; |
| 67 | 69 | private S s; |
| 68 | 70 | private Sbyte sbyte; |
| 69 | - private Sealed sealed; | |
| 70 | - private Sel sel; | |
| 71 | 71 | |
| 72 | 72 | @JsonProperty("dummy") |
| 73 | 73 | public long getDummy() { return dummy; } |
| 74 | 74 | @JsonProperty("dummy") |
| 75 | 75 | public void setDummy(long value) { this.dummy = value; } |
| 76 | 76 | |
| 77 | + @JsonProperty("nil") | |
| 78 | + public Nil getNil() { return nil; } | |
| 79 | + @JsonProperty("nil") | |
| 80 | + public void setNil(Nil value) { this.nil = value; } | |
| 81 | + | |
| 82 | + @JsonProperty("NO") | |
| 83 | + public No getNo() { return no; } | |
| 84 | + @JsonProperty("NO") | |
| 85 | + public void setNo(No value) { this.no = value; } | |
| 86 | + | |
| 77 | 87 | @JsonProperty("noSuchMethod") |
| 78 | 88 | public NoSuchMethod getNoSuchMethod() { return noSuchMethod; } |
| 79 | 89 | @JsonProperty("noSuchMethod") |
| @@ -383,14 +393,4 @@ public class Obj4 { | ||
| 383 | 393 | public Sbyte getSbyte() { return sbyte; } |
| 384 | 394 | @JsonProperty("sbyte") |
| 385 | 395 | public void setSbyte(Sbyte value) { this.sbyte = value; } |
| 386 | - | |
| 387 | - @JsonProperty("sealed") | |
| 388 | - public Sealed getSealed() { return sealed; } | |
| 389 | - @JsonProperty("sealed") | |
| 390 | - public void setSealed(Sealed value) { this.sealed = value; } | |
| 391 | - | |
| 392 | - @JsonProperty("SEL") | |
| 393 | - public Sel getSel() { return sel; } | |
| 394 | - @JsonProperty("SEL") | |
| 395 | - public void setSel(Sel value) { this.sel = value; } | |
| 396 | 396 | } |
Mjava-datetime-legacydefault / src / main / java / io / quicktype / Obj5.java+12 −18
| @@ -21,6 +21,8 @@ public class Obj5 { | ||
| 21 | 21 | private TypeClass obj5Type; |
| 22 | 22 | private PrimitiveKind primitiveKind; |
| 23 | 23 | private TrueClass purpleTrue; |
| 24 | + private Sealed sealed; | |
| 25 | + private Sel sel; | |
| 24 | 26 | private Select select; |
| 25 | 27 | private Self self; |
| 26 | 28 | private Sendable sendable; |
| @@ -66,9 +68,6 @@ public class Obj5 { | ||
| 66 | 68 | private Undefined undefined; |
| 67 | 69 | private Union union; |
| 68 | 70 | private UnmarshalJSON unmarshalJSON; |
| 69 | - private Unowned unowned; | |
| 70 | - private Unsafe unsafe; | |
| 71 | - private UseSerializers useSerializers; | |
| 72 | 71 | |
| 73 | 72 | @JsonProperty("dummy") |
| 74 | 73 | public long getDummy() { return dummy; } |
| @@ -160,6 +159,16 @@ public class Obj5 { | ||
| 160 | 159 | @JsonProperty("true") |
| 161 | 160 | public void setPurpleTrue(TrueClass value) { this.purpleTrue = value; } |
| 162 | 161 | |
| 162 | + @JsonProperty("sealed") | |
| 163 | + public Sealed getSealed() { return sealed; } | |
| 164 | + @JsonProperty("sealed") | |
| 165 | + public void setSealed(Sealed value) { this.sealed = value; } | |
| 166 | + | |
| 167 | + @JsonProperty("SEL") | |
| 168 | + public Sel getSel() { return sel; } | |
| 169 | + @JsonProperty("SEL") | |
| 170 | + public void setSel(Sel value) { this.sel = value; } | |
| 171 | + | |
| 163 | 172 | @JsonProperty("select") |
| 164 | 173 | public Select getSelect() { return select; } |
| 165 | 174 | @JsonProperty("select") |
| @@ -384,19 +393,4 @@ public class Obj5 { | ||
| 384 | 393 | public UnmarshalJSON getUnmarshalJSON() { return unmarshalJSON; } |
| 385 | 394 | @JsonProperty("UnmarshalJSON") |
| 386 | 395 | public void setUnmarshalJSON(UnmarshalJSON value) { this.unmarshalJSON = value; } |
| 387 | - | |
| 388 | - @JsonProperty("unowned") | |
| 389 | - public Unowned getUnowned() { return unowned; } | |
| 390 | - @JsonProperty("unowned") | |
| 391 | - public void setUnowned(Unowned value) { this.unowned = value; } | |
| 392 | - | |
| 393 | - @JsonProperty("unsafe") | |
| 394 | - public Unsafe getUnsafe() { return unsafe; } | |
| 395 | - @JsonProperty("unsafe") | |
| 396 | - public void setUnsafe(Unsafe value) { this.unsafe = value; } | |
| 397 | - | |
| 398 | - @JsonProperty("UseSerializers") | |
| 399 | - public UseSerializers getUseSerializers() { return useSerializers; } | |
| 400 | - @JsonProperty("UseSerializers") | |
| 401 | - public void setUseSerializers(UseSerializers value) { this.useSerializers = value; } | |
| 402 | 396 | } |
Mjava-datetime-legacydefault / src / main / java / io / quicktype / Obj6.java+18 −0
| @@ -7,7 +7,10 @@ public class Obj6 { | ||
| 7 | 7 | private Void obj6Void; |
| 8 | 8 | private Volatile obj6Volatile; |
| 9 | 9 | private While obj6While; |
| 10 | + private Unowned unowned; | |
| 11 | + private Unsafe unsafe; | |
| 10 | 12 | private Unsigned unsigned; |
| 13 | + private UseSerializers useSerializers; | |
| 11 | 14 | private Ushort ushort; |
| 12 | 15 | private Using using; |
| 13 | 16 | private Utf8JSONReader utf8JSONReader; |
| @@ -45,11 +48,26 @@ public class Obj6 { | ||
| 45 | 48 | @JsonProperty("while") |
| 46 | 49 | public void setObj6While(While value) { this.obj6While = value; } |
| 47 | 50 | |
| 51 | + @JsonProperty("unowned") | |
| 52 | + public Unowned getUnowned() { return unowned; } | |
| 53 | + @JsonProperty("unowned") | |
| 54 | + public void setUnowned(Unowned value) { this.unowned = value; } | |
| 55 | + | |
| 56 | + @JsonProperty("unsafe") | |
| 57 | + public Unsafe getUnsafe() { return unsafe; } | |
| 58 | + @JsonProperty("unsafe") | |
| 59 | + public void setUnsafe(Unsafe value) { this.unsafe = value; } | |
| 60 | + | |
| 48 | 61 | @JsonProperty("unsigned") |
| 49 | 62 | public Unsigned getUnsigned() { return unsigned; } |
| 50 | 63 | @JsonProperty("unsigned") |
| 51 | 64 | public void setUnsigned(Unsigned value) { this.unsigned = value; } |
| 52 | 65 | |
| 66 | + @JsonProperty("UseSerializers") | |
| 67 | + public UseSerializers getUseSerializers() { return useSerializers; } | |
| 68 | + @JsonProperty("UseSerializers") | |
| 69 | + public void setUseSerializers(UseSerializers value) { this.useSerializers = value; } | |
| 70 | + | |
| 53 | 71 | @JsonProperty("ushort") |
| 54 | 72 | public Ushort getUshort() { return ushort; } |
| 55 | 73 | @JsonProperty("ushort") |
Ajava-lombokdefault / src / main / java / io / quicktype / MakeDictEncoder.java+12 −0
| @@ -0,0 +1,12 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.*; | |
| 4 | + | |
| 5 | +public class MakeDictEncoder { | |
| 6 | + private long makeDictEncoder; | |
| 7 | + | |
| 8 | + @JsonProperty("makeDictEncoder") | |
| 9 | + public long getMakeDictEncoder() { return makeDictEncoder; } | |
| 10 | + @JsonProperty("makeDictEncoder") | |
| 11 | + public void setMakeDictEncoder(long value) { this.makeDictEncoder = value; } | |
| 12 | +} |
Mjava-lombokdefault / src / main / java / io / quicktype / Obj3.java+6 −12
| @@ -48,6 +48,7 @@ public class Obj3 { | ||
| 48 | 48 | private ListClass list; |
| 49 | 49 | private Locale locale; |
| 50 | 50 | private Lock lock; |
| 51 | + private MakeDictEncoder makeDictEncoder; | |
| 51 | 52 | private MapClass map; |
| 52 | 53 | private MapEntry mapEntry; |
| 53 | 54 | private MarshalJSON marshalJSON; |
| @@ -57,8 +58,6 @@ public class Obj3 { | ||
| 57 | 58 | private Mutating mutating; |
| 58 | 59 | private Namespace namespace; |
| 59 | 60 | private Newtonsoft newtonsoft; |
| 60 | - private Nil nil; | |
| 61 | - private No no; | |
| 62 | 61 | private Goto obj3Goto; |
| 63 | 62 | private If obj3If; |
| 64 | 63 | private Implements obj3Implements; |
| @@ -295,6 +294,11 @@ public class Obj3 { | ||
| 295 | 294 | @JsonProperty("lock") |
| 296 | 295 | public void setLock(Lock value) { this.lock = value; } |
| 297 | 296 | |
| 297 | + @JsonProperty("makeDictEncoder") | |
| 298 | + public MakeDictEncoder getMakeDictEncoder() { return makeDictEncoder; } | |
| 299 | + @JsonProperty("makeDictEncoder") | |
| 300 | + public void setMakeDictEncoder(MakeDictEncoder value) { this.makeDictEncoder = value; } | |
| 301 | + | |
| 298 | 302 | @JsonProperty("map") |
| 299 | 303 | public MapClass getMap() { return map; } |
| 300 | 304 | @JsonProperty("map") |
| @@ -340,16 +344,6 @@ public class Obj3 { | ||
| 340 | 344 | @JsonProperty("newtonsoft") |
| 341 | 345 | public void setNewtonsoft(Newtonsoft value) { this.newtonsoft = value; } |
| 342 | 346 | |
| 343 | - @JsonProperty("nil") | |
| 344 | - public Nil getNil() { return nil; } | |
| 345 | - @JsonProperty("nil") | |
| 346 | - public void setNil(Nil value) { this.nil = value; } | |
| 347 | - | |
| 348 | - @JsonProperty("NO") | |
| 349 | - public No getNo() { return no; } | |
| 350 | - @JsonProperty("NO") | |
| 351 | - public void setNo(No value) { this.no = value; } | |
| 352 | - | |
| 353 | 347 | @JsonProperty("goto") |
| 354 | 348 | public Goto getObj3Goto() { return obj3Goto; } |
| 355 | 349 | @JsonProperty("goto") |
Mjava-lombokdefault / src / main / java / io / quicktype / Obj4.java+12 −12
| @@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | |
| 5 | 5 | public class Obj4 { |
| 6 | 6 | private long dummy; |
| 7 | + private Nil nil; | |
| 8 | + private No no; | |
| 7 | 9 | private NoSuchMethod noSuchMethod; |
| 8 | 10 | private Noexcept noexcept; |
| 9 | 11 | private Nonatomic nonatomic; |
| @@ -66,14 +68,22 @@ public class Obj4 { | ||
| 66 | 68 | private RuntimeType runtimeType; |
| 67 | 69 | private S s; |
| 68 | 70 | private Sbyte sbyte; |
| 69 | - private Sealed sealed; | |
| 70 | - private Sel sel; | |
| 71 | 71 | |
| 72 | 72 | @JsonProperty("dummy") |
| 73 | 73 | public long getDummy() { return dummy; } |
| 74 | 74 | @JsonProperty("dummy") |
| 75 | 75 | public void setDummy(long value) { this.dummy = value; } |
| 76 | 76 | |
| 77 | + @JsonProperty("nil") | |
| 78 | + public Nil getNil() { return nil; } | |
| 79 | + @JsonProperty("nil") | |
| 80 | + public void setNil(Nil value) { this.nil = value; } | |
| 81 | + | |
| 82 | + @JsonProperty("NO") | |
| 83 | + public No getNo() { return no; } | |
| 84 | + @JsonProperty("NO") | |
| 85 | + public void setNo(No value) { this.no = value; } | |
| 86 | + | |
| 77 | 87 | @JsonProperty("noSuchMethod") |
| 78 | 88 | public NoSuchMethod getNoSuchMethod() { return noSuchMethod; } |
| 79 | 89 | @JsonProperty("noSuchMethod") |
| @@ -383,14 +393,4 @@ public class Obj4 { | ||
| 383 | 393 | public Sbyte getSbyte() { return sbyte; } |
| 384 | 394 | @JsonProperty("sbyte") |
| 385 | 395 | public void setSbyte(Sbyte value) { this.sbyte = value; } |
| 386 | - | |
| 387 | - @JsonProperty("sealed") | |
| 388 | - public Sealed getSealed() { return sealed; } | |
| 389 | - @JsonProperty("sealed") | |
| 390 | - public void setSealed(Sealed value) { this.sealed = value; } | |
| 391 | - | |
| 392 | - @JsonProperty("SEL") | |
| 393 | - public Sel getSel() { return sel; } | |
| 394 | - @JsonProperty("SEL") | |
| 395 | - public void setSel(Sel value) { this.sel = value; } | |
| 396 | 396 | } |
Mjava-lombokdefault / src / main / java / io / quicktype / Obj5.java+12 −18
| @@ -21,6 +21,8 @@ public class Obj5 { | ||
| 21 | 21 | private TypeClass obj5Type; |
| 22 | 22 | private PrimitiveKind primitiveKind; |
| 23 | 23 | private TrueClass purpleTrue; |
| 24 | + private Sealed sealed; | |
| 25 | + private Sel sel; | |
| 24 | 26 | private Select select; |
| 25 | 27 | private Self self; |
| 26 | 28 | private Sendable sendable; |
| @@ -66,9 +68,6 @@ public class Obj5 { | ||
| 66 | 68 | private Undefined undefined; |
| 67 | 69 | private Union union; |
| 68 | 70 | private UnmarshalJSON unmarshalJSON; |
| 69 | - private Unowned unowned; | |
| 70 | - private Unsafe unsafe; | |
| 71 | - private UseSerializers useSerializers; | |
| 72 | 71 | |
| 73 | 72 | @JsonProperty("dummy") |
| 74 | 73 | public long getDummy() { return dummy; } |
| @@ -160,6 +159,16 @@ public class Obj5 { | ||
| 160 | 159 | @JsonProperty("true") |
| 161 | 160 | public void setPurpleTrue(TrueClass value) { this.purpleTrue = value; } |
| 162 | 161 | |
| 162 | + @JsonProperty("sealed") | |
| 163 | + public Sealed getSealed() { return sealed; } | |
| 164 | + @JsonProperty("sealed") | |
| 165 | + public void setSealed(Sealed value) { this.sealed = value; } | |
| 166 | + | |
| 167 | + @JsonProperty("SEL") | |
| 168 | + public Sel getSel() { return sel; } | |
| 169 | + @JsonProperty("SEL") | |
| 170 | + public void setSel(Sel value) { this.sel = value; } | |
| 171 | + | |
| 163 | 172 | @JsonProperty("select") |
| 164 | 173 | public Select getSelect() { return select; } |
| 165 | 174 | @JsonProperty("select") |
| @@ -384,19 +393,4 @@ public class Obj5 { | ||
| 384 | 393 | public UnmarshalJSON getUnmarshalJSON() { return unmarshalJSON; } |
| 385 | 394 | @JsonProperty("UnmarshalJSON") |
| 386 | 395 | public void setUnmarshalJSON(UnmarshalJSON value) { this.unmarshalJSON = value; } |
| 387 | - | |
| 388 | - @JsonProperty("unowned") | |
| 389 | - public Unowned getUnowned() { return unowned; } | |
| 390 | - @JsonProperty("unowned") | |
| 391 | - public void setUnowned(Unowned value) { this.unowned = value; } | |
| 392 | - | |
| 393 | - @JsonProperty("unsafe") | |
| 394 | - public Unsafe getUnsafe() { return unsafe; } | |
| 395 | - @JsonProperty("unsafe") | |
| 396 | - public void setUnsafe(Unsafe value) { this.unsafe = value; } | |
| 397 | - | |
| 398 | - @JsonProperty("UseSerializers") | |
| 399 | - public UseSerializers getUseSerializers() { return useSerializers; } | |
| 400 | - @JsonProperty("UseSerializers") | |
| 401 | - public void setUseSerializers(UseSerializers value) { this.useSerializers = value; } | |
| 402 | 396 | } |
Mjava-lombokdefault / src / main / java / io / quicktype / Obj6.java+18 −0
| @@ -7,7 +7,10 @@ public class Obj6 { | ||
| 7 | 7 | private Void obj6Void; |
| 8 | 8 | private Volatile obj6Volatile; |
| 9 | 9 | private While obj6While; |
| 10 | + private Unowned unowned; | |
| 11 | + private Unsafe unsafe; | |
| 10 | 12 | private Unsigned unsigned; |
| 13 | + private UseSerializers useSerializers; | |
| 11 | 14 | private Ushort ushort; |
| 12 | 15 | private Using using; |
| 13 | 16 | private Utf8JSONReader utf8JSONReader; |
| @@ -45,11 +48,26 @@ public class Obj6 { | ||
| 45 | 48 | @JsonProperty("while") |
| 46 | 49 | public void setObj6While(While value) { this.obj6While = value; } |
| 47 | 50 | |
| 51 | + @JsonProperty("unowned") | |
| 52 | + public Unowned getUnowned() { return unowned; } | |
| 53 | + @JsonProperty("unowned") | |
| 54 | + public void setUnowned(Unowned value) { this.unowned = value; } | |
| 55 | + | |
| 56 | + @JsonProperty("unsafe") | |
| 57 | + public Unsafe getUnsafe() { return unsafe; } | |
| 58 | + @JsonProperty("unsafe") | |
| 59 | + public void setUnsafe(Unsafe value) { this.unsafe = value; } | |
| 60 | + | |
| 48 | 61 | @JsonProperty("unsigned") |
| 49 | 62 | public Unsigned getUnsigned() { return unsigned; } |
| 50 | 63 | @JsonProperty("unsigned") |
| 51 | 64 | public void setUnsigned(Unsigned value) { this.unsigned = value; } |
| 52 | 65 | |
| 66 | + @JsonProperty("UseSerializers") | |
| 67 | + public UseSerializers getUseSerializers() { return useSerializers; } | |
| 68 | + @JsonProperty("UseSerializers") | |
| 69 | + public void setUseSerializers(UseSerializers value) { this.useSerializers = value; } | |
| 70 | + | |
| 53 | 71 | @JsonProperty("ushort") |
| 54 | 72 | public Ushort getUshort() { return ushort; } |
| 55 | 73 | @JsonProperty("ushort") |
Ajavadefault / src / main / java / io / quicktype / MakeDictEncoder.java+12 −0
| @@ -0,0 +1,12 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.*; | |
| 4 | + | |
| 5 | +public class MakeDictEncoder { | |
| 6 | + private long makeDictEncoder; | |
| 7 | + | |
| 8 | + @JsonProperty("makeDictEncoder") | |
| 9 | + public long getMakeDictEncoder() { return makeDictEncoder; } | |
| 10 | + @JsonProperty("makeDictEncoder") | |
| 11 | + public void setMakeDictEncoder(long value) { this.makeDictEncoder = value; } | |
| 12 | +} |
Mjavadefault / src / main / java / io / quicktype / Obj3.java+6 −12
| @@ -48,6 +48,7 @@ public class Obj3 { | ||
| 48 | 48 | private ListClass list; |
| 49 | 49 | private Locale locale; |
| 50 | 50 | private Lock lock; |
| 51 | + private MakeDictEncoder makeDictEncoder; | |
| 51 | 52 | private MapClass map; |
| 52 | 53 | private MapEntry mapEntry; |
| 53 | 54 | private MarshalJSON marshalJSON; |
| @@ -57,8 +58,6 @@ public class Obj3 { | ||
| 57 | 58 | private Mutating mutating; |
| 58 | 59 | private Namespace namespace; |
| 59 | 60 | private Newtonsoft newtonsoft; |
| 60 | - private Nil nil; | |
| 61 | - private No no; | |
| 62 | 61 | private Goto obj3Goto; |
| 63 | 62 | private If obj3If; |
| 64 | 63 | private Implements obj3Implements; |
| @@ -295,6 +294,11 @@ public class Obj3 { | ||
| 295 | 294 | @JsonProperty("lock") |
| 296 | 295 | public void setLock(Lock value) { this.lock = value; } |
| 297 | 296 | |
| 297 | + @JsonProperty("makeDictEncoder") | |
| 298 | + public MakeDictEncoder getMakeDictEncoder() { return makeDictEncoder; } | |
| 299 | + @JsonProperty("makeDictEncoder") | |
| 300 | + public void setMakeDictEncoder(MakeDictEncoder value) { this.makeDictEncoder = value; } | |
| 301 | + | |
| 298 | 302 | @JsonProperty("map") |
| 299 | 303 | public MapClass getMap() { return map; } |
| 300 | 304 | @JsonProperty("map") |
| @@ -340,16 +344,6 @@ public class Obj3 { | ||
| 340 | 344 | @JsonProperty("newtonsoft") |
| 341 | 345 | public void setNewtonsoft(Newtonsoft value) { this.newtonsoft = value; } |
| 342 | 346 | |
| 343 | - @JsonProperty("nil") | |
| 344 | - public Nil getNil() { return nil; } | |
| 345 | - @JsonProperty("nil") | |
| 346 | - public void setNil(Nil value) { this.nil = value; } | |
| 347 | - | |
| 348 | - @JsonProperty("NO") | |
| 349 | - public No getNo() { return no; } | |
| 350 | - @JsonProperty("NO") | |
| 351 | - public void setNo(No value) { this.no = value; } | |
| 352 | - | |
| 353 | 347 | @JsonProperty("goto") |
| 354 | 348 | public Goto getObj3Goto() { return obj3Goto; } |
| 355 | 349 | @JsonProperty("goto") |
Mjavadefault / src / main / java / io / quicktype / Obj4.java+12 −12
| @@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.*; | ||
| 4 | 4 | |
| 5 | 5 | public class Obj4 { |
| 6 | 6 | private long dummy; |
| 7 | + private Nil nil; | |
| 8 | + private No no; | |
| 7 | 9 | private NoSuchMethod noSuchMethod; |
| 8 | 10 | private Noexcept noexcept; |
| 9 | 11 | private Nonatomic nonatomic; |
| @@ -66,14 +68,22 @@ public class Obj4 { | ||
| 66 | 68 | private RuntimeType runtimeType; |
| 67 | 69 | private S s; |
| 68 | 70 | private Sbyte sbyte; |
| 69 | - private Sealed sealed; | |
| 70 | - private Sel sel; | |
| 71 | 71 | |
| 72 | 72 | @JsonProperty("dummy") |
| 73 | 73 | public long getDummy() { return dummy; } |
| 74 | 74 | @JsonProperty("dummy") |
| 75 | 75 | public void setDummy(long value) { this.dummy = value; } |
| 76 | 76 | |
| 77 | + @JsonProperty("nil") | |
| 78 | + public Nil getNil() { return nil; } | |
| 79 | + @JsonProperty("nil") | |
| 80 | + public void setNil(Nil value) { this.nil = value; } | |
| 81 | + | |
| 82 | + @JsonProperty("NO") | |
| 83 | + public No getNo() { return no; } | |
| 84 | + @JsonProperty("NO") | |
| 85 | + public void setNo(No value) { this.no = value; } | |
| 86 | + | |
| 77 | 87 | @JsonProperty("noSuchMethod") |
| 78 | 88 | public NoSuchMethod getNoSuchMethod() { return noSuchMethod; } |
| 79 | 89 | @JsonProperty("noSuchMethod") |
| @@ -383,14 +393,4 @@ public class Obj4 { | ||
| 383 | 393 | public Sbyte getSbyte() { return sbyte; } |
| 384 | 394 | @JsonProperty("sbyte") |
| 385 | 395 | public void setSbyte(Sbyte value) { this.sbyte = value; } |
| 386 | - | |
| 387 | - @JsonProperty("sealed") | |
| 388 | - public Sealed getSealed() { return sealed; } | |
| 389 | - @JsonProperty("sealed") | |
| 390 | - public void setSealed(Sealed value) { this.sealed = value; } | |
| 391 | - | |
| 392 | - @JsonProperty("SEL") | |
| 393 | - public Sel getSel() { return sel; } | |
| 394 | - @JsonProperty("SEL") | |
| 395 | - public void setSel(Sel value) { this.sel = value; } | |
| 396 | 396 | } |
Mjavadefault / src / main / java / io / quicktype / Obj5.java+12 −18
| @@ -21,6 +21,8 @@ public class Obj5 { | ||
| 21 | 21 | private TypeClass obj5Type; |
| 22 | 22 | private PrimitiveKind primitiveKind; |
| 23 | 23 | private TrueClass purpleTrue; |
| 24 | + private Sealed sealed; | |
| 25 | + private Sel sel; | |
| 24 | 26 | private Select select; |
| 25 | 27 | private Self self; |
| 26 | 28 | private Sendable sendable; |
| @@ -66,9 +68,6 @@ public class Obj5 { | ||
| 66 | 68 | private Undefined undefined; |
| 67 | 69 | private Union union; |
| 68 | 70 | private UnmarshalJSON unmarshalJSON; |
| 69 | - private Unowned unowned; | |
| 70 | - private Unsafe unsafe; | |
| 71 | - private UseSerializers useSerializers; | |
| 72 | 71 | |
| 73 | 72 | @JsonProperty("dummy") |
| 74 | 73 | public long getDummy() { return dummy; } |
| @@ -160,6 +159,16 @@ public class Obj5 { | ||
| 160 | 159 | @JsonProperty("true") |
| 161 | 160 | public void setPurpleTrue(TrueClass value) { this.purpleTrue = value; } |
| 162 | 161 | |
| 162 | + @JsonProperty("sealed") | |
| 163 | + public Sealed getSealed() { return sealed; } | |
| 164 | + @JsonProperty("sealed") | |
| 165 | + public void setSealed(Sealed value) { this.sealed = value; } | |
| 166 | + | |
| 167 | + @JsonProperty("SEL") | |
| 168 | + public Sel getSel() { return sel; } | |
| 169 | + @JsonProperty("SEL") | |
| 170 | + public void setSel(Sel value) { this.sel = value; } | |
| 171 | + | |
| 163 | 172 | @JsonProperty("select") |
| 164 | 173 | public Select getSelect() { return select; } |
| 165 | 174 | @JsonProperty("select") |
| @@ -384,19 +393,4 @@ public class Obj5 { | ||
| 384 | 393 | public UnmarshalJSON getUnmarshalJSON() { return unmarshalJSON; } |
| 385 | 394 | @JsonProperty("UnmarshalJSON") |
| 386 | 395 | public void setUnmarshalJSON(UnmarshalJSON value) { this.unmarshalJSON = value; } |
| 387 | - | |
| 388 | - @JsonProperty("unowned") | |
| 389 | - public Unowned getUnowned() { return unowned; } | |
| 390 | - @JsonProperty("unowned") | |
| 391 | - public void setUnowned(Unowned value) { this.unowned = value; } | |
| 392 | - | |
| 393 | - @JsonProperty("unsafe") | |
| 394 | - public Unsafe getUnsafe() { return unsafe; } | |
| 395 | - @JsonProperty("unsafe") | |
| 396 | - public void setUnsafe(Unsafe value) { this.unsafe = value; } | |
| 397 | - | |
| 398 | - @JsonProperty("UseSerializers") | |
| 399 | - public UseSerializers getUseSerializers() { return useSerializers; } | |
| 400 | - @JsonProperty("UseSerializers") | |
| 401 | - public void setUseSerializers(UseSerializers value) { this.useSerializers = value; } | |
| 402 | 396 | } |
Mjavadefault / src / main / java / io / quicktype / Obj6.java+18 −0
| @@ -7,7 +7,10 @@ public class Obj6 { | ||
| 7 | 7 | private Void obj6Void; |
| 8 | 8 | private Volatile obj6Volatile; |
| 9 | 9 | private While obj6While; |
| 10 | + private Unowned unowned; | |
| 11 | + private Unsafe unsafe; | |
| 10 | 12 | private Unsigned unsigned; |
| 13 | + private UseSerializers useSerializers; | |
| 11 | 14 | private Ushort ushort; |
| 12 | 15 | private Using using; |
| 13 | 16 | private Utf8JSONReader utf8JSONReader; |
| @@ -45,11 +48,26 @@ public class Obj6 { | ||
| 45 | 48 | @JsonProperty("while") |
| 46 | 49 | public void setObj6While(While value) { this.obj6While = value; } |
| 47 | 50 | |
| 51 | + @JsonProperty("unowned") | |
| 52 | + public Unowned getUnowned() { return unowned; } | |
| 53 | + @JsonProperty("unowned") | |
| 54 | + public void setUnowned(Unowned value) { this.unowned = value; } | |
| 55 | + | |
| 56 | + @JsonProperty("unsafe") | |
| 57 | + public Unsafe getUnsafe() { return unsafe; } | |
| 58 | + @JsonProperty("unsafe") | |
| 59 | + public void setUnsafe(Unsafe value) { this.unsafe = value; } | |
| 60 | + | |
| 48 | 61 | @JsonProperty("unsigned") |
| 49 | 62 | public Unsigned getUnsigned() { return unsigned; } |
| 50 | 63 | @JsonProperty("unsigned") |
| 51 | 64 | public void setUnsigned(Unsigned value) { this.unsigned = value; } |
| 52 | 65 | |
| 66 | + @JsonProperty("UseSerializers") | |
| 67 | + public UseSerializers getUseSerializers() { return useSerializers; } | |
| 68 | + @JsonProperty("UseSerializers") | |
| 69 | + public void setUseSerializers(UseSerializers value) { this.useSerializers = value; } | |
| 70 | + | |
| 53 | 71 | @JsonProperty("ushort") |
| 54 | 72 | public Ushort getUshort() { return ushort; } |
| 55 | 73 | @JsonProperty("ushort") |
Mjavascript-prop-typesdefault / toplevel.js+38 −33
| @@ -163,7 +163,6 @@ let _JSONTokenType; | ||
| 163 | 163 | let _Locale; |
| 164 | 164 | let _MapEntry; |
| 165 | 165 | let _MarshalJSON; |
| 166 | -let _No; | |
| 167 | 166 | let _Goto; |
| 168 | 167 | let _Guard; |
| 169 | 168 | let _HasOwnProperty; |
| @@ -200,6 +199,7 @@ let _Let; | ||
| 200 | 199 | let _List; |
| 201 | 200 | let _Lock; |
| 202 | 201 | let _Long; |
| 202 | +let _MakeDictEncoder; | |
| 203 | 203 | let _Map; |
| 204 | 204 | let _MetadataPropertyHandling; |
| 205 | 205 | let _Module; |
| @@ -209,8 +209,8 @@ let _Namespace; | ||
| 209 | 209 | let _Native; |
| 210 | 210 | let _New; |
| 211 | 211 | let _Newtonsoft; |
| 212 | -let _Nil; | |
| 213 | 212 | let _Obj4; |
| 213 | +let _No; | |
| 214 | 214 | let _NSError; |
| 215 | 215 | let _NSObject; |
| 216 | 216 | let _NSString; |
| @@ -219,7 +219,7 @@ let _None; | ||
| 219 | 219 | let _ObjectMapper; |
| 220 | 220 | let _Protocol; |
| 221 | 221 | let _RegExp; |
| 222 | -let _Sel; | |
| 222 | +let _Nil; | |
| 223 | 223 | let _NoSuchMethod; |
| 224 | 224 | let _Noexcept; |
| 225 | 225 | let _Nonatomic; |
| @@ -274,10 +274,10 @@ let _Right; | ||
| 274 | 274 | let _RuntimeType; |
| 275 | 275 | let _S; |
| 276 | 276 | let _Sbyte; |
| 277 | -let _Sealed; | |
| 278 | 277 | let _Obj5; |
| 279 | 278 | let _KSerializer; |
| 280 | 279 | let _PrimitiveKind; |
| 280 | +let _Sel; | |
| 281 | 281 | let _Self; |
| 282 | 282 | let _Sendable; |
| 283 | 283 | let _SerialDescriptor; |
| @@ -294,7 +294,7 @@ let _TimeZone; | ||
| 294 | 294 | let _True; |
| 295 | 295 | let _Type; |
| 296 | 296 | let _UnmarshalJSON; |
| 297 | -let _UseSerializers; | |
| 297 | +let _Sealed; | |
| 298 | 298 | let _Select; |
| 299 | 299 | let _SelfClass; |
| 300 | 300 | let _Serialize; |
| @@ -339,13 +339,14 @@ let _Ulong; | ||
| 339 | 339 | let _Unchecked; |
| 340 | 340 | let _Undefined; |
| 341 | 341 | let _Union; |
| 342 | -let _Unowned; | |
| 343 | -let _Unsafe; | |
| 344 | 342 | let _Obj6; |
| 345 | 343 | let _UUID; |
| 344 | +let _UseSerializers; | |
| 346 | 345 | let _Utf8JSONReader; |
| 347 | 346 | let _Utf8JSONWriter; |
| 348 | 347 | let _Yes; |
| 348 | +let _Unowned; | |
| 349 | +let _Unsafe; | |
| 349 | 350 | let _Unsigned; |
| 350 | 351 | let _Ushort; |
| 351 | 352 | let _Using; |
| @@ -935,9 +936,6 @@ _MapEntry = PropTypes.shape({ | ||
| 935 | 936 | _MarshalJSON = PropTypes.shape({ |
| 936 | 937 | "MarshalJSON": PropTypes.oneOfType([Integer]).isRequired, |
| 937 | 938 | }); |
| 938 | -_No = PropTypes.shape({ | |
| 939 | - "NO": PropTypes.oneOfType([Integer]).isRequired, | |
| 940 | -}); | |
| 941 | 939 | _Goto = PropTypes.shape({ |
| 942 | 940 | "goto": PropTypes.oneOfType([Integer]).isRequired, |
| 943 | 941 | }); |
| @@ -1046,6 +1044,9 @@ _Lock = PropTypes.shape({ | ||
| 1046 | 1044 | _Long = PropTypes.shape({ |
| 1047 | 1045 | "long": PropTypes.oneOfType([Integer]).isRequired, |
| 1048 | 1046 | }); |
| 1047 | +_MakeDictEncoder = PropTypes.shape({ | |
| 1048 | + "makeDictEncoder": PropTypes.oneOfType([Integer]).isRequired, | |
| 1049 | +}); | |
| 1049 | 1050 | _Map = PropTypes.shape({ |
| 1050 | 1051 | "map": PropTypes.oneOfType([Integer]).isRequired, |
| 1051 | 1052 | }); |
| @@ -1073,9 +1074,6 @@ _New = PropTypes.shape({ | ||
| 1073 | 1074 | _Newtonsoft = PropTypes.shape({ |
| 1074 | 1075 | "newtonsoft": PropTypes.oneOfType([Integer]).isRequired, |
| 1075 | 1076 | }); |
| 1076 | -_Nil = PropTypes.shape({ | |
| 1077 | - "nil": PropTypes.oneOfType([Integer]).isRequired, | |
| 1078 | -}); | |
| 1079 | 1077 | _Obj3 = PropTypes.shape({ |
| 1080 | 1078 | "Hashable": _Hashable, |
| 1081 | 1079 | "Hasher": _Hasher, |
| @@ -1095,7 +1093,6 @@ _Obj3 = PropTypes.shape({ | ||
| 1095 | 1093 | "Locale": _Locale, |
| 1096 | 1094 | "MapEntry": _MapEntry, |
| 1097 | 1095 | "MarshalJSON": _MarshalJSON, |
| 1098 | - "NO": _No, | |
| 1099 | 1096 | "dummy": PropTypes.oneOfType([Integer]).isRequired, |
| 1100 | 1097 | "goto": _Goto, |
| 1101 | 1098 | "guard": _Guard, |
| @@ -1133,6 +1130,7 @@ _Obj3 = PropTypes.shape({ | ||
| 1133 | 1130 | "list": _List, |
| 1134 | 1131 | "lock": _Lock, |
| 1135 | 1132 | "long": _Long, |
| 1133 | + "makeDictEncoder": _MakeDictEncoder, | |
| 1136 | 1134 | "map": _Map, |
| 1137 | 1135 | "metadata_property_handling": _MetadataPropertyHandling, |
| 1138 | 1136 | "module": _Module, |
| @@ -1142,7 +1140,9 @@ _Obj3 = PropTypes.shape({ | ||
| 1142 | 1140 | "native": _Native, |
| 1143 | 1141 | "new": _New, |
| 1144 | 1142 | "newtonsoft": _Newtonsoft, |
| 1145 | - "nil": _Nil, | |
| 1143 | +}); | |
| 1144 | +_No = PropTypes.shape({ | |
| 1145 | + "NO": PropTypes.oneOfType([Integer]).isRequired, | |
| 1146 | 1146 | }); |
| 1147 | 1147 | _NSError = PropTypes.shape({ |
| 1148 | 1148 | "NSError": PropTypes.oneOfType([Integer]).isRequired, |
| @@ -1168,8 +1168,8 @@ _Protocol = PropTypes.shape({ | ||
| 1168 | 1168 | _RegExp = PropTypes.shape({ |
| 1169 | 1169 | "RegExp": PropTypes.oneOfType([(props, name) => props[name] == null || /^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i.test(props[name]) ? null : new Error("Expected UUID")]).isRequired, |
| 1170 | 1170 | }); |
| 1171 | -_Sel = PropTypes.shape({ | |
| 1172 | - "SEL": PropTypes.oneOfType([Integer]).isRequired, | |
| 1171 | +_Nil = PropTypes.shape({ | |
| 1172 | + "nil": PropTypes.oneOfType([Integer]).isRequired, | |
| 1173 | 1173 | }); |
| 1174 | 1174 | _NoSuchMethod = PropTypes.shape({ |
| 1175 | 1175 | "noSuchMethod": PropTypes.oneOfType([Integer]).isRequired, |
| @@ -1333,10 +1333,8 @@ _S = PropTypes.shape({ | ||
| 1333 | 1333 | _Sbyte = PropTypes.shape({ |
| 1334 | 1334 | "sbyte": PropTypes.oneOfType([Integer]).isRequired, |
| 1335 | 1335 | }); |
| 1336 | -_Sealed = PropTypes.shape({ | |
| 1337 | - "sealed": PropTypes.oneOfType([Integer]).isRequired, | |
| 1338 | -}); | |
| 1339 | 1336 | _Obj4 = PropTypes.shape({ |
| 1337 | + "NO": _No, | |
| 1340 | 1338 | "NSError": _NSError, |
| 1341 | 1339 | "NSObject": _NSObject, |
| 1342 | 1340 | "NSString": _NSString, |
| @@ -1345,8 +1343,8 @@ _Obj4 = PropTypes.shape({ | ||
| 1345 | 1343 | "ObjectMapper": _ObjectMapper, |
| 1346 | 1344 | "Protocol": _Protocol, |
| 1347 | 1345 | "RegExp": _RegExp, |
| 1348 | - "SEL": _Sel, | |
| 1349 | 1346 | "dummy": PropTypes.oneOfType([Integer]).isRequired, |
| 1347 | + "nil": _Nil, | |
| 1350 | 1348 | "noSuchMethod": _NoSuchMethod, |
| 1351 | 1349 | "noexcept": _Noexcept, |
| 1352 | 1350 | "nonatomic": _Nonatomic, |
| @@ -1401,7 +1399,6 @@ _Obj4 = PropTypes.shape({ | ||
| 1401 | 1399 | "runtimeType": _RuntimeType, |
| 1402 | 1400 | "s": _S, |
| 1403 | 1401 | "sbyte": _Sbyte, |
| 1404 | - "sealed": _Sealed, | |
| 1405 | 1402 | }); |
| 1406 | 1403 | _KSerializer = PropTypes.shape({ |
| 1407 | 1404 | "KSerializer": PropTypes.oneOfType([Integer]).isRequired, |
| @@ -1409,6 +1406,9 @@ _KSerializer = PropTypes.shape({ | ||
| 1409 | 1406 | _PrimitiveKind = PropTypes.shape({ |
| 1410 | 1407 | "PrimitiveKind": PropTypes.oneOfType([Integer]).isRequired, |
| 1411 | 1408 | }); |
| 1409 | +_Sel = PropTypes.shape({ | |
| 1410 | + "SEL": PropTypes.oneOfType([Integer]).isRequired, | |
| 1411 | +}); | |
| 1412 | 1412 | _Self = PropTypes.shape({ |
| 1413 | 1413 | "Self": PropTypes.oneOfType([Integer]).isRequired, |
| 1414 | 1414 | }); |
| @@ -1457,8 +1457,8 @@ _Type = PropTypes.shape({ | ||
| 1457 | 1457 | _UnmarshalJSON = PropTypes.shape({ |
| 1458 | 1458 | "UnmarshalJSON": PropTypes.oneOfType([Integer]).isRequired, |
| 1459 | 1459 | }); |
| 1460 | -_UseSerializers = PropTypes.shape({ | |
| 1461 | - "UseSerializers": PropTypes.oneOfType([Integer]).isRequired, | |
| 1460 | +_Sealed = PropTypes.shape({ | |
| 1461 | + "sealed": PropTypes.oneOfType([Integer]).isRequired, | |
| 1462 | 1462 | }); |
| 1463 | 1463 | _Select = PropTypes.shape({ |
| 1464 | 1464 | "select": PropTypes.oneOfType([Integer]).isRequired, |
| @@ -1592,15 +1592,10 @@ _Undefined = PropTypes.shape({ | ||
| 1592 | 1592 | _Union = PropTypes.shape({ |
| 1593 | 1593 | "union": PropTypes.oneOfType([Integer]).isRequired, |
| 1594 | 1594 | }); |
| 1595 | -_Unowned = PropTypes.shape({ | |
| 1596 | - "unowned": PropTypes.oneOfType([Integer]).isRequired, | |
| 1597 | -}); | |
| 1598 | -_Unsafe = PropTypes.shape({ | |
| 1599 | - "unsafe": PropTypes.oneOfType([Integer]).isRequired, | |
| 1600 | -}); | |
| 1601 | 1595 | _Obj5 = PropTypes.shape({ |
| 1602 | 1596 | "KSerializer": _KSerializer, |
| 1603 | 1597 | "PrimitiveKind": _PrimitiveKind, |
| 1598 | + "SEL": _Sel, | |
| 1604 | 1599 | "Self": _Self, |
| 1605 | 1600 | "Sendable": _Sendable, |
| 1606 | 1601 | "SerialDescriptor": _SerialDescriptor, |
| @@ -1617,8 +1612,8 @@ _Obj5 = PropTypes.shape({ | ||
| 1617 | 1612 | "True": _True, |
| 1618 | 1613 | "Type": _Type, |
| 1619 | 1614 | "UnmarshalJSON": _UnmarshalJSON, |
| 1620 | - "UseSerializers": _UseSerializers, | |
| 1621 | 1615 | "dummy": PropTypes.oneOfType([Integer]).isRequired, |
| 1616 | + "sealed": _Sealed, | |
| 1622 | 1617 | "select": _Select, |
| 1623 | 1618 | "self": _SelfClass, |
| 1624 | 1619 | "serialize": _Serialize, |
| @@ -1663,12 +1658,13 @@ _Obj5 = PropTypes.shape({ | ||
| 1663 | 1658 | "unchecked": _Unchecked, |
| 1664 | 1659 | "undefined": _Undefined, |
| 1665 | 1660 | "union": _Union, |
| 1666 | - "unowned": _Unowned, | |
| 1667 | - "unsafe": _Unsafe, | |
| 1668 | 1661 | }); |
| 1669 | 1662 | _UUID = PropTypes.shape({ |
| 1670 | 1663 | "UUID": PropTypes.oneOfType([Integer]).isRequired, |
| 1671 | 1664 | }); |
| 1665 | +_UseSerializers = PropTypes.shape({ | |
| 1666 | + "UseSerializers": PropTypes.oneOfType([Integer]).isRequired, | |
| 1667 | +}); | |
| 1672 | 1668 | _Utf8JSONReader = PropTypes.shape({ |
| 1673 | 1669 | "Utf8JsonReader": PropTypes.oneOfType([Integer]).isRequired, |
| 1674 | 1670 | }); |
| @@ -1678,6 +1674,12 @@ _Utf8JSONWriter = PropTypes.shape({ | ||
| 1678 | 1674 | _Yes = PropTypes.shape({ |
| 1679 | 1675 | "YES": PropTypes.oneOfType([Integer]).isRequired, |
| 1680 | 1676 | }); |
| 1677 | +_Unowned = PropTypes.shape({ | |
| 1678 | + "unowned": PropTypes.oneOfType([Integer]).isRequired, | |
| 1679 | +}); | |
| 1680 | +_Unsafe = PropTypes.shape({ | |
| 1681 | + "unsafe": PropTypes.oneOfType([Integer]).isRequired, | |
| 1682 | +}); | |
| 1681 | 1683 | _Unsigned = PropTypes.shape({ |
| 1682 | 1684 | "unsigned": PropTypes.oneOfType([Integer]).isRequired, |
| 1683 | 1685 | }); |
| @@ -1728,10 +1730,13 @@ _Yield = PropTypes.shape({ | ||
| 1728 | 1730 | }); |
| 1729 | 1731 | _Obj6 = PropTypes.shape({ |
| 1730 | 1732 | "UUID": _UUID, |
| 1733 | + "UseSerializers": _UseSerializers, | |
| 1731 | 1734 | "Utf8JsonReader": _Utf8JSONReader, |
| 1732 | 1735 | "Utf8JsonWriter": _Utf8JSONWriter, |
| 1733 | 1736 | "YES": _Yes, |
| 1734 | 1737 | "dummy": PropTypes.oneOfType([Integer]).isRequired, |
| 1738 | + "unowned": _Unowned, | |
| 1739 | + "unsafe": _Unsafe, | |
| 1735 | 1740 | "unsigned": _Unsigned, |
| 1736 | 1741 | "ushort": _Ushort, |
| 1737 | 1742 | "using": _Using, |
Mjavascriptdefault / TopLevel.js+32 −28
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
| @@ -739,7 +739,6 @@ const typeMap = { | ||
| 739 | 739 | { json: "Locale", js: "Locale", typ: r("Locale") }, |
| 740 | 740 | { json: "MapEntry", js: "MapEntry", typ: r("MapEntry") }, |
| 741 | 741 | { json: "MarshalJSON", js: "MarshalJSON", typ: r("MarshalJSON") }, |
| 742 | - { json: "NO", js: "NO", typ: r("No") }, | |
| 743 | 742 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 744 | 743 | { json: "goto", js: "goto", typ: r("Goto") }, |
| 745 | 744 | { json: "guard", js: "guard", typ: r("Guard") }, |
| @@ -777,6 +776,7 @@ const typeMap = { | ||
| 777 | 776 | { json: "list", js: "list", typ: r("List") }, |
| 778 | 777 | { json: "lock", js: "lock", typ: r("Lock") }, |
| 779 | 778 | { json: "long", js: "long", typ: r("Long") }, |
| 779 | + { json: "makeDictEncoder", js: "makeDictEncoder", typ: r("MakeDictEncoder") }, | |
| 780 | 780 | { json: "map", js: "map", typ: r("Map") }, |
| 781 | 781 | { json: "metadata_property_handling", js: "metadata_property_handling", typ: r("MetadataPropertyHandling") }, |
| 782 | 782 | { json: "module", js: "module", typ: r("Module") }, |
| @@ -786,7 +786,6 @@ const typeMap = { | ||
| 786 | 786 | { json: "native", js: "native", typ: r("Native") }, |
| 787 | 787 | { json: "new", js: "new", typ: r("New") }, |
| 788 | 788 | { json: "newtonsoft", js: "newtonsoft", typ: r("Newtonsoft") }, |
| 789 | - { json: "nil", js: "nil", typ: r("Nil") }, | |
| 790 | 789 | ], false), |
| 791 | 790 | "Hashable": o([ |
| 792 | 791 | { json: "Hashable", js: "Hashable", typ: i(0) }, |
| @@ -842,9 +841,6 @@ const typeMap = { | ||
| 842 | 841 | "MarshalJSON": o([ |
| 843 | 842 | { json: "MarshalJSON", js: "MarshalJSON", typ: i(0) }, |
| 844 | 843 | ], false), |
| 845 | - "No": o([ | |
| 846 | - { json: "NO", js: "NO", typ: i(0) }, | |
| 847 | - ], false), | |
| 848 | 844 | "Goto": o([ |
| 849 | 845 | { json: "goto", js: "goto", typ: i(0) }, |
| 850 | 846 | ], false), |
| @@ -953,6 +949,9 @@ const typeMap = { | ||
| 953 | 949 | "Long": o([ |
| 954 | 950 | { json: "long", js: "long", typ: i(0) }, |
| 955 | 951 | ], false), |
| 952 | + "MakeDictEncoder": o([ | |
| 953 | + { json: "makeDictEncoder", js: "makeDictEncoder", typ: i(0) }, | |
| 954 | + ], false), | |
| 956 | 955 | "Map": o([ |
| 957 | 956 | { json: "map", js: "map", typ: i(0) }, |
| 958 | 957 | ], false), |
| @@ -980,10 +979,8 @@ const typeMap = { | ||
| 980 | 979 | "Newtonsoft": o([ |
| 981 | 980 | { json: "newtonsoft", js: "newtonsoft", typ: i(0) }, |
| 982 | 981 | ], false), |
| 983 | - "Nil": o([ | |
| 984 | - { json: "nil", js: "nil", typ: i(0) }, | |
| 985 | - ], false), | |
| 986 | 982 | "Obj4": o([ |
| 983 | + { json: "NO", js: "NO", typ: r("No") }, | |
| 987 | 984 | { json: "NSError", js: "NSError", typ: r("NSError") }, |
| 988 | 985 | { json: "NSObject", js: "NSObject", typ: r("NSObject") }, |
| 989 | 986 | { json: "NSString", js: "NSString", typ: r("NSString") }, |
| @@ -992,8 +989,8 @@ const typeMap = { | ||
| 992 | 989 | { json: "ObjectMapper", js: "ObjectMapper", typ: r("ObjectMapper") }, |
| 993 | 990 | { json: "Protocol", js: "Protocol", typ: r("Protocol") }, |
| 994 | 991 | { json: "RegExp", js: "RegExp", typ: r("RegExp") }, |
| 995 | - { json: "SEL", js: "SEL", typ: r("Sel") }, | |
| 996 | 992 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 993 | + { json: "nil", js: "nil", typ: r("Nil") }, | |
| 997 | 994 | { json: "noSuchMethod", js: "noSuchMethod", typ: r("NoSuchMethod") }, |
| 998 | 995 | { json: "noexcept", js: "noexcept", typ: r("Noexcept") }, |
| 999 | 996 | { json: "nonatomic", js: "nonatomic", typ: r("Nonatomic") }, |
| @@ -1048,7 +1045,9 @@ const typeMap = { | ||
| 1048 | 1045 | { json: "runtimeType", js: "runtimeType", typ: r("RuntimeType") }, |
| 1049 | 1046 | { json: "s", js: "s", typ: r("S") }, |
| 1050 | 1047 | { json: "sbyte", js: "sbyte", typ: r("Sbyte") }, |
| 1051 | - { json: "sealed", js: "sealed", typ: r("Sealed") }, | |
| 1048 | + ], false), | |
| 1049 | + "No": o([ | |
| 1050 | + { json: "NO", js: "NO", typ: i(0) }, | |
| 1052 | 1051 | ], false), |
| 1053 | 1052 | "NSError": o([ |
| 1054 | 1053 | { json: "NSError", js: "NSError", typ: i(0) }, |
| @@ -1074,8 +1073,8 @@ const typeMap = { | ||
| 1074 | 1073 | "RegExp": o([ |
| 1075 | 1074 | { json: "RegExp", js: "RegExp", typ: { uuid: "" } }, |
| 1076 | 1075 | ], false), |
| 1077 | - "Sel": o([ | |
| 1078 | - { json: "SEL", js: "SEL", typ: i(0) }, | |
| 1076 | + "Nil": o([ | |
| 1077 | + { json: "nil", js: "nil", typ: i(0) }, | |
| 1079 | 1078 | ], false), |
| 1080 | 1079 | "NoSuchMethod": o([ |
| 1081 | 1080 | { json: "noSuchMethod", js: "noSuchMethod", typ: i(0) }, |
| @@ -1239,12 +1238,10 @@ const typeMap = { | ||
| 1239 | 1238 | "Sbyte": o([ |
| 1240 | 1239 | { json: "sbyte", js: "sbyte", typ: i(0) }, |
| 1241 | 1240 | ], false), |
| 1242 | - "Sealed": o([ | |
| 1243 | - { json: "sealed", js: "sealed", typ: i(0) }, | |
| 1244 | - ], false), | |
| 1245 | 1241 | "Obj5": o([ |
| 1246 | 1242 | { json: "KSerializer", js: "KSerializer", typ: r("KSerializer") }, |
| 1247 | 1243 | { json: "PrimitiveKind", js: "PrimitiveKind", typ: r("PrimitiveKind") }, |
| 1244 | + { json: "SEL", js: "SEL", typ: r("Sel") }, | |
| 1248 | 1245 | { json: "Self", js: "Self", typ: r("Self") }, |
| 1249 | 1246 | { json: "Sendable", js: "Sendable", typ: r("Sendable") }, |
| 1250 | 1247 | { json: "SerialDescriptor", js: "SerialDescriptor", typ: r("SerialDescriptor") }, |
| @@ -1261,8 +1258,8 @@ const typeMap = { | ||
| 1261 | 1258 | { json: "True", js: "True", typ: r("True") }, |
| 1262 | 1259 | { json: "Type", js: "Type", typ: r("Type") }, |
| 1263 | 1260 | { json: "UnmarshalJSON", js: "UnmarshalJSON", typ: r("UnmarshalJSON") }, |
| 1264 | - { json: "UseSerializers", js: "UseSerializers", typ: r("UseSerializers") }, | |
| 1265 | 1261 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 1262 | + { json: "sealed", js: "sealed", typ: r("Sealed") }, | |
| 1266 | 1263 | { json: "select", js: "select", typ: r("Select") }, |
| 1267 | 1264 | { json: "self", js: "self", typ: r("SelfClass") }, |
| 1268 | 1265 | { json: "serialize", js: "serialize", typ: r("Serialize") }, |
| @@ -1307,8 +1304,6 @@ const typeMap = { | ||
| 1307 | 1304 | { json: "unchecked", js: "unchecked", typ: r("Unchecked") }, |
| 1308 | 1305 | { json: "undefined", js: "undefined", typ: r("Undefined") }, |
| 1309 | 1306 | { json: "union", js: "union", typ: r("Union") }, |
| 1310 | - { json: "unowned", js: "unowned", typ: r("Unowned") }, | |
| 1311 | - { json: "unsafe", js: "unsafe", typ: r("Unsafe") }, | |
| 1312 | 1307 | ], false), |
| 1313 | 1308 | "KSerializer": o([ |
| 1314 | 1309 | { json: "KSerializer", js: "KSerializer", typ: i(0) }, |
| @@ -1316,6 +1311,9 @@ const typeMap = { | ||
| 1316 | 1311 | "PrimitiveKind": o([ |
| 1317 | 1312 | { json: "PrimitiveKind", js: "PrimitiveKind", typ: i(0) }, |
| 1318 | 1313 | ], false), |
| 1314 | + "Sel": o([ | |
| 1315 | + { json: "SEL", js: "SEL", typ: i(0) }, | |
| 1316 | + ], false), | |
| 1319 | 1317 | "Self": o([ |
| 1320 | 1318 | { json: "Self", js: "Self", typ: i(0) }, |
| 1321 | 1319 | ], false), |
| @@ -1364,8 +1362,8 @@ const typeMap = { | ||
| 1364 | 1362 | "UnmarshalJSON": o([ |
| 1365 | 1363 | { json: "UnmarshalJSON", js: "UnmarshalJSON", typ: i(0) }, |
| 1366 | 1364 | ], false), |
| 1367 | - "UseSerializers": o([ | |
| 1368 | - { json: "UseSerializers", js: "UseSerializers", typ: i(0) }, | |
| 1365 | + "Sealed": o([ | |
| 1366 | + { json: "sealed", js: "sealed", typ: i(0) }, | |
| 1369 | 1367 | ], false), |
| 1370 | 1368 | "Select": o([ |
| 1371 | 1369 | { json: "select", js: "select", typ: i(0) }, |
| @@ -1499,18 +1497,15 @@ const typeMap = { | ||
| 1499 | 1497 | "Union": o([ |
| 1500 | 1498 | { json: "union", js: "union", typ: i(0) }, |
| 1501 | 1499 | ], false), |
| 1502 | - "Unowned": o([ | |
| 1503 | - { json: "unowned", js: "unowned", typ: i(0) }, | |
| 1504 | - ], false), | |
| 1505 | - "Unsafe": o([ | |
| 1506 | - { json: "unsafe", js: "unsafe", typ: i(0) }, | |
| 1507 | - ], false), | |
| 1508 | 1500 | "Obj6": o([ |
| 1509 | 1501 | { json: "UUID", js: "UUID", typ: r("UUID") }, |
| 1502 | + { json: "UseSerializers", js: "UseSerializers", typ: r("UseSerializers") }, | |
| 1510 | 1503 | { json: "Utf8JsonReader", js: "Utf8JsonReader", typ: r("Utf8JSONReader") }, |
| 1511 | 1504 | { json: "Utf8JsonWriter", js: "Utf8JsonWriter", typ: r("Utf8JSONWriter") }, |
| 1512 | 1505 | { json: "YES", js: "YES", typ: r("Yes") }, |
| 1513 | 1506 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 1507 | + { json: "unowned", js: "unowned", typ: r("Unowned") }, | |
| 1508 | + { json: "unsafe", js: "unsafe", typ: r("Unsafe") }, | |
| 1514 | 1509 | { json: "unsigned", js: "unsigned", typ: r("Unsigned") }, |
| 1515 | 1510 | { json: "ushort", js: "ushort", typ: r("Ushort") }, |
| 1516 | 1511 | { json: "using", js: "using", typ: r("Using") }, |
| @@ -1531,6 +1526,9 @@ const typeMap = { | ||
| 1531 | 1526 | "UUID": o([ |
| 1532 | 1527 | { json: "UUID", js: "UUID", typ: i(0) }, |
| 1533 | 1528 | ], false), |
| 1529 | + "UseSerializers": o([ | |
| 1530 | + { json: "UseSerializers", js: "UseSerializers", typ: i(0) }, | |
| 1531 | + ], false), | |
| 1534 | 1532 | "Utf8JSONReader": o([ |
| 1535 | 1533 | { json: "Utf8JsonReader", js: "Utf8JsonReader", typ: i(0) }, |
| 1536 | 1534 | ], false), |
| @@ -1540,6 +1538,12 @@ const typeMap = { | ||
| 1540 | 1538 | "Yes": o([ |
| 1541 | 1539 | { json: "YES", js: "YES", typ: i(0) }, |
| 1542 | 1540 | ], false), |
| 1541 | + "Unowned": o([ | |
| 1542 | + { json: "unowned", js: "unowned", typ: i(0) }, | |
| 1543 | + ], false), | |
| 1544 | + "Unsafe": o([ | |
| 1545 | + { json: "unsafe", js: "unsafe", typ: i(0) }, | |
| 1546 | + ], false), | |
| 1543 | 1547 | "Unsigned": o([ |
| 1544 | 1548 | { json: "unsigned", js: "unsigned", typ: i(0) }, |
| 1545 | 1549 | ], false), |
Mkotlin-jacksondefault / TopLevel.kt+63 −55
| @@ -1258,6 +1258,9 @@ data class Obj3 ( | ||
| 1258 | 1258 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 1259 | 1259 | val long: LongClass, |
| 1260 | 1260 | |
| 1261 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 1262 | + val makeDictEncoder: MakeDictEncoder, | |
| 1263 | + | |
| 1261 | 1264 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 1262 | 1265 | val map: MapClass, |
| 1263 | 1266 | |
| @@ -1291,12 +1294,6 @@ data class Obj3 ( | ||
| 1291 | 1294 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 1292 | 1295 | val newtonsoft: Newtonsoft, |
| 1293 | 1296 | |
| 1294 | - @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 1295 | - val nil: Nil, | |
| 1296 | - | |
| 1297 | - @get:JsonProperty("NO", required=true)@field:JsonProperty("NO", required=true) | |
| 1298 | - val no: No, | |
| 1299 | - | |
| 1300 | 1297 | @get:JsonProperty("if", required=true)@field:JsonProperty("if", required=true) |
| 1301 | 1298 | val obj3If: If, |
| 1302 | 1299 | |
| @@ -1550,6 +1547,11 @@ data class LongClass ( | ||
| 1550 | 1547 | val long: Long |
| 1551 | 1548 | ) |
| 1552 | 1549 | |
| 1550 | +data class MakeDictEncoder ( | |
| 1551 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 1552 | + val makeDictEncoder: Long | |
| 1553 | +) | |
| 1554 | + | |
| 1553 | 1555 | data class MapClass ( |
| 1554 | 1556 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 1555 | 1557 | val map: Long |
| @@ -1605,16 +1607,6 @@ data class Newtonsoft ( | ||
| 1605 | 1607 | val newtonsoft: Long |
| 1606 | 1608 | ) |
| 1607 | 1609 | |
| 1608 | -data class Nil ( | |
| 1609 | - @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 1610 | - val nil: Long | |
| 1611 | -) | |
| 1612 | - | |
| 1613 | -data class No ( | |
| 1614 | - @get:JsonProperty("NO", required=true)@field:JsonProperty("NO", required=true) | |
| 1615 | - val no: Long | |
| 1616 | -) | |
| 1617 | - | |
| 1618 | 1610 | data class If ( |
| 1619 | 1611 | @get:JsonProperty("if", required=true)@field:JsonProperty("if", required=true) |
| 1620 | 1612 | val ifIf: Long |
| @@ -1639,6 +1631,12 @@ data class Obj4 ( | ||
| 1639 | 1631 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 1640 | 1632 | val dummy: Long, |
| 1641 | 1633 | |
| 1634 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 1635 | + val nil: Nil, | |
| 1636 | + | |
| 1637 | + @get:JsonProperty("NO", required=true)@field:JsonProperty("NO", required=true) | |
| 1638 | + val no: No, | |
| 1639 | + | |
| 1642 | 1640 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 1643 | 1641 | val noSuchMethod: NoSuchMethod, |
| 1644 | 1642 | |
| @@ -1823,13 +1821,17 @@ data class Obj4 ( | ||
| 1823 | 1821 | val s: S, |
| 1824 | 1822 | |
| 1825 | 1823 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 1826 | - val sbyte: Sbyte, | |
| 1824 | + val sbyte: Sbyte | |
| 1825 | +) | |
| 1827 | 1826 | |
| 1827 | +data class Nil ( | |
| 1828 | 1828 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 1829 | - val sealed: Sealed, | |
| 1829 | + val nil: Long | |
| 1830 | +) | |
| 1830 | 1831 | |
| 1831 | - @get:JsonProperty("SEL", required=true)@field:JsonProperty("SEL", required=true) | |
| 1832 | - val sel: Sel | |
| 1832 | +data class No ( | |
| 1833 | + @get:JsonProperty("NO", required=true)@field:JsonProperty("NO", required=true) | |
| 1834 | + val no: Long | |
| 1833 | 1835 | ) |
| 1834 | 1836 | |
| 1835 | 1837 | data class NoSuchMethod ( |
| @@ -2142,16 +2144,6 @@ data class Sbyte ( | ||
| 2142 | 2144 | val sbyte: Long |
| 2143 | 2145 | ) |
| 2144 | 2146 | |
| 2145 | -data class Sealed ( | |
| 2146 | - @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 2147 | - val sealed: Long | |
| 2148 | -) | |
| 2149 | - | |
| 2150 | -data class Sel ( | |
| 2151 | - @get:JsonProperty("SEL", required=true)@field:JsonProperty("SEL", required=true) | |
| 2152 | - val sel: Long | |
| 2153 | -) | |
| 2154 | - | |
| 2155 | 2147 | data class Obj5 ( |
| 2156 | 2148 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 2157 | 2149 | val dummy: Long, |
| @@ -2192,6 +2184,12 @@ data class Obj5 ( | ||
| 2192 | 2184 | @get:JsonProperty("true", required=true)@field:JsonProperty("true", required=true) |
| 2193 | 2185 | val purpleTrue: TrueClass, |
| 2194 | 2186 | |
| 2187 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 2188 | + val sealed: Sealed, | |
| 2189 | + | |
| 2190 | + @get:JsonProperty("SEL", required=true)@field:JsonProperty("SEL", required=true) | |
| 2191 | + val sel: Sel, | |
| 2192 | + | |
| 2195 | 2193 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 2196 | 2194 | val select: Select, |
| 2197 | 2195 | |
| @@ -2340,16 +2338,7 @@ data class Obj5 ( | ||
| 2340 | 2338 | val union: Union, |
| 2341 | 2339 | |
| 2342 | 2340 | @get:JsonProperty("UnmarshalJSON", required=true)@field:JsonProperty("UnmarshalJSON", required=true) |
| 2343 | - val unmarshalJSON: UnmarshalJSON, | |
| 2344 | - | |
| 2345 | - @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 2346 | - val unowned: Unowned, | |
| 2347 | - | |
| 2348 | - @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 2349 | - val unsafe: Unsafe, | |
| 2350 | - | |
| 2351 | - @get:JsonProperty("UseSerializers", required=true)@field:JsonProperty("UseSerializers", required=true) | |
| 2352 | - val useSerializers: UseSerializers | |
| 2341 | + val unmarshalJSON: UnmarshalJSON | |
| 2353 | 2342 | ) |
| 2354 | 2343 | |
| 2355 | 2344 | data class KSerializer ( |
| @@ -2412,6 +2401,16 @@ data class TrueClass ( | ||
| 2412 | 2401 | val trueTrue: Long |
| 2413 | 2402 | ) |
| 2414 | 2403 | |
| 2404 | +data class Sealed ( | |
| 2405 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 2406 | + val sealed: Long | |
| 2407 | +) | |
| 2408 | + | |
| 2409 | +data class Sel ( | |
| 2410 | + @get:JsonProperty("SEL", required=true)@field:JsonProperty("SEL", required=true) | |
| 2411 | + val sel: Long | |
| 2412 | +) | |
| 2413 | + | |
| 2415 | 2414 | data class Select ( |
| 2416 | 2415 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 2417 | 2416 | val select: Long |
| @@ -2662,21 +2661,6 @@ data class UnmarshalJSON ( | ||
| 2662 | 2661 | val unmarshalJSON: Long |
| 2663 | 2662 | ) |
| 2664 | 2663 | |
| 2665 | -data class Unowned ( | |
| 2666 | - @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 2667 | - val unowned: Long | |
| 2668 | -) | |
| 2669 | - | |
| 2670 | -data class Unsafe ( | |
| 2671 | - @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 2672 | - val unsafe: Long | |
| 2673 | -) | |
| 2674 | - | |
| 2675 | -data class UseSerializers ( | |
| 2676 | - @get:JsonProperty("UseSerializers", required=true)@field:JsonProperty("UseSerializers", required=true) | |
| 2677 | - val useSerializers: Long | |
| 2678 | -) | |
| 2679 | - | |
| 2680 | 2664 | data class Obj6 ( |
| 2681 | 2665 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 2682 | 2666 | val dummy: Long, |
| @@ -2687,9 +2671,18 @@ data class Obj6 ( | ||
| 2687 | 2671 | @get:JsonProperty("while", required=true)@field:JsonProperty("while", required=true) |
| 2688 | 2672 | val obj6While: While, |
| 2689 | 2673 | |
| 2674 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 2675 | + val unowned: Unowned, | |
| 2676 | + | |
| 2677 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 2678 | + val unsafe: Unsafe, | |
| 2679 | + | |
| 2690 | 2680 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 2691 | 2681 | val unsigned: Unsigned, |
| 2692 | 2682 | |
| 2683 | + @get:JsonProperty("UseSerializers", required=true)@field:JsonProperty("UseSerializers", required=true) | |
| 2684 | + val useSerializers: UseSerializers, | |
| 2685 | + | |
| 2693 | 2686 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 2694 | 2687 | val ushort: Ushort, |
| 2695 | 2688 | |
| @@ -2752,11 +2745,26 @@ data class While ( | ||
| 2752 | 2745 | val whileWhile: Long |
| 2753 | 2746 | ) |
| 2754 | 2747 | |
| 2748 | +data class Unowned ( | |
| 2749 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 2750 | + val unowned: Long | |
| 2751 | +) | |
| 2752 | + | |
| 2753 | +data class Unsafe ( | |
| 2754 | + @get:JsonProperty(required=true)@field:JsonProperty(required=true) | |
| 2755 | + val unsafe: Long | |
| 2756 | +) | |
| 2757 | + | |
| 2755 | 2758 | data class Unsigned ( |
| 2756 | 2759 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 2757 | 2760 | val unsigned: Long |
| 2758 | 2761 | ) |
| 2759 | 2762 | |
| 2763 | +data class UseSerializers ( | |
| 2764 | + @get:JsonProperty("UseSerializers", required=true)@field:JsonProperty("UseSerializers", required=true) | |
| 2765 | + val useSerializers: Long | |
| 2766 | +) | |
| 2767 | + | |
| 2760 | 2768 | data class Ushort ( |
| 2761 | 2769 | @get:JsonProperty(required=true)@field:JsonProperty(required=true) |
| 2762 | 2770 | val ushort: Long |
Mkotlindefault / TopLevel.kt+53 −46
| @@ -956,6 +956,7 @@ data class Obj3 ( | ||
| 956 | 956 | |
| 957 | 957 | val lock: Lock, |
| 958 | 958 | val long: LongClass, |
| 959 | + val makeDictEncoder: MakeDictEncoder, | |
| 959 | 960 | val map: MapClass, |
| 960 | 961 | |
| 961 | 962 | @Json(name = "MapEntry") |
| @@ -974,10 +975,6 @@ data class Obj3 ( | ||
| 974 | 975 | val native: Native, |
| 975 | 976 | val new: New, |
| 976 | 977 | val newtonsoft: Newtonsoft, |
| 977 | - val nil: Nil, | |
| 978 | - | |
| 979 | - @Json(name = "NO") | |
| 980 | - val no: No, | |
| 981 | 978 | |
| 982 | 979 | @Json(name = "if") |
| 983 | 980 | val obj3If: If, |
| @@ -1204,6 +1201,10 @@ data class LongClass ( | ||
| 1204 | 1201 | val long: Long |
| 1205 | 1202 | ) |
| 1206 | 1203 | |
| 1204 | +data class MakeDictEncoder ( | |
| 1205 | + val makeDictEncoder: Long | |
| 1206 | +) | |
| 1207 | + | |
| 1207 | 1208 | data class MapClass ( |
| 1208 | 1209 | val map: Long |
| 1209 | 1210 | ) |
| @@ -1251,15 +1252,6 @@ data class Newtonsoft ( | ||
| 1251 | 1252 | val newtonsoft: Long |
| 1252 | 1253 | ) |
| 1253 | 1254 | |
| 1254 | -data class Nil ( | |
| 1255 | - val nil: Long | |
| 1256 | -) | |
| 1257 | - | |
| 1258 | -data class No ( | |
| 1259 | - @Json(name = "NO") | |
| 1260 | - val no: Long | |
| 1261 | -) | |
| 1262 | - | |
| 1263 | 1255 | data class If ( |
| 1264 | 1256 | @Json(name = "if") |
| 1265 | 1257 | val ifIf: Long |
| @@ -1282,6 +1274,11 @@ data class Is ( | ||
| 1282 | 1274 | |
| 1283 | 1275 | data class Obj4 ( |
| 1284 | 1276 | val dummy: Long, |
| 1277 | + val nil: Nil, | |
| 1278 | + | |
| 1279 | + @Json(name = "NO") | |
| 1280 | + val no: No, | |
| 1281 | + | |
| 1285 | 1282 | val noSuchMethod: NoSuchMethod, |
| 1286 | 1283 | val noexcept: Noexcept, |
| 1287 | 1284 | val nonatomic: Nonatomic, |
| @@ -1384,11 +1381,16 @@ data class Obj4 ( | ||
| 1384 | 1381 | val right: Right, |
| 1385 | 1382 | val runtimeType: RuntimeType, |
| 1386 | 1383 | val s: S, |
| 1387 | - val sbyte: Sbyte, | |
| 1388 | - val sealed: Sealed, | |
| 1384 | + val sbyte: Sbyte | |
| 1385 | +) | |
| 1389 | 1386 | |
| 1390 | - @Json(name = "SEL") | |
| 1391 | - val sel: Sel | |
| 1387 | +data class Nil ( | |
| 1388 | + val nil: Long | |
| 1389 | +) | |
| 1390 | + | |
| 1391 | +data class No ( | |
| 1392 | + @Json(name = "NO") | |
| 1393 | + val no: Long | |
| 1392 | 1394 | ) |
| 1393 | 1395 | |
| 1394 | 1396 | data class NoSuchMethod ( |
| @@ -1654,15 +1656,6 @@ data class Sbyte ( | ||
| 1654 | 1656 | val sbyte: Long |
| 1655 | 1657 | ) |
| 1656 | 1658 | |
| 1657 | -data class Sealed ( | |
| 1658 | - val sealed: Long | |
| 1659 | -) | |
| 1660 | - | |
| 1661 | -data class Sel ( | |
| 1662 | - @Json(name = "SEL") | |
| 1663 | - val sel: Long | |
| 1664 | -) | |
| 1665 | - | |
| 1666 | 1659 | data class Obj5 ( |
| 1667 | 1660 | val dummy: Long, |
| 1668 | 1661 | |
| @@ -1702,6 +1695,11 @@ data class Obj5 ( | ||
| 1702 | 1695 | @Json(name = "true") |
| 1703 | 1696 | val purpleTrue: TrueClass, |
| 1704 | 1697 | |
| 1698 | + val sealed: Sealed, | |
| 1699 | + | |
| 1700 | + @Json(name = "SEL") | |
| 1701 | + val sel: Sel, | |
| 1702 | + | |
| 1705 | 1703 | val select: Select, |
| 1706 | 1704 | |
| 1707 | 1705 | @Json(name = "Self") |
| @@ -1802,13 +1800,7 @@ data class Obj5 ( | ||
| 1802 | 1800 | val union: Union, |
| 1803 | 1801 | |
| 1804 | 1802 | @Json(name = "UnmarshalJSON") |
| 1805 | - val unmarshalJSON: UnmarshalJSON, | |
| 1806 | - | |
| 1807 | - val unowned: Unowned, | |
| 1808 | - val unsafe: Unsafe, | |
| 1809 | - | |
| 1810 | - @Json(name = "UseSerializers") | |
| 1811 | - val useSerializers: UseSerializers | |
| 1803 | + val unmarshalJSON: UnmarshalJSON | |
| 1812 | 1804 | ) |
| 1813 | 1805 | |
| 1814 | 1806 | data class KSerializer ( |
| @@ -1869,6 +1861,15 @@ data class TrueClass ( | ||
| 1869 | 1861 | val trueTrue: Long |
| 1870 | 1862 | ) |
| 1871 | 1863 | |
| 1864 | +data class Sealed ( | |
| 1865 | + val sealed: Long | |
| 1866 | +) | |
| 1867 | + | |
| 1868 | +data class Sel ( | |
| 1869 | + @Json(name = "SEL") | |
| 1870 | + val sel: Long | |
| 1871 | +) | |
| 1872 | + | |
| 1872 | 1873 | data class Select ( |
| 1873 | 1874 | val select: Long |
| 1874 | 1875 | ) |
| @@ -2090,19 +2091,6 @@ data class UnmarshalJSON ( | ||
| 2090 | 2091 | val unmarshalJSON: Long |
| 2091 | 2092 | ) |
| 2092 | 2093 | |
| 2093 | -data class Unowned ( | |
| 2094 | - val unowned: Long | |
| 2095 | -) | |
| 2096 | - | |
| 2097 | -data class Unsafe ( | |
| 2098 | - val unsafe: Long | |
| 2099 | -) | |
| 2100 | - | |
| 2101 | -data class UseSerializers ( | |
| 2102 | - @Json(name = "UseSerializers") | |
| 2103 | - val useSerializers: Long | |
| 2104 | -) | |
| 2105 | - | |
| 2106 | 2094 | data class Obj6 ( |
| 2107 | 2095 | val dummy: Long, |
| 2108 | 2096 | |
| @@ -2112,7 +2100,13 @@ data class Obj6 ( | ||
| 2112 | 2100 | @Json(name = "while") |
| 2113 | 2101 | val obj6While: While, |
| 2114 | 2102 | |
| 2103 | + val unowned: Unowned, | |
| 2104 | + val unsafe: Unsafe, | |
| 2115 | 2105 | val unsigned: Unsigned, |
| 2106 | + | |
| 2107 | + @Json(name = "UseSerializers") | |
| 2108 | + val useSerializers: UseSerializers, | |
| 2109 | + | |
| 2116 | 2110 | val ushort: Ushort, |
| 2117 | 2111 | val using: Using, |
| 2118 | 2112 | |
| @@ -2157,10 +2151,23 @@ data class While ( | ||
| 2157 | 2151 | val whileWhile: Long |
| 2158 | 2152 | ) |
| 2159 | 2153 | |
| 2154 | +data class Unowned ( | |
| 2155 | + val unowned: Long | |
| 2156 | +) | |
| 2157 | + | |
| 2158 | +data class Unsafe ( | |
| 2159 | + val unsafe: Long | |
| 2160 | +) | |
| 2161 | + | |
| 2160 | 2162 | data class Unsigned ( |
| 2161 | 2163 | val unsigned: Long |
| 2162 | 2164 | ) |
| 2163 | 2165 | |
| 2166 | +data class UseSerializers ( | |
| 2167 | + @Json(name = "UseSerializers") | |
| 2168 | + val useSerializers: Long | |
| 2169 | +) | |
| 2170 | + | |
| 2164 | 2171 | data class Ushort ( |
| 2165 | 2172 | val ushort: Long |
| 2166 | 2173 | ) |
Mkotlinxdefault / TopLevel.kt+61 −53
| @@ -1069,6 +1069,7 @@ data class Obj3 ( | ||
| 1069 | 1069 | |
| 1070 | 1070 | val lock: Lock, |
| 1071 | 1071 | val long: LongClass, |
| 1072 | + val makeDictEncoder: MakeDictEncoder, | |
| 1072 | 1073 | val map: MapClass, |
| 1073 | 1074 | |
| 1074 | 1075 | @SerialName("MapEntry") |
| @@ -1087,10 +1088,6 @@ data class Obj3 ( | ||
| 1087 | 1088 | val native: Native, |
| 1088 | 1089 | val new: New, |
| 1089 | 1090 | val newtonsoft: Newtonsoft, |
| 1090 | - val nil: Nil, | |
| 1091 | - | |
| 1092 | - @SerialName("NO") | |
| 1093 | - val no: No, | |
| 1094 | 1091 | |
| 1095 | 1092 | @SerialName("if") |
| 1096 | 1093 | val obj3If: If, |
| @@ -1365,6 +1362,11 @@ data class LongClass ( | ||
| 1365 | 1362 | val long: Long |
| 1366 | 1363 | ) |
| 1367 | 1364 | |
| 1365 | +@Serializable | |
| 1366 | +data class MakeDictEncoder ( | |
| 1367 | + val makeDictEncoder: Long | |
| 1368 | +) | |
| 1369 | + | |
| 1368 | 1370 | @Serializable |
| 1369 | 1371 | data class MapClass ( |
| 1370 | 1372 | val map: Long |
| @@ -1423,17 +1425,6 @@ data class Newtonsoft ( | ||
| 1423 | 1425 | val newtonsoft: Long |
| 1424 | 1426 | ) |
| 1425 | 1427 | |
| 1426 | -@Serializable | |
| 1427 | -data class Nil ( | |
| 1428 | - val nil: Long | |
| 1429 | -) | |
| 1430 | - | |
| 1431 | -@Serializable | |
| 1432 | -data class No ( | |
| 1433 | - @SerialName("NO") | |
| 1434 | - val no: Long | |
| 1435 | -) | |
| 1436 | - | |
| 1437 | 1428 | @Serializable |
| 1438 | 1429 | data class If ( |
| 1439 | 1430 | @SerialName("if") |
| @@ -1461,6 +1452,11 @@ data class Is ( | ||
| 1461 | 1452 | @Serializable |
| 1462 | 1453 | data class Obj4 ( |
| 1463 | 1454 | val dummy: Long, |
| 1455 | + val nil: Nil, | |
| 1456 | + | |
| 1457 | + @SerialName("NO") | |
| 1458 | + val no: No, | |
| 1459 | + | |
| 1464 | 1460 | val noSuchMethod: NoSuchMethod, |
| 1465 | 1461 | val noexcept: Noexcept, |
| 1466 | 1462 | val nonatomic: Nonatomic, |
| @@ -1563,11 +1559,18 @@ data class Obj4 ( | ||
| 1563 | 1559 | val right: Right, |
| 1564 | 1560 | val runtimeType: RuntimeType, |
| 1565 | 1561 | val s: S, |
| 1566 | - val sbyte: Sbyte, | |
| 1567 | - val sealed: Sealed, | |
| 1562 | + val sbyte: Sbyte | |
| 1563 | +) | |
| 1568 | 1564 | |
| 1569 | - @SerialName("SEL") | |
| 1570 | - val sel: Sel | |
| 1565 | +@Serializable | |
| 1566 | +data class Nil ( | |
| 1567 | + val nil: Long | |
| 1568 | +) | |
| 1569 | + | |
| 1570 | +@Serializable | |
| 1571 | +data class No ( | |
| 1572 | + @SerialName("NO") | |
| 1573 | + val no: Long | |
| 1571 | 1574 | ) |
| 1572 | 1575 | |
| 1573 | 1576 | @Serializable |
| @@ -1895,17 +1898,6 @@ data class Sbyte ( | ||
| 1895 | 1898 | val sbyte: Long |
| 1896 | 1899 | ) |
| 1897 | 1900 | |
| 1898 | -@Serializable | |
| 1899 | -data class Sealed ( | |
| 1900 | - val sealed: Long | |
| 1901 | -) | |
| 1902 | - | |
| 1903 | -@Serializable | |
| 1904 | -data class Sel ( | |
| 1905 | - @SerialName("SEL") | |
| 1906 | - val sel: Long | |
| 1907 | -) | |
| 1908 | - | |
| 1909 | 1901 | @Serializable |
| 1910 | 1902 | data class Obj5 ( |
| 1911 | 1903 | val dummy: Long, |
| @@ -1946,6 +1938,11 @@ data class Obj5 ( | ||
| 1946 | 1938 | @SerialName("true") |
| 1947 | 1939 | val purpleTrue: TrueClass, |
| 1948 | 1940 | |
| 1941 | + val sealed: Sealed, | |
| 1942 | + | |
| 1943 | + @SerialName("SEL") | |
| 1944 | + val sel: Sel, | |
| 1945 | + | |
| 1949 | 1946 | val select: Select, |
| 1950 | 1947 | |
| 1951 | 1948 | @SerialName("Self") |
| @@ -2046,13 +2043,7 @@ data class Obj5 ( | ||
| 2046 | 2043 | val union: Union, |
| 2047 | 2044 | |
| 2048 | 2045 | @SerialName("UnmarshalJSON") |
| 2049 | - val unmarshalJSON: UnmarshalJSON, | |
| 2050 | - | |
| 2051 | - val unowned: Unowned, | |
| 2052 | - val unsafe: Unsafe, | |
| 2053 | - | |
| 2054 | - @SerialName("UseSerializers") | |
| 2055 | - val useSerializers: UseSerializersClass | |
| 2046 | + val unmarshalJSON: UnmarshalJSON | |
| 2056 | 2047 | ) |
| 2057 | 2048 | |
| 2058 | 2049 | @Serializable |
| @@ -2125,6 +2116,17 @@ data class TrueClass ( | ||
| 2125 | 2116 | val trueTrue: Long |
| 2126 | 2117 | ) |
| 2127 | 2118 | |
| 2119 | +@Serializable | |
| 2120 | +data class Sealed ( | |
| 2121 | + val sealed: Long | |
| 2122 | +) | |
| 2123 | + | |
| 2124 | +@Serializable | |
| 2125 | +data class Sel ( | |
| 2126 | + @SerialName("SEL") | |
| 2127 | + val sel: Long | |
| 2128 | +) | |
| 2129 | + | |
| 2128 | 2130 | @Serializable |
| 2129 | 2131 | data class Select ( |
| 2130 | 2132 | val select: Long |
| @@ -2396,22 +2398,6 @@ data class UnmarshalJSON ( | ||
| 2396 | 2398 | val unmarshalJSON: Long |
| 2397 | 2399 | ) |
| 2398 | 2400 | |
| 2399 | -@Serializable | |
| 2400 | -data class Unowned ( | |
| 2401 | - val unowned: Long | |
| 2402 | -) | |
| 2403 | - | |
| 2404 | -@Serializable | |
| 2405 | -data class Unsafe ( | |
| 2406 | - val unsafe: Long | |
| 2407 | -) | |
| 2408 | - | |
| 2409 | -@Serializable | |
| 2410 | -data class UseSerializersClass ( | |
| 2411 | - @SerialName("UseSerializers") | |
| 2412 | - val useSerializers: Long | |
| 2413 | -) | |
| 2414 | - | |
| 2415 | 2401 | @Serializable |
| 2416 | 2402 | data class Obj6 ( |
| 2417 | 2403 | val dummy: Long, |
| @@ -2422,7 +2408,13 @@ data class Obj6 ( | ||
| 2422 | 2408 | @SerialName("while") |
| 2423 | 2409 | val obj6While: While, |
| 2424 | 2410 | |
| 2411 | + val unowned: Unowned, | |
| 2412 | + val unsafe: Unsafe, | |
| 2425 | 2413 | val unsigned: Unsigned, |
| 2414 | + | |
| 2415 | + @SerialName("UseSerializers") | |
| 2416 | + val useSerializers: UseSerializersClass, | |
| 2417 | + | |
| 2426 | 2418 | val ushort: Ushort, |
| 2427 | 2419 | val using: Using, |
| 2428 | 2420 | |
| @@ -2469,11 +2461,27 @@ data class While ( | ||
| 2469 | 2461 | val whileWhile: Long |
| 2470 | 2462 | ) |
| 2471 | 2463 | |
| 2464 | +@Serializable | |
| 2465 | +data class Unowned ( | |
| 2466 | + val unowned: Long | |
| 2467 | +) | |
| 2468 | + | |
| 2469 | +@Serializable | |
| 2470 | +data class Unsafe ( | |
| 2471 | + val unsafe: Long | |
| 2472 | +) | |
| 2473 | + | |
| 2472 | 2474 | @Serializable |
| 2473 | 2475 | data class Unsigned ( |
| 2474 | 2476 | val unsigned: Long |
| 2475 | 2477 | ) |
| 2476 | 2478 | |
| 2479 | +@Serializable | |
| 2480 | +data class UseSerializersClass ( | |
| 2481 | + @SerialName("UseSerializers") | |
| 2482 | + val useSerializers: Long | |
| 2483 | +) | |
| 2484 | + | |
| 2477 | 2485 | @Serializable |
| 2478 | 2486 | data class Ushort ( |
| 2479 | 2487 | val ushort: Long |
Mobjective-cdefault / QTTopLevel.h+48 −42
| @@ -183,6 +183,7 @@ | ||
| 183 | 183 | @class QTList; |
| 184 | 184 | @class QTLocale; |
| 185 | 185 | @class QTLock; |
| 186 | +@class QTMakeDictEncoder; | |
| 186 | 187 | @class QTMap; |
| 187 | 188 | @class QTMapEntry; |
| 188 | 189 | @class QTMarshalJSON; |
| @@ -193,17 +194,16 @@ | ||
| 193 | 194 | @class QTNamespace; |
| 194 | 195 | @class QTNative; |
| 195 | 196 | @class QTNewtonsoft; |
| 196 | -@class QTNo; | |
| 197 | 197 | @class QTGoto; |
| 198 | 198 | @class QTIf; |
| 199 | 199 | @class QTInline; |
| 200 | 200 | @class QTInt; |
| 201 | 201 | @class QTLong; |
| 202 | -@class QTNil; | |
| 203 | 202 | @class QTHashCode; |
| 204 | 203 | @class QTInit; |
| 205 | 204 | @class QTNew; |
| 206 | 205 | @class QTObj4; |
| 206 | +@class QTNo; | |
| 207 | 207 | @class QTNoSuchMethod; |
| 208 | 208 | @class QTNoexcept; |
| 209 | 209 | @class QTNone; |
| @@ -217,6 +217,7 @@ | ||
| 217 | 217 | @class QTNull; |
| 218 | 218 | @class QTNullptr; |
| 219 | 219 | @class QTNumber; |
| 220 | +@class QTNil; | |
| 220 | 221 | @class QTNonatomic; |
| 221 | 222 | @class QTNoneClass; |
| 222 | 223 | @class QTNullClass; |
| @@ -266,8 +267,6 @@ | ||
| 266 | 267 | @class QTRuntimeType; |
| 267 | 268 | @class QTS; |
| 268 | 269 | @class QTSbyte; |
| 269 | -@class QTSealed; | |
| 270 | -@class QTSel; | |
| 271 | 270 | @class QTObj5; |
| 272 | 271 | @class QTKSerializer; |
| 273 | 272 | @class QTSelfClass; |
| @@ -283,6 +282,8 @@ | ||
| 283 | 282 | @class QTTypeof; |
| 284 | 283 | @class QTUnion; |
| 285 | 284 | @class QTPrimitiveKind; |
| 285 | +@class QTSealed; | |
| 286 | +@class QTSel; | |
| 286 | 287 | @class QTSelect; |
| 287 | 288 | @class QTSelf; |
| 288 | 289 | @class QTSendable; |
| @@ -331,14 +332,14 @@ | ||
| 331 | 332 | @class QTUnchecked; |
| 332 | 333 | @class QTUndefined; |
| 333 | 334 | @class QTUnmarshalJSON; |
| 334 | -@class QTUnowned; | |
| 335 | -@class QTUnsafe; | |
| 336 | -@class QTUseSerializers; | |
| 337 | 335 | @class QTObj6; |
| 338 | 336 | @class QTUnsigned; |
| 339 | 337 | @class QTVoid; |
| 340 | 338 | @class QTVolatile; |
| 341 | 339 | @class QTWhile; |
| 340 | +@class QTUnowned; | |
| 341 | +@class QTUnsafe; | |
| 342 | +@class QTUseSerializers; | |
| 342 | 343 | @class QTUshort; |
| 343 | 344 | @class QTUsing; |
| 344 | 345 | @class QTUtf8JSONReader; |
| @@ -1086,6 +1087,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 1086 | 1087 | @property (nonatomic, strong) QTList *list; |
| 1087 | 1088 | @property (nonatomic, strong) QTLocale *locale; |
| 1088 | 1089 | @property (nonatomic, strong) QTLock *lock; |
| 1090 | +@property (nonatomic, strong) QTMakeDictEncoder *makeDictEncoder; | |
| 1089 | 1091 | @property (nonatomic, strong) QTMap *map; |
| 1090 | 1092 | @property (nonatomic, strong) QTMapEntry *mapEntry; |
| 1091 | 1093 | @property (nonatomic, strong) QTMarshalJSON *marshalJSON; |
| @@ -1096,13 +1098,11 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 1096 | 1098 | @property (nonatomic, strong) QTNamespace *namespace; |
| 1097 | 1099 | @property (nonatomic, strong) QTNative *native; |
| 1098 | 1100 | @property (nonatomic, strong) QTNewtonsoft *newtonsoft; |
| 1099 | -@property (nonatomic, strong) QTNo *no; | |
| 1100 | 1101 | @property (nonatomic, strong) QTGoto *obj3Goto; |
| 1101 | 1102 | @property (nonatomic, strong) QTIf *obj3If; |
| 1102 | 1103 | @property (nonatomic, strong) QTInline *obj3Inline; |
| 1103 | 1104 | @property (nonatomic, strong) QTInt *obj3Int; |
| 1104 | 1105 | @property (nonatomic, strong) QTLong *obj3Long; |
| 1105 | -@property (nonatomic, strong) QTNil *obj3Nil; | |
| 1106 | 1106 | @property (nonatomic, strong) QTHashCode *theHashCode; |
| 1107 | 1107 | @property (nonatomic, strong) QTInit *theInit; |
| 1108 | 1108 | @property (nonatomic, strong) QTNew *theNew; |
| @@ -1288,6 +1288,10 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 1288 | 1288 | @property (nonatomic, assign) NSInteger lock; |
| 1289 | 1289 | @end |
| 1290 | 1290 | |
| 1291 | +@interface QTMakeDictEncoder : NSObject | |
| 1292 | +@property (nonatomic, assign) NSInteger makeDictEncoder; | |
| 1293 | +@end | |
| 1294 | + | |
| 1291 | 1295 | @interface QTMap : NSObject |
| 1292 | 1296 | @property (nonatomic, assign) NSInteger map; |
| 1293 | 1297 | @end |
| @@ -1328,10 +1332,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 1328 | 1332 | @property (nonatomic, assign) NSInteger newtonsoft; |
| 1329 | 1333 | @end |
| 1330 | 1334 | |
| 1331 | -@interface QTNo : NSObject | |
| 1332 | -@property (nonatomic, assign) NSInteger no; | |
| 1333 | -@end | |
| 1334 | - | |
| 1335 | 1335 | @interface QTGoto : NSObject |
| 1336 | 1336 | @property (nonatomic, assign) NSInteger gotoGoto; |
| 1337 | 1337 | @end |
| @@ -1352,10 +1352,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 1352 | 1352 | @property (nonatomic, assign) NSInteger longLong; |
| 1353 | 1353 | @end |
| 1354 | 1354 | |
| 1355 | -@interface QTNil : NSObject | |
| 1356 | -@property (nonatomic, assign) NSInteger nilNil; | |
| 1357 | -@end | |
| 1358 | - | |
| 1359 | 1355 | @interface QTHashCode : NSObject |
| 1360 | 1356 | @property (nonatomic, assign) NSInteger theHashCode; |
| 1361 | 1357 | @end |
| @@ -1370,6 +1366,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 1370 | 1366 | |
| 1371 | 1367 | @interface QTObj4 : NSObject |
| 1372 | 1368 | @property (nonatomic, assign) NSInteger dummy; |
| 1369 | +@property (nonatomic, strong) QTNo *no; | |
| 1373 | 1370 | @property (nonatomic, strong) QTNoSuchMethod *noSuchMethod; |
| 1374 | 1371 | @property (nonatomic, strong) QTNoexcept *noexcept; |
| 1375 | 1372 | @property (nonatomic, strong) QTNone *none; |
| @@ -1383,6 +1380,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 1383 | 1380 | @property (nonatomic, strong) QTNull *null; |
| 1384 | 1381 | @property (nonatomic, strong) QTNullptr *nullptr; |
| 1385 | 1382 | @property (nonatomic, strong) QTNumber *number; |
| 1383 | +@property (nonatomic, strong) QTNil *obj4Nil; | |
| 1386 | 1384 | @property (nonatomic, strong) QTNonatomic *obj4Nonatomic; |
| 1387 | 1385 | @property (nonatomic, strong) QTNoneClass *obj4None; |
| 1388 | 1386 | @property (nonatomic, strong) QTNullClass *obj4Null; |
| @@ -1432,8 +1430,10 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 1432 | 1430 | @property (nonatomic, strong) QTRuntimeType *runtimeType; |
| 1433 | 1431 | @property (nonatomic, strong) QTS *s; |
| 1434 | 1432 | @property (nonatomic, strong) QTSbyte *sbyte; |
| 1435 | -@property (nonatomic, strong) QTSealed *sealed; | |
| 1436 | -@property (nonatomic, strong) QTSel *sel; | |
| 1433 | +@end | |
| 1434 | + | |
| 1435 | +@interface QTNo : NSObject | |
| 1436 | +@property (nonatomic, assign) NSInteger no; | |
| 1437 | 1437 | @end |
| 1438 | 1438 | |
| 1439 | 1439 | @interface QTNoSuchMethod : NSObject |
| @@ -1488,6 +1488,10 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 1488 | 1488 | @property (nonatomic, assign) NSInteger number; |
| 1489 | 1489 | @end |
| 1490 | 1490 | |
| 1491 | +@interface QTNil : NSObject | |
| 1492 | +@property (nonatomic, assign) NSInteger nilNil; | |
| 1493 | +@end | |
| 1494 | + | |
| 1491 | 1495 | @interface QTNonatomic : NSObject |
| 1492 | 1496 | @property (nonatomic, assign) NSInteger nonatomicNonatomic; |
| 1493 | 1497 | @end |
| @@ -1684,14 +1688,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 1684 | 1688 | @property (nonatomic, assign) NSInteger sbyte; |
| 1685 | 1689 | @end |
| 1686 | 1690 | |
| 1687 | -@interface QTSealed : NSObject | |
| 1688 | -@property (nonatomic, assign) NSInteger sealed; | |
| 1689 | -@end | |
| 1690 | - | |
| 1691 | -@interface QTSel : NSObject | |
| 1692 | -@property (nonatomic, assign) NSInteger sel; | |
| 1693 | -@end | |
| 1694 | - | |
| 1695 | 1691 | @interface QTObj5 : NSObject |
| 1696 | 1692 | @property (nonatomic, assign) NSInteger dummy; |
| 1697 | 1693 | @property (nonatomic, strong) QTKSerializer *kSerializer; |
| @@ -1708,6 +1704,8 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 1708 | 1704 | @property (nonatomic, strong) QTTypeof *obj5Typeof; |
| 1709 | 1705 | @property (nonatomic, strong) QTUnion *obj5Union; |
| 1710 | 1706 | @property (nonatomic, strong) QTPrimitiveKind *primitiveKind; |
| 1707 | +@property (nonatomic, strong) QTSealed *sealed; | |
| 1708 | +@property (nonatomic, strong) QTSel *sel; | |
| 1711 | 1709 | @property (nonatomic, strong) QTSelect *select; |
| 1712 | 1710 | @property (nonatomic, strong) QTSelf *self; |
| 1713 | 1711 | @property (nonatomic, strong) QTSendable *sendable; |
| @@ -1756,9 +1754,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 1756 | 1754 | @property (nonatomic, strong) QTUnchecked *unchecked; |
| 1757 | 1755 | @property (nonatomic, strong) QTUndefined *undefined; |
| 1758 | 1756 | @property (nonatomic, strong) QTUnmarshalJSON *unmarshalJSON; |
| 1759 | -@property (nonatomic, strong) QTUnowned *unowned; | |
| 1760 | -@property (nonatomic, strong) QTUnsafe *unsafe; | |
| 1761 | -@property (nonatomic, strong) QTUseSerializers *useSerializers; | |
| 1762 | 1757 | @end |
| 1763 | 1758 | |
| 1764 | 1759 | @interface QTKSerializer : NSObject |
| @@ -1817,6 +1812,14 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 1817 | 1812 | @property (nonatomic, assign) NSInteger primitiveKind; |
| 1818 | 1813 | @end |
| 1819 | 1814 | |
| 1815 | +@interface QTSealed : NSObject | |
| 1816 | +@property (nonatomic, assign) NSInteger sealed; | |
| 1817 | +@end | |
| 1818 | + | |
| 1819 | +@interface QTSel : NSObject | |
| 1820 | +@property (nonatomic, assign) NSInteger sel; | |
| 1821 | +@end | |
| 1822 | + | |
| 1820 | 1823 | @interface QTSelect : NSObject |
| 1821 | 1824 | @property (nonatomic, assign) NSInteger select; |
| 1822 | 1825 | @end |
| @@ -2009,24 +2012,15 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 2009 | 2012 | @property (nonatomic, assign) NSInteger unmarshalJSON; |
| 2010 | 2013 | @end |
| 2011 | 2014 | |
| 2012 | -@interface QTUnowned : NSObject | |
| 2013 | -@property (nonatomic, assign) NSInteger unowned; | |
| 2014 | -@end | |
| 2015 | - | |
| 2016 | -@interface QTUnsafe : NSObject | |
| 2017 | -@property (nonatomic, assign) NSInteger unsafe; | |
| 2018 | -@end | |
| 2019 | - | |
| 2020 | -@interface QTUseSerializers : NSObject | |
| 2021 | -@property (nonatomic, assign) NSInteger useSerializers; | |
| 2022 | -@end | |
| 2023 | - | |
| 2024 | 2015 | @interface QTObj6 : NSObject |
| 2025 | 2016 | @property (nonatomic, assign) NSInteger dummy; |
| 2026 | 2017 | @property (nonatomic, strong) QTUnsigned *obj6Unsigned; |
| 2027 | 2018 | @property (nonatomic, strong) QTVoid *obj6Void; |
| 2028 | 2019 | @property (nonatomic, strong) QTVolatile *obj6Volatile; |
| 2029 | 2020 | @property (nonatomic, strong) QTWhile *obj6While; |
| 2021 | +@property (nonatomic, strong) QTUnowned *unowned; | |
| 2022 | +@property (nonatomic, strong) QTUnsafe *unsafe; | |
| 2023 | +@property (nonatomic, strong) QTUseSerializers *useSerializers; | |
| 2030 | 2024 | @property (nonatomic, strong) QTUshort *ushort; |
| 2031 | 2025 | @property (nonatomic, strong) QTUsing *using; |
| 2032 | 2026 | @property (nonatomic, strong) QTUtf8JSONReader *utf8JSONReader; |
| @@ -2061,6 +2055,18 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 2061 | 2055 | @property (nonatomic, assign) NSInteger whileWhile; |
| 2062 | 2056 | @end |
| 2063 | 2057 | |
| 2058 | +@interface QTUnowned : NSObject | |
| 2059 | +@property (nonatomic, assign) NSInteger unowned; | |
| 2060 | +@end | |
| 2061 | + | |
| 2062 | +@interface QTUnsafe : NSObject | |
| 2063 | +@property (nonatomic, assign) NSInteger unsafe; | |
| 2064 | +@end | |
| 2065 | + | |
| 2066 | +@interface QTUseSerializers : NSObject | |
| 2067 | +@property (nonatomic, assign) NSInteger useSerializers; | |
| 2068 | +@end | |
| 2069 | + | |
| 2064 | 2070 | @interface QTUshort : NSObject |
| 2065 | 2071 | @property (nonatomic, assign) NSInteger ushort; |
| 2066 | 2072 | @end |
Mobjective-cdefault / QTTopLevel.m+484 −432
| @@ -893,6 +893,11 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 893 | 893 | - (NSDictionary *)JSONDictionary; |
| 894 | 894 | @end |
| 895 | 895 | |
| 896 | +@interface QTMakeDictEncoder (JSONConversion) | |
| 897 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict; | |
| 898 | +- (NSDictionary *)JSONDictionary; | |
| 899 | +@end | |
| 900 | + | |
| 896 | 901 | @interface QTMap (JSONConversion) |
| 897 | 902 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 898 | 903 | - (NSDictionary *)JSONDictionary; |
| @@ -943,11 +948,6 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 943 | 948 | - (NSDictionary *)JSONDictionary; |
| 944 | 949 | @end |
| 945 | 950 | |
| 946 | -@interface QTNo (JSONConversion) | |
| 947 | -+ (instancetype)fromJSONDictionary:(NSDictionary *)dict; | |
| 948 | -- (NSDictionary *)JSONDictionary; | |
| 949 | -@end | |
| 950 | - | |
| 951 | 951 | @interface QTGoto (JSONConversion) |
| 952 | 952 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 953 | 953 | - (NSDictionary *)JSONDictionary; |
| @@ -973,11 +973,6 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 973 | 973 | - (NSDictionary *)JSONDictionary; |
| 974 | 974 | @end |
| 975 | 975 | |
| 976 | -@interface QTNil (JSONConversion) | |
| 977 | -+ (instancetype)fromJSONDictionary:(NSDictionary *)dict; | |
| 978 | -- (NSDictionary *)JSONDictionary; | |
| 979 | -@end | |
| 980 | - | |
| 981 | 976 | @interface QTHashCode (JSONConversion) |
| 982 | 977 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 983 | 978 | - (NSDictionary *)JSONDictionary; |
| @@ -998,6 +993,11 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 998 | 993 | - (NSDictionary *)JSONDictionary; |
| 999 | 994 | @end |
| 1000 | 995 | |
| 996 | +@interface QTNo (JSONConversion) | |
| 997 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict; | |
| 998 | +- (NSDictionary *)JSONDictionary; | |
| 999 | +@end | |
| 1000 | + | |
| 1001 | 1001 | @interface QTNoSuchMethod (JSONConversion) |
| 1002 | 1002 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 1003 | 1003 | - (NSDictionary *)JSONDictionary; |
| @@ -1063,6 +1063,11 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 1063 | 1063 | - (NSDictionary *)JSONDictionary; |
| 1064 | 1064 | @end |
| 1065 | 1065 | |
| 1066 | +@interface QTNil (JSONConversion) | |
| 1067 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict; | |
| 1068 | +- (NSDictionary *)JSONDictionary; | |
| 1069 | +@end | |
| 1070 | + | |
| 1066 | 1071 | @interface QTNonatomic (JSONConversion) |
| 1067 | 1072 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 1068 | 1073 | - (NSDictionary *)JSONDictionary; |
| @@ -1308,16 +1313,6 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 1308 | 1313 | - (NSDictionary *)JSONDictionary; |
| 1309 | 1314 | @end |
| 1310 | 1315 | |
| 1311 | -@interface QTSealed (JSONConversion) | |
| 1312 | -+ (instancetype)fromJSONDictionary:(NSDictionary *)dict; | |
| 1313 | -- (NSDictionary *)JSONDictionary; | |
| 1314 | -@end | |
| 1315 | - | |
| 1316 | -@interface QTSel (JSONConversion) | |
| 1317 | -+ (instancetype)fromJSONDictionary:(NSDictionary *)dict; | |
| 1318 | -- (NSDictionary *)JSONDictionary; | |
| 1319 | -@end | |
| 1320 | - | |
| 1321 | 1316 | @interface QTObj5 (JSONConversion) |
| 1322 | 1317 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 1323 | 1318 | - (NSDictionary *)JSONDictionary; |
| @@ -1393,6 +1388,16 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 1393 | 1388 | - (NSDictionary *)JSONDictionary; |
| 1394 | 1389 | @end |
| 1395 | 1390 | |
| 1391 | +@interface QTSealed (JSONConversion) | |
| 1392 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict; | |
| 1393 | +- (NSDictionary *)JSONDictionary; | |
| 1394 | +@end | |
| 1395 | + | |
| 1396 | +@interface QTSel (JSONConversion) | |
| 1397 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict; | |
| 1398 | +- (NSDictionary *)JSONDictionary; | |
| 1399 | +@end | |
| 1400 | + | |
| 1396 | 1401 | @interface QTSelect (JSONConversion) |
| 1397 | 1402 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 1398 | 1403 | - (NSDictionary *)JSONDictionary; |
| @@ -1633,42 +1638,42 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 1633 | 1638 | - (NSDictionary *)JSONDictionary; |
| 1634 | 1639 | @end |
| 1635 | 1640 | |
| 1636 | -@interface QTUnowned (JSONConversion) | |
| 1641 | +@interface QTObj6 (JSONConversion) | |
| 1637 | 1642 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 1638 | 1643 | - (NSDictionary *)JSONDictionary; |
| 1639 | 1644 | @end |
| 1640 | 1645 | |
| 1641 | -@interface QTUnsafe (JSONConversion) | |
| 1646 | +@interface QTUnsigned (JSONConversion) | |
| 1642 | 1647 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 1643 | 1648 | - (NSDictionary *)JSONDictionary; |
| 1644 | 1649 | @end |
| 1645 | 1650 | |
| 1646 | -@interface QTUseSerializers (JSONConversion) | |
| 1651 | +@interface QTVoid (JSONConversion) | |
| 1647 | 1652 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 1648 | 1653 | - (NSDictionary *)JSONDictionary; |
| 1649 | 1654 | @end |
| 1650 | 1655 | |
| 1651 | -@interface QTObj6 (JSONConversion) | |
| 1656 | +@interface QTVolatile (JSONConversion) | |
| 1652 | 1657 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 1653 | 1658 | - (NSDictionary *)JSONDictionary; |
| 1654 | 1659 | @end |
| 1655 | 1660 | |
| 1656 | -@interface QTUnsigned (JSONConversion) | |
| 1661 | +@interface QTWhile (JSONConversion) | |
| 1657 | 1662 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 1658 | 1663 | - (NSDictionary *)JSONDictionary; |
| 1659 | 1664 | @end |
| 1660 | 1665 | |
| 1661 | -@interface QTVoid (JSONConversion) | |
| 1666 | +@interface QTUnowned (JSONConversion) | |
| 1662 | 1667 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 1663 | 1668 | - (NSDictionary *)JSONDictionary; |
| 1664 | 1669 | @end |
| 1665 | 1670 | |
| 1666 | -@interface QTVolatile (JSONConversion) | |
| 1671 | +@interface QTUnsafe (JSONConversion) | |
| 1667 | 1672 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 1668 | 1673 | - (NSDictionary *)JSONDictionary; |
| 1669 | 1674 | @end |
| 1670 | 1675 | |
| 1671 | -@interface QTWhile (JSONConversion) | |
| 1676 | +@interface QTUseSerializers (JSONConversion) | |
| 1672 | 1677 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 1673 | 1678 | - (NSDictionary *)JSONDictionary; |
| 1674 | 1679 | @end |
| @@ -8686,6 +8691,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 8686 | 8691 | @"list": @"list", |
| 8687 | 8692 | @"Locale": @"locale", |
| 8688 | 8693 | @"lock": @"lock", |
| 8694 | + @"makeDictEncoder": @"makeDictEncoder", | |
| 8689 | 8695 | @"map": @"map", |
| 8690 | 8696 | @"MapEntry": @"mapEntry", |
| 8691 | 8697 | @"MarshalJSON": @"marshalJSON", |
| @@ -8696,13 +8702,11 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 8696 | 8702 | @"namespace": @"namespace", |
| 8697 | 8703 | @"native": @"native", |
| 8698 | 8704 | @"newtonsoft": @"newtonsoft", |
| 8699 | - @"NO": @"no", | |
| 8700 | 8705 | @"goto": @"obj3Goto", |
| 8701 | 8706 | @"if": @"obj3If", |
| 8702 | 8707 | @"inline": @"obj3Inline", |
| 8703 | 8708 | @"int": @"obj3Int", |
| 8704 | 8709 | @"long": @"obj3Long", |
| 8705 | - @"nil": @"obj3Nil", | |
| 8706 | 8710 | @"hashCode": @"theHashCode", |
| 8707 | 8711 | @"init": @"theInit", |
| 8708 | 8712 | @"new": @"theNew", |
| @@ -8764,6 +8768,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 8764 | 8768 | if (![dict[@"list"] isKindOfClass:NSDictionary.class]) return nil; |
| 8765 | 8769 | if (![dict[@"Locale"] isKindOfClass:NSDictionary.class]) return nil; |
| 8766 | 8770 | if (![dict[@"lock"] isKindOfClass:NSDictionary.class]) return nil; |
| 8771 | + if (![dict[@"makeDictEncoder"] isKindOfClass:NSDictionary.class]) return nil; | |
| 8767 | 8772 | if (![dict[@"map"] isKindOfClass:NSDictionary.class]) return nil; |
| 8768 | 8773 | if (![dict[@"MapEntry"] isKindOfClass:NSDictionary.class]) return nil; |
| 8769 | 8774 | if (![dict[@"MarshalJSON"] isKindOfClass:NSDictionary.class]) return nil; |
| @@ -8774,13 +8779,11 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 8774 | 8779 | if (![dict[@"namespace"] isKindOfClass:NSDictionary.class]) return nil; |
| 8775 | 8780 | if (![dict[@"native"] isKindOfClass:NSDictionary.class]) return nil; |
| 8776 | 8781 | if (![dict[@"newtonsoft"] isKindOfClass:NSDictionary.class]) return nil; |
| 8777 | - if (![dict[@"NO"] isKindOfClass:NSDictionary.class]) return nil; | |
| 8778 | 8782 | if (![dict[@"goto"] isKindOfClass:NSDictionary.class]) return nil; |
| 8779 | 8783 | if (![dict[@"if"] isKindOfClass:NSDictionary.class]) return nil; |
| 8780 | 8784 | if (![dict[@"inline"] isKindOfClass:NSDictionary.class]) return nil; |
| 8781 | 8785 | if (![dict[@"int"] isKindOfClass:NSDictionary.class]) return nil; |
| 8782 | 8786 | if (![dict[@"long"] isKindOfClass:NSDictionary.class]) return nil; |
| 8783 | - if (![dict[@"nil"] isKindOfClass:NSDictionary.class]) return nil; | |
| 8784 | 8787 | if (![dict[@"hashCode"] isKindOfClass:NSDictionary.class]) return nil; |
| 8785 | 8788 | if (![dict[@"init"] isKindOfClass:NSDictionary.class]) return nil; |
| 8786 | 8789 | if (![dict[@"new"] isKindOfClass:NSDictionary.class]) return nil; |
| @@ -8875,6 +8878,8 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 8875 | 8878 | if (!_locale && dict[@"Locale"] && ![dict[@"Locale"] isKindOfClass:NSNull.class]) return nil; |
| 8876 | 8879 | _lock = [QTLock fromJSONDictionary:(id)_lock]; |
| 8877 | 8880 | if (!_lock && dict[@"lock"] && ![dict[@"lock"] isKindOfClass:NSNull.class]) return nil; |
| 8881 | + _makeDictEncoder = [QTMakeDictEncoder fromJSONDictionary:(id)_makeDictEncoder]; | |
| 8882 | + if (!_makeDictEncoder && dict[@"makeDictEncoder"] && ![dict[@"makeDictEncoder"] isKindOfClass:NSNull.class]) return nil; | |
| 8878 | 8883 | _map = [QTMap fromJSONDictionary:(id)_map]; |
| 8879 | 8884 | if (!_map && dict[@"map"] && ![dict[@"map"] isKindOfClass:NSNull.class]) return nil; |
| 8880 | 8885 | _mapEntry = [QTMapEntry fromJSONDictionary:(id)_mapEntry]; |
| @@ -8895,8 +8900,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 8895 | 8900 | if (!_native && dict[@"native"] && ![dict[@"native"] isKindOfClass:NSNull.class]) return nil; |
| 8896 | 8901 | _newtonsoft = [QTNewtonsoft fromJSONDictionary:(id)_newtonsoft]; |
| 8897 | 8902 | if (!_newtonsoft && dict[@"newtonsoft"] && ![dict[@"newtonsoft"] isKindOfClass:NSNull.class]) return nil; |
| 8898 | - _no = [QTNo fromJSONDictionary:(id)_no]; | |
| 8899 | - if (!_no && dict[@"NO"] && ![dict[@"NO"] isKindOfClass:NSNull.class]) return nil; | |
| 8900 | 8903 | _obj3Goto = [QTGoto fromJSONDictionary:(id)_obj3Goto]; |
| 8901 | 8904 | if (!_obj3Goto && dict[@"goto"] && ![dict[@"goto"] isKindOfClass:NSNull.class]) return nil; |
| 8902 | 8905 | _obj3If = [QTIf fromJSONDictionary:(id)_obj3If]; |
| @@ -8907,8 +8910,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 8907 | 8910 | if (!_obj3Int && dict[@"int"] && ![dict[@"int"] isKindOfClass:NSNull.class]) return nil; |
| 8908 | 8911 | _obj3Long = [QTLong fromJSONDictionary:(id)_obj3Long]; |
| 8909 | 8912 | if (!_obj3Long && dict[@"long"] && ![dict[@"long"] isKindOfClass:NSNull.class]) return nil; |
| 8910 | - _obj3Nil = [QTNil fromJSONDictionary:(id)_obj3Nil]; | |
| 8911 | - if (!_obj3Nil && dict[@"nil"] && ![dict[@"nil"] isKindOfClass:NSNull.class]) return nil; | |
| 8912 | 8913 | _theHashCode = [QTHashCode fromJSONDictionary:(id)_theHashCode]; |
| 8913 | 8914 | if (!_theHashCode && dict[@"hashCode"] && ![dict[@"hashCode"] isKindOfClass:NSNull.class]) return nil; |
| 8914 | 8915 | _theInit = [QTInit fromJSONDictionary:(id)_theInit]; |
| @@ -8989,6 +8990,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 8989 | 8990 | @"list": [_list JSONDictionary], |
| 8990 | 8991 | @"Locale": [_locale JSONDictionary], |
| 8991 | 8992 | @"lock": [_lock JSONDictionary], |
| 8993 | + @"makeDictEncoder": [_makeDictEncoder JSONDictionary], | |
| 8992 | 8994 | @"map": [_map JSONDictionary], |
| 8993 | 8995 | @"MapEntry": [_mapEntry JSONDictionary], |
| 8994 | 8996 | @"MarshalJSON": [_marshalJSON JSONDictionary], |
| @@ -8999,13 +9001,11 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 8999 | 9001 | @"namespace": [_namespace JSONDictionary], |
| 9000 | 9002 | @"native": [_native JSONDictionary], |
| 9001 | 9003 | @"newtonsoft": [_newtonsoft JSONDictionary], |
| 9002 | - @"NO": [_no JSONDictionary], | |
| 9003 | 9004 | @"goto": [_obj3Goto JSONDictionary], |
| 9004 | 9005 | @"if": [_obj3If JSONDictionary], |
| 9005 | 9006 | @"inline": [_obj3Inline JSONDictionary], |
| 9006 | 9007 | @"int": [_obj3Int JSONDictionary], |
| 9007 | 9008 | @"long": [_obj3Long JSONDictionary], |
| 9008 | - @"nil": [_obj3Nil JSONDictionary], | |
| 9009 | 9009 | @"hashCode": [_theHashCode JSONDictionary], |
| 9010 | 9010 | @"init": [_theInit JSONDictionary], |
| 9011 | 9011 | @"new": [_theNew JSONDictionary], |
| @@ -11114,6 +11114,48 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 11114 | 11114 | } |
| 11115 | 11115 | @end |
| 11116 | 11116 | |
| 11117 | +@implementation QTMakeDictEncoder | |
| 11118 | ++ (NSDictionary<NSString *, NSString *> *)properties | |
| 11119 | +{ | |
| 11120 | + static NSDictionary<NSString *, NSString *> *properties; | |
| 11121 | + return properties = properties ? properties : @{ | |
| 11122 | + @"makeDictEncoder": @"makeDictEncoder", | |
| 11123 | + }; | |
| 11124 | +} | |
| 11125 | + | |
| 11126 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 11127 | +{ | |
| 11128 | + return [dict isKindOfClass:NSDictionary.class] ? [[QTMakeDictEncoder alloc] initWithJSONDictionary:dict] : nil; | |
| 11129 | +} | |
| 11130 | + | |
| 11131 | +- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 11132 | +{ | |
| 11133 | + if (self = [super init]) { | |
| 11134 | + if (![dict[@"makeDictEncoder"] isKindOfClass:NSNumber.class]) return nil; | |
| 11135 | + if ([dict[@"makeDictEncoder"] doubleValue] != [dict[@"makeDictEncoder"] longLongValue]) return nil; | |
| 11136 | + [self setValuesForKeysWithDictionary:dict]; | |
| 11137 | + } | |
| 11138 | + return self; | |
| 11139 | +} | |
| 11140 | + | |
| 11141 | +- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 11142 | +{ | |
| 11143 | + id resolved = QTMakeDictEncoder.properties[key]; | |
| 11144 | + if (resolved) [super setValue:value forKey:resolved]; | |
| 11145 | +} | |
| 11146 | + | |
| 11147 | +- (void)setNilValueForKey:(NSString *)key | |
| 11148 | +{ | |
| 11149 | + id resolved = QTMakeDictEncoder.properties[key]; | |
| 11150 | + if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 11151 | +} | |
| 11152 | + | |
| 11153 | +- (NSDictionary *)JSONDictionary | |
| 11154 | +{ | |
| 11155 | + return [self dictionaryWithValuesForKeys:QTMakeDictEncoder.properties.allValues]; | |
| 11156 | +} | |
| 11157 | +@end | |
| 11158 | + | |
| 11117 | 11159 | @implementation QTMap |
| 11118 | 11160 | + (NSDictionary<NSString *, NSString *> *)properties |
| 11119 | 11161 | { |
| @@ -11564,58 +11606,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 11564 | 11606 | } |
| 11565 | 11607 | @end |
| 11566 | 11608 | |
| 11567 | -@implementation QTNo | |
| 11568 | -+ (NSDictionary<NSString *, NSString *> *)properties | |
| 11569 | -{ | |
| 11570 | - static NSDictionary<NSString *, NSString *> *properties; | |
| 11571 | - return properties = properties ? properties : @{ | |
| 11572 | - @"NO": @"no", | |
| 11573 | - }; | |
| 11574 | -} | |
| 11575 | - | |
| 11576 | -+ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 11577 | -{ | |
| 11578 | - return [dict isKindOfClass:NSDictionary.class] ? [[QTNo alloc] initWithJSONDictionary:dict] : nil; | |
| 11579 | -} | |
| 11580 | - | |
| 11581 | -- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 11582 | -{ | |
| 11583 | - if (self = [super init]) { | |
| 11584 | - if (![dict[@"NO"] isKindOfClass:NSNumber.class]) return nil; | |
| 11585 | - if ([dict[@"NO"] doubleValue] != [dict[@"NO"] longLongValue]) return nil; | |
| 11586 | - [self setValuesForKeysWithDictionary:dict]; | |
| 11587 | - } | |
| 11588 | - return self; | |
| 11589 | -} | |
| 11590 | - | |
| 11591 | -- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 11592 | -{ | |
| 11593 | - id resolved = QTNo.properties[key]; | |
| 11594 | - if (resolved) [super setValue:value forKey:resolved]; | |
| 11595 | -} | |
| 11596 | - | |
| 11597 | -- (void)setNilValueForKey:(NSString *)key | |
| 11598 | -{ | |
| 11599 | - id resolved = QTNo.properties[key]; | |
| 11600 | - if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 11601 | -} | |
| 11602 | - | |
| 11603 | -- (NSDictionary *)JSONDictionary | |
| 11604 | -{ | |
| 11605 | - id dict = [[self dictionaryWithValuesForKeys:QTNo.properties.allValues] mutableCopy]; | |
| 11606 | - | |
| 11607 | - for (id jsonName in QTNo.properties) { | |
| 11608 | - id propertyName = QTNo.properties[jsonName]; | |
| 11609 | - if (![jsonName isEqualToString:propertyName]) { | |
| 11610 | - dict[jsonName] = dict[propertyName]; | |
| 11611 | - [dict removeObjectForKey:propertyName]; | |
| 11612 | - } | |
| 11613 | - } | |
| 11614 | - | |
| 11615 | - return dict; | |
| 11616 | -} | |
| 11617 | -@end | |
| 11618 | - | |
| 11619 | 11609 | @implementation QTGoto |
| 11620 | 11610 | + (NSDictionary<NSString *, NSString *> *)properties |
| 11621 | 11611 | { |
| @@ -11876,58 +11866,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 11876 | 11866 | } |
| 11877 | 11867 | @end |
| 11878 | 11868 | |
| 11879 | -@implementation QTNil | |
| 11880 | -+ (NSDictionary<NSString *, NSString *> *)properties | |
| 11881 | -{ | |
| 11882 | - static NSDictionary<NSString *, NSString *> *properties; | |
| 11883 | - return properties = properties ? properties : @{ | |
| 11884 | - @"nil": @"nilNil", | |
| 11885 | - }; | |
| 11886 | -} | |
| 11887 | - | |
| 11888 | -+ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 11889 | -{ | |
| 11890 | - return [dict isKindOfClass:NSDictionary.class] ? [[QTNil alloc] initWithJSONDictionary:dict] : nil; | |
| 11891 | -} | |
| 11892 | - | |
| 11893 | -- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 11894 | -{ | |
| 11895 | - if (self = [super init]) { | |
| 11896 | - if (![dict[@"nil"] isKindOfClass:NSNumber.class]) return nil; | |
| 11897 | - if ([dict[@"nil"] doubleValue] != [dict[@"nil"] longLongValue]) return nil; | |
| 11898 | - [self setValuesForKeysWithDictionary:dict]; | |
| 11899 | - } | |
| 11900 | - return self; | |
| 11901 | -} | |
| 11902 | - | |
| 11903 | -- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 11904 | -{ | |
| 11905 | - id resolved = QTNil.properties[key]; | |
| 11906 | - if (resolved) [super setValue:value forKey:resolved]; | |
| 11907 | -} | |
| 11908 | - | |
| 11909 | -- (void)setNilValueForKey:(NSString *)key | |
| 11910 | -{ | |
| 11911 | - id resolved = QTNil.properties[key]; | |
| 11912 | - if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 11913 | -} | |
| 11914 | - | |
| 11915 | -- (NSDictionary *)JSONDictionary | |
| 11916 | -{ | |
| 11917 | - id dict = [[self dictionaryWithValuesForKeys:QTNil.properties.allValues] mutableCopy]; | |
| 11918 | - | |
| 11919 | - for (id jsonName in QTNil.properties) { | |
| 11920 | - id propertyName = QTNil.properties[jsonName]; | |
| 11921 | - if (![jsonName isEqualToString:propertyName]) { | |
| 11922 | - dict[jsonName] = dict[propertyName]; | |
| 11923 | - [dict removeObjectForKey:propertyName]; | |
| 11924 | - } | |
| 11925 | - } | |
| 11926 | - | |
| 11927 | - return dict; | |
| 11928 | -} | |
| 11929 | -@end | |
| 11930 | - | |
| 11931 | 11869 | @implementation QTHashCode |
| 11932 | 11870 | + (NSDictionary<NSString *, NSString *> *)properties |
| 11933 | 11871 | { |
| @@ -12090,6 +12028,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 12090 | 12028 | static NSDictionary<NSString *, NSString *> *properties; |
| 12091 | 12029 | return properties = properties ? properties : @{ |
| 12092 | 12030 | @"dummy": @"dummy", |
| 12031 | + @"NO": @"no", | |
| 12093 | 12032 | @"noSuchMethod": @"noSuchMethod", |
| 12094 | 12033 | @"noexcept": @"noexcept", |
| 12095 | 12034 | @"None": @"none", |
| @@ -12103,6 +12042,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 12103 | 12042 | @"NULL": @"null", |
| 12104 | 12043 | @"nullptr": @"nullptr", |
| 12105 | 12044 | @"number": @"number", |
| 12045 | + @"nil": @"obj4Nil", | |
| 12106 | 12046 | @"nonatomic": @"obj4Nonatomic", |
| 12107 | 12047 | @"none": @"obj4None", |
| 12108 | 12048 | @"null": @"obj4Null", |
| @@ -12152,8 +12092,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 12152 | 12092 | @"runtimeType": @"runtimeType", |
| 12153 | 12093 | @"s": @"s", |
| 12154 | 12094 | @"sbyte": @"sbyte", |
| 12155 | - @"sealed": @"sealed", | |
| 12156 | - @"SEL": @"sel", | |
| 12157 | 12095 | }; |
| 12158 | 12096 | } |
| 12159 | 12097 | |
| @@ -12167,6 +12105,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 12167 | 12105 | if (self = [super init]) { |
| 12168 | 12106 | if (![dict[@"dummy"] isKindOfClass:NSNumber.class]) return nil; |
| 12169 | 12107 | if ([dict[@"dummy"] doubleValue] != [dict[@"dummy"] longLongValue]) return nil; |
| 12108 | + if (![dict[@"NO"] isKindOfClass:NSDictionary.class]) return nil; | |
| 12170 | 12109 | if (![dict[@"noSuchMethod"] isKindOfClass:NSDictionary.class]) return nil; |
| 12171 | 12110 | if (![dict[@"noexcept"] isKindOfClass:NSDictionary.class]) return nil; |
| 12172 | 12111 | if (![dict[@"None"] isKindOfClass:NSDictionary.class]) return nil; |
| @@ -12180,6 +12119,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 12180 | 12119 | if (![dict[@"NULL"] isKindOfClass:NSDictionary.class]) return nil; |
| 12181 | 12120 | if (![dict[@"nullptr"] isKindOfClass:NSDictionary.class]) return nil; |
| 12182 | 12121 | if (![dict[@"number"] isKindOfClass:NSDictionary.class]) return nil; |
| 12122 | + if (![dict[@"nil"] isKindOfClass:NSDictionary.class]) return nil; | |
| 12183 | 12123 | if (![dict[@"nonatomic"] isKindOfClass:NSDictionary.class]) return nil; |
| 12184 | 12124 | if (![dict[@"none"] isKindOfClass:NSDictionary.class]) return nil; |
| 12185 | 12125 | if (![dict[@"null"] isKindOfClass:NSDictionary.class]) return nil; |
| @@ -12229,9 +12169,9 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 12229 | 12169 | if (![dict[@"runtimeType"] isKindOfClass:NSDictionary.class]) return nil; |
| 12230 | 12170 | if (![dict[@"s"] isKindOfClass:NSDictionary.class]) return nil; |
| 12231 | 12171 | if (![dict[@"sbyte"] isKindOfClass:NSDictionary.class]) return nil; |
| 12232 | - if (![dict[@"sealed"] isKindOfClass:NSDictionary.class]) return nil; | |
| 12233 | - if (![dict[@"SEL"] isKindOfClass:NSDictionary.class]) return nil; | |
| 12234 | 12172 | [self setValuesForKeysWithDictionary:dict]; |
| 12173 | + _no = [QTNo fromJSONDictionary:(id)_no]; | |
| 12174 | + if (!_no && dict[@"NO"] && ![dict[@"NO"] isKindOfClass:NSNull.class]) return nil; | |
| 12235 | 12175 | _noSuchMethod = [QTNoSuchMethod fromJSONDictionary:(id)_noSuchMethod]; |
| 12236 | 12176 | if (!_noSuchMethod && dict[@"noSuchMethod"] && ![dict[@"noSuchMethod"] isKindOfClass:NSNull.class]) return nil; |
| 12237 | 12177 | _noexcept = [QTNoexcept fromJSONDictionary:(id)_noexcept]; |
| @@ -12258,6 +12198,8 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 12258 | 12198 | if (!_nullptr && dict[@"nullptr"] && ![dict[@"nullptr"] isKindOfClass:NSNull.class]) return nil; |
| 12259 | 12199 | _number = [QTNumber fromJSONDictionary:(id)_number]; |
| 12260 | 12200 | if (!_number && dict[@"number"] && ![dict[@"number"] isKindOfClass:NSNull.class]) return nil; |
| 12201 | + _obj4Nil = [QTNil fromJSONDictionary:(id)_obj4Nil]; | |
| 12202 | + if (!_obj4Nil && dict[@"nil"] && ![dict[@"nil"] isKindOfClass:NSNull.class]) return nil; | |
| 12261 | 12203 | _obj4Nonatomic = [QTNonatomic fromJSONDictionary:(id)_obj4Nonatomic]; |
| 12262 | 12204 | if (!_obj4Nonatomic && dict[@"nonatomic"] && ![dict[@"nonatomic"] isKindOfClass:NSNull.class]) return nil; |
| 12263 | 12205 | _obj4None = [QTNoneClass fromJSONDictionary:(id)_obj4None]; |
| @@ -12356,10 +12298,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 12356 | 12298 | if (!_s && dict[@"s"] && ![dict[@"s"] isKindOfClass:NSNull.class]) return nil; |
| 12357 | 12299 | _sbyte = [QTSbyte fromJSONDictionary:(id)_sbyte]; |
| 12358 | 12300 | if (!_sbyte && dict[@"sbyte"] && ![dict[@"sbyte"] isKindOfClass:NSNull.class]) return nil; |
| 12359 | - _sealed = [QTSealed fromJSONDictionary:(id)_sealed]; | |
| 12360 | - if (!_sealed && dict[@"sealed"] && ![dict[@"sealed"] isKindOfClass:NSNull.class]) return nil; | |
| 12361 | - _sel = [QTSel fromJSONDictionary:(id)_sel]; | |
| 12362 | - if (!_sel && dict[@"SEL"] && ![dict[@"SEL"] isKindOfClass:NSNull.class]) return nil; | |
| 12363 | 12301 | } |
| 12364 | 12302 | return self; |
| 12365 | 12303 | } |
| @@ -12389,6 +12327,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 12389 | 12327 | } |
| 12390 | 12328 | |
| 12391 | 12329 | [dict addEntriesFromDictionary:@{ |
| 12330 | + @"NO": [_no JSONDictionary], | |
| 12392 | 12331 | @"noSuchMethod": [_noSuchMethod JSONDictionary], |
| 12393 | 12332 | @"noexcept": [_noexcept JSONDictionary], |
| 12394 | 12333 | @"None": [_none JSONDictionary], |
| @@ -12402,6 +12341,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 12402 | 12341 | @"NULL": [_null JSONDictionary], |
| 12403 | 12342 | @"nullptr": [_nullptr JSONDictionary], |
| 12404 | 12343 | @"number": [_number JSONDictionary], |
| 12344 | + @"nil": [_obj4Nil JSONDictionary], | |
| 12405 | 12345 | @"nonatomic": [_obj4Nonatomic JSONDictionary], |
| 12406 | 12346 | @"none": [_obj4None JSONDictionary], |
| 12407 | 12347 | @"null": [_obj4Null JSONDictionary], |
| @@ -12451,33 +12391,31 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 12451 | 12391 | @"runtimeType": [_runtimeType JSONDictionary], |
| 12452 | 12392 | @"s": [_s JSONDictionary], |
| 12453 | 12393 | @"sbyte": [_sbyte JSONDictionary], |
| 12454 | - @"sealed": [_sealed JSONDictionary], | |
| 12455 | - @"SEL": [_sel JSONDictionary], | |
| 12456 | 12394 | }]; |
| 12457 | 12395 | |
| 12458 | 12396 | return dict; |
| 12459 | 12397 | } |
| 12460 | 12398 | @end |
| 12461 | 12399 | |
| 12462 | -@implementation QTNoSuchMethod | |
| 12400 | +@implementation QTNo | |
| 12463 | 12401 | + (NSDictionary<NSString *, NSString *> *)properties |
| 12464 | 12402 | { |
| 12465 | 12403 | static NSDictionary<NSString *, NSString *> *properties; |
| 12466 | 12404 | return properties = properties ? properties : @{ |
| 12467 | - @"noSuchMethod": @"noSuchMethod", | |
| 12405 | + @"NO": @"no", | |
| 12468 | 12406 | }; |
| 12469 | 12407 | } |
| 12470 | 12408 | |
| 12471 | 12409 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict |
| 12472 | 12410 | { |
| 12473 | - return [dict isKindOfClass:NSDictionary.class] ? [[QTNoSuchMethod alloc] initWithJSONDictionary:dict] : nil; | |
| 12411 | + return [dict isKindOfClass:NSDictionary.class] ? [[QTNo alloc] initWithJSONDictionary:dict] : nil; | |
| 12474 | 12412 | } |
| 12475 | 12413 | |
| 12476 | 12414 | - (instancetype)initWithJSONDictionary:(NSDictionary *)dict |
| 12477 | 12415 | { |
| 12478 | 12416 | if (self = [super init]) { |
| 12479 | - if (![dict[@"noSuchMethod"] isKindOfClass:NSNumber.class]) return nil; | |
| 12480 | - if ([dict[@"noSuchMethod"] doubleValue] != [dict[@"noSuchMethod"] longLongValue]) return nil; | |
| 12417 | + if (![dict[@"NO"] isKindOfClass:NSNumber.class]) return nil; | |
| 12418 | + if ([dict[@"NO"] doubleValue] != [dict[@"NO"] longLongValue]) return nil; | |
| 12481 | 12419 | [self setValuesForKeysWithDictionary:dict]; |
| 12482 | 12420 | } |
| 12483 | 12421 | return self; |
| @@ -12485,41 +12423,93 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 12485 | 12423 | |
| 12486 | 12424 | - (void)setValue:(nullable id)value forKey:(NSString *)key |
| 12487 | 12425 | { |
| 12488 | - id resolved = QTNoSuchMethod.properties[key]; | |
| 12426 | + id resolved = QTNo.properties[key]; | |
| 12489 | 12427 | if (resolved) [super setValue:value forKey:resolved]; |
| 12490 | 12428 | } |
| 12491 | 12429 | |
| 12492 | 12430 | - (void)setNilValueForKey:(NSString *)key |
| 12493 | 12431 | { |
| 12494 | - id resolved = QTNoSuchMethod.properties[key]; | |
| 12432 | + id resolved = QTNo.properties[key]; | |
| 12495 | 12433 | if (resolved) [super setValue:@(0) forKey:resolved]; |
| 12496 | 12434 | } |
| 12497 | 12435 | |
| 12498 | 12436 | - (NSDictionary *)JSONDictionary |
| 12499 | 12437 | { |
| 12500 | - return [self dictionaryWithValuesForKeys:QTNoSuchMethod.properties.allValues]; | |
| 12438 | + id dict = [[self dictionaryWithValuesForKeys:QTNo.properties.allValues] mutableCopy]; | |
| 12439 | + | |
| 12440 | + for (id jsonName in QTNo.properties) { | |
| 12441 | + id propertyName = QTNo.properties[jsonName]; | |
| 12442 | + if (![jsonName isEqualToString:propertyName]) { | |
| 12443 | + dict[jsonName] = dict[propertyName]; | |
| 12444 | + [dict removeObjectForKey:propertyName]; | |
| 12445 | + } | |
| 12446 | + } | |
| 12447 | + | |
| 12448 | + return dict; | |
| 12501 | 12449 | } |
| 12502 | 12450 | @end |
| 12503 | 12451 | |
| 12504 | -@implementation QTNoexcept | |
| 12452 | +@implementation QTNoSuchMethod | |
| 12505 | 12453 | + (NSDictionary<NSString *, NSString *> *)properties |
| 12506 | 12454 | { |
| 12507 | 12455 | static NSDictionary<NSString *, NSString *> *properties; |
| 12508 | 12456 | return properties = properties ? properties : @{ |
| 12509 | - @"noexcept": @"noexcept", | |
| 12457 | + @"noSuchMethod": @"noSuchMethod", | |
| 12510 | 12458 | }; |
| 12511 | 12459 | } |
| 12512 | 12460 | |
| 12513 | 12461 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict |
| 12514 | 12462 | { |
| 12515 | - return [dict isKindOfClass:NSDictionary.class] ? [[QTNoexcept alloc] initWithJSONDictionary:dict] : nil; | |
| 12463 | + return [dict isKindOfClass:NSDictionary.class] ? [[QTNoSuchMethod alloc] initWithJSONDictionary:dict] : nil; | |
| 12516 | 12464 | } |
| 12517 | 12465 | |
| 12518 | 12466 | - (instancetype)initWithJSONDictionary:(NSDictionary *)dict |
| 12519 | 12467 | { |
| 12520 | 12468 | if (self = [super init]) { |
| 12521 | - if (![dict[@"noexcept"] isKindOfClass:NSNumber.class]) return nil; | |
| 12522 | - if ([dict[@"noexcept"] doubleValue] != [dict[@"noexcept"] longLongValue]) return nil; | |
| 12469 | + if (![dict[@"noSuchMethod"] isKindOfClass:NSNumber.class]) return nil; | |
| 12470 | + if ([dict[@"noSuchMethod"] doubleValue] != [dict[@"noSuchMethod"] longLongValue]) return nil; | |
| 12471 | + [self setValuesForKeysWithDictionary:dict]; | |
| 12472 | + } | |
| 12473 | + return self; | |
| 12474 | +} | |
| 12475 | + | |
| 12476 | +- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 12477 | +{ | |
| 12478 | + id resolved = QTNoSuchMethod.properties[key]; | |
| 12479 | + if (resolved) [super setValue:value forKey:resolved]; | |
| 12480 | +} | |
| 12481 | + | |
| 12482 | +- (void)setNilValueForKey:(NSString *)key | |
| 12483 | +{ | |
| 12484 | + id resolved = QTNoSuchMethod.properties[key]; | |
| 12485 | + if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 12486 | +} | |
| 12487 | + | |
| 12488 | +- (NSDictionary *)JSONDictionary | |
| 12489 | +{ | |
| 12490 | + return [self dictionaryWithValuesForKeys:QTNoSuchMethod.properties.allValues]; | |
| 12491 | +} | |
| 12492 | +@end | |
| 12493 | + | |
| 12494 | +@implementation QTNoexcept | |
| 12495 | ++ (NSDictionary<NSString *, NSString *> *)properties | |
| 12496 | +{ | |
| 12497 | + static NSDictionary<NSString *, NSString *> *properties; | |
| 12498 | + return properties = properties ? properties : @{ | |
| 12499 | + @"noexcept": @"noexcept", | |
| 12500 | + }; | |
| 12501 | +} | |
| 12502 | + | |
| 12503 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 12504 | +{ | |
| 12505 | + return [dict isKindOfClass:NSDictionary.class] ? [[QTNoexcept alloc] initWithJSONDictionary:dict] : nil; | |
| 12506 | +} | |
| 12507 | + | |
| 12508 | +- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 12509 | +{ | |
| 12510 | + if (self = [super init]) { | |
| 12511 | + if (![dict[@"noexcept"] isKindOfClass:NSNumber.class]) return nil; | |
| 12512 | + if ([dict[@"noexcept"] doubleValue] != [dict[@"noexcept"] longLongValue]) return nil; | |
| 12523 | 12513 | [self setValuesForKeysWithDictionary:dict]; |
| 12524 | 12514 | } |
| 12525 | 12515 | return self; |
| @@ -13065,6 +13055,58 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 13065 | 13055 | } |
| 13066 | 13056 | @end |
| 13067 | 13057 | |
| 13058 | +@implementation QTNil | |
| 13059 | ++ (NSDictionary<NSString *, NSString *> *)properties | |
| 13060 | +{ | |
| 13061 | + static NSDictionary<NSString *, NSString *> *properties; | |
| 13062 | + return properties = properties ? properties : @{ | |
| 13063 | + @"nil": @"nilNil", | |
| 13064 | + }; | |
| 13065 | +} | |
| 13066 | + | |
| 13067 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 13068 | +{ | |
| 13069 | + return [dict isKindOfClass:NSDictionary.class] ? [[QTNil alloc] initWithJSONDictionary:dict] : nil; | |
| 13070 | +} | |
| 13071 | + | |
| 13072 | +- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 13073 | +{ | |
| 13074 | + if (self = [super init]) { | |
| 13075 | + if (![dict[@"nil"] isKindOfClass:NSNumber.class]) return nil; | |
| 13076 | + if ([dict[@"nil"] doubleValue] != [dict[@"nil"] longLongValue]) return nil; | |
| 13077 | + [self setValuesForKeysWithDictionary:dict]; | |
| 13078 | + } | |
| 13079 | + return self; | |
| 13080 | +} | |
| 13081 | + | |
| 13082 | +- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 13083 | +{ | |
| 13084 | + id resolved = QTNil.properties[key]; | |
| 13085 | + if (resolved) [super setValue:value forKey:resolved]; | |
| 13086 | +} | |
| 13087 | + | |
| 13088 | +- (void)setNilValueForKey:(NSString *)key | |
| 13089 | +{ | |
| 13090 | + id resolved = QTNil.properties[key]; | |
| 13091 | + if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 13092 | +} | |
| 13093 | + | |
| 13094 | +- (NSDictionary *)JSONDictionary | |
| 13095 | +{ | |
| 13096 | + id dict = [[self dictionaryWithValuesForKeys:QTNil.properties.allValues] mutableCopy]; | |
| 13097 | + | |
| 13098 | + for (id jsonName in QTNil.properties) { | |
| 13099 | + id propertyName = QTNil.properties[jsonName]; | |
| 13100 | + if (![jsonName isEqualToString:propertyName]) { | |
| 13101 | + dict[jsonName] = dict[propertyName]; | |
| 13102 | + [dict removeObjectForKey:propertyName]; | |
| 13103 | + } | |
| 13104 | + } | |
| 13105 | + | |
| 13106 | + return dict; | |
| 13107 | +} | |
| 13108 | +@end | |
| 13109 | + | |
| 13068 | 13110 | @implementation QTNonatomic |
| 13069 | 13111 | + (NSDictionary<NSString *, NSString *> *)properties |
| 13070 | 13112 | { |
| @@ -15223,100 +15265,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 15223 | 15265 | } |
| 15224 | 15266 | @end |
| 15225 | 15267 | |
| 15226 | -@implementation QTSealed | |
| 15227 | -+ (NSDictionary<NSString *, NSString *> *)properties | |
| 15228 | -{ | |
| 15229 | - static NSDictionary<NSString *, NSString *> *properties; | |
| 15230 | - return properties = properties ? properties : @{ | |
| 15231 | - @"sealed": @"sealed", | |
| 15232 | - }; | |
| 15233 | -} | |
| 15234 | - | |
| 15235 | -+ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 15236 | -{ | |
| 15237 | - return [dict isKindOfClass:NSDictionary.class] ? [[QTSealed alloc] initWithJSONDictionary:dict] : nil; | |
| 15238 | -} | |
| 15239 | - | |
| 15240 | -- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 15241 | -{ | |
| 15242 | - if (self = [super init]) { | |
| 15243 | - if (![dict[@"sealed"] isKindOfClass:NSNumber.class]) return nil; | |
| 15244 | - if ([dict[@"sealed"] doubleValue] != [dict[@"sealed"] longLongValue]) return nil; | |
| 15245 | - [self setValuesForKeysWithDictionary:dict]; | |
| 15246 | - } | |
| 15247 | - return self; | |
| 15248 | -} | |
| 15249 | - | |
| 15250 | -- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 15251 | -{ | |
| 15252 | - id resolved = QTSealed.properties[key]; | |
| 15253 | - if (resolved) [super setValue:value forKey:resolved]; | |
| 15254 | -} | |
| 15255 | - | |
| 15256 | -- (void)setNilValueForKey:(NSString *)key | |
| 15257 | -{ | |
| 15258 | - id resolved = QTSealed.properties[key]; | |
| 15259 | - if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 15260 | -} | |
| 15261 | - | |
| 15262 | -- (NSDictionary *)JSONDictionary | |
| 15263 | -{ | |
| 15264 | - return [self dictionaryWithValuesForKeys:QTSealed.properties.allValues]; | |
| 15265 | -} | |
| 15266 | -@end | |
| 15267 | - | |
| 15268 | -@implementation QTSel | |
| 15269 | -+ (NSDictionary<NSString *, NSString *> *)properties | |
| 15270 | -{ | |
| 15271 | - static NSDictionary<NSString *, NSString *> *properties; | |
| 15272 | - return properties = properties ? properties : @{ | |
| 15273 | - @"SEL": @"sel", | |
| 15274 | - }; | |
| 15275 | -} | |
| 15276 | - | |
| 15277 | -+ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 15278 | -{ | |
| 15279 | - return [dict isKindOfClass:NSDictionary.class] ? [[QTSel alloc] initWithJSONDictionary:dict] : nil; | |
| 15280 | -} | |
| 15281 | - | |
| 15282 | -- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 15283 | -{ | |
| 15284 | - if (self = [super init]) { | |
| 15285 | - if (![dict[@"SEL"] isKindOfClass:NSNumber.class]) return nil; | |
| 15286 | - if ([dict[@"SEL"] doubleValue] != [dict[@"SEL"] longLongValue]) return nil; | |
| 15287 | - [self setValuesForKeysWithDictionary:dict]; | |
| 15288 | - } | |
| 15289 | - return self; | |
| 15290 | -} | |
| 15291 | - | |
| 15292 | -- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 15293 | -{ | |
| 15294 | - id resolved = QTSel.properties[key]; | |
| 15295 | - if (resolved) [super setValue:value forKey:resolved]; | |
| 15296 | -} | |
| 15297 | - | |
| 15298 | -- (void)setNilValueForKey:(NSString *)key | |
| 15299 | -{ | |
| 15300 | - id resolved = QTSel.properties[key]; | |
| 15301 | - if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 15302 | -} | |
| 15303 | - | |
| 15304 | -- (NSDictionary *)JSONDictionary | |
| 15305 | -{ | |
| 15306 | - id dict = [[self dictionaryWithValuesForKeys:QTSel.properties.allValues] mutableCopy]; | |
| 15307 | - | |
| 15308 | - for (id jsonName in QTSel.properties) { | |
| 15309 | - id propertyName = QTSel.properties[jsonName]; | |
| 15310 | - if (![jsonName isEqualToString:propertyName]) { | |
| 15311 | - dict[jsonName] = dict[propertyName]; | |
| 15312 | - [dict removeObjectForKey:propertyName]; | |
| 15313 | - } | |
| 15314 | - } | |
| 15315 | - | |
| 15316 | - return dict; | |
| 15317 | -} | |
| 15318 | -@end | |
| 15319 | - | |
| 15320 | 15268 | @implementation QTObj5 |
| 15321 | 15269 | + (NSDictionary<NSString *, NSString *> *)properties |
| 15322 | 15270 | { |
| @@ -15337,6 +15285,8 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 15337 | 15285 | @"typeof": @"obj5Typeof", |
| 15338 | 15286 | @"union": @"obj5Union", |
| 15339 | 15287 | @"PrimitiveKind": @"primitiveKind", |
| 15288 | + @"sealed": @"sealed", | |
| 15289 | + @"SEL": @"sel", | |
| 15340 | 15290 | @"select": @"select", |
| 15341 | 15291 | @"Self": @"self", |
| 15342 | 15292 | @"Sendable": @"sendable", |
| @@ -15385,9 +15335,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 15385 | 15335 | @"unchecked": @"unchecked", |
| 15386 | 15336 | @"undefined": @"undefined", |
| 15387 | 15337 | @"UnmarshalJSON": @"unmarshalJSON", |
| 15388 | - @"unowned": @"unowned", | |
| 15389 | - @"unsafe": @"unsafe", | |
| 15390 | - @"UseSerializers": @"useSerializers", | |
| 15391 | 15338 | }; |
| 15392 | 15339 | } |
| 15393 | 15340 | |
| @@ -15415,6 +15362,8 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 15415 | 15362 | if (![dict[@"typeof"] isKindOfClass:NSDictionary.class]) return nil; |
| 15416 | 15363 | if (![dict[@"union"] isKindOfClass:NSDictionary.class]) return nil; |
| 15417 | 15364 | if (![dict[@"PrimitiveKind"] isKindOfClass:NSDictionary.class]) return nil; |
| 15365 | + if (![dict[@"sealed"] isKindOfClass:NSDictionary.class]) return nil; | |
| 15366 | + if (![dict[@"SEL"] isKindOfClass:NSDictionary.class]) return nil; | |
| 15418 | 15367 | if (![dict[@"select"] isKindOfClass:NSDictionary.class]) return nil; |
| 15419 | 15368 | if (![dict[@"Self"] isKindOfClass:NSDictionary.class]) return nil; |
| 15420 | 15369 | if (![dict[@"Sendable"] isKindOfClass:NSDictionary.class]) return nil; |
| @@ -15463,9 +15412,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 15463 | 15412 | if (![dict[@"unchecked"] isKindOfClass:NSDictionary.class]) return nil; |
| 15464 | 15413 | if (![dict[@"undefined"] isKindOfClass:NSDictionary.class]) return nil; |
| 15465 | 15414 | if (![dict[@"UnmarshalJSON"] isKindOfClass:NSDictionary.class]) return nil; |
| 15466 | - if (![dict[@"unowned"] isKindOfClass:NSDictionary.class]) return nil; | |
| 15467 | - if (![dict[@"unsafe"] isKindOfClass:NSDictionary.class]) return nil; | |
| 15468 | - if (![dict[@"UseSerializers"] isKindOfClass:NSDictionary.class]) return nil; | |
| 15469 | 15415 | [self setValuesForKeysWithDictionary:dict]; |
| 15470 | 15416 | _kSerializer = [QTKSerializer fromJSONDictionary:(id)_kSerializer]; |
| 15471 | 15417 | if (!_kSerializer && dict[@"KSerializer"] && ![dict[@"KSerializer"] isKindOfClass:NSNull.class]) return nil; |
| @@ -15495,6 +15441,10 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 15495 | 15441 | if (!_obj5Union && dict[@"union"] && ![dict[@"union"] isKindOfClass:NSNull.class]) return nil; |
| 15496 | 15442 | _primitiveKind = [QTPrimitiveKind fromJSONDictionary:(id)_primitiveKind]; |
| 15497 | 15443 | if (!_primitiveKind && dict[@"PrimitiveKind"] && ![dict[@"PrimitiveKind"] isKindOfClass:NSNull.class]) return nil; |
| 15444 | + _sealed = [QTSealed fromJSONDictionary:(id)_sealed]; | |
| 15445 | + if (!_sealed && dict[@"sealed"] && ![dict[@"sealed"] isKindOfClass:NSNull.class]) return nil; | |
| 15446 | + _sel = [QTSel fromJSONDictionary:(id)_sel]; | |
| 15447 | + if (!_sel && dict[@"SEL"] && ![dict[@"SEL"] isKindOfClass:NSNull.class]) return nil; | |
| 15498 | 15448 | _select = [QTSelect fromJSONDictionary:(id)_select]; |
| 15499 | 15449 | if (!_select && dict[@"select"] && ![dict[@"select"] isKindOfClass:NSNull.class]) return nil; |
| 15500 | 15450 | _self = [QTSelf fromJSONDictionary:(id)_self]; |
| @@ -15591,12 +15541,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 15591 | 15541 | if (!_undefined && dict[@"undefined"] && ![dict[@"undefined"] isKindOfClass:NSNull.class]) return nil; |
| 15592 | 15542 | _unmarshalJSON = [QTUnmarshalJSON fromJSONDictionary:(id)_unmarshalJSON]; |
| 15593 | 15543 | if (!_unmarshalJSON && dict[@"UnmarshalJSON"] && ![dict[@"UnmarshalJSON"] isKindOfClass:NSNull.class]) return nil; |
| 15594 | - _unowned = [QTUnowned fromJSONDictionary:(id)_unowned]; | |
| 15595 | - if (!_unowned && dict[@"unowned"] && ![dict[@"unowned"] isKindOfClass:NSNull.class]) return nil; | |
| 15596 | - _unsafe = [QTUnsafe fromJSONDictionary:(id)_unsafe]; | |
| 15597 | - if (!_unsafe && dict[@"unsafe"] && ![dict[@"unsafe"] isKindOfClass:NSNull.class]) return nil; | |
| 15598 | - _useSerializers = [QTUseSerializers fromJSONDictionary:(id)_useSerializers]; | |
| 15599 | - if (!_useSerializers && dict[@"UseSerializers"] && ![dict[@"UseSerializers"] isKindOfClass:NSNull.class]) return nil; | |
| 15600 | 15544 | } |
| 15601 | 15545 | return self; |
| 15602 | 15546 | } |
| @@ -15640,6 +15584,8 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 15640 | 15584 | @"typeof": [_obj5Typeof JSONDictionary], |
| 15641 | 15585 | @"union": [_obj5Union JSONDictionary], |
| 15642 | 15586 | @"PrimitiveKind": [_primitiveKind JSONDictionary], |
| 15587 | + @"sealed": [_sealed JSONDictionary], | |
| 15588 | + @"SEL": [_sel JSONDictionary], | |
| 15643 | 15589 | @"select": [_select JSONDictionary], |
| 15644 | 15590 | @"Self": [_self JSONDictionary], |
| 15645 | 15591 | @"Sendable": [_sendable JSONDictionary], |
| @@ -15688,9 +15634,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 15688 | 15634 | @"unchecked": [_unchecked JSONDictionary], |
| 15689 | 15635 | @"undefined": [_undefined JSONDictionary], |
| 15690 | 15636 | @"UnmarshalJSON": [_unmarshalJSON JSONDictionary], |
| 15691 | - @"unowned": [_unowned JSONDictionary], | |
| 15692 | - @"unsafe": [_unsafe JSONDictionary], | |
| 15693 | - @"UseSerializers": [_useSerializers JSONDictionary], | |
| 15694 | 15637 | }]; |
| 15695 | 15638 | |
| 15696 | 15639 | return dict; |
| @@ -16405,25 +16348,25 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 16405 | 16348 | } |
| 16406 | 16349 | @end |
| 16407 | 16350 | |
| 16408 | -@implementation QTSelect | |
| 16351 | +@implementation QTSealed | |
| 16409 | 16352 | + (NSDictionary<NSString *, NSString *> *)properties |
| 16410 | 16353 | { |
| 16411 | 16354 | static NSDictionary<NSString *, NSString *> *properties; |
| 16412 | 16355 | return properties = properties ? properties : @{ |
| 16413 | - @"select": @"select", | |
| 16356 | + @"sealed": @"sealed", | |
| 16414 | 16357 | }; |
| 16415 | 16358 | } |
| 16416 | 16359 | |
| 16417 | 16360 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict |
| 16418 | 16361 | { |
| 16419 | - return [dict isKindOfClass:NSDictionary.class] ? [[QTSelect alloc] initWithJSONDictionary:dict] : nil; | |
| 16362 | + return [dict isKindOfClass:NSDictionary.class] ? [[QTSealed alloc] initWithJSONDictionary:dict] : nil; | |
| 16420 | 16363 | } |
| 16421 | 16364 | |
| 16422 | 16365 | - (instancetype)initWithJSONDictionary:(NSDictionary *)dict |
| 16423 | 16366 | { |
| 16424 | 16367 | if (self = [super init]) { |
| 16425 | - if (![dict[@"select"] isKindOfClass:NSNumber.class]) return nil; | |
| 16426 | - if ([dict[@"select"] doubleValue] != [dict[@"select"] longLongValue]) return nil; | |
| 16368 | + if (![dict[@"sealed"] isKindOfClass:NSNumber.class]) return nil; | |
| 16369 | + if ([dict[@"sealed"] doubleValue] != [dict[@"sealed"] longLongValue]) return nil; | |
| 16427 | 16370 | [self setValuesForKeysWithDictionary:dict]; |
| 16428 | 16371 | } |
| 16429 | 16372 | return self; |
| @@ -16431,41 +16374,41 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 16431 | 16374 | |
| 16432 | 16375 | - (void)setValue:(nullable id)value forKey:(NSString *)key |
| 16433 | 16376 | { |
| 16434 | - id resolved = QTSelect.properties[key]; | |
| 16377 | + id resolved = QTSealed.properties[key]; | |
| 16435 | 16378 | if (resolved) [super setValue:value forKey:resolved]; |
| 16436 | 16379 | } |
| 16437 | 16380 | |
| 16438 | 16381 | - (void)setNilValueForKey:(NSString *)key |
| 16439 | 16382 | { |
| 16440 | - id resolved = QTSelect.properties[key]; | |
| 16383 | + id resolved = QTSealed.properties[key]; | |
| 16441 | 16384 | if (resolved) [super setValue:@(0) forKey:resolved]; |
| 16442 | 16385 | } |
| 16443 | 16386 | |
| 16444 | 16387 | - (NSDictionary *)JSONDictionary |
| 16445 | 16388 | { |
| 16446 | - return [self dictionaryWithValuesForKeys:QTSelect.properties.allValues]; | |
| 16389 | + return [self dictionaryWithValuesForKeys:QTSealed.properties.allValues]; | |
| 16447 | 16390 | } |
| 16448 | 16391 | @end |
| 16449 | 16392 | |
| 16450 | -@implementation QTSelf | |
| 16393 | +@implementation QTSel | |
| 16451 | 16394 | + (NSDictionary<NSString *, NSString *> *)properties |
| 16452 | 16395 | { |
| 16453 | 16396 | static NSDictionary<NSString *, NSString *> *properties; |
| 16454 | 16397 | return properties = properties ? properties : @{ |
| 16455 | - @"Self": @"self", | |
| 16398 | + @"SEL": @"sel", | |
| 16456 | 16399 | }; |
| 16457 | 16400 | } |
| 16458 | 16401 | |
| 16459 | 16402 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict |
| 16460 | 16403 | { |
| 16461 | - return [dict isKindOfClass:NSDictionary.class] ? [[QTSelf alloc] initWithJSONDictionary:dict] : nil; | |
| 16404 | + return [dict isKindOfClass:NSDictionary.class] ? [[QTSel alloc] initWithJSONDictionary:dict] : nil; | |
| 16462 | 16405 | } |
| 16463 | 16406 | |
| 16464 | 16407 | - (instancetype)initWithJSONDictionary:(NSDictionary *)dict |
| 16465 | 16408 | { |
| 16466 | 16409 | if (self = [super init]) { |
| 16467 | - if (![dict[@"Self"] isKindOfClass:NSNumber.class]) return nil; | |
| 16468 | - if ([dict[@"Self"] doubleValue] != [dict[@"Self"] longLongValue]) return nil; | |
| 16410 | + if (![dict[@"SEL"] isKindOfClass:NSNumber.class]) return nil; | |
| 16411 | + if ([dict[@"SEL"] doubleValue] != [dict[@"SEL"] longLongValue]) return nil; | |
| 16469 | 16412 | [self setValuesForKeysWithDictionary:dict]; |
| 16470 | 16413 | } |
| 16471 | 16414 | return self; |
| @@ -16473,22 +16416,22 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 16473 | 16416 | |
| 16474 | 16417 | - (void)setValue:(nullable id)value forKey:(NSString *)key |
| 16475 | 16418 | { |
| 16476 | - id resolved = QTSelf.properties[key]; | |
| 16419 | + id resolved = QTSel.properties[key]; | |
| 16477 | 16420 | if (resolved) [super setValue:value forKey:resolved]; |
| 16478 | 16421 | } |
| 16479 | 16422 | |
| 16480 | 16423 | - (void)setNilValueForKey:(NSString *)key |
| 16481 | 16424 | { |
| 16482 | - id resolved = QTSelf.properties[key]; | |
| 16425 | + id resolved = QTSel.properties[key]; | |
| 16483 | 16426 | if (resolved) [super setValue:@(0) forKey:resolved]; |
| 16484 | 16427 | } |
| 16485 | 16428 | |
| 16486 | 16429 | - (NSDictionary *)JSONDictionary |
| 16487 | 16430 | { |
| 16488 | - id dict = [[self dictionaryWithValuesForKeys:QTSelf.properties.allValues] mutableCopy]; | |
| 16431 | + id dict = [[self dictionaryWithValuesForKeys:QTSel.properties.allValues] mutableCopy]; | |
| 16489 | 16432 | |
| 16490 | - for (id jsonName in QTSelf.properties) { | |
| 16491 | - id propertyName = QTSelf.properties[jsonName]; | |
| 16433 | + for (id jsonName in QTSel.properties) { | |
| 16434 | + id propertyName = QTSel.properties[jsonName]; | |
| 16492 | 16435 | if (![jsonName isEqualToString:propertyName]) { |
| 16493 | 16436 | dict[jsonName] = dict[propertyName]; |
| 16494 | 16437 | [dict removeObjectForKey:propertyName]; |
| @@ -16499,24 +16442,118 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 16499 | 16442 | } |
| 16500 | 16443 | @end |
| 16501 | 16444 | |
| 16502 | -@implementation QTSendable | |
| 16445 | +@implementation QTSelect | |
| 16503 | 16446 | + (NSDictionary<NSString *, NSString *> *)properties |
| 16504 | 16447 | { |
| 16505 | 16448 | static NSDictionary<NSString *, NSString *> *properties; |
| 16506 | 16449 | return properties = properties ? properties : @{ |
| 16507 | - @"Sendable": @"sendable", | |
| 16450 | + @"select": @"select", | |
| 16508 | 16451 | }; |
| 16509 | 16452 | } |
| 16510 | 16453 | |
| 16511 | 16454 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict |
| 16512 | 16455 | { |
| 16513 | - return [dict isKindOfClass:NSDictionary.class] ? [[QTSendable alloc] initWithJSONDictionary:dict] : nil; | |
| 16456 | + return [dict isKindOfClass:NSDictionary.class] ? [[QTSelect alloc] initWithJSONDictionary:dict] : nil; | |
| 16514 | 16457 | } |
| 16515 | 16458 | |
| 16516 | 16459 | - (instancetype)initWithJSONDictionary:(NSDictionary *)dict |
| 16517 | 16460 | { |
| 16518 | 16461 | if (self = [super init]) { |
| 16519 | - if (![dict[@"Sendable"] isKindOfClass:NSNumber.class]) return nil; | |
| 16462 | + if (![dict[@"select"] isKindOfClass:NSNumber.class]) return nil; | |
| 16463 | + if ([dict[@"select"] doubleValue] != [dict[@"select"] longLongValue]) return nil; | |
| 16464 | + [self setValuesForKeysWithDictionary:dict]; | |
| 16465 | + } | |
| 16466 | + return self; | |
| 16467 | +} | |
| 16468 | + | |
| 16469 | +- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 16470 | +{ | |
| 16471 | + id resolved = QTSelect.properties[key]; | |
| 16472 | + if (resolved) [super setValue:value forKey:resolved]; | |
| 16473 | +} | |
| 16474 | + | |
| 16475 | +- (void)setNilValueForKey:(NSString *)key | |
| 16476 | +{ | |
| 16477 | + id resolved = QTSelect.properties[key]; | |
| 16478 | + if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 16479 | +} | |
| 16480 | + | |
| 16481 | +- (NSDictionary *)JSONDictionary | |
| 16482 | +{ | |
| 16483 | + return [self dictionaryWithValuesForKeys:QTSelect.properties.allValues]; | |
| 16484 | +} | |
| 16485 | +@end | |
| 16486 | + | |
| 16487 | +@implementation QTSelf | |
| 16488 | ++ (NSDictionary<NSString *, NSString *> *)properties | |
| 16489 | +{ | |
| 16490 | + static NSDictionary<NSString *, NSString *> *properties; | |
| 16491 | + return properties = properties ? properties : @{ | |
| 16492 | + @"Self": @"self", | |
| 16493 | + }; | |
| 16494 | +} | |
| 16495 | + | |
| 16496 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 16497 | +{ | |
| 16498 | + return [dict isKindOfClass:NSDictionary.class] ? [[QTSelf alloc] initWithJSONDictionary:dict] : nil; | |
| 16499 | +} | |
| 16500 | + | |
| 16501 | +- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 16502 | +{ | |
| 16503 | + if (self = [super init]) { | |
| 16504 | + if (![dict[@"Self"] isKindOfClass:NSNumber.class]) return nil; | |
| 16505 | + if ([dict[@"Self"] doubleValue] != [dict[@"Self"] longLongValue]) return nil; | |
| 16506 | + [self setValuesForKeysWithDictionary:dict]; | |
| 16507 | + } | |
| 16508 | + return self; | |
| 16509 | +} | |
| 16510 | + | |
| 16511 | +- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 16512 | +{ | |
| 16513 | + id resolved = QTSelf.properties[key]; | |
| 16514 | + if (resolved) [super setValue:value forKey:resolved]; | |
| 16515 | +} | |
| 16516 | + | |
| 16517 | +- (void)setNilValueForKey:(NSString *)key | |
| 16518 | +{ | |
| 16519 | + id resolved = QTSelf.properties[key]; | |
| 16520 | + if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 16521 | +} | |
| 16522 | + | |
| 16523 | +- (NSDictionary *)JSONDictionary | |
| 16524 | +{ | |
| 16525 | + id dict = [[self dictionaryWithValuesForKeys:QTSelf.properties.allValues] mutableCopy]; | |
| 16526 | + | |
| 16527 | + for (id jsonName in QTSelf.properties) { | |
| 16528 | + id propertyName = QTSelf.properties[jsonName]; | |
| 16529 | + if (![jsonName isEqualToString:propertyName]) { | |
| 16530 | + dict[jsonName] = dict[propertyName]; | |
| 16531 | + [dict removeObjectForKey:propertyName]; | |
| 16532 | + } | |
| 16533 | + } | |
| 16534 | + | |
| 16535 | + return dict; | |
| 16536 | +} | |
| 16537 | +@end | |
| 16538 | + | |
| 16539 | +@implementation QTSendable | |
| 16540 | ++ (NSDictionary<NSString *, NSString *> *)properties | |
| 16541 | +{ | |
| 16542 | + static NSDictionary<NSString *, NSString *> *properties; | |
| 16543 | + return properties = properties ? properties : @{ | |
| 16544 | + @"Sendable": @"sendable", | |
| 16545 | + }; | |
| 16546 | +} | |
| 16547 | + | |
| 16548 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 16549 | +{ | |
| 16550 | + return [dict isKindOfClass:NSDictionary.class] ? [[QTSendable alloc] initWithJSONDictionary:dict] : nil; | |
| 16551 | +} | |
| 16552 | + | |
| 16553 | +- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 16554 | +{ | |
| 16555 | + if (self = [super init]) { | |
| 16556 | + if (![dict[@"Sendable"] isKindOfClass:NSNumber.class]) return nil; | |
| 16520 | 16557 | if ([dict[@"Sendable"] doubleValue] != [dict[@"Sendable"] longLongValue]) return nil; |
| 16521 | 16558 | [self setValuesForKeysWithDictionary:dict]; |
| 16522 | 16559 | } |
| @@ -18641,142 +18678,6 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 18641 | 18678 | } |
| 18642 | 18679 | @end |
| 18643 | 18680 | |
| 18644 | -@implementation QTUnowned | |
| 18645 | -+ (NSDictionary<NSString *, NSString *> *)properties | |
| 18646 | -{ | |
| 18647 | - static NSDictionary<NSString *, NSString *> *properties; | |
| 18648 | - return properties = properties ? properties : @{ | |
| 18649 | - @"unowned": @"unowned", | |
| 18650 | - }; | |
| 18651 | -} | |
| 18652 | - | |
| 18653 | -+ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 18654 | -{ | |
| 18655 | - return [dict isKindOfClass:NSDictionary.class] ? [[QTUnowned alloc] initWithJSONDictionary:dict] : nil; | |
| 18656 | -} | |
| 18657 | - | |
| 18658 | -- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 18659 | -{ | |
| 18660 | - if (self = [super init]) { | |
| 18661 | - if (![dict[@"unowned"] isKindOfClass:NSNumber.class]) return nil; | |
| 18662 | - if ([dict[@"unowned"] doubleValue] != [dict[@"unowned"] longLongValue]) return nil; | |
| 18663 | - [self setValuesForKeysWithDictionary:dict]; | |
| 18664 | - } | |
| 18665 | - return self; | |
| 18666 | -} | |
| 18667 | - | |
| 18668 | -- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 18669 | -{ | |
| 18670 | - id resolved = QTUnowned.properties[key]; | |
| 18671 | - if (resolved) [super setValue:value forKey:resolved]; | |
| 18672 | -} | |
| 18673 | - | |
| 18674 | -- (void)setNilValueForKey:(NSString *)key | |
| 18675 | -{ | |
| 18676 | - id resolved = QTUnowned.properties[key]; | |
| 18677 | - if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 18678 | -} | |
| 18679 | - | |
| 18680 | -- (NSDictionary *)JSONDictionary | |
| 18681 | -{ | |
| 18682 | - return [self dictionaryWithValuesForKeys:QTUnowned.properties.allValues]; | |
| 18683 | -} | |
| 18684 | -@end | |
| 18685 | - | |
| 18686 | -@implementation QTUnsafe | |
| 18687 | -+ (NSDictionary<NSString *, NSString *> *)properties | |
| 18688 | -{ | |
| 18689 | - static NSDictionary<NSString *, NSString *> *properties; | |
| 18690 | - return properties = properties ? properties : @{ | |
| 18691 | - @"unsafe": @"unsafe", | |
| 18692 | - }; | |
| 18693 | -} | |
| 18694 | - | |
| 18695 | -+ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 18696 | -{ | |
| 18697 | - return [dict isKindOfClass:NSDictionary.class] ? [[QTUnsafe alloc] initWithJSONDictionary:dict] : nil; | |
| 18698 | -} | |
| 18699 | - | |
| 18700 | -- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 18701 | -{ | |
| 18702 | - if (self = [super init]) { | |
| 18703 | - if (![dict[@"unsafe"] isKindOfClass:NSNumber.class]) return nil; | |
| 18704 | - if ([dict[@"unsafe"] doubleValue] != [dict[@"unsafe"] longLongValue]) return nil; | |
| 18705 | - [self setValuesForKeysWithDictionary:dict]; | |
| 18706 | - } | |
| 18707 | - return self; | |
| 18708 | -} | |
| 18709 | - | |
| 18710 | -- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 18711 | -{ | |
| 18712 | - id resolved = QTUnsafe.properties[key]; | |
| 18713 | - if (resolved) [super setValue:value forKey:resolved]; | |
| 18714 | -} | |
| 18715 | - | |
| 18716 | -- (void)setNilValueForKey:(NSString *)key | |
| 18717 | -{ | |
| 18718 | - id resolved = QTUnsafe.properties[key]; | |
| 18719 | - if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 18720 | -} | |
| 18721 | - | |
| 18722 | -- (NSDictionary *)JSONDictionary | |
| 18723 | -{ | |
| 18724 | - return [self dictionaryWithValuesForKeys:QTUnsafe.properties.allValues]; | |
| 18725 | -} | |
| 18726 | -@end | |
| 18727 | - | |
| 18728 | -@implementation QTUseSerializers | |
| 18729 | -+ (NSDictionary<NSString *, NSString *> *)properties | |
| 18730 | -{ | |
| 18731 | - static NSDictionary<NSString *, NSString *> *properties; | |
| 18732 | - return properties = properties ? properties : @{ | |
| 18733 | - @"UseSerializers": @"useSerializers", | |
| 18734 | - }; | |
| 18735 | -} | |
| 18736 | - | |
| 18737 | -+ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 18738 | -{ | |
| 18739 | - return [dict isKindOfClass:NSDictionary.class] ? [[QTUseSerializers alloc] initWithJSONDictionary:dict] : nil; | |
| 18740 | -} | |
| 18741 | - | |
| 18742 | -- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 18743 | -{ | |
| 18744 | - if (self = [super init]) { | |
| 18745 | - if (![dict[@"UseSerializers"] isKindOfClass:NSNumber.class]) return nil; | |
| 18746 | - if ([dict[@"UseSerializers"] doubleValue] != [dict[@"UseSerializers"] longLongValue]) return nil; | |
| 18747 | - [self setValuesForKeysWithDictionary:dict]; | |
| 18748 | - } | |
| 18749 | - return self; | |
| 18750 | -} | |
| 18751 | - | |
| 18752 | -- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 18753 | -{ | |
| 18754 | - id resolved = QTUseSerializers.properties[key]; | |
| 18755 | - if (resolved) [super setValue:value forKey:resolved]; | |
| 18756 | -} | |
| 18757 | - | |
| 18758 | -- (void)setNilValueForKey:(NSString *)key | |
| 18759 | -{ | |
| 18760 | - id resolved = QTUseSerializers.properties[key]; | |
| 18761 | - if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 18762 | -} | |
| 18763 | - | |
| 18764 | -- (NSDictionary *)JSONDictionary | |
| 18765 | -{ | |
| 18766 | - id dict = [[self dictionaryWithValuesForKeys:QTUseSerializers.properties.allValues] mutableCopy]; | |
| 18767 | - | |
| 18768 | - for (id jsonName in QTUseSerializers.properties) { | |
| 18769 | - id propertyName = QTUseSerializers.properties[jsonName]; | |
| 18770 | - if (![jsonName isEqualToString:propertyName]) { | |
| 18771 | - dict[jsonName] = dict[propertyName]; | |
| 18772 | - [dict removeObjectForKey:propertyName]; | |
| 18773 | - } | |
| 18774 | - } | |
| 18775 | - | |
| 18776 | - return dict; | |
| 18777 | -} | |
| 18778 | -@end | |
| 18779 | - | |
| 18780 | 18681 | @implementation QTObj6 |
| 18781 | 18682 | + (NSDictionary<NSString *, NSString *> *)properties |
| 18782 | 18683 | { |
| @@ -18787,6 +18688,9 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 18787 | 18688 | @"void": @"obj6Void", |
| 18788 | 18689 | @"volatile": @"obj6Volatile", |
| 18789 | 18690 | @"while": @"obj6While", |
| 18691 | + @"unowned": @"unowned", | |
| 18692 | + @"unsafe": @"unsafe", | |
| 18693 | + @"UseSerializers": @"useSerializers", | |
| 18790 | 18694 | @"ushort": @"ushort", |
| 18791 | 18695 | @"using": @"using", |
| 18792 | 18696 | @"Utf8JsonReader": @"utf8JSONReader", |
| @@ -18820,6 +18724,9 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 18820 | 18724 | if (![dict[@"void"] isKindOfClass:NSDictionary.class]) return nil; |
| 18821 | 18725 | if (![dict[@"volatile"] isKindOfClass:NSDictionary.class]) return nil; |
| 18822 | 18726 | if (![dict[@"while"] isKindOfClass:NSDictionary.class]) return nil; |
| 18727 | + if (![dict[@"unowned"] isKindOfClass:NSDictionary.class]) return nil; | |
| 18728 | + if (![dict[@"unsafe"] isKindOfClass:NSDictionary.class]) return nil; | |
| 18729 | + if (![dict[@"UseSerializers"] isKindOfClass:NSDictionary.class]) return nil; | |
| 18823 | 18730 | if (![dict[@"ushort"] isKindOfClass:NSDictionary.class]) return nil; |
| 18824 | 18731 | if (![dict[@"using"] isKindOfClass:NSDictionary.class]) return nil; |
| 18825 | 18732 | if (![dict[@"Utf8JsonReader"] isKindOfClass:NSDictionary.class]) return nil; |
| @@ -18845,6 +18752,12 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 18845 | 18752 | if (!_obj6Volatile && dict[@"volatile"] && ![dict[@"volatile"] isKindOfClass:NSNull.class]) return nil; |
| 18846 | 18753 | _obj6While = [QTWhile fromJSONDictionary:(id)_obj6While]; |
| 18847 | 18754 | if (!_obj6While && dict[@"while"] && ![dict[@"while"] isKindOfClass:NSNull.class]) return nil; |
| 18755 | + _unowned = [QTUnowned fromJSONDictionary:(id)_unowned]; | |
| 18756 | + if (!_unowned && dict[@"unowned"] && ![dict[@"unowned"] isKindOfClass:NSNull.class]) return nil; | |
| 18757 | + _unsafe = [QTUnsafe fromJSONDictionary:(id)_unsafe]; | |
| 18758 | + if (!_unsafe && dict[@"unsafe"] && ![dict[@"unsafe"] isKindOfClass:NSNull.class]) return nil; | |
| 18759 | + _useSerializers = [QTUseSerializers fromJSONDictionary:(id)_useSerializers]; | |
| 18760 | + if (!_useSerializers && dict[@"UseSerializers"] && ![dict[@"UseSerializers"] isKindOfClass:NSNull.class]) return nil; | |
| 18848 | 18761 | _ushort = [QTUshort fromJSONDictionary:(id)_ushort]; |
| 18849 | 18762 | if (!_ushort && dict[@"ushort"] && ![dict[@"ushort"] isKindOfClass:NSNull.class]) return nil; |
| 18850 | 18763 | _using = [QTUsing fromJSONDictionary:(id)_using]; |
| @@ -18910,6 +18823,9 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 18910 | 18823 | @"void": [_obj6Void JSONDictionary], |
| 18911 | 18824 | @"volatile": [_obj6Volatile JSONDictionary], |
| 18912 | 18825 | @"while": [_obj6While JSONDictionary], |
| 18826 | + @"unowned": [_unowned JSONDictionary], | |
| 18827 | + @"unsafe": [_unsafe JSONDictionary], | |
| 18828 | + @"UseSerializers": [_useSerializers JSONDictionary], | |
| 18913 | 18829 | @"ushort": [_ushort JSONDictionary], |
| 18914 | 18830 | @"using": [_using JSONDictionary], |
| 18915 | 18831 | @"Utf8JsonReader": [_utf8JSONReader JSONDictionary], |
| @@ -19140,6 +19056,142 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 19140 | 19056 | } |
| 19141 | 19057 | @end |
| 19142 | 19058 | |
| 19059 | +@implementation QTUnowned | |
| 19060 | ++ (NSDictionary<NSString *, NSString *> *)properties | |
| 19061 | +{ | |
| 19062 | + static NSDictionary<NSString *, NSString *> *properties; | |
| 19063 | + return properties = properties ? properties : @{ | |
| 19064 | + @"unowned": @"unowned", | |
| 19065 | + }; | |
| 19066 | +} | |
| 19067 | + | |
| 19068 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 19069 | +{ | |
| 19070 | + return [dict isKindOfClass:NSDictionary.class] ? [[QTUnowned alloc] initWithJSONDictionary:dict] : nil; | |
| 19071 | +} | |
| 19072 | + | |
| 19073 | +- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 19074 | +{ | |
| 19075 | + if (self = [super init]) { | |
| 19076 | + if (![dict[@"unowned"] isKindOfClass:NSNumber.class]) return nil; | |
| 19077 | + if ([dict[@"unowned"] doubleValue] != [dict[@"unowned"] longLongValue]) return nil; | |
| 19078 | + [self setValuesForKeysWithDictionary:dict]; | |
| 19079 | + } | |
| 19080 | + return self; | |
| 19081 | +} | |
| 19082 | + | |
| 19083 | +- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 19084 | +{ | |
| 19085 | + id resolved = QTUnowned.properties[key]; | |
| 19086 | + if (resolved) [super setValue:value forKey:resolved]; | |
| 19087 | +} | |
| 19088 | + | |
| 19089 | +- (void)setNilValueForKey:(NSString *)key | |
| 19090 | +{ | |
| 19091 | + id resolved = QTUnowned.properties[key]; | |
| 19092 | + if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 19093 | +} | |
| 19094 | + | |
| 19095 | +- (NSDictionary *)JSONDictionary | |
| 19096 | +{ | |
| 19097 | + return [self dictionaryWithValuesForKeys:QTUnowned.properties.allValues]; | |
| 19098 | +} | |
| 19099 | +@end | |
| 19100 | + | |
| 19101 | +@implementation QTUnsafe | |
| 19102 | ++ (NSDictionary<NSString *, NSString *> *)properties | |
| 19103 | +{ | |
| 19104 | + static NSDictionary<NSString *, NSString *> *properties; | |
| 19105 | + return properties = properties ? properties : @{ | |
| 19106 | + @"unsafe": @"unsafe", | |
| 19107 | + }; | |
| 19108 | +} | |
| 19109 | + | |
| 19110 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 19111 | +{ | |
| 19112 | + return [dict isKindOfClass:NSDictionary.class] ? [[QTUnsafe alloc] initWithJSONDictionary:dict] : nil; | |
| 19113 | +} | |
| 19114 | + | |
| 19115 | +- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 19116 | +{ | |
| 19117 | + if (self = [super init]) { | |
| 19118 | + if (![dict[@"unsafe"] isKindOfClass:NSNumber.class]) return nil; | |
| 19119 | + if ([dict[@"unsafe"] doubleValue] != [dict[@"unsafe"] longLongValue]) return nil; | |
| 19120 | + [self setValuesForKeysWithDictionary:dict]; | |
| 19121 | + } | |
| 19122 | + return self; | |
| 19123 | +} | |
| 19124 | + | |
| 19125 | +- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 19126 | +{ | |
| 19127 | + id resolved = QTUnsafe.properties[key]; | |
| 19128 | + if (resolved) [super setValue:value forKey:resolved]; | |
| 19129 | +} | |
| 19130 | + | |
| 19131 | +- (void)setNilValueForKey:(NSString *)key | |
| 19132 | +{ | |
| 19133 | + id resolved = QTUnsafe.properties[key]; | |
| 19134 | + if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 19135 | +} | |
| 19136 | + | |
| 19137 | +- (NSDictionary *)JSONDictionary | |
| 19138 | +{ | |
| 19139 | + return [self dictionaryWithValuesForKeys:QTUnsafe.properties.allValues]; | |
| 19140 | +} | |
| 19141 | +@end | |
| 19142 | + | |
| 19143 | +@implementation QTUseSerializers | |
| 19144 | ++ (NSDictionary<NSString *, NSString *> *)properties | |
| 19145 | +{ | |
| 19146 | + static NSDictionary<NSString *, NSString *> *properties; | |
| 19147 | + return properties = properties ? properties : @{ | |
| 19148 | + @"UseSerializers": @"useSerializers", | |
| 19149 | + }; | |
| 19150 | +} | |
| 19151 | + | |
| 19152 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 19153 | +{ | |
| 19154 | + return [dict isKindOfClass:NSDictionary.class] ? [[QTUseSerializers alloc] initWithJSONDictionary:dict] : nil; | |
| 19155 | +} | |
| 19156 | + | |
| 19157 | +- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 19158 | +{ | |
| 19159 | + if (self = [super init]) { | |
| 19160 | + if (![dict[@"UseSerializers"] isKindOfClass:NSNumber.class]) return nil; | |
| 19161 | + if ([dict[@"UseSerializers"] doubleValue] != [dict[@"UseSerializers"] longLongValue]) return nil; | |
| 19162 | + [self setValuesForKeysWithDictionary:dict]; | |
| 19163 | + } | |
| 19164 | + return self; | |
| 19165 | +} | |
| 19166 | + | |
| 19167 | +- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 19168 | +{ | |
| 19169 | + id resolved = QTUseSerializers.properties[key]; | |
| 19170 | + if (resolved) [super setValue:value forKey:resolved]; | |
| 19171 | +} | |
| 19172 | + | |
| 19173 | +- (void)setNilValueForKey:(NSString *)key | |
| 19174 | +{ | |
| 19175 | + id resolved = QTUseSerializers.properties[key]; | |
| 19176 | + if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 19177 | +} | |
| 19178 | + | |
| 19179 | +- (NSDictionary *)JSONDictionary | |
| 19180 | +{ | |
| 19181 | + id dict = [[self dictionaryWithValuesForKeys:QTUseSerializers.properties.allValues] mutableCopy]; | |
| 19182 | + | |
| 19183 | + for (id jsonName in QTUseSerializers.properties) { | |
| 19184 | + id propertyName = QTUseSerializers.properties[jsonName]; | |
| 19185 | + if (![jsonName isEqualToString:propertyName]) { | |
| 19186 | + dict[jsonName] = dict[propertyName]; | |
| 19187 | + [dict removeObjectForKey:propertyName]; | |
| 19188 | + } | |
| 19189 | + } | |
| 19190 | + | |
| 19191 | + return dict; | |
| 19192 | +} | |
| 19193 | +@end | |
| 19194 | + | |
| 19143 | 19195 | @implementation QTUshort |
| 19144 | 19196 | + (NSDictionary<NSString *, NSString *> *)properties |
| 19145 | 19197 | { |
Mphpdefault / TopLevel.php+1,800 −1,641
| @@ -21128,6 +21128,7 @@ class Obj3 { | ||
| 21128 | 21128 | private LocaleClass $locale; // json:Locale Required |
| 21129 | 21129 | private Lock $lock; // json:lock Required |
| 21130 | 21130 | private Long $long; // json:long Required |
| 21131 | + private MakeDictEncoder $makeDictEncoder; // json:makeDictEncoder Required | |
| 21131 | 21132 | private Map $map; // json:map Required |
| 21132 | 21133 | private MapEntry $mapEntry; // json:MapEntry Required |
| 21133 | 21134 | private MarshalJSON $marshalJSON; // json:MarshalJSON Required |
| @@ -21139,8 +21140,6 @@ class Obj3 { | ||
| 21139 | 21140 | private Native $native; // json:native Required |
| 21140 | 21141 | private NewClass $new; // json:new Required |
| 21141 | 21142 | private Newtonsoft $newtonsoft; // json:newtonsoft Required |
| 21142 | - private Nil $nil; // json:nil Required | |
| 21143 | - private No $no; // json:NO Required | |
| 21144 | 21143 | |
| 21145 | 21144 | /** |
| 21146 | 21145 | * @param int $dummy |
| @@ -21196,6 +21195,7 @@ class Obj3 { | ||
| 21196 | 21195 | * @param LocaleClass $locale |
| 21197 | 21196 | * @param Lock $lock |
| 21198 | 21197 | * @param Long $long |
| 21198 | + * @param MakeDictEncoder $makeDictEncoder | |
| 21199 | 21199 | * @param Map $map |
| 21200 | 21200 | * @param MapEntry $mapEntry |
| 21201 | 21201 | * @param MarshalJSON $marshalJSON |
| @@ -21207,10 +21207,8 @@ class Obj3 { | ||
| 21207 | 21207 | * @param Native $native |
| 21208 | 21208 | * @param NewClass $new |
| 21209 | 21209 | * @param Newtonsoft $newtonsoft |
| 21210 | - * @param Nil $nil | |
| 21211 | - * @param No $no | |
| 21212 | 21210 | */ |
| 21213 | - public function __construct(int $dummy, GotoClass $goto, Guard $guard, HasOwnProperty $hasOwnProperty, HashCode $hashCode, Hashable $hashable, Hasher $hasher, ID $id, IfClass $if, Imp $imp, ImplementsClass $implements, Implicit $implicit, Import $import, In $in, Indirect $indirect, Infix $infix, Init $init, Inline $inline, Inout $inout, InstanceofClass $instanceof, IntClass $int, InterfaceClass $interface, Internal $internal, Is $is, ISODateTimeOffsetConverter $isoDateTimeOffsetConverter, IterableClass $iterable, Jdec $jdec, Jenc $jenc, Jpipe $jpipe, JSON $json, JSONAny $jsonAny, JSONCodingKey $jsonCodingKey, JSONConverter $jsonConverter, JSONDecoder $jsonDecoder, JSONEncoder $jsonEncoder, JSONExceptionClass $jsonException, JSONGenerator $jsonGenerator, JSONNode $jsonNode, JSONNull $jsonNull, JSONParser $jsonParser, JSONReader $jsonReader, JSONSerializer $jsonSerializer, JSONToken $jsonToken, JSONTokenType $jsonTokenType, JSONWriter $jsonWriter, Lambda $lambda, Lazy $lazy, Left $left, Let $let, ListClass $list, LocaleClass $locale, Lock $lock, Long $long, Map $map, MapEntry $mapEntry, MarshalJSON $marshalJSON, MetadataPropertyHandling $metadataPropertyHandling, Module $module, Mutable $mutable, Mutating $mutating, NamespaceClass $namespace, Native $native, NewClass $new, Newtonsoft $newtonsoft, Nil $nil, No $no) { | |
| 21211 | + public function __construct(int $dummy, GotoClass $goto, Guard $guard, HasOwnProperty $hasOwnProperty, HashCode $hashCode, Hashable $hashable, Hasher $hasher, ID $id, IfClass $if, Imp $imp, ImplementsClass $implements, Implicit $implicit, Import $import, In $in, Indirect $indirect, Infix $infix, Init $init, Inline $inline, Inout $inout, InstanceofClass $instanceof, IntClass $int, InterfaceClass $interface, Internal $internal, Is $is, ISODateTimeOffsetConverter $isoDateTimeOffsetConverter, IterableClass $iterable, Jdec $jdec, Jenc $jenc, Jpipe $jpipe, JSON $json, JSONAny $jsonAny, JSONCodingKey $jsonCodingKey, JSONConverter $jsonConverter, JSONDecoder $jsonDecoder, JSONEncoder $jsonEncoder, JSONExceptionClass $jsonException, JSONGenerator $jsonGenerator, JSONNode $jsonNode, JSONNull $jsonNull, JSONParser $jsonParser, JSONReader $jsonReader, JSONSerializer $jsonSerializer, JSONToken $jsonToken, JSONTokenType $jsonTokenType, JSONWriter $jsonWriter, Lambda $lambda, Lazy $lazy, Left $left, Let $let, ListClass $list, LocaleClass $locale, Lock $lock, Long $long, MakeDictEncoder $makeDictEncoder, Map $map, MapEntry $mapEntry, MarshalJSON $marshalJSON, MetadataPropertyHandling $metadataPropertyHandling, Module $module, Mutable $mutable, Mutating $mutating, NamespaceClass $namespace, Native $native, NewClass $new, Newtonsoft $newtonsoft) { | |
| 21214 | 21212 | $this->dummy = $dummy; |
| 21215 | 21213 | $this->goto = $goto; |
| 21216 | 21214 | $this->guard = $guard; |
| @@ -21264,6 +21262,7 @@ class Obj3 { | ||
| 21264 | 21262 | $this->locale = $locale; |
| 21265 | 21263 | $this->lock = $lock; |
| 21266 | 21264 | $this->long = $long; |
| 21265 | + $this->makeDictEncoder = $makeDictEncoder; | |
| 21267 | 21266 | $this->map = $map; |
| 21268 | 21267 | $this->mapEntry = $mapEntry; |
| 21269 | 21268 | $this->marshalJSON = $marshalJSON; |
| @@ -21275,8 +21274,6 @@ class Obj3 { | ||
| 21275 | 21274 | $this->native = $native; |
| 21276 | 21275 | $this->new = $new; |
| 21277 | 21276 | $this->newtonsoft = $newtonsoft; |
| 21278 | - $this->nil = $nil; | |
| 21279 | - $this->no = $no; | |
| 21280 | 21277 | } |
| 21281 | 21278 | |
| 21282 | 21279 | /** |
| @@ -23822,6 +23819,54 @@ class Obj3 { | ||
| 23822 | 23819 | return Long::sample(); /*83:long*/ |
| 23823 | 23820 | } |
| 23824 | 23821 | |
| 23822 | + /** | |
| 23823 | + * @param stdClass $value | |
| 23824 | + * @throws Exception | |
| 23825 | + * @return MakeDictEncoder | |
| 23826 | + */ | |
| 23827 | + public static function fromMakeDictEncoder(stdClass $value): MakeDictEncoder { | |
| 23828 | + return MakeDictEncoder::from($value); /*class*/ | |
| 23829 | + } | |
| 23830 | + | |
| 23831 | + /** | |
| 23832 | + * @throws Exception | |
| 23833 | + * @return stdClass | |
| 23834 | + */ | |
| 23835 | + public function toMakeDictEncoder(): stdClass { | |
| 23836 | + if (Obj3::validateMakeDictEncoder($this->makeDictEncoder)) { | |
| 23837 | + return $this->makeDictEncoder->to(); /*class*/ | |
| 23838 | + } | |
| 23839 | + throw new Exception('never get to this Obj3::makeDictEncoder'); | |
| 23840 | + } | |
| 23841 | + | |
| 23842 | + /** | |
| 23843 | + * @param MakeDictEncoder | |
| 23844 | + * @return bool | |
| 23845 | + * @throws Exception | |
| 23846 | + */ | |
| 23847 | + public static function validateMakeDictEncoder(MakeDictEncoder $value): bool { | |
| 23848 | + $value->validate(); | |
| 23849 | + return true; | |
| 23850 | + } | |
| 23851 | + | |
| 23852 | + /** | |
| 23853 | + * @throws Exception | |
| 23854 | + * @return MakeDictEncoder | |
| 23855 | + */ | |
| 23856 | + public function getMakeDictEncoder(): MakeDictEncoder { | |
| 23857 | + if (Obj3::validateMakeDictEncoder($this->makeDictEncoder)) { | |
| 23858 | + return $this->makeDictEncoder; | |
| 23859 | + } | |
| 23860 | + throw new Exception('never get to getMakeDictEncoder Obj3::makeDictEncoder'); | |
| 23861 | + } | |
| 23862 | + | |
| 23863 | + /** | |
| 23864 | + * @return MakeDictEncoder | |
| 23865 | + */ | |
| 23866 | + public static function sampleMakeDictEncoder(): MakeDictEncoder { | |
| 23867 | + return MakeDictEncoder::sample(); /*84:makeDictEncoder*/ | |
| 23868 | + } | |
| 23869 | + | |
| 23825 | 23870 | /** |
| 23826 | 23871 | * @param stdClass $value |
| 23827 | 23872 | * @throws Exception |
| @@ -23867,7 +23912,7 @@ class Obj3 { | ||
| 23867 | 23912 | * @return Map |
| 23868 | 23913 | */ |
| 23869 | 23914 | public static function sampleMap(): Map { |
| 23870 | - return Map::sample(); /*84:map*/ | |
| 23915 | + return Map::sample(); /*85:map*/ | |
| 23871 | 23916 | } |
| 23872 | 23917 | |
| 23873 | 23918 | /** |
| @@ -23915,7 +23960,7 @@ class Obj3 { | ||
| 23915 | 23960 | * @return MapEntry |
| 23916 | 23961 | */ |
| 23917 | 23962 | public static function sampleMapEntry(): MapEntry { |
| 23918 | - return MapEntry::sample(); /*85:mapEntry*/ | |
| 23963 | + return MapEntry::sample(); /*86:mapEntry*/ | |
| 23919 | 23964 | } |
| 23920 | 23965 | |
| 23921 | 23966 | /** |
| @@ -23963,7 +24008,7 @@ class Obj3 { | ||
| 23963 | 24008 | * @return MarshalJSON |
| 23964 | 24009 | */ |
| 23965 | 24010 | public static function sampleMarshalJSON(): MarshalJSON { |
| 23966 | - return MarshalJSON::sample(); /*86:marshalJSON*/ | |
| 24011 | + return MarshalJSON::sample(); /*87:marshalJSON*/ | |
| 23967 | 24012 | } |
| 23968 | 24013 | |
| 23969 | 24014 | /** |
| @@ -24011,7 +24056,7 @@ class Obj3 { | ||
| 24011 | 24056 | * @return MetadataPropertyHandling |
| 24012 | 24057 | */ |
| 24013 | 24058 | public static function sampleMetadataPropertyHandling(): MetadataPropertyHandling { |
| 24014 | - return MetadataPropertyHandling::sample(); /*87:metadataPropertyHandling*/ | |
| 24059 | + return MetadataPropertyHandling::sample(); /*88:metadataPropertyHandling*/ | |
| 24015 | 24060 | } |
| 24016 | 24061 | |
| 24017 | 24062 | /** |
| @@ -24059,7 +24104,7 @@ class Obj3 { | ||
| 24059 | 24104 | * @return Module |
| 24060 | 24105 | */ |
| 24061 | 24106 | public static function sampleModule(): Module { |
| 24062 | - return Module::sample(); /*88:module*/ | |
| 24107 | + return Module::sample(); /*89:module*/ | |
| 24063 | 24108 | } |
| 24064 | 24109 | |
| 24065 | 24110 | /** |
| @@ -24107,7 +24152,7 @@ class Obj3 { | ||
| 24107 | 24152 | * @return Mutable |
| 24108 | 24153 | */ |
| 24109 | 24154 | public static function sampleMutable(): Mutable { |
| 24110 | - return Mutable::sample(); /*89:mutable*/ | |
| 24155 | + return Mutable::sample(); /*90:mutable*/ | |
| 24111 | 24156 | } |
| 24112 | 24157 | |
| 24113 | 24158 | /** |
| @@ -24155,7 +24200,7 @@ class Obj3 { | ||
| 24155 | 24200 | * @return Mutating |
| 24156 | 24201 | */ |
| 24157 | 24202 | public static function sampleMutating(): Mutating { |
| 24158 | - return Mutating::sample(); /*90:mutating*/ | |
| 24203 | + return Mutating::sample(); /*91:mutating*/ | |
| 24159 | 24204 | } |
| 24160 | 24205 | |
| 24161 | 24206 | /** |
| @@ -24203,7 +24248,7 @@ class Obj3 { | ||
| 24203 | 24248 | * @return NamespaceClass |
| 24204 | 24249 | */ |
| 24205 | 24250 | public static function sampleNamespace(): NamespaceClass { |
| 24206 | - return NamespaceClass::sample(); /*91:namespace*/ | |
| 24251 | + return NamespaceClass::sample(); /*92:namespace*/ | |
| 24207 | 24252 | } |
| 24208 | 24253 | |
| 24209 | 24254 | /** |
| @@ -24251,7 +24296,7 @@ class Obj3 { | ||
| 24251 | 24296 | * @return Native |
| 24252 | 24297 | */ |
| 24253 | 24298 | public static function sampleNative(): Native { |
| 24254 | - return Native::sample(); /*92:native*/ | |
| 24299 | + return Native::sample(); /*93:native*/ | |
| 24255 | 24300 | } |
| 24256 | 24301 | |
| 24257 | 24302 | /** |
| @@ -24299,7 +24344,7 @@ class Obj3 { | ||
| 24299 | 24344 | * @return NewClass |
| 24300 | 24345 | */ |
| 24301 | 24346 | public static function sampleNew(): NewClass { |
| 24302 | - return NewClass::sample(); /*93:new*/ | |
| 24347 | + return NewClass::sample(); /*94:new*/ | |
| 24303 | 24348 | } |
| 24304 | 24349 | |
| 24305 | 24350 | /** |
| @@ -24347,103 +24392,7 @@ class Obj3 { | ||
| 24347 | 24392 | * @return Newtonsoft |
| 24348 | 24393 | */ |
| 24349 | 24394 | public static function sampleNewtonsoft(): Newtonsoft { |
| 24350 | - return Newtonsoft::sample(); /*94:newtonsoft*/ | |
| 24351 | - } | |
| 24352 | - | |
| 24353 | - /** | |
| 24354 | - * @param stdClass $value | |
| 24355 | - * @throws Exception | |
| 24356 | - * @return Nil | |
| 24357 | - */ | |
| 24358 | - public static function fromNil(stdClass $value): Nil { | |
| 24359 | - return Nil::from($value); /*class*/ | |
| 24360 | - } | |
| 24361 | - | |
| 24362 | - /** | |
| 24363 | - * @throws Exception | |
| 24364 | - * @return stdClass | |
| 24365 | - */ | |
| 24366 | - public function toNil(): stdClass { | |
| 24367 | - if (Obj3::validateNil($this->nil)) { | |
| 24368 | - return $this->nil->to(); /*class*/ | |
| 24369 | - } | |
| 24370 | - throw new Exception('never get to this Obj3::nil'); | |
| 24371 | - } | |
| 24372 | - | |
| 24373 | - /** | |
| 24374 | - * @param Nil | |
| 24375 | - * @return bool | |
| 24376 | - * @throws Exception | |
| 24377 | - */ | |
| 24378 | - public static function validateNil(Nil $value): bool { | |
| 24379 | - $value->validate(); | |
| 24380 | - return true; | |
| 24381 | - } | |
| 24382 | - | |
| 24383 | - /** | |
| 24384 | - * @throws Exception | |
| 24385 | - * @return Nil | |
| 24386 | - */ | |
| 24387 | - public function getNil(): Nil { | |
| 24388 | - if (Obj3::validateNil($this->nil)) { | |
| 24389 | - return $this->nil; | |
| 24390 | - } | |
| 24391 | - throw new Exception('never get to getNil Obj3::nil'); | |
| 24392 | - } | |
| 24393 | - | |
| 24394 | - /** | |
| 24395 | - * @return Nil | |
| 24396 | - */ | |
| 24397 | - public static function sampleNil(): Nil { | |
| 24398 | - return Nil::sample(); /*95:nil*/ | |
| 24399 | - } | |
| 24400 | - | |
| 24401 | - /** | |
| 24402 | - * @param stdClass $value | |
| 24403 | - * @throws Exception | |
| 24404 | - * @return No | |
| 24405 | - */ | |
| 24406 | - public static function fromNo(stdClass $value): No { | |
| 24407 | - return No::from($value); /*class*/ | |
| 24408 | - } | |
| 24409 | - | |
| 24410 | - /** | |
| 24411 | - * @throws Exception | |
| 24412 | - * @return stdClass | |
| 24413 | - */ | |
| 24414 | - public function toNo(): stdClass { | |
| 24415 | - if (Obj3::validateNo($this->no)) { | |
| 24416 | - return $this->no->to(); /*class*/ | |
| 24417 | - } | |
| 24418 | - throw new Exception('never get to this Obj3::no'); | |
| 24419 | - } | |
| 24420 | - | |
| 24421 | - /** | |
| 24422 | - * @param No | |
| 24423 | - * @return bool | |
| 24424 | - * @throws Exception | |
| 24425 | - */ | |
| 24426 | - public static function validateNo(No $value): bool { | |
| 24427 | - $value->validate(); | |
| 24428 | - return true; | |
| 24429 | - } | |
| 24430 | - | |
| 24431 | - /** | |
| 24432 | - * @throws Exception | |
| 24433 | - * @return No | |
| 24434 | - */ | |
| 24435 | - public function getNo(): No { | |
| 24436 | - if (Obj3::validateNo($this->no)) { | |
| 24437 | - return $this->no; | |
| 24438 | - } | |
| 24439 | - throw new Exception('never get to getNo Obj3::no'); | |
| 24440 | - } | |
| 24441 | - | |
| 24442 | - /** | |
| 24443 | - * @return No | |
| 24444 | - */ | |
| 24445 | - public static function sampleNo(): No { | |
| 24446 | - return No::sample(); /*96:no*/ | |
| 24395 | + return Newtonsoft::sample(); /*95:newtonsoft*/ | |
| 24447 | 24396 | } |
| 24448 | 24397 | |
| 24449 | 24398 | /** |
| @@ -24504,6 +24453,7 @@ class Obj3 { | ||
| 24504 | 24453 | || Obj3::validateLocale($this->locale) |
| 24505 | 24454 | || Obj3::validateLock($this->lock) |
| 24506 | 24455 | || Obj3::validateLong($this->long) |
| 24456 | + || Obj3::validateMakeDictEncoder($this->makeDictEncoder) | |
| 24507 | 24457 | || Obj3::validateMap($this->map) |
| 24508 | 24458 | || Obj3::validateMapEntry($this->mapEntry) |
| 24509 | 24459 | || Obj3::validateMarshalJSON($this->marshalJSON) |
| @@ -24514,9 +24464,7 @@ class Obj3 { | ||
| 24514 | 24464 | || Obj3::validateNamespace($this->namespace) |
| 24515 | 24465 | || Obj3::validateNative($this->native) |
| 24516 | 24466 | || Obj3::validateNew($this->new) |
| 24517 | - || Obj3::validateNewtonsoft($this->newtonsoft) | |
| 24518 | - || Obj3::validateNil($this->nil) | |
| 24519 | - || Obj3::validateNo($this->no); | |
| 24467 | + || Obj3::validateNewtonsoft($this->newtonsoft); | |
| 24520 | 24468 | } |
| 24521 | 24469 | |
| 24522 | 24470 | /** |
| @@ -24578,6 +24526,7 @@ class Obj3 { | ||
| 24578 | 24526 | $out->{'Locale'} = $this->toLocale(); |
| 24579 | 24527 | $out->{'lock'} = $this->toLock(); |
| 24580 | 24528 | $out->{'long'} = $this->toLong(); |
| 24529 | + $out->{'makeDictEncoder'} = $this->toMakeDictEncoder(); | |
| 24581 | 24530 | $out->{'map'} = $this->toMap(); |
| 24582 | 24531 | $out->{'MapEntry'} = $this->toMapEntry(); |
| 24583 | 24532 | $out->{'MarshalJSON'} = $this->toMarshalJSON(); |
| @@ -24589,8 +24538,6 @@ class Obj3 { | ||
| 24589 | 24538 | $out->{'native'} = $this->toNative(); |
| 24590 | 24539 | $out->{'new'} = $this->toNew(); |
| 24591 | 24540 | $out->{'newtonsoft'} = $this->toNewtonsoft(); |
| 24592 | - $out->{'nil'} = $this->toNil(); | |
| 24593 | - $out->{'NO'} = $this->toNo(); | |
| 24594 | 24541 | return $out; |
| 24595 | 24542 | } |
| 24596 | 24543 | |
| @@ -24759,6 +24706,9 @@ class Obj3 { | ||
| 24759 | 24706 | if (!property_exists($obj, 'long')) { |
| 24760 | 24707 | throw new Exception("Missing required property"); |
| 24761 | 24708 | } |
| 24709 | + if (!property_exists($obj, 'makeDictEncoder')) { | |
| 24710 | + throw new Exception("Missing required property"); | |
| 24711 | + } | |
| 24762 | 24712 | if (!property_exists($obj, 'map')) { |
| 24763 | 24713 | throw new Exception("Missing required property"); |
| 24764 | 24714 | } |
| @@ -24792,12 +24742,6 @@ class Obj3 { | ||
| 24792 | 24742 | if (!property_exists($obj, 'newtonsoft')) { |
| 24793 | 24743 | throw new Exception("Missing required property"); |
| 24794 | 24744 | } |
| 24795 | - if (!property_exists($obj, 'nil')) { | |
| 24796 | - throw new Exception("Missing required property"); | |
| 24797 | - } | |
| 24798 | - if (!property_exists($obj, 'NO')) { | |
| 24799 | - throw new Exception("Missing required property"); | |
| 24800 | - } | |
| 24801 | 24745 | return new Obj3( |
| 24802 | 24746 | Obj3::fromDummy($obj->{'dummy'}) |
| 24803 | 24747 | ,Obj3::fromGoto($obj->{'goto'}) |
| @@ -24852,6 +24796,7 @@ class Obj3 { | ||
| 24852 | 24796 | ,Obj3::fromLocale($obj->{'Locale'}) |
| 24853 | 24797 | ,Obj3::fromLock($obj->{'lock'}) |
| 24854 | 24798 | ,Obj3::fromLong($obj->{'long'}) |
| 24799 | + ,Obj3::fromMakeDictEncoder($obj->{'makeDictEncoder'}) | |
| 24855 | 24800 | ,Obj3::fromMap($obj->{'map'}) |
| 24856 | 24801 | ,Obj3::fromMapEntry($obj->{'MapEntry'}) |
| 24857 | 24802 | ,Obj3::fromMarshalJSON($obj->{'MarshalJSON'}) |
| @@ -24863,8 +24808,6 @@ class Obj3 { | ||
| 24863 | 24808 | ,Obj3::fromNative($obj->{'native'}) |
| 24864 | 24809 | ,Obj3::fromNew($obj->{'new'}) |
| 24865 | 24810 | ,Obj3::fromNewtonsoft($obj->{'newtonsoft'}) |
| 24866 | - ,Obj3::fromNil($obj->{'nil'}) | |
| 24867 | - ,Obj3::fromNo($obj->{'NO'}) | |
| 24868 | 24811 | ); |
| 24869 | 24812 | } |
| 24870 | 24813 | |
| @@ -24926,6 +24869,7 @@ class Obj3 { | ||
| 24926 | 24869 | ,Obj3::sampleLocale() |
| 24927 | 24870 | ,Obj3::sampleLock() |
| 24928 | 24871 | ,Obj3::sampleLong() |
| 24872 | + ,Obj3::sampleMakeDictEncoder() | |
| 24929 | 24873 | ,Obj3::sampleMap() |
| 24930 | 24874 | ,Obj3::sampleMapEntry() |
| 24931 | 24875 | ,Obj3::sampleMarshalJSON() |
| @@ -24937,8 +24881,6 @@ class Obj3 { | ||
| 24937 | 24881 | ,Obj3::sampleNative() |
| 24938 | 24882 | ,Obj3::sampleNew() |
| 24939 | 24883 | ,Obj3::sampleNewtonsoft() |
| 24940 | - ,Obj3::sampleNil() | |
| 24941 | - ,Obj3::sampleNo() | |
| 24942 | 24884 | ); |
| 24943 | 24885 | } |
| 24944 | 24886 | } |
| @@ -30198,6 +30140,107 @@ class Long { | ||
| 30198 | 30140 | } |
| 30199 | 30141 | } |
| 30200 | 30142 | |
| 30143 | +// This is an autogenerated file:MakeDictEncoder | |
| 30144 | + | |
| 30145 | +class MakeDictEncoder { | |
| 30146 | + private int $makeDictEncoder; // json:makeDictEncoder Required | |
| 30147 | + | |
| 30148 | + /** | |
| 30149 | + * @param int $makeDictEncoder | |
| 30150 | + */ | |
| 30151 | + public function __construct(int $makeDictEncoder) { | |
| 30152 | + $this->makeDictEncoder = $makeDictEncoder; | |
| 30153 | + } | |
| 30154 | + | |
| 30155 | + /** | |
| 30156 | + * @param int $value | |
| 30157 | + * @throws Exception | |
| 30158 | + * @return int | |
| 30159 | + */ | |
| 30160 | + public static function fromMakeDictEncoder(int $value): int { | |
| 30161 | + return $value; /*int*/ | |
| 30162 | + } | |
| 30163 | + | |
| 30164 | + /** | |
| 30165 | + * @throws Exception | |
| 30166 | + * @return int | |
| 30167 | + */ | |
| 30168 | + public function toMakeDictEncoder(): int { | |
| 30169 | + if (MakeDictEncoder::validateMakeDictEncoder($this->makeDictEncoder)) { | |
| 30170 | + return $this->makeDictEncoder; /*int*/ | |
| 30171 | + } | |
| 30172 | + throw new Exception('never get to this MakeDictEncoder::makeDictEncoder'); | |
| 30173 | + } | |
| 30174 | + | |
| 30175 | + /** | |
| 30176 | + * @param int | |
| 30177 | + * @return bool | |
| 30178 | + * @throws Exception | |
| 30179 | + */ | |
| 30180 | + public static function validateMakeDictEncoder(int $value): bool { | |
| 30181 | + return true; | |
| 30182 | + } | |
| 30183 | + | |
| 30184 | + /** | |
| 30185 | + * @throws Exception | |
| 30186 | + * @return int | |
| 30187 | + */ | |
| 30188 | + public function getMakeDictEncoder(): int { | |
| 30189 | + if (MakeDictEncoder::validateMakeDictEncoder($this->makeDictEncoder)) { | |
| 30190 | + return $this->makeDictEncoder; | |
| 30191 | + } | |
| 30192 | + throw new Exception('never get to getMakeDictEncoder MakeDictEncoder::makeDictEncoder'); | |
| 30193 | + } | |
| 30194 | + | |
| 30195 | + /** | |
| 30196 | + * @return int | |
| 30197 | + */ | |
| 30198 | + public static function sampleMakeDictEncoder(): int { | |
| 30199 | + return 31; /*31:makeDictEncoder*/ | |
| 30200 | + } | |
| 30201 | + | |
| 30202 | + /** | |
| 30203 | + * @throws Exception | |
| 30204 | + * @return bool | |
| 30205 | + */ | |
| 30206 | + public function validate(): bool { | |
| 30207 | + return MakeDictEncoder::validateMakeDictEncoder($this->makeDictEncoder); | |
| 30208 | + } | |
| 30209 | + | |
| 30210 | + /** | |
| 30211 | + * @return stdClass | |
| 30212 | + * @throws Exception | |
| 30213 | + */ | |
| 30214 | + public function to(): stdClass { | |
| 30215 | + $out = new stdClass(); | |
| 30216 | + $out->{'makeDictEncoder'} = $this->toMakeDictEncoder(); | |
| 30217 | + return $out; | |
| 30218 | + } | |
| 30219 | + | |
| 30220 | + /** | |
| 30221 | + * @param stdClass $obj | |
| 30222 | + * @return MakeDictEncoder | |
| 30223 | + * @throws Exception | |
| 30224 | + */ | |
| 30225 | + public static function from(stdClass $obj): MakeDictEncoder { | |
| 30226 | + if (!property_exists($obj, 'makeDictEncoder')) { | |
| 30227 | + throw new Exception("Missing required property"); | |
| 30228 | + } | |
| 30229 | + return new MakeDictEncoder( | |
| 30230 | + MakeDictEncoder::fromMakeDictEncoder($obj->{'makeDictEncoder'}) | |
| 30231 | + ); | |
| 30232 | + } | |
| 30233 | + | |
| 30234 | + /** | |
| 30235 | + * @return MakeDictEncoder | |
| 30236 | + */ | |
| 30237 | + public static function sample(): MakeDictEncoder { | |
| 30238 | + return new MakeDictEncoder( | |
| 30239 | + MakeDictEncoder::sampleMakeDictEncoder() | |
| 30240 | + ); | |
| 30241 | + } | |
| 30242 | +} | |
| 30243 | + | |
| 30201 | 30244 | // This is an autogenerated file:Map |
| 30202 | 30245 | |
| 30203 | 30246 | class Map { |
| @@ -31309,212 +31352,12 @@ class Newtonsoft { | ||
| 31309 | 31352 | } |
| 31310 | 31353 | } |
| 31311 | 31354 | |
| 31312 | -// This is an autogenerated file:Nil | |
| 31313 | - | |
| 31314 | -class Nil { | |
| 31315 | - private int $nil; // json:nil Required | |
| 31316 | - | |
| 31317 | - /** | |
| 31318 | - * @param int $nil | |
| 31319 | - */ | |
| 31320 | - public function __construct(int $nil) { | |
| 31321 | - $this->nil = $nil; | |
| 31322 | - } | |
| 31323 | - | |
| 31324 | - /** | |
| 31325 | - * @param int $value | |
| 31326 | - * @throws Exception | |
| 31327 | - * @return int | |
| 31328 | - */ | |
| 31329 | - public static function fromNil(int $value): int { | |
| 31330 | - return $value; /*int*/ | |
| 31331 | - } | |
| 31332 | - | |
| 31333 | - /** | |
| 31334 | - * @throws Exception | |
| 31335 | - * @return int | |
| 31336 | - */ | |
| 31337 | - public function toNil(): int { | |
| 31338 | - if (Nil::validateNil($this->nil)) { | |
| 31339 | - return $this->nil; /*int*/ | |
| 31340 | - } | |
| 31341 | - throw new Exception('never get to this Nil::nil'); | |
| 31342 | - } | |
| 31343 | - | |
| 31344 | - /** | |
| 31345 | - * @param int | |
| 31346 | - * @return bool | |
| 31347 | - * @throws Exception | |
| 31348 | - */ | |
| 31349 | - public static function validateNil(int $value): bool { | |
| 31350 | - return true; | |
| 31351 | - } | |
| 31352 | - | |
| 31353 | - /** | |
| 31354 | - * @throws Exception | |
| 31355 | - * @return int | |
| 31356 | - */ | |
| 31357 | - public function getNil(): int { | |
| 31358 | - if (Nil::validateNil($this->nil)) { | |
| 31359 | - return $this->nil; | |
| 31360 | - } | |
| 31361 | - throw new Exception('never get to getNil Nil::nil'); | |
| 31362 | - } | |
| 31363 | - | |
| 31364 | - /** | |
| 31365 | - * @return int | |
| 31366 | - */ | |
| 31367 | - public static function sampleNil(): int { | |
| 31368 | - return 31; /*31:nil*/ | |
| 31369 | - } | |
| 31370 | - | |
| 31371 | - /** | |
| 31372 | - * @throws Exception | |
| 31373 | - * @return bool | |
| 31374 | - */ | |
| 31375 | - public function validate(): bool { | |
| 31376 | - return Nil::validateNil($this->nil); | |
| 31377 | - } | |
| 31378 | - | |
| 31379 | - /** | |
| 31380 | - * @return stdClass | |
| 31381 | - * @throws Exception | |
| 31382 | - */ | |
| 31383 | - public function to(): stdClass { | |
| 31384 | - $out = new stdClass(); | |
| 31385 | - $out->{'nil'} = $this->toNil(); | |
| 31386 | - return $out; | |
| 31387 | - } | |
| 31388 | - | |
| 31389 | - /** | |
| 31390 | - * @param stdClass $obj | |
| 31391 | - * @return Nil | |
| 31392 | - * @throws Exception | |
| 31393 | - */ | |
| 31394 | - public static function from(stdClass $obj): Nil { | |
| 31395 | - if (!property_exists($obj, 'nil')) { | |
| 31396 | - throw new Exception("Missing required property"); | |
| 31397 | - } | |
| 31398 | - return new Nil( | |
| 31399 | - Nil::fromNil($obj->{'nil'}) | |
| 31400 | - ); | |
| 31401 | - } | |
| 31402 | - | |
| 31403 | - /** | |
| 31404 | - * @return Nil | |
| 31405 | - */ | |
| 31406 | - public static function sample(): Nil { | |
| 31407 | - return new Nil( | |
| 31408 | - Nil::sampleNil() | |
| 31409 | - ); | |
| 31410 | - } | |
| 31411 | -} | |
| 31412 | - | |
| 31413 | -// This is an autogenerated file:No | |
| 31414 | - | |
| 31415 | -class No { | |
| 31416 | - private int $no; // json:NO Required | |
| 31417 | - | |
| 31418 | - /** | |
| 31419 | - * @param int $no | |
| 31420 | - */ | |
| 31421 | - public function __construct(int $no) { | |
| 31422 | - $this->no = $no; | |
| 31423 | - } | |
| 31424 | - | |
| 31425 | - /** | |
| 31426 | - * @param int $value | |
| 31427 | - * @throws Exception | |
| 31428 | - * @return int | |
| 31429 | - */ | |
| 31430 | - public static function fromNo(int $value): int { | |
| 31431 | - return $value; /*int*/ | |
| 31432 | - } | |
| 31433 | - | |
| 31434 | - /** | |
| 31435 | - * @throws Exception | |
| 31436 | - * @return int | |
| 31437 | - */ | |
| 31438 | - public function toNo(): int { | |
| 31439 | - if (No::validateNo($this->no)) { | |
| 31440 | - return $this->no; /*int*/ | |
| 31441 | - } | |
| 31442 | - throw new Exception('never get to this No::no'); | |
| 31443 | - } | |
| 31444 | - | |
| 31445 | - /** | |
| 31446 | - * @param int | |
| 31447 | - * @return bool | |
| 31448 | - * @throws Exception | |
| 31449 | - */ | |
| 31450 | - public static function validateNo(int $value): bool { | |
| 31451 | - return true; | |
| 31452 | - } | |
| 31453 | - | |
| 31454 | - /** | |
| 31455 | - * @throws Exception | |
| 31456 | - * @return int | |
| 31457 | - */ | |
| 31458 | - public function getNo(): int { | |
| 31459 | - if (No::validateNo($this->no)) { | |
| 31460 | - return $this->no; | |
| 31461 | - } | |
| 31462 | - throw new Exception('never get to getNo No::no'); | |
| 31463 | - } | |
| 31464 | - | |
| 31465 | - /** | |
| 31466 | - * @return int | |
| 31467 | - */ | |
| 31468 | - public static function sampleNo(): int { | |
| 31469 | - return 31; /*31:no*/ | |
| 31470 | - } | |
| 31471 | - | |
| 31472 | - /** | |
| 31473 | - * @throws Exception | |
| 31474 | - * @return bool | |
| 31475 | - */ | |
| 31476 | - public function validate(): bool { | |
| 31477 | - return No::validateNo($this->no); | |
| 31478 | - } | |
| 31479 | - | |
| 31480 | - /** | |
| 31481 | - * @return stdClass | |
| 31482 | - * @throws Exception | |
| 31483 | - */ | |
| 31484 | - public function to(): stdClass { | |
| 31485 | - $out = new stdClass(); | |
| 31486 | - $out->{'NO'} = $this->toNo(); | |
| 31487 | - return $out; | |
| 31488 | - } | |
| 31489 | - | |
| 31490 | - /** | |
| 31491 | - * @param stdClass $obj | |
| 31492 | - * @return No | |
| 31493 | - * @throws Exception | |
| 31494 | - */ | |
| 31495 | - public static function from(stdClass $obj): No { | |
| 31496 | - if (!property_exists($obj, 'NO')) { | |
| 31497 | - throw new Exception("Missing required property"); | |
| 31498 | - } | |
| 31499 | - return new No( | |
| 31500 | - No::fromNo($obj->{'NO'}) | |
| 31501 | - ); | |
| 31502 | - } | |
| 31503 | - | |
| 31504 | - /** | |
| 31505 | - * @return No | |
| 31506 | - */ | |
| 31507 | - public static function sample(): No { | |
| 31508 | - return new No( | |
| 31509 | - No::sampleNo() | |
| 31510 | - ); | |
| 31511 | - } | |
| 31512 | -} | |
| 31513 | - | |
| 31514 | -// This is an autogenerated file:Obj4 | |
| 31355 | +// This is an autogenerated file:Obj4 | |
| 31515 | 31356 | |
| 31516 | 31357 | class Obj4 { |
| 31517 | 31358 | private int $dummy; // json:dummy Required |
| 31359 | + private Nil $nil; // json:nil Required | |
| 31360 | + private No $no; // json:NO Required | |
| 31518 | 31361 | private NoSuchMethod $noSuchMethod; // json:noSuchMethod Required |
| 31519 | 31362 | private Noexcept $noexcept; // json:noexcept Required |
| 31520 | 31363 | private Nonatomic $nonatomic; // json:nonatomic Required |
| @@ -31577,11 +31420,11 @@ class Obj4 { | ||
| 31577 | 31420 | private RuntimeType $runtimeType; // json:runtimeType Required |
| 31578 | 31421 | private S $s; // json:s Required |
| 31579 | 31422 | private Sbyte $sbyte; // json:sbyte Required |
| 31580 | - private Sealed $sealed; // json:sealed Required | |
| 31581 | - private Sel $sel; // json:SEL Required | |
| 31582 | 31423 | |
| 31583 | 31424 | /** |
| 31584 | 31425 | * @param int $dummy |
| 31426 | + * @param Nil $nil | |
| 31427 | + * @param No $no | |
| 31585 | 31428 | * @param NoSuchMethod $noSuchMethod |
| 31586 | 31429 | * @param Noexcept $noexcept |
| 31587 | 31430 | * @param Nonatomic $nonatomic |
| @@ -31644,11 +31487,11 @@ class Obj4 { | ||
| 31644 | 31487 | * @param RuntimeType $runtimeType |
| 31645 | 31488 | * @param S $s |
| 31646 | 31489 | * @param Sbyte $sbyte |
| 31647 | - * @param Sealed $sealed | |
| 31648 | - * @param Sel $sel | |
| 31649 | 31490 | */ |
| 31650 | - public function __construct(int $dummy, NoSuchMethod $noSuchMethod, Noexcept $noexcept, Nonatomic $nonatomic, None $none, Nonlocal $nonlocal, Nonmutating $nonmutating, Not $not, NotEq $notEq, NSError $nsError, NSObject $nsObject, NSString $nsString, NULLClass $null, Nullptr $nullptr, Number $number, NoneClass $obj4None, Obj4Null $obj4Null, ProtocolClass $obj4Protocol, ObjectClass $object, ObjectMapper $objectMapper, Of $of, Oneway $oneway, Open $open, Operator $operator, Optional $optional, OrClass $or, OrEq $orEq, Out $out, OverrideClass $override, Package $package, Params $params, Pass $pass, Port $port, Postfix $postfix, Precedence $precedence, Prefix $prefix, PrintClass $print, PrintMembers $printMembers, Printf $printf, PrivateClass $private, ProtectedClass $protected, Protocol $protocol, PublicClass $public, Quicktype $quicktype, Raise $raise, Range $range, ReadonlyClass $readonly, Ref $ref, RegExp $regExp, Register $register, ReinterpretCast $reinterpretCast, Repeat $repeat, RequireClass $require, Required $required, Requires $requires, Restrict $restrict, Retain $retain, Rethrows $rethrows, ReturnClass $return, Right $right, RuntimeType $runtimeType, S $s, Sbyte $sbyte, Sealed $sealed, Sel $sel) { | |
| 31491 | + public function __construct(int $dummy, Nil $nil, No $no, NoSuchMethod $noSuchMethod, Noexcept $noexcept, Nonatomic $nonatomic, None $none, Nonlocal $nonlocal, Nonmutating $nonmutating, Not $not, NotEq $notEq, NSError $nsError, NSObject $nsObject, NSString $nsString, NULLClass $null, Nullptr $nullptr, Number $number, NoneClass $obj4None, Obj4Null $obj4Null, ProtocolClass $obj4Protocol, ObjectClass $object, ObjectMapper $objectMapper, Of $of, Oneway $oneway, Open $open, Operator $operator, Optional $optional, OrClass $or, OrEq $orEq, Out $out, OverrideClass $override, Package $package, Params $params, Pass $pass, Port $port, Postfix $postfix, Precedence $precedence, Prefix $prefix, PrintClass $print, PrintMembers $printMembers, Printf $printf, PrivateClass $private, ProtectedClass $protected, Protocol $protocol, PublicClass $public, Quicktype $quicktype, Raise $raise, Range $range, ReadonlyClass $readonly, Ref $ref, RegExp $regExp, Register $register, ReinterpretCast $reinterpretCast, Repeat $repeat, RequireClass $require, Required $required, Requires $requires, Restrict $restrict, Retain $retain, Rethrows $rethrows, ReturnClass $return, Right $right, RuntimeType $runtimeType, S $s, Sbyte $sbyte) { | |
| 31651 | 31492 | $this->dummy = $dummy; |
| 31493 | + $this->nil = $nil; | |
| 31494 | + $this->no = $no; | |
| 31652 | 31495 | $this->noSuchMethod = $noSuchMethod; |
| 31653 | 31496 | $this->noexcept = $noexcept; |
| 31654 | 31497 | $this->nonatomic = $nonatomic; |
| @@ -31711,8 +31554,6 @@ class Obj4 { | ||
| 31711 | 31554 | $this->runtimeType = $runtimeType; |
| 31712 | 31555 | $this->s = $s; |
| 31713 | 31556 | $this->sbyte = $sbyte; |
| 31714 | - $this->sealed = $sealed; | |
| 31715 | - $this->sel = $sel; | |
| 31716 | 31557 | } |
| 31717 | 31558 | |
| 31718 | 31559 | /** |
| @@ -31762,6 +31603,102 @@ class Obj4 { | ||
| 31762 | 31603 | return 31; /*31:dummy*/ |
| 31763 | 31604 | } |
| 31764 | 31605 | |
| 31606 | + /** | |
| 31607 | + * @param stdClass $value | |
| 31608 | + * @throws Exception | |
| 31609 | + * @return Nil | |
| 31610 | + */ | |
| 31611 | + public static function fromNil(stdClass $value): Nil { | |
| 31612 | + return Nil::from($value); /*class*/ | |
| 31613 | + } | |
| 31614 | + | |
| 31615 | + /** | |
| 31616 | + * @throws Exception | |
| 31617 | + * @return stdClass | |
| 31618 | + */ | |
| 31619 | + public function toNil(): stdClass { | |
| 31620 | + if (Obj4::validateNil($this->nil)) { | |
| 31621 | + return $this->nil->to(); /*class*/ | |
| 31622 | + } | |
| 31623 | + throw new Exception('never get to this Obj4::nil'); | |
| 31624 | + } | |
| 31625 | + | |
| 31626 | + /** | |
| 31627 | + * @param Nil | |
| 31628 | + * @return bool | |
| 31629 | + * @throws Exception | |
| 31630 | + */ | |
| 31631 | + public static function validateNil(Nil $value): bool { | |
| 31632 | + $value->validate(); | |
| 31633 | + return true; | |
| 31634 | + } | |
| 31635 | + | |
| 31636 | + /** | |
| 31637 | + * @throws Exception | |
| 31638 | + * @return Nil | |
| 31639 | + */ | |
| 31640 | + public function getNil(): Nil { | |
| 31641 | + if (Obj4::validateNil($this->nil)) { | |
| 31642 | + return $this->nil; | |
| 31643 | + } | |
| 31644 | + throw new Exception('never get to getNil Obj4::nil'); | |
| 31645 | + } | |
| 31646 | + | |
| 31647 | + /** | |
| 31648 | + * @return Nil | |
| 31649 | + */ | |
| 31650 | + public static function sampleNil(): Nil { | |
| 31651 | + return Nil::sample(); /*32:nil*/ | |
| 31652 | + } | |
| 31653 | + | |
| 31654 | + /** | |
| 31655 | + * @param stdClass $value | |
| 31656 | + * @throws Exception | |
| 31657 | + * @return No | |
| 31658 | + */ | |
| 31659 | + public static function fromNo(stdClass $value): No { | |
| 31660 | + return No::from($value); /*class*/ | |
| 31661 | + } | |
| 31662 | + | |
| 31663 | + /** | |
| 31664 | + * @throws Exception | |
| 31665 | + * @return stdClass | |
| 31666 | + */ | |
| 31667 | + public function toNo(): stdClass { | |
| 31668 | + if (Obj4::validateNo($this->no)) { | |
| 31669 | + return $this->no->to(); /*class*/ | |
| 31670 | + } | |
| 31671 | + throw new Exception('never get to this Obj4::no'); | |
| 31672 | + } | |
| 31673 | + | |
| 31674 | + /** | |
| 31675 | + * @param No | |
| 31676 | + * @return bool | |
| 31677 | + * @throws Exception | |
| 31678 | + */ | |
| 31679 | + public static function validateNo(No $value): bool { | |
| 31680 | + $value->validate(); | |
| 31681 | + return true; | |
| 31682 | + } | |
| 31683 | + | |
| 31684 | + /** | |
| 31685 | + * @throws Exception | |
| 31686 | + * @return No | |
| 31687 | + */ | |
| 31688 | + public function getNo(): No { | |
| 31689 | + if (Obj4::validateNo($this->no)) { | |
| 31690 | + return $this->no; | |
| 31691 | + } | |
| 31692 | + throw new Exception('never get to getNo Obj4::no'); | |
| 31693 | + } | |
| 31694 | + | |
| 31695 | + /** | |
| 31696 | + * @return No | |
| 31697 | + */ | |
| 31698 | + public static function sampleNo(): No { | |
| 31699 | + return No::sample(); /*33:no*/ | |
| 31700 | + } | |
| 31701 | + | |
| 31765 | 31702 | /** |
| 31766 | 31703 | * @param stdClass $value |
| 31767 | 31704 | * @throws Exception |
| @@ -31807,7 +31744,7 @@ class Obj4 { | ||
| 31807 | 31744 | * @return NoSuchMethod |
| 31808 | 31745 | */ |
| 31809 | 31746 | public static function sampleNoSuchMethod(): NoSuchMethod { |
| 31810 | - return NoSuchMethod::sample(); /*32:noSuchMethod*/ | |
| 31747 | + return NoSuchMethod::sample(); /*34:noSuchMethod*/ | |
| 31811 | 31748 | } |
| 31812 | 31749 | |
| 31813 | 31750 | /** |
| @@ -31855,7 +31792,7 @@ class Obj4 { | ||
| 31855 | 31792 | * @return Noexcept |
| 31856 | 31793 | */ |
| 31857 | 31794 | public static function sampleNoexcept(): Noexcept { |
| 31858 | - return Noexcept::sample(); /*33:noexcept*/ | |
| 31795 | + return Noexcept::sample(); /*35:noexcept*/ | |
| 31859 | 31796 | } |
| 31860 | 31797 | |
| 31861 | 31798 | /** |
| @@ -31903,7 +31840,7 @@ class Obj4 { | ||
| 31903 | 31840 | * @return Nonatomic |
| 31904 | 31841 | */ |
| 31905 | 31842 | public static function sampleNonatomic(): Nonatomic { |
| 31906 | - return Nonatomic::sample(); /*34:nonatomic*/ | |
| 31843 | + return Nonatomic::sample(); /*36:nonatomic*/ | |
| 31907 | 31844 | } |
| 31908 | 31845 | |
| 31909 | 31846 | /** |
| @@ -31951,7 +31888,7 @@ class Obj4 { | ||
| 31951 | 31888 | * @return None |
| 31952 | 31889 | */ |
| 31953 | 31890 | public static function sampleNone(): None { |
| 31954 | - return None::sample(); /*35:none*/ | |
| 31891 | + return None::sample(); /*37:none*/ | |
| 31955 | 31892 | } |
| 31956 | 31893 | |
| 31957 | 31894 | /** |
| @@ -31999,7 +31936,7 @@ class Obj4 { | ||
| 31999 | 31936 | * @return Nonlocal |
| 32000 | 31937 | */ |
| 32001 | 31938 | public static function sampleNonlocal(): Nonlocal { |
| 32002 | - return Nonlocal::sample(); /*36:nonlocal*/ | |
| 31939 | + return Nonlocal::sample(); /*38:nonlocal*/ | |
| 32003 | 31940 | } |
| 32004 | 31941 | |
| 32005 | 31942 | /** |
| @@ -32047,7 +31984,7 @@ class Obj4 { | ||
| 32047 | 31984 | * @return Nonmutating |
| 32048 | 31985 | */ |
| 32049 | 31986 | public static function sampleNonmutating(): Nonmutating { |
| 32050 | - return Nonmutating::sample(); /*37:nonmutating*/ | |
| 31987 | + return Nonmutating::sample(); /*39:nonmutating*/ | |
| 32051 | 31988 | } |
| 32052 | 31989 | |
| 32053 | 31990 | /** |
| @@ -32095,7 +32032,7 @@ class Obj4 { | ||
| 32095 | 32032 | * @return Not |
| 32096 | 32033 | */ |
| 32097 | 32034 | public static function sampleNot(): Not { |
| 32098 | - return Not::sample(); /*38:not*/ | |
| 32035 | + return Not::sample(); /*40:not*/ | |
| 32099 | 32036 | } |
| 32100 | 32037 | |
| 32101 | 32038 | /** |
| @@ -32143,7 +32080,7 @@ class Obj4 { | ||
| 32143 | 32080 | * @return NotEq |
| 32144 | 32081 | */ |
| 32145 | 32082 | public static function sampleNotEq(): NotEq { |
| 32146 | - return NotEq::sample(); /*39:notEq*/ | |
| 32083 | + return NotEq::sample(); /*41:notEq*/ | |
| 32147 | 32084 | } |
| 32148 | 32085 | |
| 32149 | 32086 | /** |
| @@ -32191,7 +32128,7 @@ class Obj4 { | ||
| 32191 | 32128 | * @return NSError |
| 32192 | 32129 | */ |
| 32193 | 32130 | public static function sampleNSError(): NSError { |
| 32194 | - return NSError::sample(); /*40:nsError*/ | |
| 32131 | + return NSError::sample(); /*42:nsError*/ | |
| 32195 | 32132 | } |
| 32196 | 32133 | |
| 32197 | 32134 | /** |
| @@ -32239,7 +32176,7 @@ class Obj4 { | ||
| 32239 | 32176 | * @return NSObject |
| 32240 | 32177 | */ |
| 32241 | 32178 | public static function sampleNSObject(): NSObject { |
| 32242 | - return NSObject::sample(); /*41:nsObject*/ | |
| 32179 | + return NSObject::sample(); /*43:nsObject*/ | |
| 32243 | 32180 | } |
| 32244 | 32181 | |
| 32245 | 32182 | /** |
| @@ -32287,7 +32224,7 @@ class Obj4 { | ||
| 32287 | 32224 | * @return NSString |
| 32288 | 32225 | */ |
| 32289 | 32226 | public static function sampleNSString(): NSString { |
| 32290 | - return NSString::sample(); /*42:nsString*/ | |
| 32227 | + return NSString::sample(); /*44:nsString*/ | |
| 32291 | 32228 | } |
| 32292 | 32229 | |
| 32293 | 32230 | /** |
| @@ -32335,7 +32272,7 @@ class Obj4 { | ||
| 32335 | 32272 | * @return NULLClass |
| 32336 | 32273 | */ |
| 32337 | 32274 | public static function sampleNull(): NULLClass { |
| 32338 | - return NULLClass::sample(); /*43:null*/ | |
| 32275 | + return NULLClass::sample(); /*45:null*/ | |
| 32339 | 32276 | } |
| 32340 | 32277 | |
| 32341 | 32278 | /** |
| @@ -32383,7 +32320,7 @@ class Obj4 { | ||
| 32383 | 32320 | * @return Nullptr |
| 32384 | 32321 | */ |
| 32385 | 32322 | public static function sampleNullptr(): Nullptr { |
| 32386 | - return Nullptr::sample(); /*44:nullptr*/ | |
| 32323 | + return Nullptr::sample(); /*46:nullptr*/ | |
| 32387 | 32324 | } |
| 32388 | 32325 | |
| 32389 | 32326 | /** |
| @@ -32431,7 +32368,7 @@ class Obj4 { | ||
| 32431 | 32368 | * @return Number |
| 32432 | 32369 | */ |
| 32433 | 32370 | public static function sampleNumber(): Number { |
| 32434 | - return Number::sample(); /*45:number*/ | |
| 32371 | + return Number::sample(); /*47:number*/ | |
| 32435 | 32372 | } |
| 32436 | 32373 | |
| 32437 | 32374 | /** |
| @@ -32479,7 +32416,7 @@ class Obj4 { | ||
| 32479 | 32416 | * @return NoneClass |
| 32480 | 32417 | */ |
| 32481 | 32418 | public static function sampleObj4None(): NoneClass { |
| 32482 | - return NoneClass::sample(); /*46:obj4None*/ | |
| 32419 | + return NoneClass::sample(); /*48:obj4None*/ | |
| 32483 | 32420 | } |
| 32484 | 32421 | |
| 32485 | 32422 | /** |
| @@ -32527,7 +32464,7 @@ class Obj4 { | ||
| 32527 | 32464 | * @return Obj4Null |
| 32528 | 32465 | */ |
| 32529 | 32466 | public static function sampleObj4Null(): Obj4Null { |
| 32530 | - return Obj4Null::sample(); /*47:obj4Null*/ | |
| 32467 | + return Obj4Null::sample(); /*49:obj4Null*/ | |
| 32531 | 32468 | } |
| 32532 | 32469 | |
| 32533 | 32470 | /** |
| @@ -32575,7 +32512,7 @@ class Obj4 { | ||
| 32575 | 32512 | * @return ProtocolClass |
| 32576 | 32513 | */ |
| 32577 | 32514 | public static function sampleObj4Protocol(): ProtocolClass { |
| 32578 | - return ProtocolClass::sample(); /*48:obj4Protocol*/ | |
| 32515 | + return ProtocolClass::sample(); /*50:obj4Protocol*/ | |
| 32579 | 32516 | } |
| 32580 | 32517 | |
| 32581 | 32518 | /** |
| @@ -32623,7 +32560,7 @@ class Obj4 { | ||
| 32623 | 32560 | * @return ObjectClass |
| 32624 | 32561 | */ |
| 32625 | 32562 | public static function sampleObject(): ObjectClass { |
| 32626 | - return ObjectClass::sample(); /*49:object*/ | |
| 32563 | + return ObjectClass::sample(); /*51:object*/ | |
| 32627 | 32564 | } |
| 32628 | 32565 | |
| 32629 | 32566 | /** |
| @@ -32671,7 +32608,7 @@ class Obj4 { | ||
| 32671 | 32608 | * @return ObjectMapper |
| 32672 | 32609 | */ |
| 32673 | 32610 | public static function sampleObjectMapper(): ObjectMapper { |
| 32674 | - return ObjectMapper::sample(); /*50:objectMapper*/ | |
| 32611 | + return ObjectMapper::sample(); /*52:objectMapper*/ | |
| 32675 | 32612 | } |
| 32676 | 32613 | |
| 32677 | 32614 | /** |
| @@ -32719,7 +32656,7 @@ class Obj4 { | ||
| 32719 | 32656 | * @return Of |
| 32720 | 32657 | */ |
| 32721 | 32658 | public static function sampleOf(): Of { |
| 32722 | - return Of::sample(); /*51:of*/ | |
| 32659 | + return Of::sample(); /*53:of*/ | |
| 32723 | 32660 | } |
| 32724 | 32661 | |
| 32725 | 32662 | /** |
| @@ -32767,7 +32704,7 @@ class Obj4 { | ||
| 32767 | 32704 | * @return Oneway |
| 32768 | 32705 | */ |
| 32769 | 32706 | public static function sampleOneway(): Oneway { |
| 32770 | - return Oneway::sample(); /*52:oneway*/ | |
| 32707 | + return Oneway::sample(); /*54:oneway*/ | |
| 32771 | 32708 | } |
| 32772 | 32709 | |
| 32773 | 32710 | /** |
| @@ -32815,7 +32752,7 @@ class Obj4 { | ||
| 32815 | 32752 | * @return Open |
| 32816 | 32753 | */ |
| 32817 | 32754 | public static function sampleOpen(): Open { |
| 32818 | - return Open::sample(); /*53:open*/ | |
| 32755 | + return Open::sample(); /*55:open*/ | |
| 32819 | 32756 | } |
| 32820 | 32757 | |
| 32821 | 32758 | /** |
| @@ -32863,7 +32800,7 @@ class Obj4 { | ||
| 32863 | 32800 | * @return Operator |
| 32864 | 32801 | */ |
| 32865 | 32802 | public static function sampleOperator(): Operator { |
| 32866 | - return Operator::sample(); /*54:operator*/ | |
| 32803 | + return Operator::sample(); /*56:operator*/ | |
| 32867 | 32804 | } |
| 32868 | 32805 | |
| 32869 | 32806 | /** |
| @@ -32911,7 +32848,7 @@ class Obj4 { | ||
| 32911 | 32848 | * @return Optional |
| 32912 | 32849 | */ |
| 32913 | 32850 | public static function sampleOptional(): Optional { |
| 32914 | - return Optional::sample(); /*55:optional*/ | |
| 32851 | + return Optional::sample(); /*57:optional*/ | |
| 32915 | 32852 | } |
| 32916 | 32853 | |
| 32917 | 32854 | /** |
| @@ -32959,7 +32896,7 @@ class Obj4 { | ||
| 32959 | 32896 | * @return OrClass |
| 32960 | 32897 | */ |
| 32961 | 32898 | public static function sampleOr(): OrClass { |
| 32962 | - return OrClass::sample(); /*56:or*/ | |
| 32899 | + return OrClass::sample(); /*58:or*/ | |
| 32963 | 32900 | } |
| 32964 | 32901 | |
| 32965 | 32902 | /** |
| @@ -33007,7 +32944,7 @@ class Obj4 { | ||
| 33007 | 32944 | * @return OrEq |
| 33008 | 32945 | */ |
| 33009 | 32946 | public static function sampleOrEq(): OrEq { |
| 33010 | - return OrEq::sample(); /*57:orEq*/ | |
| 32947 | + return OrEq::sample(); /*59:orEq*/ | |
| 33011 | 32948 | } |
| 33012 | 32949 | |
| 33013 | 32950 | /** |
| @@ -33055,7 +32992,7 @@ class Obj4 { | ||
| 33055 | 32992 | * @return Out |
| 33056 | 32993 | */ |
| 33057 | 32994 | public static function sampleOut(): Out { |
| 33058 | - return Out::sample(); /*58:out*/ | |
| 32995 | + return Out::sample(); /*60:out*/ | |
| 33059 | 32996 | } |
| 33060 | 32997 | |
| 33061 | 32998 | /** |
| @@ -33103,7 +33040,7 @@ class Obj4 { | ||
| 33103 | 33040 | * @return OverrideClass |
| 33104 | 33041 | */ |
| 33105 | 33042 | public static function sampleOverride(): OverrideClass { |
| 33106 | - return OverrideClass::sample(); /*59:override*/ | |
| 33043 | + return OverrideClass::sample(); /*61:override*/ | |
| 33107 | 33044 | } |
| 33108 | 33045 | |
| 33109 | 33046 | /** |
| @@ -33151,7 +33088,7 @@ class Obj4 { | ||
| 33151 | 33088 | * @return Package |
| 33152 | 33089 | */ |
| 33153 | 33090 | public static function samplePackage(): Package { |
| 33154 | - return Package::sample(); /*60:package*/ | |
| 33091 | + return Package::sample(); /*62:package*/ | |
| 33155 | 33092 | } |
| 33156 | 33093 | |
| 33157 | 33094 | /** |
| @@ -33199,7 +33136,7 @@ class Obj4 { | ||
| 33199 | 33136 | * @return Params |
| 33200 | 33137 | */ |
| 33201 | 33138 | public static function sampleParams(): Params { |
| 33202 | - return Params::sample(); /*61:params*/ | |
| 33139 | + return Params::sample(); /*63:params*/ | |
| 33203 | 33140 | } |
| 33204 | 33141 | |
| 33205 | 33142 | /** |
| @@ -33247,7 +33184,7 @@ class Obj4 { | ||
| 33247 | 33184 | * @return Pass |
| 33248 | 33185 | */ |
| 33249 | 33186 | public static function samplePass(): Pass { |
| 33250 | - return Pass::sample(); /*62:pass*/ | |
| 33187 | + return Pass::sample(); /*64:pass*/ | |
| 33251 | 33188 | } |
| 33252 | 33189 | |
| 33253 | 33190 | /** |
| @@ -33295,7 +33232,7 @@ class Obj4 { | ||
| 33295 | 33232 | * @return Port |
| 33296 | 33233 | */ |
| 33297 | 33234 | public static function samplePort(): Port { |
| 33298 | - return Port::sample(); /*63:port*/ | |
| 33235 | + return Port::sample(); /*65:port*/ | |
| 33299 | 33236 | } |
| 33300 | 33237 | |
| 33301 | 33238 | /** |
| @@ -33343,7 +33280,7 @@ class Obj4 { | ||
| 33343 | 33280 | * @return Postfix |
| 33344 | 33281 | */ |
| 33345 | 33282 | public static function samplePostfix(): Postfix { |
| 33346 | - return Postfix::sample(); /*64:postfix*/ | |
| 33283 | + return Postfix::sample(); /*66:postfix*/ | |
| 33347 | 33284 | } |
| 33348 | 33285 | |
| 33349 | 33286 | /** |
| @@ -33391,7 +33328,7 @@ class Obj4 { | ||
| 33391 | 33328 | * @return Precedence |
| 33392 | 33329 | */ |
| 33393 | 33330 | public static function samplePrecedence(): Precedence { |
| 33394 | - return Precedence::sample(); /*65:precedence*/ | |
| 33331 | + return Precedence::sample(); /*67:precedence*/ | |
| 33395 | 33332 | } |
| 33396 | 33333 | |
| 33397 | 33334 | /** |
| @@ -33439,7 +33376,7 @@ class Obj4 { | ||
| 33439 | 33376 | * @return Prefix |
| 33440 | 33377 | */ |
| 33441 | 33378 | public static function samplePrefix(): Prefix { |
| 33442 | - return Prefix::sample(); /*66:prefix*/ | |
| 33379 | + return Prefix::sample(); /*68:prefix*/ | |
| 33443 | 33380 | } |
| 33444 | 33381 | |
| 33445 | 33382 | /** |
| @@ -33487,7 +33424,7 @@ class Obj4 { | ||
| 33487 | 33424 | * @return PrintClass |
| 33488 | 33425 | */ |
| 33489 | 33426 | public static function samplePrint(): PrintClass { |
| 33490 | - return PrintClass::sample(); /*67:print*/ | |
| 33427 | + return PrintClass::sample(); /*69:print*/ | |
| 33491 | 33428 | } |
| 33492 | 33429 | |
| 33493 | 33430 | /** |
| @@ -33535,7 +33472,7 @@ class Obj4 { | ||
| 33535 | 33472 | * @return PrintMembers |
| 33536 | 33473 | */ |
| 33537 | 33474 | public static function samplePrintMembers(): PrintMembers { |
| 33538 | - return PrintMembers::sample(); /*68:printMembers*/ | |
| 33475 | + return PrintMembers::sample(); /*70:printMembers*/ | |
| 33539 | 33476 | } |
| 33540 | 33477 | |
| 33541 | 33478 | /** |
| @@ -33583,7 +33520,7 @@ class Obj4 { | ||
| 33583 | 33520 | * @return Printf |
| 33584 | 33521 | */ |
| 33585 | 33522 | public static function samplePrintf(): Printf { |
| 33586 | - return Printf::sample(); /*69:printf*/ | |
| 33523 | + return Printf::sample(); /*71:printf*/ | |
| 33587 | 33524 | } |
| 33588 | 33525 | |
| 33589 | 33526 | /** |
| @@ -33631,7 +33568,7 @@ class Obj4 { | ||
| 33631 | 33568 | * @return PrivateClass |
| 33632 | 33569 | */ |
| 33633 | 33570 | public static function samplePrivate(): PrivateClass { |
| 33634 | - return PrivateClass::sample(); /*70:private*/ | |
| 33571 | + return PrivateClass::sample(); /*72:private*/ | |
| 33635 | 33572 | } |
| 33636 | 33573 | |
| 33637 | 33574 | /** |
| @@ -33679,7 +33616,7 @@ class Obj4 { | ||
| 33679 | 33616 | * @return ProtectedClass |
| 33680 | 33617 | */ |
| 33681 | 33618 | public static function sampleProtected(): ProtectedClass { |
| 33682 | - return ProtectedClass::sample(); /*71:protected*/ | |
| 33619 | + return ProtectedClass::sample(); /*73:protected*/ | |
| 33683 | 33620 | } |
| 33684 | 33621 | |
| 33685 | 33622 | /** |
| @@ -33727,7 +33664,7 @@ class Obj4 { | ||
| 33727 | 33664 | * @return Protocol |
| 33728 | 33665 | */ |
| 33729 | 33666 | public static function sampleProtocol(): Protocol { |
| 33730 | - return Protocol::sample(); /*72:protocol*/ | |
| 33667 | + return Protocol::sample(); /*74:protocol*/ | |
| 33731 | 33668 | } |
| 33732 | 33669 | |
| 33733 | 33670 | /** |
| @@ -33775,7 +33712,7 @@ class Obj4 { | ||
| 33775 | 33712 | * @return PublicClass |
| 33776 | 33713 | */ |
| 33777 | 33714 | public static function samplePublic(): PublicClass { |
| 33778 | - return PublicClass::sample(); /*73:public*/ | |
| 33715 | + return PublicClass::sample(); /*75:public*/ | |
| 33779 | 33716 | } |
| 33780 | 33717 | |
| 33781 | 33718 | /** |
| @@ -33823,7 +33760,7 @@ class Obj4 { | ||
| 33823 | 33760 | * @return Quicktype |
| 33824 | 33761 | */ |
| 33825 | 33762 | public static function sampleQuicktype(): Quicktype { |
| 33826 | - return Quicktype::sample(); /*74:quicktype*/ | |
| 33763 | + return Quicktype::sample(); /*76:quicktype*/ | |
| 33827 | 33764 | } |
| 33828 | 33765 | |
| 33829 | 33766 | /** |
| @@ -33871,7 +33808,7 @@ class Obj4 { | ||
| 33871 | 33808 | * @return Raise |
| 33872 | 33809 | */ |
| 33873 | 33810 | public static function sampleRaise(): Raise { |
| 33874 | - return Raise::sample(); /*75:raise*/ | |
| 33811 | + return Raise::sample(); /*77:raise*/ | |
| 33875 | 33812 | } |
| 33876 | 33813 | |
| 33877 | 33814 | /** |
| @@ -33919,7 +33856,7 @@ class Obj4 { | ||
| 33919 | 33856 | * @return Range |
| 33920 | 33857 | */ |
| 33921 | 33858 | public static function sampleRange(): Range { |
| 33922 | - return Range::sample(); /*76:range*/ | |
| 33859 | + return Range::sample(); /*78:range*/ | |
| 33923 | 33860 | } |
| 33924 | 33861 | |
| 33925 | 33862 | /** |
| @@ -33967,7 +33904,7 @@ class Obj4 { | ||
| 33967 | 33904 | * @return ReadonlyClass |
| 33968 | 33905 | */ |
| 33969 | 33906 | public static function sampleReadonly(): ReadonlyClass { |
| 33970 | - return ReadonlyClass::sample(); /*77:readonly*/ | |
| 33907 | + return ReadonlyClass::sample(); /*79:readonly*/ | |
| 33971 | 33908 | } |
| 33972 | 33909 | |
| 33973 | 33910 | /** |
| @@ -34015,7 +33952,7 @@ class Obj4 { | ||
| 34015 | 33952 | * @return Ref |
| 34016 | 33953 | */ |
| 34017 | 33954 | public static function sampleRef(): Ref { |
| 34018 | - return Ref::sample(); /*78:ref*/ | |
| 33955 | + return Ref::sample(); /*80:ref*/ | |
| 34019 | 33956 | } |
| 34020 | 33957 | |
| 34021 | 33958 | /** |
| @@ -34063,7 +34000,7 @@ class Obj4 { | ||
| 34063 | 34000 | * @return RegExp |
| 34064 | 34001 | */ |
| 34065 | 34002 | public static function sampleRegExp(): RegExp { |
| 34066 | - return RegExp::sample(); /*79:regExp*/ | |
| 34003 | + return RegExp::sample(); /*81:regExp*/ | |
| 34067 | 34004 | } |
| 34068 | 34005 | |
| 34069 | 34006 | /** |
| @@ -34111,7 +34048,7 @@ class Obj4 { | ||
| 34111 | 34048 | * @return Register |
| 34112 | 34049 | */ |
| 34113 | 34050 | public static function sampleRegister(): Register { |
| 34114 | - return Register::sample(); /*80:register*/ | |
| 34051 | + return Register::sample(); /*82:register*/ | |
| 34115 | 34052 | } |
| 34116 | 34053 | |
| 34117 | 34054 | /** |
| @@ -34159,7 +34096,7 @@ class Obj4 { | ||
| 34159 | 34096 | * @return ReinterpretCast |
| 34160 | 34097 | */ |
| 34161 | 34098 | public static function sampleReinterpretCast(): ReinterpretCast { |
| 34162 | - return ReinterpretCast::sample(); /*81:reinterpretCast*/ | |
| 34099 | + return ReinterpretCast::sample(); /*83:reinterpretCast*/ | |
| 34163 | 34100 | } |
| 34164 | 34101 | |
| 34165 | 34102 | /** |
| @@ -34207,7 +34144,7 @@ class Obj4 { | ||
| 34207 | 34144 | * @return Repeat |
| 34208 | 34145 | */ |
| 34209 | 34146 | public static function sampleRepeat(): Repeat { |
| 34210 | - return Repeat::sample(); /*82:repeat*/ | |
| 34147 | + return Repeat::sample(); /*84:repeat*/ | |
| 34211 | 34148 | } |
| 34212 | 34149 | |
| 34213 | 34150 | /** |
| @@ -34255,7 +34192,7 @@ class Obj4 { | ||
| 34255 | 34192 | * @return RequireClass |
| 34256 | 34193 | */ |
| 34257 | 34194 | public static function sampleRequire(): RequireClass { |
| 34258 | - return RequireClass::sample(); /*83:require*/ | |
| 34195 | + return RequireClass::sample(); /*85:require*/ | |
| 34259 | 34196 | } |
| 34260 | 34197 | |
| 34261 | 34198 | /** |
| @@ -34303,7 +34240,7 @@ class Obj4 { | ||
| 34303 | 34240 | * @return Required |
| 34304 | 34241 | */ |
| 34305 | 34242 | public static function sampleRequired(): Required { |
| 34306 | - return Required::sample(); /*84:required*/ | |
| 34243 | + return Required::sample(); /*86:required*/ | |
| 34307 | 34244 | } |
| 34308 | 34245 | |
| 34309 | 34246 | /** |
| @@ -34351,7 +34288,7 @@ class Obj4 { | ||
| 34351 | 34288 | * @return Requires |
| 34352 | 34289 | */ |
| 34353 | 34290 | public static function sampleRequires(): Requires { |
| 34354 | - return Requires::sample(); /*85:requires*/ | |
| 34291 | + return Requires::sample(); /*87:requires*/ | |
| 34355 | 34292 | } |
| 34356 | 34293 | |
| 34357 | 34294 | /** |
| @@ -34399,7 +34336,7 @@ class Obj4 { | ||
| 34399 | 34336 | * @return Restrict |
| 34400 | 34337 | */ |
| 34401 | 34338 | public static function sampleRestrict(): Restrict { |
| 34402 | - return Restrict::sample(); /*86:restrict*/ | |
| 34339 | + return Restrict::sample(); /*88:restrict*/ | |
| 34403 | 34340 | } |
| 34404 | 34341 | |
| 34405 | 34342 | /** |
| @@ -34447,7 +34384,7 @@ class Obj4 { | ||
| 34447 | 34384 | * @return Retain |
| 34448 | 34385 | */ |
| 34449 | 34386 | public static function sampleRetain(): Retain { |
| 34450 | - return Retain::sample(); /*87:retain*/ | |
| 34387 | + return Retain::sample(); /*89:retain*/ | |
| 34451 | 34388 | } |
| 34452 | 34389 | |
| 34453 | 34390 | /** |
| @@ -34495,7 +34432,7 @@ class Obj4 { | ||
| 34495 | 34432 | * @return Rethrows |
| 34496 | 34433 | */ |
| 34497 | 34434 | public static function sampleRethrows(): Rethrows { |
| 34498 | - return Rethrows::sample(); /*88:rethrows*/ | |
| 34435 | + return Rethrows::sample(); /*90:rethrows*/ | |
| 34499 | 34436 | } |
| 34500 | 34437 | |
| 34501 | 34438 | /** |
| @@ -34543,7 +34480,7 @@ class Obj4 { | ||
| 34543 | 34480 | * @return ReturnClass |
| 34544 | 34481 | */ |
| 34545 | 34482 | public static function sampleReturn(): ReturnClass { |
| 34546 | - return ReturnClass::sample(); /*89:return*/ | |
| 34483 | + return ReturnClass::sample(); /*91:return*/ | |
| 34547 | 34484 | } |
| 34548 | 34485 | |
| 34549 | 34486 | /** |
| @@ -34591,7 +34528,7 @@ class Obj4 { | ||
| 34591 | 34528 | * @return Right |
| 34592 | 34529 | */ |
| 34593 | 34530 | public static function sampleRight(): Right { |
| 34594 | - return Right::sample(); /*90:right*/ | |
| 34531 | + return Right::sample(); /*92:right*/ | |
| 34595 | 34532 | } |
| 34596 | 34533 | |
| 34597 | 34534 | /** |
| @@ -34639,7 +34576,7 @@ class Obj4 { | ||
| 34639 | 34576 | * @return RuntimeType |
| 34640 | 34577 | */ |
| 34641 | 34578 | public static function sampleRuntimeType(): RuntimeType { |
| 34642 | - return RuntimeType::sample(); /*91:runtimeType*/ | |
| 34579 | + return RuntimeType::sample(); /*93:runtimeType*/ | |
| 34643 | 34580 | } |
| 34644 | 34581 | |
| 34645 | 34582 | /** |
| @@ -34687,7 +34624,7 @@ class Obj4 { | ||
| 34687 | 34624 | * @return S |
| 34688 | 34625 | */ |
| 34689 | 34626 | public static function sampleS(): S { |
| 34690 | - return S::sample(); /*92:s*/ | |
| 34627 | + return S::sample(); /*94:s*/ | |
| 34691 | 34628 | } |
| 34692 | 34629 | |
| 34693 | 34630 | /** |
| @@ -34735,111 +34672,17 @@ class Obj4 { | ||
| 34735 | 34672 | * @return Sbyte |
| 34736 | 34673 | */ |
| 34737 | 34674 | public static function sampleSbyte(): Sbyte { |
| 34738 | - return Sbyte::sample(); /*93:sbyte*/ | |
| 34675 | + return Sbyte::sample(); /*95:sbyte*/ | |
| 34739 | 34676 | } |
| 34740 | 34677 | |
| 34741 | 34678 | /** |
| 34742 | - * @param stdClass $value | |
| 34743 | 34679 | * @throws Exception |
| 34744 | - * @return Sealed | |
| 34745 | - */ | |
| 34746 | - public static function fromSealed(stdClass $value): Sealed { | |
| 34747 | - return Sealed::from($value); /*class*/ | |
| 34748 | - } | |
| 34749 | - | |
| 34750 | - /** | |
| 34751 | - * @throws Exception | |
| 34752 | - * @return stdClass | |
| 34753 | - */ | |
| 34754 | - public function toSealed(): stdClass { | |
| 34755 | - if (Obj4::validateSealed($this->sealed)) { | |
| 34756 | - return $this->sealed->to(); /*class*/ | |
| 34757 | - } | |
| 34758 | - throw new Exception('never get to this Obj4::sealed'); | |
| 34759 | - } | |
| 34760 | - | |
| 34761 | - /** | |
| 34762 | - * @param Sealed | |
| 34763 | - * @return bool | |
| 34764 | - * @throws Exception | |
| 34765 | - */ | |
| 34766 | - public static function validateSealed(Sealed $value): bool { | |
| 34767 | - $value->validate(); | |
| 34768 | - return true; | |
| 34769 | - } | |
| 34770 | - | |
| 34771 | - /** | |
| 34772 | - * @throws Exception | |
| 34773 | - * @return Sealed | |
| 34774 | - */ | |
| 34775 | - public function getSealed(): Sealed { | |
| 34776 | - if (Obj4::validateSealed($this->sealed)) { | |
| 34777 | - return $this->sealed; | |
| 34778 | - } | |
| 34779 | - throw new Exception('never get to getSealed Obj4::sealed'); | |
| 34780 | - } | |
| 34781 | - | |
| 34782 | - /** | |
| 34783 | - * @return Sealed | |
| 34784 | - */ | |
| 34785 | - public static function sampleSealed(): Sealed { | |
| 34786 | - return Sealed::sample(); /*94:sealed*/ | |
| 34787 | - } | |
| 34788 | - | |
| 34789 | - /** | |
| 34790 | - * @param stdClass $value | |
| 34791 | - * @throws Exception | |
| 34792 | - * @return Sel | |
| 34793 | - */ | |
| 34794 | - public static function fromSel(stdClass $value): Sel { | |
| 34795 | - return Sel::from($value); /*class*/ | |
| 34796 | - } | |
| 34797 | - | |
| 34798 | - /** | |
| 34799 | - * @throws Exception | |
| 34800 | - * @return stdClass | |
| 34801 | - */ | |
| 34802 | - public function toSel(): stdClass { | |
| 34803 | - if (Obj4::validateSel($this->sel)) { | |
| 34804 | - return $this->sel->to(); /*class*/ | |
| 34805 | - } | |
| 34806 | - throw new Exception('never get to this Obj4::sel'); | |
| 34807 | - } | |
| 34808 | - | |
| 34809 | - /** | |
| 34810 | - * @param Sel | |
| 34811 | - * @return bool | |
| 34812 | - * @throws Exception | |
| 34813 | - */ | |
| 34814 | - public static function validateSel(Sel $value): bool { | |
| 34815 | - $value->validate(); | |
| 34816 | - return true; | |
| 34817 | - } | |
| 34818 | - | |
| 34819 | - /** | |
| 34820 | - * @throws Exception | |
| 34821 | - * @return Sel | |
| 34822 | - */ | |
| 34823 | - public function getSel(): Sel { | |
| 34824 | - if (Obj4::validateSel($this->sel)) { | |
| 34825 | - return $this->sel; | |
| 34826 | - } | |
| 34827 | - throw new Exception('never get to getSel Obj4::sel'); | |
| 34828 | - } | |
| 34829 | - | |
| 34830 | - /** | |
| 34831 | - * @return Sel | |
| 34832 | - */ | |
| 34833 | - public static function sampleSel(): Sel { | |
| 34834 | - return Sel::sample(); /*95:sel*/ | |
| 34835 | - } | |
| 34836 | - | |
| 34837 | - /** | |
| 34838 | - * @throws Exception | |
| 34839 | - * @return bool | |
| 34680 | + * @return bool | |
| 34840 | 34681 | */ |
| 34841 | 34682 | public function validate(): bool { |
| 34842 | 34683 | return Obj4::validateDummy($this->dummy) |
| 34684 | + || Obj4::validateNil($this->nil) | |
| 34685 | + || Obj4::validateNo($this->no) | |
| 34843 | 34686 | || Obj4::validateNoSuchMethod($this->noSuchMethod) |
| 34844 | 34687 | || Obj4::validateNoexcept($this->noexcept) |
| 34845 | 34688 | || Obj4::validateNonatomic($this->nonatomic) |
| @@ -34901,9 +34744,7 @@ class Obj4 { | ||
| 34901 | 34744 | || Obj4::validateRight($this->right) |
| 34902 | 34745 | || Obj4::validateRuntimeType($this->runtimeType) |
| 34903 | 34746 | || Obj4::validateS($this->s) |
| 34904 | - || Obj4::validateSbyte($this->sbyte) | |
| 34905 | - || Obj4::validateSealed($this->sealed) | |
| 34906 | - || Obj4::validateSel($this->sel); | |
| 34747 | + || Obj4::validateSbyte($this->sbyte); | |
| 34907 | 34748 | } |
| 34908 | 34749 | |
| 34909 | 34750 | /** |
| @@ -34913,6 +34754,8 @@ class Obj4 { | ||
| 34913 | 34754 | public function to(): stdClass { |
| 34914 | 34755 | $out = new stdClass(); |
| 34915 | 34756 | $out->{'dummy'} = $this->toDummy(); |
| 34757 | + $out->{'nil'} = $this->toNil(); | |
| 34758 | + $out->{'NO'} = $this->toNo(); | |
| 34916 | 34759 | $out->{'noSuchMethod'} = $this->toNoSuchMethod(); |
| 34917 | 34760 | $out->{'noexcept'} = $this->toNoexcept(); |
| 34918 | 34761 | $out->{'nonatomic'} = $this->toNonatomic(); |
| @@ -34975,8 +34818,6 @@ class Obj4 { | ||
| 34975 | 34818 | $out->{'runtimeType'} = $this->toRuntimeType(); |
| 34976 | 34819 | $out->{'s'} = $this->toS(); |
| 34977 | 34820 | $out->{'sbyte'} = $this->toSbyte(); |
| 34978 | - $out->{'sealed'} = $this->toSealed(); | |
| 34979 | - $out->{'SEL'} = $this->toSel(); | |
| 34980 | 34821 | return $out; |
| 34981 | 34822 | } |
| 34982 | 34823 | |
| @@ -34989,6 +34830,12 @@ class Obj4 { | ||
| 34989 | 34830 | if (!property_exists($obj, 'dummy')) { |
| 34990 | 34831 | throw new Exception("Missing required property"); |
| 34991 | 34832 | } |
| 34833 | + if (!property_exists($obj, 'nil')) { | |
| 34834 | + throw new Exception("Missing required property"); | |
| 34835 | + } | |
| 34836 | + if (!property_exists($obj, 'NO')) { | |
| 34837 | + throw new Exception("Missing required property"); | |
| 34838 | + } | |
| 34992 | 34839 | if (!property_exists($obj, 'noSuchMethod')) { |
| 34993 | 34840 | throw new Exception("Missing required property"); |
| 34994 | 34841 | } |
| @@ -35175,14 +35022,10 @@ class Obj4 { | ||
| 35175 | 35022 | if (!property_exists($obj, 'sbyte')) { |
| 35176 | 35023 | throw new Exception("Missing required property"); |
| 35177 | 35024 | } |
| 35178 | - if (!property_exists($obj, 'sealed')) { | |
| 35179 | - throw new Exception("Missing required property"); | |
| 35180 | - } | |
| 35181 | - if (!property_exists($obj, 'SEL')) { | |
| 35182 | - throw new Exception("Missing required property"); | |
| 35183 | - } | |
| 35184 | 35025 | return new Obj4( |
| 35185 | 35026 | Obj4::fromDummy($obj->{'dummy'}) |
| 35027 | + ,Obj4::fromNil($obj->{'nil'}) | |
| 35028 | + ,Obj4::fromNo($obj->{'NO'}) | |
| 35186 | 35029 | ,Obj4::fromNoSuchMethod($obj->{'noSuchMethod'}) |
| 35187 | 35030 | ,Obj4::fromNoexcept($obj->{'noexcept'}) |
| 35188 | 35031 | ,Obj4::fromNonatomic($obj->{'nonatomic'}) |
| @@ -35245,8 +35088,6 @@ class Obj4 { | ||
| 35245 | 35088 | ,Obj4::fromRuntimeType($obj->{'runtimeType'}) |
| 35246 | 35089 | ,Obj4::fromS($obj->{'s'}) |
| 35247 | 35090 | ,Obj4::fromSbyte($obj->{'sbyte'}) |
| 35248 | - ,Obj4::fromSealed($obj->{'sealed'}) | |
| 35249 | - ,Obj4::fromSel($obj->{'SEL'}) | |
| 35250 | 35091 | ); |
| 35251 | 35092 | } |
| 35252 | 35093 | |
| @@ -35256,6 +35097,8 @@ class Obj4 { | ||
| 35256 | 35097 | public static function sample(): Obj4 { |
| 35257 | 35098 | return new Obj4( |
| 35258 | 35099 | Obj4::sampleDummy() |
| 35100 | + ,Obj4::sampleNil() | |
| 35101 | + ,Obj4::sampleNo() | |
| 35259 | 35102 | ,Obj4::sampleNoSuchMethod() |
| 35260 | 35103 | ,Obj4::sampleNoexcept() |
| 35261 | 35104 | ,Obj4::sampleNonatomic() |
| @@ -35318,22 +35161,20 @@ class Obj4 { | ||
| 35318 | 35161 | ,Obj4::sampleRuntimeType() |
| 35319 | 35162 | ,Obj4::sampleS() |
| 35320 | 35163 | ,Obj4::sampleSbyte() |
| 35321 | - ,Obj4::sampleSealed() | |
| 35322 | - ,Obj4::sampleSel() | |
| 35323 | 35164 | ); |
| 35324 | 35165 | } |
| 35325 | 35166 | } |
| 35326 | 35167 | |
| 35327 | -// This is an autogenerated file:NoSuchMethod | |
| 35168 | +// This is an autogenerated file:Nil | |
| 35328 | 35169 | |
| 35329 | -class NoSuchMethod { | |
| 35330 | - private int $noSuchMethod; // json:noSuchMethod Required | |
| 35170 | +class Nil { | |
| 35171 | + private int $nil; // json:nil Required | |
| 35331 | 35172 | |
| 35332 | 35173 | /** |
| 35333 | - * @param int $noSuchMethod | |
| 35174 | + * @param int $nil | |
| 35334 | 35175 | */ |
| 35335 | - public function __construct(int $noSuchMethod) { | |
| 35336 | - $this->noSuchMethod = $noSuchMethod; | |
| 35176 | + public function __construct(int $nil) { | |
| 35177 | + $this->nil = $nil; | |
| 35337 | 35178 | } |
| 35338 | 35179 | |
| 35339 | 35180 | /** |
| @@ -35341,7 +35182,7 @@ class NoSuchMethod { | ||
| 35341 | 35182 | * @throws Exception |
| 35342 | 35183 | * @return int |
| 35343 | 35184 | */ |
| 35344 | - public static function fromNoSuchMethod(int $value): int { | |
| 35185 | + public static function fromNil(int $value): int { | |
| 35345 | 35186 | return $value; /*int*/ |
| 35346 | 35187 | } |
| 35347 | 35188 | |
| @@ -35349,11 +35190,11 @@ class NoSuchMethod { | ||
| 35349 | 35190 | * @throws Exception |
| 35350 | 35191 | * @return int |
| 35351 | 35192 | */ |
| 35352 | - public function toNoSuchMethod(): int { | |
| 35353 | - if (NoSuchMethod::validateNoSuchMethod($this->noSuchMethod)) { | |
| 35354 | - return $this->noSuchMethod; /*int*/ | |
| 35193 | + public function toNil(): int { | |
| 35194 | + if (Nil::validateNil($this->nil)) { | |
| 35195 | + return $this->nil; /*int*/ | |
| 35355 | 35196 | } |
| 35356 | - throw new Exception('never get to this NoSuchMethod::noSuchMethod'); | |
| 35197 | + throw new Exception('never get to this Nil::nil'); | |
| 35357 | 35198 | } |
| 35358 | 35199 | |
| 35359 | 35200 | /** |
| @@ -35361,7 +35202,7 @@ class NoSuchMethod { | ||
| 35361 | 35202 | * @return bool |
| 35362 | 35203 | * @throws Exception |
| 35363 | 35204 | */ |
| 35364 | - public static function validateNoSuchMethod(int $value): bool { | |
| 35205 | + public static function validateNil(int $value): bool { | |
| 35365 | 35206 | return true; |
| 35366 | 35207 | } |
| 35367 | 35208 | |
| @@ -35369,18 +35210,18 @@ class NoSuchMethod { | ||
| 35369 | 35210 | * @throws Exception |
| 35370 | 35211 | * @return int |
| 35371 | 35212 | */ |
| 35372 | - public function getNoSuchMethod(): int { | |
| 35373 | - if (NoSuchMethod::validateNoSuchMethod($this->noSuchMethod)) { | |
| 35374 | - return $this->noSuchMethod; | |
| 35213 | + public function getNil(): int { | |
| 35214 | + if (Nil::validateNil($this->nil)) { | |
| 35215 | + return $this->nil; | |
| 35375 | 35216 | } |
| 35376 | - throw new Exception('never get to getNoSuchMethod NoSuchMethod::noSuchMethod'); | |
| 35217 | + throw new Exception('never get to getNil Nil::nil'); | |
| 35377 | 35218 | } |
| 35378 | 35219 | |
| 35379 | 35220 | /** |
| 35380 | 35221 | * @return int |
| 35381 | 35222 | */ |
| 35382 | - public static function sampleNoSuchMethod(): int { | |
| 35383 | - return 31; /*31:noSuchMethod*/ | |
| 35223 | + public static function sampleNil(): int { | |
| 35224 | + return 31; /*31:nil*/ | |
| 35384 | 35225 | } |
| 35385 | 35226 | |
| 35386 | 35227 | /** |
| @@ -35388,7 +35229,7 @@ class NoSuchMethod { | ||
| 35388 | 35229 | * @return bool |
| 35389 | 35230 | */ |
| 35390 | 35231 | public function validate(): bool { |
| 35391 | - return NoSuchMethod::validateNoSuchMethod($this->noSuchMethod); | |
| 35232 | + return Nil::validateNil($this->nil); | |
| 35392 | 35233 | } |
| 35393 | 35234 | |
| 35394 | 35235 | /** |
| @@ -35397,44 +35238,44 @@ class NoSuchMethod { | ||
| 35397 | 35238 | */ |
| 35398 | 35239 | public function to(): stdClass { |
| 35399 | 35240 | $out = new stdClass(); |
| 35400 | - $out->{'noSuchMethod'} = $this->toNoSuchMethod(); | |
| 35241 | + $out->{'nil'} = $this->toNil(); | |
| 35401 | 35242 | return $out; |
| 35402 | 35243 | } |
| 35403 | 35244 | |
| 35404 | 35245 | /** |
| 35405 | 35246 | * @param stdClass $obj |
| 35406 | - * @return NoSuchMethod | |
| 35247 | + * @return Nil | |
| 35407 | 35248 | * @throws Exception |
| 35408 | 35249 | */ |
| 35409 | - public static function from(stdClass $obj): NoSuchMethod { | |
| 35410 | - if (!property_exists($obj, 'noSuchMethod')) { | |
| 35250 | + public static function from(stdClass $obj): Nil { | |
| 35251 | + if (!property_exists($obj, 'nil')) { | |
| 35411 | 35252 | throw new Exception("Missing required property"); |
| 35412 | 35253 | } |
| 35413 | - return new NoSuchMethod( | |
| 35414 | - NoSuchMethod::fromNoSuchMethod($obj->{'noSuchMethod'}) | |
| 35254 | + return new Nil( | |
| 35255 | + Nil::fromNil($obj->{'nil'}) | |
| 35415 | 35256 | ); |
| 35416 | 35257 | } |
| 35417 | 35258 | |
| 35418 | 35259 | /** |
| 35419 | - * @return NoSuchMethod | |
| 35260 | + * @return Nil | |
| 35420 | 35261 | */ |
| 35421 | - public static function sample(): NoSuchMethod { | |
| 35422 | - return new NoSuchMethod( | |
| 35423 | - NoSuchMethod::sampleNoSuchMethod() | |
| 35262 | + public static function sample(): Nil { | |
| 35263 | + return new Nil( | |
| 35264 | + Nil::sampleNil() | |
| 35424 | 35265 | ); |
| 35425 | 35266 | } |
| 35426 | 35267 | } |
| 35427 | 35268 | |
| 35428 | -// This is an autogenerated file:Noexcept | |
| 35269 | +// This is an autogenerated file:No | |
| 35429 | 35270 | |
| 35430 | -class Noexcept { | |
| 35431 | - private int $noexcept; // json:noexcept Required | |
| 35271 | +class No { | |
| 35272 | + private int $no; // json:NO Required | |
| 35432 | 35273 | |
| 35433 | 35274 | /** |
| 35434 | - * @param int $noexcept | |
| 35275 | + * @param int $no | |
| 35435 | 35276 | */ |
| 35436 | - public function __construct(int $noexcept) { | |
| 35437 | - $this->noexcept = $noexcept; | |
| 35277 | + public function __construct(int $no) { | |
| 35278 | + $this->no = $no; | |
| 35438 | 35279 | } |
| 35439 | 35280 | |
| 35440 | 35281 | /** |
| @@ -35442,7 +35283,7 @@ class Noexcept { | ||
| 35442 | 35283 | * @throws Exception |
| 35443 | 35284 | * @return int |
| 35444 | 35285 | */ |
| 35445 | - public static function fromNoexcept(int $value): int { | |
| 35286 | + public static function fromNo(int $value): int { | |
| 35446 | 35287 | return $value; /*int*/ |
| 35447 | 35288 | } |
| 35448 | 35289 | |
| @@ -35450,11 +35291,11 @@ class Noexcept { | ||
| 35450 | 35291 | * @throws Exception |
| 35451 | 35292 | * @return int |
| 35452 | 35293 | */ |
| 35453 | - public function toNoexcept(): int { | |
| 35454 | - if (Noexcept::validateNoexcept($this->noexcept)) { | |
| 35455 | - return $this->noexcept; /*int*/ | |
| 35294 | + public function toNo(): int { | |
| 35295 | + if (No::validateNo($this->no)) { | |
| 35296 | + return $this->no; /*int*/ | |
| 35456 | 35297 | } |
| 35457 | - throw new Exception('never get to this Noexcept::noexcept'); | |
| 35298 | + throw new Exception('never get to this No::no'); | |
| 35458 | 35299 | } |
| 35459 | 35300 | |
| 35460 | 35301 | /** |
| @@ -35462,7 +35303,7 @@ class Noexcept { | ||
| 35462 | 35303 | * @return bool |
| 35463 | 35304 | * @throws Exception |
| 35464 | 35305 | */ |
| 35465 | - public static function validateNoexcept(int $value): bool { | |
| 35306 | + public static function validateNo(int $value): bool { | |
| 35466 | 35307 | return true; |
| 35467 | 35308 | } |
| 35468 | 35309 | |
| @@ -35470,18 +35311,18 @@ class Noexcept { | ||
| 35470 | 35311 | * @throws Exception |
| 35471 | 35312 | * @return int |
| 35472 | 35313 | */ |
| 35473 | - public function getNoexcept(): int { | |
| 35474 | - if (Noexcept::validateNoexcept($this->noexcept)) { | |
| 35475 | - return $this->noexcept; | |
| 35314 | + public function getNo(): int { | |
| 35315 | + if (No::validateNo($this->no)) { | |
| 35316 | + return $this->no; | |
| 35476 | 35317 | } |
| 35477 | - throw new Exception('never get to getNoexcept Noexcept::noexcept'); | |
| 35318 | + throw new Exception('never get to getNo No::no'); | |
| 35478 | 35319 | } |
| 35479 | 35320 | |
| 35480 | 35321 | /** |
| 35481 | 35322 | * @return int |
| 35482 | 35323 | */ |
| 35483 | - public static function sampleNoexcept(): int { | |
| 35484 | - return 31; /*31:noexcept*/ | |
| 35324 | + public static function sampleNo(): int { | |
| 35325 | + return 31; /*31:no*/ | |
| 35485 | 35326 | } |
| 35486 | 35327 | |
| 35487 | 35328 | /** |
| @@ -35489,7 +35330,7 @@ class Noexcept { | ||
| 35489 | 35330 | * @return bool |
| 35490 | 35331 | */ |
| 35491 | 35332 | public function validate(): bool { |
| 35492 | - return Noexcept::validateNoexcept($this->noexcept); | |
| 35333 | + return No::validateNo($this->no); | |
| 35493 | 35334 | } |
| 35494 | 35335 | |
| 35495 | 35336 | /** |
| @@ -35498,44 +35339,44 @@ class Noexcept { | ||
| 35498 | 35339 | */ |
| 35499 | 35340 | public function to(): stdClass { |
| 35500 | 35341 | $out = new stdClass(); |
| 35501 | - $out->{'noexcept'} = $this->toNoexcept(); | |
| 35342 | + $out->{'NO'} = $this->toNo(); | |
| 35502 | 35343 | return $out; |
| 35503 | 35344 | } |
| 35504 | 35345 | |
| 35505 | 35346 | /** |
| 35506 | 35347 | * @param stdClass $obj |
| 35507 | - * @return Noexcept | |
| 35348 | + * @return No | |
| 35508 | 35349 | * @throws Exception |
| 35509 | 35350 | */ |
| 35510 | - public static function from(stdClass $obj): Noexcept { | |
| 35511 | - if (!property_exists($obj, 'noexcept')) { | |
| 35351 | + public static function from(stdClass $obj): No { | |
| 35352 | + if (!property_exists($obj, 'NO')) { | |
| 35512 | 35353 | throw new Exception("Missing required property"); |
| 35513 | 35354 | } |
| 35514 | - return new Noexcept( | |
| 35515 | - Noexcept::fromNoexcept($obj->{'noexcept'}) | |
| 35355 | + return new No( | |
| 35356 | + No::fromNo($obj->{'NO'}) | |
| 35516 | 35357 | ); |
| 35517 | 35358 | } |
| 35518 | 35359 | |
| 35519 | 35360 | /** |
| 35520 | - * @return Noexcept | |
| 35361 | + * @return No | |
| 35521 | 35362 | */ |
| 35522 | - public static function sample(): Noexcept { | |
| 35523 | - return new Noexcept( | |
| 35524 | - Noexcept::sampleNoexcept() | |
| 35363 | + public static function sample(): No { | |
| 35364 | + return new No( | |
| 35365 | + No::sampleNo() | |
| 35525 | 35366 | ); |
| 35526 | 35367 | } |
| 35527 | 35368 | } |
| 35528 | 35369 | |
| 35529 | -// This is an autogenerated file:Nonatomic | |
| 35370 | +// This is an autogenerated file:NoSuchMethod | |
| 35530 | 35371 | |
| 35531 | -class Nonatomic { | |
| 35532 | - private int $nonatomic; // json:nonatomic Required | |
| 35372 | +class NoSuchMethod { | |
| 35373 | + private int $noSuchMethod; // json:noSuchMethod Required | |
| 35533 | 35374 | |
| 35534 | 35375 | /** |
| 35535 | - * @param int $nonatomic | |
| 35376 | + * @param int $noSuchMethod | |
| 35536 | 35377 | */ |
| 35537 | - public function __construct(int $nonatomic) { | |
| 35538 | - $this->nonatomic = $nonatomic; | |
| 35378 | + public function __construct(int $noSuchMethod) { | |
| 35379 | + $this->noSuchMethod = $noSuchMethod; | |
| 35539 | 35380 | } |
| 35540 | 35381 | |
| 35541 | 35382 | /** |
| @@ -35543,7 +35384,7 @@ class Nonatomic { | ||
| 35543 | 35384 | * @throws Exception |
| 35544 | 35385 | * @return int |
| 35545 | 35386 | */ |
| 35546 | - public static function fromNonatomic(int $value): int { | |
| 35387 | + public static function fromNoSuchMethod(int $value): int { | |
| 35547 | 35388 | return $value; /*int*/ |
| 35548 | 35389 | } |
| 35549 | 35390 | |
| @@ -35551,11 +35392,11 @@ class Nonatomic { | ||
| 35551 | 35392 | * @throws Exception |
| 35552 | 35393 | * @return int |
| 35553 | 35394 | */ |
| 35554 | - public function toNonatomic(): int { | |
| 35555 | - if (Nonatomic::validateNonatomic($this->nonatomic)) { | |
| 35556 | - return $this->nonatomic; /*int*/ | |
| 35395 | + public function toNoSuchMethod(): int { | |
| 35396 | + if (NoSuchMethod::validateNoSuchMethod($this->noSuchMethod)) { | |
| 35397 | + return $this->noSuchMethod; /*int*/ | |
| 35557 | 35398 | } |
| 35558 | - throw new Exception('never get to this Nonatomic::nonatomic'); | |
| 35399 | + throw new Exception('never get to this NoSuchMethod::noSuchMethod'); | |
| 35559 | 35400 | } |
| 35560 | 35401 | |
| 35561 | 35402 | /** |
| @@ -35563,7 +35404,7 @@ class Nonatomic { | ||
| 35563 | 35404 | * @return bool |
| 35564 | 35405 | * @throws Exception |
| 35565 | 35406 | */ |
| 35566 | - public static function validateNonatomic(int $value): bool { | |
| 35407 | + public static function validateNoSuchMethod(int $value): bool { | |
| 35567 | 35408 | return true; |
| 35568 | 35409 | } |
| 35569 | 35410 | |
| @@ -35571,18 +35412,18 @@ class Nonatomic { | ||
| 35571 | 35412 | * @throws Exception |
| 35572 | 35413 | * @return int |
| 35573 | 35414 | */ |
| 35574 | - public function getNonatomic(): int { | |
| 35575 | - if (Nonatomic::validateNonatomic($this->nonatomic)) { | |
| 35576 | - return $this->nonatomic; | |
| 35415 | + public function getNoSuchMethod(): int { | |
| 35416 | + if (NoSuchMethod::validateNoSuchMethod($this->noSuchMethod)) { | |
| 35417 | + return $this->noSuchMethod; | |
| 35577 | 35418 | } |
| 35578 | - throw new Exception('never get to getNonatomic Nonatomic::nonatomic'); | |
| 35419 | + throw new Exception('never get to getNoSuchMethod NoSuchMethod::noSuchMethod'); | |
| 35579 | 35420 | } |
| 35580 | 35421 | |
| 35581 | 35422 | /** |
| 35582 | 35423 | * @return int |
| 35583 | 35424 | */ |
| 35584 | - public static function sampleNonatomic(): int { | |
| 35585 | - return 31; /*31:nonatomic*/ | |
| 35425 | + public static function sampleNoSuchMethod(): int { | |
| 35426 | + return 31; /*31:noSuchMethod*/ | |
| 35586 | 35427 | } |
| 35587 | 35428 | |
| 35588 | 35429 | /** |
| @@ -35590,7 +35431,7 @@ class Nonatomic { | ||
| 35590 | 35431 | * @return bool |
| 35591 | 35432 | */ |
| 35592 | 35433 | public function validate(): bool { |
| 35593 | - return Nonatomic::validateNonatomic($this->nonatomic); | |
| 35434 | + return NoSuchMethod::validateNoSuchMethod($this->noSuchMethod); | |
| 35594 | 35435 | } |
| 35595 | 35436 | |
| 35596 | 35437 | /** |
| @@ -35599,13 +35440,215 @@ class Nonatomic { | ||
| 35599 | 35440 | */ |
| 35600 | 35441 | public function to(): stdClass { |
| 35601 | 35442 | $out = new stdClass(); |
| 35602 | - $out->{'nonatomic'} = $this->toNonatomic(); | |
| 35443 | + $out->{'noSuchMethod'} = $this->toNoSuchMethod(); | |
| 35603 | 35444 | return $out; |
| 35604 | 35445 | } |
| 35605 | 35446 | |
| 35606 | 35447 | /** |
| 35607 | 35448 | * @param stdClass $obj |
| 35608 | - * @return Nonatomic | |
| 35449 | + * @return NoSuchMethod | |
| 35450 | + * @throws Exception | |
| 35451 | + */ | |
| 35452 | + public static function from(stdClass $obj): NoSuchMethod { | |
| 35453 | + if (!property_exists($obj, 'noSuchMethod')) { | |
| 35454 | + throw new Exception("Missing required property"); | |
| 35455 | + } | |
| 35456 | + return new NoSuchMethod( | |
| 35457 | + NoSuchMethod::fromNoSuchMethod($obj->{'noSuchMethod'}) | |
| 35458 | + ); | |
| 35459 | + } | |
| 35460 | + | |
| 35461 | + /** | |
| 35462 | + * @return NoSuchMethod | |
| 35463 | + */ | |
| 35464 | + public static function sample(): NoSuchMethod { | |
| 35465 | + return new NoSuchMethod( | |
| 35466 | + NoSuchMethod::sampleNoSuchMethod() | |
| 35467 | + ); | |
| 35468 | + } | |
| 35469 | +} | |
| 35470 | + | |
| 35471 | +// This is an autogenerated file:Noexcept | |
| 35472 | + | |
| 35473 | +class Noexcept { | |
| 35474 | + private int $noexcept; // json:noexcept Required | |
| 35475 | + | |
| 35476 | + /** | |
| 35477 | + * @param int $noexcept | |
| 35478 | + */ | |
| 35479 | + public function __construct(int $noexcept) { | |
| 35480 | + $this->noexcept = $noexcept; | |
| 35481 | + } | |
| 35482 | + | |
| 35483 | + /** | |
| 35484 | + * @param int $value | |
| 35485 | + * @throws Exception | |
| 35486 | + * @return int | |
| 35487 | + */ | |
| 35488 | + public static function fromNoexcept(int $value): int { | |
| 35489 | + return $value; /*int*/ | |
| 35490 | + } | |
| 35491 | + | |
| 35492 | + /** | |
| 35493 | + * @throws Exception | |
| 35494 | + * @return int | |
| 35495 | + */ | |
| 35496 | + public function toNoexcept(): int { | |
| 35497 | + if (Noexcept::validateNoexcept($this->noexcept)) { | |
| 35498 | + return $this->noexcept; /*int*/ | |
| 35499 | + } | |
| 35500 | + throw new Exception('never get to this Noexcept::noexcept'); | |
| 35501 | + } | |
| 35502 | + | |
| 35503 | + /** | |
| 35504 | + * @param int | |
| 35505 | + * @return bool | |
| 35506 | + * @throws Exception | |
| 35507 | + */ | |
| 35508 | + public static function validateNoexcept(int $value): bool { | |
| 35509 | + return true; | |
| 35510 | + } | |
| 35511 | + | |
| 35512 | + /** | |
| 35513 | + * @throws Exception | |
| 35514 | + * @return int | |
| 35515 | + */ | |
| 35516 | + public function getNoexcept(): int { | |
| 35517 | + if (Noexcept::validateNoexcept($this->noexcept)) { | |
| 35518 | + return $this->noexcept; | |
| 35519 | + } | |
| 35520 | + throw new Exception('never get to getNoexcept Noexcept::noexcept'); | |
| 35521 | + } | |
| 35522 | + | |
| 35523 | + /** | |
| 35524 | + * @return int | |
| 35525 | + */ | |
| 35526 | + public static function sampleNoexcept(): int { | |
| 35527 | + return 31; /*31:noexcept*/ | |
| 35528 | + } | |
| 35529 | + | |
| 35530 | + /** | |
| 35531 | + * @throws Exception | |
| 35532 | + * @return bool | |
| 35533 | + */ | |
| 35534 | + public function validate(): bool { | |
| 35535 | + return Noexcept::validateNoexcept($this->noexcept); | |
| 35536 | + } | |
| 35537 | + | |
| 35538 | + /** | |
| 35539 | + * @return stdClass | |
| 35540 | + * @throws Exception | |
| 35541 | + */ | |
| 35542 | + public function to(): stdClass { | |
| 35543 | + $out = new stdClass(); | |
| 35544 | + $out->{'noexcept'} = $this->toNoexcept(); | |
| 35545 | + return $out; | |
| 35546 | + } | |
| 35547 | + | |
| 35548 | + /** | |
| 35549 | + * @param stdClass $obj | |
| 35550 | + * @return Noexcept | |
| 35551 | + * @throws Exception | |
| 35552 | + */ | |
| 35553 | + public static function from(stdClass $obj): Noexcept { | |
| 35554 | + if (!property_exists($obj, 'noexcept')) { | |
| 35555 | + throw new Exception("Missing required property"); | |
| 35556 | + } | |
| 35557 | + return new Noexcept( | |
| 35558 | + Noexcept::fromNoexcept($obj->{'noexcept'}) | |
| 35559 | + ); | |
| 35560 | + } | |
| 35561 | + | |
| 35562 | + /** | |
| 35563 | + * @return Noexcept | |
| 35564 | + */ | |
| 35565 | + public static function sample(): Noexcept { | |
| 35566 | + return new Noexcept( | |
| 35567 | + Noexcept::sampleNoexcept() | |
| 35568 | + ); | |
| 35569 | + } | |
| 35570 | +} | |
| 35571 | + | |
| 35572 | +// This is an autogenerated file:Nonatomic | |
| 35573 | + | |
| 35574 | +class Nonatomic { | |
| 35575 | + private int $nonatomic; // json:nonatomic Required | |
| 35576 | + | |
| 35577 | + /** | |
| 35578 | + * @param int $nonatomic | |
| 35579 | + */ | |
| 35580 | + public function __construct(int $nonatomic) { | |
| 35581 | + $this->nonatomic = $nonatomic; | |
| 35582 | + } | |
| 35583 | + | |
| 35584 | + /** | |
| 35585 | + * @param int $value | |
| 35586 | + * @throws Exception | |
| 35587 | + * @return int | |
| 35588 | + */ | |
| 35589 | + public static function fromNonatomic(int $value): int { | |
| 35590 | + return $value; /*int*/ | |
| 35591 | + } | |
| 35592 | + | |
| 35593 | + /** | |
| 35594 | + * @throws Exception | |
| 35595 | + * @return int | |
| 35596 | + */ | |
| 35597 | + public function toNonatomic(): int { | |
| 35598 | + if (Nonatomic::validateNonatomic($this->nonatomic)) { | |
| 35599 | + return $this->nonatomic; /*int*/ | |
| 35600 | + } | |
| 35601 | + throw new Exception('never get to this Nonatomic::nonatomic'); | |
| 35602 | + } | |
| 35603 | + | |
| 35604 | + /** | |
| 35605 | + * @param int | |
| 35606 | + * @return bool | |
| 35607 | + * @throws Exception | |
| 35608 | + */ | |
| 35609 | + public static function validateNonatomic(int $value): bool { | |
| 35610 | + return true; | |
| 35611 | + } | |
| 35612 | + | |
| 35613 | + /** | |
| 35614 | + * @throws Exception | |
| 35615 | + * @return int | |
| 35616 | + */ | |
| 35617 | + public function getNonatomic(): int { | |
| 35618 | + if (Nonatomic::validateNonatomic($this->nonatomic)) { | |
| 35619 | + return $this->nonatomic; | |
| 35620 | + } | |
| 35621 | + throw new Exception('never get to getNonatomic Nonatomic::nonatomic'); | |
| 35622 | + } | |
| 35623 | + | |
| 35624 | + /** | |
| 35625 | + * @return int | |
| 35626 | + */ | |
| 35627 | + public static function sampleNonatomic(): int { | |
| 35628 | + return 31; /*31:nonatomic*/ | |
| 35629 | + } | |
| 35630 | + | |
| 35631 | + /** | |
| 35632 | + * @throws Exception | |
| 35633 | + * @return bool | |
| 35634 | + */ | |
| 35635 | + public function validate(): bool { | |
| 35636 | + return Nonatomic::validateNonatomic($this->nonatomic); | |
| 35637 | + } | |
| 35638 | + | |
| 35639 | + /** | |
| 35640 | + * @return stdClass | |
| 35641 | + * @throws Exception | |
| 35642 | + */ | |
| 35643 | + public function to(): stdClass { | |
| 35644 | + $out = new stdClass(); | |
| 35645 | + $out->{'nonatomic'} = $this->toNonatomic(); | |
| 35646 | + return $out; | |
| 35647 | + } | |
| 35648 | + | |
| 35649 | + /** | |
| 35650 | + * @param stdClass $obj | |
| 35651 | + * @return Nonatomic | |
| 35609 | 35652 | * @throws Exception |
| 35610 | 35653 | */ |
| 35611 | 35654 | public static function from(stdClass $obj): Nonatomic { |
| @@ -41589,209 +41632,7 @@ class Sbyte { | ||
| 41589 | 41632 | } |
| 41590 | 41633 | } |
| 41591 | 41634 | |
| 41592 | -// This is an autogenerated file:Sealed | |
| 41593 | - | |
| 41594 | -class Sealed { | |
| 41595 | - private int $sealed; // json:sealed Required | |
| 41596 | - | |
| 41597 | - /** | |
| 41598 | - * @param int $sealed | |
| 41599 | - */ | |
| 41600 | - public function __construct(int $sealed) { | |
| 41601 | - $this->sealed = $sealed; | |
| 41602 | - } | |
| 41603 | - | |
| 41604 | - /** | |
| 41605 | - * @param int $value | |
| 41606 | - * @throws Exception | |
| 41607 | - * @return int | |
| 41608 | - */ | |
| 41609 | - public static function fromSealed(int $value): int { | |
| 41610 | - return $value; /*int*/ | |
| 41611 | - } | |
| 41612 | - | |
| 41613 | - /** | |
| 41614 | - * @throws Exception | |
| 41615 | - * @return int | |
| 41616 | - */ | |
| 41617 | - public function toSealed(): int { | |
| 41618 | - if (Sealed::validateSealed($this->sealed)) { | |
| 41619 | - return $this->sealed; /*int*/ | |
| 41620 | - } | |
| 41621 | - throw new Exception('never get to this Sealed::sealed'); | |
| 41622 | - } | |
| 41623 | - | |
| 41624 | - /** | |
| 41625 | - * @param int | |
| 41626 | - * @return bool | |
| 41627 | - * @throws Exception | |
| 41628 | - */ | |
| 41629 | - public static function validateSealed(int $value): bool { | |
| 41630 | - return true; | |
| 41631 | - } | |
| 41632 | - | |
| 41633 | - /** | |
| 41634 | - * @throws Exception | |
| 41635 | - * @return int | |
| 41636 | - */ | |
| 41637 | - public function getSealed(): int { | |
| 41638 | - if (Sealed::validateSealed($this->sealed)) { | |
| 41639 | - return $this->sealed; | |
| 41640 | - } | |
| 41641 | - throw new Exception('never get to getSealed Sealed::sealed'); | |
| 41642 | - } | |
| 41643 | - | |
| 41644 | - /** | |
| 41645 | - * @return int | |
| 41646 | - */ | |
| 41647 | - public static function sampleSealed(): int { | |
| 41648 | - return 31; /*31:sealed*/ | |
| 41649 | - } | |
| 41650 | - | |
| 41651 | - /** | |
| 41652 | - * @throws Exception | |
| 41653 | - * @return bool | |
| 41654 | - */ | |
| 41655 | - public function validate(): bool { | |
| 41656 | - return Sealed::validateSealed($this->sealed); | |
| 41657 | - } | |
| 41658 | - | |
| 41659 | - /** | |
| 41660 | - * @return stdClass | |
| 41661 | - * @throws Exception | |
| 41662 | - */ | |
| 41663 | - public function to(): stdClass { | |
| 41664 | - $out = new stdClass(); | |
| 41665 | - $out->{'sealed'} = $this->toSealed(); | |
| 41666 | - return $out; | |
| 41667 | - } | |
| 41668 | - | |
| 41669 | - /** | |
| 41670 | - * @param stdClass $obj | |
| 41671 | - * @return Sealed | |
| 41672 | - * @throws Exception | |
| 41673 | - */ | |
| 41674 | - public static function from(stdClass $obj): Sealed { | |
| 41675 | - if (!property_exists($obj, 'sealed')) { | |
| 41676 | - throw new Exception("Missing required property"); | |
| 41677 | - } | |
| 41678 | - return new Sealed( | |
| 41679 | - Sealed::fromSealed($obj->{'sealed'}) | |
| 41680 | - ); | |
| 41681 | - } | |
| 41682 | - | |
| 41683 | - /** | |
| 41684 | - * @return Sealed | |
| 41685 | - */ | |
| 41686 | - public static function sample(): Sealed { | |
| 41687 | - return new Sealed( | |
| 41688 | - Sealed::sampleSealed() | |
| 41689 | - ); | |
| 41690 | - } | |
| 41691 | -} | |
| 41692 | - | |
| 41693 | -// This is an autogenerated file:Sel | |
| 41694 | - | |
| 41695 | -class Sel { | |
| 41696 | - private int $sel; // json:SEL Required | |
| 41697 | - | |
| 41698 | - /** | |
| 41699 | - * @param int $sel | |
| 41700 | - */ | |
| 41701 | - public function __construct(int $sel) { | |
| 41702 | - $this->sel = $sel; | |
| 41703 | - } | |
| 41704 | - | |
| 41705 | - /** | |
| 41706 | - * @param int $value | |
| 41707 | - * @throws Exception | |
| 41708 | - * @return int | |
| 41709 | - */ | |
| 41710 | - public static function fromSel(int $value): int { | |
| 41711 | - return $value; /*int*/ | |
| 41712 | - } | |
| 41713 | - | |
| 41714 | - /** | |
| 41715 | - * @throws Exception | |
| 41716 | - * @return int | |
| 41717 | - */ | |
| 41718 | - public function toSel(): int { | |
| 41719 | - if (Sel::validateSel($this->sel)) { | |
| 41720 | - return $this->sel; /*int*/ | |
| 41721 | - } | |
| 41722 | - throw new Exception('never get to this Sel::sel'); | |
| 41723 | - } | |
| 41724 | - | |
| 41725 | - /** | |
| 41726 | - * @param int | |
| 41727 | - * @return bool | |
| 41728 | - * @throws Exception | |
| 41729 | - */ | |
| 41730 | - public static function validateSel(int $value): bool { | |
| 41731 | - return true; | |
| 41732 | - } | |
| 41733 | - | |
| 41734 | - /** | |
| 41735 | - * @throws Exception | |
| 41736 | - * @return int | |
| 41737 | - */ | |
| 41738 | - public function getSel(): int { | |
| 41739 | - if (Sel::validateSel($this->sel)) { | |
| 41740 | - return $this->sel; | |
| 41741 | - } | |
| 41742 | - throw new Exception('never get to getSel Sel::sel'); | |
| 41743 | - } | |
| 41744 | - | |
| 41745 | - /** | |
| 41746 | - * @return int | |
| 41747 | - */ | |
| 41748 | - public static function sampleSel(): int { | |
| 41749 | - return 31; /*31:sel*/ | |
| 41750 | - } | |
| 41751 | - | |
| 41752 | - /** | |
| 41753 | - * @throws Exception | |
| 41754 | - * @return bool | |
| 41755 | - */ | |
| 41756 | - public function validate(): bool { | |
| 41757 | - return Sel::validateSel($this->sel); | |
| 41758 | - } | |
| 41759 | - | |
| 41760 | - /** | |
| 41761 | - * @return stdClass | |
| 41762 | - * @throws Exception | |
| 41763 | - */ | |
| 41764 | - public function to(): stdClass { | |
| 41765 | - $out = new stdClass(); | |
| 41766 | - $out->{'SEL'} = $this->toSel(); | |
| 41767 | - return $out; | |
| 41768 | - } | |
| 41769 | - | |
| 41770 | - /** | |
| 41771 | - * @param stdClass $obj | |
| 41772 | - * @return Sel | |
| 41773 | - * @throws Exception | |
| 41774 | - */ | |
| 41775 | - public static function from(stdClass $obj): Sel { | |
| 41776 | - if (!property_exists($obj, 'SEL')) { | |
| 41777 | - throw new Exception("Missing required property"); | |
| 41778 | - } | |
| 41779 | - return new Sel( | |
| 41780 | - Sel::fromSel($obj->{'SEL'}) | |
| 41781 | - ); | |
| 41782 | - } | |
| 41783 | - | |
| 41784 | - /** | |
| 41785 | - * @return Sel | |
| 41786 | - */ | |
| 41787 | - public static function sample(): Sel { | |
| 41788 | - return new Sel( | |
| 41789 | - Sel::sampleSel() | |
| 41790 | - ); | |
| 41791 | - } | |
| 41792 | -} | |
| 41793 | - | |
| 41794 | -// This is an autogenerated file:Obj5 | |
| 41635 | +// This is an autogenerated file:Obj5 | |
| 41795 | 41636 | |
| 41796 | 41637 | class Obj5 { |
| 41797 | 41638 | private int $dummy; // json:dummy Required |
| @@ -41801,6 +41642,8 @@ class Obj5 { | ||
| 41801 | 41642 | private Obj5True $obj5True; // json:true Required |
| 41802 | 41643 | private TypeClass $obj5Type; // json:type Required |
| 41803 | 41644 | private PrimitiveKind $primitiveKind; // json:PrimitiveKind Required |
| 41645 | + private Sealed $sealed; // json:sealed Required | |
| 41646 | + private Sel $sel; // json:SEL Required | |
| 41804 | 41647 | private Select $select; // json:select Required |
| 41805 | 41648 | private SelfClass $self; // json:Self Required |
| 41806 | 41649 | private Sendable $sendable; // json:Sendable Required |
| @@ -41857,9 +41700,6 @@ class Obj5 { | ||
| 41857 | 41700 | private Undefined $undefined; // json:undefined Required |
| 41858 | 41701 | private Union $union; // json:union Required |
| 41859 | 41702 | private UnmarshalJSON $unmarshalJSON; // json:UnmarshalJSON Required |
| 41860 | - private Unowned $unowned; // json:unowned Required | |
| 41861 | - private Unsafe $unsafe; // json:unsafe Required | |
| 41862 | - private UseSerializers $useSerializers; // json:UseSerializers Required | |
| 41863 | 41703 | |
| 41864 | 41704 | /** |
| 41865 | 41705 | * @param int $dummy |
| @@ -41869,6 +41709,8 @@ class Obj5 { | ||
| 41869 | 41709 | * @param Obj5True $obj5True |
| 41870 | 41710 | * @param TypeClass $obj5Type |
| 41871 | 41711 | * @param PrimitiveKind $primitiveKind |
| 41712 | + * @param Sealed $sealed | |
| 41713 | + * @param Sel $sel | |
| 41872 | 41714 | * @param Select $select |
| 41873 | 41715 | * @param SelfClass $self |
| 41874 | 41716 | * @param Sendable $sendable |
| @@ -41925,11 +41767,8 @@ class Obj5 { | ||
| 41925 | 41767 | * @param Undefined $undefined |
| 41926 | 41768 | * @param Union $union |
| 41927 | 41769 | * @param UnmarshalJSON $unmarshalJSON |
| 41928 | - * @param Unowned $unowned | |
| 41929 | - * @param Unsafe $unsafe | |
| 41930 | - * @param UseSerializers $useSerializers | |
| 41931 | 41770 | */ |
| 41932 | - public function __construct(int $dummy, KSerializer $kSerializer, Obj5Self $obj5Self, This $obj5This, Obj5True $obj5True, TypeClass $obj5Type, PrimitiveKind $primitiveKind, Select $select, SelfClass $self, Sendable $sendable, SerialDescriptor $serialDescriptor, SerialName $serialName, SerializableClass $serializable, Serialize $serialize, SerializerProvider $serializerProvider, Set $set, Short $short, Signed $signed, SimpleModule $simpleModule, Sizeof $sizeof, Stackalloc $stackalloc, Standards $standards, StaticClass $static, StaticAssert $staticAssert, StaticCast $staticCast, StdDeserializer $stdDeserializer, StdSerializer $stdSerializer, Strictfp $strictfp, StringClass $string, Struct $struct, Subscript $subscript, Super $super, SwitchClass $switch, Symbol $symbol, Synchronized $synchronized, System $system, Template $template, Then $then, ThreadLocal $threadLocal, ThrowClass $throw, Throws $throws, TimeOnly $timeOnly, TimeOnlyConverter $timeOnlyConverter, TimeZone $timeZone, ToDict $toDict, ToJSON $toJSON, ToString $toString, TopLevelClass $topLevel, Transient $transient, TrueClass $true, TryClass $try, Type $type, Typealias $typealias, Typedef $typedef, Typeid $typeid, Typename $typename, Typeof $typeof, Uint $uint, Ulong $ulong, Unchecked $unchecked, Undefined $undefined, Union $union, UnmarshalJSON $unmarshalJSON, Unowned $unowned, Unsafe $unsafe, UseSerializers $useSerializers) { | |
| 41771 | + public function __construct(int $dummy, KSerializer $kSerializer, Obj5Self $obj5Self, This $obj5This, Obj5True $obj5True, TypeClass $obj5Type, PrimitiveKind $primitiveKind, Sealed $sealed, Sel $sel, Select $select, SelfClass $self, Sendable $sendable, SerialDescriptor $serialDescriptor, SerialName $serialName, SerializableClass $serializable, Serialize $serialize, SerializerProvider $serializerProvider, Set $set, Short $short, Signed $signed, SimpleModule $simpleModule, Sizeof $sizeof, Stackalloc $stackalloc, Standards $standards, StaticClass $static, StaticAssert $staticAssert, StaticCast $staticCast, StdDeserializer $stdDeserializer, StdSerializer $stdSerializer, Strictfp $strictfp, StringClass $string, Struct $struct, Subscript $subscript, Super $super, SwitchClass $switch, Symbol $symbol, Synchronized $synchronized, System $system, Template $template, Then $then, ThreadLocal $threadLocal, ThrowClass $throw, Throws $throws, TimeOnly $timeOnly, TimeOnlyConverter $timeOnlyConverter, TimeZone $timeZone, ToDict $toDict, ToJSON $toJSON, ToString $toString, TopLevelClass $topLevel, Transient $transient, TrueClass $true, TryClass $try, Type $type, Typealias $typealias, Typedef $typedef, Typeid $typeid, Typename $typename, Typeof $typeof, Uint $uint, Ulong $ulong, Unchecked $unchecked, Undefined $undefined, Union $union, UnmarshalJSON $unmarshalJSON) { | |
| 41933 | 41772 | $this->dummy = $dummy; |
| 41934 | 41773 | $this->kSerializer = $kSerializer; |
| 41935 | 41774 | $this->obj5Self = $obj5Self; |
| @@ -41937,6 +41776,8 @@ class Obj5 { | ||
| 41937 | 41776 | $this->obj5True = $obj5True; |
| 41938 | 41777 | $this->obj5Type = $obj5Type; |
| 41939 | 41778 | $this->primitiveKind = $primitiveKind; |
| 41779 | + $this->sealed = $sealed; | |
| 41780 | + $this->sel = $sel; | |
| 41940 | 41781 | $this->select = $select; |
| 41941 | 41782 | $this->self = $self; |
| 41942 | 41783 | $this->sendable = $sendable; |
| @@ -41993,9 +41834,6 @@ class Obj5 { | ||
| 41993 | 41834 | $this->undefined = $undefined; |
| 41994 | 41835 | $this->union = $union; |
| 41995 | 41836 | $this->unmarshalJSON = $unmarshalJSON; |
| 41996 | - $this->unowned = $unowned; | |
| 41997 | - $this->unsafe = $unsafe; | |
| 41998 | - $this->useSerializers = $useSerializers; | |
| 41999 | 41837 | } |
| 42000 | 41838 | |
| 42001 | 41839 | /** |
| @@ -42333,6 +42171,102 @@ class Obj5 { | ||
| 42333 | 42171 | return PrimitiveKind::sample(); /*37:primitiveKind*/ |
| 42334 | 42172 | } |
| 42335 | 42173 | |
| 42174 | + /** | |
| 42175 | + * @param stdClass $value | |
| 42176 | + * @throws Exception | |
| 42177 | + * @return Sealed | |
| 42178 | + */ | |
| 42179 | + public static function fromSealed(stdClass $value): Sealed { | |
| 42180 | + return Sealed::from($value); /*class*/ | |
| 42181 | + } | |
| 42182 | + | |
| 42183 | + /** | |
| 42184 | + * @throws Exception | |
| 42185 | + * @return stdClass | |
| 42186 | + */ | |
| 42187 | + public function toSealed(): stdClass { | |
| 42188 | + if (Obj5::validateSealed($this->sealed)) { | |
| 42189 | + return $this->sealed->to(); /*class*/ | |
| 42190 | + } | |
| 42191 | + throw new Exception('never get to this Obj5::sealed'); | |
| 42192 | + } | |
| 42193 | + | |
| 42194 | + /** | |
| 42195 | + * @param Sealed | |
| 42196 | + * @return bool | |
| 42197 | + * @throws Exception | |
| 42198 | + */ | |
| 42199 | + public static function validateSealed(Sealed $value): bool { | |
| 42200 | + $value->validate(); | |
| 42201 | + return true; | |
| 42202 | + } | |
| 42203 | + | |
| 42204 | + /** | |
| 42205 | + * @throws Exception | |
| 42206 | + * @return Sealed | |
| 42207 | + */ | |
| 42208 | + public function getSealed(): Sealed { | |
| 42209 | + if (Obj5::validateSealed($this->sealed)) { | |
| 42210 | + return $this->sealed; | |
| 42211 | + } | |
| 42212 | + throw new Exception('never get to getSealed Obj5::sealed'); | |
| 42213 | + } | |
| 42214 | + | |
| 42215 | + /** | |
| 42216 | + * @return Sealed | |
| 42217 | + */ | |
| 42218 | + public static function sampleSealed(): Sealed { | |
| 42219 | + return Sealed::sample(); /*38:sealed*/ | |
| 42220 | + } | |
| 42221 | + | |
| 42222 | + /** | |
| 42223 | + * @param stdClass $value | |
| 42224 | + * @throws Exception | |
| 42225 | + * @return Sel | |
| 42226 | + */ | |
| 42227 | + public static function fromSel(stdClass $value): Sel { | |
| 42228 | + return Sel::from($value); /*class*/ | |
| 42229 | + } | |
| 42230 | + | |
| 42231 | + /** | |
| 42232 | + * @throws Exception | |
| 42233 | + * @return stdClass | |
| 42234 | + */ | |
| 42235 | + public function toSel(): stdClass { | |
| 42236 | + if (Obj5::validateSel($this->sel)) { | |
| 42237 | + return $this->sel->to(); /*class*/ | |
| 42238 | + } | |
| 42239 | + throw new Exception('never get to this Obj5::sel'); | |
| 42240 | + } | |
| 42241 | + | |
| 42242 | + /** | |
| 42243 | + * @param Sel | |
| 42244 | + * @return bool | |
| 42245 | + * @throws Exception | |
| 42246 | + */ | |
| 42247 | + public static function validateSel(Sel $value): bool { | |
| 42248 | + $value->validate(); | |
| 42249 | + return true; | |
| 42250 | + } | |
| 42251 | + | |
| 42252 | + /** | |
| 42253 | + * @throws Exception | |
| 42254 | + * @return Sel | |
| 42255 | + */ | |
| 42256 | + public function getSel(): Sel { | |
| 42257 | + if (Obj5::validateSel($this->sel)) { | |
| 42258 | + return $this->sel; | |
| 42259 | + } | |
| 42260 | + throw new Exception('never get to getSel Obj5::sel'); | |
| 42261 | + } | |
| 42262 | + | |
| 42263 | + /** | |
| 42264 | + * @return Sel | |
| 42265 | + */ | |
| 42266 | + public static function sampleSel(): Sel { | |
| 42267 | + return Sel::sample(); /*39:sel*/ | |
| 42268 | + } | |
| 42269 | + | |
| 42336 | 42270 | /** |
| 42337 | 42271 | * @param stdClass $value |
| 42338 | 42272 | * @throws Exception |
| @@ -42378,7 +42312,7 @@ class Obj5 { | ||
| 42378 | 42312 | * @return Select |
| 42379 | 42313 | */ |
| 42380 | 42314 | public static function sampleSelect(): Select { |
| 42381 | - return Select::sample(); /*38:select*/ | |
| 42315 | + return Select::sample(); /*40:select*/ | |
| 42382 | 42316 | } |
| 42383 | 42317 | |
| 42384 | 42318 | /** |
| @@ -42426,7 +42360,7 @@ class Obj5 { | ||
| 42426 | 42360 | * @return SelfClass |
| 42427 | 42361 | */ |
| 42428 | 42362 | public static function sampleSelf(): SelfClass { |
| 42429 | - return SelfClass::sample(); /*39:self*/ | |
| 42363 | + return SelfClass::sample(); /*41:self*/ | |
| 42430 | 42364 | } |
| 42431 | 42365 | |
| 42432 | 42366 | /** |
| @@ -42474,7 +42408,7 @@ class Obj5 { | ||
| 42474 | 42408 | * @return Sendable |
| 42475 | 42409 | */ |
| 42476 | 42410 | public static function sampleSendable(): Sendable { |
| 42477 | - return Sendable::sample(); /*40:sendable*/ | |
| 42411 | + return Sendable::sample(); /*42:sendable*/ | |
| 42478 | 42412 | } |
| 42479 | 42413 | |
| 42480 | 42414 | /** |
| @@ -42522,7 +42456,7 @@ class Obj5 { | ||
| 42522 | 42456 | * @return SerialDescriptor |
| 42523 | 42457 | */ |
| 42524 | 42458 | public static function sampleSerialDescriptor(): SerialDescriptor { |
| 42525 | - return SerialDescriptor::sample(); /*41:serialDescriptor*/ | |
| 42459 | + return SerialDescriptor::sample(); /*43:serialDescriptor*/ | |
| 42526 | 42460 | } |
| 42527 | 42461 | |
| 42528 | 42462 | /** |
| @@ -42570,7 +42504,7 @@ class Obj5 { | ||
| 42570 | 42504 | * @return SerialName |
| 42571 | 42505 | */ |
| 42572 | 42506 | public static function sampleSerialName(): SerialName { |
| 42573 | - return SerialName::sample(); /*42:serialName*/ | |
| 42507 | + return SerialName::sample(); /*44:serialName*/ | |
| 42574 | 42508 | } |
| 42575 | 42509 | |
| 42576 | 42510 | /** |
| @@ -42618,7 +42552,7 @@ class Obj5 { | ||
| 42618 | 42552 | * @return SerializableClass |
| 42619 | 42553 | */ |
| 42620 | 42554 | public static function sampleSerializable(): SerializableClass { |
| 42621 | - return SerializableClass::sample(); /*43:serializable*/ | |
| 42555 | + return SerializableClass::sample(); /*45:serializable*/ | |
| 42622 | 42556 | } |
| 42623 | 42557 | |
| 42624 | 42558 | /** |
| @@ -42666,7 +42600,7 @@ class Obj5 { | ||
| 42666 | 42600 | * @return Serialize |
| 42667 | 42601 | */ |
| 42668 | 42602 | public static function sampleSerialize(): Serialize { |
| 42669 | - return Serialize::sample(); /*44:serialize*/ | |
| 42603 | + return Serialize::sample(); /*46:serialize*/ | |
| 42670 | 42604 | } |
| 42671 | 42605 | |
| 42672 | 42606 | /** |
| @@ -42714,7 +42648,7 @@ class Obj5 { | ||
| 42714 | 42648 | * @return SerializerProvider |
| 42715 | 42649 | */ |
| 42716 | 42650 | public static function sampleSerializerProvider(): SerializerProvider { |
| 42717 | - return SerializerProvider::sample(); /*45:serializerProvider*/ | |
| 42651 | + return SerializerProvider::sample(); /*47:serializerProvider*/ | |
| 42718 | 42652 | } |
| 42719 | 42653 | |
| 42720 | 42654 | /** |
| @@ -42762,7 +42696,7 @@ class Obj5 { | ||
| 42762 | 42696 | * @return Set |
| 42763 | 42697 | */ |
| 42764 | 42698 | public static function sampleSet(): Set { |
| 42765 | - return Set::sample(); /*46:set*/ | |
| 42699 | + return Set::sample(); /*48:set*/ | |
| 42766 | 42700 | } |
| 42767 | 42701 | |
| 42768 | 42702 | /** |
| @@ -42810,7 +42744,7 @@ class Obj5 { | ||
| 42810 | 42744 | * @return Short |
| 42811 | 42745 | */ |
| 42812 | 42746 | public static function sampleShort(): Short { |
| 42813 | - return Short::sample(); /*47:short*/ | |
| 42747 | + return Short::sample(); /*49:short*/ | |
| 42814 | 42748 | } |
| 42815 | 42749 | |
| 42816 | 42750 | /** |
| @@ -42858,7 +42792,7 @@ class Obj5 { | ||
| 42858 | 42792 | * @return Signed |
| 42859 | 42793 | */ |
| 42860 | 42794 | public static function sampleSigned(): Signed { |
| 42861 | - return Signed::sample(); /*48:signed*/ | |
| 42795 | + return Signed::sample(); /*50:signed*/ | |
| 42862 | 42796 | } |
| 42863 | 42797 | |
| 42864 | 42798 | /** |
| @@ -42906,7 +42840,7 @@ class Obj5 { | ||
| 42906 | 42840 | * @return SimpleModule |
| 42907 | 42841 | */ |
| 42908 | 42842 | public static function sampleSimpleModule(): SimpleModule { |
| 42909 | - return SimpleModule::sample(); /*49:simpleModule*/ | |
| 42843 | + return SimpleModule::sample(); /*51:simpleModule*/ | |
| 42910 | 42844 | } |
| 42911 | 42845 | |
| 42912 | 42846 | /** |
| @@ -42954,7 +42888,7 @@ class Obj5 { | ||
| 42954 | 42888 | * @return Sizeof |
| 42955 | 42889 | */ |
| 42956 | 42890 | public static function sampleSizeof(): Sizeof { |
| 42957 | - return Sizeof::sample(); /*50:sizeof*/ | |
| 42891 | + return Sizeof::sample(); /*52:sizeof*/ | |
| 42958 | 42892 | } |
| 42959 | 42893 | |
| 42960 | 42894 | /** |
| @@ -43002,7 +42936,7 @@ class Obj5 { | ||
| 43002 | 42936 | * @return Stackalloc |
| 43003 | 42937 | */ |
| 43004 | 42938 | public static function sampleStackalloc(): Stackalloc { |
| 43005 | - return Stackalloc::sample(); /*51:stackalloc*/ | |
| 42939 | + return Stackalloc::sample(); /*53:stackalloc*/ | |
| 43006 | 42940 | } |
| 43007 | 42941 | |
| 43008 | 42942 | /** |
| @@ -43050,7 +42984,7 @@ class Obj5 { | ||
| 43050 | 42984 | * @return Standards |
| 43051 | 42985 | */ |
| 43052 | 42986 | public static function sampleStandards(): Standards { |
| 43053 | - return Standards::sample(); /*52:standards*/ | |
| 42987 | + return Standards::sample(); /*54:standards*/ | |
| 43054 | 42988 | } |
| 43055 | 42989 | |
| 43056 | 42990 | /** |
| @@ -43098,7 +43032,7 @@ class Obj5 { | ||
| 43098 | 43032 | * @return StaticClass |
| 43099 | 43033 | */ |
| 43100 | 43034 | public static function sampleStatic(): StaticClass { |
| 43101 | - return StaticClass::sample(); /*53:static*/ | |
| 43035 | + return StaticClass::sample(); /*55:static*/ | |
| 43102 | 43036 | } |
| 43103 | 43037 | |
| 43104 | 43038 | /** |
| @@ -43146,7 +43080,7 @@ class Obj5 { | ||
| 43146 | 43080 | * @return StaticAssert |
| 43147 | 43081 | */ |
| 43148 | 43082 | public static function sampleStaticAssert(): StaticAssert { |
| 43149 | - return StaticAssert::sample(); /*54:staticAssert*/ | |
| 43083 | + return StaticAssert::sample(); /*56:staticAssert*/ | |
| 43150 | 43084 | } |
| 43151 | 43085 | |
| 43152 | 43086 | /** |
| @@ -43194,7 +43128,7 @@ class Obj5 { | ||
| 43194 | 43128 | * @return StaticCast |
| 43195 | 43129 | */ |
| 43196 | 43130 | public static function sampleStaticCast(): StaticCast { |
| 43197 | - return StaticCast::sample(); /*55:staticCast*/ | |
| 43131 | + return StaticCast::sample(); /*57:staticCast*/ | |
| 43198 | 43132 | } |
| 43199 | 43133 | |
| 43200 | 43134 | /** |
| @@ -43242,7 +43176,7 @@ class Obj5 { | ||
| 43242 | 43176 | * @return StdDeserializer |
| 43243 | 43177 | */ |
| 43244 | 43178 | public static function sampleStdDeserializer(): StdDeserializer { |
| 43245 | - return StdDeserializer::sample(); /*56:stdDeserializer*/ | |
| 43179 | + return StdDeserializer::sample(); /*58:stdDeserializer*/ | |
| 43246 | 43180 | } |
| 43247 | 43181 | |
| 43248 | 43182 | /** |
| @@ -43290,7 +43224,7 @@ class Obj5 { | ||
| 43290 | 43224 | * @return StdSerializer |
| 43291 | 43225 | */ |
| 43292 | 43226 | public static function sampleStdSerializer(): StdSerializer { |
| 43293 | - return StdSerializer::sample(); /*57:stdSerializer*/ | |
| 43227 | + return StdSerializer::sample(); /*59:stdSerializer*/ | |
| 43294 | 43228 | } |
| 43295 | 43229 | |
| 43296 | 43230 | /** |
| @@ -43338,7 +43272,7 @@ class Obj5 { | ||
| 43338 | 43272 | * @return Strictfp |
| 43339 | 43273 | */ |
| 43340 | 43274 | public static function sampleStrictfp(): Strictfp { |
| 43341 | - return Strictfp::sample(); /*58:strictfp*/ | |
| 43275 | + return Strictfp::sample(); /*60:strictfp*/ | |
| 43342 | 43276 | } |
| 43343 | 43277 | |
| 43344 | 43278 | /** |
| @@ -43386,7 +43320,7 @@ class Obj5 { | ||
| 43386 | 43320 | * @return StringClass |
| 43387 | 43321 | */ |
| 43388 | 43322 | public static function sampleString(): StringClass { |
| 43389 | - return StringClass::sample(); /*59:string*/ | |
| 43323 | + return StringClass::sample(); /*61:string*/ | |
| 43390 | 43324 | } |
| 43391 | 43325 | |
| 43392 | 43326 | /** |
| @@ -43434,7 +43368,7 @@ class Obj5 { | ||
| 43434 | 43368 | * @return Struct |
| 43435 | 43369 | */ |
| 43436 | 43370 | public static function sampleStruct(): Struct { |
| 43437 | - return Struct::sample(); /*60:struct*/ | |
| 43371 | + return Struct::sample(); /*62:struct*/ | |
| 43438 | 43372 | } |
| 43439 | 43373 | |
| 43440 | 43374 | /** |
| @@ -43482,7 +43416,7 @@ class Obj5 { | ||
| 43482 | 43416 | * @return Subscript |
| 43483 | 43417 | */ |
| 43484 | 43418 | public static function sampleSubscript(): Subscript { |
| 43485 | - return Subscript::sample(); /*61:subscript*/ | |
| 43419 | + return Subscript::sample(); /*63:subscript*/ | |
| 43486 | 43420 | } |
| 43487 | 43421 | |
| 43488 | 43422 | /** |
| @@ -43530,7 +43464,7 @@ class Obj5 { | ||
| 43530 | 43464 | * @return Super |
| 43531 | 43465 | */ |
| 43532 | 43466 | public static function sampleSuper(): Super { |
| 43533 | - return Super::sample(); /*62:super*/ | |
| 43467 | + return Super::sample(); /*64:super*/ | |
| 43534 | 43468 | } |
| 43535 | 43469 | |
| 43536 | 43470 | /** |
| @@ -43578,7 +43512,7 @@ class Obj5 { | ||
| 43578 | 43512 | * @return SwitchClass |
| 43579 | 43513 | */ |
| 43580 | 43514 | public static function sampleSwitch(): SwitchClass { |
| 43581 | - return SwitchClass::sample(); /*63:switch*/ | |
| 43515 | + return SwitchClass::sample(); /*65:switch*/ | |
| 43582 | 43516 | } |
| 43583 | 43517 | |
| 43584 | 43518 | /** |
| @@ -43626,7 +43560,7 @@ class Obj5 { | ||
| 43626 | 43560 | * @return Symbol |
| 43627 | 43561 | */ |
| 43628 | 43562 | public static function sampleSymbol(): Symbol { |
| 43629 | - return Symbol::sample(); /*64:symbol*/ | |
| 43563 | + return Symbol::sample(); /*66:symbol*/ | |
| 43630 | 43564 | } |
| 43631 | 43565 | |
| 43632 | 43566 | /** |
| @@ -43674,7 +43608,7 @@ class Obj5 { | ||
| 43674 | 43608 | * @return Synchronized |
| 43675 | 43609 | */ |
| 43676 | 43610 | public static function sampleSynchronized(): Synchronized { |
| 43677 | - return Synchronized::sample(); /*65:synchronized*/ | |
| 43611 | + return Synchronized::sample(); /*67:synchronized*/ | |
| 43678 | 43612 | } |
| 43679 | 43613 | |
| 43680 | 43614 | /** |
| @@ -43722,7 +43656,7 @@ class Obj5 { | ||
| 43722 | 43656 | * @return System |
| 43723 | 43657 | */ |
| 43724 | 43658 | public static function sampleSystem(): System { |
| 43725 | - return System::sample(); /*66:system*/ | |
| 43659 | + return System::sample(); /*68:system*/ | |
| 43726 | 43660 | } |
| 43727 | 43661 | |
| 43728 | 43662 | /** |
| @@ -43770,7 +43704,7 @@ class Obj5 { | ||
| 43770 | 43704 | * @return Template |
| 43771 | 43705 | */ |
| 43772 | 43706 | public static function sampleTemplate(): Template { |
| 43773 | - return Template::sample(); /*67:template*/ | |
| 43707 | + return Template::sample(); /*69:template*/ | |
| 43774 | 43708 | } |
| 43775 | 43709 | |
| 43776 | 43710 | /** |
| @@ -43818,7 +43752,7 @@ class Obj5 { | ||
| 43818 | 43752 | * @return Then |
| 43819 | 43753 | */ |
| 43820 | 43754 | public static function sampleThen(): Then { |
| 43821 | - return Then::sample(); /*68:then*/ | |
| 43755 | + return Then::sample(); /*70:then*/ | |
| 43822 | 43756 | } |
| 43823 | 43757 | |
| 43824 | 43758 | /** |
| @@ -43866,7 +43800,7 @@ class Obj5 { | ||
| 43866 | 43800 | * @return ThreadLocal |
| 43867 | 43801 | */ |
| 43868 | 43802 | public static function sampleThreadLocal(): ThreadLocal { |
| 43869 | - return ThreadLocal::sample(); /*69:threadLocal*/ | |
| 43803 | + return ThreadLocal::sample(); /*71:threadLocal*/ | |
| 43870 | 43804 | } |
| 43871 | 43805 | |
| 43872 | 43806 | /** |
| @@ -43914,7 +43848,7 @@ class Obj5 { | ||
| 43914 | 43848 | * @return ThrowClass |
| 43915 | 43849 | */ |
| 43916 | 43850 | public static function sampleThrow(): ThrowClass { |
| 43917 | - return ThrowClass::sample(); /*70:throw*/ | |
| 43851 | + return ThrowClass::sample(); /*72:throw*/ | |
| 43918 | 43852 | } |
| 43919 | 43853 | |
| 43920 | 43854 | /** |
| @@ -43962,7 +43896,7 @@ class Obj5 { | ||
| 43962 | 43896 | * @return Throws |
| 43963 | 43897 | */ |
| 43964 | 43898 | public static function sampleThrows(): Throws { |
| 43965 | - return Throws::sample(); /*71:throws*/ | |
| 43899 | + return Throws::sample(); /*73:throws*/ | |
| 43966 | 43900 | } |
| 43967 | 43901 | |
| 43968 | 43902 | /** |
| @@ -44010,7 +43944,7 @@ class Obj5 { | ||
| 44010 | 43944 | * @return TimeOnly |
| 44011 | 43945 | */ |
| 44012 | 43946 | public static function sampleTimeOnly(): TimeOnly { |
| 44013 | - return TimeOnly::sample(); /*72:timeOnly*/ | |
| 43947 | + return TimeOnly::sample(); /*74:timeOnly*/ | |
| 44014 | 43948 | } |
| 44015 | 43949 | |
| 44016 | 43950 | /** |
| @@ -44058,7 +43992,7 @@ class Obj5 { | ||
| 44058 | 43992 | * @return TimeOnlyConverter |
| 44059 | 43993 | */ |
| 44060 | 43994 | public static function sampleTimeOnlyConverter(): TimeOnlyConverter { |
| 44061 | - return TimeOnlyConverter::sample(); /*73:timeOnlyConverter*/ | |
| 43995 | + return TimeOnlyConverter::sample(); /*75:timeOnlyConverter*/ | |
| 44062 | 43996 | } |
| 44063 | 43997 | |
| 44064 | 43998 | /** |
| @@ -44106,7 +44040,7 @@ class Obj5 { | ||
| 44106 | 44040 | * @return TimeZone |
| 44107 | 44041 | */ |
| 44108 | 44042 | public static function sampleTimeZone(): TimeZone { |
| 44109 | - return TimeZone::sample(); /*74:timeZone*/ | |
| 44043 | + return TimeZone::sample(); /*76:timeZone*/ | |
| 44110 | 44044 | } |
| 44111 | 44045 | |
| 44112 | 44046 | /** |
| @@ -44154,7 +44088,7 @@ class Obj5 { | ||
| 44154 | 44088 | * @return ToDict |
| 44155 | 44089 | */ |
| 44156 | 44090 | public static function sampleToDict(): ToDict { |
| 44157 | - return ToDict::sample(); /*75:toDict*/ | |
| 44091 | + return ToDict::sample(); /*77:toDict*/ | |
| 44158 | 44092 | } |
| 44159 | 44093 | |
| 44160 | 44094 | /** |
| @@ -44202,7 +44136,7 @@ class Obj5 { | ||
| 44202 | 44136 | * @return ToJSON |
| 44203 | 44137 | */ |
| 44204 | 44138 | public static function sampleToJSON(): ToJSON { |
| 44205 | - return ToJSON::sample(); /*76:toJSON*/ | |
| 44139 | + return ToJSON::sample(); /*78:toJSON*/ | |
| 44206 | 44140 | } |
| 44207 | 44141 | |
| 44208 | 44142 | /** |
| @@ -44250,7 +44184,7 @@ class Obj5 { | ||
| 44250 | 44184 | * @return ToString |
| 44251 | 44185 | */ |
| 44252 | 44186 | public static function sampleToString(): ToString { |
| 44253 | - return ToString::sample(); /*77:toString*/ | |
| 44187 | + return ToString::sample(); /*79:toString*/ | |
| 44254 | 44188 | } |
| 44255 | 44189 | |
| 44256 | 44190 | /** |
| @@ -44298,7 +44232,7 @@ class Obj5 { | ||
| 44298 | 44232 | * @return TopLevelClass |
| 44299 | 44233 | */ |
| 44300 | 44234 | public static function sampleTopLevel(): TopLevelClass { |
| 44301 | - return TopLevelClass::sample(); /*78:topLevel*/ | |
| 44235 | + return TopLevelClass::sample(); /*80:topLevel*/ | |
| 44302 | 44236 | } |
| 44303 | 44237 | |
| 44304 | 44238 | /** |
| @@ -44346,7 +44280,7 @@ class Obj5 { | ||
| 44346 | 44280 | * @return Transient |
| 44347 | 44281 | */ |
| 44348 | 44282 | public static function sampleTransient(): Transient { |
| 44349 | - return Transient::sample(); /*79:transient*/ | |
| 44283 | + return Transient::sample(); /*81:transient*/ | |
| 44350 | 44284 | } |
| 44351 | 44285 | |
| 44352 | 44286 | /** |
| @@ -44394,7 +44328,7 @@ class Obj5 { | ||
| 44394 | 44328 | * @return TrueClass |
| 44395 | 44329 | */ |
| 44396 | 44330 | public static function sampleTrue(): TrueClass { |
| 44397 | - return TrueClass::sample(); /*80:true*/ | |
| 44331 | + return TrueClass::sample(); /*82:true*/ | |
| 44398 | 44332 | } |
| 44399 | 44333 | |
| 44400 | 44334 | /** |
| @@ -44442,7 +44376,7 @@ class Obj5 { | ||
| 44442 | 44376 | * @return TryClass |
| 44443 | 44377 | */ |
| 44444 | 44378 | public static function sampleTry(): TryClass { |
| 44445 | - return TryClass::sample(); /*81:try*/ | |
| 44379 | + return TryClass::sample(); /*83:try*/ | |
| 44446 | 44380 | } |
| 44447 | 44381 | |
| 44448 | 44382 | /** |
| @@ -44490,7 +44424,7 @@ class Obj5 { | ||
| 44490 | 44424 | * @return Type |
| 44491 | 44425 | */ |
| 44492 | 44426 | public static function sampleType(): Type { |
| 44493 | - return Type::sample(); /*82:type*/ | |
| 44427 | + return Type::sample(); /*84:type*/ | |
| 44494 | 44428 | } |
| 44495 | 44429 | |
| 44496 | 44430 | /** |
| @@ -44538,7 +44472,7 @@ class Obj5 { | ||
| 44538 | 44472 | * @return Typealias |
| 44539 | 44473 | */ |
| 44540 | 44474 | public static function sampleTypealias(): Typealias { |
| 44541 | - return Typealias::sample(); /*83:typealias*/ | |
| 44475 | + return Typealias::sample(); /*85:typealias*/ | |
| 44542 | 44476 | } |
| 44543 | 44477 | |
| 44544 | 44478 | /** |
| @@ -44586,7 +44520,7 @@ class Obj5 { | ||
| 44586 | 44520 | * @return Typedef |
| 44587 | 44521 | */ |
| 44588 | 44522 | public static function sampleTypedef(): Typedef { |
| 44589 | - return Typedef::sample(); /*84:typedef*/ | |
| 44523 | + return Typedef::sample(); /*86:typedef*/ | |
| 44590 | 44524 | } |
| 44591 | 44525 | |
| 44592 | 44526 | /** |
| @@ -44634,7 +44568,7 @@ class Obj5 { | ||
| 44634 | 44568 | * @return Typeid |
| 44635 | 44569 | */ |
| 44636 | 44570 | public static function sampleTypeid(): Typeid { |
| 44637 | - return Typeid::sample(); /*85:typeid*/ | |
| 44571 | + return Typeid::sample(); /*87:typeid*/ | |
| 44638 | 44572 | } |
| 44639 | 44573 | |
| 44640 | 44574 | /** |
| @@ -44682,7 +44616,7 @@ class Obj5 { | ||
| 44682 | 44616 | * @return Typename |
| 44683 | 44617 | */ |
| 44684 | 44618 | public static function sampleTypename(): Typename { |
| 44685 | - return Typename::sample(); /*86:typename*/ | |
| 44619 | + return Typename::sample(); /*88:typename*/ | |
| 44686 | 44620 | } |
| 44687 | 44621 | |
| 44688 | 44622 | /** |
| @@ -44730,7 +44664,7 @@ class Obj5 { | ||
| 44730 | 44664 | * @return Typeof |
| 44731 | 44665 | */ |
| 44732 | 44666 | public static function sampleTypeof(): Typeof { |
| 44733 | - return Typeof::sample(); /*87:typeof*/ | |
| 44667 | + return Typeof::sample(); /*89:typeof*/ | |
| 44734 | 44668 | } |
| 44735 | 44669 | |
| 44736 | 44670 | /** |
| @@ -44778,7 +44712,7 @@ class Obj5 { | ||
| 44778 | 44712 | * @return Uint |
| 44779 | 44713 | */ |
| 44780 | 44714 | public static function sampleUint(): Uint { |
| 44781 | - return Uint::sample(); /*88:uint*/ | |
| 44715 | + return Uint::sample(); /*90:uint*/ | |
| 44782 | 44716 | } |
| 44783 | 44717 | |
| 44784 | 44718 | /** |
| @@ -44826,7 +44760,7 @@ class Obj5 { | ||
| 44826 | 44760 | * @return Ulong |
| 44827 | 44761 | */ |
| 44828 | 44762 | public static function sampleUlong(): Ulong { |
| 44829 | - return Ulong::sample(); /*89:ulong*/ | |
| 44763 | + return Ulong::sample(); /*91:ulong*/ | |
| 44830 | 44764 | } |
| 44831 | 44765 | |
| 44832 | 44766 | /** |
| @@ -44874,7 +44808,7 @@ class Obj5 { | ||
| 44874 | 44808 | * @return Unchecked |
| 44875 | 44809 | */ |
| 44876 | 44810 | public static function sampleUnchecked(): Unchecked { |
| 44877 | - return Unchecked::sample(); /*90:unchecked*/ | |
| 44811 | + return Unchecked::sample(); /*92:unchecked*/ | |
| 44878 | 44812 | } |
| 44879 | 44813 | |
| 44880 | 44814 | /** |
| @@ -44922,7 +44856,7 @@ class Obj5 { | ||
| 44922 | 44856 | * @return Undefined |
| 44923 | 44857 | */ |
| 44924 | 44858 | public static function sampleUndefined(): Undefined { |
| 44925 | - return Undefined::sample(); /*91:undefined*/ | |
| 44859 | + return Undefined::sample(); /*93:undefined*/ | |
| 44926 | 44860 | } |
| 44927 | 44861 | |
| 44928 | 44862 | /** |
| @@ -44970,7 +44904,7 @@ class Obj5 { | ||
| 44970 | 44904 | * @return Union |
| 44971 | 44905 | */ |
| 44972 | 44906 | public static function sampleUnion(): Union { |
| 44973 | - return Union::sample(); /*92:union*/ | |
| 44907 | + return Union::sample(); /*94:union*/ | |
| 44974 | 44908 | } |
| 44975 | 44909 | |
| 44976 | 44910 | /** |
| @@ -45018,156 +44952,12 @@ class Obj5 { | ||
| 45018 | 44952 | * @return UnmarshalJSON |
| 45019 | 44953 | */ |
| 45020 | 44954 | public static function sampleUnmarshalJSON(): UnmarshalJSON { |
| 45021 | - return UnmarshalJSON::sample(); /*93:unmarshalJSON*/ | |
| 44955 | + return UnmarshalJSON::sample(); /*95:unmarshalJSON*/ | |
| 45022 | 44956 | } |
| 45023 | 44957 | |
| 45024 | 44958 | /** |
| 45025 | - * @param stdClass $value | |
| 45026 | 44959 | * @throws Exception |
| 45027 | - * @return Unowned | |
| 45028 | - */ | |
| 45029 | - public static function fromUnowned(stdClass $value): Unowned { | |
| 45030 | - return Unowned::from($value); /*class*/ | |
| 45031 | - } | |
| 45032 | - | |
| 45033 | - /** | |
| 45034 | - * @throws Exception | |
| 45035 | - * @return stdClass | |
| 45036 | - */ | |
| 45037 | - public function toUnowned(): stdClass { | |
| 45038 | - if (Obj5::validateUnowned($this->unowned)) { | |
| 45039 | - return $this->unowned->to(); /*class*/ | |
| 45040 | - } | |
| 45041 | - throw new Exception('never get to this Obj5::unowned'); | |
| 45042 | - } | |
| 45043 | - | |
| 45044 | - /** | |
| 45045 | - * @param Unowned | |
| 45046 | - * @return bool | |
| 45047 | - * @throws Exception | |
| 45048 | - */ | |
| 45049 | - public static function validateUnowned(Unowned $value): bool { | |
| 45050 | - $value->validate(); | |
| 45051 | - return true; | |
| 45052 | - } | |
| 45053 | - | |
| 45054 | - /** | |
| 45055 | - * @throws Exception | |
| 45056 | - * @return Unowned | |
| 45057 | - */ | |
| 45058 | - public function getUnowned(): Unowned { | |
| 45059 | - if (Obj5::validateUnowned($this->unowned)) { | |
| 45060 | - return $this->unowned; | |
| 45061 | - } | |
| 45062 | - throw new Exception('never get to getUnowned Obj5::unowned'); | |
| 45063 | - } | |
| 45064 | - | |
| 45065 | - /** | |
| 45066 | - * @return Unowned | |
| 45067 | - */ | |
| 45068 | - public static function sampleUnowned(): Unowned { | |
| 45069 | - return Unowned::sample(); /*94:unowned*/ | |
| 45070 | - } | |
| 45071 | - | |
| 45072 | - /** | |
| 45073 | - * @param stdClass $value | |
| 45074 | - * @throws Exception | |
| 45075 | - * @return Unsafe | |
| 45076 | - */ | |
| 45077 | - public static function fromUnsafe(stdClass $value): Unsafe { | |
| 45078 | - return Unsafe::from($value); /*class*/ | |
| 45079 | - } | |
| 45080 | - | |
| 45081 | - /** | |
| 45082 | - * @throws Exception | |
| 45083 | - * @return stdClass | |
| 45084 | - */ | |
| 45085 | - public function toUnsafe(): stdClass { | |
| 45086 | - if (Obj5::validateUnsafe($this->unsafe)) { | |
| 45087 | - return $this->unsafe->to(); /*class*/ | |
| 45088 | - } | |
| 45089 | - throw new Exception('never get to this Obj5::unsafe'); | |
| 45090 | - } | |
| 45091 | - | |
| 45092 | - /** | |
| 45093 | - * @param Unsafe | |
| 45094 | - * @return bool | |
| 45095 | - * @throws Exception | |
| 45096 | - */ | |
| 45097 | - public static function validateUnsafe(Unsafe $value): bool { | |
| 45098 | - $value->validate(); | |
| 45099 | - return true; | |
| 45100 | - } | |
| 45101 | - | |
| 45102 | - /** | |
| 45103 | - * @throws Exception | |
| 45104 | - * @return Unsafe | |
| 45105 | - */ | |
| 45106 | - public function getUnsafe(): Unsafe { | |
| 45107 | - if (Obj5::validateUnsafe($this->unsafe)) { | |
| 45108 | - return $this->unsafe; | |
| 45109 | - } | |
| 45110 | - throw new Exception('never get to getUnsafe Obj5::unsafe'); | |
| 45111 | - } | |
| 45112 | - | |
| 45113 | - /** | |
| 45114 | - * @return Unsafe | |
| 45115 | - */ | |
| 45116 | - public static function sampleUnsafe(): Unsafe { | |
| 45117 | - return Unsafe::sample(); /*95:unsafe*/ | |
| 45118 | - } | |
| 45119 | - | |
| 45120 | - /** | |
| 45121 | - * @param stdClass $value | |
| 45122 | - * @throws Exception | |
| 45123 | - * @return UseSerializers | |
| 45124 | - */ | |
| 45125 | - public static function fromUseSerializers(stdClass $value): UseSerializers { | |
| 45126 | - return UseSerializers::from($value); /*class*/ | |
| 45127 | - } | |
| 45128 | - | |
| 45129 | - /** | |
| 45130 | - * @throws Exception | |
| 45131 | - * @return stdClass | |
| 45132 | - */ | |
| 45133 | - public function toUseSerializers(): stdClass { | |
| 45134 | - if (Obj5::validateUseSerializers($this->useSerializers)) { | |
| 45135 | - return $this->useSerializers->to(); /*class*/ | |
| 45136 | - } | |
| 45137 | - throw new Exception('never get to this Obj5::useSerializers'); | |
| 45138 | - } | |
| 45139 | - | |
| 45140 | - /** | |
| 45141 | - * @param UseSerializers | |
| 45142 | - * @return bool | |
| 45143 | - * @throws Exception | |
| 45144 | - */ | |
| 45145 | - public static function validateUseSerializers(UseSerializers $value): bool { | |
| 45146 | - $value->validate(); | |
| 45147 | - return true; | |
| 45148 | - } | |
| 45149 | - | |
| 45150 | - /** | |
| 45151 | - * @throws Exception | |
| 45152 | - * @return UseSerializers | |
| 45153 | - */ | |
| 45154 | - public function getUseSerializers(): UseSerializers { | |
| 45155 | - if (Obj5::validateUseSerializers($this->useSerializers)) { | |
| 45156 | - return $this->useSerializers; | |
| 45157 | - } | |
| 45158 | - throw new Exception('never get to getUseSerializers Obj5::useSerializers'); | |
| 45159 | - } | |
| 45160 | - | |
| 45161 | - /** | |
| 45162 | - * @return UseSerializers | |
| 45163 | - */ | |
| 45164 | - public static function sampleUseSerializers(): UseSerializers { | |
| 45165 | - return UseSerializers::sample(); /*96:useSerializers*/ | |
| 45166 | - } | |
| 45167 | - | |
| 45168 | - /** | |
| 45169 | - * @throws Exception | |
| 45170 | - * @return bool | |
| 44960 | + * @return bool | |
| 45171 | 44961 | */ |
| 45172 | 44962 | public function validate(): bool { |
| 45173 | 44963 | return Obj5::validateDummy($this->dummy) |
| @@ -45177,6 +44967,8 @@ class Obj5 { | ||
| 45177 | 44967 | || Obj5::validateObj5True($this->obj5True) |
| 45178 | 44968 | || Obj5::validateObj5Type($this->obj5Type) |
| 45179 | 44969 | || Obj5::validatePrimitiveKind($this->primitiveKind) |
| 44970 | + || Obj5::validateSealed($this->sealed) | |
| 44971 | + || Obj5::validateSel($this->sel) | |
| 45180 | 44972 | || Obj5::validateSelect($this->select) |
| 45181 | 44973 | || Obj5::validateSelf($this->self) |
| 45182 | 44974 | || Obj5::validateSendable($this->sendable) |
| @@ -45232,10 +45024,7 @@ class Obj5 { | ||
| 45232 | 45024 | || Obj5::validateUnchecked($this->unchecked) |
| 45233 | 45025 | || Obj5::validateUndefined($this->undefined) |
| 45234 | 45026 | || Obj5::validateUnion($this->union) |
| 45235 | - || Obj5::validateUnmarshalJSON($this->unmarshalJSON) | |
| 45236 | - || Obj5::validateUnowned($this->unowned) | |
| 45237 | - || Obj5::validateUnsafe($this->unsafe) | |
| 45238 | - || Obj5::validateUseSerializers($this->useSerializers); | |
| 45027 | + || Obj5::validateUnmarshalJSON($this->unmarshalJSON); | |
| 45239 | 45028 | } |
| 45240 | 45029 | |
| 45241 | 45030 | /** |
| @@ -45251,6 +45040,8 @@ class Obj5 { | ||
| 45251 | 45040 | $out->{'true'} = $this->toObj5True(); |
| 45252 | 45041 | $out->{'type'} = $this->toObj5Type(); |
| 45253 | 45042 | $out->{'PrimitiveKind'} = $this->toPrimitiveKind(); |
| 45043 | + $out->{'sealed'} = $this->toSealed(); | |
| 45044 | + $out->{'SEL'} = $this->toSel(); | |
| 45254 | 45045 | $out->{'select'} = $this->toSelect(); |
| 45255 | 45046 | $out->{'Self'} = $this->toSelf(); |
| 45256 | 45047 | $out->{'Sendable'} = $this->toSendable(); |
| @@ -45307,9 +45098,6 @@ class Obj5 { | ||
| 45307 | 45098 | $out->{'undefined'} = $this->toUndefined(); |
| 45308 | 45099 | $out->{'union'} = $this->toUnion(); |
| 45309 | 45100 | $out->{'UnmarshalJSON'} = $this->toUnmarshalJSON(); |
| 45310 | - $out->{'unowned'} = $this->toUnowned(); | |
| 45311 | - $out->{'unsafe'} = $this->toUnsafe(); | |
| 45312 | - $out->{'UseSerializers'} = $this->toUseSerializers(); | |
| 45313 | 45101 | return $out; |
| 45314 | 45102 | } |
| 45315 | 45103 | |
| @@ -45340,6 +45128,12 @@ class Obj5 { | ||
| 45340 | 45128 | if (!property_exists($obj, 'PrimitiveKind')) { |
| 45341 | 45129 | throw new Exception("Missing required property"); |
| 45342 | 45130 | } |
| 45131 | + if (!property_exists($obj, 'sealed')) { | |
| 45132 | + throw new Exception("Missing required property"); | |
| 45133 | + } | |
| 45134 | + if (!property_exists($obj, 'SEL')) { | |
| 45135 | + throw new Exception("Missing required property"); | |
| 45136 | + } | |
| 45343 | 45137 | if (!property_exists($obj, 'select')) { |
| 45344 | 45138 | throw new Exception("Missing required property"); |
| 45345 | 45139 | } |
| @@ -45508,15 +45302,6 @@ class Obj5 { | ||
| 45508 | 45302 | if (!property_exists($obj, 'UnmarshalJSON')) { |
| 45509 | 45303 | throw new Exception("Missing required property"); |
| 45510 | 45304 | } |
| 45511 | - if (!property_exists($obj, 'unowned')) { | |
| 45512 | - throw new Exception("Missing required property"); | |
| 45513 | - } | |
| 45514 | - if (!property_exists($obj, 'unsafe')) { | |
| 45515 | - throw new Exception("Missing required property"); | |
| 45516 | - } | |
| 45517 | - if (!property_exists($obj, 'UseSerializers')) { | |
| 45518 | - throw new Exception("Missing required property"); | |
| 45519 | - } | |
| 45520 | 45305 | return new Obj5( |
| 45521 | 45306 | Obj5::fromDummy($obj->{'dummy'}) |
| 45522 | 45307 | ,Obj5::fromKSerializer($obj->{'KSerializer'}) |
| @@ -45525,6 +45310,8 @@ class Obj5 { | ||
| 45525 | 45310 | ,Obj5::fromObj5True($obj->{'true'}) |
| 45526 | 45311 | ,Obj5::fromObj5Type($obj->{'type'}) |
| 45527 | 45312 | ,Obj5::fromPrimitiveKind($obj->{'PrimitiveKind'}) |
| 45313 | + ,Obj5::fromSealed($obj->{'sealed'}) | |
| 45314 | + ,Obj5::fromSel($obj->{'SEL'}) | |
| 45528 | 45315 | ,Obj5::fromSelect($obj->{'select'}) |
| 45529 | 45316 | ,Obj5::fromSelf($obj->{'Self'}) |
| 45530 | 45317 | ,Obj5::fromSendable($obj->{'Sendable'}) |
| @@ -45581,9 +45368,6 @@ class Obj5 { | ||
| 45581 | 45368 | ,Obj5::fromUndefined($obj->{'undefined'}) |
| 45582 | 45369 | ,Obj5::fromUnion($obj->{'union'}) |
| 45583 | 45370 | ,Obj5::fromUnmarshalJSON($obj->{'UnmarshalJSON'}) |
| 45584 | - ,Obj5::fromUnowned($obj->{'unowned'}) | |
| 45585 | - ,Obj5::fromUnsafe($obj->{'unsafe'}) | |
| 45586 | - ,Obj5::fromUseSerializers($obj->{'UseSerializers'}) | |
| 45587 | 45371 | ); |
| 45588 | 45372 | } |
| 45589 | 45373 | |
| @@ -45599,6 +45383,8 @@ class Obj5 { | ||
| 45599 | 45383 | ,Obj5::sampleObj5True() |
| 45600 | 45384 | ,Obj5::sampleObj5Type() |
| 45601 | 45385 | ,Obj5::samplePrimitiveKind() |
| 45386 | + ,Obj5::sampleSealed() | |
| 45387 | + ,Obj5::sampleSel() | |
| 45602 | 45388 | ,Obj5::sampleSelect() |
| 45603 | 45389 | ,Obj5::sampleSelf() |
| 45604 | 45390 | ,Obj5::sampleSendable() |
| @@ -45655,9 +45441,6 @@ class Obj5 { | ||
| 45655 | 45441 | ,Obj5::sampleUndefined() |
| 45656 | 45442 | ,Obj5::sampleUnion() |
| 45657 | 45443 | ,Obj5::sampleUnmarshalJSON() |
| 45658 | - ,Obj5::sampleUnowned() | |
| 45659 | - ,Obj5::sampleUnsafe() | |
| 45660 | - ,Obj5::sampleUseSerializers() | |
| 45661 | 45444 | ); |
| 45662 | 45445 | } |
| 45663 | 45446 | } |
| @@ -46268,16 +46051,16 @@ class PrimitiveKind { | ||
| 46268 | 46051 | } |
| 46269 | 46052 | } |
| 46270 | 46053 | |
| 46271 | -// This is an autogenerated file:Select | |
| 46054 | +// This is an autogenerated file:Sealed | |
| 46272 | 46055 | |
| 46273 | -class Select { | |
| 46274 | - private int $select; // json:select Required | |
| 46056 | +class Sealed { | |
| 46057 | + private int $sealed; // json:sealed Required | |
| 46275 | 46058 | |
| 46276 | 46059 | /** |
| 46277 | - * @param int $select | |
| 46060 | + * @param int $sealed | |
| 46278 | 46061 | */ |
| 46279 | - public function __construct(int $select) { | |
| 46280 | - $this->select = $select; | |
| 46062 | + public function __construct(int $sealed) { | |
| 46063 | + $this->sealed = $sealed; | |
| 46281 | 46064 | } |
| 46282 | 46065 | |
| 46283 | 46066 | /** |
| @@ -46285,7 +46068,7 @@ class Select { | ||
| 46285 | 46068 | * @throws Exception |
| 46286 | 46069 | * @return int |
| 46287 | 46070 | */ |
| 46288 | - public static function fromSelect(int $value): int { | |
| 46071 | + public static function fromSealed(int $value): int { | |
| 46289 | 46072 | return $value; /*int*/ |
| 46290 | 46073 | } |
| 46291 | 46074 | |
| @@ -46293,11 +46076,11 @@ class Select { | ||
| 46293 | 46076 | * @throws Exception |
| 46294 | 46077 | * @return int |
| 46295 | 46078 | */ |
| 46296 | - public function toSelect(): int { | |
| 46297 | - if (Select::validateSelect($this->select)) { | |
| 46298 | - return $this->select; /*int*/ | |
| 46079 | + public function toSealed(): int { | |
| 46080 | + if (Sealed::validateSealed($this->sealed)) { | |
| 46081 | + return $this->sealed; /*int*/ | |
| 46299 | 46082 | } |
| 46300 | - throw new Exception('never get to this Select::select'); | |
| 46083 | + throw new Exception('never get to this Sealed::sealed'); | |
| 46301 | 46084 | } |
| 46302 | 46085 | |
| 46303 | 46086 | /** |
| @@ -46305,7 +46088,7 @@ class Select { | ||
| 46305 | 46088 | * @return bool |
| 46306 | 46089 | * @throws Exception |
| 46307 | 46090 | */ |
| 46308 | - public static function validateSelect(int $value): bool { | |
| 46091 | + public static function validateSealed(int $value): bool { | |
| 46309 | 46092 | return true; |
| 46310 | 46093 | } |
| 46311 | 46094 | |
| @@ -46313,18 +46096,18 @@ class Select { | ||
| 46313 | 46096 | * @throws Exception |
| 46314 | 46097 | * @return int |
| 46315 | 46098 | */ |
| 46316 | - public function getSelect(): int { | |
| 46317 | - if (Select::validateSelect($this->select)) { | |
| 46318 | - return $this->select; | |
| 46099 | + public function getSealed(): int { | |
| 46100 | + if (Sealed::validateSealed($this->sealed)) { | |
| 46101 | + return $this->sealed; | |
| 46319 | 46102 | } |
| 46320 | - throw new Exception('never get to getSelect Select::select'); | |
| 46103 | + throw new Exception('never get to getSealed Sealed::sealed'); | |
| 46321 | 46104 | } |
| 46322 | 46105 | |
| 46323 | 46106 | /** |
| 46324 | 46107 | * @return int |
| 46325 | 46108 | */ |
| 46326 | - public static function sampleSelect(): int { | |
| 46327 | - return 31; /*31:select*/ | |
| 46109 | + public static function sampleSealed(): int { | |
| 46110 | + return 31; /*31:sealed*/ | |
| 46328 | 46111 | } |
| 46329 | 46112 | |
| 46330 | 46113 | /** |
| @@ -46332,7 +46115,7 @@ class Select { | ||
| 46332 | 46115 | * @return bool |
| 46333 | 46116 | */ |
| 46334 | 46117 | public function validate(): bool { |
| 46335 | - return Select::validateSelect($this->select); | |
| 46118 | + return Sealed::validateSealed($this->sealed); | |
| 46336 | 46119 | } |
| 46337 | 46120 | |
| 46338 | 46121 | /** |
| @@ -46341,44 +46124,44 @@ class Select { | ||
| 46341 | 46124 | */ |
| 46342 | 46125 | public function to(): stdClass { |
| 46343 | 46126 | $out = new stdClass(); |
| 46344 | - $out->{'select'} = $this->toSelect(); | |
| 46127 | + $out->{'sealed'} = $this->toSealed(); | |
| 46345 | 46128 | return $out; |
| 46346 | 46129 | } |
| 46347 | 46130 | |
| 46348 | 46131 | /** |
| 46349 | 46132 | * @param stdClass $obj |
| 46350 | - * @return Select | |
| 46133 | + * @return Sealed | |
| 46351 | 46134 | * @throws Exception |
| 46352 | 46135 | */ |
| 46353 | - public static function from(stdClass $obj): Select { | |
| 46354 | - if (!property_exists($obj, 'select')) { | |
| 46136 | + public static function from(stdClass $obj): Sealed { | |
| 46137 | + if (!property_exists($obj, 'sealed')) { | |
| 46355 | 46138 | throw new Exception("Missing required property"); |
| 46356 | 46139 | } |
| 46357 | - return new Select( | |
| 46358 | - Select::fromSelect($obj->{'select'}) | |
| 46140 | + return new Sealed( | |
| 46141 | + Sealed::fromSealed($obj->{'sealed'}) | |
| 46359 | 46142 | ); |
| 46360 | 46143 | } |
| 46361 | 46144 | |
| 46362 | 46145 | /** |
| 46363 | - * @return Select | |
| 46146 | + * @return Sealed | |
| 46364 | 46147 | */ |
| 46365 | - public static function sample(): Select { | |
| 46366 | - return new Select( | |
| 46367 | - Select::sampleSelect() | |
| 46148 | + public static function sample(): Sealed { | |
| 46149 | + return new Sealed( | |
| 46150 | + Sealed::sampleSealed() | |
| 46368 | 46151 | ); |
| 46369 | 46152 | } |
| 46370 | 46153 | } |
| 46371 | 46154 | |
| 46372 | -// This is an autogenerated file:SelfClass | |
| 46155 | +// This is an autogenerated file:Sel | |
| 46373 | 46156 | |
| 46374 | -class SelfClass { | |
| 46375 | - private int $self; // json:Self Required | |
| 46157 | +class Sel { | |
| 46158 | + private int $sel; // json:SEL Required | |
| 46376 | 46159 | |
| 46377 | 46160 | /** |
| 46378 | - * @param int $self | |
| 46161 | + * @param int $sel | |
| 46379 | 46162 | */ |
| 46380 | - public function __construct(int $self) { | |
| 46381 | - $this->self = $self; | |
| 46163 | + public function __construct(int $sel) { | |
| 46164 | + $this->sel = $sel; | |
| 46382 | 46165 | } |
| 46383 | 46166 | |
| 46384 | 46167 | /** |
| @@ -46386,7 +46169,7 @@ class SelfClass { | ||
| 46386 | 46169 | * @throws Exception |
| 46387 | 46170 | * @return int |
| 46388 | 46171 | */ |
| 46389 | - public static function fromSelf(int $value): int { | |
| 46172 | + public static function fromSel(int $value): int { | |
| 46390 | 46173 | return $value; /*int*/ |
| 46391 | 46174 | } |
| 46392 | 46175 | |
| @@ -46394,11 +46177,11 @@ class SelfClass { | ||
| 46394 | 46177 | * @throws Exception |
| 46395 | 46178 | * @return int |
| 46396 | 46179 | */ |
| 46397 | - public function toSelf(): int { | |
| 46398 | - if (SelfClass::validateSelf($this->self)) { | |
| 46399 | - return $this->self; /*int*/ | |
| 46180 | + public function toSel(): int { | |
| 46181 | + if (Sel::validateSel($this->sel)) { | |
| 46182 | + return $this->sel; /*int*/ | |
| 46400 | 46183 | } |
| 46401 | - throw new Exception('never get to this SelfClass::self'); | |
| 46184 | + throw new Exception('never get to this Sel::sel'); | |
| 46402 | 46185 | } |
| 46403 | 46186 | |
| 46404 | 46187 | /** |
| @@ -46406,7 +46189,7 @@ class SelfClass { | ||
| 46406 | 46189 | * @return bool |
| 46407 | 46190 | * @throws Exception |
| 46408 | 46191 | */ |
| 46409 | - public static function validateSelf(int $value): bool { | |
| 46192 | + public static function validateSel(int $value): bool { | |
| 46410 | 46193 | return true; |
| 46411 | 46194 | } |
| 46412 | 46195 | |
| @@ -46414,18 +46197,18 @@ class SelfClass { | ||
| 46414 | 46197 | * @throws Exception |
| 46415 | 46198 | * @return int |
| 46416 | 46199 | */ |
| 46417 | - public function getSelf(): int { | |
| 46418 | - if (SelfClass::validateSelf($this->self)) { | |
| 46419 | - return $this->self; | |
| 46200 | + public function getSel(): int { | |
| 46201 | + if (Sel::validateSel($this->sel)) { | |
| 46202 | + return $this->sel; | |
| 46420 | 46203 | } |
| 46421 | - throw new Exception('never get to getSelf SelfClass::self'); | |
| 46204 | + throw new Exception('never get to getSel Sel::sel'); | |
| 46422 | 46205 | } |
| 46423 | 46206 | |
| 46424 | 46207 | /** |
| 46425 | 46208 | * @return int |
| 46426 | 46209 | */ |
| 46427 | - public static function sampleSelf(): int { | |
| 46428 | - return 31; /*31:self*/ | |
| 46210 | + public static function sampleSel(): int { | |
| 46211 | + return 31; /*31:sel*/ | |
| 46429 | 46212 | } |
| 46430 | 46213 | |
| 46431 | 46214 | /** |
| @@ -46433,7 +46216,7 @@ class SelfClass { | ||
| 46433 | 46216 | * @return bool |
| 46434 | 46217 | */ |
| 46435 | 46218 | public function validate(): bool { |
| 46436 | - return SelfClass::validateSelf($this->self); | |
| 46219 | + return Sel::validateSel($this->sel); | |
| 46437 | 46220 | } |
| 46438 | 46221 | |
| 46439 | 46222 | /** |
| @@ -46442,26 +46225,228 @@ class SelfClass { | ||
| 46442 | 46225 | */ |
| 46443 | 46226 | public function to(): stdClass { |
| 46444 | 46227 | $out = new stdClass(); |
| 46445 | - $out->{'Self'} = $this->toSelf(); | |
| 46228 | + $out->{'SEL'} = $this->toSel(); | |
| 46446 | 46229 | return $out; |
| 46447 | 46230 | } |
| 46448 | 46231 | |
| 46449 | 46232 | /** |
| 46450 | 46233 | * @param stdClass $obj |
| 46451 | - * @return SelfClass | |
| 46234 | + * @return Sel | |
| 46452 | 46235 | * @throws Exception |
| 46453 | 46236 | */ |
| 46454 | - public static function from(stdClass $obj): SelfClass { | |
| 46455 | - if (!property_exists($obj, 'Self')) { | |
| 46237 | + public static function from(stdClass $obj): Sel { | |
| 46238 | + if (!property_exists($obj, 'SEL')) { | |
| 46456 | 46239 | throw new Exception("Missing required property"); |
| 46457 | 46240 | } |
| 46458 | - return new SelfClass( | |
| 46459 | - SelfClass::fromSelf($obj->{'Self'}) | |
| 46241 | + return new Sel( | |
| 46242 | + Sel::fromSel($obj->{'SEL'}) | |
| 46460 | 46243 | ); |
| 46461 | 46244 | } |
| 46462 | 46245 | |
| 46463 | 46246 | /** |
| 46464 | - * @return SelfClass | |
| 46247 | + * @return Sel | |
| 46248 | + */ | |
| 46249 | + public static function sample(): Sel { | |
| 46250 | + return new Sel( | |
| 46251 | + Sel::sampleSel() | |
| 46252 | + ); | |
| 46253 | + } | |
| 46254 | +} | |
| 46255 | + | |
| 46256 | +// This is an autogenerated file:Select | |
| 46257 | + | |
| 46258 | +class Select { | |
| 46259 | + private int $select; // json:select Required | |
| 46260 | + | |
| 46261 | + /** | |
| 46262 | + * @param int $select | |
| 46263 | + */ | |
| 46264 | + public function __construct(int $select) { | |
| 46265 | + $this->select = $select; | |
| 46266 | + } | |
| 46267 | + | |
| 46268 | + /** | |
| 46269 | + * @param int $value | |
| 46270 | + * @throws Exception | |
| 46271 | + * @return int | |
| 46272 | + */ | |
| 46273 | + public static function fromSelect(int $value): int { | |
| 46274 | + return $value; /*int*/ | |
| 46275 | + } | |
| 46276 | + | |
| 46277 | + /** | |
| 46278 | + * @throws Exception | |
| 46279 | + * @return int | |
| 46280 | + */ | |
| 46281 | + public function toSelect(): int { | |
| 46282 | + if (Select::validateSelect($this->select)) { | |
| 46283 | + return $this->select; /*int*/ | |
| 46284 | + } | |
| 46285 | + throw new Exception('never get to this Select::select'); | |
| 46286 | + } | |
| 46287 | + | |
| 46288 | + /** | |
| 46289 | + * @param int | |
| 46290 | + * @return bool | |
| 46291 | + * @throws Exception | |
| 46292 | + */ | |
| 46293 | + public static function validateSelect(int $value): bool { | |
| 46294 | + return true; | |
| 46295 | + } | |
| 46296 | + | |
| 46297 | + /** | |
| 46298 | + * @throws Exception | |
| 46299 | + * @return int | |
| 46300 | + */ | |
| 46301 | + public function getSelect(): int { | |
| 46302 | + if (Select::validateSelect($this->select)) { | |
| 46303 | + return $this->select; | |
| 46304 | + } | |
| 46305 | + throw new Exception('never get to getSelect Select::select'); | |
| 46306 | + } | |
| 46307 | + | |
| 46308 | + /** | |
| 46309 | + * @return int | |
| 46310 | + */ | |
| 46311 | + public static function sampleSelect(): int { | |
| 46312 | + return 31; /*31:select*/ | |
| 46313 | + } | |
| 46314 | + | |
| 46315 | + /** | |
| 46316 | + * @throws Exception | |
| 46317 | + * @return bool | |
| 46318 | + */ | |
| 46319 | + public function validate(): bool { | |
| 46320 | + return Select::validateSelect($this->select); | |
| 46321 | + } | |
| 46322 | + | |
| 46323 | + /** | |
| 46324 | + * @return stdClass | |
| 46325 | + * @throws Exception | |
| 46326 | + */ | |
| 46327 | + public function to(): stdClass { | |
| 46328 | + $out = new stdClass(); | |
| 46329 | + $out->{'select'} = $this->toSelect(); | |
| 46330 | + return $out; | |
| 46331 | + } | |
| 46332 | + | |
| 46333 | + /** | |
| 46334 | + * @param stdClass $obj | |
| 46335 | + * @return Select | |
| 46336 | + * @throws Exception | |
| 46337 | + */ | |
| 46338 | + public static function from(stdClass $obj): Select { | |
| 46339 | + if (!property_exists($obj, 'select')) { | |
| 46340 | + throw new Exception("Missing required property"); | |
| 46341 | + } | |
| 46342 | + return new Select( | |
| 46343 | + Select::fromSelect($obj->{'select'}) | |
| 46344 | + ); | |
| 46345 | + } | |
| 46346 | + | |
| 46347 | + /** | |
| 46348 | + * @return Select | |
| 46349 | + */ | |
| 46350 | + public static function sample(): Select { | |
| 46351 | + return new Select( | |
| 46352 | + Select::sampleSelect() | |
| 46353 | + ); | |
| 46354 | + } | |
| 46355 | +} | |
| 46356 | + | |
| 46357 | +// This is an autogenerated file:SelfClass | |
| 46358 | + | |
| 46359 | +class SelfClass { | |
| 46360 | + private int $self; // json:Self Required | |
| 46361 | + | |
| 46362 | + /** | |
| 46363 | + * @param int $self | |
| 46364 | + */ | |
| 46365 | + public function __construct(int $self) { | |
| 46366 | + $this->self = $self; | |
| 46367 | + } | |
| 46368 | + | |
| 46369 | + /** | |
| 46370 | + * @param int $value | |
| 46371 | + * @throws Exception | |
| 46372 | + * @return int | |
| 46373 | + */ | |
| 46374 | + public static function fromSelf(int $value): int { | |
| 46375 | + return $value; /*int*/ | |
| 46376 | + } | |
| 46377 | + | |
| 46378 | + /** | |
| 46379 | + * @throws Exception | |
| 46380 | + * @return int | |
| 46381 | + */ | |
| 46382 | + public function toSelf(): int { | |
| 46383 | + if (SelfClass::validateSelf($this->self)) { | |
| 46384 | + return $this->self; /*int*/ | |
| 46385 | + } | |
| 46386 | + throw new Exception('never get to this SelfClass::self'); | |
| 46387 | + } | |
| 46388 | + | |
| 46389 | + /** | |
| 46390 | + * @param int | |
| 46391 | + * @return bool | |
| 46392 | + * @throws Exception | |
| 46393 | + */ | |
| 46394 | + public static function validateSelf(int $value): bool { | |
| 46395 | + return true; | |
| 46396 | + } | |
| 46397 | + | |
| 46398 | + /** | |
| 46399 | + * @throws Exception | |
| 46400 | + * @return int | |
| 46401 | + */ | |
| 46402 | + public function getSelf(): int { | |
| 46403 | + if (SelfClass::validateSelf($this->self)) { | |
| 46404 | + return $this->self; | |
| 46405 | + } | |
| 46406 | + throw new Exception('never get to getSelf SelfClass::self'); | |
| 46407 | + } | |
| 46408 | + | |
| 46409 | + /** | |
| 46410 | + * @return int | |
| 46411 | + */ | |
| 46412 | + public static function sampleSelf(): int { | |
| 46413 | + return 31; /*31:self*/ | |
| 46414 | + } | |
| 46415 | + | |
| 46416 | + /** | |
| 46417 | + * @throws Exception | |
| 46418 | + * @return bool | |
| 46419 | + */ | |
| 46420 | + public function validate(): bool { | |
| 46421 | + return SelfClass::validateSelf($this->self); | |
| 46422 | + } | |
| 46423 | + | |
| 46424 | + /** | |
| 46425 | + * @return stdClass | |
| 46426 | + * @throws Exception | |
| 46427 | + */ | |
| 46428 | + public function to(): stdClass { | |
| 46429 | + $out = new stdClass(); | |
| 46430 | + $out->{'Self'} = $this->toSelf(); | |
| 46431 | + return $out; | |
| 46432 | + } | |
| 46433 | + | |
| 46434 | + /** | |
| 46435 | + * @param stdClass $obj | |
| 46436 | + * @return SelfClass | |
| 46437 | + * @throws Exception | |
| 46438 | + */ | |
| 46439 | + public static function from(stdClass $obj): SelfClass { | |
| 46440 | + if (!property_exists($obj, 'Self')) { | |
| 46441 | + throw new Exception("Missing required property"); | |
| 46442 | + } | |
| 46443 | + return new SelfClass( | |
| 46444 | + SelfClass::fromSelf($obj->{'Self'}) | |
| 46445 | + ); | |
| 46446 | + } | |
| 46447 | + | |
| 46448 | + /** | |
| 46449 | + * @return SelfClass | |
| 46465 | 46450 | */ |
| 46466 | 46451 | public static function sample(): SelfClass { |
| 46467 | 46452 | return new SelfClass( |
| @@ -51924,36 +51909,105 @@ class UnmarshalJSON { | ||
| 51924 | 51909 | } |
| 51925 | 51910 | } |
| 51926 | 51911 | |
| 51927 | -// This is an autogenerated file:Unowned | |
| 51928 | - | |
| 51929 | -class Unowned { | |
| 51930 | - private int $unowned; // json:unowned Required | |
| 51931 | - | |
| 51932 | - /** | |
| 51933 | - * @param int $unowned | |
| 51934 | - */ | |
| 51935 | - public function __construct(int $unowned) { | |
| 51936 | - $this->unowned = $unowned; | |
| 51937 | - } | |
| 51912 | +// This is an autogenerated file:Obj6 | |
| 51938 | 51913 | |
| 51939 | - /** | |
| 51940 | - * @param int $value | |
| 51941 | - * @throws Exception | |
| 51942 | - * @return int | |
| 51943 | - */ | |
| 51944 | - public static function fromUnowned(int $value): int { | |
| 51945 | - return $value; /*int*/ | |
| 51946 | - } | |
| 51914 | +class Obj6 { | |
| 51915 | + private int $dummy; // json:dummy Required | |
| 51916 | + private Unowned $unowned; // json:unowned Required | |
| 51917 | + private Unsafe $unsafe; // json:unsafe Required | |
| 51918 | + private Unsigned $unsigned; // json:unsigned Required | |
| 51919 | + private UseSerializers $useSerializers; // json:UseSerializers Required | |
| 51920 | + private Ushort $ushort; // json:ushort Required | |
| 51921 | + private Using $using; // json:using Required | |
| 51922 | + private Utf8JSONReader $utf8JSONReader; // json:Utf8JsonReader Required | |
| 51923 | + private Utf8JSONWriter $utf8JSONWriter; // json:Utf8JsonWriter Required | |
| 51924 | + private UUID $uuid; // json:UUID Required | |
| 51925 | + private VarClass $var; // json:var Required | |
| 51926 | + private Virtual $virtual; // json:virtual Required | |
| 51927 | + private VoidClass $void; // json:void Required | |
| 51928 | + private Volatile $volatile; // json:volatile Required | |
| 51929 | + private WcharT $wcharT; // json:wchar_t Required | |
| 51930 | + private Weak $weak; // json:weak Required | |
| 51931 | + private Where $where; // json:where Required | |
| 51932 | + private WhileClass $while; // json:while Required | |
| 51933 | + private WillSet $willSet; // json:willSet Required | |
| 51934 | + private With $with; // json:with Required | |
| 51935 | + private XorClass $xor; // json:xor Required | |
| 51936 | + private XorEq $xorEq; // json:xor_eq Required | |
| 51937 | + private Yes $yes; // json:YES Required | |
| 51938 | + private YieldClass $yield; // json:yield Required | |
| 51947 | 51939 | |
| 51948 | 51940 | /** |
| 51949 | - * @throws Exception | |
| 51950 | - * @return int | |
| 51951 | - */ | |
| 51952 | - public function toUnowned(): int { | |
| 51953 | - if (Unowned::validateUnowned($this->unowned)) { | |
| 51954 | - return $this->unowned; /*int*/ | |
| 51955 | - } | |
| 51956 | - throw new Exception('never get to this Unowned::unowned'); | |
| 51941 | + * @param int $dummy | |
| 51942 | + * @param Unowned $unowned | |
| 51943 | + * @param Unsafe $unsafe | |
| 51944 | + * @param Unsigned $unsigned | |
| 51945 | + * @param UseSerializers $useSerializers | |
| 51946 | + * @param Ushort $ushort | |
| 51947 | + * @param Using $using | |
| 51948 | + * @param Utf8JSONReader $utf8JSONReader | |
| 51949 | + * @param Utf8JSONWriter $utf8JSONWriter | |
| 51950 | + * @param UUID $uuid | |
| 51951 | + * @param VarClass $var | |
| 51952 | + * @param Virtual $virtual | |
| 51953 | + * @param VoidClass $void | |
| 51954 | + * @param Volatile $volatile | |
| 51955 | + * @param WcharT $wcharT | |
| 51956 | + * @param Weak $weak | |
| 51957 | + * @param Where $where | |
| 51958 | + * @param WhileClass $while | |
| 51959 | + * @param WillSet $willSet | |
| 51960 | + * @param With $with | |
| 51961 | + * @param XorClass $xor | |
| 51962 | + * @param XorEq $xorEq | |
| 51963 | + * @param Yes $yes | |
| 51964 | + * @param YieldClass $yield | |
| 51965 | + */ | |
| 51966 | + public function __construct(int $dummy, Unowned $unowned, Unsafe $unsafe, Unsigned $unsigned, UseSerializers $useSerializers, Ushort $ushort, Using $using, Utf8JSONReader $utf8JSONReader, Utf8JSONWriter $utf8JSONWriter, UUID $uuid, VarClass $var, Virtual $virtual, VoidClass $void, Volatile $volatile, WcharT $wcharT, Weak $weak, Where $where, WhileClass $while, WillSet $willSet, With $with, XorClass $xor, XorEq $xorEq, Yes $yes, YieldClass $yield) { | |
| 51967 | + $this->dummy = $dummy; | |
| 51968 | + $this->unowned = $unowned; | |
| 51969 | + $this->unsafe = $unsafe; | |
| 51970 | + $this->unsigned = $unsigned; | |
| 51971 | + $this->useSerializers = $useSerializers; | |
| 51972 | + $this->ushort = $ushort; | |
| 51973 | + $this->using = $using; | |
| 51974 | + $this->utf8JSONReader = $utf8JSONReader; | |
| 51975 | + $this->utf8JSONWriter = $utf8JSONWriter; | |
| 51976 | + $this->uuid = $uuid; | |
| 51977 | + $this->var = $var; | |
| 51978 | + $this->virtual = $virtual; | |
| 51979 | + $this->void = $void; | |
| 51980 | + $this->volatile = $volatile; | |
| 51981 | + $this->wcharT = $wcharT; | |
| 51982 | + $this->weak = $weak; | |
| 51983 | + $this->where = $where; | |
| 51984 | + $this->while = $while; | |
| 51985 | + $this->willSet = $willSet; | |
| 51986 | + $this->with = $with; | |
| 51987 | + $this->xor = $xor; | |
| 51988 | + $this->xorEq = $xorEq; | |
| 51989 | + $this->yes = $yes; | |
| 51990 | + $this->yield = $yield; | |
| 51991 | + } | |
| 51992 | + | |
| 51993 | + /** | |
| 51994 | + * @param int $value | |
| 51995 | + * @throws Exception | |
| 51996 | + * @return int | |
| 51997 | + */ | |
| 51998 | + public static function fromDummy(int $value): int { | |
| 51999 | + return $value; /*int*/ | |
| 52000 | + } | |
| 52001 | + | |
| 52002 | + /** | |
| 52003 | + * @throws Exception | |
| 52004 | + * @return int | |
| 52005 | + */ | |
| 52006 | + public function toDummy(): int { | |
| 52007 | + if (Obj6::validateDummy($this->dummy)) { | |
| 52008 | + return $this->dummy; /*int*/ | |
| 52009 | + } | |
| 52010 | + throw new Exception('never get to this Obj6::dummy'); | |
| 51957 | 52011 | } |
| 51958 | 52012 | |
| 51959 | 52013 | /** |
| @@ -51961,7 +52015,7 @@ class Unowned { | ||
| 51961 | 52015 | * @return bool |
| 51962 | 52016 | * @throws Exception |
| 51963 | 52017 | */ |
| 51964 | - public static function validateUnowned(int $value): bool { | |
| 52018 | + public static function validateDummy(int $value): bool { | |
| 51965 | 52019 | return true; |
| 51966 | 52020 | } |
| 51967 | 52021 | |
| @@ -51969,435 +52023,216 @@ class Unowned { | ||
| 51969 | 52023 | * @throws Exception |
| 51970 | 52024 | * @return int |
| 51971 | 52025 | */ |
| 51972 | - public function getUnowned(): int { | |
| 51973 | - if (Unowned::validateUnowned($this->unowned)) { | |
| 51974 | - return $this->unowned; | |
| 52026 | + public function getDummy(): int { | |
| 52027 | + if (Obj6::validateDummy($this->dummy)) { | |
| 52028 | + return $this->dummy; | |
| 51975 | 52029 | } |
| 51976 | - throw new Exception('never get to getUnowned Unowned::unowned'); | |
| 52030 | + throw new Exception('never get to getDummy Obj6::dummy'); | |
| 51977 | 52031 | } |
| 51978 | 52032 | |
| 51979 | 52033 | /** |
| 51980 | 52034 | * @return int |
| 51981 | 52035 | */ |
| 51982 | - public static function sampleUnowned(): int { | |
| 51983 | - return 31; /*31:unowned*/ | |
| 52036 | + public static function sampleDummy(): int { | |
| 52037 | + return 31; /*31:dummy*/ | |
| 51984 | 52038 | } |
| 51985 | 52039 | |
| 51986 | 52040 | /** |
| 52041 | + * @param stdClass $value | |
| 51987 | 52042 | * @throws Exception |
| 51988 | - * @return bool | |
| 52043 | + * @return Unowned | |
| 51989 | 52044 | */ |
| 51990 | - public function validate(): bool { | |
| 51991 | - return Unowned::validateUnowned($this->unowned); | |
| 52045 | + public static function fromUnowned(stdClass $value): Unowned { | |
| 52046 | + return Unowned::from($value); /*class*/ | |
| 51992 | 52047 | } |
| 51993 | 52048 | |
| 51994 | 52049 | /** |
| 51995 | - * @return stdClass | |
| 51996 | 52050 | * @throws Exception |
| 52051 | + * @return stdClass | |
| 51997 | 52052 | */ |
| 51998 | - public function to(): stdClass { | |
| 51999 | - $out = new stdClass(); | |
| 52000 | - $out->{'unowned'} = $this->toUnowned(); | |
| 52001 | - return $out; | |
| 52053 | + public function toUnowned(): stdClass { | |
| 52054 | + if (Obj6::validateUnowned($this->unowned)) { | |
| 52055 | + return $this->unowned->to(); /*class*/ | |
| 52056 | + } | |
| 52057 | + throw new Exception('never get to this Obj6::unowned'); | |
| 52002 | 52058 | } |
| 52003 | 52059 | |
| 52004 | 52060 | /** |
| 52005 | - * @param stdClass $obj | |
| 52006 | - * @return Unowned | |
| 52061 | + * @param Unowned | |
| 52062 | + * @return bool | |
| 52007 | 52063 | * @throws Exception |
| 52008 | 52064 | */ |
| 52009 | - public static function from(stdClass $obj): Unowned { | |
| 52010 | - if (!property_exists($obj, 'unowned')) { | |
| 52011 | - throw new Exception("Missing required property"); | |
| 52012 | - } | |
| 52013 | - return new Unowned( | |
| 52014 | - Unowned::fromUnowned($obj->{'unowned'}) | |
| 52015 | - ); | |
| 52065 | + public static function validateUnowned(Unowned $value): bool { | |
| 52066 | + $value->validate(); | |
| 52067 | + return true; | |
| 52016 | 52068 | } |
| 52017 | 52069 | |
| 52018 | 52070 | /** |
| 52071 | + * @throws Exception | |
| 52019 | 52072 | * @return Unowned |
| 52020 | 52073 | */ |
| 52021 | - public static function sample(): Unowned { | |
| 52022 | - return new Unowned( | |
| 52023 | - Unowned::sampleUnowned() | |
| 52024 | - ); | |
| 52074 | + public function getUnowned(): Unowned { | |
| 52075 | + if (Obj6::validateUnowned($this->unowned)) { | |
| 52076 | + return $this->unowned; | |
| 52077 | + } | |
| 52078 | + throw new Exception('never get to getUnowned Obj6::unowned'); | |
| 52025 | 52079 | } |
| 52026 | -} | |
| 52027 | - | |
| 52028 | -// This is an autogenerated file:Unsafe | |
| 52029 | - | |
| 52030 | -class Unsafe { | |
| 52031 | - private int $unsafe; // json:unsafe Required | |
| 52032 | 52080 | |
| 52033 | 52081 | /** |
| 52034 | - * @param int $unsafe | |
| 52082 | + * @return Unowned | |
| 52035 | 52083 | */ |
| 52036 | - public function __construct(int $unsafe) { | |
| 52037 | - $this->unsafe = $unsafe; | |
| 52084 | + public static function sampleUnowned(): Unowned { | |
| 52085 | + return Unowned::sample(); /*32:unowned*/ | |
| 52038 | 52086 | } |
| 52039 | 52087 | |
| 52040 | 52088 | /** |
| 52041 | - * @param int $value | |
| 52089 | + * @param stdClass $value | |
| 52042 | 52090 | * @throws Exception |
| 52043 | - * @return int | |
| 52091 | + * @return Unsafe | |
| 52044 | 52092 | */ |
| 52045 | - public static function fromUnsafe(int $value): int { | |
| 52046 | - return $value; /*int*/ | |
| 52093 | + public static function fromUnsafe(stdClass $value): Unsafe { | |
| 52094 | + return Unsafe::from($value); /*class*/ | |
| 52047 | 52095 | } |
| 52048 | 52096 | |
| 52049 | 52097 | /** |
| 52050 | 52098 | * @throws Exception |
| 52051 | - * @return int | |
| 52099 | + * @return stdClass | |
| 52052 | 52100 | */ |
| 52053 | - public function toUnsafe(): int { | |
| 52054 | - if (Unsafe::validateUnsafe($this->unsafe)) { | |
| 52055 | - return $this->unsafe; /*int*/ | |
| 52101 | + public function toUnsafe(): stdClass { | |
| 52102 | + if (Obj6::validateUnsafe($this->unsafe)) { | |
| 52103 | + return $this->unsafe->to(); /*class*/ | |
| 52056 | 52104 | } |
| 52057 | - throw new Exception('never get to this Unsafe::unsafe'); | |
| 52105 | + throw new Exception('never get to this Obj6::unsafe'); | |
| 52058 | 52106 | } |
| 52059 | 52107 | |
| 52060 | 52108 | /** |
| 52061 | - * @param int | |
| 52109 | + * @param Unsafe | |
| 52062 | 52110 | * @return bool |
| 52063 | 52111 | * @throws Exception |
| 52064 | 52112 | */ |
| 52065 | - public static function validateUnsafe(int $value): bool { | |
| 52113 | + public static function validateUnsafe(Unsafe $value): bool { | |
| 52114 | + $value->validate(); | |
| 52066 | 52115 | return true; |
| 52067 | 52116 | } |
| 52068 | 52117 | |
| 52069 | 52118 | /** |
| 52070 | 52119 | * @throws Exception |
| 52071 | - * @return int | |
| 52120 | + * @return Unsafe | |
| 52072 | 52121 | */ |
| 52073 | - public function getUnsafe(): int { | |
| 52074 | - if (Unsafe::validateUnsafe($this->unsafe)) { | |
| 52122 | + public function getUnsafe(): Unsafe { | |
| 52123 | + if (Obj6::validateUnsafe($this->unsafe)) { | |
| 52075 | 52124 | return $this->unsafe; |
| 52076 | 52125 | } |
| 52077 | - throw new Exception('never get to getUnsafe Unsafe::unsafe'); | |
| 52126 | + throw new Exception('never get to getUnsafe Obj6::unsafe'); | |
| 52078 | 52127 | } |
| 52079 | 52128 | |
| 52080 | 52129 | /** |
| 52081 | - * @return int | |
| 52130 | + * @return Unsafe | |
| 52082 | 52131 | */ |
| 52083 | - public static function sampleUnsafe(): int { | |
| 52084 | - return 31; /*31:unsafe*/ | |
| 52132 | + public static function sampleUnsafe(): Unsafe { | |
| 52133 | + return Unsafe::sample(); /*33:unsafe*/ | |
| 52085 | 52134 | } |
| 52086 | 52135 | |
| 52087 | 52136 | /** |
| 52137 | + * @param stdClass $value | |
| 52088 | 52138 | * @throws Exception |
| 52089 | - * @return bool | |
| 52139 | + * @return Unsigned | |
| 52090 | 52140 | */ |
| 52091 | - public function validate(): bool { | |
| 52092 | - return Unsafe::validateUnsafe($this->unsafe); | |
| 52141 | + public static function fromUnsigned(stdClass $value): Unsigned { | |
| 52142 | + return Unsigned::from($value); /*class*/ | |
| 52093 | 52143 | } |
| 52094 | 52144 | |
| 52095 | 52145 | /** |
| 52096 | - * @return stdClass | |
| 52097 | 52146 | * @throws Exception |
| 52147 | + * @return stdClass | |
| 52098 | 52148 | */ |
| 52099 | - public function to(): stdClass { | |
| 52100 | - $out = new stdClass(); | |
| 52101 | - $out->{'unsafe'} = $this->toUnsafe(); | |
| 52102 | - return $out; | |
| 52149 | + public function toUnsigned(): stdClass { | |
| 52150 | + if (Obj6::validateUnsigned($this->unsigned)) { | |
| 52151 | + return $this->unsigned->to(); /*class*/ | |
| 52152 | + } | |
| 52153 | + throw new Exception('never get to this Obj6::unsigned'); | |
| 52103 | 52154 | } |
| 52104 | 52155 | |
| 52105 | 52156 | /** |
| 52106 | - * @param stdClass $obj | |
| 52107 | - * @return Unsafe | |
| 52157 | + * @param Unsigned | |
| 52158 | + * @return bool | |
| 52108 | 52159 | * @throws Exception |
| 52109 | 52160 | */ |
| 52110 | - public static function from(stdClass $obj): Unsafe { | |
| 52111 | - if (!property_exists($obj, 'unsafe')) { | |
| 52112 | - throw new Exception("Missing required property"); | |
| 52113 | - } | |
| 52114 | - return new Unsafe( | |
| 52115 | - Unsafe::fromUnsafe($obj->{'unsafe'}) | |
| 52116 | - ); | |
| 52161 | + public static function validateUnsigned(Unsigned $value): bool { | |
| 52162 | + $value->validate(); | |
| 52163 | + return true; | |
| 52117 | 52164 | } |
| 52118 | 52165 | |
| 52119 | 52166 | /** |
| 52120 | - * @return Unsafe | |
| 52167 | + * @throws Exception | |
| 52168 | + * @return Unsigned | |
| 52121 | 52169 | */ |
| 52122 | - public static function sample(): Unsafe { | |
| 52123 | - return new Unsafe( | |
| 52124 | - Unsafe::sampleUnsafe() | |
| 52125 | - ); | |
| 52170 | + public function getUnsigned(): Unsigned { | |
| 52171 | + if (Obj6::validateUnsigned($this->unsigned)) { | |
| 52172 | + return $this->unsigned; | |
| 52173 | + } | |
| 52174 | + throw new Exception('never get to getUnsigned Obj6::unsigned'); | |
| 52126 | 52175 | } |
| 52127 | -} | |
| 52128 | - | |
| 52129 | -// This is an autogenerated file:UseSerializers | |
| 52130 | - | |
| 52131 | -class UseSerializers { | |
| 52132 | - private int $useSerializers; // json:UseSerializers Required | |
| 52133 | 52176 | |
| 52134 | 52177 | /** |
| 52135 | - * @param int $useSerializers | |
| 52178 | + * @return Unsigned | |
| 52136 | 52179 | */ |
| 52137 | - public function __construct(int $useSerializers) { | |
| 52138 | - $this->useSerializers = $useSerializers; | |
| 52180 | + public static function sampleUnsigned(): Unsigned { | |
| 52181 | + return Unsigned::sample(); /*34:unsigned*/ | |
| 52139 | 52182 | } |
| 52140 | 52183 | |
| 52141 | 52184 | /** |
| 52142 | - * @param int $value | |
| 52185 | + * @param stdClass $value | |
| 52143 | 52186 | * @throws Exception |
| 52144 | - * @return int | |
| 52187 | + * @return UseSerializers | |
| 52145 | 52188 | */ |
| 52146 | - public static function fromUseSerializers(int $value): int { | |
| 52147 | - return $value; /*int*/ | |
| 52189 | + public static function fromUseSerializers(stdClass $value): UseSerializers { | |
| 52190 | + return UseSerializers::from($value); /*class*/ | |
| 52148 | 52191 | } |
| 52149 | 52192 | |
| 52150 | 52193 | /** |
| 52151 | 52194 | * @throws Exception |
| 52152 | - * @return int | |
| 52195 | + * @return stdClass | |
| 52153 | 52196 | */ |
| 52154 | - public function toUseSerializers(): int { | |
| 52155 | - if (UseSerializers::validateUseSerializers($this->useSerializers)) { | |
| 52156 | - return $this->useSerializers; /*int*/ | |
| 52197 | + public function toUseSerializers(): stdClass { | |
| 52198 | + if (Obj6::validateUseSerializers($this->useSerializers)) { | |
| 52199 | + return $this->useSerializers->to(); /*class*/ | |
| 52157 | 52200 | } |
| 52158 | - throw new Exception('never get to this UseSerializers::useSerializers'); | |
| 52201 | + throw new Exception('never get to this Obj6::useSerializers'); | |
| 52159 | 52202 | } |
| 52160 | 52203 | |
| 52161 | 52204 | /** |
| 52162 | - * @param int | |
| 52205 | + * @param UseSerializers | |
| 52163 | 52206 | * @return bool |
| 52164 | 52207 | * @throws Exception |
| 52165 | 52208 | */ |
| 52166 | - public static function validateUseSerializers(int $value): bool { | |
| 52209 | + public static function validateUseSerializers(UseSerializers $value): bool { | |
| 52210 | + $value->validate(); | |
| 52167 | 52211 | return true; |
| 52168 | 52212 | } |
| 52169 | 52213 | |
| 52170 | 52214 | /** |
| 52171 | 52215 | * @throws Exception |
| 52172 | - * @return int | |
| 52216 | + * @return UseSerializers | |
| 52173 | 52217 | */ |
| 52174 | - public function getUseSerializers(): int { | |
| 52175 | - if (UseSerializers::validateUseSerializers($this->useSerializers)) { | |
| 52218 | + public function getUseSerializers(): UseSerializers { | |
| 52219 | + if (Obj6::validateUseSerializers($this->useSerializers)) { | |
| 52176 | 52220 | return $this->useSerializers; |
| 52177 | 52221 | } |
| 52178 | - throw new Exception('never get to getUseSerializers UseSerializers::useSerializers'); | |
| 52222 | + throw new Exception('never get to getUseSerializers Obj6::useSerializers'); | |
| 52179 | 52223 | } |
| 52180 | 52224 | |
| 52181 | 52225 | /** |
| 52182 | - * @return int | |
| 52226 | + * @return UseSerializers | |
| 52183 | 52227 | */ |
| 52184 | - public static function sampleUseSerializers(): int { | |
| 52185 | - return 31; /*31:useSerializers*/ | |
| 52228 | + public static function sampleUseSerializers(): UseSerializers { | |
| 52229 | + return UseSerializers::sample(); /*35:useSerializers*/ | |
| 52186 | 52230 | } |
| 52187 | 52231 | |
| 52188 | 52232 | /** |
| 52233 | + * @param stdClass $value | |
| 52189 | 52234 | * @throws Exception |
| 52190 | - * @return bool | |
| 52191 | - */ | |
| 52192 | - public function validate(): bool { | |
| 52193 | - return UseSerializers::validateUseSerializers($this->useSerializers); | |
| 52194 | - } | |
| 52195 | - | |
| 52196 | - /** | |
| 52197 | - * @return stdClass | |
| 52198 | - * @throws Exception | |
| 52199 | - */ | |
| 52200 | - public function to(): stdClass { | |
| 52201 | - $out = new stdClass(); | |
| 52202 | - $out->{'UseSerializers'} = $this->toUseSerializers(); | |
| 52203 | - return $out; | |
| 52204 | - } | |
| 52205 | - | |
| 52206 | - /** | |
| 52207 | - * @param stdClass $obj | |
| 52208 | - * @return UseSerializers | |
| 52209 | - * @throws Exception | |
| 52210 | - */ | |
| 52211 | - public static function from(stdClass $obj): UseSerializers { | |
| 52212 | - if (!property_exists($obj, 'UseSerializers')) { | |
| 52213 | - throw new Exception("Missing required property"); | |
| 52214 | - } | |
| 52215 | - return new UseSerializers( | |
| 52216 | - UseSerializers::fromUseSerializers($obj->{'UseSerializers'}) | |
| 52217 | - ); | |
| 52218 | - } | |
| 52219 | - | |
| 52220 | - /** | |
| 52221 | - * @return UseSerializers | |
| 52222 | - */ | |
| 52223 | - public static function sample(): UseSerializers { | |
| 52224 | - return new UseSerializers( | |
| 52225 | - UseSerializers::sampleUseSerializers() | |
| 52226 | - ); | |
| 52227 | - } | |
| 52228 | -} | |
| 52229 | - | |
| 52230 | -// This is an autogenerated file:Obj6 | |
| 52231 | - | |
| 52232 | -class Obj6 { | |
| 52233 | - private int $dummy; // json:dummy Required | |
| 52234 | - private Unsigned $unsigned; // json:unsigned Required | |
| 52235 | - private Ushort $ushort; // json:ushort Required | |
| 52236 | - private Using $using; // json:using Required | |
| 52237 | - private Utf8JSONReader $utf8JSONReader; // json:Utf8JsonReader Required | |
| 52238 | - private Utf8JSONWriter $utf8JSONWriter; // json:Utf8JsonWriter Required | |
| 52239 | - private UUID $uuid; // json:UUID Required | |
| 52240 | - private VarClass $var; // json:var Required | |
| 52241 | - private Virtual $virtual; // json:virtual Required | |
| 52242 | - private VoidClass $void; // json:void Required | |
| 52243 | - private Volatile $volatile; // json:volatile Required | |
| 52244 | - private WcharT $wcharT; // json:wchar_t Required | |
| 52245 | - private Weak $weak; // json:weak Required | |
| 52246 | - private Where $where; // json:where Required | |
| 52247 | - private WhileClass $while; // json:while Required | |
| 52248 | - private WillSet $willSet; // json:willSet Required | |
| 52249 | - private With $with; // json:with Required | |
| 52250 | - private XorClass $xor; // json:xor Required | |
| 52251 | - private XorEq $xorEq; // json:xor_eq Required | |
| 52252 | - private Yes $yes; // json:YES Required | |
| 52253 | - private YieldClass $yield; // json:yield Required | |
| 52254 | - | |
| 52255 | - /** | |
| 52256 | - * @param int $dummy | |
| 52257 | - * @param Unsigned $unsigned | |
| 52258 | - * @param Ushort $ushort | |
| 52259 | - * @param Using $using | |
| 52260 | - * @param Utf8JSONReader $utf8JSONReader | |
| 52261 | - * @param Utf8JSONWriter $utf8JSONWriter | |
| 52262 | - * @param UUID $uuid | |
| 52263 | - * @param VarClass $var | |
| 52264 | - * @param Virtual $virtual | |
| 52265 | - * @param VoidClass $void | |
| 52266 | - * @param Volatile $volatile | |
| 52267 | - * @param WcharT $wcharT | |
| 52268 | - * @param Weak $weak | |
| 52269 | - * @param Where $where | |
| 52270 | - * @param WhileClass $while | |
| 52271 | - * @param WillSet $willSet | |
| 52272 | - * @param With $with | |
| 52273 | - * @param XorClass $xor | |
| 52274 | - * @param XorEq $xorEq | |
| 52275 | - * @param Yes $yes | |
| 52276 | - * @param YieldClass $yield | |
| 52277 | - */ | |
| 52278 | - public function __construct(int $dummy, Unsigned $unsigned, Ushort $ushort, Using $using, Utf8JSONReader $utf8JSONReader, Utf8JSONWriter $utf8JSONWriter, UUID $uuid, VarClass $var, Virtual $virtual, VoidClass $void, Volatile $volatile, WcharT $wcharT, Weak $weak, Where $where, WhileClass $while, WillSet $willSet, With $with, XorClass $xor, XorEq $xorEq, Yes $yes, YieldClass $yield) { | |
| 52279 | - $this->dummy = $dummy; | |
| 52280 | - $this->unsigned = $unsigned; | |
| 52281 | - $this->ushort = $ushort; | |
| 52282 | - $this->using = $using; | |
| 52283 | - $this->utf8JSONReader = $utf8JSONReader; | |
| 52284 | - $this->utf8JSONWriter = $utf8JSONWriter; | |
| 52285 | - $this->uuid = $uuid; | |
| 52286 | - $this->var = $var; | |
| 52287 | - $this->virtual = $virtual; | |
| 52288 | - $this->void = $void; | |
| 52289 | - $this->volatile = $volatile; | |
| 52290 | - $this->wcharT = $wcharT; | |
| 52291 | - $this->weak = $weak; | |
| 52292 | - $this->where = $where; | |
| 52293 | - $this->while = $while; | |
| 52294 | - $this->willSet = $willSet; | |
| 52295 | - $this->with = $with; | |
| 52296 | - $this->xor = $xor; | |
| 52297 | - $this->xorEq = $xorEq; | |
| 52298 | - $this->yes = $yes; | |
| 52299 | - $this->yield = $yield; | |
| 52300 | - } | |
| 52301 | - | |
| 52302 | - /** | |
| 52303 | - * @param int $value | |
| 52304 | - * @throws Exception | |
| 52305 | - * @return int | |
| 52306 | - */ | |
| 52307 | - public static function fromDummy(int $value): int { | |
| 52308 | - return $value; /*int*/ | |
| 52309 | - } | |
| 52310 | - | |
| 52311 | - /** | |
| 52312 | - * @throws Exception | |
| 52313 | - * @return int | |
| 52314 | - */ | |
| 52315 | - public function toDummy(): int { | |
| 52316 | - if (Obj6::validateDummy($this->dummy)) { | |
| 52317 | - return $this->dummy; /*int*/ | |
| 52318 | - } | |
| 52319 | - throw new Exception('never get to this Obj6::dummy'); | |
| 52320 | - } | |
| 52321 | - | |
| 52322 | - /** | |
| 52323 | - * @param int | |
| 52324 | - * @return bool | |
| 52325 | - * @throws Exception | |
| 52326 | - */ | |
| 52327 | - public static function validateDummy(int $value): bool { | |
| 52328 | - return true; | |
| 52329 | - } | |
| 52330 | - | |
| 52331 | - /** | |
| 52332 | - * @throws Exception | |
| 52333 | - * @return int | |
| 52334 | - */ | |
| 52335 | - public function getDummy(): int { | |
| 52336 | - if (Obj6::validateDummy($this->dummy)) { | |
| 52337 | - return $this->dummy; | |
| 52338 | - } | |
| 52339 | - throw new Exception('never get to getDummy Obj6::dummy'); | |
| 52340 | - } | |
| 52341 | - | |
| 52342 | - /** | |
| 52343 | - * @return int | |
| 52344 | - */ | |
| 52345 | - public static function sampleDummy(): int { | |
| 52346 | - return 31; /*31:dummy*/ | |
| 52347 | - } | |
| 52348 | - | |
| 52349 | - /** | |
| 52350 | - * @param stdClass $value | |
| 52351 | - * @throws Exception | |
| 52352 | - * @return Unsigned | |
| 52353 | - */ | |
| 52354 | - public static function fromUnsigned(stdClass $value): Unsigned { | |
| 52355 | - return Unsigned::from($value); /*class*/ | |
| 52356 | - } | |
| 52357 | - | |
| 52358 | - /** | |
| 52359 | - * @throws Exception | |
| 52360 | - * @return stdClass | |
| 52361 | - */ | |
| 52362 | - public function toUnsigned(): stdClass { | |
| 52363 | - if (Obj6::validateUnsigned($this->unsigned)) { | |
| 52364 | - return $this->unsigned->to(); /*class*/ | |
| 52365 | - } | |
| 52366 | - throw new Exception('never get to this Obj6::unsigned'); | |
| 52367 | - } | |
| 52368 | - | |
| 52369 | - /** | |
| 52370 | - * @param Unsigned | |
| 52371 | - * @return bool | |
| 52372 | - * @throws Exception | |
| 52373 | - */ | |
| 52374 | - public static function validateUnsigned(Unsigned $value): bool { | |
| 52375 | - $value->validate(); | |
| 52376 | - return true; | |
| 52377 | - } | |
| 52378 | - | |
| 52379 | - /** | |
| 52380 | - * @throws Exception | |
| 52381 | - * @return Unsigned | |
| 52382 | - */ | |
| 52383 | - public function getUnsigned(): Unsigned { | |
| 52384 | - if (Obj6::validateUnsigned($this->unsigned)) { | |
| 52385 | - return $this->unsigned; | |
| 52386 | - } | |
| 52387 | - throw new Exception('never get to getUnsigned Obj6::unsigned'); | |
| 52388 | - } | |
| 52389 | - | |
| 52390 | - /** | |
| 52391 | - * @return Unsigned | |
| 52392 | - */ | |
| 52393 | - public static function sampleUnsigned(): Unsigned { | |
| 52394 | - return Unsigned::sample(); /*32:unsigned*/ | |
| 52395 | - } | |
| 52396 | - | |
| 52397 | - /** | |
| 52398 | - * @param stdClass $value | |
| 52399 | - * @throws Exception | |
| 52400 | - * @return Ushort | |
| 52235 | + * @return Ushort | |
| 52401 | 52236 | */ |
| 52402 | 52237 | public static function fromUshort(stdClass $value): Ushort { |
| 52403 | 52238 | return Ushort::from($value); /*class*/ |
| @@ -52439,7 +52274,7 @@ class Obj6 { | ||
| 52439 | 52274 | * @return Ushort |
| 52440 | 52275 | */ |
| 52441 | 52276 | public static function sampleUshort(): Ushort { |
| 52442 | - return Ushort::sample(); /*33:ushort*/ | |
| 52277 | + return Ushort::sample(); /*36:ushort*/ | |
| 52443 | 52278 | } |
| 52444 | 52279 | |
| 52445 | 52280 | /** |
| @@ -52487,7 +52322,7 @@ class Obj6 { | ||
| 52487 | 52322 | * @return Using |
| 52488 | 52323 | */ |
| 52489 | 52324 | public static function sampleUsing(): Using { |
| 52490 | - return Using::sample(); /*34:using*/ | |
| 52325 | + return Using::sample(); /*37:using*/ | |
| 52491 | 52326 | } |
| 52492 | 52327 | |
| 52493 | 52328 | /** |
| @@ -52535,7 +52370,7 @@ class Obj6 { | ||
| 52535 | 52370 | * @return Utf8JSONReader |
| 52536 | 52371 | */ |
| 52537 | 52372 | public static function sampleUtf8JSONReader(): Utf8JSONReader { |
| 52538 | - return Utf8JSONReader::sample(); /*35:utf8JSONReader*/ | |
| 52373 | + return Utf8JSONReader::sample(); /*38:utf8JSONReader*/ | |
| 52539 | 52374 | } |
| 52540 | 52375 | |
| 52541 | 52376 | /** |
| @@ -52583,7 +52418,7 @@ class Obj6 { | ||
| 52583 | 52418 | * @return Utf8JSONWriter |
| 52584 | 52419 | */ |
| 52585 | 52420 | public static function sampleUtf8JSONWriter(): Utf8JSONWriter { |
| 52586 | - return Utf8JSONWriter::sample(); /*36:utf8JSONWriter*/ | |
| 52421 | + return Utf8JSONWriter::sample(); /*39:utf8JSONWriter*/ | |
| 52587 | 52422 | } |
| 52588 | 52423 | |
| 52589 | 52424 | /** |
| @@ -52631,7 +52466,7 @@ class Obj6 { | ||
| 52631 | 52466 | * @return UUID |
| 52632 | 52467 | */ |
| 52633 | 52468 | public static function sampleUUID(): UUID { |
| 52634 | - return UUID::sample(); /*37:uuid*/ | |
| 52469 | + return UUID::sample(); /*40:uuid*/ | |
| 52635 | 52470 | } |
| 52636 | 52471 | |
| 52637 | 52472 | /** |
| @@ -52679,7 +52514,7 @@ class Obj6 { | ||
| 52679 | 52514 | * @return VarClass |
| 52680 | 52515 | */ |
| 52681 | 52516 | public static function sampleVar(): VarClass { |
| 52682 | - return VarClass::sample(); /*38:var*/ | |
| 52517 | + return VarClass::sample(); /*41:var*/ | |
| 52683 | 52518 | } |
| 52684 | 52519 | |
| 52685 | 52520 | /** |
| @@ -52727,7 +52562,7 @@ class Obj6 { | ||
| 52727 | 52562 | * @return Virtual |
| 52728 | 52563 | */ |
| 52729 | 52564 | public static function sampleVirtual(): Virtual { |
| 52730 | - return Virtual::sample(); /*39:virtual*/ | |
| 52565 | + return Virtual::sample(); /*42:virtual*/ | |
| 52731 | 52566 | } |
| 52732 | 52567 | |
| 52733 | 52568 | /** |
| @@ -52775,7 +52610,7 @@ class Obj6 { | ||
| 52775 | 52610 | * @return VoidClass |
| 52776 | 52611 | */ |
| 52777 | 52612 | public static function sampleVoid(): VoidClass { |
| 52778 | - return VoidClass::sample(); /*40:void*/ | |
| 52613 | + return VoidClass::sample(); /*43:void*/ | |
| 52779 | 52614 | } |
| 52780 | 52615 | |
| 52781 | 52616 | /** |
| @@ -52823,7 +52658,7 @@ class Obj6 { | ||
| 52823 | 52658 | * @return Volatile |
| 52824 | 52659 | */ |
| 52825 | 52660 | public static function sampleVolatile(): Volatile { |
| 52826 | - return Volatile::sample(); /*41:volatile*/ | |
| 52661 | + return Volatile::sample(); /*44:volatile*/ | |
| 52827 | 52662 | } |
| 52828 | 52663 | |
| 52829 | 52664 | /** |
| @@ -52871,7 +52706,7 @@ class Obj6 { | ||
| 52871 | 52706 | * @return WcharT |
| 52872 | 52707 | */ |
| 52873 | 52708 | public static function sampleWcharT(): WcharT { |
| 52874 | - return WcharT::sample(); /*42:wcharT*/ | |
| 52709 | + return WcharT::sample(); /*45:wcharT*/ | |
| 52875 | 52710 | } |
| 52876 | 52711 | |
| 52877 | 52712 | /** |
| @@ -52919,7 +52754,7 @@ class Obj6 { | ||
| 52919 | 52754 | * @return Weak |
| 52920 | 52755 | */ |
| 52921 | 52756 | public static function sampleWeak(): Weak { |
| 52922 | - return Weak::sample(); /*43:weak*/ | |
| 52757 | + return Weak::sample(); /*46:weak*/ | |
| 52923 | 52758 | } |
| 52924 | 52759 | |
| 52925 | 52760 | /** |
| @@ -52967,7 +52802,7 @@ class Obj6 { | ||
| 52967 | 52802 | * @return Where |
| 52968 | 52803 | */ |
| 52969 | 52804 | public static function sampleWhere(): Where { |
| 52970 | - return Where::sample(); /*44:where*/ | |
| 52805 | + return Where::sample(); /*47:where*/ | |
| 52971 | 52806 | } |
| 52972 | 52807 | |
| 52973 | 52808 | /** |
| @@ -53015,7 +52850,7 @@ class Obj6 { | ||
| 53015 | 52850 | * @return WhileClass |
| 53016 | 52851 | */ |
| 53017 | 52852 | public static function sampleWhile(): WhileClass { |
| 53018 | - return WhileClass::sample(); /*45:while*/ | |
| 52853 | + return WhileClass::sample(); /*48:while*/ | |
| 53019 | 52854 | } |
| 53020 | 52855 | |
| 53021 | 52856 | /** |
| @@ -53063,7 +52898,7 @@ class Obj6 { | ||
| 53063 | 52898 | * @return WillSet |
| 53064 | 52899 | */ |
| 53065 | 52900 | public static function sampleWillSet(): WillSet { |
| 53066 | - return WillSet::sample(); /*46:willSet*/ | |
| 52901 | + return WillSet::sample(); /*49:willSet*/ | |
| 53067 | 52902 | } |
| 53068 | 52903 | |
| 53069 | 52904 | /** |
| @@ -53111,7 +52946,7 @@ class Obj6 { | ||
| 53111 | 52946 | * @return With |
| 53112 | 52947 | */ |
| 53113 | 52948 | public static function sampleWith(): With { |
| 53114 | - return With::sample(); /*47:with*/ | |
| 52949 | + return With::sample(); /*50:with*/ | |
| 53115 | 52950 | } |
| 53116 | 52951 | |
| 53117 | 52952 | /** |
| @@ -53159,7 +52994,7 @@ class Obj6 { | ||
| 53159 | 52994 | * @return XorClass |
| 53160 | 52995 | */ |
| 53161 | 52996 | public static function sampleXor(): XorClass { |
| 53162 | - return XorClass::sample(); /*48:xor*/ | |
| 52997 | + return XorClass::sample(); /*51:xor*/ | |
| 53163 | 52998 | } |
| 53164 | 52999 | |
| 53165 | 53000 | /** |
| @@ -53207,7 +53042,7 @@ class Obj6 { | ||
| 53207 | 53042 | * @return XorEq |
| 53208 | 53043 | */ |
| 53209 | 53044 | public static function sampleXorEq(): XorEq { |
| 53210 | - return XorEq::sample(); /*49:xorEq*/ | |
| 53045 | + return XorEq::sample(); /*52:xorEq*/ | |
| 53211 | 53046 | } |
| 53212 | 53047 | |
| 53213 | 53048 | /** |
| @@ -53255,55 +53090,519 @@ class Obj6 { | ||
| 53255 | 53090 | * @return Yes |
| 53256 | 53091 | */ |
| 53257 | 53092 | public static function sampleYes(): Yes { |
| 53258 | - return Yes::sample(); /*50:yes*/ | |
| 53093 | + return Yes::sample(); /*53:yes*/ | |
| 53094 | + } | |
| 53095 | + | |
| 53096 | + /** | |
| 53097 | + * @param stdClass $value | |
| 53098 | + * @throws Exception | |
| 53099 | + * @return YieldClass | |
| 53100 | + */ | |
| 53101 | + public static function fromYield(stdClass $value): YieldClass { | |
| 53102 | + return YieldClass::from($value); /*class*/ | |
| 53103 | + } | |
| 53104 | + | |
| 53105 | + /** | |
| 53106 | + * @throws Exception | |
| 53107 | + * @return stdClass | |
| 53108 | + */ | |
| 53109 | + public function toYield(): stdClass { | |
| 53110 | + if (Obj6::validateYield($this->yield)) { | |
| 53111 | + return $this->yield->to(); /*class*/ | |
| 53112 | + } | |
| 53113 | + throw new Exception('never get to this Obj6::yield'); | |
| 53114 | + } | |
| 53115 | + | |
| 53116 | + /** | |
| 53117 | + * @param YieldClass | |
| 53118 | + * @return bool | |
| 53119 | + * @throws Exception | |
| 53120 | + */ | |
| 53121 | + public static function validateYield(YieldClass $value): bool { | |
| 53122 | + $value->validate(); | |
| 53123 | + return true; | |
| 53124 | + } | |
| 53125 | + | |
| 53126 | + /** | |
| 53127 | + * @throws Exception | |
| 53128 | + * @return YieldClass | |
| 53129 | + */ | |
| 53130 | + public function getYield(): YieldClass { | |
| 53131 | + if (Obj6::validateYield($this->yield)) { | |
| 53132 | + return $this->yield; | |
| 53133 | + } | |
| 53134 | + throw new Exception('never get to getYield Obj6::yield'); | |
| 53135 | + } | |
| 53136 | + | |
| 53137 | + /** | |
| 53138 | + * @return YieldClass | |
| 53139 | + */ | |
| 53140 | + public static function sampleYield(): YieldClass { | |
| 53141 | + return YieldClass::sample(); /*54:yield*/ | |
| 53142 | + } | |
| 53143 | + | |
| 53144 | + /** | |
| 53145 | + * @throws Exception | |
| 53146 | + * @return bool | |
| 53147 | + */ | |
| 53148 | + public function validate(): bool { | |
| 53149 | + return Obj6::validateDummy($this->dummy) | |
| 53150 | + || Obj6::validateUnowned($this->unowned) | |
| 53151 | + || Obj6::validateUnsafe($this->unsafe) | |
| 53152 | + || Obj6::validateUnsigned($this->unsigned) | |
| 53153 | + || Obj6::validateUseSerializers($this->useSerializers) | |
| 53154 | + || Obj6::validateUshort($this->ushort) | |
| 53155 | + || Obj6::validateUsing($this->using) | |
| 53156 | + || Obj6::validateUtf8JSONReader($this->utf8JSONReader) | |
| 53157 | + || Obj6::validateUtf8JSONWriter($this->utf8JSONWriter) | |
| 53158 | + || Obj6::validateUUID($this->uuid) | |
| 53159 | + || Obj6::validateVar($this->var) | |
| 53160 | + || Obj6::validateVirtual($this->virtual) | |
| 53161 | + || Obj6::validateVoid($this->void) | |
| 53162 | + || Obj6::validateVolatile($this->volatile) | |
| 53163 | + || Obj6::validateWcharT($this->wcharT) | |
| 53164 | + || Obj6::validateWeak($this->weak) | |
| 53165 | + || Obj6::validateWhere($this->where) | |
| 53166 | + || Obj6::validateWhile($this->while) | |
| 53167 | + || Obj6::validateWillSet($this->willSet) | |
| 53168 | + || Obj6::validateWith($this->with) | |
| 53169 | + || Obj6::validateXor($this->xor) | |
| 53170 | + || Obj6::validateXorEq($this->xorEq) | |
| 53171 | + || Obj6::validateYes($this->yes) | |
| 53172 | + || Obj6::validateYield($this->yield); | |
| 53173 | + } | |
| 53174 | + | |
| 53175 | + /** | |
| 53176 | + * @return stdClass | |
| 53177 | + * @throws Exception | |
| 53178 | + */ | |
| 53179 | + public function to(): stdClass { | |
| 53180 | + $out = new stdClass(); | |
| 53181 | + $out->{'dummy'} = $this->toDummy(); | |
| 53182 | + $out->{'unowned'} = $this->toUnowned(); | |
| 53183 | + $out->{'unsafe'} = $this->toUnsafe(); | |
| 53184 | + $out->{'unsigned'} = $this->toUnsigned(); | |
| 53185 | + $out->{'UseSerializers'} = $this->toUseSerializers(); | |
| 53186 | + $out->{'ushort'} = $this->toUshort(); | |
| 53187 | + $out->{'using'} = $this->toUsing(); | |
| 53188 | + $out->{'Utf8JsonReader'} = $this->toUtf8JSONReader(); | |
| 53189 | + $out->{'Utf8JsonWriter'} = $this->toUtf8JSONWriter(); | |
| 53190 | + $out->{'UUID'} = $this->toUUID(); | |
| 53191 | + $out->{'var'} = $this->toVar(); | |
| 53192 | + $out->{'virtual'} = $this->toVirtual(); | |
| 53193 | + $out->{'void'} = $this->toVoid(); | |
| 53194 | + $out->{'volatile'} = $this->toVolatile(); | |
| 53195 | + $out->{'wchar_t'} = $this->toWcharT(); | |
| 53196 | + $out->{'weak'} = $this->toWeak(); | |
| 53197 | + $out->{'where'} = $this->toWhere(); | |
| 53198 | + $out->{'while'} = $this->toWhile(); | |
| 53199 | + $out->{'willSet'} = $this->toWillSet(); | |
| 53200 | + $out->{'with'} = $this->toWith(); | |
| 53201 | + $out->{'xor'} = $this->toXor(); | |
| 53202 | + $out->{'xor_eq'} = $this->toXorEq(); | |
| 53203 | + $out->{'YES'} = $this->toYes(); | |
| 53204 | + $out->{'yield'} = $this->toYield(); | |
| 53205 | + return $out; | |
| 53206 | + } | |
| 53207 | + | |
| 53208 | + /** | |
| 53209 | + * @param stdClass $obj | |
| 53210 | + * @return Obj6 | |
| 53211 | + * @throws Exception | |
| 53212 | + */ | |
| 53213 | + public static function from(stdClass $obj): Obj6 { | |
| 53214 | + if (!property_exists($obj, 'dummy')) { | |
| 53215 | + throw new Exception("Missing required property"); | |
| 53216 | + } | |
| 53217 | + if (!property_exists($obj, 'unowned')) { | |
| 53218 | + throw new Exception("Missing required property"); | |
| 53219 | + } | |
| 53220 | + if (!property_exists($obj, 'unsafe')) { | |
| 53221 | + throw new Exception("Missing required property"); | |
| 53222 | + } | |
| 53223 | + if (!property_exists($obj, 'unsigned')) { | |
| 53224 | + throw new Exception("Missing required property"); | |
| 53225 | + } | |
| 53226 | + if (!property_exists($obj, 'UseSerializers')) { | |
| 53227 | + throw new Exception("Missing required property"); | |
| 53228 | + } | |
| 53229 | + if (!property_exists($obj, 'ushort')) { | |
| 53230 | + throw new Exception("Missing required property"); | |
| 53231 | + } | |
| 53232 | + if (!property_exists($obj, 'using')) { | |
| 53233 | + throw new Exception("Missing required property"); | |
| 53234 | + } | |
| 53235 | + if (!property_exists($obj, 'Utf8JsonReader')) { | |
| 53236 | + throw new Exception("Missing required property"); | |
| 53237 | + } | |
| 53238 | + if (!property_exists($obj, 'Utf8JsonWriter')) { | |
| 53239 | + throw new Exception("Missing required property"); | |
| 53240 | + } | |
| 53241 | + if (!property_exists($obj, 'UUID')) { | |
| 53242 | + throw new Exception("Missing required property"); | |
| 53243 | + } | |
| 53244 | + if (!property_exists($obj, 'var')) { | |
| 53245 | + throw new Exception("Missing required property"); | |
| 53246 | + } | |
| 53247 | + if (!property_exists($obj, 'virtual')) { | |
| 53248 | + throw new Exception("Missing required property"); | |
| 53249 | + } | |
| 53250 | + if (!property_exists($obj, 'void')) { | |
| 53251 | + throw new Exception("Missing required property"); | |
| 53252 | + } | |
| 53253 | + if (!property_exists($obj, 'volatile')) { | |
| 53254 | + throw new Exception("Missing required property"); | |
| 53255 | + } | |
| 53256 | + if (!property_exists($obj, 'wchar_t')) { | |
| 53257 | + throw new Exception("Missing required property"); | |
| 53258 | + } | |
| 53259 | + if (!property_exists($obj, 'weak')) { | |
| 53260 | + throw new Exception("Missing required property"); | |
| 53261 | + } | |
| 53262 | + if (!property_exists($obj, 'where')) { | |
| 53263 | + throw new Exception("Missing required property"); | |
| 53264 | + } | |
| 53265 | + if (!property_exists($obj, 'while')) { | |
| 53266 | + throw new Exception("Missing required property"); | |
| 53267 | + } | |
| 53268 | + if (!property_exists($obj, 'willSet')) { | |
| 53269 | + throw new Exception("Missing required property"); | |
| 53270 | + } | |
| 53271 | + if (!property_exists($obj, 'with')) { | |
| 53272 | + throw new Exception("Missing required property"); | |
| 53273 | + } | |
| 53274 | + if (!property_exists($obj, 'xor')) { | |
| 53275 | + throw new Exception("Missing required property"); | |
| 53276 | + } | |
| 53277 | + if (!property_exists($obj, 'xor_eq')) { | |
| 53278 | + throw new Exception("Missing required property"); | |
| 53279 | + } | |
| 53280 | + if (!property_exists($obj, 'YES')) { | |
| 53281 | + throw new Exception("Missing required property"); | |
| 53282 | + } | |
| 53283 | + if (!property_exists($obj, 'yield')) { | |
| 53284 | + throw new Exception("Missing required property"); | |
| 53285 | + } | |
| 53286 | + return new Obj6( | |
| 53287 | + Obj6::fromDummy($obj->{'dummy'}) | |
| 53288 | + ,Obj6::fromUnowned($obj->{'unowned'}) | |
| 53289 | + ,Obj6::fromUnsafe($obj->{'unsafe'}) | |
| 53290 | + ,Obj6::fromUnsigned($obj->{'unsigned'}) | |
| 53291 | + ,Obj6::fromUseSerializers($obj->{'UseSerializers'}) | |
| 53292 | + ,Obj6::fromUshort($obj->{'ushort'}) | |
| 53293 | + ,Obj6::fromUsing($obj->{'using'}) | |
| 53294 | + ,Obj6::fromUtf8JSONReader($obj->{'Utf8JsonReader'}) | |
| 53295 | + ,Obj6::fromUtf8JSONWriter($obj->{'Utf8JsonWriter'}) | |
| 53296 | + ,Obj6::fromUUID($obj->{'UUID'}) | |
| 53297 | + ,Obj6::fromVar($obj->{'var'}) | |
| 53298 | + ,Obj6::fromVirtual($obj->{'virtual'}) | |
| 53299 | + ,Obj6::fromVoid($obj->{'void'}) | |
| 53300 | + ,Obj6::fromVolatile($obj->{'volatile'}) | |
| 53301 | + ,Obj6::fromWcharT($obj->{'wchar_t'}) | |
| 53302 | + ,Obj6::fromWeak($obj->{'weak'}) | |
| 53303 | + ,Obj6::fromWhere($obj->{'where'}) | |
| 53304 | + ,Obj6::fromWhile($obj->{'while'}) | |
| 53305 | + ,Obj6::fromWillSet($obj->{'willSet'}) | |
| 53306 | + ,Obj6::fromWith($obj->{'with'}) | |
| 53307 | + ,Obj6::fromXor($obj->{'xor'}) | |
| 53308 | + ,Obj6::fromXorEq($obj->{'xor_eq'}) | |
| 53309 | + ,Obj6::fromYes($obj->{'YES'}) | |
| 53310 | + ,Obj6::fromYield($obj->{'yield'}) | |
| 53311 | + ); | |
| 53312 | + } | |
| 53313 | + | |
| 53314 | + /** | |
| 53315 | + * @return Obj6 | |
| 53316 | + */ | |
| 53317 | + public static function sample(): Obj6 { | |
| 53318 | + return new Obj6( | |
| 53319 | + Obj6::sampleDummy() | |
| 53320 | + ,Obj6::sampleUnowned() | |
| 53321 | + ,Obj6::sampleUnsafe() | |
| 53322 | + ,Obj6::sampleUnsigned() | |
| 53323 | + ,Obj6::sampleUseSerializers() | |
| 53324 | + ,Obj6::sampleUshort() | |
| 53325 | + ,Obj6::sampleUsing() | |
| 53326 | + ,Obj6::sampleUtf8JSONReader() | |
| 53327 | + ,Obj6::sampleUtf8JSONWriter() | |
| 53328 | + ,Obj6::sampleUUID() | |
| 53329 | + ,Obj6::sampleVar() | |
| 53330 | + ,Obj6::sampleVirtual() | |
| 53331 | + ,Obj6::sampleVoid() | |
| 53332 | + ,Obj6::sampleVolatile() | |
| 53333 | + ,Obj6::sampleWcharT() | |
| 53334 | + ,Obj6::sampleWeak() | |
| 53335 | + ,Obj6::sampleWhere() | |
| 53336 | + ,Obj6::sampleWhile() | |
| 53337 | + ,Obj6::sampleWillSet() | |
| 53338 | + ,Obj6::sampleWith() | |
| 53339 | + ,Obj6::sampleXor() | |
| 53340 | + ,Obj6::sampleXorEq() | |
| 53341 | + ,Obj6::sampleYes() | |
| 53342 | + ,Obj6::sampleYield() | |
| 53343 | + ); | |
| 53344 | + } | |
| 53345 | +} | |
| 53346 | + | |
| 53347 | +// This is an autogenerated file:Unowned | |
| 53348 | + | |
| 53349 | +class Unowned { | |
| 53350 | + private int $unowned; // json:unowned Required | |
| 53351 | + | |
| 53352 | + /** | |
| 53353 | + * @param int $unowned | |
| 53354 | + */ | |
| 53355 | + public function __construct(int $unowned) { | |
| 53356 | + $this->unowned = $unowned; | |
| 53357 | + } | |
| 53358 | + | |
| 53359 | + /** | |
| 53360 | + * @param int $value | |
| 53361 | + * @throws Exception | |
| 53362 | + * @return int | |
| 53363 | + */ | |
| 53364 | + public static function fromUnowned(int $value): int { | |
| 53365 | + return $value; /*int*/ | |
| 53366 | + } | |
| 53367 | + | |
| 53368 | + /** | |
| 53369 | + * @throws Exception | |
| 53370 | + * @return int | |
| 53371 | + */ | |
| 53372 | + public function toUnowned(): int { | |
| 53373 | + if (Unowned::validateUnowned($this->unowned)) { | |
| 53374 | + return $this->unowned; /*int*/ | |
| 53375 | + } | |
| 53376 | + throw new Exception('never get to this Unowned::unowned'); | |
| 53377 | + } | |
| 53378 | + | |
| 53379 | + /** | |
| 53380 | + * @param int | |
| 53381 | + * @return bool | |
| 53382 | + * @throws Exception | |
| 53383 | + */ | |
| 53384 | + public static function validateUnowned(int $value): bool { | |
| 53385 | + return true; | |
| 53386 | + } | |
| 53387 | + | |
| 53388 | + /** | |
| 53389 | + * @throws Exception | |
| 53390 | + * @return int | |
| 53391 | + */ | |
| 53392 | + public function getUnowned(): int { | |
| 53393 | + if (Unowned::validateUnowned($this->unowned)) { | |
| 53394 | + return $this->unowned; | |
| 53395 | + } | |
| 53396 | + throw new Exception('never get to getUnowned Unowned::unowned'); | |
| 53397 | + } | |
| 53398 | + | |
| 53399 | + /** | |
| 53400 | + * @return int | |
| 53401 | + */ | |
| 53402 | + public static function sampleUnowned(): int { | |
| 53403 | + return 31; /*31:unowned*/ | |
| 53404 | + } | |
| 53405 | + | |
| 53406 | + /** | |
| 53407 | + * @throws Exception | |
| 53408 | + * @return bool | |
| 53409 | + */ | |
| 53410 | + public function validate(): bool { | |
| 53411 | + return Unowned::validateUnowned($this->unowned); | |
| 53412 | + } | |
| 53413 | + | |
| 53414 | + /** | |
| 53415 | + * @return stdClass | |
| 53416 | + * @throws Exception | |
| 53417 | + */ | |
| 53418 | + public function to(): stdClass { | |
| 53419 | + $out = new stdClass(); | |
| 53420 | + $out->{'unowned'} = $this->toUnowned(); | |
| 53421 | + return $out; | |
| 53422 | + } | |
| 53423 | + | |
| 53424 | + /** | |
| 53425 | + * @param stdClass $obj | |
| 53426 | + * @return Unowned | |
| 53427 | + * @throws Exception | |
| 53428 | + */ | |
| 53429 | + public static function from(stdClass $obj): Unowned { | |
| 53430 | + if (!property_exists($obj, 'unowned')) { | |
| 53431 | + throw new Exception("Missing required property"); | |
| 53432 | + } | |
| 53433 | + return new Unowned( | |
| 53434 | + Unowned::fromUnowned($obj->{'unowned'}) | |
| 53435 | + ); | |
| 53436 | + } | |
| 53437 | + | |
| 53438 | + /** | |
| 53439 | + * @return Unowned | |
| 53440 | + */ | |
| 53441 | + public static function sample(): Unowned { | |
| 53442 | + return new Unowned( | |
| 53443 | + Unowned::sampleUnowned() | |
| 53444 | + ); | |
| 53445 | + } | |
| 53446 | +} | |
| 53447 | + | |
| 53448 | +// This is an autogenerated file:Unsafe | |
| 53449 | + | |
| 53450 | +class Unsafe { | |
| 53451 | + private int $unsafe; // json:unsafe Required | |
| 53452 | + | |
| 53453 | + /** | |
| 53454 | + * @param int $unsafe | |
| 53455 | + */ | |
| 53456 | + public function __construct(int $unsafe) { | |
| 53457 | + $this->unsafe = $unsafe; | |
| 53458 | + } | |
| 53459 | + | |
| 53460 | + /** | |
| 53461 | + * @param int $value | |
| 53462 | + * @throws Exception | |
| 53463 | + * @return int | |
| 53464 | + */ | |
| 53465 | + public static function fromUnsafe(int $value): int { | |
| 53466 | + return $value; /*int*/ | |
| 53467 | + } | |
| 53468 | + | |
| 53469 | + /** | |
| 53470 | + * @throws Exception | |
| 53471 | + * @return int | |
| 53472 | + */ | |
| 53473 | + public function toUnsafe(): int { | |
| 53474 | + if (Unsafe::validateUnsafe($this->unsafe)) { | |
| 53475 | + return $this->unsafe; /*int*/ | |
| 53476 | + } | |
| 53477 | + throw new Exception('never get to this Unsafe::unsafe'); | |
| 53478 | + } | |
| 53479 | + | |
| 53480 | + /** | |
| 53481 | + * @param int | |
| 53482 | + * @return bool | |
| 53483 | + * @throws Exception | |
| 53484 | + */ | |
| 53485 | + public static function validateUnsafe(int $value): bool { | |
| 53486 | + return true; | |
| 53487 | + } | |
| 53488 | + | |
| 53489 | + /** | |
| 53490 | + * @throws Exception | |
| 53491 | + * @return int | |
| 53492 | + */ | |
| 53493 | + public function getUnsafe(): int { | |
| 53494 | + if (Unsafe::validateUnsafe($this->unsafe)) { | |
| 53495 | + return $this->unsafe; | |
| 53496 | + } | |
| 53497 | + throw new Exception('never get to getUnsafe Unsafe::unsafe'); | |
| 53498 | + } | |
| 53499 | + | |
| 53500 | + /** | |
| 53501 | + * @return int | |
| 53502 | + */ | |
| 53503 | + public static function sampleUnsafe(): int { | |
| 53504 | + return 31; /*31:unsafe*/ | |
| 53505 | + } | |
| 53506 | + | |
| 53507 | + /** | |
| 53508 | + * @throws Exception | |
| 53509 | + * @return bool | |
| 53510 | + */ | |
| 53511 | + public function validate(): bool { | |
| 53512 | + return Unsafe::validateUnsafe($this->unsafe); | |
| 53513 | + } | |
| 53514 | + | |
| 53515 | + /** | |
| 53516 | + * @return stdClass | |
| 53517 | + * @throws Exception | |
| 53518 | + */ | |
| 53519 | + public function to(): stdClass { | |
| 53520 | + $out = new stdClass(); | |
| 53521 | + $out->{'unsafe'} = $this->toUnsafe(); | |
| 53522 | + return $out; | |
| 53523 | + } | |
| 53524 | + | |
| 53525 | + /** | |
| 53526 | + * @param stdClass $obj | |
| 53527 | + * @return Unsafe | |
| 53528 | + * @throws Exception | |
| 53529 | + */ | |
| 53530 | + public static function from(stdClass $obj): Unsafe { | |
| 53531 | + if (!property_exists($obj, 'unsafe')) { | |
| 53532 | + throw new Exception("Missing required property"); | |
| 53533 | + } | |
| 53534 | + return new Unsafe( | |
| 53535 | + Unsafe::fromUnsafe($obj->{'unsafe'}) | |
| 53536 | + ); | |
| 53537 | + } | |
| 53538 | + | |
| 53539 | + /** | |
| 53540 | + * @return Unsafe | |
| 53541 | + */ | |
| 53542 | + public static function sample(): Unsafe { | |
| 53543 | + return new Unsafe( | |
| 53544 | + Unsafe::sampleUnsafe() | |
| 53545 | + ); | |
| 53546 | + } | |
| 53547 | +} | |
| 53548 | + | |
| 53549 | +// This is an autogenerated file:Unsigned | |
| 53550 | + | |
| 53551 | +class Unsigned { | |
| 53552 | + private int $unsigned; // json:unsigned Required | |
| 53553 | + | |
| 53554 | + /** | |
| 53555 | + * @param int $unsigned | |
| 53556 | + */ | |
| 53557 | + public function __construct(int $unsigned) { | |
| 53558 | + $this->unsigned = $unsigned; | |
| 53259 | 53559 | } |
| 53260 | 53560 | |
| 53261 | 53561 | /** |
| 53262 | - * @param stdClass $value | |
| 53562 | + * @param int $value | |
| 53263 | 53563 | * @throws Exception |
| 53264 | - * @return YieldClass | |
| 53564 | + * @return int | |
| 53265 | 53565 | */ |
| 53266 | - public static function fromYield(stdClass $value): YieldClass { | |
| 53267 | - return YieldClass::from($value); /*class*/ | |
| 53566 | + public static function fromUnsigned(int $value): int { | |
| 53567 | + return $value; /*int*/ | |
| 53268 | 53568 | } |
| 53269 | 53569 | |
| 53270 | 53570 | /** |
| 53271 | 53571 | * @throws Exception |
| 53272 | - * @return stdClass | |
| 53572 | + * @return int | |
| 53273 | 53573 | */ |
| 53274 | - public function toYield(): stdClass { | |
| 53275 | - if (Obj6::validateYield($this->yield)) { | |
| 53276 | - return $this->yield->to(); /*class*/ | |
| 53574 | + public function toUnsigned(): int { | |
| 53575 | + if (Unsigned::validateUnsigned($this->unsigned)) { | |
| 53576 | + return $this->unsigned; /*int*/ | |
| 53277 | 53577 | } |
| 53278 | - throw new Exception('never get to this Obj6::yield'); | |
| 53578 | + throw new Exception('never get to this Unsigned::unsigned'); | |
| 53279 | 53579 | } |
| 53280 | 53580 | |
| 53281 | 53581 | /** |
| 53282 | - * @param YieldClass | |
| 53582 | + * @param int | |
| 53283 | 53583 | * @return bool |
| 53284 | 53584 | * @throws Exception |
| 53285 | 53585 | */ |
| 53286 | - public static function validateYield(YieldClass $value): bool { | |
| 53287 | - $value->validate(); | |
| 53586 | + public static function validateUnsigned(int $value): bool { | |
| 53288 | 53587 | return true; |
| 53289 | 53588 | } |
| 53290 | 53589 | |
| 53291 | 53590 | /** |
| 53292 | 53591 | * @throws Exception |
| 53293 | - * @return YieldClass | |
| 53592 | + * @return int | |
| 53294 | 53593 | */ |
| 53295 | - public function getYield(): YieldClass { | |
| 53296 | - if (Obj6::validateYield($this->yield)) { | |
| 53297 | - return $this->yield; | |
| 53594 | + public function getUnsigned(): int { | |
| 53595 | + if (Unsigned::validateUnsigned($this->unsigned)) { | |
| 53596 | + return $this->unsigned; | |
| 53298 | 53597 | } |
| 53299 | - throw new Exception('never get to getYield Obj6::yield'); | |
| 53598 | + throw new Exception('never get to getUnsigned Unsigned::unsigned'); | |
| 53300 | 53599 | } |
| 53301 | 53600 | |
| 53302 | 53601 | /** |
| 53303 | - * @return YieldClass | |
| 53602 | + * @return int | |
| 53304 | 53603 | */ |
| 53305 | - public static function sampleYield(): YieldClass { | |
| 53306 | - return YieldClass::sample(); /*51:yield*/ | |
| 53604 | + public static function sampleUnsigned(): int { | |
| 53605 | + return 31; /*31:unsigned*/ | |
| 53307 | 53606 | } |
| 53308 | 53607 | |
| 53309 | 53608 | /** |
| @@ -53311,27 +53610,7 @@ class Obj6 { | ||
| 53311 | 53610 | * @return bool |
| 53312 | 53611 | */ |
| 53313 | 53612 | public function validate(): bool { |
| 53314 | - return Obj6::validateDummy($this->dummy) | |
| 53315 | - || Obj6::validateUnsigned($this->unsigned) | |
| 53316 | - || Obj6::validateUshort($this->ushort) | |
| 53317 | - || Obj6::validateUsing($this->using) | |
| 53318 | - || Obj6::validateUtf8JSONReader($this->utf8JSONReader) | |
| 53319 | - || Obj6::validateUtf8JSONWriter($this->utf8JSONWriter) | |
| 53320 | - || Obj6::validateUUID($this->uuid) | |
| 53321 | - || Obj6::validateVar($this->var) | |
| 53322 | - || Obj6::validateVirtual($this->virtual) | |
| 53323 | - || Obj6::validateVoid($this->void) | |
| 53324 | - || Obj6::validateVolatile($this->volatile) | |
| 53325 | - || Obj6::validateWcharT($this->wcharT) | |
| 53326 | - || Obj6::validateWeak($this->weak) | |
| 53327 | - || Obj6::validateWhere($this->where) | |
| 53328 | - || Obj6::validateWhile($this->while) | |
| 53329 | - || Obj6::validateWillSet($this->willSet) | |
| 53330 | - || Obj6::validateWith($this->with) | |
| 53331 | - || Obj6::validateXor($this->xor) | |
| 53332 | - || Obj6::validateXorEq($this->xorEq) | |
| 53333 | - || Obj6::validateYes($this->yes) | |
| 53334 | - || Obj6::validateYield($this->yield); | |
| 53613 | + return Unsigned::validateUnsigned($this->unsigned); | |
| 53335 | 53614 | } |
| 53336 | 53615 | |
| 53337 | 53616 | /** |
| @@ -53340,164 +53619,44 @@ class Obj6 { | ||
| 53340 | 53619 | */ |
| 53341 | 53620 | public function to(): stdClass { |
| 53342 | 53621 | $out = new stdClass(); |
| 53343 | - $out->{'dummy'} = $this->toDummy(); | |
| 53344 | 53622 | $out->{'unsigned'} = $this->toUnsigned(); |
| 53345 | - $out->{'ushort'} = $this->toUshort(); | |
| 53346 | - $out->{'using'} = $this->toUsing(); | |
| 53347 | - $out->{'Utf8JsonReader'} = $this->toUtf8JSONReader(); | |
| 53348 | - $out->{'Utf8JsonWriter'} = $this->toUtf8JSONWriter(); | |
| 53349 | - $out->{'UUID'} = $this->toUUID(); | |
| 53350 | - $out->{'var'} = $this->toVar(); | |
| 53351 | - $out->{'virtual'} = $this->toVirtual(); | |
| 53352 | - $out->{'void'} = $this->toVoid(); | |
| 53353 | - $out->{'volatile'} = $this->toVolatile(); | |
| 53354 | - $out->{'wchar_t'} = $this->toWcharT(); | |
| 53355 | - $out->{'weak'} = $this->toWeak(); | |
| 53356 | - $out->{'where'} = $this->toWhere(); | |
| 53357 | - $out->{'while'} = $this->toWhile(); | |
| 53358 | - $out->{'willSet'} = $this->toWillSet(); | |
| 53359 | - $out->{'with'} = $this->toWith(); | |
| 53360 | - $out->{'xor'} = $this->toXor(); | |
| 53361 | - $out->{'xor_eq'} = $this->toXorEq(); | |
| 53362 | - $out->{'YES'} = $this->toYes(); | |
| 53363 | - $out->{'yield'} = $this->toYield(); | |
| 53364 | 53623 | return $out; |
| 53365 | 53624 | } |
| 53366 | 53625 | |
| 53367 | 53626 | /** |
| 53368 | 53627 | * @param stdClass $obj |
| 53369 | - * @return Obj6 | |
| 53628 | + * @return Unsigned | |
| 53370 | 53629 | * @throws Exception |
| 53371 | 53630 | */ |
| 53372 | - public static function from(stdClass $obj): Obj6 { | |
| 53373 | - if (!property_exists($obj, 'dummy')) { | |
| 53374 | - throw new Exception("Missing required property"); | |
| 53375 | - } | |
| 53631 | + public static function from(stdClass $obj): Unsigned { | |
| 53376 | 53632 | if (!property_exists($obj, 'unsigned')) { |
| 53377 | 53633 | throw new Exception("Missing required property"); |
| 53378 | 53634 | } |
| 53379 | - if (!property_exists($obj, 'ushort')) { | |
| 53380 | - throw new Exception("Missing required property"); | |
| 53381 | - } | |
| 53382 | - if (!property_exists($obj, 'using')) { | |
| 53383 | - throw new Exception("Missing required property"); | |
| 53384 | - } | |
| 53385 | - if (!property_exists($obj, 'Utf8JsonReader')) { | |
| 53386 | - throw new Exception("Missing required property"); | |
| 53387 | - } | |
| 53388 | - if (!property_exists($obj, 'Utf8JsonWriter')) { | |
| 53389 | - throw new Exception("Missing required property"); | |
| 53390 | - } | |
| 53391 | - if (!property_exists($obj, 'UUID')) { | |
| 53392 | - throw new Exception("Missing required property"); | |
| 53393 | - } | |
| 53394 | - if (!property_exists($obj, 'var')) { | |
| 53395 | - throw new Exception("Missing required property"); | |
| 53396 | - } | |
| 53397 | - if (!property_exists($obj, 'virtual')) { | |
| 53398 | - throw new Exception("Missing required property"); | |
| 53399 | - } | |
| 53400 | - if (!property_exists($obj, 'void')) { | |
| 53401 | - throw new Exception("Missing required property"); | |
| 53402 | - } | |
| 53403 | - if (!property_exists($obj, 'volatile')) { | |
| 53404 | - throw new Exception("Missing required property"); | |
| 53405 | - } | |
| 53406 | - if (!property_exists($obj, 'wchar_t')) { | |
| 53407 | - throw new Exception("Missing required property"); | |
| 53408 | - } | |
| 53409 | - if (!property_exists($obj, 'weak')) { | |
| 53410 | - throw new Exception("Missing required property"); | |
| 53411 | - } | |
| 53412 | - if (!property_exists($obj, 'where')) { | |
| 53413 | - throw new Exception("Missing required property"); | |
| 53414 | - } | |
| 53415 | - if (!property_exists($obj, 'while')) { | |
| 53416 | - throw new Exception("Missing required property"); | |
| 53417 | - } | |
| 53418 | - if (!property_exists($obj, 'willSet')) { | |
| 53419 | - throw new Exception("Missing required property"); | |
| 53420 | - } | |
| 53421 | - if (!property_exists($obj, 'with')) { | |
| 53422 | - throw new Exception("Missing required property"); | |
| 53423 | - } | |
| 53424 | - if (!property_exists($obj, 'xor')) { | |
| 53425 | - throw new Exception("Missing required property"); | |
| 53426 | - } | |
| 53427 | - if (!property_exists($obj, 'xor_eq')) { | |
| 53428 | - throw new Exception("Missing required property"); | |
| 53429 | - } | |
| 53430 | - if (!property_exists($obj, 'YES')) { | |
| 53431 | - throw new Exception("Missing required property"); | |
| 53432 | - } | |
| 53433 | - if (!property_exists($obj, 'yield')) { | |
| 53434 | - throw new Exception("Missing required property"); | |
| 53435 | - } | |
| 53436 | - return new Obj6( | |
| 53437 | - Obj6::fromDummy($obj->{'dummy'}) | |
| 53438 | - ,Obj6::fromUnsigned($obj->{'unsigned'}) | |
| 53439 | - ,Obj6::fromUshort($obj->{'ushort'}) | |
| 53440 | - ,Obj6::fromUsing($obj->{'using'}) | |
| 53441 | - ,Obj6::fromUtf8JSONReader($obj->{'Utf8JsonReader'}) | |
| 53442 | - ,Obj6::fromUtf8JSONWriter($obj->{'Utf8JsonWriter'}) | |
| 53443 | - ,Obj6::fromUUID($obj->{'UUID'}) | |
| 53444 | - ,Obj6::fromVar($obj->{'var'}) | |
| 53445 | - ,Obj6::fromVirtual($obj->{'virtual'}) | |
| 53446 | - ,Obj6::fromVoid($obj->{'void'}) | |
| 53447 | - ,Obj6::fromVolatile($obj->{'volatile'}) | |
| 53448 | - ,Obj6::fromWcharT($obj->{'wchar_t'}) | |
| 53449 | - ,Obj6::fromWeak($obj->{'weak'}) | |
| 53450 | - ,Obj6::fromWhere($obj->{'where'}) | |
| 53451 | - ,Obj6::fromWhile($obj->{'while'}) | |
| 53452 | - ,Obj6::fromWillSet($obj->{'willSet'}) | |
| 53453 | - ,Obj6::fromWith($obj->{'with'}) | |
| 53454 | - ,Obj6::fromXor($obj->{'xor'}) | |
| 53455 | - ,Obj6::fromXorEq($obj->{'xor_eq'}) | |
| 53456 | - ,Obj6::fromYes($obj->{'YES'}) | |
| 53457 | - ,Obj6::fromYield($obj->{'yield'}) | |
| 53635 | + return new Unsigned( | |
| 53636 | + Unsigned::fromUnsigned($obj->{'unsigned'}) | |
| 53458 | 53637 | ); |
| 53459 | 53638 | } |
| 53460 | 53639 | |
| 53461 | 53640 | /** |
| 53462 | - * @return Obj6 | |
| 53641 | + * @return Unsigned | |
| 53463 | 53642 | */ |
| 53464 | - public static function sample(): Obj6 { | |
| 53465 | - return new Obj6( | |
| 53466 | - Obj6::sampleDummy() | |
| 53467 | - ,Obj6::sampleUnsigned() | |
| 53468 | - ,Obj6::sampleUshort() | |
| 53469 | - ,Obj6::sampleUsing() | |
| 53470 | - ,Obj6::sampleUtf8JSONReader() | |
| 53471 | - ,Obj6::sampleUtf8JSONWriter() | |
| 53472 | - ,Obj6::sampleUUID() | |
| 53473 | - ,Obj6::sampleVar() | |
| 53474 | - ,Obj6::sampleVirtual() | |
| 53475 | - ,Obj6::sampleVoid() | |
| 53476 | - ,Obj6::sampleVolatile() | |
| 53477 | - ,Obj6::sampleWcharT() | |
| 53478 | - ,Obj6::sampleWeak() | |
| 53479 | - ,Obj6::sampleWhere() | |
| 53480 | - ,Obj6::sampleWhile() | |
| 53481 | - ,Obj6::sampleWillSet() | |
| 53482 | - ,Obj6::sampleWith() | |
| 53483 | - ,Obj6::sampleXor() | |
| 53484 | - ,Obj6::sampleXorEq() | |
| 53485 | - ,Obj6::sampleYes() | |
| 53486 | - ,Obj6::sampleYield() | |
| 53643 | + public static function sample(): Unsigned { | |
| 53644 | + return new Unsigned( | |
| 53645 | + Unsigned::sampleUnsigned() | |
| 53487 | 53646 | ); |
| 53488 | 53647 | } |
| 53489 | 53648 | } |
| 53490 | 53649 | |
| 53491 | -// This is an autogenerated file:Unsigned | |
| 53650 | +// This is an autogenerated file:UseSerializers | |
| 53492 | 53651 | |
| 53493 | -class Unsigned { | |
| 53494 | - private int $unsigned; // json:unsigned Required | |
| 53652 | +class UseSerializers { | |
| 53653 | + private int $useSerializers; // json:UseSerializers Required | |
| 53495 | 53654 | |
| 53496 | 53655 | /** |
| 53497 | - * @param int $unsigned | |
| 53656 | + * @param int $useSerializers | |
| 53498 | 53657 | */ |
| 53499 | - public function __construct(int $unsigned) { | |
| 53500 | - $this->unsigned = $unsigned; | |
| 53658 | + public function __construct(int $useSerializers) { | |
| 53659 | + $this->useSerializers = $useSerializers; | |
| 53501 | 53660 | } |
| 53502 | 53661 | |
| 53503 | 53662 | /** |
| @@ -53505,7 +53664,7 @@ class Unsigned { | ||
| 53505 | 53664 | * @throws Exception |
| 53506 | 53665 | * @return int |
| 53507 | 53666 | */ |
| 53508 | - public static function fromUnsigned(int $value): int { | |
| 53667 | + public static function fromUseSerializers(int $value): int { | |
| 53509 | 53668 | return $value; /*int*/ |
| 53510 | 53669 | } |
| 53511 | 53670 | |
| @@ -53513,11 +53672,11 @@ class Unsigned { | ||
| 53513 | 53672 | * @throws Exception |
| 53514 | 53673 | * @return int |
| 53515 | 53674 | */ |
| 53516 | - public function toUnsigned(): int { | |
| 53517 | - if (Unsigned::validateUnsigned($this->unsigned)) { | |
| 53518 | - return $this->unsigned; /*int*/ | |
| 53675 | + public function toUseSerializers(): int { | |
| 53676 | + if (UseSerializers::validateUseSerializers($this->useSerializers)) { | |
| 53677 | + return $this->useSerializers; /*int*/ | |
| 53519 | 53678 | } |
| 53520 | - throw new Exception('never get to this Unsigned::unsigned'); | |
| 53679 | + throw new Exception('never get to this UseSerializers::useSerializers'); | |
| 53521 | 53680 | } |
| 53522 | 53681 | |
| 53523 | 53682 | /** |
| @@ -53525,7 +53684,7 @@ class Unsigned { | ||
| 53525 | 53684 | * @return bool |
| 53526 | 53685 | * @throws Exception |
| 53527 | 53686 | */ |
| 53528 | - public static function validateUnsigned(int $value): bool { | |
| 53687 | + public static function validateUseSerializers(int $value): bool { | |
| 53529 | 53688 | return true; |
| 53530 | 53689 | } |
| 53531 | 53690 | |
| @@ -53533,18 +53692,18 @@ class Unsigned { | ||
| 53533 | 53692 | * @throws Exception |
| 53534 | 53693 | * @return int |
| 53535 | 53694 | */ |
| 53536 | - public function getUnsigned(): int { | |
| 53537 | - if (Unsigned::validateUnsigned($this->unsigned)) { | |
| 53538 | - return $this->unsigned; | |
| 53695 | + public function getUseSerializers(): int { | |
| 53696 | + if (UseSerializers::validateUseSerializers($this->useSerializers)) { | |
| 53697 | + return $this->useSerializers; | |
| 53539 | 53698 | } |
| 53540 | - throw new Exception('never get to getUnsigned Unsigned::unsigned'); | |
| 53699 | + throw new Exception('never get to getUseSerializers UseSerializers::useSerializers'); | |
| 53541 | 53700 | } |
| 53542 | 53701 | |
| 53543 | 53702 | /** |
| 53544 | 53703 | * @return int |
| 53545 | 53704 | */ |
| 53546 | - public static function sampleUnsigned(): int { | |
| 53547 | - return 31; /*31:unsigned*/ | |
| 53705 | + public static function sampleUseSerializers(): int { | |
| 53706 | + return 31; /*31:useSerializers*/ | |
| 53548 | 53707 | } |
| 53549 | 53708 | |
| 53550 | 53709 | /** |
| @@ -53552,7 +53711,7 @@ class Unsigned { | ||
| 53552 | 53711 | * @return bool |
| 53553 | 53712 | */ |
| 53554 | 53713 | public function validate(): bool { |
| 53555 | - return Unsigned::validateUnsigned($this->unsigned); | |
| 53714 | + return UseSerializers::validateUseSerializers($this->useSerializers); | |
| 53556 | 53715 | } |
| 53557 | 53716 | |
| 53558 | 53717 | /** |
| @@ -53561,30 +53720,30 @@ class Unsigned { | ||
| 53561 | 53720 | */ |
| 53562 | 53721 | public function to(): stdClass { |
| 53563 | 53722 | $out = new stdClass(); |
| 53564 | - $out->{'unsigned'} = $this->toUnsigned(); | |
| 53723 | + $out->{'UseSerializers'} = $this->toUseSerializers(); | |
| 53565 | 53724 | return $out; |
| 53566 | 53725 | } |
| 53567 | 53726 | |
| 53568 | 53727 | /** |
| 53569 | 53728 | * @param stdClass $obj |
| 53570 | - * @return Unsigned | |
| 53729 | + * @return UseSerializers | |
| 53571 | 53730 | * @throws Exception |
| 53572 | 53731 | */ |
| 53573 | - public static function from(stdClass $obj): Unsigned { | |
| 53574 | - if (!property_exists($obj, 'unsigned')) { | |
| 53732 | + public static function from(stdClass $obj): UseSerializers { | |
| 53733 | + if (!property_exists($obj, 'UseSerializers')) { | |
| 53575 | 53734 | throw new Exception("Missing required property"); |
| 53576 | 53735 | } |
| 53577 | - return new Unsigned( | |
| 53578 | - Unsigned::fromUnsigned($obj->{'unsigned'}) | |
| 53736 | + return new UseSerializers( | |
| 53737 | + UseSerializers::fromUseSerializers($obj->{'UseSerializers'}) | |
| 53579 | 53738 | ); |
| 53580 | 53739 | } |
| 53581 | 53740 | |
| 53582 | 53741 | /** |
| 53583 | - * @return Unsigned | |
| 53742 | + * @return UseSerializers | |
| 53584 | 53743 | */ |
| 53585 | - public static function sample(): Unsigned { | |
| 53586 | - return new Unsigned( | |
| 53587 | - Unsigned::sampleUnsigned() | |
| 53744 | + public static function sample(): UseSerializers { | |
| 53745 | + return new UseSerializers( | |
| 53746 | + UseSerializers::sampleUseSerializers() | |
| 53588 | 53747 | ); |
| 53589 | 53748 | } |
| 53590 | 53749 | } |
Mpikedefault / TopLevel.pmod+200 −175
| @@ -3355,6 +3355,7 @@ class Obj3 { | ||
| 3355 | 3355 | Locale locale; // json: "Locale" |
| 3356 | 3356 | Lock lock; // json: "lock" |
| 3357 | 3357 | Long long; // json: "long" |
| 3358 | + MakeDictEncoder make_dict_encoder; // json: "makeDictEncoder" | |
| 3358 | 3359 | Map map; // json: "map" |
| 3359 | 3360 | MapEntry map_entry; // json: "MapEntry" |
| 3360 | 3361 | MarshalJson marshal_json; // json: "MarshalJSON" |
| @@ -3366,8 +3367,6 @@ class Obj3 { | ||
| 3366 | 3367 | Native native; // json: "native" |
| 3367 | 3368 | New new; // json: "new" |
| 3368 | 3369 | Newtonsoft newtonsoft; // json: "newtonsoft" |
| 3369 | - Nil nil; // json: "nil" | |
| 3370 | - No no; // json: "NO" | |
| 3371 | 3370 | If obj3_if; // json: "if" |
| 3372 | 3371 | Import obj3_import; // json: "import" |
| 3373 | 3372 | Inline obj3_inline; // json: "inline" |
| @@ -3424,6 +3423,7 @@ class Obj3 { | ||
| 3424 | 3423 | "Locale" : locale, |
| 3425 | 3424 | "lock" : lock, |
| 3426 | 3425 | "long" : long, |
| 3426 | + "makeDictEncoder" : make_dict_encoder, | |
| 3427 | 3427 | "map" : map, |
| 3428 | 3428 | "MapEntry" : map_entry, |
| 3429 | 3429 | "MarshalJSON" : marshal_json, |
| @@ -3435,8 +3435,6 @@ class Obj3 { | ||
| 3435 | 3435 | "native" : native, |
| 3436 | 3436 | "new" : new, |
| 3437 | 3437 | "newtonsoft" : newtonsoft, |
| 3438 | - "nil" : nil, | |
| 3439 | - "NO" : no, | |
| 3440 | 3438 | "if" : obj3_if, |
| 3441 | 3439 | "import" : obj3_import, |
| 3442 | 3440 | "inline" : obj3_inline, |
| @@ -3547,6 +3545,8 @@ Obj3 Obj3_from_JSON(mixed json) { | ||
| 3547 | 3545 | retval.lock = json["lock"]; |
| 3548 | 3546 | if (!mappingp(json["long"])) error("Expected object"); |
| 3549 | 3547 | retval.long = json["long"]; |
| 3548 | + if (!mappingp(json["makeDictEncoder"])) error("Expected object"); | |
| 3549 | + retval.make_dict_encoder = json["makeDictEncoder"]; | |
| 3550 | 3550 | if (!mappingp(json["map"])) error("Expected object"); |
| 3551 | 3551 | retval.map = json["map"]; |
| 3552 | 3552 | if (!mappingp(json["MapEntry"])) error("Expected object"); |
| @@ -3569,10 +3569,6 @@ Obj3 Obj3_from_JSON(mixed json) { | ||
| 3569 | 3569 | retval.new = json["new"]; |
| 3570 | 3570 | if (!mappingp(json["newtonsoft"])) error("Expected object"); |
| 3571 | 3571 | retval.newtonsoft = json["newtonsoft"]; |
| 3572 | - if (!mappingp(json["nil"])) error("Expected object"); | |
| 3573 | - retval.nil = json["nil"]; | |
| 3574 | - if (!mappingp(json["NO"])) error("Expected object"); | |
| 3575 | - retval.no = json["NO"]; | |
| 3576 | 3572 | if (!mappingp(json["if"])) error("Expected object"); |
| 3577 | 3573 | retval.obj3_if = json["if"]; |
| 3578 | 3574 | if (!mappingp(json["import"])) error("Expected object"); |
| @@ -4573,6 +4569,27 @@ Long Long_from_JSON(mixed json) { | ||
| 4573 | 4569 | return retval; |
| 4574 | 4570 | } |
| 4575 | 4571 | |
| 4572 | +class MakeDictEncoder { | |
| 4573 | + int make_dict_encoder; // json: "makeDictEncoder" | |
| 4574 | + | |
| 4575 | + string encode_json() { | |
| 4576 | + mapping(string:mixed) json = ([ | |
| 4577 | + "makeDictEncoder" : make_dict_encoder, | |
| 4578 | + ]); | |
| 4579 | + | |
| 4580 | + return Standards.JSON.encode(json); | |
| 4581 | + } | |
| 4582 | +} | |
| 4583 | + | |
| 4584 | +MakeDictEncoder MakeDictEncoder_from_JSON(mixed json) { | |
| 4585 | + MakeDictEncoder retval = MakeDictEncoder(); | |
| 4586 | + | |
| 4587 | + if (!intp(json["makeDictEncoder"])) error("Expected integer"); | |
| 4588 | + retval.make_dict_encoder = json["makeDictEncoder"]; | |
| 4589 | + | |
| 4590 | + return retval; | |
| 4591 | +} | |
| 4592 | + | |
| 4576 | 4593 | class Map { |
| 4577 | 4594 | int map; // json: "map" |
| 4578 | 4595 | |
| @@ -4804,48 +4821,6 @@ Newtonsoft Newtonsoft_from_JSON(mixed json) { | ||
| 4804 | 4821 | return retval; |
| 4805 | 4822 | } |
| 4806 | 4823 | |
| 4807 | -class Nil { | |
| 4808 | - int nil; // json: "nil" | |
| 4809 | - | |
| 4810 | - string encode_json() { | |
| 4811 | - mapping(string:mixed) json = ([ | |
| 4812 | - "nil" : nil, | |
| 4813 | - ]); | |
| 4814 | - | |
| 4815 | - return Standards.JSON.encode(json); | |
| 4816 | - } | |
| 4817 | -} | |
| 4818 | - | |
| 4819 | -Nil Nil_from_JSON(mixed json) { | |
| 4820 | - Nil retval = Nil(); | |
| 4821 | - | |
| 4822 | - if (!intp(json["nil"])) error("Expected integer"); | |
| 4823 | - retval.nil = json["nil"]; | |
| 4824 | - | |
| 4825 | - return retval; | |
| 4826 | -} | |
| 4827 | - | |
| 4828 | -class No { | |
| 4829 | - int no; // json: "NO" | |
| 4830 | - | |
| 4831 | - string encode_json() { | |
| 4832 | - mapping(string:mixed) json = ([ | |
| 4833 | - "NO" : no, | |
| 4834 | - ]); | |
| 4835 | - | |
| 4836 | - return Standards.JSON.encode(json); | |
| 4837 | - } | |
| 4838 | -} | |
| 4839 | - | |
| 4840 | -No No_from_JSON(mixed json) { | |
| 4841 | - No retval = No(); | |
| 4842 | - | |
| 4843 | - if (!intp(json["NO"])) error("Expected integer"); | |
| 4844 | - retval.no = json["NO"]; | |
| 4845 | - | |
| 4846 | - return retval; | |
| 4847 | -} | |
| 4848 | - | |
| 4849 | 4824 | class If { |
| 4850 | 4825 | int if_if; // json: "if" |
| 4851 | 4826 | |
| @@ -4953,6 +4928,8 @@ Lambda Lambda_from_JSON(mixed json) { | ||
| 4953 | 4928 | |
| 4954 | 4929 | class Obj4 { |
| 4955 | 4930 | int dummy; // json: "dummy" |
| 4931 | + Nil nil; // json: "nil" | |
| 4932 | + No no; // json: "NO" | |
| 4956 | 4933 | NoSuchMethod no_such_method; // json: "noSuchMethod" |
| 4957 | 4934 | Noexcept noexcept; // json: "noexcept" |
| 4958 | 4935 | Nonatomic nonatomic; // json: "nonatomic" |
| @@ -5015,12 +4992,12 @@ class Obj4 { | ||
| 5015 | 4992 | RuntimeType runtime_type; // json: "runtimeType" |
| 5016 | 4993 | S s; // json: "s" |
| 5017 | 4994 | Sbyte sbyte; // json: "sbyte" |
| 5018 | - Sealed sealed; // json: "sealed" | |
| 5019 | - Sel sel; // json: "SEL" | |
| 5020 | 4995 | |
| 5021 | 4996 | string encode_json() { |
| 5022 | 4997 | mapping(string:mixed) json = ([ |
| 5023 | 4998 | "dummy" : dummy, |
| 4999 | + "nil" : nil, | |
| 5000 | + "NO" : no, | |
| 5024 | 5001 | "noSuchMethod" : no_such_method, |
| 5025 | 5002 | "noexcept" : noexcept, |
| 5026 | 5003 | "nonatomic" : nonatomic, |
| @@ -5083,8 +5060,6 @@ class Obj4 { | ||
| 5083 | 5060 | "runtimeType" : runtime_type, |
| 5084 | 5061 | "s" : s, |
| 5085 | 5062 | "sbyte" : sbyte, |
| 5086 | - "sealed" : sealed, | |
| 5087 | - "SEL" : sel, | |
| 5088 | 5063 | ]); |
| 5089 | 5064 | |
| 5090 | 5065 | return Standards.JSON.encode(json); |
| @@ -5096,6 +5071,10 @@ Obj4 Obj4_from_JSON(mixed json) { | ||
| 5096 | 5071 | |
| 5097 | 5072 | if (!intp(json["dummy"])) error("Expected integer"); |
| 5098 | 5073 | retval.dummy = json["dummy"]; |
| 5074 | + if (!mappingp(json["nil"])) error("Expected object"); | |
| 5075 | + retval.nil = json["nil"]; | |
| 5076 | + if (!mappingp(json["NO"])) error("Expected object"); | |
| 5077 | + retval.no = json["NO"]; | |
| 5099 | 5078 | if (!mappingp(json["noSuchMethod"])) error("Expected object"); |
| 5100 | 5079 | retval.no_such_method = json["noSuchMethod"]; |
| 5101 | 5080 | if (!mappingp(json["noexcept"])) error("Expected object"); |
| @@ -5220,10 +5199,48 @@ Obj4 Obj4_from_JSON(mixed json) { | ||
| 5220 | 5199 | retval.s = json["s"]; |
| 5221 | 5200 | if (!mappingp(json["sbyte"])) error("Expected object"); |
| 5222 | 5201 | retval.sbyte = json["sbyte"]; |
| 5223 | - if (!mappingp(json["sealed"])) error("Expected object"); | |
| 5224 | - retval.sealed = json["sealed"]; | |
| 5225 | - if (!mappingp(json["SEL"])) error("Expected object"); | |
| 5226 | - retval.sel = json["SEL"]; | |
| 5202 | + | |
| 5203 | + return retval; | |
| 5204 | +} | |
| 5205 | + | |
| 5206 | +class Nil { | |
| 5207 | + int nil; // json: "nil" | |
| 5208 | + | |
| 5209 | + string encode_json() { | |
| 5210 | + mapping(string:mixed) json = ([ | |
| 5211 | + "nil" : nil, | |
| 5212 | + ]); | |
| 5213 | + | |
| 5214 | + return Standards.JSON.encode(json); | |
| 5215 | + } | |
| 5216 | +} | |
| 5217 | + | |
| 5218 | +Nil Nil_from_JSON(mixed json) { | |
| 5219 | + Nil retval = Nil(); | |
| 5220 | + | |
| 5221 | + if (!intp(json["nil"])) error("Expected integer"); | |
| 5222 | + retval.nil = json["nil"]; | |
| 5223 | + | |
| 5224 | + return retval; | |
| 5225 | +} | |
| 5226 | + | |
| 5227 | +class No { | |
| 5228 | + int no; // json: "NO" | |
| 5229 | + | |
| 5230 | + string encode_json() { | |
| 5231 | + mapping(string:mixed) json = ([ | |
| 5232 | + "NO" : no, | |
| 5233 | + ]); | |
| 5234 | + | |
| 5235 | + return Standards.JSON.encode(json); | |
| 5236 | + } | |
| 5237 | +} | |
| 5238 | + | |
| 5239 | +No No_from_JSON(mixed json) { | |
| 5240 | + No retval = No(); | |
| 5241 | + | |
| 5242 | + if (!intp(json["NO"])) error("Expected integer"); | |
| 5243 | + retval.no = json["NO"]; | |
| 5227 | 5244 | |
| 5228 | 5245 | return retval; |
| 5229 | 5246 | } |
| @@ -6529,48 +6546,6 @@ Sbyte Sbyte_from_JSON(mixed json) { | ||
| 6529 | 6546 | return retval; |
| 6530 | 6547 | } |
| 6531 | 6548 | |
| 6532 | -class Sealed { | |
| 6533 | - int sealed; // json: "sealed" | |
| 6534 | - | |
| 6535 | - string encode_json() { | |
| 6536 | - mapping(string:mixed) json = ([ | |
| 6537 | - "sealed" : sealed, | |
| 6538 | - ]); | |
| 6539 | - | |
| 6540 | - return Standards.JSON.encode(json); | |
| 6541 | - } | |
| 6542 | -} | |
| 6543 | - | |
| 6544 | -Sealed Sealed_from_JSON(mixed json) { | |
| 6545 | - Sealed retval = Sealed(); | |
| 6546 | - | |
| 6547 | - if (!intp(json["sealed"])) error("Expected integer"); | |
| 6548 | - retval.sealed = json["sealed"]; | |
| 6549 | - | |
| 6550 | - return retval; | |
| 6551 | -} | |
| 6552 | - | |
| 6553 | -class Sel { | |
| 6554 | - int sel; // json: "SEL" | |
| 6555 | - | |
| 6556 | - string encode_json() { | |
| 6557 | - mapping(string:mixed) json = ([ | |
| 6558 | - "SEL" : sel, | |
| 6559 | - ]); | |
| 6560 | - | |
| 6561 | - return Standards.JSON.encode(json); | |
| 6562 | - } | |
| 6563 | -} | |
| 6564 | - | |
| 6565 | -Sel Sel_from_JSON(mixed json) { | |
| 6566 | - Sel retval = Sel(); | |
| 6567 | - | |
| 6568 | - if (!intp(json["SEL"])) error("Expected integer"); | |
| 6569 | - retval.sel = json["SEL"]; | |
| 6570 | - | |
| 6571 | - return retval; | |
| 6572 | -} | |
| 6573 | - | |
| 6574 | 6549 | class Obj5 { |
| 6575 | 6550 | int dummy; // json: "dummy" |
| 6576 | 6551 | KSerializer k_serializer; // json: "KSerializer" |
| @@ -6583,6 +6558,8 @@ class Obj5 { | ||
| 6583 | 6558 | Typedef obj5_typedef; // json: "typedef" |
| 6584 | 6559 | Typeof obj5_typeof; // json: "typeof" |
| 6585 | 6560 | PrimitiveKind primitive_kind; // json: "PrimitiveKind" |
| 6561 | + Sealed sealed; // json: "sealed" | |
| 6562 | + Sel sel; // json: "SEL" | |
| 6586 | 6563 | Select select; // json: "select" |
| 6587 | 6564 | Self self; // json: "Self" |
| 6588 | 6565 | Sendable sendable; // json: "Sendable" |
| @@ -6635,9 +6612,6 @@ class Obj5 { | ||
| 6635 | 6612 | Undefined undefined; // json: "undefined" |
| 6636 | 6613 | Union union; // json: "union" |
| 6637 | 6614 | UnmarshalJson unmarshal_json; // json: "UnmarshalJSON" |
| 6638 | - Unowned unowned; // json: "unowned" | |
| 6639 | - Unsafe unsafe; // json: "unsafe" | |
| 6640 | - UseSerializers use_serializers; // json: "UseSerializers" | |
| 6641 | 6615 | |
| 6642 | 6616 | string encode_json() { |
| 6643 | 6617 | mapping(string:mixed) json = ([ |
| @@ -6652,6 +6626,8 @@ class Obj5 { | ||
| 6652 | 6626 | "typedef" : obj5_typedef, |
| 6653 | 6627 | "typeof" : obj5_typeof, |
| 6654 | 6628 | "PrimitiveKind" : primitive_kind, |
| 6629 | + "sealed" : sealed, | |
| 6630 | + "SEL" : sel, | |
| 6655 | 6631 | "select" : select, |
| 6656 | 6632 | "Self" : self, |
| 6657 | 6633 | "Sendable" : sendable, |
| @@ -6704,9 +6680,6 @@ class Obj5 { | ||
| 6704 | 6680 | "undefined" : undefined, |
| 6705 | 6681 | "union" : union, |
| 6706 | 6682 | "UnmarshalJSON" : unmarshal_json, |
| 6707 | - "unowned" : unowned, | |
| 6708 | - "unsafe" : unsafe, | |
| 6709 | - "UseSerializers" : use_serializers, | |
| 6710 | 6683 | ]); |
| 6711 | 6684 | |
| 6712 | 6685 | return Standards.JSON.encode(json); |
| @@ -6738,6 +6711,10 @@ Obj5 Obj5_from_JSON(mixed json) { | ||
| 6738 | 6711 | retval.obj5_typeof = json["typeof"]; |
| 6739 | 6712 | if (!mappingp(json["PrimitiveKind"])) error("Expected object"); |
| 6740 | 6713 | retval.primitive_kind = json["PrimitiveKind"]; |
| 6714 | + if (!mappingp(json["sealed"])) error("Expected object"); | |
| 6715 | + retval.sealed = json["sealed"]; | |
| 6716 | + if (!mappingp(json["SEL"])) error("Expected object"); | |
| 6717 | + retval.sel = json["SEL"]; | |
| 6741 | 6718 | if (!mappingp(json["select"])) error("Expected object"); |
| 6742 | 6719 | retval.select = json["select"]; |
| 6743 | 6720 | if (!mappingp(json["Self"])) error("Expected object"); |
| @@ -6842,12 +6819,6 @@ Obj5 Obj5_from_JSON(mixed json) { | ||
| 6842 | 6819 | retval.union = json["union"]; |
| 6843 | 6820 | if (!mappingp(json["UnmarshalJSON"])) error("Expected object"); |
| 6844 | 6821 | retval.unmarshal_json = json["UnmarshalJSON"]; |
| 6845 | - if (!mappingp(json["unowned"])) error("Expected object"); | |
| 6846 | - retval.unowned = json["unowned"]; | |
| 6847 | - if (!mappingp(json["unsafe"])) error("Expected object"); | |
| 6848 | - retval.unsafe = json["unsafe"]; | |
| 6849 | - if (!mappingp(json["UseSerializers"])) error("Expected object"); | |
| 6850 | - retval.use_serializers = json["UseSerializers"]; | |
| 6851 | 6822 | |
| 6852 | 6823 | return retval; |
| 6853 | 6824 | } |
| @@ -7062,6 +7033,48 @@ PrimitiveKind PrimitiveKind_from_JSON(mixed json) { | ||
| 7062 | 7033 | return retval; |
| 7063 | 7034 | } |
| 7064 | 7035 | |
| 7036 | +class Sealed { | |
| 7037 | + int sealed; // json: "sealed" | |
| 7038 | + | |
| 7039 | + string encode_json() { | |
| 7040 | + mapping(string:mixed) json = ([ | |
| 7041 | + "sealed" : sealed, | |
| 7042 | + ]); | |
| 7043 | + | |
| 7044 | + return Standards.JSON.encode(json); | |
| 7045 | + } | |
| 7046 | +} | |
| 7047 | + | |
| 7048 | +Sealed Sealed_from_JSON(mixed json) { | |
| 7049 | + Sealed retval = Sealed(); | |
| 7050 | + | |
| 7051 | + if (!intp(json["sealed"])) error("Expected integer"); | |
| 7052 | + retval.sealed = json["sealed"]; | |
| 7053 | + | |
| 7054 | + return retval; | |
| 7055 | +} | |
| 7056 | + | |
| 7057 | +class Sel { | |
| 7058 | + int sel; // json: "SEL" | |
| 7059 | + | |
| 7060 | + string encode_json() { | |
| 7061 | + mapping(string:mixed) json = ([ | |
| 7062 | + "SEL" : sel, | |
| 7063 | + ]); | |
| 7064 | + | |
| 7065 | + return Standards.JSON.encode(json); | |
| 7066 | + } | |
| 7067 | +} | |
| 7068 | + | |
| 7069 | +Sel Sel_from_JSON(mixed json) { | |
| 7070 | + Sel retval = Sel(); | |
| 7071 | + | |
| 7072 | + if (!intp(json["SEL"])) error("Expected integer"); | |
| 7073 | + retval.sel = json["SEL"]; | |
| 7074 | + | |
| 7075 | + return retval; | |
| 7076 | +} | |
| 7077 | + | |
| 7065 | 7078 | class Select { |
| 7066 | 7079 | int select; // json: "select" |
| 7067 | 7080 | |
| @@ -8154,74 +8167,14 @@ UnmarshalJson UnmarshalJson_from_JSON(mixed json) { | ||
| 8154 | 8167 | return retval; |
| 8155 | 8168 | } |
| 8156 | 8169 | |
| 8157 | -class Unowned { | |
| 8158 | - int unowned; // json: "unowned" | |
| 8159 | - | |
| 8160 | - string encode_json() { | |
| 8161 | - mapping(string:mixed) json = ([ | |
| 8162 | - "unowned" : unowned, | |
| 8163 | - ]); | |
| 8164 | - | |
| 8165 | - return Standards.JSON.encode(json); | |
| 8166 | - } | |
| 8167 | -} | |
| 8168 | - | |
| 8169 | -Unowned Unowned_from_JSON(mixed json) { | |
| 8170 | - Unowned retval = Unowned(); | |
| 8171 | - | |
| 8172 | - if (!intp(json["unowned"])) error("Expected integer"); | |
| 8173 | - retval.unowned = json["unowned"]; | |
| 8174 | - | |
| 8175 | - return retval; | |
| 8176 | -} | |
| 8177 | - | |
| 8178 | -class Unsafe { | |
| 8179 | - int unsafe; // json: "unsafe" | |
| 8180 | - | |
| 8181 | - string encode_json() { | |
| 8182 | - mapping(string:mixed) json = ([ | |
| 8183 | - "unsafe" : unsafe, | |
| 8184 | - ]); | |
| 8185 | - | |
| 8186 | - return Standards.JSON.encode(json); | |
| 8187 | - } | |
| 8188 | -} | |
| 8189 | - | |
| 8190 | -Unsafe Unsafe_from_JSON(mixed json) { | |
| 8191 | - Unsafe retval = Unsafe(); | |
| 8192 | - | |
| 8193 | - if (!intp(json["unsafe"])) error("Expected integer"); | |
| 8194 | - retval.unsafe = json["unsafe"]; | |
| 8195 | - | |
| 8196 | - return retval; | |
| 8197 | -} | |
| 8198 | - | |
| 8199 | -class UseSerializers { | |
| 8200 | - int use_serializers; // json: "UseSerializers" | |
| 8201 | - | |
| 8202 | - string encode_json() { | |
| 8203 | - mapping(string:mixed) json = ([ | |
| 8204 | - "UseSerializers" : use_serializers, | |
| 8205 | - ]); | |
| 8206 | - | |
| 8207 | - return Standards.JSON.encode(json); | |
| 8208 | - } | |
| 8209 | -} | |
| 8210 | - | |
| 8211 | -UseSerializers UseSerializers_from_JSON(mixed json) { | |
| 8212 | - UseSerializers retval = UseSerializers(); | |
| 8213 | - | |
| 8214 | - if (!intp(json["UseSerializers"])) error("Expected integer"); | |
| 8215 | - retval.use_serializers = json["UseSerializers"]; | |
| 8216 | - | |
| 8217 | - return retval; | |
| 8218 | -} | |
| 8219 | - | |
| 8220 | 8170 | class Obj6 { |
| 8221 | 8171 | int dummy; // json: "dummy" |
| 8222 | 8172 | Void obj6_void; // json: "void" |
| 8223 | 8173 | While obj6_while; // json: "while" |
| 8174 | + Unowned unowned; // json: "unowned" | |
| 8175 | + Unsafe unsafe; // json: "unsafe" | |
| 8224 | 8176 | Unsigned unsigned; // json: "unsigned" |
| 8177 | + UseSerializers use_serializers; // json: "UseSerializers" | |
| 8225 | 8178 | Ushort ushort; // json: "ushort" |
| 8226 | 8179 | Using using; // json: "using" |
| 8227 | 8180 | Utf8JsonReader utf8_json_reader; // json: "Utf8JsonReader" |
| @@ -8245,7 +8198,10 @@ class Obj6 { | ||
| 8245 | 8198 | "dummy" : dummy, |
| 8246 | 8199 | "void" : obj6_void, |
| 8247 | 8200 | "while" : obj6_while, |
| 8201 | + "unowned" : unowned, | |
| 8202 | + "unsafe" : unsafe, | |
| 8248 | 8203 | "unsigned" : unsigned, |
| 8204 | + "UseSerializers" : use_serializers, | |
| 8249 | 8205 | "ushort" : ushort, |
| 8250 | 8206 | "using" : using, |
| 8251 | 8207 | "Utf8JsonReader" : utf8_json_reader, |
| @@ -8278,8 +8234,14 @@ Obj6 Obj6_from_JSON(mixed json) { | ||
| 8278 | 8234 | retval.obj6_void = json["void"]; |
| 8279 | 8235 | if (!mappingp(json["while"])) error("Expected object"); |
| 8280 | 8236 | retval.obj6_while = json["while"]; |
| 8237 | + if (!mappingp(json["unowned"])) error("Expected object"); | |
| 8238 | + retval.unowned = json["unowned"]; | |
| 8239 | + if (!mappingp(json["unsafe"])) error("Expected object"); | |
| 8240 | + retval.unsafe = json["unsafe"]; | |
| 8281 | 8241 | if (!mappingp(json["unsigned"])) error("Expected object"); |
| 8282 | 8242 | retval.unsigned = json["unsigned"]; |
| 8243 | + if (!mappingp(json["UseSerializers"])) error("Expected object"); | |
| 8244 | + retval.use_serializers = json["UseSerializers"]; | |
| 8283 | 8245 | if (!mappingp(json["ushort"])) error("Expected object"); |
| 8284 | 8246 | retval.ushort = json["ushort"]; |
| 8285 | 8247 | if (!mappingp(json["using"])) error("Expected object"); |
| @@ -8360,6 +8322,48 @@ While While_from_JSON(mixed json) { | ||
| 8360 | 8322 | return retval; |
| 8361 | 8323 | } |
| 8362 | 8324 | |
| 8325 | +class Unowned { | |
| 8326 | + int unowned; // json: "unowned" | |
| 8327 | + | |
| 8328 | + string encode_json() { | |
| 8329 | + mapping(string:mixed) json = ([ | |
| 8330 | + "unowned" : unowned, | |
| 8331 | + ]); | |
| 8332 | + | |
| 8333 | + return Standards.JSON.encode(json); | |
| 8334 | + } | |
| 8335 | +} | |
| 8336 | + | |
| 8337 | +Unowned Unowned_from_JSON(mixed json) { | |
| 8338 | + Unowned retval = Unowned(); | |
| 8339 | + | |
| 8340 | + if (!intp(json["unowned"])) error("Expected integer"); | |
| 8341 | + retval.unowned = json["unowned"]; | |
| 8342 | + | |
| 8343 | + return retval; | |
| 8344 | +} | |
| 8345 | + | |
| 8346 | +class Unsafe { | |
| 8347 | + int unsafe; // json: "unsafe" | |
| 8348 | + | |
| 8349 | + string encode_json() { | |
| 8350 | + mapping(string:mixed) json = ([ | |
| 8351 | + "unsafe" : unsafe, | |
| 8352 | + ]); | |
| 8353 | + | |
| 8354 | + return Standards.JSON.encode(json); | |
| 8355 | + } | |
| 8356 | +} | |
| 8357 | + | |
| 8358 | +Unsafe Unsafe_from_JSON(mixed json) { | |
| 8359 | + Unsafe retval = Unsafe(); | |
| 8360 | + | |
| 8361 | + if (!intp(json["unsafe"])) error("Expected integer"); | |
| 8362 | + retval.unsafe = json["unsafe"]; | |
| 8363 | + | |
| 8364 | + return retval; | |
| 8365 | +} | |
| 8366 | + | |
| 8363 | 8367 | class Unsigned { |
| 8364 | 8368 | int unsigned; // json: "unsigned" |
| 8365 | 8369 | |
| @@ -8381,6 +8385,27 @@ Unsigned Unsigned_from_JSON(mixed json) { | ||
| 8381 | 8385 | return retval; |
| 8382 | 8386 | } |
| 8383 | 8387 | |
| 8388 | +class UseSerializers { | |
| 8389 | + int use_serializers; // json: "UseSerializers" | |
| 8390 | + | |
| 8391 | + string encode_json() { | |
| 8392 | + mapping(string:mixed) json = ([ | |
| 8393 | + "UseSerializers" : use_serializers, | |
| 8394 | + ]); | |
| 8395 | + | |
| 8396 | + return Standards.JSON.encode(json); | |
| 8397 | + } | |
| 8398 | +} | |
| 8399 | + | |
| 8400 | +UseSerializers UseSerializers_from_JSON(mixed json) { | |
| 8401 | + UseSerializers retval = UseSerializers(); | |
| 8402 | + | |
| 8403 | + if (!intp(json["UseSerializers"])) error("Expected integer"); | |
| 8404 | + retval.use_serializers = json["UseSerializers"]; | |
| 8405 | + | |
| 8406 | + return retval; | |
| 8407 | +} | |
| 8408 | + | |
| 8384 | 8409 | class Ushort { |
| 8385 | 8410 | int ushort; // json: "ushort" |
Mpythondefault / quicktype.py+156 −137
| @@ -3244,6 +3244,22 @@ class Long: | ||
| 3244 | 3244 | return result |
| 3245 | 3245 | |
| 3246 | 3246 | |
| 3247 | +@dataclass | |
| 3248 | +class MakeDictEncoder: | |
| 3249 | + make_dict_encoder: int | |
| 3250 | + | |
| 3251 | + @staticmethod | |
| 3252 | + def from_dict(obj: Any) -> 'MakeDictEncoder': | |
| 3253 | + assert isinstance(obj, dict) | |
| 3254 | + make_dict_encoder = from_int(obj["makeDictEncoder"]) | |
| 3255 | + return MakeDictEncoder(make_dict_encoder) | |
| 3256 | + | |
| 3257 | + def to_dict(self) -> dict: | |
| 3258 | + result: dict = {} | |
| 3259 | + result["makeDictEncoder"] = from_int(self.make_dict_encoder) | |
| 3260 | + return result | |
| 3261 | + | |
| 3262 | + | |
| 3247 | 3263 | @dataclass |
| 3248 | 3264 | class Map: |
| 3249 | 3265 | map: int |
| @@ -3420,38 +3436,6 @@ class Newtonsoft: | ||
| 3420 | 3436 | return result |
| 3421 | 3437 | |
| 3422 | 3438 | |
| 3423 | -@dataclass | |
| 3424 | -class Nil: | |
| 3425 | - nil: int | |
| 3426 | - | |
| 3427 | - @staticmethod | |
| 3428 | - def from_dict(obj: Any) -> 'Nil': | |
| 3429 | - assert isinstance(obj, dict) | |
| 3430 | - nil = from_int(obj["nil"]) | |
| 3431 | - return Nil(nil) | |
| 3432 | - | |
| 3433 | - def to_dict(self) -> dict: | |
| 3434 | - result: dict = {} | |
| 3435 | - result["nil"] = from_int(self.nil) | |
| 3436 | - return result | |
| 3437 | - | |
| 3438 | - | |
| 3439 | -@dataclass | |
| 3440 | -class No: | |
| 3441 | - no: int | |
| 3442 | - | |
| 3443 | - @staticmethod | |
| 3444 | - def from_dict(obj: Any) -> 'No': | |
| 3445 | - assert isinstance(obj, dict) | |
| 3446 | - no = from_int(obj["NO"]) | |
| 3447 | - return No(no) | |
| 3448 | - | |
| 3449 | - def to_dict(self) -> dict: | |
| 3450 | - result: dict = {} | |
| 3451 | - result["NO"] = from_int(self.no) | |
| 3452 | - return result | |
| 3453 | - | |
| 3454 | - | |
| 3455 | 3439 | @dataclass |
| 3456 | 3440 | class If: |
| 3457 | 3441 | if_if: int |
| @@ -3568,7 +3552,6 @@ class Obj3: | ||
| 3568 | 3552 | locale: Locale |
| 3569 | 3553 | map_entry: MapEntry |
| 3570 | 3554 | marshal_json: MarshalJSON |
| 3571 | - no: No | |
| 3572 | 3555 | dummy: int |
| 3573 | 3556 | goto: Goto |
| 3574 | 3557 | guard: Guard |
| @@ -3606,6 +3589,7 @@ class Obj3: | ||
| 3606 | 3589 | list: ListClass |
| 3607 | 3590 | lock: Lock |
| 3608 | 3591 | long: Long |
| 3592 | + make_dict_encoder: MakeDictEncoder | |
| 3609 | 3593 | map: Map |
| 3610 | 3594 | metadata_property_handling: MetadataPropertyHandling |
| 3611 | 3595 | module: Module |
| @@ -3615,7 +3599,6 @@ class Obj3: | ||
| 3615 | 3599 | native: Native |
| 3616 | 3600 | new: New |
| 3617 | 3601 | newtonsoft: Newtonsoft |
| 3618 | - nil: Nil | |
| 3619 | 3602 | |
| 3620 | 3603 | @staticmethod |
| 3621 | 3604 | def from_dict(obj: Any) -> 'Obj3': |
| @@ -3638,7 +3621,6 @@ class Obj3: | ||
| 3638 | 3621 | locale = Locale.from_dict(obj["Locale"]) |
| 3639 | 3622 | map_entry = MapEntry.from_dict(obj["MapEntry"]) |
| 3640 | 3623 | marshal_json = MarshalJSON.from_dict(obj["MarshalJSON"]) |
| 3641 | - no = No.from_dict(obj["NO"]) | |
| 3642 | 3624 | dummy = from_int(obj["dummy"]) |
| 3643 | 3625 | goto = Goto.from_dict(obj["goto"]) |
| 3644 | 3626 | guard = Guard.from_dict(obj["guard"]) |
| @@ -3676,6 +3658,7 @@ class Obj3: | ||
| 3676 | 3658 | list = ListClass.from_dict(obj["list"]) |
| 3677 | 3659 | lock = Lock.from_dict(obj["lock"]) |
| 3678 | 3660 | long = Long.from_dict(obj["long"]) |
| 3661 | + make_dict_encoder = MakeDictEncoder.from_dict(obj["makeDictEncoder"]) | |
| 3679 | 3662 | map = Map.from_dict(obj["map"]) |
| 3680 | 3663 | metadata_property_handling = MetadataPropertyHandling.from_dict(obj["metadata_property_handling"]) |
| 3681 | 3664 | module = Module.from_dict(obj["module"]) |
| @@ -3685,8 +3668,7 @@ class Obj3: | ||
| 3685 | 3668 | native = Native.from_dict(obj["native"]) |
| 3686 | 3669 | new = New.from_dict(obj["new"]) |
| 3687 | 3670 | newtonsoft = Newtonsoft.from_dict(obj["newtonsoft"]) |
| 3688 | - nil = Nil.from_dict(obj["nil"]) | |
| 3689 | - return Obj3(hashable, hasher, imp, iso_date_time_offset_converter, json_any, json_coding_key, json_decoder, json_encoder, json_null, json_exception, json_generator, json_node, json_parser, json_reader, json_token_type, locale, map_entry, marshal_json, no, dummy, goto, guard, has_own_property, hash_code, id, obj3_if, implements, implicit, obj3_import, obj3_in, indirect, infix, init, inline, inout, instanceof, obj3_int, interface, internal, obj3_is, iterable, jdec, jenc, jpipe, json, json_converter, json_serializer, json_token, json_writer, obj3_lambda, lazy, left, let, list, lock, long, map, metadata_property_handling, module, mutable, mutating, namespace, native, new, newtonsoft, nil) | |
| 3671 | + return Obj3(hashable, hasher, imp, iso_date_time_offset_converter, json_any, json_coding_key, json_decoder, json_encoder, json_null, json_exception, json_generator, json_node, json_parser, json_reader, json_token_type, locale, map_entry, marshal_json, dummy, goto, guard, has_own_property, hash_code, id, obj3_if, implements, implicit, obj3_import, obj3_in, indirect, infix, init, inline, inout, instanceof, obj3_int, interface, internal, obj3_is, iterable, jdec, jenc, jpipe, json, json_converter, json_serializer, json_token, json_writer, obj3_lambda, lazy, left, let, list, lock, long, make_dict_encoder, map, metadata_property_handling, module, mutable, mutating, namespace, native, new, newtonsoft) | |
| 3690 | 3672 | |
| 3691 | 3673 | def to_dict(self) -> dict: |
| 3692 | 3674 | result: dict = {} |
| @@ -3708,7 +3690,6 @@ class Obj3: | ||
| 3708 | 3690 | result["Locale"] = to_class(Locale, self.locale) |
| 3709 | 3691 | result["MapEntry"] = to_class(MapEntry, self.map_entry) |
| 3710 | 3692 | result["MarshalJSON"] = to_class(MarshalJSON, self.marshal_json) |
| 3711 | - result["NO"] = to_class(No, self.no) | |
| 3712 | 3693 | result["dummy"] = from_int(self.dummy) |
| 3713 | 3694 | result["goto"] = to_class(Goto, self.goto) |
| 3714 | 3695 | result["guard"] = to_class(Guard, self.guard) |
| @@ -3746,6 +3727,7 @@ class Obj3: | ||
| 3746 | 3727 | result["list"] = to_class(ListClass, self.list) |
| 3747 | 3728 | result["lock"] = to_class(Lock, self.lock) |
| 3748 | 3729 | result["long"] = to_class(Long, self.long) |
| 3730 | + result["makeDictEncoder"] = to_class(MakeDictEncoder, self.make_dict_encoder) | |
| 3749 | 3731 | result["map"] = to_class(Map, self.map) |
| 3750 | 3732 | result["metadata_property_handling"] = to_class(MetadataPropertyHandling, self.metadata_property_handling) |
| 3751 | 3733 | result["module"] = to_class(Module, self.module) |
| @@ -3755,7 +3737,38 @@ class Obj3: | ||
| 3755 | 3737 | result["native"] = to_class(Native, self.native) |
| 3756 | 3738 | result["new"] = to_class(New, self.new) |
| 3757 | 3739 | result["newtonsoft"] = to_class(Newtonsoft, self.newtonsoft) |
| 3758 | - result["nil"] = to_class(Nil, self.nil) | |
| 3740 | + return result | |
| 3741 | + | |
| 3742 | + | |
| 3743 | +@dataclass | |
| 3744 | +class Nil: | |
| 3745 | + nil: int | |
| 3746 | + | |
| 3747 | + @staticmethod | |
| 3748 | + def from_dict(obj: Any) -> 'Nil': | |
| 3749 | + assert isinstance(obj, dict) | |
| 3750 | + nil = from_int(obj["nil"]) | |
| 3751 | + return Nil(nil) | |
| 3752 | + | |
| 3753 | + def to_dict(self) -> dict: | |
| 3754 | + result: dict = {} | |
| 3755 | + result["nil"] = from_int(self.nil) | |
| 3756 | + return result | |
| 3757 | + | |
| 3758 | + | |
| 3759 | +@dataclass | |
| 3760 | +class No: | |
| 3761 | + no: int | |
| 3762 | + | |
| 3763 | + @staticmethod | |
| 3764 | + def from_dict(obj: Any) -> 'No': | |
| 3765 | + assert isinstance(obj, dict) | |
| 3766 | + no = from_int(obj["NO"]) | |
| 3767 | + return No(no) | |
| 3768 | + | |
| 3769 | + def to_dict(self) -> dict: | |
| 3770 | + result: dict = {} | |
| 3771 | + result["NO"] = from_int(self.no) | |
| 3759 | 3772 | return result |
| 3760 | 3773 | |
| 3761 | 3774 | |
| @@ -4751,40 +4764,9 @@ class Sbyte: | ||
| 4751 | 4764 | return result |
| 4752 | 4765 | |
| 4753 | 4766 | |
| 4754 | -@dataclass | |
| 4755 | -class Sealed: | |
| 4756 | - sealed: int | |
| 4757 | - | |
| 4758 | - @staticmethod | |
| 4759 | - def from_dict(obj: Any) -> 'Sealed': | |
| 4760 | - assert isinstance(obj, dict) | |
| 4761 | - sealed = from_int(obj["sealed"]) | |
| 4762 | - return Sealed(sealed) | |
| 4763 | - | |
| 4764 | - def to_dict(self) -> dict: | |
| 4765 | - result: dict = {} | |
| 4766 | - result["sealed"] = from_int(self.sealed) | |
| 4767 | - return result | |
| 4768 | - | |
| 4769 | - | |
| 4770 | -@dataclass | |
| 4771 | -class Sel: | |
| 4772 | - sel: int | |
| 4773 | - | |
| 4774 | - @staticmethod | |
| 4775 | - def from_dict(obj: Any) -> 'Sel': | |
| 4776 | - assert isinstance(obj, dict) | |
| 4777 | - sel = from_int(obj["SEL"]) | |
| 4778 | - return Sel(sel) | |
| 4779 | - | |
| 4780 | - def to_dict(self) -> dict: | |
| 4781 | - result: dict = {} | |
| 4782 | - result["SEL"] = from_int(self.sel) | |
| 4783 | - return result | |
| 4784 | - | |
| 4785 | - | |
| 4786 | 4767 | @dataclass |
| 4787 | 4768 | class Obj4: |
| 4769 | + no: No | |
| 4788 | 4770 | ns_error: NSError |
| 4789 | 4771 | ns_object: NSObject |
| 4790 | 4772 | ns_string: NSString |
| @@ -4793,8 +4775,8 @@ class Obj4: | ||
| 4793 | 4775 | object_mapper: ObjectMapper |
| 4794 | 4776 | protocol: Protocol |
| 4795 | 4777 | reg_exp: RegExp |
| 4796 | - sel: Sel | |
| 4797 | 4778 | dummy: int |
| 4779 | + nil: Nil | |
| 4798 | 4780 | no_such_method: NoSuchMethod |
| 4799 | 4781 | noexcept: Noexcept |
| 4800 | 4782 | nonatomic: Nonatomic |
| @@ -4849,11 +4831,11 @@ class Obj4: | ||
| 4849 | 4831 | runtime_type: RuntimeType |
| 4850 | 4832 | s: S |
| 4851 | 4833 | sbyte: Sbyte |
| 4852 | - sealed: Sealed | |
| 4853 | 4834 | |
| 4854 | 4835 | @staticmethod |
| 4855 | 4836 | def from_dict(obj: Any) -> 'Obj4': |
| 4856 | 4837 | assert isinstance(obj, dict) |
| 4838 | + no = No.from_dict(obj["NO"]) | |
| 4857 | 4839 | ns_error = NSError.from_dict(obj["NSError"]) |
| 4858 | 4840 | ns_object = NSObject.from_dict(obj["NSObject"]) |
| 4859 | 4841 | ns_string = NSString.from_dict(obj["NSString"]) |
| @@ -4862,8 +4844,8 @@ class Obj4: | ||
| 4862 | 4844 | object_mapper = ObjectMapper.from_dict(obj["ObjectMapper"]) |
| 4863 | 4845 | protocol = Protocol.from_dict(obj["Protocol"]) |
| 4864 | 4846 | reg_exp = RegExp.from_dict(obj["RegExp"]) |
| 4865 | - sel = Sel.from_dict(obj["SEL"]) | |
| 4866 | 4847 | dummy = from_int(obj["dummy"]) |
| 4848 | + nil = Nil.from_dict(obj["nil"]) | |
| 4867 | 4849 | no_such_method = NoSuchMethod.from_dict(obj["noSuchMethod"]) |
| 4868 | 4850 | noexcept = Noexcept.from_dict(obj["noexcept"]) |
| 4869 | 4851 | nonatomic = Nonatomic.from_dict(obj["nonatomic"]) |
| @@ -4918,11 +4900,11 @@ class Obj4: | ||
| 4918 | 4900 | runtime_type = RuntimeType.from_dict(obj["runtimeType"]) |
| 4919 | 4901 | s = S.from_dict(obj["s"]) |
| 4920 | 4902 | sbyte = Sbyte.from_dict(obj["sbyte"]) |
| 4921 | - sealed = Sealed.from_dict(obj["sealed"]) | |
| 4922 | - return Obj4(ns_error, ns_object, ns_string, null, none, object_mapper, protocol, reg_exp, sel, dummy, no_such_method, noexcept, nonatomic, obj4_none, obj4_nonlocal, nonmutating, obj4_not, not_eq, obj4_null, nullptr, number, object, of, oneway, open, operator, optional, obj4_or, or_eq, out, override, package, params, obj4_pass, port, postfix, precedence, prefix, obj4_print, print_members, printf, private, protected, obj4_protocol, public, quicktype, obj4_raise, range, readonly, ref, register, reinterpret_cast, repeat, require, required, requires, restrict, retain, rethrows, obj4_return, right, runtime_type, s, sbyte, sealed) | |
| 4903 | + return Obj4(no, ns_error, ns_object, ns_string, null, none, object_mapper, protocol, reg_exp, dummy, nil, no_such_method, noexcept, nonatomic, obj4_none, obj4_nonlocal, nonmutating, obj4_not, not_eq, obj4_null, nullptr, number, object, of, oneway, open, operator, optional, obj4_or, or_eq, out, override, package, params, obj4_pass, port, postfix, precedence, prefix, obj4_print, print_members, printf, private, protected, obj4_protocol, public, quicktype, obj4_raise, range, readonly, ref, register, reinterpret_cast, repeat, require, required, requires, restrict, retain, rethrows, obj4_return, right, runtime_type, s, sbyte) | |
| 4923 | 4904 | |
| 4924 | 4905 | def to_dict(self) -> dict: |
| 4925 | 4906 | result: dict = {} |
| 4907 | + result["NO"] = to_class(No, self.no) | |
| 4926 | 4908 | result["NSError"] = to_class(NSError, self.ns_error) |
| 4927 | 4909 | result["NSObject"] = to_class(NSObject, self.ns_object) |
| 4928 | 4910 | result["NSString"] = to_class(NSString, self.ns_string) |
| @@ -4931,8 +4913,8 @@ class Obj4: | ||
| 4931 | 4913 | result["ObjectMapper"] = to_class(ObjectMapper, self.object_mapper) |
| 4932 | 4914 | result["Protocol"] = to_class(Protocol, self.protocol) |
| 4933 | 4915 | result["RegExp"] = to_class(RegExp, self.reg_exp) |
| 4934 | - result["SEL"] = to_class(Sel, self.sel) | |
| 4935 | 4916 | result["dummy"] = from_int(self.dummy) |
| 4917 | + result["nil"] = to_class(Nil, self.nil) | |
| 4936 | 4918 | result["noSuchMethod"] = to_class(NoSuchMethod, self.no_such_method) |
| 4937 | 4919 | result["noexcept"] = to_class(Noexcept, self.noexcept) |
| 4938 | 4920 | result["nonatomic"] = to_class(Nonatomic, self.nonatomic) |
| @@ -4987,7 +4969,6 @@ class Obj4: | ||
| 4987 | 4969 | result["runtimeType"] = to_class(RuntimeType, self.runtime_type) |
| 4988 | 4970 | result["s"] = to_class(S, self.s) |
| 4989 | 4971 | result["sbyte"] = to_class(Sbyte, self.sbyte) |
| 4990 | - result["sealed"] = to_class(Sealed, self.sealed) | |
| 4991 | 4972 | return result |
| 4992 | 4973 | |
| 4993 | 4974 | |
| @@ -5119,6 +5100,38 @@ class SelfClass: | ||
| 5119 | 5100 | return result |
| 5120 | 5101 | |
| 5121 | 5102 | |
| 5103 | +@dataclass | |
| 5104 | +class Sealed: | |
| 5105 | + sealed: int | |
| 5106 | + | |
| 5107 | + @staticmethod | |
| 5108 | + def from_dict(obj: Any) -> 'Sealed': | |
| 5109 | + assert isinstance(obj, dict) | |
| 5110 | + sealed = from_int(obj["sealed"]) | |
| 5111 | + return Sealed(sealed) | |
| 5112 | + | |
| 5113 | + def to_dict(self) -> dict: | |
| 5114 | + result: dict = {} | |
| 5115 | + result["sealed"] = from_int(self.sealed) | |
| 5116 | + return result | |
| 5117 | + | |
| 5118 | + | |
| 5119 | +@dataclass | |
| 5120 | +class Sel: | |
| 5121 | + sel: int | |
| 5122 | + | |
| 5123 | + @staticmethod | |
| 5124 | + def from_dict(obj: Any) -> 'Sel': | |
| 5125 | + assert isinstance(obj, dict) | |
| 5126 | + sel = from_int(obj["SEL"]) | |
| 5127 | + return Sel(sel) | |
| 5128 | + | |
| 5129 | + def to_dict(self) -> dict: | |
| 5130 | + result: dict = {} | |
| 5131 | + result["SEL"] = from_int(self.sel) | |
| 5132 | + return result | |
| 5133 | + | |
| 5134 | + | |
| 5122 | 5135 | @dataclass |
| 5123 | 5136 | class Select: |
| 5124 | 5137 | select: int |
| @@ -5983,58 +5996,11 @@ class UnmarshalJSON: | ||
| 5983 | 5996 | return result |
| 5984 | 5997 | |
| 5985 | 5998 | |
| 5986 | -@dataclass | |
| 5987 | -class Unowned: | |
| 5988 | - unowned: int | |
| 5989 | - | |
| 5990 | - @staticmethod | |
| 5991 | - def from_dict(obj: Any) -> 'Unowned': | |
| 5992 | - assert isinstance(obj, dict) | |
| 5993 | - unowned = from_int(obj["unowned"]) | |
| 5994 | - return Unowned(unowned) | |
| 5995 | - | |
| 5996 | - def to_dict(self) -> dict: | |
| 5997 | - result: dict = {} | |
| 5998 | - result["unowned"] = from_int(self.unowned) | |
| 5999 | - return result | |
| 6000 | - | |
| 6001 | - | |
| 6002 | -@dataclass | |
| 6003 | -class Unsafe: | |
| 6004 | - unsafe: int | |
| 6005 | - | |
| 6006 | - @staticmethod | |
| 6007 | - def from_dict(obj: Any) -> 'Unsafe': | |
| 6008 | - assert isinstance(obj, dict) | |
| 6009 | - unsafe = from_int(obj["unsafe"]) | |
| 6010 | - return Unsafe(unsafe) | |
| 6011 | - | |
| 6012 | - def to_dict(self) -> dict: | |
| 6013 | - result: dict = {} | |
| 6014 | - result["unsafe"] = from_int(self.unsafe) | |
| 6015 | - return result | |
| 6016 | - | |
| 6017 | - | |
| 6018 | -@dataclass | |
| 6019 | -class UseSerializers: | |
| 6020 | - use_serializers: int | |
| 6021 | - | |
| 6022 | - @staticmethod | |
| 6023 | - def from_dict(obj: Any) -> 'UseSerializers': | |
| 6024 | - assert isinstance(obj, dict) | |
| 6025 | - use_serializers = from_int(obj["UseSerializers"]) | |
| 6026 | - return UseSerializers(use_serializers) | |
| 6027 | - | |
| 6028 | - def to_dict(self) -> dict: | |
| 6029 | - result: dict = {} | |
| 6030 | - result["UseSerializers"] = from_int(self.use_serializers) | |
| 6031 | - return result | |
| 6032 | - | |
| 6033 | - | |
| 6034 | 5999 | @dataclass |
| 6035 | 6000 | class Obj5: |
| 6036 | 6001 | k_serializer: KSerializer |
| 6037 | 6002 | primitive_kind: PrimitiveKind |
| 6003 | + sel: Sel | |
| 6038 | 6004 | obj5_self: Self |
| 6039 | 6005 | sendable: Sendable |
| 6040 | 6006 | serial_descriptor: SerialDescriptor |
| @@ -6051,8 +6017,8 @@ class Obj5: | ||
| 6051 | 6017 | true: TrueClass |
| 6052 | 6018 | type: TypeClass |
| 6053 | 6019 | unmarshal_json: UnmarshalJSON |
| 6054 | - use_serializers: UseSerializers | |
| 6055 | 6020 | dummy: int |
| 6021 | + sealed: Sealed | |
| 6056 | 6022 | select: Select |
| 6057 | 6023 | purple_self: SelfClass |
| 6058 | 6024 | serialize: Serialize |
| @@ -6097,14 +6063,13 @@ class Obj5: | ||
| 6097 | 6063 | unchecked: Unchecked |
| 6098 | 6064 | undefined: Undefined |
| 6099 | 6065 | union: UnionClass |
| 6100 | - unowned: Unowned | |
| 6101 | - unsafe: Unsafe | |
| 6102 | 6066 | |
| 6103 | 6067 | @staticmethod |
| 6104 | 6068 | def from_dict(obj: Any) -> 'Obj5': |
| 6105 | 6069 | assert isinstance(obj, dict) |
| 6106 | 6070 | k_serializer = KSerializer.from_dict(obj["KSerializer"]) |
| 6107 | 6071 | primitive_kind = PrimitiveKind.from_dict(obj["PrimitiveKind"]) |
| 6072 | + sel = Sel.from_dict(obj["SEL"]) | |
| 6108 | 6073 | obj5_self = Self.from_dict(obj["Self"]) |
| 6109 | 6074 | sendable = Sendable.from_dict(obj["Sendable"]) |
| 6110 | 6075 | serial_descriptor = SerialDescriptor.from_dict(obj["SerialDescriptor"]) |
| @@ -6121,8 +6086,8 @@ class Obj5: | ||
| 6121 | 6086 | true = TrueClass.from_dict(obj["True"]) |
| 6122 | 6087 | type = TypeClass.from_dict(obj["Type"]) |
| 6123 | 6088 | unmarshal_json = UnmarshalJSON.from_dict(obj["UnmarshalJSON"]) |
| 6124 | - use_serializers = UseSerializers.from_dict(obj["UseSerializers"]) | |
| 6125 | 6089 | dummy = from_int(obj["dummy"]) |
| 6090 | + sealed = Sealed.from_dict(obj["sealed"]) | |
| 6126 | 6091 | select = Select.from_dict(obj["select"]) |
| 6127 | 6092 | purple_self = SelfClass.from_dict(obj["self"]) |
| 6128 | 6093 | serialize = Serialize.from_dict(obj["serialize"]) |
| @@ -6167,14 +6132,13 @@ class Obj5: | ||
| 6167 | 6132 | unchecked = Unchecked.from_dict(obj["unchecked"]) |
| 6168 | 6133 | undefined = Undefined.from_dict(obj["undefined"]) |
| 6169 | 6134 | union = UnionClass.from_dict(obj["union"]) |
| 6170 | - unowned = Unowned.from_dict(obj["unowned"]) | |
| 6171 | - unsafe = Unsafe.from_dict(obj["unsafe"]) | |
| 6172 | - return Obj5(k_serializer, primitive_kind, obj5_self, sendable, serial_descriptor, serial_name, serializable, serializer_provider, simple_module, standards, std_deserializer, std_serializer, time_only, time_only_converter, time_zone, true, type, unmarshal_json, use_serializers, dummy, select, purple_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_string, obj5_to_dict, to_json, top_level, transient, obj5_true, obj5_try, obj5_type, typealias, typedef, typeid, typename, typeof, uint, ulong, unchecked, undefined, union, unowned, unsafe) | |
| 6135 | + return Obj5(k_serializer, primitive_kind, sel, obj5_self, sendable, serial_descriptor, serial_name, serializable, serializer_provider, simple_module, standards, std_deserializer, std_serializer, time_only, time_only_converter, time_zone, true, type, unmarshal_json, dummy, sealed, select, purple_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_string, obj5_to_dict, to_json, top_level, transient, obj5_true, obj5_try, obj5_type, typealias, typedef, typeid, typename, typeof, uint, ulong, unchecked, undefined, union) | |
| 6173 | 6136 | |
| 6174 | 6137 | def to_dict(self) -> dict: |
| 6175 | 6138 | result: dict = {} |
| 6176 | 6139 | result["KSerializer"] = to_class(KSerializer, self.k_serializer) |
| 6177 | 6140 | result["PrimitiveKind"] = to_class(PrimitiveKind, self.primitive_kind) |
| 6141 | + result["SEL"] = to_class(Sel, self.sel) | |
| 6178 | 6142 | result["Self"] = to_class(Self, self.obj5_self) |
| 6179 | 6143 | result["Sendable"] = to_class(Sendable, self.sendable) |
| 6180 | 6144 | result["SerialDescriptor"] = to_class(SerialDescriptor, self.serial_descriptor) |
| @@ -6191,8 +6155,8 @@ class Obj5: | ||
| 6191 | 6155 | result["True"] = to_class(TrueClass, self.true) |
| 6192 | 6156 | result["Type"] = to_class(TypeClass, self.type) |
| 6193 | 6157 | result["UnmarshalJSON"] = to_class(UnmarshalJSON, self.unmarshal_json) |
| 6194 | - result["UseSerializers"] = to_class(UseSerializers, self.use_serializers) | |
| 6195 | 6158 | result["dummy"] = from_int(self.dummy) |
| 6159 | + result["sealed"] = to_class(Sealed, self.sealed) | |
| 6196 | 6160 | result["select"] = to_class(Select, self.select) |
| 6197 | 6161 | result["self"] = to_class(SelfClass, self.purple_self) |
| 6198 | 6162 | result["serialize"] = to_class(Serialize, self.serialize) |
| @@ -6237,8 +6201,6 @@ class Obj5: | ||
| 6237 | 6201 | result["unchecked"] = to_class(Unchecked, self.unchecked) |
| 6238 | 6202 | result["undefined"] = to_class(Undefined, self.undefined) |
| 6239 | 6203 | result["union"] = to_class(UnionClass, self.union) |
| 6240 | - result["unowned"] = to_class(Unowned, self.unowned) | |
| 6241 | - result["unsafe"] = to_class(Unsafe, self.unsafe) | |
| 6242 | 6204 | return result |
| 6243 | 6205 | |
| 6244 | 6206 | |
| @@ -6290,6 +6252,38 @@ class Yield: | ||
| 6290 | 6252 | return result |
| 6291 | 6253 | |
| 6292 | 6254 | |
| 6255 | +@dataclass | |
| 6256 | +class Unowned: | |
| 6257 | + unowned: int | |
| 6258 | + | |
| 6259 | + @staticmethod | |
| 6260 | + def from_dict(obj: Any) -> 'Unowned': | |
| 6261 | + assert isinstance(obj, dict) | |
| 6262 | + unowned = from_int(obj["unowned"]) | |
| 6263 | + return Unowned(unowned) | |
| 6264 | + | |
| 6265 | + def to_dict(self) -> dict: | |
| 6266 | + result: dict = {} | |
| 6267 | + result["unowned"] = from_int(self.unowned) | |
| 6268 | + return result | |
| 6269 | + | |
| 6270 | + | |
| 6271 | +@dataclass | |
| 6272 | +class Unsafe: | |
| 6273 | + unsafe: int | |
| 6274 | + | |
| 6275 | + @staticmethod | |
| 6276 | + def from_dict(obj: Any) -> 'Unsafe': | |
| 6277 | + assert isinstance(obj, dict) | |
| 6278 | + unsafe = from_int(obj["unsafe"]) | |
| 6279 | + return Unsafe(unsafe) | |
| 6280 | + | |
| 6281 | + def to_dict(self) -> dict: | |
| 6282 | + result: dict = {} | |
| 6283 | + result["unsafe"] = from_int(self.unsafe) | |
| 6284 | + return result | |
| 6285 | + | |
| 6286 | + | |
| 6293 | 6287 | @dataclass |
| 6294 | 6288 | class Unsigned: |
| 6295 | 6289 | unsigned: int |
| @@ -6306,6 +6300,22 @@ class Unsigned: | ||
| 6306 | 6300 | return result |
| 6307 | 6301 | |
| 6308 | 6302 | |
| 6303 | +@dataclass | |
| 6304 | +class UseSerializers: | |
| 6305 | + use_serializers: int | |
| 6306 | + | |
| 6307 | + @staticmethod | |
| 6308 | + def from_dict(obj: Any) -> 'UseSerializers': | |
| 6309 | + assert isinstance(obj, dict) | |
| 6310 | + use_serializers = from_int(obj["UseSerializers"]) | |
| 6311 | + return UseSerializers(use_serializers) | |
| 6312 | + | |
| 6313 | + def to_dict(self) -> dict: | |
| 6314 | + result: dict = {} | |
| 6315 | + result["UseSerializers"] = from_int(self.use_serializers) | |
| 6316 | + return result | |
| 6317 | + | |
| 6318 | + | |
| 6309 | 6319 | @dataclass |
| 6310 | 6320 | class Ushort: |
| 6311 | 6321 | ushort: int |
| @@ -6565,10 +6575,13 @@ class Yes: | ||
| 6565 | 6575 | @dataclass |
| 6566 | 6576 | class Obj6: |
| 6567 | 6577 | uuid: UUIDClass |
| 6578 | + use_serializers: UseSerializers | |
| 6568 | 6579 | utf8_json_reader: Utf8JSONReader |
| 6569 | 6580 | utf8_json_writer: Utf8JSONWriter |
| 6570 | 6581 | yes: Yes |
| 6571 | 6582 | dummy: int |
| 6583 | + unowned: Unowned | |
| 6584 | + unsafe: Unsafe | |
| 6572 | 6585 | unsigned: Unsigned |
| 6573 | 6586 | ushort: Ushort |
| 6574 | 6587 | using: Using |
| @@ -6590,10 +6603,13 @@ class Obj6: | ||
| 6590 | 6603 | def from_dict(obj: Any) -> 'Obj6': |
| 6591 | 6604 | assert isinstance(obj, dict) |
| 6592 | 6605 | uuid = UUIDClass.from_dict(obj["UUID"]) |
| 6606 | + use_serializers = UseSerializers.from_dict(obj["UseSerializers"]) | |
| 6593 | 6607 | utf8_json_reader = Utf8JSONReader.from_dict(obj["Utf8JsonReader"]) |
| 6594 | 6608 | utf8_json_writer = Utf8JSONWriter.from_dict(obj["Utf8JsonWriter"]) |
| 6595 | 6609 | yes = Yes.from_dict(obj["YES"]) |
| 6596 | 6610 | dummy = from_int(obj["dummy"]) |
| 6611 | + unowned = Unowned.from_dict(obj["unowned"]) | |
| 6612 | + unsafe = Unsafe.from_dict(obj["unsafe"]) | |
| 6597 | 6613 | unsigned = Unsigned.from_dict(obj["unsigned"]) |
| 6598 | 6614 | ushort = Ushort.from_dict(obj["ushort"]) |
| 6599 | 6615 | using = Using.from_dict(obj["using"]) |
| @@ -6610,15 +6626,18 @@ class Obj6: | ||
| 6610 | 6626 | xor = Xor.from_dict(obj["xor"]) |
| 6611 | 6627 | xor_eq = XorEq.from_dict(obj["xor_eq"]) |
| 6612 | 6628 | obj6_yield = Yield.from_dict(obj["yield"]) |
| 6613 | - return Obj6(uuid, utf8_json_reader, utf8_json_writer, yes, dummy, unsigned, ushort, using, var, virtual, void, volatile, wchar_t, weak, where, obj6_while, will_set, obj6_with, xor, xor_eq, obj6_yield) | |
| 6629 | + return Obj6(uuid, use_serializers, utf8_json_reader, utf8_json_writer, yes, dummy, unowned, unsafe, unsigned, ushort, using, var, virtual, void, volatile, wchar_t, weak, where, obj6_while, will_set, obj6_with, xor, xor_eq, obj6_yield) | |
| 6614 | 6630 | |
| 6615 | 6631 | def to_dict(self) -> dict: |
| 6616 | 6632 | result: dict = {} |
| 6617 | 6633 | result["UUID"] = to_class(UUIDClass, self.uuid) |
| 6634 | + result["UseSerializers"] = to_class(UseSerializers, self.use_serializers) | |
| 6618 | 6635 | result["Utf8JsonReader"] = to_class(Utf8JSONReader, self.utf8_json_reader) |
| 6619 | 6636 | result["Utf8JsonWriter"] = to_class(Utf8JSONWriter, self.utf8_json_writer) |
| 6620 | 6637 | result["YES"] = to_class(Yes, self.yes) |
| 6621 | 6638 | result["dummy"] = from_int(self.dummy) |
| 6639 | + result["unowned"] = to_class(Unowned, self.unowned) | |
| 6640 | + result["unsafe"] = to_class(Unsafe, self.unsafe) | |
| 6622 | 6641 | result["unsigned"] = to_class(Unsigned, self.unsigned) |
| 6623 | 6642 | result["ushort"] = to_class(Ushort, self.ushort) |
| 6624 | 6643 | result["using"] = to_class(Using, self.using) |
Mrubydefault / TopLevel.rb+224 −196
| @@ -4886,6 +4886,31 @@ class Long < Dry::Struct | ||
| 4886 | 4886 | end |
| 4887 | 4887 | end |
| 4888 | 4888 | |
| 4889 | +class MakeDictEncoder < Dry::Struct | |
| 4890 | + attribute :make_dict_encoder, Types::Integer | |
| 4891 | + | |
| 4892 | + def self.from_dynamic!(d) | |
| 4893 | + d = Types::Hash[d] | |
| 4894 | + new( | |
| 4895 | + make_dict_encoder: d.fetch("makeDictEncoder"), | |
| 4896 | + ) | |
| 4897 | + end | |
| 4898 | + | |
| 4899 | + def self.from_json!(json) | |
| 4900 | + from_dynamic!(JSON.parse(json)) | |
| 4901 | + end | |
| 4902 | + | |
| 4903 | + def to_dynamic | |
| 4904 | + { | |
| 4905 | + "makeDictEncoder" => make_dict_encoder, | |
| 4906 | + } | |
| 4907 | + end | |
| 4908 | + | |
| 4909 | + def to_json(options = nil) | |
| 4910 | + JSON.generate(to_dynamic, options) | |
| 4911 | + end | |
| 4912 | +end | |
| 4913 | + | |
| 4889 | 4914 | class Map < Dry::Struct |
| 4890 | 4915 | attribute :map, Types::Integer |
| 4891 | 4916 | |
| @@ -5111,31 +5136,6 @@ class Newtonsoft < Dry::Struct | ||
| 5111 | 5136 | end |
| 5112 | 5137 | end |
| 5113 | 5138 | |
| 5114 | -class No < Dry::Struct | |
| 5115 | - attribute :no, Types::Integer | |
| 5116 | - | |
| 5117 | - def self.from_dynamic!(d) | |
| 5118 | - d = Types::Hash[d] | |
| 5119 | - new( | |
| 5120 | - no: d.fetch("NO"), | |
| 5121 | - ) | |
| 5122 | - end | |
| 5123 | - | |
| 5124 | - def self.from_json!(json) | |
| 5125 | - from_dynamic!(JSON.parse(json)) | |
| 5126 | - end | |
| 5127 | - | |
| 5128 | - def to_dynamic | |
| 5129 | - { | |
| 5130 | - "NO" => no, | |
| 5131 | - } | |
| 5132 | - end | |
| 5133 | - | |
| 5134 | - def to_json(options = nil) | |
| 5135 | - JSON.generate(to_dynamic, options) | |
| 5136 | - end | |
| 5137 | -end | |
| 5138 | - | |
| 5139 | 5139 | class If < Dry::Struct |
| 5140 | 5140 | attribute :if_if, Types::Integer |
| 5141 | 5141 | |
| @@ -5261,31 +5261,6 @@ class New < Dry::Struct | ||
| 5261 | 5261 | end |
| 5262 | 5262 | end |
| 5263 | 5263 | |
| 5264 | -class Nil < Dry::Struct | |
| 5265 | - attribute :nil_nil, Types::Integer | |
| 5266 | - | |
| 5267 | - def self.from_dynamic!(d) | |
| 5268 | - d = Types::Hash[d] | |
| 5269 | - new( | |
| 5270 | - nil_nil: d.fetch("nil"), | |
| 5271 | - ) | |
| 5272 | - end | |
| 5273 | - | |
| 5274 | - def self.from_json!(json) | |
| 5275 | - from_dynamic!(JSON.parse(json)) | |
| 5276 | - end | |
| 5277 | - | |
| 5278 | - def to_dynamic | |
| 5279 | - { | |
| 5280 | - "nil" => nil_nil, | |
| 5281 | - } | |
| 5282 | - end | |
| 5283 | - | |
| 5284 | - def to_json(options = nil) | |
| 5285 | - JSON.generate(to_dynamic, options) | |
| 5286 | - end | |
| 5287 | -end | |
| 5288 | - | |
| 5289 | 5264 | class Obj3 < Dry::Struct |
| 5290 | 5265 | attribute :dummy, Types::Integer |
| 5291 | 5266 | attribute :goto, Goto |
| @@ -5337,6 +5312,7 @@ class Obj3 < Dry::Struct | ||
| 5337 | 5312 | attribute :locale, Locale |
| 5338 | 5313 | attribute :lock, Lock |
| 5339 | 5314 | attribute :long, Long |
| 5315 | + attribute :make_dict_encoder, MakeDictEncoder | |
| 5340 | 5316 | attribute :map, Map |
| 5341 | 5317 | attribute :map_entry, MapEntry |
| 5342 | 5318 | attribute :marshal_json, MarshalJSON |
| @@ -5346,13 +5322,11 @@ class Obj3 < Dry::Struct | ||
| 5346 | 5322 | attribute :namespace, Namespace |
| 5347 | 5323 | attribute :native, Native |
| 5348 | 5324 | attribute :newtonsoft, Newtonsoft |
| 5349 | - attribute :no, No | |
| 5350 | 5325 | attribute :obj3_if, If |
| 5351 | 5326 | attribute :obj3_in, In |
| 5352 | 5327 | attribute :obj3_lambda, Lambda |
| 5353 | 5328 | attribute :obj3_module, ModuleClass |
| 5354 | 5329 | attribute :obj3_new, New |
| 5355 | - attribute :obj3_nil, Nil | |
| 5356 | 5330 | |
| 5357 | 5331 | def self.from_dynamic!(d) |
| 5358 | 5332 | d = Types::Hash[d] |
| @@ -5407,6 +5381,7 @@ class Obj3 < Dry::Struct | ||
| 5407 | 5381 | locale: Locale.from_dynamic!(d.fetch("Locale")), |
| 5408 | 5382 | lock: Lock.from_dynamic!(d.fetch("lock")), |
| 5409 | 5383 | long: Long.from_dynamic!(d.fetch("long")), |
| 5384 | + make_dict_encoder: MakeDictEncoder.from_dynamic!(d.fetch("makeDictEncoder")), | |
| 5410 | 5385 | map: Map.from_dynamic!(d.fetch("map")), |
| 5411 | 5386 | map_entry: MapEntry.from_dynamic!(d.fetch("MapEntry")), |
| 5412 | 5387 | marshal_json: MarshalJSON.from_dynamic!(d.fetch("MarshalJSON")), |
| @@ -5416,13 +5391,11 @@ class Obj3 < Dry::Struct | ||
| 5416 | 5391 | namespace: Namespace.from_dynamic!(d.fetch("namespace")), |
| 5417 | 5392 | native: Native.from_dynamic!(d.fetch("native")), |
| 5418 | 5393 | newtonsoft: Newtonsoft.from_dynamic!(d.fetch("newtonsoft")), |
| 5419 | - no: No.from_dynamic!(d.fetch("NO")), | |
| 5420 | 5394 | obj3_if: If.from_dynamic!(d.fetch("if")), |
| 5421 | 5395 | obj3_in: In.from_dynamic!(d.fetch("in")), |
| 5422 | 5396 | obj3_lambda: Lambda.from_dynamic!(d.fetch("lambda")), |
| 5423 | 5397 | obj3_module: ModuleClass.from_dynamic!(d.fetch("module")), |
| 5424 | 5398 | obj3_new: New.from_dynamic!(d.fetch("new")), |
| 5425 | - obj3_nil: Nil.from_dynamic!(d.fetch("nil")), | |
| 5426 | 5399 | ) |
| 5427 | 5400 | end |
| 5428 | 5401 | |
| @@ -5482,6 +5455,7 @@ class Obj3 < Dry::Struct | ||
| 5482 | 5455 | "Locale" => locale.to_dynamic, |
| 5483 | 5456 | "lock" => lock.to_dynamic, |
| 5484 | 5457 | "long" => long.to_dynamic, |
| 5458 | + "makeDictEncoder" => make_dict_encoder.to_dynamic, | |
| 5485 | 5459 | "map" => map.to_dynamic, |
| 5486 | 5460 | "MapEntry" => map_entry.to_dynamic, |
| 5487 | 5461 | "MarshalJSON" => marshal_json.to_dynamic, |
| @@ -5491,13 +5465,36 @@ class Obj3 < Dry::Struct | ||
| 5491 | 5465 | "namespace" => namespace.to_dynamic, |
| 5492 | 5466 | "native" => native.to_dynamic, |
| 5493 | 5467 | "newtonsoft" => newtonsoft.to_dynamic, |
| 5494 | - "NO" => no.to_dynamic, | |
| 5495 | 5468 | "if" => obj3_if.to_dynamic, |
| 5496 | 5469 | "in" => obj3_in.to_dynamic, |
| 5497 | 5470 | "lambda" => obj3_lambda.to_dynamic, |
| 5498 | 5471 | "module" => obj3_module.to_dynamic, |
| 5499 | 5472 | "new" => obj3_new.to_dynamic, |
| 5500 | - "nil" => obj3_nil.to_dynamic, | |
| 5473 | + } | |
| 5474 | + end | |
| 5475 | + | |
| 5476 | + def to_json(options = nil) | |
| 5477 | + JSON.generate(to_dynamic, options) | |
| 5478 | + end | |
| 5479 | +end | |
| 5480 | + | |
| 5481 | +class No < Dry::Struct | |
| 5482 | + attribute :no, Types::Integer | |
| 5483 | + | |
| 5484 | + def self.from_dynamic!(d) | |
| 5485 | + d = Types::Hash[d] | |
| 5486 | + new( | |
| 5487 | + no: d.fetch("NO"), | |
| 5488 | + ) | |
| 5489 | + end | |
| 5490 | + | |
| 5491 | + def self.from_json!(json) | |
| 5492 | + from_dynamic!(JSON.parse(json)) | |
| 5493 | + end | |
| 5494 | + | |
| 5495 | + def to_dynamic | |
| 5496 | + { | |
| 5497 | + "NO" => no, | |
| 5501 | 5498 | } |
| 5502 | 5499 | end |
| 5503 | 5500 | |
| @@ -5831,6 +5828,31 @@ class Number < Dry::Struct | ||
| 5831 | 5828 | end |
| 5832 | 5829 | end |
| 5833 | 5830 | |
| 5831 | +class Nil < Dry::Struct | |
| 5832 | + attribute :nil_nil, Types::Integer | |
| 5833 | + | |
| 5834 | + def self.from_dynamic!(d) | |
| 5835 | + d = Types::Hash[d] | |
| 5836 | + new( | |
| 5837 | + nil_nil: d.fetch("nil"), | |
| 5838 | + ) | |
| 5839 | + end | |
| 5840 | + | |
| 5841 | + def self.from_json!(json) | |
| 5842 | + from_dynamic!(JSON.parse(json)) | |
| 5843 | + end | |
| 5844 | + | |
| 5845 | + def to_dynamic | |
| 5846 | + { | |
| 5847 | + "nil" => nil_nil, | |
| 5848 | + } | |
| 5849 | + end | |
| 5850 | + | |
| 5851 | + def to_json(options = nil) | |
| 5852 | + JSON.generate(to_dynamic, options) | |
| 5853 | + end | |
| 5854 | +end | |
| 5855 | + | |
| 5834 | 5856 | class NoneClass < Dry::Struct |
| 5835 | 5857 | attribute :none, Types::Integer |
| 5836 | 5858 | |
| @@ -7056,58 +7078,9 @@ class Sbyte < Dry::Struct | ||
| 7056 | 7078 | end |
| 7057 | 7079 | end |
| 7058 | 7080 | |
| 7059 | -class Sealed < Dry::Struct | |
| 7060 | - attribute :sealed, Types::Integer | |
| 7061 | - | |
| 7062 | - def self.from_dynamic!(d) | |
| 7063 | - d = Types::Hash[d] | |
| 7064 | - new( | |
| 7065 | - sealed: d.fetch("sealed"), | |
| 7066 | - ) | |
| 7067 | - end | |
| 7068 | - | |
| 7069 | - def self.from_json!(json) | |
| 7070 | - from_dynamic!(JSON.parse(json)) | |
| 7071 | - end | |
| 7072 | - | |
| 7073 | - def to_dynamic | |
| 7074 | - { | |
| 7075 | - "sealed" => sealed, | |
| 7076 | - } | |
| 7077 | - end | |
| 7078 | - | |
| 7079 | - def to_json(options = nil) | |
| 7080 | - JSON.generate(to_dynamic, options) | |
| 7081 | - end | |
| 7082 | -end | |
| 7083 | - | |
| 7084 | -class Sel < Dry::Struct | |
| 7085 | - attribute :sel, Types::Integer | |
| 7086 | - | |
| 7087 | - def self.from_dynamic!(d) | |
| 7088 | - d = Types::Hash[d] | |
| 7089 | - new( | |
| 7090 | - sel: d.fetch("SEL"), | |
| 7091 | - ) | |
| 7092 | - end | |
| 7093 | - | |
| 7094 | - def self.from_json!(json) | |
| 7095 | - from_dynamic!(JSON.parse(json)) | |
| 7096 | - end | |
| 7097 | - | |
| 7098 | - def to_dynamic | |
| 7099 | - { | |
| 7100 | - "SEL" => sel, | |
| 7101 | - } | |
| 7102 | - end | |
| 7103 | - | |
| 7104 | - def to_json(options = nil) | |
| 7105 | - JSON.generate(to_dynamic, options) | |
| 7106 | - end | |
| 7107 | -end | |
| 7108 | - | |
| 7109 | 7081 | class Obj4 < Dry::Struct |
| 7110 | 7082 | attribute :dummy, Types::Integer |
| 7083 | + attribute :no, No | |
| 7111 | 7084 | attribute :no_such_method, NoSuchMethod |
| 7112 | 7085 | attribute :noexcept, Noexcept |
| 7113 | 7086 | attribute :nonatomic, Nonatomic |
| @@ -7121,6 +7094,7 @@ class Obj4 < Dry::Struct | ||
| 7121 | 7094 | attribute :null, Null |
| 7122 | 7095 | attribute :nullptr, Nullptr |
| 7123 | 7096 | attribute :number, Number |
| 7097 | + attribute :obj4_nil, Nil | |
| 7124 | 7098 | attribute :obj4_none, NoneClass |
| 7125 | 7099 | attribute :obj4_not, Not |
| 7126 | 7100 | attribute :obj4_null, NullClass |
| @@ -7170,13 +7144,12 @@ class Obj4 < Dry::Struct | ||
| 7170 | 7144 | attribute :runtime_type, RuntimeType |
| 7171 | 7145 | attribute :s, S |
| 7172 | 7146 | attribute :sbyte, Sbyte |
| 7173 | - attribute :sealed, Sealed | |
| 7174 | - attribute :sel, Sel | |
| 7175 | 7147 | |
| 7176 | 7148 | def self.from_dynamic!(d) |
| 7177 | 7149 | d = Types::Hash[d] |
| 7178 | 7150 | new( |
| 7179 | 7151 | dummy: d.fetch("dummy"), |
| 7152 | + no: No.from_dynamic!(d.fetch("NO")), | |
| 7180 | 7153 | no_such_method: NoSuchMethod.from_dynamic!(d.fetch("noSuchMethod")), |
| 7181 | 7154 | noexcept: Noexcept.from_dynamic!(d.fetch("noexcept")), |
| 7182 | 7155 | nonatomic: Nonatomic.from_dynamic!(d.fetch("nonatomic")), |
| @@ -7190,6 +7163,7 @@ class Obj4 < Dry::Struct | ||
| 7190 | 7163 | null: Null.from_dynamic!(d.fetch("NULL")), |
| 7191 | 7164 | nullptr: Nullptr.from_dynamic!(d.fetch("nullptr")), |
| 7192 | 7165 | number: Number.from_dynamic!(d.fetch("number")), |
| 7166 | + obj4_nil: Nil.from_dynamic!(d.fetch("nil")), | |
| 7193 | 7167 | obj4_none: NoneClass.from_dynamic!(d.fetch("none")), |
| 7194 | 7168 | obj4_not: Not.from_dynamic!(d.fetch("not")), |
| 7195 | 7169 | obj4_null: NullClass.from_dynamic!(d.fetch("null")), |
| @@ -7239,8 +7213,6 @@ class Obj4 < Dry::Struct | ||
| 7239 | 7213 | runtime_type: RuntimeType.from_dynamic!(d.fetch("runtimeType")), |
| 7240 | 7214 | s: S.from_dynamic!(d.fetch("s")), |
| 7241 | 7215 | sbyte: Sbyte.from_dynamic!(d.fetch("sbyte")), |
| 7242 | - sealed: Sealed.from_dynamic!(d.fetch("sealed")), | |
| 7243 | - sel: Sel.from_dynamic!(d.fetch("SEL")), | |
| 7244 | 7216 | ) |
| 7245 | 7217 | end |
| 7246 | 7218 | |
| @@ -7251,6 +7223,7 @@ class Obj4 < Dry::Struct | ||
| 7251 | 7223 | def to_dynamic |
| 7252 | 7224 | { |
| 7253 | 7225 | "dummy" => dummy, |
| 7226 | + "NO" => no.to_dynamic, | |
| 7254 | 7227 | "noSuchMethod" => no_such_method.to_dynamic, |
| 7255 | 7228 | "noexcept" => noexcept.to_dynamic, |
| 7256 | 7229 | "nonatomic" => nonatomic.to_dynamic, |
| @@ -7264,6 +7237,7 @@ class Obj4 < Dry::Struct | ||
| 7264 | 7237 | "NULL" => null.to_dynamic, |
| 7265 | 7238 | "nullptr" => nullptr.to_dynamic, |
| 7266 | 7239 | "number" => number.to_dynamic, |
| 7240 | + "nil" => obj4_nil.to_dynamic, | |
| 7267 | 7241 | "none" => obj4_none.to_dynamic, |
| 7268 | 7242 | "not" => obj4_not.to_dynamic, |
| 7269 | 7243 | "null" => obj4_null.to_dynamic, |
| @@ -7313,8 +7287,6 @@ class Obj4 < Dry::Struct | ||
| 7313 | 7287 | "runtimeType" => runtime_type.to_dynamic, |
| 7314 | 7288 | "s" => s.to_dynamic, |
| 7315 | 7289 | "sbyte" => sbyte.to_dynamic, |
| 7316 | - "sealed" => sealed.to_dynamic, | |
| 7317 | - "SEL" => sel.to_dynamic, | |
| 7318 | 7290 | } |
| 7319 | 7291 | end |
| 7320 | 7292 | |
| @@ -7623,6 +7595,56 @@ class PrimitiveKind < Dry::Struct | ||
| 7623 | 7595 | end |
| 7624 | 7596 | end |
| 7625 | 7597 | |
| 7598 | +class Sealed < Dry::Struct | |
| 7599 | + attribute :sealed, Types::Integer | |
| 7600 | + | |
| 7601 | + def self.from_dynamic!(d) | |
| 7602 | + d = Types::Hash[d] | |
| 7603 | + new( | |
| 7604 | + sealed: d.fetch("sealed"), | |
| 7605 | + ) | |
| 7606 | + end | |
| 7607 | + | |
| 7608 | + def self.from_json!(json) | |
| 7609 | + from_dynamic!(JSON.parse(json)) | |
| 7610 | + end | |
| 7611 | + | |
| 7612 | + def to_dynamic | |
| 7613 | + { | |
| 7614 | + "sealed" => sealed, | |
| 7615 | + } | |
| 7616 | + end | |
| 7617 | + | |
| 7618 | + def to_json(options = nil) | |
| 7619 | + JSON.generate(to_dynamic, options) | |
| 7620 | + end | |
| 7621 | +end | |
| 7622 | + | |
| 7623 | +class Sel < Dry::Struct | |
| 7624 | + attribute :sel, Types::Integer | |
| 7625 | + | |
| 7626 | + def self.from_dynamic!(d) | |
| 7627 | + d = Types::Hash[d] | |
| 7628 | + new( | |
| 7629 | + sel: d.fetch("SEL"), | |
| 7630 | + ) | |
| 7631 | + end | |
| 7632 | + | |
| 7633 | + def self.from_json!(json) | |
| 7634 | + from_dynamic!(JSON.parse(json)) | |
| 7635 | + end | |
| 7636 | + | |
| 7637 | + def to_dynamic | |
| 7638 | + { | |
| 7639 | + "SEL" => sel, | |
| 7640 | + } | |
| 7641 | + end | |
| 7642 | + | |
| 7643 | + def to_json(options = nil) | |
| 7644 | + JSON.generate(to_dynamic, options) | |
| 7645 | + end | |
| 7646 | +end | |
| 7647 | + | |
| 7626 | 7648 | class Obj5Self < Dry::Struct |
| 7627 | 7649 | attribute :self_self, Types::Integer |
| 7628 | 7650 | |
| @@ -8873,81 +8895,6 @@ class UnmarshalJSON < Dry::Struct | ||
| 8873 | 8895 | end |
| 8874 | 8896 | end |
| 8875 | 8897 | |
| 8876 | -class Unowned < Dry::Struct | |
| 8877 | - attribute :unowned, Types::Integer | |
| 8878 | - | |
| 8879 | - def self.from_dynamic!(d) | |
| 8880 | - d = Types::Hash[d] | |
| 8881 | - new( | |
| 8882 | - unowned: d.fetch("unowned"), | |
| 8883 | - ) | |
| 8884 | - end | |
| 8885 | - | |
| 8886 | - def self.from_json!(json) | |
| 8887 | - from_dynamic!(JSON.parse(json)) | |
| 8888 | - end | |
| 8889 | - | |
| 8890 | - def to_dynamic | |
| 8891 | - { | |
| 8892 | - "unowned" => unowned, | |
| 8893 | - } | |
| 8894 | - end | |
| 8895 | - | |
| 8896 | - def to_json(options = nil) | |
| 8897 | - JSON.generate(to_dynamic, options) | |
| 8898 | - end | |
| 8899 | -end | |
| 8900 | - | |
| 8901 | -class Unsafe < Dry::Struct | |
| 8902 | - attribute :unsafe, Types::Integer | |
| 8903 | - | |
| 8904 | - def self.from_dynamic!(d) | |
| 8905 | - d = Types::Hash[d] | |
| 8906 | - new( | |
| 8907 | - unsafe: d.fetch("unsafe"), | |
| 8908 | - ) | |
| 8909 | - end | |
| 8910 | - | |
| 8911 | - def self.from_json!(json) | |
| 8912 | - from_dynamic!(JSON.parse(json)) | |
| 8913 | - end | |
| 8914 | - | |
| 8915 | - def to_dynamic | |
| 8916 | - { | |
| 8917 | - "unsafe" => unsafe, | |
| 8918 | - } | |
| 8919 | - end | |
| 8920 | - | |
| 8921 | - def to_json(options = nil) | |
| 8922 | - JSON.generate(to_dynamic, options) | |
| 8923 | - end | |
| 8924 | -end | |
| 8925 | - | |
| 8926 | -class UseSerializers < Dry::Struct | |
| 8927 | - attribute :use_serializers, Types::Integer | |
| 8928 | - | |
| 8929 | - def self.from_dynamic!(d) | |
| 8930 | - d = Types::Hash[d] | |
| 8931 | - new( | |
| 8932 | - use_serializers: d.fetch("UseSerializers"), | |
| 8933 | - ) | |
| 8934 | - end | |
| 8935 | - | |
| 8936 | - def self.from_json!(json) | |
| 8937 | - from_dynamic!(JSON.parse(json)) | |
| 8938 | - end | |
| 8939 | - | |
| 8940 | - def to_dynamic | |
| 8941 | - { | |
| 8942 | - "UseSerializers" => use_serializers, | |
| 8943 | - } | |
| 8944 | - end | |
| 8945 | - | |
| 8946 | - def to_json(options = nil) | |
| 8947 | - JSON.generate(to_dynamic, options) | |
| 8948 | - end | |
| 8949 | -end | |
| 8950 | - | |
| 8951 | 8898 | class Obj5 < Dry::Struct |
| 8952 | 8899 | attribute :dummy, Types::Integer |
| 8953 | 8900 | attribute :k_serializer, KSerializer |
| @@ -8962,6 +8909,8 @@ class Obj5 < Dry::Struct | ||
| 8962 | 8909 | attribute :obj5_try, Try |
| 8963 | 8910 | attribute :obj5_type, Type |
| 8964 | 8911 | attribute :primitive_kind, PrimitiveKind |
| 8912 | + attribute :sealed, Sealed | |
| 8913 | + attribute :sel, Sel | |
| 8965 | 8914 | attribute :self_1, Obj5Self |
| 8966 | 8915 | attribute :sendable, Sendable |
| 8967 | 8916 | attribute :serial_descriptor, SerialDescriptor |
| @@ -9012,9 +8961,6 @@ class Obj5 < Dry::Struct | ||
| 9012 | 8961 | attribute :undefined, UndefinedClass |
| 9013 | 8962 | attribute :union, Union |
| 9014 | 8963 | attribute :unmarshal_json, UnmarshalJSON |
| 9015 | - attribute :unowned, Unowned | |
| 9016 | - attribute :unsafe, Unsafe | |
| 9017 | - attribute :use_serializers, UseSerializers | |
| 9018 | 8964 | |
| 9019 | 8965 | def self.from_dynamic!(d) |
| 9020 | 8966 | d = Types::Hash[d] |
| @@ -9032,6 +8978,8 @@ class Obj5 < Dry::Struct | ||
| 9032 | 8978 | obj5_try: Try.from_dynamic!(d.fetch("try")), |
| 9033 | 8979 | obj5_type: Type.from_dynamic!(d.fetch("Type")), |
| 9034 | 8980 | primitive_kind: PrimitiveKind.from_dynamic!(d.fetch("PrimitiveKind")), |
| 8981 | + sealed: Sealed.from_dynamic!(d.fetch("sealed")), | |
| 8982 | + sel: Sel.from_dynamic!(d.fetch("SEL")), | |
| 9035 | 8983 | self_1: Obj5Self.from_dynamic!(d.fetch("self")), |
| 9036 | 8984 | sendable: Sendable.from_dynamic!(d.fetch("Sendable")), |
| 9037 | 8985 | serial_descriptor: SerialDescriptor.from_dynamic!(d.fetch("SerialDescriptor")), |
| @@ -9082,9 +9030,6 @@ class Obj5 < Dry::Struct | ||
| 9082 | 9030 | undefined: UndefinedClass.from_dynamic!(d.fetch("undefined")), |
| 9083 | 9031 | union: Union.from_dynamic!(d.fetch("union")), |
| 9084 | 9032 | unmarshal_json: UnmarshalJSON.from_dynamic!(d.fetch("UnmarshalJSON")), |
| 9085 | - unowned: Unowned.from_dynamic!(d.fetch("unowned")), | |
| 9086 | - unsafe: Unsafe.from_dynamic!(d.fetch("unsafe")), | |
| 9087 | - use_serializers: UseSerializers.from_dynamic!(d.fetch("UseSerializers")), | |
| 9088 | 9033 | ) |
| 9089 | 9034 | end |
| 9090 | 9035 | |
| @@ -9107,6 +9052,8 @@ class Obj5 < Dry::Struct | ||
| 9107 | 9052 | "try" => obj5_try.to_dynamic, |
| 9108 | 9053 | "Type" => obj5_type.to_dynamic, |
| 9109 | 9054 | "PrimitiveKind" => primitive_kind.to_dynamic, |
| 9055 | + "sealed" => sealed.to_dynamic, | |
| 9056 | + "SEL" => sel.to_dynamic, | |
| 9110 | 9057 | "self" => self_1.to_dynamic, |
| 9111 | 9058 | "Sendable" => sendable.to_dynamic, |
| 9112 | 9059 | "SerialDescriptor" => serial_descriptor.to_dynamic, |
| @@ -9157,9 +9104,6 @@ class Obj5 < Dry::Struct | ||
| 9157 | 9104 | "undefined" => undefined.to_dynamic, |
| 9158 | 9105 | "union" => union.to_dynamic, |
| 9159 | 9106 | "UnmarshalJSON" => unmarshal_json.to_dynamic, |
| 9160 | - "unowned" => unowned.to_dynamic, | |
| 9161 | - "unsafe" => unsafe.to_dynamic, | |
| 9162 | - "UseSerializers" => use_serializers.to_dynamic, | |
| 9163 | 9107 | } |
| 9164 | 9108 | end |
| 9165 | 9109 | |
| @@ -9243,6 +9187,56 @@ class Yield < Dry::Struct | ||
| 9243 | 9187 | end |
| 9244 | 9188 | end |
| 9245 | 9189 | |
| 9190 | +class Unowned < Dry::Struct | |
| 9191 | + attribute :unowned, Types::Integer | |
| 9192 | + | |
| 9193 | + def self.from_dynamic!(d) | |
| 9194 | + d = Types::Hash[d] | |
| 9195 | + new( | |
| 9196 | + unowned: d.fetch("unowned"), | |
| 9197 | + ) | |
| 9198 | + end | |
| 9199 | + | |
| 9200 | + def self.from_json!(json) | |
| 9201 | + from_dynamic!(JSON.parse(json)) | |
| 9202 | + end | |
| 9203 | + | |
| 9204 | + def to_dynamic | |
| 9205 | + { | |
| 9206 | + "unowned" => unowned, | |
| 9207 | + } | |
| 9208 | + end | |
| 9209 | + | |
| 9210 | + def to_json(options = nil) | |
| 9211 | + JSON.generate(to_dynamic, options) | |
| 9212 | + end | |
| 9213 | +end | |
| 9214 | + | |
| 9215 | +class Unsafe < Dry::Struct | |
| 9216 | + attribute :unsafe, Types::Integer | |
| 9217 | + | |
| 9218 | + def self.from_dynamic!(d) | |
| 9219 | + d = Types::Hash[d] | |
| 9220 | + new( | |
| 9221 | + unsafe: d.fetch("unsafe"), | |
| 9222 | + ) | |
| 9223 | + end | |
| 9224 | + | |
| 9225 | + def self.from_json!(json) | |
| 9226 | + from_dynamic!(JSON.parse(json)) | |
| 9227 | + end | |
| 9228 | + | |
| 9229 | + def to_dynamic | |
| 9230 | + { | |
| 9231 | + "unsafe" => unsafe, | |
| 9232 | + } | |
| 9233 | + end | |
| 9234 | + | |
| 9235 | + def to_json(options = nil) | |
| 9236 | + JSON.generate(to_dynamic, options) | |
| 9237 | + end | |
| 9238 | +end | |
| 9239 | + | |
| 9246 | 9240 | class Unsigned < Dry::Struct |
| 9247 | 9241 | attribute :unsigned, Types::Integer |
| 9248 | 9242 | |
| @@ -9268,6 +9262,31 @@ class Unsigned < Dry::Struct | ||
| 9268 | 9262 | end |
| 9269 | 9263 | end |
| 9270 | 9264 | |
| 9265 | +class UseSerializers < Dry::Struct | |
| 9266 | + attribute :use_serializers, Types::Integer | |
| 9267 | + | |
| 9268 | + def self.from_dynamic!(d) | |
| 9269 | + d = Types::Hash[d] | |
| 9270 | + new( | |
| 9271 | + use_serializers: d.fetch("UseSerializers"), | |
| 9272 | + ) | |
| 9273 | + end | |
| 9274 | + | |
| 9275 | + def self.from_json!(json) | |
| 9276 | + from_dynamic!(JSON.parse(json)) | |
| 9277 | + end | |
| 9278 | + | |
| 9279 | + def to_dynamic | |
| 9280 | + { | |
| 9281 | + "UseSerializers" => use_serializers, | |
| 9282 | + } | |
| 9283 | + end | |
| 9284 | + | |
| 9285 | + def to_json(options = nil) | |
| 9286 | + JSON.generate(to_dynamic, options) | |
| 9287 | + end | |
| 9288 | +end | |
| 9289 | + | |
| 9271 | 9290 | class Ushort < Dry::Struct |
| 9272 | 9291 | attribute :ushort, Types::Integer |
| 9273 | 9292 | |
| @@ -9673,7 +9692,10 @@ class Obj6 < Dry::Struct | ||
| 9673 | 9692 | attribute :obj6_while, While |
| 9674 | 9693 | attribute :obj6_with, With |
| 9675 | 9694 | attribute :obj6_yield, Yield |
| 9695 | + attribute :unowned, Unowned | |
| 9696 | + attribute :unsafe, Unsafe | |
| 9676 | 9697 | attribute :unsigned, Unsigned |
| 9698 | + attribute :use_serializers, UseSerializers | |
| 9677 | 9699 | attribute :ushort, Ushort |
| 9678 | 9700 | attribute :using, Using |
| 9679 | 9701 | attribute :utf8_json_reader, Utf8JSONReader |
| @@ -9698,7 +9720,10 @@ class Obj6 < Dry::Struct | ||
| 9698 | 9720 | obj6_while: While.from_dynamic!(d.fetch("while")), |
| 9699 | 9721 | obj6_with: With.from_dynamic!(d.fetch("with")), |
| 9700 | 9722 | obj6_yield: Yield.from_dynamic!(d.fetch("yield")), |
| 9723 | + unowned: Unowned.from_dynamic!(d.fetch("unowned")), | |
| 9724 | + unsafe: Unsafe.from_dynamic!(d.fetch("unsafe")), | |
| 9701 | 9725 | unsigned: Unsigned.from_dynamic!(d.fetch("unsigned")), |
| 9726 | + use_serializers: UseSerializers.from_dynamic!(d.fetch("UseSerializers")), | |
| 9702 | 9727 | ushort: Ushort.from_dynamic!(d.fetch("ushort")), |
| 9703 | 9728 | using: Using.from_dynamic!(d.fetch("using")), |
| 9704 | 9729 | utf8_json_reader: Utf8JSONReader.from_dynamic!(d.fetch("Utf8JsonReader")), |
| @@ -9728,7 +9753,10 @@ class Obj6 < Dry::Struct | ||
| 9728 | 9753 | "while" => obj6_while.to_dynamic, |
| 9729 | 9754 | "with" => obj6_with.to_dynamic, |
| 9730 | 9755 | "yield" => obj6_yield.to_dynamic, |
| 9756 | + "unowned" => unowned.to_dynamic, | |
| 9757 | + "unsafe" => unsafe.to_dynamic, | |
| 9731 | 9758 | "unsigned" => unsigned.to_dynamic, |
| 9759 | + "UseSerializers" => use_serializers.to_dynamic, | |
| 9732 | 9760 | "ushort" => ushort.to_dynamic, |
| 9733 | 9761 | "using" => using.to_dynamic, |
| 9734 | 9762 | "Utf8JsonReader" => utf8_json_reader.to_dynamic, |
Mrustdefault / module_under_test.rs+64 −55
| @@ -1152,6 +1152,9 @@ pub struct Obj3 { | ||
| 1152 | 1152 | |
| 1153 | 1153 | pub long: Long, |
| 1154 | 1154 | |
| 1155 | + #[serde(rename = "makeDictEncoder")] | |
| 1156 | + pub make_dict_encoder: MakeDictEncoder, | |
| 1157 | + | |
| 1155 | 1158 | pub map: Map, |
| 1156 | 1159 | |
| 1157 | 1160 | #[serde(rename = "MapEntry")] |
| @@ -1176,11 +1179,6 @@ pub struct Obj3 { | ||
| 1176 | 1179 | |
| 1177 | 1180 | pub newtonsoft: Newtonsoft, |
| 1178 | 1181 | |
| 1179 | - pub nil: Nil, | |
| 1180 | - | |
| 1181 | - #[serde(rename = "NO")] | |
| 1182 | - pub no: No, | |
| 1183 | - | |
| 1184 | 1182 | #[serde(rename = "if")] |
| 1185 | 1183 | pub obj3_if: If, |
| 1186 | 1184 | |
| @@ -1459,6 +1457,12 @@ pub struct Long { | ||
| 1459 | 1457 | pub long: i64, |
| 1460 | 1458 | } |
| 1461 | 1459 | |
| 1460 | +#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 1461 | +#[serde(rename_all = "camelCase")] | |
| 1462 | +pub struct MakeDictEncoder { | |
| 1463 | + pub make_dict_encoder: i64, | |
| 1464 | +} | |
| 1465 | + | |
| 1462 | 1466 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 1463 | 1467 | pub struct Map { |
| 1464 | 1468 | pub map: i64, |
| @@ -1517,17 +1521,6 @@ pub struct Newtonsoft { | ||
| 1517 | 1521 | pub newtonsoft: i64, |
| 1518 | 1522 | } |
| 1519 | 1523 | |
| 1520 | -#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 1521 | -pub struct Nil { | |
| 1522 | - pub nil: i64, | |
| 1523 | -} | |
| 1524 | - | |
| 1525 | -#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 1526 | -#[serde(rename_all = "SCREAMING_SNAKE_CASE")] | |
| 1527 | -pub struct No { | |
| 1528 | - pub no: i64, | |
| 1529 | -} | |
| 1530 | - | |
| 1531 | 1524 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 1532 | 1525 | pub struct If { |
| 1533 | 1526 | #[serde(rename = "if")] |
| @@ -1550,6 +1543,11 @@ pub struct Let { | ||
| 1550 | 1543 | pub struct Obj4 { |
| 1551 | 1544 | pub dummy: i64, |
| 1552 | 1545 | |
| 1546 | + pub nil: Nil, | |
| 1547 | + | |
| 1548 | + #[serde(rename = "NO")] | |
| 1549 | + pub no: No, | |
| 1550 | + | |
| 1553 | 1551 | #[serde(rename = "noSuchMethod")] |
| 1554 | 1552 | pub no_such_method: NoSuchMethod, |
| 1555 | 1553 | |
| @@ -1690,11 +1688,17 @@ pub struct Obj4 { | ||
| 1690 | 1688 | pub s: S, |
| 1691 | 1689 | |
| 1692 | 1690 | pub sbyte: Sbyte, |
| 1691 | +} | |
| 1693 | 1692 | |
| 1694 | - pub sealed: Sealed, | |
| 1693 | +#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 1694 | +pub struct Nil { | |
| 1695 | + pub nil: i64, | |
| 1696 | +} | |
| 1695 | 1697 | |
| 1696 | - #[serde(rename = "SEL")] | |
| 1697 | - pub sel: Sel, | |
| 1698 | +#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 1699 | +#[serde(rename_all = "SCREAMING_SNAKE_CASE")] | |
| 1700 | +pub struct No { | |
| 1701 | + pub no: i64, | |
| 1698 | 1702 | } |
| 1699 | 1703 | |
| 1700 | 1704 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| @@ -2024,17 +2028,6 @@ pub struct Sbyte { | ||
| 2024 | 2028 | pub sbyte: i64, |
| 2025 | 2029 | } |
| 2026 | 2030 | |
| 2027 | -#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 2028 | -pub struct Sealed { | |
| 2029 | - pub sealed: i64, | |
| 2030 | -} | |
| 2031 | - | |
| 2032 | -#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 2033 | -#[serde(rename_all = "SCREAMING_SNAKE_CASE")] | |
| 2034 | -pub struct Sel { | |
| 2035 | - pub sel: i64, | |
| 2036 | -} | |
| 2037 | - | |
| 2038 | 2031 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 2039 | 2032 | pub struct Obj5 { |
| 2040 | 2033 | pub dummy: i64, |
| @@ -2069,9 +2062,6 @@ pub struct Obj5 { | ||
| 2069 | 2062 | #[serde(rename = "union")] |
| 2070 | 2063 | pub obj5_union: Union, |
| 2071 | 2064 | |
| 2072 | - #[serde(rename = "unsafe")] | |
| 2073 | - pub obj5_unsafe: Unsafe, | |
| 2074 | - | |
| 2075 | 2065 | #[serde(rename = "PrimitiveKind")] |
| 2076 | 2066 | pub primitive_kind: PrimitiveKind, |
| 2077 | 2067 | |
| @@ -2084,6 +2074,11 @@ pub struct Obj5 { | ||
| 2084 | 2074 | #[serde(rename = "type")] |
| 2085 | 2075 | pub purple_type: TypeClass, |
| 2086 | 2076 | |
| 2077 | + pub sealed: Sealed, | |
| 2078 | + | |
| 2079 | + #[serde(rename = "SEL")] | |
| 2080 | + pub sel: Sel, | |
| 2081 | + | |
| 2087 | 2082 | pub select: Select, |
| 2088 | 2083 | |
| 2089 | 2084 | #[serde(rename = "Sendable")] |
| @@ -2193,11 +2188,6 @@ pub struct Obj5 { | ||
| 2193 | 2188 | |
| 2194 | 2189 | #[serde(rename = "UnmarshalJSON")] |
| 2195 | 2190 | pub unmarshal_json: UnmarshalJson, |
| 2196 | - | |
| 2197 | - pub unowned: Unowned, | |
| 2198 | - | |
| 2199 | - #[serde(rename = "UseSerializers")] | |
| 2200 | - pub use_serializers: UseSerializers, | |
| 2201 | 2191 | } |
| 2202 | 2192 | |
| 2203 | 2193 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| @@ -2263,12 +2253,6 @@ pub struct Union { | ||
| 2263 | 2253 | pub union_union: i64, |
| 2264 | 2254 | } |
| 2265 | 2255 | |
| 2266 | -#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 2267 | -pub struct Unsafe { | |
| 2268 | - #[serde(rename = "unsafe")] | |
| 2269 | - pub unsafe_unsafe: i64, | |
| 2270 | -} | |
| 2271 | - | |
| 2272 | 2256 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 2273 | 2257 | #[serde(rename_all = "PascalCase")] |
| 2274 | 2258 | pub struct PrimitiveKind { |
| @@ -2293,6 +2277,17 @@ pub struct TypeClass { | ||
| 2293 | 2277 | pub type_type: i64, |
| 2294 | 2278 | } |
| 2295 | 2279 | |
| 2280 | +#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 2281 | +pub struct Sealed { | |
| 2282 | + pub sealed: i64, | |
| 2283 | +} | |
| 2284 | + | |
| 2285 | +#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 2286 | +#[serde(rename_all = "SCREAMING_SNAKE_CASE")] | |
| 2287 | +pub struct Sel { | |
| 2288 | + pub sel: i64, | |
| 2289 | +} | |
| 2290 | + | |
| 2296 | 2291 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 2297 | 2292 | pub struct Select { |
| 2298 | 2293 | pub select: i64, |
| @@ -2548,21 +2543,13 @@ pub struct UnmarshalJson { | ||
| 2548 | 2543 | pub unmarshal_json: i64, |
| 2549 | 2544 | } |
| 2550 | 2545 | |
| 2551 | -#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 2552 | -pub struct Unowned { | |
| 2553 | - pub unowned: i64, | |
| 2554 | -} | |
| 2555 | - | |
| 2556 | -#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 2557 | -#[serde(rename_all = "PascalCase")] | |
| 2558 | -pub struct UseSerializers { | |
| 2559 | - pub use_serializers: i64, | |
| 2560 | -} | |
| 2561 | - | |
| 2562 | 2546 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 2563 | 2547 | pub struct Obj6 { |
| 2564 | 2548 | pub dummy: i64, |
| 2565 | 2549 | |
| 2550 | + #[serde(rename = "unsafe")] | |
| 2551 | + pub obj6_unsafe: Unsafe, | |
| 2552 | + | |
| 2566 | 2553 | #[serde(rename = "virtual")] |
| 2567 | 2554 | pub obj6_virtual: Virtual, |
| 2568 | 2555 | |
| @@ -2575,8 +2562,13 @@ pub struct Obj6 { | ||
| 2575 | 2562 | #[serde(rename = "yield")] |
| 2576 | 2563 | pub obj6_yield: Yield, |
| 2577 | 2564 | |
| 2565 | + pub unowned: Unowned, | |
| 2566 | + | |
| 2578 | 2567 | pub unsigned: Unsigned, |
| 2579 | 2568 | |
| 2569 | + #[serde(rename = "UseSerializers")] | |
| 2570 | + pub use_serializers: UseSerializers, | |
| 2571 | + | |
| 2580 | 2572 | pub ushort: Ushort, |
| 2581 | 2573 | |
| 2582 | 2574 | pub using: Using, |
| @@ -2613,6 +2605,12 @@ pub struct Obj6 { | ||
| 2613 | 2605 | pub yes: Yes, |
| 2614 | 2606 | } |
| 2615 | 2607 | |
| 2608 | +#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 2609 | +pub struct Unsafe { | |
| 2610 | + #[serde(rename = "unsafe")] | |
| 2611 | + pub unsafe_unsafe: i64, | |
| 2612 | +} | |
| 2613 | + | |
| 2616 | 2614 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 2617 | 2615 | pub struct Virtual { |
| 2618 | 2616 | #[serde(rename = "virtual")] |
| @@ -2637,11 +2635,22 @@ pub struct Yield { | ||
| 2637 | 2635 | pub yield_yield: i64, |
| 2638 | 2636 | } |
| 2639 | 2637 | |
| 2638 | +#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 2639 | +pub struct Unowned { | |
| 2640 | + pub unowned: i64, | |
| 2641 | +} | |
| 2642 | + | |
| 2640 | 2643 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 2641 | 2644 | pub struct Unsigned { |
| 2642 | 2645 | pub unsigned: i64, |
| 2643 | 2646 | } |
| 2644 | 2647 | |
| 2648 | +#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 2649 | +#[serde(rename_all = "PascalCase")] | |
| 2650 | +pub struct UseSerializers { | |
| 2651 | + pub use_serializers: i64, | |
| 2652 | +} | |
| 2653 | + | |
| 2645 | 2654 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 2646 | 2655 | pub struct Ushort { |
| 2647 | 2656 | pub ushort: i64, |
Mscala3-upickledefault / TopLevel.scala+42 −37
| @@ -807,6 +807,7 @@ case class Obj3 ( | ||
| 807 | 807 | val Locale : Locale, |
| 808 | 808 | val lock : Lock, |
| 809 | 809 | val long : LongClass, |
| 810 | + val makeDictEncoder : MakeDictEncoder, | |
| 810 | 811 | val map : MapClass, |
| 811 | 812 | val MapEntry : MapEntry, |
| 812 | 813 | val MarshalJSON : MarshalJSON, |
| @@ -817,8 +818,6 @@ case class Obj3 ( | ||
| 817 | 818 | val namespace : Namespace, |
| 818 | 819 | val native : Native, |
| 819 | 820 | val newtonsoft : Newtonsoft, |
| 820 | - val nil : Nil, | |
| 821 | - val NO : No, | |
| 822 | 821 | val `if` : If, |
| 823 | 822 | val `implicit` : Implicit, |
| 824 | 823 | val `import` : Import, |
| @@ -1019,6 +1018,10 @@ case class LongClass ( | ||
| 1019 | 1018 | val long : Long |
| 1020 | 1019 | ) derives OptionPickler.ReadWriter |
| 1021 | 1020 | |
| 1021 | +case class MakeDictEncoder ( | |
| 1022 | + val makeDictEncoder : Long | |
| 1023 | +) derives OptionPickler.ReadWriter | |
| 1024 | + | |
| 1022 | 1025 | case class MapClass ( |
| 1023 | 1026 | val map : Long |
| 1024 | 1027 | ) derives OptionPickler.ReadWriter |
| @@ -1059,14 +1062,6 @@ case class Newtonsoft ( | ||
| 1059 | 1062 | val newtonsoft : Long |
| 1060 | 1063 | ) derives OptionPickler.ReadWriter |
| 1061 | 1064 | |
| 1062 | -case class Nil ( | |
| 1063 | - val nil : Long | |
| 1064 | -) derives OptionPickler.ReadWriter | |
| 1065 | - | |
| 1066 | -case class No ( | |
| 1067 | - val NO : Long | |
| 1068 | -) derives OptionPickler.ReadWriter | |
| 1069 | - | |
| 1070 | 1065 | case class If ( |
| 1071 | 1066 | val `if` : Long |
| 1072 | 1067 | ) derives OptionPickler.ReadWriter |
| @@ -1089,6 +1084,8 @@ case class New ( | ||
| 1089 | 1084 | |
| 1090 | 1085 | case class Obj4 ( |
| 1091 | 1086 | val dummy : Long, |
| 1087 | + val nil : Nil, | |
| 1088 | + val NO : No, | |
| 1092 | 1089 | val noSuchMethod : NoSuchMethod, |
| 1093 | 1090 | val noexcept : Noexcept, |
| 1094 | 1091 | val nonatomic : Nonatomic, |
| @@ -1112,7 +1109,6 @@ case class Obj4 ( | ||
| 1112 | 1109 | val `protected` : Protected, |
| 1113 | 1110 | val protocol : ProtocolClass, |
| 1114 | 1111 | val `return` : Return, |
| 1115 | - val `sealed` : Sealed, | |
| 1116 | 1112 | val ObjectMapper : ObjectMapper, |
| 1117 | 1113 | val of : Of, |
| 1118 | 1114 | val oneway : Oneway, |
| @@ -1151,8 +1147,15 @@ case class Obj4 ( | ||
| 1151 | 1147 | val right : Right, |
| 1152 | 1148 | val runtimeType : RuntimeType, |
| 1153 | 1149 | val s : S, |
| 1154 | - val sbyte : Sbyte, | |
| 1155 | - val SEL : Sel | |
| 1150 | + val sbyte : Sbyte | |
| 1151 | +) derives OptionPickler.ReadWriter | |
| 1152 | + | |
| 1153 | +case class Nil ( | |
| 1154 | + val nil : Long | |
| 1155 | +) derives OptionPickler.ReadWriter | |
| 1156 | + | |
| 1157 | +case class No ( | |
| 1158 | + val NO : Long | |
| 1156 | 1159 | ) derives OptionPickler.ReadWriter |
| 1157 | 1160 | |
| 1158 | 1161 | case class NoSuchMethod ( |
| @@ -1247,10 +1250,6 @@ case class Return ( | ||
| 1247 | 1250 | val `return` : Long |
| 1248 | 1251 | ) derives OptionPickler.ReadWriter |
| 1249 | 1252 | |
| 1250 | -case class Sealed ( | |
| 1251 | - val `sealed` : Long | |
| 1252 | -) derives OptionPickler.ReadWriter | |
| 1253 | - | |
| 1254 | 1253 | case class ObjectMapper ( |
| 1255 | 1254 | val ObjectMapper : Long |
| 1256 | 1255 | ) derives OptionPickler.ReadWriter |
| @@ -1407,13 +1406,10 @@ case class Sbyte ( | ||
| 1407 | 1406 | val sbyte : Long |
| 1408 | 1407 | ) derives OptionPickler.ReadWriter |
| 1409 | 1408 | |
| 1410 | -case class Sel ( | |
| 1411 | - val SEL : Long | |
| 1412 | -) derives OptionPickler.ReadWriter | |
| 1413 | - | |
| 1414 | 1409 | case class Obj5 ( |
| 1415 | 1410 | val dummy : Long, |
| 1416 | 1411 | val KSerializer : KSerializer, |
| 1412 | + val `sealed` : Sealed, | |
| 1417 | 1413 | val self : SelfClass, |
| 1418 | 1414 | val `super` : Super, |
| 1419 | 1415 | val `then` : Then, |
| @@ -1425,6 +1421,7 @@ case class Obj5 ( | ||
| 1425 | 1421 | val PrimitiveKind : PrimitiveKind, |
| 1426 | 1422 | val `true` : TrueClass, |
| 1427 | 1423 | val `type` : TypeClass, |
| 1424 | + val SEL : Sel, | |
| 1428 | 1425 | val select : Select, |
| 1429 | 1426 | val Self : Self, |
| 1430 | 1427 | val Sendable : Sendable, |
| @@ -1476,16 +1473,17 @@ case class Obj5 ( | ||
| 1476 | 1473 | val unchecked : Unchecked, |
| 1477 | 1474 | val undefined : Undefined, |
| 1478 | 1475 | val union : Union, |
| 1479 | - val UnmarshalJSON : UnmarshalJSON, | |
| 1480 | - val unowned : Unowned, | |
| 1481 | - val unsafe : Unsafe, | |
| 1482 | - val UseSerializers : UseSerializers | |
| 1476 | + val UnmarshalJSON : UnmarshalJSON | |
| 1483 | 1477 | ) derives OptionPickler.ReadWriter |
| 1484 | 1478 | |
| 1485 | 1479 | case class KSerializer ( |
| 1486 | 1480 | val KSerializer : Long |
| 1487 | 1481 | ) derives OptionPickler.ReadWriter |
| 1488 | 1482 | |
| 1483 | +case class Sealed ( | |
| 1484 | + val `sealed` : Long | |
| 1485 | +) derives OptionPickler.ReadWriter | |
| 1486 | + | |
| 1489 | 1487 | case class SelfClass ( |
| 1490 | 1488 | val self : Long |
| 1491 | 1489 | ) derives OptionPickler.ReadWriter |
| @@ -1530,6 +1528,10 @@ case class TypeClass ( | ||
| 1530 | 1528 | val `type` : Long |
| 1531 | 1529 | ) derives OptionPickler.ReadWriter |
| 1532 | 1530 | |
| 1531 | +case class Sel ( | |
| 1532 | + val SEL : Long | |
| 1533 | +) derives OptionPickler.ReadWriter | |
| 1534 | + | |
| 1533 | 1535 | case class Select ( |
| 1534 | 1536 | val select : Long |
| 1535 | 1537 | ) derives OptionPickler.ReadWriter |
| @@ -1732,25 +1734,16 @@ case class UnmarshalJSON ( | ||
| 1732 | 1734 | val UnmarshalJSON : Long |
| 1733 | 1735 | ) derives OptionPickler.ReadWriter |
| 1734 | 1736 | |
| 1735 | -case class Unowned ( | |
| 1736 | - val unowned : Long | |
| 1737 | -) derives OptionPickler.ReadWriter | |
| 1738 | - | |
| 1739 | -case class Unsafe ( | |
| 1740 | - val unsafe : Long | |
| 1741 | -) derives OptionPickler.ReadWriter | |
| 1742 | - | |
| 1743 | -case class UseSerializers ( | |
| 1744 | - val UseSerializers : Long | |
| 1745 | -) derives OptionPickler.ReadWriter | |
| 1746 | - | |
| 1747 | 1737 | case class Obj6 ( |
| 1748 | 1738 | val dummy : Long, |
| 1749 | 1739 | val `var` : Var, |
| 1750 | 1740 | val `while` : While, |
| 1751 | 1741 | val `with` : With, |
| 1752 | 1742 | val `yield` : Yield, |
| 1743 | + val unowned : Unowned, | |
| 1744 | + val unsafe : Unsafe, | |
| 1753 | 1745 | val unsigned : Unsigned, |
| 1746 | + val UseSerializers : UseSerializers, | |
| 1754 | 1747 | val ushort : Ushort, |
| 1755 | 1748 | val using : Using, |
| 1756 | 1749 | val Utf8JsonReader : Utf8JSONReader, |
| @@ -1784,10 +1777,22 @@ case class Yield ( | ||
| 1784 | 1777 | val `yield` : Long |
| 1785 | 1778 | ) derives OptionPickler.ReadWriter |
| 1786 | 1779 | |
| 1780 | +case class Unowned ( | |
| 1781 | + val unowned : Long | |
| 1782 | +) derives OptionPickler.ReadWriter | |
| 1783 | + | |
| 1784 | +case class Unsafe ( | |
| 1785 | + val unsafe : Long | |
| 1786 | +) derives OptionPickler.ReadWriter | |
| 1787 | + | |
| 1787 | 1788 | case class Unsigned ( |
| 1788 | 1789 | val unsigned : Long |
| 1789 | 1790 | ) derives OptionPickler.ReadWriter |
| 1790 | 1791 | |
| 1792 | +case class UseSerializers ( | |
| 1793 | + val UseSerializers : Long | |
| 1794 | +) derives OptionPickler.ReadWriter | |
| 1795 | + | |
| 1791 | 1796 | case class Ushort ( |
| 1792 | 1797 | val ushort : Long |
| 1793 | 1798 | ) derives OptionPickler.ReadWriter |
Mscala3default / TopLevel.scala+42 −37
| @@ -757,6 +757,7 @@ case class Obj3 ( | ||
| 757 | 757 | val Locale : Locale, |
| 758 | 758 | val lock : Lock, |
| 759 | 759 | val long : LongClass, |
| 760 | + val makeDictEncoder : MakeDictEncoder, | |
| 760 | 761 | val map : MapClass, |
| 761 | 762 | val MapEntry : MapEntry, |
| 762 | 763 | val MarshalJSON : MarshalJSON, |
| @@ -767,8 +768,6 @@ case class Obj3 ( | ||
| 767 | 768 | val namespace : Namespace, |
| 768 | 769 | val native : Native, |
| 769 | 770 | val newtonsoft : Newtonsoft, |
| 770 | - val nil : Nil, | |
| 771 | - val NO : No, | |
| 772 | 771 | val `if` : If, |
| 773 | 772 | val `implicit` : Implicit, |
| 774 | 773 | val `import` : Import, |
| @@ -986,6 +985,10 @@ case class LongClass ( | ||
| 986 | 985 | val long : Long |
| 987 | 986 | ) derives Encoder.AsObject, Decoder |
| 988 | 987 | |
| 988 | +case class MakeDictEncoder ( | |
| 989 | + val makeDictEncoder : Long | |
| 990 | +) derives Encoder.AsObject, Decoder | |
| 991 | + | |
| 989 | 992 | case class MapClass ( |
| 990 | 993 | val map : Long |
| 991 | 994 | ) derives Encoder.AsObject, Decoder |
| @@ -1026,14 +1029,6 @@ case class Newtonsoft ( | ||
| 1026 | 1029 | val newtonsoft : Long |
| 1027 | 1030 | ) derives Encoder.AsObject, Decoder |
| 1028 | 1031 | |
| 1029 | -case class Nil ( | |
| 1030 | - val nil : Long | |
| 1031 | -) derives Encoder.AsObject, Decoder | |
| 1032 | - | |
| 1033 | -case class No ( | |
| 1034 | - val NO : Long | |
| 1035 | -) derives Encoder.AsObject, Decoder | |
| 1036 | - | |
| 1037 | 1032 | case class If ( |
| 1038 | 1033 | val `if` : Long |
| 1039 | 1034 | ) derives Encoder.AsObject, Decoder |
| @@ -1056,6 +1051,8 @@ case class New ( | ||
| 1056 | 1051 | |
| 1057 | 1052 | case class Obj4 ( |
| 1058 | 1053 | val dummy : Long, |
| 1054 | + val nil : Nil, | |
| 1055 | + val NO : No, | |
| 1059 | 1056 | val noSuchMethod : NoSuchMethod, |
| 1060 | 1057 | val noexcept : Noexcept, |
| 1061 | 1058 | val nonatomic : Nonatomic, |
| @@ -1079,7 +1076,6 @@ case class Obj4 ( | ||
| 1079 | 1076 | val `protected` : Protected, |
| 1080 | 1077 | val protocol : ProtocolClass, |
| 1081 | 1078 | val `return` : Return, |
| 1082 | - val `sealed` : Sealed, | |
| 1083 | 1079 | val ObjectMapper : ObjectMapper, |
| 1084 | 1080 | val of : Of, |
| 1085 | 1081 | val oneway : Oneway, |
| @@ -1118,8 +1114,15 @@ case class Obj4 ( | ||
| 1118 | 1114 | val right : Right, |
| 1119 | 1115 | val runtimeType : RuntimeType, |
| 1120 | 1116 | val s : S, |
| 1121 | - val sbyte : Sbyte, | |
| 1122 | - val SEL : Sel | |
| 1117 | + val sbyte : Sbyte | |
| 1118 | +) derives Encoder.AsObject, Decoder | |
| 1119 | + | |
| 1120 | +case class Nil ( | |
| 1121 | + val nil : Long | |
| 1122 | +) derives Encoder.AsObject, Decoder | |
| 1123 | + | |
| 1124 | +case class No ( | |
| 1125 | + val NO : Long | |
| 1123 | 1126 | ) derives Encoder.AsObject, Decoder |
| 1124 | 1127 | |
| 1125 | 1128 | case class NoSuchMethod ( |
| @@ -1214,10 +1217,6 @@ case class Return ( | ||
| 1214 | 1217 | val `return` : Long |
| 1215 | 1218 | ) derives Encoder.AsObject, Decoder |
| 1216 | 1219 | |
| 1217 | -case class Sealed ( | |
| 1218 | - val `sealed` : Long | |
| 1219 | -) derives Encoder.AsObject, Decoder | |
| 1220 | - | |
| 1221 | 1220 | case class ObjectMapper ( |
| 1222 | 1221 | val ObjectMapper : Long |
| 1223 | 1222 | ) derives Encoder.AsObject, Decoder |
| @@ -1374,13 +1373,10 @@ case class Sbyte ( | ||
| 1374 | 1373 | val sbyte : Long |
| 1375 | 1374 | ) derives Encoder.AsObject, Decoder |
| 1376 | 1375 | |
| 1377 | -case class Sel ( | |
| 1378 | - val SEL : Long | |
| 1379 | -) derives Encoder.AsObject, Decoder | |
| 1380 | - | |
| 1381 | 1376 | case class Obj5 ( |
| 1382 | 1377 | val dummy : Long, |
| 1383 | 1378 | val KSerializer : KSerializer, |
| 1379 | + val `sealed` : Sealed, | |
| 1384 | 1380 | val self : SelfClass, |
| 1385 | 1381 | val `super` : Super, |
| 1386 | 1382 | val `then` : Then, |
| @@ -1392,6 +1388,7 @@ case class Obj5 ( | ||
| 1392 | 1388 | val PrimitiveKind : PrimitiveKind, |
| 1393 | 1389 | val `true` : TrueClass, |
| 1394 | 1390 | val `type` : TypeClass, |
| 1391 | + val SEL : Sel, | |
| 1395 | 1392 | val select : Select, |
| 1396 | 1393 | val Self : Self, |
| 1397 | 1394 | val Sendable : Sendable, |
| @@ -1441,10 +1438,7 @@ case class Obj5 ( | ||
| 1441 | 1438 | val unchecked : Unchecked, |
| 1442 | 1439 | val undefined : Undefined, |
| 1443 | 1440 | val union : Union, |
| 1444 | - val UnmarshalJSON : UnmarshalJSON, | |
| 1445 | - val unowned : Unowned, | |
| 1446 | - val unsafe : Unsafe, | |
| 1447 | - val UseSerializers : UseSerializers | |
| 1441 | + val UnmarshalJSON : UnmarshalJSON | |
| 1448 | 1442 | ) |
| 1449 | 1443 | |
| 1450 | 1444 | object Obj5: |
| @@ -1461,6 +1455,10 @@ case class KSerializer ( | ||
| 1461 | 1455 | val KSerializer : Long |
| 1462 | 1456 | ) derives Encoder.AsObject, Decoder |
| 1463 | 1457 | |
| 1458 | +case class Sealed ( | |
| 1459 | + val `sealed` : Long | |
| 1460 | +) derives Encoder.AsObject, Decoder | |
| 1461 | + | |
| 1464 | 1462 | case class SelfClass ( |
| 1465 | 1463 | val self : Long |
| 1466 | 1464 | ) derives Encoder.AsObject, Decoder |
| @@ -1505,6 +1503,10 @@ case class TypeClass ( | ||
| 1505 | 1503 | val `type` : Long |
| 1506 | 1504 | ) derives Encoder.AsObject, Decoder |
| 1507 | 1505 | |
| 1506 | +case class Sel ( | |
| 1507 | + val SEL : Long | |
| 1508 | +) derives Encoder.AsObject, Decoder | |
| 1509 | + | |
| 1508 | 1510 | case class Select ( |
| 1509 | 1511 | val select : Long |
| 1510 | 1512 | ) derives Encoder.AsObject, Decoder |
| @@ -1723,25 +1725,16 @@ case class UnmarshalJSON ( | ||
| 1723 | 1725 | val UnmarshalJSON : Long |
| 1724 | 1726 | ) derives Encoder.AsObject, Decoder |
| 1725 | 1727 | |
| 1726 | -case class Unowned ( | |
| 1727 | - val unowned : Long | |
| 1728 | -) derives Encoder.AsObject, Decoder | |
| 1729 | - | |
| 1730 | -case class Unsafe ( | |
| 1731 | - val unsafe : Long | |
| 1732 | -) derives Encoder.AsObject, Decoder | |
| 1733 | - | |
| 1734 | -case class UseSerializers ( | |
| 1735 | - val UseSerializers : Long | |
| 1736 | -) derives Encoder.AsObject, Decoder | |
| 1737 | - | |
| 1738 | 1728 | case class Obj6 ( |
| 1739 | 1729 | val dummy : Long, |
| 1740 | 1730 | val `var` : Var, |
| 1741 | 1731 | val `while` : While, |
| 1742 | 1732 | val `with` : With, |
| 1743 | 1733 | val `yield` : Yield, |
| 1734 | + val unowned : Unowned, | |
| 1735 | + val unsafe : Unsafe, | |
| 1744 | 1736 | val unsigned : Unsigned, |
| 1737 | + val UseSerializers : UseSerializers, | |
| 1745 | 1738 | val ushort : Ushort, |
| 1746 | 1739 | val using : Using, |
| 1747 | 1740 | val Utf8JsonReader : Utf8JSONReader, |
| @@ -1775,10 +1768,22 @@ case class Yield ( | ||
| 1775 | 1768 | val `yield` : Long |
| 1776 | 1769 | ) derives Encoder.AsObject, Decoder |
| 1777 | 1770 | |
| 1771 | +case class Unowned ( | |
| 1772 | + val unowned : Long | |
| 1773 | +) derives Encoder.AsObject, Decoder | |
| 1774 | + | |
| 1775 | +case class Unsafe ( | |
| 1776 | + val unsafe : Long | |
| 1777 | +) derives Encoder.AsObject, Decoder | |
| 1778 | + | |
| 1778 | 1779 | case class Unsigned ( |
| 1779 | 1780 | val unsigned : Long |
| 1780 | 1781 | ) derives Encoder.AsObject, Decoder |
| 1781 | 1782 | |
| 1783 | +case class UseSerializers ( | |
| 1784 | + val UseSerializers : Long | |
| 1785 | +) derives Encoder.AsObject, Decoder | |
| 1786 | + | |
| 1782 | 1787 | case class Ushort ( |
| 1783 | 1788 | val ushort : Long |
| 1784 | 1789 | ) derives Encoder.AsObject, Decoder |
Mswiftdefault / quicktype.swift+390 −342
| @@ -6351,6 +6351,7 @@ struct Obj3: Codable { | ||
| 6351 | 6351 | let locale: LocaleClass |
| 6352 | 6352 | let lock: Lock |
| 6353 | 6353 | let long: Long |
| 6354 | + let makeDictEncoder: MakeDictEncoder | |
| 6354 | 6355 | let map: Map |
| 6355 | 6356 | let mapEntry: MapEntry |
| 6356 | 6357 | let marshalJSON: MarshalJSON |
| @@ -6361,7 +6362,6 @@ struct Obj3: Codable { | ||
| 6361 | 6362 | let native: Native |
| 6362 | 6363 | let new: New |
| 6363 | 6364 | let newtonsoft: Newtonsoft |
| 6364 | - let no: No | |
| 6365 | 6365 | let obj3Guard: Guard |
| 6366 | 6366 | let obj3If: If |
| 6367 | 6367 | let obj3Import: Import |
| @@ -6377,7 +6377,6 @@ struct Obj3: Codable { | ||
| 6377 | 6377 | let obj3Left: Left |
| 6378 | 6378 | let obj3Let: Let |
| 6379 | 6379 | let obj3Mutating: Mutating |
| 6380 | - let obj3Nil: Nil | |
| 6381 | 6380 | |
| 6382 | 6381 | enum CodingKeys: String, CodingKey { |
| 6383 | 6382 | case dummy = "dummy" |
| @@ -6419,6 +6418,7 @@ struct Obj3: Codable { | ||
| 6419 | 6418 | case locale = "Locale" |
| 6420 | 6419 | case lock = "lock" |
| 6421 | 6420 | case long = "long" |
| 6421 | + case makeDictEncoder = "makeDictEncoder" | |
| 6422 | 6422 | case map = "map" |
| 6423 | 6423 | case mapEntry = "MapEntry" |
| 6424 | 6424 | case marshalJSON = "MarshalJSON" |
| @@ -6429,7 +6429,6 @@ struct Obj3: Codable { | ||
| 6429 | 6429 | case native = "native" |
| 6430 | 6430 | case new = "new" |
| 6431 | 6431 | case newtonsoft = "newtonsoft" |
| 6432 | - case no = "NO" | |
| 6433 | 6432 | case obj3Guard = "guard" |
| 6434 | 6433 | case obj3If = "if" |
| 6435 | 6434 | case obj3Import = "import" |
| @@ -6445,7 +6444,6 @@ struct Obj3: Codable { | ||
| 6445 | 6444 | case obj3Left = "left" |
| 6446 | 6445 | case obj3Let = "let" |
| 6447 | 6446 | case obj3Mutating = "mutating" |
| 6448 | - case obj3Nil = "nil" | |
| 6449 | 6447 | } |
| 6450 | 6448 | } |
| 6451 | 6449 | |
| @@ -6507,6 +6505,7 @@ extension Obj3 { | ||
| 6507 | 6505 | locale: LocaleClass? = nil, |
| 6508 | 6506 | lock: Lock? = nil, |
| 6509 | 6507 | long: Long? = nil, |
| 6508 | + makeDictEncoder: MakeDictEncoder? = nil, | |
| 6510 | 6509 | map: Map? = nil, |
| 6511 | 6510 | mapEntry: MapEntry? = nil, |
| 6512 | 6511 | marshalJSON: MarshalJSON? = nil, |
| @@ -6517,7 +6516,6 @@ extension Obj3 { | ||
| 6517 | 6516 | native: Native? = nil, |
| 6518 | 6517 | new: New? = nil, |
| 6519 | 6518 | newtonsoft: Newtonsoft? = nil, |
| 6520 | - no: No? = nil, | |
| 6521 | 6519 | obj3Guard: Guard? = nil, |
| 6522 | 6520 | obj3If: If? = nil, |
| 6523 | 6521 | obj3Import: Import? = nil, |
| @@ -6532,8 +6530,7 @@ extension Obj3 { | ||
| 6532 | 6530 | obj3Lazy: Lazy? = nil, |
| 6533 | 6531 | obj3Left: Left? = nil, |
| 6534 | 6532 | obj3Let: Let? = nil, |
| 6535 | - obj3Mutating: Mutating? = nil, | |
| 6536 | - obj3Nil: Nil? = nil | |
| 6533 | + obj3Mutating: Mutating? = nil | |
| 6537 | 6534 | ) -> Obj3 { |
| 6538 | 6535 | return Obj3( |
| 6539 | 6536 | dummy: dummy ?? self.dummy, |
| @@ -6575,6 +6572,7 @@ extension Obj3 { | ||
| 6575 | 6572 | locale: locale ?? self.locale, |
| 6576 | 6573 | lock: lock ?? self.lock, |
| 6577 | 6574 | long: long ?? self.long, |
| 6575 | + makeDictEncoder: makeDictEncoder ?? self.makeDictEncoder, | |
| 6578 | 6576 | map: map ?? self.map, |
| 6579 | 6577 | mapEntry: mapEntry ?? self.mapEntry, |
| 6580 | 6578 | marshalJSON: marshalJSON ?? self.marshalJSON, |
| @@ -6585,7 +6583,6 @@ extension Obj3 { | ||
| 6585 | 6583 | native: native ?? self.native, |
| 6586 | 6584 | new: new ?? self.new, |
| 6587 | 6585 | newtonsoft: newtonsoft ?? self.newtonsoft, |
| 6588 | - no: no ?? self.no, | |
| 6589 | 6586 | obj3Guard: obj3Guard ?? self.obj3Guard, |
| 6590 | 6587 | obj3If: obj3If ?? self.obj3If, |
| 6591 | 6588 | obj3Import: obj3Import ?? self.obj3Import, |
| @@ -6600,8 +6597,7 @@ extension Obj3 { | ||
| 6600 | 6597 | obj3Lazy: obj3Lazy ?? self.obj3Lazy, |
| 6601 | 6598 | obj3Left: obj3Left ?? self.obj3Left, |
| 6602 | 6599 | obj3Let: obj3Let ?? self.obj3Let, |
| 6603 | - obj3Mutating: obj3Mutating ?? self.obj3Mutating, | |
| 6604 | - obj3Nil: obj3Nil ?? self.obj3Nil | |
| 6600 | + obj3Mutating: obj3Mutating ?? self.obj3Mutating | |
| 6605 | 6601 | ) |
| 6606 | 6602 | } |
| 6607 | 6603 | |
| @@ -8286,6 +8282,50 @@ extension Long { | ||
| 8286 | 8282 | } |
| 8287 | 8283 | } |
| 8288 | 8284 | |
| 8285 | +// MARK: - MakeDictEncoder | |
| 8286 | +struct MakeDictEncoder: Codable { | |
| 8287 | + let makeDictEncoder: Int | |
| 8288 | + | |
| 8289 | + enum CodingKeys: String, CodingKey { | |
| 8290 | + case makeDictEncoder = "makeDictEncoder" | |
| 8291 | + } | |
| 8292 | +} | |
| 8293 | + | |
| 8294 | +// MARK: MakeDictEncoder convenience initializers and mutators | |
| 8295 | + | |
| 8296 | +extension MakeDictEncoder { | |
| 8297 | + init(data: Data) throws { | |
| 8298 | + self = try newJSONDecoder().decode(MakeDictEncoder.self, from: data) | |
| 8299 | + } | |
| 8300 | + | |
| 8301 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 8302 | + guard let data = json.data(using: encoding) else { | |
| 8303 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 8304 | + } | |
| 8305 | + try self.init(data: data) | |
| 8306 | + } | |
| 8307 | + | |
| 8308 | + init(fromURL url: URL) throws { | |
| 8309 | + try self.init(data: try Data(contentsOf: url)) | |
| 8310 | + } | |
| 8311 | + | |
| 8312 | + func with( | |
| 8313 | + makeDictEncoder: Int? = nil | |
| 8314 | + ) -> MakeDictEncoder { | |
| 8315 | + return MakeDictEncoder( | |
| 8316 | + makeDictEncoder: makeDictEncoder ?? self.makeDictEncoder | |
| 8317 | + ) | |
| 8318 | + } | |
| 8319 | + | |
| 8320 | + func jsonData() throws -> Data { | |
| 8321 | + return try newJSONEncoder().encode(self) | |
| 8322 | + } | |
| 8323 | + | |
| 8324 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 8325 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 8326 | + } | |
| 8327 | +} | |
| 8328 | + | |
| 8289 | 8329 | // MARK: - Map |
| 8290 | 8330 | struct Map: Codable { |
| 8291 | 8331 | let map: Int |
| @@ -8726,50 +8766,6 @@ extension Newtonsoft { | ||
| 8726 | 8766 | } |
| 8727 | 8767 | } |
| 8728 | 8768 | |
| 8729 | -// MARK: - No | |
| 8730 | -struct No: Codable { | |
| 8731 | - let no: Int | |
| 8732 | - | |
| 8733 | - enum CodingKeys: String, CodingKey { | |
| 8734 | - case no = "NO" | |
| 8735 | - } | |
| 8736 | -} | |
| 8737 | - | |
| 8738 | -// MARK: No convenience initializers and mutators | |
| 8739 | - | |
| 8740 | -extension No { | |
| 8741 | - init(data: Data) throws { | |
| 8742 | - self = try newJSONDecoder().decode(No.self, from: data) | |
| 8743 | - } | |
| 8744 | - | |
| 8745 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 8746 | - guard let data = json.data(using: encoding) else { | |
| 8747 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 8748 | - } | |
| 8749 | - try self.init(data: data) | |
| 8750 | - } | |
| 8751 | - | |
| 8752 | - init(fromURL url: URL) throws { | |
| 8753 | - try self.init(data: try Data(contentsOf: url)) | |
| 8754 | - } | |
| 8755 | - | |
| 8756 | - func with( | |
| 8757 | - no: Int? = nil | |
| 8758 | - ) -> No { | |
| 8759 | - return No( | |
| 8760 | - no: no ?? self.no | |
| 8761 | - ) | |
| 8762 | - } | |
| 8763 | - | |
| 8764 | - func jsonData() throws -> Data { | |
| 8765 | - return try newJSONEncoder().encode(self) | |
| 8766 | - } | |
| 8767 | - | |
| 8768 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 8769 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 8770 | - } | |
| 8771 | -} | |
| 8772 | - | |
| 8773 | 8769 | // MARK: - Guard |
| 8774 | 8770 | struct Guard: Codable { |
| 8775 | 8771 | let guardGuard: Int |
| @@ -9430,53 +9426,10 @@ extension Mutating { | ||
| 9430 | 9426 | } |
| 9431 | 9427 | } |
| 9432 | 9428 | |
| 9433 | -// MARK: - Nil | |
| 9434 | -struct Nil: Codable { | |
| 9435 | - let nilNil: Int | |
| 9436 | - | |
| 9437 | - enum CodingKeys: String, CodingKey { | |
| 9438 | - case nilNil = "nil" | |
| 9439 | - } | |
| 9440 | -} | |
| 9441 | - | |
| 9442 | -// MARK: Nil convenience initializers and mutators | |
| 9443 | - | |
| 9444 | -extension Nil { | |
| 9445 | - init(data: Data) throws { | |
| 9446 | - self = try newJSONDecoder().decode(Nil.self, from: data) | |
| 9447 | - } | |
| 9448 | - | |
| 9449 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 9450 | - guard let data = json.data(using: encoding) else { | |
| 9451 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 9452 | - } | |
| 9453 | - try self.init(data: data) | |
| 9454 | - } | |
| 9455 | - | |
| 9456 | - init(fromURL url: URL) throws { | |
| 9457 | - try self.init(data: try Data(contentsOf: url)) | |
| 9458 | - } | |
| 9459 | - | |
| 9460 | - func with( | |
| 9461 | - nilNil: Int? = nil | |
| 9462 | - ) -> Nil { | |
| 9463 | - return Nil( | |
| 9464 | - nilNil: nilNil ?? self.nilNil | |
| 9465 | - ) | |
| 9466 | - } | |
| 9467 | - | |
| 9468 | - func jsonData() throws -> Data { | |
| 9469 | - return try newJSONEncoder().encode(self) | |
| 9470 | - } | |
| 9471 | - | |
| 9472 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 9473 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 9474 | - } | |
| 9475 | -} | |
| 9476 | - | |
| 9477 | 9429 | // MARK: - Obj4 |
| 9478 | 9430 | struct Obj4: Codable { |
| 9479 | 9431 | let dummy: Int |
| 9432 | + let no: No | |
| 9480 | 9433 | let noSuchMethod: NoSuchMethod |
| 9481 | 9434 | let noexcept: Noexcept |
| 9482 | 9435 | let nonatomic: Nonatomic |
| @@ -9490,6 +9443,7 @@ struct Obj4: Codable { | ||
| 9490 | 9443 | let null: Null |
| 9491 | 9444 | let nullptr: Nullptr |
| 9492 | 9445 | let number: Number |
| 9446 | + let obj4Nil: Nil | |
| 9493 | 9447 | let obj4None: NoneClass |
| 9494 | 9448 | let obj4Nonmutating: Nonmutating |
| 9495 | 9449 | let obj4Null: NullClass |
| @@ -9539,11 +9493,10 @@ struct Obj4: Codable { | ||
| 9539 | 9493 | let runtimeType: RuntimeType |
| 9540 | 9494 | let s: S |
| 9541 | 9495 | let sbyte: Sbyte |
| 9542 | - let sealed: Sealed | |
| 9543 | - let sel: Sel | |
| 9544 | 9496 | |
| 9545 | 9497 | enum CodingKeys: String, CodingKey { |
| 9546 | 9498 | case dummy = "dummy" |
| 9499 | + case no = "NO" | |
| 9547 | 9500 | case noSuchMethod = "noSuchMethod" |
| 9548 | 9501 | case noexcept = "noexcept" |
| 9549 | 9502 | case nonatomic = "nonatomic" |
| @@ -9557,6 +9510,7 @@ struct Obj4: Codable { | ||
| 9557 | 9510 | case null = "NULL" |
| 9558 | 9511 | case nullptr = "nullptr" |
| 9559 | 9512 | case number = "number" |
| 9513 | + case obj4Nil = "nil" | |
| 9560 | 9514 | case obj4None = "none" |
| 9561 | 9515 | case obj4Nonmutating = "nonmutating" |
| 9562 | 9516 | case obj4Null = "null" |
| @@ -9606,8 +9560,6 @@ struct Obj4: Codable { | ||
| 9606 | 9560 | case runtimeType = "runtimeType" |
| 9607 | 9561 | case s = "s" |
| 9608 | 9562 | case sbyte = "sbyte" |
| 9609 | - case sealed = "sealed" | |
| 9610 | - case sel = "SEL" | |
| 9611 | 9563 | } |
| 9612 | 9564 | } |
| 9613 | 9565 | |
| @@ -9631,6 +9583,7 @@ extension Obj4 { | ||
| 9631 | 9583 | |
| 9632 | 9584 | func with( |
| 9633 | 9585 | dummy: Int? = nil, |
| 9586 | + no: No? = nil, | |
| 9634 | 9587 | noSuchMethod: NoSuchMethod? = nil, |
| 9635 | 9588 | noexcept: Noexcept? = nil, |
| 9636 | 9589 | nonatomic: Nonatomic? = nil, |
| @@ -9644,6 +9597,7 @@ extension Obj4 { | ||
| 9644 | 9597 | null: Null? = nil, |
| 9645 | 9598 | nullptr: Nullptr? = nil, |
| 9646 | 9599 | number: Number? = nil, |
| 9600 | + obj4Nil: Nil? = nil, | |
| 9647 | 9601 | obj4None: NoneClass? = nil, |
| 9648 | 9602 | obj4Nonmutating: Nonmutating? = nil, |
| 9649 | 9603 | obj4Null: NullClass? = nil, |
| @@ -9692,12 +9646,11 @@ extension Obj4 { | ||
| 9692 | 9646 | retain: Retain? = nil, |
| 9693 | 9647 | runtimeType: RuntimeType? = nil, |
| 9694 | 9648 | s: S? = nil, |
| 9695 | - sbyte: Sbyte? = nil, | |
| 9696 | - sealed: Sealed? = nil, | |
| 9697 | - sel: Sel? = nil | |
| 9649 | + sbyte: Sbyte? = nil | |
| 9698 | 9650 | ) -> Obj4 { |
| 9699 | 9651 | return Obj4( |
| 9700 | 9652 | dummy: dummy ?? self.dummy, |
| 9653 | + no: no ?? self.no, | |
| 9701 | 9654 | noSuchMethod: noSuchMethod ?? self.noSuchMethod, |
| 9702 | 9655 | noexcept: noexcept ?? self.noexcept, |
| 9703 | 9656 | nonatomic: nonatomic ?? self.nonatomic, |
| @@ -9711,6 +9664,7 @@ extension Obj4 { | ||
| 9711 | 9664 | null: null ?? self.null, |
| 9712 | 9665 | nullptr: nullptr ?? self.nullptr, |
| 9713 | 9666 | number: number ?? self.number, |
| 9667 | + obj4Nil: obj4Nil ?? self.obj4Nil, | |
| 9714 | 9668 | obj4None: obj4None ?? self.obj4None, |
| 9715 | 9669 | obj4Nonmutating: obj4Nonmutating ?? self.obj4Nonmutating, |
| 9716 | 9670 | obj4Null: obj4Null ?? self.obj4Null, |
| @@ -9759,9 +9713,51 @@ extension Obj4 { | ||
| 9759 | 9713 | retain: retain ?? self.retain, |
| 9760 | 9714 | runtimeType: runtimeType ?? self.runtimeType, |
| 9761 | 9715 | s: s ?? self.s, |
| 9762 | - sbyte: sbyte ?? self.sbyte, | |
| 9763 | - sealed: sealed ?? self.sealed, | |
| 9764 | - sel: sel ?? self.sel | |
| 9716 | + sbyte: sbyte ?? self.sbyte | |
| 9717 | + ) | |
| 9718 | + } | |
| 9719 | + | |
| 9720 | + func jsonData() throws -> Data { | |
| 9721 | + return try newJSONEncoder().encode(self) | |
| 9722 | + } | |
| 9723 | + | |
| 9724 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 9725 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 9726 | + } | |
| 9727 | +} | |
| 9728 | + | |
| 9729 | +// MARK: - No | |
| 9730 | +struct No: Codable { | |
| 9731 | + let no: Int | |
| 9732 | + | |
| 9733 | + enum CodingKeys: String, CodingKey { | |
| 9734 | + case no = "NO" | |
| 9735 | + } | |
| 9736 | +} | |
| 9737 | + | |
| 9738 | +// MARK: No convenience initializers and mutators | |
| 9739 | + | |
| 9740 | +extension No { | |
| 9741 | + init(data: Data) throws { | |
| 9742 | + self = try newJSONDecoder().decode(No.self, from: data) | |
| 9743 | + } | |
| 9744 | + | |
| 9745 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 9746 | + guard let data = json.data(using: encoding) else { | |
| 9747 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 9748 | + } | |
| 9749 | + try self.init(data: data) | |
| 9750 | + } | |
| 9751 | + | |
| 9752 | + init(fromURL url: URL) throws { | |
| 9753 | + try self.init(data: try Data(contentsOf: url)) | |
| 9754 | + } | |
| 9755 | + | |
| 9756 | + func with( | |
| 9757 | + no: Int? = nil | |
| 9758 | + ) -> No { | |
| 9759 | + return No( | |
| 9760 | + no: no ?? self.no | |
| 9765 | 9761 | ) |
| 9766 | 9762 | } |
| 9767 | 9763 | |
| @@ -10346,6 +10342,50 @@ extension Number { | ||
| 10346 | 10342 | } |
| 10347 | 10343 | } |
| 10348 | 10344 | |
| 10345 | +// MARK: - Nil | |
| 10346 | +struct Nil: Codable { | |
| 10347 | + let nilNil: Int | |
| 10348 | + | |
| 10349 | + enum CodingKeys: String, CodingKey { | |
| 10350 | + case nilNil = "nil" | |
| 10351 | + } | |
| 10352 | +} | |
| 10353 | + | |
| 10354 | +// MARK: Nil convenience initializers and mutators | |
| 10355 | + | |
| 10356 | +extension Nil { | |
| 10357 | + init(data: Data) throws { | |
| 10358 | + self = try newJSONDecoder().decode(Nil.self, from: data) | |
| 10359 | + } | |
| 10360 | + | |
| 10361 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 10362 | + guard let data = json.data(using: encoding) else { | |
| 10363 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 10364 | + } | |
| 10365 | + try self.init(data: data) | |
| 10366 | + } | |
| 10367 | + | |
| 10368 | + init(fromURL url: URL) throws { | |
| 10369 | + try self.init(data: try Data(contentsOf: url)) | |
| 10370 | + } | |
| 10371 | + | |
| 10372 | + func with( | |
| 10373 | + nilNil: Int? = nil | |
| 10374 | + ) -> Nil { | |
| 10375 | + return Nil( | |
| 10376 | + nilNil: nilNil ?? self.nilNil | |
| 10377 | + ) | |
| 10378 | + } | |
| 10379 | + | |
| 10380 | + func jsonData() throws -> Data { | |
| 10381 | + return try newJSONEncoder().encode(self) | |
| 10382 | + } | |
| 10383 | + | |
| 10384 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 10385 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 10386 | + } | |
| 10387 | +} | |
| 10388 | + | |
| 10349 | 10389 | // MARK: - NoneClass |
| 10350 | 10390 | struct NoneClass: Codable { |
| 10351 | 10391 | let none: Int |
| @@ -12502,94 +12542,6 @@ extension Sbyte { | ||
| 12502 | 12542 | } |
| 12503 | 12543 | } |
| 12504 | 12544 | |
| 12505 | -// MARK: - Sealed | |
| 12506 | -struct Sealed: Codable { | |
| 12507 | - let sealed: Int | |
| 12508 | - | |
| 12509 | - enum CodingKeys: String, CodingKey { | |
| 12510 | - case sealed = "sealed" | |
| 12511 | - } | |
| 12512 | -} | |
| 12513 | - | |
| 12514 | -// MARK: Sealed convenience initializers and mutators | |
| 12515 | - | |
| 12516 | -extension Sealed { | |
| 12517 | - init(data: Data) throws { | |
| 12518 | - self = try newJSONDecoder().decode(Sealed.self, from: data) | |
| 12519 | - } | |
| 12520 | - | |
| 12521 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 12522 | - guard let data = json.data(using: encoding) else { | |
| 12523 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 12524 | - } | |
| 12525 | - try self.init(data: data) | |
| 12526 | - } | |
| 12527 | - | |
| 12528 | - init(fromURL url: URL) throws { | |
| 12529 | - try self.init(data: try Data(contentsOf: url)) | |
| 12530 | - } | |
| 12531 | - | |
| 12532 | - func with( | |
| 12533 | - sealed: Int? = nil | |
| 12534 | - ) -> Sealed { | |
| 12535 | - return Sealed( | |
| 12536 | - sealed: sealed ?? self.sealed | |
| 12537 | - ) | |
| 12538 | - } | |
| 12539 | - | |
| 12540 | - func jsonData() throws -> Data { | |
| 12541 | - return try newJSONEncoder().encode(self) | |
| 12542 | - } | |
| 12543 | - | |
| 12544 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 12545 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 12546 | - } | |
| 12547 | -} | |
| 12548 | - | |
| 12549 | -// MARK: - Sel | |
| 12550 | -struct Sel: Codable { | |
| 12551 | - let sel: Int | |
| 12552 | - | |
| 12553 | - enum CodingKeys: String, CodingKey { | |
| 12554 | - case sel = "SEL" | |
| 12555 | - } | |
| 12556 | -} | |
| 12557 | - | |
| 12558 | -// MARK: Sel convenience initializers and mutators | |
| 12559 | - | |
| 12560 | -extension Sel { | |
| 12561 | - init(data: Data) throws { | |
| 12562 | - self = try newJSONDecoder().decode(Sel.self, from: data) | |
| 12563 | - } | |
| 12564 | - | |
| 12565 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 12566 | - guard let data = json.data(using: encoding) else { | |
| 12567 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 12568 | - } | |
| 12569 | - try self.init(data: data) | |
| 12570 | - } | |
| 12571 | - | |
| 12572 | - init(fromURL url: URL) throws { | |
| 12573 | - try self.init(data: try Data(contentsOf: url)) | |
| 12574 | - } | |
| 12575 | - | |
| 12576 | - func with( | |
| 12577 | - sel: Int? = nil | |
| 12578 | - ) -> Sel { | |
| 12579 | - return Sel( | |
| 12580 | - sel: sel ?? self.sel | |
| 12581 | - ) | |
| 12582 | - } | |
| 12583 | - | |
| 12584 | - func jsonData() throws -> Data { | |
| 12585 | - return try newJSONEncoder().encode(self) | |
| 12586 | - } | |
| 12587 | - | |
| 12588 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 12589 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 12590 | - } | |
| 12591 | -} | |
| 12592 | - | |
| 12593 | 12545 | // MARK: - Obj5 |
| 12594 | 12546 | struct Obj5: Codable { |
| 12595 | 12547 | let dummy: Int |
| @@ -12607,10 +12559,11 @@ struct Obj5: Codable { | ||
| 12607 | 12559 | let obj5Try: Try |
| 12608 | 12560 | let obj5Type: Obj5Type |
| 12609 | 12561 | let obj5Typealias: Typealias |
| 12610 | - let obj5Unowned: Unowned | |
| 12611 | 12562 | let primitiveKind: PrimitiveKind |
| 12612 | 12563 | let purpleSelf: Obj5Self |
| 12613 | 12564 | let purpleTrue: TrueClass |
| 12565 | + let sealed: Sealed | |
| 12566 | + let sel: Sel | |
| 12614 | 12567 | let select: Select |
| 12615 | 12568 | let sendable: Sendable |
| 12616 | 12569 | let serialDescriptor: SerialDescriptor |
| @@ -12656,8 +12609,6 @@ struct Obj5: Codable { | ||
| 12656 | 12609 | let undefined: Undefined |
| 12657 | 12610 | let union: Union |
| 12658 | 12611 | let unmarshalJSON: UnmarshalJSON |
| 12659 | - let unsafe: Unsafe | |
| 12660 | - let useSerializers: UseSerializers | |
| 12661 | 12612 | |
| 12662 | 12613 | enum CodingKeys: String, CodingKey { |
| 12663 | 12614 | case dummy = "dummy" |
| @@ -12675,10 +12626,11 @@ struct Obj5: Codable { | ||
| 12675 | 12626 | case obj5Try = "try" |
| 12676 | 12627 | case obj5Type = "type" |
| 12677 | 12628 | case obj5Typealias = "typealias" |
| 12678 | - case obj5Unowned = "unowned" | |
| 12679 | 12629 | case primitiveKind = "PrimitiveKind" |
| 12680 | 12630 | case purpleSelf = "self" |
| 12681 | 12631 | case purpleTrue = "true" |
| 12632 | + case sealed = "sealed" | |
| 12633 | + case sel = "SEL" | |
| 12682 | 12634 | case select = "select" |
| 12683 | 12635 | case sendable = "Sendable" |
| 12684 | 12636 | case serialDescriptor = "SerialDescriptor" |
| @@ -12724,8 +12676,6 @@ struct Obj5: Codable { | ||
| 12724 | 12676 | case undefined = "undefined" |
| 12725 | 12677 | case union = "union" |
| 12726 | 12678 | case unmarshalJSON = "UnmarshalJSON" |
| 12727 | - case unsafe = "unsafe" | |
| 12728 | - case useSerializers = "UseSerializers" | |
| 12729 | 12679 | } |
| 12730 | 12680 | } |
| 12731 | 12681 | |
| @@ -12763,10 +12713,11 @@ extension Obj5 { | ||
| 12763 | 12713 | obj5Try: Try? = nil, |
| 12764 | 12714 | obj5Type: Obj5Type? = nil, |
| 12765 | 12715 | obj5Typealias: Typealias? = nil, |
| 12766 | - obj5Unowned: Unowned? = nil, | |
| 12767 | 12716 | primitiveKind: PrimitiveKind? = nil, |
| 12768 | 12717 | purpleSelf: Obj5Self? = nil, |
| 12769 | 12718 | purpleTrue: TrueClass? = nil, |
| 12719 | + sealed: Sealed? = nil, | |
| 12720 | + sel: Sel? = nil, | |
| 12770 | 12721 | select: Select? = nil, |
| 12771 | 12722 | sendable: Sendable? = nil, |
| 12772 | 12723 | serialDescriptor: SerialDescriptor? = nil, |
| @@ -12811,9 +12762,7 @@ extension Obj5 { | ||
| 12811 | 12762 | unchecked: Unchecked? = nil, |
| 12812 | 12763 | undefined: Undefined? = nil, |
| 12813 | 12764 | union: Union? = nil, |
| 12814 | - unmarshalJSON: UnmarshalJSON? = nil, | |
| 12815 | - unsafe: Unsafe? = nil, | |
| 12816 | - useSerializers: UseSerializers? = nil | |
| 12765 | + unmarshalJSON: UnmarshalJSON? = nil | |
| 12817 | 12766 | ) -> Obj5 { |
| 12818 | 12767 | return Obj5( |
| 12819 | 12768 | dummy: dummy ?? self.dummy, |
| @@ -12831,10 +12780,11 @@ extension Obj5 { | ||
| 12831 | 12780 | obj5Try: obj5Try ?? self.obj5Try, |
| 12832 | 12781 | obj5Type: obj5Type ?? self.obj5Type, |
| 12833 | 12782 | obj5Typealias: obj5Typealias ?? self.obj5Typealias, |
| 12834 | - obj5Unowned: obj5Unowned ?? self.obj5Unowned, | |
| 12835 | 12783 | primitiveKind: primitiveKind ?? self.primitiveKind, |
| 12836 | 12784 | purpleSelf: purpleSelf ?? self.purpleSelf, |
| 12837 | 12785 | purpleTrue: purpleTrue ?? self.purpleTrue, |
| 12786 | + sealed: sealed ?? self.sealed, | |
| 12787 | + sel: sel ?? self.sel, | |
| 12838 | 12788 | select: select ?? self.select, |
| 12839 | 12789 | sendable: sendable ?? self.sendable, |
| 12840 | 12790 | serialDescriptor: serialDescriptor ?? self.serialDescriptor, |
| @@ -12879,9 +12829,7 @@ extension Obj5 { | ||
| 12879 | 12829 | unchecked: unchecked ?? self.unchecked, |
| 12880 | 12830 | undefined: undefined ?? self.undefined, |
| 12881 | 12831 | union: union ?? self.union, |
| 12882 | - unmarshalJSON: unmarshalJSON ?? self.unmarshalJSON, | |
| 12883 | - unsafe: unsafe ?? self.unsafe, | |
| 12884 | - useSerializers: useSerializers ?? self.useSerializers | |
| 12832 | + unmarshalJSON: unmarshalJSON ?? self.unmarshalJSON | |
| 12885 | 12833 | ) |
| 12886 | 12834 | } |
| 12887 | 12835 | |
| @@ -13510,50 +13458,6 @@ extension Typealias { | ||
| 13510 | 13458 | } |
| 13511 | 13459 | } |
| 13512 | 13460 | |
| 13513 | -// MARK: - Unowned | |
| 13514 | -struct Unowned: Codable { | |
| 13515 | - let unownedUnowned: Int | |
| 13516 | - | |
| 13517 | - enum CodingKeys: String, CodingKey { | |
| 13518 | - case unownedUnowned = "unowned" | |
| 13519 | - } | |
| 13520 | -} | |
| 13521 | - | |
| 13522 | -// MARK: Unowned convenience initializers and mutators | |
| 13523 | - | |
| 13524 | -extension Unowned { | |
| 13525 | - init(data: Data) throws { | |
| 13526 | - self = try newJSONDecoder().decode(Unowned.self, from: data) | |
| 13527 | - } | |
| 13528 | - | |
| 13529 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 13530 | - guard let data = json.data(using: encoding) else { | |
| 13531 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 13532 | - } | |
| 13533 | - try self.init(data: data) | |
| 13534 | - } | |
| 13535 | - | |
| 13536 | - init(fromURL url: URL) throws { | |
| 13537 | - try self.init(data: try Data(contentsOf: url)) | |
| 13538 | - } | |
| 13539 | - | |
| 13540 | - func with( | |
| 13541 | - unownedUnowned: Int? = nil | |
| 13542 | - ) -> Unowned { | |
| 13543 | - return Unowned( | |
| 13544 | - unownedUnowned: unownedUnowned ?? self.unownedUnowned | |
| 13545 | - ) | |
| 13546 | - } | |
| 13547 | - | |
| 13548 | - func jsonData() throws -> Data { | |
| 13549 | - return try newJSONEncoder().encode(self) | |
| 13550 | - } | |
| 13551 | - | |
| 13552 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 13553 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 13554 | - } | |
| 13555 | -} | |
| 13556 | - | |
| 13557 | 13461 | // MARK: - PrimitiveKind |
| 13558 | 13462 | struct PrimitiveKind: Codable { |
| 13559 | 13463 | let primitiveKind: Int |
| @@ -13686,6 +13590,94 @@ extension TrueClass { | ||
| 13686 | 13590 | } |
| 13687 | 13591 | } |
| 13688 | 13592 | |
| 13593 | +// MARK: - Sealed | |
| 13594 | +struct Sealed: Codable { | |
| 13595 | + let sealed: Int | |
| 13596 | + | |
| 13597 | + enum CodingKeys: String, CodingKey { | |
| 13598 | + case sealed = "sealed" | |
| 13599 | + } | |
| 13600 | +} | |
| 13601 | + | |
| 13602 | +// MARK: Sealed convenience initializers and mutators | |
| 13603 | + | |
| 13604 | +extension Sealed { | |
| 13605 | + init(data: Data) throws { | |
| 13606 | + self = try newJSONDecoder().decode(Sealed.self, from: data) | |
| 13607 | + } | |
| 13608 | + | |
| 13609 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 13610 | + guard let data = json.data(using: encoding) else { | |
| 13611 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 13612 | + } | |
| 13613 | + try self.init(data: data) | |
| 13614 | + } | |
| 13615 | + | |
| 13616 | + init(fromURL url: URL) throws { | |
| 13617 | + try self.init(data: try Data(contentsOf: url)) | |
| 13618 | + } | |
| 13619 | + | |
| 13620 | + func with( | |
| 13621 | + sealed: Int? = nil | |
| 13622 | + ) -> Sealed { | |
| 13623 | + return Sealed( | |
| 13624 | + sealed: sealed ?? self.sealed | |
| 13625 | + ) | |
| 13626 | + } | |
| 13627 | + | |
| 13628 | + func jsonData() throws -> Data { | |
| 13629 | + return try newJSONEncoder().encode(self) | |
| 13630 | + } | |
| 13631 | + | |
| 13632 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 13633 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 13634 | + } | |
| 13635 | +} | |
| 13636 | + | |
| 13637 | +// MARK: - Sel | |
| 13638 | +struct Sel: Codable { | |
| 13639 | + let sel: Int | |
| 13640 | + | |
| 13641 | + enum CodingKeys: String, CodingKey { | |
| 13642 | + case sel = "SEL" | |
| 13643 | + } | |
| 13644 | +} | |
| 13645 | + | |
| 13646 | +// MARK: Sel convenience initializers and mutators | |
| 13647 | + | |
| 13648 | +extension Sel { | |
| 13649 | + init(data: Data) throws { | |
| 13650 | + self = try newJSONDecoder().decode(Sel.self, from: data) | |
| 13651 | + } | |
| 13652 | + | |
| 13653 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 13654 | + guard let data = json.data(using: encoding) else { | |
| 13655 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 13656 | + } | |
| 13657 | + try self.init(data: data) | |
| 13658 | + } | |
| 13659 | + | |
| 13660 | + init(fromURL url: URL) throws { | |
| 13661 | + try self.init(data: try Data(contentsOf: url)) | |
| 13662 | + } | |
| 13663 | + | |
| 13664 | + func with( | |
| 13665 | + sel: Int? = nil | |
| 13666 | + ) -> Sel { | |
| 13667 | + return Sel( | |
| 13668 | + sel: sel ?? self.sel | |
| 13669 | + ) | |
| 13670 | + } | |
| 13671 | + | |
| 13672 | + func jsonData() throws -> Data { | |
| 13673 | + return try newJSONEncoder().encode(self) | |
| 13674 | + } | |
| 13675 | + | |
| 13676 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 13677 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 13678 | + } | |
| 13679 | +} | |
| 13680 | + | |
| 13689 | 13681 | // MARK: - Select |
| 13690 | 13682 | struct Select: Codable { |
| 13691 | 13683 | let select: Int |
| @@ -15666,103 +15658,18 @@ extension UnmarshalJSON { | ||
| 15666 | 15658 | } |
| 15667 | 15659 | } |
| 15668 | 15660 | |
| 15669 | -// MARK: - Unsafe | |
| 15670 | -struct Unsafe: Codable { | |
| 15671 | - let unsafe: Int | |
| 15672 | - | |
| 15673 | - enum CodingKeys: String, CodingKey { | |
| 15674 | - case unsafe = "unsafe" | |
| 15675 | - } | |
| 15676 | -} | |
| 15677 | - | |
| 15678 | -// MARK: Unsafe convenience initializers and mutators | |
| 15679 | - | |
| 15680 | -extension Unsafe { | |
| 15681 | - init(data: Data) throws { | |
| 15682 | - self = try newJSONDecoder().decode(Unsafe.self, from: data) | |
| 15683 | - } | |
| 15684 | - | |
| 15685 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 15686 | - guard let data = json.data(using: encoding) else { | |
| 15687 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 15688 | - } | |
| 15689 | - try self.init(data: data) | |
| 15690 | - } | |
| 15691 | - | |
| 15692 | - init(fromURL url: URL) throws { | |
| 15693 | - try self.init(data: try Data(contentsOf: url)) | |
| 15694 | - } | |
| 15695 | - | |
| 15696 | - func with( | |
| 15697 | - unsafe: Int? = nil | |
| 15698 | - ) -> Unsafe { | |
| 15699 | - return Unsafe( | |
| 15700 | - unsafe: unsafe ?? self.unsafe | |
| 15701 | - ) | |
| 15702 | - } | |
| 15703 | - | |
| 15704 | - func jsonData() throws -> Data { | |
| 15705 | - return try newJSONEncoder().encode(self) | |
| 15706 | - } | |
| 15707 | - | |
| 15708 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 15709 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 15710 | - } | |
| 15711 | -} | |
| 15712 | - | |
| 15713 | -// MARK: - UseSerializers | |
| 15714 | -struct UseSerializers: Codable { | |
| 15715 | - let useSerializers: Int | |
| 15716 | - | |
| 15717 | - enum CodingKeys: String, CodingKey { | |
| 15718 | - case useSerializers = "UseSerializers" | |
| 15719 | - } | |
| 15720 | -} | |
| 15721 | - | |
| 15722 | -// MARK: UseSerializers convenience initializers and mutators | |
| 15723 | - | |
| 15724 | -extension UseSerializers { | |
| 15725 | - init(data: Data) throws { | |
| 15726 | - self = try newJSONDecoder().decode(UseSerializers.self, from: data) | |
| 15727 | - } | |
| 15728 | - | |
| 15729 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 15730 | - guard let data = json.data(using: encoding) else { | |
| 15731 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 15732 | - } | |
| 15733 | - try self.init(data: data) | |
| 15734 | - } | |
| 15735 | - | |
| 15736 | - init(fromURL url: URL) throws { | |
| 15737 | - try self.init(data: try Data(contentsOf: url)) | |
| 15738 | - } | |
| 15739 | - | |
| 15740 | - func with( | |
| 15741 | - useSerializers: Int? = nil | |
| 15742 | - ) -> UseSerializers { | |
| 15743 | - return UseSerializers( | |
| 15744 | - useSerializers: useSerializers ?? self.useSerializers | |
| 15745 | - ) | |
| 15746 | - } | |
| 15747 | - | |
| 15748 | - func jsonData() throws -> Data { | |
| 15749 | - return try newJSONEncoder().encode(self) | |
| 15750 | - } | |
| 15751 | - | |
| 15752 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 15753 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 15754 | - } | |
| 15755 | -} | |
| 15756 | - | |
| 15757 | 15661 | // MARK: - Obj6 |
| 15758 | 15662 | struct Obj6: Codable { |
| 15759 | 15663 | let dummy: Int |
| 15664 | + let obj6Unowned: Unowned | |
| 15760 | 15665 | let obj6Var: Var |
| 15761 | 15666 | let obj6Weak: Weak |
| 15762 | 15667 | let obj6Where: Where |
| 15763 | 15668 | let obj6While: While |
| 15764 | 15669 | let obj6WillSet: WillSet |
| 15670 | + let unsafe: Unsafe | |
| 15765 | 15671 | let unsigned: Unsigned |
| 15672 | + let useSerializers: UseSerializers | |
| 15766 | 15673 | let ushort: Ushort |
| 15767 | 15674 | let using: Using |
| 15768 | 15675 | let utf8JSONReader: Utf8JSONReader |
| @@ -15780,12 +15687,15 @@ struct Obj6: Codable { | ||
| 15780 | 15687 | |
| 15781 | 15688 | enum CodingKeys: String, CodingKey { |
| 15782 | 15689 | case dummy = "dummy" |
| 15690 | + case obj6Unowned = "unowned" | |
| 15783 | 15691 | case obj6Var = "var" |
| 15784 | 15692 | case obj6Weak = "weak" |
| 15785 | 15693 | case obj6Where = "where" |
| 15786 | 15694 | case obj6While = "while" |
| 15787 | 15695 | case obj6WillSet = "willSet" |
| 15696 | + case unsafe = "unsafe" | |
| 15788 | 15697 | case unsigned = "unsigned" |
| 15698 | + case useSerializers = "UseSerializers" | |
| 15789 | 15699 | case ushort = "ushort" |
| 15790 | 15700 | case using = "using" |
| 15791 | 15701 | case utf8JSONReader = "Utf8JsonReader" |
| @@ -15823,12 +15733,15 @@ extension Obj6 { | ||
| 15823 | 15733 | |
| 15824 | 15734 | func with( |
| 15825 | 15735 | dummy: Int? = nil, |
| 15736 | + obj6Unowned: Unowned? = nil, | |
| 15826 | 15737 | obj6Var: Var? = nil, |
| 15827 | 15738 | obj6Weak: Weak? = nil, |
| 15828 | 15739 | obj6Where: Where? = nil, |
| 15829 | 15740 | obj6While: While? = nil, |
| 15830 | 15741 | obj6WillSet: WillSet? = nil, |
| 15742 | + unsafe: Unsafe? = nil, | |
| 15831 | 15743 | unsigned: Unsigned? = nil, |
| 15744 | + useSerializers: UseSerializers? = nil, | |
| 15832 | 15745 | ushort: Ushort? = nil, |
| 15833 | 15746 | using: Using? = nil, |
| 15834 | 15747 | utf8JSONReader: Utf8JSONReader? = nil, |
| @@ -15846,12 +15759,15 @@ extension Obj6 { | ||
| 15846 | 15759 | ) -> Obj6 { |
| 15847 | 15760 | return Obj6( |
| 15848 | 15761 | dummy: dummy ?? self.dummy, |
| 15762 | + obj6Unowned: obj6Unowned ?? self.obj6Unowned, | |
| 15849 | 15763 | obj6Var: obj6Var ?? self.obj6Var, |
| 15850 | 15764 | obj6Weak: obj6Weak ?? self.obj6Weak, |
| 15851 | 15765 | obj6Where: obj6Where ?? self.obj6Where, |
| 15852 | 15766 | obj6While: obj6While ?? self.obj6While, |
| 15853 | 15767 | obj6WillSet: obj6WillSet ?? self.obj6WillSet, |
| 15768 | + unsafe: unsafe ?? self.unsafe, | |
| 15854 | 15769 | unsigned: unsigned ?? self.unsigned, |
| 15770 | + useSerializers: useSerializers ?? self.useSerializers, | |
| 15855 | 15771 | ushort: ushort ?? self.ushort, |
| 15856 | 15772 | using: using ?? self.using, |
| 15857 | 15773 | utf8JSONReader: utf8JSONReader ?? self.utf8JSONReader, |
| @@ -15878,6 +15794,50 @@ extension Obj6 { | ||
| 15878 | 15794 | } |
| 15879 | 15795 | } |
| 15880 | 15796 | |
| 15797 | +// MARK: - Unowned | |
| 15798 | +struct Unowned: Codable { | |
| 15799 | + let unownedUnowned: Int | |
| 15800 | + | |
| 15801 | + enum CodingKeys: String, CodingKey { | |
| 15802 | + case unownedUnowned = "unowned" | |
| 15803 | + } | |
| 15804 | +} | |
| 15805 | + | |
| 15806 | +// MARK: Unowned convenience initializers and mutators | |
| 15807 | + | |
| 15808 | +extension Unowned { | |
| 15809 | + init(data: Data) throws { | |
| 15810 | + self = try newJSONDecoder().decode(Unowned.self, from: data) | |
| 15811 | + } | |
| 15812 | + | |
| 15813 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 15814 | + guard let data = json.data(using: encoding) else { | |
| 15815 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 15816 | + } | |
| 15817 | + try self.init(data: data) | |
| 15818 | + } | |
| 15819 | + | |
| 15820 | + init(fromURL url: URL) throws { | |
| 15821 | + try self.init(data: try Data(contentsOf: url)) | |
| 15822 | + } | |
| 15823 | + | |
| 15824 | + func with( | |
| 15825 | + unownedUnowned: Int? = nil | |
| 15826 | + ) -> Unowned { | |
| 15827 | + return Unowned( | |
| 15828 | + unownedUnowned: unownedUnowned ?? self.unownedUnowned | |
| 15829 | + ) | |
| 15830 | + } | |
| 15831 | + | |
| 15832 | + func jsonData() throws -> Data { | |
| 15833 | + return try newJSONEncoder().encode(self) | |
| 15834 | + } | |
| 15835 | + | |
| 15836 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 15837 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 15838 | + } | |
| 15839 | +} | |
| 15840 | + | |
| 15881 | 15841 | // MARK: - Var |
| 15882 | 15842 | struct Var: Codable { |
| 15883 | 15843 | let varVar: Int |
| @@ -16098,6 +16058,50 @@ extension WillSet { | ||
| 16098 | 16058 | } |
| 16099 | 16059 | } |
| 16100 | 16060 | |
| 16061 | +// MARK: - Unsafe | |
| 16062 | +struct Unsafe: Codable { | |
| 16063 | + let unsafe: Int | |
| 16064 | + | |
| 16065 | + enum CodingKeys: String, CodingKey { | |
| 16066 | + case unsafe = "unsafe" | |
| 16067 | + } | |
| 16068 | +} | |
| 16069 | + | |
| 16070 | +// MARK: Unsafe convenience initializers and mutators | |
| 16071 | + | |
| 16072 | +extension Unsafe { | |
| 16073 | + init(data: Data) throws { | |
| 16074 | + self = try newJSONDecoder().decode(Unsafe.self, from: data) | |
| 16075 | + } | |
| 16076 | + | |
| 16077 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 16078 | + guard let data = json.data(using: encoding) else { | |
| 16079 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 16080 | + } | |
| 16081 | + try self.init(data: data) | |
| 16082 | + } | |
| 16083 | + | |
| 16084 | + init(fromURL url: URL) throws { | |
| 16085 | + try self.init(data: try Data(contentsOf: url)) | |
| 16086 | + } | |
| 16087 | + | |
| 16088 | + func with( | |
| 16089 | + unsafe: Int? = nil | |
| 16090 | + ) -> Unsafe { | |
| 16091 | + return Unsafe( | |
| 16092 | + unsafe: unsafe ?? self.unsafe | |
| 16093 | + ) | |
| 16094 | + } | |
| 16095 | + | |
| 16096 | + func jsonData() throws -> Data { | |
| 16097 | + return try newJSONEncoder().encode(self) | |
| 16098 | + } | |
| 16099 | + | |
| 16100 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 16101 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 16102 | + } | |
| 16103 | +} | |
| 16104 | + | |
| 16101 | 16105 | // MARK: - Unsigned |
| 16102 | 16106 | struct Unsigned: Codable { |
| 16103 | 16107 | let unsigned: Int |
| @@ -16142,6 +16146,50 @@ extension Unsigned { | ||
| 16142 | 16146 | } |
| 16143 | 16147 | } |
| 16144 | 16148 | |
| 16149 | +// MARK: - UseSerializers | |
| 16150 | +struct UseSerializers: Codable { | |
| 16151 | + let useSerializers: Int | |
| 16152 | + | |
| 16153 | + enum CodingKeys: String, CodingKey { | |
| 16154 | + case useSerializers = "UseSerializers" | |
| 16155 | + } | |
| 16156 | +} | |
| 16157 | + | |
| 16158 | +// MARK: UseSerializers convenience initializers and mutators | |
| 16159 | + | |
| 16160 | +extension UseSerializers { | |
| 16161 | + init(data: Data) throws { | |
| 16162 | + self = try newJSONDecoder().decode(UseSerializers.self, from: data) | |
| 16163 | + } | |
| 16164 | + | |
| 16165 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 16166 | + guard let data = json.data(using: encoding) else { | |
| 16167 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 16168 | + } | |
| 16169 | + try self.init(data: data) | |
| 16170 | + } | |
| 16171 | + | |
| 16172 | + init(fromURL url: URL) throws { | |
| 16173 | + try self.init(data: try Data(contentsOf: url)) | |
| 16174 | + } | |
| 16175 | + | |
| 16176 | + func with( | |
| 16177 | + useSerializers: Int? = nil | |
| 16178 | + ) -> UseSerializers { | |
| 16179 | + return UseSerializers( | |
| 16180 | + useSerializers: useSerializers ?? self.useSerializers | |
| 16181 | + ) | |
| 16182 | + } | |
| 16183 | + | |
| 16184 | + func jsonData() throws -> Data { | |
| 16185 | + return try newJSONEncoder().encode(self) | |
| 16186 | + } | |
| 16187 | + | |
| 16188 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 16189 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 16190 | + } | |
| 16191 | +} | |
| 16192 | + | |
| 16145 | 16193 | // MARK: - Ushort |
| 16146 | 16194 | struct Ushort: Codable { |
| 16147 | 16195 | let ushort: Int |
Mswiftobjective-c-support-true__struct-or-class-class--f14372afa3e4 / quicktype.swift+446 −392
| @@ -7140,6 +7140,7 @@ extension FalseClass { | ||
| 7140 | 7140 | let locale: LocaleClass |
| 7141 | 7141 | let lock: Lock |
| 7142 | 7142 | let long: Long |
| 7143 | + let makeDictEncoder: MakeDictEncoder | |
| 7143 | 7144 | let map: Map |
| 7144 | 7145 | let mapEntry: MapEntry |
| 7145 | 7146 | let marshalJSON: MarshalJSON |
| @@ -7150,7 +7151,6 @@ extension FalseClass { | ||
| 7150 | 7151 | let native: Native |
| 7151 | 7152 | let new: New |
| 7152 | 7153 | let newtonsoft: Newtonsoft |
| 7153 | - let no: No | |
| 7154 | 7154 | let obj3Guard: Guard |
| 7155 | 7155 | let obj3If: If |
| 7156 | 7156 | let obj3Import: Import |
| @@ -7166,7 +7166,6 @@ extension FalseClass { | ||
| 7166 | 7166 | let obj3Left: Left |
| 7167 | 7167 | let obj3Let: Let |
| 7168 | 7168 | let obj3Mutating: Mutating |
| 7169 | - let obj3Nil: Nil | |
| 7170 | 7169 | |
| 7171 | 7170 | enum CodingKeys: String, CodingKey { |
| 7172 | 7171 | case dummy = "dummy" |
| @@ -7208,6 +7207,7 @@ extension FalseClass { | ||
| 7208 | 7207 | case locale = "Locale" |
| 7209 | 7208 | case lock = "lock" |
| 7210 | 7209 | case long = "long" |
| 7210 | + case makeDictEncoder = "makeDictEncoder" | |
| 7211 | 7211 | case map = "map" |
| 7212 | 7212 | case mapEntry = "MapEntry" |
| 7213 | 7213 | case marshalJSON = "MarshalJSON" |
| @@ -7218,7 +7218,6 @@ extension FalseClass { | ||
| 7218 | 7218 | case native = "native" |
| 7219 | 7219 | case new = "new" |
| 7220 | 7220 | case newtonsoft = "newtonsoft" |
| 7221 | - case no = "NO" | |
| 7222 | 7221 | case obj3Guard = "guard" |
| 7223 | 7222 | case obj3If = "if" |
| 7224 | 7223 | case obj3Import = "import" |
| @@ -7234,10 +7233,9 @@ extension FalseClass { | ||
| 7234 | 7233 | case obj3Left = "left" |
| 7235 | 7234 | case obj3Let = "let" |
| 7236 | 7235 | case obj3Mutating = "mutating" |
| 7237 | - case obj3Nil = "nil" | |
| 7238 | 7236 | } |
| 7239 | 7237 | |
| 7240 | - init(dummy: Int, goto: Goto, hasOwnProperty: HasOwnProperty, hashCode: HashCode, hashable: HashableClass, hasher: HasherClass, id: ID, imp: Imp, implements: Implements, implicit: Implicit, inline: Inline, instanceof: Instanceof, int: IntClass, interface: Interface, isoDateTimeOffsetConverter: ISODateTimeOffsetConverter, iterable: Iterable, jdec: Jdec, jenc: Jenc, jpipe: Jpipe, jsonAny: JSONAnyClass, jsonCodingKey: JSONCodingKeyClass, jsonConverter: JSONConverter, jsonDecoder: JSONDecoderClass, jsonEncoder: JSONEncoderClass, jsonException: JSONException, jsonGenerator: JSONGenerator, jsonNode: JSONNode, jsonNull: JSONNullClass, jsonParser: JSONParser, jsonReader: JSONReader, jsonSerializer: JSONSerializer, jsonToken: JSONToken, jsonTokenType: JSONTokenType, jsonWriter: JSONWriter, lambda: Lambda, list: List, locale: LocaleClass, lock: Lock, long: Long, map: Map, mapEntry: MapEntry, marshalJSON: MarshalJSON, metadataPropertyHandling: MetadataPropertyHandling, module: Module, mutable: Mutable, namespace: Namespace, native: Native, new: New, newtonsoft: Newtonsoft, no: No, obj3Guard: Guard, obj3If: If, obj3Import: Import, obj3In: In, obj3Indirect: Indirect, obj3Infix: Infix, obj3Init: Init, obj3Inout: Inout, obj3Internal: Internal, obj3Is: Is, obj3JSON: JSON, obj3Lazy: Lazy, obj3Left: Left, obj3Let: Let, obj3Mutating: Mutating, obj3Nil: Nil) { | |
| 7238 | + init(dummy: Int, goto: Goto, hasOwnProperty: HasOwnProperty, hashCode: HashCode, hashable: HashableClass, hasher: HasherClass, id: ID, imp: Imp, implements: Implements, implicit: Implicit, inline: Inline, instanceof: Instanceof, int: IntClass, interface: Interface, isoDateTimeOffsetConverter: ISODateTimeOffsetConverter, iterable: Iterable, jdec: Jdec, jenc: Jenc, jpipe: Jpipe, jsonAny: JSONAnyClass, jsonCodingKey: JSONCodingKeyClass, jsonConverter: JSONConverter, jsonDecoder: JSONDecoderClass, jsonEncoder: JSONEncoderClass, jsonException: JSONException, jsonGenerator: JSONGenerator, jsonNode: JSONNode, jsonNull: JSONNullClass, jsonParser: JSONParser, jsonReader: JSONReader, jsonSerializer: JSONSerializer, jsonToken: JSONToken, jsonTokenType: JSONTokenType, jsonWriter: JSONWriter, lambda: Lambda, list: List, locale: LocaleClass, lock: Lock, long: Long, makeDictEncoder: MakeDictEncoder, map: Map, mapEntry: MapEntry, marshalJSON: MarshalJSON, metadataPropertyHandling: MetadataPropertyHandling, module: Module, mutable: Mutable, namespace: Namespace, native: Native, new: New, newtonsoft: Newtonsoft, obj3Guard: Guard, obj3If: If, obj3Import: Import, obj3In: In, obj3Indirect: Indirect, obj3Infix: Infix, obj3Init: Init, obj3Inout: Inout, obj3Internal: Internal, obj3Is: Is, obj3JSON: JSON, obj3Lazy: Lazy, obj3Left: Left, obj3Let: Let, obj3Mutating: Mutating) { | |
| 7241 | 7239 | self.dummy = dummy |
| 7242 | 7240 | self.goto = goto |
| 7243 | 7241 | self.hasOwnProperty = hasOwnProperty |
| @@ -7277,6 +7275,7 @@ extension FalseClass { | ||
| 7277 | 7275 | self.locale = locale |
| 7278 | 7276 | self.lock = lock |
| 7279 | 7277 | self.long = long |
| 7278 | + self.makeDictEncoder = makeDictEncoder | |
| 7280 | 7279 | self.map = map |
| 7281 | 7280 | self.mapEntry = mapEntry |
| 7282 | 7281 | self.marshalJSON = marshalJSON |
| @@ -7287,7 +7286,6 @@ extension FalseClass { | ||
| 7287 | 7286 | self.native = native |
| 7288 | 7287 | self.new = new |
| 7289 | 7288 | self.newtonsoft = newtonsoft |
| 7290 | - self.no = no | |
| 7291 | 7289 | self.obj3Guard = obj3Guard |
| 7292 | 7290 | self.obj3If = obj3If |
| 7293 | 7291 | self.obj3Import = obj3Import |
| @@ -7303,7 +7301,6 @@ extension FalseClass { | ||
| 7303 | 7301 | self.obj3Left = obj3Left |
| 7304 | 7302 | self.obj3Let = obj3Let |
| 7305 | 7303 | self.obj3Mutating = obj3Mutating |
| 7306 | - self.obj3Nil = obj3Nil | |
| 7307 | 7304 | } |
| 7308 | 7305 | } |
| 7309 | 7306 | |
| @@ -7312,7 +7309,7 @@ extension FalseClass { | ||
| 7312 | 7309 | extension Obj3 { |
| 7313 | 7310 | convenience init(data: Data) throws { |
| 7314 | 7311 | let me = try newJSONDecoder().decode(Obj3.self, from: data) |
| 7315 | - self.init(dummy: me.dummy, goto: me.goto, hasOwnProperty: me.hasOwnProperty, hashCode: me.hashCode, hashable: me.hashable, hasher: me.hasher, id: me.id, imp: me.imp, implements: me.implements, implicit: me.implicit, inline: me.inline, instanceof: me.instanceof, int: me.int, interface: me.interface, isoDateTimeOffsetConverter: me.isoDateTimeOffsetConverter, iterable: me.iterable, jdec: me.jdec, jenc: me.jenc, jpipe: me.jpipe, jsonAny: me.jsonAny, jsonCodingKey: me.jsonCodingKey, jsonConverter: me.jsonConverter, jsonDecoder: me.jsonDecoder, jsonEncoder: me.jsonEncoder, jsonException: me.jsonException, jsonGenerator: me.jsonGenerator, jsonNode: me.jsonNode, jsonNull: me.jsonNull, jsonParser: me.jsonParser, jsonReader: me.jsonReader, jsonSerializer: me.jsonSerializer, jsonToken: me.jsonToken, jsonTokenType: me.jsonTokenType, jsonWriter: me.jsonWriter, lambda: me.lambda, list: me.list, locale: me.locale, lock: me.lock, long: me.long, map: me.map, mapEntry: me.mapEntry, marshalJSON: me.marshalJSON, metadataPropertyHandling: me.metadataPropertyHandling, module: me.module, mutable: me.mutable, namespace: me.namespace, native: me.native, new: me.new, newtonsoft: me.newtonsoft, no: me.no, obj3Guard: me.obj3Guard, obj3If: me.obj3If, obj3Import: me.obj3Import, obj3In: me.obj3In, obj3Indirect: me.obj3Indirect, obj3Infix: me.obj3Infix, obj3Init: me.obj3Init, obj3Inout: me.obj3Inout, obj3Internal: me.obj3Internal, obj3Is: me.obj3Is, obj3JSON: me.obj3JSON, obj3Lazy: me.obj3Lazy, obj3Left: me.obj3Left, obj3Let: me.obj3Let, obj3Mutating: me.obj3Mutating, obj3Nil: me.obj3Nil) | |
| 7312 | + self.init(dummy: me.dummy, goto: me.goto, hasOwnProperty: me.hasOwnProperty, hashCode: me.hashCode, hashable: me.hashable, hasher: me.hasher, id: me.id, imp: me.imp, implements: me.implements, implicit: me.implicit, inline: me.inline, instanceof: me.instanceof, int: me.int, interface: me.interface, isoDateTimeOffsetConverter: me.isoDateTimeOffsetConverter, iterable: me.iterable, jdec: me.jdec, jenc: me.jenc, jpipe: me.jpipe, jsonAny: me.jsonAny, jsonCodingKey: me.jsonCodingKey, jsonConverter: me.jsonConverter, jsonDecoder: me.jsonDecoder, jsonEncoder: me.jsonEncoder, jsonException: me.jsonException, jsonGenerator: me.jsonGenerator, jsonNode: me.jsonNode, jsonNull: me.jsonNull, jsonParser: me.jsonParser, jsonReader: me.jsonReader, jsonSerializer: me.jsonSerializer, jsonToken: me.jsonToken, jsonTokenType: me.jsonTokenType, jsonWriter: me.jsonWriter, lambda: me.lambda, list: me.list, locale: me.locale, lock: me.lock, long: me.long, makeDictEncoder: me.makeDictEncoder, map: me.map, mapEntry: me.mapEntry, marshalJSON: me.marshalJSON, metadataPropertyHandling: me.metadataPropertyHandling, module: me.module, mutable: me.mutable, namespace: me.namespace, native: me.native, new: me.new, newtonsoft: me.newtonsoft, obj3Guard: me.obj3Guard, obj3If: me.obj3If, obj3Import: me.obj3Import, obj3In: me.obj3In, obj3Indirect: me.obj3Indirect, obj3Infix: me.obj3Infix, obj3Init: me.obj3Init, obj3Inout: me.obj3Inout, obj3Internal: me.obj3Internal, obj3Is: me.obj3Is, obj3JSON: me.obj3JSON, obj3Lazy: me.obj3Lazy, obj3Left: me.obj3Left, obj3Let: me.obj3Let, obj3Mutating: me.obj3Mutating) | |
| 7316 | 7313 | } |
| 7317 | 7314 | |
| 7318 | 7315 | convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { |
| @@ -7366,6 +7363,7 @@ extension Obj3 { | ||
| 7366 | 7363 | locale: LocaleClass? = nil, |
| 7367 | 7364 | lock: Lock? = nil, |
| 7368 | 7365 | long: Long? = nil, |
| 7366 | + makeDictEncoder: MakeDictEncoder? = nil, | |
| 7369 | 7367 | map: Map? = nil, |
| 7370 | 7368 | mapEntry: MapEntry? = nil, |
| 7371 | 7369 | marshalJSON: MarshalJSON? = nil, |
| @@ -7376,7 +7374,6 @@ extension Obj3 { | ||
| 7376 | 7374 | native: Native? = nil, |
| 7377 | 7375 | new: New? = nil, |
| 7378 | 7376 | newtonsoft: Newtonsoft? = nil, |
| 7379 | - no: No? = nil, | |
| 7380 | 7377 | obj3Guard: Guard? = nil, |
| 7381 | 7378 | obj3If: If? = nil, |
| 7382 | 7379 | obj3Import: Import? = nil, |
| @@ -7391,8 +7388,7 @@ extension Obj3 { | ||
| 7391 | 7388 | obj3Lazy: Lazy? = nil, |
| 7392 | 7389 | obj3Left: Left? = nil, |
| 7393 | 7390 | obj3Let: Let? = nil, |
| 7394 | - obj3Mutating: Mutating? = nil, | |
| 7395 | - obj3Nil: Nil? = nil | |
| 7391 | + obj3Mutating: Mutating? = nil | |
| 7396 | 7392 | ) -> Obj3 { |
| 7397 | 7393 | return Obj3( |
| 7398 | 7394 | dummy: dummy ?? self.dummy, |
| @@ -7434,6 +7430,7 @@ extension Obj3 { | ||
| 7434 | 7430 | locale: locale ?? self.locale, |
| 7435 | 7431 | lock: lock ?? self.lock, |
| 7436 | 7432 | long: long ?? self.long, |
| 7433 | + makeDictEncoder: makeDictEncoder ?? self.makeDictEncoder, | |
| 7437 | 7434 | map: map ?? self.map, |
| 7438 | 7435 | mapEntry: mapEntry ?? self.mapEntry, |
| 7439 | 7436 | marshalJSON: marshalJSON ?? self.marshalJSON, |
| @@ -7444,7 +7441,6 @@ extension Obj3 { | ||
| 7444 | 7441 | native: native ?? self.native, |
| 7445 | 7442 | new: new ?? self.new, |
| 7446 | 7443 | newtonsoft: newtonsoft ?? self.newtonsoft, |
| 7447 | - no: no ?? self.no, | |
| 7448 | 7444 | obj3Guard: obj3Guard ?? self.obj3Guard, |
| 7449 | 7445 | obj3If: obj3If ?? self.obj3If, |
| 7450 | 7446 | obj3Import: obj3Import ?? self.obj3Import, |
| @@ -7459,8 +7455,7 @@ extension Obj3 { | ||
| 7459 | 7455 | obj3Lazy: obj3Lazy ?? self.obj3Lazy, |
| 7460 | 7456 | obj3Left: obj3Left ?? self.obj3Left, |
| 7461 | 7457 | obj3Let: obj3Let ?? self.obj3Let, |
| 7462 | - obj3Mutating: obj3Mutating ?? self.obj3Mutating, | |
| 7463 | - obj3Nil: obj3Nil ?? self.obj3Nil | |
| 7458 | + obj3Mutating: obj3Mutating ?? self.obj3Mutating | |
| 7464 | 7459 | ) |
| 7465 | 7460 | } |
| 7466 | 7461 | |
| @@ -9335,6 +9330,55 @@ extension Long { | ||
| 9335 | 9330 | } |
| 9336 | 9331 | } |
| 9337 | 9332 | |
| 9333 | +// MARK: - MakeDictEncoder | |
| 9334 | +@objcMembers class MakeDictEncoder: NSObject, Codable { | |
| 9335 | + let makeDictEncoder: Int | |
| 9336 | + | |
| 9337 | + enum CodingKeys: String, CodingKey { | |
| 9338 | + case makeDictEncoder = "makeDictEncoder" | |
| 9339 | + } | |
| 9340 | + | |
| 9341 | + init(makeDictEncoder: Int) { | |
| 9342 | + self.makeDictEncoder = makeDictEncoder | |
| 9343 | + } | |
| 9344 | +} | |
| 9345 | + | |
| 9346 | +// MARK: MakeDictEncoder convenience initializers and mutators | |
| 9347 | + | |
| 9348 | +extension MakeDictEncoder { | |
| 9349 | + convenience init(data: Data) throws { | |
| 9350 | + let me = try newJSONDecoder().decode(MakeDictEncoder.self, from: data) | |
| 9351 | + self.init(makeDictEncoder: me.makeDictEncoder) | |
| 9352 | + } | |
| 9353 | + | |
| 9354 | + convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 9355 | + guard let data = json.data(using: encoding) else { | |
| 9356 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 9357 | + } | |
| 9358 | + try self.init(data: data) | |
| 9359 | + } | |
| 9360 | + | |
| 9361 | + convenience init(fromURL url: URL) throws { | |
| 9362 | + try self.init(data: try Data(contentsOf: url)) | |
| 9363 | + } | |
| 9364 | + | |
| 9365 | + func with( | |
| 9366 | + makeDictEncoder: Int? = nil | |
| 9367 | + ) -> MakeDictEncoder { | |
| 9368 | + return MakeDictEncoder( | |
| 9369 | + makeDictEncoder: makeDictEncoder ?? self.makeDictEncoder | |
| 9370 | + ) | |
| 9371 | + } | |
| 9372 | + | |
| 9373 | + func jsonData() throws -> Data { | |
| 9374 | + return try newJSONEncoder().encode(self) | |
| 9375 | + } | |
| 9376 | + | |
| 9377 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 9378 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 9379 | + } | |
| 9380 | +} | |
| 9381 | + | |
| 9338 | 9382 | // MARK: - Map |
| 9339 | 9383 | @objcMembers class Map: NSObject, Codable { |
| 9340 | 9384 | let map: Int |
| @@ -9825,55 +9869,6 @@ extension Newtonsoft { | ||
| 9825 | 9869 | } |
| 9826 | 9870 | } |
| 9827 | 9871 | |
| 9828 | -// MARK: - No | |
| 9829 | -@objcMembers class No: NSObject, Codable { | |
| 9830 | - let no: Int | |
| 9831 | - | |
| 9832 | - enum CodingKeys: String, CodingKey { | |
| 9833 | - case no = "NO" | |
| 9834 | - } | |
| 9835 | - | |
| 9836 | - init(no: Int) { | |
| 9837 | - self.no = no | |
| 9838 | - } | |
| 9839 | -} | |
| 9840 | - | |
| 9841 | -// MARK: No convenience initializers and mutators | |
| 9842 | - | |
| 9843 | -extension No { | |
| 9844 | - convenience init(data: Data) throws { | |
| 9845 | - let me = try newJSONDecoder().decode(No.self, from: data) | |
| 9846 | - self.init(no: me.no) | |
| 9847 | - } | |
| 9848 | - | |
| 9849 | - convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 9850 | - guard let data = json.data(using: encoding) else { | |
| 9851 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 9852 | - } | |
| 9853 | - try self.init(data: data) | |
| 9854 | - } | |
| 9855 | - | |
| 9856 | - convenience init(fromURL url: URL) throws { | |
| 9857 | - try self.init(data: try Data(contentsOf: url)) | |
| 9858 | - } | |
| 9859 | - | |
| 9860 | - func with( | |
| 9861 | - no: Int? = nil | |
| 9862 | - ) -> No { | |
| 9863 | - return No( | |
| 9864 | - no: no ?? self.no | |
| 9865 | - ) | |
| 9866 | - } | |
| 9867 | - | |
| 9868 | - func jsonData() throws -> Data { | |
| 9869 | - return try newJSONEncoder().encode(self) | |
| 9870 | - } | |
| 9871 | - | |
| 9872 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 9873 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 9874 | - } | |
| 9875 | -} | |
| 9876 | - | |
| 9877 | 9872 | // MARK: - Guard |
| 9878 | 9873 | @objcMembers class Guard: NSObject, Codable { |
| 9879 | 9874 | let guardGuard: Int |
| @@ -10609,58 +10604,10 @@ extension Mutating { | ||
| 10609 | 10604 | } |
| 10610 | 10605 | } |
| 10611 | 10606 | |
| 10612 | -// MARK: - Nil | |
| 10613 | -@objcMembers class Nil: NSObject, Codable { | |
| 10614 | - let nilNil: Int | |
| 10615 | - | |
| 10616 | - enum CodingKeys: String, CodingKey { | |
| 10617 | - case nilNil = "nil" | |
| 10618 | - } | |
| 10619 | - | |
| 10620 | - init(nilNil: Int) { | |
| 10621 | - self.nilNil = nilNil | |
| 10622 | - } | |
| 10623 | -} | |
| 10624 | - | |
| 10625 | -// MARK: Nil convenience initializers and mutators | |
| 10626 | - | |
| 10627 | -extension Nil { | |
| 10628 | - convenience init(data: Data) throws { | |
| 10629 | - let me = try newJSONDecoder().decode(Nil.self, from: data) | |
| 10630 | - self.init(nilNil: me.nilNil) | |
| 10631 | - } | |
| 10632 | - | |
| 10633 | - convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 10634 | - guard let data = json.data(using: encoding) else { | |
| 10635 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 10636 | - } | |
| 10637 | - try self.init(data: data) | |
| 10638 | - } | |
| 10639 | - | |
| 10640 | - convenience init(fromURL url: URL) throws { | |
| 10641 | - try self.init(data: try Data(contentsOf: url)) | |
| 10642 | - } | |
| 10643 | - | |
| 10644 | - func with( | |
| 10645 | - nilNil: Int? = nil | |
| 10646 | - ) -> Nil { | |
| 10647 | - return Nil( | |
| 10648 | - nilNil: nilNil ?? self.nilNil | |
| 10649 | - ) | |
| 10650 | - } | |
| 10651 | - | |
| 10652 | - func jsonData() throws -> Data { | |
| 10653 | - return try newJSONEncoder().encode(self) | |
| 10654 | - } | |
| 10655 | - | |
| 10656 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 10657 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 10658 | - } | |
| 10659 | -} | |
| 10660 | - | |
| 10661 | 10607 | // MARK: - Obj4 |
| 10662 | 10608 | @objcMembers class Obj4: NSObject, Codable { |
| 10663 | 10609 | let dummy: Int |
| 10610 | + let no: No | |
| 10664 | 10611 | let noSuchMethod: NoSuchMethod |
| 10665 | 10612 | let noexcept: Noexcept |
| 10666 | 10613 | let nonatomic: Nonatomic |
| @@ -10674,6 +10621,7 @@ extension Nil { | ||
| 10674 | 10621 | let null: Null |
| 10675 | 10622 | let nullptr: Nullptr |
| 10676 | 10623 | let number: Number |
| 10624 | + let obj4Nil: Nil | |
| 10677 | 10625 | let obj4None: NoneClass |
| 10678 | 10626 | let obj4Nonmutating: Nonmutating |
| 10679 | 10627 | let obj4Null: NullClass |
| @@ -10723,11 +10671,10 @@ extension Nil { | ||
| 10723 | 10671 | let runtimeType: RuntimeType |
| 10724 | 10672 | let s: S |
| 10725 | 10673 | let sbyte: Sbyte |
| 10726 | - let sealed: Sealed | |
| 10727 | - let sel: Sel | |
| 10728 | 10674 | |
| 10729 | 10675 | enum CodingKeys: String, CodingKey { |
| 10730 | 10676 | case dummy = "dummy" |
| 10677 | + case no = "NO" | |
| 10731 | 10678 | case noSuchMethod = "noSuchMethod" |
| 10732 | 10679 | case noexcept = "noexcept" |
| 10733 | 10680 | case nonatomic = "nonatomic" |
| @@ -10741,6 +10688,7 @@ extension Nil { | ||
| 10741 | 10688 | case null = "NULL" |
| 10742 | 10689 | case nullptr = "nullptr" |
| 10743 | 10690 | case number = "number" |
| 10691 | + case obj4Nil = "nil" | |
| 10744 | 10692 | case obj4None = "none" |
| 10745 | 10693 | case obj4Nonmutating = "nonmutating" |
| 10746 | 10694 | case obj4Null = "null" |
| @@ -10790,12 +10738,11 @@ extension Nil { | ||
| 10790 | 10738 | case runtimeType = "runtimeType" |
| 10791 | 10739 | case s = "s" |
| 10792 | 10740 | case sbyte = "sbyte" |
| 10793 | - case sealed = "sealed" | |
| 10794 | - case sel = "SEL" | |
| 10795 | 10741 | } |
| 10796 | 10742 | |
| 10797 | - init(dummy: Int, noSuchMethod: NoSuchMethod, noexcept: Noexcept, nonatomic: Nonatomic, none: None, nonlocal: Nonlocal, not: Not, notEq: NotEq, nsError: NSErrorClass, nsObject: NSObjectClass, nsString: NSString, null: Null, nullptr: Nullptr, number: Number, obj4None: NoneClass, obj4Nonmutating: Nonmutating, obj4Null: NullClass, obj4Open: Open, obj4Operator: Operator, obj4Optional: Optional, obj4Override: Override, obj4Postfix: Postfix, obj4Precedence: Precedence, obj4Prefix: Prefix, obj4Private: Private, obj4Protocol: ProtocolClass, obj4Public: Public, obj4Repeat: Repeat, obj4Required: Required, obj4Retain: Retain, obj4Rethrows: Rethrows, obj4Return: Return, obj4Right: Right, object: Object, objectMapper: ObjectMapper, of: Of, oneway: Oneway, or: Or, orEq: OrEq, out: Out, package: Package, params: Params, pass: Pass, port: Port, print: Print, printMembers: PrintMembers, printf: Printf, protected: Protected, purpleProtocol: Obj4Protocol, quicktype: Quicktype, raise: Raise, range: Range, readonly: Readonly, ref: Ref, regExp: RegExp, register: Register, reinterpretCast: ReinterpretCast, require: Require, requires: Requires, restrict: Restrict, runtimeType: RuntimeType, s: S, sbyte: Sbyte, sealed: Sealed, sel: Sel) { | |
| 10743 | + init(dummy: Int, no: No, noSuchMethod: NoSuchMethod, noexcept: Noexcept, nonatomic: Nonatomic, none: None, nonlocal: Nonlocal, not: Not, notEq: NotEq, nsError: NSErrorClass, nsObject: NSObjectClass, nsString: NSString, null: Null, nullptr: Nullptr, number: Number, obj4Nil: Nil, obj4None: NoneClass, obj4Nonmutating: Nonmutating, obj4Null: NullClass, obj4Open: Open, obj4Operator: Operator, obj4Optional: Optional, obj4Override: Override, obj4Postfix: Postfix, obj4Precedence: Precedence, obj4Prefix: Prefix, obj4Private: Private, obj4Protocol: ProtocolClass, obj4Public: Public, obj4Repeat: Repeat, obj4Required: Required, obj4Retain: Retain, obj4Rethrows: Rethrows, obj4Return: Return, obj4Right: Right, object: Object, objectMapper: ObjectMapper, of: Of, oneway: Oneway, or: Or, orEq: OrEq, out: Out, package: Package, params: Params, pass: Pass, port: Port, print: Print, printMembers: PrintMembers, printf: Printf, protected: Protected, purpleProtocol: Obj4Protocol, quicktype: Quicktype, raise: Raise, range: Range, readonly: Readonly, ref: Ref, regExp: RegExp, register: Register, reinterpretCast: ReinterpretCast, require: Require, requires: Requires, restrict: Restrict, runtimeType: RuntimeType, s: S, sbyte: Sbyte) { | |
| 10798 | 10744 | self.dummy = dummy |
| 10745 | + self.no = no | |
| 10799 | 10746 | self.noSuchMethod = noSuchMethod |
| 10800 | 10747 | self.noexcept = noexcept |
| 10801 | 10748 | self.nonatomic = nonatomic |
| @@ -10809,6 +10756,7 @@ extension Nil { | ||
| 10809 | 10756 | self.null = null |
| 10810 | 10757 | self.nullptr = nullptr |
| 10811 | 10758 | self.number = number |
| 10759 | + self.obj4Nil = obj4Nil | |
| 10812 | 10760 | self.obj4None = obj4None |
| 10813 | 10761 | self.obj4Nonmutating = obj4Nonmutating |
| 10814 | 10762 | self.obj4Null = obj4Null |
| @@ -10858,8 +10806,6 @@ extension Nil { | ||
| 10858 | 10806 | self.runtimeType = runtimeType |
| 10859 | 10807 | self.s = s |
| 10860 | 10808 | self.sbyte = sbyte |
| 10861 | - self.sealed = sealed | |
| 10862 | - self.sel = sel | |
| 10863 | 10809 | } |
| 10864 | 10810 | } |
| 10865 | 10811 | |
| @@ -10868,7 +10814,7 @@ extension Nil { | ||
| 10868 | 10814 | extension Obj4 { |
| 10869 | 10815 | convenience init(data: Data) throws { |
| 10870 | 10816 | let me = try newJSONDecoder().decode(Obj4.self, from: data) |
| 10871 | - self.init(dummy: me.dummy, noSuchMethod: me.noSuchMethod, noexcept: me.noexcept, nonatomic: me.nonatomic, none: me.none, nonlocal: me.nonlocal, not: me.not, notEq: me.notEq, nsError: me.nsError, nsObject: me.nsObject, nsString: me.nsString, null: me.null, nullptr: me.nullptr, number: me.number, obj4None: me.obj4None, obj4Nonmutating: me.obj4Nonmutating, obj4Null: me.obj4Null, obj4Open: me.obj4Open, obj4Operator: me.obj4Operator, obj4Optional: me.obj4Optional, obj4Override: me.obj4Override, obj4Postfix: me.obj4Postfix, obj4Precedence: me.obj4Precedence, obj4Prefix: me.obj4Prefix, obj4Private: me.obj4Private, obj4Protocol: me.obj4Protocol, obj4Public: me.obj4Public, obj4Repeat: me.obj4Repeat, obj4Required: me.obj4Required, obj4Retain: me.obj4Retain, obj4Rethrows: me.obj4Rethrows, obj4Return: me.obj4Return, obj4Right: me.obj4Right, object: me.object, objectMapper: me.objectMapper, of: me.of, oneway: me.oneway, or: me.or, orEq: me.orEq, out: me.out, package: me.package, params: me.params, pass: me.pass, port: me.port, print: me.print, printMembers: me.printMembers, printf: me.printf, protected: me.protected, purpleProtocol: me.purpleProtocol, quicktype: me.quicktype, raise: me.raise, range: me.range, readonly: me.readonly, ref: me.ref, regExp: me.regExp, register: me.register, reinterpretCast: me.reinterpretCast, require: me.require, requires: me.requires, restrict: me.restrict, runtimeType: me.runtimeType, s: me.s, sbyte: me.sbyte, sealed: me.sealed, sel: me.sel) | |
| 10817 | + self.init(dummy: me.dummy, no: me.no, noSuchMethod: me.noSuchMethod, noexcept: me.noexcept, nonatomic: me.nonatomic, none: me.none, nonlocal: me.nonlocal, not: me.not, notEq: me.notEq, nsError: me.nsError, nsObject: me.nsObject, nsString: me.nsString, null: me.null, nullptr: me.nullptr, number: me.number, obj4Nil: me.obj4Nil, obj4None: me.obj4None, obj4Nonmutating: me.obj4Nonmutating, obj4Null: me.obj4Null, obj4Open: me.obj4Open, obj4Operator: me.obj4Operator, obj4Optional: me.obj4Optional, obj4Override: me.obj4Override, obj4Postfix: me.obj4Postfix, obj4Precedence: me.obj4Precedence, obj4Prefix: me.obj4Prefix, obj4Private: me.obj4Private, obj4Protocol: me.obj4Protocol, obj4Public: me.obj4Public, obj4Repeat: me.obj4Repeat, obj4Required: me.obj4Required, obj4Retain: me.obj4Retain, obj4Rethrows: me.obj4Rethrows, obj4Return: me.obj4Return, obj4Right: me.obj4Right, object: me.object, objectMapper: me.objectMapper, of: me.of, oneway: me.oneway, or: me.or, orEq: me.orEq, out: me.out, package: me.package, params: me.params, pass: me.pass, port: me.port, print: me.print, printMembers: me.printMembers, printf: me.printf, protected: me.protected, purpleProtocol: me.purpleProtocol, quicktype: me.quicktype, raise: me.raise, range: me.range, readonly: me.readonly, ref: me.ref, regExp: me.regExp, register: me.register, reinterpretCast: me.reinterpretCast, require: me.require, requires: me.requires, restrict: me.restrict, runtimeType: me.runtimeType, s: me.s, sbyte: me.sbyte) | |
| 10872 | 10818 | } |
| 10873 | 10819 | |
| 10874 | 10820 | convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { |
| @@ -10884,6 +10830,7 @@ extension Obj4 { | ||
| 10884 | 10830 | |
| 10885 | 10831 | func with( |
| 10886 | 10832 | dummy: Int? = nil, |
| 10833 | + no: No? = nil, | |
| 10887 | 10834 | noSuchMethod: NoSuchMethod? = nil, |
| 10888 | 10835 | noexcept: Noexcept? = nil, |
| 10889 | 10836 | nonatomic: Nonatomic? = nil, |
| @@ -10897,6 +10844,7 @@ extension Obj4 { | ||
| 10897 | 10844 | null: Null? = nil, |
| 10898 | 10845 | nullptr: Nullptr? = nil, |
| 10899 | 10846 | number: Number? = nil, |
| 10847 | + obj4Nil: Nil? = nil, | |
| 10900 | 10848 | obj4None: NoneClass? = nil, |
| 10901 | 10849 | obj4Nonmutating: Nonmutating? = nil, |
| 10902 | 10850 | obj4Null: NullClass? = nil, |
| @@ -10945,12 +10893,11 @@ extension Obj4 { | ||
| 10945 | 10893 | restrict: Restrict? = nil, |
| 10946 | 10894 | runtimeType: RuntimeType? = nil, |
| 10947 | 10895 | s: S? = nil, |
| 10948 | - sbyte: Sbyte? = nil, | |
| 10949 | - sealed: Sealed? = nil, | |
| 10950 | - sel: Sel? = nil | |
| 10896 | + sbyte: Sbyte? = nil | |
| 10951 | 10897 | ) -> Obj4 { |
| 10952 | 10898 | return Obj4( |
| 10953 | 10899 | dummy: dummy ?? self.dummy, |
| 10900 | + no: no ?? self.no, | |
| 10954 | 10901 | noSuchMethod: noSuchMethod ?? self.noSuchMethod, |
| 10955 | 10902 | noexcept: noexcept ?? self.noexcept, |
| 10956 | 10903 | nonatomic: nonatomic ?? self.nonatomic, |
| @@ -10964,6 +10911,7 @@ extension Obj4 { | ||
| 10964 | 10911 | null: null ?? self.null, |
| 10965 | 10912 | nullptr: nullptr ?? self.nullptr, |
| 10966 | 10913 | number: number ?? self.number, |
| 10914 | + obj4Nil: obj4Nil ?? self.obj4Nil, | |
| 10967 | 10915 | obj4None: obj4None ?? self.obj4None, |
| 10968 | 10916 | obj4Nonmutating: obj4Nonmutating ?? self.obj4Nonmutating, |
| 10969 | 10917 | obj4Null: obj4Null ?? self.obj4Null, |
| @@ -11012,9 +10960,56 @@ extension Obj4 { | ||
| 11012 | 10960 | restrict: restrict ?? self.restrict, |
| 11013 | 10961 | runtimeType: runtimeType ?? self.runtimeType, |
| 11014 | 10962 | s: s ?? self.s, |
| 11015 | - sbyte: sbyte ?? self.sbyte, | |
| 11016 | - sealed: sealed ?? self.sealed, | |
| 11017 | - sel: sel ?? self.sel | |
| 10963 | + sbyte: sbyte ?? self.sbyte | |
| 10964 | + ) | |
| 10965 | + } | |
| 10966 | + | |
| 10967 | + func jsonData() throws -> Data { | |
| 10968 | + return try newJSONEncoder().encode(self) | |
| 10969 | + } | |
| 10970 | + | |
| 10971 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 10972 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 10973 | + } | |
| 10974 | +} | |
| 10975 | + | |
| 10976 | +// MARK: - No | |
| 10977 | +@objcMembers class No: NSObject, Codable { | |
| 10978 | + let no: Int | |
| 10979 | + | |
| 10980 | + enum CodingKeys: String, CodingKey { | |
| 10981 | + case no = "NO" | |
| 10982 | + } | |
| 10983 | + | |
| 10984 | + init(no: Int) { | |
| 10985 | + self.no = no | |
| 10986 | + } | |
| 10987 | +} | |
| 10988 | + | |
| 10989 | +// MARK: No convenience initializers and mutators | |
| 10990 | + | |
| 10991 | +extension No { | |
| 10992 | + convenience init(data: Data) throws { | |
| 10993 | + let me = try newJSONDecoder().decode(No.self, from: data) | |
| 10994 | + self.init(no: me.no) | |
| 10995 | + } | |
| 10996 | + | |
| 10997 | + convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 10998 | + guard let data = json.data(using: encoding) else { | |
| 10999 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 11000 | + } | |
| 11001 | + try self.init(data: data) | |
| 11002 | + } | |
| 11003 | + | |
| 11004 | + convenience init(fromURL url: URL) throws { | |
| 11005 | + try self.init(data: try Data(contentsOf: url)) | |
| 11006 | + } | |
| 11007 | + | |
| 11008 | + func with( | |
| 11009 | + no: Int? = nil | |
| 11010 | + ) -> No { | |
| 11011 | + return No( | |
| 11012 | + no: no ?? self.no | |
| 11018 | 11013 | ) |
| 11019 | 11014 | } |
| 11020 | 11015 | |
| @@ -11664,6 +11659,55 @@ extension Number { | ||
| 11664 | 11659 | } |
| 11665 | 11660 | } |
| 11666 | 11661 | |
| 11662 | +// MARK: - Nil | |
| 11663 | +@objcMembers class Nil: NSObject, Codable { | |
| 11664 | + let nilNil: Int | |
| 11665 | + | |
| 11666 | + enum CodingKeys: String, CodingKey { | |
| 11667 | + case nilNil = "nil" | |
| 11668 | + } | |
| 11669 | + | |
| 11670 | + init(nilNil: Int) { | |
| 11671 | + self.nilNil = nilNil | |
| 11672 | + } | |
| 11673 | +} | |
| 11674 | + | |
| 11675 | +// MARK: Nil convenience initializers and mutators | |
| 11676 | + | |
| 11677 | +extension Nil { | |
| 11678 | + convenience init(data: Data) throws { | |
| 11679 | + let me = try newJSONDecoder().decode(Nil.self, from: data) | |
| 11680 | + self.init(nilNil: me.nilNil) | |
| 11681 | + } | |
| 11682 | + | |
| 11683 | + convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 11684 | + guard let data = json.data(using: encoding) else { | |
| 11685 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 11686 | + } | |
| 11687 | + try self.init(data: data) | |
| 11688 | + } | |
| 11689 | + | |
| 11690 | + convenience init(fromURL url: URL) throws { | |
| 11691 | + try self.init(data: try Data(contentsOf: url)) | |
| 11692 | + } | |
| 11693 | + | |
| 11694 | + func with( | |
| 11695 | + nilNil: Int? = nil | |
| 11696 | + ) -> Nil { | |
| 11697 | + return Nil( | |
| 11698 | + nilNil: nilNil ?? self.nilNil | |
| 11699 | + ) | |
| 11700 | + } | |
| 11701 | + | |
| 11702 | + func jsonData() throws -> Data { | |
| 11703 | + return try newJSONEncoder().encode(self) | |
| 11704 | + } | |
| 11705 | + | |
| 11706 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 11707 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 11708 | + } | |
| 11709 | +} | |
| 11710 | + | |
| 11667 | 11711 | // MARK: - NoneClass |
| 11668 | 11712 | @objcMembers class NoneClass: NSObject, Codable { |
| 11669 | 11713 | let none: Int |
| @@ -14065,104 +14109,6 @@ extension Sbyte { | ||
| 14065 | 14109 | } |
| 14066 | 14110 | } |
| 14067 | 14111 | |
| 14068 | -// MARK: - Sealed | |
| 14069 | -@objcMembers class Sealed: NSObject, Codable { | |
| 14070 | - let sealed: Int | |
| 14071 | - | |
| 14072 | - enum CodingKeys: String, CodingKey { | |
| 14073 | - case sealed = "sealed" | |
| 14074 | - } | |
| 14075 | - | |
| 14076 | - init(sealed: Int) { | |
| 14077 | - self.sealed = sealed | |
| 14078 | - } | |
| 14079 | -} | |
| 14080 | - | |
| 14081 | -// MARK: Sealed convenience initializers and mutators | |
| 14082 | - | |
| 14083 | -extension Sealed { | |
| 14084 | - convenience init(data: Data) throws { | |
| 14085 | - let me = try newJSONDecoder().decode(Sealed.self, from: data) | |
| 14086 | - self.init(sealed: me.sealed) | |
| 14087 | - } | |
| 14088 | - | |
| 14089 | - convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 14090 | - guard let data = json.data(using: encoding) else { | |
| 14091 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 14092 | - } | |
| 14093 | - try self.init(data: data) | |
| 14094 | - } | |
| 14095 | - | |
| 14096 | - convenience init(fromURL url: URL) throws { | |
| 14097 | - try self.init(data: try Data(contentsOf: url)) | |
| 14098 | - } | |
| 14099 | - | |
| 14100 | - func with( | |
| 14101 | - sealed: Int? = nil | |
| 14102 | - ) -> Sealed { | |
| 14103 | - return Sealed( | |
| 14104 | - sealed: sealed ?? self.sealed | |
| 14105 | - ) | |
| 14106 | - } | |
| 14107 | - | |
| 14108 | - func jsonData() throws -> Data { | |
| 14109 | - return try newJSONEncoder().encode(self) | |
| 14110 | - } | |
| 14111 | - | |
| 14112 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 14113 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 14114 | - } | |
| 14115 | -} | |
| 14116 | - | |
| 14117 | -// MARK: - Sel | |
| 14118 | -@objcMembers class Sel: NSObject, Codable { | |
| 14119 | - let sel: Int | |
| 14120 | - | |
| 14121 | - enum CodingKeys: String, CodingKey { | |
| 14122 | - case sel = "SEL" | |
| 14123 | - } | |
| 14124 | - | |
| 14125 | - init(sel: Int) { | |
| 14126 | - self.sel = sel | |
| 14127 | - } | |
| 14128 | -} | |
| 14129 | - | |
| 14130 | -// MARK: Sel convenience initializers and mutators | |
| 14131 | - | |
| 14132 | -extension Sel { | |
| 14133 | - convenience init(data: Data) throws { | |
| 14134 | - let me = try newJSONDecoder().decode(Sel.self, from: data) | |
| 14135 | - self.init(sel: me.sel) | |
| 14136 | - } | |
| 14137 | - | |
| 14138 | - convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 14139 | - guard let data = json.data(using: encoding) else { | |
| 14140 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 14141 | - } | |
| 14142 | - try self.init(data: data) | |
| 14143 | - } | |
| 14144 | - | |
| 14145 | - convenience init(fromURL url: URL) throws { | |
| 14146 | - try self.init(data: try Data(contentsOf: url)) | |
| 14147 | - } | |
| 14148 | - | |
| 14149 | - func with( | |
| 14150 | - sel: Int? = nil | |
| 14151 | - ) -> Sel { | |
| 14152 | - return Sel( | |
| 14153 | - sel: sel ?? self.sel | |
| 14154 | - ) | |
| 14155 | - } | |
| 14156 | - | |
| 14157 | - func jsonData() throws -> Data { | |
| 14158 | - return try newJSONEncoder().encode(self) | |
| 14159 | - } | |
| 14160 | - | |
| 14161 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 14162 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 14163 | - } | |
| 14164 | -} | |
| 14165 | - | |
| 14166 | 14112 | // MARK: - Obj5 |
| 14167 | 14113 | @objcMembers class Obj5: NSObject, Codable { |
| 14168 | 14114 | let dummy: Int |
| @@ -14180,10 +14126,11 @@ extension Sel { | ||
| 14180 | 14126 | let obj5Try: Try |
| 14181 | 14127 | let obj5Type: Obj5Type |
| 14182 | 14128 | let obj5Typealias: Typealias |
| 14183 | - let obj5Unowned: Unowned | |
| 14184 | 14129 | let primitiveKind: PrimitiveKind |
| 14185 | 14130 | let purpleSelf: Obj5Self |
| 14186 | 14131 | let purpleTrue: TrueClass |
| 14132 | + let sealed: Sealed | |
| 14133 | + let sel: Sel | |
| 14187 | 14134 | let select: Select |
| 14188 | 14135 | let sendable: Sendable |
| 14189 | 14136 | let serialDescriptor: SerialDescriptor |
| @@ -14229,8 +14176,6 @@ extension Sel { | ||
| 14229 | 14176 | let undefined: Undefined |
| 14230 | 14177 | let union: Union |
| 14231 | 14178 | let unmarshalJSON: UnmarshalJSON |
| 14232 | - let unsafe: Unsafe | |
| 14233 | - let useSerializers: UseSerializers | |
| 14234 | 14179 | |
| 14235 | 14180 | enum CodingKeys: String, CodingKey { |
| 14236 | 14181 | case dummy = "dummy" |
| @@ -14248,10 +14193,11 @@ extension Sel { | ||
| 14248 | 14193 | case obj5Try = "try" |
| 14249 | 14194 | case obj5Type = "type" |
| 14250 | 14195 | case obj5Typealias = "typealias" |
| 14251 | - case obj5Unowned = "unowned" | |
| 14252 | 14196 | case primitiveKind = "PrimitiveKind" |
| 14253 | 14197 | case purpleSelf = "self" |
| 14254 | 14198 | case purpleTrue = "true" |
| 14199 | + case sealed = "sealed" | |
| 14200 | + case sel = "SEL" | |
| 14255 | 14201 | case select = "select" |
| 14256 | 14202 | case sendable = "Sendable" |
| 14257 | 14203 | case serialDescriptor = "SerialDescriptor" |
| @@ -14297,11 +14243,9 @@ extension Sel { | ||
| 14297 | 14243 | case undefined = "undefined" |
| 14298 | 14244 | case union = "union" |
| 14299 | 14245 | case unmarshalJSON = "UnmarshalJSON" |
| 14300 | - case unsafe = "unsafe" | |
| 14301 | - case useSerializers = "UseSerializers" | |
| 14302 | 14246 | } |
| 14303 | 14247 | |
| 14304 | - init(dummy: Int, kSerializer: KSerializer, obj5Self: SelfClass, obj5Set: Set, obj5Static: Static, obj5Struct: Struct, obj5Subscript: Subscript, obj5Super: Super, obj5Switch: Switch, obj5Throw: Throw, obj5Throws: Throws, obj5True: True, obj5Try: Try, obj5Type: Obj5Type, obj5Typealias: Typealias, obj5Unowned: Unowned, primitiveKind: PrimitiveKind, purpleSelf: Obj5Self, purpleTrue: TrueClass, select: Select, sendable: Sendable, serialDescriptor: SerialDescriptor, serialName: SerialName, serializable: Serializable, serialize: Serialize, serializerProvider: SerializerProvider, short: Short, signed: Signed, simpleModule: SimpleModule, sizeof: Sizeof, stackalloc: Stackalloc, standards: Standards, staticAssert: StaticAssert, staticCast: StaticCast, stdDeserializer: StdDeserializer, stdSerializer: StdSerializer, strictfp: Strictfp, string: StringClass, symbol: Symbol, synchronized: Synchronized, system: System, template: Template, then: Then, this: This, threadLocal: ThreadLocal, timeOnly: TimeOnly, timeOnlyConverter: TimeOnlyConverter, timeZone: TimeZoneClass, toDict: ToDict, toJSON: ToJSON, toString: ToString, topLevel: TopLevelClass, transient: Transient, type: TypeClass, typedef: Typedef, typeid: Typeid, typename: Typename, typeof: Typeof, uint: Uint, ulong: Ulong, unchecked: Unchecked, undefined: Undefined, union: Union, unmarshalJSON: UnmarshalJSON, unsafe: Unsafe, useSerializers: UseSerializers) { | |
| 14248 | + init(dummy: Int, kSerializer: KSerializer, obj5Self: SelfClass, obj5Set: Set, obj5Static: Static, obj5Struct: Struct, obj5Subscript: Subscript, obj5Super: Super, obj5Switch: Switch, obj5Throw: Throw, obj5Throws: Throws, obj5True: True, obj5Try: Try, obj5Type: Obj5Type, obj5Typealias: Typealias, primitiveKind: PrimitiveKind, purpleSelf: Obj5Self, purpleTrue: TrueClass, sealed: Sealed, sel: Sel, select: Select, sendable: Sendable, serialDescriptor: SerialDescriptor, serialName: SerialName, serializable: Serializable, serialize: Serialize, serializerProvider: SerializerProvider, short: Short, signed: Signed, simpleModule: SimpleModule, sizeof: Sizeof, stackalloc: Stackalloc, standards: Standards, staticAssert: StaticAssert, staticCast: StaticCast, stdDeserializer: StdDeserializer, stdSerializer: StdSerializer, strictfp: Strictfp, string: StringClass, symbol: Symbol, synchronized: Synchronized, system: System, template: Template, then: Then, this: This, threadLocal: ThreadLocal, timeOnly: TimeOnly, timeOnlyConverter: TimeOnlyConverter, timeZone: TimeZoneClass, toDict: ToDict, toJSON: ToJSON, toString: ToString, topLevel: TopLevelClass, transient: Transient, type: TypeClass, typedef: Typedef, typeid: Typeid, typename: Typename, typeof: Typeof, uint: Uint, ulong: Ulong, unchecked: Unchecked, undefined: Undefined, union: Union, unmarshalJSON: UnmarshalJSON) { | |
| 14305 | 14249 | self.dummy = dummy |
| 14306 | 14250 | self.kSerializer = kSerializer |
| 14307 | 14251 | self.obj5Self = obj5Self |
| @@ -14317,10 +14261,11 @@ extension Sel { | ||
| 14317 | 14261 | self.obj5Try = obj5Try |
| 14318 | 14262 | self.obj5Type = obj5Type |
| 14319 | 14263 | self.obj5Typealias = obj5Typealias |
| 14320 | - self.obj5Unowned = obj5Unowned | |
| 14321 | 14264 | self.primitiveKind = primitiveKind |
| 14322 | 14265 | self.purpleSelf = purpleSelf |
| 14323 | 14266 | self.purpleTrue = purpleTrue |
| 14267 | + self.sealed = sealed | |
| 14268 | + self.sel = sel | |
| 14324 | 14269 | self.select = select |
| 14325 | 14270 | self.sendable = sendable |
| 14326 | 14271 | self.serialDescriptor = serialDescriptor |
| @@ -14366,8 +14311,6 @@ extension Sel { | ||
| 14366 | 14311 | self.undefined = undefined |
| 14367 | 14312 | self.union = union |
| 14368 | 14313 | self.unmarshalJSON = unmarshalJSON |
| 14369 | - self.unsafe = unsafe | |
| 14370 | - self.useSerializers = useSerializers | |
| 14371 | 14314 | } |
| 14372 | 14315 | } |
| 14373 | 14316 | |
| @@ -14376,7 +14319,7 @@ extension Sel { | ||
| 14376 | 14319 | extension Obj5 { |
| 14377 | 14320 | convenience init(data: Data) throws { |
| 14378 | 14321 | let me = try newJSONDecoder().decode(Obj5.self, from: data) |
| 14379 | - self.init(dummy: me.dummy, kSerializer: me.kSerializer, obj5Self: me.obj5Self, obj5Set: me.obj5Set, obj5Static: me.obj5Static, obj5Struct: me.obj5Struct, obj5Subscript: me.obj5Subscript, obj5Super: me.obj5Super, obj5Switch: me.obj5Switch, obj5Throw: me.obj5Throw, obj5Throws: me.obj5Throws, obj5True: me.obj5True, obj5Try: me.obj5Try, obj5Type: me.obj5Type, obj5Typealias: me.obj5Typealias, obj5Unowned: me.obj5Unowned, primitiveKind: me.primitiveKind, purpleSelf: me.purpleSelf, purpleTrue: me.purpleTrue, select: me.select, sendable: me.sendable, serialDescriptor: me.serialDescriptor, serialName: me.serialName, serializable: me.serializable, serialize: me.serialize, serializerProvider: me.serializerProvider, short: me.short, signed: me.signed, simpleModule: me.simpleModule, sizeof: me.sizeof, stackalloc: me.stackalloc, standards: me.standards, staticAssert: me.staticAssert, staticCast: me.staticCast, stdDeserializer: me.stdDeserializer, stdSerializer: me.stdSerializer, strictfp: me.strictfp, string: me.string, symbol: me.symbol, synchronized: me.synchronized, system: me.system, template: me.template, then: me.then, this: me.this, threadLocal: me.threadLocal, timeOnly: me.timeOnly, timeOnlyConverter: me.timeOnlyConverter, timeZone: me.timeZone, toDict: me.toDict, toJSON: me.toJSON, toString: me.toString, topLevel: me.topLevel, transient: me.transient, type: me.type, typedef: me.typedef, typeid: me.typeid, typename: me.typename, typeof: me.typeof, uint: me.uint, ulong: me.ulong, unchecked: me.unchecked, undefined: me.undefined, union: me.union, unmarshalJSON: me.unmarshalJSON, unsafe: me.unsafe, useSerializers: me.useSerializers) | |
| 14322 | + self.init(dummy: me.dummy, kSerializer: me.kSerializer, obj5Self: me.obj5Self, obj5Set: me.obj5Set, obj5Static: me.obj5Static, obj5Struct: me.obj5Struct, obj5Subscript: me.obj5Subscript, obj5Super: me.obj5Super, obj5Switch: me.obj5Switch, obj5Throw: me.obj5Throw, obj5Throws: me.obj5Throws, obj5True: me.obj5True, obj5Try: me.obj5Try, obj5Type: me.obj5Type, obj5Typealias: me.obj5Typealias, primitiveKind: me.primitiveKind, purpleSelf: me.purpleSelf, purpleTrue: me.purpleTrue, sealed: me.sealed, sel: me.sel, select: me.select, sendable: me.sendable, serialDescriptor: me.serialDescriptor, serialName: me.serialName, serializable: me.serializable, serialize: me.serialize, serializerProvider: me.serializerProvider, short: me.short, signed: me.signed, simpleModule: me.simpleModule, sizeof: me.sizeof, stackalloc: me.stackalloc, standards: me.standards, staticAssert: me.staticAssert, staticCast: me.staticCast, stdDeserializer: me.stdDeserializer, stdSerializer: me.stdSerializer, strictfp: me.strictfp, string: me.string, symbol: me.symbol, synchronized: me.synchronized, system: me.system, template: me.template, then: me.then, this: me.this, threadLocal: me.threadLocal, timeOnly: me.timeOnly, timeOnlyConverter: me.timeOnlyConverter, timeZone: me.timeZone, toDict: me.toDict, toJSON: me.toJSON, toString: me.toString, topLevel: me.topLevel, transient: me.transient, type: me.type, typedef: me.typedef, typeid: me.typeid, typename: me.typename, typeof: me.typeof, uint: me.uint, ulong: me.ulong, unchecked: me.unchecked, undefined: me.undefined, union: me.union, unmarshalJSON: me.unmarshalJSON) | |
| 14380 | 14323 | } |
| 14381 | 14324 | |
| 14382 | 14325 | convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { |
| @@ -14406,10 +14349,11 @@ extension Obj5 { | ||
| 14406 | 14349 | obj5Try: Try? = nil, |
| 14407 | 14350 | obj5Type: Obj5Type? = nil, |
| 14408 | 14351 | obj5Typealias: Typealias? = nil, |
| 14409 | - obj5Unowned: Unowned? = nil, | |
| 14410 | 14352 | primitiveKind: PrimitiveKind? = nil, |
| 14411 | 14353 | purpleSelf: Obj5Self? = nil, |
| 14412 | 14354 | purpleTrue: TrueClass? = nil, |
| 14355 | + sealed: Sealed? = nil, | |
| 14356 | + sel: Sel? = nil, | |
| 14413 | 14357 | select: Select? = nil, |
| 14414 | 14358 | sendable: Sendable? = nil, |
| 14415 | 14359 | serialDescriptor: SerialDescriptor? = nil, |
| @@ -14454,9 +14398,7 @@ extension Obj5 { | ||
| 14454 | 14398 | unchecked: Unchecked? = nil, |
| 14455 | 14399 | undefined: Undefined? = nil, |
| 14456 | 14400 | union: Union? = nil, |
| 14457 | - unmarshalJSON: UnmarshalJSON? = nil, | |
| 14458 | - unsafe: Unsafe? = nil, | |
| 14459 | - useSerializers: UseSerializers? = nil | |
| 14401 | + unmarshalJSON: UnmarshalJSON? = nil | |
| 14460 | 14402 | ) -> Obj5 { |
| 14461 | 14403 | return Obj5( |
| 14462 | 14404 | dummy: dummy ?? self.dummy, |
| @@ -14474,10 +14416,11 @@ extension Obj5 { | ||
| 14474 | 14416 | obj5Try: obj5Try ?? self.obj5Try, |
| 14475 | 14417 | obj5Type: obj5Type ?? self.obj5Type, |
| 14476 | 14418 | obj5Typealias: obj5Typealias ?? self.obj5Typealias, |
| 14477 | - obj5Unowned: obj5Unowned ?? self.obj5Unowned, | |
| 14478 | 14419 | primitiveKind: primitiveKind ?? self.primitiveKind, |
| 14479 | 14420 | purpleSelf: purpleSelf ?? self.purpleSelf, |
| 14480 | 14421 | purpleTrue: purpleTrue ?? self.purpleTrue, |
| 14422 | + sealed: sealed ?? self.sealed, | |
| 14423 | + sel: sel ?? self.sel, | |
| 14481 | 14424 | select: select ?? self.select, |
| 14482 | 14425 | sendable: sendable ?? self.sendable, |
| 14483 | 14426 | serialDescriptor: serialDescriptor ?? self.serialDescriptor, |
| @@ -14522,9 +14465,7 @@ extension Obj5 { | ||
| 14522 | 14465 | unchecked: unchecked ?? self.unchecked, |
| 14523 | 14466 | undefined: undefined ?? self.undefined, |
| 14524 | 14467 | union: union ?? self.union, |
| 14525 | - unmarshalJSON: unmarshalJSON ?? self.unmarshalJSON, | |
| 14526 | - unsafe: unsafe ?? self.unsafe, | |
| 14527 | - useSerializers: useSerializers ?? self.useSerializers | |
| 14468 | + unmarshalJSON: unmarshalJSON ?? self.unmarshalJSON | |
| 14528 | 14469 | ) |
| 14529 | 14470 | } |
| 14530 | 14471 | |
| @@ -15223,55 +15164,6 @@ extension Typealias { | ||
| 15223 | 15164 | } |
| 15224 | 15165 | } |
| 15225 | 15166 | |
| 15226 | -// MARK: - Unowned | |
| 15227 | -@objcMembers class Unowned: NSObject, Codable { | |
| 15228 | - let unownedUnowned: Int | |
| 15229 | - | |
| 15230 | - enum CodingKeys: String, CodingKey { | |
| 15231 | - case unownedUnowned = "unowned" | |
| 15232 | - } | |
| 15233 | - | |
| 15234 | - init(unownedUnowned: Int) { | |
| 15235 | - self.unownedUnowned = unownedUnowned | |
| 15236 | - } | |
| 15237 | -} | |
| 15238 | - | |
| 15239 | -// MARK: Unowned convenience initializers and mutators | |
| 15240 | - | |
| 15241 | -extension Unowned { | |
| 15242 | - convenience init(data: Data) throws { | |
| 15243 | - let me = try newJSONDecoder().decode(Unowned.self, from: data) | |
| 15244 | - self.init(unownedUnowned: me.unownedUnowned) | |
| 15245 | - } | |
| 15246 | - | |
| 15247 | - convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 15248 | - guard let data = json.data(using: encoding) else { | |
| 15249 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 15250 | - } | |
| 15251 | - try self.init(data: data) | |
| 15252 | - } | |
| 15253 | - | |
| 15254 | - convenience init(fromURL url: URL) throws { | |
| 15255 | - try self.init(data: try Data(contentsOf: url)) | |
| 15256 | - } | |
| 15257 | - | |
| 15258 | - func with( | |
| 15259 | - unownedUnowned: Int? = nil | |
| 15260 | - ) -> Unowned { | |
| 15261 | - return Unowned( | |
| 15262 | - unownedUnowned: unownedUnowned ?? self.unownedUnowned | |
| 15263 | - ) | |
| 15264 | - } | |
| 15265 | - | |
| 15266 | - func jsonData() throws -> Data { | |
| 15267 | - return try newJSONEncoder().encode(self) | |
| 15268 | - } | |
| 15269 | - | |
| 15270 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 15271 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 15272 | - } | |
| 15273 | -} | |
| 15274 | - | |
| 15275 | 15167 | // MARK: - PrimitiveKind |
| 15276 | 15168 | @objcMembers class PrimitiveKind: NSObject, Codable { |
| 15277 | 15169 | let primitiveKind: Int |
| @@ -15419,6 +15311,104 @@ extension TrueClass { | ||
| 15419 | 15311 | } |
| 15420 | 15312 | } |
| 15421 | 15313 | |
| 15314 | +// MARK: - Sealed | |
| 15315 | +@objcMembers class Sealed: NSObject, Codable { | |
| 15316 | + let sealed: Int | |
| 15317 | + | |
| 15318 | + enum CodingKeys: String, CodingKey { | |
| 15319 | + case sealed = "sealed" | |
| 15320 | + } | |
| 15321 | + | |
| 15322 | + init(sealed: Int) { | |
| 15323 | + self.sealed = sealed | |
| 15324 | + } | |
| 15325 | +} | |
| 15326 | + | |
| 15327 | +// MARK: Sealed convenience initializers and mutators | |
| 15328 | + | |
| 15329 | +extension Sealed { | |
| 15330 | + convenience init(data: Data) throws { | |
| 15331 | + let me = try newJSONDecoder().decode(Sealed.self, from: data) | |
| 15332 | + self.init(sealed: me.sealed) | |
| 15333 | + } | |
| 15334 | + | |
| 15335 | + convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 15336 | + guard let data = json.data(using: encoding) else { | |
| 15337 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 15338 | + } | |
| 15339 | + try self.init(data: data) | |
| 15340 | + } | |
| 15341 | + | |
| 15342 | + convenience init(fromURL url: URL) throws { | |
| 15343 | + try self.init(data: try Data(contentsOf: url)) | |
| 15344 | + } | |
| 15345 | + | |
| 15346 | + func with( | |
| 15347 | + sealed: Int? = nil | |
| 15348 | + ) -> Sealed { | |
| 15349 | + return Sealed( | |
| 15350 | + sealed: sealed ?? self.sealed | |
| 15351 | + ) | |
| 15352 | + } | |
| 15353 | + | |
| 15354 | + func jsonData() throws -> Data { | |
| 15355 | + return try newJSONEncoder().encode(self) | |
| 15356 | + } | |
| 15357 | + | |
| 15358 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 15359 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 15360 | + } | |
| 15361 | +} | |
| 15362 | + | |
| 15363 | +// MARK: - Sel | |
| 15364 | +@objcMembers class Sel: NSObject, Codable { | |
| 15365 | + let sel: Int | |
| 15366 | + | |
| 15367 | + enum CodingKeys: String, CodingKey { | |
| 15368 | + case sel = "SEL" | |
| 15369 | + } | |
| 15370 | + | |
| 15371 | + init(sel: Int) { | |
| 15372 | + self.sel = sel | |
| 15373 | + } | |
| 15374 | +} | |
| 15375 | + | |
| 15376 | +// MARK: Sel convenience initializers and mutators | |
| 15377 | + | |
| 15378 | +extension Sel { | |
| 15379 | + convenience init(data: Data) throws { | |
| 15380 | + let me = try newJSONDecoder().decode(Sel.self, from: data) | |
| 15381 | + self.init(sel: me.sel) | |
| 15382 | + } | |
| 15383 | + | |
| 15384 | + convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 15385 | + guard let data = json.data(using: encoding) else { | |
| 15386 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 15387 | + } | |
| 15388 | + try self.init(data: data) | |
| 15389 | + } | |
| 15390 | + | |
| 15391 | + convenience init(fromURL url: URL) throws { | |
| 15392 | + try self.init(data: try Data(contentsOf: url)) | |
| 15393 | + } | |
| 15394 | + | |
| 15395 | + func with( | |
| 15396 | + sel: Int? = nil | |
| 15397 | + ) -> Sel { | |
| 15398 | + return Sel( | |
| 15399 | + sel: sel ?? self.sel | |
| 15400 | + ) | |
| 15401 | + } | |
| 15402 | + | |
| 15403 | + func jsonData() throws -> Data { | |
| 15404 | + return try newJSONEncoder().encode(self) | |
| 15405 | + } | |
| 15406 | + | |
| 15407 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 15408 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 15409 | + } | |
| 15410 | +} | |
| 15411 | + | |
| 15422 | 15412 | // MARK: - Select |
| 15423 | 15413 | @objcMembers class Select: NSObject, Codable { |
| 15424 | 15414 | let select: Int |
| @@ -17624,113 +17614,18 @@ extension UnmarshalJSON { | ||
| 17624 | 17614 | } |
| 17625 | 17615 | } |
| 17626 | 17616 | |
| 17627 | -// MARK: - Unsafe | |
| 17628 | -@objcMembers class Unsafe: NSObject, Codable { | |
| 17629 | - let unsafe: Int | |
| 17630 | - | |
| 17631 | - enum CodingKeys: String, CodingKey { | |
| 17632 | - case unsafe = "unsafe" | |
| 17633 | - } | |
| 17634 | - | |
| 17635 | - init(unsafe: Int) { | |
| 17636 | - self.unsafe = unsafe | |
| 17637 | - } | |
| 17638 | -} | |
| 17639 | - | |
| 17640 | -// MARK: Unsafe convenience initializers and mutators | |
| 17641 | - | |
| 17642 | -extension Unsafe { | |
| 17643 | - convenience init(data: Data) throws { | |
| 17644 | - let me = try newJSONDecoder().decode(Unsafe.self, from: data) | |
| 17645 | - self.init(unsafe: me.unsafe) | |
| 17646 | - } | |
| 17647 | - | |
| 17648 | - convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 17649 | - guard let data = json.data(using: encoding) else { | |
| 17650 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 17651 | - } | |
| 17652 | - try self.init(data: data) | |
| 17653 | - } | |
| 17654 | - | |
| 17655 | - convenience init(fromURL url: URL) throws { | |
| 17656 | - try self.init(data: try Data(contentsOf: url)) | |
| 17657 | - } | |
| 17658 | - | |
| 17659 | - func with( | |
| 17660 | - unsafe: Int? = nil | |
| 17661 | - ) -> Unsafe { | |
| 17662 | - return Unsafe( | |
| 17663 | - unsafe: unsafe ?? self.unsafe | |
| 17664 | - ) | |
| 17665 | - } | |
| 17666 | - | |
| 17667 | - func jsonData() throws -> Data { | |
| 17668 | - return try newJSONEncoder().encode(self) | |
| 17669 | - } | |
| 17670 | - | |
| 17671 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 17672 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 17673 | - } | |
| 17674 | -} | |
| 17675 | - | |
| 17676 | -// MARK: - UseSerializers | |
| 17677 | -@objcMembers class UseSerializers: NSObject, Codable { | |
| 17678 | - let useSerializers: Int | |
| 17679 | - | |
| 17680 | - enum CodingKeys: String, CodingKey { | |
| 17681 | - case useSerializers = "UseSerializers" | |
| 17682 | - } | |
| 17683 | - | |
| 17684 | - init(useSerializers: Int) { | |
| 17685 | - self.useSerializers = useSerializers | |
| 17686 | - } | |
| 17687 | -} | |
| 17688 | - | |
| 17689 | -// MARK: UseSerializers convenience initializers and mutators | |
| 17690 | - | |
| 17691 | -extension UseSerializers { | |
| 17692 | - convenience init(data: Data) throws { | |
| 17693 | - let me = try newJSONDecoder().decode(UseSerializers.self, from: data) | |
| 17694 | - self.init(useSerializers: me.useSerializers) | |
| 17695 | - } | |
| 17696 | - | |
| 17697 | - convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 17698 | - guard let data = json.data(using: encoding) else { | |
| 17699 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 17700 | - } | |
| 17701 | - try self.init(data: data) | |
| 17702 | - } | |
| 17703 | - | |
| 17704 | - convenience init(fromURL url: URL) throws { | |
| 17705 | - try self.init(data: try Data(contentsOf: url)) | |
| 17706 | - } | |
| 17707 | - | |
| 17708 | - func with( | |
| 17709 | - useSerializers: Int? = nil | |
| 17710 | - ) -> UseSerializers { | |
| 17711 | - return UseSerializers( | |
| 17712 | - useSerializers: useSerializers ?? self.useSerializers | |
| 17713 | - ) | |
| 17714 | - } | |
| 17715 | - | |
| 17716 | - func jsonData() throws -> Data { | |
| 17717 | - return try newJSONEncoder().encode(self) | |
| 17718 | - } | |
| 17719 | - | |
| 17720 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 17721 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 17722 | - } | |
| 17723 | -} | |
| 17724 | - | |
| 17725 | 17617 | // MARK: - Obj6 |
| 17726 | 17618 | @objcMembers class Obj6: NSObject, Codable { |
| 17727 | 17619 | let dummy: Int |
| 17620 | + let obj6Unowned: Unowned | |
| 17728 | 17621 | let obj6Var: Var |
| 17729 | 17622 | let obj6Weak: Weak |
| 17730 | 17623 | let obj6Where: Where |
| 17731 | 17624 | let obj6While: While |
| 17732 | 17625 | let obj6WillSet: WillSet |
| 17626 | + let unsafe: Unsafe | |
| 17733 | 17627 | let unsigned: Unsigned |
| 17628 | + let useSerializers: UseSerializers | |
| 17734 | 17629 | let ushort: Ushort |
| 17735 | 17630 | let using: Using |
| 17736 | 17631 | let utf8JSONReader: Utf8JSONReader |
| @@ -17748,12 +17643,15 @@ extension UseSerializers { | ||
| 17748 | 17643 | |
| 17749 | 17644 | enum CodingKeys: String, CodingKey { |
| 17750 | 17645 | case dummy = "dummy" |
| 17646 | + case obj6Unowned = "unowned" | |
| 17751 | 17647 | case obj6Var = "var" |
| 17752 | 17648 | case obj6Weak = "weak" |
| 17753 | 17649 | case obj6Where = "where" |
| 17754 | 17650 | case obj6While = "while" |
| 17755 | 17651 | case obj6WillSet = "willSet" |
| 17652 | + case unsafe = "unsafe" | |
| 17756 | 17653 | case unsigned = "unsigned" |
| 17654 | + case useSerializers = "UseSerializers" | |
| 17757 | 17655 | case ushort = "ushort" |
| 17758 | 17656 | case using = "using" |
| 17759 | 17657 | case utf8JSONReader = "Utf8JsonReader" |
| @@ -17770,14 +17668,17 @@ extension UseSerializers { | ||
| 17770 | 17668 | case yield = "yield" |
| 17771 | 17669 | } |
| 17772 | 17670 | |
| 17773 | - init(dummy: Int, obj6Var: Var, obj6Weak: Weak, obj6Where: Where, obj6While: While, obj6WillSet: WillSet, unsigned: Unsigned, ushort: Ushort, using: Using, utf8JSONReader: Utf8JSONReader, utf8JSONWriter: Utf8JSONWriter, uuid: UUIDClass, virtual: Virtual, void: Void, volatile: Volatile, wcharT: WcharT, with: With, xor: Xor, xorEq: XorEq, yes: Yes, yield: Yield) { | |
| 17671 | + init(dummy: Int, obj6Unowned: Unowned, obj6Var: Var, obj6Weak: Weak, obj6Where: Where, obj6While: While, obj6WillSet: WillSet, unsafe: Unsafe, unsigned: Unsigned, useSerializers: UseSerializers, ushort: Ushort, using: Using, utf8JSONReader: Utf8JSONReader, utf8JSONWriter: Utf8JSONWriter, uuid: UUIDClass, virtual: Virtual, void: Void, volatile: Volatile, wcharT: WcharT, with: With, xor: Xor, xorEq: XorEq, yes: Yes, yield: Yield) { | |
| 17774 | 17672 | self.dummy = dummy |
| 17673 | + self.obj6Unowned = obj6Unowned | |
| 17775 | 17674 | self.obj6Var = obj6Var |
| 17776 | 17675 | self.obj6Weak = obj6Weak |
| 17777 | 17676 | self.obj6Where = obj6Where |
| 17778 | 17677 | self.obj6While = obj6While |
| 17779 | 17678 | self.obj6WillSet = obj6WillSet |
| 17679 | + self.unsafe = unsafe | |
| 17780 | 17680 | self.unsigned = unsigned |
| 17681 | + self.useSerializers = useSerializers | |
| 17781 | 17682 | self.ushort = ushort |
| 17782 | 17683 | self.using = using |
| 17783 | 17684 | self.utf8JSONReader = utf8JSONReader |
| @@ -17800,7 +17701,7 @@ extension UseSerializers { | ||
| 17800 | 17701 | extension Obj6 { |
| 17801 | 17702 | convenience init(data: Data) throws { |
| 17802 | 17703 | let me = try newJSONDecoder().decode(Obj6.self, from: data) |
| 17803 | - self.init(dummy: me.dummy, obj6Var: me.obj6Var, obj6Weak: me.obj6Weak, obj6Where: me.obj6Where, obj6While: me.obj6While, obj6WillSet: me.obj6WillSet, unsigned: me.unsigned, ushort: me.ushort, using: me.using, utf8JSONReader: me.utf8JSONReader, utf8JSONWriter: me.utf8JSONWriter, uuid: me.uuid, virtual: me.virtual, void: me.void, volatile: me.volatile, wcharT: me.wcharT, with: me.with, xor: me.xor, xorEq: me.xorEq, yes: me.yes, yield: me.yield) | |
| 17704 | + self.init(dummy: me.dummy, obj6Unowned: me.obj6Unowned, obj6Var: me.obj6Var, obj6Weak: me.obj6Weak, obj6Where: me.obj6Where, obj6While: me.obj6While, obj6WillSet: me.obj6WillSet, unsafe: me.unsafe, unsigned: me.unsigned, useSerializers: me.useSerializers, ushort: me.ushort, using: me.using, utf8JSONReader: me.utf8JSONReader, utf8JSONWriter: me.utf8JSONWriter, uuid: me.uuid, virtual: me.virtual, void: me.void, volatile: me.volatile, wcharT: me.wcharT, with: me.with, xor: me.xor, xorEq: me.xorEq, yes: me.yes, yield: me.yield) | |
| 17804 | 17705 | } |
| 17805 | 17706 | |
| 17806 | 17707 | convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { |
| @@ -17816,12 +17717,15 @@ extension Obj6 { | ||
| 17816 | 17717 | |
| 17817 | 17718 | func with( |
| 17818 | 17719 | dummy: Int? = nil, |
| 17720 | + obj6Unowned: Unowned? = nil, | |
| 17819 | 17721 | obj6Var: Var? = nil, |
| 17820 | 17722 | obj6Weak: Weak? = nil, |
| 17821 | 17723 | obj6Where: Where? = nil, |
| 17822 | 17724 | obj6While: While? = nil, |
| 17823 | 17725 | obj6WillSet: WillSet? = nil, |
| 17726 | + unsafe: Unsafe? = nil, | |
| 17824 | 17727 | unsigned: Unsigned? = nil, |
| 17728 | + useSerializers: UseSerializers? = nil, | |
| 17825 | 17729 | ushort: Ushort? = nil, |
| 17826 | 17730 | using: Using? = nil, |
| 17827 | 17731 | utf8JSONReader: Utf8JSONReader? = nil, |
| @@ -17839,12 +17743,15 @@ extension Obj6 { | ||
| 17839 | 17743 | ) -> Obj6 { |
| 17840 | 17744 | return Obj6( |
| 17841 | 17745 | dummy: dummy ?? self.dummy, |
| 17746 | + obj6Unowned: obj6Unowned ?? self.obj6Unowned, | |
| 17842 | 17747 | obj6Var: obj6Var ?? self.obj6Var, |
| 17843 | 17748 | obj6Weak: obj6Weak ?? self.obj6Weak, |
| 17844 | 17749 | obj6Where: obj6Where ?? self.obj6Where, |
| 17845 | 17750 | obj6While: obj6While ?? self.obj6While, |
| 17846 | 17751 | obj6WillSet: obj6WillSet ?? self.obj6WillSet, |
| 17752 | + unsafe: unsafe ?? self.unsafe, | |
| 17847 | 17753 | unsigned: unsigned ?? self.unsigned, |
| 17754 | + useSerializers: useSerializers ?? self.useSerializers, | |
| 17848 | 17755 | ushort: ushort ?? self.ushort, |
| 17849 | 17756 | using: using ?? self.using, |
| 17850 | 17757 | utf8JSONReader: utf8JSONReader ?? self.utf8JSONReader, |
| @@ -17871,6 +17778,55 @@ extension Obj6 { | ||
| 17871 | 17778 | } |
| 17872 | 17779 | } |
| 17873 | 17780 | |
| 17781 | +// MARK: - Unowned | |
| 17782 | +@objcMembers class Unowned: NSObject, Codable { | |
| 17783 | + let unownedUnowned: Int | |
| 17784 | + | |
| 17785 | + enum CodingKeys: String, CodingKey { | |
| 17786 | + case unownedUnowned = "unowned" | |
| 17787 | + } | |
| 17788 | + | |
| 17789 | + init(unownedUnowned: Int) { | |
| 17790 | + self.unownedUnowned = unownedUnowned | |
| 17791 | + } | |
| 17792 | +} | |
| 17793 | + | |
| 17794 | +// MARK: Unowned convenience initializers and mutators | |
| 17795 | + | |
| 17796 | +extension Unowned { | |
| 17797 | + convenience init(data: Data) throws { | |
| 17798 | + let me = try newJSONDecoder().decode(Unowned.self, from: data) | |
| 17799 | + self.init(unownedUnowned: me.unownedUnowned) | |
| 17800 | + } | |
| 17801 | + | |
| 17802 | + convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 17803 | + guard let data = json.data(using: encoding) else { | |
| 17804 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 17805 | + } | |
| 17806 | + try self.init(data: data) | |
| 17807 | + } | |
| 17808 | + | |
| 17809 | + convenience init(fromURL url: URL) throws { | |
| 17810 | + try self.init(data: try Data(contentsOf: url)) | |
| 17811 | + } | |
| 17812 | + | |
| 17813 | + func with( | |
| 17814 | + unownedUnowned: Int? = nil | |
| 17815 | + ) -> Unowned { | |
| 17816 | + return Unowned( | |
| 17817 | + unownedUnowned: unownedUnowned ?? self.unownedUnowned | |
| 17818 | + ) | |
| 17819 | + } | |
| 17820 | + | |
| 17821 | + func jsonData() throws -> Data { | |
| 17822 | + return try newJSONEncoder().encode(self) | |
| 17823 | + } | |
| 17824 | + | |
| 17825 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 17826 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 17827 | + } | |
| 17828 | +} | |
| 17829 | + | |
| 17874 | 17830 | // MARK: - Var |
| 17875 | 17831 | @objcMembers class Var: NSObject, Codable { |
| 17876 | 17832 | let varVar: Int |
| @@ -18116,6 +18072,55 @@ extension WillSet { | ||
| 18116 | 18072 | } |
| 18117 | 18073 | } |
| 18118 | 18074 | |
| 18075 | +// MARK: - Unsafe | |
| 18076 | +@objcMembers class Unsafe: NSObject, Codable { | |
| 18077 | + let unsafe: Int | |
| 18078 | + | |
| 18079 | + enum CodingKeys: String, CodingKey { | |
| 18080 | + case unsafe = "unsafe" | |
| 18081 | + } | |
| 18082 | + | |
| 18083 | + init(unsafe: Int) { | |
| 18084 | + self.unsafe = unsafe | |
| 18085 | + } | |
| 18086 | +} | |
| 18087 | + | |
| 18088 | +// MARK: Unsafe convenience initializers and mutators | |
| 18089 | + | |
| 18090 | +extension Unsafe { | |
| 18091 | + convenience init(data: Data) throws { | |
| 18092 | + let me = try newJSONDecoder().decode(Unsafe.self, from: data) | |
| 18093 | + self.init(unsafe: me.unsafe) | |
| 18094 | + } | |
| 18095 | + | |
| 18096 | + convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 18097 | + guard let data = json.data(using: encoding) else { | |
| 18098 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 18099 | + } | |
| 18100 | + try self.init(data: data) | |
| 18101 | + } | |
| 18102 | + | |
| 18103 | + convenience init(fromURL url: URL) throws { | |
| 18104 | + try self.init(data: try Data(contentsOf: url)) | |
| 18105 | + } | |
| 18106 | + | |
| 18107 | + func with( | |
| 18108 | + unsafe: Int? = nil | |
| 18109 | + ) -> Unsafe { | |
| 18110 | + return Unsafe( | |
| 18111 | + unsafe: unsafe ?? self.unsafe | |
| 18112 | + ) | |
| 18113 | + } | |
| 18114 | + | |
| 18115 | + func jsonData() throws -> Data { | |
| 18116 | + return try newJSONEncoder().encode(self) | |
| 18117 | + } | |
| 18118 | + | |
| 18119 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 18120 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 18121 | + } | |
| 18122 | +} | |
| 18123 | + | |
| 18119 | 18124 | // MARK: - Unsigned |
| 18120 | 18125 | @objcMembers class Unsigned: NSObject, Codable { |
| 18121 | 18126 | let unsigned: Int |
| @@ -18165,6 +18170,55 @@ extension Unsigned { | ||
| 18165 | 18170 | } |
| 18166 | 18171 | } |
| 18167 | 18172 | |
| 18173 | +// MARK: - UseSerializers | |
| 18174 | +@objcMembers class UseSerializers: NSObject, Codable { | |
| 18175 | + let useSerializers: Int | |
| 18176 | + | |
| 18177 | + enum CodingKeys: String, CodingKey { | |
| 18178 | + case useSerializers = "UseSerializers" | |
| 18179 | + } | |
| 18180 | + | |
| 18181 | + init(useSerializers: Int) { | |
| 18182 | + self.useSerializers = useSerializers | |
| 18183 | + } | |
| 18184 | +} | |
| 18185 | + | |
| 18186 | +// MARK: UseSerializers convenience initializers and mutators | |
| 18187 | + | |
| 18188 | +extension UseSerializers { | |
| 18189 | + convenience init(data: Data) throws { | |
| 18190 | + let me = try newJSONDecoder().decode(UseSerializers.self, from: data) | |
| 18191 | + self.init(useSerializers: me.useSerializers) | |
| 18192 | + } | |
| 18193 | + | |
| 18194 | + convenience init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 18195 | + guard let data = json.data(using: encoding) else { | |
| 18196 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 18197 | + } | |
| 18198 | + try self.init(data: data) | |
| 18199 | + } | |
| 18200 | + | |
| 18201 | + convenience init(fromURL url: URL) throws { | |
| 18202 | + try self.init(data: try Data(contentsOf: url)) | |
| 18203 | + } | |
| 18204 | + | |
| 18205 | + func with( | |
| 18206 | + useSerializers: Int? = nil | |
| 18207 | + ) -> UseSerializers { | |
| 18208 | + return UseSerializers( | |
| 18209 | + useSerializers: useSerializers ?? self.useSerializers | |
| 18210 | + ) | |
| 18211 | + } | |
| 18212 | + | |
| 18213 | + func jsonData() throws -> Data { | |
| 18214 | + return try newJSONEncoder().encode(self) | |
| 18215 | + } | |
| 18216 | + | |
| 18217 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 18218 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 18219 | + } | |
| 18220 | +} | |
| 18221 | + | |
| 18168 | 18222 | // MARK: - Ushort |
| 18169 | 18223 | @objcMembers class Ushort: NSObject, Codable { |
| 18170 | 18224 | let ushort: Int |
Mswiftprotocol-equatable--bd9068f466c1 / quicktype.swift+432 −378
| @@ -7143,6 +7143,7 @@ struct Obj3: Codable, Equatable { | ||
| 7143 | 7143 | let locale: LocaleClass |
| 7144 | 7144 | let lock: Lock |
| 7145 | 7145 | let long: Long |
| 7146 | + let makeDictEncoder: MakeDictEncoder | |
| 7146 | 7147 | let map: Map |
| 7147 | 7148 | let mapEntry: MapEntry |
| 7148 | 7149 | let marshalJSON: MarshalJSON |
| @@ -7153,7 +7154,6 @@ struct Obj3: Codable, Equatable { | ||
| 7153 | 7154 | let native: Native |
| 7154 | 7155 | let new: New |
| 7155 | 7156 | let newtonsoft: Newtonsoft |
| 7156 | - let no: No | |
| 7157 | 7157 | let obj3Guard: Guard |
| 7158 | 7158 | let obj3If: If |
| 7159 | 7159 | let obj3Import: Import |
| @@ -7169,7 +7169,6 @@ struct Obj3: Codable, Equatable { | ||
| 7169 | 7169 | let obj3Left: Left |
| 7170 | 7170 | let obj3Let: Let |
| 7171 | 7171 | let obj3Mutating: Mutating |
| 7172 | - let obj3Nil: Nil | |
| 7173 | 7172 | |
| 7174 | 7173 | enum CodingKeys: String, CodingKey { |
| 7175 | 7174 | case dummy = "dummy" |
| @@ -7211,6 +7210,7 @@ struct Obj3: Codable, Equatable { | ||
| 7211 | 7210 | case locale = "Locale" |
| 7212 | 7211 | case lock = "lock" |
| 7213 | 7212 | case long = "long" |
| 7213 | + case makeDictEncoder = "makeDictEncoder" | |
| 7214 | 7214 | case map = "map" |
| 7215 | 7215 | case mapEntry = "MapEntry" |
| 7216 | 7216 | case marshalJSON = "MarshalJSON" |
| @@ -7221,7 +7221,6 @@ struct Obj3: Codable, Equatable { | ||
| 7221 | 7221 | case native = "native" |
| 7222 | 7222 | case new = "new" |
| 7223 | 7223 | case newtonsoft = "newtonsoft" |
| 7224 | - case no = "NO" | |
| 7225 | 7224 | case obj3Guard = "guard" |
| 7226 | 7225 | case obj3If = "if" |
| 7227 | 7226 | case obj3Import = "import" |
| @@ -7237,7 +7236,6 @@ struct Obj3: Codable, Equatable { | ||
| 7237 | 7236 | case obj3Left = "left" |
| 7238 | 7237 | case obj3Let = "let" |
| 7239 | 7238 | case obj3Mutating = "mutating" |
| 7240 | - case obj3Nil = "nil" | |
| 7241 | 7239 | } |
| 7242 | 7240 | } |
| 7243 | 7241 | |
| @@ -7299,6 +7297,7 @@ extension Obj3 { | ||
| 7299 | 7297 | locale: LocaleClass? = nil, |
| 7300 | 7298 | lock: Lock? = nil, |
| 7301 | 7299 | long: Long? = nil, |
| 7300 | + makeDictEncoder: MakeDictEncoder? = nil, | |
| 7302 | 7301 | map: Map? = nil, |
| 7303 | 7302 | mapEntry: MapEntry? = nil, |
| 7304 | 7303 | marshalJSON: MarshalJSON? = nil, |
| @@ -7309,7 +7308,6 @@ extension Obj3 { | ||
| 7309 | 7308 | native: Native? = nil, |
| 7310 | 7309 | new: New? = nil, |
| 7311 | 7310 | newtonsoft: Newtonsoft? = nil, |
| 7312 | - no: No? = nil, | |
| 7313 | 7311 | obj3Guard: Guard? = nil, |
| 7314 | 7312 | obj3If: If? = nil, |
| 7315 | 7313 | obj3Import: Import? = nil, |
| @@ -7324,8 +7322,7 @@ extension Obj3 { | ||
| 7324 | 7322 | obj3Lazy: Lazy? = nil, |
| 7325 | 7323 | obj3Left: Left? = nil, |
| 7326 | 7324 | obj3Let: Let? = nil, |
| 7327 | - obj3Mutating: Mutating? = nil, | |
| 7328 | - obj3Nil: Nil? = nil | |
| 7325 | + obj3Mutating: Mutating? = nil | |
| 7329 | 7326 | ) -> Obj3 { |
| 7330 | 7327 | return Obj3( |
| 7331 | 7328 | dummy: dummy ?? self.dummy, |
| @@ -7367,6 +7364,7 @@ extension Obj3 { | ||
| 7367 | 7364 | locale: locale ?? self.locale, |
| 7368 | 7365 | lock: lock ?? self.lock, |
| 7369 | 7366 | long: long ?? self.long, |
| 7367 | + makeDictEncoder: makeDictEncoder ?? self.makeDictEncoder, | |
| 7370 | 7368 | map: map ?? self.map, |
| 7371 | 7369 | mapEntry: mapEntry ?? self.mapEntry, |
| 7372 | 7370 | marshalJSON: marshalJSON ?? self.marshalJSON, |
| @@ -7377,7 +7375,6 @@ extension Obj3 { | ||
| 7377 | 7375 | native: native ?? self.native, |
| 7378 | 7376 | new: new ?? self.new, |
| 7379 | 7377 | newtonsoft: newtonsoft ?? self.newtonsoft, |
| 7380 | - no: no ?? self.no, | |
| 7381 | 7378 | obj3Guard: obj3Guard ?? self.obj3Guard, |
| 7382 | 7379 | obj3If: obj3If ?? self.obj3If, |
| 7383 | 7380 | obj3Import: obj3Import ?? self.obj3Import, |
| @@ -7392,8 +7389,7 @@ extension Obj3 { | ||
| 7392 | 7389 | obj3Lazy: obj3Lazy ?? self.obj3Lazy, |
| 7393 | 7390 | obj3Left: obj3Left ?? self.obj3Left, |
| 7394 | 7391 | obj3Let: obj3Let ?? self.obj3Let, |
| 7395 | - obj3Mutating: obj3Mutating ?? self.obj3Mutating, | |
| 7396 | - obj3Nil: obj3Nil ?? self.obj3Nil | |
| 7392 | + obj3Mutating: obj3Mutating ?? self.obj3Mutating | |
| 7397 | 7393 | ) |
| 7398 | 7394 | } |
| 7399 | 7395 | |
| @@ -9312,6 +9308,56 @@ extension Long { | ||
| 9312 | 9308 | // for types that require the use of JSONAny, nor will the implementation of Hashable be |
| 9313 | 9309 | // synthesized for types that have collections (such as arrays or dictionaries). |
| 9314 | 9310 | |
| 9311 | +// MARK: - MakeDictEncoder | |
| 9312 | +struct MakeDictEncoder: Codable, Equatable { | |
| 9313 | + let makeDictEncoder: Int | |
| 9314 | + | |
| 9315 | + enum CodingKeys: String, CodingKey { | |
| 9316 | + case makeDictEncoder = "makeDictEncoder" | |
| 9317 | + } | |
| 9318 | +} | |
| 9319 | + | |
| 9320 | +// MARK: MakeDictEncoder convenience initializers and mutators | |
| 9321 | + | |
| 9322 | +extension MakeDictEncoder { | |
| 9323 | + init(data: Data) throws { | |
| 9324 | + self = try newJSONDecoder().decode(MakeDictEncoder.self, from: data) | |
| 9325 | + } | |
| 9326 | + | |
| 9327 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 9328 | + guard let data = json.data(using: encoding) else { | |
| 9329 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 9330 | + } | |
| 9331 | + try self.init(data: data) | |
| 9332 | + } | |
| 9333 | + | |
| 9334 | + init(fromURL url: URL) throws { | |
| 9335 | + try self.init(data: try Data(contentsOf: url)) | |
| 9336 | + } | |
| 9337 | + | |
| 9338 | + func with( | |
| 9339 | + makeDictEncoder: Int? = nil | |
| 9340 | + ) -> MakeDictEncoder { | |
| 9341 | + return MakeDictEncoder( | |
| 9342 | + makeDictEncoder: makeDictEncoder ?? self.makeDictEncoder | |
| 9343 | + ) | |
| 9344 | + } | |
| 9345 | + | |
| 9346 | + func jsonData() throws -> Data { | |
| 9347 | + return try newJSONEncoder().encode(self) | |
| 9348 | + } | |
| 9349 | + | |
| 9350 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 9351 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 9352 | + } | |
| 9353 | +} | |
| 9354 | + | |
| 9355 | +// | |
| 9356 | +// Hashable or Equatable: | |
| 9357 | +// The compiler will not be able to synthesize the implementation of Hashable or Equatable | |
| 9358 | +// for types that require the use of JSONAny, nor will the implementation of Hashable be | |
| 9359 | +// synthesized for types that have collections (such as arrays or dictionaries). | |
| 9360 | + | |
| 9315 | 9361 | // MARK: - Map |
| 9316 | 9362 | struct Map: Codable, Equatable { |
| 9317 | 9363 | let map: Int |
| @@ -9812,56 +9858,6 @@ extension Newtonsoft { | ||
| 9812 | 9858 | // for types that require the use of JSONAny, nor will the implementation of Hashable be |
| 9813 | 9859 | // synthesized for types that have collections (such as arrays or dictionaries). |
| 9814 | 9860 | |
| 9815 | -// MARK: - No | |
| 9816 | -struct No: Codable, Equatable { | |
| 9817 | - let no: Int | |
| 9818 | - | |
| 9819 | - enum CodingKeys: String, CodingKey { | |
| 9820 | - case no = "NO" | |
| 9821 | - } | |
| 9822 | -} | |
| 9823 | - | |
| 9824 | -// MARK: No convenience initializers and mutators | |
| 9825 | - | |
| 9826 | -extension No { | |
| 9827 | - init(data: Data) throws { | |
| 9828 | - self = try newJSONDecoder().decode(No.self, from: data) | |
| 9829 | - } | |
| 9830 | - | |
| 9831 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 9832 | - guard let data = json.data(using: encoding) else { | |
| 9833 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 9834 | - } | |
| 9835 | - try self.init(data: data) | |
| 9836 | - } | |
| 9837 | - | |
| 9838 | - init(fromURL url: URL) throws { | |
| 9839 | - try self.init(data: try Data(contentsOf: url)) | |
| 9840 | - } | |
| 9841 | - | |
| 9842 | - func with( | |
| 9843 | - no: Int? = nil | |
| 9844 | - ) -> No { | |
| 9845 | - return No( | |
| 9846 | - no: no ?? self.no | |
| 9847 | - ) | |
| 9848 | - } | |
| 9849 | - | |
| 9850 | - func jsonData() throws -> Data { | |
| 9851 | - return try newJSONEncoder().encode(self) | |
| 9852 | - } | |
| 9853 | - | |
| 9854 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 9855 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 9856 | - } | |
| 9857 | -} | |
| 9858 | - | |
| 9859 | -// | |
| 9860 | -// Hashable or Equatable: | |
| 9861 | -// The compiler will not be able to synthesize the implementation of Hashable or Equatable | |
| 9862 | -// for types that require the use of JSONAny, nor will the implementation of Hashable be | |
| 9863 | -// synthesized for types that have collections (such as arrays or dictionaries). | |
| 9864 | - | |
| 9865 | 9861 | // MARK: - Guard |
| 9866 | 9862 | struct Guard: Codable, Equatable { |
| 9867 | 9863 | let guardGuard: Int |
| @@ -10612,59 +10608,10 @@ extension Mutating { | ||
| 10612 | 10608 | // for types that require the use of JSONAny, nor will the implementation of Hashable be |
| 10613 | 10609 | // synthesized for types that have collections (such as arrays or dictionaries). |
| 10614 | 10610 | |
| 10615 | -// MARK: - Nil | |
| 10616 | -struct Nil: Codable, Equatable { | |
| 10617 | - let nilNil: Int | |
| 10618 | - | |
| 10619 | - enum CodingKeys: String, CodingKey { | |
| 10620 | - case nilNil = "nil" | |
| 10621 | - } | |
| 10622 | -} | |
| 10623 | - | |
| 10624 | -// MARK: Nil convenience initializers and mutators | |
| 10625 | - | |
| 10626 | -extension Nil { | |
| 10627 | - init(data: Data) throws { | |
| 10628 | - self = try newJSONDecoder().decode(Nil.self, from: data) | |
| 10629 | - } | |
| 10630 | - | |
| 10631 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 10632 | - guard let data = json.data(using: encoding) else { | |
| 10633 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 10634 | - } | |
| 10635 | - try self.init(data: data) | |
| 10636 | - } | |
| 10637 | - | |
| 10638 | - init(fromURL url: URL) throws { | |
| 10639 | - try self.init(data: try Data(contentsOf: url)) | |
| 10640 | - } | |
| 10641 | - | |
| 10642 | - func with( | |
| 10643 | - nilNil: Int? = nil | |
| 10644 | - ) -> Nil { | |
| 10645 | - return Nil( | |
| 10646 | - nilNil: nilNil ?? self.nilNil | |
| 10647 | - ) | |
| 10648 | - } | |
| 10649 | - | |
| 10650 | - func jsonData() throws -> Data { | |
| 10651 | - return try newJSONEncoder().encode(self) | |
| 10652 | - } | |
| 10653 | - | |
| 10654 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 10655 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 10656 | - } | |
| 10657 | -} | |
| 10658 | - | |
| 10659 | -// | |
| 10660 | -// Hashable or Equatable: | |
| 10661 | -// The compiler will not be able to synthesize the implementation of Hashable or Equatable | |
| 10662 | -// for types that require the use of JSONAny, nor will the implementation of Hashable be | |
| 10663 | -// synthesized for types that have collections (such as arrays or dictionaries). | |
| 10664 | - | |
| 10665 | 10611 | // MARK: - Obj4 |
| 10666 | 10612 | struct Obj4: Codable, Equatable { |
| 10667 | 10613 | let dummy: Int |
| 10614 | + let no: No | |
| 10668 | 10615 | let noSuchMethod: NoSuchMethod |
| 10669 | 10616 | let noexcept: Noexcept |
| 10670 | 10617 | let nonatomic: Nonatomic |
| @@ -10678,6 +10625,7 @@ struct Obj4: Codable, Equatable { | ||
| 10678 | 10625 | let null: Null |
| 10679 | 10626 | let nullptr: Nullptr |
| 10680 | 10627 | let number: Number |
| 10628 | + let obj4Nil: Nil | |
| 10681 | 10629 | let obj4None: NoneClass |
| 10682 | 10630 | let obj4Nonmutating: Nonmutating |
| 10683 | 10631 | let obj4Null: NullClass |
| @@ -10727,11 +10675,10 @@ struct Obj4: Codable, Equatable { | ||
| 10727 | 10675 | let runtimeType: RuntimeType |
| 10728 | 10676 | let s: S |
| 10729 | 10677 | let sbyte: Sbyte |
| 10730 | - let sealed: Sealed | |
| 10731 | - let sel: Sel | |
| 10732 | 10678 | |
| 10733 | 10679 | enum CodingKeys: String, CodingKey { |
| 10734 | 10680 | case dummy = "dummy" |
| 10681 | + case no = "NO" | |
| 10735 | 10682 | case noSuchMethod = "noSuchMethod" |
| 10736 | 10683 | case noexcept = "noexcept" |
| 10737 | 10684 | case nonatomic = "nonatomic" |
| @@ -10745,6 +10692,7 @@ struct Obj4: Codable, Equatable { | ||
| 10745 | 10692 | case null = "NULL" |
| 10746 | 10693 | case nullptr = "nullptr" |
| 10747 | 10694 | case number = "number" |
| 10695 | + case obj4Nil = "nil" | |
| 10748 | 10696 | case obj4None = "none" |
| 10749 | 10697 | case obj4Nonmutating = "nonmutating" |
| 10750 | 10698 | case obj4Null = "null" |
| @@ -10794,8 +10742,6 @@ struct Obj4: Codable, Equatable { | ||
| 10794 | 10742 | case runtimeType = "runtimeType" |
| 10795 | 10743 | case s = "s" |
| 10796 | 10744 | case sbyte = "sbyte" |
| 10797 | - case sealed = "sealed" | |
| 10798 | - case sel = "SEL" | |
| 10799 | 10745 | } |
| 10800 | 10746 | } |
| 10801 | 10747 | |
| @@ -10819,6 +10765,7 @@ extension Obj4 { | ||
| 10819 | 10765 | |
| 10820 | 10766 | func with( |
| 10821 | 10767 | dummy: Int? = nil, |
| 10768 | + no: No? = nil, | |
| 10822 | 10769 | noSuchMethod: NoSuchMethod? = nil, |
| 10823 | 10770 | noexcept: Noexcept? = nil, |
| 10824 | 10771 | nonatomic: Nonatomic? = nil, |
| @@ -10832,6 +10779,7 @@ extension Obj4 { | ||
| 10832 | 10779 | null: Null? = nil, |
| 10833 | 10780 | nullptr: Nullptr? = nil, |
| 10834 | 10781 | number: Number? = nil, |
| 10782 | + obj4Nil: Nil? = nil, | |
| 10835 | 10783 | obj4None: NoneClass? = nil, |
| 10836 | 10784 | obj4Nonmutating: Nonmutating? = nil, |
| 10837 | 10785 | obj4Null: NullClass? = nil, |
| @@ -10880,12 +10828,11 @@ extension Obj4 { | ||
| 10880 | 10828 | retain: Retain? = nil, |
| 10881 | 10829 | runtimeType: RuntimeType? = nil, |
| 10882 | 10830 | s: S? = nil, |
| 10883 | - sbyte: Sbyte? = nil, | |
| 10884 | - sealed: Sealed? = nil, | |
| 10885 | - sel: Sel? = nil | |
| 10831 | + sbyte: Sbyte? = nil | |
| 10886 | 10832 | ) -> Obj4 { |
| 10887 | 10833 | return Obj4( |
| 10888 | 10834 | dummy: dummy ?? self.dummy, |
| 10835 | + no: no ?? self.no, | |
| 10889 | 10836 | noSuchMethod: noSuchMethod ?? self.noSuchMethod, |
| 10890 | 10837 | noexcept: noexcept ?? self.noexcept, |
| 10891 | 10838 | nonatomic: nonatomic ?? self.nonatomic, |
| @@ -10899,6 +10846,7 @@ extension Obj4 { | ||
| 10899 | 10846 | null: null ?? self.null, |
| 10900 | 10847 | nullptr: nullptr ?? self.nullptr, |
| 10901 | 10848 | number: number ?? self.number, |
| 10849 | + obj4Nil: obj4Nil ?? self.obj4Nil, | |
| 10902 | 10850 | obj4None: obj4None ?? self.obj4None, |
| 10903 | 10851 | obj4Nonmutating: obj4Nonmutating ?? self.obj4Nonmutating, |
| 10904 | 10852 | obj4Null: obj4Null ?? self.obj4Null, |
| @@ -10947,9 +10895,57 @@ extension Obj4 { | ||
| 10947 | 10895 | retain: retain ?? self.retain, |
| 10948 | 10896 | runtimeType: runtimeType ?? self.runtimeType, |
| 10949 | 10897 | s: s ?? self.s, |
| 10950 | - sbyte: sbyte ?? self.sbyte, | |
| 10951 | - sealed: sealed ?? self.sealed, | |
| 10952 | - sel: sel ?? self.sel | |
| 10898 | + sbyte: sbyte ?? self.sbyte | |
| 10899 | + ) | |
| 10900 | + } | |
| 10901 | + | |
| 10902 | + func jsonData() throws -> Data { | |
| 10903 | + return try newJSONEncoder().encode(self) | |
| 10904 | + } | |
| 10905 | + | |
| 10906 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 10907 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 10908 | + } | |
| 10909 | +} | |
| 10910 | + | |
| 10911 | +// | |
| 10912 | +// Hashable or Equatable: | |
| 10913 | +// The compiler will not be able to synthesize the implementation of Hashable or Equatable | |
| 10914 | +// for types that require the use of JSONAny, nor will the implementation of Hashable be | |
| 10915 | +// synthesized for types that have collections (such as arrays or dictionaries). | |
| 10916 | + | |
| 10917 | +// MARK: - No | |
| 10918 | +struct No: Codable, Equatable { | |
| 10919 | + let no: Int | |
| 10920 | + | |
| 10921 | + enum CodingKeys: String, CodingKey { | |
| 10922 | + case no = "NO" | |
| 10923 | + } | |
| 10924 | +} | |
| 10925 | + | |
| 10926 | +// MARK: No convenience initializers and mutators | |
| 10927 | + | |
| 10928 | +extension No { | |
| 10929 | + init(data: Data) throws { | |
| 10930 | + self = try newJSONDecoder().decode(No.self, from: data) | |
| 10931 | + } | |
| 10932 | + | |
| 10933 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 10934 | + guard let data = json.data(using: encoding) else { | |
| 10935 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 10936 | + } | |
| 10937 | + try self.init(data: data) | |
| 10938 | + } | |
| 10939 | + | |
| 10940 | + init(fromURL url: URL) throws { | |
| 10941 | + try self.init(data: try Data(contentsOf: url)) | |
| 10942 | + } | |
| 10943 | + | |
| 10944 | + func with( | |
| 10945 | + no: Int? = nil | |
| 10946 | + ) -> No { | |
| 10947 | + return No( | |
| 10948 | + no: no ?? self.no | |
| 10953 | 10949 | ) |
| 10954 | 10950 | } |
| 10955 | 10951 | |
| @@ -11618,6 +11614,56 @@ extension Number { | ||
| 11618 | 11614 | // for types that require the use of JSONAny, nor will the implementation of Hashable be |
| 11619 | 11615 | // synthesized for types that have collections (such as arrays or dictionaries). |
| 11620 | 11616 | |
| 11617 | +// MARK: - Nil | |
| 11618 | +struct Nil: Codable, Equatable { | |
| 11619 | + let nilNil: Int | |
| 11620 | + | |
| 11621 | + enum CodingKeys: String, CodingKey { | |
| 11622 | + case nilNil = "nil" | |
| 11623 | + } | |
| 11624 | +} | |
| 11625 | + | |
| 11626 | +// MARK: Nil convenience initializers and mutators | |
| 11627 | + | |
| 11628 | +extension Nil { | |
| 11629 | + init(data: Data) throws { | |
| 11630 | + self = try newJSONDecoder().decode(Nil.self, from: data) | |
| 11631 | + } | |
| 11632 | + | |
| 11633 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 11634 | + guard let data = json.data(using: encoding) else { | |
| 11635 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 11636 | + } | |
| 11637 | + try self.init(data: data) | |
| 11638 | + } | |
| 11639 | + | |
| 11640 | + init(fromURL url: URL) throws { | |
| 11641 | + try self.init(data: try Data(contentsOf: url)) | |
| 11642 | + } | |
| 11643 | + | |
| 11644 | + func with( | |
| 11645 | + nilNil: Int? = nil | |
| 11646 | + ) -> Nil { | |
| 11647 | + return Nil( | |
| 11648 | + nilNil: nilNil ?? self.nilNil | |
| 11649 | + ) | |
| 11650 | + } | |
| 11651 | + | |
| 11652 | + func jsonData() throws -> Data { | |
| 11653 | + return try newJSONEncoder().encode(self) | |
| 11654 | + } | |
| 11655 | + | |
| 11656 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 11657 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 11658 | + } | |
| 11659 | +} | |
| 11660 | + | |
| 11661 | +// | |
| 11662 | +// Hashable or Equatable: | |
| 11663 | +// The compiler will not be able to synthesize the implementation of Hashable or Equatable | |
| 11664 | +// for types that require the use of JSONAny, nor will the implementation of Hashable be | |
| 11665 | +// synthesized for types that have collections (such as arrays or dictionaries). | |
| 11666 | + | |
| 11621 | 11667 | // MARK: - NoneClass |
| 11622 | 11668 | struct NoneClass: Codable, Equatable { |
| 11623 | 11669 | let none: Int |
| @@ -14068,106 +14114,6 @@ extension Sbyte { | ||
| 14068 | 14114 | // for types that require the use of JSONAny, nor will the implementation of Hashable be |
| 14069 | 14115 | // synthesized for types that have collections (such as arrays or dictionaries). |
| 14070 | 14116 | |
| 14071 | -// MARK: - Sealed | |
| 14072 | -struct Sealed: Codable, Equatable { | |
| 14073 | - let sealed: Int | |
| 14074 | - | |
| 14075 | - enum CodingKeys: String, CodingKey { | |
| 14076 | - case sealed = "sealed" | |
| 14077 | - } | |
| 14078 | -} | |
| 14079 | - | |
| 14080 | -// MARK: Sealed convenience initializers and mutators | |
| 14081 | - | |
| 14082 | -extension Sealed { | |
| 14083 | - init(data: Data) throws { | |
| 14084 | - self = try newJSONDecoder().decode(Sealed.self, from: data) | |
| 14085 | - } | |
| 14086 | - | |
| 14087 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 14088 | - guard let data = json.data(using: encoding) else { | |
| 14089 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 14090 | - } | |
| 14091 | - try self.init(data: data) | |
| 14092 | - } | |
| 14093 | - | |
| 14094 | - init(fromURL url: URL) throws { | |
| 14095 | - try self.init(data: try Data(contentsOf: url)) | |
| 14096 | - } | |
| 14097 | - | |
| 14098 | - func with( | |
| 14099 | - sealed: Int? = nil | |
| 14100 | - ) -> Sealed { | |
| 14101 | - return Sealed( | |
| 14102 | - sealed: sealed ?? self.sealed | |
| 14103 | - ) | |
| 14104 | - } | |
| 14105 | - | |
| 14106 | - func jsonData() throws -> Data { | |
| 14107 | - return try newJSONEncoder().encode(self) | |
| 14108 | - } | |
| 14109 | - | |
| 14110 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 14111 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 14112 | - } | |
| 14113 | -} | |
| 14114 | - | |
| 14115 | -// | |
| 14116 | -// Hashable or Equatable: | |
| 14117 | -// The compiler will not be able to synthesize the implementation of Hashable or Equatable | |
| 14118 | -// for types that require the use of JSONAny, nor will the implementation of Hashable be | |
| 14119 | -// synthesized for types that have collections (such as arrays or dictionaries). | |
| 14120 | - | |
| 14121 | -// MARK: - Sel | |
| 14122 | -struct Sel: Codable, Equatable { | |
| 14123 | - let sel: Int | |
| 14124 | - | |
| 14125 | - enum CodingKeys: String, CodingKey { | |
| 14126 | - case sel = "SEL" | |
| 14127 | - } | |
| 14128 | -} | |
| 14129 | - | |
| 14130 | -// MARK: Sel convenience initializers and mutators | |
| 14131 | - | |
| 14132 | -extension Sel { | |
| 14133 | - init(data: Data) throws { | |
| 14134 | - self = try newJSONDecoder().decode(Sel.self, from: data) | |
| 14135 | - } | |
| 14136 | - | |
| 14137 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 14138 | - guard let data = json.data(using: encoding) else { | |
| 14139 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 14140 | - } | |
| 14141 | - try self.init(data: data) | |
| 14142 | - } | |
| 14143 | - | |
| 14144 | - init(fromURL url: URL) throws { | |
| 14145 | - try self.init(data: try Data(contentsOf: url)) | |
| 14146 | - } | |
| 14147 | - | |
| 14148 | - func with( | |
| 14149 | - sel: Int? = nil | |
| 14150 | - ) -> Sel { | |
| 14151 | - return Sel( | |
| 14152 | - sel: sel ?? self.sel | |
| 14153 | - ) | |
| 14154 | - } | |
| 14155 | - | |
| 14156 | - func jsonData() throws -> Data { | |
| 14157 | - return try newJSONEncoder().encode(self) | |
| 14158 | - } | |
| 14159 | - | |
| 14160 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 14161 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 14162 | - } | |
| 14163 | -} | |
| 14164 | - | |
| 14165 | -// | |
| 14166 | -// Hashable or Equatable: | |
| 14167 | -// The compiler will not be able to synthesize the implementation of Hashable or Equatable | |
| 14168 | -// for types that require the use of JSONAny, nor will the implementation of Hashable be | |
| 14169 | -// synthesized for types that have collections (such as arrays or dictionaries). | |
| 14170 | - | |
| 14171 | 14117 | // MARK: - Obj5 |
| 14172 | 14118 | struct Obj5: Codable, Equatable { |
| 14173 | 14119 | let dummy: Int |
| @@ -14185,10 +14131,11 @@ struct Obj5: Codable, Equatable { | ||
| 14185 | 14131 | let obj5Try: Try |
| 14186 | 14132 | let obj5Type: Obj5Type |
| 14187 | 14133 | let obj5Typealias: Typealias |
| 14188 | - let obj5Unowned: Unowned | |
| 14189 | 14134 | let primitiveKind: PrimitiveKind |
| 14190 | 14135 | let purpleSelf: Obj5Self |
| 14191 | 14136 | let purpleTrue: TrueClass |
| 14137 | + let sealed: Sealed | |
| 14138 | + let sel: Sel | |
| 14192 | 14139 | let select: Select |
| 14193 | 14140 | let sendable: Sendable |
| 14194 | 14141 | let serialDescriptor: SerialDescriptor |
| @@ -14234,8 +14181,6 @@ struct Obj5: Codable, Equatable { | ||
| 14234 | 14181 | let undefined: Undefined |
| 14235 | 14182 | let union: Union |
| 14236 | 14183 | let unmarshalJSON: UnmarshalJSON |
| 14237 | - let unsafe: Unsafe | |
| 14238 | - let useSerializers: UseSerializers | |
| 14239 | 14184 | |
| 14240 | 14185 | enum CodingKeys: String, CodingKey { |
| 14241 | 14186 | case dummy = "dummy" |
| @@ -14253,10 +14198,11 @@ struct Obj5: Codable, Equatable { | ||
| 14253 | 14198 | case obj5Try = "try" |
| 14254 | 14199 | case obj5Type = "type" |
| 14255 | 14200 | case obj5Typealias = "typealias" |
| 14256 | - case obj5Unowned = "unowned" | |
| 14257 | 14201 | case primitiveKind = "PrimitiveKind" |
| 14258 | 14202 | case purpleSelf = "self" |
| 14259 | 14203 | case purpleTrue = "true" |
| 14204 | + case sealed = "sealed" | |
| 14205 | + case sel = "SEL" | |
| 14260 | 14206 | case select = "select" |
| 14261 | 14207 | case sendable = "Sendable" |
| 14262 | 14208 | case serialDescriptor = "SerialDescriptor" |
| @@ -14302,8 +14248,6 @@ struct Obj5: Codable, Equatable { | ||
| 14302 | 14248 | case undefined = "undefined" |
| 14303 | 14249 | case union = "union" |
| 14304 | 14250 | case unmarshalJSON = "UnmarshalJSON" |
| 14305 | - case unsafe = "unsafe" | |
| 14306 | - case useSerializers = "UseSerializers" | |
| 14307 | 14251 | } |
| 14308 | 14252 | } |
| 14309 | 14253 | |
| @@ -14341,10 +14285,11 @@ extension Obj5 { | ||
| 14341 | 14285 | obj5Try: Try? = nil, |
| 14342 | 14286 | obj5Type: Obj5Type? = nil, |
| 14343 | 14287 | obj5Typealias: Typealias? = nil, |
| 14344 | - obj5Unowned: Unowned? = nil, | |
| 14345 | 14288 | primitiveKind: PrimitiveKind? = nil, |
| 14346 | 14289 | purpleSelf: Obj5Self? = nil, |
| 14347 | 14290 | purpleTrue: TrueClass? = nil, |
| 14291 | + sealed: Sealed? = nil, | |
| 14292 | + sel: Sel? = nil, | |
| 14348 | 14293 | select: Select? = nil, |
| 14349 | 14294 | sendable: Sendable? = nil, |
| 14350 | 14295 | serialDescriptor: SerialDescriptor? = nil, |
| @@ -14389,9 +14334,7 @@ extension Obj5 { | ||
| 14389 | 14334 | unchecked: Unchecked? = nil, |
| 14390 | 14335 | undefined: Undefined? = nil, |
| 14391 | 14336 | union: Union? = nil, |
| 14392 | - unmarshalJSON: UnmarshalJSON? = nil, | |
| 14393 | - unsafe: Unsafe? = nil, | |
| 14394 | - useSerializers: UseSerializers? = nil | |
| 14337 | + unmarshalJSON: UnmarshalJSON? = nil | |
| 14395 | 14338 | ) -> Obj5 { |
| 14396 | 14339 | return Obj5( |
| 14397 | 14340 | dummy: dummy ?? self.dummy, |
| @@ -14409,10 +14352,11 @@ extension Obj5 { | ||
| 14409 | 14352 | obj5Try: obj5Try ?? self.obj5Try, |
| 14410 | 14353 | obj5Type: obj5Type ?? self.obj5Type, |
| 14411 | 14354 | obj5Typealias: obj5Typealias ?? self.obj5Typealias, |
| 14412 | - obj5Unowned: obj5Unowned ?? self.obj5Unowned, | |
| 14413 | 14355 | primitiveKind: primitiveKind ?? self.primitiveKind, |
| 14414 | 14356 | purpleSelf: purpleSelf ?? self.purpleSelf, |
| 14415 | 14357 | purpleTrue: purpleTrue ?? self.purpleTrue, |
| 14358 | + sealed: sealed ?? self.sealed, | |
| 14359 | + sel: sel ?? self.sel, | |
| 14416 | 14360 | select: select ?? self.select, |
| 14417 | 14361 | sendable: sendable ?? self.sendable, |
| 14418 | 14362 | serialDescriptor: serialDescriptor ?? self.serialDescriptor, |
| @@ -14457,9 +14401,7 @@ extension Obj5 { | ||
| 14457 | 14401 | unchecked: unchecked ?? self.unchecked, |
| 14458 | 14402 | undefined: undefined ?? self.undefined, |
| 14459 | 14403 | union: union ?? self.union, |
| 14460 | - unmarshalJSON: unmarshalJSON ?? self.unmarshalJSON, | |
| 14461 | - unsafe: unsafe ?? self.unsafe, | |
| 14462 | - useSerializers: useSerializers ?? self.useSerializers | |
| 14404 | + unmarshalJSON: unmarshalJSON ?? self.unmarshalJSON | |
| 14463 | 14405 | ) |
| 14464 | 14406 | } |
| 14465 | 14407 | |
| @@ -15178,20 +15120,20 @@ extension Typealias { | ||
| 15178 | 15120 | // for types that require the use of JSONAny, nor will the implementation of Hashable be |
| 15179 | 15121 | // synthesized for types that have collections (such as arrays or dictionaries). |
| 15180 | 15122 | |
| 15181 | -// MARK: - Unowned | |
| 15182 | -struct Unowned: Codable, Equatable { | |
| 15183 | - let unownedUnowned: Int | |
| 15123 | +// MARK: - PrimitiveKind | |
| 15124 | +struct PrimitiveKind: Codable, Equatable { | |
| 15125 | + let primitiveKind: Int | |
| 15184 | 15126 | |
| 15185 | 15127 | enum CodingKeys: String, CodingKey { |
| 15186 | - case unownedUnowned = "unowned" | |
| 15128 | + case primitiveKind = "PrimitiveKind" | |
| 15187 | 15129 | } |
| 15188 | 15130 | } |
| 15189 | 15131 | |
| 15190 | -// MARK: Unowned convenience initializers and mutators | |
| 15132 | +// MARK: PrimitiveKind convenience initializers and mutators | |
| 15191 | 15133 | |
| 15192 | -extension Unowned { | |
| 15134 | +extension PrimitiveKind { | |
| 15193 | 15135 | init(data: Data) throws { |
| 15194 | - self = try newJSONDecoder().decode(Unowned.self, from: data) | |
| 15136 | + self = try newJSONDecoder().decode(PrimitiveKind.self, from: data) | |
| 15195 | 15137 | } |
| 15196 | 15138 | |
| 15197 | 15139 | init(_ json: String, using encoding: String.Encoding = .utf8) throws { |
| @@ -15206,10 +15148,10 @@ extension Unowned { | ||
| 15206 | 15148 | } |
| 15207 | 15149 | |
| 15208 | 15150 | func with( |
| 15209 | - unownedUnowned: Int? = nil | |
| 15210 | - ) -> Unowned { | |
| 15211 | - return Unowned( | |
| 15212 | - unownedUnowned: unownedUnowned ?? self.unownedUnowned | |
| 15151 | + primitiveKind: Int? = nil | |
| 15152 | + ) -> PrimitiveKind { | |
| 15153 | + return PrimitiveKind( | |
| 15154 | + primitiveKind: primitiveKind ?? self.primitiveKind | |
| 15213 | 15155 | ) |
| 15214 | 15156 | } |
| 15215 | 15157 | |
| @@ -15228,20 +15170,20 @@ extension Unowned { | ||
| 15228 | 15170 | // for types that require the use of JSONAny, nor will the implementation of Hashable be |
| 15229 | 15171 | // synthesized for types that have collections (such as arrays or dictionaries). |
| 15230 | 15172 | |
| 15231 | -// MARK: - PrimitiveKind | |
| 15232 | -struct PrimitiveKind: Codable, Equatable { | |
| 15233 | - let primitiveKind: Int | |
| 15173 | +// MARK: - Obj5Self | |
| 15174 | +struct Obj5Self: Codable, Equatable { | |
| 15175 | + let selfSelf: Int | |
| 15234 | 15176 | |
| 15235 | 15177 | enum CodingKeys: String, CodingKey { |
| 15236 | - case primitiveKind = "PrimitiveKind" | |
| 15178 | + case selfSelf = "self" | |
| 15237 | 15179 | } |
| 15238 | 15180 | } |
| 15239 | 15181 | |
| 15240 | -// MARK: PrimitiveKind convenience initializers and mutators | |
| 15182 | +// MARK: Obj5Self convenience initializers and mutators | |
| 15241 | 15183 | |
| 15242 | -extension PrimitiveKind { | |
| 15184 | +extension Obj5Self { | |
| 15243 | 15185 | init(data: Data) throws { |
| 15244 | - self = try newJSONDecoder().decode(PrimitiveKind.self, from: data) | |
| 15186 | + self = try newJSONDecoder().decode(Obj5Self.self, from: data) | |
| 15245 | 15187 | } |
| 15246 | 15188 | |
| 15247 | 15189 | init(_ json: String, using encoding: String.Encoding = .utf8) throws { |
| @@ -15256,10 +15198,10 @@ extension PrimitiveKind { | ||
| 15256 | 15198 | } |
| 15257 | 15199 | |
| 15258 | 15200 | func with( |
| 15259 | - primitiveKind: Int? = nil | |
| 15260 | - ) -> PrimitiveKind { | |
| 15261 | - return PrimitiveKind( | |
| 15262 | - primitiveKind: primitiveKind ?? self.primitiveKind | |
| 15201 | + selfSelf: Int? = nil | |
| 15202 | + ) -> Obj5Self { | |
| 15203 | + return Obj5Self( | |
| 15204 | + selfSelf: selfSelf ?? self.selfSelf | |
| 15263 | 15205 | ) |
| 15264 | 15206 | } |
| 15265 | 15207 | |
| @@ -15278,20 +15220,20 @@ extension PrimitiveKind { | ||
| 15278 | 15220 | // for types that require the use of JSONAny, nor will the implementation of Hashable be |
| 15279 | 15221 | // synthesized for types that have collections (such as arrays or dictionaries). |
| 15280 | 15222 | |
| 15281 | -// MARK: - Obj5Self | |
| 15282 | -struct Obj5Self: Codable, Equatable { | |
| 15283 | - let selfSelf: Int | |
| 15223 | +// MARK: - TrueClass | |
| 15224 | +struct TrueClass: Codable, Equatable { | |
| 15225 | + let trueTrue: Int | |
| 15284 | 15226 | |
| 15285 | 15227 | enum CodingKeys: String, CodingKey { |
| 15286 | - case selfSelf = "self" | |
| 15228 | + case trueTrue = "true" | |
| 15287 | 15229 | } |
| 15288 | 15230 | } |
| 15289 | 15231 | |
| 15290 | -// MARK: Obj5Self convenience initializers and mutators | |
| 15232 | +// MARK: TrueClass convenience initializers and mutators | |
| 15291 | 15233 | |
| 15292 | -extension Obj5Self { | |
| 15234 | +extension TrueClass { | |
| 15293 | 15235 | init(data: Data) throws { |
| 15294 | - self = try newJSONDecoder().decode(Obj5Self.self, from: data) | |
| 15236 | + self = try newJSONDecoder().decode(TrueClass.self, from: data) | |
| 15295 | 15237 | } |
| 15296 | 15238 | |
| 15297 | 15239 | init(_ json: String, using encoding: String.Encoding = .utf8) throws { |
| @@ -15306,10 +15248,10 @@ extension Obj5Self { | ||
| 15306 | 15248 | } |
| 15307 | 15249 | |
| 15308 | 15250 | func with( |
| 15309 | - selfSelf: Int? = nil | |
| 15310 | - ) -> Obj5Self { | |
| 15311 | - return Obj5Self( | |
| 15312 | - selfSelf: selfSelf ?? self.selfSelf | |
| 15251 | + trueTrue: Int? = nil | |
| 15252 | + ) -> TrueClass { | |
| 15253 | + return TrueClass( | |
| 15254 | + trueTrue: trueTrue ?? self.trueTrue | |
| 15313 | 15255 | ) |
| 15314 | 15256 | } |
| 15315 | 15257 | |
| @@ -15328,20 +15270,20 @@ extension Obj5Self { | ||
| 15328 | 15270 | // for types that require the use of JSONAny, nor will the implementation of Hashable be |
| 15329 | 15271 | // synthesized for types that have collections (such as arrays or dictionaries). |
| 15330 | 15272 | |
| 15331 | -// MARK: - TrueClass | |
| 15332 | -struct TrueClass: Codable, Equatable { | |
| 15333 | - let trueTrue: Int | |
| 15273 | +// MARK: - Sealed | |
| 15274 | +struct Sealed: Codable, Equatable { | |
| 15275 | + let sealed: Int | |
| 15334 | 15276 | |
| 15335 | 15277 | enum CodingKeys: String, CodingKey { |
| 15336 | - case trueTrue = "true" | |
| 15278 | + case sealed = "sealed" | |
| 15337 | 15279 | } |
| 15338 | 15280 | } |
| 15339 | 15281 | |
| 15340 | -// MARK: TrueClass convenience initializers and mutators | |
| 15282 | +// MARK: Sealed convenience initializers and mutators | |
| 15341 | 15283 | |
| 15342 | -extension TrueClass { | |
| 15284 | +extension Sealed { | |
| 15343 | 15285 | init(data: Data) throws { |
| 15344 | - self = try newJSONDecoder().decode(TrueClass.self, from: data) | |
| 15286 | + self = try newJSONDecoder().decode(Sealed.self, from: data) | |
| 15345 | 15287 | } |
| 15346 | 15288 | |
| 15347 | 15289 | init(_ json: String, using encoding: String.Encoding = .utf8) throws { |
| @@ -15356,10 +15298,60 @@ extension TrueClass { | ||
| 15356 | 15298 | } |
| 15357 | 15299 | |
| 15358 | 15300 | func with( |
| 15359 | - trueTrue: Int? = nil | |
| 15360 | - ) -> TrueClass { | |
| 15361 | - return TrueClass( | |
| 15362 | - trueTrue: trueTrue ?? self.trueTrue | |
| 15301 | + sealed: Int? = nil | |
| 15302 | + ) -> Sealed { | |
| 15303 | + return Sealed( | |
| 15304 | + sealed: sealed ?? self.sealed | |
| 15305 | + ) | |
| 15306 | + } | |
| 15307 | + | |
| 15308 | + func jsonData() throws -> Data { | |
| 15309 | + return try newJSONEncoder().encode(self) | |
| 15310 | + } | |
| 15311 | + | |
| 15312 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 15313 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 15314 | + } | |
| 15315 | +} | |
| 15316 | + | |
| 15317 | +// | |
| 15318 | +// Hashable or Equatable: | |
| 15319 | +// The compiler will not be able to synthesize the implementation of Hashable or Equatable | |
| 15320 | +// for types that require the use of JSONAny, nor will the implementation of Hashable be | |
| 15321 | +// synthesized for types that have collections (such as arrays or dictionaries). | |
| 15322 | + | |
| 15323 | +// MARK: - Sel | |
| 15324 | +struct Sel: Codable, Equatable { | |
| 15325 | + let sel: Int | |
| 15326 | + | |
| 15327 | + enum CodingKeys: String, CodingKey { | |
| 15328 | + case sel = "SEL" | |
| 15329 | + } | |
| 15330 | +} | |
| 15331 | + | |
| 15332 | +// MARK: Sel convenience initializers and mutators | |
| 15333 | + | |
| 15334 | +extension Sel { | |
| 15335 | + init(data: Data) throws { | |
| 15336 | + self = try newJSONDecoder().decode(Sel.self, from: data) | |
| 15337 | + } | |
| 15338 | + | |
| 15339 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 15340 | + guard let data = json.data(using: encoding) else { | |
| 15341 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 15342 | + } | |
| 15343 | + try self.init(data: data) | |
| 15344 | + } | |
| 15345 | + | |
| 15346 | + init(fromURL url: URL) throws { | |
| 15347 | + try self.init(data: try Data(contentsOf: url)) | |
| 15348 | + } | |
| 15349 | + | |
| 15350 | + func with( | |
| 15351 | + sel: Int? = nil | |
| 15352 | + ) -> Sel { | |
| 15353 | + return Sel( | |
| 15354 | + sel: sel ?? self.sel | |
| 15363 | 15355 | ) |
| 15364 | 15356 | } |
| 15365 | 15357 | |
| @@ -17628,115 +17620,18 @@ extension UnmarshalJSON { | ||
| 17628 | 17620 | // for types that require the use of JSONAny, nor will the implementation of Hashable be |
| 17629 | 17621 | // synthesized for types that have collections (such as arrays or dictionaries). |
| 17630 | 17622 | |
| 17631 | -// MARK: - Unsafe | |
| 17632 | -struct Unsafe: Codable, Equatable { | |
| 17633 | - let unsafe: Int | |
| 17634 | - | |
| 17635 | - enum CodingKeys: String, CodingKey { | |
| 17636 | - case unsafe = "unsafe" | |
| 17637 | - } | |
| 17638 | -} | |
| 17639 | - | |
| 17640 | -// MARK: Unsafe convenience initializers and mutators | |
| 17641 | - | |
| 17642 | -extension Unsafe { | |
| 17643 | - init(data: Data) throws { | |
| 17644 | - self = try newJSONDecoder().decode(Unsafe.self, from: data) | |
| 17645 | - } | |
| 17646 | - | |
| 17647 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 17648 | - guard let data = json.data(using: encoding) else { | |
| 17649 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 17650 | - } | |
| 17651 | - try self.init(data: data) | |
| 17652 | - } | |
| 17653 | - | |
| 17654 | - init(fromURL url: URL) throws { | |
| 17655 | - try self.init(data: try Data(contentsOf: url)) | |
| 17656 | - } | |
| 17657 | - | |
| 17658 | - func with( | |
| 17659 | - unsafe: Int? = nil | |
| 17660 | - ) -> Unsafe { | |
| 17661 | - return Unsafe( | |
| 17662 | - unsafe: unsafe ?? self.unsafe | |
| 17663 | - ) | |
| 17664 | - } | |
| 17665 | - | |
| 17666 | - func jsonData() throws -> Data { | |
| 17667 | - return try newJSONEncoder().encode(self) | |
| 17668 | - } | |
| 17669 | - | |
| 17670 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 17671 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 17672 | - } | |
| 17673 | -} | |
| 17674 | - | |
| 17675 | -// | |
| 17676 | -// Hashable or Equatable: | |
| 17677 | -// The compiler will not be able to synthesize the implementation of Hashable or Equatable | |
| 17678 | -// for types that require the use of JSONAny, nor will the implementation of Hashable be | |
| 17679 | -// synthesized for types that have collections (such as arrays or dictionaries). | |
| 17680 | - | |
| 17681 | -// MARK: - UseSerializers | |
| 17682 | -struct UseSerializers: Codable, Equatable { | |
| 17683 | - let useSerializers: Int | |
| 17684 | - | |
| 17685 | - enum CodingKeys: String, CodingKey { | |
| 17686 | - case useSerializers = "UseSerializers" | |
| 17687 | - } | |
| 17688 | -} | |
| 17689 | - | |
| 17690 | -// MARK: UseSerializers convenience initializers and mutators | |
| 17691 | - | |
| 17692 | -extension UseSerializers { | |
| 17693 | - init(data: Data) throws { | |
| 17694 | - self = try newJSONDecoder().decode(UseSerializers.self, from: data) | |
| 17695 | - } | |
| 17696 | - | |
| 17697 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 17698 | - guard let data = json.data(using: encoding) else { | |
| 17699 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 17700 | - } | |
| 17701 | - try self.init(data: data) | |
| 17702 | - } | |
| 17703 | - | |
| 17704 | - init(fromURL url: URL) throws { | |
| 17705 | - try self.init(data: try Data(contentsOf: url)) | |
| 17706 | - } | |
| 17707 | - | |
| 17708 | - func with( | |
| 17709 | - useSerializers: Int? = nil | |
| 17710 | - ) -> UseSerializers { | |
| 17711 | - return UseSerializers( | |
| 17712 | - useSerializers: useSerializers ?? self.useSerializers | |
| 17713 | - ) | |
| 17714 | - } | |
| 17715 | - | |
| 17716 | - func jsonData() throws -> Data { | |
| 17717 | - return try newJSONEncoder().encode(self) | |
| 17718 | - } | |
| 17719 | - | |
| 17720 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 17721 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 17722 | - } | |
| 17723 | -} | |
| 17724 | - | |
| 17725 | -// | |
| 17726 | -// Hashable or Equatable: | |
| 17727 | -// The compiler will not be able to synthesize the implementation of Hashable or Equatable | |
| 17728 | -// for types that require the use of JSONAny, nor will the implementation of Hashable be | |
| 17729 | -// synthesized for types that have collections (such as arrays or dictionaries). | |
| 17730 | - | |
| 17731 | 17623 | // MARK: - Obj6 |
| 17732 | 17624 | struct Obj6: Codable, Equatable { |
| 17733 | 17625 | let dummy: Int |
| 17626 | + let obj6Unowned: Unowned | |
| 17734 | 17627 | let obj6Var: Var |
| 17735 | 17628 | let obj6Weak: Weak |
| 17736 | 17629 | let obj6Where: Where |
| 17737 | 17630 | let obj6While: While |
| 17738 | 17631 | let obj6WillSet: WillSet |
| 17632 | + let unsafe: Unsafe | |
| 17739 | 17633 | let unsigned: Unsigned |
| 17634 | + let useSerializers: UseSerializers | |
| 17740 | 17635 | let ushort: Ushort |
| 17741 | 17636 | let using: Using |
| 17742 | 17637 | let utf8JSONReader: Utf8JSONReader |
| @@ -17754,12 +17649,15 @@ struct Obj6: Codable, Equatable { | ||
| 17754 | 17649 | |
| 17755 | 17650 | enum CodingKeys: String, CodingKey { |
| 17756 | 17651 | case dummy = "dummy" |
| 17652 | + case obj6Unowned = "unowned" | |
| 17757 | 17653 | case obj6Var = "var" |
| 17758 | 17654 | case obj6Weak = "weak" |
| 17759 | 17655 | case obj6Where = "where" |
| 17760 | 17656 | case obj6While = "while" |
| 17761 | 17657 | case obj6WillSet = "willSet" |
| 17658 | + case unsafe = "unsafe" | |
| 17762 | 17659 | case unsigned = "unsigned" |
| 17660 | + case useSerializers = "UseSerializers" | |
| 17763 | 17661 | case ushort = "ushort" |
| 17764 | 17662 | case using = "using" |
| 17765 | 17663 | case utf8JSONReader = "Utf8JsonReader" |
| @@ -17797,12 +17695,15 @@ extension Obj6 { | ||
| 17797 | 17695 | |
| 17798 | 17696 | func with( |
| 17799 | 17697 | dummy: Int? = nil, |
| 17698 | + obj6Unowned: Unowned? = nil, | |
| 17800 | 17699 | obj6Var: Var? = nil, |
| 17801 | 17700 | obj6Weak: Weak? = nil, |
| 17802 | 17701 | obj6Where: Where? = nil, |
| 17803 | 17702 | obj6While: While? = nil, |
| 17804 | 17703 | obj6WillSet: WillSet? = nil, |
| 17704 | + unsafe: Unsafe? = nil, | |
| 17805 | 17705 | unsigned: Unsigned? = nil, |
| 17706 | + useSerializers: UseSerializers? = nil, | |
| 17806 | 17707 | ushort: Ushort? = nil, |
| 17807 | 17708 | using: Using? = nil, |
| 17808 | 17709 | utf8JSONReader: Utf8JSONReader? = nil, |
| @@ -17820,12 +17721,15 @@ extension Obj6 { | ||
| 17820 | 17721 | ) -> Obj6 { |
| 17821 | 17722 | return Obj6( |
| 17822 | 17723 | dummy: dummy ?? self.dummy, |
| 17724 | + obj6Unowned: obj6Unowned ?? self.obj6Unowned, | |
| 17823 | 17725 | obj6Var: obj6Var ?? self.obj6Var, |
| 17824 | 17726 | obj6Weak: obj6Weak ?? self.obj6Weak, |
| 17825 | 17727 | obj6Where: obj6Where ?? self.obj6Where, |
| 17826 | 17728 | obj6While: obj6While ?? self.obj6While, |
| 17827 | 17729 | obj6WillSet: obj6WillSet ?? self.obj6WillSet, |
| 17730 | + unsafe: unsafe ?? self.unsafe, | |
| 17828 | 17731 | unsigned: unsigned ?? self.unsigned, |
| 17732 | + useSerializers: useSerializers ?? self.useSerializers, | |
| 17829 | 17733 | ushort: ushort ?? self.ushort, |
| 17830 | 17734 | using: using ?? self.using, |
| 17831 | 17735 | utf8JSONReader: utf8JSONReader ?? self.utf8JSONReader, |
| @@ -17858,6 +17762,56 @@ extension Obj6 { | ||
| 17858 | 17762 | // for types that require the use of JSONAny, nor will the implementation of Hashable be |
| 17859 | 17763 | // synthesized for types that have collections (such as arrays or dictionaries). |
| 17860 | 17764 | |
| 17765 | +// MARK: - Unowned | |
| 17766 | +struct Unowned: Codable, Equatable { | |
| 17767 | + let unownedUnowned: Int | |
| 17768 | + | |
| 17769 | + enum CodingKeys: String, CodingKey { | |
| 17770 | + case unownedUnowned = "unowned" | |
| 17771 | + } | |
| 17772 | +} | |
| 17773 | + | |
| 17774 | +// MARK: Unowned convenience initializers and mutators | |
| 17775 | + | |
| 17776 | +extension Unowned { | |
| 17777 | + init(data: Data) throws { | |
| 17778 | + self = try newJSONDecoder().decode(Unowned.self, from: data) | |
| 17779 | + } | |
| 17780 | + | |
| 17781 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 17782 | + guard let data = json.data(using: encoding) else { | |
| 17783 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 17784 | + } | |
| 17785 | + try self.init(data: data) | |
| 17786 | + } | |
| 17787 | + | |
| 17788 | + init(fromURL url: URL) throws { | |
| 17789 | + try self.init(data: try Data(contentsOf: url)) | |
| 17790 | + } | |
| 17791 | + | |
| 17792 | + func with( | |
| 17793 | + unownedUnowned: Int? = nil | |
| 17794 | + ) -> Unowned { | |
| 17795 | + return Unowned( | |
| 17796 | + unownedUnowned: unownedUnowned ?? self.unownedUnowned | |
| 17797 | + ) | |
| 17798 | + } | |
| 17799 | + | |
| 17800 | + func jsonData() throws -> Data { | |
| 17801 | + return try newJSONEncoder().encode(self) | |
| 17802 | + } | |
| 17803 | + | |
| 17804 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 17805 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 17806 | + } | |
| 17807 | +} | |
| 17808 | + | |
| 17809 | +// | |
| 17810 | +// Hashable or Equatable: | |
| 17811 | +// The compiler will not be able to synthesize the implementation of Hashable or Equatable | |
| 17812 | +// for types that require the use of JSONAny, nor will the implementation of Hashable be | |
| 17813 | +// synthesized for types that have collections (such as arrays or dictionaries). | |
| 17814 | + | |
| 17861 | 17815 | // MARK: - Var |
| 17862 | 17816 | struct Var: Codable, Equatable { |
| 17863 | 17817 | let varVar: Int |
| @@ -18108,6 +18062,56 @@ extension WillSet { | ||
| 18108 | 18062 | // for types that require the use of JSONAny, nor will the implementation of Hashable be |
| 18109 | 18063 | // synthesized for types that have collections (such as arrays or dictionaries). |
| 18110 | 18064 | |
| 18065 | +// MARK: - Unsafe | |
| 18066 | +struct Unsafe: Codable, Equatable { | |
| 18067 | + let unsafe: Int | |
| 18068 | + | |
| 18069 | + enum CodingKeys: String, CodingKey { | |
| 18070 | + case unsafe = "unsafe" | |
| 18071 | + } | |
| 18072 | +} | |
| 18073 | + | |
| 18074 | +// MARK: Unsafe convenience initializers and mutators | |
| 18075 | + | |
| 18076 | +extension Unsafe { | |
| 18077 | + init(data: Data) throws { | |
| 18078 | + self = try newJSONDecoder().decode(Unsafe.self, from: data) | |
| 18079 | + } | |
| 18080 | + | |
| 18081 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 18082 | + guard let data = json.data(using: encoding) else { | |
| 18083 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 18084 | + } | |
| 18085 | + try self.init(data: data) | |
| 18086 | + } | |
| 18087 | + | |
| 18088 | + init(fromURL url: URL) throws { | |
| 18089 | + try self.init(data: try Data(contentsOf: url)) | |
| 18090 | + } | |
| 18091 | + | |
| 18092 | + func with( | |
| 18093 | + unsafe: Int? = nil | |
| 18094 | + ) -> Unsafe { | |
| 18095 | + return Unsafe( | |
| 18096 | + unsafe: unsafe ?? self.unsafe | |
| 18097 | + ) | |
| 18098 | + } | |
| 18099 | + | |
| 18100 | + func jsonData() throws -> Data { | |
| 18101 | + return try newJSONEncoder().encode(self) | |
| 18102 | + } | |
| 18103 | + | |
| 18104 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 18105 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 18106 | + } | |
| 18107 | +} | |
| 18108 | + | |
| 18109 | +// | |
| 18110 | +// Hashable or Equatable: | |
| 18111 | +// The compiler will not be able to synthesize the implementation of Hashable or Equatable | |
| 18112 | +// for types that require the use of JSONAny, nor will the implementation of Hashable be | |
| 18113 | +// synthesized for types that have collections (such as arrays or dictionaries). | |
| 18114 | + | |
| 18111 | 18115 | // MARK: - Unsigned |
| 18112 | 18116 | struct Unsigned: Codable, Equatable { |
| 18113 | 18117 | let unsigned: Int |
| @@ -18158,6 +18162,56 @@ extension Unsigned { | ||
| 18158 | 18162 | // for types that require the use of JSONAny, nor will the implementation of Hashable be |
| 18159 | 18163 | // synthesized for types that have collections (such as arrays or dictionaries). |
| 18160 | 18164 | |
| 18165 | +// MARK: - UseSerializers | |
| 18166 | +struct UseSerializers: Codable, Equatable { | |
| 18167 | + let useSerializers: Int | |
| 18168 | + | |
| 18169 | + enum CodingKeys: String, CodingKey { | |
| 18170 | + case useSerializers = "UseSerializers" | |
| 18171 | + } | |
| 18172 | +} | |
| 18173 | + | |
| 18174 | +// MARK: UseSerializers convenience initializers and mutators | |
| 18175 | + | |
| 18176 | +extension UseSerializers { | |
| 18177 | + init(data: Data) throws { | |
| 18178 | + self = try newJSONDecoder().decode(UseSerializers.self, from: data) | |
| 18179 | + } | |
| 18180 | + | |
| 18181 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 18182 | + guard let data = json.data(using: encoding) else { | |
| 18183 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 18184 | + } | |
| 18185 | + try self.init(data: data) | |
| 18186 | + } | |
| 18187 | + | |
| 18188 | + init(fromURL url: URL) throws { | |
| 18189 | + try self.init(data: try Data(contentsOf: url)) | |
| 18190 | + } | |
| 18191 | + | |
| 18192 | + func with( | |
| 18193 | + useSerializers: Int? = nil | |
| 18194 | + ) -> UseSerializers { | |
| 18195 | + return UseSerializers( | |
| 18196 | + useSerializers: useSerializers ?? self.useSerializers | |
| 18197 | + ) | |
| 18198 | + } | |
| 18199 | + | |
| 18200 | + func jsonData() throws -> Data { | |
| 18201 | + return try newJSONEncoder().encode(self) | |
| 18202 | + } | |
| 18203 | + | |
| 18204 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 18205 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 18206 | + } | |
| 18207 | +} | |
| 18208 | + | |
| 18209 | +// | |
| 18210 | +// Hashable or Equatable: | |
| 18211 | +// The compiler will not be able to synthesize the implementation of Hashable or Equatable | |
| 18212 | +// for types that require the use of JSONAny, nor will the implementation of Hashable be | |
| 18213 | +// synthesized for types that have collections (such as arrays or dictionaries). | |
| 18214 | + | |
| 18161 | 18215 | // MARK: - Ushort |
| 18162 | 18216 | struct Ushort: Codable, Equatable { |
| 18163 | 18217 | let ushort: Int |
Mswiftsendable-true--1c3982c78639 / quicktype.swift+390 −342
| @@ -6351,6 +6351,7 @@ struct Obj3: Codable, Sendable { | ||
| 6351 | 6351 | let locale: LocaleClass |
| 6352 | 6352 | let lock: Lock |
| 6353 | 6353 | let long: Long |
| 6354 | + let makeDictEncoder: MakeDictEncoder | |
| 6354 | 6355 | let map: Map |
| 6355 | 6356 | let mapEntry: MapEntry |
| 6356 | 6357 | let marshalJSON: MarshalJSON |
| @@ -6361,7 +6362,6 @@ struct Obj3: Codable, Sendable { | ||
| 6361 | 6362 | let native: Native |
| 6362 | 6363 | let new: New |
| 6363 | 6364 | let newtonsoft: Newtonsoft |
| 6364 | - let no: No | |
| 6365 | 6365 | let obj3Guard: Guard |
| 6366 | 6366 | let obj3If: If |
| 6367 | 6367 | let obj3Import: Import |
| @@ -6377,7 +6377,6 @@ struct Obj3: Codable, Sendable { | ||
| 6377 | 6377 | let obj3Left: Left |
| 6378 | 6378 | let obj3Let: Let |
| 6379 | 6379 | let obj3Mutating: Mutating |
| 6380 | - let obj3Nil: Nil | |
| 6381 | 6380 | |
| 6382 | 6381 | enum CodingKeys: String, CodingKey { |
| 6383 | 6382 | case dummy = "dummy" |
| @@ -6419,6 +6418,7 @@ struct Obj3: Codable, Sendable { | ||
| 6419 | 6418 | case locale = "Locale" |
| 6420 | 6419 | case lock = "lock" |
| 6421 | 6420 | case long = "long" |
| 6421 | + case makeDictEncoder = "makeDictEncoder" | |
| 6422 | 6422 | case map = "map" |
| 6423 | 6423 | case mapEntry = "MapEntry" |
| 6424 | 6424 | case marshalJSON = "MarshalJSON" |
| @@ -6429,7 +6429,6 @@ struct Obj3: Codable, Sendable { | ||
| 6429 | 6429 | case native = "native" |
| 6430 | 6430 | case new = "new" |
| 6431 | 6431 | case newtonsoft = "newtonsoft" |
| 6432 | - case no = "NO" | |
| 6433 | 6432 | case obj3Guard = "guard" |
| 6434 | 6433 | case obj3If = "if" |
| 6435 | 6434 | case obj3Import = "import" |
| @@ -6445,7 +6444,6 @@ struct Obj3: Codable, Sendable { | ||
| 6445 | 6444 | case obj3Left = "left" |
| 6446 | 6445 | case obj3Let = "let" |
| 6447 | 6446 | case obj3Mutating = "mutating" |
| 6448 | - case obj3Nil = "nil" | |
| 6449 | 6447 | } |
| 6450 | 6448 | } |
| 6451 | 6449 | |
| @@ -6507,6 +6505,7 @@ extension Obj3 { | ||
| 6507 | 6505 | locale: LocaleClass? = nil, |
| 6508 | 6506 | lock: Lock? = nil, |
| 6509 | 6507 | long: Long? = nil, |
| 6508 | + makeDictEncoder: MakeDictEncoder? = nil, | |
| 6510 | 6509 | map: Map? = nil, |
| 6511 | 6510 | mapEntry: MapEntry? = nil, |
| 6512 | 6511 | marshalJSON: MarshalJSON? = nil, |
| @@ -6517,7 +6516,6 @@ extension Obj3 { | ||
| 6517 | 6516 | native: Native? = nil, |
| 6518 | 6517 | new: New? = nil, |
| 6519 | 6518 | newtonsoft: Newtonsoft? = nil, |
| 6520 | - no: No? = nil, | |
| 6521 | 6519 | obj3Guard: Guard? = nil, |
| 6522 | 6520 | obj3If: If? = nil, |
| 6523 | 6521 | obj3Import: Import? = nil, |
| @@ -6532,8 +6530,7 @@ extension Obj3 { | ||
| 6532 | 6530 | obj3Lazy: Lazy? = nil, |
| 6533 | 6531 | obj3Left: Left? = nil, |
| 6534 | 6532 | obj3Let: Let? = nil, |
| 6535 | - obj3Mutating: Mutating? = nil, | |
| 6536 | - obj3Nil: Nil? = nil | |
| 6533 | + obj3Mutating: Mutating? = nil | |
| 6537 | 6534 | ) -> Obj3 { |
| 6538 | 6535 | return Obj3( |
| 6539 | 6536 | dummy: dummy ?? self.dummy, |
| @@ -6575,6 +6572,7 @@ extension Obj3 { | ||
| 6575 | 6572 | locale: locale ?? self.locale, |
| 6576 | 6573 | lock: lock ?? self.lock, |
| 6577 | 6574 | long: long ?? self.long, |
| 6575 | + makeDictEncoder: makeDictEncoder ?? self.makeDictEncoder, | |
| 6578 | 6576 | map: map ?? self.map, |
| 6579 | 6577 | mapEntry: mapEntry ?? self.mapEntry, |
| 6580 | 6578 | marshalJSON: marshalJSON ?? self.marshalJSON, |
| @@ -6585,7 +6583,6 @@ extension Obj3 { | ||
| 6585 | 6583 | native: native ?? self.native, |
| 6586 | 6584 | new: new ?? self.new, |
| 6587 | 6585 | newtonsoft: newtonsoft ?? self.newtonsoft, |
| 6588 | - no: no ?? self.no, | |
| 6589 | 6586 | obj3Guard: obj3Guard ?? self.obj3Guard, |
| 6590 | 6587 | obj3If: obj3If ?? self.obj3If, |
| 6591 | 6588 | obj3Import: obj3Import ?? self.obj3Import, |
| @@ -6600,8 +6597,7 @@ extension Obj3 { | ||
| 6600 | 6597 | obj3Lazy: obj3Lazy ?? self.obj3Lazy, |
| 6601 | 6598 | obj3Left: obj3Left ?? self.obj3Left, |
| 6602 | 6599 | obj3Let: obj3Let ?? self.obj3Let, |
| 6603 | - obj3Mutating: obj3Mutating ?? self.obj3Mutating, | |
| 6604 | - obj3Nil: obj3Nil ?? self.obj3Nil | |
| 6600 | + obj3Mutating: obj3Mutating ?? self.obj3Mutating | |
| 6605 | 6601 | ) |
| 6606 | 6602 | } |
| 6607 | 6603 | |
| @@ -8286,6 +8282,50 @@ extension Long { | ||
| 8286 | 8282 | } |
| 8287 | 8283 | } |
| 8288 | 8284 | |
| 8285 | +// MARK: - MakeDictEncoder | |
| 8286 | +struct MakeDictEncoder: Codable, Sendable { | |
| 8287 | + let makeDictEncoder: Int | |
| 8288 | + | |
| 8289 | + enum CodingKeys: String, CodingKey { | |
| 8290 | + case makeDictEncoder = "makeDictEncoder" | |
| 8291 | + } | |
| 8292 | +} | |
| 8293 | + | |
| 8294 | +// MARK: MakeDictEncoder convenience initializers and mutators | |
| 8295 | + | |
| 8296 | +extension MakeDictEncoder { | |
| 8297 | + init(data: Data) throws { | |
| 8298 | + self = try newJSONDecoder().decode(MakeDictEncoder.self, from: data) | |
| 8299 | + } | |
| 8300 | + | |
| 8301 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 8302 | + guard let data = json.data(using: encoding) else { | |
| 8303 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 8304 | + } | |
| 8305 | + try self.init(data: data) | |
| 8306 | + } | |
| 8307 | + | |
| 8308 | + init(fromURL url: URL) throws { | |
| 8309 | + try self.init(data: try Data(contentsOf: url)) | |
| 8310 | + } | |
| 8311 | + | |
| 8312 | + func with( | |
| 8313 | + makeDictEncoder: Int? = nil | |
| 8314 | + ) -> MakeDictEncoder { | |
| 8315 | + return MakeDictEncoder( | |
| 8316 | + makeDictEncoder: makeDictEncoder ?? self.makeDictEncoder | |
| 8317 | + ) | |
| 8318 | + } | |
| 8319 | + | |
| 8320 | + func jsonData() throws -> Data { | |
| 8321 | + return try newJSONEncoder().encode(self) | |
| 8322 | + } | |
| 8323 | + | |
| 8324 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 8325 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 8326 | + } | |
| 8327 | +} | |
| 8328 | + | |
| 8289 | 8329 | // MARK: - Map |
| 8290 | 8330 | struct Map: Codable, Sendable { |
| 8291 | 8331 | let map: Int |
| @@ -8726,50 +8766,6 @@ extension Newtonsoft { | ||
| 8726 | 8766 | } |
| 8727 | 8767 | } |
| 8728 | 8768 | |
| 8729 | -// MARK: - No | |
| 8730 | -struct No: Codable, Sendable { | |
| 8731 | - let no: Int | |
| 8732 | - | |
| 8733 | - enum CodingKeys: String, CodingKey { | |
| 8734 | - case no = "NO" | |
| 8735 | - } | |
| 8736 | -} | |
| 8737 | - | |
| 8738 | -// MARK: No convenience initializers and mutators | |
| 8739 | - | |
| 8740 | -extension No { | |
| 8741 | - init(data: Data) throws { | |
| 8742 | - self = try newJSONDecoder().decode(No.self, from: data) | |
| 8743 | - } | |
| 8744 | - | |
| 8745 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 8746 | - guard let data = json.data(using: encoding) else { | |
| 8747 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 8748 | - } | |
| 8749 | - try self.init(data: data) | |
| 8750 | - } | |
| 8751 | - | |
| 8752 | - init(fromURL url: URL) throws { | |
| 8753 | - try self.init(data: try Data(contentsOf: url)) | |
| 8754 | - } | |
| 8755 | - | |
| 8756 | - func with( | |
| 8757 | - no: Int? = nil | |
| 8758 | - ) -> No { | |
| 8759 | - return No( | |
| 8760 | - no: no ?? self.no | |
| 8761 | - ) | |
| 8762 | - } | |
| 8763 | - | |
| 8764 | - func jsonData() throws -> Data { | |
| 8765 | - return try newJSONEncoder().encode(self) | |
| 8766 | - } | |
| 8767 | - | |
| 8768 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 8769 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 8770 | - } | |
| 8771 | -} | |
| 8772 | - | |
| 8773 | 8769 | // MARK: - Guard |
| 8774 | 8770 | struct Guard: Codable, Sendable { |
| 8775 | 8771 | let guardGuard: Int |
| @@ -9430,53 +9426,10 @@ extension Mutating { | ||
| 9430 | 9426 | } |
| 9431 | 9427 | } |
| 9432 | 9428 | |
| 9433 | -// MARK: - Nil | |
| 9434 | -struct Nil: Codable, Sendable { | |
| 9435 | - let nilNil: Int | |
| 9436 | - | |
| 9437 | - enum CodingKeys: String, CodingKey { | |
| 9438 | - case nilNil = "nil" | |
| 9439 | - } | |
| 9440 | -} | |
| 9441 | - | |
| 9442 | -// MARK: Nil convenience initializers and mutators | |
| 9443 | - | |
| 9444 | -extension Nil { | |
| 9445 | - init(data: Data) throws { | |
| 9446 | - self = try newJSONDecoder().decode(Nil.self, from: data) | |
| 9447 | - } | |
| 9448 | - | |
| 9449 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 9450 | - guard let data = json.data(using: encoding) else { | |
| 9451 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 9452 | - } | |
| 9453 | - try self.init(data: data) | |
| 9454 | - } | |
| 9455 | - | |
| 9456 | - init(fromURL url: URL) throws { | |
| 9457 | - try self.init(data: try Data(contentsOf: url)) | |
| 9458 | - } | |
| 9459 | - | |
| 9460 | - func with( | |
| 9461 | - nilNil: Int? = nil | |
| 9462 | - ) -> Nil { | |
| 9463 | - return Nil( | |
| 9464 | - nilNil: nilNil ?? self.nilNil | |
| 9465 | - ) | |
| 9466 | - } | |
| 9467 | - | |
| 9468 | - func jsonData() throws -> Data { | |
| 9469 | - return try newJSONEncoder().encode(self) | |
| 9470 | - } | |
| 9471 | - | |
| 9472 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 9473 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 9474 | - } | |
| 9475 | -} | |
| 9476 | - | |
| 9477 | 9429 | // MARK: - Obj4 |
| 9478 | 9430 | struct Obj4: Codable, Sendable { |
| 9479 | 9431 | let dummy: Int |
| 9432 | + let no: No | |
| 9480 | 9433 | let noSuchMethod: NoSuchMethod |
| 9481 | 9434 | let noexcept: Noexcept |
| 9482 | 9435 | let nonatomic: Nonatomic |
| @@ -9490,6 +9443,7 @@ struct Obj4: Codable, Sendable { | ||
| 9490 | 9443 | let null: Null |
| 9491 | 9444 | let nullptr: Nullptr |
| 9492 | 9445 | let number: Number |
| 9446 | + let obj4Nil: Nil | |
| 9493 | 9447 | let obj4None: NoneClass |
| 9494 | 9448 | let obj4Nonmutating: Nonmutating |
| 9495 | 9449 | let obj4Null: NullClass |
| @@ -9539,11 +9493,10 @@ struct Obj4: Codable, Sendable { | ||
| 9539 | 9493 | let runtimeType: RuntimeType |
| 9540 | 9494 | let s: S |
| 9541 | 9495 | let sbyte: Sbyte |
| 9542 | - let sealed: Sealed | |
| 9543 | - let sel: Sel | |
| 9544 | 9496 | |
| 9545 | 9497 | enum CodingKeys: String, CodingKey { |
| 9546 | 9498 | case dummy = "dummy" |
| 9499 | + case no = "NO" | |
| 9547 | 9500 | case noSuchMethod = "noSuchMethod" |
| 9548 | 9501 | case noexcept = "noexcept" |
| 9549 | 9502 | case nonatomic = "nonatomic" |
| @@ -9557,6 +9510,7 @@ struct Obj4: Codable, Sendable { | ||
| 9557 | 9510 | case null = "NULL" |
| 9558 | 9511 | case nullptr = "nullptr" |
| 9559 | 9512 | case number = "number" |
| 9513 | + case obj4Nil = "nil" | |
| 9560 | 9514 | case obj4None = "none" |
| 9561 | 9515 | case obj4Nonmutating = "nonmutating" |
| 9562 | 9516 | case obj4Null = "null" |
| @@ -9606,8 +9560,6 @@ struct Obj4: Codable, Sendable { | ||
| 9606 | 9560 | case runtimeType = "runtimeType" |
| 9607 | 9561 | case s = "s" |
| 9608 | 9562 | case sbyte = "sbyte" |
| 9609 | - case sealed = "sealed" | |
| 9610 | - case sel = "SEL" | |
| 9611 | 9563 | } |
| 9612 | 9564 | } |
| 9613 | 9565 | |
| @@ -9631,6 +9583,7 @@ extension Obj4 { | ||
| 9631 | 9583 | |
| 9632 | 9584 | func with( |
| 9633 | 9585 | dummy: Int? = nil, |
| 9586 | + no: No? = nil, | |
| 9634 | 9587 | noSuchMethod: NoSuchMethod? = nil, |
| 9635 | 9588 | noexcept: Noexcept? = nil, |
| 9636 | 9589 | nonatomic: Nonatomic? = nil, |
| @@ -9644,6 +9597,7 @@ extension Obj4 { | ||
| 9644 | 9597 | null: Null? = nil, |
| 9645 | 9598 | nullptr: Nullptr? = nil, |
| 9646 | 9599 | number: Number? = nil, |
| 9600 | + obj4Nil: Nil? = nil, | |
| 9647 | 9601 | obj4None: NoneClass? = nil, |
| 9648 | 9602 | obj4Nonmutating: Nonmutating? = nil, |
| 9649 | 9603 | obj4Null: NullClass? = nil, |
| @@ -9692,12 +9646,11 @@ extension Obj4 { | ||
| 9692 | 9646 | retain: Retain? = nil, |
| 9693 | 9647 | runtimeType: RuntimeType? = nil, |
| 9694 | 9648 | s: S? = nil, |
| 9695 | - sbyte: Sbyte? = nil, | |
| 9696 | - sealed: Sealed? = nil, | |
| 9697 | - sel: Sel? = nil | |
| 9649 | + sbyte: Sbyte? = nil | |
| 9698 | 9650 | ) -> Obj4 { |
| 9699 | 9651 | return Obj4( |
| 9700 | 9652 | dummy: dummy ?? self.dummy, |
| 9653 | + no: no ?? self.no, | |
| 9701 | 9654 | noSuchMethod: noSuchMethod ?? self.noSuchMethod, |
| 9702 | 9655 | noexcept: noexcept ?? self.noexcept, |
| 9703 | 9656 | nonatomic: nonatomic ?? self.nonatomic, |
| @@ -9711,6 +9664,7 @@ extension Obj4 { | ||
| 9711 | 9664 | null: null ?? self.null, |
| 9712 | 9665 | nullptr: nullptr ?? self.nullptr, |
| 9713 | 9666 | number: number ?? self.number, |
| 9667 | + obj4Nil: obj4Nil ?? self.obj4Nil, | |
| 9714 | 9668 | obj4None: obj4None ?? self.obj4None, |
| 9715 | 9669 | obj4Nonmutating: obj4Nonmutating ?? self.obj4Nonmutating, |
| 9716 | 9670 | obj4Null: obj4Null ?? self.obj4Null, |
| @@ -9759,9 +9713,51 @@ extension Obj4 { | ||
| 9759 | 9713 | retain: retain ?? self.retain, |
| 9760 | 9714 | runtimeType: runtimeType ?? self.runtimeType, |
| 9761 | 9715 | s: s ?? self.s, |
| 9762 | - sbyte: sbyte ?? self.sbyte, | |
| 9763 | - sealed: sealed ?? self.sealed, | |
| 9764 | - sel: sel ?? self.sel | |
| 9716 | + sbyte: sbyte ?? self.sbyte | |
| 9717 | + ) | |
| 9718 | + } | |
| 9719 | + | |
| 9720 | + func jsonData() throws -> Data { | |
| 9721 | + return try newJSONEncoder().encode(self) | |
| 9722 | + } | |
| 9723 | + | |
| 9724 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 9725 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 9726 | + } | |
| 9727 | +} | |
| 9728 | + | |
| 9729 | +// MARK: - No | |
| 9730 | +struct No: Codable, Sendable { | |
| 9731 | + let no: Int | |
| 9732 | + | |
| 9733 | + enum CodingKeys: String, CodingKey { | |
| 9734 | + case no = "NO" | |
| 9735 | + } | |
| 9736 | +} | |
| 9737 | + | |
| 9738 | +// MARK: No convenience initializers and mutators | |
| 9739 | + | |
| 9740 | +extension No { | |
| 9741 | + init(data: Data) throws { | |
| 9742 | + self = try newJSONDecoder().decode(No.self, from: data) | |
| 9743 | + } | |
| 9744 | + | |
| 9745 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 9746 | + guard let data = json.data(using: encoding) else { | |
| 9747 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 9748 | + } | |
| 9749 | + try self.init(data: data) | |
| 9750 | + } | |
| 9751 | + | |
| 9752 | + init(fromURL url: URL) throws { | |
| 9753 | + try self.init(data: try Data(contentsOf: url)) | |
| 9754 | + } | |
| 9755 | + | |
| 9756 | + func with( | |
| 9757 | + no: Int? = nil | |
| 9758 | + ) -> No { | |
| 9759 | + return No( | |
| 9760 | + no: no ?? self.no | |
| 9765 | 9761 | ) |
| 9766 | 9762 | } |
| 9767 | 9763 | |
| @@ -10346,6 +10342,50 @@ extension Number { | ||
| 10346 | 10342 | } |
| 10347 | 10343 | } |
| 10348 | 10344 | |
| 10345 | +// MARK: - Nil | |
| 10346 | +struct Nil: Codable, Sendable { | |
| 10347 | + let nilNil: Int | |
| 10348 | + | |
| 10349 | + enum CodingKeys: String, CodingKey { | |
| 10350 | + case nilNil = "nil" | |
| 10351 | + } | |
| 10352 | +} | |
| 10353 | + | |
| 10354 | +// MARK: Nil convenience initializers and mutators | |
| 10355 | + | |
| 10356 | +extension Nil { | |
| 10357 | + init(data: Data) throws { | |
| 10358 | + self = try newJSONDecoder().decode(Nil.self, from: data) | |
| 10359 | + } | |
| 10360 | + | |
| 10361 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 10362 | + guard let data = json.data(using: encoding) else { | |
| 10363 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 10364 | + } | |
| 10365 | + try self.init(data: data) | |
| 10366 | + } | |
| 10367 | + | |
| 10368 | + init(fromURL url: URL) throws { | |
| 10369 | + try self.init(data: try Data(contentsOf: url)) | |
| 10370 | + } | |
| 10371 | + | |
| 10372 | + func with( | |
| 10373 | + nilNil: Int? = nil | |
| 10374 | + ) -> Nil { | |
| 10375 | + return Nil( | |
| 10376 | + nilNil: nilNil ?? self.nilNil | |
| 10377 | + ) | |
| 10378 | + } | |
| 10379 | + | |
| 10380 | + func jsonData() throws -> Data { | |
| 10381 | + return try newJSONEncoder().encode(self) | |
| 10382 | + } | |
| 10383 | + | |
| 10384 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 10385 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 10386 | + } | |
| 10387 | +} | |
| 10388 | + | |
| 10349 | 10389 | // MARK: - NoneClass |
| 10350 | 10390 | struct NoneClass: Codable, Sendable { |
| 10351 | 10391 | let none: Int |
| @@ -12502,94 +12542,6 @@ extension Sbyte { | ||
| 12502 | 12542 | } |
| 12503 | 12543 | } |
| 12504 | 12544 | |
| 12505 | -// MARK: - Sealed | |
| 12506 | -struct Sealed: Codable, Sendable { | |
| 12507 | - let sealed: Int | |
| 12508 | - | |
| 12509 | - enum CodingKeys: String, CodingKey { | |
| 12510 | - case sealed = "sealed" | |
| 12511 | - } | |
| 12512 | -} | |
| 12513 | - | |
| 12514 | -// MARK: Sealed convenience initializers and mutators | |
| 12515 | - | |
| 12516 | -extension Sealed { | |
| 12517 | - init(data: Data) throws { | |
| 12518 | - self = try newJSONDecoder().decode(Sealed.self, from: data) | |
| 12519 | - } | |
| 12520 | - | |
| 12521 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 12522 | - guard let data = json.data(using: encoding) else { | |
| 12523 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 12524 | - } | |
| 12525 | - try self.init(data: data) | |
| 12526 | - } | |
| 12527 | - | |
| 12528 | - init(fromURL url: URL) throws { | |
| 12529 | - try self.init(data: try Data(contentsOf: url)) | |
| 12530 | - } | |
| 12531 | - | |
| 12532 | - func with( | |
| 12533 | - sealed: Int? = nil | |
| 12534 | - ) -> Sealed { | |
| 12535 | - return Sealed( | |
| 12536 | - sealed: sealed ?? self.sealed | |
| 12537 | - ) | |
| 12538 | - } | |
| 12539 | - | |
| 12540 | - func jsonData() throws -> Data { | |
| 12541 | - return try newJSONEncoder().encode(self) | |
| 12542 | - } | |
| 12543 | - | |
| 12544 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 12545 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 12546 | - } | |
| 12547 | -} | |
| 12548 | - | |
| 12549 | -// MARK: - Sel | |
| 12550 | -struct Sel: Codable, Sendable { | |
| 12551 | - let sel: Int | |
| 12552 | - | |
| 12553 | - enum CodingKeys: String, CodingKey { | |
| 12554 | - case sel = "SEL" | |
| 12555 | - } | |
| 12556 | -} | |
| 12557 | - | |
| 12558 | -// MARK: Sel convenience initializers and mutators | |
| 12559 | - | |
| 12560 | -extension Sel { | |
| 12561 | - init(data: Data) throws { | |
| 12562 | - self = try newJSONDecoder().decode(Sel.self, from: data) | |
| 12563 | - } | |
| 12564 | - | |
| 12565 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 12566 | - guard let data = json.data(using: encoding) else { | |
| 12567 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 12568 | - } | |
| 12569 | - try self.init(data: data) | |
| 12570 | - } | |
| 12571 | - | |
| 12572 | - init(fromURL url: URL) throws { | |
| 12573 | - try self.init(data: try Data(contentsOf: url)) | |
| 12574 | - } | |
| 12575 | - | |
| 12576 | - func with( | |
| 12577 | - sel: Int? = nil | |
| 12578 | - ) -> Sel { | |
| 12579 | - return Sel( | |
| 12580 | - sel: sel ?? self.sel | |
| 12581 | - ) | |
| 12582 | - } | |
| 12583 | - | |
| 12584 | - func jsonData() throws -> Data { | |
| 12585 | - return try newJSONEncoder().encode(self) | |
| 12586 | - } | |
| 12587 | - | |
| 12588 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 12589 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 12590 | - } | |
| 12591 | -} | |
| 12592 | - | |
| 12593 | 12545 | // MARK: - Obj5 |
| 12594 | 12546 | struct Obj5: Codable, Sendable { |
| 12595 | 12547 | let dummy: Int |
| @@ -12607,10 +12559,11 @@ struct Obj5: Codable, Sendable { | ||
| 12607 | 12559 | let obj5Try: Try |
| 12608 | 12560 | let obj5Type: Obj5Type |
| 12609 | 12561 | let obj5Typealias: Typealias |
| 12610 | - let obj5Unowned: Unowned | |
| 12611 | 12562 | let primitiveKind: PrimitiveKind |
| 12612 | 12563 | let purpleSelf: Obj5Self |
| 12613 | 12564 | let purpleTrue: TrueClass |
| 12565 | + let sealed: Sealed | |
| 12566 | + let sel: Sel | |
| 12614 | 12567 | let select: Select |
| 12615 | 12568 | let sendable: SendableClass |
| 12616 | 12569 | let serialDescriptor: SerialDescriptor |
| @@ -12656,8 +12609,6 @@ struct Obj5: Codable, Sendable { | ||
| 12656 | 12609 | let undefined: Undefined |
| 12657 | 12610 | let union: Union |
| 12658 | 12611 | let unmarshalJSON: UnmarshalJSON |
| 12659 | - let unsafe: Unsafe | |
| 12660 | - let useSerializers: UseSerializers | |
| 12661 | 12612 | |
| 12662 | 12613 | enum CodingKeys: String, CodingKey { |
| 12663 | 12614 | case dummy = "dummy" |
| @@ -12675,10 +12626,11 @@ struct Obj5: Codable, Sendable { | ||
| 12675 | 12626 | case obj5Try = "try" |
| 12676 | 12627 | case obj5Type = "type" |
| 12677 | 12628 | case obj5Typealias = "typealias" |
| 12678 | - case obj5Unowned = "unowned" | |
| 12679 | 12629 | case primitiveKind = "PrimitiveKind" |
| 12680 | 12630 | case purpleSelf = "self" |
| 12681 | 12631 | case purpleTrue = "true" |
| 12632 | + case sealed = "sealed" | |
| 12633 | + case sel = "SEL" | |
| 12682 | 12634 | case select = "select" |
| 12683 | 12635 | case sendable = "Sendable" |
| 12684 | 12636 | case serialDescriptor = "SerialDescriptor" |
| @@ -12724,8 +12676,6 @@ struct Obj5: Codable, Sendable { | ||
| 12724 | 12676 | case undefined = "undefined" |
| 12725 | 12677 | case union = "union" |
| 12726 | 12678 | case unmarshalJSON = "UnmarshalJSON" |
| 12727 | - case unsafe = "unsafe" | |
| 12728 | - case useSerializers = "UseSerializers" | |
| 12729 | 12679 | } |
| 12730 | 12680 | } |
| 12731 | 12681 | |
| @@ -12763,10 +12713,11 @@ extension Obj5 { | ||
| 12763 | 12713 | obj5Try: Try? = nil, |
| 12764 | 12714 | obj5Type: Obj5Type? = nil, |
| 12765 | 12715 | obj5Typealias: Typealias? = nil, |
| 12766 | - obj5Unowned: Unowned? = nil, | |
| 12767 | 12716 | primitiveKind: PrimitiveKind? = nil, |
| 12768 | 12717 | purpleSelf: Obj5Self? = nil, |
| 12769 | 12718 | purpleTrue: TrueClass? = nil, |
| 12719 | + sealed: Sealed? = nil, | |
| 12720 | + sel: Sel? = nil, | |
| 12770 | 12721 | select: Select? = nil, |
| 12771 | 12722 | sendable: SendableClass? = nil, |
| 12772 | 12723 | serialDescriptor: SerialDescriptor? = nil, |
| @@ -12811,9 +12762,7 @@ extension Obj5 { | ||
| 12811 | 12762 | unchecked: Unchecked? = nil, |
| 12812 | 12763 | undefined: Undefined? = nil, |
| 12813 | 12764 | union: Union? = nil, |
| 12814 | - unmarshalJSON: UnmarshalJSON? = nil, | |
| 12815 | - unsafe: Unsafe? = nil, | |
| 12816 | - useSerializers: UseSerializers? = nil | |
| 12765 | + unmarshalJSON: UnmarshalJSON? = nil | |
| 12817 | 12766 | ) -> Obj5 { |
| 12818 | 12767 | return Obj5( |
| 12819 | 12768 | dummy: dummy ?? self.dummy, |
| @@ -12831,10 +12780,11 @@ extension Obj5 { | ||
| 12831 | 12780 | obj5Try: obj5Try ?? self.obj5Try, |
| 12832 | 12781 | obj5Type: obj5Type ?? self.obj5Type, |
| 12833 | 12782 | obj5Typealias: obj5Typealias ?? self.obj5Typealias, |
| 12834 | - obj5Unowned: obj5Unowned ?? self.obj5Unowned, | |
| 12835 | 12783 | primitiveKind: primitiveKind ?? self.primitiveKind, |
| 12836 | 12784 | purpleSelf: purpleSelf ?? self.purpleSelf, |
| 12837 | 12785 | purpleTrue: purpleTrue ?? self.purpleTrue, |
| 12786 | + sealed: sealed ?? self.sealed, | |
| 12787 | + sel: sel ?? self.sel, | |
| 12838 | 12788 | select: select ?? self.select, |
| 12839 | 12789 | sendable: sendable ?? self.sendable, |
| 12840 | 12790 | serialDescriptor: serialDescriptor ?? self.serialDescriptor, |
| @@ -12879,9 +12829,7 @@ extension Obj5 { | ||
| 12879 | 12829 | unchecked: unchecked ?? self.unchecked, |
| 12880 | 12830 | undefined: undefined ?? self.undefined, |
| 12881 | 12831 | union: union ?? self.union, |
| 12882 | - unmarshalJSON: unmarshalJSON ?? self.unmarshalJSON, | |
| 12883 | - unsafe: unsafe ?? self.unsafe, | |
| 12884 | - useSerializers: useSerializers ?? self.useSerializers | |
| 12832 | + unmarshalJSON: unmarshalJSON ?? self.unmarshalJSON | |
| 12885 | 12833 | ) |
| 12886 | 12834 | } |
| 12887 | 12835 | |
| @@ -13510,50 +13458,6 @@ extension Typealias { | ||
| 13510 | 13458 | } |
| 13511 | 13459 | } |
| 13512 | 13460 | |
| 13513 | -// MARK: - Unowned | |
| 13514 | -struct Unowned: Codable, Sendable { | |
| 13515 | - let unownedUnowned: Int | |
| 13516 | - | |
| 13517 | - enum CodingKeys: String, CodingKey { | |
| 13518 | - case unownedUnowned = "unowned" | |
| 13519 | - } | |
| 13520 | -} | |
| 13521 | - | |
| 13522 | -// MARK: Unowned convenience initializers and mutators | |
| 13523 | - | |
| 13524 | -extension Unowned { | |
| 13525 | - init(data: Data) throws { | |
| 13526 | - self = try newJSONDecoder().decode(Unowned.self, from: data) | |
| 13527 | - } | |
| 13528 | - | |
| 13529 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 13530 | - guard let data = json.data(using: encoding) else { | |
| 13531 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 13532 | - } | |
| 13533 | - try self.init(data: data) | |
| 13534 | - } | |
| 13535 | - | |
| 13536 | - init(fromURL url: URL) throws { | |
| 13537 | - try self.init(data: try Data(contentsOf: url)) | |
| 13538 | - } | |
| 13539 | - | |
| 13540 | - func with( | |
| 13541 | - unownedUnowned: Int? = nil | |
| 13542 | - ) -> Unowned { | |
| 13543 | - return Unowned( | |
| 13544 | - unownedUnowned: unownedUnowned ?? self.unownedUnowned | |
| 13545 | - ) | |
| 13546 | - } | |
| 13547 | - | |
| 13548 | - func jsonData() throws -> Data { | |
| 13549 | - return try newJSONEncoder().encode(self) | |
| 13550 | - } | |
| 13551 | - | |
| 13552 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 13553 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 13554 | - } | |
| 13555 | -} | |
| 13556 | - | |
| 13557 | 13461 | // MARK: - PrimitiveKind |
| 13558 | 13462 | struct PrimitiveKind: Codable, Sendable { |
| 13559 | 13463 | let primitiveKind: Int |
| @@ -13686,6 +13590,94 @@ extension TrueClass { | ||
| 13686 | 13590 | } |
| 13687 | 13591 | } |
| 13688 | 13592 | |
| 13593 | +// MARK: - Sealed | |
| 13594 | +struct Sealed: Codable, Sendable { | |
| 13595 | + let sealed: Int | |
| 13596 | + | |
| 13597 | + enum CodingKeys: String, CodingKey { | |
| 13598 | + case sealed = "sealed" | |
| 13599 | + } | |
| 13600 | +} | |
| 13601 | + | |
| 13602 | +// MARK: Sealed convenience initializers and mutators | |
| 13603 | + | |
| 13604 | +extension Sealed { | |
| 13605 | + init(data: Data) throws { | |
| 13606 | + self = try newJSONDecoder().decode(Sealed.self, from: data) | |
| 13607 | + } | |
| 13608 | + | |
| 13609 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 13610 | + guard let data = json.data(using: encoding) else { | |
| 13611 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 13612 | + } | |
| 13613 | + try self.init(data: data) | |
| 13614 | + } | |
| 13615 | + | |
| 13616 | + init(fromURL url: URL) throws { | |
| 13617 | + try self.init(data: try Data(contentsOf: url)) | |
| 13618 | + } | |
| 13619 | + | |
| 13620 | + func with( | |
| 13621 | + sealed: Int? = nil | |
| 13622 | + ) -> Sealed { | |
| 13623 | + return Sealed( | |
| 13624 | + sealed: sealed ?? self.sealed | |
| 13625 | + ) | |
| 13626 | + } | |
| 13627 | + | |
| 13628 | + func jsonData() throws -> Data { | |
| 13629 | + return try newJSONEncoder().encode(self) | |
| 13630 | + } | |
| 13631 | + | |
| 13632 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 13633 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 13634 | + } | |
| 13635 | +} | |
| 13636 | + | |
| 13637 | +// MARK: - Sel | |
| 13638 | +struct Sel: Codable, Sendable { | |
| 13639 | + let sel: Int | |
| 13640 | + | |
| 13641 | + enum CodingKeys: String, CodingKey { | |
| 13642 | + case sel = "SEL" | |
| 13643 | + } | |
| 13644 | +} | |
| 13645 | + | |
| 13646 | +// MARK: Sel convenience initializers and mutators | |
| 13647 | + | |
| 13648 | +extension Sel { | |
| 13649 | + init(data: Data) throws { | |
| 13650 | + self = try newJSONDecoder().decode(Sel.self, from: data) | |
| 13651 | + } | |
| 13652 | + | |
| 13653 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 13654 | + guard let data = json.data(using: encoding) else { | |
| 13655 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 13656 | + } | |
| 13657 | + try self.init(data: data) | |
| 13658 | + } | |
| 13659 | + | |
| 13660 | + init(fromURL url: URL) throws { | |
| 13661 | + try self.init(data: try Data(contentsOf: url)) | |
| 13662 | + } | |
| 13663 | + | |
| 13664 | + func with( | |
| 13665 | + sel: Int? = nil | |
| 13666 | + ) -> Sel { | |
| 13667 | + return Sel( | |
| 13668 | + sel: sel ?? self.sel | |
| 13669 | + ) | |
| 13670 | + } | |
| 13671 | + | |
| 13672 | + func jsonData() throws -> Data { | |
| 13673 | + return try newJSONEncoder().encode(self) | |
| 13674 | + } | |
| 13675 | + | |
| 13676 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 13677 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 13678 | + } | |
| 13679 | +} | |
| 13680 | + | |
| 13689 | 13681 | // MARK: - Select |
| 13690 | 13682 | struct Select: Codable, Sendable { |
| 13691 | 13683 | let select: Int |
| @@ -15666,103 +15658,18 @@ extension UnmarshalJSON { | ||
| 15666 | 15658 | } |
| 15667 | 15659 | } |
| 15668 | 15660 | |
| 15669 | -// MARK: - Unsafe | |
| 15670 | -struct Unsafe: Codable, Sendable { | |
| 15671 | - let unsafe: Int | |
| 15672 | - | |
| 15673 | - enum CodingKeys: String, CodingKey { | |
| 15674 | - case unsafe = "unsafe" | |
| 15675 | - } | |
| 15676 | -} | |
| 15677 | - | |
| 15678 | -// MARK: Unsafe convenience initializers and mutators | |
| 15679 | - | |
| 15680 | -extension Unsafe { | |
| 15681 | - init(data: Data) throws { | |
| 15682 | - self = try newJSONDecoder().decode(Unsafe.self, from: data) | |
| 15683 | - } | |
| 15684 | - | |
| 15685 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 15686 | - guard let data = json.data(using: encoding) else { | |
| 15687 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 15688 | - } | |
| 15689 | - try self.init(data: data) | |
| 15690 | - } | |
| 15691 | - | |
| 15692 | - init(fromURL url: URL) throws { | |
| 15693 | - try self.init(data: try Data(contentsOf: url)) | |
| 15694 | - } | |
| 15695 | - | |
| 15696 | - func with( | |
| 15697 | - unsafe: Int? = nil | |
| 15698 | - ) -> Unsafe { | |
| 15699 | - return Unsafe( | |
| 15700 | - unsafe: unsafe ?? self.unsafe | |
| 15701 | - ) | |
| 15702 | - } | |
| 15703 | - | |
| 15704 | - func jsonData() throws -> Data { | |
| 15705 | - return try newJSONEncoder().encode(self) | |
| 15706 | - } | |
| 15707 | - | |
| 15708 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 15709 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 15710 | - } | |
| 15711 | -} | |
| 15712 | - | |
| 15713 | -// MARK: - UseSerializers | |
| 15714 | -struct UseSerializers: Codable, Sendable { | |
| 15715 | - let useSerializers: Int | |
| 15716 | - | |
| 15717 | - enum CodingKeys: String, CodingKey { | |
| 15718 | - case useSerializers = "UseSerializers" | |
| 15719 | - } | |
| 15720 | -} | |
| 15721 | - | |
| 15722 | -// MARK: UseSerializers convenience initializers and mutators | |
| 15723 | - | |
| 15724 | -extension UseSerializers { | |
| 15725 | - init(data: Data) throws { | |
| 15726 | - self = try newJSONDecoder().decode(UseSerializers.self, from: data) | |
| 15727 | - } | |
| 15728 | - | |
| 15729 | - init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 15730 | - guard let data = json.data(using: encoding) else { | |
| 15731 | - throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 15732 | - } | |
| 15733 | - try self.init(data: data) | |
| 15734 | - } | |
| 15735 | - | |
| 15736 | - init(fromURL url: URL) throws { | |
| 15737 | - try self.init(data: try Data(contentsOf: url)) | |
| 15738 | - } | |
| 15739 | - | |
| 15740 | - func with( | |
| 15741 | - useSerializers: Int? = nil | |
| 15742 | - ) -> UseSerializers { | |
| 15743 | - return UseSerializers( | |
| 15744 | - useSerializers: useSerializers ?? self.useSerializers | |
| 15745 | - ) | |
| 15746 | - } | |
| 15747 | - | |
| 15748 | - func jsonData() throws -> Data { | |
| 15749 | - return try newJSONEncoder().encode(self) | |
| 15750 | - } | |
| 15751 | - | |
| 15752 | - func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 15753 | - return String(data: try self.jsonData(), encoding: encoding) | |
| 15754 | - } | |
| 15755 | -} | |
| 15756 | - | |
| 15757 | 15661 | // MARK: - Obj6 |
| 15758 | 15662 | struct Obj6: Codable, Sendable { |
| 15759 | 15663 | let dummy: Int |
| 15664 | + let obj6Unowned: Unowned | |
| 15760 | 15665 | let obj6Var: Var |
| 15761 | 15666 | let obj6Weak: Weak |
| 15762 | 15667 | let obj6Where: Where |
| 15763 | 15668 | let obj6While: While |
| 15764 | 15669 | let obj6WillSet: WillSet |
| 15670 | + let unsafe: Unsafe | |
| 15765 | 15671 | let unsigned: Unsigned |
| 15672 | + let useSerializers: UseSerializers | |
| 15766 | 15673 | let ushort: Ushort |
| 15767 | 15674 | let using: Using |
| 15768 | 15675 | let utf8JSONReader: Utf8JSONReader |
| @@ -15780,12 +15687,15 @@ struct Obj6: Codable, Sendable { | ||
| 15780 | 15687 | |
| 15781 | 15688 | enum CodingKeys: String, CodingKey { |
| 15782 | 15689 | case dummy = "dummy" |
| 15690 | + case obj6Unowned = "unowned" | |
| 15783 | 15691 | case obj6Var = "var" |
| 15784 | 15692 | case obj6Weak = "weak" |
| 15785 | 15693 | case obj6Where = "where" |
| 15786 | 15694 | case obj6While = "while" |
| 15787 | 15695 | case obj6WillSet = "willSet" |
| 15696 | + case unsafe = "unsafe" | |
| 15788 | 15697 | case unsigned = "unsigned" |
| 15698 | + case useSerializers = "UseSerializers" | |
| 15789 | 15699 | case ushort = "ushort" |
| 15790 | 15700 | case using = "using" |
| 15791 | 15701 | case utf8JSONReader = "Utf8JsonReader" |
| @@ -15823,12 +15733,15 @@ extension Obj6 { | ||
| 15823 | 15733 | |
| 15824 | 15734 | func with( |
| 15825 | 15735 | dummy: Int? = nil, |
| 15736 | + obj6Unowned: Unowned? = nil, | |
| 15826 | 15737 | obj6Var: Var? = nil, |
| 15827 | 15738 | obj6Weak: Weak? = nil, |
| 15828 | 15739 | obj6Where: Where? = nil, |
| 15829 | 15740 | obj6While: While? = nil, |
| 15830 | 15741 | obj6WillSet: WillSet? = nil, |
| 15742 | + unsafe: Unsafe? = nil, | |
| 15831 | 15743 | unsigned: Unsigned? = nil, |
| 15744 | + useSerializers: UseSerializers? = nil, | |
| 15832 | 15745 | ushort: Ushort? = nil, |
| 15833 | 15746 | using: Using? = nil, |
| 15834 | 15747 | utf8JSONReader: Utf8JSONReader? = nil, |
| @@ -15846,12 +15759,15 @@ extension Obj6 { | ||
| 15846 | 15759 | ) -> Obj6 { |
| 15847 | 15760 | return Obj6( |
| 15848 | 15761 | dummy: dummy ?? self.dummy, |
| 15762 | + obj6Unowned: obj6Unowned ?? self.obj6Unowned, | |
| 15849 | 15763 | obj6Var: obj6Var ?? self.obj6Var, |
| 15850 | 15764 | obj6Weak: obj6Weak ?? self.obj6Weak, |
| 15851 | 15765 | obj6Where: obj6Where ?? self.obj6Where, |
| 15852 | 15766 | obj6While: obj6While ?? self.obj6While, |
| 15853 | 15767 | obj6WillSet: obj6WillSet ?? self.obj6WillSet, |
| 15768 | + unsafe: unsafe ?? self.unsafe, | |
| 15854 | 15769 | unsigned: unsigned ?? self.unsigned, |
| 15770 | + useSerializers: useSerializers ?? self.useSerializers, | |
| 15855 | 15771 | ushort: ushort ?? self.ushort, |
| 15856 | 15772 | using: using ?? self.using, |
| 15857 | 15773 | utf8JSONReader: utf8JSONReader ?? self.utf8JSONReader, |
| @@ -15878,6 +15794,50 @@ extension Obj6 { | ||
| 15878 | 15794 | } |
| 15879 | 15795 | } |
| 15880 | 15796 | |
| 15797 | +// MARK: - Unowned | |
| 15798 | +struct Unowned: Codable, Sendable { | |
| 15799 | + let unownedUnowned: Int | |
| 15800 | + | |
| 15801 | + enum CodingKeys: String, CodingKey { | |
| 15802 | + case unownedUnowned = "unowned" | |
| 15803 | + } | |
| 15804 | +} | |
| 15805 | + | |
| 15806 | +// MARK: Unowned convenience initializers and mutators | |
| 15807 | + | |
| 15808 | +extension Unowned { | |
| 15809 | + init(data: Data) throws { | |
| 15810 | + self = try newJSONDecoder().decode(Unowned.self, from: data) | |
| 15811 | + } | |
| 15812 | + | |
| 15813 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 15814 | + guard let data = json.data(using: encoding) else { | |
| 15815 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 15816 | + } | |
| 15817 | + try self.init(data: data) | |
| 15818 | + } | |
| 15819 | + | |
| 15820 | + init(fromURL url: URL) throws { | |
| 15821 | + try self.init(data: try Data(contentsOf: url)) | |
| 15822 | + } | |
| 15823 | + | |
| 15824 | + func with( | |
| 15825 | + unownedUnowned: Int? = nil | |
| 15826 | + ) -> Unowned { | |
| 15827 | + return Unowned( | |
| 15828 | + unownedUnowned: unownedUnowned ?? self.unownedUnowned | |
| 15829 | + ) | |
| 15830 | + } | |
| 15831 | + | |
| 15832 | + func jsonData() throws -> Data { | |
| 15833 | + return try newJSONEncoder().encode(self) | |
| 15834 | + } | |
| 15835 | + | |
| 15836 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 15837 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 15838 | + } | |
| 15839 | +} | |
| 15840 | + | |
| 15881 | 15841 | // MARK: - Var |
| 15882 | 15842 | struct Var: Codable, Sendable { |
| 15883 | 15843 | let varVar: Int |
| @@ -16098,6 +16058,50 @@ extension WillSet { | ||
| 16098 | 16058 | } |
| 16099 | 16059 | } |
| 16100 | 16060 | |
| 16061 | +// MARK: - Unsafe | |
| 16062 | +struct Unsafe: Codable, Sendable { | |
| 16063 | + let unsafe: Int | |
| 16064 | + | |
| 16065 | + enum CodingKeys: String, CodingKey { | |
| 16066 | + case unsafe = "unsafe" | |
| 16067 | + } | |
| 16068 | +} | |
| 16069 | + | |
| 16070 | +// MARK: Unsafe convenience initializers and mutators | |
| 16071 | + | |
| 16072 | +extension Unsafe { | |
| 16073 | + init(data: Data) throws { | |
| 16074 | + self = try newJSONDecoder().decode(Unsafe.self, from: data) | |
| 16075 | + } | |
| 16076 | + | |
| 16077 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 16078 | + guard let data = json.data(using: encoding) else { | |
| 16079 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 16080 | + } | |
| 16081 | + try self.init(data: data) | |
| 16082 | + } | |
| 16083 | + | |
| 16084 | + init(fromURL url: URL) throws { | |
| 16085 | + try self.init(data: try Data(contentsOf: url)) | |
| 16086 | + } | |
| 16087 | + | |
| 16088 | + func with( | |
| 16089 | + unsafe: Int? = nil | |
| 16090 | + ) -> Unsafe { | |
| 16091 | + return Unsafe( | |
| 16092 | + unsafe: unsafe ?? self.unsafe | |
| 16093 | + ) | |
| 16094 | + } | |
| 16095 | + | |
| 16096 | + func jsonData() throws -> Data { | |
| 16097 | + return try newJSONEncoder().encode(self) | |
| 16098 | + } | |
| 16099 | + | |
| 16100 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 16101 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 16102 | + } | |
| 16103 | +} | |
| 16104 | + | |
| 16101 | 16105 | // MARK: - Unsigned |
| 16102 | 16106 | struct Unsigned: Codable, Sendable { |
| 16103 | 16107 | let unsigned: Int |
| @@ -16142,6 +16146,50 @@ extension Unsigned { | ||
| 16142 | 16146 | } |
| 16143 | 16147 | } |
| 16144 | 16148 | |
| 16149 | +// MARK: - UseSerializers | |
| 16150 | +struct UseSerializers: Codable, Sendable { | |
| 16151 | + let useSerializers: Int | |
| 16152 | + | |
| 16153 | + enum CodingKeys: String, CodingKey { | |
| 16154 | + case useSerializers = "UseSerializers" | |
| 16155 | + } | |
| 16156 | +} | |
| 16157 | + | |
| 16158 | +// MARK: UseSerializers convenience initializers and mutators | |
| 16159 | + | |
| 16160 | +extension UseSerializers { | |
| 16161 | + init(data: Data) throws { | |
| 16162 | + self = try newJSONDecoder().decode(UseSerializers.self, from: data) | |
| 16163 | + } | |
| 16164 | + | |
| 16165 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 16166 | + guard let data = json.data(using: encoding) else { | |
| 16167 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 16168 | + } | |
| 16169 | + try self.init(data: data) | |
| 16170 | + } | |
| 16171 | + | |
| 16172 | + init(fromURL url: URL) throws { | |
| 16173 | + try self.init(data: try Data(contentsOf: url)) | |
| 16174 | + } | |
| 16175 | + | |
| 16176 | + func with( | |
| 16177 | + useSerializers: Int? = nil | |
| 16178 | + ) -> UseSerializers { | |
| 16179 | + return UseSerializers( | |
| 16180 | + useSerializers: useSerializers ?? self.useSerializers | |
| 16181 | + ) | |
| 16182 | + } | |
| 16183 | + | |
| 16184 | + func jsonData() throws -> Data { | |
| 16185 | + return try newJSONEncoder().encode(self) | |
| 16186 | + } | |
| 16187 | + | |
| 16188 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 16189 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 16190 | + } | |
| 16191 | +} | |
| 16192 | + | |
| 16145 | 16193 | // MARK: - Ushort |
| 16146 | 16194 | struct Ushort: Codable, Sendable { |
| 16147 | 16195 | let ushort: Int |
Mtypescript-effect-schemadefault / TopLevel.ts+40 −35
| @@ -83,13 +83,28 @@ export class Ushort extends S.Class<Ushort>("Ushort")({ | ||
| 83 | 83 | "ushort": S.Int, |
| 84 | 84 | }) {} |
| 85 | 85 | |
| 86 | +export class UseSerializers extends S.Class<UseSerializers>("UseSerializers")({ | |
| 87 | + "UseSerializers": S.Int, | |
| 88 | +}) {} | |
| 89 | + | |
| 86 | 90 | export class Unsigned extends S.Class<Unsigned>("Unsigned")({ |
| 87 | 91 | "unsigned": S.Int, |
| 88 | 92 | }) {} |
| 89 | 93 | |
| 94 | +export class Unsafe extends S.Class<Unsafe>("Unsafe")({ | |
| 95 | + "unsafe": S.Int, | |
| 96 | +}) {} | |
| 97 | + | |
| 98 | +export class Unowned extends S.Class<Unowned>("Unowned")({ | |
| 99 | + "unowned": S.Int, | |
| 100 | +}) {} | |
| 101 | + | |
| 90 | 102 | export class Obj6 extends S.Class<Obj6>("Obj6")({ |
| 91 | 103 | "dummy": S.Int, |
| 104 | + "unowned": Unowned, | |
| 105 | + "unsafe": Unsafe, | |
| 92 | 106 | "unsigned": Unsigned, |
| 107 | + "UseSerializers": UseSerializers, | |
| 93 | 108 | "ushort": Ushort, |
| 94 | 109 | "using": Using, |
| 95 | 110 | "Utf8JsonReader": Utf8JsonReader, |
| @@ -111,18 +126,6 @@ export class Obj6 extends S.Class<Obj6>("Obj6")({ | ||
| 111 | 126 | "yield": Yield, |
| 112 | 127 | }) {} |
| 113 | 128 | |
| 114 | -export class UseSerializers extends S.Class<UseSerializers>("UseSerializers")({ | |
| 115 | - "UseSerializers": S.Int, | |
| 116 | -}) {} | |
| 117 | - | |
| 118 | -export class Unsafe extends S.Class<Unsafe>("Unsafe")({ | |
| 119 | - "unsafe": S.Int, | |
| 120 | -}) {} | |
| 121 | - | |
| 122 | -export class Unowned extends S.Class<Unowned>("Unowned")({ | |
| 123 | - "unowned": S.Int, | |
| 124 | -}) {} | |
| 125 | - | |
| 126 | 129 | export class UnmarshalJson extends S.Class<UnmarshalJson>("UnmarshalJson")({ |
| 127 | 130 | "UnmarshalJSON": S.Int, |
| 128 | 131 | }) {} |
| @@ -352,6 +355,14 @@ export class Select extends S.Class<Select>("Select")({ | ||
| 352 | 355 | "select": S.Int, |
| 353 | 356 | }) {} |
| 354 | 357 | |
| 358 | +export class Sel extends S.Class<Sel>("Sel")({ | |
| 359 | + "SEL": S.Int, | |
| 360 | +}) {} | |
| 361 | + | |
| 362 | +export class Sealed extends S.Class<Sealed>("Sealed")({ | |
| 363 | + "sealed": S.Int, | |
| 364 | +}) {} | |
| 365 | + | |
| 355 | 366 | export class PrimitiveKind extends S.Class<PrimitiveKind>("PrimitiveKind")({ |
| 356 | 367 | "PrimitiveKind": S.Int, |
| 357 | 368 | }) {} |
| @@ -379,6 +390,8 @@ export class Obj5 extends S.Class<Obj5>("Obj5")({ | ||
| 379 | 390 | "true": TrueClass, |
| 380 | 391 | "type": TypeClass, |
| 381 | 392 | "PrimitiveKind": PrimitiveKind, |
| 393 | + "sealed": Sealed, | |
| 394 | + "SEL": Sel, | |
| 382 | 395 | "select": Select, |
| 383 | 396 | "Self": Self, |
| 384 | 397 | "Sendable": Sendable, |
| @@ -436,20 +449,9 @@ export class Obj5 extends S.Class<Obj5>("Obj5")({ | ||
| 436 | 449 | "undefined": Undefined, |
| 437 | 450 | "union": Union, |
| 438 | 451 | "UnmarshalJSON": UnmarshalJson, |
| 439 | - "unowned": Unowned, | |
| 440 | - "unsafe": Unsafe, | |
| 441 | - "UseSerializers": UseSerializers, | |
| 442 | 452 | }) {} |
| 443 | 453 | Object.defineProperty(Obj5.prototype, "toString", { writable: true }); |
| 444 | 454 | |
| 445 | -export class Sel extends S.Class<Sel>("Sel")({ | |
| 446 | - "SEL": S.Int, | |
| 447 | -}) {} | |
| 448 | - | |
| 449 | -export class Sealed extends S.Class<Sealed>("Sealed")({ | |
| 450 | - "sealed": S.Int, | |
| 451 | -}) {} | |
| 452 | - | |
| 453 | 455 | export class Sbyte extends S.Class<Sbyte>("Sbyte")({ |
| 454 | 456 | "sbyte": S.Int, |
| 455 | 457 | }) {} |
| @@ -698,8 +700,18 @@ export class NoSuchMethod extends S.Class<NoSuchMethod>("NoSuchMethod")({ | ||
| 698 | 700 | "noSuchMethod": S.Int, |
| 699 | 701 | }) {} |
| 700 | 702 | |
| 703 | +export class No extends S.Class<No>("No")({ | |
| 704 | + "NO": S.Int, | |
| 705 | +}) {} | |
| 706 | + | |
| 707 | +export class Nil extends S.Class<Nil>("Nil")({ | |
| 708 | + "nil": S.Int, | |
| 709 | +}) {} | |
| 710 | + | |
| 701 | 711 | export class Obj4 extends S.Class<Obj4>("Obj4")({ |
| 702 | 712 | "dummy": S.Int, |
| 713 | + "nil": Nil, | |
| 714 | + "NO": No, | |
| 703 | 715 | "noSuchMethod": NoSuchMethod, |
| 704 | 716 | "noexcept": Noexcept, |
| 705 | 717 | "nonatomic": Nonatomic, |
| @@ -762,16 +774,6 @@ export class Obj4 extends S.Class<Obj4>("Obj4")({ | ||
| 762 | 774 | "runtimeType": RuntimeType, |
| 763 | 775 | "s": SClass, |
| 764 | 776 | "sbyte": Sbyte, |
| 765 | - "sealed": Sealed, | |
| 766 | - "SEL": Sel, | |
| 767 | -}) {} | |
| 768 | - | |
| 769 | -export class No extends S.Class<No>("No")({ | |
| 770 | - "NO": S.Int, | |
| 771 | -}) {} | |
| 772 | - | |
| 773 | -export class Nil extends S.Class<Nil>("Nil")({ | |
| 774 | - "nil": S.Int, | |
| 775 | 777 | }) {} |
| 776 | 778 | |
| 777 | 779 | export class Newtonsoft extends S.Class<Newtonsoft>("Newtonsoft")({ |
| @@ -818,6 +820,10 @@ export class Map extends S.Class<Map>("Map")({ | ||
| 818 | 820 | "map": S.Int, |
| 819 | 821 | }) {} |
| 820 | 822 | |
| 823 | +export class MakeDictEncoder extends S.Class<MakeDictEncoder>("MakeDictEncoder")({ | |
| 824 | + "makeDictEncoder": S.Int, | |
| 825 | +}) {} | |
| 826 | + | |
| 821 | 827 | export class Long extends S.Class<Long>("Long")({ |
| 822 | 828 | "long": S.Int, |
| 823 | 829 | }) {} |
| @@ -1080,6 +1086,7 @@ export class Obj3 extends S.Class<Obj3>("Obj3")({ | ||
| 1080 | 1086 | "Locale": Locale, |
| 1081 | 1087 | "lock": Lock, |
| 1082 | 1088 | "long": Long, |
| 1089 | + "makeDictEncoder": MakeDictEncoder, | |
| 1083 | 1090 | "map": Map, |
| 1084 | 1091 | "MapEntry": MapEntry, |
| 1085 | 1092 | "MarshalJSON": MarshalJson, |
| @@ -1091,8 +1098,6 @@ export class Obj3 extends S.Class<Obj3>("Obj3")({ | ||
| 1091 | 1098 | "native": Native, |
| 1092 | 1099 | "new": New, |
| 1093 | 1100 | "newtonsoft": Newtonsoft, |
| 1094 | - "nil": Nil, | |
| 1095 | - "NO": No, | |
| 1096 | 1101 | }) {} |
| 1097 | 1102 | |
| 1098 | 1103 | export class FalseClass extends S.Class<FalseClass>("FalseClass")({ |
Mtypescript-zoddefault / TopLevel.ts+28 −22
| @@ -907,6 +907,11 @@ export const LongSchema = z.object({ | ||
| 907 | 907 | }); |
| 908 | 908 | export type Long = z.infer<typeof LongSchema>; |
| 909 | 909 | |
| 910 | +export const MakeDictEncoderSchema = z.object({ | |
| 911 | + "makeDictEncoder": z.number().int(), | |
| 912 | +}); | |
| 913 | +export type MakeDictEncoder = z.infer<typeof MakeDictEncoderSchema>; | |
| 914 | + | |
| 910 | 915 | export const MapSchema = z.object({ |
| 911 | 916 | "map": z.number().int(), |
| 912 | 917 | }); |
| @@ -1282,16 +1287,6 @@ export const SbyteSchema = z.object({ | ||
| 1282 | 1287 | }); |
| 1283 | 1288 | export type Sbyte = z.infer<typeof SbyteSchema>; |
| 1284 | 1289 | |
| 1285 | -export const SealedSchema = z.object({ | |
| 1286 | - "sealed": z.number().int(), | |
| 1287 | -}); | |
| 1288 | -export type Sealed = z.infer<typeof SealedSchema>; | |
| 1289 | - | |
| 1290 | -export const SelSchema = z.object({ | |
| 1291 | - "SEL": z.number().int(), | |
| 1292 | -}); | |
| 1293 | -export type Sel = z.infer<typeof SelSchema>; | |
| 1294 | - | |
| 1295 | 1290 | export const KSerializerSchema = z.object({ |
| 1296 | 1291 | "KSerializer": z.number().int(), |
| 1297 | 1292 | }); |
| @@ -1317,6 +1312,16 @@ export const PrimitiveKindSchema = z.object({ | ||
| 1317 | 1312 | }); |
| 1318 | 1313 | export type PrimitiveKind = z.infer<typeof PrimitiveKindSchema>; |
| 1319 | 1314 | |
| 1315 | +export const SealedSchema = z.object({ | |
| 1316 | + "sealed": z.number().int(), | |
| 1317 | +}); | |
| 1318 | +export type Sealed = z.infer<typeof SealedSchema>; | |
| 1319 | + | |
| 1320 | +export const SelSchema = z.object({ | |
| 1321 | + "SEL": z.number().int(), | |
| 1322 | +}); | |
| 1323 | +export type Sel = z.infer<typeof SelSchema>; | |
| 1324 | + | |
| 1320 | 1325 | export const SelectSchema = z.object({ |
| 1321 | 1326 | "select": z.number().int(), |
| 1322 | 1327 | }); |
| @@ -1612,16 +1617,16 @@ export const UnsafeSchema = z.object({ | ||
| 1612 | 1617 | }); |
| 1613 | 1618 | export type Unsafe = z.infer<typeof UnsafeSchema>; |
| 1614 | 1619 | |
| 1615 | -export const UseSerializersSchema = z.object({ | |
| 1616 | - "UseSerializers": z.number().int(), | |
| 1617 | -}); | |
| 1618 | -export type UseSerializers = z.infer<typeof UseSerializersSchema>; | |
| 1619 | - | |
| 1620 | 1620 | export const UnsignedSchema = z.object({ |
| 1621 | 1621 | "unsigned": z.number().int(), |
| 1622 | 1622 | }); |
| 1623 | 1623 | export type Unsigned = z.infer<typeof UnsignedSchema>; |
| 1624 | 1624 | |
| 1625 | +export const UseSerializersSchema = z.object({ | |
| 1626 | + "UseSerializers": z.number().int(), | |
| 1627 | +}); | |
| 1628 | +export type UseSerializers = z.infer<typeof UseSerializersSchema>; | |
| 1629 | + | |
| 1625 | 1630 | export const UshortSchema = z.object({ |
| 1626 | 1631 | "ushort": z.number().int(), |
| 1627 | 1632 | }); |
| @@ -1909,6 +1914,7 @@ export const Obj3Schema = z.object({ | ||
| 1909 | 1914 | "Locale": LocaleSchema, |
| 1910 | 1915 | "lock": LockSchema, |
| 1911 | 1916 | "long": LongSchema, |
| 1917 | + "makeDictEncoder": MakeDictEncoderSchema, | |
| 1912 | 1918 | "map": MapSchema, |
| 1913 | 1919 | "MapEntry": MapEntrySchema, |
| 1914 | 1920 | "MarshalJSON": MarshalJsonSchema, |
| @@ -1920,13 +1926,13 @@ export const Obj3Schema = z.object({ | ||
| 1920 | 1926 | "native": NativeSchema, |
| 1921 | 1927 | "new": NewSchema, |
| 1922 | 1928 | "newtonsoft": NewtonsoftSchema, |
| 1923 | - "nil": NilSchema, | |
| 1924 | - "NO": NoSchema, | |
| 1925 | 1929 | }); |
| 1926 | 1930 | export type Obj3 = z.infer<typeof Obj3Schema>; |
| 1927 | 1931 | |
| 1928 | 1932 | export const Obj4Schema = z.object({ |
| 1929 | 1933 | "dummy": z.number().int(), |
| 1934 | + "nil": NilSchema, | |
| 1935 | + "NO": NoSchema, | |
| 1930 | 1936 | "noSuchMethod": NoSuchMethodSchema, |
| 1931 | 1937 | "noexcept": NoexceptSchema, |
| 1932 | 1938 | "nonatomic": NonatomicSchema, |
| @@ -1989,8 +1995,6 @@ export const Obj4Schema = z.object({ | ||
| 1989 | 1995 | "runtimeType": RuntimeTypeSchema, |
| 1990 | 1996 | "s": SSchema, |
| 1991 | 1997 | "sbyte": SbyteSchema, |
| 1992 | - "sealed": SealedSchema, | |
| 1993 | - "SEL": SelSchema, | |
| 1994 | 1998 | }); |
| 1995 | 1999 | export type Obj4 = z.infer<typeof Obj4Schema>; |
| 1996 | 2000 | |
| @@ -2001,6 +2005,8 @@ export const Obj5Schema = z.object({ | ||
| 2001 | 2005 | "true": TrueClassSchema, |
| 2002 | 2006 | "type": TypeClassSchema, |
| 2003 | 2007 | "PrimitiveKind": PrimitiveKindSchema, |
| 2008 | + "sealed": SealedSchema, | |
| 2009 | + "SEL": SelSchema, | |
| 2004 | 2010 | "select": SelectSchema, |
| 2005 | 2011 | "Self": SelfSchema, |
| 2006 | 2012 | "Sendable": SendableSchema, |
| @@ -2058,15 +2064,15 @@ export const Obj5Schema = z.object({ | ||
| 2058 | 2064 | "undefined": UndefinedSchema, |
| 2059 | 2065 | "union": UnionSchema, |
| 2060 | 2066 | "UnmarshalJSON": UnmarshalJsonSchema, |
| 2061 | - "unowned": UnownedSchema, | |
| 2062 | - "unsafe": UnsafeSchema, | |
| 2063 | - "UseSerializers": UseSerializersSchema, | |
| 2064 | 2067 | }); |
| 2065 | 2068 | export type Obj5 = z.infer<typeof Obj5Schema>; |
| 2066 | 2069 | |
| 2067 | 2070 | export const Obj6Schema = z.object({ |
| 2068 | 2071 | "dummy": z.number().int(), |
| 2072 | + "unowned": UnownedSchema, | |
| 2073 | + "unsafe": UnsafeSchema, | |
| 2069 | 2074 | "unsigned": UnsignedSchema, |
| 2075 | + "UseSerializers": UseSerializersSchema, | |
| 2070 | 2076 | "ushort": UshortSchema, |
| 2071 | 2077 | "using": UsingSchema, |
| 2072 | 2078 | "Utf8JsonReader": Utf8JsonReaderSchema, |
Mtypescriptdefault / TopLevel.ts+68 −59
| @@ -686,7 +686,6 @@ export interface Obj3 { | ||
| 686 | 686 | Locale: Locale; |
| 687 | 687 | MapEntry: MapEntry; |
| 688 | 688 | MarshalJSON: MarshalJSON; |
| 689 | - NO: No; | |
| 690 | 689 | dummy: number; |
| 691 | 690 | goto: Goto; |
| 692 | 691 | guard: Guard; |
| @@ -724,6 +723,7 @@ export interface Obj3 { | ||
| 724 | 723 | list: List; |
| 725 | 724 | lock: Lock; |
| 726 | 725 | long: Long; |
| 726 | + makeDictEncoder: MakeDictEncoder; | |
| 727 | 727 | map: Map; |
| 728 | 728 | metadata_property_handling: MetadataPropertyHandling; |
| 729 | 729 | module: Module; |
| @@ -733,7 +733,6 @@ export interface Obj3 { | ||
| 733 | 733 | native: Native; |
| 734 | 734 | new: New; |
| 735 | 735 | newtonsoft: Newtonsoft; |
| 736 | - nil: Nil; | |
| 737 | 736 | } |
| 738 | 737 | |
| 739 | 738 | export interface Hashable { |
| @@ -808,10 +807,6 @@ export interface MarshalJSON { | ||
| 808 | 807 | MarshalJSON: number; |
| 809 | 808 | } |
| 810 | 809 | |
| 811 | -export interface No { | |
| 812 | - NO: number; | |
| 813 | -} | |
| 814 | - | |
| 815 | 810 | export interface Goto { |
| 816 | 811 | goto: number; |
| 817 | 812 | } |
| @@ -956,6 +951,10 @@ export interface Long { | ||
| 956 | 951 | long: number; |
| 957 | 952 | } |
| 958 | 953 | |
| 954 | +export interface MakeDictEncoder { | |
| 955 | + makeDictEncoder: number; | |
| 956 | +} | |
| 957 | + | |
| 959 | 958 | export interface Map { |
| 960 | 959 | map: number; |
| 961 | 960 | } |
| @@ -992,11 +991,8 @@ export interface Newtonsoft { | ||
| 992 | 991 | newtonsoft: number; |
| 993 | 992 | } |
| 994 | 993 | |
| 995 | -export interface Nil { | |
| 996 | - nil: number; | |
| 997 | -} | |
| 998 | - | |
| 999 | 994 | export interface Obj4 { |
| 995 | + NO: No; | |
| 1000 | 996 | NSError: NSError; |
| 1001 | 997 | NSObject: NSObject; |
| 1002 | 998 | NSString: NSString; |
| @@ -1005,8 +1001,8 @@ export interface Obj4 { | ||
| 1005 | 1001 | ObjectMapper: ObjectMapper; |
| 1006 | 1002 | Protocol: Protocol; |
| 1007 | 1003 | RegExp: RegExp; |
| 1008 | - SEL: Sel; | |
| 1009 | 1004 | dummy: number; |
| 1005 | + nil: Nil; | |
| 1010 | 1006 | noSuchMethod: NoSuchMethod; |
| 1011 | 1007 | noexcept: Noexcept; |
| 1012 | 1008 | nonatomic: Nonatomic; |
| @@ -1061,7 +1057,10 @@ export interface Obj4 { | ||
| 1061 | 1057 | runtimeType: RuntimeType; |
| 1062 | 1058 | s: S; |
| 1063 | 1059 | sbyte: Sbyte; |
| 1064 | - sealed: Sealed; | |
| 1060 | +} | |
| 1061 | + | |
| 1062 | +export interface No { | |
| 1063 | + NO: number; | |
| 1065 | 1064 | } |
| 1066 | 1065 | |
| 1067 | 1066 | export interface NSError { |
| @@ -1096,8 +1095,8 @@ export interface RegExp { | ||
| 1096 | 1095 | RegExp: string; |
| 1097 | 1096 | } |
| 1098 | 1097 | |
| 1099 | -export interface Sel { | |
| 1100 | - SEL: number; | |
| 1098 | +export interface Nil { | |
| 1099 | + nil: number; | |
| 1101 | 1100 | } |
| 1102 | 1101 | |
| 1103 | 1102 | export interface NoSuchMethod { |
| @@ -1316,13 +1315,10 @@ export interface Sbyte { | ||
| 1316 | 1315 | sbyte: number; |
| 1317 | 1316 | } |
| 1318 | 1317 | |
| 1319 | -export interface Sealed { | |
| 1320 | - sealed: number; | |
| 1321 | -} | |
| 1322 | - | |
| 1323 | 1318 | export interface Obj5 { |
| 1324 | 1319 | KSerializer: KSerializer; |
| 1325 | 1320 | PrimitiveKind: PrimitiveKind; |
| 1321 | + SEL: Sel; | |
| 1326 | 1322 | Self: Self; |
| 1327 | 1323 | Sendable: Sendable; |
| 1328 | 1324 | SerialDescriptor: SerialDescriptor; |
| @@ -1339,8 +1335,8 @@ export interface Obj5 { | ||
| 1339 | 1335 | True: True; |
| 1340 | 1336 | Type: Type; |
| 1341 | 1337 | UnmarshalJSON: UnmarshalJSON; |
| 1342 | - UseSerializers: UseSerializers; | |
| 1343 | 1338 | dummy: number; |
| 1339 | + sealed: Sealed; | |
| 1344 | 1340 | select: Select; |
| 1345 | 1341 | self: SelfClass; |
| 1346 | 1342 | serialize: Serialize; |
| @@ -1385,8 +1381,6 @@ export interface Obj5 { | ||
| 1385 | 1381 | unchecked: Unchecked; |
| 1386 | 1382 | undefined: Undefined; |
| 1387 | 1383 | union: Union; |
| 1388 | - unowned: Unowned; | |
| 1389 | - unsafe: Unsafe; | |
| 1390 | 1384 | } |
| 1391 | 1385 | |
| 1392 | 1386 | export interface KSerializer { |
| @@ -1397,6 +1391,10 @@ export interface PrimitiveKind { | ||
| 1397 | 1391 | PrimitiveKind: number; |
| 1398 | 1392 | } |
| 1399 | 1393 | |
| 1394 | +export interface Sel { | |
| 1395 | + SEL: number; | |
| 1396 | +} | |
| 1397 | + | |
| 1400 | 1398 | export interface Self { |
| 1401 | 1399 | Self: number; |
| 1402 | 1400 | } |
| @@ -1461,8 +1459,8 @@ export interface UnmarshalJSON { | ||
| 1461 | 1459 | UnmarshalJSON: number; |
| 1462 | 1460 | } |
| 1463 | 1461 | |
| 1464 | -export interface UseSerializers { | |
| 1465 | - UseSerializers: number; | |
| 1462 | +export interface Sealed { | |
| 1463 | + sealed: number; | |
| 1466 | 1464 | } |
| 1467 | 1465 | |
| 1468 | 1466 | export interface Select { |
| @@ -1641,20 +1639,15 @@ export interface Union { | ||
| 1641 | 1639 | union: number; |
| 1642 | 1640 | } |
| 1643 | 1641 | |
| 1644 | -export interface Unowned { | |
| 1645 | - unowned: number; | |
| 1646 | -} | |
| 1647 | - | |
| 1648 | -export interface Unsafe { | |
| 1649 | - unsafe: number; | |
| 1650 | -} | |
| 1651 | - | |
| 1652 | 1642 | export interface Obj6 { |
| 1653 | 1643 | UUID: UUID; |
| 1644 | + UseSerializers: UseSerializers; | |
| 1654 | 1645 | Utf8JsonReader: Utf8JSONReader; |
| 1655 | 1646 | Utf8JsonWriter: Utf8JSONWriter; |
| 1656 | 1647 | YES: Yes; |
| 1657 | 1648 | dummy: number; |
| 1649 | + unowned: Unowned; | |
| 1650 | + unsafe: Unsafe; | |
| 1658 | 1651 | unsigned: Unsigned; |
| 1659 | 1652 | ushort: Ushort; |
| 1660 | 1653 | using: Using; |
| @@ -1677,6 +1670,10 @@ export interface UUID { | ||
| 1677 | 1670 | UUID: number; |
| 1678 | 1671 | } |
| 1679 | 1672 | |
| 1673 | +export interface UseSerializers { | |
| 1674 | + UseSerializers: number; | |
| 1675 | +} | |
| 1676 | + | |
| 1680 | 1677 | export interface Utf8JSONReader { |
| 1681 | 1678 | Utf8JsonReader: number; |
| 1682 | 1679 | } |
| @@ -1689,6 +1686,14 @@ export interface Yes { | ||
| 1689 | 1686 | YES: number; |
| 1690 | 1687 | } |
| 1691 | 1688 | |
| 1689 | +export interface Unowned { | |
| 1690 | + unowned: number; | |
| 1691 | +} | |
| 1692 | + | |
| 1693 | +export interface Unsafe { | |
| 1694 | + unsafe: number; | |
| 1695 | +} | |
| 1696 | + | |
| 1692 | 1697 | export interface Unsigned { |
| 1693 | 1698 | unsigned: number; |
| 1694 | 1699 | } |
| @@ -1849,7 +1854,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1849 | 1854 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 1850 | 1855 | return invalidValue(l(ref || "object"), val, key, parent); |
| 1851 | 1856 | } |
| 1852 | - const result: any = {}; | |
| 1857 | + const result: any = Object.create(null); | |
| 1853 | 1858 | Object.getOwnPropertyNames(props).forEach(key => { |
| 1854 | 1859 | const prop = props[key]; |
| 1855 | 1860 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -1860,7 +1865,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1860 | 1865 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 1861 | 1866 | } |
| 1862 | 1867 | }); |
| 1863 | - return result; | |
| 1868 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 1864 | 1869 | } |
| 1865 | 1870 | |
| 1866 | 1871 | if (typ === "any") return val; |
| @@ -2487,7 +2492,6 @@ const typeMap: any = { | ||
| 2487 | 2492 | { json: "Locale", js: "Locale", typ: r("Locale") }, |
| 2488 | 2493 | { json: "MapEntry", js: "MapEntry", typ: r("MapEntry") }, |
| 2489 | 2494 | { json: "MarshalJSON", js: "MarshalJSON", typ: r("MarshalJSON") }, |
| 2490 | - { json: "NO", js: "NO", typ: r("No") }, | |
| 2491 | 2495 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 2492 | 2496 | { json: "goto", js: "goto", typ: r("Goto") }, |
| 2493 | 2497 | { json: "guard", js: "guard", typ: r("Guard") }, |
| @@ -2525,6 +2529,7 @@ const typeMap: any = { | ||
| 2525 | 2529 | { json: "list", js: "list", typ: r("List") }, |
| 2526 | 2530 | { json: "lock", js: "lock", typ: r("Lock") }, |
| 2527 | 2531 | { json: "long", js: "long", typ: r("Long") }, |
| 2532 | + { json: "makeDictEncoder", js: "makeDictEncoder", typ: r("MakeDictEncoder") }, | |
| 2528 | 2533 | { json: "map", js: "map", typ: r("Map") }, |
| 2529 | 2534 | { json: "metadata_property_handling", js: "metadata_property_handling", typ: r("MetadataPropertyHandling") }, |
| 2530 | 2535 | { json: "module", js: "module", typ: r("Module") }, |
| @@ -2534,7 +2539,6 @@ const typeMap: any = { | ||
| 2534 | 2539 | { json: "native", js: "native", typ: r("Native") }, |
| 2535 | 2540 | { json: "new", js: "new", typ: r("New") }, |
| 2536 | 2541 | { json: "newtonsoft", js: "newtonsoft", typ: r("Newtonsoft") }, |
| 2537 | - { json: "nil", js: "nil", typ: r("Nil") }, | |
| 2538 | 2542 | ], false), |
| 2539 | 2543 | "Hashable": o([ |
| 2540 | 2544 | { json: "Hashable", js: "Hashable", typ: i(0) }, |
| @@ -2590,9 +2594,6 @@ const typeMap: any = { | ||
| 2590 | 2594 | "MarshalJSON": o([ |
| 2591 | 2595 | { json: "MarshalJSON", js: "MarshalJSON", typ: i(0) }, |
| 2592 | 2596 | ], false), |
| 2593 | - "No": o([ | |
| 2594 | - { json: "NO", js: "NO", typ: i(0) }, | |
| 2595 | - ], false), | |
| 2596 | 2597 | "Goto": o([ |
| 2597 | 2598 | { json: "goto", js: "goto", typ: i(0) }, |
| 2598 | 2599 | ], false), |
| @@ -2701,6 +2702,9 @@ const typeMap: any = { | ||
| 2701 | 2702 | "Long": o([ |
| 2702 | 2703 | { json: "long", js: "long", typ: i(0) }, |
| 2703 | 2704 | ], false), |
| 2705 | + "MakeDictEncoder": o([ | |
| 2706 | + { json: "makeDictEncoder", js: "makeDictEncoder", typ: i(0) }, | |
| 2707 | + ], false), | |
| 2704 | 2708 | "Map": o([ |
| 2705 | 2709 | { json: "map", js: "map", typ: i(0) }, |
| 2706 | 2710 | ], false), |
| @@ -2728,10 +2732,8 @@ const typeMap: any = { | ||
| 2728 | 2732 | "Newtonsoft": o([ |
| 2729 | 2733 | { json: "newtonsoft", js: "newtonsoft", typ: i(0) }, |
| 2730 | 2734 | ], false), |
| 2731 | - "Nil": o([ | |
| 2732 | - { json: "nil", js: "nil", typ: i(0) }, | |
| 2733 | - ], false), | |
| 2734 | 2735 | "Obj4": o([ |
| 2736 | + { json: "NO", js: "NO", typ: r("No") }, | |
| 2735 | 2737 | { json: "NSError", js: "NSError", typ: r("NSError") }, |
| 2736 | 2738 | { json: "NSObject", js: "NSObject", typ: r("NSObject") }, |
| 2737 | 2739 | { json: "NSString", js: "NSString", typ: r("NSString") }, |
| @@ -2740,8 +2742,8 @@ const typeMap: any = { | ||
| 2740 | 2742 | { json: "ObjectMapper", js: "ObjectMapper", typ: r("ObjectMapper") }, |
| 2741 | 2743 | { json: "Protocol", js: "Protocol", typ: r("Protocol") }, |
| 2742 | 2744 | { json: "RegExp", js: "RegExp", typ: r("RegExp") }, |
| 2743 | - { json: "SEL", js: "SEL", typ: r("Sel") }, | |
| 2744 | 2745 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 2746 | + { json: "nil", js: "nil", typ: r("Nil") }, | |
| 2745 | 2747 | { json: "noSuchMethod", js: "noSuchMethod", typ: r("NoSuchMethod") }, |
| 2746 | 2748 | { json: "noexcept", js: "noexcept", typ: r("Noexcept") }, |
| 2747 | 2749 | { json: "nonatomic", js: "nonatomic", typ: r("Nonatomic") }, |
| @@ -2796,7 +2798,9 @@ const typeMap: any = { | ||
| 2796 | 2798 | { json: "runtimeType", js: "runtimeType", typ: r("RuntimeType") }, |
| 2797 | 2799 | { json: "s", js: "s", typ: r("S") }, |
| 2798 | 2800 | { json: "sbyte", js: "sbyte", typ: r("Sbyte") }, |
| 2799 | - { json: "sealed", js: "sealed", typ: r("Sealed") }, | |
| 2801 | + ], false), | |
| 2802 | + "No": o([ | |
| 2803 | + { json: "NO", js: "NO", typ: i(0) }, | |
| 2800 | 2804 | ], false), |
| 2801 | 2805 | "NSError": o([ |
| 2802 | 2806 | { json: "NSError", js: "NSError", typ: i(0) }, |
| @@ -2822,8 +2826,8 @@ const typeMap: any = { | ||
| 2822 | 2826 | "RegExp": o([ |
| 2823 | 2827 | { json: "RegExp", js: "RegExp", typ: { uuid: "" } }, |
| 2824 | 2828 | ], false), |
| 2825 | - "Sel": o([ | |
| 2826 | - { json: "SEL", js: "SEL", typ: i(0) }, | |
| 2829 | + "Nil": o([ | |
| 2830 | + { json: "nil", js: "nil", typ: i(0) }, | |
| 2827 | 2831 | ], false), |
| 2828 | 2832 | "NoSuchMethod": o([ |
| 2829 | 2833 | { json: "noSuchMethod", js: "noSuchMethod", typ: i(0) }, |
| @@ -2987,12 +2991,10 @@ const typeMap: any = { | ||
| 2987 | 2991 | "Sbyte": o([ |
| 2988 | 2992 | { json: "sbyte", js: "sbyte", typ: i(0) }, |
| 2989 | 2993 | ], false), |
| 2990 | - "Sealed": o([ | |
| 2991 | - { json: "sealed", js: "sealed", typ: i(0) }, | |
| 2992 | - ], false), | |
| 2993 | 2994 | "Obj5": o([ |
| 2994 | 2995 | { json: "KSerializer", js: "KSerializer", typ: r("KSerializer") }, |
| 2995 | 2996 | { json: "PrimitiveKind", js: "PrimitiveKind", typ: r("PrimitiveKind") }, |
| 2997 | + { json: "SEL", js: "SEL", typ: r("Sel") }, | |
| 2996 | 2998 | { json: "Self", js: "Self", typ: r("Self") }, |
| 2997 | 2999 | { json: "Sendable", js: "Sendable", typ: r("Sendable") }, |
| 2998 | 3000 | { json: "SerialDescriptor", js: "SerialDescriptor", typ: r("SerialDescriptor") }, |
| @@ -3009,8 +3011,8 @@ const typeMap: any = { | ||
| 3009 | 3011 | { json: "True", js: "True", typ: r("True") }, |
| 3010 | 3012 | { json: "Type", js: "Type", typ: r("Type") }, |
| 3011 | 3013 | { json: "UnmarshalJSON", js: "UnmarshalJSON", typ: r("UnmarshalJSON") }, |
| 3012 | - { json: "UseSerializers", js: "UseSerializers", typ: r("UseSerializers") }, | |
| 3013 | 3014 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 3015 | + { json: "sealed", js: "sealed", typ: r("Sealed") }, | |
| 3014 | 3016 | { json: "select", js: "select", typ: r("Select") }, |
| 3015 | 3017 | { json: "self", js: "self", typ: r("SelfClass") }, |
| 3016 | 3018 | { json: "serialize", js: "serialize", typ: r("Serialize") }, |
| @@ -3055,8 +3057,6 @@ const typeMap: any = { | ||
| 3055 | 3057 | { json: "unchecked", js: "unchecked", typ: r("Unchecked") }, |
| 3056 | 3058 | { json: "undefined", js: "undefined", typ: r("Undefined") }, |
| 3057 | 3059 | { json: "union", js: "union", typ: r("Union") }, |
| 3058 | - { json: "unowned", js: "unowned", typ: r("Unowned") }, | |
| 3059 | - { json: "unsafe", js: "unsafe", typ: r("Unsafe") }, | |
| 3060 | 3060 | ], false), |
| 3061 | 3061 | "KSerializer": o([ |
| 3062 | 3062 | { json: "KSerializer", js: "KSerializer", typ: i(0) }, |
| @@ -3064,6 +3064,9 @@ const typeMap: any = { | ||
| 3064 | 3064 | "PrimitiveKind": o([ |
| 3065 | 3065 | { json: "PrimitiveKind", js: "PrimitiveKind", typ: i(0) }, |
| 3066 | 3066 | ], false), |
| 3067 | + "Sel": o([ | |
| 3068 | + { json: "SEL", js: "SEL", typ: i(0) }, | |
| 3069 | + ], false), | |
| 3067 | 3070 | "Self": o([ |
| 3068 | 3071 | { json: "Self", js: "Self", typ: i(0) }, |
| 3069 | 3072 | ], false), |
| @@ -3112,8 +3115,8 @@ const typeMap: any = { | ||
| 3112 | 3115 | "UnmarshalJSON": o([ |
| 3113 | 3116 | { json: "UnmarshalJSON", js: "UnmarshalJSON", typ: i(0) }, |
| 3114 | 3117 | ], false), |
| 3115 | - "UseSerializers": o([ | |
| 3116 | - { json: "UseSerializers", js: "UseSerializers", typ: i(0) }, | |
| 3118 | + "Sealed": o([ | |
| 3119 | + { json: "sealed", js: "sealed", typ: i(0) }, | |
| 3117 | 3120 | ], false), |
| 3118 | 3121 | "Select": o([ |
| 3119 | 3122 | { json: "select", js: "select", typ: i(0) }, |
| @@ -3247,18 +3250,15 @@ const typeMap: any = { | ||
| 3247 | 3250 | "Union": o([ |
| 3248 | 3251 | { json: "union", js: "union", typ: i(0) }, |
| 3249 | 3252 | ], false), |
| 3250 | - "Unowned": o([ | |
| 3251 | - { json: "unowned", js: "unowned", typ: i(0) }, | |
| 3252 | - ], false), | |
| 3253 | - "Unsafe": o([ | |
| 3254 | - { json: "unsafe", js: "unsafe", typ: i(0) }, | |
| 3255 | - ], false), | |
| 3256 | 3253 | "Obj6": o([ |
| 3257 | 3254 | { json: "UUID", js: "UUID", typ: r("UUID") }, |
| 3255 | + { json: "UseSerializers", js: "UseSerializers", typ: r("UseSerializers") }, | |
| 3258 | 3256 | { json: "Utf8JsonReader", js: "Utf8JsonReader", typ: r("Utf8JSONReader") }, |
| 3259 | 3257 | { json: "Utf8JsonWriter", js: "Utf8JsonWriter", typ: r("Utf8JSONWriter") }, |
| 3260 | 3258 | { json: "YES", js: "YES", typ: r("Yes") }, |
| 3261 | 3259 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 3260 | + { json: "unowned", js: "unowned", typ: r("Unowned") }, | |
| 3261 | + { json: "unsafe", js: "unsafe", typ: r("Unsafe") }, | |
| 3262 | 3262 | { json: "unsigned", js: "unsigned", typ: r("Unsigned") }, |
| 3263 | 3263 | { json: "ushort", js: "ushort", typ: r("Ushort") }, |
| 3264 | 3264 | { json: "using", js: "using", typ: r("Using") }, |
| @@ -3279,6 +3279,9 @@ const typeMap: any = { | ||
| 3279 | 3279 | "UUID": o([ |
| 3280 | 3280 | { json: "UUID", js: "UUID", typ: i(0) }, |
| 3281 | 3281 | ], false), |
| 3282 | + "UseSerializers": o([ | |
| 3283 | + { json: "UseSerializers", js: "UseSerializers", typ: i(0) }, | |
| 3284 | + ], false), | |
| 3282 | 3285 | "Utf8JSONReader": o([ |
| 3283 | 3286 | { json: "Utf8JsonReader", js: "Utf8JsonReader", typ: i(0) }, |
| 3284 | 3287 | ], false), |
| @@ -3288,6 +3291,12 @@ const typeMap: any = { | ||
| 3288 | 3291 | "Yes": o([ |
| 3289 | 3292 | { json: "YES", js: "YES", typ: i(0) }, |
| 3290 | 3293 | ], false), |
| 3294 | + "Unowned": o([ | |
| 3295 | + { json: "unowned", js: "unowned", typ: i(0) }, | |
| 3296 | + ], false), | |
| 3297 | + "Unsafe": o([ | |
| 3298 | + { json: "unsafe", js: "unsafe", typ: i(0) }, | |
| 3299 | + ], false), | |
| 3291 | 3300 | "Unsigned": o([ |
| 3292 | 3301 | { json: "unsigned", js: "unsigned", typ: i(0) }, |
| 3293 | 3302 | ], false), |
Mtypescriptprefer-types-true--df33e18681f9 / TopLevel.ts+68 −59
| @@ -686,7 +686,6 @@ export type Obj3 = { | ||
| 686 | 686 | Locale: Locale; |
| 687 | 687 | MapEntry: MapEntry; |
| 688 | 688 | MarshalJSON: MarshalJSON; |
| 689 | - NO: No; | |
| 690 | 689 | dummy: number; |
| 691 | 690 | goto: Goto; |
| 692 | 691 | guard: Guard; |
| @@ -724,6 +723,7 @@ export type Obj3 = { | ||
| 724 | 723 | list: List; |
| 725 | 724 | lock: Lock; |
| 726 | 725 | long: Long; |
| 726 | + makeDictEncoder: MakeDictEncoder; | |
| 727 | 727 | map: Map; |
| 728 | 728 | metadata_property_handling: MetadataPropertyHandling; |
| 729 | 729 | module: Module; |
| @@ -733,7 +733,6 @@ export type Obj3 = { | ||
| 733 | 733 | native: Native; |
| 734 | 734 | new: New; |
| 735 | 735 | newtonsoft: Newtonsoft; |
| 736 | - nil: Nil; | |
| 737 | 736 | } |
| 738 | 737 | |
| 739 | 738 | export type Hashable = { |
| @@ -808,10 +807,6 @@ export type MarshalJSON = { | ||
| 808 | 807 | MarshalJSON: number; |
| 809 | 808 | } |
| 810 | 809 | |
| 811 | -export type No = { | |
| 812 | - NO: number; | |
| 813 | -} | |
| 814 | - | |
| 815 | 810 | export type Goto = { |
| 816 | 811 | goto: number; |
| 817 | 812 | } |
| @@ -956,6 +951,10 @@ export type Long = { | ||
| 956 | 951 | long: number; |
| 957 | 952 | } |
| 958 | 953 | |
| 954 | +export type MakeDictEncoder = { | |
| 955 | + makeDictEncoder: number; | |
| 956 | +} | |
| 957 | + | |
| 959 | 958 | export type Map = { |
| 960 | 959 | map: number; |
| 961 | 960 | } |
| @@ -992,11 +991,8 @@ export type Newtonsoft = { | ||
| 992 | 991 | newtonsoft: number; |
| 993 | 992 | } |
| 994 | 993 | |
| 995 | -export type Nil = { | |
| 996 | - nil: number; | |
| 997 | -} | |
| 998 | - | |
| 999 | 994 | export type Obj4 = { |
| 995 | + NO: No; | |
| 1000 | 996 | NSError: NSError; |
| 1001 | 997 | NSObject: NSObject; |
| 1002 | 998 | NSString: NSString; |
| @@ -1005,8 +1001,8 @@ export type Obj4 = { | ||
| 1005 | 1001 | ObjectMapper: ObjectMapper; |
| 1006 | 1002 | Protocol: Protocol; |
| 1007 | 1003 | RegExp: RegExp; |
| 1008 | - SEL: Sel; | |
| 1009 | 1004 | dummy: number; |
| 1005 | + nil: Nil; | |
| 1010 | 1006 | noSuchMethod: NoSuchMethod; |
| 1011 | 1007 | noexcept: Noexcept; |
| 1012 | 1008 | nonatomic: Nonatomic; |
| @@ -1061,7 +1057,10 @@ export type Obj4 = { | ||
| 1061 | 1057 | runtimeType: RuntimeType; |
| 1062 | 1058 | s: S; |
| 1063 | 1059 | sbyte: Sbyte; |
| 1064 | - sealed: Sealed; | |
| 1060 | +} | |
| 1061 | + | |
| 1062 | +export type No = { | |
| 1063 | + NO: number; | |
| 1065 | 1064 | } |
| 1066 | 1065 | |
| 1067 | 1066 | export type NSError = { |
| @@ -1096,8 +1095,8 @@ export type RegExp = { | ||
| 1096 | 1095 | RegExp: string; |
| 1097 | 1096 | } |
| 1098 | 1097 | |
| 1099 | -export type Sel = { | |
| 1100 | - SEL: number; | |
| 1098 | +export type Nil = { | |
| 1099 | + nil: number; | |
| 1101 | 1100 | } |
| 1102 | 1101 | |
| 1103 | 1102 | export type NoSuchMethod = { |
| @@ -1316,13 +1315,10 @@ export type Sbyte = { | ||
| 1316 | 1315 | sbyte: number; |
| 1317 | 1316 | } |
| 1318 | 1317 | |
| 1319 | -export type Sealed = { | |
| 1320 | - sealed: number; | |
| 1321 | -} | |
| 1322 | - | |
| 1323 | 1318 | export type Obj5 = { |
| 1324 | 1319 | KSerializer: KSerializer; |
| 1325 | 1320 | PrimitiveKind: PrimitiveKind; |
| 1321 | + SEL: Sel; | |
| 1326 | 1322 | Self: Self; |
| 1327 | 1323 | Sendable: Sendable; |
| 1328 | 1324 | SerialDescriptor: SerialDescriptor; |
| @@ -1339,8 +1335,8 @@ export type Obj5 = { | ||
| 1339 | 1335 | True: True; |
| 1340 | 1336 | Type: Type; |
| 1341 | 1337 | UnmarshalJSON: UnmarshalJSON; |
| 1342 | - UseSerializers: UseSerializers; | |
| 1343 | 1338 | dummy: number; |
| 1339 | + sealed: Sealed; | |
| 1344 | 1340 | select: Select; |
| 1345 | 1341 | self: SelfClass; |
| 1346 | 1342 | serialize: Serialize; |
| @@ -1385,8 +1381,6 @@ export type Obj5 = { | ||
| 1385 | 1381 | unchecked: Unchecked; |
| 1386 | 1382 | undefined: Undefined; |
| 1387 | 1383 | union: Union; |
| 1388 | - unowned: Unowned; | |
| 1389 | - unsafe: Unsafe; | |
| 1390 | 1384 | } |
| 1391 | 1385 | |
| 1392 | 1386 | export type KSerializer = { |
| @@ -1397,6 +1391,10 @@ export type PrimitiveKind = { | ||
| 1397 | 1391 | PrimitiveKind: number; |
| 1398 | 1392 | } |
| 1399 | 1393 | |
| 1394 | +export type Sel = { | |
| 1395 | + SEL: number; | |
| 1396 | +} | |
| 1397 | + | |
| 1400 | 1398 | export type Self = { |
| 1401 | 1399 | Self: number; |
| 1402 | 1400 | } |
| @@ -1461,8 +1459,8 @@ export type UnmarshalJSON = { | ||
| 1461 | 1459 | UnmarshalJSON: number; |
| 1462 | 1460 | } |
| 1463 | 1461 | |
| 1464 | -export type UseSerializers = { | |
| 1465 | - UseSerializers: number; | |
| 1462 | +export type Sealed = { | |
| 1463 | + sealed: number; | |
| 1466 | 1464 | } |
| 1467 | 1465 | |
| 1468 | 1466 | export type Select = { |
| @@ -1641,20 +1639,15 @@ export type Union = { | ||
| 1641 | 1639 | union: number; |
| 1642 | 1640 | } |
| 1643 | 1641 | |
| 1644 | -export type Unowned = { | |
| 1645 | - unowned: number; | |
| 1646 | -} | |
| 1647 | - | |
| 1648 | -export type Unsafe = { | |
| 1649 | - unsafe: number; | |
| 1650 | -} | |
| 1651 | - | |
| 1652 | 1642 | export type Obj6 = { |
| 1653 | 1643 | UUID: UUID; |
| 1644 | + UseSerializers: UseSerializers; | |
| 1654 | 1645 | Utf8JsonReader: Utf8JSONReader; |
| 1655 | 1646 | Utf8JsonWriter: Utf8JSONWriter; |
| 1656 | 1647 | YES: Yes; |
| 1657 | 1648 | dummy: number; |
| 1649 | + unowned: Unowned; | |
| 1650 | + unsafe: Unsafe; | |
| 1658 | 1651 | unsigned: Unsigned; |
| 1659 | 1652 | ushort: Ushort; |
| 1660 | 1653 | using: Using; |
| @@ -1677,6 +1670,10 @@ export type UUID = { | ||
| 1677 | 1670 | UUID: number; |
| 1678 | 1671 | } |
| 1679 | 1672 | |
| 1673 | +export type UseSerializers = { | |
| 1674 | + UseSerializers: number; | |
| 1675 | +} | |
| 1676 | + | |
| 1680 | 1677 | export type Utf8JSONReader = { |
| 1681 | 1678 | Utf8JsonReader: number; |
| 1682 | 1679 | } |
| @@ -1689,6 +1686,14 @@ export type Yes = { | ||
| 1689 | 1686 | YES: number; |
| 1690 | 1687 | } |
| 1691 | 1688 | |
| 1689 | +export type Unowned = { | |
| 1690 | + unowned: number; | |
| 1691 | +} | |
| 1692 | + | |
| 1693 | +export type Unsafe = { | |
| 1694 | + unsafe: number; | |
| 1695 | +} | |
| 1696 | + | |
| 1692 | 1697 | export type Unsigned = { |
| 1693 | 1698 | unsigned: number; |
| 1694 | 1699 | } |
| @@ -1849,7 +1854,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1849 | 1854 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 1850 | 1855 | return invalidValue(l(ref || "object"), val, key, parent); |
| 1851 | 1856 | } |
| 1852 | - const result: any = {}; | |
| 1857 | + const result: any = Object.create(null); | |
| 1853 | 1858 | Object.getOwnPropertyNames(props).forEach(key => { |
| 1854 | 1859 | const prop = props[key]; |
| 1855 | 1860 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -1860,7 +1865,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1860 | 1865 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 1861 | 1866 | } |
| 1862 | 1867 | }); |
| 1863 | - return result; | |
| 1868 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 1864 | 1869 | } |
| 1865 | 1870 | |
| 1866 | 1871 | if (typ === "any") return val; |
| @@ -2487,7 +2492,6 @@ const typeMap: any = { | ||
| 2487 | 2492 | { json: "Locale", js: "Locale", typ: r("Locale") }, |
| 2488 | 2493 | { json: "MapEntry", js: "MapEntry", typ: r("MapEntry") }, |
| 2489 | 2494 | { json: "MarshalJSON", js: "MarshalJSON", typ: r("MarshalJSON") }, |
| 2490 | - { json: "NO", js: "NO", typ: r("No") }, | |
| 2491 | 2495 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 2492 | 2496 | { json: "goto", js: "goto", typ: r("Goto") }, |
| 2493 | 2497 | { json: "guard", js: "guard", typ: r("Guard") }, |
| @@ -2525,6 +2529,7 @@ const typeMap: any = { | ||
| 2525 | 2529 | { json: "list", js: "list", typ: r("List") }, |
| 2526 | 2530 | { json: "lock", js: "lock", typ: r("Lock") }, |
| 2527 | 2531 | { json: "long", js: "long", typ: r("Long") }, |
| 2532 | + { json: "makeDictEncoder", js: "makeDictEncoder", typ: r("MakeDictEncoder") }, | |
| 2528 | 2533 | { json: "map", js: "map", typ: r("Map") }, |
| 2529 | 2534 | { json: "metadata_property_handling", js: "metadata_property_handling", typ: r("MetadataPropertyHandling") }, |
| 2530 | 2535 | { json: "module", js: "module", typ: r("Module") }, |
| @@ -2534,7 +2539,6 @@ const typeMap: any = { | ||
| 2534 | 2539 | { json: "native", js: "native", typ: r("Native") }, |
| 2535 | 2540 | { json: "new", js: "new", typ: r("New") }, |
| 2536 | 2541 | { json: "newtonsoft", js: "newtonsoft", typ: r("Newtonsoft") }, |
| 2537 | - { json: "nil", js: "nil", typ: r("Nil") }, | |
| 2538 | 2542 | ], false), |
| 2539 | 2543 | "Hashable": o([ |
| 2540 | 2544 | { json: "Hashable", js: "Hashable", typ: i(0) }, |
| @@ -2590,9 +2594,6 @@ const typeMap: any = { | ||
| 2590 | 2594 | "MarshalJSON": o([ |
| 2591 | 2595 | { json: "MarshalJSON", js: "MarshalJSON", typ: i(0) }, |
| 2592 | 2596 | ], false), |
| 2593 | - "No": o([ | |
| 2594 | - { json: "NO", js: "NO", typ: i(0) }, | |
| 2595 | - ], false), | |
| 2596 | 2597 | "Goto": o([ |
| 2597 | 2598 | { json: "goto", js: "goto", typ: i(0) }, |
| 2598 | 2599 | ], false), |
| @@ -2701,6 +2702,9 @@ const typeMap: any = { | ||
| 2701 | 2702 | "Long": o([ |
| 2702 | 2703 | { json: "long", js: "long", typ: i(0) }, |
| 2703 | 2704 | ], false), |
| 2705 | + "MakeDictEncoder": o([ | |
| 2706 | + { json: "makeDictEncoder", js: "makeDictEncoder", typ: i(0) }, | |
| 2707 | + ], false), | |
| 2704 | 2708 | "Map": o([ |
| 2705 | 2709 | { json: "map", js: "map", typ: i(0) }, |
| 2706 | 2710 | ], false), |
| @@ -2728,10 +2732,8 @@ const typeMap: any = { | ||
| 2728 | 2732 | "Newtonsoft": o([ |
| 2729 | 2733 | { json: "newtonsoft", js: "newtonsoft", typ: i(0) }, |
| 2730 | 2734 | ], false), |
| 2731 | - "Nil": o([ | |
| 2732 | - { json: "nil", js: "nil", typ: i(0) }, | |
| 2733 | - ], false), | |
| 2734 | 2735 | "Obj4": o([ |
| 2736 | + { json: "NO", js: "NO", typ: r("No") }, | |
| 2735 | 2737 | { json: "NSError", js: "NSError", typ: r("NSError") }, |
| 2736 | 2738 | { json: "NSObject", js: "NSObject", typ: r("NSObject") }, |
| 2737 | 2739 | { json: "NSString", js: "NSString", typ: r("NSString") }, |
| @@ -2740,8 +2742,8 @@ const typeMap: any = { | ||
| 2740 | 2742 | { json: "ObjectMapper", js: "ObjectMapper", typ: r("ObjectMapper") }, |
| 2741 | 2743 | { json: "Protocol", js: "Protocol", typ: r("Protocol") }, |
| 2742 | 2744 | { json: "RegExp", js: "RegExp", typ: r("RegExp") }, |
| 2743 | - { json: "SEL", js: "SEL", typ: r("Sel") }, | |
| 2744 | 2745 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 2746 | + { json: "nil", js: "nil", typ: r("Nil") }, | |
| 2745 | 2747 | { json: "noSuchMethod", js: "noSuchMethod", typ: r("NoSuchMethod") }, |
| 2746 | 2748 | { json: "noexcept", js: "noexcept", typ: r("Noexcept") }, |
| 2747 | 2749 | { json: "nonatomic", js: "nonatomic", typ: r("Nonatomic") }, |
| @@ -2796,7 +2798,9 @@ const typeMap: any = { | ||
| 2796 | 2798 | { json: "runtimeType", js: "runtimeType", typ: r("RuntimeType") }, |
| 2797 | 2799 | { json: "s", js: "s", typ: r("S") }, |
| 2798 | 2800 | { json: "sbyte", js: "sbyte", typ: r("Sbyte") }, |
| 2799 | - { json: "sealed", js: "sealed", typ: r("Sealed") }, | |
| 2801 | + ], false), | |
| 2802 | + "No": o([ | |
| 2803 | + { json: "NO", js: "NO", typ: i(0) }, | |
| 2800 | 2804 | ], false), |
| 2801 | 2805 | "NSError": o([ |
| 2802 | 2806 | { json: "NSError", js: "NSError", typ: i(0) }, |
| @@ -2822,8 +2826,8 @@ const typeMap: any = { | ||
| 2822 | 2826 | "RegExp": o([ |
| 2823 | 2827 | { json: "RegExp", js: "RegExp", typ: { uuid: "" } }, |
| 2824 | 2828 | ], false), |
| 2825 | - "Sel": o([ | |
| 2826 | - { json: "SEL", js: "SEL", typ: i(0) }, | |
| 2829 | + "Nil": o([ | |
| 2830 | + { json: "nil", js: "nil", typ: i(0) }, | |
| 2827 | 2831 | ], false), |
| 2828 | 2832 | "NoSuchMethod": o([ |
| 2829 | 2833 | { json: "noSuchMethod", js: "noSuchMethod", typ: i(0) }, |
| @@ -2987,12 +2991,10 @@ const typeMap: any = { | ||
| 2987 | 2991 | "Sbyte": o([ |
| 2988 | 2992 | { json: "sbyte", js: "sbyte", typ: i(0) }, |
| 2989 | 2993 | ], false), |
| 2990 | - "Sealed": o([ | |
| 2991 | - { json: "sealed", js: "sealed", typ: i(0) }, | |
| 2992 | - ], false), | |
| 2993 | 2994 | "Obj5": o([ |
| 2994 | 2995 | { json: "KSerializer", js: "KSerializer", typ: r("KSerializer") }, |
| 2995 | 2996 | { json: "PrimitiveKind", js: "PrimitiveKind", typ: r("PrimitiveKind") }, |
| 2997 | + { json: "SEL", js: "SEL", typ: r("Sel") }, | |
| 2996 | 2998 | { json: "Self", js: "Self", typ: r("Self") }, |
| 2997 | 2999 | { json: "Sendable", js: "Sendable", typ: r("Sendable") }, |
| 2998 | 3000 | { json: "SerialDescriptor", js: "SerialDescriptor", typ: r("SerialDescriptor") }, |
| @@ -3009,8 +3011,8 @@ const typeMap: any = { | ||
| 3009 | 3011 | { json: "True", js: "True", typ: r("True") }, |
| 3010 | 3012 | { json: "Type", js: "Type", typ: r("Type") }, |
| 3011 | 3013 | { json: "UnmarshalJSON", js: "UnmarshalJSON", typ: r("UnmarshalJSON") }, |
| 3012 | - { json: "UseSerializers", js: "UseSerializers", typ: r("UseSerializers") }, | |
| 3013 | 3014 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 3015 | + { json: "sealed", js: "sealed", typ: r("Sealed") }, | |
| 3014 | 3016 | { json: "select", js: "select", typ: r("Select") }, |
| 3015 | 3017 | { json: "self", js: "self", typ: r("SelfClass") }, |
| 3016 | 3018 | { json: "serialize", js: "serialize", typ: r("Serialize") }, |
| @@ -3055,8 +3057,6 @@ const typeMap: any = { | ||
| 3055 | 3057 | { json: "unchecked", js: "unchecked", typ: r("Unchecked") }, |
| 3056 | 3058 | { json: "undefined", js: "undefined", typ: r("Undefined") }, |
| 3057 | 3059 | { json: "union", js: "union", typ: r("Union") }, |
| 3058 | - { json: "unowned", js: "unowned", typ: r("Unowned") }, | |
| 3059 | - { json: "unsafe", js: "unsafe", typ: r("Unsafe") }, | |
| 3060 | 3060 | ], false), |
| 3061 | 3061 | "KSerializer": o([ |
| 3062 | 3062 | { json: "KSerializer", js: "KSerializer", typ: i(0) }, |
| @@ -3064,6 +3064,9 @@ const typeMap: any = { | ||
| 3064 | 3064 | "PrimitiveKind": o([ |
| 3065 | 3065 | { json: "PrimitiveKind", js: "PrimitiveKind", typ: i(0) }, |
| 3066 | 3066 | ], false), |
| 3067 | + "Sel": o([ | |
| 3068 | + { json: "SEL", js: "SEL", typ: i(0) }, | |
| 3069 | + ], false), | |
| 3067 | 3070 | "Self": o([ |
| 3068 | 3071 | { json: "Self", js: "Self", typ: i(0) }, |
| 3069 | 3072 | ], false), |
| @@ -3112,8 +3115,8 @@ const typeMap: any = { | ||
| 3112 | 3115 | "UnmarshalJSON": o([ |
| 3113 | 3116 | { json: "UnmarshalJSON", js: "UnmarshalJSON", typ: i(0) }, |
| 3114 | 3117 | ], false), |
| 3115 | - "UseSerializers": o([ | |
| 3116 | - { json: "UseSerializers", js: "UseSerializers", typ: i(0) }, | |
| 3118 | + "Sealed": o([ | |
| 3119 | + { json: "sealed", js: "sealed", typ: i(0) }, | |
| 3117 | 3120 | ], false), |
| 3118 | 3121 | "Select": o([ |
| 3119 | 3122 | { json: "select", js: "select", typ: i(0) }, |
| @@ -3247,18 +3250,15 @@ const typeMap: any = { | ||
| 3247 | 3250 | "Union": o([ |
| 3248 | 3251 | { json: "union", js: "union", typ: i(0) }, |
| 3249 | 3252 | ], false), |
| 3250 | - "Unowned": o([ | |
| 3251 | - { json: "unowned", js: "unowned", typ: i(0) }, | |
| 3252 | - ], false), | |
| 3253 | - "Unsafe": o([ | |
| 3254 | - { json: "unsafe", js: "unsafe", typ: i(0) }, | |
| 3255 | - ], false), | |
| 3256 | 3253 | "Obj6": o([ |
| 3257 | 3254 | { json: "UUID", js: "UUID", typ: r("UUID") }, |
| 3255 | + { json: "UseSerializers", js: "UseSerializers", typ: r("UseSerializers") }, | |
| 3258 | 3256 | { json: "Utf8JsonReader", js: "Utf8JsonReader", typ: r("Utf8JSONReader") }, |
| 3259 | 3257 | { json: "Utf8JsonWriter", js: "Utf8JsonWriter", typ: r("Utf8JSONWriter") }, |
| 3260 | 3258 | { json: "YES", js: "YES", typ: r("Yes") }, |
| 3261 | 3259 | { json: "dummy", js: "dummy", typ: i(0) }, |
| 3260 | + { json: "unowned", js: "unowned", typ: r("Unowned") }, | |
| 3261 | + { json: "unsafe", js: "unsafe", typ: r("Unsafe") }, | |
| 3262 | 3262 | { json: "unsigned", js: "unsigned", typ: r("Unsigned") }, |
| 3263 | 3263 | { json: "ushort", js: "ushort", typ: r("Ushort") }, |
| 3264 | 3264 | { json: "using", js: "using", typ: r("Using") }, |
| @@ -3279,6 +3279,9 @@ const typeMap: any = { | ||
| 3279 | 3279 | "UUID": o([ |
| 3280 | 3280 | { json: "UUID", js: "UUID", typ: i(0) }, |
| 3281 | 3281 | ], false), |
| 3282 | + "UseSerializers": o([ | |
| 3283 | + { json: "UseSerializers", js: "UseSerializers", typ: i(0) }, | |
| 3284 | + ], false), | |
| 3282 | 3285 | "Utf8JSONReader": o([ |
| 3283 | 3286 | { json: "Utf8JsonReader", js: "Utf8JsonReader", typ: i(0) }, |
| 3284 | 3287 | ], false), |
| @@ -3288,6 +3291,12 @@ const typeMap: any = { | ||
| 3288 | 3291 | "Yes": o([ |
| 3289 | 3292 | { json: "YES", js: "YES", typ: i(0) }, |
| 3290 | 3293 | ], false), |
| 3294 | + "Unowned": o([ | |
| 3295 | + { json: "unowned", js: "unowned", typ: i(0) }, | |
| 3296 | + ], false), | |
| 3297 | + "Unsafe": o([ | |
| 3298 | + { json: "unsafe", js: "unsafe", typ: i(0) }, | |
| 3299 | + ], false), | |
| 3291 | 3300 | "Unsigned": o([ |
| 3292 | 3301 | { json: "unsigned", js: "unsigned", typ: i(0) }, |
| 3293 | 3302 | ], false), |
Test case
3 generated files · +6 −6test/inputs/json/priority/kotlin-enum-class-case-collision.json
Mflowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/list.json
Mflowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/name-style.json
Mflowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
5 generated files · +56 −30test/inputs/json/priority/nbl-stats.json
Melmdefault / QuickType.elm+20 −12
| @@ -436,9 +436,9 @@ encodeQuickType x = | ||
| 436 | 436 | , ("periodLengthREGULAR", Jenc.int x.periodLengthREGULAR) |
| 437 | 437 | , ("periodType", encodePerType x.periodType) |
| 438 | 438 | , ("periodsMax", Jenc.int x.periodsMax) |
| 439 | - , ("scorers", Jenc.dict identity (Jenc.list encodeScorer) x.scorers) | |
| 439 | + , ("scorers", makeDictEncoder identity (Jenc.list encodeScorer) x.scorers) | |
| 440 | 440 | , ("timeline", Jenc.list identity x.timeline) |
| 441 | - , ("tm", Jenc.dict identity encodeTm x.tm) | |
| 441 | + , ("tm", makeDictEncoder identity encodeTm x.tm) | |
| 442 | 442 | , ("totalTimeAdded", Jenc.int x.totalTimeAdded) |
| 443 | 443 | , ("totallds", encodeTotallds x.totallds) |
| 444 | 444 | ] |
| @@ -878,7 +878,7 @@ encodeTm x = | ||
| 878 | 878 | , ("p2_score", Jenc.int x.p2Score) |
| 879 | 879 | , ("p3_score", Jenc.int x.p3Score) |
| 880 | 880 | , ("p4_score", Jenc.int x.p4Score) |
| 881 | - , ("pl", Jenc.dict identity encodePl x.pl) | |
| 881 | + , ("pl", makeDictEncoder identity encodePl x.pl) | |
| 882 | 882 | , ("score", Jenc.int x.score) |
| 883 | 883 | , ("scoring", Jenc.list encodeScorer x.scoring) |
| 884 | 884 | , ("shortName", Jenc.string x.shortName) |
| @@ -945,11 +945,11 @@ lds = | ||
| 945 | 945 | encodeLds : Lds -> Jenc.Value |
| 946 | 946 | encodeLds x = |
| 947 | 947 | Jenc.object |
| 948 | - [ ("sAssists", Jenc.dict identity encodeScorer x.sAssists) | |
| 948 | + [ ("sAssists", makeDictEncoder identity encodeScorer x.sAssists) | |
| 949 | 949 | , ("sBlocks", encodeSBlocks x.sBlocks) |
| 950 | - , ("sPoints", Jenc.dict identity encodeScorer x.sPoints) | |
| 951 | - , ("sReboundsTotal", Jenc.dict identity encodeScorer x.sReboundsTotal) | |
| 952 | - , ("sSteals", Jenc.dict identity encodeScorer x.sSteals) | |
| 950 | + , ("sPoints", makeDictEncoder identity encodeScorer x.sPoints) | |
| 951 | + , ("sReboundsTotal", makeDictEncoder identity encodeScorer x.sReboundsTotal) | |
| 952 | + , ("sSteals", makeDictEncoder identity encodeScorer x.sSteals) | |
| 953 | 953 | ] |
| 954 | 954 | |
| 955 | 955 | sBlocks : Jdec.Decoder SBlocks |
| @@ -1163,15 +1163,23 @@ totallds = | ||
| 1163 | 1163 | encodeTotallds : Totallds -> Jenc.Value |
| 1164 | 1164 | encodeTotallds x = |
| 1165 | 1165 | Jenc.object |
| 1166 | - [ ("sAssists", Jenc.dict identity encodeScorer x.sAssists) | |
| 1167 | - , ("sBlocks", Jenc.dict identity encodeScorer x.sBlocks) | |
| 1168 | - , ("sPoints", Jenc.dict identity encodeScorer x.sPoints) | |
| 1169 | - , ("sReboundsTotal", Jenc.dict identity encodeScorer x.sReboundsTotal) | |
| 1170 | - , ("sSteals", Jenc.dict identity encodeScorer x.sSteals) | |
| 1166 | + [ ("sAssists", makeDictEncoder identity encodeScorer x.sAssists) | |
| 1167 | + , ("sBlocks", makeDictEncoder identity encodeScorer x.sBlocks) | |
| 1168 | + , ("sPoints", makeDictEncoder identity encodeScorer x.sPoints) | |
| 1169 | + , ("sReboundsTotal", makeDictEncoder identity encodeScorer x.sReboundsTotal) | |
| 1170 | + , ("sSteals", makeDictEncoder identity encodeScorer x.sSteals) | |
| 1171 | 1171 | ] |
| 1172 | 1172 | |
| 1173 | 1173 | --- encoder helpers |
| 1174 | 1174 | |
| 1175 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 1176 | +makeDictEncoder f m r = | |
| 1177 | + r | |
| 1178 | + |> Dict.toList | |
| 1179 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 1180 | + |> String.join "," | |
| 1181 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 1182 | + | |
| 1175 | 1183 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 1176 | 1184 | makeNullableEncoder f m = |
| 1177 | 1185 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -439,7 +439,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 439 | 439 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 440 | 440 | return invalidValue(l(ref || "object"), val, key, parent); |
| 441 | 441 | } |
| 442 | - const result: any = {}; | |
| 442 | + const result: any = Object.create(null); | |
| 443 | 443 | Object.getOwnPropertyNames(props).forEach(key => { |
| 444 | 444 | const prop = props[key]; |
| 445 | 445 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -450,7 +450,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 450 | 450 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 451 | 451 | } |
| 452 | 452 | }); |
| 453 | - return result; | |
| 453 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+30 −12
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export const LeaddatumEnum = S.Literal( |
| 5 | 23 | "", |
| @@ -222,11 +240,11 @@ export class Pbp extends S.Class<Pbp>("Pbp")({ | ||
| 222 | 240 | }) {} |
| 223 | 241 | |
| 224 | 242 | export class Totallds extends S.Class<Totallds>("Totallds")({ |
| 225 | - "sAssists": S.Record({ key: S.String, value: Scorer}), | |
| 226 | - "sBlocks": S.Record({ key: S.String, value: Scorer}), | |
| 227 | - "sPoints": S.Record({ key: S.String, value: Scorer}), | |
| 228 | - "sReboundsTotal": S.Record({ key: S.String, value: Scorer}), | |
| 229 | - "sSteals": S.Record({ key: S.String, value: Scorer}), | |
| 243 | + "sAssists": mapSchema(Scorer), | |
| 244 | + "sBlocks": mapSchema(Scorer), | |
| 245 | + "sPoints": mapSchema(Scorer), | |
| 246 | + "sReboundsTotal": mapSchema(Scorer), | |
| 247 | + "sSteals": mapSchema(Scorer), | |
| 230 | 248 | }) {} |
| 231 | 249 | |
| 232 | 250 | export class Team extends S.Class<Team>("Team")({ |
| @@ -266,9 +284,9 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 266 | 284 | "periodLengthREGULAR": S.Int, |
| 267 | 285 | "periodType": PerType, |
| 268 | 286 | "periodsMax": S.Int, |
| 269 | - "scorers": S.Record({ key: S.String, value: S.Array(Scorer)}), | |
| 287 | + "scorers": mapSchema(S.Array(Scorer)), | |
| 270 | 288 | "timeline": S.Array(S.Any), |
| 271 | - "tm": S.Record({ key: S.String, value: S.suspend(() => Tm)}), | |
| 289 | + "tm": mapSchema(S.suspend(() => Tm)), | |
| 272 | 290 | "totalTimeAdded": S.Int, |
| 273 | 291 | "totallds": Totallds, |
| 274 | 292 | }) {} |
| @@ -278,11 +296,11 @@ export class SBlocks extends S.Class<SBlocks>("SBlocks")({ | ||
| 278 | 296 | }) {} |
| 279 | 297 | |
| 280 | 298 | export class Lds extends S.Class<Lds>("Lds")({ |
| 281 | - "sAssists": S.Record({ key: S.String, value: Scorer}), | |
| 299 | + "sAssists": mapSchema(Scorer), | |
| 282 | 300 | "sBlocks": SBlocks, |
| 283 | - "sPoints": S.Record({ key: S.String, value: Scorer}), | |
| 284 | - "sReboundsTotal": S.Record({ key: S.String, value: Scorer}), | |
| 285 | - "sSteals": S.Record({ key: S.String, value: Scorer}), | |
| 301 | + "sPoints": mapSchema(Scorer), | |
| 302 | + "sReboundsTotal": mapSchema(Scorer), | |
| 303 | + "sSteals": mapSchema(Scorer), | |
| 286 | 304 | }) {} |
| 287 | 305 | |
| 288 | 306 | export class Tm extends S.Class<Tm>("Tm")({ |
| @@ -298,7 +316,7 @@ export class Tm extends S.Class<Tm>("Tm")({ | ||
| 298 | 316 | "p2_score": S.Int, |
| 299 | 317 | "p3_score": S.Int, |
| 300 | 318 | "p4_score": S.Int, |
| 301 | - "pl": S.Record({ key: S.String, value: Pl}), | |
| 319 | + "pl": mapSchema(Pl), | |
| 302 | 320 | "score": S.Int, |
| 303 | 321 | "scoring": S.Array(Scorer), |
| 304 | 322 | "shortName": S.String, |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -384,7 +384,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 384 | 384 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 385 | 385 | return invalidValue(l(ref || "object"), val, key, parent); |
| 386 | 386 | } |
| 387 | - const result: any = {}; | |
| 387 | + const result: any = Object.create(null); | |
| 388 | 388 | Object.getOwnPropertyNames(props).forEach(key => { |
| 389 | 389 | const prop = props[key]; |
| 390 | 390 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -395,7 +395,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 395 | 395 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 396 | 396 | } |
| 397 | 397 | }); |
| 398 | - return result; | |
| 398 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | if (typ === "any") return val; |
Test case
6 generated files · +38 −12test/inputs/json/priority/nested-objects.json
Melmdefault / QuickType.elm+10 −2
| @@ -47,12 +47,20 @@ quickType = | ||
| 47 | 47 | encodeQuickType : QuickType -> Jenc.Value |
| 48 | 48 | encodeQuickType x = |
| 49 | 49 | Jenc.object |
| 50 | - [ ("a", Jenc.dict identity Jenc.int x.a) | |
| 51 | - , ("b", Jenc.dict identity Jenc.int x.b) | |
| 50 | + [ ("a", makeDictEncoder identity Jenc.int x.a) | |
| 51 | + , ("b", makeDictEncoder identity Jenc.int x.b) | |
| 52 | 52 | ] |
| 53 | 53 | |
| 54 | 54 | --- encoder helpers |
| 55 | 55 | |
| 56 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 57 | +makeDictEncoder f m r = | |
| 58 | + r | |
| 59 | + |> Dict.toList | |
| 60 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 61 | + |> String.join "," | |
| 62 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 63 | + | |
| 56 | 64 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 57 | 65 | makeNullableEncoder f m = |
| 58 | 66 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mjavascriptconverters-all-objects--3a443babd1cb / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+20 −2
| @@ -1,7 +1,25 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | - "a": S.Record({ key: S.String, value: S.Int}), | |
| 6 | - "b": S.Record({ key: S.String, value: S.Int}), | |
| 23 | + "a": mapSchema(S.Int), | |
| 24 | + "b": mapSchema(S.Int), | |
| 7 | 25 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/no-classes.json
Mflowdefault / TopLevel.js+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/nst-test-suite.json
Mflowdefault / TopLevel.js+2 −2
| @@ -247,7 +247,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 247 | 247 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 248 | 248 | return invalidValue(l(ref || "object"), val, key, parent); |
| 249 | 249 | } |
| 250 | - const result: any = {}; | |
| 250 | + const result: any = Object.create(null); | |
| 251 | 251 | Object.getOwnPropertyNames(props).forEach(key => { |
| 252 | 252 | const prop = props[key]; |
| 253 | 253 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -258,7 +258,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 258 | 258 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 259 | 259 | } |
| 260 | 260 | }); |
| 261 | - return result; | |
| 261 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -244,7 +244,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 244 | 244 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 245 | 245 | return invalidValue(l(ref || "object"), val, key, parent); |
| 246 | 246 | } |
| 247 | - const result: any = {}; | |
| 247 | + const result: any = Object.create(null); | |
| 248 | 248 | Object.getOwnPropertyNames(props).forEach(key => { |
| 249 | 249 | const prop = props[key]; |
| 250 | 250 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -255,7 +255,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 255 | 255 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 256 | 256 | } |
| 257 | 257 | }); |
| 258 | - return result; | |
| 258 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | if (typ === "any") return val; |
Test case
7 generated files · +38 −12test/inputs/json/priority/number-map.json
Melmdefault / QuickType.elm+9 −1
| @@ -45,11 +45,19 @@ quickType = | ||
| 45 | 45 | encodeQuickType : QuickType -> Jenc.Value |
| 46 | 46 | encodeQuickType x = |
| 47 | 47 | Jenc.object |
| 48 | - [ ("foo", Jenc.dict identity Jenc.float x.foo) | |
| 48 | + [ ("foo", makeDictEncoder identity Jenc.float x.foo) | |
| 49 | 49 | ] |
| 50 | 50 | |
| 51 | 51 | --- encoder helpers |
| 52 | 52 | |
| 53 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 54 | +makeDictEncoder f m r = | |
| 55 | + r | |
| 56 | + |> Dict.toList | |
| 57 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 58 | + |> String.join "," | |
| 59 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 60 | + | |
| 53 | 61 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 54 | 62 | makeNullableEncoder f m = |
| 55 | 63 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Mflowreadonly-true--24da4fc107df / TopLevel.js+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,6 +1,24 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | - "foo": S.Record({ key: S.String, value: S.Number}), | |
| 23 | + "foo": mapSchema(S.Number), | |
| 6 | 24 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Mtypescriptreadonly-true--24da4fc107df / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/omit-empty.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/optional-union.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/php-mixed-union.json
Mflowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/php-validation.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/recursive.json
Mflowdefault / TopLevel.js+2 −2
| @@ -226,7 +226,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 226 | 226 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 227 | 227 | return invalidValue(l(ref || "object"), val, key, parent); |
| 228 | 228 | } |
| 229 | - const result: any = {}; | |
| 229 | + const result: any = Object.create(null); | |
| 230 | 230 | Object.getOwnPropertyNames(props).forEach(key => { |
| 231 | 231 | const prop = props[key]; |
| 232 | 232 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -237,7 +237,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 237 | 237 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 238 | 238 | } |
| 239 | 239 | }); |
| 240 | - return result; | |
| 240 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -226,7 +226,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 226 | 226 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 227 | 227 | return invalidValue(l(ref || "object"), val, key, parent); |
| 228 | 228 | } |
| 229 | - const result: any = {}; | |
| 229 | + const result: any = Object.create(null); | |
| 230 | 230 | Object.getOwnPropertyNames(props).forEach(key => { |
| 231 | 231 | const prop = props[key]; |
| 232 | 232 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -237,7 +237,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 237 | 237 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 238 | 238 | } |
| 239 | 239 | }); |
| 240 | - return result; | |
| 240 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/simple-identifiers.json
Mflowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/union-constructor-clash.json
Mflowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/unions.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/url.json
Mflowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/uuids.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/bitcoin-block.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/copy-with-property.json
Mflowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/getting-started.json
Mflowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/github-events.json
Mflowdefault / TopLevel.js+2 −2
| @@ -395,7 +395,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 395 | 395 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 396 | 396 | return invalidValue(l(ref || "object"), val, key, parent); |
| 397 | 397 | } |
| 398 | - const result: any = {}; | |
| 398 | + const result: any = Object.create(null); | |
| 399 | 399 | Object.getOwnPropertyNames(props).forEach(key => { |
| 400 | 400 | const prop = props[key]; |
| 401 | 401 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -406,7 +406,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 406 | 406 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 407 | 407 | } |
| 408 | 408 | }); |
| 409 | - return result; | |
| 409 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -393,7 +393,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 393 | 393 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 394 | 394 | return invalidValue(l(ref || "object"), val, key, parent); |
| 395 | 395 | } |
| 396 | - const result: any = {}; | |
| 396 | + const result: any = Object.create(null); | |
| 397 | 397 | Object.getOwnPropertyNames(props).forEach(key => { |
| 398 | 398 | const prop = props[key]; |
| 399 | 399 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -404,7 +404,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 404 | 404 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 405 | 405 | } |
| 406 | 406 | }); |
| 407 | - return result; | |
| 407 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | if (typ === "any") return val; |
Test case
5 generated files · +36 −10test/inputs/json/samples/kitchen-sink.json
Melmdefault / QuickType.elm+10 −2
| @@ -105,10 +105,10 @@ encodeQuickType x = | ||
| 105 | 105 | , ("differentThings", Jenc.list encodeDifferentThingElement x.differentThings) |
| 106 | 106 | , ("doubleValue", Jenc.float x.doubleValue) |
| 107 | 107 | , ("intValue", Jenc.int x.intValue) |
| 108 | - , ("mapValue", Jenc.dict identity (makeNullableEncoder Jenc.int) x.mapValue) | |
| 108 | + , ("mapValue", makeDictEncoder identity (makeNullableEncoder Jenc.int) x.mapValue) | |
| 109 | 109 | , ("name with spaces", always Jenc.null x.nameWithSpaces) |
| 110 | 110 | , ("nullValue", always Jenc.null x.nullValue) |
| 111 | - , ("nullableMapValue", Jenc.dict identity (makeNullableEncoder Jenc.int) x.nullableMapValue) | |
| 111 | + , ("nullableMapValue", makeDictEncoder identity (makeNullableEncoder Jenc.int) x.nullableMapValue) | |
| 112 | 112 | , ("people", Jenc.list encodePersonElement x.people) |
| 113 | 113 | , ("person", encodePurplePerson x.person) |
| 114 | 114 | , ("stringValue", Jenc.string x.stringValue) |
| @@ -183,6 +183,14 @@ encodePurplePerson x = | ||
| 183 | 183 | |
| 184 | 184 | --- encoder helpers |
| 185 | 185 | |
| 186 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 187 | +makeDictEncoder f m r = | |
| 188 | + r | |
| 189 | + |> Dict.toList | |
| 190 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 191 | + |> String.join "," | |
| 192 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 193 | + | |
| 186 | 194 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 187 | 195 | makeNullableEncoder f m = |
| 188 | 196 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -139,7 +139,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 139 | 139 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 140 | 140 | return invalidValue(l(ref || "object"), val, key, parent); |
| 141 | 141 | } |
| 142 | - const result: any = {}; | |
| 142 | + const result: any = Object.create(null); | |
| 143 | 143 | Object.getOwnPropertyNames(props).forEach(key => { |
| 144 | 144 | const prop = props[key]; |
| 145 | 145 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -150,7 +150,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 150 | 150 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 151 | 151 | } |
| 152 | 152 | }); |
| 153 | - return result; | |
| 153 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+20 −2
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class PurplePerson extends S.Class<PurplePerson>("PurplePerson")({ |
| 5 | 23 | "intOrString": S.Int, |
| @@ -22,10 +40,10 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 22 | 40 | "differentThings": S.Array(S.Union(S.Int, S.NumberFromString.pipe(S.int()), DifferentThingClass)), |
| 23 | 41 | "doubleValue": S.Number, |
| 24 | 42 | "intValue": S.Int, |
| 25 | - "mapValue": S.Record({ key: S.String, value: S.NullOr(S.Int)}), | |
| 43 | + "mapValue": mapSchema(S.NullOr(S.Int)), | |
| 26 | 44 | "name with spaces": S.Null, |
| 27 | 45 | "nullValue": S.Null, |
| 28 | - "nullableMapValue": S.Record({ key: S.String, value: S.NullOr(S.Int)}), | |
| 46 | + "nullableMapValue": mapSchema(S.NullOr(S.Int)), | |
| 29 | 47 | "people": S.Array(PersonElement), |
| 30 | 48 | "person": PurplePerson, |
| 31 | 49 | "stringValue": S.String, |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -139,7 +139,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 139 | 139 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 140 | 140 | return invalidValue(l(ref || "object"), val, key, parent); |
| 141 | 141 | } |
| 142 | - const result: any = {}; | |
| 142 | + const result: any = Object.create(null); | |
| 143 | 143 | Object.getOwnPropertyNames(props).forEach(key => { |
| 144 | 144 | const prop = props[key]; |
| 145 | 145 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -150,7 +150,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 150 | 150 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 151 | 151 | } |
| 152 | 152 | }); |
| 153 | - return result; | |
| 153 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/null-safe.json
Mflowdefault / TopLevel.js+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/objc-control-characters.json
Mflowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
4 generated files · +8 −8test/inputs/json/samples/pokedex.json
Mflowdefault / TopLevel.js+2 −2
| @@ -159,7 +159,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 159 | 159 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 160 | 160 | return invalidValue(l(ref || "object"), val, key, parent); |
| 161 | 161 | } |
| 162 | - const result: any = {}; | |
| 162 | + const result: any = Object.create(null); | |
| 163 | 163 | Object.getOwnPropertyNames(props).forEach(key => { |
| 164 | 164 | const prop = props[key]; |
| 165 | 165 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -170,7 +170,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 170 | 170 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 171 | 171 | } |
| 172 | 172 | }); |
| 173 | - return result; | |
| 173 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Mtypescriptprefer-types-true--df33e18681f9 / TopLevel.ts+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/reddit.json
Mflowdefault / TopLevel.js+2 −2
| @@ -248,7 +248,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 248 | 248 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 249 | 249 | return invalidValue(l(ref || "object"), val, key, parent); |
| 250 | 250 | } |
| 251 | - const result: any = {}; | |
| 251 | + const result: any = Object.create(null); | |
| 252 | 252 | Object.getOwnPropertyNames(props).forEach(key => { |
| 253 | 253 | const prop = props[key]; |
| 254 | 254 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -259,7 +259,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 259 | 259 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 260 | 260 | } |
| 261 | 261 | }); |
| 262 | - return result; | |
| 262 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -233,7 +233,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 233 | 233 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 234 | 234 | return invalidValue(l(ref || "object"), val, key, parent); |
| 235 | 235 | } |
| 236 | - const result: any = {}; | |
| 236 | + const result: any = Object.create(null); | |
| 237 | 237 | Object.getOwnPropertyNames(props).forEach(key => { |
| 238 | 238 | const prop = props[key]; |
| 239 | 239 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -244,7 +244,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 244 | 244 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 245 | 245 | } |
| 246 | 246 | }); |
| 247 | - return result; | |
| 247 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if (typ === "any") return val; |
Test case
4 generated files · +8 −8test/inputs/json/samples/simple-object.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mflowreadonly-true--24da4fc107df / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/spotify-album.json
Mflowdefault / TopLevel.js+2 −2
| @@ -177,7 +177,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 177 | 177 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 178 | 178 | return invalidValue(l(ref || "object"), val, key, parent); |
| 179 | 179 | } |
| 180 | - const result: any = {}; | |
| 180 | + const result: any = Object.create(null); | |
| 181 | 181 | Object.getOwnPropertyNames(props).forEach(key => { |
| 182 | 182 | const prop = props[key]; |
| 183 | 183 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -188,7 +188,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 188 | 188 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 189 | 189 | } |
| 190 | 190 | }); |
| 191 | - return result; | |
| 191 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -177,7 +177,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 177 | 177 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 178 | 178 | return invalidValue(l(ref || "object"), val, key, parent); |
| 179 | 179 | } |
| 180 | - const result: any = {}; | |
| 180 | + const result: any = Object.create(null); | |
| 181 | 181 | Object.getOwnPropertyNames(props).forEach(key => { |
| 182 | 182 | const prop = props[key]; |
| 183 | 183 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -188,7 +188,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 188 | 188 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 189 | 189 | } |
| 190 | 190 | }); |
| 191 | - return result; | |
| 191 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/json/samples/us-avg-temperatures.json
Melmdefault / QuickType.elm+9 −1
| @@ -61,7 +61,7 @@ quickType = | ||
| 61 | 61 | encodeQuickType : QuickType -> Jenc.Value |
| 62 | 62 | encodeQuickType x = |
| 63 | 63 | Jenc.object |
| 64 | - [ ("data", Jenc.dict identity encodeDatum x.data) | |
| 64 | + [ ("data", makeDictEncoder identity encodeDatum x.data) | |
| 65 | 65 | , ("description", encodeDescription x.description) |
| 66 | 66 | ] |
| 67 | 67 | |
| @@ -97,6 +97,14 @@ encodeDescription x = | ||
| 97 | 97 | |
| 98 | 98 | --- encoder helpers |
| 99 | 99 | |
| 100 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 101 | +makeDictEncoder f m r = | |
| 102 | + r | |
| 103 | + |> Dict.toList | |
| 104 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 105 | + |> String.join "," | |
| 106 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 107 | + | |
| 100 | 108 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 101 | 109 | makeNullableEncoder f m = |
| 102 | 110 | case m of |
Mflowdefault / TopLevel.js+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class Description extends S.Class<Description>("Description")({ |
| 5 | 23 | "base_period": S.String, |
| @@ -14,6 +32,6 @@ export class Datum extends S.Class<Datum>("Datum")({ | ||
| 14 | 32 | }) {} |
| 15 | 33 | |
| 16 | 34 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 17 | - "data": S.Record({ key: S.String, value: Datum}), | |
| 35 | + "data": mapSchema(Datum), | |
| 18 | 36 | "description": Description, |
| 19 | 37 | }) {} |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/us-senators.json
Mflowdefault / TopLevel.js+2 −2
| @@ -212,7 +212,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 212 | 212 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 213 | 213 | return invalidValue(l(ref || "object"), val, key, parent); |
| 214 | 214 | } |
| 215 | - const result: any = {}; | |
| 215 | + const result: any = Object.create(null); | |
| 216 | 216 | Object.getOwnPropertyNames(props).forEach(key => { |
| 217 | 217 | const prop = props[key]; |
| 218 | 218 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -223,7 +223,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 223 | 223 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 224 | 224 | } |
| 225 | 225 | }); |
| 226 | - return result; | |
| 226 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -189,7 +189,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 189 | 189 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 190 | 190 | return invalidValue(l(ref || "object"), val, key, parent); |
| 191 | 191 | } |
| 192 | - const result: any = {}; | |
| 192 | + const result: any = Object.create(null); | |
| 193 | 193 | Object.getOwnPropertyNames(props).forEach(key => { |
| 194 | 194 | const prop = props[key]; |
| 195 | 195 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -200,7 +200,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 200 | 200 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 201 | 201 | } |
| 202 | 202 | }); |
| 203 | - return result; | |
| 203 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/accessors.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/all-of-additional-properties-false.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/schema/any.schema
Mschema-elmdefault / QuickType.elm+9 −1
| @@ -48,11 +48,19 @@ encodeQuickType : QuickType -> Jenc.Value | ||
| 48 | 48 | encodeQuickType x = |
| 49 | 49 | Jenc.object |
| 50 | 50 | [ ("foo", identity x.foo) |
| 51 | - , ("values", Jenc.dict identity identity x.values) | |
| 51 | + , ("values", makeDictEncoder identity identity x.values) | |
| 52 | 52 | ] |
| 53 | 53 | |
| 54 | 54 | --- encoder helpers |
| 55 | 55 | |
| 56 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 57 | +makeDictEncoder f m r = | |
| 58 | + r | |
| 59 | + |> Dict.toList | |
| 60 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 61 | + |> String.join "," | |
| 62 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 63 | + | |
| 56 | 64 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 57 | 65 | makeNullableEncoder f m = |
| 58 | 66 | case m of |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,7 +1,25 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | 23 | "foo": S.Any, |
| 6 | - "values": S.Record({ key: S.String, value: S.Any}), | |
| 24 | + "values": mapSchema(S.Any), | |
| 7 | 25 | }) {} |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/bool-string.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/boolean-subschema.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/camelCase.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/schema/class-map-union.schema
Mschema-elmdefault / QuickType.elm+9 −1
| @@ -57,7 +57,7 @@ quickType = | ||
| 57 | 57 | encodeQuickType : QuickType -> Jenc.Value |
| 58 | 58 | encodeQuickType x = |
| 59 | 59 | Jenc.object |
| 60 | - [ ("union", makeNullableEncoder (Jenc.dict identity encodeUnionValue) x.union) | |
| 60 | + [ ("union", makeNullableEncoder (makeDictEncoder identity encodeUnionValue) x.union) | |
| 61 | 61 | ] |
| 62 | 62 | |
| 63 | 63 | unionValue : Jdec.Decoder UnionValue |
| @@ -89,6 +89,14 @@ encodeUnionClass x = | ||
| 89 | 89 | |
| 90 | 90 | --- encoder helpers |
| 91 | 91 | |
| 92 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 93 | +makeDictEncoder f m r = | |
| 94 | + r | |
| 95 | + |> Dict.toList | |
| 96 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 97 | + |> String.join "," | |
| 98 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 99 | + | |
| 92 | 100 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 93 | 101 | makeNullableEncoder f m = |
| 94 | 102 | case m of |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 125 | 125 | return invalidValue(l(ref || "object"), val, key, parent); |
| 126 | 126 | } |
| 127 | - const result: any = {}; | |
| 127 | + const result: any = Object.create(null); | |
| 128 | 128 | Object.getOwnPropertyNames(props).forEach(key => { |
| 129 | 129 | const prop = props[key]; |
| 130 | 130 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 136 | 136 | } |
| 137 | 137 | }); |
| 138 | - return result; | |
| 138 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,10 +1,28 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class UnionClass extends S.Class<UnionClass>("UnionClass")({ |
| 5 | 23 | "quux": S.optional(S.Int), |
| 6 | 24 | }) {} |
| 7 | 25 | |
| 8 | 26 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 9 | - "union": S.optional(S.Record({ key: S.String, value: S.Union(S.Boolean, S.Number, S.String, UnionClass)})), | |
| 27 | + "union": S.optional(mapSchema(S.Union(S.Boolean, S.Number, S.String, UnionClass))), | |
| 10 | 28 | }) {} |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 125 | 125 | return invalidValue(l(ref || "object"), val, key, parent); |
| 126 | 126 | } |
| 127 | - const result: any = {}; | |
| 127 | + const result: any = Object.create(null); | |
| 128 | 128 | Object.getOwnPropertyNames(props).forEach(key => { |
| 129 | 129 | const prop = props[key]; |
| 130 | 130 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 136 | 136 | } |
| 137 | 137 | }); |
| 138 | - return result; | |
| 138 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | if (typ === "any") return val; |
Test case
7 generated files · +38 −12test/inputs/schema/class-with-additional.schema
Mschema-elmdefault / QuickType.elm+9 −1
| @@ -50,7 +50,7 @@ quickType = | ||
| 50 | 50 | encodeQuickType : QuickType -> Jenc.Value |
| 51 | 51 | encodeQuickType x = |
| 52 | 52 | Jenc.object |
| 53 | - [ ("map", makeNullableEncoder (Jenc.dict identity encodeMap) x.map) | |
| 53 | + [ ("map", makeNullableEncoder (makeDictEncoder identity encodeMap) x.map) | |
| 54 | 54 | ] |
| 55 | 55 | |
| 56 | 56 | map : Jdec.Decoder Map |
| @@ -67,6 +67,14 @@ encodeMap x = case x of | ||
| 67 | 67 | |
| 68 | 68 | --- encoder helpers |
| 69 | 69 | |
| 70 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 71 | +makeDictEncoder f m r = | |
| 72 | + r | |
| 73 | + |> Dict.toList | |
| 74 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 75 | + |> String.join "," | |
| 76 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 77 | + | |
| 70 | 78 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 71 | 79 | makeNullableEncoder f m = |
| 72 | 80 | case m of |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mschema-flowreadonly-true--24da4fc107df / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,6 +1,24 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | - "map": S.optional(S.Record({ key: S.String, value: S.Union(S.Boolean, S.Number)})), | |
| 23 | + "map": S.optional(mapSchema(S.Union(S.Boolean, S.Number))), | |
| 6 | 24 | }) {} |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mschema-typescriptreadonly-true--24da4fc107df / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
4 generated files · +8 −8test/inputs/schema/comment-injection-enum-nested-comment.schema
Mcomment-injection-typescriptdefault / TopLevel.ts+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 123 | 123 | return invalidValue(l(ref || "object"), val, key, parent); |
| 124 | 124 | } |
| 125 | - const result: any = {}; | |
| 125 | + const result: any = Object.create(null); | |
| 126 | 126 | Object.getOwnPropertyNames(props).forEach(key => { |
| 127 | 127 | const prop = props[key]; |
| 128 | 128 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -133,7 +133,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 133 | 133 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 134 | 134 | } |
| 135 | 135 | }); |
| 136 | - return result; | |
| 136 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Test case
4 generated files · +8 −8test/inputs/schema/comment-injection-enum.schema
Mcomment-injection-typescriptdefault / TopLevel.ts+2 −2
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 128 | 128 | return invalidValue(l(ref || "object"), val, key, parent); |
| 129 | 129 | } |
| 130 | - const result: any = {}; | |
| 130 | + const result: any = Object.create(null); | |
| 131 | 131 | Object.getOwnPropertyNames(props).forEach(key => { |
| 132 | 132 | const prop = props[key]; |
| 133 | 133 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 139 | 139 | } |
| 140 | 140 | }); |
| 141 | - return result; | |
| 141 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if (typ === "any") return val; |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 129 | 129 | return invalidValue(l(ref || "object"), val, key, parent); |
| 130 | 130 | } |
| 131 | - const result: any = {}; | |
| 131 | + const result: any = Object.create(null); | |
| 132 | 132 | Object.getOwnPropertyNames(props).forEach(key => { |
| 133 | 133 | const prop = props[key]; |
| 134 | 134 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -139,7 +139,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 139 | 139 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 140 | 140 | } |
| 141 | 141 | }); |
| 142 | - return result; | |
| 142 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 128 | 128 | return invalidValue(l(ref || "object"), val, key, parent); |
| 129 | 129 | } |
| 130 | - const result: any = {}; | |
| 130 | + const result: any = Object.create(null); | |
| 131 | 131 | Object.getOwnPropertyNames(props).forEach(key => { |
| 132 | 132 | const prop = props[key]; |
| 133 | 133 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 139 | 139 | } |
| 140 | 140 | }); |
| 141 | - return result; | |
| 141 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if (typ === "any") return val; |
Test case
4 generated files · +8 −8test/inputs/schema/comment-injection-nested-comment.schema
Mcomment-injection-typescriptdefault / TopLevel.ts+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Test case
4 generated files · +8 −8test/inputs/schema/comment-injection.schema
Mcomment-injection-typescriptdefault / TopLevel.ts+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/const-non-string.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/constructor.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/cut-enum.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/date-time-or-string.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/date-time.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/default-value.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/description-with-double-quotes.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/description.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 147 | 147 | return invalidValue(l(ref || "object"), val, key, parent); |
| 148 | 148 | } |
| 149 | - const result: any = {}; | |
| 149 | + const result: any = Object.create(null); | |
| 150 | 150 | Object.getOwnPropertyNames(props).forEach(key => { |
| 151 | 151 | const prop = props[key]; |
| 152 | 152 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -157,7 +157,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 157 | 157 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 158 | 158 | } |
| 159 | 159 | }); |
| 160 | - return result; | |
| 160 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -144,7 +144,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 144 | 144 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 145 | 145 | return invalidValue(l(ref || "object"), val, key, parent); |
| 146 | 146 | } |
| 147 | - const result: any = {}; | |
| 147 | + const result: any = Object.create(null); | |
| 148 | 148 | Object.getOwnPropertyNames(props).forEach(key => { |
| 149 | 149 | const prop = props[key]; |
| 150 | 150 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -155,7 +155,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 155 | 155 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 156 | 156 | } |
| 157 | 157 | }); |
| 158 | - return result; | |
| 158 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if (typ === "any") return val; |
Test case
5 generated files · +37 −11test/inputs/schema/direct-union.schema
Mschema-elmdefault / QuickType.elm+10 −2
| @@ -61,7 +61,7 @@ quickType = | ||
| 61 | 61 | encodeQuickType : QuickType -> Jenc.Value |
| 62 | 62 | encodeQuickType x = |
| 63 | 63 | Jenc.object |
| 64 | - [ ("stuff", Jenc.dict identity encodeThing x.stuff) | |
| 64 | + [ ("stuff", makeDictEncoder identity encodeThing x.stuff) | |
| 65 | 65 | ] |
| 66 | 66 | |
| 67 | 67 | thing : Jdec.Decoder Thing |
| @@ -97,10 +97,18 @@ encodeAnything x = case x of | ||
| 97 | 97 | NullInAnything -> Jenc.null |
| 98 | 98 | StringInAnything y -> Jenc.string y |
| 99 | 99 | DoubleInAnything y -> Jenc.float y |
| 100 | - AnythingMapInAnything y -> Jenc.dict identity identity y | |
| 100 | + AnythingMapInAnything y -> makeDictEncoder identity identity y | |
| 101 | 101 | |
| 102 | 102 | --- encoder helpers |
| 103 | 103 | |
| 104 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 105 | +makeDictEncoder f m r = | |
| 106 | + r | |
| 107 | + |> Dict.toList | |
| 108 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 109 | + |> String.join "," | |
| 110 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 111 | + | |
| 104 | 112 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 105 | 113 | makeNullableEncoder f m = |
| 106 | 114 | case m of |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescript-effect-schemadefault / TopLevel.ts+21 −3
| @@ -1,11 +1,29 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class Thing extends S.Class<Thing>("Thing")({ |
| 5 | - "optional": S.optional(S.Union(S.Array(S.Any), S.Boolean, S.Number, S.Int, S.Record({ key: S.String, value: S.Any}), S.String, S.Null)), | |
| 6 | - "required": S.Union(S.Array(S.Any), S.Boolean, S.Number, S.Int, S.Record({ key: S.String, value: S.Any}), S.String, S.Null), | |
| 23 | + "optional": S.optional(S.Union(S.Array(S.Any), S.Boolean, S.Number, S.Int, mapSchema(S.Any), S.String, S.Null)), | |
| 24 | + "required": S.Union(S.Array(S.Any), S.Boolean, S.Number, S.Int, mapSchema(S.Any), S.String, S.Null), | |
| 7 | 25 | }) {} |
| 8 | 26 | |
| 9 | 27 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 10 | - "stuff": S.Record({ key: S.String, value: Thing}), | |
| 28 | + "stuff": mapSchema(Thing), | |
| 11 | 29 | }) {} |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/schema/empty-object.schema
Mschema-elmdefault / QuickType.elm+9 −1
| @@ -36,10 +36,18 @@ quickType : Jdec.Decoder QuickType | ||
| 36 | 36 | quickType = Jdec.dict Jdec.value |
| 37 | 37 | |
| 38 | 38 | quickTypeToString : QuickType -> String |
| 39 | -quickTypeToString r = Jenc.encode 0 (Jenc.dict identity identity r) | |
| 39 | +quickTypeToString r = Jenc.encode 0 (makeDictEncoder identity identity r) | |
| 40 | 40 | |
| 41 | 41 | --- encoder helpers |
| 42 | 42 | |
| 43 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 44 | +makeDictEncoder f m r = | |
| 45 | + r | |
| 46 | + |> Dict.toList | |
| 47 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 48 | + |> String.join "," | |
| 49 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 50 | + | |
| 43 | 51 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 44 | 52 | makeNullableEncoder f m = |
| 45 | 53 | case m of |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,4 +1,22 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | -export const TopLevel = S.Record({ key: S.String, value: S.Any}); | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 21 | +export const TopLevel = mapSchema(S.Any); | |
| 4 | 22 | export type TopLevel = S.Schema.Type<typeof TopLevel>; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/enum-large.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/enum-with-null.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/enum-with-values.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/enum.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 130 | 130 | return invalidValue(l(ref || "object"), val, key, parent); |
| 131 | 131 | } |
| 132 | - const result: any = {}; | |
| 132 | + const result: any = Object.create(null); | |
| 133 | 133 | Object.getOwnPropertyNames(props).forEach(key => { |
| 134 | 134 | const prop = props[key]; |
| 135 | 135 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 141 | 141 | } |
| 142 | 142 | }); |
| 143 | - return result; | |
| 143 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/fractional-bounds.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/schema/go-schema-pattern-properties.schema
Mschema-elmdefault / QuickType.elm+9 −1
| @@ -45,11 +45,19 @@ quickType = | ||
| 45 | 45 | encodeQuickType : QuickType -> Jenc.Value |
| 46 | 46 | encodeQuickType x = |
| 47 | 47 | Jenc.object |
| 48 | - [ ("map", Jenc.dict identity Jenc.int x.map) | |
| 48 | + [ ("map", makeDictEncoder identity Jenc.int x.map) | |
| 49 | 49 | ] |
| 50 | 50 | |
| 51 | 51 | --- encoder helpers |
| 52 | 52 | |
| 53 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 54 | +makeDictEncoder f m r = | |
| 55 | + r | |
| 56 | + |> Dict.toList | |
| 57 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 58 | + |> String.join "," | |
| 59 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 60 | + | |
| 53 | 61 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 54 | 62 | makeNullableEncoder f m = |
| 55 | 63 | case m of |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,6 +1,24 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | - "map": S.Record({ key: S.String, value: S.Int}), | |
| 23 | + "map": mapSchema(S.Int), | |
| 6 | 24 | }) {} |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/haskell-enum-forbidden.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/id-no-address.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/id-root.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/ie-suffix-singularization.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/implicit-all-of.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/implicit-class-array-union.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/implicit-one-of.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/integer-before-number.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/integer-float-union.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/integer-string.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/integer-type.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/intersection-nested.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/intersection.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/issue2680-top-level-array.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Test case
34 generated files · +86 −18test/inputs/schema/keyword-enum.schema
Mschema-cjsondefault / TopLevel.c+2 −0
| @@ -188,6 +188,7 @@ enum Enum cJSON_GetEnumValue(const cJSON * j) { | ||
| 188 | 188 | else if (!strcmp(cJSON_GetStringValue(j), "Locale")) x = ENUM_LOCALE; |
| 189 | 189 | else if (!strcmp(cJSON_GetStringValue(j), "lock")) x = ENUM_LOCK; |
| 190 | 190 | else if (!strcmp(cJSON_GetStringValue(j), "long")) x = ENUM_LONG; |
| 191 | + else if (!strcmp(cJSON_GetStringValue(j), "makeDictEncoder")) x = ENUM_MAKE_DICT_ENCODER; | |
| 191 | 192 | else if (!strcmp(cJSON_GetStringValue(j), "map")) x = ENUM_MAP; |
| 192 | 193 | else if (!strcmp(cJSON_GetStringValue(j), "MarshalJSON")) x = ENUM_MARSHAL_JSON; |
| 193 | 194 | else if (!strcmp(cJSON_GetStringValue(j), "MapEntry")) x = ENUM_MAP_ENTRY; |
| @@ -538,6 +539,7 @@ cJSON * cJSON_CreateEnum(const enum Enum x) { | ||
| 538 | 539 | case ENUM_LOCALE: j = cJSON_CreateString("Locale"); break; |
| 539 | 540 | case ENUM_LOCK: j = cJSON_CreateString("lock"); break; |
| 540 | 541 | case ENUM_LONG: j = cJSON_CreateString("long"); break; |
| 542 | + case ENUM_MAKE_DICT_ENCODER: j = cJSON_CreateString("makeDictEncoder"); break; | |
| 541 | 543 | case ENUM_MAP: j = cJSON_CreateString("map"); break; |
| 542 | 544 | case ENUM_MARSHAL_JSON: j = cJSON_CreateString("MarshalJSON"); break; |
| 543 | 545 | case ENUM_MAP_ENTRY: j = cJSON_CreateString("MapEntry"); break; |
Mschema-cjsondefault / TopLevel.h+1 −0
| @@ -229,6 +229,7 @@ enum Enum { | ||
| 229 | 229 | ENUM_LOCALE, |
| 230 | 230 | ENUM_LOCK, |
| 231 | 231 | ENUM_LONG, |
| 232 | + ENUM_MAKE_DICT_ENCODER, | |
| 232 | 233 | ENUM_MAP, |
| 233 | 234 | ENUM_MARSHAL_JSON, |
| 234 | 235 | ENUM_MAP_ENTRY, |
Mschema-cplusplusdefault / quicktype.hpp+3 −1
| @@ -89,7 +89,7 @@ namespace quicktype { | ||
| 89 | 89 | } |
| 90 | 90 | #endif |
| 91 | 91 | |
| 92 | - enum class Enum : int { EMPTY, BOOL, COMPLEX, IMAGINERY, ABSTRACT, ALIGNAS, ALIGNOF, AND, AND_EQ, ANY, ENUM_ANY, ARRAY, AS, ASM, ASSERT, ASSOCIATEDTYPE, ASSOCIATIVITY, ASYNC, ATOMIC, ATOMIC_CANCEL, ATOMIC_COMMIT, ATOMIC_NOEXCEPT, AUTO, AWAIT, BASE, BITAND, BITOR, ENUM_BOOL, PURPLE_BOOL, BOOLEAN, BREAK, BYCOPY, BYREF, BYTE, CALENDAR, CASE, CATCH, CHAN, CHAR, CHAR16_T, CHAR32_T, CHECKED, CLASS, ENUM_CLASS, CLONE, CO_AWAIT, CO_RETURN, CO_YIELD, CODABLE, CODING_KEY, CODING_KEYS, COMPL, CONCEPT, CONSOLE, CONST, CONST_CAST, CONSTEXPR, CONSTRUCTOR, CONTINUE, CONVENIENCE, CONVERT, CONVERTER, CULTURE_INFO, DATE, DATE_PARSE_HANDLING, DATE_FORMATTER, DATE_ONLY, DATE_ONLY_CONVERTER, DATE_TIME, DATE_TIME_STYLES, DEBUGGER, DECIMAL, DECLARE, DECLTYPE, DECODE_STRING, DECODER, DECODING_ERROR, DEF, DEFAULT, DEFER, DEINIT, DEL, DELEGATE, DELETE, DICT, DICTIONARY, DID_SET, DO, DOUBLE, DYNAMIC, DYNAMIC_CAST, ELIF, ELSE, ENCODE_QUICK_TYPE, ENCODER, ENUM, ENUM_VALUES, EQUATABLE, EQUALITY_CONTRACT, EVENT, EXCEPT, EXCEPTION, EXPLICIT, EXPORT, EXPOSING, EXTENDS, EXTENSION, EXTERN, FALLTHROUGH, FALSE, ENUM_FALSE, FILEPRIVATE, FINAL, FINALLY, FIXED, FLOAT, FOR, FOREACH, FORMAT_EXCEPTION, FRIEND, FROM, FROM_DICT, FROM_JSON, FUNC, FUNCTION, GET, GLOBAL, GO, GOTO, GUARD, HASHABLE, HASH_CODE, HASHER, HAS_OWN_PROPERTY, ID, IF, IMP, IMPLEMENTS, IMPLICIT, IMPORT, IN, INDIRECT, INFIX, INIT, INLINE, INOUT, INSTANCEOF, INT, INTERFACE, INTERNAL, ISO_DATE_TIME_OFFSET_CONVERTER, ITERABLE, IS, JDEC, JENC, JPIPE, JSON, JSON_CONVERTER, JSON_SERIALIZER, JSON_TOKEN, JSON_WRITER, JSON_ANY, JSON_CODING_KEY, JSON_DECODER, JSON_ENCODER, JSON_EXCEPTION, JSON_GENERATOR, JSON_NODE, JSON_NULL, JSON_PARSER, JSON_READER, JSON_TOKEN_TYPE, LAMBDA, LAZY, LEFT, LET, LIST, LOCALE, LOCK, LONG, MAP, MARSHAL_JSON, MAP_ENTRY, METADATA_PROPERTY_HANDLING, MODULE, MUTABLE, MUTATING, NAMESPACE, NATIVE, NEW, NEWTONSOFT, NIL, NO, NOEXCEPT, NONATOMIC, NONE, ENUM_NONE, NONLOCAL, NONMUTATING, NS_OBJECT, NO_SUCH_METHOD, NOT, NOT_EQ, NS_ERROR, NS_STRING, ENUM_NULL, PURPLE_NULL, NULLPTR, NUMBER, OBJECT, OBJECT_MAPPER, OF, ONEWAY, OPEN, OPERATOR, OPTIONAL, OR, OR_EQ, OUT, OVERRIDE, PACKAGE, PARAMS, PASS, PORT, POSTFIX, PRECEDENCE, PREFIX, PRINT, PRINTF, PRINT_MEMBERS, PRIVATE, PROTECTED, PROTOCOL, ENUM_PROTOCOL, PUBLIC, QUICKTYPE, RAISE, RANGE, READONLY, REF, REG_EXP, REGISTER, REINTERPRET_CAST, REPEAT, REQUIRE, REQUIRED, REQUIRES, RESTRICT, RETAIN, RETHROWS, RETURN, RIGHT, RUNTIME_TYPE, S, SBYTE, SEALED, SEL, SELECT, SELF, SERIALIZABLE, ENUM_SELF, SENDABLE, SERIALIZE, SERIAL_NAME, K_SERIALIZER, PRIMITIVE_KIND, SERIAL_DESCRIPTOR, SERIALIZER_PROVIDER, SET, SHORT, SIGNED, SIMPLE_MODULE, SIZEOF, STACKALLOC, STANDARDS, STATIC, STATIC_ASSERT, STATIC_CAST, STD_DESERIALIZER, STD_SERIALIZER, STRICTFP, STRING, STRUCT, SUBSCRIPT, SUPER, SWITCH, SYMBOL, SYNCHRONIZED, SYSTEM, TEMPLATE, THEN, THIS, THREAD_LOCAL, THROW, THROWS, TIME_ONLY, TIME_ONLY_CONVERTER, TIME_ZONE, TO_JSON, TOP_LEVEL, TO_STRING, TO_DICT, TRANSIENT, TRUE, ENUM_TRUE, TRY, TYPE, ENUM_TYPE, TYPEALIAS, TYPEDEF, TYPEID, TYPENAME, TYPEOF, UINT, ULONG, UNCHECKED, UNDEFINED, UNION, UNMARSHAL_JSON, USE_SERIALIZERS, UNOWNED, UNSAFE, UNSIGNED, USHORT, USING, UTF8_JSON_READER, UTF8_JSON_WRITER, UUID, VAR, VIRTUAL, VOID, VOLATILE, WCHAR_T, WEAK, WHERE, WHILE, WILL_SET, WITH, XOR, XOR_EQ, YES, YIELD, DUMMY }; | |
| 92 | + enum class Enum : int { EMPTY, BOOL, COMPLEX, IMAGINERY, ABSTRACT, ALIGNAS, ALIGNOF, AND, AND_EQ, ANY, ENUM_ANY, ARRAY, AS, ASM, ASSERT, ASSOCIATEDTYPE, ASSOCIATIVITY, ASYNC, ATOMIC, ATOMIC_CANCEL, ATOMIC_COMMIT, ATOMIC_NOEXCEPT, AUTO, AWAIT, BASE, BITAND, BITOR, ENUM_BOOL, PURPLE_BOOL, BOOLEAN, BREAK, BYCOPY, BYREF, BYTE, CALENDAR, CASE, CATCH, CHAN, CHAR, CHAR16_T, CHAR32_T, CHECKED, CLASS, ENUM_CLASS, CLONE, CO_AWAIT, CO_RETURN, CO_YIELD, CODABLE, CODING_KEY, CODING_KEYS, COMPL, CONCEPT, CONSOLE, CONST, CONST_CAST, CONSTEXPR, CONSTRUCTOR, CONTINUE, CONVENIENCE, CONVERT, CONVERTER, CULTURE_INFO, DATE, DATE_PARSE_HANDLING, DATE_FORMATTER, DATE_ONLY, DATE_ONLY_CONVERTER, DATE_TIME, DATE_TIME_STYLES, DEBUGGER, DECIMAL, DECLARE, DECLTYPE, DECODE_STRING, DECODER, DECODING_ERROR, DEF, DEFAULT, DEFER, DEINIT, DEL, DELEGATE, DELETE, DICT, DICTIONARY, DID_SET, DO, DOUBLE, DYNAMIC, DYNAMIC_CAST, ELIF, ELSE, ENCODE_QUICK_TYPE, ENCODER, ENUM, ENUM_VALUES, EQUATABLE, EQUALITY_CONTRACT, EVENT, EXCEPT, EXCEPTION, EXPLICIT, EXPORT, EXPOSING, EXTENDS, EXTENSION, EXTERN, FALLTHROUGH, FALSE, ENUM_FALSE, FILEPRIVATE, FINAL, FINALLY, FIXED, FLOAT, FOR, FOREACH, FORMAT_EXCEPTION, FRIEND, FROM, FROM_DICT, FROM_JSON, FUNC, FUNCTION, GET, GLOBAL, GO, GOTO, GUARD, HASHABLE, HASH_CODE, HASHER, HAS_OWN_PROPERTY, ID, IF, IMP, IMPLEMENTS, IMPLICIT, IMPORT, IN, INDIRECT, INFIX, INIT, INLINE, INOUT, INSTANCEOF, INT, INTERFACE, INTERNAL, ISO_DATE_TIME_OFFSET_CONVERTER, ITERABLE, IS, JDEC, JENC, JPIPE, JSON, JSON_CONVERTER, JSON_SERIALIZER, JSON_TOKEN, JSON_WRITER, JSON_ANY, JSON_CODING_KEY, JSON_DECODER, JSON_ENCODER, JSON_EXCEPTION, JSON_GENERATOR, JSON_NODE, JSON_NULL, JSON_PARSER, JSON_READER, JSON_TOKEN_TYPE, LAMBDA, LAZY, LEFT, LET, LIST, LOCALE, LOCK, LONG, MAKE_DICT_ENCODER, MAP, MARSHAL_JSON, MAP_ENTRY, METADATA_PROPERTY_HANDLING, MODULE, MUTABLE, MUTATING, NAMESPACE, NATIVE, NEW, NEWTONSOFT, NIL, NO, NOEXCEPT, NONATOMIC, NONE, ENUM_NONE, NONLOCAL, NONMUTATING, NS_OBJECT, NO_SUCH_METHOD, NOT, NOT_EQ, NS_ERROR, NS_STRING, ENUM_NULL, PURPLE_NULL, NULLPTR, NUMBER, OBJECT, OBJECT_MAPPER, OF, ONEWAY, OPEN, OPERATOR, OPTIONAL, OR, OR_EQ, OUT, OVERRIDE, PACKAGE, PARAMS, PASS, PORT, POSTFIX, PRECEDENCE, PREFIX, PRINT, PRINTF, PRINT_MEMBERS, PRIVATE, PROTECTED, PROTOCOL, ENUM_PROTOCOL, PUBLIC, QUICKTYPE, RAISE, RANGE, READONLY, REF, REG_EXP, REGISTER, REINTERPRET_CAST, REPEAT, REQUIRE, REQUIRED, REQUIRES, RESTRICT, RETAIN, RETHROWS, RETURN, RIGHT, RUNTIME_TYPE, S, SBYTE, SEALED, SEL, SELECT, SELF, SERIALIZABLE, ENUM_SELF, SENDABLE, SERIALIZE, SERIAL_NAME, K_SERIALIZER, PRIMITIVE_KIND, SERIAL_DESCRIPTOR, SERIALIZER_PROVIDER, SET, SHORT, SIGNED, SIMPLE_MODULE, SIZEOF, STACKALLOC, STANDARDS, STATIC, STATIC_ASSERT, STATIC_CAST, STD_DESERIALIZER, STD_SERIALIZER, STRICTFP, STRING, STRUCT, SUBSCRIPT, SUPER, SWITCH, SYMBOL, SYNCHRONIZED, SYSTEM, TEMPLATE, THEN, THIS, THREAD_LOCAL, THROW, THROWS, TIME_ONLY, TIME_ONLY_CONVERTER, TIME_ZONE, TO_JSON, TOP_LEVEL, TO_STRING, TO_DICT, TRANSIENT, TRUE, ENUM_TRUE, TRY, TYPE, ENUM_TYPE, TYPEALIAS, TYPEDEF, TYPEID, TYPENAME, TYPEOF, UINT, ULONG, UNCHECKED, UNDEFINED, UNION, UNMARSHAL_JSON, USE_SERIALIZERS, UNOWNED, UNSAFE, UNSIGNED, USHORT, USING, UTF8_JSON_READER, UTF8_JSON_WRITER, UUID, VAR, VIRTUAL, VOID, VOLATILE, WCHAR_T, WEAK, WHERE, WHILE, WILL_SET, WITH, XOR, XOR_EQ, YES, YIELD, DUMMY }; | |
| 93 | 93 | |
| 94 | 94 | class TopLevel { |
| 95 | 95 | public: |
| @@ -306,6 +306,7 @@ namespace quicktype { | ||
| 306 | 306 | {"Locale", Enum::LOCALE}, |
| 307 | 307 | {"lock", Enum::LOCK}, |
| 308 | 308 | {"long", Enum::LONG}, |
| 309 | + {"makeDictEncoder", Enum::MAKE_DICT_ENCODER}, | |
| 309 | 310 | {"map", Enum::MAP}, |
| 310 | 311 | {"MarshalJSON", Enum::MARSHAL_JSON}, |
| 311 | 312 | {"MapEntry", Enum::MAP_ENTRY}, |
| @@ -659,6 +660,7 @@ namespace quicktype { | ||
| 659 | 660 | case Enum::LOCALE: j = "Locale"; break; |
| 660 | 661 | case Enum::LOCK: j = "lock"; break; |
| 661 | 662 | case Enum::LONG: j = "long"; break; |
| 663 | + case Enum::MAKE_DICT_ENCODER: j = "makeDictEncoder"; break; | |
| 662 | 664 | case Enum::MAP: j = "map"; break; |
| 663 | 665 | case Enum::MARSHAL_JSON: j = "MarshalJSON"; break; |
| 664 | 666 | case Enum::MAP_ENTRY: j = "MapEntry"; break; |
Mschema-csharp-recordsdefault / QuickType.cs+6 −1
| @@ -29,7 +29,7 @@ namespace QuickType | ||
| 29 | 29 | public Enum? Enum { get; set; } |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public enum Enum { Empty, Bool, Complex, Imaginery, Abstract, Alignas, Alignof, And, AndEq, Any, EnumAny, Array, As, Asm, Assert, Associatedtype, Associativity, Async, Atomic, AtomicCancel, AtomicCommit, AtomicNoexcept, Auto, Await, Base, Bitand, Bitor, EnumBool, PurpleBool, Boolean, Break, Bycopy, Byref, Byte, Calendar, Case, Catch, Chan, Char, Char16T, Char32T, Checked, Class, EnumClass, Clone, CoAwait, CoReturn, CoYield, Codable, CodingKey, CodingKeys, Compl, Concept, Console, Const, ConstCast, Constexpr, Constructor, Continue, Convenience, Convert, Converter, CultureInfo, Date, DateParseHandling, DateFormatter, DateOnly, DateOnlyConverter, DateTime, DateTimeStyles, Debugger, Decimal, Declare, Decltype, DecodeString, Decoder, DecodingError, Def, Default, Defer, Deinit, Del, Delegate, Delete, Dict, Dictionary, DidSet, Do, Double, Dynamic, DynamicCast, Elif, Else, EncodeQuickType, Encoder, Enum, EnumValues, Equatable, EqualityContract, Event, Except, Exception, Explicit, Export, Exposing, Extends, Extension, Extern, Fallthrough, False, EnumFalse, Fileprivate, Final, Finally, Fixed, Float, For, Foreach, FormatException, Friend, From, FromDict, FromJson, Func, Function, Get, Global, Go, Goto, Guard, Hashable, HashCode, Hasher, HasOwnProperty, Id, If, Imp, Implements, Implicit, Import, In, Indirect, Infix, Init, Inline, Inout, Instanceof, Int, Interface, Internal, IsoDateTimeOffsetConverter, Iterable, Is, Jdec, Jenc, Jpipe, Json, JsonConverter, JsonSerializer, JsonToken, JsonWriter, JsonAny, JsonCodingKey, JsonDecoder, JsonEncoder, JsonException, JsonGenerator, JsonNode, JsonNull, JsonParser, JsonReader, JsonTokenType, Lambda, Lazy, Left, Let, List, Locale, Lock, Long, Map, MarshalJson, MapEntry, MetadataPropertyHandling, Module, Mutable, Mutating, Namespace, Native, New, Newtonsoft, Nil, No, Noexcept, Nonatomic, None, EnumNone, Nonlocal, Nonmutating, NsObject, NoSuchMethod, Not, NotEq, NsError, NsString, Null, EnumNull, Nullptr, Number, Object, ObjectMapper, Of, Oneway, Open, Operator, Optional, Or, OrEq, Out, Override, Package, Params, Pass, Port, Postfix, Precedence, Prefix, Print, Printf, PrintMembers, Private, Protected, Protocol, EnumProtocol, Public, Quicktype, Raise, Range, Readonly, Ref, RegExp, Register, ReinterpretCast, Repeat, Require, Required, Requires, Restrict, Retain, Rethrows, Return, Right, RuntimeType, S, Sbyte, Sealed, Sel, Select, Self, Serializable, EnumSelf, Sendable, Serialize, SerialName, KSerializer, PrimitiveKind, SerialDescriptor, SerializerProvider, Set, Short, Signed, SimpleModule, Sizeof, Stackalloc, Standards, Static, StaticAssert, StaticCast, StdDeserializer, StdSerializer, Strictfp, String, Struct, Subscript, Super, Switch, Symbol, Synchronized, System, Template, Then, This, ThreadLocal, Throw, Throws, TimeOnly, TimeOnlyConverter, TimeZone, ToJson, TopLevel, ToString, ToDict, Transient, True, EnumTrue, Try, Type, EnumType, Typealias, Typedef, Typeid, Typename, Typeof, Uint, Ulong, Unchecked, Undefined, Union, UnmarshalJson, UseSerializers, Unowned, Unsafe, Unsigned, Ushort, Using, Utf8JsonReader, Utf8JsonWriter, Uuid, Var, Virtual, Void, Volatile, WcharT, Weak, Where, While, WillSet, With, Xor, XorEq, Yes, Yield, Dummy }; | |
| 32 | + public enum Enum { Empty, Bool, Complex, Imaginery, Abstract, Alignas, Alignof, And, AndEq, Any, EnumAny, Array, As, Asm, Assert, Associatedtype, Associativity, Async, Atomic, AtomicCancel, AtomicCommit, AtomicNoexcept, Auto, Await, Base, Bitand, Bitor, EnumBool, PurpleBool, Boolean, Break, Bycopy, Byref, Byte, Calendar, Case, Catch, Chan, Char, Char16T, Char32T, Checked, Class, EnumClass, Clone, CoAwait, CoReturn, CoYield, Codable, CodingKey, CodingKeys, Compl, Concept, Console, Const, ConstCast, Constexpr, Constructor, Continue, Convenience, Convert, Converter, CultureInfo, Date, DateParseHandling, DateFormatter, DateOnly, DateOnlyConverter, DateTime, DateTimeStyles, Debugger, Decimal, Declare, Decltype, DecodeString, Decoder, DecodingError, Def, Default, Defer, Deinit, Del, Delegate, Delete, Dict, Dictionary, DidSet, Do, Double, Dynamic, DynamicCast, Elif, Else, EncodeQuickType, Encoder, Enum, EnumValues, Equatable, EqualityContract, Event, Except, Exception, Explicit, Export, Exposing, Extends, Extension, Extern, Fallthrough, False, EnumFalse, Fileprivate, Final, Finally, Fixed, Float, For, Foreach, FormatException, Friend, From, FromDict, FromJson, Func, Function, Get, Global, Go, Goto, Guard, Hashable, HashCode, Hasher, HasOwnProperty, Id, If, Imp, Implements, Implicit, Import, In, Indirect, Infix, Init, Inline, Inout, Instanceof, Int, Interface, Internal, IsoDateTimeOffsetConverter, Iterable, Is, Jdec, Jenc, Jpipe, Json, JsonConverter, JsonSerializer, JsonToken, JsonWriter, JsonAny, JsonCodingKey, JsonDecoder, JsonEncoder, JsonException, JsonGenerator, JsonNode, JsonNull, JsonParser, JsonReader, JsonTokenType, Lambda, Lazy, Left, Let, List, Locale, Lock, Long, MakeDictEncoder, Map, MarshalJson, MapEntry, MetadataPropertyHandling, Module, Mutable, Mutating, Namespace, Native, New, Newtonsoft, Nil, No, Noexcept, Nonatomic, None, EnumNone, Nonlocal, Nonmutating, NsObject, NoSuchMethod, Not, NotEq, NsError, NsString, Null, EnumNull, Nullptr, Number, Object, ObjectMapper, Of, Oneway, Open, Operator, Optional, Or, OrEq, Out, Override, Package, Params, Pass, Port, Postfix, Precedence, Prefix, Print, Printf, PrintMembers, Private, Protected, Protocol, EnumProtocol, Public, Quicktype, Raise, Range, Readonly, Ref, RegExp, Register, ReinterpretCast, Repeat, Require, Required, Requires, Restrict, Retain, Rethrows, Return, Right, RuntimeType, S, Sbyte, Sealed, Sel, Select, Self, Serializable, EnumSelf, Sendable, Serialize, SerialName, KSerializer, PrimitiveKind, SerialDescriptor, SerializerProvider, Set, Short, Signed, SimpleModule, Sizeof, Stackalloc, Standards, Static, StaticAssert, StaticCast, StdDeserializer, StdSerializer, Strictfp, String, Struct, Subscript, Super, Switch, Symbol, Synchronized, System, Template, Then, This, ThreadLocal, Throw, Throws, TimeOnly, TimeOnlyConverter, TimeZone, ToJson, TopLevel, ToString, ToDict, Transient, True, EnumTrue, Try, Type, EnumType, Typealias, Typedef, Typeid, Typename, Typeof, Uint, Ulong, Unchecked, Undefined, Union, UnmarshalJson, UseSerializers, Unowned, Unsafe, Unsigned, Ushort, Using, Utf8JsonReader, Utf8JsonWriter, Uuid, Var, Virtual, Void, Volatile, WcharT, Weak, Where, While, WillSet, With, Xor, XorEq, Yes, Yield, Dummy }; | |
| 33 | 33 | |
| 34 | 34 | public partial record TopLevel |
| 35 | 35 | { |
| @@ -425,6 +425,8 @@ namespace QuickType | ||
| 425 | 425 | return Enum.Lock; |
| 426 | 426 | case "long": |
| 427 | 427 | return Enum.Long; |
| 428 | + case "makeDictEncoder": | |
| 429 | + return Enum.MakeDictEncoder; | |
| 428 | 430 | case "map": |
| 429 | 431 | return Enum.Map; |
| 430 | 432 | case "MarshalJSON": |
| @@ -1305,6 +1307,9 @@ namespace QuickType | ||
| 1305 | 1307 | case Enum.Long: |
| 1306 | 1308 | serializer.Serialize(writer, "long"); |
| 1307 | 1309 | return; |
| 1310 | + case Enum.MakeDictEncoder: | |
| 1311 | + serializer.Serialize(writer, "makeDictEncoder"); | |
| 1312 | + return; | |
| 1308 | 1313 | case Enum.Map: |
| 1309 | 1314 | serializer.Serialize(writer, "map"); |
| 1310 | 1315 | return; |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+6 −1
| @@ -27,7 +27,7 @@ namespace QuickType | ||
| 27 | 27 | public Enum? Enum { get; set; } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public enum Enum { Empty, Bool, Complex, Imaginery, Abstract, Alignas, Alignof, And, AndEq, Any, EnumAny, Array, As, Asm, Assert, Associatedtype, Associativity, Async, Atomic, AtomicCancel, AtomicCommit, AtomicNoexcept, Auto, Await, Base, Bitand, Bitor, EnumBool, PurpleBool, Boolean, Break, Bycopy, Byref, Byte, Calendar, Case, Catch, Chan, Char, Char16T, Char32T, Checked, Class, EnumClass, Clone, CoAwait, CoReturn, CoYield, Codable, CodingKey, CodingKeys, Compl, Concept, Console, Const, ConstCast, Constexpr, Constructor, Continue, Convenience, Convert, Converter, CultureInfo, Date, DateParseHandling, DateFormatter, DateOnly, DateOnlyConverter, DateTime, DateTimeStyles, Debugger, Decimal, Declare, Decltype, DecodeString, Decoder, DecodingError, Def, Default, Defer, Deinit, Del, Delegate, Delete, Dict, Dictionary, DidSet, Do, Double, Dynamic, DynamicCast, Elif, Else, EncodeQuickType, Encoder, Enum, EnumValues, Equatable, EqualityContract, Event, Except, Exception, Explicit, Export, Exposing, Extends, Extension, Extern, Fallthrough, False, EnumFalse, Fileprivate, Final, Finally, Fixed, Float, For, Foreach, FormatException, Friend, From, FromDict, FromJson, Func, Function, Get, Global, Go, Goto, Guard, Hashable, HashCode, Hasher, HasOwnProperty, Id, If, Imp, Implements, Implicit, Import, In, Indirect, Infix, Init, Inline, Inout, Instanceof, Int, Interface, Internal, IsoDateTimeOffsetConverter, Iterable, Is, Jdec, Jenc, Jpipe, Json, JsonConverter, JsonSerializer, JsonToken, JsonWriter, JsonAny, JsonCodingKey, JsonDecoder, JsonEncoder, JsonException, JsonGenerator, JsonNode, JsonNull, JsonParser, JsonReader, JsonTokenType, Lambda, Lazy, Left, Let, List, Locale, Lock, Long, Map, MarshalJson, MapEntry, MetadataPropertyHandling, Module, Mutable, Mutating, Namespace, Native, New, Newtonsoft, Nil, No, Noexcept, Nonatomic, None, EnumNone, Nonlocal, Nonmutating, NsObject, NoSuchMethod, Not, NotEq, NsError, NsString, Null, EnumNull, Nullptr, Number, Object, ObjectMapper, Of, Oneway, Open, Operator, Optional, Or, OrEq, Out, Override, Package, Params, Pass, Port, Postfix, Precedence, Prefix, Print, Printf, PrintMembers, Private, Protected, Protocol, EnumProtocol, Public, Quicktype, Raise, Range, Readonly, Ref, RegExp, Register, ReinterpretCast, Repeat, Require, Required, Requires, Restrict, Retain, Rethrows, Return, Right, RuntimeType, S, Sbyte, Sealed, Sel, Select, Self, Serializable, EnumSelf, Sendable, Serialize, SerialName, KSerializer, PrimitiveKind, SerialDescriptor, SerializerProvider, Set, Short, Signed, SimpleModule, Sizeof, Stackalloc, Standards, Static, StaticAssert, StaticCast, StdDeserializer, StdSerializer, Strictfp, String, Struct, Subscript, Super, Switch, Symbol, Synchronized, System, Template, Then, This, ThreadLocal, Throw, Throws, TimeOnly, TimeOnlyConverter, TimeZone, ToJson, TopLevel, ToString, ToDict, Transient, True, EnumTrue, Try, Type, EnumType, Typealias, Typedef, Typeid, Typename, Typeof, Uint, Ulong, Unchecked, Undefined, Union, UnmarshalJson, UseSerializers, Unowned, Unsafe, Unsigned, Ushort, Using, Utf8JsonReader, Utf8JsonWriter, Uuid, Var, Virtual, Void, Volatile, WcharT, Weak, Where, While, WillSet, With, Xor, XorEq, Yes, Yield, Dummy }; | |
| 30 | + public enum Enum { Empty, Bool, Complex, Imaginery, Abstract, Alignas, Alignof, And, AndEq, Any, EnumAny, Array, As, Asm, Assert, Associatedtype, Associativity, Async, Atomic, AtomicCancel, AtomicCommit, AtomicNoexcept, Auto, Await, Base, Bitand, Bitor, EnumBool, PurpleBool, Boolean, Break, Bycopy, Byref, Byte, Calendar, Case, Catch, Chan, Char, Char16T, Char32T, Checked, Class, EnumClass, Clone, CoAwait, CoReturn, CoYield, Codable, CodingKey, CodingKeys, Compl, Concept, Console, Const, ConstCast, Constexpr, Constructor, Continue, Convenience, Convert, Converter, CultureInfo, Date, DateParseHandling, DateFormatter, DateOnly, DateOnlyConverter, DateTime, DateTimeStyles, Debugger, Decimal, Declare, Decltype, DecodeString, Decoder, DecodingError, Def, Default, Defer, Deinit, Del, Delegate, Delete, Dict, Dictionary, DidSet, Do, Double, Dynamic, DynamicCast, Elif, Else, EncodeQuickType, Encoder, Enum, EnumValues, Equatable, EqualityContract, Event, Except, Exception, Explicit, Export, Exposing, Extends, Extension, Extern, Fallthrough, False, EnumFalse, Fileprivate, Final, Finally, Fixed, Float, For, Foreach, FormatException, Friend, From, FromDict, FromJson, Func, Function, Get, Global, Go, Goto, Guard, Hashable, HashCode, Hasher, HasOwnProperty, Id, If, Imp, Implements, Implicit, Import, In, Indirect, Infix, Init, Inline, Inout, Instanceof, Int, Interface, Internal, IsoDateTimeOffsetConverter, Iterable, Is, Jdec, Jenc, Jpipe, Json, JsonConverter, JsonSerializer, JsonToken, JsonWriter, JsonAny, JsonCodingKey, JsonDecoder, JsonEncoder, JsonException, JsonGenerator, JsonNode, JsonNull, JsonParser, JsonReader, JsonTokenType, Lambda, Lazy, Left, Let, List, Locale, Lock, Long, MakeDictEncoder, Map, MarshalJson, MapEntry, MetadataPropertyHandling, Module, Mutable, Mutating, Namespace, Native, New, Newtonsoft, Nil, No, Noexcept, Nonatomic, None, EnumNone, Nonlocal, Nonmutating, NsObject, NoSuchMethod, Not, NotEq, NsError, NsString, Null, EnumNull, Nullptr, Number, Object, ObjectMapper, Of, Oneway, Open, Operator, Optional, Or, OrEq, Out, Override, Package, Params, Pass, Port, Postfix, Precedence, Prefix, Print, Printf, PrintMembers, Private, Protected, Protocol, EnumProtocol, Public, Quicktype, Raise, Range, Readonly, Ref, RegExp, Register, ReinterpretCast, Repeat, Require, Required, Requires, Restrict, Retain, Rethrows, Return, Right, RuntimeType, S, Sbyte, Sealed, Sel, Select, Self, Serializable, EnumSelf, Sendable, Serialize, SerialName, KSerializer, PrimitiveKind, SerialDescriptor, SerializerProvider, Set, Short, Signed, SimpleModule, Sizeof, Stackalloc, Standards, Static, StaticAssert, StaticCast, StdDeserializer, StdSerializer, Strictfp, String, Struct, Subscript, Super, Switch, Symbol, Synchronized, System, Template, Then, This, ThreadLocal, Throw, Throws, TimeOnly, TimeOnlyConverter, TimeZone, ToJson, TopLevel, ToString, ToDict, Transient, True, EnumTrue, Try, Type, EnumType, Typealias, Typedef, Typeid, Typename, Typeof, Uint, Ulong, Unchecked, Undefined, Union, UnmarshalJson, UseSerializers, Unowned, Unsafe, Unsigned, Ushort, Using, Utf8JsonReader, Utf8JsonWriter, Uuid, Var, Virtual, Void, Volatile, WcharT, Weak, Where, While, WillSet, With, Xor, XorEq, Yes, Yield, Dummy }; | |
| 31 | 31 | |
| 32 | 32 | public partial class TopLevel |
| 33 | 33 | { |
| @@ -422,6 +422,8 @@ namespace QuickType | ||
| 422 | 422 | return Enum.Lock; |
| 423 | 423 | case "long": |
| 424 | 424 | return Enum.Long; |
| 425 | + case "makeDictEncoder": | |
| 426 | + return Enum.MakeDictEncoder; | |
| 425 | 427 | case "map": |
| 426 | 428 | return Enum.Map; |
| 427 | 429 | case "MarshalJSON": |
| @@ -1296,6 +1298,9 @@ namespace QuickType | ||
| 1296 | 1298 | case Enum.Long: |
| 1297 | 1299 | JsonSerializer.Serialize(writer, "long", options); |
| 1298 | 1300 | return; |
| 1301 | + case Enum.MakeDictEncoder: | |
| 1302 | + JsonSerializer.Serialize(writer, "makeDictEncoder", options); | |
| 1303 | + return; | |
| 1299 | 1304 | case Enum.Map: |
| 1300 | 1305 | JsonSerializer.Serialize(writer, "map", options); |
| 1301 | 1306 | return; |
Mschema-csharpdefault / QuickType.cs+6 −1
| @@ -29,7 +29,7 @@ namespace QuickType | ||
| 29 | 29 | public Enum? Enum { get; set; } |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public enum Enum { Empty, Bool, Complex, Imaginery, Abstract, Alignas, Alignof, And, AndEq, Any, EnumAny, Array, As, Asm, Assert, Associatedtype, Associativity, Async, Atomic, AtomicCancel, AtomicCommit, AtomicNoexcept, Auto, Await, Base, Bitand, Bitor, EnumBool, PurpleBool, Boolean, Break, Bycopy, Byref, Byte, Calendar, Case, Catch, Chan, Char, Char16T, Char32T, Checked, Class, EnumClass, Clone, CoAwait, CoReturn, CoYield, Codable, CodingKey, CodingKeys, Compl, Concept, Console, Const, ConstCast, Constexpr, Constructor, Continue, Convenience, Convert, Converter, CultureInfo, Date, DateParseHandling, DateFormatter, DateOnly, DateOnlyConverter, DateTime, DateTimeStyles, Debugger, Decimal, Declare, Decltype, DecodeString, Decoder, DecodingError, Def, Default, Defer, Deinit, Del, Delegate, Delete, Dict, Dictionary, DidSet, Do, Double, Dynamic, DynamicCast, Elif, Else, EncodeQuickType, Encoder, Enum, EnumValues, Equatable, EqualityContract, Event, Except, Exception, Explicit, Export, Exposing, Extends, Extension, Extern, Fallthrough, False, EnumFalse, Fileprivate, Final, Finally, Fixed, Float, For, Foreach, FormatException, Friend, From, FromDict, FromJson, Func, Function, Get, Global, Go, Goto, Guard, Hashable, HashCode, Hasher, HasOwnProperty, Id, If, Imp, Implements, Implicit, Import, In, Indirect, Infix, Init, Inline, Inout, Instanceof, Int, Interface, Internal, IsoDateTimeOffsetConverter, Iterable, Is, Jdec, Jenc, Jpipe, Json, JsonConverter, JsonSerializer, JsonToken, JsonWriter, JsonAny, JsonCodingKey, JsonDecoder, JsonEncoder, JsonException, JsonGenerator, JsonNode, JsonNull, JsonParser, JsonReader, JsonTokenType, Lambda, Lazy, Left, Let, List, Locale, Lock, Long, Map, MarshalJson, MapEntry, MetadataPropertyHandling, Module, Mutable, Mutating, Namespace, Native, New, Newtonsoft, Nil, No, Noexcept, Nonatomic, None, EnumNone, Nonlocal, Nonmutating, NsObject, NoSuchMethod, Not, NotEq, NsError, NsString, Null, EnumNull, Nullptr, Number, Object, ObjectMapper, Of, Oneway, Open, Operator, Optional, Or, OrEq, Out, Override, Package, Params, Pass, Port, Postfix, Precedence, Prefix, Print, Printf, PrintMembers, Private, Protected, Protocol, EnumProtocol, Public, Quicktype, Raise, Range, Readonly, Ref, RegExp, Register, ReinterpretCast, Repeat, Require, Required, Requires, Restrict, Retain, Rethrows, Return, Right, RuntimeType, S, Sbyte, Sealed, Sel, Select, Self, Serializable, EnumSelf, Sendable, Serialize, SerialName, KSerializer, PrimitiveKind, SerialDescriptor, SerializerProvider, Set, Short, Signed, SimpleModule, Sizeof, Stackalloc, Standards, Static, StaticAssert, StaticCast, StdDeserializer, StdSerializer, Strictfp, String, Struct, Subscript, Super, Switch, Symbol, Synchronized, System, Template, Then, This, ThreadLocal, Throw, Throws, TimeOnly, TimeOnlyConverter, TimeZone, ToJson, TopLevel, ToString, ToDict, Transient, True, EnumTrue, Try, Type, EnumType, Typealias, Typedef, Typeid, Typename, Typeof, Uint, Ulong, Unchecked, Undefined, Union, UnmarshalJson, UseSerializers, Unowned, Unsafe, Unsigned, Ushort, Using, Utf8JsonReader, Utf8JsonWriter, Uuid, Var, Virtual, Void, Volatile, WcharT, Weak, Where, While, WillSet, With, Xor, XorEq, Yes, Yield, Dummy }; | |
| 32 | + public enum Enum { Empty, Bool, Complex, Imaginery, Abstract, Alignas, Alignof, And, AndEq, Any, EnumAny, Array, As, Asm, Assert, Associatedtype, Associativity, Async, Atomic, AtomicCancel, AtomicCommit, AtomicNoexcept, Auto, Await, Base, Bitand, Bitor, EnumBool, PurpleBool, Boolean, Break, Bycopy, Byref, Byte, Calendar, Case, Catch, Chan, Char, Char16T, Char32T, Checked, Class, EnumClass, Clone, CoAwait, CoReturn, CoYield, Codable, CodingKey, CodingKeys, Compl, Concept, Console, Const, ConstCast, Constexpr, Constructor, Continue, Convenience, Convert, Converter, CultureInfo, Date, DateParseHandling, DateFormatter, DateOnly, DateOnlyConverter, DateTime, DateTimeStyles, Debugger, Decimal, Declare, Decltype, DecodeString, Decoder, DecodingError, Def, Default, Defer, Deinit, Del, Delegate, Delete, Dict, Dictionary, DidSet, Do, Double, Dynamic, DynamicCast, Elif, Else, EncodeQuickType, Encoder, Enum, EnumValues, Equatable, EqualityContract, Event, Except, Exception, Explicit, Export, Exposing, Extends, Extension, Extern, Fallthrough, False, EnumFalse, Fileprivate, Final, Finally, Fixed, Float, For, Foreach, FormatException, Friend, From, FromDict, FromJson, Func, Function, Get, Global, Go, Goto, Guard, Hashable, HashCode, Hasher, HasOwnProperty, Id, If, Imp, Implements, Implicit, Import, In, Indirect, Infix, Init, Inline, Inout, Instanceof, Int, Interface, Internal, IsoDateTimeOffsetConverter, Iterable, Is, Jdec, Jenc, Jpipe, Json, JsonConverter, JsonSerializer, JsonToken, JsonWriter, JsonAny, JsonCodingKey, JsonDecoder, JsonEncoder, JsonException, JsonGenerator, JsonNode, JsonNull, JsonParser, JsonReader, JsonTokenType, Lambda, Lazy, Left, Let, List, Locale, Lock, Long, MakeDictEncoder, Map, MarshalJson, MapEntry, MetadataPropertyHandling, Module, Mutable, Mutating, Namespace, Native, New, Newtonsoft, Nil, No, Noexcept, Nonatomic, None, EnumNone, Nonlocal, Nonmutating, NsObject, NoSuchMethod, Not, NotEq, NsError, NsString, Null, EnumNull, Nullptr, Number, Object, ObjectMapper, Of, Oneway, Open, Operator, Optional, Or, OrEq, Out, Override, Package, Params, Pass, Port, Postfix, Precedence, Prefix, Print, Printf, PrintMembers, Private, Protected, Protocol, EnumProtocol, Public, Quicktype, Raise, Range, Readonly, Ref, RegExp, Register, ReinterpretCast, Repeat, Require, Required, Requires, Restrict, Retain, Rethrows, Return, Right, RuntimeType, S, Sbyte, Sealed, Sel, Select, Self, Serializable, EnumSelf, Sendable, Serialize, SerialName, KSerializer, PrimitiveKind, SerialDescriptor, SerializerProvider, Set, Short, Signed, SimpleModule, Sizeof, Stackalloc, Standards, Static, StaticAssert, StaticCast, StdDeserializer, StdSerializer, Strictfp, String, Struct, Subscript, Super, Switch, Symbol, Synchronized, System, Template, Then, This, ThreadLocal, Throw, Throws, TimeOnly, TimeOnlyConverter, TimeZone, ToJson, TopLevel, ToString, ToDict, Transient, True, EnumTrue, Try, Type, EnumType, Typealias, Typedef, Typeid, Typename, Typeof, Uint, Ulong, Unchecked, Undefined, Union, UnmarshalJson, UseSerializers, Unowned, Unsafe, Unsigned, Ushort, Using, Utf8JsonReader, Utf8JsonWriter, Uuid, Var, Virtual, Void, Volatile, WcharT, Weak, Where, While, WillSet, With, Xor, XorEq, Yes, Yield, Dummy }; | |
| 33 | 33 | |
| 34 | 34 | public partial class TopLevel |
| 35 | 35 | { |
| @@ -425,6 +425,8 @@ namespace QuickType | ||
| 425 | 425 | return Enum.Lock; |
| 426 | 426 | case "long": |
| 427 | 427 | return Enum.Long; |
| 428 | + case "makeDictEncoder": | |
| 429 | + return Enum.MakeDictEncoder; | |
| 428 | 430 | case "map": |
| 429 | 431 | return Enum.Map; |
| 430 | 432 | case "MarshalJSON": |
| @@ -1305,6 +1307,9 @@ namespace QuickType | ||
| 1305 | 1307 | case Enum.Long: |
| 1306 | 1308 | serializer.Serialize(writer, "long"); |
| 1307 | 1309 | return; |
| 1310 | + case Enum.MakeDictEncoder: | |
| 1311 | + serializer.Serialize(writer, "makeDictEncoder"); | |
| 1312 | + return; | |
| 1308 | 1313 | case Enum.Map: |
| 1309 | 1314 | serializer.Serialize(writer, "map"); |
| 1310 | 1315 | return; |
Mschema-dartdefault / TopLevel.dart+2 −0
| @@ -205,6 +205,7 @@ enum Enum { | ||
| 205 | 205 | LOCALE, |
| 206 | 206 | LOCK, |
| 207 | 207 | LONG, |
| 208 | + MAKE_DICT_ENCODER, | |
| 208 | 209 | MAP, |
| 209 | 210 | MARSHAL_JSON, |
| 210 | 211 | MAP_ENTRY, |
| @@ -551,6 +552,7 @@ final enumValues = EnumValues({ | ||
| 551 | 552 | "Locale": Enum.LOCALE, |
| 552 | 553 | "lock": Enum.LOCK, |
| 553 | 554 | "long": Enum.LONG, |
| 555 | + "makeDictEncoder": Enum.MAKE_DICT_ENCODER, | |
| 554 | 556 | "map": Enum.MAP, |
| 555 | 557 | "MarshalJSON": Enum.MARSHAL_JSON, |
| 556 | 558 | "MapEntry": Enum.MAP_ENTRY, |
Mschema-elixirdefault / QuickType.ex+1 −0
| @@ -187,6 +187,7 @@ defmodule EnumEnum do | ||
| 187 | 187 | :Locale, |
| 188 | 188 | :lock, |
| 189 | 189 | :long, |
| 190 | + :makeDictEncoder, | |
| 190 | 191 | :map, |
| 191 | 192 | :MarshalJSON, |
| 192 | 193 | :MapEntry, |
Mschema-elmdefault / QuickType.elm+3 −0
| @@ -208,6 +208,7 @@ type EnumEnum | ||
| 208 | 208 | | Locale |
| 209 | 209 | | Lock |
| 210 | 210 | | Long |
| 211 | + | MakeDictEncoder | |
| 211 | 212 | | Map |
| 212 | 213 | | MarshalJSON |
| 213 | 214 | | MapEntry |
| @@ -579,6 +580,7 @@ enumEnum = | ||
| 579 | 580 | "Locale" -> Jdec.succeed Locale |
| 580 | 581 | "lock" -> Jdec.succeed Lock |
| 581 | 582 | "long" -> Jdec.succeed Long |
| 583 | + "makeDictEncoder" -> Jdec.succeed MakeDictEncoder | |
| 582 | 584 | "map" -> Jdec.succeed Map |
| 583 | 585 | "MarshalJSON" -> Jdec.succeed MarshalJSON |
| 584 | 586 | "MapEntry" -> Jdec.succeed MapEntry |
| @@ -927,6 +929,7 @@ encodeEnumEnum x = case x of | ||
| 927 | 929 | Locale -> Jenc.string "Locale" |
| 928 | 930 | Lock -> Jenc.string "lock" |
| 929 | 931 | Long -> Jenc.string "long" |
| 932 | + MakeDictEncoder -> Jenc.string "makeDictEncoder" | |
| 930 | 933 | Map -> Jenc.string "map" |
| 931 | 934 | MarshalJSON -> Jenc.string "MarshalJSON" |
| 932 | 935 | MapEntry -> Jenc.string "MapEntry" |
Mschema-flowdefault / TopLevel.js+4 −2
| @@ -195,6 +195,7 @@ export type Enum = | ||
| 195 | 195 | | "Locale" |
| 196 | 196 | | "lock" |
| 197 | 197 | | "long" |
| 198 | + | "makeDictEncoder" | |
| 198 | 199 | | "map" |
| 199 | 200 | | "MarshalJSON" |
| 200 | 201 | | "MapEntry" |
| @@ -453,7 +454,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 453 | 454 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 454 | 455 | return invalidValue(l(ref || "object"), val, key, parent); |
| 455 | 456 | } |
| 456 | - const result: any = {}; | |
| 457 | + const result: any = Object.create(null); | |
| 457 | 458 | Object.getOwnPropertyNames(props).forEach(key => { |
| 458 | 459 | const prop = props[key]; |
| 459 | 460 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -464,7 +465,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 464 | 465 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 465 | 466 | } |
| 466 | 467 | }); |
| 467 | - return result; | |
| 468 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 468 | 469 | } |
| 469 | 470 | |
| 470 | 471 | if (typ === "any") return val; |
| @@ -728,6 +729,7 @@ const typeMap: any = { | ||
| 728 | 729 | "Locale", |
| 729 | 730 | "lock", |
| 730 | 731 | "long", |
| 732 | + "makeDictEncoder", | |
| 731 | 733 | "map", |
| 732 | 734 | "MarshalJSON", |
| 733 | 735 | "MapEntry", |
Mschema-golangdefault / quicktype.go+2 −1
| @@ -205,6 +205,7 @@ const ( | ||
| 205 | 205 | Locale EnumEnum = "Locale" |
| 206 | 206 | Lock EnumEnum = "lock" |
| 207 | 207 | Long EnumEnum = "long" |
| 208 | + MakeDictEncoder EnumEnum = "makeDictEncoder" | |
| 208 | 209 | Map EnumEnum = "map" |
| 209 | 210 | MarshalJSON EnumEnum = "MarshalJSON" |
| 210 | 211 | MapEntry EnumEnum = "MapEntry" |
| @@ -377,7 +378,7 @@ func (x *EnumEnum) UnmarshalJSON(data []byte) error { | ||
| 377 | 378 | var value string |
| 378 | 379 | if err := json.Unmarshal(data, &value); err != nil { return err } |
| 379 | 380 | switch EnumEnum(value) { |
| 380 | - case Empty, Bool, Complex, Imaginery, Abstract, Alignas, Alignof, And, AndEq, Any, EnumAny, Array, As, ASM, Assert, Associatedtype, Associativity, Async, Atomic, AtomicCancel, AtomicCommit, AtomicNoexcept, Auto, Await, Base, Bitand, Bitor, EnumBOOL, EnumBool, Boolean, Break, Bycopy, Byref, Byte, Calendar, Case, Catch, Chan, Char, Char16T, Char32T, Checked, Class, EnumClass, Clone, CoAwait, CoReturn, CoYield, Codable, CodingKey, CodingKeys, Compl, Concept, Console, Const, ConstCast, Constexpr, Constructor, Continue, Convenience, Convert, Converter, CultureInfo, Date, DateParseHandling, DateFormatter, DateOnly, DateOnlyConverter, DateTime, DateTimeStyles, Debugger, Decimal, Declare, Decltype, DecodeString, Decoder, DecodingError, Def, Default, Defer, Deinit, Del, Delegate, Delete, Dict, Dictionary, DidSet, Do, Double, Dynamic, DynamicCast, Elif, Else, EncodeQuickType, Encoder, Enum, EnumValues, Equatable, EqualityContract, Event, Except, Exception, Explicit, Export, Exposing, Extends, Extension, Extern, Fallthrough, False, EnumFalse, Fileprivate, Final, Finally, Fixed, Float, For, Foreach, FormatException, Friend, From, FromDict, FromJSON, Func, Function, Get, Global, Go, Goto, Guard, Hashable, HashCode, Hasher, HasOwnProperty, ID, If, Imp, Implements, Implicit, Import, In, Indirect, Infix, Init, Inline, Inout, Instanceof, Int, Interface, Internal, ISODateTimeOffsetConverter, Iterable, Is, Jdec, Jenc, Jpipe, JSON, JSONConverter, JSONSerializer, JSONToken, JSONWriter, JSONAny, JSONCodingKey, JSONDecoder, JSONEncoder, JSONException, JSONGenerator, JSONNode, JSONNull, JSONParser, JSONReader, JSONTokenType, Lambda, Lazy, Left, Let, List, Locale, Lock, Long, Map, MarshalJSON, MapEntry, MetadataPropertyHandling, Module, Mutable, Mutating, Namespace, Native, New, Newtonsoft, Nil, No, Noexcept, Nonatomic, None, EnumNone, Nonlocal, Nonmutating, NSObject, NoSuchMethod, Not, NotEq, NSError, NSString, Null, EnumNull, Nullptr, Number, Object, ObjectMapper, Of, Oneway, Open, Operator, Optional, Or, OrEq, Out, Override, Package, Params, Pass, Port, Postfix, Precedence, Prefix, Print, Printf, PrintMembers, Private, Protected, Protocol, EnumProtocol, Public, Quicktype, Raise, Range, Readonly, Ref, RegExp, Register, ReinterpretCast, Repeat, Require, Required, Requires, Restrict, Retain, Rethrows, Return, Right, RuntimeType, S, Sbyte, Sealed, Sel, Select, Self, Serializable, EnumSelf, Sendable, Serialize, SerialName, KSerializer, PrimitiveKind, SerialDescriptor, SerializerProvider, Set, Short, Signed, SimpleModule, Sizeof, Stackalloc, Standards, Static, StaticAssert, StaticCast, StdDeserializer, StdSerializer, Strictfp, String, Struct, Subscript, Super, Switch, Symbol, Synchronized, System, Template, Then, This, ThreadLocal, Throw, Throws, TimeOnly, TimeOnlyConverter, TimeZone, ToJSON, EnumTopLevel, ToString, ToDict, Transient, True, EnumTrue, Try, Type, EnumType, Typealias, Typedef, Typeid, Typename, Typeof, Uint, Ulong, Unchecked, Undefined, Union, UnmarshalJSON, UseSerializers, Unowned, Unsafe, Unsigned, Ushort, Using, Utf8JSONReader, Utf8JSONWriter, UUID, Var, Virtual, Void, Volatile, WcharT, Weak, Where, While, WillSet, With, Xor, XorEq, Yes, Yield, Dummy: *x = EnumEnum(value); return nil | |
| 381 | + case Empty, Bool, Complex, Imaginery, Abstract, Alignas, Alignof, And, AndEq, Any, EnumAny, Array, As, ASM, Assert, Associatedtype, Associativity, Async, Atomic, AtomicCancel, AtomicCommit, AtomicNoexcept, Auto, Await, Base, Bitand, Bitor, EnumBOOL, EnumBool, Boolean, Break, Bycopy, Byref, Byte, Calendar, Case, Catch, Chan, Char, Char16T, Char32T, Checked, Class, EnumClass, Clone, CoAwait, CoReturn, CoYield, Codable, CodingKey, CodingKeys, Compl, Concept, Console, Const, ConstCast, Constexpr, Constructor, Continue, Convenience, Convert, Converter, CultureInfo, Date, DateParseHandling, DateFormatter, DateOnly, DateOnlyConverter, DateTime, DateTimeStyles, Debugger, Decimal, Declare, Decltype, DecodeString, Decoder, DecodingError, Def, Default, Defer, Deinit, Del, Delegate, Delete, Dict, Dictionary, DidSet, Do, Double, Dynamic, DynamicCast, Elif, Else, EncodeQuickType, Encoder, Enum, EnumValues, Equatable, EqualityContract, Event, Except, Exception, Explicit, Export, Exposing, Extends, Extension, Extern, Fallthrough, False, EnumFalse, Fileprivate, Final, Finally, Fixed, Float, For, Foreach, FormatException, Friend, From, FromDict, FromJSON, Func, Function, Get, Global, Go, Goto, Guard, Hashable, HashCode, Hasher, HasOwnProperty, ID, If, Imp, Implements, Implicit, Import, In, Indirect, Infix, Init, Inline, Inout, Instanceof, Int, Interface, Internal, ISODateTimeOffsetConverter, Iterable, Is, Jdec, Jenc, Jpipe, JSON, JSONConverter, JSONSerializer, JSONToken, JSONWriter, JSONAny, JSONCodingKey, JSONDecoder, JSONEncoder, JSONException, JSONGenerator, JSONNode, JSONNull, JSONParser, JSONReader, JSONTokenType, Lambda, Lazy, Left, Let, List, Locale, Lock, Long, MakeDictEncoder, Map, MarshalJSON, MapEntry, MetadataPropertyHandling, Module, Mutable, Mutating, Namespace, Native, New, Newtonsoft, Nil, No, Noexcept, Nonatomic, None, EnumNone, Nonlocal, Nonmutating, NSObject, NoSuchMethod, Not, NotEq, NSError, NSString, Null, EnumNull, Nullptr, Number, Object, ObjectMapper, Of, Oneway, Open, Operator, Optional, Or, OrEq, Out, Override, Package, Params, Pass, Port, Postfix, Precedence, Prefix, Print, Printf, PrintMembers, Private, Protected, Protocol, EnumProtocol, Public, Quicktype, Raise, Range, Readonly, Ref, RegExp, Register, ReinterpretCast, Repeat, Require, Required, Requires, Restrict, Retain, Rethrows, Return, Right, RuntimeType, S, Sbyte, Sealed, Sel, Select, Self, Serializable, EnumSelf, Sendable, Serialize, SerialName, KSerializer, PrimitiveKind, SerialDescriptor, SerializerProvider, Set, Short, Signed, SimpleModule, Sizeof, Stackalloc, Standards, Static, StaticAssert, StaticCast, StdDeserializer, StdSerializer, Strictfp, String, Struct, Subscript, Super, Switch, Symbol, Synchronized, System, Template, Then, This, ThreadLocal, Throw, Throws, TimeOnly, TimeOnlyConverter, TimeZone, ToJSON, EnumTopLevel, ToString, ToDict, Transient, True, EnumTrue, Try, Type, EnumType, Typealias, Typedef, Typeid, Typename, Typeof, Uint, Ulong, Unchecked, Undefined, Union, UnmarshalJSON, UseSerializers, Unowned, Unsafe, Unsigned, Ushort, Using, Utf8JSONReader, Utf8JSONWriter, UUID, Var, Virtual, Void, Volatile, WcharT, Weak, Where, While, WillSet, With, Xor, XorEq, Yes, Yield, Dummy: *x = EnumEnum(value); return nil | |
| 381 | 382 | } |
| 382 | 383 | return invalidEnumEnum(value) |
| 383 | 384 | } |
Mschema-haskelldefault / QuickType.hs+3 −0
| @@ -198,6 +198,7 @@ data EnumEnum | ||
| 198 | 198 | | LocaleEnumEnum |
| 199 | 199 | | LockEnumEnum |
| 200 | 200 | | LongEnumEnum |
| 201 | + | MakeDictEncoderEnumEnum | |
| 201 | 202 | | MapEnumEnum |
| 202 | 203 | | MarshalJSONEnumEnum |
| 203 | 204 | | MapEntryEnumEnum |
| @@ -557,6 +558,7 @@ instance ToJSON EnumEnum where | ||
| 557 | 558 | toJSON LocaleEnumEnum = "Locale" |
| 558 | 559 | toJSON LockEnumEnum = "lock" |
| 559 | 560 | toJSON LongEnumEnum = "long" |
| 561 | + toJSON MakeDictEncoderEnumEnum = "makeDictEncoder" | |
| 560 | 562 | toJSON MapEnumEnum = "map" |
| 561 | 563 | toJSON MarshalJSONEnumEnum = "MarshalJSON" |
| 562 | 564 | toJSON MapEntryEnumEnum = "MapEntry" |
| @@ -904,6 +906,7 @@ instance FromJSON EnumEnum where | ||
| 904 | 906 | parseText "Locale" = return LocaleEnumEnum |
| 905 | 907 | parseText "lock" = return LockEnumEnum |
| 906 | 908 | parseText "long" = return LongEnumEnum |
| 909 | + parseText "makeDictEncoder" = return MakeDictEncoderEnumEnum | |
| 907 | 910 | parseText "map" = return MapEnumEnum |
| 908 | 911 | parseText "MarshalJSON" = return MarshalJSONEnumEnum |
| 909 | 912 | parseText "MapEntry" = return MapEntryEnumEnum |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / Enum.java+3 −1
| @@ -4,7 +4,7 @@ import java.io.IOException; | ||
| 4 | 4 | import com.fasterxml.jackson.annotation.*; |
| 5 | 5 | |
| 6 | 6 | public enum Enum { |
| 7 | - EMPTY, BOOL, COMPLEX, IMAGINERY, ABSTRACT, ALIGNAS, ALIGNOF, AND, AND_EQ, ANY, ENUM_ANY, ARRAY, AS, ASM, ASSERT, ASSOCIATEDTYPE, ASSOCIATIVITY, ASYNC, ATOMIC, ATOMIC_CANCEL, ATOMIC_COMMIT, ATOMIC_NOEXCEPT, AUTO, AWAIT, BASE, BITAND, BITOR, ENUM_BOOL, PURPLE_BOOL, BOOLEAN, BREAK, BYCOPY, BYREF, BYTE, CALENDAR, CASE, CATCH, CHAN, CHAR, CHAR16_T, CHAR32_T, CHECKED, CLASS, ENUM_CLASS, CLONE, CO_AWAIT, CO_RETURN, CO_YIELD, CODABLE, CODING_KEY, CODING_KEYS, COMPL, CONCEPT, CONSOLE, CONST, CONST_CAST, CONSTEXPR, CONSTRUCTOR, CONTINUE, CONVENIENCE, CONVERT, CONVERTER, CULTURE_INFO, DATE, DATE_PARSE_HANDLING, DATE_FORMATTER, DATE_ONLY, DATE_ONLY_CONVERTER, DATE_TIME, DATE_TIME_STYLES, DEBUGGER, DECIMAL, DECLARE, DECLTYPE, DECODE_STRING, DECODER, DECODING_ERROR, DEF, DEFAULT, DEFER, DEINIT, DEL, DELEGATE, DELETE, DICT, DICTIONARY, DID_SET, DO, DOUBLE, DYNAMIC, DYNAMIC_CAST, ELIF, ELSE, ENCODE_QUICK_TYPE, ENCODER, ENUM, ENUM_VALUES, EQUATABLE, EQUALITY_CONTRACT, EVENT, EXCEPT, EXCEPTION, EXPLICIT, EXPORT, EXPOSING, EXTENDS, EXTENSION, EXTERN, FALLTHROUGH, FALSE, ENUM_FALSE, FILEPRIVATE, FINAL, FINALLY, FIXED, FLOAT, FOR, FOREACH, FORMAT_EXCEPTION, FRIEND, FROM, FROM_DICT, FROM_JSON, FUNC, FUNCTION, GET, GLOBAL, GO, GOTO, GUARD, HASHABLE, HASH_CODE, HASHER, HAS_OWN_PROPERTY, ID, IF, IMP, IMPLEMENTS, IMPLICIT, IMPORT, IN, INDIRECT, INFIX, INIT, INLINE, INOUT, INSTANCEOF, INT, INTERFACE, INTERNAL, ISO_DATE_TIME_OFFSET_CONVERTER, ITERABLE, IS, JDEC, JENC, JPIPE, JSON, JSON_CONVERTER, JSON_SERIALIZER, JSON_TOKEN, JSON_WRITER, JSON_ANY, JSON_CODING_KEY, JSON_DECODER, JSON_ENCODER, JSON_EXCEPTION, JSON_GENERATOR, JSON_NODE, JSON_NULL, JSON_PARSER, JSON_READER, JSON_TOKEN_TYPE, LAMBDA, LAZY, LEFT, LET, LIST, LOCALE, LOCK, LONG, MAP, MARSHAL_JSON, MAP_ENTRY, METADATA_PROPERTY_HANDLING, MODULE, MUTABLE, MUTATING, NAMESPACE, NATIVE, NEW, NEWTONSOFT, NIL, NO, NOEXCEPT, NONATOMIC, NONE, ENUM_NONE, NONLOCAL, NONMUTATING, NS_OBJECT, NO_SUCH_METHOD, NOT, NOT_EQ, NS_ERROR, NS_STRING, NULL, ENUM_NULL, NULLPTR, NUMBER, OBJECT, OBJECT_MAPPER, OF, ONEWAY, OPEN, OPERATOR, OPTIONAL, OR, OR_EQ, OUT, OVERRIDE, PACKAGE, PARAMS, PASS, PORT, POSTFIX, PRECEDENCE, PREFIX, PRINT, PRINTF, PRINT_MEMBERS, PRIVATE, PROTECTED, PROTOCOL, ENUM_PROTOCOL, PUBLIC, QUICKTYPE, RAISE, RANGE, READONLY, REF, REG_EXP, REGISTER, REINTERPRET_CAST, REPEAT, REQUIRE, REQUIRED, REQUIRES, RESTRICT, RETAIN, RETHROWS, RETURN, RIGHT, RUNTIME_TYPE, S, SBYTE, SEALED, SEL, SELECT, SELF, SERIALIZABLE, ENUM_SELF, SENDABLE, SERIALIZE, SERIAL_NAME, K_SERIALIZER, PRIMITIVE_KIND, SERIAL_DESCRIPTOR, SERIALIZER_PROVIDER, SET, SHORT, SIGNED, SIMPLE_MODULE, SIZEOF, STACKALLOC, STANDARDS, STATIC, STATIC_ASSERT, STATIC_CAST, STD_DESERIALIZER, STD_SERIALIZER, STRICTFP, STRING, STRUCT, SUBSCRIPT, SUPER, SWITCH, SYMBOL, SYNCHRONIZED, SYSTEM, TEMPLATE, THEN, THIS, THREAD_LOCAL, THROW, THROWS, TIME_ONLY, TIME_ONLY_CONVERTER, TIME_ZONE, TO_JSON, TOP_LEVEL, TO_STRING, TO_DICT, TRANSIENT, TRUE, ENUM_TRUE, TRY, TYPE, ENUM_TYPE, TYPEALIAS, TYPEDEF, TYPEID, TYPENAME, TYPEOF, UINT, ULONG, UNCHECKED, UNDEFINED, UNION, UNMARSHAL_JSON, USE_SERIALIZERS, UNOWNED, UNSAFE, UNSIGNED, USHORT, USING, UTF8_JSON_READER, UTF8_JSON_WRITER, UUID, VAR, VIRTUAL, VOID, VOLATILE, WCHAR_T, WEAK, WHERE, WHILE, WILL_SET, WITH, XOR, XOR_EQ, YES, YIELD, DUMMY; | |
| 7 | + EMPTY, BOOL, COMPLEX, IMAGINERY, ABSTRACT, ALIGNAS, ALIGNOF, AND, AND_EQ, ANY, ENUM_ANY, ARRAY, AS, ASM, ASSERT, ASSOCIATEDTYPE, ASSOCIATIVITY, ASYNC, ATOMIC, ATOMIC_CANCEL, ATOMIC_COMMIT, ATOMIC_NOEXCEPT, AUTO, AWAIT, BASE, BITAND, BITOR, ENUM_BOOL, PURPLE_BOOL, BOOLEAN, BREAK, BYCOPY, BYREF, BYTE, CALENDAR, CASE, CATCH, CHAN, CHAR, CHAR16_T, CHAR32_T, CHECKED, CLASS, ENUM_CLASS, CLONE, CO_AWAIT, CO_RETURN, CO_YIELD, CODABLE, CODING_KEY, CODING_KEYS, COMPL, CONCEPT, CONSOLE, CONST, CONST_CAST, CONSTEXPR, CONSTRUCTOR, CONTINUE, CONVENIENCE, CONVERT, CONVERTER, CULTURE_INFO, DATE, DATE_PARSE_HANDLING, DATE_FORMATTER, DATE_ONLY, DATE_ONLY_CONVERTER, DATE_TIME, DATE_TIME_STYLES, DEBUGGER, DECIMAL, DECLARE, DECLTYPE, DECODE_STRING, DECODER, DECODING_ERROR, DEF, DEFAULT, DEFER, DEINIT, DEL, DELEGATE, DELETE, DICT, DICTIONARY, DID_SET, DO, DOUBLE, DYNAMIC, DYNAMIC_CAST, ELIF, ELSE, ENCODE_QUICK_TYPE, ENCODER, ENUM, ENUM_VALUES, EQUATABLE, EQUALITY_CONTRACT, EVENT, EXCEPT, EXCEPTION, EXPLICIT, EXPORT, EXPOSING, EXTENDS, EXTENSION, EXTERN, FALLTHROUGH, FALSE, ENUM_FALSE, FILEPRIVATE, FINAL, FINALLY, FIXED, FLOAT, FOR, FOREACH, FORMAT_EXCEPTION, FRIEND, FROM, FROM_DICT, FROM_JSON, FUNC, FUNCTION, GET, GLOBAL, GO, GOTO, GUARD, HASHABLE, HASH_CODE, HASHER, HAS_OWN_PROPERTY, ID, IF, IMP, IMPLEMENTS, IMPLICIT, IMPORT, IN, INDIRECT, INFIX, INIT, INLINE, INOUT, INSTANCEOF, INT, INTERFACE, INTERNAL, ISO_DATE_TIME_OFFSET_CONVERTER, ITERABLE, IS, JDEC, JENC, JPIPE, JSON, JSON_CONVERTER, JSON_SERIALIZER, JSON_TOKEN, JSON_WRITER, JSON_ANY, JSON_CODING_KEY, JSON_DECODER, JSON_ENCODER, JSON_EXCEPTION, JSON_GENERATOR, JSON_NODE, JSON_NULL, JSON_PARSER, JSON_READER, JSON_TOKEN_TYPE, LAMBDA, LAZY, LEFT, LET, LIST, LOCALE, LOCK, LONG, MAKE_DICT_ENCODER, MAP, MARSHAL_JSON, MAP_ENTRY, METADATA_PROPERTY_HANDLING, MODULE, MUTABLE, MUTATING, NAMESPACE, NATIVE, NEW, NEWTONSOFT, NIL, NO, NOEXCEPT, NONATOMIC, NONE, ENUM_NONE, NONLOCAL, NONMUTATING, NS_OBJECT, NO_SUCH_METHOD, NOT, NOT_EQ, NS_ERROR, NS_STRING, NULL, ENUM_NULL, NULLPTR, NUMBER, OBJECT, OBJECT_MAPPER, OF, ONEWAY, OPEN, OPERATOR, OPTIONAL, OR, OR_EQ, OUT, OVERRIDE, PACKAGE, PARAMS, PASS, PORT, POSTFIX, PRECEDENCE, PREFIX, PRINT, PRINTF, PRINT_MEMBERS, PRIVATE, PROTECTED, PROTOCOL, ENUM_PROTOCOL, PUBLIC, QUICKTYPE, RAISE, RANGE, READONLY, REF, REG_EXP, REGISTER, REINTERPRET_CAST, REPEAT, REQUIRE, REQUIRED, REQUIRES, RESTRICT, RETAIN, RETHROWS, RETURN, RIGHT, RUNTIME_TYPE, S, SBYTE, SEALED, SEL, SELECT, SELF, SERIALIZABLE, ENUM_SELF, SENDABLE, SERIALIZE, SERIAL_NAME, K_SERIALIZER, PRIMITIVE_KIND, SERIAL_DESCRIPTOR, SERIALIZER_PROVIDER, SET, SHORT, SIGNED, SIMPLE_MODULE, SIZEOF, STACKALLOC, STANDARDS, STATIC, STATIC_ASSERT, STATIC_CAST, STD_DESERIALIZER, STD_SERIALIZER, STRICTFP, STRING, STRUCT, SUBSCRIPT, SUPER, SWITCH, SYMBOL, SYNCHRONIZED, SYSTEM, TEMPLATE, THEN, THIS, THREAD_LOCAL, THROW, THROWS, TIME_ONLY, TIME_ONLY_CONVERTER, TIME_ZONE, TO_JSON, TOP_LEVEL, TO_STRING, TO_DICT, TRANSIENT, TRUE, ENUM_TRUE, TRY, TYPE, ENUM_TYPE, TYPEALIAS, TYPEDEF, TYPEID, TYPENAME, TYPEOF, UINT, ULONG, UNCHECKED, UNDEFINED, UNION, UNMARSHAL_JSON, USE_SERIALIZERS, UNOWNED, UNSAFE, UNSIGNED, USHORT, USING, UTF8_JSON_READER, UTF8_JSON_WRITER, UUID, VAR, VIRTUAL, VOID, VOLATILE, WCHAR_T, WEAK, WHERE, WHILE, WILL_SET, WITH, XOR, XOR_EQ, YES, YIELD, DUMMY; | |
| 8 | 8 | |
| 9 | 9 | @JsonValue |
| 10 | 10 | public String toValue() { |
| @@ -189,6 +189,7 @@ public enum Enum { | ||
| 189 | 189 | case LOCALE: return "Locale"; |
| 190 | 190 | case LOCK: return "lock"; |
| 191 | 191 | case LONG: return "long"; |
| 192 | + case MAKE_DICT_ENCODER: return "makeDictEncoder"; | |
| 192 | 193 | case MAP: return "map"; |
| 193 | 194 | case MARSHAL_JSON: return "MarshalJSON"; |
| 194 | 195 | case MAP_ENTRY: return "MapEntry"; |
| @@ -538,6 +539,7 @@ public enum Enum { | ||
| 538 | 539 | if (value.equals("Locale")) return LOCALE; |
| 539 | 540 | if (value.equals("lock")) return LOCK; |
| 540 | 541 | if (value.equals("long")) return LONG; |
| 542 | + if (value.equals("makeDictEncoder")) return MAKE_DICT_ENCODER; | |
| 541 | 543 | if (value.equals("map")) return MAP; |
| 542 | 544 | if (value.equals("MarshalJSON")) return MARSHAL_JSON; |
| 543 | 545 | if (value.equals("MapEntry")) return MAP_ENTRY; |
Mschema-java-lombokdefault / src / main / java / io / quicktype / Enum.java+3 −1
| @@ -4,7 +4,7 @@ import java.io.IOException; | ||
| 4 | 4 | import com.fasterxml.jackson.annotation.*; |
| 5 | 5 | |
| 6 | 6 | public enum Enum { |
| 7 | - EMPTY, BOOL, COMPLEX, IMAGINERY, ABSTRACT, ALIGNAS, ALIGNOF, AND, AND_EQ, ANY, ENUM_ANY, ARRAY, AS, ASM, ASSERT, ASSOCIATEDTYPE, ASSOCIATIVITY, ASYNC, ATOMIC, ATOMIC_CANCEL, ATOMIC_COMMIT, ATOMIC_NOEXCEPT, AUTO, AWAIT, BASE, BITAND, BITOR, ENUM_BOOL, PURPLE_BOOL, BOOLEAN, BREAK, BYCOPY, BYREF, BYTE, CALENDAR, CASE, CATCH, CHAN, CHAR, CHAR16_T, CHAR32_T, CHECKED, CLASS, ENUM_CLASS, CLONE, CO_AWAIT, CO_RETURN, CO_YIELD, CODABLE, CODING_KEY, CODING_KEYS, COMPL, CONCEPT, CONSOLE, CONST, CONST_CAST, CONSTEXPR, CONSTRUCTOR, CONTINUE, CONVENIENCE, CONVERT, CONVERTER, CULTURE_INFO, DATE, DATE_PARSE_HANDLING, DATE_FORMATTER, DATE_ONLY, DATE_ONLY_CONVERTER, DATE_TIME, DATE_TIME_STYLES, DEBUGGER, DECIMAL, DECLARE, DECLTYPE, DECODE_STRING, DECODER, DECODING_ERROR, DEF, DEFAULT, DEFER, DEINIT, DEL, DELEGATE, DELETE, DICT, DICTIONARY, DID_SET, DO, DOUBLE, DYNAMIC, DYNAMIC_CAST, ELIF, ELSE, ENCODE_QUICK_TYPE, ENCODER, ENUM, ENUM_VALUES, EQUATABLE, EQUALITY_CONTRACT, EVENT, EXCEPT, EXCEPTION, EXPLICIT, EXPORT, EXPOSING, EXTENDS, EXTENSION, EXTERN, FALLTHROUGH, FALSE, ENUM_FALSE, FILEPRIVATE, FINAL, FINALLY, FIXED, FLOAT, FOR, FOREACH, FORMAT_EXCEPTION, FRIEND, FROM, FROM_DICT, FROM_JSON, FUNC, FUNCTION, GET, GLOBAL, GO, GOTO, GUARD, HASHABLE, HASH_CODE, HASHER, HAS_OWN_PROPERTY, ID, IF, IMP, IMPLEMENTS, IMPLICIT, IMPORT, IN, INDIRECT, INFIX, INIT, INLINE, INOUT, INSTANCEOF, INT, INTERFACE, INTERNAL, ISO_DATE_TIME_OFFSET_CONVERTER, ITERABLE, IS, JDEC, JENC, JPIPE, JSON, JSON_CONVERTER, JSON_SERIALIZER, JSON_TOKEN, JSON_WRITER, JSON_ANY, JSON_CODING_KEY, JSON_DECODER, JSON_ENCODER, JSON_EXCEPTION, JSON_GENERATOR, JSON_NODE, JSON_NULL, JSON_PARSER, JSON_READER, JSON_TOKEN_TYPE, LAMBDA, LAZY, LEFT, LET, LIST, LOCALE, LOCK, LONG, MAP, MARSHAL_JSON, MAP_ENTRY, METADATA_PROPERTY_HANDLING, MODULE, MUTABLE, MUTATING, NAMESPACE, NATIVE, NEW, NEWTONSOFT, NIL, NO, NOEXCEPT, NONATOMIC, NONE, ENUM_NONE, NONLOCAL, NONMUTATING, NS_OBJECT, NO_SUCH_METHOD, NOT, NOT_EQ, NS_ERROR, NS_STRING, NULL, ENUM_NULL, NULLPTR, NUMBER, OBJECT, OBJECT_MAPPER, OF, ONEWAY, OPEN, OPERATOR, OPTIONAL, OR, OR_EQ, OUT, OVERRIDE, PACKAGE, PARAMS, PASS, PORT, POSTFIX, PRECEDENCE, PREFIX, PRINT, PRINTF, PRINT_MEMBERS, PRIVATE, PROTECTED, PROTOCOL, ENUM_PROTOCOL, PUBLIC, QUICKTYPE, RAISE, RANGE, READONLY, REF, REG_EXP, REGISTER, REINTERPRET_CAST, REPEAT, REQUIRE, REQUIRED, REQUIRES, RESTRICT, RETAIN, RETHROWS, RETURN, RIGHT, RUNTIME_TYPE, S, SBYTE, SEALED, SEL, SELECT, SELF, SERIALIZABLE, ENUM_SELF, SENDABLE, SERIALIZE, SERIAL_NAME, K_SERIALIZER, PRIMITIVE_KIND, SERIAL_DESCRIPTOR, SERIALIZER_PROVIDER, SET, SHORT, SIGNED, SIMPLE_MODULE, SIZEOF, STACKALLOC, STANDARDS, STATIC, STATIC_ASSERT, STATIC_CAST, STD_DESERIALIZER, STD_SERIALIZER, STRICTFP, STRING, STRUCT, SUBSCRIPT, SUPER, SWITCH, SYMBOL, SYNCHRONIZED, SYSTEM, TEMPLATE, THEN, THIS, THREAD_LOCAL, THROW, THROWS, TIME_ONLY, TIME_ONLY_CONVERTER, TIME_ZONE, TO_JSON, TOP_LEVEL, TO_STRING, TO_DICT, TRANSIENT, TRUE, ENUM_TRUE, TRY, TYPE, ENUM_TYPE, TYPEALIAS, TYPEDEF, TYPEID, TYPENAME, TYPEOF, UINT, ULONG, UNCHECKED, UNDEFINED, UNION, UNMARSHAL_JSON, USE_SERIALIZERS, UNOWNED, UNSAFE, UNSIGNED, USHORT, USING, UTF8_JSON_READER, UTF8_JSON_WRITER, UUID, VAR, VIRTUAL, VOID, VOLATILE, WCHAR_T, WEAK, WHERE, WHILE, WILL_SET, WITH, XOR, XOR_EQ, YES, YIELD, DUMMY; | |
| 7 | + EMPTY, BOOL, COMPLEX, IMAGINERY, ABSTRACT, ALIGNAS, ALIGNOF, AND, AND_EQ, ANY, ENUM_ANY, ARRAY, AS, ASM, ASSERT, ASSOCIATEDTYPE, ASSOCIATIVITY, ASYNC, ATOMIC, ATOMIC_CANCEL, ATOMIC_COMMIT, ATOMIC_NOEXCEPT, AUTO, AWAIT, BASE, BITAND, BITOR, ENUM_BOOL, PURPLE_BOOL, BOOLEAN, BREAK, BYCOPY, BYREF, BYTE, CALENDAR, CASE, CATCH, CHAN, CHAR, CHAR16_T, CHAR32_T, CHECKED, CLASS, ENUM_CLASS, CLONE, CO_AWAIT, CO_RETURN, CO_YIELD, CODABLE, CODING_KEY, CODING_KEYS, COMPL, CONCEPT, CONSOLE, CONST, CONST_CAST, CONSTEXPR, CONSTRUCTOR, CONTINUE, CONVENIENCE, CONVERT, CONVERTER, CULTURE_INFO, DATE, DATE_PARSE_HANDLING, DATE_FORMATTER, DATE_ONLY, DATE_ONLY_CONVERTER, DATE_TIME, DATE_TIME_STYLES, DEBUGGER, DECIMAL, DECLARE, DECLTYPE, DECODE_STRING, DECODER, DECODING_ERROR, DEF, DEFAULT, DEFER, DEINIT, DEL, DELEGATE, DELETE, DICT, DICTIONARY, DID_SET, DO, DOUBLE, DYNAMIC, DYNAMIC_CAST, ELIF, ELSE, ENCODE_QUICK_TYPE, ENCODER, ENUM, ENUM_VALUES, EQUATABLE, EQUALITY_CONTRACT, EVENT, EXCEPT, EXCEPTION, EXPLICIT, EXPORT, EXPOSING, EXTENDS, EXTENSION, EXTERN, FALLTHROUGH, FALSE, ENUM_FALSE, FILEPRIVATE, FINAL, FINALLY, FIXED, FLOAT, FOR, FOREACH, FORMAT_EXCEPTION, FRIEND, FROM, FROM_DICT, FROM_JSON, FUNC, FUNCTION, GET, GLOBAL, GO, GOTO, GUARD, HASHABLE, HASH_CODE, HASHER, HAS_OWN_PROPERTY, ID, IF, IMP, IMPLEMENTS, IMPLICIT, IMPORT, IN, INDIRECT, INFIX, INIT, INLINE, INOUT, INSTANCEOF, INT, INTERFACE, INTERNAL, ISO_DATE_TIME_OFFSET_CONVERTER, ITERABLE, IS, JDEC, JENC, JPIPE, JSON, JSON_CONVERTER, JSON_SERIALIZER, JSON_TOKEN, JSON_WRITER, JSON_ANY, JSON_CODING_KEY, JSON_DECODER, JSON_ENCODER, JSON_EXCEPTION, JSON_GENERATOR, JSON_NODE, JSON_NULL, JSON_PARSER, JSON_READER, JSON_TOKEN_TYPE, LAMBDA, LAZY, LEFT, LET, LIST, LOCALE, LOCK, LONG, MAKE_DICT_ENCODER, MAP, MARSHAL_JSON, MAP_ENTRY, METADATA_PROPERTY_HANDLING, MODULE, MUTABLE, MUTATING, NAMESPACE, NATIVE, NEW, NEWTONSOFT, NIL, NO, NOEXCEPT, NONATOMIC, NONE, ENUM_NONE, NONLOCAL, NONMUTATING, NS_OBJECT, NO_SUCH_METHOD, NOT, NOT_EQ, NS_ERROR, NS_STRING, NULL, ENUM_NULL, NULLPTR, NUMBER, OBJECT, OBJECT_MAPPER, OF, ONEWAY, OPEN, OPERATOR, OPTIONAL, OR, OR_EQ, OUT, OVERRIDE, PACKAGE, PARAMS, PASS, PORT, POSTFIX, PRECEDENCE, PREFIX, PRINT, PRINTF, PRINT_MEMBERS, PRIVATE, PROTECTED, PROTOCOL, ENUM_PROTOCOL, PUBLIC, QUICKTYPE, RAISE, RANGE, READONLY, REF, REG_EXP, REGISTER, REINTERPRET_CAST, REPEAT, REQUIRE, REQUIRED, REQUIRES, RESTRICT, RETAIN, RETHROWS, RETURN, RIGHT, RUNTIME_TYPE, S, SBYTE, SEALED, SEL, SELECT, SELF, SERIALIZABLE, ENUM_SELF, SENDABLE, SERIALIZE, SERIAL_NAME, K_SERIALIZER, PRIMITIVE_KIND, SERIAL_DESCRIPTOR, SERIALIZER_PROVIDER, SET, SHORT, SIGNED, SIMPLE_MODULE, SIZEOF, STACKALLOC, STANDARDS, STATIC, STATIC_ASSERT, STATIC_CAST, STD_DESERIALIZER, STD_SERIALIZER, STRICTFP, STRING, STRUCT, SUBSCRIPT, SUPER, SWITCH, SYMBOL, SYNCHRONIZED, SYSTEM, TEMPLATE, THEN, THIS, THREAD_LOCAL, THROW, THROWS, TIME_ONLY, TIME_ONLY_CONVERTER, TIME_ZONE, TO_JSON, TOP_LEVEL, TO_STRING, TO_DICT, TRANSIENT, TRUE, ENUM_TRUE, TRY, TYPE, ENUM_TYPE, TYPEALIAS, TYPEDEF, TYPEID, TYPENAME, TYPEOF, UINT, ULONG, UNCHECKED, UNDEFINED, UNION, UNMARSHAL_JSON, USE_SERIALIZERS, UNOWNED, UNSAFE, UNSIGNED, USHORT, USING, UTF8_JSON_READER, UTF8_JSON_WRITER, UUID, VAR, VIRTUAL, VOID, VOLATILE, WCHAR_T, WEAK, WHERE, WHILE, WILL_SET, WITH, XOR, XOR_EQ, YES, YIELD, DUMMY; | |
| 8 | 8 | |
| 9 | 9 | @JsonValue |
| 10 | 10 | public String toValue() { |
| @@ -189,6 +189,7 @@ public enum Enum { | ||
| 189 | 189 | case LOCALE: return "Locale"; |
| 190 | 190 | case LOCK: return "lock"; |
| 191 | 191 | case LONG: return "long"; |
| 192 | + case MAKE_DICT_ENCODER: return "makeDictEncoder"; | |
| 192 | 193 | case MAP: return "map"; |
| 193 | 194 | case MARSHAL_JSON: return "MarshalJSON"; |
| 194 | 195 | case MAP_ENTRY: return "MapEntry"; |
| @@ -538,6 +539,7 @@ public enum Enum { | ||
| 538 | 539 | if (value.equals("Locale")) return LOCALE; |
| 539 | 540 | if (value.equals("lock")) return LOCK; |
| 540 | 541 | if (value.equals("long")) return LONG; |
| 542 | + if (value.equals("makeDictEncoder")) return MAKE_DICT_ENCODER; | |
| 541 | 543 | if (value.equals("map")) return MAP; |
| 542 | 544 | if (value.equals("MarshalJSON")) return MARSHAL_JSON; |
| 543 | 545 | if (value.equals("MapEntry")) return MAP_ENTRY; |
Mschema-javadefault / src / main / java / io / quicktype / Enum.java+3 −1
| @@ -4,7 +4,7 @@ import java.io.IOException; | ||
| 4 | 4 | import com.fasterxml.jackson.annotation.*; |
| 5 | 5 | |
| 6 | 6 | public enum Enum { |
| 7 | - EMPTY, BOOL, COMPLEX, IMAGINERY, ABSTRACT, ALIGNAS, ALIGNOF, AND, AND_EQ, ANY, ENUM_ANY, ARRAY, AS, ASM, ASSERT, ASSOCIATEDTYPE, ASSOCIATIVITY, ASYNC, ATOMIC, ATOMIC_CANCEL, ATOMIC_COMMIT, ATOMIC_NOEXCEPT, AUTO, AWAIT, BASE, BITAND, BITOR, ENUM_BOOL, PURPLE_BOOL, BOOLEAN, BREAK, BYCOPY, BYREF, BYTE, CALENDAR, CASE, CATCH, CHAN, CHAR, CHAR16_T, CHAR32_T, CHECKED, CLASS, ENUM_CLASS, CLONE, CO_AWAIT, CO_RETURN, CO_YIELD, CODABLE, CODING_KEY, CODING_KEYS, COMPL, CONCEPT, CONSOLE, CONST, CONST_CAST, CONSTEXPR, CONSTRUCTOR, CONTINUE, CONVENIENCE, CONVERT, CONVERTER, CULTURE_INFO, DATE, DATE_PARSE_HANDLING, DATE_FORMATTER, DATE_ONLY, DATE_ONLY_CONVERTER, DATE_TIME, DATE_TIME_STYLES, DEBUGGER, DECIMAL, DECLARE, DECLTYPE, DECODE_STRING, DECODER, DECODING_ERROR, DEF, DEFAULT, DEFER, DEINIT, DEL, DELEGATE, DELETE, DICT, DICTIONARY, DID_SET, DO, DOUBLE, DYNAMIC, DYNAMIC_CAST, ELIF, ELSE, ENCODE_QUICK_TYPE, ENCODER, ENUM, ENUM_VALUES, EQUATABLE, EQUALITY_CONTRACT, EVENT, EXCEPT, EXCEPTION, EXPLICIT, EXPORT, EXPOSING, EXTENDS, EXTENSION, EXTERN, FALLTHROUGH, FALSE, ENUM_FALSE, FILEPRIVATE, FINAL, FINALLY, FIXED, FLOAT, FOR, FOREACH, FORMAT_EXCEPTION, FRIEND, FROM, FROM_DICT, FROM_JSON, FUNC, FUNCTION, GET, GLOBAL, GO, GOTO, GUARD, HASHABLE, HASH_CODE, HASHER, HAS_OWN_PROPERTY, ID, IF, IMP, IMPLEMENTS, IMPLICIT, IMPORT, IN, INDIRECT, INFIX, INIT, INLINE, INOUT, INSTANCEOF, INT, INTERFACE, INTERNAL, ISO_DATE_TIME_OFFSET_CONVERTER, ITERABLE, IS, JDEC, JENC, JPIPE, JSON, JSON_CONVERTER, JSON_SERIALIZER, JSON_TOKEN, JSON_WRITER, JSON_ANY, JSON_CODING_KEY, JSON_DECODER, JSON_ENCODER, JSON_EXCEPTION, JSON_GENERATOR, JSON_NODE, JSON_NULL, JSON_PARSER, JSON_READER, JSON_TOKEN_TYPE, LAMBDA, LAZY, LEFT, LET, LIST, LOCALE, LOCK, LONG, MAP, MARSHAL_JSON, MAP_ENTRY, METADATA_PROPERTY_HANDLING, MODULE, MUTABLE, MUTATING, NAMESPACE, NATIVE, NEW, NEWTONSOFT, NIL, NO, NOEXCEPT, NONATOMIC, NONE, ENUM_NONE, NONLOCAL, NONMUTATING, NS_OBJECT, NO_SUCH_METHOD, NOT, NOT_EQ, NS_ERROR, NS_STRING, NULL, ENUM_NULL, NULLPTR, NUMBER, OBJECT, OBJECT_MAPPER, OF, ONEWAY, OPEN, OPERATOR, OPTIONAL, OR, OR_EQ, OUT, OVERRIDE, PACKAGE, PARAMS, PASS, PORT, POSTFIX, PRECEDENCE, PREFIX, PRINT, PRINTF, PRINT_MEMBERS, PRIVATE, PROTECTED, PROTOCOL, ENUM_PROTOCOL, PUBLIC, QUICKTYPE, RAISE, RANGE, READONLY, REF, REG_EXP, REGISTER, REINTERPRET_CAST, REPEAT, REQUIRE, REQUIRED, REQUIRES, RESTRICT, RETAIN, RETHROWS, RETURN, RIGHT, RUNTIME_TYPE, S, SBYTE, SEALED, SEL, SELECT, SELF, SERIALIZABLE, ENUM_SELF, SENDABLE, SERIALIZE, SERIAL_NAME, K_SERIALIZER, PRIMITIVE_KIND, SERIAL_DESCRIPTOR, SERIALIZER_PROVIDER, SET, SHORT, SIGNED, SIMPLE_MODULE, SIZEOF, STACKALLOC, STANDARDS, STATIC, STATIC_ASSERT, STATIC_CAST, STD_DESERIALIZER, STD_SERIALIZER, STRICTFP, STRING, STRUCT, SUBSCRIPT, SUPER, SWITCH, SYMBOL, SYNCHRONIZED, SYSTEM, TEMPLATE, THEN, THIS, THREAD_LOCAL, THROW, THROWS, TIME_ONLY, TIME_ONLY_CONVERTER, TIME_ZONE, TO_JSON, TOP_LEVEL, TO_STRING, TO_DICT, TRANSIENT, TRUE, ENUM_TRUE, TRY, TYPE, ENUM_TYPE, TYPEALIAS, TYPEDEF, TYPEID, TYPENAME, TYPEOF, UINT, ULONG, UNCHECKED, UNDEFINED, UNION, UNMARSHAL_JSON, USE_SERIALIZERS, UNOWNED, UNSAFE, UNSIGNED, USHORT, USING, UTF8_JSON_READER, UTF8_JSON_WRITER, UUID, VAR, VIRTUAL, VOID, VOLATILE, WCHAR_T, WEAK, WHERE, WHILE, WILL_SET, WITH, XOR, XOR_EQ, YES, YIELD, DUMMY; | |
| 7 | + EMPTY, BOOL, COMPLEX, IMAGINERY, ABSTRACT, ALIGNAS, ALIGNOF, AND, AND_EQ, ANY, ENUM_ANY, ARRAY, AS, ASM, ASSERT, ASSOCIATEDTYPE, ASSOCIATIVITY, ASYNC, ATOMIC, ATOMIC_CANCEL, ATOMIC_COMMIT, ATOMIC_NOEXCEPT, AUTO, AWAIT, BASE, BITAND, BITOR, ENUM_BOOL, PURPLE_BOOL, BOOLEAN, BREAK, BYCOPY, BYREF, BYTE, CALENDAR, CASE, CATCH, CHAN, CHAR, CHAR16_T, CHAR32_T, CHECKED, CLASS, ENUM_CLASS, CLONE, CO_AWAIT, CO_RETURN, CO_YIELD, CODABLE, CODING_KEY, CODING_KEYS, COMPL, CONCEPT, CONSOLE, CONST, CONST_CAST, CONSTEXPR, CONSTRUCTOR, CONTINUE, CONVENIENCE, CONVERT, CONVERTER, CULTURE_INFO, DATE, DATE_PARSE_HANDLING, DATE_FORMATTER, DATE_ONLY, DATE_ONLY_CONVERTER, DATE_TIME, DATE_TIME_STYLES, DEBUGGER, DECIMAL, DECLARE, DECLTYPE, DECODE_STRING, DECODER, DECODING_ERROR, DEF, DEFAULT, DEFER, DEINIT, DEL, DELEGATE, DELETE, DICT, DICTIONARY, DID_SET, DO, DOUBLE, DYNAMIC, DYNAMIC_CAST, ELIF, ELSE, ENCODE_QUICK_TYPE, ENCODER, ENUM, ENUM_VALUES, EQUATABLE, EQUALITY_CONTRACT, EVENT, EXCEPT, EXCEPTION, EXPLICIT, EXPORT, EXPOSING, EXTENDS, EXTENSION, EXTERN, FALLTHROUGH, FALSE, ENUM_FALSE, FILEPRIVATE, FINAL, FINALLY, FIXED, FLOAT, FOR, FOREACH, FORMAT_EXCEPTION, FRIEND, FROM, FROM_DICT, FROM_JSON, FUNC, FUNCTION, GET, GLOBAL, GO, GOTO, GUARD, HASHABLE, HASH_CODE, HASHER, HAS_OWN_PROPERTY, ID, IF, IMP, IMPLEMENTS, IMPLICIT, IMPORT, IN, INDIRECT, INFIX, INIT, INLINE, INOUT, INSTANCEOF, INT, INTERFACE, INTERNAL, ISO_DATE_TIME_OFFSET_CONVERTER, ITERABLE, IS, JDEC, JENC, JPIPE, JSON, JSON_CONVERTER, JSON_SERIALIZER, JSON_TOKEN, JSON_WRITER, JSON_ANY, JSON_CODING_KEY, JSON_DECODER, JSON_ENCODER, JSON_EXCEPTION, JSON_GENERATOR, JSON_NODE, JSON_NULL, JSON_PARSER, JSON_READER, JSON_TOKEN_TYPE, LAMBDA, LAZY, LEFT, LET, LIST, LOCALE, LOCK, LONG, MAKE_DICT_ENCODER, MAP, MARSHAL_JSON, MAP_ENTRY, METADATA_PROPERTY_HANDLING, MODULE, MUTABLE, MUTATING, NAMESPACE, NATIVE, NEW, NEWTONSOFT, NIL, NO, NOEXCEPT, NONATOMIC, NONE, ENUM_NONE, NONLOCAL, NONMUTATING, NS_OBJECT, NO_SUCH_METHOD, NOT, NOT_EQ, NS_ERROR, NS_STRING, NULL, ENUM_NULL, NULLPTR, NUMBER, OBJECT, OBJECT_MAPPER, OF, ONEWAY, OPEN, OPERATOR, OPTIONAL, OR, OR_EQ, OUT, OVERRIDE, PACKAGE, PARAMS, PASS, PORT, POSTFIX, PRECEDENCE, PREFIX, PRINT, PRINTF, PRINT_MEMBERS, PRIVATE, PROTECTED, PROTOCOL, ENUM_PROTOCOL, PUBLIC, QUICKTYPE, RAISE, RANGE, READONLY, REF, REG_EXP, REGISTER, REINTERPRET_CAST, REPEAT, REQUIRE, REQUIRED, REQUIRES, RESTRICT, RETAIN, RETHROWS, RETURN, RIGHT, RUNTIME_TYPE, S, SBYTE, SEALED, SEL, SELECT, SELF, SERIALIZABLE, ENUM_SELF, SENDABLE, SERIALIZE, SERIAL_NAME, K_SERIALIZER, PRIMITIVE_KIND, SERIAL_DESCRIPTOR, SERIALIZER_PROVIDER, SET, SHORT, SIGNED, SIMPLE_MODULE, SIZEOF, STACKALLOC, STANDARDS, STATIC, STATIC_ASSERT, STATIC_CAST, STD_DESERIALIZER, STD_SERIALIZER, STRICTFP, STRING, STRUCT, SUBSCRIPT, SUPER, SWITCH, SYMBOL, SYNCHRONIZED, SYSTEM, TEMPLATE, THEN, THIS, THREAD_LOCAL, THROW, THROWS, TIME_ONLY, TIME_ONLY_CONVERTER, TIME_ZONE, TO_JSON, TOP_LEVEL, TO_STRING, TO_DICT, TRANSIENT, TRUE, ENUM_TRUE, TRY, TYPE, ENUM_TYPE, TYPEALIAS, TYPEDEF, TYPEID, TYPENAME, TYPEOF, UINT, ULONG, UNCHECKED, UNDEFINED, UNION, UNMARSHAL_JSON, USE_SERIALIZERS, UNOWNED, UNSAFE, UNSIGNED, USHORT, USING, UTF8_JSON_READER, UTF8_JSON_WRITER, UUID, VAR, VIRTUAL, VOID, VOLATILE, WCHAR_T, WEAK, WHERE, WHILE, WILL_SET, WITH, XOR, XOR_EQ, YES, YIELD, DUMMY; | |
| 8 | 8 | |
| 9 | 9 | @JsonValue |
| 10 | 10 | public String toValue() { |
| @@ -189,6 +189,7 @@ public enum Enum { | ||
| 189 | 189 | case LOCALE: return "Locale"; |
| 190 | 190 | case LOCK: return "lock"; |
| 191 | 191 | case LONG: return "long"; |
| 192 | + case MAKE_DICT_ENCODER: return "makeDictEncoder"; | |
| 192 | 193 | case MAP: return "map"; |
| 193 | 194 | case MARSHAL_JSON: return "MarshalJSON"; |
| 194 | 195 | case MAP_ENTRY: return "MapEntry"; |
| @@ -538,6 +539,7 @@ public enum Enum { | ||
| 538 | 539 | if (value.equals("Locale")) return LOCALE; |
| 539 | 540 | if (value.equals("lock")) return LOCK; |
| 540 | 541 | if (value.equals("long")) return LONG; |
| 542 | + if (value.equals("makeDictEncoder")) return MAKE_DICT_ENCODER; | |
| 541 | 543 | if (value.equals("map")) return MAP; |
| 542 | 544 | if (value.equals("MarshalJSON")) return MARSHAL_JSON; |
| 543 | 545 | if (value.equals("MapEntry")) return MAP_ENTRY; |
Mschema-javascript-prop-typesdefault / toplevel.js+1 −1
| @@ -13,7 +13,7 @@ | ||
| 13 | 13 | import PropTypes from "prop-types"; |
| 14 | 14 | |
| 15 | 15 | let _TopLevel; |
| 16 | -const _Enum = PropTypes.oneOf(['_', '_Bool', '_Complex', '_Imaginery', 'abstract', 'alignas', 'alignof', 'and', 'and_eq', 'any', 'Any', 'array', 'as', 'asm', 'assert', 'associatedtype', 'associativity', 'async', 'atomic', 'atomic_cancel', 'atomic_commit', 'atomic_noexcept', 'auto', 'await', 'base', 'bitand', 'bitor', 'BOOL', 'bool', 'boolean', 'break', 'bycopy', 'byref', 'byte', 'Calendar', 'case', 'catch', 'chan', 'char', 'char16_t', 'char32_t', 'checked', 'class', 'Class', 'clone', 'co_await', 'co_return', 'co_yield', 'Codable', 'CodingKey', 'CodingKeys', 'compl', 'concept', 'console', 'const', 'const_cast', 'constexpr', 'constructor', 'continue', 'convenience', 'convert', 'converter', 'CultureInfo', 'date', 'date_parse_handling', 'DateFormatter', 'DateOnly', 'DateOnlyConverter', 'DateTime', 'DateTimeStyles', 'debugger', 'decimal', 'declare', 'decltype', 'decode_string', 'Decoder', 'DecodingError', 'def', 'default', 'defer', 'deinit', 'del', 'delegate', 'delete', 'dict', 'dictionary', 'didSet', 'do', 'double', 'dynamic', 'dynamic_cast', 'elif', 'else', 'encode_quick_type', 'Encoder', 'enum', 'EnumValues', 'Equatable', 'equalityContract', 'event', 'except', 'exception', 'explicit', 'export', 'exposing', 'extends', 'extension', 'extern', 'fallthrough', 'false', 'False', 'fileprivate', 'final', 'finally', 'fixed', 'float', 'for', 'foreach', 'FormatException', 'friend', 'from', 'from_dict', 'from_json', 'func', 'function', 'get', 'global', 'go', 'goto', 'guard', 'Hashable', 'hashCode', 'Hasher', 'hasOwnProperty', 'id', 'if', 'IMP', 'implements', 'implicit', 'import', 'in', 'indirect', 'infix', 'init', 'inline', 'inout', 'instanceof', 'int', 'interface', 'internal', 'IsoDateTimeOffsetConverter', 'iterable', 'is', 'jdec', 'jenc', 'jpipe', 'json', 'json_converter', 'json_serializer', 'json_token', 'json_writer', 'JSONAny', 'JSONCodingKey', 'JSONDecoder', 'JSONEncoder', 'JsonException', 'JsonGenerator', 'JsonNode', 'JSONNull', 'JsonParser', 'JsonReader', 'JsonTokenType', 'lambda', 'lazy', 'left', 'let', 'list', 'Locale', 'lock', 'long', 'map', 'MarshalJSON', 'MapEntry', 'metadata_property_handling', 'module', 'mutable', 'mutating', 'namespace', 'native', 'new', 'newtonsoft', 'nil', 'NO', 'noexcept', 'nonatomic', 'none', 'None', 'nonlocal', 'nonmutating', 'NSObject', 'noSuchMethod', 'not', 'not_eq', 'NSError', 'NSString', 'NULL', 'null', 'nullptr', 'number', 'object', 'ObjectMapper', 'of', 'oneway', 'open', 'operator', 'optional', 'or', 'or_eq', 'out', 'override', 'package', 'params', 'pass', 'port', 'postfix', 'precedence', 'prefix', 'print', 'printf', 'printMembers', 'private', 'protected', 'Protocol', 'protocol', 'public', 'quicktype', 'raise', 'range', 'readonly', 'ref', 'RegExp', 'register', 'reinterpret_cast', 'repeat', 'require', 'required', 'requires', 'restrict', 'retain', 'rethrows', 'return', 'right', 'runtimeType', 's', 'sbyte', 'sealed', 'SEL', 'select', 'Self', 'Serializable', 'self', 'Sendable', 'serialize', 'SerialName', 'KSerializer', 'PrimitiveKind', 'SerialDescriptor', 'SerializerProvider', 'set', 'short', 'signed', 'SimpleModule', 'sizeof', 'stackalloc', 'Standards', 'static', 'static_assert', 'static_cast', 'StdDeserializer', 'StdSerializer', 'strictfp', 'string', 'struct', 'subscript', 'super', 'switch', 'symbol', 'synchronized', 'system', 'template', 'then', 'this', 'thread_local', 'throw', 'throws', 'TimeOnly', 'TimeOnlyConverter', 'TimeZone', 'to_json', 'top_level', 'toString', 'to_dict', 'transient', 'True', 'true', 'try', 'Type', 'type', 'typealias', 'typedef', 'typeid', 'typename', 'typeof', 'uint', 'ulong', 'unchecked', 'undefined', 'union', 'UnmarshalJSON', 'UseSerializers', 'unowned', 'unsafe', 'unsigned', 'ushort', 'using', 'Utf8JsonReader', 'Utf8JsonWriter', 'UUID', 'var', 'virtual', 'void', 'volatile', 'wchar_t', 'weak', 'where', 'while', 'willSet', 'with', 'xor', 'xor_eq', 'YES', 'yield', 'dummy']); | |
| 16 | +const _Enum = PropTypes.oneOf(['_', '_Bool', '_Complex', '_Imaginery', 'abstract', 'alignas', 'alignof', 'and', 'and_eq', 'any', 'Any', 'array', 'as', 'asm', 'assert', 'associatedtype', 'associativity', 'async', 'atomic', 'atomic_cancel', 'atomic_commit', 'atomic_noexcept', 'auto', 'await', 'base', 'bitand', 'bitor', 'BOOL', 'bool', 'boolean', 'break', 'bycopy', 'byref', 'byte', 'Calendar', 'case', 'catch', 'chan', 'char', 'char16_t', 'char32_t', 'checked', 'class', 'Class', 'clone', 'co_await', 'co_return', 'co_yield', 'Codable', 'CodingKey', 'CodingKeys', 'compl', 'concept', 'console', 'const', 'const_cast', 'constexpr', 'constructor', 'continue', 'convenience', 'convert', 'converter', 'CultureInfo', 'date', 'date_parse_handling', 'DateFormatter', 'DateOnly', 'DateOnlyConverter', 'DateTime', 'DateTimeStyles', 'debugger', 'decimal', 'declare', 'decltype', 'decode_string', 'Decoder', 'DecodingError', 'def', 'default', 'defer', 'deinit', 'del', 'delegate', 'delete', 'dict', 'dictionary', 'didSet', 'do', 'double', 'dynamic', 'dynamic_cast', 'elif', 'else', 'encode_quick_type', 'Encoder', 'enum', 'EnumValues', 'Equatable', 'equalityContract', 'event', 'except', 'exception', 'explicit', 'export', 'exposing', 'extends', 'extension', 'extern', 'fallthrough', 'false', 'False', 'fileprivate', 'final', 'finally', 'fixed', 'float', 'for', 'foreach', 'FormatException', 'friend', 'from', 'from_dict', 'from_json', 'func', 'function', 'get', 'global', 'go', 'goto', 'guard', 'Hashable', 'hashCode', 'Hasher', 'hasOwnProperty', 'id', 'if', 'IMP', 'implements', 'implicit', 'import', 'in', 'indirect', 'infix', 'init', 'inline', 'inout', 'instanceof', 'int', 'interface', 'internal', 'IsoDateTimeOffsetConverter', 'iterable', 'is', 'jdec', 'jenc', 'jpipe', 'json', 'json_converter', 'json_serializer', 'json_token', 'json_writer', 'JSONAny', 'JSONCodingKey', 'JSONDecoder', 'JSONEncoder', 'JsonException', 'JsonGenerator', 'JsonNode', 'JSONNull', 'JsonParser', 'JsonReader', 'JsonTokenType', 'lambda', 'lazy', 'left', 'let', 'list', 'Locale', 'lock', 'long', 'makeDictEncoder', 'map', 'MarshalJSON', 'MapEntry', 'metadata_property_handling', 'module', 'mutable', 'mutating', 'namespace', 'native', 'new', 'newtonsoft', 'nil', 'NO', 'noexcept', 'nonatomic', 'none', 'None', 'nonlocal', 'nonmutating', 'NSObject', 'noSuchMethod', 'not', 'not_eq', 'NSError', 'NSString', 'NULL', 'null', 'nullptr', 'number', 'object', 'ObjectMapper', 'of', 'oneway', 'open', 'operator', 'optional', 'or', 'or_eq', 'out', 'override', 'package', 'params', 'pass', 'port', 'postfix', 'precedence', 'prefix', 'print', 'printf', 'printMembers', 'private', 'protected', 'Protocol', 'protocol', 'public', 'quicktype', 'raise', 'range', 'readonly', 'ref', 'RegExp', 'register', 'reinterpret_cast', 'repeat', 'require', 'required', 'requires', 'restrict', 'retain', 'rethrows', 'return', 'right', 'runtimeType', 's', 'sbyte', 'sealed', 'SEL', 'select', 'Self', 'Serializable', 'self', 'Sendable', 'serialize', 'SerialName', 'KSerializer', 'PrimitiveKind', 'SerialDescriptor', 'SerializerProvider', 'set', 'short', 'signed', 'SimpleModule', 'sizeof', 'stackalloc', 'Standards', 'static', 'static_assert', 'static_cast', 'StdDeserializer', 'StdSerializer', 'strictfp', 'string', 'struct', 'subscript', 'super', 'switch', 'symbol', 'synchronized', 'system', 'template', 'then', 'this', 'thread_local', 'throw', 'throws', 'TimeOnly', 'TimeOnlyConverter', 'TimeZone', 'to_json', 'top_level', 'toString', 'to_dict', 'transient', 'True', 'true', 'try', 'Type', 'type', 'typealias', 'typedef', 'typeid', 'typename', 'typeof', 'uint', 'ulong', 'unchecked', 'undefined', 'union', 'UnmarshalJSON', 'UseSerializers', 'unowned', 'unsafe', 'unsigned', 'ushort', 'using', 'Utf8JsonReader', 'Utf8JsonWriter', 'UUID', 'var', 'virtual', 'void', 'volatile', 'wchar_t', 'weak', 'where', 'while', 'willSet', 'with', 'xor', 'xor_eq', 'YES', 'yield', 'dummy']); | |
| 17 | 17 | _TopLevel = PropTypes.shape({ |
| 18 | 18 | "enum": PropTypes.oneOfType([_Enum, PropTypes.oneOf([null])]), |
| 19 | 19 | }); |
Mschema-javascriptdefault / TopLevel.js+3 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
| @@ -376,6 +376,7 @@ const typeMap = { | ||
| 376 | 376 | "Locale", |
| 377 | 377 | "lock", |
| 378 | 378 | "long", |
| 379 | + "makeDictEncoder", | |
| 379 | 380 | "map", |
| 380 | 381 | "MarshalJSON", |
| 381 | 382 | "MapEntry", |
Mschema-kotlin-jacksondefault / TopLevel.kt+2 −0
| @@ -221,6 +221,7 @@ enum class EnumEnum(val value: String) { | ||
| 221 | 221 | Locale("Locale"), |
| 222 | 222 | Lock("lock"), |
| 223 | 223 | EnumLong("long"), |
| 224 | + MakeDictEncoder("makeDictEncoder"), | |
| 224 | 225 | EnumMap("map"), |
| 225 | 226 | MarshalJSON("MarshalJSON"), |
| 226 | 227 | MapEntry("MapEntry"), |
| @@ -567,6 +568,7 @@ enum class EnumEnum(val value: String) { | ||
| 567 | 568 | "Locale" -> Locale |
| 568 | 569 | "lock" -> Lock |
| 569 | 570 | "long" -> EnumLong |
| 571 | + "makeDictEncoder" -> MakeDictEncoder | |
| 570 | 572 | "map" -> EnumMap |
| 571 | 573 | "MarshalJSON" -> MarshalJSON |
| 572 | 574 | "MapEntry" -> MapEntry |
Mschema-kotlindefault / TopLevel.kt+2 −0
| @@ -208,6 +208,7 @@ enum class EnumEnum(val value: String) { | ||
| 208 | 208 | Locale("Locale"), |
| 209 | 209 | Lock("lock"), |
| 210 | 210 | EnumLong("long"), |
| 211 | + MakeDictEncoder("makeDictEncoder"), | |
| 211 | 212 | EnumMap("map"), |
| 212 | 213 | MarshalJSON("MarshalJSON"), |
| 213 | 214 | MapEntry("MapEntry"), |
| @@ -554,6 +555,7 @@ enum class EnumEnum(val value: String) { | ||
| 554 | 555 | "Locale" -> Locale |
| 555 | 556 | "lock" -> Lock |
| 556 | 557 | "long" -> EnumLong |
| 558 | + "makeDictEncoder" -> MakeDictEncoder | |
| 557 | 559 | "map" -> EnumMap |
| 558 | 560 | "MarshalJSON" -> MarshalJSON |
| 559 | 561 | "MapEntry" -> MapEntry |
Mschema-kotlinxdefault / TopLevel.kt+1 −0
| @@ -197,6 +197,7 @@ enum class EnumEnum(val value: String) { | ||
| 197 | 197 | @SerialName("Locale") Locale("Locale"), |
| 198 | 198 | @SerialName("lock") Lock("lock"), |
| 199 | 199 | @SerialName("long") EnumLong("long"), |
| 200 | + @SerialName("makeDictEncoder") MakeDictEncoder("makeDictEncoder"), | |
| 200 | 201 | @SerialName("map") EnumMap("map"), |
| 201 | 202 | @SerialName("MarshalJSON") MarshalJSON("MarshalJSON"), |
| 202 | 203 | @SerialName("MapEntry") MapEntry("MapEntry"), |
Mschema-objective-cdefault / QTTopLevel.h+1 −0
| @@ -195,6 +195,7 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 195 | 195 | + (QTEnum *)locale; |
| 196 | 196 | + (QTEnum *)lock; |
| 197 | 197 | + (QTEnum *)enumLong; |
| 198 | ++ (QTEnum *)makeDictEncoder; | |
| 198 | 199 | + (QTEnum *)map; |
| 199 | 200 | + (QTEnum *)marshalJSON; |
| 200 | 201 | + (QTEnum *)mapEntry; |
Mschema-objective-cdefault / QTTopLevel.m+2 −0
| @@ -198,6 +198,7 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 198 | 198 | @"Locale": [[QTEnum alloc] initWithValue:@"Locale"], |
| 199 | 199 | @"lock": [[QTEnum alloc] initWithValue:@"lock"], |
| 200 | 200 | @"long": [[QTEnum alloc] initWithValue:@"long"], |
| 201 | + @"makeDictEncoder": [[QTEnum alloc] initWithValue:@"makeDictEncoder"], | |
| 201 | 202 | @"map": [[QTEnum alloc] initWithValue:@"map"], |
| 202 | 203 | @"MarshalJSON": [[QTEnum alloc] initWithValue:@"MarshalJSON"], |
| 203 | 204 | @"MapEntry": [[QTEnum alloc] initWithValue:@"MapEntry"], |
| @@ -544,6 +545,7 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 544 | 545 | + (QTEnum *)locale { return QTEnum.values[@"Locale"]; } |
| 545 | 546 | + (QTEnum *)lock { return QTEnum.values[@"lock"]; } |
| 546 | 547 | + (QTEnum *)enumLong { return QTEnum.values[@"long"]; } |
| 548 | ++ (QTEnum *)makeDictEncoder { return QTEnum.values[@"makeDictEncoder"]; } | |
| 547 | 549 | + (QTEnum *)map { return QTEnum.values[@"map"]; } |
| 548 | 550 | + (QTEnum *)marshalJSON { return QTEnum.values[@"MarshalJSON"]; } |
| 549 | 551 | + (QTEnum *)mapEntry { return QTEnum.values[@"MapEntry"]; } |
Mschema-phpdefault / TopLevel.php+4 −0
| @@ -293,6 +293,7 @@ class EnumEnum { | ||
| 293 | 293 | public static EnumEnum $LOCALE; |
| 294 | 294 | public static EnumEnum $LOCK; |
| 295 | 295 | public static EnumEnum $LONG; |
| 296 | + public static EnumEnum $MAKE_DICT_ENCODER; | |
| 296 | 297 | public static EnumEnum $MAP; |
| 297 | 298 | public static EnumEnum $MARSHAL_JSON; |
| 298 | 299 | public static EnumEnum $MAP_ENTRY; |
| @@ -637,6 +638,7 @@ class EnumEnum { | ||
| 637 | 638 | EnumEnum::$LOCALE = new EnumEnum('Locale'); |
| 638 | 639 | EnumEnum::$LOCK = new EnumEnum('lock'); |
| 639 | 640 | EnumEnum::$LONG = new EnumEnum('long'); |
| 641 | + EnumEnum::$MAKE_DICT_ENCODER = new EnumEnum('makeDictEncoder'); | |
| 640 | 642 | EnumEnum::$MAP = new EnumEnum('map'); |
| 641 | 643 | EnumEnum::$MARSHAL_JSON = new EnumEnum('MarshalJSON'); |
| 642 | 644 | EnumEnum::$MAP_ENTRY = new EnumEnum('MapEntry'); |
| @@ -993,6 +995,7 @@ class EnumEnum { | ||
| 993 | 995 | case EnumEnum::$LOCALE->enum: return 'Locale'; |
| 994 | 996 | case EnumEnum::$LOCK->enum: return 'lock'; |
| 995 | 997 | case EnumEnum::$LONG->enum: return 'long'; |
| 998 | + case EnumEnum::$MAKE_DICT_ENCODER->enum: return 'makeDictEncoder'; | |
| 996 | 999 | case EnumEnum::$MAP->enum: return 'map'; |
| 997 | 1000 | case EnumEnum::$MARSHAL_JSON->enum: return 'MarshalJSON'; |
| 998 | 1001 | case EnumEnum::$MAP_ENTRY->enum: return 'MapEntry'; |
| @@ -1347,6 +1350,7 @@ class EnumEnum { | ||
| 1347 | 1350 | case 'Locale': return EnumEnum::$LOCALE; |
| 1348 | 1351 | case 'lock': return EnumEnum::$LOCK; |
| 1349 | 1352 | case 'long': return EnumEnum::$LONG; |
| 1353 | + case 'makeDictEncoder': return EnumEnum::$MAKE_DICT_ENCODER; | |
| 1350 | 1354 | case 'map': return EnumEnum::$MAP; |
| 1351 | 1355 | case 'MarshalJSON': return EnumEnum::$MARSHAL_JSON; |
| 1352 | 1356 | case 'MapEntry': return EnumEnum::$MAP_ENTRY; |
Mschema-pikedefault / TopLevel.pmod+2 −1
| @@ -213,6 +213,7 @@ enum Enum { | ||
| 213 | 213 | LOCALE = "Locale", // json: "Locale" |
| 214 | 214 | LOCK = "lock", // json: "lock" |
| 215 | 215 | LONG = "long", // json: "long" |
| 216 | + MAKE_DICT_ENCODER = "makeDictEncoder", // json: "makeDictEncoder" | |
| 216 | 217 | MAP = "map", // json: "map" |
| 217 | 218 | MARSHAL_JSON = "MarshalJSON", // json: "MarshalJSON" |
| 218 | 219 | MAP_ENTRY = "MapEntry", // json: "MapEntry" |
| @@ -379,5 +380,5 @@ enum Enum { | ||
| 379 | 380 | } |
| 380 | 381 | |
| 381 | 382 | Enum Enum_from_JSON(mixed json) { |
| 382 | - if(!zero_type(json)&&json != "_"&&json != "_Bool"&&json != "_Complex"&&json != "_Imaginery"&&json != "abstract"&&json != "alignas"&&json != "alignof"&&json != "and"&&json != "and_eq"&&json != "any"&&json != "Any"&&json != "array"&&json != "as"&&json != "asm"&&json != "assert"&&json != "associatedtype"&&json != "associativity"&&json != "async"&&json != "atomic"&&json != "atomic_cancel"&&json != "atomic_commit"&&json != "atomic_noexcept"&&json != "auto"&&json != "await"&&json != "base"&&json != "bitand"&&json != "bitor"&&json != "BOOL"&&json != "bool"&&json != "boolean"&&json != "break"&&json != "bycopy"&&json != "byref"&&json != "byte"&&json != "Calendar"&&json != "case"&&json != "catch"&&json != "chan"&&json != "char"&&json != "char16_t"&&json != "char32_t"&&json != "checked"&&json != "class"&&json != "Class"&&json != "clone"&&json != "co_await"&&json != "co_return"&&json != "co_yield"&&json != "Codable"&&json != "CodingKey"&&json != "CodingKeys"&&json != "compl"&&json != "concept"&&json != "console"&&json != "const"&&json != "const_cast"&&json != "constexpr"&&json != "constructor"&&json != "continue"&&json != "convenience"&&json != "convert"&&json != "converter"&&json != "CultureInfo"&&json != "date"&&json != "date_parse_handling"&&json != "DateFormatter"&&json != "DateOnly"&&json != "DateOnlyConverter"&&json != "DateTime"&&json != "DateTimeStyles"&&json != "debugger"&&json != "decimal"&&json != "declare"&&json != "decltype"&&json != "decode_string"&&json != "Decoder"&&json != "DecodingError"&&json != "def"&&json != "default"&&json != "defer"&&json != "deinit"&&json != "del"&&json != "delegate"&&json != "delete"&&json != "dict"&&json != "dictionary"&&json != "didSet"&&json != "do"&&json != "double"&&json != "dynamic"&&json != "dynamic_cast"&&json != "elif"&&json != "else"&&json != "encode_quick_type"&&json != "Encoder"&&json != "enum"&&json != "EnumValues"&&json != "Equatable"&&json != "equalityContract"&&json != "event"&&json != "except"&&json != "exception"&&json != "explicit"&&json != "export"&&json != "exposing"&&json != "extends"&&json != "extension"&&json != "extern"&&json != "fallthrough"&&json != "false"&&json != "False"&&json != "fileprivate"&&json != "final"&&json != "finally"&&json != "fixed"&&json != "float"&&json != "for"&&json != "foreach"&&json != "FormatException"&&json != "friend"&&json != "from"&&json != "from_dict"&&json != "from_json"&&json != "func"&&json != "function"&&json != "get"&&json != "global"&&json != "go"&&json != "goto"&&json != "guard"&&json != "Hashable"&&json != "hashCode"&&json != "Hasher"&&json != "hasOwnProperty"&&json != "id"&&json != "if"&&json != "IMP"&&json != "implements"&&json != "implicit"&&json != "import"&&json != "in"&&json != "indirect"&&json != "infix"&&json != "init"&&json != "inline"&&json != "inout"&&json != "instanceof"&&json != "int"&&json != "interface"&&json != "internal"&&json != "IsoDateTimeOffsetConverter"&&json != "iterable"&&json != "is"&&json != "jdec"&&json != "jenc"&&json != "jpipe"&&json != "json"&&json != "json_converter"&&json != "json_serializer"&&json != "json_token"&&json != "json_writer"&&json != "JSONAny"&&json != "JSONCodingKey"&&json != "JSONDecoder"&&json != "JSONEncoder"&&json != "JsonException"&&json != "JsonGenerator"&&json != "JsonNode"&&json != "JSONNull"&&json != "JsonParser"&&json != "JsonReader"&&json != "JsonTokenType"&&json != "lambda"&&json != "lazy"&&json != "left"&&json != "let"&&json != "list"&&json != "Locale"&&json != "lock"&&json != "long"&&json != "map"&&json != "MarshalJSON"&&json != "MapEntry"&&json != "metadata_property_handling"&&json != "module"&&json != "mutable"&&json != "mutating"&&json != "namespace"&&json != "native"&&json != "new"&&json != "newtonsoft"&&json != "nil"&&json != "NO"&&json != "noexcept"&&json != "nonatomic"&&json != "none"&&json != "None"&&json != "nonlocal"&&json != "nonmutating"&&json != "NSObject"&&json != "noSuchMethod"&&json != "not"&&json != "not_eq"&&json != "NSError"&&json != "NSString"&&json != "NULL"&&json != "null"&&json != "nullptr"&&json != "number"&&json != "object"&&json != "ObjectMapper"&&json != "of"&&json != "oneway"&&json != "open"&&json != "operator"&&json != "optional"&&json != "or"&&json != "or_eq"&&json != "out"&&json != "override"&&json != "package"&&json != "params"&&json != "pass"&&json != "port"&&json != "postfix"&&json != "precedence"&&json != "prefix"&&json != "print"&&json != "printf"&&json != "printMembers"&&json != "private"&&json != "protected"&&json != "Protocol"&&json != "protocol"&&json != "public"&&json != "quicktype"&&json != "raise"&&json != "range"&&json != "readonly"&&json != "ref"&&json != "RegExp"&&json != "register"&&json != "reinterpret_cast"&&json != "repeat"&&json != "require"&&json != "required"&&json != "requires"&&json != "restrict"&&json != "retain"&&json != "rethrows"&&json != "return"&&json != "right"&&json != "runtimeType"&&json != "s"&&json != "sbyte"&&json != "sealed"&&json != "SEL"&&json != "select"&&json != "Self"&&json != "Serializable"&&json != "self"&&json != "Sendable"&&json != "serialize"&&json != "SerialName"&&json != "KSerializer"&&json != "PrimitiveKind"&&json != "SerialDescriptor"&&json != "SerializerProvider"&&json != "set"&&json != "short"&&json != "signed"&&json != "SimpleModule"&&json != "sizeof"&&json != "stackalloc"&&json != "Standards"&&json != "static"&&json != "static_assert"&&json != "static_cast"&&json != "StdDeserializer"&&json != "StdSerializer"&&json != "strictfp"&&json != "string"&&json != "struct"&&json != "subscript"&&json != "super"&&json != "switch"&&json != "symbol"&&json != "synchronized"&&json != "system"&&json != "template"&&json != "then"&&json != "this"&&json != "thread_local"&&json != "throw"&&json != "throws"&&json != "TimeOnly"&&json != "TimeOnlyConverter"&&json != "TimeZone"&&json != "to_json"&&json != "top_level"&&json != "toString"&&json != "to_dict"&&json != "transient"&&json != "True"&&json != "true"&&json != "try"&&json != "Type"&&json != "type"&&json != "typealias"&&json != "typedef"&&json != "typeid"&&json != "typename"&&json != "typeof"&&json != "uint"&&json != "ulong"&&json != "unchecked"&&json != "undefined"&&json != "union"&&json != "UnmarshalJSON"&&json != "UseSerializers"&&json != "unowned"&&json != "unsafe"&&json != "unsigned"&&json != "ushort"&&json != "using"&&json != "Utf8JsonReader"&&json != "Utf8JsonWriter"&&json != "UUID"&&json != "var"&&json != "virtual"&&json != "void"&&json != "volatile"&&json != "wchar_t"&&json != "weak"&&json != "where"&&json != "while"&&json != "willSet"&&json != "with"&&json != "xor"&&json != "xor_eq"&&json != "YES"&&json != "yield"&&json != "dummy")error("enum");return json; | |
| 383 | + if(!zero_type(json)&&json != "_"&&json != "_Bool"&&json != "_Complex"&&json != "_Imaginery"&&json != "abstract"&&json != "alignas"&&json != "alignof"&&json != "and"&&json != "and_eq"&&json != "any"&&json != "Any"&&json != "array"&&json != "as"&&json != "asm"&&json != "assert"&&json != "associatedtype"&&json != "associativity"&&json != "async"&&json != "atomic"&&json != "atomic_cancel"&&json != "atomic_commit"&&json != "atomic_noexcept"&&json != "auto"&&json != "await"&&json != "base"&&json != "bitand"&&json != "bitor"&&json != "BOOL"&&json != "bool"&&json != "boolean"&&json != "break"&&json != "bycopy"&&json != "byref"&&json != "byte"&&json != "Calendar"&&json != "case"&&json != "catch"&&json != "chan"&&json != "char"&&json != "char16_t"&&json != "char32_t"&&json != "checked"&&json != "class"&&json != "Class"&&json != "clone"&&json != "co_await"&&json != "co_return"&&json != "co_yield"&&json != "Codable"&&json != "CodingKey"&&json != "CodingKeys"&&json != "compl"&&json != "concept"&&json != "console"&&json != "const"&&json != "const_cast"&&json != "constexpr"&&json != "constructor"&&json != "continue"&&json != "convenience"&&json != "convert"&&json != "converter"&&json != "CultureInfo"&&json != "date"&&json != "date_parse_handling"&&json != "DateFormatter"&&json != "DateOnly"&&json != "DateOnlyConverter"&&json != "DateTime"&&json != "DateTimeStyles"&&json != "debugger"&&json != "decimal"&&json != "declare"&&json != "decltype"&&json != "decode_string"&&json != "Decoder"&&json != "DecodingError"&&json != "def"&&json != "default"&&json != "defer"&&json != "deinit"&&json != "del"&&json != "delegate"&&json != "delete"&&json != "dict"&&json != "dictionary"&&json != "didSet"&&json != "do"&&json != "double"&&json != "dynamic"&&json != "dynamic_cast"&&json != "elif"&&json != "else"&&json != "encode_quick_type"&&json != "Encoder"&&json != "enum"&&json != "EnumValues"&&json != "Equatable"&&json != "equalityContract"&&json != "event"&&json != "except"&&json != "exception"&&json != "explicit"&&json != "export"&&json != "exposing"&&json != "extends"&&json != "extension"&&json != "extern"&&json != "fallthrough"&&json != "false"&&json != "False"&&json != "fileprivate"&&json != "final"&&json != "finally"&&json != "fixed"&&json != "float"&&json != "for"&&json != "foreach"&&json != "FormatException"&&json != "friend"&&json != "from"&&json != "from_dict"&&json != "from_json"&&json != "func"&&json != "function"&&json != "get"&&json != "global"&&json != "go"&&json != "goto"&&json != "guard"&&json != "Hashable"&&json != "hashCode"&&json != "Hasher"&&json != "hasOwnProperty"&&json != "id"&&json != "if"&&json != "IMP"&&json != "implements"&&json != "implicit"&&json != "import"&&json != "in"&&json != "indirect"&&json != "infix"&&json != "init"&&json != "inline"&&json != "inout"&&json != "instanceof"&&json != "int"&&json != "interface"&&json != "internal"&&json != "IsoDateTimeOffsetConverter"&&json != "iterable"&&json != "is"&&json != "jdec"&&json != "jenc"&&json != "jpipe"&&json != "json"&&json != "json_converter"&&json != "json_serializer"&&json != "json_token"&&json != "json_writer"&&json != "JSONAny"&&json != "JSONCodingKey"&&json != "JSONDecoder"&&json != "JSONEncoder"&&json != "JsonException"&&json != "JsonGenerator"&&json != "JsonNode"&&json != "JSONNull"&&json != "JsonParser"&&json != "JsonReader"&&json != "JsonTokenType"&&json != "lambda"&&json != "lazy"&&json != "left"&&json != "let"&&json != "list"&&json != "Locale"&&json != "lock"&&json != "long"&&json != "makeDictEncoder"&&json != "map"&&json != "MarshalJSON"&&json != "MapEntry"&&json != "metadata_property_handling"&&json != "module"&&json != "mutable"&&json != "mutating"&&json != "namespace"&&json != "native"&&json != "new"&&json != "newtonsoft"&&json != "nil"&&json != "NO"&&json != "noexcept"&&json != "nonatomic"&&json != "none"&&json != "None"&&json != "nonlocal"&&json != "nonmutating"&&json != "NSObject"&&json != "noSuchMethod"&&json != "not"&&json != "not_eq"&&json != "NSError"&&json != "NSString"&&json != "NULL"&&json != "null"&&json != "nullptr"&&json != "number"&&json != "object"&&json != "ObjectMapper"&&json != "of"&&json != "oneway"&&json != "open"&&json != "operator"&&json != "optional"&&json != "or"&&json != "or_eq"&&json != "out"&&json != "override"&&json != "package"&&json != "params"&&json != "pass"&&json != "port"&&json != "postfix"&&json != "precedence"&&json != "prefix"&&json != "print"&&json != "printf"&&json != "printMembers"&&json != "private"&&json != "protected"&&json != "Protocol"&&json != "protocol"&&json != "public"&&json != "quicktype"&&json != "raise"&&json != "range"&&json != "readonly"&&json != "ref"&&json != "RegExp"&&json != "register"&&json != "reinterpret_cast"&&json != "repeat"&&json != "require"&&json != "required"&&json != "requires"&&json != "restrict"&&json != "retain"&&json != "rethrows"&&json != "return"&&json != "right"&&json != "runtimeType"&&json != "s"&&json != "sbyte"&&json != "sealed"&&json != "SEL"&&json != "select"&&json != "Self"&&json != "Serializable"&&json != "self"&&json != "Sendable"&&json != "serialize"&&json != "SerialName"&&json != "KSerializer"&&json != "PrimitiveKind"&&json != "SerialDescriptor"&&json != "SerializerProvider"&&json != "set"&&json != "short"&&json != "signed"&&json != "SimpleModule"&&json != "sizeof"&&json != "stackalloc"&&json != "Standards"&&json != "static"&&json != "static_assert"&&json != "static_cast"&&json != "StdDeserializer"&&json != "StdSerializer"&&json != "strictfp"&&json != "string"&&json != "struct"&&json != "subscript"&&json != "super"&&json != "switch"&&json != "symbol"&&json != "synchronized"&&json != "system"&&json != "template"&&json != "then"&&json != "this"&&json != "thread_local"&&json != "throw"&&json != "throws"&&json != "TimeOnly"&&json != "TimeOnlyConverter"&&json != "TimeZone"&&json != "to_json"&&json != "top_level"&&json != "toString"&&json != "to_dict"&&json != "transient"&&json != "True"&&json != "true"&&json != "try"&&json != "Type"&&json != "type"&&json != "typealias"&&json != "typedef"&&json != "typeid"&&json != "typename"&&json != "typeof"&&json != "uint"&&json != "ulong"&&json != "unchecked"&&json != "undefined"&&json != "union"&&json != "UnmarshalJSON"&&json != "UseSerializers"&&json != "unowned"&&json != "unsafe"&&json != "unsigned"&&json != "ushort"&&json != "using"&&json != "Utf8JsonReader"&&json != "Utf8JsonWriter"&&json != "UUID"&&json != "var"&&json != "virtual"&&json != "void"&&json != "volatile"&&json != "wchar_t"&&json != "weak"&&json != "where"&&json != "while"&&json != "willSet"&&json != "with"&&json != "xor"&&json != "xor_eq"&&json != "YES"&&json != "yield"&&json != "dummy")error("enum");return json; | |
| 383 | 384 | } |
Mschema-pythondefault / quicktype.py+1 −0
| @@ -212,6 +212,7 @@ class EnumEnum(Enum): | ||
| 212 | 212 | LOCALE = "Locale" |
| 213 | 213 | LOCK = "lock" |
| 214 | 214 | LONG = "long" |
| 215 | + MAKE_DICT_ENCODER = "makeDictEncoder" | |
| 215 | 216 | MAP = "map" |
| 216 | 217 | MARSHAL_JSON = "MarshalJSON" |
| 217 | 218 | MAP_ENTRY = "MapEntry" |
Mschema-rubydefault / TopLevel.rb+2 −1
| @@ -17,7 +17,7 @@ module Types | ||
| 17 | 17 | |
| 18 | 18 | Hash = Strict::Hash |
| 19 | 19 | String = Strict::String |
| 20 | - Enum = Strict::String.enum("_", "_Bool", "_Complex", "_Imaginery", "abstract", "alignas", "alignof", "and", "and_eq", "any", "Any", "array", "as", "asm", "assert", "associatedtype", "associativity", "async", "atomic", "atomic_cancel", "atomic_commit", "atomic_noexcept", "auto", "await", "base", "bitand", "bitor", "BOOL", "bool", "boolean", "break", "bycopy", "byref", "byte", "Calendar", "case", "catch", "chan", "char", "char16_t", "char32_t", "checked", "class", "Class", "clone", "co_await", "co_return", "co_yield", "Codable", "CodingKey", "CodingKeys", "compl", "concept", "console", "const", "const_cast", "constexpr", "constructor", "continue", "convenience", "convert", "converter", "CultureInfo", "date", "date_parse_handling", "DateFormatter", "DateOnly", "DateOnlyConverter", "DateTime", "DateTimeStyles", "debugger", "decimal", "declare", "decltype", "decode_string", "Decoder", "DecodingError", "def", "default", "defer", "deinit", "del", "delegate", "delete", "dict", "dictionary", "didSet", "do", "double", "dynamic", "dynamic_cast", "elif", "else", "encode_quick_type", "Encoder", "enum", "EnumValues", "Equatable", "equalityContract", "event", "except", "exception", "explicit", "export", "exposing", "extends", "extension", "extern", "fallthrough", "false", "False", "fileprivate", "final", "finally", "fixed", "float", "for", "foreach", "FormatException", "friend", "from", "from_dict", "from_json", "func", "function", "get", "global", "go", "goto", "guard", "Hashable", "hashCode", "Hasher", "hasOwnProperty", "id", "if", "IMP", "implements", "implicit", "import", "in", "indirect", "infix", "init", "inline", "inout", "instanceof", "int", "interface", "internal", "IsoDateTimeOffsetConverter", "iterable", "is", "jdec", "jenc", "jpipe", "json", "json_converter", "json_serializer", "json_token", "json_writer", "JSONAny", "JSONCodingKey", "JSONDecoder", "JSONEncoder", "JsonException", "JsonGenerator", "JsonNode", "JSONNull", "JsonParser", "JsonReader", "JsonTokenType", "lambda", "lazy", "left", "let", "list", "Locale", "lock", "long", "map", "MarshalJSON", "MapEntry", "metadata_property_handling", "module", "mutable", "mutating", "namespace", "native", "new", "newtonsoft", "nil", "NO", "noexcept", "nonatomic", "none", "None", "nonlocal", "nonmutating", "NSObject", "noSuchMethod", "not", "not_eq", "NSError", "NSString", "NULL", "null", "nullptr", "number", "object", "ObjectMapper", "of", "oneway", "open", "operator", "optional", "or", "or_eq", "out", "override", "package", "params", "pass", "port", "postfix", "precedence", "prefix", "print", "printf", "printMembers", "private", "protected", "Protocol", "protocol", "public", "quicktype", "raise", "range", "readonly", "ref", "RegExp", "register", "reinterpret_cast", "repeat", "require", "required", "requires", "restrict", "retain", "rethrows", "return", "right", "runtimeType", "s", "sbyte", "sealed", "SEL", "select", "Self", "Serializable", "self", "Sendable", "serialize", "SerialName", "KSerializer", "PrimitiveKind", "SerialDescriptor", "SerializerProvider", "set", "short", "signed", "SimpleModule", "sizeof", "stackalloc", "Standards", "static", "static_assert", "static_cast", "StdDeserializer", "StdSerializer", "strictfp", "string", "struct", "subscript", "super", "switch", "symbol", "synchronized", "system", "template", "then", "this", "thread_local", "throw", "throws", "TimeOnly", "TimeOnlyConverter", "TimeZone", "to_json", "top_level", "toString", "to_dict", "transient", "True", "true", "try", "Type", "type", "typealias", "typedef", "typeid", "typename", "typeof", "uint", "ulong", "unchecked", "undefined", "union", "UnmarshalJSON", "UseSerializers", "unowned", "unsafe", "unsigned", "ushort", "using", "Utf8JsonReader", "Utf8JsonWriter", "UUID", "var", "virtual", "void", "volatile", "wchar_t", "weak", "where", "while", "willSet", "with", "xor", "xor_eq", "YES", "yield", "dummy") | |
| 20 | + Enum = Strict::String.enum("_", "_Bool", "_Complex", "_Imaginery", "abstract", "alignas", "alignof", "and", "and_eq", "any", "Any", "array", "as", "asm", "assert", "associatedtype", "associativity", "async", "atomic", "atomic_cancel", "atomic_commit", "atomic_noexcept", "auto", "await", "base", "bitand", "bitor", "BOOL", "bool", "boolean", "break", "bycopy", "byref", "byte", "Calendar", "case", "catch", "chan", "char", "char16_t", "char32_t", "checked", "class", "Class", "clone", "co_await", "co_return", "co_yield", "Codable", "CodingKey", "CodingKeys", "compl", "concept", "console", "const", "const_cast", "constexpr", "constructor", "continue", "convenience", "convert", "converter", "CultureInfo", "date", "date_parse_handling", "DateFormatter", "DateOnly", "DateOnlyConverter", "DateTime", "DateTimeStyles", "debugger", "decimal", "declare", "decltype", "decode_string", "Decoder", "DecodingError", "def", "default", "defer", "deinit", "del", "delegate", "delete", "dict", "dictionary", "didSet", "do", "double", "dynamic", "dynamic_cast", "elif", "else", "encode_quick_type", "Encoder", "enum", "EnumValues", "Equatable", "equalityContract", "event", "except", "exception", "explicit", "export", "exposing", "extends", "extension", "extern", "fallthrough", "false", "False", "fileprivate", "final", "finally", "fixed", "float", "for", "foreach", "FormatException", "friend", "from", "from_dict", "from_json", "func", "function", "get", "global", "go", "goto", "guard", "Hashable", "hashCode", "Hasher", "hasOwnProperty", "id", "if", "IMP", "implements", "implicit", "import", "in", "indirect", "infix", "init", "inline", "inout", "instanceof", "int", "interface", "internal", "IsoDateTimeOffsetConverter", "iterable", "is", "jdec", "jenc", "jpipe", "json", "json_converter", "json_serializer", "json_token", "json_writer", "JSONAny", "JSONCodingKey", "JSONDecoder", "JSONEncoder", "JsonException", "JsonGenerator", "JsonNode", "JSONNull", "JsonParser", "JsonReader", "JsonTokenType", "lambda", "lazy", "left", "let", "list", "Locale", "lock", "long", "makeDictEncoder", "map", "MarshalJSON", "MapEntry", "metadata_property_handling", "module", "mutable", "mutating", "namespace", "native", "new", "newtonsoft", "nil", "NO", "noexcept", "nonatomic", "none", "None", "nonlocal", "nonmutating", "NSObject", "noSuchMethod", "not", "not_eq", "NSError", "NSString", "NULL", "null", "nullptr", "number", "object", "ObjectMapper", "of", "oneway", "open", "operator", "optional", "or", "or_eq", "out", "override", "package", "params", "pass", "port", "postfix", "precedence", "prefix", "print", "printf", "printMembers", "private", "protected", "Protocol", "protocol", "public", "quicktype", "raise", "range", "readonly", "ref", "RegExp", "register", "reinterpret_cast", "repeat", "require", "required", "requires", "restrict", "retain", "rethrows", "return", "right", "runtimeType", "s", "sbyte", "sealed", "SEL", "select", "Self", "Serializable", "self", "Sendable", "serialize", "SerialName", "KSerializer", "PrimitiveKind", "SerialDescriptor", "SerializerProvider", "set", "short", "signed", "SimpleModule", "sizeof", "stackalloc", "Standards", "static", "static_assert", "static_cast", "StdDeserializer", "StdSerializer", "strictfp", "string", "struct", "subscript", "super", "switch", "symbol", "synchronized", "system", "template", "then", "this", "thread_local", "throw", "throws", "TimeOnly", "TimeOnlyConverter", "TimeZone", "to_json", "top_level", "toString", "to_dict", "transient", "True", "true", "try", "Type", "type", "typealias", "typedef", "typeid", "typename", "typeof", "uint", "ulong", "unchecked", "undefined", "union", "UnmarshalJSON", "UseSerializers", "unowned", "unsafe", "unsigned", "ushort", "using", "Utf8JsonReader", "Utf8JsonWriter", "UUID", "var", "virtual", "void", "volatile", "wchar_t", "weak", "where", "while", "willSet", "with", "xor", "xor_eq", "YES", "yield", "dummy") | |
| 21 | 21 | end |
| 22 | 22 | |
| 23 | 23 | module Enum |
| @@ -201,6 +201,7 @@ module Enum | ||
| 201 | 201 | Locale = "Locale" |
| 202 | 202 | Lock = "lock" |
| 203 | 203 | Long = "long" |
| 204 | + MakeDictEncoder = "makeDictEncoder" | |
| 204 | 205 | Map = "map" |
| 205 | 206 | MarshalJSON = "MarshalJSON" |
| 206 | 207 | MapEntry = "MapEntry" |
Mschema-rustdefault / module_under_test.rs+3 −0
| @@ -447,6 +447,9 @@ pub enum Enum { | ||
| 447 | 447 | |
| 448 | 448 | Long, |
| 449 | 449 | |
| 450 | + #[serde(rename = "makeDictEncoder")] | |
| 451 | + MakeDictEncoder, | |
| 452 | + | |
| 450 | 453 | Map, |
| 451 | 454 | |
| 452 | 455 | #[serde(rename = "MarshalJSON")] |
Mschema-scala3-upickledefault / TopLevel.scala+3 −0
| @@ -263,6 +263,7 @@ enum EnumEnum : | ||
| 263 | 263 | case Locale |
| 264 | 264 | case Lock |
| 265 | 265 | case EnumLong |
| 266 | + case MakeDictEncoder | |
| 266 | 267 | case EnumMap |
| 267 | 268 | case MarshalJSON |
| 268 | 269 | case MapEntry |
| @@ -609,6 +610,7 @@ given OptionPickler.ReadWriter[EnumEnum] = OptionPickler.readwriter[String].bima | ||
| 609 | 610 | case EnumEnum.Locale => "Locale" |
| 610 | 611 | case EnumEnum.Lock => "lock" |
| 611 | 612 | case EnumEnum.EnumLong => "long" |
| 613 | + case EnumEnum.MakeDictEncoder => "makeDictEncoder" | |
| 612 | 614 | case EnumEnum.EnumMap => "map" |
| 613 | 615 | case EnumEnum.MarshalJSON => "MarshalJSON" |
| 614 | 616 | case EnumEnum.MapEntry => "MapEntry" |
| @@ -954,6 +956,7 @@ given OptionPickler.ReadWriter[EnumEnum] = OptionPickler.readwriter[String].bima | ||
| 954 | 956 | case "Locale" => EnumEnum.Locale |
| 955 | 957 | case "lock" => EnumEnum.Lock |
| 956 | 958 | case "long" => EnumEnum.EnumLong |
| 959 | + case "makeDictEncoder" => EnumEnum.MakeDictEncoder | |
| 957 | 960 | case "map" => EnumEnum.EnumMap |
| 958 | 961 | case "MarshalJSON" => EnumEnum.MarshalJSON |
| 959 | 962 | case "MapEntry" => EnumEnum.MapEntry |
Mschema-scala3default / TopLevel.scala+3 −0
| @@ -192,6 +192,7 @@ enum EnumEnum : | ||
| 192 | 192 | case Locale |
| 193 | 193 | case Lock |
| 194 | 194 | case EnumLong |
| 195 | + case MakeDictEncoder | |
| 195 | 196 | case EnumMap |
| 196 | 197 | case MarshalJSON |
| 197 | 198 | case MapEntry |
| @@ -537,6 +538,7 @@ given Decoder[EnumEnum] = Decoder.decodeString.emap { | ||
| 537 | 538 | case "Locale" => scala.Right(EnumEnum.Locale) |
| 538 | 539 | case "lock" => scala.Right(EnumEnum.Lock) |
| 539 | 540 | case "long" => scala.Right(EnumEnum.EnumLong) |
| 541 | + case "makeDictEncoder" => scala.Right(EnumEnum.MakeDictEncoder) | |
| 540 | 542 | case "map" => scala.Right(EnumEnum.EnumMap) |
| 541 | 543 | case "MarshalJSON" => scala.Right(EnumEnum.MarshalJSON) |
| 542 | 544 | case "MapEntry" => scala.Right(EnumEnum.MapEntry) |
| @@ -883,6 +885,7 @@ given Encoder[EnumEnum] = Encoder.encodeString.contramap { | ||
| 883 | 885 | case EnumEnum.Locale => "Locale" |
| 884 | 886 | case EnumEnum.Lock => "lock" |
| 885 | 887 | case EnumEnum.EnumLong => "long" |
| 888 | + case EnumEnum.MakeDictEncoder => "makeDictEncoder" | |
| 886 | 889 | case EnumEnum.EnumMap => "map" |
| 887 | 890 | case EnumEnum.MarshalJSON => "MarshalJSON" |
| 888 | 891 | case EnumEnum.MapEntry => "MapEntry" |
Mschema-schemadefault / TopLevel.schema+1 −0
| @@ -196,6 +196,7 @@ | ||
| 196 | 196 | "Locale", |
| 197 | 197 | "lock", |
| 198 | 198 | "long", |
| 199 | + "makeDictEncoder", | |
| 199 | 200 | "map", |
| 200 | 201 | "MarshalJSON", |
| 201 | 202 | "MapEntry", |
Mschema-swiftdefault / quicktype.swift+1 −0
| @@ -230,6 +230,7 @@ enum Enum: String, Codable { | ||
| 230 | 230 | case locale = "Locale" |
| 231 | 231 | case lock = "lock" |
| 232 | 232 | case long = "long" |
| 233 | + case makeDictEncoder = "makeDictEncoder" | |
| 233 | 234 | case map = "map" |
| 234 | 235 | case marshalJSON = "MarshalJSON" |
| 235 | 236 | case mapEntry = "MapEntry" |
Mschema-typescript-effect-schemadefault / TopLevel.ts+1 −0
| @@ -182,6 +182,7 @@ export const Enum = S.Literal( | ||
| 182 | 182 | "Locale", |
| 183 | 183 | "lock", |
| 184 | 184 | "long", |
| 185 | + "makeDictEncoder", | |
| 185 | 186 | "map", |
| 186 | 187 | "MarshalJSON", |
| 187 | 188 | "MapEntry", |
Mschema-typescript-zoddefault / TopLevel.ts+1 −0
| @@ -182,6 +182,7 @@ export const EnumSchema = z.enum([ | ||
| 182 | 182 | "Locale", |
| 183 | 183 | "lock", |
| 184 | 184 | "long", |
| 185 | + "makeDictEncoder", | |
| 185 | 186 | "map", |
| 186 | 187 | "MarshalJSON", |
| 187 | 188 | "MapEntry", |
Mschema-typescriptdefault / TopLevel.ts+4 −3
| @@ -12,7 +12,7 @@ export interface TopLevel { | ||
| 12 | 12 | [property: string]: unknown; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | -export type Enum = "_" | "_Bool" | "_Complex" | "_Imaginery" | "abstract" | "alignas" | "alignof" | "and" | "and_eq" | "any" | "Any" | "array" | "as" | "asm" | "assert" | "associatedtype" | "associativity" | "async" | "atomic" | "atomic_cancel" | "atomic_commit" | "atomic_noexcept" | "auto" | "await" | "base" | "bitand" | "bitor" | "BOOL" | "bool" | "boolean" | "break" | "bycopy" | "byref" | "byte" | "Calendar" | "case" | "catch" | "chan" | "char" | "char16_t" | "char32_t" | "checked" | "class" | "Class" | "clone" | "co_await" | "co_return" | "co_yield" | "Codable" | "CodingKey" | "CodingKeys" | "compl" | "concept" | "console" | "const" | "const_cast" | "constexpr" | "constructor" | "continue" | "convenience" | "convert" | "converter" | "CultureInfo" | "date" | "date_parse_handling" | "DateFormatter" | "DateOnly" | "DateOnlyConverter" | "DateTime" | "DateTimeStyles" | "debugger" | "decimal" | "declare" | "decltype" | "decode_string" | "Decoder" | "DecodingError" | "def" | "default" | "defer" | "deinit" | "del" | "delegate" | "delete" | "dict" | "dictionary" | "didSet" | "do" | "double" | "dynamic" | "dynamic_cast" | "elif" | "else" | "encode_quick_type" | "Encoder" | "enum" | "EnumValues" | "Equatable" | "equalityContract" | "event" | "except" | "exception" | "explicit" | "export" | "exposing" | "extends" | "extension" | "extern" | "fallthrough" | "false" | "False" | "fileprivate" | "final" | "finally" | "fixed" | "float" | "for" | "foreach" | "FormatException" | "friend" | "from" | "from_dict" | "from_json" | "func" | "function" | "get" | "global" | "go" | "goto" | "guard" | "Hashable" | "hashCode" | "Hasher" | "hasOwnProperty" | "id" | "if" | "IMP" | "implements" | "implicit" | "import" | "in" | "indirect" | "infix" | "init" | "inline" | "inout" | "instanceof" | "int" | "interface" | "internal" | "IsoDateTimeOffsetConverter" | "iterable" | "is" | "jdec" | "jenc" | "jpipe" | "json" | "json_converter" | "json_serializer" | "json_token" | "json_writer" | "JSONAny" | "JSONCodingKey" | "JSONDecoder" | "JSONEncoder" | "JsonException" | "JsonGenerator" | "JsonNode" | "JSONNull" | "JsonParser" | "JsonReader" | "JsonTokenType" | "lambda" | "lazy" | "left" | "let" | "list" | "Locale" | "lock" | "long" | "map" | "MarshalJSON" | "MapEntry" | "metadata_property_handling" | "module" | "mutable" | "mutating" | "namespace" | "native" | "new" | "newtonsoft" | "nil" | "NO" | "noexcept" | "nonatomic" | "none" | "None" | "nonlocal" | "nonmutating" | "NSObject" | "noSuchMethod" | "not" | "not_eq" | "NSError" | "NSString" | "NULL" | "null" | "nullptr" | "number" | "object" | "ObjectMapper" | "of" | "oneway" | "open" | "operator" | "optional" | "or" | "or_eq" | "out" | "override" | "package" | "params" | "pass" | "port" | "postfix" | "precedence" | "prefix" | "print" | "printf" | "printMembers" | "private" | "protected" | "Protocol" | "protocol" | "public" | "quicktype" | "raise" | "range" | "readonly" | "ref" | "RegExp" | "register" | "reinterpret_cast" | "repeat" | "require" | "required" | "requires" | "restrict" | "retain" | "rethrows" | "return" | "right" | "runtimeType" | "s" | "sbyte" | "sealed" | "SEL" | "select" | "Self" | "Serializable" | "self" | "Sendable" | "serialize" | "SerialName" | "KSerializer" | "PrimitiveKind" | "SerialDescriptor" | "SerializerProvider" | "set" | "short" | "signed" | "SimpleModule" | "sizeof" | "stackalloc" | "Standards" | "static" | "static_assert" | "static_cast" | "StdDeserializer" | "StdSerializer" | "strictfp" | "string" | "struct" | "subscript" | "super" | "switch" | "symbol" | "synchronized" | "system" | "template" | "then" | "this" | "thread_local" | "throw" | "throws" | "TimeOnly" | "TimeOnlyConverter" | "TimeZone" | "to_json" | "top_level" | "toString" | "to_dict" | "transient" | "True" | "true" | "try" | "Type" | "type" | "typealias" | "typedef" | "typeid" | "typename" | "typeof" | "uint" | "ulong" | "unchecked" | "undefined" | "union" | "UnmarshalJSON" | "UseSerializers" | "unowned" | "unsafe" | "unsigned" | "ushort" | "using" | "Utf8JsonReader" | "Utf8JsonWriter" | "UUID" | "var" | "virtual" | "void" | "volatile" | "wchar_t" | "weak" | "where" | "while" | "willSet" | "with" | "xor" | "xor_eq" | "YES" | "yield" | "dummy"; | |
| 15 | +export type Enum = "_" | "_Bool" | "_Complex" | "_Imaginery" | "abstract" | "alignas" | "alignof" | "and" | "and_eq" | "any" | "Any" | "array" | "as" | "asm" | "assert" | "associatedtype" | "associativity" | "async" | "atomic" | "atomic_cancel" | "atomic_commit" | "atomic_noexcept" | "auto" | "await" | "base" | "bitand" | "bitor" | "BOOL" | "bool" | "boolean" | "break" | "bycopy" | "byref" | "byte" | "Calendar" | "case" | "catch" | "chan" | "char" | "char16_t" | "char32_t" | "checked" | "class" | "Class" | "clone" | "co_await" | "co_return" | "co_yield" | "Codable" | "CodingKey" | "CodingKeys" | "compl" | "concept" | "console" | "const" | "const_cast" | "constexpr" | "constructor" | "continue" | "convenience" | "convert" | "converter" | "CultureInfo" | "date" | "date_parse_handling" | "DateFormatter" | "DateOnly" | "DateOnlyConverter" | "DateTime" | "DateTimeStyles" | "debugger" | "decimal" | "declare" | "decltype" | "decode_string" | "Decoder" | "DecodingError" | "def" | "default" | "defer" | "deinit" | "del" | "delegate" | "delete" | "dict" | "dictionary" | "didSet" | "do" | "double" | "dynamic" | "dynamic_cast" | "elif" | "else" | "encode_quick_type" | "Encoder" | "enum" | "EnumValues" | "Equatable" | "equalityContract" | "event" | "except" | "exception" | "explicit" | "export" | "exposing" | "extends" | "extension" | "extern" | "fallthrough" | "false" | "False" | "fileprivate" | "final" | "finally" | "fixed" | "float" | "for" | "foreach" | "FormatException" | "friend" | "from" | "from_dict" | "from_json" | "func" | "function" | "get" | "global" | "go" | "goto" | "guard" | "Hashable" | "hashCode" | "Hasher" | "hasOwnProperty" | "id" | "if" | "IMP" | "implements" | "implicit" | "import" | "in" | "indirect" | "infix" | "init" | "inline" | "inout" | "instanceof" | "int" | "interface" | "internal" | "IsoDateTimeOffsetConverter" | "iterable" | "is" | "jdec" | "jenc" | "jpipe" | "json" | "json_converter" | "json_serializer" | "json_token" | "json_writer" | "JSONAny" | "JSONCodingKey" | "JSONDecoder" | "JSONEncoder" | "JsonException" | "JsonGenerator" | "JsonNode" | "JSONNull" | "JsonParser" | "JsonReader" | "JsonTokenType" | "lambda" | "lazy" | "left" | "let" | "list" | "Locale" | "lock" | "long" | "makeDictEncoder" | "map" | "MarshalJSON" | "MapEntry" | "metadata_property_handling" | "module" | "mutable" | "mutating" | "namespace" | "native" | "new" | "newtonsoft" | "nil" | "NO" | "noexcept" | "nonatomic" | "none" | "None" | "nonlocal" | "nonmutating" | "NSObject" | "noSuchMethod" | "not" | "not_eq" | "NSError" | "NSString" | "NULL" | "null" | "nullptr" | "number" | "object" | "ObjectMapper" | "of" | "oneway" | "open" | "operator" | "optional" | "or" | "or_eq" | "out" | "override" | "package" | "params" | "pass" | "port" | "postfix" | "precedence" | "prefix" | "print" | "printf" | "printMembers" | "private" | "protected" | "Protocol" | "protocol" | "public" | "quicktype" | "raise" | "range" | "readonly" | "ref" | "RegExp" | "register" | "reinterpret_cast" | "repeat" | "require" | "required" | "requires" | "restrict" | "retain" | "rethrows" | "return" | "right" | "runtimeType" | "s" | "sbyte" | "sealed" | "SEL" | "select" | "Self" | "Serializable" | "self" | "Sendable" | "serialize" | "SerialName" | "KSerializer" | "PrimitiveKind" | "SerialDescriptor" | "SerializerProvider" | "set" | "short" | "signed" | "SimpleModule" | "sizeof" | "stackalloc" | "Standards" | "static" | "static_assert" | "static_cast" | "StdDeserializer" | "StdSerializer" | "strictfp" | "string" | "struct" | "subscript" | "super" | "switch" | "symbol" | "synchronized" | "system" | "template" | "then" | "this" | "thread_local" | "throw" | "throws" | "TimeOnly" | "TimeOnlyConverter" | "TimeZone" | "to_json" | "top_level" | "toString" | "to_dict" | "transient" | "True" | "true" | "try" | "Type" | "type" | "typealias" | "typedef" | "typeid" | "typename" | "typeof" | "uint" | "ulong" | "unchecked" | "undefined" | "union" | "UnmarshalJSON" | "UseSerializers" | "unowned" | "unsafe" | "unsigned" | "ushort" | "using" | "Utf8JsonReader" | "Utf8JsonWriter" | "UUID" | "var" | "virtual" | "void" | "volatile" | "wchar_t" | "weak" | "where" | "while" | "willSet" | "with" | "xor" | "xor_eq" | "YES" | "yield" | "dummy"; | |
| 16 | 16 | |
| 17 | 17 | // Converts JSON strings to/from your types |
| 18 | 18 | // and asserts the results of JSON.parse at runtime |
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
| @@ -385,6 +385,7 @@ const typeMap: any = { | ||
| 385 | 385 | "Locale", |
| 386 | 386 | "lock", |
| 387 | 387 | "long", |
| 388 | + "makeDictEncoder", | |
| 388 | 389 | "map", |
| 389 | 390 | "MarshalJSON", |
| 390 | 391 | "MapEntry", |
Test case
37 generated files · +1,350 −171test/inputs/schema/keyword-unions.schema
Mschema-cjsondefault / TopLevel.c+104 −0
| @@ -5593,6 +5593,50 @@ void cJSON_DeleteUnionLock(struct UnionLock * x) { | ||
| 5593 | 5593 | } |
| 5594 | 5594 | } |
| 5595 | 5595 | |
| 5596 | +struct UnionMakeDictEncoder * cJSON_GetUnionMakeDictEncoderValue(const cJSON * j) { | |
| 5597 | + struct UnionMakeDictEncoder * x = cJSON_malloc(sizeof(struct UnionMakeDictEncoder)); | |
| 5598 | + if (NULL != x) { | |
| 5599 | + memset(x, 0, sizeof(struct UnionMakeDictEncoder)); | |
| 5600 | + if (cJSON_IsNumber(j)) { | |
| 5601 | + x->type = cJSON_Number; | |
| 5602 | + x->value.number = cJSON_GetNumberValue(j); | |
| 5603 | + } | |
| 5604 | + else if (cJSON_IsObject(j)) { | |
| 5605 | + x->type = cJSON_Object; | |
| 5606 | + x->value.make_dict_encoder = cJSON_GetMakeDictEncoderValue(j); | |
| 5607 | + if (NULL == x->value.make_dict_encoder) x->type = 0; | |
| 5608 | + } | |
| 5609 | + if (0 == x->type) { cJSON_free(x); return NULL; } | |
| 5610 | + } | |
| 5611 | + return x; | |
| 5612 | +} | |
| 5613 | +struct UnionMakeDictEncoder * cJSON_ParseUnionMakeDictEncoder(const char * s) { cJSON * j = cJSON_Parse(s); struct UnionMakeDictEncoder * x = j ? cJSON_GetUnionMakeDictEncoderValue(j) : NULL; cJSON_Delete(j); return x; } | |
| 5614 | +char * cJSON_PrintUnionMakeDictEncoder(const struct UnionMakeDictEncoder * x) { cJSON * j = cJSON_CreateUnionMakeDictEncoder(x); char * s = j ? cJSON_Print(j) : NULL; cJSON_Delete(j); return s; } | |
| 5615 | + | |
| 5616 | +cJSON * cJSON_CreateUnionMakeDictEncoder(const struct UnionMakeDictEncoder * x) { | |
| 5617 | + cJSON * j = NULL; | |
| 5618 | + if (NULL != x) { | |
| 5619 | + if (cJSON_Number == x->type) { | |
| 5620 | + j = cJSON_CreateNumber(x->value.number); | |
| 5621 | + } | |
| 5622 | + else if (cJSON_Object == x->type) { | |
| 5623 | + j = cJSON_CreateMakeDictEncoder(x->value.make_dict_encoder); | |
| 5624 | + } | |
| 5625 | + } | |
| 5626 | + return j; | |
| 5627 | +} | |
| 5628 | + | |
| 5629 | +void cJSON_DeleteUnionMakeDictEncoder(struct UnionMakeDictEncoder * x) { | |
| 5630 | + if (NULL != x) { | |
| 5631 | + if (cJSON_Number == x->type) { | |
| 5632 | + } | |
| 5633 | + else if (cJSON_Object == x->type) { | |
| 5634 | + cJSON_DeleteMakeDictEncoder(x->value.make_dict_encoder); | |
| 5635 | + } | |
| 5636 | + cJSON_free(x); | |
| 5637 | + } | |
| 5638 | +} | |
| 5639 | + | |
| 5596 | 5640 | struct UnionMap * cJSON_GetUnionMapValue(const cJSON * j) { |
| 5597 | 5641 | struct UnionMap * x = cJSON_malloc(sizeof(struct UnionMap)); |
| 5598 | 5642 | if (NULL != x) { |
| @@ -21276,6 +21320,55 @@ void cJSON_DeleteLock(struct Lock * x) { | ||
| 21276 | 21320 | } |
| 21277 | 21321 | } |
| 21278 | 21322 | |
| 21323 | +struct MakeDictEncoder * cJSON_ParseMakeDictEncoder(const char * s) { | |
| 21324 | + struct MakeDictEncoder * x = NULL; | |
| 21325 | + if (NULL != s) { | |
| 21326 | + cJSON * j = cJSON_Parse(s); | |
| 21327 | + if (NULL != j) { | |
| 21328 | + x = cJSON_GetMakeDictEncoderValue(j); | |
| 21329 | + cJSON_Delete(j); | |
| 21330 | + } | |
| 21331 | + } | |
| 21332 | + return x; | |
| 21333 | +} | |
| 21334 | + | |
| 21335 | +struct MakeDictEncoder * cJSON_GetMakeDictEncoderValue(const cJSON * j) { | |
| 21336 | + struct MakeDictEncoder * x = NULL; | |
| 21337 | + if (NULL != j) { | |
| 21338 | + if (NULL != (x = cJSON_malloc(sizeof(struct MakeDictEncoder)))) { | |
| 21339 | + memset(x, 0, sizeof(struct MakeDictEncoder)); | |
| 21340 | + } | |
| 21341 | + } | |
| 21342 | + return x; | |
| 21343 | +} | |
| 21344 | + | |
| 21345 | +cJSON * cJSON_CreateMakeDictEncoder(const struct MakeDictEncoder * x) { | |
| 21346 | + cJSON * j = NULL; | |
| 21347 | + if (NULL != x) { | |
| 21348 | + if (NULL != (j = cJSON_CreateObject())) { | |
| 21349 | + } | |
| 21350 | + } | |
| 21351 | + return j; | |
| 21352 | +} | |
| 21353 | + | |
| 21354 | +char * cJSON_PrintMakeDictEncoder(const struct MakeDictEncoder * x) { | |
| 21355 | + char * s = NULL; | |
| 21356 | + if (NULL != x) { | |
| 21357 | + cJSON * j = cJSON_CreateMakeDictEncoder(x); | |
| 21358 | + if (NULL != j) { | |
| 21359 | + s = cJSON_Print(j); | |
| 21360 | + cJSON_Delete(j); | |
| 21361 | + } | |
| 21362 | + } | |
| 21363 | + return s; | |
| 21364 | +} | |
| 21365 | + | |
| 21366 | +void cJSON_DeleteMakeDictEncoder(struct MakeDictEncoder * x) { | |
| 21367 | + if (NULL != x) { | |
| 21368 | + cJSON_free(x); | |
| 21369 | + } | |
| 21370 | +} | |
| 21371 | + | |
| 21279 | 21372 | struct Map * cJSON_ParseMap(const char * s) { |
| 21280 | 21373 | struct Map * x = NULL; |
| 21281 | 21374 | if (NULL != s) { |
| @@ -32739,6 +32832,11 @@ struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | ||
| 32739 | 32832 | x->top_level_long = cJSON_GetUnionLongValue(cJSON_GetObjectItemCaseSensitive(j, "long")); |
| 32740 | 32833 | if (NULL == x->top_level_long) { cJSON_DeleteTopLevel(x); return NULL; } |
| 32741 | 32834 | } |
| 32835 | + if (cJSON_HasObjectItem(j, "makeDictEncoder")) { | |
| 32836 | + if (!cJSON_IsUnionMakeDictEncoder(cJSON_GetObjectItemCaseSensitive(j, "makeDictEncoder"))) { cJSON_DeleteTopLevel(x); return NULL; } | |
| 32837 | + x->make_dict_encoder = cJSON_GetUnionMakeDictEncoderValue(cJSON_GetObjectItemCaseSensitive(j, "makeDictEncoder")); | |
| 32838 | + if (NULL == x->make_dict_encoder) { cJSON_DeleteTopLevel(x); return NULL; } | |
| 32839 | + } | |
| 32742 | 32840 | if (cJSON_HasObjectItem(j, "map")) { |
| 32743 | 32841 | if (!cJSON_IsUnionMap(cJSON_GetObjectItemCaseSensitive(j, "map"))) { cJSON_DeleteTopLevel(x); return NULL; } |
| 32744 | 32842 | x->map = cJSON_GetUnionMapValue(cJSON_GetObjectItemCaseSensitive(j, "map")); |
| @@ -34099,6 +34197,9 @@ cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | ||
| 34099 | 34197 | if (NULL != x->top_level_long) { |
| 34100 | 34198 | cJSON_AddItemToObject(j, "long", cJSON_CreateUnionLong(x->top_level_long)); |
| 34101 | 34199 | } |
| 34200 | + if (NULL != x->make_dict_encoder) { | |
| 34201 | + cJSON_AddItemToObject(j, "makeDictEncoder", cJSON_CreateUnionMakeDictEncoder(x->make_dict_encoder)); | |
| 34202 | + } | |
| 34102 | 34203 | if (NULL != x->map) { |
| 34103 | 34204 | cJSON_AddItemToObject(j, "map", cJSON_CreateUnionMap(x->map)); |
| 34104 | 34205 | } |
| @@ -35147,6 +35248,9 @@ void cJSON_DeleteTopLevel(struct TopLevel * x) { | ||
| 35147 | 35248 | if (NULL != x->top_level_long) { |
| 35148 | 35249 | cJSON_DeleteUnionLong(x->top_level_long); |
| 35149 | 35250 | } |
| 35251 | + if (NULL != x->make_dict_encoder) { | |
| 35252 | + cJSON_DeleteUnionMakeDictEncoder(x->make_dict_encoder); | |
| 35253 | + } | |
| 35150 | 35254 | if (NULL != x->map) { |
| 35151 | 35255 | cJSON_DeleteUnionMap(x->map); |
| 35152 | 35256 | } |
Mschema-cjsondefault / TopLevel.h+25 −0
| @@ -1445,6 +1445,17 @@ struct UnionLock { | ||
| 1445 | 1445 | } value; |
| 1446 | 1446 | }; |
| 1447 | 1447 | |
| 1448 | +struct MakeDictEncoder { | |
| 1449 | +}; | |
| 1450 | + | |
| 1451 | +struct UnionMakeDictEncoder { | |
| 1452 | + int type; | |
| 1453 | + union { | |
| 1454 | + double number; | |
| 1455 | + struct MakeDictEncoder * make_dict_encoder; | |
| 1456 | + } value; | |
| 1457 | +}; | |
| 1458 | + | |
| 1448 | 1459 | struct Map { |
| 1449 | 1460 | }; |
| 1450 | 1461 | |
| @@ -3993,6 +4004,7 @@ struct TopLevel { | ||
| 3993 | 4004 | struct UnionLocale * locale; |
| 3994 | 4005 | struct UnionLock * lock; |
| 3995 | 4006 | struct UnionLong * top_level_long; |
| 4007 | + struct UnionMakeDictEncoder * make_dict_encoder; | |
| 3996 | 4008 | struct UnionMap * map; |
| 3997 | 4009 | struct UnionMapEntry * map_entry; |
| 3998 | 4010 | struct UnionMarshalJson * marshal_json; |
| @@ -5045,6 +5057,13 @@ void cJSON_DeleteUnionLock(struct UnionLock * x); | ||
| 5045 | 5057 | struct UnionLock * cJSON_ParseUnionLock(const char * s); |
| 5046 | 5058 | char * cJSON_PrintUnionLock(const struct UnionLock * x); |
| 5047 | 5059 | |
| 5060 | +#define cJSON_IsUnionMakeDictEncoder(j) (cJSON_IsNumber(j) || cJSON_IsObject(j)) | |
| 5061 | +struct UnionMakeDictEncoder * cJSON_GetUnionMakeDictEncoderValue(const cJSON * j); | |
| 5062 | +cJSON * cJSON_CreateUnionMakeDictEncoder(const struct UnionMakeDictEncoder * x); | |
| 5063 | +void cJSON_DeleteUnionMakeDictEncoder(struct UnionMakeDictEncoder * x); | |
| 5064 | +struct UnionMakeDictEncoder * cJSON_ParseUnionMakeDictEncoder(const char * s); | |
| 5065 | +char * cJSON_PrintUnionMakeDictEncoder(const struct UnionMakeDictEncoder * x); | |
| 5066 | + | |
| 5048 | 5067 | #define cJSON_IsUnionMap(j) (cJSON_IsNumber(j) || cJSON_IsObject(j)) |
| 5049 | 5068 | struct UnionMap * cJSON_GetUnionMapValue(const cJSON * j); |
| 5050 | 5069 | cJSON * cJSON_CreateUnionMap(const struct UnionMap * x); |
| @@ -7312,6 +7331,12 @@ cJSON * cJSON_CreateLock(const struct Lock * x); | ||
| 7312 | 7331 | char * cJSON_PrintLock(const struct Lock * x); |
| 7313 | 7332 | void cJSON_DeleteLock(struct Lock * x); |
| 7314 | 7333 | |
| 7334 | +struct MakeDictEncoder * cJSON_ParseMakeDictEncoder(const char * s); | |
| 7335 | +struct MakeDictEncoder * cJSON_GetMakeDictEncoderValue(const cJSON * j); | |
| 7336 | +cJSON * cJSON_CreateMakeDictEncoder(const struct MakeDictEncoder * x); | |
| 7337 | +char * cJSON_PrintMakeDictEncoder(const struct MakeDictEncoder * x); | |
| 7338 | +void cJSON_DeleteMakeDictEncoder(struct MakeDictEncoder * x); | |
| 7339 | + | |
| 7315 | 7340 | struct Map * cJSON_ParseMap(const char * s); |
| 7316 | 7341 | struct Map * cJSON_GetMapValue(const cJSON * j); |
| 7317 | 7342 | cJSON * cJSON_CreateMap(const struct Map * x); |
Mschema-cplusplusdefault / quicktype.hpp+60 −0
| @@ -1613,6 +1613,18 @@ namespace quicktype { | ||
| 1613 | 1613 | |
| 1614 | 1614 | using UnionLock = std::variant<Lock, double>; |
| 1615 | 1615 | |
| 1616 | + class MakeDictEncoder { | |
| 1617 | + public: | |
| 1618 | + MakeDictEncoder() = default; | |
| 1619 | + virtual ~MakeDictEncoder() = default; | |
| 1620 | + | |
| 1621 | + private: | |
| 1622 | + | |
| 1623 | + public: | |
| 1624 | + }; | |
| 1625 | + | |
| 1626 | + using UnionMakeDictEncoder = std::variant<MakeDictEncoder, double>; | |
| 1627 | + | |
| 1616 | 1628 | class Map { |
| 1617 | 1629 | public: |
| 1618 | 1630 | Map() = default; |
| @@ -4381,6 +4393,7 @@ namespace quicktype { | ||
| 4381 | 4393 | std::optional<UnionLocale> locale; |
| 4382 | 4394 | std::optional<UnionLock> lock; |
| 4383 | 4395 | std::optional<UnionLong> top_level_long; |
| 4396 | + std::optional<UnionMakeDictEncoder> make_dict_encoder; | |
| 4384 | 4397 | std::optional<UnionMap> map; |
| 4385 | 4398 | std::optional<UnionMapEntry> map_entry; |
| 4386 | 4399 | std::optional<UnionMarshalJson> marshal_json; |
| @@ -5272,6 +5285,10 @@ namespace quicktype { | ||
| 5272 | 5285 | std::optional<UnionLong> & get_mutable_top_level_long() { return top_level_long; } |
| 5273 | 5286 | void set_top_level_long(const std::optional<UnionLong> & value) { this->top_level_long = value; } |
| 5274 | 5287 | |
| 5288 | + const std::optional<UnionMakeDictEncoder> & get_make_dict_encoder() const { return make_dict_encoder; } | |
| 5289 | + std::optional<UnionMakeDictEncoder> & get_mutable_make_dict_encoder() { return make_dict_encoder; } | |
| 5290 | + void set_make_dict_encoder(const std::optional<UnionMakeDictEncoder> & value) { this->make_dict_encoder = value; } | |
| 5291 | + | |
| 5275 | 5292 | const std::optional<UnionMap> & get_map() const { return map; } |
| 5276 | 5293 | std::optional<UnionMap> & get_mutable_map() { return map; } |
| 5277 | 5294 | void set_map(const std::optional<UnionMap> & value) { this->map = value; } |
| @@ -6300,6 +6317,9 @@ void to_json(json & j, const Locale & x); | ||
| 6300 | 6317 | void from_json(const json & j, Lock & x); |
| 6301 | 6318 | void to_json(json & j, const Lock & x); |
| 6302 | 6319 | |
| 6320 | +void from_json(const json & j, MakeDictEncoder & x); | |
| 6321 | +void to_json(json & j, const MakeDictEncoder & x); | |
| 6322 | + | |
| 6303 | 6323 | void from_json(const json & j, Map & x); |
| 6304 | 6324 | void to_json(json & j, const Map & x); |
| 6305 | 6325 | |
| @@ -7711,6 +7731,12 @@ struct adl_serializer<std::variant<quicktype::Lock, double>> { | ||
| 7711 | 7731 | static void to_json(json & j, const std::variant<quicktype::Lock, double> & x); |
| 7712 | 7732 | }; |
| 7713 | 7733 | |
| 7734 | +template <> | |
| 7735 | +struct adl_serializer<std::variant<quicktype::MakeDictEncoder, double>> { | |
| 7736 | + static void from_json(const json & j, std::variant<quicktype::MakeDictEncoder, double> & x); | |
| 7737 | + static void to_json(json & j, const std::variant<quicktype::MakeDictEncoder, double> & x); | |
| 7738 | +}; | |
| 7739 | + | |
| 7714 | 7740 | template <> |
| 7715 | 7741 | struct adl_serializer<std::variant<quicktype::Map, double>> { |
| 7716 | 7742 | static void from_json(const json & j, std::variant<quicktype::Map, double> & x); |
| @@ -10399,6 +10425,17 @@ namespace quicktype { | ||
| 10399 | 10425 | (void)x; |
| 10400 | 10426 | } |
| 10401 | 10427 | |
| 10428 | + inline void from_json(const json & j, MakeDictEncoder& x) { | |
| 10429 | + if (!j.is_object()) throw std::runtime_error("Expected object"); | |
| 10430 | + (void)j; | |
| 10431 | + (void)x; | |
| 10432 | + } | |
| 10433 | + | |
| 10434 | + inline void to_json(json & j, const MakeDictEncoder & x) { | |
| 10435 | + j = json::object(); | |
| 10436 | + (void)x; | |
| 10437 | + } | |
| 10438 | + | |
| 10402 | 10439 | inline void from_json(const json & j, Map& x) { |
| 10403 | 10440 | if (!j.is_object()) throw std::runtime_error("Expected object"); |
| 10404 | 10441 | (void)j; |
| @@ -13130,6 +13167,8 @@ namespace quicktype { | ||
| 13130 | 13167 | x.set_lock(get_stack_optional<std::variant<Lock, double>>(j, "lock")); |
| 13131 | 13168 | if (j.find("long") != j.end() && j.at("long").is_null()) throw std::runtime_error("Unexpected null"); |
| 13132 | 13169 | x.set_top_level_long(get_stack_optional<std::variant<Long, double>>(j, "long")); |
| 13170 | + if (j.find("makeDictEncoder") != j.end() && j.at("makeDictEncoder").is_null()) throw std::runtime_error("Unexpected null"); | |
| 13171 | + x.set_make_dict_encoder(get_stack_optional<std::variant<MakeDictEncoder, double>>(j, "makeDictEncoder")); | |
| 13133 | 13172 | if (j.find("map") != j.end() && j.at("map").is_null()) throw std::runtime_error("Unexpected null"); |
| 13134 | 13173 | x.set_map(get_stack_optional<std::variant<Map, double>>(j, "map")); |
| 13135 | 13174 | if (j.find("MapEntry") != j.end() && j.at("MapEntry").is_null()) throw std::runtime_error("Unexpected null"); |
| @@ -13638,6 +13677,7 @@ namespace quicktype { | ||
| 13638 | 13677 | j["Locale"] = x.get_locale(); |
| 13639 | 13678 | j["lock"] = x.get_lock(); |
| 13640 | 13679 | j["long"] = x.get_top_level_long(); |
| 13680 | + j["makeDictEncoder"] = x.get_make_dict_encoder(); | |
| 13641 | 13681 | j["map"] = x.get_map(); |
| 13642 | 13682 | j["MapEntry"] = x.get_map_entry(); |
| 13643 | 13683 | j["MarshalJSON"] = x.get_marshal_json(); |
| @@ -16342,6 +16382,26 @@ namespace nlohmann { | ||
| 16342 | 16382 | } |
| 16343 | 16383 | } |
| 16344 | 16384 | |
| 16385 | + inline void adl_serializer<std::variant<quicktype::MakeDictEncoder, double>>::from_json(const json & j, std::variant<quicktype::MakeDictEncoder, double> & x) { | |
| 16386 | + if (j.is_number()) | |
| 16387 | + x = j.get<double>(); | |
| 16388 | + else if (j.is_object()) | |
| 16389 | + x = j.get<quicktype::MakeDictEncoder>(); | |
| 16390 | + else throw std::runtime_error("Could not deserialise!"); | |
| 16391 | + } | |
| 16392 | + | |
| 16393 | + inline void adl_serializer<std::variant<quicktype::MakeDictEncoder, double>>::to_json(json & j, const std::variant<quicktype::MakeDictEncoder, double> & x) { | |
| 16394 | + switch (x.index()) { | |
| 16395 | + case 0: | |
| 16396 | + j = std::get<quicktype::MakeDictEncoder>(x); | |
| 16397 | + break; | |
| 16398 | + case 1: | |
| 16399 | + j = std::get<double>(x); | |
| 16400 | + break; | |
| 16401 | + default: throw std::runtime_error("Input JSON does not conform to schema!"); | |
| 16402 | + } | |
| 16403 | + } | |
| 16404 | + | |
| 16345 | 16405 | inline void adl_serializer<std::variant<quicktype::Map, double>>::from_json(const json & j, std::variant<quicktype::Map, double> & x) { |
| 16346 | 16406 | if (j.is_number()) |
| 16347 | 16407 | x = j.get<double>(); |
Mschema-crystaldefault / TopLevel.cr+10 −0
| @@ -428,6 +428,9 @@ class TopLevel | ||
| 428 | 428 | |
| 429 | 429 | property long : UnionLong? |
| 430 | 430 | |
| 431 | + @[JSON::Field(key: "makeDictEncoder")] | |
| 432 | + property make_dict_encoder : UnionMakeDictEncoder? | |
| 433 | + | |
| 431 | 434 | property map : UnionMap? |
| 432 | 435 | |
| 433 | 436 | @[JSON::Field(key: "MapEntry")] |
| @@ -1625,6 +1628,11 @@ class Long | ||
| 1625 | 1628 | |
| 1626 | 1629 | end |
| 1627 | 1630 | |
| 1631 | +class MakeDictEncoder | |
| 1632 | + include JSON::Serializable | |
| 1633 | + | |
| 1634 | +end | |
| 1635 | + | |
| 1628 | 1636 | class Map |
| 1629 | 1637 | include JSON::Serializable |
| 1630 | 1638 | |
| @@ -2849,6 +2857,8 @@ alias UnionLock = Float64 | Lock | ||
| 2849 | 2857 | |
| 2850 | 2858 | alias UnionLong = Float64 | Long |
| 2851 | 2859 | |
| 2860 | +alias UnionMakeDictEncoder = Float64 | MakeDictEncoder | |
| 2861 | + | |
| 2852 | 2862 | alias UnionMap = Float64 | Map |
| 2853 | 2863 | |
| 2854 | 2864 | alias UnionMapEntry = Float64 | MapEntry |
Mschema-csharp-recordsdefault / QuickType.cs+55 −0
| @@ -571,6 +571,9 @@ namespace QuickType | ||
| 571 | 571 | [JsonProperty("long", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 572 | 572 | public UnionLong? Long { get; set; } |
| 573 | 573 | |
| 574 | + [JsonProperty("makeDictEncoder", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 575 | + public UnionMakeDictEncoder? MakeDictEncoder { get; set; } | |
| 576 | + | |
| 574 | 577 | [JsonProperty("map", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 575 | 578 | public UnionMap? Map { get; set; } |
| 576 | 579 | |
| @@ -1747,6 +1750,10 @@ namespace QuickType | ||
| 1747 | 1750 | { |
| 1748 | 1751 | } |
| 1749 | 1752 | |
| 1753 | + public partial record MakeDictEncoder | |
| 1754 | + { | |
| 1755 | + } | |
| 1756 | + | |
| 1750 | 1757 | public partial record Map |
| 1751 | 1758 | { |
| 1752 | 1759 | } |
| @@ -3980,6 +3987,15 @@ namespace QuickType | ||
| 3980 | 3987 | public static implicit operator UnionLong(Long Long) => new UnionLong { Long = Long }; |
| 3981 | 3988 | } |
| 3982 | 3989 | |
| 3990 | + public partial struct UnionMakeDictEncoder | |
| 3991 | + { | |
| 3992 | + public double? Double; | |
| 3993 | + public MakeDictEncoder? MakeDictEncoder; | |
| 3994 | + | |
| 3995 | + public static implicit operator UnionMakeDictEncoder(double Double) => new UnionMakeDictEncoder { Double = Double }; | |
| 3996 | + public static implicit operator UnionMakeDictEncoder(MakeDictEncoder MakeDictEncoder) => new UnionMakeDictEncoder { MakeDictEncoder = MakeDictEncoder }; | |
| 3997 | + } | |
| 3998 | + | |
| 3983 | 3999 | public partial struct UnionMap |
| 3984 | 4000 | { |
| 3985 | 4001 | public double? Double; |
| @@ -5734,6 +5750,7 @@ namespace QuickType | ||
| 5734 | 5750 | UnionListConverter.Singleton, |
| 5735 | 5751 | UnionLockConverter.Singleton, |
| 5736 | 5752 | UnionLongConverter.Singleton, |
| 5753 | + UnionMakeDictEncoderConverter.Singleton, | |
| 5737 | 5754 | UnionMapConverter.Singleton, |
| 5738 | 5755 | UnionMetadataPropertyHandlingConverter.Singleton, |
| 5739 | 5756 | UnionModuleConverter.Singleton, |
| @@ -14036,6 +14053,44 @@ namespace QuickType | ||
| 14036 | 14053 | public static readonly UnionLongConverter Singleton = new UnionLongConverter(); |
| 14037 | 14054 | } |
| 14038 | 14055 | |
| 14056 | + internal class UnionMakeDictEncoderConverter : JsonConverter | |
| 14057 | + { | |
| 14058 | + public override bool CanConvert(Type t) => t == typeof(UnionMakeDictEncoder) || t == typeof(UnionMakeDictEncoder?); | |
| 14059 | + | |
| 14060 | + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) | |
| 14061 | + { | |
| 14062 | + switch (reader.TokenType) | |
| 14063 | + { | |
| 14064 | + case JsonToken.Integer: | |
| 14065 | + case JsonToken.Float: | |
| 14066 | + var doubleValue = serializer.Deserialize<double>(reader); | |
| 14067 | + return new UnionMakeDictEncoder { Double = doubleValue }; | |
| 14068 | + case JsonToken.StartObject: | |
| 14069 | + var objectValue = serializer.Deserialize<MakeDictEncoder>(reader); | |
| 14070 | + return new UnionMakeDictEncoder { MakeDictEncoder = objectValue }; | |
| 14071 | + } | |
| 14072 | + throw new Exception("Cannot unmarshal type UnionMakeDictEncoder"); | |
| 14073 | + } | |
| 14074 | + | |
| 14075 | + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) | |
| 14076 | + { | |
| 14077 | + var value = (UnionMakeDictEncoder)untypedValue; | |
| 14078 | + if (value.Double != null) | |
| 14079 | + { | |
| 14080 | + serializer.Serialize(writer, value.Double.Value); | |
| 14081 | + return; | |
| 14082 | + } | |
| 14083 | + if (value.MakeDictEncoder != null) | |
| 14084 | + { | |
| 14085 | + serializer.Serialize(writer, value.MakeDictEncoder); | |
| 14086 | + return; | |
| 14087 | + } | |
| 14088 | + throw new Exception("Cannot marshal type UnionMakeDictEncoder"); | |
| 14089 | + } | |
| 14090 | + | |
| 14091 | + public static readonly UnionMakeDictEncoderConverter Singleton = new UnionMakeDictEncoderConverter(); | |
| 14092 | + } | |
| 14093 | + | |
| 14039 | 14094 | internal class UnionMapConverter : JsonConverter |
| 14040 | 14095 | { |
| 14041 | 14096 | public override bool CanConvert(Type t) => t == typeof(UnionMap) || t == typeof(UnionMap?); |
Mschema-csharp-SystemTextJsondefault / QuickType.cs+54 −0
| @@ -750,6 +750,10 @@ namespace QuickType | ||
| 750 | 750 | [JsonPropertyName("long")] |
| 751 | 751 | public UnionLong? Long { get; set; } |
| 752 | 752 | |
| 753 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | |
| 754 | + [JsonPropertyName("makeDictEncoder")] | |
| 755 | + public UnionMakeDictEncoder? MakeDictEncoder { get; set; } | |
| 756 | + | |
| 753 | 757 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 754 | 758 | [JsonPropertyName("map")] |
| 755 | 759 | public UnionMap? Map { get; set; } |
| @@ -2095,6 +2099,10 @@ namespace QuickType | ||
| 2095 | 2099 | { |
| 2096 | 2100 | } |
| 2097 | 2101 | |
| 2102 | + public partial class MakeDictEncoder | |
| 2103 | + { | |
| 2104 | + } | |
| 2105 | + | |
| 2098 | 2106 | public partial class Map |
| 2099 | 2107 | { |
| 2100 | 2108 | } |
| @@ -4338,6 +4346,15 @@ namespace QuickType | ||
| 4338 | 4346 | public static implicit operator UnionLong(Long Long) => new UnionLong { Long = Long }; |
| 4339 | 4347 | } |
| 4340 | 4348 | |
| 4349 | + public partial struct UnionMakeDictEncoder | |
| 4350 | + { | |
| 4351 | + public double? Double; | |
| 4352 | + public MakeDictEncoder? MakeDictEncoder; | |
| 4353 | + | |
| 4354 | + public static implicit operator UnionMakeDictEncoder(double Double) => new UnionMakeDictEncoder { Double = Double }; | |
| 4355 | + public static implicit operator UnionMakeDictEncoder(MakeDictEncoder MakeDictEncoder) => new UnionMakeDictEncoder { MakeDictEncoder = MakeDictEncoder }; | |
| 4356 | + } | |
| 4357 | + | |
| 4341 | 4358 | public partial struct UnionMap |
| 4342 | 4359 | { |
| 4343 | 4360 | public double? Double; |
| @@ -6072,6 +6089,7 @@ namespace QuickType | ||
| 6072 | 6089 | UnionListConverter.Singleton, |
| 6073 | 6090 | UnionLockConverter.Singleton, |
| 6074 | 6091 | UnionLongConverter.Singleton, |
| 6092 | + UnionMakeDictEncoderConverter.Singleton, | |
| 6075 | 6093 | UnionMapConverter.Singleton, |
| 6076 | 6094 | UnionMetadataPropertyHandlingConverter.Singleton, |
| 6077 | 6095 | UnionModuleConverter.Singleton, |
| @@ -13946,6 +13964,42 @@ namespace QuickType | ||
| 13946 | 13964 | public static readonly UnionLongConverter Singleton = new UnionLongConverter(); |
| 13947 | 13965 | } |
| 13948 | 13966 | |
| 13967 | + internal class UnionMakeDictEncoderConverter : JsonConverter<UnionMakeDictEncoder> | |
| 13968 | + { | |
| 13969 | + public override bool CanConvert(Type t) => t == typeof(UnionMakeDictEncoder); | |
| 13970 | + | |
| 13971 | + public override UnionMakeDictEncoder Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | |
| 13972 | + { | |
| 13973 | + switch (reader.TokenType) | |
| 13974 | + { | |
| 13975 | + case JsonTokenType.Number: | |
| 13976 | + var doubleValue1 = reader.GetDouble(); | |
| 13977 | + return new UnionMakeDictEncoder { Double = doubleValue1 }; | |
| 13978 | + case JsonTokenType.StartObject: | |
| 13979 | + var objectValue = JsonSerializer.Deserialize<MakeDictEncoder>(ref reader, options); | |
| 13980 | + return new UnionMakeDictEncoder { MakeDictEncoder = objectValue }; | |
| 13981 | + } | |
| 13982 | + throw new JsonException("Cannot unmarshal type UnionMakeDictEncoder"); | |
| 13983 | + } | |
| 13984 | + | |
| 13985 | + public override void Write(Utf8JsonWriter writer, UnionMakeDictEncoder value, JsonSerializerOptions options) | |
| 13986 | + { | |
| 13987 | + if (value.Double != null) | |
| 13988 | + { | |
| 13989 | + JsonSerializer.Serialize(writer, value.Double.Value, options); | |
| 13990 | + return; | |
| 13991 | + } | |
| 13992 | + if (value.MakeDictEncoder != null) | |
| 13993 | + { | |
| 13994 | + JsonSerializer.Serialize(writer, value.MakeDictEncoder, options); | |
| 13995 | + return; | |
| 13996 | + } | |
| 13997 | + throw new NotSupportedException("Cannot marshal type UnionMakeDictEncoder"); | |
| 13998 | + } | |
| 13999 | + | |
| 14000 | + public static readonly UnionMakeDictEncoderConverter Singleton = new UnionMakeDictEncoderConverter(); | |
| 14001 | + } | |
| 14002 | + | |
| 13949 | 14003 | internal class UnionMapConverter : JsonConverter<UnionMap> |
| 13950 | 14004 | { |
| 13951 | 14005 | public override bool CanConvert(Type t) => t == typeof(UnionMap); |
Mschema-csharpdefault / QuickType.cs+55 −0
| @@ -571,6 +571,9 @@ namespace QuickType | ||
| 571 | 571 | [JsonProperty("long", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 572 | 572 | public UnionLong? Long { get; set; } |
| 573 | 573 | |
| 574 | + [JsonProperty("makeDictEncoder", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] | |
| 575 | + public UnionMakeDictEncoder? MakeDictEncoder { get; set; } | |
| 576 | + | |
| 574 | 577 | [JsonProperty("map", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] |
| 575 | 578 | public UnionMap? Map { get; set; } |
| 576 | 579 | |
| @@ -1755,6 +1758,10 @@ namespace QuickType | ||
| 1755 | 1758 | { |
| 1756 | 1759 | } |
| 1757 | 1760 | |
| 1761 | + public partial class MakeDictEncoder | |
| 1762 | + { | |
| 1763 | + } | |
| 1764 | + | |
| 1758 | 1765 | public partial class Map |
| 1759 | 1766 | { |
| 1760 | 1767 | } |
| @@ -3998,6 +4005,15 @@ namespace QuickType | ||
| 3998 | 4005 | public static implicit operator UnionLong(Long Long) => new UnionLong { Long = Long }; |
| 3999 | 4006 | } |
| 4000 | 4007 | |
| 4008 | + public partial struct UnionMakeDictEncoder | |
| 4009 | + { | |
| 4010 | + public double? Double; | |
| 4011 | + public MakeDictEncoder? MakeDictEncoder; | |
| 4012 | + | |
| 4013 | + public static implicit operator UnionMakeDictEncoder(double Double) => new UnionMakeDictEncoder { Double = Double }; | |
| 4014 | + public static implicit operator UnionMakeDictEncoder(MakeDictEncoder MakeDictEncoder) => new UnionMakeDictEncoder { MakeDictEncoder = MakeDictEncoder }; | |
| 4015 | + } | |
| 4016 | + | |
| 4001 | 4017 | public partial struct UnionMap |
| 4002 | 4018 | { |
| 4003 | 4019 | public double? Double; |
| @@ -5734,6 +5750,7 @@ namespace QuickType | ||
| 5734 | 5750 | UnionListConverter.Singleton, |
| 5735 | 5751 | UnionLockConverter.Singleton, |
| 5736 | 5752 | UnionLongConverter.Singleton, |
| 5753 | + UnionMakeDictEncoderConverter.Singleton, | |
| 5737 | 5754 | UnionMapConverter.Singleton, |
| 5738 | 5755 | UnionMetadataPropertyHandlingConverter.Singleton, |
| 5739 | 5756 | UnionModuleConverter.Singleton, |
| @@ -14036,6 +14053,44 @@ namespace QuickType | ||
| 14036 | 14053 | public static readonly UnionLongConverter Singleton = new UnionLongConverter(); |
| 14037 | 14054 | } |
| 14038 | 14055 | |
| 14056 | + internal class UnionMakeDictEncoderConverter : JsonConverter | |
| 14057 | + { | |
| 14058 | + public override bool CanConvert(Type t) => t == typeof(UnionMakeDictEncoder) || t == typeof(UnionMakeDictEncoder?); | |
| 14059 | + | |
| 14060 | + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) | |
| 14061 | + { | |
| 14062 | + switch (reader.TokenType) | |
| 14063 | + { | |
| 14064 | + case JsonToken.Integer: | |
| 14065 | + case JsonToken.Float: | |
| 14066 | + var doubleValue = serializer.Deserialize<double>(reader); | |
| 14067 | + return new UnionMakeDictEncoder { Double = doubleValue }; | |
| 14068 | + case JsonToken.StartObject: | |
| 14069 | + var objectValue = serializer.Deserialize<MakeDictEncoder>(reader); | |
| 14070 | + return new UnionMakeDictEncoder { MakeDictEncoder = objectValue }; | |
| 14071 | + } | |
| 14072 | + throw new Exception("Cannot unmarshal type UnionMakeDictEncoder"); | |
| 14073 | + } | |
| 14074 | + | |
| 14075 | + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) | |
| 14076 | + { | |
| 14077 | + var value = (UnionMakeDictEncoder)untypedValue; | |
| 14078 | + if (value.Double != null) | |
| 14079 | + { | |
| 14080 | + serializer.Serialize(writer, value.Double.Value); | |
| 14081 | + return; | |
| 14082 | + } | |
| 14083 | + if (value.MakeDictEncoder != null) | |
| 14084 | + { | |
| 14085 | + serializer.Serialize(writer, value.MakeDictEncoder); | |
| 14086 | + return; | |
| 14087 | + } | |
| 14088 | + throw new Exception("Cannot marshal type UnionMakeDictEncoder"); | |
| 14089 | + } | |
| 14090 | + | |
| 14091 | + public static readonly UnionMakeDictEncoderConverter Singleton = new UnionMakeDictEncoderConverter(); | |
| 14092 | + } | |
| 14093 | + | |
| 14039 | 14094 | internal class UnionMapConverter : JsonConverter |
| 14040 | 14095 | { |
| 14041 | 14096 | public override bool CanConvert(Type t) => t == typeof(UnionMap) || t == typeof(UnionMap?); |
Mschema-dartdefault / TopLevel.dart+14 −0
| @@ -191,6 +191,7 @@ class TopLevel { | ||
| 191 | 191 | final dynamic locale; |
| 192 | 192 | final dynamic lock; |
| 193 | 193 | final dynamic long; |
| 194 | + final dynamic makeDictEncoder; | |
| 194 | 195 | final dynamic map; |
| 195 | 196 | final dynamic mapEntry; |
| 196 | 197 | final dynamic marshalJson; |
| @@ -536,6 +537,7 @@ class TopLevel { | ||
| 536 | 537 | this.locale, |
| 537 | 538 | this.lock, |
| 538 | 539 | this.long, |
| 540 | + this.makeDictEncoder, | |
| 539 | 541 | this.map, |
| 540 | 542 | this.mapEntry, |
| 541 | 543 | this.marshalJson, |
| @@ -882,6 +884,7 @@ class TopLevel { | ||
| 882 | 884 | locale: json["Locale"], |
| 883 | 885 | lock: json["lock"], |
| 884 | 886 | long: json["long"], |
| 887 | + makeDictEncoder: json["makeDictEncoder"], | |
| 885 | 888 | map: json["map"], |
| 886 | 889 | mapEntry: json["MapEntry"], |
| 887 | 890 | marshalJson: json["MarshalJSON"], |
| @@ -1228,6 +1231,7 @@ class TopLevel { | ||
| 1228 | 1231 | "Locale": locale, |
| 1229 | 1232 | "lock": lock, |
| 1230 | 1233 | "long": long, |
| 1234 | + "makeDictEncoder": makeDictEncoder, | |
| 1231 | 1235 | "map": map, |
| 1232 | 1236 | "MapEntry": mapEntry, |
| 1233 | 1237 | "MarshalJSON": marshalJson, |
| @@ -2822,6 +2826,16 @@ class Long { | ||
| 2822 | 2826 | }; |
| 2823 | 2827 | } |
| 2824 | 2828 | |
| 2829 | +class MakeDictEncoder { | |
| 2830 | + MakeDictEncoder(); | |
| 2831 | + | |
| 2832 | + factory MakeDictEncoder.fromJson(Map<String, dynamic> json) => MakeDictEncoder( | |
| 2833 | + ); | |
| 2834 | + | |
| 2835 | + Map<String, dynamic> toJson() => { | |
| 2836 | + }; | |
| 2837 | +} | |
| 2838 | + | |
| 2825 | 2839 | class MapClass { |
| 2826 | 2840 | MapClass(); |
Mschema-elixirdefault / QuickType.ex+45 −1
| @@ -4935,6 +4935,35 @@ defmodule Long do | ||
| 4935 | 4935 | end |
| 4936 | 4936 | end |
| 4937 | 4937 | |
| 4938 | +defmodule MakeDictEncoder do | |
| 4939 | + defstruct [] | |
| 4940 | + | |
| 4941 | + @type t :: %__MODULE__{ | |
| 4942 | + } | |
| 4943 | + | |
| 4944 | + def from_map(m) when is_map(m) do | |
| 4945 | + %MakeDictEncoder{ | |
| 4946 | + } | |
| 4947 | + end | |
| 4948 | + | |
| 4949 | + def from_json(json) do | |
| 4950 | + json | |
| 4951 | + |> Jason.decode!() | |
| 4952 | + |> from_map() | |
| 4953 | + end | |
| 4954 | + | |
| 4955 | + def to_map(_struct) do | |
| 4956 | + %{ | |
| 4957 | + } | |
| 4958 | + end | |
| 4959 | + | |
| 4960 | + def to_json(struct) do | |
| 4961 | + struct | |
| 4962 | + |> to_map() | |
| 4963 | + |> Jason.encode!() | |
| 4964 | + end | |
| 4965 | +end | |
| 4966 | + | |
| 4938 | 4967 | defmodule MapClass do |
| 4939 | 4968 | defstruct [] |
| 4940 | 4969 | |
| @@ -9924,7 +9953,7 @@ defmodule Yield do | ||
| 9924 | 9953 | end |
| 9925 | 9954 | |
| 9926 | 9955 | defmodule TopLevel do |
| 9927 | - 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, :calendar, :case, :top_level_catch, :chan, :char, :char16_t, :char32_t, :checked, :top_level_class, :class, :clone, :co_await, :co_return, :co_yield, :codable, :coding_key, :coding_keys, :compl, :concept, :console, :const, :const_cast, :constexpr, :constructor, :continue, :convenience, :convert, :converter, :culture_info, :date, :date_parse_handling, :date_formatter, :date_only, :date_only_converter, :date_time, :date_time_styles, :debugger, :decimal, :declare, :decltype, :decode_string, :decoder, :decoding_error, :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, :encoder, :enum, :enum_values, :equality_contract, :equatable, :event, :except, :exception, :explicit, :export, :exposing, :extends, :extension, :extern, :fallthrough, :false_1, :top_level_false, :fileprivate, :final, :finally, :fixed, :float, :for, :foreach, :format_exception, :friend, :from, :from_dict, :from_json, :func, :function, :get, :global, :go, :goto, :guard, :hashable, :hash_code, :hasher, :has_own_property, :id, :if, :imp, :implements, :implicit, :top_level_import, :top_level_in, :indirect, :infix, :init, :inline, :inout, :instanceof, :int, :interface, :internal, :is, :iso_date_time_offset_converter, :iterable, :jdec, :jenc, :jpipe, :json, :json_converter, :json_serializer, :json_token, :json_writer, :json_any, :json_coding_key, :json_decoder, :json_encoder, :json_exception, :json_generator, :json_node, :json_null, :json_parser, :json_reader, :json_token_type, :k_serializer, :lambda, :lazy, :left, :let, :list, :locale, :lock, :long, :map, :map_entry, :marshal_json, :metadata_property_handling, :module, :mutable, :mutating, :namespace, :native, :new, :newtonsoft, :top_level_nil, :no, :noexcept, :nonatomic, :top_level_none, :none, :nonlocal, :nonmutating, :no_such_method, :top_level_not, :not_eq, :ns_error, :ns_object, :ns_string, :null, :top_level_null, :nullptr, :number, :object, :object_mapper, :of, :oneway, :open, :operator, :optional, :top_level_or, :or_eq, :out, :override, :package, :params, :pass, :port, :postfix, :precedence, :prefix, :primitive_kind, :print, :printf, :print_members, :private, :protected, :protocol, :top_level_protocol, :public, :quicktype, :raise, :range, :readonly, :ref, :reg_exp, :register, :reinterpret_cast, :repeat, :require, :required, :requires, :restrict, :retain, :rethrows, :return, :right, :runtime_type, :s, :sbyte, :sealed, :sel, :select, :self, :top_level_self, :sendable, :serial_descriptor, :serializable, :serialize, :serializer_provider, :serial_name, :set, :short, :signed, :simple_module, :sizeof, :stackalloc, :standards, :static, :static_assert, :static_cast, :std_deserializer, :std_serializer, :strictfp, :string, :struct, :subscript, :super, :switch, :symbol, :synchronized, :system, :template, :then, :this, :thread_local, :throw, :throws, :time_only, :time_only_converter, :time_zone, :to_dict, :to_json, :top_level, :to_string, :transient, :top_level_true, :true_1, :try, :type, :top_level_type, :typealias, :typedef, :typeid, :typename, :typeof, :uint, :ulong, :unchecked, :undefined, :union, :unmarshal_json, :unowned, :unsafe, :unsigned, :use_serializers, :ushort, :using, :utf8_json_reader, :utf8_json_writer, :uuid, :var, :virtual, :void, :volatile, :wchar_t, :weak, :where, :while, :will_set, :with, :xor, :xor_eq, :yes, :yield] | |
| 9956 | + 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, :calendar, :case, :top_level_catch, :chan, :char, :char16_t, :char32_t, :checked, :top_level_class, :class, :clone, :co_await, :co_return, :co_yield, :codable, :coding_key, :coding_keys, :compl, :concept, :console, :const, :const_cast, :constexpr, :constructor, :continue, :convenience, :convert, :converter, :culture_info, :date, :date_parse_handling, :date_formatter, :date_only, :date_only_converter, :date_time, :date_time_styles, :debugger, :decimal, :declare, :decltype, :decode_string, :decoder, :decoding_error, :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, :encoder, :enum, :enum_values, :equality_contract, :equatable, :event, :except, :exception, :explicit, :export, :exposing, :extends, :extension, :extern, :fallthrough, :false_1, :top_level_false, :fileprivate, :final, :finally, :fixed, :float, :for, :foreach, :format_exception, :friend, :from, :from_dict, :from_json, :func, :function, :get, :global, :go, :goto, :guard, :hashable, :hash_code, :hasher, :has_own_property, :id, :if, :imp, :implements, :implicit, :top_level_import, :top_level_in, :indirect, :infix, :init, :inline, :inout, :instanceof, :int, :interface, :internal, :is, :iso_date_time_offset_converter, :iterable, :jdec, :jenc, :jpipe, :json, :json_converter, :json_serializer, :json_token, :json_writer, :json_any, :json_coding_key, :json_decoder, :json_encoder, :json_exception, :json_generator, :json_node, :json_null, :json_parser, :json_reader, :json_token_type, :k_serializer, :lambda, :lazy, :left, :let, :list, :locale, :lock, :long, :make_dict_encoder, :map, :map_entry, :marshal_json, :metadata_property_handling, :module, :mutable, :mutating, :namespace, :native, :new, :newtonsoft, :top_level_nil, :no, :noexcept, :nonatomic, :top_level_none, :none, :nonlocal, :nonmutating, :no_such_method, :top_level_not, :not_eq, :ns_error, :ns_object, :ns_string, :null, :top_level_null, :nullptr, :number, :object, :object_mapper, :of, :oneway, :open, :operator, :optional, :top_level_or, :or_eq, :out, :override, :package, :params, :pass, :port, :postfix, :precedence, :prefix, :primitive_kind, :print, :printf, :print_members, :private, :protected, :protocol, :top_level_protocol, :public, :quicktype, :raise, :range, :readonly, :ref, :reg_exp, :register, :reinterpret_cast, :repeat, :require, :required, :requires, :restrict, :retain, :rethrows, :return, :right, :runtime_type, :s, :sbyte, :sealed, :sel, :select, :self, :top_level_self, :sendable, :serial_descriptor, :serializable, :serialize, :serializer_provider, :serial_name, :set, :short, :signed, :simple_module, :sizeof, :stackalloc, :standards, :static, :static_assert, :static_cast, :std_deserializer, :std_serializer, :strictfp, :string, :struct, :subscript, :super, :switch, :symbol, :synchronized, :system, :template, :then, :this, :thread_local, :throw, :throws, :time_only, :time_only_converter, :time_zone, :to_dict, :to_json, :top_level, :to_string, :transient, :top_level_true, :true_1, :try, :type, :top_level_type, :typealias, :typedef, :typeid, :typename, :typeof, :uint, :ulong, :unchecked, :undefined, :union, :unmarshal_json, :unowned, :unsafe, :unsigned, :use_serializers, :ushort, :using, :utf8_json_reader, :utf8_json_writer, :uuid, :var, :virtual, :void, :volatile, :wchar_t, :weak, :where, :while, :will_set, :with, :xor, :xor_eq, :yes, :yield] | |
| 9928 | 9957 | |
| 9929 | 9958 | @type t :: %__MODULE__{ |
| 9930 | 9959 | empty: Empty.t() | float() | nil, |
| @@ -10109,6 +10138,7 @@ defmodule TopLevel do | ||
| 10109 | 10138 | locale: Locale.t() | float() | nil, |
| 10110 | 10139 | lock: Lock.t() | float() | nil, |
| 10111 | 10140 | long: Long.t() | float() | nil, |
| 10141 | + make_dict_encoder: MakeDictEncoder.t() | float() | nil, | |
| 10112 | 10142 | map: MapClass.t() | float() | nil, |
| 10113 | 10143 | map_entry: MapEntry.t() | float() | nil, |
| 10114 | 10144 | marshal_json: MarshalJSON.t() | float() | nil, |
| @@ -12452,6 +12482,18 @@ defmodule TopLevel do | ||
| 12452 | 12482 | def encode_long(value) when is_nil(value), do: value |
| 12453 | 12483 | def encode_long(_), do: {:error, "Unexpected type when encoding TopLevel.long"} |
| 12454 | 12484 | |
| 12485 | + def decode_make_dict_encoder(%{} = value), do: MakeDictEncoder.from_map(value) | |
| 12486 | + def decode_make_dict_encoder(value) when is_float(value), do: value | |
| 12487 | + def decode_make_dict_encoder(value) when is_integer(value), do: value | |
| 12488 | + def decode_make_dict_encoder(value) when is_nil(value), do: value | |
| 12489 | + def decode_make_dict_encoder(_), do: {:error, "Unexpected type when decoding TopLevel.make_dict_encoder"} | |
| 12490 | + | |
| 12491 | + def encode_make_dict_encoder(%MakeDictEncoder{} = value), do: MakeDictEncoder.to_map(value) | |
| 12492 | + def encode_make_dict_encoder(value) when is_float(value), do: value | |
| 12493 | + def encode_make_dict_encoder(value) when is_integer(value), do: value | |
| 12494 | + def encode_make_dict_encoder(value) when is_nil(value), do: value | |
| 12495 | + def encode_make_dict_encoder(_), do: {:error, "Unexpected type when encoding TopLevel.make_dict_encoder"} | |
| 12496 | + | |
| 12455 | 12497 | def decode_map(%{} = value), do: MapClass.from_map(value) |
| 12456 | 12498 | def decode_map(value) when is_float(value), do: value |
| 12457 | 12499 | def decode_map(value) when is_integer(value), do: value |
| @@ -14568,6 +14610,7 @@ defmodule TopLevel do | ||
| 14568 | 14610 | locale: decode_locale(m["Locale"]), |
| 14569 | 14611 | lock: decode_lock(m["lock"]), |
| 14570 | 14612 | long: decode_long(m["long"]), |
| 14613 | + make_dict_encoder: decode_make_dict_encoder(m["makeDictEncoder"]), | |
| 14571 | 14614 | map: decode_map(m["map"]), |
| 14572 | 14615 | map_entry: decode_map_entry(m["MapEntry"]), |
| 14573 | 14616 | marshal_json: decode_marshal_json(m["MarshalJSON"]), |
| @@ -14922,6 +14965,7 @@ defmodule TopLevel do | ||
| 14922 | 14965 | "Locale" => encode_locale(struct.locale), |
| 14923 | 14966 | "lock" => encode_lock(struct.lock), |
| 14924 | 14967 | "long" => encode_long(struct.long), |
| 14968 | + "makeDictEncoder" => encode_make_dict_encoder(struct.make_dict_encoder), | |
| 14925 | 14969 | "map" => encode_map(struct.map), |
| 14926 | 14970 | "MapEntry" => encode_map_entry(struct.map_entry), |
| 14927 | 14971 | "MarshalJSON" => encode_marshal_json(struct.marshal_json), |
Mschema-elmdefault / QuickType.elm+35 −0
| @@ -178,6 +178,7 @@ module QuickType exposing | ||
| 178 | 178 | , Locale |
| 179 | 179 | , Lock |
| 180 | 180 | , Long |
| 181 | + , MakeDictEncoder | |
| 181 | 182 | , Map |
| 182 | 183 | , MapEntry |
| 183 | 184 | , MarshalJSON |
| @@ -520,6 +521,7 @@ module QuickType exposing | ||
| 520 | 521 | , UnionLocale(..) |
| 521 | 522 | , UnionLock(..) |
| 522 | 523 | , UnionLong(..) |
| 524 | + , UnionMakeDictEncoder(..) | |
| 523 | 525 | , UnionMap(..) |
| 524 | 526 | , UnionMapEntry(..) |
| 525 | 527 | , UnionMarshalJSON(..) |
| @@ -889,6 +891,7 @@ type alias QuickType = | ||
| 889 | 891 | , locale : Maybe UnionLocale |
| 890 | 892 | , lock : Maybe UnionLock |
| 891 | 893 | , long : Maybe UnionLong |
| 894 | + , makeDictEncoder : Maybe UnionMakeDictEncoder | |
| 892 | 895 | , map : Maybe UnionMap |
| 893 | 896 | , mapEntry : Maybe UnionMapEntry |
| 894 | 897 | , marshalJSON : Maybe UnionMarshalJSON |
| @@ -2356,6 +2359,14 @@ type alias Long = | ||
| 2356 | 2359 | { |
| 2357 | 2360 | } |
| 2358 | 2361 | |
| 2362 | +type UnionMakeDictEncoder | |
| 2363 | + = DoubleInUnionMakeDictEncoder Float | |
| 2364 | + | MakeDictEncoderInUnionMakeDictEncoder MakeDictEncoder | |
| 2365 | + | |
| 2366 | +type alias MakeDictEncoder = | |
| 2367 | + { | |
| 2368 | + } | |
| 2369 | + | |
| 2359 | 2370 | type UnionMap |
| 2360 | 2371 | = DoubleInUnionMap Float |
| 2361 | 2372 | | MapInUnionMap Map |
| @@ -3984,6 +3995,7 @@ quickType = | ||
| 3984 | 3995 | |> Jpipe.custom (optionalField "Locale" (Jdec.map Just unionLocale) Nothing) |
| 3985 | 3996 | |> Jpipe.custom (optionalField "lock" (Jdec.map Just unionLock) Nothing) |
| 3986 | 3997 | |> Jpipe.custom (optionalField "long" (Jdec.map Just unionLong) Nothing) |
| 3998 | + |> Jpipe.custom (optionalField "makeDictEncoder" (Jdec.map Just unionMakeDictEncoder) Nothing) | |
| 3987 | 3999 | |> Jpipe.custom (optionalField "map" (Jdec.map Just unionMap) Nothing) |
| 3988 | 4000 | |> Jpipe.custom (optionalField "MapEntry" (Jdec.map Just unionMapEntry) Nothing) |
| 3989 | 4001 | |> Jpipe.custom (optionalField "MarshalJSON" (Jdec.map Just unionMarshalJSON) Nothing) |
| @@ -4331,6 +4343,7 @@ encodeQuickType x = | ||
| 4331 | 4343 | , ("Locale", makeNullableEncoder encodeUnionLocale x.locale) |
| 4332 | 4344 | , ("lock", makeNullableEncoder encodeUnionLock x.lock) |
| 4333 | 4345 | , ("long", makeNullableEncoder encodeUnionLong x.long) |
| 4346 | + , ("makeDictEncoder", makeNullableEncoder encodeUnionMakeDictEncoder x.makeDictEncoder) | |
| 4334 | 4347 | , ("map", makeNullableEncoder encodeUnionMap x.map) |
| 4335 | 4348 | , ("MapEntry", makeNullableEncoder encodeUnionMapEntry x.mapEntry) |
| 4336 | 4349 | , ("MarshalJSON", makeNullableEncoder encodeUnionMarshalJSON x.marshalJSON) |
| @@ -8080,6 +8093,28 @@ encodeLong x = | ||
| 8080 | 8093 | [ |
| 8081 | 8094 | ] |
| 8082 | 8095 | |
| 8096 | +unionMakeDictEncoder : Jdec.Decoder UnionMakeDictEncoder | |
| 8097 | +unionMakeDictEncoder = | |
| 8098 | + Jdec.oneOf | |
| 8099 | + [ Jdec.map DoubleInUnionMakeDictEncoder Jdec.float | |
| 8100 | + , Jdec.map MakeDictEncoderInUnionMakeDictEncoder makeDictEncoder | |
| 8101 | + ] | |
| 8102 | + | |
| 8103 | +encodeUnionMakeDictEncoder : UnionMakeDictEncoder -> Jenc.Value | |
| 8104 | +encodeUnionMakeDictEncoder x = case x of | |
| 8105 | + DoubleInUnionMakeDictEncoder y -> Jenc.float y | |
| 8106 | + MakeDictEncoderInUnionMakeDictEncoder y -> encodeMakeDictEncoder y | |
| 8107 | + | |
| 8108 | +makeDictEncoder : Jdec.Decoder MakeDictEncoder | |
| 8109 | +makeDictEncoder = | |
| 8110 | + Jdec.dict Jdec.value |> Jdec.map (\_ -> MakeDictEncoder) | |
| 8111 | + | |
| 8112 | +encodeMakeDictEncoder : MakeDictEncoder -> Jenc.Value | |
| 8113 | +encodeMakeDictEncoder x = | |
| 8114 | + Jenc.object | |
| 8115 | + [ | |
| 8116 | + ] | |
| 8117 | + | |
| 8083 | 8118 | unionMap : Jdec.Decoder UnionMap |
| 8084 | 8119 | unionMap = |
| 8085 | 8120 | Jdec.oneOf |
Mschema-flowdefault / TopLevel.js+11 −2
| @@ -192,6 +192,7 @@ export type TopLevel = { | ||
| 192 | 192 | Locale?: UnionLocale; |
| 193 | 193 | lock?: UnionLock; |
| 194 | 194 | long?: UnionLong; |
| 195 | + makeDictEncoder?: UnionMakeDictEncoder; | |
| 195 | 196 | map?: UnionMap; |
| 196 | 197 | MapEntry?: UnionMapEntry; |
| 197 | 198 | MarshalJSON?: UnionMarshalJSON; |
| @@ -1431,6 +1432,11 @@ export type UnionLong = Long | number; | ||
| 1431 | 1432 | export type Long = { |
| 1432 | 1433 | }; |
| 1433 | 1434 | |
| 1435 | +export type UnionMakeDictEncoder = MakeDictEncoder | number; | |
| 1436 | + | |
| 1437 | +export type MakeDictEncoder = { | |
| 1438 | +}; | |
| 1439 | + | |
| 1434 | 1440 | export type UnionMap = Map | number; |
| 1435 | 1441 | |
| 1436 | 1442 | export type Map = { |
| @@ -2160,7 +2166,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 2160 | 2166 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 2161 | 2167 | return invalidValue(l(ref || "object"), val, key, parent); |
| 2162 | 2168 | } |
| 2163 | - const result: any = {}; | |
| 2169 | + const result: any = Object.create(null); | |
| 2164 | 2170 | Object.getOwnPropertyNames(props).forEach(key => { |
| 2165 | 2171 | const prop = props[key]; |
| 2166 | 2172 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -2171,7 +2177,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 2171 | 2177 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 2172 | 2178 | } |
| 2173 | 2179 | }); |
| 2174 | - return result; | |
| 2180 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 2175 | 2181 | } |
| 2176 | 2182 | |
| 2177 | 2183 | if (typ === "any") return val; |
| @@ -2434,6 +2440,7 @@ const typeMap: any = { | ||
| 2434 | 2440 | { json: "Locale", js: "Locale", typ: u(undefined, u(r("Locale"), 3.14)) }, |
| 2435 | 2441 | { json: "lock", js: "lock", typ: u(undefined, u(r("Lock"), 3.14)) }, |
| 2436 | 2442 | { json: "long", js: "long", typ: u(undefined, u(r("Long"), 3.14)) }, |
| 2443 | + { json: "makeDictEncoder", js: "makeDictEncoder", typ: u(undefined, u(r("MakeDictEncoder"), 3.14)) }, | |
| 2437 | 2444 | { json: "map", js: "map", typ: u(undefined, u(r("Map"), 3.14)) }, |
| 2438 | 2445 | { json: "MapEntry", js: "MapEntry", typ: u(undefined, u(r("MapEntry"), 3.14)) }, |
| 2439 | 2446 | { json: "MarshalJSON", js: "MarshalJSON", typ: u(undefined, u(r("MarshalJSON"), 3.14)) }, |
| @@ -3026,6 +3033,8 @@ const typeMap: any = { | ||
| 3026 | 3033 | ], false), |
| 3027 | 3034 | "Long": o([ |
| 3028 | 3035 | ], false), |
| 3036 | + "MakeDictEncoder": o([ | |
| 3037 | + ], false), | |
| 3029 | 3038 | "Map": o([ |
| 3030 | 3039 | ], false), |
| 3031 | 3040 | "MetadataPropertyHandling": o([ |
Mschema-golangdefault / quicktype.go+26 −0
| @@ -204,6 +204,7 @@ type TopLevel struct { | ||
| 204 | 204 | Locale *UnionLocale `json:"Locale"` |
| 205 | 205 | Lock *UnionLock `json:"lock"` |
| 206 | 206 | Long *UnionLong `json:"long"` |
| 207 | + MakeDictEncoder *UnionMakeDictEncoder `json:"makeDictEncoder"` | |
| 207 | 208 | Map *UnionMap `json:"map"` |
| 208 | 209 | MapEntry *UnionMapEntry `json:"MapEntry"` |
| 209 | 210 | MarshalJSON *UnionMarshalJSON `json:"MarshalJSON"` |
| @@ -895,6 +896,9 @@ type Lock struct { | ||
| 895 | 896 | type Long struct { |
| 896 | 897 | } |
| 897 | 898 | |
| 899 | +type MakeDictEncoder struct { | |
| 900 | +} | |
| 901 | + | |
| 898 | 902 | type Map struct { |
| 899 | 903 | } |
| 900 | 904 | |
| @@ -5265,6 +5269,28 @@ func (x *UnionLong) MarshalJSON() ([]byte, error) { | ||
| 5265 | 5269 | return marshalUnion(nil, x.Double, nil, nil, false, nil, x.Long != nil, x.Long, false, nil, false, nil, false) |
| 5266 | 5270 | } |
| 5267 | 5271 | |
| 5272 | +type UnionMakeDictEncoder struct { | |
| 5273 | + Double *float64 | |
| 5274 | + MakeDictEncoder *MakeDictEncoder | |
| 5275 | +} | |
| 5276 | + | |
| 5277 | +func (x *UnionMakeDictEncoder) UnmarshalJSON(data []byte) error { | |
| 5278 | + x.MakeDictEncoder = nil | |
| 5279 | + var c MakeDictEncoder | |
| 5280 | + object, err := unmarshalUnion(data, nil, &x.Double, nil, nil, false, nil, true, &c, false, nil, false, nil, false) | |
| 5281 | + if err != nil { | |
| 5282 | + return err | |
| 5283 | + } | |
| 5284 | + if object { | |
| 5285 | + x.MakeDictEncoder = &c | |
| 5286 | + } | |
| 5287 | + return nil | |
| 5288 | +} | |
| 5289 | + | |
| 5290 | +func (x *UnionMakeDictEncoder) MarshalJSON() ([]byte, error) { | |
| 5291 | + return marshalUnion(nil, x.Double, nil, nil, false, nil, x.MakeDictEncoder != nil, x.MakeDictEncoder, false, nil, false, nil, false) | |
| 5292 | +} | |
| 5293 | + | |
| 5268 | 5294 | type UnionMap struct { |
| 5269 | 5295 | Double *float64 |
| 5270 | 5296 | Map *Map |
Mschema-haskelldefault / QuickType.hs+29 −1
| @@ -167,6 +167,7 @@ module QuickType | ||
| 167 | 167 | , Locale (..) |
| 168 | 168 | , Lock (..) |
| 169 | 169 | , Long (..) |
| 170 | + , MakeDictEncoder (..) | |
| 170 | 171 | , MapClass (..) |
| 171 | 172 | , MapEntry (..) |
| 172 | 173 | , MarshalJSON (..) |
| @@ -509,6 +510,7 @@ module QuickType | ||
| 509 | 510 | , UnionLocale (..) |
| 510 | 511 | , UnionLock (..) |
| 511 | 512 | , UnionLong (..) |
| 513 | + , UnionMakeDictEncoder (..) | |
| 512 | 514 | , UnionMap (..) |
| 513 | 515 | , UnionMapEntry (..) |
| 514 | 516 | , UnionMarshalJSON (..) |
| @@ -879,6 +881,7 @@ data QuickType = QuickType | ||
| 879 | 881 | , localeQuickType :: Maybe UnionLocale |
| 880 | 882 | , lockQuickType :: Maybe UnionLock |
| 881 | 883 | , longQuickType :: Maybe UnionLong |
| 884 | + , makeDictEncoderQuickType :: Maybe UnionMakeDictEncoder | |
| 882 | 885 | , mapQuickType :: Maybe UnionMap |
| 883 | 886 | , mapEntryQuickType :: Maybe UnionMapEntry |
| 884 | 887 | , marshalJSONQuickType :: Maybe UnionMarshalJSON |
| @@ -2518,6 +2521,15 @@ data Long = Long | ||
| 2518 | 2521 | { |
| 2519 | 2522 | } deriving (Show) |
| 2520 | 2523 | |
| 2524 | +data UnionMakeDictEncoder | |
| 2525 | + = DoubleInUnionMakeDictEncoder Double | |
| 2526 | + | MakeDictEncoderInUnionMakeDictEncoder MakeDictEncoder | |
| 2527 | + deriving (Show) | |
| 2528 | + | |
| 2529 | +data MakeDictEncoder = MakeDictEncoder | |
| 2530 | + { | |
| 2531 | + } deriving (Show) | |
| 2532 | + | |
| 2521 | 2533 | data UnionMap |
| 2522 | 2534 | = DoubleInUnionMap Double |
| 2523 | 2535 | | MapClassInUnionMap MapClass |
| @@ -4124,7 +4136,7 @@ decodeTopLevel :: ByteString -> Maybe QuickType | ||
| 4124 | 4136 | decodeTopLevel = decode |
| 4125 | 4137 | |
| 4126 | 4138 | instance ToJSON QuickType where |
| 4127 | - toJSON (QuickType emptyQuickType quickTypeBoolQuickType complexQuickType imagineryQuickType abstractQuickType alignasQuickType alignofQuickType andQuickType andEqQuickType quickTypeAnyQuickType anyQuickType arrayQuickType quickTypeAsQuickType asmQuickType assertQuickType associatedtypeQuickType associativityQuickType asyncQuickType atomicQuickType atomicCancelQuickType atomicCommitQuickType atomicNoexceptQuickType autoQuickType awaitQuickType baseQuickType bitandQuickType bitorQuickType boolQuickType purpleBoolQuickType booleanQuickType breakQuickType bycopyQuickType byrefQuickType byteQuickType calendarQuickType quickTypeCaseQuickType catchQuickType chanQuickType charQuickType char16TQuickType char32TQuickType checkedQuickType purpleClassQuickType quickTypeClassQuickType cloneQuickType coAwaitQuickType coReturnQuickType coYieldQuickType codableQuickType codingKeyQuickType codingKeysQuickType complQuickType conceptQuickType consoleQuickType constQuickType constCastQuickType constexprQuickType constructorQuickType continueQuickType convenienceQuickType convertQuickType converterQuickType cultureInfoQuickType dateQuickType dateParseHandlingQuickType dateFormatterQuickType dateOnlyQuickType dateOnlyConverterQuickType dateTimeQuickType dateTimeStylesQuickType debuggerQuickType decimalQuickType declareQuickType decltypeQuickType decodeStringQuickType decoderQuickType decodingErrorQuickType defQuickType quickTypeDefaultQuickType deferQuickType deinitQuickType delQuickType delegateQuickType deleteQuickType dictQuickType dictionaryQuickType didSetQuickType quickTypeDoQuickType doubleQuickType dummyQuickType dynamicQuickType dynamicCastQuickType elifQuickType quickTypeElseQuickType encodeQuickTypeQuickType encoderQuickType enumQuickType enumValuesQuickType equalityContractQuickType equatableQuickType eventQuickType exceptQuickType exceptionQuickType explicitQuickType exportQuickType exposingQuickType extendsQuickType extensionQuickType externQuickType fallthroughQuickType quickTypeFalseQuickType falseQuickType fileprivateQuickType finalQuickType finallyQuickType fixedQuickType floatQuickType forQuickType foreachQuickType formatExceptionQuickType friendQuickType fromQuickType fromDictQuickType fromJSONQuickType funcQuickType functionQuickType getQuickType globalQuickType goQuickType gotoQuickType guardQuickType hashableQuickType hashCodeQuickType hasherQuickType hasOwnPropertyQuickType quickTypeIDQuickType quickTypeIfQuickType impQuickType implementsQuickType implicitQuickType quickTypeImportQuickType quickTypeInQuickType indirectQuickType quickTypeInfixQuickType initQuickType inlineQuickType inoutQuickType instanceofQuickType intQuickType interfaceQuickType internalQuickType isQuickType isoDateTimeOffsetConverterQuickType iterableQuickType jdecQuickType jencQuickType jpipeQuickType jsonQuickType jsonConverterQuickType jsonSerializerQuickType jsonTokenQuickType jsonWriterQuickType jsonAnyQuickType jsonCodingKeyQuickType jsonDecoderQuickType jsonEncoderQuickType jsonExceptionQuickType jsonGeneratorQuickType jsonNodeQuickType jsonNullQuickType jsonParserQuickType jsonReaderQuickType jsonTokenTypeQuickType kSerializerQuickType lambdaQuickType lazyQuickType leftQuickType quickTypeLetQuickType listQuickType localeQuickType lockQuickType longQuickType mapQuickType mapEntryQuickType marshalJSONQuickType metadataPropertyHandlingQuickType quickTypeModuleQuickType mutableQuickType mutatingQuickType namespaceQuickType nativeQuickType newQuickType newtonsoftQuickType nilQuickType noQuickType noexceptQuickType nonatomicQuickType quickTypeNoneQuickType noneQuickType nonlocalQuickType nonmutatingQuickType noSuchMethodQuickType notQuickType notEqQuickType nsErrorQuickType nsObjectQuickType nsStringQuickType nullQuickType quickTypeNullQuickType nullptrQuickType numberQuickType objectQuickType objectMapperQuickType quickTypeOfQuickType onewayQuickType openQuickType operatorQuickType optionalQuickType orQuickType orEqQuickType outQuickType overrideQuickType packageQuickType paramsQuickType passQuickType portQuickType postfixQuickType precedenceQuickType prefixQuickType primitiveKindQuickType printQuickType printfQuickType printMembersQuickType privateQuickType protectedQuickType protocolQuickType quickTypeProtocolQuickType publicQuickType quicktypeQuickType raiseQuickType rangeQuickType readonlyQuickType refQuickType regExpQuickType registerQuickType reinterpretCastQuickType repeatQuickType requireQuickType requiredQuickType requiresQuickType restrictQuickType retainQuickType rethrowsQuickType returnQuickType rightQuickType runtimeTypeQuickType sQuickType sbyteQuickType sealedQuickType selQuickType selectQuickType selfQuickType quickTypeSelfQuickType sendableQuickType serialDescriptorQuickType serializableQuickType serializeQuickType serializerProviderQuickType serialNameQuickType setQuickType shortQuickType signedQuickType simpleModuleQuickType sizeofQuickType stackallocQuickType standardsQuickType staticQuickType staticAssertQuickType staticCastQuickType stdDeserializerQuickType stdSerializerQuickType strictfpQuickType stringQuickType structQuickType subscriptQuickType superQuickType switchQuickType symbolQuickType synchronizedQuickType systemQuickType templateQuickType quickTypeThenQuickType thisQuickType threadLocalQuickType throwQuickType throwsQuickType timeOnlyQuickType timeOnlyConverterQuickType timeZoneQuickType toDictQuickType toJSONQuickType topLevelQuickType toStringQuickType transientQuickType trueQuickType quickTypeTrueQuickType tryQuickType quickTypeTypeQuickType purpleTypeQuickType typealiasQuickType typedefQuickType typeidQuickType typenameQuickType typeofQuickType uintQuickType ulongQuickType uncheckedQuickType undefinedQuickType unionQuickType unmarshalJSONQuickType unownedQuickType unsafeQuickType unsignedQuickType useSerializersQuickType ushortQuickType usingQuickType utf8JSONReaderQuickType utf8JSONWriterQuickType uuidQuickType varQuickType virtualQuickType voidQuickType volatileQuickType wcharTQuickType weakQuickType quickTypeWhereQuickType whileQuickType willSetQuickType withQuickType xorQuickType xorEqQuickType yesQuickType yieldQuickType) = | |
| 4139 | + toJSON (QuickType emptyQuickType quickTypeBoolQuickType complexQuickType imagineryQuickType abstractQuickType alignasQuickType alignofQuickType andQuickType andEqQuickType quickTypeAnyQuickType anyQuickType arrayQuickType quickTypeAsQuickType asmQuickType assertQuickType associatedtypeQuickType associativityQuickType asyncQuickType atomicQuickType atomicCancelQuickType atomicCommitQuickType atomicNoexceptQuickType autoQuickType awaitQuickType baseQuickType bitandQuickType bitorQuickType boolQuickType purpleBoolQuickType booleanQuickType breakQuickType bycopyQuickType byrefQuickType byteQuickType calendarQuickType quickTypeCaseQuickType catchQuickType chanQuickType charQuickType char16TQuickType char32TQuickType checkedQuickType purpleClassQuickType quickTypeClassQuickType cloneQuickType coAwaitQuickType coReturnQuickType coYieldQuickType codableQuickType codingKeyQuickType codingKeysQuickType complQuickType conceptQuickType consoleQuickType constQuickType constCastQuickType constexprQuickType constructorQuickType continueQuickType convenienceQuickType convertQuickType converterQuickType cultureInfoQuickType dateQuickType dateParseHandlingQuickType dateFormatterQuickType dateOnlyQuickType dateOnlyConverterQuickType dateTimeQuickType dateTimeStylesQuickType debuggerQuickType decimalQuickType declareQuickType decltypeQuickType decodeStringQuickType decoderQuickType decodingErrorQuickType defQuickType quickTypeDefaultQuickType deferQuickType deinitQuickType delQuickType delegateQuickType deleteQuickType dictQuickType dictionaryQuickType didSetQuickType quickTypeDoQuickType doubleQuickType dummyQuickType dynamicQuickType dynamicCastQuickType elifQuickType quickTypeElseQuickType encodeQuickTypeQuickType encoderQuickType enumQuickType enumValuesQuickType equalityContractQuickType equatableQuickType eventQuickType exceptQuickType exceptionQuickType explicitQuickType exportQuickType exposingQuickType extendsQuickType extensionQuickType externQuickType fallthroughQuickType quickTypeFalseQuickType falseQuickType fileprivateQuickType finalQuickType finallyQuickType fixedQuickType floatQuickType forQuickType foreachQuickType formatExceptionQuickType friendQuickType fromQuickType fromDictQuickType fromJSONQuickType funcQuickType functionQuickType getQuickType globalQuickType goQuickType gotoQuickType guardQuickType hashableQuickType hashCodeQuickType hasherQuickType hasOwnPropertyQuickType quickTypeIDQuickType quickTypeIfQuickType impQuickType implementsQuickType implicitQuickType quickTypeImportQuickType quickTypeInQuickType indirectQuickType quickTypeInfixQuickType initQuickType inlineQuickType inoutQuickType instanceofQuickType intQuickType interfaceQuickType internalQuickType isQuickType isoDateTimeOffsetConverterQuickType iterableQuickType jdecQuickType jencQuickType jpipeQuickType jsonQuickType jsonConverterQuickType jsonSerializerQuickType jsonTokenQuickType jsonWriterQuickType jsonAnyQuickType jsonCodingKeyQuickType jsonDecoderQuickType jsonEncoderQuickType jsonExceptionQuickType jsonGeneratorQuickType jsonNodeQuickType jsonNullQuickType jsonParserQuickType jsonReaderQuickType jsonTokenTypeQuickType kSerializerQuickType lambdaQuickType lazyQuickType leftQuickType quickTypeLetQuickType listQuickType localeQuickType lockQuickType longQuickType makeDictEncoderQuickType mapQuickType mapEntryQuickType marshalJSONQuickType metadataPropertyHandlingQuickType quickTypeModuleQuickType mutableQuickType mutatingQuickType namespaceQuickType nativeQuickType newQuickType newtonsoftQuickType nilQuickType noQuickType noexceptQuickType nonatomicQuickType quickTypeNoneQuickType noneQuickType nonlocalQuickType nonmutatingQuickType noSuchMethodQuickType notQuickType notEqQuickType nsErrorQuickType nsObjectQuickType nsStringQuickType nullQuickType quickTypeNullQuickType nullptrQuickType numberQuickType objectQuickType objectMapperQuickType quickTypeOfQuickType onewayQuickType openQuickType operatorQuickType optionalQuickType orQuickType orEqQuickType outQuickType overrideQuickType packageQuickType paramsQuickType passQuickType portQuickType postfixQuickType precedenceQuickType prefixQuickType primitiveKindQuickType printQuickType printfQuickType printMembersQuickType privateQuickType protectedQuickType protocolQuickType quickTypeProtocolQuickType publicQuickType quicktypeQuickType raiseQuickType rangeQuickType readonlyQuickType refQuickType regExpQuickType registerQuickType reinterpretCastQuickType repeatQuickType requireQuickType requiredQuickType requiresQuickType restrictQuickType retainQuickType rethrowsQuickType returnQuickType rightQuickType runtimeTypeQuickType sQuickType sbyteQuickType sealedQuickType selQuickType selectQuickType selfQuickType quickTypeSelfQuickType sendableQuickType serialDescriptorQuickType serializableQuickType serializeQuickType serializerProviderQuickType serialNameQuickType setQuickType shortQuickType signedQuickType simpleModuleQuickType sizeofQuickType stackallocQuickType standardsQuickType staticQuickType staticAssertQuickType staticCastQuickType stdDeserializerQuickType stdSerializerQuickType strictfpQuickType stringQuickType structQuickType subscriptQuickType superQuickType switchQuickType symbolQuickType synchronizedQuickType systemQuickType templateQuickType quickTypeThenQuickType thisQuickType threadLocalQuickType throwQuickType throwsQuickType timeOnlyQuickType timeOnlyConverterQuickType timeZoneQuickType toDictQuickType toJSONQuickType topLevelQuickType toStringQuickType transientQuickType trueQuickType quickTypeTrueQuickType tryQuickType quickTypeTypeQuickType purpleTypeQuickType typealiasQuickType typedefQuickType typeidQuickType typenameQuickType typeofQuickType uintQuickType ulongQuickType uncheckedQuickType undefinedQuickType unionQuickType unmarshalJSONQuickType unownedQuickType unsafeQuickType unsignedQuickType useSerializersQuickType ushortQuickType usingQuickType utf8JSONReaderQuickType utf8JSONWriterQuickType uuidQuickType varQuickType virtualQuickType voidQuickType volatileQuickType wcharTQuickType weakQuickType quickTypeWhereQuickType whileQuickType willSetQuickType withQuickType xorQuickType xorEqQuickType yesQuickType yieldQuickType) = | |
| 4128 | 4140 | object $ foldMap (maybe [] pure) |
| 4129 | 4141 | [ ("_" .=) <$> emptyQuickType |
| 4130 | 4142 | , ("_Bool" .=) <$> quickTypeBoolQuickType |
| @@ -4308,6 +4320,7 @@ instance ToJSON QuickType where | ||
| 4308 | 4320 | , ("Locale" .=) <$> localeQuickType |
| 4309 | 4321 | , ("lock" .=) <$> lockQuickType |
| 4310 | 4322 | , ("long" .=) <$> longQuickType |
| 4323 | + , ("makeDictEncoder" .=) <$> makeDictEncoderQuickType | |
| 4311 | 4324 | , ("map" .=) <$> mapQuickType |
| 4312 | 4325 | , ("MapEntry" .=) <$> mapEntryQuickType |
| 4313 | 4326 | , ("MarshalJSON" .=) <$> marshalJSONQuickType |
| @@ -4655,6 +4668,7 @@ instance FromJSON QuickType where | ||
| 4655 | 4668 | <*> v .:! "Locale" |
| 4656 | 4669 | <*> v .:! "lock" |
| 4657 | 4670 | <*> v .:! "long" |
| 4671 | + <*> v .:! "makeDictEncoder" | |
| 4658 | 4672 | <*> v .:! "map" |
| 4659 | 4673 | <*> v .:! "MapEntry" |
| 4660 | 4674 | <*> v .:! "MarshalJSON" |
| @@ -7113,6 +7127,20 @@ instance ToJSON Long where | ||
| 7113 | 7127 | instance FromJSON Long where |
| 7114 | 7128 | parseJSON (Object _) = return Long |
| 7115 | 7129 | |
| 7130 | +instance ToJSON UnionMakeDictEncoder where | |
| 7131 | + toJSON (DoubleInUnionMakeDictEncoder x) = toJSON x | |
| 7132 | + toJSON (MakeDictEncoderInUnionMakeDictEncoder x) = toJSON x | |
| 7133 | + | |
| 7134 | +instance FromJSON UnionMakeDictEncoder where | |
| 7135 | + parseJSON xs@(Number _) = (fmap DoubleInUnionMakeDictEncoder . parseJSON) xs | |
| 7136 | + parseJSON xs@(Object _) = (fmap MakeDictEncoderInUnionMakeDictEncoder . parseJSON) xs | |
| 7137 | + | |
| 7138 | +instance ToJSON MakeDictEncoder where | |
| 7139 | + toJSON = \_ -> emptyObject | |
| 7140 | + | |
| 7141 | +instance FromJSON MakeDictEncoder where | |
| 7142 | + parseJSON (Object _) = return MakeDictEncoder | |
| 7143 | + | |
| 7116 | 7144 | instance ToJSON UnionMap where |
| 7117 | 7145 | toJSON (DoubleInUnionMap x) = toJSON x |
| 7118 | 7146 | toJSON (MapClassInUnionMap x) = toJSON x |
Aschema-java-datetime-legacydefault / src / main / java / io / quicktype / MakeDictEncoder.java+7 −0
| @@ -0,0 +1,7 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.*; | |
| 4 | + | |
| 5 | +@JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.NONE) | |
| 6 | +public class MakeDictEncoder { | |
| 7 | +} |
Mschema-java-datetime-legacydefault / src / main / java / io / quicktype / TopLevel.java+6 −0
| @@ -185,6 +185,7 @@ public class TopLevel { | ||
| 185 | 185 | private UnionLocale locale; |
| 186 | 186 | private UnionLock lock; |
| 187 | 187 | private UnionLong topLevelLong; |
| 188 | + private UnionMakeDictEncoder makeDictEncoder; | |
| 188 | 189 | private UnionMap map; |
| 189 | 190 | private UnionMapEntry mapEntry; |
| 190 | 191 | private UnionMarshalJSON marshalJSON; |
| @@ -1257,6 +1258,11 @@ public class TopLevel { | ||
| 1257 | 1258 | @JsonProperty("long") |
| 1258 | 1259 | public void setTopLevelLong(UnionLong value) { this.topLevelLong = value; } |
| 1259 | 1260 | |
| 1261 | + @JsonProperty("makeDictEncoder") | |
| 1262 | + public UnionMakeDictEncoder getMakeDictEncoder() { return makeDictEncoder; } | |
| 1263 | + @JsonProperty("makeDictEncoder") | |
| 1264 | + public void setMakeDictEncoder(UnionMakeDictEncoder value) { this.makeDictEncoder = value; } | |
| 1265 | + | |
| 1260 | 1266 | @JsonProperty("map") |
| 1261 | 1267 | public UnionMap getMap() { return map; } |
| 1262 | 1268 | @JsonProperty("map") |
Aschema-java-datetime-legacydefault / src / main / java / io / quicktype / UnionMakeDictEncoder.java+50 −0
| @@ -0,0 +1,50 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import java.io.IOException; | |
| 4 | +import java.io.IOException; | |
| 5 | +import com.fasterxml.jackson.core.*; | |
| 6 | +import com.fasterxml.jackson.databind.*; | |
| 7 | +import com.fasterxml.jackson.databind.annotation.*; | |
| 8 | +import com.fasterxml.jackson.core.type.*; | |
| 9 | + | |
| 10 | +@JsonDeserialize(using = UnionMakeDictEncoder.Deserializer.class) | |
| 11 | +@JsonSerialize(using = UnionMakeDictEncoder.Serializer.class) | |
| 12 | +public class UnionMakeDictEncoder { | |
| 13 | + public Double doubleValue; | |
| 14 | + public MakeDictEncoder makeDictEncoderValue; | |
| 15 | + | |
| 16 | + static class Deserializer extends JsonDeserializer<UnionMakeDictEncoder> { | |
| 17 | + @Override | |
| 18 | + public UnionMakeDictEncoder deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { | |
| 19 | + UnionMakeDictEncoder value = new UnionMakeDictEncoder(); | |
| 20 | + switch (jsonParser.currentToken()) { | |
| 21 | + case VALUE_NULL: | |
| 22 | + break; | |
| 23 | + case VALUE_NUMBER_INT: | |
| 24 | + case VALUE_NUMBER_FLOAT: | |
| 25 | + value.doubleValue = jsonParser.readValueAs(Double.class); | |
| 26 | + break; | |
| 27 | + case START_OBJECT: | |
| 28 | + value.makeDictEncoderValue = jsonParser.readValueAs(MakeDictEncoder.class); | |
| 29 | + break; | |
| 30 | + default: throw new IOException("Cannot deserialize UnionMakeDictEncoder"); | |
| 31 | + } | |
| 32 | + return value; | |
| 33 | + } | |
| 34 | + } | |
| 35 | + | |
| 36 | + static class Serializer extends JsonSerializer<UnionMakeDictEncoder> { | |
| 37 | + @Override | |
| 38 | + public void serialize(UnionMakeDictEncoder obj, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { | |
| 39 | + if (obj.doubleValue != null) { | |
| 40 | + jsonGenerator.writeObject(obj.doubleValue); | |
| 41 | + return; | |
| 42 | + } | |
| 43 | + if (obj.makeDictEncoderValue != null) { | |
| 44 | + jsonGenerator.writeObject(obj.makeDictEncoderValue); | |
| 45 | + return; | |
| 46 | + } | |
| 47 | + jsonGenerator.writeNull(); | |
| 48 | + } | |
| 49 | + } | |
| 50 | +} |
Aschema-java-lombokdefault / src / main / java / io / quicktype / MakeDictEncoder.java+7 −0
| @@ -0,0 +1,7 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.*; | |
| 4 | + | |
| 5 | +@JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.NONE) | |
| 6 | +public class MakeDictEncoder { | |
| 7 | +} |
Mschema-java-lombokdefault / src / main / java / io / quicktype / TopLevel.java+6 −0
| @@ -185,6 +185,7 @@ public class TopLevel { | ||
| 185 | 185 | private UnionLocale locale; |
| 186 | 186 | private UnionLock lock; |
| 187 | 187 | private UnionLong topLevelLong; |
| 188 | + private UnionMakeDictEncoder makeDictEncoder; | |
| 188 | 189 | private UnionMap map; |
| 189 | 190 | private UnionMapEntry mapEntry; |
| 190 | 191 | private UnionMarshalJSON marshalJSON; |
| @@ -1257,6 +1258,11 @@ public class TopLevel { | ||
| 1257 | 1258 | @JsonProperty("long") |
| 1258 | 1259 | public void setTopLevelLong(UnionLong value) { this.topLevelLong = value; } |
| 1259 | 1260 | |
| 1261 | + @JsonProperty("makeDictEncoder") | |
| 1262 | + public UnionMakeDictEncoder getMakeDictEncoder() { return makeDictEncoder; } | |
| 1263 | + @JsonProperty("makeDictEncoder") | |
| 1264 | + public void setMakeDictEncoder(UnionMakeDictEncoder value) { this.makeDictEncoder = value; } | |
| 1265 | + | |
| 1260 | 1266 | @JsonProperty("map") |
| 1261 | 1267 | public UnionMap getMap() { return map; } |
| 1262 | 1268 | @JsonProperty("map") |
Aschema-java-lombokdefault / src / main / java / io / quicktype / UnionMakeDictEncoder.java+50 −0
| @@ -0,0 +1,50 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import java.io.IOException; | |
| 4 | +import java.io.IOException; | |
| 5 | +import com.fasterxml.jackson.core.*; | |
| 6 | +import com.fasterxml.jackson.databind.*; | |
| 7 | +import com.fasterxml.jackson.databind.annotation.*; | |
| 8 | +import com.fasterxml.jackson.core.type.*; | |
| 9 | + | |
| 10 | +@JsonDeserialize(using = UnionMakeDictEncoder.Deserializer.class) | |
| 11 | +@JsonSerialize(using = UnionMakeDictEncoder.Serializer.class) | |
| 12 | +public class UnionMakeDictEncoder { | |
| 13 | + public Double doubleValue; | |
| 14 | + public MakeDictEncoder makeDictEncoderValue; | |
| 15 | + | |
| 16 | + static class Deserializer extends JsonDeserializer<UnionMakeDictEncoder> { | |
| 17 | + @Override | |
| 18 | + public UnionMakeDictEncoder deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { | |
| 19 | + UnionMakeDictEncoder value = new UnionMakeDictEncoder(); | |
| 20 | + switch (jsonParser.currentToken()) { | |
| 21 | + case VALUE_NULL: | |
| 22 | + break; | |
| 23 | + case VALUE_NUMBER_INT: | |
| 24 | + case VALUE_NUMBER_FLOAT: | |
| 25 | + value.doubleValue = jsonParser.readValueAs(Double.class); | |
| 26 | + break; | |
| 27 | + case START_OBJECT: | |
| 28 | + value.makeDictEncoderValue = jsonParser.readValueAs(MakeDictEncoder.class); | |
| 29 | + break; | |
| 30 | + default: throw new IOException("Cannot deserialize UnionMakeDictEncoder"); | |
| 31 | + } | |
| 32 | + return value; | |
| 33 | + } | |
| 34 | + } | |
| 35 | + | |
| 36 | + static class Serializer extends JsonSerializer<UnionMakeDictEncoder> { | |
| 37 | + @Override | |
| 38 | + public void serialize(UnionMakeDictEncoder obj, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { | |
| 39 | + if (obj.doubleValue != null) { | |
| 40 | + jsonGenerator.writeObject(obj.doubleValue); | |
| 41 | + return; | |
| 42 | + } | |
| 43 | + if (obj.makeDictEncoderValue != null) { | |
| 44 | + jsonGenerator.writeObject(obj.makeDictEncoderValue); | |
| 45 | + return; | |
| 46 | + } | |
| 47 | + jsonGenerator.writeNull(); | |
| 48 | + } | |
| 49 | + } | |
| 50 | +} |
Aschema-javadefault / src / main / java / io / quicktype / MakeDictEncoder.java+7 −0
| @@ -0,0 +1,7 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.*; | |
| 4 | + | |
| 5 | +@JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.NONE) | |
| 6 | +public class MakeDictEncoder { | |
| 7 | +} |
Mschema-javadefault / src / main / java / io / quicktype / TopLevel.java+6 −0
| @@ -185,6 +185,7 @@ public class TopLevel { | ||
| 185 | 185 | private UnionLocale locale; |
| 186 | 186 | private UnionLock lock; |
| 187 | 187 | private UnionLong topLevelLong; |
| 188 | + private UnionMakeDictEncoder makeDictEncoder; | |
| 188 | 189 | private UnionMap map; |
| 189 | 190 | private UnionMapEntry mapEntry; |
| 190 | 191 | private UnionMarshalJSON marshalJSON; |
| @@ -1257,6 +1258,11 @@ public class TopLevel { | ||
| 1257 | 1258 | @JsonProperty("long") |
| 1258 | 1259 | public void setTopLevelLong(UnionLong value) { this.topLevelLong = value; } |
| 1259 | 1260 | |
| 1261 | + @JsonProperty("makeDictEncoder") | |
| 1262 | + public UnionMakeDictEncoder getMakeDictEncoder() { return makeDictEncoder; } | |
| 1263 | + @JsonProperty("makeDictEncoder") | |
| 1264 | + public void setMakeDictEncoder(UnionMakeDictEncoder value) { this.makeDictEncoder = value; } | |
| 1265 | + | |
| 1260 | 1266 | @JsonProperty("map") |
| 1261 | 1267 | public UnionMap getMap() { return map; } |
| 1262 | 1268 | @JsonProperty("map") |
Aschema-javadefault / src / main / java / io / quicktype / UnionMakeDictEncoder.java+50 −0
| @@ -0,0 +1,50 @@ | ||
| 1 | +package io.quicktype; | |
| 2 | + | |
| 3 | +import java.io.IOException; | |
| 4 | +import java.io.IOException; | |
| 5 | +import com.fasterxml.jackson.core.*; | |
| 6 | +import com.fasterxml.jackson.databind.*; | |
| 7 | +import com.fasterxml.jackson.databind.annotation.*; | |
| 8 | +import com.fasterxml.jackson.core.type.*; | |
| 9 | + | |
| 10 | +@JsonDeserialize(using = UnionMakeDictEncoder.Deserializer.class) | |
| 11 | +@JsonSerialize(using = UnionMakeDictEncoder.Serializer.class) | |
| 12 | +public class UnionMakeDictEncoder { | |
| 13 | + public Double doubleValue; | |
| 14 | + public MakeDictEncoder makeDictEncoderValue; | |
| 15 | + | |
| 16 | + static class Deserializer extends JsonDeserializer<UnionMakeDictEncoder> { | |
| 17 | + @Override | |
| 18 | + public UnionMakeDictEncoder deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { | |
| 19 | + UnionMakeDictEncoder value = new UnionMakeDictEncoder(); | |
| 20 | + switch (jsonParser.currentToken()) { | |
| 21 | + case VALUE_NULL: | |
| 22 | + break; | |
| 23 | + case VALUE_NUMBER_INT: | |
| 24 | + case VALUE_NUMBER_FLOAT: | |
| 25 | + value.doubleValue = jsonParser.readValueAs(Double.class); | |
| 26 | + break; | |
| 27 | + case START_OBJECT: | |
| 28 | + value.makeDictEncoderValue = jsonParser.readValueAs(MakeDictEncoder.class); | |
| 29 | + break; | |
| 30 | + default: throw new IOException("Cannot deserialize UnionMakeDictEncoder"); | |
| 31 | + } | |
| 32 | + return value; | |
| 33 | + } | |
| 34 | + } | |
| 35 | + | |
| 36 | + static class Serializer extends JsonSerializer<UnionMakeDictEncoder> { | |
| 37 | + @Override | |
| 38 | + public void serialize(UnionMakeDictEncoder obj, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { | |
| 39 | + if (obj.doubleValue != null) { | |
| 40 | + jsonGenerator.writeObject(obj.doubleValue); | |
| 41 | + return; | |
| 42 | + } | |
| 43 | + if (obj.makeDictEncoderValue != null) { | |
| 44 | + jsonGenerator.writeObject(obj.makeDictEncoderValue); | |
| 45 | + return; | |
| 46 | + } | |
| 47 | + jsonGenerator.writeNull(); | |
| 48 | + } | |
| 49 | + } | |
| 50 | +} |
Mschema-javascript-prop-typesdefault / toplevel.js+4 −0
| @@ -228,6 +228,7 @@ let _Let; | ||
| 228 | 228 | let _List; |
| 229 | 229 | let _Lock; |
| 230 | 230 | let _Long; |
| 231 | +let _MakeDictEncoder; | |
| 231 | 232 | let _Map; |
| 232 | 233 | let _MetadataPropertyHandling; |
| 233 | 234 | let _Module; |
| @@ -785,6 +786,8 @@ _Lock = PropTypes.shape({ | ||
| 785 | 786 | }); |
| 786 | 787 | _Long = PropTypes.shape({ |
| 787 | 788 | }); |
| 789 | +_MakeDictEncoder = PropTypes.shape({ | |
| 790 | +}); | |
| 788 | 791 | _Map = PropTypes.shape({ |
| 789 | 792 | }); |
| 790 | 793 | _MetadataPropertyHandling = PropTypes.shape({ |
| @@ -1222,6 +1225,7 @@ _TopLevel = PropTypes.shape({ | ||
| 1222 | 1225 | "Locale": PropTypes.oneOfType([_Locale, PropTypes.number, PropTypes.oneOf([null])]), |
| 1223 | 1226 | "lock": PropTypes.oneOfType([_Lock, PropTypes.number, PropTypes.oneOf([null])]), |
| 1224 | 1227 | "long": PropTypes.oneOfType([_Long, PropTypes.number, PropTypes.oneOf([null])]), |
| 1228 | + "makeDictEncoder": PropTypes.oneOfType([_MakeDictEncoder, PropTypes.number, PropTypes.oneOf([null])]), | |
| 1225 | 1229 | "map": PropTypes.oneOfType([_Map, PropTypes.number, PropTypes.oneOf([null])]), |
| 1226 | 1230 | "MapEntry": PropTypes.oneOfType([_MapEntry, PropTypes.number, PropTypes.oneOf([null])]), |
| 1227 | 1231 | "MarshalJSON": PropTypes.oneOfType([_MarshalJSON, PropTypes.number, PropTypes.oneOf([null])]), |
Mschema-javascriptdefault / TopLevel.js+5 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
| @@ -375,6 +375,7 @@ const typeMap = { | ||
| 375 | 375 | { json: "Locale", js: "Locale", typ: u(undefined, u(r("Locale"), 3.14)) }, |
| 376 | 376 | { json: "lock", js: "lock", typ: u(undefined, u(r("Lock"), 3.14)) }, |
| 377 | 377 | { json: "long", js: "long", typ: u(undefined, u(r("Long"), 3.14)) }, |
| 378 | + { json: "makeDictEncoder", js: "makeDictEncoder", typ: u(undefined, u(r("MakeDictEncoder"), 3.14)) }, | |
| 378 | 379 | { json: "map", js: "map", typ: u(undefined, u(r("Map"), 3.14)) }, |
| 379 | 380 | { json: "MapEntry", js: "MapEntry", typ: u(undefined, u(r("MapEntry"), 3.14)) }, |
| 380 | 381 | { json: "MarshalJSON", js: "MarshalJSON", typ: u(undefined, u(r("MarshalJSON"), 3.14)) }, |
| @@ -967,6 +968,8 @@ const typeMap = { | ||
| 967 | 968 | ], false), |
| 968 | 969 | "Long": o([ |
| 969 | 970 | ], false), |
| 971 | + "MakeDictEncoder": o([ | |
| 972 | + ], false), | |
| 970 | 973 | "Map": o([ |
| 971 | 974 | ], false), |
| 972 | 975 | "MetadataPropertyHandling": o([ |
Mschema-objective-cdefault / QTTopLevel.h+5 −0
| @@ -157,6 +157,7 @@ | ||
| 157 | 157 | @class QTList; |
| 158 | 158 | @class QTLocale; |
| 159 | 159 | @class QTLock; |
| 160 | +@class QTMakeDictEncoder; | |
| 160 | 161 | @class QTMap; |
| 161 | 162 | @class QTMapEntry; |
| 162 | 163 | @class QTMarshalJSON; |
| @@ -543,6 +544,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 543 | 544 | @property (nonatomic, nullable, copy) id locale; |
| 544 | 545 | @property (nonatomic, nullable, copy) id lock; |
| 545 | 546 | @property (nonatomic, nullable, copy) id qtTopLevelLong; |
| 547 | +@property (nonatomic, nullable, copy) id makeDictEncoder; | |
| 546 | 548 | @property (nonatomic, nullable, copy) id map; |
| 547 | 549 | @property (nonatomic, nullable, copy) id mapEntry; |
| 548 | 550 | @property (nonatomic, nullable, copy) id marshalJSON; |
| @@ -1164,6 +1166,9 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding en | ||
| 1164 | 1166 | @interface QTLock : NSObject |
| 1165 | 1167 | @end |
| 1166 | 1168 | |
| 1169 | +@interface QTMakeDictEncoder : NSObject | |
| 1170 | +@end | |
| 1171 | + | |
| 1167 | 1172 | @interface QTMap : NSObject |
| 1168 | 1173 | @end |
Mschema-objective-cdefault / QTTopLevel.m+45 −0
| @@ -768,6 +768,11 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 768 | 768 | - (NSDictionary *)JSONDictionary; |
| 769 | 769 | @end |
| 770 | 770 | |
| 771 | +@interface QTMakeDictEncoder (JSONConversion) | |
| 772 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict; | |
| 773 | +- (NSDictionary *)JSONDictionary; | |
| 774 | +@end | |
| 775 | + | |
| 771 | 776 | @interface QTMap (JSONConversion) |
| 772 | 777 | + (instancetype)fromJSONDictionary:(NSDictionary *)dict; |
| 773 | 778 | - (NSDictionary *)JSONDictionary; |
| @@ -1946,6 +1951,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 1946 | 1951 | @"Locale": @"locale", |
| 1947 | 1952 | @"lock": @"lock", |
| 1948 | 1953 | @"long": @"qtTopLevelLong", |
| 1954 | + @"makeDictEncoder": @"makeDictEncoder", | |
| 1949 | 1955 | @"map": @"map", |
| 1950 | 1956 | @"MapEntry": @"mapEntry", |
| 1951 | 1957 | @"MarshalJSON": @"marshalJSON", |
| @@ -8060,6 +8066,45 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 8060 | 8066 | } |
| 8061 | 8067 | @end |
| 8062 | 8068 | |
| 8069 | +@implementation QTMakeDictEncoder | |
| 8070 | ++ (NSDictionary<NSString *, NSString *> *)properties | |
| 8071 | +{ | |
| 8072 | + static NSDictionary<NSString *, NSString *> *properties; | |
| 8073 | + return properties = properties ? properties : @{ | |
| 8074 | + }; | |
| 8075 | +} | |
| 8076 | + | |
| 8077 | ++ (instancetype)fromJSONDictionary:(NSDictionary *)dict | |
| 8078 | +{ | |
| 8079 | + return [dict isKindOfClass:NSDictionary.class] ? [[QTMakeDictEncoder alloc] initWithJSONDictionary:dict] : nil; | |
| 8080 | +} | |
| 8081 | + | |
| 8082 | +- (instancetype)initWithJSONDictionary:(NSDictionary *)dict | |
| 8083 | +{ | |
| 8084 | + if (self = [super init]) { | |
| 8085 | + [self setValuesForKeysWithDictionary:dict]; | |
| 8086 | + } | |
| 8087 | + return self; | |
| 8088 | +} | |
| 8089 | + | |
| 8090 | +- (void)setValue:(nullable id)value forKey:(NSString *)key | |
| 8091 | +{ | |
| 8092 | + id resolved = QTMakeDictEncoder.properties[key]; | |
| 8093 | + if (resolved) [super setValue:value forKey:resolved]; | |
| 8094 | +} | |
| 8095 | + | |
| 8096 | +- (void)setNilValueForKey:(NSString *)key | |
| 8097 | +{ | |
| 8098 | + id resolved = QTMakeDictEncoder.properties[key]; | |
| 8099 | + if (resolved) [super setValue:@(0) forKey:resolved]; | |
| 8100 | +} | |
| 8101 | + | |
| 8102 | +- (NSDictionary *)JSONDictionary | |
| 8103 | +{ | |
| 8104 | + return [self dictionaryWithValuesForKeys:QTMakeDictEncoder.properties.allValues]; | |
| 8105 | +} | |
| 8106 | +@end | |
| 8107 | + | |
| 8063 | 8108 | @implementation QTMap |
| 8064 | 8109 | + (NSDictionary<NSString *, NSString *> *)properties |
| 8065 | 8110 | { |
Mschema-phpdefault / TopLevel.php+290 −162
| @@ -186,6 +186,7 @@ class TopLevel { | ||
| 186 | 186 | private LocaleClass|float|null $locale; // json:Locale Optional |
| 187 | 187 | private Lock|float|null $lock; // json:lock Optional |
| 188 | 188 | private Long|float|null $long; // json:long Optional |
| 189 | + private MakeDictEncoder|float|null $makeDictEncoder; // json:makeDictEncoder Optional | |
| 189 | 190 | private Map|float|null $map; // json:map Optional |
| 190 | 191 | private MapEntry|float|null $mapEntry; // json:MapEntry Optional |
| 191 | 192 | private MarshalJSON|float|null $marshalJSON; // json:MarshalJSON Optional |
| @@ -531,6 +532,7 @@ class TopLevel { | ||
| 531 | 532 | * @param LocaleClass|float|null $locale |
| 532 | 533 | * @param Lock|float|null $lock |
| 533 | 534 | * @param Long|float|null $long |
| 535 | + * @param MakeDictEncoder|float|null $makeDictEncoder | |
| 534 | 536 | * @param Map|float|null $map |
| 535 | 537 | * @param MapEntry|float|null $mapEntry |
| 536 | 538 | * @param MarshalJSON|float|null $marshalJSON |
| @@ -693,7 +695,7 @@ class TopLevel { | ||
| 693 | 695 | * @param Yes|float|null $yes |
| 694 | 696 | * @param YieldClass|float|null $yield |
| 695 | 697 | */ |
| 696 | - public function __construct(Union|float|null $empty, UnionBoolBool|float|null $topLevelBool, Complex|float|null $complex, Imaginery|float|null $imaginery, AbstractClass|float|null $abstract, Alignas|float|null $alignas, Alignof|float|null $alignof, AndClass|float|null $and, AndEq|float|null $andEq, AnyClass|float|null $topLevelAny, Any|float|null $any, ArrayClass|float|null $array, AsClass|float|null $as, ASM|float|null $asm, Assert|float|null $assert, Associatedtype|float|null $associatedtype, Associativity|float|null $associativity, Async|float|null $async, Atomic|float|null $atomic, AtomicCancel|float|null $atomicCancel, AtomicCommit|float|null $atomicCommit, AtomicNoexcept|float|null $atomicNoexcept, Auto|float|null $auto, Await|float|null $await, Base|float|null $base, Bitand|float|null $bitand, Bitor|float|null $bitor, BOOLClass|float|null $bool, UnionBoolBoolClass|float|null $purpleBool, Boolean|float|null $boolean, BreakClass|float|null $break, Bycopy|float|null $bycopy, Byref|float|null $byref, Byte|float|null $byte, Calendar|float|null $calendar, CaseClass|float|null $case, CatchClass|float|null $catch, Chan|float|null $chan, Char|float|null $char, Char16T|float|null $char16T, Char32T|float|null $char32T, Checked|float|null $checked, UnionClassClass|float|null $topLevelClass, ClassClass|float|null $class, CloneClass|float|null $clone, CoAwait|float|null $coAwait, CoReturn|float|null $coReturn, CoYield|float|null $coYield, Codable|float|null $codable, CodingKey|float|null $codingKey, CodingKeys|float|null $codingKeys, Compl|float|null $compl, Concept|float|null $concept, Console|float|null $console, ConstClass|float|null $const, ConstCast|float|null $constCast, Constexpr|float|null $constexpr, Constructor|float|null $constructor, ContinueClass|float|null $continue, Convenience|float|null $convenience, Convert|float|null $convert, ConverterClass|float|null $converter, CultureInfo|float|null $cultureInfo, Date|float|null $date, DateParseHandling|float|null $dateParseHandling, DateFormatter|float|null $dateFormatter, DateOnly|float|null $dateOnly, DateOnlyConverter|float|null $dateOnlyConverter, DateTimeClass|float|null $dateTime, DateTimeStyles|float|null $dateTimeStyles, Debugger|float|null $debugger, Decimal|float|null $decimal, DeclareClass|float|null $declare, Decltype|float|null $decltype, DecodeString|float|null $decodeString, Decoder|float|null $decoder, DecodingError|float|null $decodingError, Def|float|null $def, DefaultClass|float|null $default, Defer|float|null $defer, Deinit|float|null $deinit, Del|float|null $del, Delegate|float|null $delegate, Delete|float|null $delete, Dict|float|null $dict, Dictionary|float|null $dictionary, DidSet|float|null $didSet, DoClass|float|null $do, Double|float|null $double, ?float $dummy, Dynamic|float|null $dynamic, DynamicCast|float|null $dynamicCast, Elif|float|null $elif, ElseClass|float|null $else, EncodeQuickType|float|null $encodeQuickType, Encoder|float|null $encoder, EnumClass|float|null $enum, EnumValues|float|null $enumValues, EqualityContract|float|null $equalityContract, Equatable|float|null $equatable, Event|float|null $event, Except|float|null $except, ExceptionClass|float|null $exception, Explicit|float|null $explicit, Export|float|null $export, Exposing|float|null $exposing, ExtendsClass|float|null $extends, Extension|float|null $extension, Extern|float|null $extern, Fallthrough|float|null $fallthrough, UnionFalseFalse|float|null $topLevelFalse, FalseClass|float|null $false, Fileprivate|float|null $fileprivate, FinalClass|float|null $final, FinallyClass|float|null $finally, Fixed|float|null $fixed, FloatClass|float|null $float, ForClass|float|null $for, ForeachClass|float|null $foreach, FormatException|float|null $formatException, Friend|float|null $friend, From|float|null $from, FromDict|float|null $fromDict, FromJSON|float|null $fromJSON, Func|float|null $func, FunctionClass|float|null $function, Get|float|null $get, GlobalClass|float|null $global, Go|float|null $go, GotoClass|float|null $goto, Guard|float|null $guard, Hashable|float|null $hashable, HashCode|float|null $hashCode, Hasher|float|null $hasher, HasOwnProperty|float|null $hasOwnProperty, ID|float|null $id, IfClass|float|null $if, Imp|float|null $imp, ImplementsClass|float|null $implements, Implicit|float|null $implicit, Import|float|null $import, In|float|null $in, Indirect|float|null $indirect, Infix|float|null $infix, Init|float|null $init, Inline|float|null $inline, Inout|float|null $inout, InstanceofClass|float|null $instanceof, IntClass|float|null $int, InterfaceClass|float|null $interface, Internal|float|null $internal, Is|float|null $is, ISODateTimeOffsetConverter|float|null $isoDateTimeOffsetConverter, IterableClass|float|null $iterable, Jdec|float|null $jdec, Jenc|float|null $jenc, Jpipe|float|null $jpipe, JSON|float|null $json, JSONConverter|float|null $jsonConverter, JSONSerializer|float|null $jsonSerializer, JSONToken|float|null $jsonToken, JSONWriter|float|null $jsonWriter, JSONAny|float|null $jsonAny, JSONCodingKey|float|null $jsonCodingKey, JSONDecoder|float|null $jsonDecoder, JSONEncoder|float|null $jsonEncoder, JSONExceptionClass|float|null $jsonException, JSONGenerator|float|null $jsonGenerator, JSONNode|float|null $jsonNode, JSONNull|float|null $jsonNull, JSONParser|float|null $jsonParser, JSONReader|float|null $jsonReader, JSONTokenType|float|null $jsonTokenType, KSerializer|float|null $kSerializer, Lambda|float|null $lambda, Lazy|float|null $lazy, Left|float|null $left, Let|float|null $let, ListClass|float|null $list, LocaleClass|float|null $locale, Lock|float|null $lock, Long|float|null $long, Map|float|null $map, MapEntry|float|null $mapEntry, MarshalJSON|float|null $marshalJSON, MetadataPropertyHandling|float|null $metadataPropertyHandling, Module|float|null $module, Mutable|float|null $mutable, Mutating|float|null $mutating, NamespaceClass|float|null $namespace, Native|float|null $native, NewClass|float|null $new, Newtonsoft|float|null $newtonsoft, Nil|float|null $nil, No|float|null $no, Noexcept|float|null $noexcept, Nonatomic|float|null $nonatomic, NoneClass|float|null $topLevelNone, None|float|null $none, Nonlocal|float|null $nonlocal, Nonmutating|float|null $nonmutating, NoSuchMethod|float|null $noSuchMethod, Not|float|null $not, NotEq|float|null $notEq, NSError|float|null $nsError, NSObject|float|null $nsObject, NSString|float|null $nsString, NULLClass|float|null $null, UnionNullNull|float|null $topLevelNull, Nullptr|float|null $nullptr, Number|float|null $number, ObjectClass|float|null $object, ObjectMapper|float|null $objectMapper, Of|float|null $of, Oneway|float|null $oneway, Open|float|null $open, Operator|float|null $operator, Optional|float|null $optional, OrClass|float|null $or, OrEq|float|null $orEq, Out|float|null $out, OverrideClass|float|null $override, Package|float|null $package, Params|float|null $params, Pass|float|null $pass, Port|float|null $port, Postfix|float|null $postfix, Precedence|float|null $precedence, Prefix|float|null $prefix, PrimitiveKind|float|null $primitiveKind, PrintClass|float|null $print, Printf|float|null $printf, PrintMembers|float|null $printMembers, PrivateClass|float|null $private, ProtectedClass|float|null $protected, Protocol|float|null $protocol, ProtocolClass|float|null $topLevelProtocol, PublicClass|float|null $public, Quicktype|float|null $quicktype, Raise|float|null $raise, Range|float|null $range, ReadonlyClass|float|null $readonly, Ref|float|null $ref, RegExp|float|null $regExp, Register|float|null $register, ReinterpretCast|float|null $reinterpretCast, Repeat|float|null $repeat, RequireClass|float|null $require, Required|float|null $required, Requires|float|null $requires, Restrict|float|null $restrict, Retain|float|null $retain, Rethrows|float|null $rethrows, ReturnClass|float|null $return, Right|float|null $right, RuntimeType|float|null $runtimeType, S|float|null $s, Sbyte|float|null $sbyte, Sealed|float|null $sealed, Sel|float|null $sel, Select|float|null $select, SelfClass|float|null $self, UnionSelfSelf|float|null $topLevelSelf, Sendable|float|null $sendable, SerialDescriptor|float|null $serialDescriptor, SerializableClass|float|null $serializable, Serialize|float|null $serialize, SerializerProvider|float|null $serializerProvider, SerialName|float|null $serialName, Set|float|null $set, Short|float|null $short, Signed|float|null $signed, SimpleModule|float|null $simpleModule, Sizeof|float|null $sizeof, Stackalloc|float|null $stackalloc, Standards|float|null $standards, StaticClass|float|null $static, StaticAssert|float|null $staticAssert, StaticCast|float|null $staticCast, StdDeserializer|float|null $stdDeserializer, StdSerializer|float|null $stdSerializer, Strictfp|float|null $strictfp, StringClass|float|null $string, Struct|float|null $struct, Subscript|float|null $subscript, Super|float|null $super, SwitchClass|float|null $switch, Symbol|float|null $symbol, Synchronized|float|null $synchronized, System|float|null $system, Template|float|null $template, Then|float|null $then, This|float|null $topLevelThis, ThreadLocal|float|null $threadLocal, ThrowClass|float|null $throw, Throws|float|null $throws, TimeOnly|float|null $timeOnly, TimeOnlyConverter|float|null $timeOnlyConverter, TimeZone|float|null $timeZone, ToDict|float|null $toDict, ToJSON|float|null $toJSON, TopLevelClass|float|null $topLevel, ToString|float|null $toString, Transient|float|null $transient, TrueClass|float|null $true, UnionTrueTrue|float|null $topLevelTrue, TryClass|float|null $try, Type|float|null $type, TypeClass|float|null $topLevelType, Typealias|float|null $typealias, Typedef|float|null $typedef, Typeid|float|null $typeid, Typename|float|null $typename, Typeof|float|null $typeof, Uint|float|null $uint, Ulong|float|null $ulong, Unchecked|float|null $unchecked, Undefined|float|null $undefined, UnionClass|float|null $union, UnmarshalJSON|float|null $unmarshalJSON, Unowned|float|null $unowned, Unsafe|float|null $unsafe, Unsigned|float|null $unsigned, UseSerializers|float|null $useSerializers, Ushort|float|null $ushort, Using|float|null $using, Utf8JSONReader|float|null $utf8JSONReader, Utf8JSONWriter|float|null $utf8JSONWriter, UUID|float|null $uuid, VarClass|float|null $var, Virtual|float|null $virtual, VoidClass|float|null $void, Volatile|float|null $volatile, WcharT|float|null $wcharT, Weak|float|null $weak, Where|float|null $where, WhileClass|float|null $while, WillSet|float|null $willSet, With|float|null $with, XorClass|float|null $xor, XorEq|float|null $xorEq, Yes|float|null $yes, YieldClass|float|null $yield) { | |
| 698 | + public function __construct(Union|float|null $empty, UnionBoolBool|float|null $topLevelBool, Complex|float|null $complex, Imaginery|float|null $imaginery, AbstractClass|float|null $abstract, Alignas|float|null $alignas, Alignof|float|null $alignof, AndClass|float|null $and, AndEq|float|null $andEq, AnyClass|float|null $topLevelAny, Any|float|null $any, ArrayClass|float|null $array, AsClass|float|null $as, ASM|float|null $asm, Assert|float|null $assert, Associatedtype|float|null $associatedtype, Associativity|float|null $associativity, Async|float|null $async, Atomic|float|null $atomic, AtomicCancel|float|null $atomicCancel, AtomicCommit|float|null $atomicCommit, AtomicNoexcept|float|null $atomicNoexcept, Auto|float|null $auto, Await|float|null $await, Base|float|null $base, Bitand|float|null $bitand, Bitor|float|null $bitor, BOOLClass|float|null $bool, UnionBoolBoolClass|float|null $purpleBool, Boolean|float|null $boolean, BreakClass|float|null $break, Bycopy|float|null $bycopy, Byref|float|null $byref, Byte|float|null $byte, Calendar|float|null $calendar, CaseClass|float|null $case, CatchClass|float|null $catch, Chan|float|null $chan, Char|float|null $char, Char16T|float|null $char16T, Char32T|float|null $char32T, Checked|float|null $checked, UnionClassClass|float|null $topLevelClass, ClassClass|float|null $class, CloneClass|float|null $clone, CoAwait|float|null $coAwait, CoReturn|float|null $coReturn, CoYield|float|null $coYield, Codable|float|null $codable, CodingKey|float|null $codingKey, CodingKeys|float|null $codingKeys, Compl|float|null $compl, Concept|float|null $concept, Console|float|null $console, ConstClass|float|null $const, ConstCast|float|null $constCast, Constexpr|float|null $constexpr, Constructor|float|null $constructor, ContinueClass|float|null $continue, Convenience|float|null $convenience, Convert|float|null $convert, ConverterClass|float|null $converter, CultureInfo|float|null $cultureInfo, Date|float|null $date, DateParseHandling|float|null $dateParseHandling, DateFormatter|float|null $dateFormatter, DateOnly|float|null $dateOnly, DateOnlyConverter|float|null $dateOnlyConverter, DateTimeClass|float|null $dateTime, DateTimeStyles|float|null $dateTimeStyles, Debugger|float|null $debugger, Decimal|float|null $decimal, DeclareClass|float|null $declare, Decltype|float|null $decltype, DecodeString|float|null $decodeString, Decoder|float|null $decoder, DecodingError|float|null $decodingError, Def|float|null $def, DefaultClass|float|null $default, Defer|float|null $defer, Deinit|float|null $deinit, Del|float|null $del, Delegate|float|null $delegate, Delete|float|null $delete, Dict|float|null $dict, Dictionary|float|null $dictionary, DidSet|float|null $didSet, DoClass|float|null $do, Double|float|null $double, ?float $dummy, Dynamic|float|null $dynamic, DynamicCast|float|null $dynamicCast, Elif|float|null $elif, ElseClass|float|null $else, EncodeQuickType|float|null $encodeQuickType, Encoder|float|null $encoder, EnumClass|float|null $enum, EnumValues|float|null $enumValues, EqualityContract|float|null $equalityContract, Equatable|float|null $equatable, Event|float|null $event, Except|float|null $except, ExceptionClass|float|null $exception, Explicit|float|null $explicit, Export|float|null $export, Exposing|float|null $exposing, ExtendsClass|float|null $extends, Extension|float|null $extension, Extern|float|null $extern, Fallthrough|float|null $fallthrough, UnionFalseFalse|float|null $topLevelFalse, FalseClass|float|null $false, Fileprivate|float|null $fileprivate, FinalClass|float|null $final, FinallyClass|float|null $finally, Fixed|float|null $fixed, FloatClass|float|null $float, ForClass|float|null $for, ForeachClass|float|null $foreach, FormatException|float|null $formatException, Friend|float|null $friend, From|float|null $from, FromDict|float|null $fromDict, FromJSON|float|null $fromJSON, Func|float|null $func, FunctionClass|float|null $function, Get|float|null $get, GlobalClass|float|null $global, Go|float|null $go, GotoClass|float|null $goto, Guard|float|null $guard, Hashable|float|null $hashable, HashCode|float|null $hashCode, Hasher|float|null $hasher, HasOwnProperty|float|null $hasOwnProperty, ID|float|null $id, IfClass|float|null $if, Imp|float|null $imp, ImplementsClass|float|null $implements, Implicit|float|null $implicit, Import|float|null $import, In|float|null $in, Indirect|float|null $indirect, Infix|float|null $infix, Init|float|null $init, Inline|float|null $inline, Inout|float|null $inout, InstanceofClass|float|null $instanceof, IntClass|float|null $int, InterfaceClass|float|null $interface, Internal|float|null $internal, Is|float|null $is, ISODateTimeOffsetConverter|float|null $isoDateTimeOffsetConverter, IterableClass|float|null $iterable, Jdec|float|null $jdec, Jenc|float|null $jenc, Jpipe|float|null $jpipe, JSON|float|null $json, JSONConverter|float|null $jsonConverter, JSONSerializer|float|null $jsonSerializer, JSONToken|float|null $jsonToken, JSONWriter|float|null $jsonWriter, JSONAny|float|null $jsonAny, JSONCodingKey|float|null $jsonCodingKey, JSONDecoder|float|null $jsonDecoder, JSONEncoder|float|null $jsonEncoder, JSONExceptionClass|float|null $jsonException, JSONGenerator|float|null $jsonGenerator, JSONNode|float|null $jsonNode, JSONNull|float|null $jsonNull, JSONParser|float|null $jsonParser, JSONReader|float|null $jsonReader, JSONTokenType|float|null $jsonTokenType, KSerializer|float|null $kSerializer, Lambda|float|null $lambda, Lazy|float|null $lazy, Left|float|null $left, Let|float|null $let, ListClass|float|null $list, LocaleClass|float|null $locale, Lock|float|null $lock, Long|float|null $long, MakeDictEncoder|float|null $makeDictEncoder, Map|float|null $map, MapEntry|float|null $mapEntry, MarshalJSON|float|null $marshalJSON, MetadataPropertyHandling|float|null $metadataPropertyHandling, Module|float|null $module, Mutable|float|null $mutable, Mutating|float|null $mutating, NamespaceClass|float|null $namespace, Native|float|null $native, NewClass|float|null $new, Newtonsoft|float|null $newtonsoft, Nil|float|null $nil, No|float|null $no, Noexcept|float|null $noexcept, Nonatomic|float|null $nonatomic, NoneClass|float|null $topLevelNone, None|float|null $none, Nonlocal|float|null $nonlocal, Nonmutating|float|null $nonmutating, NoSuchMethod|float|null $noSuchMethod, Not|float|null $not, NotEq|float|null $notEq, NSError|float|null $nsError, NSObject|float|null $nsObject, NSString|float|null $nsString, NULLClass|float|null $null, UnionNullNull|float|null $topLevelNull, Nullptr|float|null $nullptr, Number|float|null $number, ObjectClass|float|null $object, ObjectMapper|float|null $objectMapper, Of|float|null $of, Oneway|float|null $oneway, Open|float|null $open, Operator|float|null $operator, Optional|float|null $optional, OrClass|float|null $or, OrEq|float|null $orEq, Out|float|null $out, OverrideClass|float|null $override, Package|float|null $package, Params|float|null $params, Pass|float|null $pass, Port|float|null $port, Postfix|float|null $postfix, Precedence|float|null $precedence, Prefix|float|null $prefix, PrimitiveKind|float|null $primitiveKind, PrintClass|float|null $print, Printf|float|null $printf, PrintMembers|float|null $printMembers, PrivateClass|float|null $private, ProtectedClass|float|null $protected, Protocol|float|null $protocol, ProtocolClass|float|null $topLevelProtocol, PublicClass|float|null $public, Quicktype|float|null $quicktype, Raise|float|null $raise, Range|float|null $range, ReadonlyClass|float|null $readonly, Ref|float|null $ref, RegExp|float|null $regExp, Register|float|null $register, ReinterpretCast|float|null $reinterpretCast, Repeat|float|null $repeat, RequireClass|float|null $require, Required|float|null $required, Requires|float|null $requires, Restrict|float|null $restrict, Retain|float|null $retain, Rethrows|float|null $rethrows, ReturnClass|float|null $return, Right|float|null $right, RuntimeType|float|null $runtimeType, S|float|null $s, Sbyte|float|null $sbyte, Sealed|float|null $sealed, Sel|float|null $sel, Select|float|null $select, SelfClass|float|null $self, UnionSelfSelf|float|null $topLevelSelf, Sendable|float|null $sendable, SerialDescriptor|float|null $serialDescriptor, SerializableClass|float|null $serializable, Serialize|float|null $serialize, SerializerProvider|float|null $serializerProvider, SerialName|float|null $serialName, Set|float|null $set, Short|float|null $short, Signed|float|null $signed, SimpleModule|float|null $simpleModule, Sizeof|float|null $sizeof, Stackalloc|float|null $stackalloc, Standards|float|null $standards, StaticClass|float|null $static, StaticAssert|float|null $staticAssert, StaticCast|float|null $staticCast, StdDeserializer|float|null $stdDeserializer, StdSerializer|float|null $stdSerializer, Strictfp|float|null $strictfp, StringClass|float|null $string, Struct|float|null $struct, Subscript|float|null $subscript, Super|float|null $super, SwitchClass|float|null $switch, Symbol|float|null $symbol, Synchronized|float|null $synchronized, System|float|null $system, Template|float|null $template, Then|float|null $then, This|float|null $topLevelThis, ThreadLocal|float|null $threadLocal, ThrowClass|float|null $throw, Throws|float|null $throws, TimeOnly|float|null $timeOnly, TimeOnlyConverter|float|null $timeOnlyConverter, TimeZone|float|null $timeZone, ToDict|float|null $toDict, ToJSON|float|null $toJSON, TopLevelClass|float|null $topLevel, ToString|float|null $toString, Transient|float|null $transient, TrueClass|float|null $true, UnionTrueTrue|float|null $topLevelTrue, TryClass|float|null $try, Type|float|null $type, TypeClass|float|null $topLevelType, Typealias|float|null $typealias, Typedef|float|null $typedef, Typeid|float|null $typeid, Typename|float|null $typename, Typeof|float|null $typeof, Uint|float|null $uint, Ulong|float|null $ulong, Unchecked|float|null $unchecked, Undefined|float|null $undefined, UnionClass|float|null $union, UnmarshalJSON|float|null $unmarshalJSON, Unowned|float|null $unowned, Unsafe|float|null $unsafe, Unsigned|float|null $unsigned, UseSerializers|float|null $useSerializers, Ushort|float|null $ushort, Using|float|null $using, Utf8JSONReader|float|null $utf8JSONReader, Utf8JSONWriter|float|null $utf8JSONWriter, UUID|float|null $uuid, VarClass|float|null $var, Virtual|float|null $virtual, VoidClass|float|null $void, Volatile|float|null $volatile, WcharT|float|null $wcharT, Weak|float|null $weak, Where|float|null $where, WhileClass|float|null $while, WillSet|float|null $willSet, With|float|null $with, XorClass|float|null $xor, XorEq|float|null $xorEq, Yes|float|null $yes, YieldClass|float|null $yield) { | |
| 697 | 699 | $this->empty = $empty; |
| 698 | 700 | $this->topLevelBool = $topLevelBool; |
| 699 | 701 | $this->complex = $complex; |
| @@ -876,6 +878,7 @@ class TopLevel { | ||
| 876 | 878 | $this->locale = $locale; |
| 877 | 879 | $this->lock = $lock; |
| 878 | 880 | $this->long = $long; |
| 881 | + $this->makeDictEncoder = $makeDictEncoder; | |
| 879 | 882 | $this->map = $map; |
| 880 | 883 | $this->mapEntry = $mapEntry; |
| 881 | 884 | $this->marshalJSON = $marshalJSON; |
| @@ -14852,6 +14855,82 @@ class TopLevel { | ||
| 14852 | 14855 | return Long::sample(); /*212:long*/ |
| 14853 | 14856 | } |
| 14854 | 14857 | |
| 14858 | + /** | |
| 14859 | + * @param stdClass|float|null $value | |
| 14860 | + * @throws Exception | |
| 14861 | + * @return MakeDictEncoder|float|null | |
| 14862 | + */ | |
| 14863 | + public static function fromMakeDictEncoder(stdClass|float|null $value): MakeDictEncoder|float|null { | |
| 14864 | + if (is_null($value)) { | |
| 14865 | + return $value; /*null*/ | |
| 14866 | + } elseif (is_object($value)) { | |
| 14867 | + return MakeDictEncoder::from($value); /*class*/ | |
| 14868 | + } elseif (is_float($value) || is_int($value)) { | |
| 14869 | + return $value; /*float*/ | |
| 14870 | + } else { | |
| 14871 | + throw new Exception('Cannot deserialize union value in TopLevel'); | |
| 14872 | + } | |
| 14873 | + } | |
| 14874 | + | |
| 14875 | + /** | |
| 14876 | + * @throws Exception | |
| 14877 | + * @return stdClass|float|null | |
| 14878 | + */ | |
| 14879 | + public function toMakeDictEncoder(): stdClass|float|null { | |
| 14880 | + if (TopLevel::validateMakeDictEncoder($this->makeDictEncoder)) { | |
| 14881 | + if (is_null($this->makeDictEncoder)) { | |
| 14882 | + return $this->makeDictEncoder; /*null*/ | |
| 14883 | + } elseif ($this->makeDictEncoder instanceof MakeDictEncoder) { | |
| 14884 | + return $this->makeDictEncoder->to(); /*class*/ | |
| 14885 | + } elseif (is_float($this->makeDictEncoder) || is_int($this->makeDictEncoder)) { | |
| 14886 | + return $this->makeDictEncoder; /*float*/ | |
| 14887 | + } else { | |
| 14888 | + throw new Exception('Union value has no matching member in TopLevel'); | |
| 14889 | + } | |
| 14890 | + } | |
| 14891 | + throw new Exception('never get to this TopLevel::makeDictEncoder'); | |
| 14892 | + } | |
| 14893 | + | |
| 14894 | + /** | |
| 14895 | + * @param MakeDictEncoder|float|null | |
| 14896 | + * @return bool | |
| 14897 | + * @throws Exception | |
| 14898 | + */ | |
| 14899 | + public static function validateMakeDictEncoder(MakeDictEncoder|float|null $value): bool { | |
| 14900 | + if (is_null($value)) { | |
| 14901 | + if (!is_null($value)) { | |
| 14902 | + throw new Exception("Attribute Error:TopLevel::makeDictEncoder"); | |
| 14903 | + } | |
| 14904 | + } elseif ($value instanceof MakeDictEncoder) { | |
| 14905 | + $value->validate(); | |
| 14906 | + } elseif (is_float($value) || is_int($value)) { | |
| 14907 | + if (!is_float($value) && !is_int($value)) { | |
| 14908 | + throw new Exception("Attribute Error:TopLevel::makeDictEncoder"); | |
| 14909 | + } | |
| 14910 | + } else { | |
| 14911 | + throw new Exception("Attribute Error:TopLevel::makeDictEncoder"); | |
| 14912 | + } | |
| 14913 | + return true; | |
| 14914 | + } | |
| 14915 | + | |
| 14916 | + /** | |
| 14917 | + * @throws Exception | |
| 14918 | + * @return MakeDictEncoder|float|null | |
| 14919 | + */ | |
| 14920 | + public function getMakeDictEncoder(): MakeDictEncoder|float|null { | |
| 14921 | + if (TopLevel::validateMakeDictEncoder($this->makeDictEncoder)) { | |
| 14922 | + return $this->makeDictEncoder; | |
| 14923 | + } | |
| 14924 | + throw new Exception('never get to getMakeDictEncoder TopLevel::makeDictEncoder'); | |
| 14925 | + } | |
| 14926 | + | |
| 14927 | + /** | |
| 14928 | + * @return MakeDictEncoder|float|null | |
| 14929 | + */ | |
| 14930 | + public static function sampleMakeDictEncoder(): MakeDictEncoder|float|null { | |
| 14931 | + return MakeDictEncoder::sample(); /*213:makeDictEncoder*/ | |
| 14932 | + } | |
| 14933 | + | |
| 14855 | 14934 | /** |
| 14856 | 14935 | * @param stdClass|float|null $value |
| 14857 | 14936 | * @throws Exception |
| @@ -14925,7 +15004,7 @@ class TopLevel { | ||
| 14925 | 15004 | * @return Map|float|null |
| 14926 | 15005 | */ |
| 14927 | 15006 | public static function sampleMap(): Map|float|null { |
| 14928 | - return Map::sample(); /*213:map*/ | |
| 15007 | + return Map::sample(); /*214:map*/ | |
| 14929 | 15008 | } |
| 14930 | 15009 | |
| 14931 | 15010 | /** |
| @@ -15001,7 +15080,7 @@ class TopLevel { | ||
| 15001 | 15080 | * @return MapEntry|float|null |
| 15002 | 15081 | */ |
| 15003 | 15082 | public static function sampleMapEntry(): MapEntry|float|null { |
| 15004 | - return MapEntry::sample(); /*214:mapEntry*/ | |
| 15083 | + return MapEntry::sample(); /*215:mapEntry*/ | |
| 15005 | 15084 | } |
| 15006 | 15085 | |
| 15007 | 15086 | /** |
| @@ -15077,7 +15156,7 @@ class TopLevel { | ||
| 15077 | 15156 | * @return MarshalJSON|float|null |
| 15078 | 15157 | */ |
| 15079 | 15158 | public static function sampleMarshalJSON(): MarshalJSON|float|null { |
| 15080 | - return MarshalJSON::sample(); /*215:marshalJSON*/ | |
| 15159 | + return MarshalJSON::sample(); /*216:marshalJSON*/ | |
| 15081 | 15160 | } |
| 15082 | 15161 | |
| 15083 | 15162 | /** |
| @@ -15153,7 +15232,7 @@ class TopLevel { | ||
| 15153 | 15232 | * @return MetadataPropertyHandling|float|null |
| 15154 | 15233 | */ |
| 15155 | 15234 | public static function sampleMetadataPropertyHandling(): MetadataPropertyHandling|float|null { |
| 15156 | - return MetadataPropertyHandling::sample(); /*216:metadataPropertyHandling*/ | |
| 15235 | + return MetadataPropertyHandling::sample(); /*217:metadataPropertyHandling*/ | |
| 15157 | 15236 | } |
| 15158 | 15237 | |
| 15159 | 15238 | /** |
| @@ -15229,7 +15308,7 @@ class TopLevel { | ||
| 15229 | 15308 | * @return Module|float|null |
| 15230 | 15309 | */ |
| 15231 | 15310 | public static function sampleModule(): Module|float|null { |
| 15232 | - return Module::sample(); /*217:module*/ | |
| 15311 | + return Module::sample(); /*218:module*/ | |
| 15233 | 15312 | } |
| 15234 | 15313 | |
| 15235 | 15314 | /** |
| @@ -15305,7 +15384,7 @@ class TopLevel { | ||
| 15305 | 15384 | * @return Mutable|float|null |
| 15306 | 15385 | */ |
| 15307 | 15386 | public static function sampleMutable(): Mutable|float|null { |
| 15308 | - return Mutable::sample(); /*218:mutable*/ | |
| 15387 | + return Mutable::sample(); /*219:mutable*/ | |
| 15309 | 15388 | } |
| 15310 | 15389 | |
| 15311 | 15390 | /** |
| @@ -15381,7 +15460,7 @@ class TopLevel { | ||
| 15381 | 15460 | * @return Mutating|float|null |
| 15382 | 15461 | */ |
| 15383 | 15462 | public static function sampleMutating(): Mutating|float|null { |
| 15384 | - return Mutating::sample(); /*219:mutating*/ | |
| 15463 | + return Mutating::sample(); /*220:mutating*/ | |
| 15385 | 15464 | } |
| 15386 | 15465 | |
| 15387 | 15466 | /** |
| @@ -15457,7 +15536,7 @@ class TopLevel { | ||
| 15457 | 15536 | * @return NamespaceClass|float|null |
| 15458 | 15537 | */ |
| 15459 | 15538 | public static function sampleNamespace(): NamespaceClass|float|null { |
| 15460 | - return NamespaceClass::sample(); /*220:namespace*/ | |
| 15539 | + return NamespaceClass::sample(); /*221:namespace*/ | |
| 15461 | 15540 | } |
| 15462 | 15541 | |
| 15463 | 15542 | /** |
| @@ -15533,7 +15612,7 @@ class TopLevel { | ||
| 15533 | 15612 | * @return Native|float|null |
| 15534 | 15613 | */ |
| 15535 | 15614 | public static function sampleNative(): Native|float|null { |
| 15536 | - return Native::sample(); /*221:native*/ | |
| 15615 | + return Native::sample(); /*222:native*/ | |
| 15537 | 15616 | } |
| 15538 | 15617 | |
| 15539 | 15618 | /** |
| @@ -15609,7 +15688,7 @@ class TopLevel { | ||
| 15609 | 15688 | * @return NewClass|float|null |
| 15610 | 15689 | */ |
| 15611 | 15690 | public static function sampleNew(): NewClass|float|null { |
| 15612 | - return NewClass::sample(); /*222:new*/ | |
| 15691 | + return NewClass::sample(); /*223:new*/ | |
| 15613 | 15692 | } |
| 15614 | 15693 | |
| 15615 | 15694 | /** |
| @@ -15685,7 +15764,7 @@ class TopLevel { | ||
| 15685 | 15764 | * @return Newtonsoft|float|null |
| 15686 | 15765 | */ |
| 15687 | 15766 | public static function sampleNewtonsoft(): Newtonsoft|float|null { |
| 15688 | - return Newtonsoft::sample(); /*223:newtonsoft*/ | |
| 15767 | + return Newtonsoft::sample(); /*224:newtonsoft*/ | |
| 15689 | 15768 | } |
| 15690 | 15769 | |
| 15691 | 15770 | /** |
| @@ -15761,7 +15840,7 @@ class TopLevel { | ||
| 15761 | 15840 | * @return Nil|float|null |
| 15762 | 15841 | */ |
| 15763 | 15842 | public static function sampleNil(): Nil|float|null { |
| 15764 | - return Nil::sample(); /*224:nil*/ | |
| 15843 | + return Nil::sample(); /*225:nil*/ | |
| 15765 | 15844 | } |
| 15766 | 15845 | |
| 15767 | 15846 | /** |
| @@ -15837,7 +15916,7 @@ class TopLevel { | ||
| 15837 | 15916 | * @return No|float|null |
| 15838 | 15917 | */ |
| 15839 | 15918 | public static function sampleNo(): No|float|null { |
| 15840 | - return No::sample(); /*225:no*/ | |
| 15919 | + return No::sample(); /*226:no*/ | |
| 15841 | 15920 | } |
| 15842 | 15921 | |
| 15843 | 15922 | /** |
| @@ -15913,7 +15992,7 @@ class TopLevel { | ||
| 15913 | 15992 | * @return Noexcept|float|null |
| 15914 | 15993 | */ |
| 15915 | 15994 | public static function sampleNoexcept(): Noexcept|float|null { |
| 15916 | - return Noexcept::sample(); /*226:noexcept*/ | |
| 15995 | + return Noexcept::sample(); /*227:noexcept*/ | |
| 15917 | 15996 | } |
| 15918 | 15997 | |
| 15919 | 15998 | /** |
| @@ -15989,7 +16068,7 @@ class TopLevel { | ||
| 15989 | 16068 | * @return Nonatomic|float|null |
| 15990 | 16069 | */ |
| 15991 | 16070 | public static function sampleNonatomic(): Nonatomic|float|null { |
| 15992 | - return Nonatomic::sample(); /*227:nonatomic*/ | |
| 16071 | + return Nonatomic::sample(); /*228:nonatomic*/ | |
| 15993 | 16072 | } |
| 15994 | 16073 | |
| 15995 | 16074 | /** |
| @@ -16065,7 +16144,7 @@ class TopLevel { | ||
| 16065 | 16144 | * @return NoneClass|float|null |
| 16066 | 16145 | */ |
| 16067 | 16146 | public static function sampleTopLevelNone(): NoneClass|float|null { |
| 16068 | - return NoneClass::sample(); /*228:topLevelNone*/ | |
| 16147 | + return NoneClass::sample(); /*229:topLevelNone*/ | |
| 16069 | 16148 | } |
| 16070 | 16149 | |
| 16071 | 16150 | /** |
| @@ -16141,7 +16220,7 @@ class TopLevel { | ||
| 16141 | 16220 | * @return None|float|null |
| 16142 | 16221 | */ |
| 16143 | 16222 | public static function sampleNone(): None|float|null { |
| 16144 | - return None::sample(); /*229:none*/ | |
| 16223 | + return None::sample(); /*230:none*/ | |
| 16145 | 16224 | } |
| 16146 | 16225 | |
| 16147 | 16226 | /** |
| @@ -16217,7 +16296,7 @@ class TopLevel { | ||
| 16217 | 16296 | * @return Nonlocal|float|null |
| 16218 | 16297 | */ |
| 16219 | 16298 | public static function sampleNonlocal(): Nonlocal|float|null { |
| 16220 | - return Nonlocal::sample(); /*230:nonlocal*/ | |
| 16299 | + return Nonlocal::sample(); /*231:nonlocal*/ | |
| 16221 | 16300 | } |
| 16222 | 16301 | |
| 16223 | 16302 | /** |
| @@ -16293,7 +16372,7 @@ class TopLevel { | ||
| 16293 | 16372 | * @return Nonmutating|float|null |
| 16294 | 16373 | */ |
| 16295 | 16374 | public static function sampleNonmutating(): Nonmutating|float|null { |
| 16296 | - return Nonmutating::sample(); /*231:nonmutating*/ | |
| 16375 | + return Nonmutating::sample(); /*232:nonmutating*/ | |
| 16297 | 16376 | } |
| 16298 | 16377 | |
| 16299 | 16378 | /** |
| @@ -16369,7 +16448,7 @@ class TopLevel { | ||
| 16369 | 16448 | * @return NoSuchMethod|float|null |
| 16370 | 16449 | */ |
| 16371 | 16450 | public static function sampleNoSuchMethod(): NoSuchMethod|float|null { |
| 16372 | - return NoSuchMethod::sample(); /*232:noSuchMethod*/ | |
| 16451 | + return NoSuchMethod::sample(); /*233:noSuchMethod*/ | |
| 16373 | 16452 | } |
| 16374 | 16453 | |
| 16375 | 16454 | /** |
| @@ -16445,7 +16524,7 @@ class TopLevel { | ||
| 16445 | 16524 | * @return Not|float|null |
| 16446 | 16525 | */ |
| 16447 | 16526 | public static function sampleNot(): Not|float|null { |
| 16448 | - return Not::sample(); /*233:not*/ | |
| 16527 | + return Not::sample(); /*234:not*/ | |
| 16449 | 16528 | } |
| 16450 | 16529 | |
| 16451 | 16530 | /** |
| @@ -16521,7 +16600,7 @@ class TopLevel { | ||
| 16521 | 16600 | * @return NotEq|float|null |
| 16522 | 16601 | */ |
| 16523 | 16602 | public static function sampleNotEq(): NotEq|float|null { |
| 16524 | - return NotEq::sample(); /*234:notEq*/ | |
| 16603 | + return NotEq::sample(); /*235:notEq*/ | |
| 16525 | 16604 | } |
| 16526 | 16605 | |
| 16527 | 16606 | /** |
| @@ -16597,7 +16676,7 @@ class TopLevel { | ||
| 16597 | 16676 | * @return NSError|float|null |
| 16598 | 16677 | */ |
| 16599 | 16678 | public static function sampleNSError(): NSError|float|null { |
| 16600 | - return NSError::sample(); /*235:nsError*/ | |
| 16679 | + return NSError::sample(); /*236:nsError*/ | |
| 16601 | 16680 | } |
| 16602 | 16681 | |
| 16603 | 16682 | /** |
| @@ -16673,7 +16752,7 @@ class TopLevel { | ||
| 16673 | 16752 | * @return NSObject|float|null |
| 16674 | 16753 | */ |
| 16675 | 16754 | public static function sampleNSObject(): NSObject|float|null { |
| 16676 | - return NSObject::sample(); /*236:nsObject*/ | |
| 16755 | + return NSObject::sample(); /*237:nsObject*/ | |
| 16677 | 16756 | } |
| 16678 | 16757 | |
| 16679 | 16758 | /** |
| @@ -16749,7 +16828,7 @@ class TopLevel { | ||
| 16749 | 16828 | * @return NSString|float|null |
| 16750 | 16829 | */ |
| 16751 | 16830 | public static function sampleNSString(): NSString|float|null { |
| 16752 | - return NSString::sample(); /*237:nsString*/ | |
| 16831 | + return NSString::sample(); /*238:nsString*/ | |
| 16753 | 16832 | } |
| 16754 | 16833 | |
| 16755 | 16834 | /** |
| @@ -16825,7 +16904,7 @@ class TopLevel { | ||
| 16825 | 16904 | * @return NULLClass|float|null |
| 16826 | 16905 | */ |
| 16827 | 16906 | public static function sampleNull(): NULLClass|float|null { |
| 16828 | - return NULLClass::sample(); /*238:null*/ | |
| 16907 | + return NULLClass::sample(); /*239:null*/ | |
| 16829 | 16908 | } |
| 16830 | 16909 | |
| 16831 | 16910 | /** |
| @@ -16901,7 +16980,7 @@ class TopLevel { | ||
| 16901 | 16980 | * @return UnionNullNull|float|null |
| 16902 | 16981 | */ |
| 16903 | 16982 | public static function sampleTopLevelNull(): UnionNullNull|float|null { |
| 16904 | - return UnionNullNull::sample(); /*239:topLevelNull*/ | |
| 16983 | + return UnionNullNull::sample(); /*240:topLevelNull*/ | |
| 16905 | 16984 | } |
| 16906 | 16985 | |
| 16907 | 16986 | /** |
| @@ -16977,7 +17056,7 @@ class TopLevel { | ||
| 16977 | 17056 | * @return Nullptr|float|null |
| 16978 | 17057 | */ |
| 16979 | 17058 | public static function sampleNullptr(): Nullptr|float|null { |
| 16980 | - return Nullptr::sample(); /*240:nullptr*/ | |
| 17059 | + return Nullptr::sample(); /*241:nullptr*/ | |
| 16981 | 17060 | } |
| 16982 | 17061 | |
| 16983 | 17062 | /** |
| @@ -17053,7 +17132,7 @@ class TopLevel { | ||
| 17053 | 17132 | * @return Number|float|null |
| 17054 | 17133 | */ |
| 17055 | 17134 | public static function sampleNumber(): Number|float|null { |
| 17056 | - return Number::sample(); /*241:number*/ | |
| 17135 | + return Number::sample(); /*242:number*/ | |
| 17057 | 17136 | } |
| 17058 | 17137 | |
| 17059 | 17138 | /** |
| @@ -17129,7 +17208,7 @@ class TopLevel { | ||
| 17129 | 17208 | * @return ObjectClass|float|null |
| 17130 | 17209 | */ |
| 17131 | 17210 | public static function sampleObject(): ObjectClass|float|null { |
| 17132 | - return ObjectClass::sample(); /*242:object*/ | |
| 17211 | + return ObjectClass::sample(); /*243:object*/ | |
| 17133 | 17212 | } |
| 17134 | 17213 | |
| 17135 | 17214 | /** |
| @@ -17205,7 +17284,7 @@ class TopLevel { | ||
| 17205 | 17284 | * @return ObjectMapper|float|null |
| 17206 | 17285 | */ |
| 17207 | 17286 | public static function sampleObjectMapper(): ObjectMapper|float|null { |
| 17208 | - return ObjectMapper::sample(); /*243:objectMapper*/ | |
| 17287 | + return ObjectMapper::sample(); /*244:objectMapper*/ | |
| 17209 | 17288 | } |
| 17210 | 17289 | |
| 17211 | 17290 | /** |
| @@ -17281,7 +17360,7 @@ class TopLevel { | ||
| 17281 | 17360 | * @return Of|float|null |
| 17282 | 17361 | */ |
| 17283 | 17362 | public static function sampleOf(): Of|float|null { |
| 17284 | - return Of::sample(); /*244:of*/ | |
| 17363 | + return Of::sample(); /*245:of*/ | |
| 17285 | 17364 | } |
| 17286 | 17365 | |
| 17287 | 17366 | /** |
| @@ -17357,7 +17436,7 @@ class TopLevel { | ||
| 17357 | 17436 | * @return Oneway|float|null |
| 17358 | 17437 | */ |
| 17359 | 17438 | public static function sampleOneway(): Oneway|float|null { |
| 17360 | - return Oneway::sample(); /*245:oneway*/ | |
| 17439 | + return Oneway::sample(); /*246:oneway*/ | |
| 17361 | 17440 | } |
| 17362 | 17441 | |
| 17363 | 17442 | /** |
| @@ -17433,7 +17512,7 @@ class TopLevel { | ||
| 17433 | 17512 | * @return Open|float|null |
| 17434 | 17513 | */ |
| 17435 | 17514 | public static function sampleOpen(): Open|float|null { |
| 17436 | - return Open::sample(); /*246:open*/ | |
| 17515 | + return Open::sample(); /*247:open*/ | |
| 17437 | 17516 | } |
| 17438 | 17517 | |
| 17439 | 17518 | /** |
| @@ -17509,7 +17588,7 @@ class TopLevel { | ||
| 17509 | 17588 | * @return Operator|float|null |
| 17510 | 17589 | */ |
| 17511 | 17590 | public static function sampleOperator(): Operator|float|null { |
| 17512 | - return Operator::sample(); /*247:operator*/ | |
| 17591 | + return Operator::sample(); /*248:operator*/ | |
| 17513 | 17592 | } |
| 17514 | 17593 | |
| 17515 | 17594 | /** |
| @@ -17585,7 +17664,7 @@ class TopLevel { | ||
| 17585 | 17664 | * @return Optional|float|null |
| 17586 | 17665 | */ |
| 17587 | 17666 | public static function sampleOptional(): Optional|float|null { |
| 17588 | - return Optional::sample(); /*248:optional*/ | |
| 17667 | + return Optional::sample(); /*249:optional*/ | |
| 17589 | 17668 | } |
| 17590 | 17669 | |
| 17591 | 17670 | /** |
| @@ -17661,7 +17740,7 @@ class TopLevel { | ||
| 17661 | 17740 | * @return OrClass|float|null |
| 17662 | 17741 | */ |
| 17663 | 17742 | public static function sampleOr(): OrClass|float|null { |
| 17664 | - return OrClass::sample(); /*249:or*/ | |
| 17743 | + return OrClass::sample(); /*250:or*/ | |
| 17665 | 17744 | } |
| 17666 | 17745 | |
| 17667 | 17746 | /** |
| @@ -17737,7 +17816,7 @@ class TopLevel { | ||
| 17737 | 17816 | * @return OrEq|float|null |
| 17738 | 17817 | */ |
| 17739 | 17818 | public static function sampleOrEq(): OrEq|float|null { |
| 17740 | - return OrEq::sample(); /*250:orEq*/ | |
| 17819 | + return OrEq::sample(); /*251:orEq*/ | |
| 17741 | 17820 | } |
| 17742 | 17821 | |
| 17743 | 17822 | /** |
| @@ -17813,7 +17892,7 @@ class TopLevel { | ||
| 17813 | 17892 | * @return Out|float|null |
| 17814 | 17893 | */ |
| 17815 | 17894 | public static function sampleOut(): Out|float|null { |
| 17816 | - return Out::sample(); /*251:out*/ | |
| 17895 | + return Out::sample(); /*252:out*/ | |
| 17817 | 17896 | } |
| 17818 | 17897 | |
| 17819 | 17898 | /** |
| @@ -17889,7 +17968,7 @@ class TopLevel { | ||
| 17889 | 17968 | * @return OverrideClass|float|null |
| 17890 | 17969 | */ |
| 17891 | 17970 | public static function sampleOverride(): OverrideClass|float|null { |
| 17892 | - return OverrideClass::sample(); /*252:override*/ | |
| 17971 | + return OverrideClass::sample(); /*253:override*/ | |
| 17893 | 17972 | } |
| 17894 | 17973 | |
| 17895 | 17974 | /** |
| @@ -17965,7 +18044,7 @@ class TopLevel { | ||
| 17965 | 18044 | * @return Package|float|null |
| 17966 | 18045 | */ |
| 17967 | 18046 | public static function samplePackage(): Package|float|null { |
| 17968 | - return Package::sample(); /*253:package*/ | |
| 18047 | + return Package::sample(); /*254:package*/ | |
| 17969 | 18048 | } |
| 17970 | 18049 | |
| 17971 | 18050 | /** |
| @@ -18041,7 +18120,7 @@ class TopLevel { | ||
| 18041 | 18120 | * @return Params|float|null |
| 18042 | 18121 | */ |
| 18043 | 18122 | public static function sampleParams(): Params|float|null { |
| 18044 | - return Params::sample(); /*254:params*/ | |
| 18123 | + return Params::sample(); /*255:params*/ | |
| 18045 | 18124 | } |
| 18046 | 18125 | |
| 18047 | 18126 | /** |
| @@ -18117,7 +18196,7 @@ class TopLevel { | ||
| 18117 | 18196 | * @return Pass|float|null |
| 18118 | 18197 | */ |
| 18119 | 18198 | public static function samplePass(): Pass|float|null { |
| 18120 | - return Pass::sample(); /*255:pass*/ | |
| 18199 | + return Pass::sample(); /*256:pass*/ | |
| 18121 | 18200 | } |
| 18122 | 18201 | |
| 18123 | 18202 | /** |
| @@ -18193,7 +18272,7 @@ class TopLevel { | ||
| 18193 | 18272 | * @return Port|float|null |
| 18194 | 18273 | */ |
| 18195 | 18274 | public static function samplePort(): Port|float|null { |
| 18196 | - return Port::sample(); /*256:port*/ | |
| 18275 | + return Port::sample(); /*257:port*/ | |
| 18197 | 18276 | } |
| 18198 | 18277 | |
| 18199 | 18278 | /** |
| @@ -18269,7 +18348,7 @@ class TopLevel { | ||
| 18269 | 18348 | * @return Postfix|float|null |
| 18270 | 18349 | */ |
| 18271 | 18350 | public static function samplePostfix(): Postfix|float|null { |
| 18272 | - return Postfix::sample(); /*257:postfix*/ | |
| 18351 | + return Postfix::sample(); /*258:postfix*/ | |
| 18273 | 18352 | } |
| 18274 | 18353 | |
| 18275 | 18354 | /** |
| @@ -18345,7 +18424,7 @@ class TopLevel { | ||
| 18345 | 18424 | * @return Precedence|float|null |
| 18346 | 18425 | */ |
| 18347 | 18426 | public static function samplePrecedence(): Precedence|float|null { |
| 18348 | - return Precedence::sample(); /*258:precedence*/ | |
| 18427 | + return Precedence::sample(); /*259:precedence*/ | |
| 18349 | 18428 | } |
| 18350 | 18429 | |
| 18351 | 18430 | /** |
| @@ -18421,7 +18500,7 @@ class TopLevel { | ||
| 18421 | 18500 | * @return Prefix|float|null |
| 18422 | 18501 | */ |
| 18423 | 18502 | public static function samplePrefix(): Prefix|float|null { |
| 18424 | - return Prefix::sample(); /*259:prefix*/ | |
| 18503 | + return Prefix::sample(); /*260:prefix*/ | |
| 18425 | 18504 | } |
| 18426 | 18505 | |
| 18427 | 18506 | /** |
| @@ -18497,7 +18576,7 @@ class TopLevel { | ||
| 18497 | 18576 | * @return PrimitiveKind|float|null |
| 18498 | 18577 | */ |
| 18499 | 18578 | public static function samplePrimitiveKind(): PrimitiveKind|float|null { |
| 18500 | - return PrimitiveKind::sample(); /*260:primitiveKind*/ | |
| 18579 | + return PrimitiveKind::sample(); /*261:primitiveKind*/ | |
| 18501 | 18580 | } |
| 18502 | 18581 | |
| 18503 | 18582 | /** |
| @@ -18573,7 +18652,7 @@ class TopLevel { | ||
| 18573 | 18652 | * @return PrintClass|float|null |
| 18574 | 18653 | */ |
| 18575 | 18654 | public static function samplePrint(): PrintClass|float|null { |
| 18576 | - return PrintClass::sample(); /*261:print*/ | |
| 18655 | + return PrintClass::sample(); /*262:print*/ | |
| 18577 | 18656 | } |
| 18578 | 18657 | |
| 18579 | 18658 | /** |
| @@ -18649,7 +18728,7 @@ class TopLevel { | ||
| 18649 | 18728 | * @return Printf|float|null |
| 18650 | 18729 | */ |
| 18651 | 18730 | public static function samplePrintf(): Printf|float|null { |
| 18652 | - return Printf::sample(); /*262:printf*/ | |
| 18731 | + return Printf::sample(); /*263:printf*/ | |
| 18653 | 18732 | } |
| 18654 | 18733 | |
| 18655 | 18734 | /** |
| @@ -18725,7 +18804,7 @@ class TopLevel { | ||
| 18725 | 18804 | * @return PrintMembers|float|null |
| 18726 | 18805 | */ |
| 18727 | 18806 | public static function samplePrintMembers(): PrintMembers|float|null { |
| 18728 | - return PrintMembers::sample(); /*263:printMembers*/ | |
| 18807 | + return PrintMembers::sample(); /*264:printMembers*/ | |
| 18729 | 18808 | } |
| 18730 | 18809 | |
| 18731 | 18810 | /** |
| @@ -18801,7 +18880,7 @@ class TopLevel { | ||
| 18801 | 18880 | * @return PrivateClass|float|null |
| 18802 | 18881 | */ |
| 18803 | 18882 | public static function samplePrivate(): PrivateClass|float|null { |
| 18804 | - return PrivateClass::sample(); /*264:private*/ | |
| 18883 | + return PrivateClass::sample(); /*265:private*/ | |
| 18805 | 18884 | } |
| 18806 | 18885 | |
| 18807 | 18886 | /** |
| @@ -18877,7 +18956,7 @@ class TopLevel { | ||
| 18877 | 18956 | * @return ProtectedClass|float|null |
| 18878 | 18957 | */ |
| 18879 | 18958 | public static function sampleProtected(): ProtectedClass|float|null { |
| 18880 | - return ProtectedClass::sample(); /*265:protected*/ | |
| 18959 | + return ProtectedClass::sample(); /*266:protected*/ | |
| 18881 | 18960 | } |
| 18882 | 18961 | |
| 18883 | 18962 | /** |
| @@ -18953,7 +19032,7 @@ class TopLevel { | ||
| 18953 | 19032 | * @return Protocol|float|null |
| 18954 | 19033 | */ |
| 18955 | 19034 | public static function sampleProtocol(): Protocol|float|null { |
| 18956 | - return Protocol::sample(); /*266:protocol*/ | |
| 19035 | + return Protocol::sample(); /*267:protocol*/ | |
| 18957 | 19036 | } |
| 18958 | 19037 | |
| 18959 | 19038 | /** |
| @@ -19029,7 +19108,7 @@ class TopLevel { | ||
| 19029 | 19108 | * @return ProtocolClass|float|null |
| 19030 | 19109 | */ |
| 19031 | 19110 | public static function sampleTopLevelProtocol(): ProtocolClass|float|null { |
| 19032 | - return ProtocolClass::sample(); /*267:topLevelProtocol*/ | |
| 19111 | + return ProtocolClass::sample(); /*268:topLevelProtocol*/ | |
| 19033 | 19112 | } |
| 19034 | 19113 | |
| 19035 | 19114 | /** |
| @@ -19105,7 +19184,7 @@ class TopLevel { | ||
| 19105 | 19184 | * @return PublicClass|float|null |
| 19106 | 19185 | */ |
| 19107 | 19186 | public static function samplePublic(): PublicClass|float|null { |
| 19108 | - return PublicClass::sample(); /*268:public*/ | |
| 19187 | + return PublicClass::sample(); /*269:public*/ | |
| 19109 | 19188 | } |
| 19110 | 19189 | |
| 19111 | 19190 | /** |
| @@ -19181,7 +19260,7 @@ class TopLevel { | ||
| 19181 | 19260 | * @return Quicktype|float|null |
| 19182 | 19261 | */ |
| 19183 | 19262 | public static function sampleQuicktype(): Quicktype|float|null { |
| 19184 | - return Quicktype::sample(); /*269:quicktype*/ | |
| 19263 | + return Quicktype::sample(); /*270:quicktype*/ | |
| 19185 | 19264 | } |
| 19186 | 19265 | |
| 19187 | 19266 | /** |
| @@ -19257,7 +19336,7 @@ class TopLevel { | ||
| 19257 | 19336 | * @return Raise|float|null |
| 19258 | 19337 | */ |
| 19259 | 19338 | public static function sampleRaise(): Raise|float|null { |
| 19260 | - return Raise::sample(); /*270:raise*/ | |
| 19339 | + return Raise::sample(); /*271:raise*/ | |
| 19261 | 19340 | } |
| 19262 | 19341 | |
| 19263 | 19342 | /** |
| @@ -19333,7 +19412,7 @@ class TopLevel { | ||
| 19333 | 19412 | * @return Range|float|null |
| 19334 | 19413 | */ |
| 19335 | 19414 | public static function sampleRange(): Range|float|null { |
| 19336 | - return Range::sample(); /*271:range*/ | |
| 19415 | + return Range::sample(); /*272:range*/ | |
| 19337 | 19416 | } |
| 19338 | 19417 | |
| 19339 | 19418 | /** |
| @@ -19409,7 +19488,7 @@ class TopLevel { | ||
| 19409 | 19488 | * @return ReadonlyClass|float|null |
| 19410 | 19489 | */ |
| 19411 | 19490 | public static function sampleReadonly(): ReadonlyClass|float|null { |
| 19412 | - return ReadonlyClass::sample(); /*272:readonly*/ | |
| 19491 | + return ReadonlyClass::sample(); /*273:readonly*/ | |
| 19413 | 19492 | } |
| 19414 | 19493 | |
| 19415 | 19494 | /** |
| @@ -19485,7 +19564,7 @@ class TopLevel { | ||
| 19485 | 19564 | * @return Ref|float|null |
| 19486 | 19565 | */ |
| 19487 | 19566 | public static function sampleRef(): Ref|float|null { |
| 19488 | - return Ref::sample(); /*273:ref*/ | |
| 19567 | + return Ref::sample(); /*274:ref*/ | |
| 19489 | 19568 | } |
| 19490 | 19569 | |
| 19491 | 19570 | /** |
| @@ -19561,7 +19640,7 @@ class TopLevel { | ||
| 19561 | 19640 | * @return RegExp|float|null |
| 19562 | 19641 | */ |
| 19563 | 19642 | public static function sampleRegExp(): RegExp|float|null { |
| 19564 | - return RegExp::sample(); /*274:regExp*/ | |
| 19643 | + return RegExp::sample(); /*275:regExp*/ | |
| 19565 | 19644 | } |
| 19566 | 19645 | |
| 19567 | 19646 | /** |
| @@ -19637,7 +19716,7 @@ class TopLevel { | ||
| 19637 | 19716 | * @return Register|float|null |
| 19638 | 19717 | */ |
| 19639 | 19718 | public static function sampleRegister(): Register|float|null { |
| 19640 | - return Register::sample(); /*275:register*/ | |
| 19719 | + return Register::sample(); /*276:register*/ | |
| 19641 | 19720 | } |
| 19642 | 19721 | |
| 19643 | 19722 | /** |
| @@ -19713,7 +19792,7 @@ class TopLevel { | ||
| 19713 | 19792 | * @return ReinterpretCast|float|null |
| 19714 | 19793 | */ |
| 19715 | 19794 | public static function sampleReinterpretCast(): ReinterpretCast|float|null { |
| 19716 | - return ReinterpretCast::sample(); /*276:reinterpretCast*/ | |
| 19795 | + return ReinterpretCast::sample(); /*277:reinterpretCast*/ | |
| 19717 | 19796 | } |
| 19718 | 19797 | |
| 19719 | 19798 | /** |
| @@ -19789,7 +19868,7 @@ class TopLevel { | ||
| 19789 | 19868 | * @return Repeat|float|null |
| 19790 | 19869 | */ |
| 19791 | 19870 | public static function sampleRepeat(): Repeat|float|null { |
| 19792 | - return Repeat::sample(); /*277:repeat*/ | |
| 19871 | + return Repeat::sample(); /*278:repeat*/ | |
| 19793 | 19872 | } |
| 19794 | 19873 | |
| 19795 | 19874 | /** |
| @@ -19865,7 +19944,7 @@ class TopLevel { | ||
| 19865 | 19944 | * @return RequireClass|float|null |
| 19866 | 19945 | */ |
| 19867 | 19946 | public static function sampleRequire(): RequireClass|float|null { |
| 19868 | - return RequireClass::sample(); /*278:require*/ | |
| 19947 | + return RequireClass::sample(); /*279:require*/ | |
| 19869 | 19948 | } |
| 19870 | 19949 | |
| 19871 | 19950 | /** |
| @@ -19941,7 +20020,7 @@ class TopLevel { | ||
| 19941 | 20020 | * @return Required|float|null |
| 19942 | 20021 | */ |
| 19943 | 20022 | public static function sampleRequired(): Required|float|null { |
| 19944 | - return Required::sample(); /*279:required*/ | |
| 20023 | + return Required::sample(); /*280:required*/ | |
| 19945 | 20024 | } |
| 19946 | 20025 | |
| 19947 | 20026 | /** |
| @@ -20017,7 +20096,7 @@ class TopLevel { | ||
| 20017 | 20096 | * @return Requires|float|null |
| 20018 | 20097 | */ |
| 20019 | 20098 | public static function sampleRequires(): Requires|float|null { |
| 20020 | - return Requires::sample(); /*280:requires*/ | |
| 20099 | + return Requires::sample(); /*281:requires*/ | |
| 20021 | 20100 | } |
| 20022 | 20101 | |
| 20023 | 20102 | /** |
| @@ -20093,7 +20172,7 @@ class TopLevel { | ||
| 20093 | 20172 | * @return Restrict|float|null |
| 20094 | 20173 | */ |
| 20095 | 20174 | public static function sampleRestrict(): Restrict|float|null { |
| 20096 | - return Restrict::sample(); /*281:restrict*/ | |
| 20175 | + return Restrict::sample(); /*282:restrict*/ | |
| 20097 | 20176 | } |
| 20098 | 20177 | |
| 20099 | 20178 | /** |
| @@ -20169,7 +20248,7 @@ class TopLevel { | ||
| 20169 | 20248 | * @return Retain|float|null |
| 20170 | 20249 | */ |
| 20171 | 20250 | public static function sampleRetain(): Retain|float|null { |
| 20172 | - return Retain::sample(); /*282:retain*/ | |
| 20251 | + return Retain::sample(); /*283:retain*/ | |
| 20173 | 20252 | } |
| 20174 | 20253 | |
| 20175 | 20254 | /** |
| @@ -20245,7 +20324,7 @@ class TopLevel { | ||
| 20245 | 20324 | * @return Rethrows|float|null |
| 20246 | 20325 | */ |
| 20247 | 20326 | public static function sampleRethrows(): Rethrows|float|null { |
| 20248 | - return Rethrows::sample(); /*283:rethrows*/ | |
| 20327 | + return Rethrows::sample(); /*284:rethrows*/ | |
| 20249 | 20328 | } |
| 20250 | 20329 | |
| 20251 | 20330 | /** |
| @@ -20321,7 +20400,7 @@ class TopLevel { | ||
| 20321 | 20400 | * @return ReturnClass|float|null |
| 20322 | 20401 | */ |
| 20323 | 20402 | public static function sampleReturn(): ReturnClass|float|null { |
| 20324 | - return ReturnClass::sample(); /*284:return*/ | |
| 20403 | + return ReturnClass::sample(); /*285:return*/ | |
| 20325 | 20404 | } |
| 20326 | 20405 | |
| 20327 | 20406 | /** |
| @@ -20397,7 +20476,7 @@ class TopLevel { | ||
| 20397 | 20476 | * @return Right|float|null |
| 20398 | 20477 | */ |
| 20399 | 20478 | public static function sampleRight(): Right|float|null { |
| 20400 | - return Right::sample(); /*285:right*/ | |
| 20479 | + return Right::sample(); /*286:right*/ | |
| 20401 | 20480 | } |
| 20402 | 20481 | |
| 20403 | 20482 | /** |
| @@ -20473,7 +20552,7 @@ class TopLevel { | ||
| 20473 | 20552 | * @return RuntimeType|float|null |
| 20474 | 20553 | */ |
| 20475 | 20554 | public static function sampleRuntimeType(): RuntimeType|float|null { |
| 20476 | - return RuntimeType::sample(); /*286:runtimeType*/ | |
| 20555 | + return RuntimeType::sample(); /*287:runtimeType*/ | |
| 20477 | 20556 | } |
| 20478 | 20557 | |
| 20479 | 20558 | /** |
| @@ -20549,7 +20628,7 @@ class TopLevel { | ||
| 20549 | 20628 | * @return S|float|null |
| 20550 | 20629 | */ |
| 20551 | 20630 | public static function sampleS(): S|float|null { |
| 20552 | - return S::sample(); /*287:s*/ | |
| 20631 | + return S::sample(); /*288:s*/ | |
| 20553 | 20632 | } |
| 20554 | 20633 | |
| 20555 | 20634 | /** |
| @@ -20625,7 +20704,7 @@ class TopLevel { | ||
| 20625 | 20704 | * @return Sbyte|float|null |
| 20626 | 20705 | */ |
| 20627 | 20706 | public static function sampleSbyte(): Sbyte|float|null { |
| 20628 | - return Sbyte::sample(); /*288:sbyte*/ | |
| 20707 | + return Sbyte::sample(); /*289:sbyte*/ | |
| 20629 | 20708 | } |
| 20630 | 20709 | |
| 20631 | 20710 | /** |
| @@ -20701,7 +20780,7 @@ class TopLevel { | ||
| 20701 | 20780 | * @return Sealed|float|null |
| 20702 | 20781 | */ |
| 20703 | 20782 | public static function sampleSealed(): Sealed|float|null { |
| 20704 | - return Sealed::sample(); /*289:sealed*/ | |
| 20783 | + return Sealed::sample(); /*290:sealed*/ | |
| 20705 | 20784 | } |
| 20706 | 20785 | |
| 20707 | 20786 | /** |
| @@ -20777,7 +20856,7 @@ class TopLevel { | ||
| 20777 | 20856 | * @return Sel|float|null |
| 20778 | 20857 | */ |
| 20779 | 20858 | public static function sampleSel(): Sel|float|null { |
| 20780 | - return Sel::sample(); /*290:sel*/ | |
| 20859 | + return Sel::sample(); /*291:sel*/ | |
| 20781 | 20860 | } |
| 20782 | 20861 | |
| 20783 | 20862 | /** |
| @@ -20853,7 +20932,7 @@ class TopLevel { | ||
| 20853 | 20932 | * @return Select|float|null |
| 20854 | 20933 | */ |
| 20855 | 20934 | public static function sampleSelect(): Select|float|null { |
| 20856 | - return Select::sample(); /*291:select*/ | |
| 20935 | + return Select::sample(); /*292:select*/ | |
| 20857 | 20936 | } |
| 20858 | 20937 | |
| 20859 | 20938 | /** |
| @@ -20929,7 +21008,7 @@ class TopLevel { | ||
| 20929 | 21008 | * @return SelfClass|float|null |
| 20930 | 21009 | */ |
| 20931 | 21010 | public static function sampleSelf(): SelfClass|float|null { |
| 20932 | - return SelfClass::sample(); /*292:self*/ | |
| 21011 | + return SelfClass::sample(); /*293:self*/ | |
| 20933 | 21012 | } |
| 20934 | 21013 | |
| 20935 | 21014 | /** |
| @@ -21005,7 +21084,7 @@ class TopLevel { | ||
| 21005 | 21084 | * @return UnionSelfSelf|float|null |
| 21006 | 21085 | */ |
| 21007 | 21086 | public static function sampleTopLevelSelf(): UnionSelfSelf|float|null { |
| 21008 | - return UnionSelfSelf::sample(); /*293:topLevelSelf*/ | |
| 21087 | + return UnionSelfSelf::sample(); /*294:topLevelSelf*/ | |
| 21009 | 21088 | } |
| 21010 | 21089 | |
| 21011 | 21090 | /** |
| @@ -21081,7 +21160,7 @@ class TopLevel { | ||
| 21081 | 21160 | * @return Sendable|float|null |
| 21082 | 21161 | */ |
| 21083 | 21162 | public static function sampleSendable(): Sendable|float|null { |
| 21084 | - return Sendable::sample(); /*294:sendable*/ | |
| 21163 | + return Sendable::sample(); /*295:sendable*/ | |
| 21085 | 21164 | } |
| 21086 | 21165 | |
| 21087 | 21166 | /** |
| @@ -21157,7 +21236,7 @@ class TopLevel { | ||
| 21157 | 21236 | * @return SerialDescriptor|float|null |
| 21158 | 21237 | */ |
| 21159 | 21238 | public static function sampleSerialDescriptor(): SerialDescriptor|float|null { |
| 21160 | - return SerialDescriptor::sample(); /*295:serialDescriptor*/ | |
| 21239 | + return SerialDescriptor::sample(); /*296:serialDescriptor*/ | |
| 21161 | 21240 | } |
| 21162 | 21241 | |
| 21163 | 21242 | /** |
| @@ -21233,7 +21312,7 @@ class TopLevel { | ||
| 21233 | 21312 | * @return SerializableClass|float|null |
| 21234 | 21313 | */ |
| 21235 | 21314 | public static function sampleSerializable(): SerializableClass|float|null { |
| 21236 | - return SerializableClass::sample(); /*296:serializable*/ | |
| 21315 | + return SerializableClass::sample(); /*297:serializable*/ | |
| 21237 | 21316 | } |
| 21238 | 21317 | |
| 21239 | 21318 | /** |
| @@ -21309,7 +21388,7 @@ class TopLevel { | ||
| 21309 | 21388 | * @return Serialize|float|null |
| 21310 | 21389 | */ |
| 21311 | 21390 | public static function sampleSerialize(): Serialize|float|null { |
| 21312 | - return Serialize::sample(); /*297:serialize*/ | |
| 21391 | + return Serialize::sample(); /*298:serialize*/ | |
| 21313 | 21392 | } |
| 21314 | 21393 | |
| 21315 | 21394 | /** |
| @@ -21385,7 +21464,7 @@ class TopLevel { | ||
| 21385 | 21464 | * @return SerializerProvider|float|null |
| 21386 | 21465 | */ |
| 21387 | 21466 | public static function sampleSerializerProvider(): SerializerProvider|float|null { |
| 21388 | - return SerializerProvider::sample(); /*298:serializerProvider*/ | |
| 21467 | + return SerializerProvider::sample(); /*299:serializerProvider*/ | |
| 21389 | 21468 | } |
| 21390 | 21469 | |
| 21391 | 21470 | /** |
| @@ -21461,7 +21540,7 @@ class TopLevel { | ||
| 21461 | 21540 | * @return SerialName|float|null |
| 21462 | 21541 | */ |
| 21463 | 21542 | public static function sampleSerialName(): SerialName|float|null { |
| 21464 | - return SerialName::sample(); /*299:serialName*/ | |
| 21543 | + return SerialName::sample(); /*300:serialName*/ | |
| 21465 | 21544 | } |
| 21466 | 21545 | |
| 21467 | 21546 | /** |
| @@ -21537,7 +21616,7 @@ class TopLevel { | ||
| 21537 | 21616 | * @return Set|float|null |
| 21538 | 21617 | */ |
| 21539 | 21618 | public static function sampleSet(): Set|float|null { |
| 21540 | - return Set::sample(); /*300:set*/ | |
| 21619 | + return Set::sample(); /*301:set*/ | |
| 21541 | 21620 | } |
| 21542 | 21621 | |
| 21543 | 21622 | /** |
| @@ -21613,7 +21692,7 @@ class TopLevel { | ||
| 21613 | 21692 | * @return Short|float|null |
| 21614 | 21693 | */ |
| 21615 | 21694 | public static function sampleShort(): Short|float|null { |
| 21616 | - return Short::sample(); /*301:short*/ | |
| 21695 | + return Short::sample(); /*302:short*/ | |
| 21617 | 21696 | } |
| 21618 | 21697 | |
| 21619 | 21698 | /** |
| @@ -21689,7 +21768,7 @@ class TopLevel { | ||
| 21689 | 21768 | * @return Signed|float|null |
| 21690 | 21769 | */ |
| 21691 | 21770 | public static function sampleSigned(): Signed|float|null { |
| 21692 | - return Signed::sample(); /*302:signed*/ | |
| 21771 | + return Signed::sample(); /*303:signed*/ | |
| 21693 | 21772 | } |
| 21694 | 21773 | |
| 21695 | 21774 | /** |
| @@ -21765,7 +21844,7 @@ class TopLevel { | ||
| 21765 | 21844 | * @return SimpleModule|float|null |
| 21766 | 21845 | */ |
| 21767 | 21846 | public static function sampleSimpleModule(): SimpleModule|float|null { |
| 21768 | - return SimpleModule::sample(); /*303:simpleModule*/ | |
| 21847 | + return SimpleModule::sample(); /*304:simpleModule*/ | |
| 21769 | 21848 | } |
| 21770 | 21849 | |
| 21771 | 21850 | /** |
| @@ -21841,7 +21920,7 @@ class TopLevel { | ||
| 21841 | 21920 | * @return Sizeof|float|null |
| 21842 | 21921 | */ |
| 21843 | 21922 | public static function sampleSizeof(): Sizeof|float|null { |
| 21844 | - return Sizeof::sample(); /*304:sizeof*/ | |
| 21923 | + return Sizeof::sample(); /*305:sizeof*/ | |
| 21845 | 21924 | } |
| 21846 | 21925 | |
| 21847 | 21926 | /** |
| @@ -21917,7 +21996,7 @@ class TopLevel { | ||
| 21917 | 21996 | * @return Stackalloc|float|null |
| 21918 | 21997 | */ |
| 21919 | 21998 | public static function sampleStackalloc(): Stackalloc|float|null { |
| 21920 | - return Stackalloc::sample(); /*305:stackalloc*/ | |
| 21999 | + return Stackalloc::sample(); /*306:stackalloc*/ | |
| 21921 | 22000 | } |
| 21922 | 22001 | |
| 21923 | 22002 | /** |
| @@ -21993,7 +22072,7 @@ class TopLevel { | ||
| 21993 | 22072 | * @return Standards|float|null |
| 21994 | 22073 | */ |
| 21995 | 22074 | public static function sampleStandards(): Standards|float|null { |
| 21996 | - return Standards::sample(); /*306:standards*/ | |
| 22075 | + return Standards::sample(); /*307:standards*/ | |
| 21997 | 22076 | } |
| 21998 | 22077 | |
| 21999 | 22078 | /** |
| @@ -22069,7 +22148,7 @@ class TopLevel { | ||
| 22069 | 22148 | * @return StaticClass|float|null |
| 22070 | 22149 | */ |
| 22071 | 22150 | public static function sampleStatic(): StaticClass|float|null { |
| 22072 | - return StaticClass::sample(); /*307:static*/ | |
| 22151 | + return StaticClass::sample(); /*308:static*/ | |
| 22073 | 22152 | } |
| 22074 | 22153 | |
| 22075 | 22154 | /** |
| @@ -22145,7 +22224,7 @@ class TopLevel { | ||
| 22145 | 22224 | * @return StaticAssert|float|null |
| 22146 | 22225 | */ |
| 22147 | 22226 | public static function sampleStaticAssert(): StaticAssert|float|null { |
| 22148 | - return StaticAssert::sample(); /*308:staticAssert*/ | |
| 22227 | + return StaticAssert::sample(); /*309:staticAssert*/ | |
| 22149 | 22228 | } |
| 22150 | 22229 | |
| 22151 | 22230 | /** |
| @@ -22221,7 +22300,7 @@ class TopLevel { | ||
| 22221 | 22300 | * @return StaticCast|float|null |
| 22222 | 22301 | */ |
| 22223 | 22302 | public static function sampleStaticCast(): StaticCast|float|null { |
| 22224 | - return StaticCast::sample(); /*309:staticCast*/ | |
| 22303 | + return StaticCast::sample(); /*310:staticCast*/ | |
| 22225 | 22304 | } |
| 22226 | 22305 | |
| 22227 | 22306 | /** |
| @@ -22297,7 +22376,7 @@ class TopLevel { | ||
| 22297 | 22376 | * @return StdDeserializer|float|null |
| 22298 | 22377 | */ |
| 22299 | 22378 | public static function sampleStdDeserializer(): StdDeserializer|float|null { |
| 22300 | - return StdDeserializer::sample(); /*310:stdDeserializer*/ | |
| 22379 | + return StdDeserializer::sample(); /*311:stdDeserializer*/ | |
| 22301 | 22380 | } |
| 22302 | 22381 | |
| 22303 | 22382 | /** |
| @@ -22373,7 +22452,7 @@ class TopLevel { | ||
| 22373 | 22452 | * @return StdSerializer|float|null |
| 22374 | 22453 | */ |
| 22375 | 22454 | public static function sampleStdSerializer(): StdSerializer|float|null { |
| 22376 | - return StdSerializer::sample(); /*311:stdSerializer*/ | |
| 22455 | + return StdSerializer::sample(); /*312:stdSerializer*/ | |
| 22377 | 22456 | } |
| 22378 | 22457 | |
| 22379 | 22458 | /** |
| @@ -22449,7 +22528,7 @@ class TopLevel { | ||
| 22449 | 22528 | * @return Strictfp|float|null |
| 22450 | 22529 | */ |
| 22451 | 22530 | public static function sampleStrictfp(): Strictfp|float|null { |
| 22452 | - return Strictfp::sample(); /*312:strictfp*/ | |
| 22531 | + return Strictfp::sample(); /*313:strictfp*/ | |
| 22453 | 22532 | } |
| 22454 | 22533 | |
| 22455 | 22534 | /** |
| @@ -22525,7 +22604,7 @@ class TopLevel { | ||
| 22525 | 22604 | * @return StringClass|float|null |
| 22526 | 22605 | */ |
| 22527 | 22606 | public static function sampleString(): StringClass|float|null { |
| 22528 | - return StringClass::sample(); /*313:string*/ | |
| 22607 | + return StringClass::sample(); /*314:string*/ | |
| 22529 | 22608 | } |
| 22530 | 22609 | |
| 22531 | 22610 | /** |
| @@ -22601,7 +22680,7 @@ class TopLevel { | ||
| 22601 | 22680 | * @return Struct|float|null |
| 22602 | 22681 | */ |
| 22603 | 22682 | public static function sampleStruct(): Struct|float|null { |
| 22604 | - return Struct::sample(); /*314:struct*/ | |
| 22683 | + return Struct::sample(); /*315:struct*/ | |
| 22605 | 22684 | } |
| 22606 | 22685 | |
| 22607 | 22686 | /** |
| @@ -22677,7 +22756,7 @@ class TopLevel { | ||
| 22677 | 22756 | * @return Subscript|float|null |
| 22678 | 22757 | */ |
| 22679 | 22758 | public static function sampleSubscript(): Subscript|float|null { |
| 22680 | - return Subscript::sample(); /*315:subscript*/ | |
| 22759 | + return Subscript::sample(); /*316:subscript*/ | |
| 22681 | 22760 | } |
| 22682 | 22761 | |
| 22683 | 22762 | /** |
| @@ -22753,7 +22832,7 @@ class TopLevel { | ||
| 22753 | 22832 | * @return Super|float|null |
| 22754 | 22833 | */ |
| 22755 | 22834 | public static function sampleSuper(): Super|float|null { |
| 22756 | - return Super::sample(); /*316:super*/ | |
| 22835 | + return Super::sample(); /*317:super*/ | |
| 22757 | 22836 | } |
| 22758 | 22837 | |
| 22759 | 22838 | /** |
| @@ -22829,7 +22908,7 @@ class TopLevel { | ||
| 22829 | 22908 | * @return SwitchClass|float|null |
| 22830 | 22909 | */ |
| 22831 | 22910 | public static function sampleSwitch(): SwitchClass|float|null { |
| 22832 | - return SwitchClass::sample(); /*317:switch*/ | |
| 22911 | + return SwitchClass::sample(); /*318:switch*/ | |
| 22833 | 22912 | } |
| 22834 | 22913 | |
| 22835 | 22914 | /** |
| @@ -22905,7 +22984,7 @@ class TopLevel { | ||
| 22905 | 22984 | * @return Symbol|float|null |
| 22906 | 22985 | */ |
| 22907 | 22986 | public static function sampleSymbol(): Symbol|float|null { |
| 22908 | - return Symbol::sample(); /*318:symbol*/ | |
| 22987 | + return Symbol::sample(); /*319:symbol*/ | |
| 22909 | 22988 | } |
| 22910 | 22989 | |
| 22911 | 22990 | /** |
| @@ -22981,7 +23060,7 @@ class TopLevel { | ||
| 22981 | 23060 | * @return Synchronized|float|null |
| 22982 | 23061 | */ |
| 22983 | 23062 | public static function sampleSynchronized(): Synchronized|float|null { |
| 22984 | - return Synchronized::sample(); /*319:synchronized*/ | |
| 23063 | + return Synchronized::sample(); /*320:synchronized*/ | |
| 22985 | 23064 | } |
| 22986 | 23065 | |
| 22987 | 23066 | /** |
| @@ -23057,7 +23136,7 @@ class TopLevel { | ||
| 23057 | 23136 | * @return System|float|null |
| 23058 | 23137 | */ |
| 23059 | 23138 | public static function sampleSystem(): System|float|null { |
| 23060 | - return System::sample(); /*320:system*/ | |
| 23139 | + return System::sample(); /*321:system*/ | |
| 23061 | 23140 | } |
| 23062 | 23141 | |
| 23063 | 23142 | /** |
| @@ -23133,7 +23212,7 @@ class TopLevel { | ||
| 23133 | 23212 | * @return Template|float|null |
| 23134 | 23213 | */ |
| 23135 | 23214 | public static function sampleTemplate(): Template|float|null { |
| 23136 | - return Template::sample(); /*321:template*/ | |
| 23215 | + return Template::sample(); /*322:template*/ | |
| 23137 | 23216 | } |
| 23138 | 23217 | |
| 23139 | 23218 | /** |
| @@ -23209,7 +23288,7 @@ class TopLevel { | ||
| 23209 | 23288 | * @return Then|float|null |
| 23210 | 23289 | */ |
| 23211 | 23290 | public static function sampleThen(): Then|float|null { |
| 23212 | - return Then::sample(); /*322:then*/ | |
| 23291 | + return Then::sample(); /*323:then*/ | |
| 23213 | 23292 | } |
| 23214 | 23293 | |
| 23215 | 23294 | /** |
| @@ -23285,7 +23364,7 @@ class TopLevel { | ||
| 23285 | 23364 | * @return This|float|null |
| 23286 | 23365 | */ |
| 23287 | 23366 | public static function sampleTopLevelThis(): This|float|null { |
| 23288 | - return This::sample(); /*323:topLevelThis*/ | |
| 23367 | + return This::sample(); /*324:topLevelThis*/ | |
| 23289 | 23368 | } |
| 23290 | 23369 | |
| 23291 | 23370 | /** |
| @@ -23361,7 +23440,7 @@ class TopLevel { | ||
| 23361 | 23440 | * @return ThreadLocal|float|null |
| 23362 | 23441 | */ |
| 23363 | 23442 | public static function sampleThreadLocal(): ThreadLocal|float|null { |
| 23364 | - return ThreadLocal::sample(); /*324:threadLocal*/ | |
| 23443 | + return ThreadLocal::sample(); /*325:threadLocal*/ | |
| 23365 | 23444 | } |
| 23366 | 23445 | |
| 23367 | 23446 | /** |
| @@ -23437,7 +23516,7 @@ class TopLevel { | ||
| 23437 | 23516 | * @return ThrowClass|float|null |
| 23438 | 23517 | */ |
| 23439 | 23518 | public static function sampleThrow(): ThrowClass|float|null { |
| 23440 | - return ThrowClass::sample(); /*325:throw*/ | |
| 23519 | + return ThrowClass::sample(); /*326:throw*/ | |
| 23441 | 23520 | } |
| 23442 | 23521 | |
| 23443 | 23522 | /** |
| @@ -23513,7 +23592,7 @@ class TopLevel { | ||
| 23513 | 23592 | * @return Throws|float|null |
| 23514 | 23593 | */ |
| 23515 | 23594 | public static function sampleThrows(): Throws|float|null { |
| 23516 | - return Throws::sample(); /*326:throws*/ | |
| 23595 | + return Throws::sample(); /*327:throws*/ | |
| 23517 | 23596 | } |
| 23518 | 23597 | |
| 23519 | 23598 | /** |
| @@ -23589,7 +23668,7 @@ class TopLevel { | ||
| 23589 | 23668 | * @return TimeOnly|float|null |
| 23590 | 23669 | */ |
| 23591 | 23670 | public static function sampleTimeOnly(): TimeOnly|float|null { |
| 23592 | - return TimeOnly::sample(); /*327:timeOnly*/ | |
| 23671 | + return TimeOnly::sample(); /*328:timeOnly*/ | |
| 23593 | 23672 | } |
| 23594 | 23673 | |
| 23595 | 23674 | /** |
| @@ -23665,7 +23744,7 @@ class TopLevel { | ||
| 23665 | 23744 | * @return TimeOnlyConverter|float|null |
| 23666 | 23745 | */ |
| 23667 | 23746 | public static function sampleTimeOnlyConverter(): TimeOnlyConverter|float|null { |
| 23668 | - return TimeOnlyConverter::sample(); /*328:timeOnlyConverter*/ | |
| 23747 | + return TimeOnlyConverter::sample(); /*329:timeOnlyConverter*/ | |
| 23669 | 23748 | } |
| 23670 | 23749 | |
| 23671 | 23750 | /** |
| @@ -23741,7 +23820,7 @@ class TopLevel { | ||
| 23741 | 23820 | * @return TimeZone|float|null |
| 23742 | 23821 | */ |
| 23743 | 23822 | public static function sampleTimeZone(): TimeZone|float|null { |
| 23744 | - return TimeZone::sample(); /*329:timeZone*/ | |
| 23823 | + return TimeZone::sample(); /*330:timeZone*/ | |
| 23745 | 23824 | } |
| 23746 | 23825 | |
| 23747 | 23826 | /** |
| @@ -23817,7 +23896,7 @@ class TopLevel { | ||
| 23817 | 23896 | * @return ToDict|float|null |
| 23818 | 23897 | */ |
| 23819 | 23898 | public static function sampleToDict(): ToDict|float|null { |
| 23820 | - return ToDict::sample(); /*330:toDict*/ | |
| 23899 | + return ToDict::sample(); /*331:toDict*/ | |
| 23821 | 23900 | } |
| 23822 | 23901 | |
| 23823 | 23902 | /** |
| @@ -23893,7 +23972,7 @@ class TopLevel { | ||
| 23893 | 23972 | * @return ToJSON|float|null |
| 23894 | 23973 | */ |
| 23895 | 23974 | public static function sampleToJSON(): ToJSON|float|null { |
| 23896 | - return ToJSON::sample(); /*331:toJSON*/ | |
| 23975 | + return ToJSON::sample(); /*332:toJSON*/ | |
| 23897 | 23976 | } |
| 23898 | 23977 | |
| 23899 | 23978 | /** |
| @@ -23969,7 +24048,7 @@ class TopLevel { | ||
| 23969 | 24048 | * @return TopLevelClass|float|null |
| 23970 | 24049 | */ |
| 23971 | 24050 | public static function sampleTopLevel(): TopLevelClass|float|null { |
| 23972 | - return TopLevelClass::sample(); /*332:topLevel*/ | |
| 24051 | + return TopLevelClass::sample(); /*333:topLevel*/ | |
| 23973 | 24052 | } |
| 23974 | 24053 | |
| 23975 | 24054 | /** |
| @@ -24045,7 +24124,7 @@ class TopLevel { | ||
| 24045 | 24124 | * @return ToString|float|null |
| 24046 | 24125 | */ |
| 24047 | 24126 | public static function sampleToString(): ToString|float|null { |
| 24048 | - return ToString::sample(); /*333:toString*/ | |
| 24127 | + return ToString::sample(); /*334:toString*/ | |
| 24049 | 24128 | } |
| 24050 | 24129 | |
| 24051 | 24130 | /** |
| @@ -24121,7 +24200,7 @@ class TopLevel { | ||
| 24121 | 24200 | * @return Transient|float|null |
| 24122 | 24201 | */ |
| 24123 | 24202 | public static function sampleTransient(): Transient|float|null { |
| 24124 | - return Transient::sample(); /*334:transient*/ | |
| 24203 | + return Transient::sample(); /*335:transient*/ | |
| 24125 | 24204 | } |
| 24126 | 24205 | |
| 24127 | 24206 | /** |
| @@ -24197,7 +24276,7 @@ class TopLevel { | ||
| 24197 | 24276 | * @return TrueClass|float|null |
| 24198 | 24277 | */ |
| 24199 | 24278 | public static function sampleTrue(): TrueClass|float|null { |
| 24200 | - return TrueClass::sample(); /*335:true*/ | |
| 24279 | + return TrueClass::sample(); /*336:true*/ | |
| 24201 | 24280 | } |
| 24202 | 24281 | |
| 24203 | 24282 | /** |
| @@ -24273,7 +24352,7 @@ class TopLevel { | ||
| 24273 | 24352 | * @return UnionTrueTrue|float|null |
| 24274 | 24353 | */ |
| 24275 | 24354 | public static function sampleTopLevelTrue(): UnionTrueTrue|float|null { |
| 24276 | - return UnionTrueTrue::sample(); /*336:topLevelTrue*/ | |
| 24355 | + return UnionTrueTrue::sample(); /*337:topLevelTrue*/ | |
| 24277 | 24356 | } |
| 24278 | 24357 | |
| 24279 | 24358 | /** |
| @@ -24349,7 +24428,7 @@ class TopLevel { | ||
| 24349 | 24428 | * @return TryClass|float|null |
| 24350 | 24429 | */ |
| 24351 | 24430 | public static function sampleTry(): TryClass|float|null { |
| 24352 | - return TryClass::sample(); /*337:try*/ | |
| 24431 | + return TryClass::sample(); /*338:try*/ | |
| 24353 | 24432 | } |
| 24354 | 24433 | |
| 24355 | 24434 | /** |
| @@ -24425,7 +24504,7 @@ class TopLevel { | ||
| 24425 | 24504 | * @return Type|float|null |
| 24426 | 24505 | */ |
| 24427 | 24506 | public static function sampleType(): Type|float|null { |
| 24428 | - return Type::sample(); /*338:type*/ | |
| 24507 | + return Type::sample(); /*339:type*/ | |
| 24429 | 24508 | } |
| 24430 | 24509 | |
| 24431 | 24510 | /** |
| @@ -24501,7 +24580,7 @@ class TopLevel { | ||
| 24501 | 24580 | * @return TypeClass|float|null |
| 24502 | 24581 | */ |
| 24503 | 24582 | public static function sampleTopLevelType(): TypeClass|float|null { |
| 24504 | - return TypeClass::sample(); /*339:topLevelType*/ | |
| 24583 | + return TypeClass::sample(); /*340:topLevelType*/ | |
| 24505 | 24584 | } |
| 24506 | 24585 | |
| 24507 | 24586 | /** |
| @@ -24577,7 +24656,7 @@ class TopLevel { | ||
| 24577 | 24656 | * @return Typealias|float|null |
| 24578 | 24657 | */ |
| 24579 | 24658 | public static function sampleTypealias(): Typealias|float|null { |
| 24580 | - return Typealias::sample(); /*340:typealias*/ | |
| 24659 | + return Typealias::sample(); /*341:typealias*/ | |
| 24581 | 24660 | } |
| 24582 | 24661 | |
| 24583 | 24662 | /** |
| @@ -24653,7 +24732,7 @@ class TopLevel { | ||
| 24653 | 24732 | * @return Typedef|float|null |
| 24654 | 24733 | */ |
| 24655 | 24734 | public static function sampleTypedef(): Typedef|float|null { |
| 24656 | - return Typedef::sample(); /*341:typedef*/ | |
| 24735 | + return Typedef::sample(); /*342:typedef*/ | |
| 24657 | 24736 | } |
| 24658 | 24737 | |
| 24659 | 24738 | /** |
| @@ -24729,7 +24808,7 @@ class TopLevel { | ||
| 24729 | 24808 | * @return Typeid|float|null |
| 24730 | 24809 | */ |
| 24731 | 24810 | public static function sampleTypeid(): Typeid|float|null { |
| 24732 | - return Typeid::sample(); /*342:typeid*/ | |
| 24811 | + return Typeid::sample(); /*343:typeid*/ | |
| 24733 | 24812 | } |
| 24734 | 24813 | |
| 24735 | 24814 | /** |
| @@ -24805,7 +24884,7 @@ class TopLevel { | ||
| 24805 | 24884 | * @return Typename|float|null |
| 24806 | 24885 | */ |
| 24807 | 24886 | public static function sampleTypename(): Typename|float|null { |
| 24808 | - return Typename::sample(); /*343:typename*/ | |
| 24887 | + return Typename::sample(); /*344:typename*/ | |
| 24809 | 24888 | } |
| 24810 | 24889 | |
| 24811 | 24890 | /** |
| @@ -24881,7 +24960,7 @@ class TopLevel { | ||
| 24881 | 24960 | * @return Typeof|float|null |
| 24882 | 24961 | */ |
| 24883 | 24962 | public static function sampleTypeof(): Typeof|float|null { |
| 24884 | - return Typeof::sample(); /*344:typeof*/ | |
| 24963 | + return Typeof::sample(); /*345:typeof*/ | |
| 24885 | 24964 | } |
| 24886 | 24965 | |
| 24887 | 24966 | /** |
| @@ -24957,7 +25036,7 @@ class TopLevel { | ||
| 24957 | 25036 | * @return Uint|float|null |
| 24958 | 25037 | */ |
| 24959 | 25038 | public static function sampleUint(): Uint|float|null { |
| 24960 | - return Uint::sample(); /*345:uint*/ | |
| 25039 | + return Uint::sample(); /*346:uint*/ | |
| 24961 | 25040 | } |
| 24962 | 25041 | |
| 24963 | 25042 | /** |
| @@ -25033,7 +25112,7 @@ class TopLevel { | ||
| 25033 | 25112 | * @return Ulong|float|null |
| 25034 | 25113 | */ |
| 25035 | 25114 | public static function sampleUlong(): Ulong|float|null { |
| 25036 | - return Ulong::sample(); /*346:ulong*/ | |
| 25115 | + return Ulong::sample(); /*347:ulong*/ | |
| 25037 | 25116 | } |
| 25038 | 25117 | |
| 25039 | 25118 | /** |
| @@ -25109,7 +25188,7 @@ class TopLevel { | ||
| 25109 | 25188 | * @return Unchecked|float|null |
| 25110 | 25189 | */ |
| 25111 | 25190 | public static function sampleUnchecked(): Unchecked|float|null { |
| 25112 | - return Unchecked::sample(); /*347:unchecked*/ | |
| 25191 | + return Unchecked::sample(); /*348:unchecked*/ | |
| 25113 | 25192 | } |
| 25114 | 25193 | |
| 25115 | 25194 | /** |
| @@ -25185,7 +25264,7 @@ class TopLevel { | ||
| 25185 | 25264 | * @return Undefined|float|null |
| 25186 | 25265 | */ |
| 25187 | 25266 | public static function sampleUndefined(): Undefined|float|null { |
| 25188 | - return Undefined::sample(); /*348:undefined*/ | |
| 25267 | + return Undefined::sample(); /*349:undefined*/ | |
| 25189 | 25268 | } |
| 25190 | 25269 | |
| 25191 | 25270 | /** |
| @@ -25261,7 +25340,7 @@ class TopLevel { | ||
| 25261 | 25340 | * @return UnionClass|float|null |
| 25262 | 25341 | */ |
| 25263 | 25342 | public static function sampleUnion(): UnionClass|float|null { |
| 25264 | - return UnionClass::sample(); /*349:union*/ | |
| 25343 | + return UnionClass::sample(); /*350:union*/ | |
| 25265 | 25344 | } |
| 25266 | 25345 | |
| 25267 | 25346 | /** |
| @@ -25337,7 +25416,7 @@ class TopLevel { | ||
| 25337 | 25416 | * @return UnmarshalJSON|float|null |
| 25338 | 25417 | */ |
| 25339 | 25418 | public static function sampleUnmarshalJSON(): UnmarshalJSON|float|null { |
| 25340 | - return UnmarshalJSON::sample(); /*350:unmarshalJSON*/ | |
| 25419 | + return UnmarshalJSON::sample(); /*351:unmarshalJSON*/ | |
| 25341 | 25420 | } |
| 25342 | 25421 | |
| 25343 | 25422 | /** |
| @@ -25413,7 +25492,7 @@ class TopLevel { | ||
| 25413 | 25492 | * @return Unowned|float|null |
| 25414 | 25493 | */ |
| 25415 | 25494 | public static function sampleUnowned(): Unowned|float|null { |
| 25416 | - return Unowned::sample(); /*351:unowned*/ | |
| 25495 | + return Unowned::sample(); /*352:unowned*/ | |
| 25417 | 25496 | } |
| 25418 | 25497 | |
| 25419 | 25498 | /** |
| @@ -25489,7 +25568,7 @@ class TopLevel { | ||
| 25489 | 25568 | * @return Unsafe|float|null |
| 25490 | 25569 | */ |
| 25491 | 25570 | public static function sampleUnsafe(): Unsafe|float|null { |
| 25492 | - return Unsafe::sample(); /*352:unsafe*/ | |
| 25571 | + return Unsafe::sample(); /*353:unsafe*/ | |
| 25493 | 25572 | } |
| 25494 | 25573 | |
| 25495 | 25574 | /** |
| @@ -25565,7 +25644,7 @@ class TopLevel { | ||
| 25565 | 25644 | * @return Unsigned|float|null |
| 25566 | 25645 | */ |
| 25567 | 25646 | public static function sampleUnsigned(): Unsigned|float|null { |
| 25568 | - return Unsigned::sample(); /*353:unsigned*/ | |
| 25647 | + return Unsigned::sample(); /*354:unsigned*/ | |
| 25569 | 25648 | } |
| 25570 | 25649 | |
| 25571 | 25650 | /** |
| @@ -25641,7 +25720,7 @@ class TopLevel { | ||
| 25641 | 25720 | * @return UseSerializers|float|null |
| 25642 | 25721 | */ |
| 25643 | 25722 | public static function sampleUseSerializers(): UseSerializers|float|null { |
| 25644 | - return UseSerializers::sample(); /*354:useSerializers*/ | |
| 25723 | + return UseSerializers::sample(); /*355:useSerializers*/ | |
| 25645 | 25724 | } |
| 25646 | 25725 | |
| 25647 | 25726 | /** |
| @@ -25717,7 +25796,7 @@ class TopLevel { | ||
| 25717 | 25796 | * @return Ushort|float|null |
| 25718 | 25797 | */ |
| 25719 | 25798 | public static function sampleUshort(): Ushort|float|null { |
| 25720 | - return Ushort::sample(); /*355:ushort*/ | |
| 25799 | + return Ushort::sample(); /*356:ushort*/ | |
| 25721 | 25800 | } |
| 25722 | 25801 | |
| 25723 | 25802 | /** |
| @@ -25793,7 +25872,7 @@ class TopLevel { | ||
| 25793 | 25872 | * @return Using|float|null |
| 25794 | 25873 | */ |
| 25795 | 25874 | public static function sampleUsing(): Using|float|null { |
| 25796 | - return Using::sample(); /*356:using*/ | |
| 25875 | + return Using::sample(); /*357:using*/ | |
| 25797 | 25876 | } |
| 25798 | 25877 | |
| 25799 | 25878 | /** |
| @@ -25869,7 +25948,7 @@ class TopLevel { | ||
| 25869 | 25948 | * @return Utf8JSONReader|float|null |
| 25870 | 25949 | */ |
| 25871 | 25950 | public static function sampleUtf8JSONReader(): Utf8JSONReader|float|null { |
| 25872 | - return Utf8JSONReader::sample(); /*357:utf8JSONReader*/ | |
| 25951 | + return Utf8JSONReader::sample(); /*358:utf8JSONReader*/ | |
| 25873 | 25952 | } |
| 25874 | 25953 | |
| 25875 | 25954 | /** |
| @@ -25945,7 +26024,7 @@ class TopLevel { | ||
| 25945 | 26024 | * @return Utf8JSONWriter|float|null |
| 25946 | 26025 | */ |
| 25947 | 26026 | public static function sampleUtf8JSONWriter(): Utf8JSONWriter|float|null { |
| 25948 | - return Utf8JSONWriter::sample(); /*358:utf8JSONWriter*/ | |
| 26027 | + return Utf8JSONWriter::sample(); /*359:utf8JSONWriter*/ | |
| 25949 | 26028 | } |
| 25950 | 26029 | |
| 25951 | 26030 | /** |
| @@ -26021,7 +26100,7 @@ class TopLevel { | ||
| 26021 | 26100 | * @return UUID|float|null |
| 26022 | 26101 | */ |
| 26023 | 26102 | public static function sampleUUID(): UUID|float|null { |
| 26024 | - return UUID::sample(); /*359:uuid*/ | |
| 26103 | + return UUID::sample(); /*360:uuid*/ | |
| 26025 | 26104 | } |
| 26026 | 26105 | |
| 26027 | 26106 | /** |
| @@ -26097,7 +26176,7 @@ class TopLevel { | ||
| 26097 | 26176 | * @return VarClass|float|null |
| 26098 | 26177 | */ |
| 26099 | 26178 | public static function sampleVar(): VarClass|float|null { |
| 26100 | - return VarClass::sample(); /*360:var*/ | |
| 26179 | + return VarClass::sample(); /*361:var*/ | |
| 26101 | 26180 | } |
| 26102 | 26181 | |
| 26103 | 26182 | /** |
| @@ -26173,7 +26252,7 @@ class TopLevel { | ||
| 26173 | 26252 | * @return Virtual|float|null |
| 26174 | 26253 | */ |
| 26175 | 26254 | public static function sampleVirtual(): Virtual|float|null { |
| 26176 | - return Virtual::sample(); /*361:virtual*/ | |
| 26255 | + return Virtual::sample(); /*362:virtual*/ | |
| 26177 | 26256 | } |
| 26178 | 26257 | |
| 26179 | 26258 | /** |
| @@ -26249,7 +26328,7 @@ class TopLevel { | ||
| 26249 | 26328 | * @return VoidClass|float|null |
| 26250 | 26329 | */ |
| 26251 | 26330 | public static function sampleVoid(): VoidClass|float|null { |
| 26252 | - return VoidClass::sample(); /*362:void*/ | |
| 26331 | + return VoidClass::sample(); /*363:void*/ | |
| 26253 | 26332 | } |
| 26254 | 26333 | |
| 26255 | 26334 | /** |
| @@ -26325,7 +26404,7 @@ class TopLevel { | ||
| 26325 | 26404 | * @return Volatile|float|null |
| 26326 | 26405 | */ |
| 26327 | 26406 | public static function sampleVolatile(): Volatile|float|null { |
| 26328 | - return Volatile::sample(); /*363:volatile*/ | |
| 26407 | + return Volatile::sample(); /*364:volatile*/ | |
| 26329 | 26408 | } |
| 26330 | 26409 | |
| 26331 | 26410 | /** |
| @@ -26401,7 +26480,7 @@ class TopLevel { | ||
| 26401 | 26480 | * @return WcharT|float|null |
| 26402 | 26481 | */ |
| 26403 | 26482 | public static function sampleWcharT(): WcharT|float|null { |
| 26404 | - return WcharT::sample(); /*364:wcharT*/ | |
| 26483 | + return WcharT::sample(); /*365:wcharT*/ | |
| 26405 | 26484 | } |
| 26406 | 26485 | |
| 26407 | 26486 | /** |
| @@ -26477,7 +26556,7 @@ class TopLevel { | ||
| 26477 | 26556 | * @return Weak|float|null |
| 26478 | 26557 | */ |
| 26479 | 26558 | public static function sampleWeak(): Weak|float|null { |
| 26480 | - return Weak::sample(); /*365:weak*/ | |
| 26559 | + return Weak::sample(); /*366:weak*/ | |
| 26481 | 26560 | } |
| 26482 | 26561 | |
| 26483 | 26562 | /** |
| @@ -26553,7 +26632,7 @@ class TopLevel { | ||
| 26553 | 26632 | * @return Where|float|null |
| 26554 | 26633 | */ |
| 26555 | 26634 | public static function sampleWhere(): Where|float|null { |
| 26556 | - return Where::sample(); /*366:where*/ | |
| 26635 | + return Where::sample(); /*367:where*/ | |
| 26557 | 26636 | } |
| 26558 | 26637 | |
| 26559 | 26638 | /** |
| @@ -26629,7 +26708,7 @@ class TopLevel { | ||
| 26629 | 26708 | * @return WhileClass|float|null |
| 26630 | 26709 | */ |
| 26631 | 26710 | public static function sampleWhile(): WhileClass|float|null { |
| 26632 | - return WhileClass::sample(); /*367:while*/ | |
| 26711 | + return WhileClass::sample(); /*368:while*/ | |
| 26633 | 26712 | } |
| 26634 | 26713 | |
| 26635 | 26714 | /** |
| @@ -26705,7 +26784,7 @@ class TopLevel { | ||
| 26705 | 26784 | * @return WillSet|float|null |
| 26706 | 26785 | */ |
| 26707 | 26786 | public static function sampleWillSet(): WillSet|float|null { |
| 26708 | - return WillSet::sample(); /*368:willSet*/ | |
| 26787 | + return WillSet::sample(); /*369:willSet*/ | |
| 26709 | 26788 | } |
| 26710 | 26789 | |
| 26711 | 26790 | /** |
| @@ -26781,7 +26860,7 @@ class TopLevel { | ||
| 26781 | 26860 | * @return With|float|null |
| 26782 | 26861 | */ |
| 26783 | 26862 | public static function sampleWith(): With|float|null { |
| 26784 | - return With::sample(); /*369:with*/ | |
| 26863 | + return With::sample(); /*370:with*/ | |
| 26785 | 26864 | } |
| 26786 | 26865 | |
| 26787 | 26866 | /** |
| @@ -26857,7 +26936,7 @@ class TopLevel { | ||
| 26857 | 26936 | * @return XorClass|float|null |
| 26858 | 26937 | */ |
| 26859 | 26938 | public static function sampleXor(): XorClass|float|null { |
| 26860 | - return XorClass::sample(); /*370:xor*/ | |
| 26939 | + return XorClass::sample(); /*371:xor*/ | |
| 26861 | 26940 | } |
| 26862 | 26941 | |
| 26863 | 26942 | /** |
| @@ -26933,7 +27012,7 @@ class TopLevel { | ||
| 26933 | 27012 | * @return XorEq|float|null |
| 26934 | 27013 | */ |
| 26935 | 27014 | public static function sampleXorEq(): XorEq|float|null { |
| 26936 | - return XorEq::sample(); /*371:xorEq*/ | |
| 27015 | + return XorEq::sample(); /*372:xorEq*/ | |
| 26937 | 27016 | } |
| 26938 | 27017 | |
| 26939 | 27018 | /** |
| @@ -27009,7 +27088,7 @@ class TopLevel { | ||
| 27009 | 27088 | * @return Yes|float|null |
| 27010 | 27089 | */ |
| 27011 | 27090 | public static function sampleYes(): Yes|float|null { |
| 27012 | - return Yes::sample(); /*372:yes*/ | |
| 27091 | + return Yes::sample(); /*373:yes*/ | |
| 27013 | 27092 | } |
| 27014 | 27093 | |
| 27015 | 27094 | /** |
| @@ -27085,7 +27164,7 @@ class TopLevel { | ||
| 27085 | 27164 | * @return YieldClass|float|null |
| 27086 | 27165 | */ |
| 27087 | 27166 | public static function sampleYield(): YieldClass|float|null { |
| 27088 | - return YieldClass::sample(); /*373:yield*/ | |
| 27167 | + return YieldClass::sample(); /*374:yield*/ | |
| 27089 | 27168 | } |
| 27090 | 27169 | |
| 27091 | 27170 | /** |
| @@ -27275,6 +27354,7 @@ class TopLevel { | ||
| 27275 | 27354 | || TopLevel::validateLocale($this->locale) |
| 27276 | 27355 | || TopLevel::validateLock($this->lock) |
| 27277 | 27356 | || TopLevel::validateLong($this->long) |
| 27357 | + || TopLevel::validateMakeDictEncoder($this->makeDictEncoder) | |
| 27278 | 27358 | || TopLevel::validateMap($this->map) |
| 27279 | 27359 | || TopLevel::validateMapEntry($this->mapEntry) |
| 27280 | 27360 | || TopLevel::validateMarshalJSON($this->marshalJSON) |
| @@ -27626,6 +27706,7 @@ class TopLevel { | ||
| 27626 | 27706 | $out->{'Locale'} = $this->toLocale(); |
| 27627 | 27707 | $out->{'lock'} = $this->toLock(); |
| 27628 | 27708 | $out->{'long'} = $this->toLong(); |
| 27709 | + $out->{'makeDictEncoder'} = $this->toMakeDictEncoder(); | |
| 27629 | 27710 | $out->{'map'} = $this->toMap(); |
| 27630 | 27711 | $out->{'MapEntry'} = $this->toMapEntry(); |
| 27631 | 27712 | $out->{'MarshalJSON'} = $this->toMarshalJSON(); |
| @@ -27979,6 +28060,7 @@ class TopLevel { | ||
| 27979 | 28060 | ,TopLevel::fromLocale($obj->{'Locale'}) |
| 27980 | 28061 | ,TopLevel::fromLock($obj->{'lock'}) |
| 27981 | 28062 | ,TopLevel::fromLong($obj->{'long'}) |
| 28063 | + ,TopLevel::fromMakeDictEncoder($obj->{'makeDictEncoder'}) | |
| 27982 | 28064 | ,TopLevel::fromMap($obj->{'map'}) |
| 27983 | 28065 | ,TopLevel::fromMapEntry($obj->{'MapEntry'}) |
| 27984 | 28066 | ,TopLevel::fromMarshalJSON($obj->{'MarshalJSON'}) |
| @@ -28330,6 +28412,7 @@ class TopLevel { | ||
| 28330 | 28412 | ,TopLevel::sampleLocale() |
| 28331 | 28413 | ,TopLevel::sampleLock() |
| 28332 | 28414 | ,TopLevel::sampleLong() |
| 28415 | + ,TopLevel::sampleMakeDictEncoder() | |
| 28333 | 28416 | ,TopLevel::sampleMap() |
| 28334 | 28417 | ,TopLevel::sampleMapEntry() |
| 28335 | 28418 | ,TopLevel::sampleMarshalJSON() |
| @@ -36415,6 +36498,51 @@ class Long { | ||
| 36415 | 36498 | } |
| 36416 | 36499 | } |
| 36417 | 36500 | |
| 36501 | +// This is an autogenerated file:MakeDictEncoder | |
| 36502 | + | |
| 36503 | +class MakeDictEncoder { | |
| 36504 | + | |
| 36505 | + /** | |
| 36506 | + */ | |
| 36507 | + public function __construct() { | |
| 36508 | + } | |
| 36509 | + | |
| 36510 | + /** | |
| 36511 | + * @throws Exception | |
| 36512 | + * @return bool | |
| 36513 | + */ | |
| 36514 | + public function validate(): bool { | |
| 36515 | + return true; | |
| 36516 | + } | |
| 36517 | + | |
| 36518 | + /** | |
| 36519 | + * @return stdClass | |
| 36520 | + * @throws Exception | |
| 36521 | + */ | |
| 36522 | + public function to(): stdClass { | |
| 36523 | + $out = new stdClass(); | |
| 36524 | + return $out; | |
| 36525 | + } | |
| 36526 | + | |
| 36527 | + /** | |
| 36528 | + * @param stdClass $obj | |
| 36529 | + * @return MakeDictEncoder | |
| 36530 | + * @throws Exception | |
| 36531 | + */ | |
| 36532 | + public static function from(stdClass $obj): MakeDictEncoder { | |
| 36533 | + return new MakeDictEncoder( | |
| 36534 | + ); | |
| 36535 | + } | |
| 36536 | + | |
| 36537 | + /** | |
| 36538 | + * @return MakeDictEncoder | |
| 36539 | + */ | |
| 36540 | + public static function sample(): MakeDictEncoder { | |
| 36541 | + return new MakeDictEncoder( | |
| 36542 | + ); | |
| 36543 | + } | |
| 36544 | +} | |
| 36545 | + | |
| 36418 | 36546 | // This is an autogenerated file:Map |
| 36419 | 36547 | |
| 36420 | 36548 | class Map { |
Mschema-pikedefault / TopLevel.pmod+26 −0
| @@ -195,6 +195,7 @@ class TopLevel { | ||
| 195 | 195 | UnionLocale locale; // json: "Locale" |
| 196 | 196 | UnionLock lock; // json: "lock" |
| 197 | 197 | UnionLong long; // json: "long" |
| 198 | + UnionMakeDictEncoder make_dict_encoder; // json: "makeDictEncoder" | |
| 198 | 199 | UnionMap map; // json: "map" |
| 199 | 200 | UnionMapEntry map_entry; // json: "MapEntry" |
| 200 | 201 | UnionMarshalJson marshal_json; // json: "MarshalJSON" |
| @@ -541,6 +542,7 @@ class TopLevel { | ||
| 541 | 542 | "Locale" : locale, |
| 542 | 543 | "lock" : lock, |
| 543 | 544 | "long" : long, |
| 545 | + "makeDictEncoder" : make_dict_encoder, | |
| 544 | 546 | "map" : map, |
| 545 | 547 | "MapEntry" : map_entry, |
| 546 | 548 | "MarshalJSON" : marshal_json, |
| @@ -1074,6 +1076,8 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 1074 | 1076 | retval.lock = json["lock"]; |
| 1075 | 1077 | if (arrayp(json["long"])) error("Unexpected array"); |
| 1076 | 1078 | retval.long = json["long"]; |
| 1079 | + if (arrayp(json["makeDictEncoder"])) error("Unexpected array"); | |
| 1080 | + retval.make_dict_encoder = json["makeDictEncoder"]; | |
| 1077 | 1081 | if (arrayp(json["map"])) error("Unexpected array"); |
| 1078 | 1082 | retval.map = json["map"]; |
| 1079 | 1083 | if (arrayp(json["MapEntry"])) error("Unexpected array"); |
| @@ -4744,6 +4748,28 @@ Long Long_from_JSON(mixed json) { | ||
| 4744 | 4748 | return retval; |
| 4745 | 4749 | } |
| 4746 | 4750 | |
| 4751 | +typedef float|MakeDictEncoder UnionMakeDictEncoder; | |
| 4752 | + | |
| 4753 | +UnionMakeDictEncoder UnionMakeDictEncoder_from_JSON(mixed json) { | |
| 4754 | + return json; | |
| 4755 | +} | |
| 4756 | + | |
| 4757 | +class MakeDictEncoder { | |
| 4758 | + | |
| 4759 | + string encode_json() { | |
| 4760 | + mapping(string:mixed) json = ([ | |
| 4761 | + ]); | |
| 4762 | + | |
| 4763 | + return Standards.JSON.encode(json); | |
| 4764 | + } | |
| 4765 | +} | |
| 4766 | + | |
| 4767 | +MakeDictEncoder MakeDictEncoder_from_JSON(mixed json) { | |
| 4768 | + MakeDictEncoder retval = MakeDictEncoder(); | |
| 4769 | + | |
| 4770 | + return retval; | |
| 4771 | +} | |
| 4772 | + | |
| 4747 | 4773 | typedef float|Map UnionMap; |
| 4748 | 4774 | |
| 4749 | 4775 | UnionMap UnionMap_from_JSON(mixed json) { |
Mschema-pythondefault / quicktype.py+19 −1
| @@ -2134,6 +2134,20 @@ class Long: | ||
| 2134 | 2134 | return result |
| 2135 | 2135 | |
| 2136 | 2136 | |
| 2137 | +@dataclass | |
| 2138 | +class MakeDictEncoder: | |
| 2139 | + pass | |
| 2140 | + | |
| 2141 | + @staticmethod | |
| 2142 | + def from_dict(obj: Any) -> 'MakeDictEncoder': | |
| 2143 | + assert isinstance(obj, dict) | |
| 2144 | + return MakeDictEncoder() | |
| 2145 | + | |
| 2146 | + def to_dict(self) -> dict: | |
| 2147 | + result: dict = {} | |
| 2148 | + return result | |
| 2149 | + | |
| 2150 | + | |
| 2137 | 2151 | @dataclass |
| 2138 | 2152 | class Map: |
| 2139 | 2153 | pass |
| @@ -5006,6 +5020,7 @@ class TopLevel: | ||
| 5006 | 5020 | locale: float | Locale | None = None |
| 5007 | 5021 | lock: float | Lock | None = None |
| 5008 | 5022 | long: float | Long | None = None |
| 5023 | + make_dict_encoder: float | MakeDictEncoder | None = None | |
| 5009 | 5024 | map: float | Map | None = None |
| 5010 | 5025 | map_entry: float | MapEntry | None = None |
| 5011 | 5026 | marshal_json: float | MarshalJSON | None = None |
| @@ -5353,6 +5368,7 @@ class TopLevel: | ||
| 5353 | 5368 | locale = from_union([from_float, Locale.from_dict, from_none], obj.get("Locale")) |
| 5354 | 5369 | lock = from_union([from_float, Lock.from_dict, from_none], obj.get("lock")) |
| 5355 | 5370 | long = from_union([from_float, Long.from_dict, from_none], obj.get("long")) |
| 5371 | + make_dict_encoder = from_union([from_float, MakeDictEncoder.from_dict, from_none], obj.get("makeDictEncoder")) | |
| 5356 | 5372 | map = from_union([from_float, Map.from_dict, from_none], obj.get("map")) |
| 5357 | 5373 | map_entry = from_union([from_float, MapEntry.from_dict, from_none], obj.get("MapEntry")) |
| 5358 | 5374 | marshal_json = from_union([from_float, MarshalJSON.from_dict, from_none], obj.get("MarshalJSON")) |
| @@ -5514,7 +5530,7 @@ class TopLevel: | ||
| 5514 | 5530 | xor_eq = from_union([from_float, XorEq.from_dict, from_none], obj.get("xor_eq")) |
| 5515 | 5531 | yes = from_union([from_float, Yes.from_dict, from_none], obj.get("YES")) |
| 5516 | 5532 | top_level_yield = from_union([from_float, Yield.from_dict, from_none], obj.get("yield")) |
| 5517 | - return TopLevel(empty, purple_bool, complex, imaginery, abstract, alignas, alignof, top_level_and, and_eq, top_level_any, any, array, top_level_as, asm, top_level_assert, associatedtype, associativity, top_level_async, atomic, atomic_cancel, atomic_commit, atomic_noexcept, auto, top_level_await, base, bitand, bitor, top_level_bool, fluffy_bool, boolean, top_level_break, bycopy, byref, byte, calendar, case, catch, chan, char, char16_t, char32_t, checked, purple_class, top_level_class, clone, co_await, co_return, co_yield, codable, coding_key, coding_keys, compl, concept, console, const, const_cast, constexpr, constructor, top_level_continue, convenience, convert, converter, culture_info, date, date_parse_handling, date_formatter, date_only, date_only_converter, date_time, date_time_styles, debugger, decimal, declare, decltype, decode_string, decoder, decoding_error, top_level_def, default, defer, deinit, top_level_del, delegate, delete, top_level_dict, dictionary, did_set, do, double, dummy, dynamic, dynamic_cast, top_level_elif, top_level_else, encode_quick_type, encoder, enum, enum_values, equality_contract, equatable, event, top_level_except, exception, explicit, export, exposing, extends, extension, extern, fallthrough, top_level_false, false, fileprivate, final, top_level_finally, fixed, top_level_float, top_level_for, foreach, format_exception, friend, top_level_from, top_level_from_dict, from_json, func, function, get, top_level_global, go, goto, guard, hashable, hash_code, hasher, has_own_property, id, top_level_if, imp, implements, implicit, top_level_import, top_level_in, indirect, infix, init, inline, inout, instanceof, top_level_int, interface, internal, top_level_is, iso_date_time_offset_converter, iterable, jdec, jenc, jpipe, json, json_converter, json_serializer, json_token, json_writer, json_any, json_coding_key, json_decoder, json_encoder, json_exception, json_generator, json_node, json_null, json_parser, json_reader, json_token_type, k_serializer, top_level_lambda, lazy, left, let, list, locale, lock, long, map, map_entry, marshal_json, metadata_property_handling, module, mutable, mutating, namespace, native, new, newtonsoft, nil, no, noexcept, nonatomic, top_level_none, none, top_level_nonlocal, nonmutating, no_such_method, top_level_not, not_eq, ns_error, ns_object, ns_string, null, top_level_null, nullptr, number, object, object_mapper, of, oneway, open, operator, optional, top_level_or, or_eq, out, override, package, params, top_level_pass, port, postfix, precedence, prefix, primitive_kind, top_level_print, printf, print_members, private, protected, protocol, top_level_protocol, public, quicktype, top_level_raise, range, readonly, ref, reg_exp, register, reinterpret_cast, repeat, require, required, requires, restrict, retain, rethrows, top_level_return, right, runtime_type, s, sbyte, sealed, sel, select, top_level_self, purple_self, sendable, serial_descriptor, serializable, serialize, serializer_provider, serial_name, set, short, signed, simple_module, sizeof, stackalloc, standards, static, static_assert, static_cast, std_deserializer, std_serializer, strictfp, string, struct, subscript, super, switch, symbol, synchronized, system, template, then, this, thread_local, throw, throws, time_only, time_only_converter, time_zone, top_level_to_dict, to_json, top_level, to_string, transient, true, top_level_true, top_level_try, type, top_level_type, typealias, typedef, typeid, typename, typeof, uint, ulong, unchecked, undefined, union, unmarshal_json, unowned, unsafe, unsigned, use_serializers, ushort, using, utf8_json_reader, utf8_json_writer, uuid, var, virtual, void, volatile, wchar_t, weak, where, top_level_while, will_set, top_level_with, xor, xor_eq, yes, top_level_yield) | |
| 5533 | + return TopLevel(empty, purple_bool, complex, imaginery, abstract, alignas, alignof, top_level_and, and_eq, top_level_any, any, array, top_level_as, asm, top_level_assert, associatedtype, associativity, top_level_async, atomic, atomic_cancel, atomic_commit, atomic_noexcept, auto, top_level_await, base, bitand, bitor, top_level_bool, fluffy_bool, boolean, top_level_break, bycopy, byref, byte, calendar, case, catch, chan, char, char16_t, char32_t, checked, purple_class, top_level_class, clone, co_await, co_return, co_yield, codable, coding_key, coding_keys, compl, concept, console, const, const_cast, constexpr, constructor, top_level_continue, convenience, convert, converter, culture_info, date, date_parse_handling, date_formatter, date_only, date_only_converter, date_time, date_time_styles, debugger, decimal, declare, decltype, decode_string, decoder, decoding_error, top_level_def, default, defer, deinit, top_level_del, delegate, delete, top_level_dict, dictionary, did_set, do, double, dummy, dynamic, dynamic_cast, top_level_elif, top_level_else, encode_quick_type, encoder, enum, enum_values, equality_contract, equatable, event, top_level_except, exception, explicit, export, exposing, extends, extension, extern, fallthrough, top_level_false, false, fileprivate, final, top_level_finally, fixed, top_level_float, top_level_for, foreach, format_exception, friend, top_level_from, top_level_from_dict, from_json, func, function, get, top_level_global, go, goto, guard, hashable, hash_code, hasher, has_own_property, id, top_level_if, imp, implements, implicit, top_level_import, top_level_in, indirect, infix, init, inline, inout, instanceof, top_level_int, interface, internal, top_level_is, iso_date_time_offset_converter, iterable, jdec, jenc, jpipe, json, json_converter, json_serializer, json_token, json_writer, json_any, json_coding_key, json_decoder, json_encoder, json_exception, json_generator, json_node, json_null, json_parser, json_reader, json_token_type, k_serializer, top_level_lambda, lazy, left, let, list, locale, lock, long, make_dict_encoder, map, map_entry, marshal_json, metadata_property_handling, module, mutable, mutating, namespace, native, new, newtonsoft, nil, no, noexcept, nonatomic, top_level_none, none, top_level_nonlocal, nonmutating, no_such_method, top_level_not, not_eq, ns_error, ns_object, ns_string, null, top_level_null, nullptr, number, object, object_mapper, of, oneway, open, operator, optional, top_level_or, or_eq, out, override, package, params, top_level_pass, port, postfix, precedence, prefix, primitive_kind, top_level_print, printf, print_members, private, protected, protocol, top_level_protocol, public, quicktype, top_level_raise, range, readonly, ref, reg_exp, register, reinterpret_cast, repeat, require, required, requires, restrict, retain, rethrows, top_level_return, right, runtime_type, s, sbyte, sealed, sel, select, top_level_self, purple_self, sendable, serial_descriptor, serializable, serialize, serializer_provider, serial_name, set, short, signed, simple_module, sizeof, stackalloc, standards, static, static_assert, static_cast, std_deserializer, std_serializer, strictfp, string, struct, subscript, super, switch, symbol, synchronized, system, template, then, this, thread_local, throw, throws, time_only, time_only_converter, time_zone, top_level_to_dict, to_json, top_level, to_string, transient, true, top_level_true, top_level_try, type, top_level_type, typealias, typedef, typeid, typename, typeof, uint, ulong, unchecked, undefined, union, unmarshal_json, unowned, unsafe, unsigned, use_serializers, ushort, using, utf8_json_reader, utf8_json_writer, uuid, var, virtual, void, volatile, wchar_t, weak, where, top_level_while, will_set, top_level_with, xor, xor_eq, yes, top_level_yield) | |
| 5518 | 5534 | |
| 5519 | 5535 | def to_dict(self) -> dict: |
| 5520 | 5536 | result: dict = {} |
| @@ -5882,6 +5898,8 @@ class TopLevel: | ||
| 5882 | 5898 | result["lock"] = from_union([to_float, lambda x: to_class(Lock, x), from_none], self.lock) |
| 5883 | 5899 | if self.long is not None: |
| 5884 | 5900 | result["long"] = from_union([to_float, lambda x: to_class(Long, x), from_none], self.long) |
| 5901 | + if self.make_dict_encoder is not None: | |
| 5902 | + result["makeDictEncoder"] = from_union([to_float, lambda x: to_class(MakeDictEncoder, x), from_none], self.make_dict_encoder) | |
| 5885 | 5903 | if self.map is not None: |
| 5886 | 5904 | result["map"] = from_union([to_float, lambda x: to_class(Map, x), from_none], self.map) |
| 5887 | 5905 | if self.map_entry is not None: |
Mschema-ruby-syntaxdefault / TopLevel.rb+60 −0
| @@ -9253,6 +9253,63 @@ class UnionLong < Dry::Struct | ||
| 9253 | 9253 | end |
| 9254 | 9254 | end |
| 9255 | 9255 | |
| 9256 | +class MakeDictEncoder < Dry::Struct | |
| 9257 | + | |
| 9258 | + def self.from_dynamic!(d) | |
| 9259 | + d = Types::Hash[d] | |
| 9260 | + new( | |
| 9261 | + ) | |
| 9262 | + end | |
| 9263 | + | |
| 9264 | + def self.from_json!(json) | |
| 9265 | + from_dynamic!(JSON.parse(json)) | |
| 9266 | + end | |
| 9267 | + | |
| 9268 | + def to_dynamic | |
| 9269 | + { | |
| 9270 | + } | |
| 9271 | + end | |
| 9272 | + | |
| 9273 | + def to_json(options = nil) | |
| 9274 | + JSON.generate(to_dynamic, options) | |
| 9275 | + end | |
| 9276 | +end | |
| 9277 | + | |
| 9278 | +class UnionMakeDictEncoder < Dry::Struct | |
| 9279 | + attribute :double, Types::Double.optional | |
| 9280 | + attribute :make_dict_encoder, MakeDictEncoder.optional | |
| 9281 | + | |
| 9282 | + def self.from_dynamic!(d) | |
| 9283 | + if schema.key(:double).type.right.valid? d | |
| 9284 | + return new(double: d, make_dict_encoder: nil) | |
| 9285 | + end | |
| 9286 | + begin | |
| 9287 | + value = MakeDictEncoder.from_dynamic!(d) | |
| 9288 | + if schema.key(:make_dict_encoder).type.right.valid? value | |
| 9289 | + return new(make_dict_encoder: value, double: nil) | |
| 9290 | + end | |
| 9291 | + rescue | |
| 9292 | + end | |
| 9293 | + raise "Invalid union" | |
| 9294 | + end | |
| 9295 | + | |
| 9296 | + def self.from_json!(json) | |
| 9297 | + from_dynamic!(JSON.parse(json)) | |
| 9298 | + end | |
| 9299 | + | |
| 9300 | + def to_dynamic | |
| 9301 | + if double != nil | |
| 9302 | + double | |
| 9303 | + elsif make_dict_encoder != nil | |
| 9304 | + make_dict_encoder.to_dynamic | |
| 9305 | + end | |
| 9306 | + end | |
| 9307 | + | |
| 9308 | + def to_json(options = nil) | |
| 9309 | + JSON.generate(to_dynamic, options) | |
| 9310 | + end | |
| 9311 | +end | |
| 9312 | + | |
| 9256 | 9313 | class Map < Dry::Struct |
| 9257 | 9314 | |
| 9258 | 9315 | def self.from_dynamic!(d) |
| @@ -19696,6 +19753,7 @@ class TopLevel < Dry::Struct | ||
| 19696 | 19753 | attribute :locale, Types.Instance(UnionLocale).optional |
| 19697 | 19754 | attribute :lock, Types.Instance(UnionLock).optional |
| 19698 | 19755 | attribute :long, Types.Instance(UnionLong).optional |
| 19756 | + attribute :make_dict_encoder, Types.Instance(UnionMakeDictEncoder).optional | |
| 19699 | 19757 | attribute :map, Types.Instance(UnionMap).optional |
| 19700 | 19758 | attribute :map_entry, Types.Instance(UnionMapEntry).optional |
| 19701 | 19759 | attribute :marshal_json, Types.Instance(UnionMarshalJSON).optional |
| @@ -20043,6 +20101,7 @@ class TopLevel < Dry::Struct | ||
| 20043 | 20101 | locale: d.key?("Locale") ? UnionLocale.from_dynamic!(d["Locale"]) : nil, |
| 20044 | 20102 | lock: d.key?("lock") ? UnionLock.from_dynamic!(d["lock"]) : nil, |
| 20045 | 20103 | long: d.key?("long") ? UnionLong.from_dynamic!(d["long"]) : nil, |
| 20104 | + make_dict_encoder: d.key?("makeDictEncoder") ? UnionMakeDictEncoder.from_dynamic!(d["makeDictEncoder"]) : nil, | |
| 20046 | 20105 | map: d.key?("map") ? UnionMap.from_dynamic!(d["map"]) : nil, |
| 20047 | 20106 | map_entry: d.key?("MapEntry") ? UnionMapEntry.from_dynamic!(d["MapEntry"]) : nil, |
| 20048 | 20107 | marshal_json: d.key?("MarshalJSON") ? UnionMarshalJSON.from_dynamic!(d["MarshalJSON"]) : nil, |
| @@ -20395,6 +20454,7 @@ class TopLevel < Dry::Struct | ||
| 20395 | 20454 | "Locale" => locale&.to_dynamic, |
| 20396 | 20455 | "lock" => lock&.to_dynamic, |
| 20397 | 20456 | "long" => long&.to_dynamic, |
| 20457 | + "makeDictEncoder" => make_dict_encoder&.to_dynamic, | |
| 20398 | 20458 | "map" => map&.to_dynamic, |
| 20399 | 20459 | "MapEntry" => map_entry&.to_dynamic, |
| 20400 | 20460 | "MarshalJSON" => marshal_json&.to_dynamic, |
Mschema-rubydefault / TopLevel.rb+60 −0
| @@ -9253,6 +9253,63 @@ class UnionLong < Dry::Struct | ||
| 9253 | 9253 | end |
| 9254 | 9254 | end |
| 9255 | 9255 | |
| 9256 | +class MakeDictEncoder < Dry::Struct | |
| 9257 | + | |
| 9258 | + def self.from_dynamic!(d) | |
| 9259 | + d = Types::Hash[d] | |
| 9260 | + new( | |
| 9261 | + ) | |
| 9262 | + end | |
| 9263 | + | |
| 9264 | + def self.from_json!(json) | |
| 9265 | + from_dynamic!(JSON.parse(json)) | |
| 9266 | + end | |
| 9267 | + | |
| 9268 | + def to_dynamic | |
| 9269 | + { | |
| 9270 | + } | |
| 9271 | + end | |
| 9272 | + | |
| 9273 | + def to_json(options = nil) | |
| 9274 | + JSON.generate(to_dynamic, options) | |
| 9275 | + end | |
| 9276 | +end | |
| 9277 | + | |
| 9278 | +class UnionMakeDictEncoder < Dry::Struct | |
| 9279 | + attribute :double, Types::Double.optional | |
| 9280 | + attribute :make_dict_encoder, MakeDictEncoder.optional | |
| 9281 | + | |
| 9282 | + def self.from_dynamic!(d) | |
| 9283 | + if schema.key(:double).type.right.valid? d | |
| 9284 | + return new(double: d, make_dict_encoder: nil) | |
| 9285 | + end | |
| 9286 | + begin | |
| 9287 | + value = MakeDictEncoder.from_dynamic!(d) | |
| 9288 | + if schema.key(:make_dict_encoder).type.right.valid? value | |
| 9289 | + return new(make_dict_encoder: value, double: nil) | |
| 9290 | + end | |
| 9291 | + rescue | |
| 9292 | + end | |
| 9293 | + raise "Invalid union" | |
| 9294 | + end | |
| 9295 | + | |
| 9296 | + def self.from_json!(json) | |
| 9297 | + from_dynamic!(JSON.parse(json)) | |
| 9298 | + end | |
| 9299 | + | |
| 9300 | + def to_dynamic | |
| 9301 | + if double != nil | |
| 9302 | + double | |
| 9303 | + elsif make_dict_encoder != nil | |
| 9304 | + make_dict_encoder.to_dynamic | |
| 9305 | + end | |
| 9306 | + end | |
| 9307 | + | |
| 9308 | + def to_json(options = nil) | |
| 9309 | + JSON.generate(to_dynamic, options) | |
| 9310 | + end | |
| 9311 | +end | |
| 9312 | + | |
| 9256 | 9313 | class Map < Dry::Struct |
| 9257 | 9314 | |
| 9258 | 9315 | def self.from_dynamic!(d) |
| @@ -19696,6 +19753,7 @@ class TopLevel < Dry::Struct | ||
| 19696 | 19753 | attribute :locale, Types.Instance(UnionLocale).optional |
| 19697 | 19754 | attribute :lock, Types.Instance(UnionLock).optional |
| 19698 | 19755 | attribute :long, Types.Instance(UnionLong).optional |
| 19756 | + attribute :make_dict_encoder, Types.Instance(UnionMakeDictEncoder).optional | |
| 19699 | 19757 | attribute :map, Types.Instance(UnionMap).optional |
| 19700 | 19758 | attribute :map_entry, Types.Instance(UnionMapEntry).optional |
| 19701 | 19759 | attribute :marshal_json, Types.Instance(UnionMarshalJSON).optional |
| @@ -20043,6 +20101,7 @@ class TopLevel < Dry::Struct | ||
| 20043 | 20101 | locale: d.key?("Locale") ? UnionLocale.from_dynamic!(d["Locale"]) : nil, |
| 20044 | 20102 | lock: d.key?("lock") ? UnionLock.from_dynamic!(d["lock"]) : nil, |
| 20045 | 20103 | long: d.key?("long") ? UnionLong.from_dynamic!(d["long"]) : nil, |
| 20104 | + make_dict_encoder: d.key?("makeDictEncoder") ? UnionMakeDictEncoder.from_dynamic!(d["makeDictEncoder"]) : nil, | |
| 20046 | 20105 | map: d.key?("map") ? UnionMap.from_dynamic!(d["map"]) : nil, |
| 20047 | 20106 | map_entry: d.key?("MapEntry") ? UnionMapEntry.from_dynamic!(d["MapEntry"]) : nil, |
| 20048 | 20107 | marshal_json: d.key?("MarshalJSON") ? UnionMarshalJSON.from_dynamic!(d["MarshalJSON"]) : nil, |
| @@ -20395,6 +20454,7 @@ class TopLevel < Dry::Struct | ||
| 20395 | 20454 | "Locale" => locale&.to_dynamic, |
| 20396 | 20455 | "lock" => lock&.to_dynamic, |
| 20397 | 20456 | "long" => long&.to_dynamic, |
| 20457 | + "makeDictEncoder" => make_dict_encoder&.to_dynamic, | |
| 20398 | 20458 | "map" => map&.to_dynamic, |
| 20399 | 20459 | "MapEntry" => map_entry&.to_dynamic, |
| 20400 | 20460 | "MarshalJSON" => marshal_json&.to_dynamic, |
Mschema-rustdefault / module_under_test.rs+15 −0
| @@ -446,6 +446,9 @@ pub struct TopLevel { | ||
| 446 | 446 | |
| 447 | 447 | pub long: Option<UnionLong>, |
| 448 | 448 | |
| 449 | + #[serde(rename = "makeDictEncoder")] | |
| 450 | + pub make_dict_encoder: Option<UnionMakeDictEncoder>, | |
| 451 | + | |
| 449 | 452 | pub map: Option<UnionMap>, |
| 450 | 453 | |
| 451 | 454 | #[serde(rename = "MapEntry")] |
| @@ -2712,6 +2715,18 @@ pub enum UnionLong { | ||
| 2712 | 2715 | pub struct Long { |
| 2713 | 2716 | } |
| 2714 | 2717 | |
| 2718 | +#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 2719 | +#[serde(untagged)] | |
| 2720 | +pub enum UnionMakeDictEncoder { | |
| 2721 | + Double(f64), | |
| 2722 | + | |
| 2723 | + MakeDictEncoder(MakeDictEncoder), | |
| 2724 | +} | |
| 2725 | + | |
| 2726 | +#[derive(Debug, Clone, Serialize, Deserialize)] | |
| 2727 | +pub struct MakeDictEncoder { | |
| 2728 | +} | |
| 2729 | + | |
| 2715 | 2730 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 2716 | 2731 | #[serde(untagged)] |
| 2717 | 2732 | pub enum UnionMap { |
Mschema-schemadefault / TopLevel.schema+19 −0
| @@ -552,6 +552,9 @@ | ||
| 552 | 552 | "long": { |
| 553 | 553 | "$ref": "#/definitions/UnionLong" |
| 554 | 554 | }, |
| 555 | + "makeDictEncoder": { | |
| 556 | + "$ref": "#/definitions/UnionMakeDictEncoder" | |
| 557 | + }, | |
| 555 | 558 | "map": { |
| 556 | 559 | "$ref": "#/definitions/UnionMap" |
| 557 | 560 | }, |
| @@ -2114,6 +2117,11 @@ | ||
| 2114 | 2117 | "additionalProperties": false, |
| 2115 | 2118 | "title": "Long" |
| 2116 | 2119 | }, |
| 2120 | + "MakeDictEncoder": { | |
| 2121 | + "type": "object", | |
| 2122 | + "additionalProperties": false, | |
| 2123 | + "title": "MakeDictEncoder" | |
| 2124 | + }, | |
| 2117 | 2125 | "Map": { |
| 2118 | 2126 | "type": "object", |
| 2119 | 2127 | "additionalProperties": false, |
| @@ -5114,6 +5122,17 @@ | ||
| 5114 | 5122 | ], |
| 5115 | 5123 | "title": "UnionLong" |
| 5116 | 5124 | }, |
| 5125 | + "UnionMakeDictEncoder": { | |
| 5126 | + "anyOf": [ | |
| 5127 | + { | |
| 5128 | + "$ref": "#/definitions/MakeDictEncoder" | |
| 5129 | + }, | |
| 5130 | + { | |
| 5131 | + "type": "number" | |
| 5132 | + } | |
| 5133 | + ], | |
| 5134 | + "title": "UnionMakeDictEncoder" | |
| 5135 | + }, | |
| 5117 | 5136 | "UnionMap": { |
| 5118 | 5137 | "anyOf": [ |
| 5119 | 5138 | { |
Mschema-swiftdefault / quicktype.swift+75 −0
| @@ -189,6 +189,7 @@ struct TopLevel: Codable { | ||
| 189 | 189 | let locale: UnionLocale? |
| 190 | 190 | let lock: UnionLock? |
| 191 | 191 | let long: UnionLong? |
| 192 | + let makeDictEncoder: UnionMakeDictEncoder? | |
| 192 | 193 | let map: UnionMap? |
| 193 | 194 | let mapEntry: UnionMapEntry? |
| 194 | 195 | let marshalJSON: UnionMarshalJSON? |
| @@ -534,6 +535,7 @@ struct TopLevel: Codable { | ||
| 534 | 535 | case locale = "Locale" |
| 535 | 536 | case lock = "lock" |
| 536 | 537 | case long = "long" |
| 538 | + case makeDictEncoder = "makeDictEncoder" | |
| 537 | 539 | case map = "map" |
| 538 | 540 | case mapEntry = "MapEntry" |
| 539 | 541 | case marshalJSON = "MarshalJSON" |
| @@ -899,6 +901,7 @@ extension TopLevel { | ||
| 899 | 901 | locale: UnionLocale?? = nil, |
| 900 | 902 | lock: UnionLock?? = nil, |
| 901 | 903 | long: UnionLong?? = nil, |
| 904 | + makeDictEncoder: UnionMakeDictEncoder?? = nil, | |
| 902 | 905 | map: UnionMap?? = nil, |
| 903 | 906 | mapEntry: UnionMapEntry?? = nil, |
| 904 | 907 | marshalJSON: UnionMarshalJSON?? = nil, |
| @@ -1244,6 +1247,7 @@ extension TopLevel { | ||
| 1244 | 1247 | locale: locale ?? self.locale, |
| 1245 | 1248 | lock: lock ?? self.lock, |
| 1246 | 1249 | long: long ?? self.long, |
| 1250 | + makeDictEncoder: makeDictEncoder ?? self.makeDictEncoder, | |
| 1247 | 1251 | map: map ?? self.map, |
| 1248 | 1252 | mapEntry: mapEntry ?? self.mapEntry, |
| 1249 | 1253 | marshalJSON: marshalJSON ?? self.marshalJSON, |
| @@ -11073,6 +11077,77 @@ extension Long { | ||
| 11073 | 11077 | } |
| 11074 | 11078 | } |
| 11075 | 11079 | |
| 11080 | +enum UnionMakeDictEncoder: Codable { | |
| 11081 | + case double(Double) | |
| 11082 | + case makeDictEncoder(MakeDictEncoder) | |
| 11083 | + | |
| 11084 | + init(from decoder: Decoder) throws { | |
| 11085 | + let container = try decoder.singleValueContainer() | |
| 11086 | + if let x = try? container.decode(Double.self) { | |
| 11087 | + self = .double(x) | |
| 11088 | + return | |
| 11089 | + } | |
| 11090 | + if let x = try? container.decode(MakeDictEncoder.self) { | |
| 11091 | + self = .makeDictEncoder(x) | |
| 11092 | + return | |
| 11093 | + } | |
| 11094 | + throw DecodingError.typeMismatch(UnionMakeDictEncoder.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "Wrong type for UnionMakeDictEncoder")) | |
| 11095 | + } | |
| 11096 | + | |
| 11097 | + func encode(to encoder: Encoder) throws { | |
| 11098 | + var container = encoder.singleValueContainer() | |
| 11099 | + switch self { | |
| 11100 | + case .double(let x): | |
| 11101 | + try container.encode(x) | |
| 11102 | + case .makeDictEncoder(let x): | |
| 11103 | + try container.encode(x) | |
| 11104 | + } | |
| 11105 | + } | |
| 11106 | +} | |
| 11107 | + | |
| 11108 | +// MARK: - MakeDictEncoder | |
| 11109 | +struct MakeDictEncoder: Codable { | |
| 11110 | + private enum K: String, CodingKey { case unused } | |
| 11111 | + init(from decoder: Decoder) throws { | |
| 11112 | + _ = try decoder.container(keyedBy: K.self) | |
| 11113 | + } | |
| 11114 | + init() { | |
| 11115 | + } | |
| 11116 | +} | |
| 11117 | + | |
| 11118 | +// MARK: MakeDictEncoder convenience initializers and mutators | |
| 11119 | + | |
| 11120 | +extension MakeDictEncoder { | |
| 11121 | + init(data: Data) throws { | |
| 11122 | + self = try newJSONDecoder().decode(MakeDictEncoder.self, from: data) | |
| 11123 | + } | |
| 11124 | + | |
| 11125 | + init(_ json: String, using encoding: String.Encoding = .utf8) throws { | |
| 11126 | + guard let data = json.data(using: encoding) else { | |
| 11127 | + throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil) | |
| 11128 | + } | |
| 11129 | + try self.init(data: data) | |
| 11130 | + } | |
| 11131 | + | |
| 11132 | + init(fromURL url: URL) throws { | |
| 11133 | + try self.init(data: try Data(contentsOf: url)) | |
| 11134 | + } | |
| 11135 | + | |
| 11136 | + func with( | |
| 11137 | + ) -> MakeDictEncoder { | |
| 11138 | + return MakeDictEncoder( | |
| 11139 | + ) | |
| 11140 | + } | |
| 11141 | + | |
| 11142 | + func jsonData() throws -> Data { | |
| 11143 | + return try newJSONEncoder().encode(self) | |
| 11144 | + } | |
| 11145 | + | |
| 11146 | + func jsonString(encoding: String.Encoding = .utf8) throws -> String? { | |
| 11147 | + return String(data: try self.jsonData(), encoding: encoding) | |
| 11148 | + } | |
| 11149 | +} | |
| 11150 | + | |
| 11076 | 11151 | enum UnionMap: Codable { |
| 11077 | 11152 | case double(Double) |
| 11078 | 11153 | case map(Map) |
Mschema-typescript-effect-schemadefault / TopLevel.ts+4 −0
| @@ -499,6 +499,9 @@ export class MapEntry extends S.Class<MapEntry>("MapEntry")(S.Struct({}).pipe(S. | ||
| 499 | 499 | export class Map extends S.Class<Map>("Map")(S.Struct({}).pipe(S.filter(value => typeof value === "object" && value !== null && !Array.isArray(value))) |
| 500 | 500 | ) {} |
| 501 | 501 | |
| 502 | +export class MakeDictEncoder extends S.Class<MakeDictEncoder>("MakeDictEncoder")(S.Struct({}).pipe(S.filter(value => typeof value === "object" && value !== null && !Array.isArray(value))) | |
| 503 | +) {} | |
| 504 | + | |
| 502 | 505 | export class Long extends S.Class<Long>("Long")(S.Struct({}).pipe(S.filter(value => typeof value === "object" && value !== null && !Array.isArray(value))) |
| 503 | 506 | ) {} |
| 504 | 507 | |
| @@ -1210,6 +1213,7 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 1210 | 1213 | "Locale": S.optional(S.Union(S.Number, Locale)), |
| 1211 | 1214 | "lock": S.optional(S.Union(S.Number, Lock)), |
| 1212 | 1215 | "long": S.optional(S.Union(S.Number, Long)), |
| 1216 | + "makeDictEncoder": S.optional(S.Union(S.Number, MakeDictEncoder)), | |
| 1213 | 1217 | "map": S.optional(S.Union(S.Number, Map)), |
| 1214 | 1218 | "MapEntry": S.optional(S.Union(S.Number, MapEntry)), |
| 1215 | 1219 | "MarshalJSON": S.optional(S.Union(S.Number, MarshalJson)), |
Mschema-typescript-zoddefault / TopLevel.ts+5 −0
| @@ -705,6 +705,10 @@ export const LongSchema = z.object({ | ||
| 705 | 705 | }); |
| 706 | 706 | export type Long = z.infer<typeof LongSchema>; |
| 707 | 707 | |
| 708 | +export const MakeDictEncoderSchema = z.object({ | |
| 709 | +}); | |
| 710 | +export type MakeDictEncoder = z.infer<typeof MakeDictEncoderSchema>; | |
| 711 | + | |
| 708 | 712 | export const MapSchema = z.object({ |
| 709 | 713 | }); |
| 710 | 714 | export type Map = z.infer<typeof MapSchema>; |
| @@ -1552,6 +1556,7 @@ export const TopLevelSchema = z.preprocess(value => typeof value === "object" && | ||
| 1552 | 1556 | "Locale": z.union([LocaleSchema, z.number()]).optional(), |
| 1553 | 1557 | "lock": z.union([LockSchema, z.number()]).optional(), |
| 1554 | 1558 | "long": z.union([LongSchema, z.number()]).optional(), |
| 1559 | + "makeDictEncoder": z.union([MakeDictEncoderSchema, z.number()]).optional(), | |
| 1555 | 1560 | "map": z.union([MapSchema, z.number()]).optional(), |
| 1556 | 1561 | "MapEntry": z.union([MapEntrySchema, z.number()]).optional(), |
| 1557 | 1562 | "MarshalJSON": z.union([MarshalJsonSchema, z.number()]).optional(), |
Mschema-typescriptdefault / TopLevel.ts+6 −2
| @@ -190,6 +190,7 @@ export interface TopLevel { | ||
| 190 | 190 | Locale?: UnionLocale; |
| 191 | 191 | lock?: UnionLock; |
| 192 | 192 | long?: UnionLong; |
| 193 | + makeDictEncoder?: UnionMakeDictEncoder; | |
| 193 | 194 | map?: UnionMap; |
| 194 | 195 | MapEntry?: UnionMapEntry; |
| 195 | 196 | MarshalJSON?: UnionMarshalJSON; |
| @@ -784,6 +785,8 @@ export type UnionLock = object | number; | ||
| 784 | 785 | |
| 785 | 786 | export type UnionLong = object | number; |
| 786 | 787 | |
| 788 | +export type UnionMakeDictEncoder = object | number; | |
| 789 | + | |
| 787 | 790 | export type UnionMap = object | number; |
| 788 | 791 | |
| 789 | 792 | export type UnionMetadataPropertyHandling = object | number; |
| @@ -1134,7 +1137,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1134 | 1137 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 1135 | 1138 | return invalidValue(l(ref || "object"), val, key, parent); |
| 1136 | 1139 | } |
| 1137 | - const result: any = {}; | |
| 1140 | + const result: any = Object.create(null); | |
| 1138 | 1141 | Object.getOwnPropertyNames(props).forEach(key => { |
| 1139 | 1142 | const prop = props[key]; |
| 1140 | 1143 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -1145,7 +1148,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1145 | 1148 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 1146 | 1149 | } |
| 1147 | 1150 | }); |
| 1148 | - return result; | |
| 1151 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 1149 | 1152 | } |
| 1150 | 1153 | |
| 1151 | 1154 | if (typ === "any") return val; |
| @@ -1408,6 +1411,7 @@ const typeMap: any = { | ||
| 1408 | 1411 | { json: "Locale", js: "Locale", typ: u(undefined, u(m("any"), 3.14)) }, |
| 1409 | 1412 | { json: "lock", js: "lock", typ: u(undefined, u(m("any"), 3.14)) }, |
| 1410 | 1413 | { json: "long", js: "long", typ: u(undefined, u(m("any"), 3.14)) }, |
| 1414 | + { json: "makeDictEncoder", js: "makeDictEncoder", typ: u(undefined, u(m("any"), 3.14)) }, | |
| 1411 | 1415 | { json: "map", js: "map", typ: u(undefined, u(m("any"), 3.14)) }, |
| 1412 | 1416 | { json: "MapEntry", js: "MapEntry", typ: u(undefined, u(m("any"), 3.14)) }, |
| 1413 | 1417 | { json: "MarshalJSON", js: "MarshalJSON", typ: u(undefined, u(m("any"), 3.14)) }, |
Test case
3 generated files · +6 −6test/inputs/schema/light.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/list.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/min-max-items.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/minmax-integer.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/minmax.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/minmaxlength.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/multi-type-enum.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/mutually-recursive.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/nested-intersection-union.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/non-standard-ref.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/nullable-optional-one-of.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/object-type-required.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/optional-any.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/optional-const-ref.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 119 | 119 | return invalidValue(l(ref || "object"), val, key, parent); |
| 120 | 120 | } |
| 121 | - const result: any = {}; | |
| 121 | + const result: any = Object.create(null); | |
| 122 | 122 | Object.getOwnPropertyNames(props).forEach(key => { |
| 123 | 123 | const prop = props[key]; |
| 124 | 124 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 130 | 130 | } |
| 131 | 131 | }); |
| 132 | - return result; | |
| 132 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 119 | 119 | return invalidValue(l(ref || "object"), val, key, parent); |
| 120 | 120 | } |
| 121 | - const result: any = {}; | |
| 121 | + const result: any = Object.create(null); | |
| 122 | 122 | Object.getOwnPropertyNames(props).forEach(key => { |
| 123 | 123 | const prop = props[key]; |
| 124 | 124 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 130 | 130 | } |
| 131 | 131 | }); |
| 132 | - return result; | |
| 132 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/optional-constraints.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/optional-date-time.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/optional-enum.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/optional-property.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/pattern.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/postman-collection.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 119 | 119 | return invalidValue(l(ref || "object"), val, key, parent); |
| 120 | 120 | } |
| 121 | - const result: any = {}; | |
| 121 | + const result: any = Object.create(null); | |
| 122 | 122 | Object.getOwnPropertyNames(props).forEach(key => { |
| 123 | 123 | const prop = props[key]; |
| 124 | 124 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 130 | 130 | } |
| 131 | 131 | }); |
| 132 | - return result; | |
| 132 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 119 | 119 | return invalidValue(l(ref || "object"), val, key, parent); |
| 120 | 120 | } |
| 121 | - const result: any = {}; | |
| 121 | + const result: any = Object.create(null); | |
| 122 | 122 | Object.getOwnPropertyNames(props).forEach(key => { |
| 123 | 123 | const prop = props[key]; |
| 124 | 124 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 130 | 130 | } |
| 131 | 131 | }); |
| 132 | - return result; | |
| 132 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/prefix-items.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
4 generated files · +27 −9test/inputs/schema/recursive-union-flattening.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescript-effect-schemadefault / TopLevel.ts+21 −3
| @@ -1,13 +1,31 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class XClass extends S.Class<XClass>("XClass")({ |
| 5 | - "x": S.optional(S.Union(S.Array(S.Union(S.Array(S.Any), S.Boolean, S.Number, S.String, S.suspend(() => XClass), S.Null)), S.Boolean, S.Number, S.Record({ key: S.String, value: S.Any}), S.String, S.Null)), | |
| 23 | + "x": S.optional(S.Union(S.Array(S.Union(S.Array(S.Any), S.Boolean, S.Number, S.String, S.suspend(() => XClass), S.Null)), S.Boolean, S.Number, mapSchema(S.Any), S.String, S.Null)), | |
| 6 | 24 | }) {} |
| 7 | 25 | |
| 8 | 26 | export class TopLevelClass extends S.Class<TopLevelClass>("TopLevelClass")({ |
| 9 | - "x": S.optional(S.Union(S.Array(S.Union(S.Array(S.Any), S.Boolean, S.Number, S.String, XClass, S.Null)), S.Boolean, S.Number, S.Record({ key: S.String, value: S.Any}), S.String, S.Null)), | |
| 27 | + "x": S.optional(S.Union(S.Array(S.Union(S.Array(S.Any), S.Boolean, S.Number, S.String, XClass, S.Null)), S.Boolean, S.Number, mapSchema(S.Any), S.String, S.Null)), | |
| 10 | 28 | }) {} |
| 11 | 29 | |
| 12 | -export const TopLevel = S.Union(S.Array(S.Union(S.Array(S.Any), S.Boolean, S.Number, S.String, TopLevelClass, S.Null)), S.Boolean, S.Number, S.Int, S.Record({ key: S.String, value: S.Any}), S.String, S.Null); | |
| 30 | +export const TopLevel = S.Union(S.Array(S.Union(S.Array(S.Any), S.Boolean, S.Number, S.String, TopLevelClass, S.Null)), S.Boolean, S.Number, S.Int, mapSchema(S.Any), S.String, S.Null); | |
| 13 | 31 | export type TopLevel = S.Schema.Type<typeof TopLevel>; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/ref-id-files.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/ref-remote.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/renaming-bug.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -210,7 +210,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 210 | 210 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 211 | 211 | return invalidValue(l(ref || "object"), val, key, parent); |
| 212 | 212 | } |
| 213 | - const result: any = {}; | |
| 213 | + const result: any = Object.create(null); | |
| 214 | 214 | Object.getOwnPropertyNames(props).forEach(key => { |
| 215 | 215 | const prop = props[key]; |
| 216 | 216 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -221,7 +221,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 221 | 221 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 222 | 222 | } |
| 223 | 223 | }); |
| 224 | - return result; | |
| 224 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -195,7 +195,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 195 | 195 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 196 | 196 | return invalidValue(l(ref || "object"), val, key, parent); |
| 197 | 197 | } |
| 198 | - const result: any = {}; | |
| 198 | + const result: any = Object.create(null); | |
| 199 | 199 | Object.getOwnPropertyNames(props).forEach(key => { |
| 200 | 200 | const prop = props[key]; |
| 201 | 201 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -206,7 +206,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 206 | 206 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 207 | 207 | } |
| 208 | 208 | }); |
| 209 | - return result; | |
| 209 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/required-draft3.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/required-non-properties.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/required.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/rust-cycle-breaker-union.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/schema-constraints.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/simple-ref.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/strict-optional.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/top-level-array.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/top-level-enum.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/top-level-primitive-array.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/top-level-primitive.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/tuple.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
5 generated files · +34 −8test/inputs/schema/unevaluated-properties.schema
Mschema-elmdefault / QuickType.elm+9 −1
| @@ -88,7 +88,7 @@ encodeConfig x = | ||
| 88 | 88 | Jenc.object |
| 89 | 89 | [ ("closed", makeNullableEncoder encodeClosed x.closed) |
| 90 | 90 | , ("name", makeNullableEncoder Jenc.string x.name) |
| 91 | - , ("settings", makeNullableEncoder (Jenc.dict identity (Jenc.list encodeItem)) x.settings) | |
| 91 | + , ("settings", makeNullableEncoder (makeDictEncoder identity (Jenc.list encodeItem)) x.settings) | |
| 92 | 92 | ] |
| 93 | 93 | |
| 94 | 94 | closed : Jdec.Decoder Closed |
| @@ -138,6 +138,14 @@ encodeItem x = | ||
| 138 | 138 | |
| 139 | 139 | --- encoder helpers |
| 140 | 140 | |
| 141 | +makeDictEncoder : (String -> String) -> (a -> Jenc.Value) -> Dict String a -> Jenc.Value | |
| 142 | +makeDictEncoder f m r = | |
| 143 | + r | |
| 144 | + |> Dict.toList | |
| 145 | + |> List.map (\( x, y ) -> Jenc.encode 0 (Jenc.string (f x)) ++ ":" ++ Jenc.encode 0 (m y)) | |
| 146 | + |> String.join "," | |
| 147 | + |> (\str -> Jdec.decodeString Jdec.value ("{" ++ str ++ "}") |> Result.withDefault Jenc.null) | |
| 148 | + | |
| 141 | 149 | makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value |
| 142 | 150 | makeNullableEncoder f m = |
| 143 | 151 | case m of |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 127 | 127 | return invalidValue(l(ref || "object"), val, key, parent); |
| 128 | 128 | } |
| 129 | - const result: any = {}; | |
| 129 | + const result: any = Object.create(null); | |
| 130 | 130 | Object.getOwnPropertyNames(props).forEach(key => { |
| 131 | 131 | const prop = props[key]; |
| 132 | 132 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -137,7 +137,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 137 | 137 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 138 | 138 | } |
| 139 | 139 | }); |
| 140 | - return result; | |
| 140 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescript-effect-schemadefault / TopLevel.ts+19 −1
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | |
| 4 | 22 | export class Item extends S.Class<Item>("Item")({ |
| 5 | 23 | "key": S.String, |
| @@ -12,7 +30,7 @@ export class ClosedClass extends S.Class<ClosedClass>("ClosedClass")(S.Struct({} | ||
| 12 | 30 | export class Config extends S.Class<Config>("Config")({ |
| 13 | 31 | "closed": S.optional(S.Union(S.Array(S.Any), S.Boolean, S.Number, S.Int, S.String, ClosedClass, S.Null)), |
| 14 | 32 | "name": S.optional(S.String), |
| 15 | - "settings": S.optional(S.Record({ key: S.String, value: S.Array(Item)})), | |
| 33 | + "settings": S.optional(mapSchema(S.Array(Item))), | |
| 16 | 34 | }) {} |
| 17 | 35 | |
| 18 | 36 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 124 | 124 | return invalidValue(l(ref || "object"), val, key, parent); |
| 125 | 125 | } |
| 126 | - const result: any = {}; | |
| 126 | + const result: any = Object.create(null); | |
| 127 | 127 | Object.getOwnPropertyNames(props).forEach(key => { |
| 128 | 128 | const prop = props[key]; |
| 129 | 129 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -134,7 +134,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 134 | 134 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 135 | 135 | } |
| 136 | 136 | }); |
| 137 | - return result; | |
| 137 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/unicode-codepoint-length.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/union-int-double.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/union-list.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/union.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/uuid.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 119 | 119 | return invalidValue(l(ref || "object"), val, key, parent); |
| 120 | 120 | } |
| 121 | - const result: any = {}; | |
| 121 | + const result: any = Object.create(null); | |
| 122 | 122 | Object.getOwnPropertyNames(props).forEach(key => { |
| 123 | 123 | const prop = props[key]; |
| 124 | 124 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 130 | 130 | } |
| 131 | 131 | }); |
| 132 | - return result; | |
| 132 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Test case
4 generated files · +35 −17test/inputs/schema/vega-lite.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -6199,7 +6199,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 6199 | 6199 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 6200 | 6200 | return invalidValue(l(ref || "object"), val, key, parent); |
| 6201 | 6201 | } |
| 6202 | - const result: any = {}; | |
| 6202 | + const result: any = Object.create(null); | |
| 6203 | 6203 | Object.getOwnPropertyNames(props).forEach(key => { |
| 6204 | 6204 | const prop = props[key]; |
| 6205 | 6205 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -6210,7 +6210,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 6210 | 6210 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 6211 | 6211 | } |
| 6212 | 6212 | }); |
| 6213 | - return result; | |
| 6213 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 6214 | 6214 | } |
| 6215 | 6215 | |
| 6216 | 6216 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescript-effect-schemadefault / TopLevel.ts+29 −11
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | +const objectSchema = <A>() => | |
| 4 | + S.declare( | |
| 5 | + (input): input is Record<string, A> => | |
| 6 | + typeof input === "object" && input !== null && !Array.isArray(input) | |
| 7 | + ); | |
| 8 | +const mapSchema = <A, I, R>(value: S.Schema<A, I, R>) => { | |
| 9 | + const entries = S.transform(objectSchema<unknown>(), S.Array(S.Tuple(S.String, value)), { | |
| 10 | + strict: false, | |
| 11 | + decode: Object.entries, | |
| 12 | + encode: Object.fromEntries | |
| 13 | + }); | |
| 14 | + return S.transform(entries, objectSchema<A>(), { | |
| 15 | + strict: false, | |
| 16 | + decode: Object.fromEntries, | |
| 17 | + encode: Object.entries | |
| 18 | + }); | |
| 19 | +}; | |
| 20 | + | |
| 3 | 21 | // Determines how size calculation should be performed, one of `"content"` or `"padding"`. |
| 4 | 22 | // The default setting (`"content"`) interprets the width and height settings as the data |
| 5 | 23 | // rectangle (plotting) dimensions, to which padding is then added. In contrast, the |
| @@ -642,7 +660,7 @@ export class Projection extends S.Class<Projection>("Projection")({ | ||
| 642 | 660 | "fraction": S.optional(S.Number), |
| 643 | 661 | "lobes": S.optional(S.Number), |
| 644 | 662 | "parallel": S.optional(S.Number), |
| 645 | - "precision": S.optional(S.Record({ key: S.String, value: S.Union(S.Number, S.String)})), | |
| 663 | + "precision": S.optional(mapSchema(S.Union(S.Number, S.String))), | |
| 646 | 664 | "radius": S.optional(S.Number), |
| 647 | 665 | "ratio": S.optional(S.Number), |
| 648 | 666 | "rotate": S.optional(S.Array(S.Number)), |
| @@ -789,7 +807,7 @@ export class Header extends S.Class<Header>("Header")({ | ||
| 789 | 807 | }) {} |
| 790 | 808 | |
| 791 | 809 | export class SelectionDef extends S.Class<SelectionDef>("SelectionDef")({ |
| 792 | - "bind": S.optional(S.Union(BindEnum, S.Record({ key: S.String, value: S.suspend(() => VgBinding)}))), | |
| 810 | + "bind": S.optional(S.Union(BindEnum, mapSchema(S.suspend(() => VgBinding)))), | |
| 793 | 811 | "empty": S.optional(Empty), |
| 794 | 812 | "encodings": S.optional(S.Array(SingleDefChannel)), |
| 795 | 813 | "fields": S.optional(S.Array(S.String)), |
| @@ -989,7 +1007,7 @@ export class EncodingWithFacet extends S.Class<EncodingWithFacet>("EncodingWithF | ||
| 989 | 1007 | }) {} |
| 990 | 1008 | |
| 991 | 1009 | export class DataFormat extends S.Class<DataFormat>("DataFormat")({ |
| 992 | - "parse": S.optional(S.Union(ParseEnum, S.Record({ key: S.String, value: S.Any}))), | |
| 1010 | + "parse": S.optional(S.Union(ParseEnum, mapSchema(S.Any))), | |
| 993 | 1011 | "type": S.optional(DataFormatType), |
| 994 | 1012 | "property": S.optional(S.String), |
| 995 | 1013 | "feature": S.optional(S.String), |
| @@ -999,7 +1017,7 @@ export class DataFormat extends S.Class<DataFormat>("DataFormat")({ | ||
| 999 | 1017 | export class Data extends S.Class<Data>("Data")({ |
| 1000 | 1018 | "format": S.optional(DataFormat), |
| 1001 | 1019 | "url": S.optional(S.String), |
| 1002 | - "values": S.optional(S.Union(S.Array(S.Union(S.Boolean, S.Number, S.Record({ key: S.String, value: S.Any}), S.String)), S.Record({ key: S.String, value: S.Any}), S.String)), | |
| 1020 | + "values": S.optional(S.Union(S.Array(S.Union(S.Boolean, S.Number, mapSchema(S.Any), S.String)), mapSchema(S.Any), S.String)), | |
| 1003 | 1021 | "name": S.optional(S.String), |
| 1004 | 1022 | }) {} |
| 1005 | 1023 | |
| @@ -1139,7 +1157,7 @@ export class VgBinding extends S.Class<VgBinding>("VgBinding")({ | ||
| 1139 | 1157 | }) {} |
| 1140 | 1158 | |
| 1141 | 1159 | export class SingleSelectionConfig extends S.Class<SingleSelectionConfig>("SingleSelectionConfig")({ |
| 1142 | - "bind": S.optional(S.Record({ key: S.String, value: VgBinding})), | |
| 1160 | + "bind": S.optional(mapSchema(VgBinding)), | |
| 1143 | 1161 | "empty": S.optional(Empty), |
| 1144 | 1162 | "encodings": S.optional(S.Array(SingleDefChannel)), |
| 1145 | 1163 | "fields": S.optional(S.Array(S.String)), |
| @@ -1237,7 +1255,7 @@ export class ProjectionConfig extends S.Class<ProjectionConfig>("ProjectionConfi | ||
| 1237 | 1255 | "fraction": S.optional(S.Number), |
| 1238 | 1256 | "lobes": S.optional(S.Number), |
| 1239 | 1257 | "parallel": S.optional(S.Number), |
| 1240 | - "precision": S.optional(S.Record({ key: S.String, value: S.Union(S.Number, S.String)})), | |
| 1258 | + "precision": S.optional(mapSchema(S.Union(S.Number, S.String))), | |
| 1241 | 1259 | "radius": S.optional(S.Number), |
| 1242 | 1260 | "ratio": S.optional(S.Number), |
| 1243 | 1261 | "rotate": S.optional(S.Array(S.Number)), |
| @@ -1474,14 +1492,14 @@ export class Config extends S.Class<Config>("Config")({ | ||
| 1474 | 1492 | "padding": S.optional(S.Union(S.Number, PaddingClass)), |
| 1475 | 1493 | "point": S.optional(MarkConfig), |
| 1476 | 1494 | "projection": S.optional(ProjectionConfig), |
| 1477 | - "range": S.optional(S.Record({ key: S.String, value: S.Union(S.Array(S.Union(S.Number, S.String)), VgScheme)})), | |
| 1495 | + "range": S.optional(mapSchema(S.Union(S.Array(S.Union(S.Number, S.String)), VgScheme))), | |
| 1478 | 1496 | "rect": S.optional(MarkConfig), |
| 1479 | 1497 | "rule": S.optional(MarkConfig), |
| 1480 | 1498 | "scale": S.optional(ScaleConfig), |
| 1481 | 1499 | "selection": S.optional(SelectionConfig), |
| 1482 | 1500 | "square": S.optional(MarkConfig), |
| 1483 | 1501 | "stack": S.optional(StackOffset), |
| 1484 | - "style": S.optional(S.Record({ key: S.String, value: VgMarkConfig})), | |
| 1502 | + "style": S.optional(mapSchema(VgMarkConfig)), | |
| 1485 | 1503 | "text": S.optional(TextConfig), |
| 1486 | 1504 | "tick": S.optional(TickConfig), |
| 1487 | 1505 | "timeFormat": S.optional(S.String), |
| @@ -1524,7 +1542,7 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 1524 | 1542 | "name": S.optional(S.String), |
| 1525 | 1543 | "padding": S.optional(S.Union(S.Number, PaddingClass)), |
| 1526 | 1544 | "projection": S.optional(Projection), |
| 1527 | - "selection": S.optional(S.Record({ key: S.String, value: SelectionDef})), | |
| 1545 | + "selection": S.optional(mapSchema(SelectionDef)), | |
| 1528 | 1546 | "title": S.optional(S.Union(S.String, TitleParams)), |
| 1529 | 1547 | "transform": S.optional(S.Array(Transform)), |
| 1530 | 1548 | "width": S.optional(S.Number), |
| @@ -1550,7 +1568,7 @@ export class Spec extends S.Class<Spec>("Spec")({ | ||
| 1550 | 1568 | "encoding": S.optional(Encoding), |
| 1551 | 1569 | "mark": S.optional(S.Union(Mark, MarkDef)), |
| 1552 | 1570 | "projection": S.optional(Projection), |
| 1553 | - "selection": S.optional(S.Record({ key: S.String, value: SelectionDef})), | |
| 1571 | + "selection": S.optional(mapSchema(SelectionDef)), | |
| 1554 | 1572 | "facet": S.optional(FacetMapping), |
| 1555 | 1573 | "spec": S.optional(S.suspend(() => Spec)), |
| 1556 | 1574 | "repeat": S.optional(Repeat), |
| @@ -1571,5 +1589,5 @@ export class LayerSpec extends S.Class<LayerSpec>("LayerSpec")({ | ||
| 1571 | 1589 | "encoding": S.optional(Encoding), |
| 1572 | 1590 | "mark": S.optional(S.Union(Mark, MarkDef)), |
| 1573 | 1591 | "projection": S.optional(Projection), |
| 1574 | - "selection": S.optional(S.Record({ key: S.String, value: SelectionDef})), | |
| 1592 | + "selection": S.optional(mapSchema(SelectionDef)), | |
| 1575 | 1593 | }) {} |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -5956,7 +5956,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 5956 | 5956 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 5957 | 5957 | return invalidValue(l(ref || "object"), val, key, parent); |
| 5958 | 5958 | } |
| 5959 | - const result: any = {}; | |
| 5959 | + const result: any = Object.create(null); | |
| 5960 | 5960 | Object.getOwnPropertyNames(props).forEach(key => { |
| 5961 | 5961 | const prop = props[key]; |
| 5962 | 5962 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -5967,7 +5967,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 5967 | 5967 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 5968 | 5968 | } |
| 5969 | 5969 | }); |
| 5970 | - return result; | |
| 5970 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 5971 | 5971 | } |
| 5972 | 5972 | |
| 5973 | 5973 | if (typ === "any") return val; |
No generated files match these filters.