mirror of
https://github.com/immich-app/immich.git
synced 2024-12-22 01:47:08 +02:00
57 lines
2.3 KiB
Diff
57 lines
2.3 KiB
Diff
--- native_class.mustache 2023-08-31 23:09:59.584269162 +0200
|
|
+++ native_class1.mustache 2023-08-31 22:59:53.633083270 +0200
|
|
@@ -91,14 +91,14 @@
|
|
{{/isDateTime}}
|
|
{{#isNullable}}
|
|
} else {
|
|
- json[r'{{{baseName}}}'] = null;
|
|
+ // json[r'{{{baseName}}}'] = null;
|
|
}
|
|
{{/isNullable}}
|
|
{{^isNullable}}
|
|
{{^required}}
|
|
{{^defaultValue}}
|
|
} else {
|
|
- json[r'{{{baseName}}}'] = null;
|
|
+ // json[r'{{{baseName}}}'] = null;
|
|
}
|
|
{{/defaultValue}}
|
|
{{/required}}
|
|
@@ -114,17 +114,6 @@
|
|
if (value is Map) {
|
|
final json = value.cast<String, dynamic>();
|
|
|
|
- // Ensure that the map contains the required keys.
|
|
- // Note 1: the values aren't checked for validity beyond being non-null.
|
|
- // Note 2: this code is stripped in release mode!
|
|
- assert(() {
|
|
- requiredKeys.forEach((key) {
|
|
- assert(json.containsKey(key), 'Required key "{{{classname}}}[$key]" is missing from JSON.');
|
|
- assert(json[key] != null, 'Required key "{{{classname}}}[$key]" has a null value in JSON.');
|
|
- });
|
|
- return true;
|
|
- }());
|
|
-
|
|
return {{{classname}}}(
|
|
{{#vars}}
|
|
{{#isDateTime}}
|
|
@@ -215,6 +204,10 @@
|
|
? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}
|
|
: {{{datatypeWithEnum}}}.parse(json[r'{{{baseName}}}'].toString()),
|
|
{{/isNumber}}
|
|
+ {{#isDouble}}
|
|
+ {{{name}}}: (mapValueOfType<num>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}).toDouble(),
|
|
+ {{/isDouble}}
|
|
+ {{^isDouble}}
|
|
{{^isNumber}}
|
|
{{^isEnum}}
|
|
{{{name}}}: mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
|
|
@@ -223,6 +216,7 @@
|
|
{{{name}}}: {{{enumName}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
|
|
{{/isEnum}}
|
|
{{/isNumber}}
|
|
+ {{/isDouble}}
|
|
{{/isMap}}
|
|
{{/isArray}}
|
|
{{/complexType}}
|