Compare commits

...

5 Commits

Author SHA1 Message Date
timonrieger 131b5f1937 gen client 2026-06-08 20:42:55 +02:00
timonrieger 03ef4b385b bump openapi-generator version to v7.23.0 2026-06-08 20:42:55 +02:00
timonrieger 1d00e6a420 remove patch in favor of [OpenAPITools/openapi-generator#23930](https://github.com/OpenAPITools/openapi-generator/issues/23930)
partially revert "chore(mobile): make openapi requests abortable (#28692)"
2026-06-08 20:42:55 +02:00
timonrieger 39f142d5cd remove patch in favor of OpenAPITools/openapi-generator#23365 2026-06-08 20:42:55 +02:00
timonrieger 82a24f0583 remove patch in favor of OpenAPITools/openapi-generator#23811 2026-06-08 20:42:55 +02:00
10 changed files with 24 additions and 273 deletions
+1 -1
View File
@@ -1 +1 @@
7.22.0 7.23.0
+1 -1
View File
@@ -4,7 +4,7 @@ Immich API
This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 3.0.0 - API version: 3.0.0
- Generator version: 7.22.0 - Generator version: 7.23.0
- Build package: org.openapitools.codegen.languages.DartClientCodegen - Build package: org.openapitools.codegen.languages.DartClientCodegen
## Requirements ## Requirements
+2 -2
View File
@@ -97,9 +97,9 @@ class ApiClient {
if (nullableHeaderParams != null) { if (nullableHeaderParams != null) {
request.headers.addAll(nullableHeaderParams); request.headers.addAll(nullableHeaderParams);
} }
if (msgBody is String) { if (msgBody is String && msgBody.isNotEmpty) {
request.body = msgBody; request.body = msgBody;
} else if (msgBody is List<int>) { } else if (msgBody is List<int> && msgBody.isNotEmpty) {
request.bodyBytes = msgBody; request.bodyBytes = msgBody;
} else if (msgBody is Map<String, String>) { } else if (msgBody is Map<String, String>) {
request.bodyFields = msgBody; request.bodyFields = msgBody;
@@ -35,16 +35,16 @@ class TimeBucketAssetResponseDto {
}); });
/// Array of city names extracted from EXIF GPS data /// Array of city names extracted from EXIF GPS data
Optional<List<String>?> city; Optional<List<String?>?> city;
/// Array of country names extracted from EXIF GPS data /// Array of country names extracted from EXIF GPS data
Optional<List<String>?> country; Optional<List<String?>?> country;
/// Array of UTC timestamps when each asset was originally uploaded to Immich /// Array of UTC timestamps when each asset was originally uploaded to Immich
List<String> createdAt; List<String> createdAt;
/// Array of video/gif durations in milliseconds (null for static images) /// Array of video/gif durations in milliseconds (null for static images)
List<int> duration; List<int?> duration;
/// Array of file creation timestamps in UTC /// Array of file creation timestamps in UTC
List<String> fileCreatedAt; List<String> fileCreatedAt;
@@ -62,22 +62,22 @@ class TimeBucketAssetResponseDto {
List<bool> isTrashed; List<bool> isTrashed;
/// Array of latitude coordinates extracted from EXIF GPS data /// Array of latitude coordinates extracted from EXIF GPS data
Optional<List<num>?> latitude; Optional<List<num?>?> latitude;
/// Array of live photo video asset IDs (null for non-live photos) /// Array of live photo video asset IDs (null for non-live photos)
List<String> livePhotoVideoId; List<String?> livePhotoVideoId;
/// Array of UTC offset hours at the time each photo was taken. Positive values are east of UTC, negative values are west of UTC. Values may be fractional (e.g., 5.5 for +05:30, -9.75 for -09:45). Applying this offset to 'fileCreatedAt' will give you the time the photo was taken from the photographer's perspective. /// Array of UTC offset hours at the time each photo was taken. Positive values are east of UTC, negative values are west of UTC. Values may be fractional (e.g., 5.5 for +05:30, -9.75 for -09:45). Applying this offset to 'fileCreatedAt' will give you the time the photo was taken from the photographer's perspective.
List<num> localOffsetHours; List<num> localOffsetHours;
/// Array of longitude coordinates extracted from EXIF GPS data /// Array of longitude coordinates extracted from EXIF GPS data
Optional<List<num>?> longitude; Optional<List<num?>?> longitude;
/// Array of owner IDs for each asset /// Array of owner IDs for each asset
List<String> ownerId; List<String> ownerId;
/// Array of projection types for 360° content (e.g., \"EQUIRECTANGULAR\", \"CUBEFACE\", \"CYLINDRICAL\") /// Array of projection types for 360° content (e.g., \"EQUIRECTANGULAR\", \"CUBEFACE\", \"CYLINDRICAL\")
List<String> projectionType; List<String?> projectionType;
/// Array of aspect ratios (width/height) for each asset /// Array of aspect ratios (width/height) for each asset
List<num> ratio; List<num> ratio;
@@ -86,7 +86,7 @@ class TimeBucketAssetResponseDto {
Optional<List<List<String>?>?> stack; Optional<List<List<String>?>?> stack;
/// Array of BlurHash strings for generating asset previews (base64 encoded) /// Array of BlurHash strings for generating asset previews (base64 encoded)
List<String> thumbhash; List<String?> thumbhash;
/// Array of visibility statuses for each asset (e.g., ARCHIVE, TIMELINE, HIDDEN, LOCKED) /// Array of visibility statuses for each asset (e.g., ARCHIVE, TIMELINE, HIDDEN, LOCKED)
List<AssetVisibility> visibility; List<AssetVisibility> visibility;
+1 -2
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
OPENAPI_GENERATOR_VERSION=v7.22.0 OPENAPI_GENERATOR_VERSION=v7.23.0
set -euo pipefail set -euo pipefail
@@ -23,7 +23,6 @@ patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api_client.dart <./patch/
patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api.dart <./patch/api.dart.patch patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api.dart <./patch/api.dart.patch
patch --no-backup-if-mismatch -u ../mobile/openapi/pubspec.yaml <./patch/pubspec_immich_mobile.yaml.patch patch --no-backup-if-mismatch -u ../mobile/openapi/pubspec.yaml <./patch/pubspec_immich_mobile.yaml.patch
patch --no-backup-if-mismatch -u ../mobile/openapi/lib/model/asset_edit_action_item_dto.dart <./patch/asset_edit_action_item_dto.dart.patch patch --no-backup-if-mismatch -u ../mobile/openapi/lib/model/asset_edit_action_item_dto.dart <./patch/asset_edit_action_item_dto.dart.patch
patch --no-backup-if-mismatch -u ../mobile/openapi/lib/model/time_bucket_asset_response_dto.dart <./patch/time_bucket_asset_response_dto.dart.patch
# Don't include analysis_options.yaml for the generated openapi files # Don't include analysis_options.yaml for the generated openapi files
# so that language servers can properly exclude the mobile/openapi directory # so that language servers can properly exclude the mobile/openapi directory
rm ../mobile/openapi/analysis_options.yaml rm ../mobile/openapi/analysis_options.yaml
+1 -1
View File
@@ -2,6 +2,6 @@
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2, "spaces": 2,
"generator-cli": { "generator-cli": {
"version": "7.22.0" "version": "7.23.0"
} }
} }
+7 -73
View File
@@ -1,96 +1,30 @@
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
class ApiClient { class ApiClient {
ApiClient({this.basePath = '/api', this.authentication,}); ApiClient({this.basePath = '/api', this.authentication,});
- final String basePath; - final String basePath;
+ String basePath; + String basePath;
final Authentication? authentication; final Authentication? authentication;
var _client = Client(); var _client = Client();
@@ -44,8 +44,9 @@ @@ -143,19 +143,19 @@
Object? body, );
Map<String, String> headerParams,
Map<String, String> formParams,
- String? contentType,
- ) async {
+ String? contentType, {
+ Future<void>? abortTrigger,
+ }) async {
await authentication?.applyToParams(queryParams, headerParams);
headerParams.addAll(_defaultHeaderMap);
@@ -63,7 +64,7 @@
body is MultipartFile && (contentType == null ||
!contentType.toLowerCase().startsWith('multipart/form-data'))
) {
- final request = StreamedRequest(method, uri);
+ final request = AbortableStreamedRequest(method, uri, abortTrigger: abortTrigger);
request.headers.addAll(headerParams);
request.contentLength = body.length;
body.finalize().listen(
@@ -78,7 +79,7 @@
}
if (body is MultipartRequest) {
- final request = MultipartRequest(method, uri);
+ final request = AbortableMultipartRequest(method, uri, abortTrigger: abortTrigger);
request.fields.addAll(body.fields);
request.files.addAll(body.files);
request.headers.addAll(body.headers);
@@ -92,14 +93,19 @@
: await serializeAsync(body);
final nullableHeaderParams = headerParams.isEmpty ? null : headerParams;
- switch(method) {
- case 'POST': return await _client.post(uri, headers: nullableHeaderParams, body: msgBody,);
- case 'PUT': return await _client.put(uri, headers: nullableHeaderParams, body: msgBody,);
- case 'DELETE': return await _client.delete(uri, headers: nullableHeaderParams, body: msgBody,);
- case 'PATCH': return await _client.patch(uri, headers: nullableHeaderParams, body: msgBody,);
- case 'HEAD': return await _client.head(uri, headers: nullableHeaderParams,);
- case 'GET': return await _client.get(uri, headers: nullableHeaderParams,);
+ final request = AbortableRequest(method, uri, abortTrigger: abortTrigger);
+ if (nullableHeaderParams != null) {
+ request.headers.addAll(nullableHeaderParams);
}
+ if (msgBody is String) {
+ request.body = msgBody;
+ } else if (msgBody is List<int>) {
+ request.bodyBytes = msgBody;
+ } else if (msgBody is Map<String, String>) {
+ request.bodyFields = msgBody;
+ }
+ final response = await _client.send(request);
+ return Response.fromStream(response);
} on SocketException catch (error, trace) {
throw ApiException.withInner(
HttpStatus.badRequest,
@@ -136,26 +146,21 @@
trace,
);
}
-
- throw ApiException(
- HttpStatus.badRequest,
- 'Invalid HTTP operation: $method $path',
- );
} }
- Future<dynamic> deserializeAsync(String value, String targetType, {bool growable = false,}) async => - Future<dynamic> deserializeAsync(String value, String targetType, {bool growable = false,}) async =>
+ Future<dynamic> deserializeAsync(String value, String targetType, {bool growable = false,}) => + Future<dynamic> deserializeAsync(String value, String targetType, {bool growable = false,}) =>
// ignore: deprecated_member_use_from_same_package // ignore: deprecated_member_use_from_same_package
deserialize(value, targetType, growable: growable); deserialize(value, targetType, growable: growable);
@Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.') @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.')
- dynamic deserialize(String value, String targetType, {bool growable = false,}) { - dynamic deserialize(String value, String targetType, {bool growable = false,}) {
+ Future<dynamic> deserialize(String value, String targetType, {bool growable = false,}) async { + Future<dynamic> deserialize(String value, String targetType, {bool growable = false,}) async {
// Remove all spaces. Necessary for regular expressions as well. // Remove all spaces. Necessary for regular expressions as well.
targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments
// If the expected target type is String, nothing to do... // If the expected target type is String, nothing to do...
return targetType == 'String' return targetType == 'String'
? value ? value
- : fromJson(json.decode(value), targetType, growable: growable); - : fromJson(json.decode(value), targetType, growable: growable);
+ : fromJson(await compute((String j) => json.decode(j), value), targetType, growable: growable); + : fromJson(await compute((String j) => json.decode(j), value), targetType, growable: growable);
} }
// ignore: deprecated_member_use_from_same_package
@@ -1,9 +0,0 @@
@@ -83,7 +83,7 @@
List<num> ratio;
/// Array of stack information as [stackId, assetCount] tuples (null for non-stacked assets)
- Optional<List<List<String>>?> stack;
+ Optional<List<List<String>?>?> stack;
/// Array of BlurHash strings for generating asset previews (base64 encoded)
List<String> thumbhash;
+3 -24
View File
@@ -1,11 +1,8 @@
--- api.mustache --- api.mustache
+++ api.mustache.modified +++ api.mustache.modified
@@ -49,9 +49,9 @@ @@ -51,7 +51,7 @@
///
{{/-last}}
{{/allParams}} {{/allParams}}
- Future<Response> {{{nickname}}}WithHttpInfo({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}}? {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async { Future<Response> {{{nickname}}}WithHttpInfo({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}}? {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async {
+ Future<Response> {{{nickname}}}WithHttpInfo({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}}, {{/required}}{{/allParams}}{ {{#allParams}}{{^required}}{{{dataType}}}? {{{paramName}}}, {{/required}}{{/allParams}}Future<void>? abortTrigger, }) async {
// ignore: prefer_const_declarations // ignore: prefer_const_declarations
- final path = r'{{{path}}}'{{#pathParams}} - final path = r'{{{path}}}'{{#pathParams}}
+ final apiPath = r'{{{path}}}'{{#pathParams}} + final apiPath = r'{{{path}}}'{{#pathParams}}
@@ -21,7 +18,7 @@
{{#formParams}} {{#formParams}}
{{^isFile}} {{^isFile}}
if ({{{paramName}}} != null) { if ({{{paramName}}} != null) {
@@ -121,13 +121,14 @@ @@ -121,7 +121,7 @@
{{/isMultipart}} {{/isMultipart}}
return apiClient.invokeAPI( return apiClient.invokeAPI(
@@ -30,21 +27,3 @@
'{{{httpMethod}}}', '{{{httpMethod}}}',
queryParams, queryParams,
postBody, postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
+ abortTrigger: abortTrigger,
);
}
@@ -161,8 +162,8 @@
///
{{/-last}}
{{/allParams}}
- Future<{{#returnType}}{{{.}}}?{{/returnType}}{{^returnType}}void{{/returnType}}> {{{nickname}}}({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}}? {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async {
- final response = await {{{nickname}}}WithHttpInfo({{#allParams}}{{#required}}{{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}} {{#allParams}}{{^required}}{{{paramName}}}: {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}} {{/hasOptionalParams}});
+ Future<{{#returnType}}{{{.}}}?{{/returnType}}{{^returnType}}void{{/returnType}}> {{{nickname}}}({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}}, {{/required}}{{/allParams}}{ {{#allParams}}{{^required}}{{{dataType}}}? {{{paramName}}}, {{/required}}{{/allParams}}Future<void>? abortTrigger, }) async {
+ final response = await {{{nickname}}}WithHttpInfo({{#allParams}}{{#required}}{{{paramName}}}, {{/required}}{{/allParams}}{{#allParams}}{{^required}}{{{paramName}}}: {{{paramName}}}, {{/required}}{{/allParams}}abortTrigger: abortTrigger,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
@@ -26,155 +26,3 @@
return {{{classname}}}( return {{{classname}}}(
{{#vars}} {{#vars}}
{{#isDateTime}} {{#isDateTime}}
@@ -195,48 +181,98 @@
{{#complexType}}
{{#isArray}}
{{#items.isArray}}
+ {{#vendorExtensions.x-is-optional}}
+ {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(json[r'{{{baseName}}}'] is List
+ ? (json[r'{{{baseName}}}'] as List).map((e) =>
+ {{#items.complexType}}
+ e == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.complexType}}>[]{{/items.isNullable}} : {{items.complexType}}.listFromJson(e){{#uniqueItems}}.toSet(){{/uniqueItems}}
+ {{/items.complexType}}
+ {{^items.complexType}}
+ e == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}>[]{{/items.isNullable}} : (e as List).map((value) => value as {{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}).toList(growable: false)
+ {{/items.complexType}}
+ ).toList()
+ : {{#isNullable}}null{{/isNullable}}{{^isNullable}}const []{{/isNullable}}) : const Optional.absent(),
+ {{/vendorExtensions.x-is-optional}}
+ {{^vendorExtensions.x-is-optional}}
{{{name}}}: json[r'{{{baseName}}}'] is List
? (json[r'{{{baseName}}}'] as List).map((e) =>
{{#items.complexType}}
- {{items.complexType}}.listFromJson(json[r'{{{baseName}}}']){{#uniqueItems}}.toSet(){{/uniqueItems}}
+ e == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.complexType}}>[]{{/items.isNullable}} : {{items.complexType}}.listFromJson(e){{#uniqueItems}}.toSet(){{/uniqueItems}}
{{/items.complexType}}
{{^items.complexType}}
- e == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.items.dataType}}>[]{{/items.isNullable}} : (e as List).cast<{{items.items.dataType}}>()
+ e == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}>[]{{/items.isNullable}} : (e as List).map((value) => value as {{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}).toList(growable: false)
{{/items.complexType}}
).toList()
: {{#isNullable}}null{{/isNullable}}{{^isNullable}}const []{{/isNullable}},
+ {{/vendorExtensions.x-is-optional}}
{{/items.isArray}}
{{^items.isArray}}
+ {{#vendorExtensions.x-is-optional}}
+ {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present({{{complexType}}}.listFromJson(json[r'{{{baseName}}}']){{#uniqueItems}}.toSet(){{/uniqueItems}}) : const Optional.absent(),
+ {{/vendorExtensions.x-is-optional}}
+ {{^vendorExtensions.x-is-optional}}
{{{name}}}: {{{complexType}}}.listFromJson(json[r'{{{baseName}}}']){{#uniqueItems}}.toSet(){{/uniqueItems}},
+ {{/vendorExtensions.x-is-optional}}
{{/items.isArray}}
{{/isArray}}
{{^isArray}}
{{#isMap}}
{{#items.isArray}}
+ {{#vendorExtensions.x-is-optional}}
+ {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(json[r'{{{baseName}}}'] == null ? null
+ {{#items.complexType}}
+ : {{items.complexType}}.mapListFromJson(json[r'{{{baseName}}}'])) : const Optional.absent(),
+ {{/items.complexType}}
+ {{^items.complexType}}
+ : (json[r'{{{baseName}}}'] as Map<String, dynamic>).map((k, v) => MapEntry(k, v == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}>[]{{/items.isNullable}} : (v as List).map((value) => value as {{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}).toList(growable: false)))) : const Optional.absent(),
+ {{/items.complexType}}
+ {{/vendorExtensions.x-is-optional}}
+ {{^vendorExtensions.x-is-optional}}
{{{name}}}: json[r'{{{baseName}}}'] == null
? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}
- {{#items.complexType}}
+ {{#items.complexType}}
: {{items.complexType}}.mapListFromJson(json[r'{{{baseName}}}']),
- {{/items.complexType}}
- {{^items.complexType}}
- : (json[r'{{{baseName}}}'] as Map<String, dynamic>).map((k, v) => MapEntry(k, v == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.items.dataType}}>[]{{/items.isNullable}} : (v as List).cast<{{items.items.dataType}}>())),
- {{/items.complexType}}
+ {{/items.complexType}}
+ {{^items.complexType}}
+ : (json[r'{{{baseName}}}'] as Map<String, dynamic>).map((k, v) => MapEntry(k, v == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}>[]{{/items.isNullable}} : (v as List).map((value) => value as {{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}).toList(growable: false))),
+ {{/items.complexType}}
+ {{/vendorExtensions.x-is-optional}}
{{/items.isArray}}
{{^items.isArray}}
{{#items.isMap}}
{{#items.complexType}}
+ {{#vendorExtensions.x-is-optional}}
+ {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present({{items.complexType}}.mapFromJson(json[r'{{{baseName}}}'])) : const Optional.absent(),
+ {{/vendorExtensions.x-is-optional}}
+ {{^vendorExtensions.x-is-optional}}
{{{name}}}: {{items.complexType}}.mapFromJson(json[r'{{{baseName}}}']),
+ {{/vendorExtensions.x-is-optional}}
{{/items.complexType}}
{{^items.complexType}}
+ {{#vendorExtensions.x-is-optional}}
+ {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(mapCastOfType<String, dynamic>(json, r'{{{baseName}}}')) : const Optional.absent(),
+ {{/vendorExtensions.x-is-optional}}
+ {{^vendorExtensions.x-is-optional}}
{{{name}}}: mapCastOfType<String, dynamic>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
+ {{/vendorExtensions.x-is-optional}}
{{/items.complexType}}
{{/items.isMap}}
{{^items.isMap}}
{{#items.complexType}}
+ {{#vendorExtensions.x-is-optional}}
+ {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present({{{items.complexType}}}.mapFromJson(json[r'{{{baseName}}}'])) : const Optional.absent(),
+ {{/vendorExtensions.x-is-optional}}
+ {{^vendorExtensions.x-is-optional}}
{{{name}}}: {{{items.complexType}}}.mapFromJson(json[r'{{{baseName}}}']),
+ {{/vendorExtensions.x-is-optional}}
{{/items.complexType}}
{{^items.complexType}}
+ {{#vendorExtensions.x-is-optional}}
+ {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(mapCastOfType<String, {{items.dataType}}>(json, r'{{{baseName}}}')) : const Optional.absent(),
+ {{/vendorExtensions.x-is-optional}}
+ {{^vendorExtensions.x-is-optional}}
{{{name}}}: mapCastOfType<String, {{items.dataType}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
+ {{/vendorExtensions.x-is-optional}}
{{/items.complexType}}
{{/items.isMap}}
{{/items.isArray}}
@@ -259,23 +295,45 @@
{{^complexType}}
{{#isArray}}
{{#isEnum}}
+ {{#vendorExtensions.x-is-optional}}
+ {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present({{{items.datatypeWithEnum}}}.listFromJson(json[r'{{{baseName}}}']){{#uniqueItems}}.toSet(){{/uniqueItems}}) : const Optional.absent(),
+ {{/vendorExtensions.x-is-optional}}
+ {{^vendorExtensions.x-is-optional}}
{{{name}}}: {{{items.datatypeWithEnum}}}.listFromJson(json[r'{{{baseName}}}']){{#uniqueItems}}.toSet(){{/uniqueItems}},
+ {{/vendorExtensions.x-is-optional}}
{{/isEnum}}
{{^isEnum}}
+ {{#vendorExtensions.x-is-optional}}
+ {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(json[r'{{{baseName}}}'] is Iterable
+ ? (json[r'{{{baseName}}}'] as Iterable).cast<{{{items.datatype}}}>().{{#uniqueItems}}toSet(){{/uniqueItems}}{{^uniqueItems}}toList(growable: false){{/uniqueItems}}
+ : {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}) : const Optional.absent(),
+ {{/vendorExtensions.x-is-optional}}
+ {{^vendorExtensions.x-is-optional}}
{{{name}}}: json[r'{{{baseName}}}'] is Iterable
? (json[r'{{{baseName}}}'] as Iterable).cast<{{{items.datatype}}}>().{{#uniqueItems}}toSet(){{/uniqueItems}}{{^uniqueItems}}toList(growable: false){{/uniqueItems}}
: {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}},
+ {{/vendorExtensions.x-is-optional}}
{{/isEnum}}
{{/isArray}}
{{^isArray}}
{{#isMap}}
+ {{#vendorExtensions.x-is-optional}}
+ {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(mapCastOfType<String, {{{items.datatype}}}>(json, r'{{{baseName}}}')) : const Optional.absent(),
+ {{/vendorExtensions.x-is-optional}}
+ {{^vendorExtensions.x-is-optional}}
{{{name}}}: mapCastOfType<String, {{{items.datatype}}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
+ {{/vendorExtensions.x-is-optional}}
{{/isMap}}
{{^isMap}}
{{#isNumber}}
+ {{#vendorExtensions.x-is-optional}}
+ {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(json[r'{{{baseName}}}'] == null ? null : num.parse('${json[r'{{{baseName}}}']}')) : const Optional.absent(),
+ {{/vendorExtensions.x-is-optional}}
+ {{^vendorExtensions.x-is-optional}}
{{{name}}}: {{#isNullable}}json[r'{{{baseName}}}'] == null
? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}
: {{/isNullable}}{{{datatypeWithEnum}}}.parse('${json[r'{{{baseName}}}']}'),
+ {{/vendorExtensions.x-is-optional}}
{{/isNumber}}
{{^isNumber}}
{{#vendorExtensions.x-original-is-integer}}