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 city; + List city; - List country; + List country; - List duration; + List duration; List id; @@ -46,20 +46,20 @@ class TimeBucketAssetResponseDto { List isTrashed; - List livePhotoVideoId; + List livePhotoVideoId; List localDateTime; List ownerId; - List projectionType; + List projectionType; List ratio; /// (stack ID, stack asset count) tuple - List> stack; + List?> stack; - List thumbhash; + List 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 {{/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',