diff --git a/mobile/openapi/lib/model/time_bucket_asset_response_dto.dart b/mobile/openapi/lib/model/time_bucket_asset_response_dto.dart index dd3abb3358..0c4e12f039 100644 --- a/mobile/openapi/lib/model/time_bucket_asset_response_dto.dart +++ b/mobile/openapi/lib/model/time_bucket_asset_response_dto.dart @@ -30,11 +30,11 @@ class TimeBucketAssetResponseDto { this.thumbhash = const [], }); - List<String> city; + List<String?> city; - List<String> country; + List<String?> country; - List<String> duration; + List<String?> duration; List<String> id; @@ -46,20 +46,20 @@ class TimeBucketAssetResponseDto { List<num> isTrashed; - List<String> livePhotoVideoId; + List<String?> livePhotoVideoId; List<String> localDateTime; List<String> ownerId; - List<String> projectionType; + List<String?> projectionType; List<num> ratio; /// (stack ID, stack asset count) tuple - List<List<String>> stack; + List<List<String>?> stack; - List<String> thumbhash; + List<String?> thumbhash; @override bool operator ==(Object other) => identical(this, other) || other is TimeBucketAssetResponseDto && diff --git a/open-api/bin/generate-open-api.sh b/open-api/bin/generate-open-api.sh index 8fa5dd0da4..6cc9b747fa 100755 --- a/open-api/bin/generate-open-api.sh +++ b/open-api/bin/generate-open-api.sh @@ -8,6 +8,7 @@ function dart { cd ./templates/mobile/serialization/native wget -O native_class.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENERATOR_VERSION/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache patch --no-backup-if-mismatch -u native_class.mustache <native_class.mustache.patch + patch --no-backup-if-mismatch -u native_class.mustache <native_class_default_value_for_array_items.patch cd ../../ wget -O api.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENERATOR_VERSION/modules/openapi-generator/src/main/resources/dart2/api.mustache diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index 9af17fd906..ffa17381f9 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -13649,10 +13649,10 @@ "description": "(stack ID, stack asset count) tuple", "items": { "items": { - "maxItems": 2, - "minItems": 2, "type": "string" }, + "maxItems": 2, + "minItems": 2, "nullable": true, "type": "array" }, diff --git a/open-api/templates/mobile/serialization/native/native_class.mustache b/open-api/templates/mobile/serialization/native/native_class.mustache index 9a7b1439b1..9f40d5b0bf 100644 --- a/open-api/templates/mobile/serialization/native/native_class.mustache +++ b/open-api/templates/mobile/serialization/native/native_class.mustache @@ -32,7 +32,7 @@ class {{{classname}}} { {{/required}} {{/isNullable}} {{/isEnum}} - {{{datatypeWithEnum}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}?{{/defaultValue}}{{/required}}{{/isNullable}} {{{name}}}; + {{#isArray}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}<{{{items.dataType}}}{{#items.isNullable}}?{{/items.isNullable}}>{{/isArray}}{{^isArray}}{{{datatypeWithEnum}}}{{/isArray}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}?{{/defaultValue}}{{/required}}{{/isNullable}} {{{name}}}; {{/vars}} @override diff --git a/open-api/templates/mobile/serialization/native/native_class_default_value_for_array_items.patch b/open-api/templates/mobile/serialization/native/native_class_default_value_for_array_items.patch new file mode 100644 index 0000000000..a59e300913 --- /dev/null +++ b/open-api/templates/mobile/serialization/native/native_class_default_value_for_array_items.patch @@ -0,0 +1,13 @@ +diff --git a/open-api/templates/mobile/serialization/native/native_class.mustache b/open-api/templates/mobile/serialization/native/native_class.mustache +index 9a7b1439b..9f40d5b0b 100644 +--- a/open-api/templates/mobile/serialization/native/native_class.mustache ++++ b/open-api/templates/mobile/serialization/native/native_class.mustache +@@ -32,7 +32,7 @@ class {{{classname}}} { + {{/required}} + {{/isNullable}} + {{/isEnum}} +- {{{datatypeWithEnum}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}?{{/defaultValue}}{{/required}}{{/isNullable}} {{{name}}}; ++ {{#isArray}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}<{{{items.dataType}}}{{#items.isNullable}}?{{/items.isNullable}}>{{/isArray}}{{^isArray}}{{{datatypeWithEnum}}}{{/isArray}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}?{{/defaultValue}}{{/required}}{{/isNullable}} {{{name}}}; + + {{/vars}} + @override diff --git a/server/src/dtos/time-bucket.dto.ts b/server/src/dtos/time-bucket.dto.ts index acc0914aa5..228a5488ef 100644 --- a/server/src/dtos/time-bucket.dto.ts +++ b/server/src/dtos/time-bucket.dto.ts @@ -88,7 +88,9 @@ export class TimeBucketAssetResponseDto implements TimeBucketAssets { type: 'array', items: { type: 'array', - items: { type: 'string', maxItems: 2, minItems: 2 }, + items: { type: 'string' }, + minItems: 2, + maxItems: 2, nullable: true, }, description: '(stack ID, stack asset count) tuple',