silly generator

This commit is contained in:
mertalev 2025-05-06 18:06:59 -04:00
parent 4174575785
commit 35d91aa6bf
No known key found for this signature in database
GPG Key ID: DF6ABC77AAD98C95
6 changed files with 27 additions and 11 deletions

View File

@ -30,11 +30,11 @@ class TimeBucketAssetResponseDto {
this.thumbhash = const [], this.thumbhash = const [],
}); });
List<String> city; List<String?> city;
List<String> country; List<String?> country;
List<String> duration; List<String?> duration;
List<String> id; List<String> id;
@ -46,20 +46,20 @@ class TimeBucketAssetResponseDto {
List<num> isTrashed; List<num> isTrashed;
List<String> livePhotoVideoId; List<String?> livePhotoVideoId;
List<String> localDateTime; List<String> localDateTime;
List<String> ownerId; List<String> ownerId;
List<String> projectionType; List<String?> projectionType;
List<num> ratio; List<num> ratio;
/// (stack ID, stack asset count) tuple /// (stack ID, stack asset count) tuple
List<List<String>> stack; List<List<String>?> stack;
List<String> thumbhash; List<String?> thumbhash;
@override @override
bool operator ==(Object other) => identical(this, other) || other is TimeBucketAssetResponseDto && bool operator ==(Object other) => identical(this, other) || other is TimeBucketAssetResponseDto &&

View File

@ -8,6 +8,7 @@ function dart {
cd ./templates/mobile/serialization/native 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 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.mustache.patch
patch --no-backup-if-mismatch -u native_class.mustache <native_class_default_value_for_array_items.patch
cd ../../ cd ../../
wget -O api.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENERATOR_VERSION/modules/openapi-generator/src/main/resources/dart2/api.mustache wget -O api.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENERATOR_VERSION/modules/openapi-generator/src/main/resources/dart2/api.mustache

View File

@ -13649,10 +13649,10 @@
"description": "(stack ID, stack asset count) tuple", "description": "(stack ID, stack asset count) tuple",
"items": { "items": {
"items": { "items": {
"maxItems": 2,
"minItems": 2,
"type": "string" "type": "string"
}, },
"maxItems": 2,
"minItems": 2,
"nullable": true, "nullable": true,
"type": "array" "type": "array"
}, },

View File

@ -32,7 +32,7 @@ class {{{classname}}} {
{{/required}} {{/required}}
{{/isNullable}} {{/isNullable}}
{{/isEnum}} {{/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}} {{/vars}}
@override @override

View File

@ -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

View File

@ -88,7 +88,9 @@ export class TimeBucketAssetResponseDto implements TimeBucketAssets {
type: 'array', type: 'array',
items: { items: {
type: 'array', type: 'array',
items: { type: 'string', maxItems: 2, minItems: 2 }, items: { type: 'string' },
minItems: 2,
maxItems: 2,
nullable: true, nullable: true,
}, },
description: '(stack ID, stack asset count) tuple', description: '(stack ID, stack asset count) tuple',