chore(mobile): properly patch openapi with custom response dto (#11753)
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import 'package:openapi/api.dart';
|
||||
|
||||
dynamic upgradeDto(dynamic value, String targetType) {
|
||||
switch (targetType) {
|
||||
case 'UserPreferencesResponseDto':
|
||||
if (value is Map) {
|
||||
if (value['rating'] == null) {
|
||||
value['rating'] = RatingResponse().toJson();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+1
@@ -16,6 +16,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:immich_mobile/utils/openapi_patching.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
Generated
+1
@@ -166,6 +166,7 @@ class ApiClient {
|
||||
|
||||
/// Returns a native instance of an OpenAPI class matching the [specified type][targetType].
|
||||
static dynamic fromJson(dynamic value, String targetType, {bool growable = false,}) {
|
||||
upgradeDto(value, targetType);
|
||||
try {
|
||||
switch (targetType) {
|
||||
case 'String':
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ part of openapi.api;
|
||||
class RatingResponse {
|
||||
/// Returns a new [RatingResponse] instance.
|
||||
RatingResponse({
|
||||
required this.enabled,
|
||||
this.enabled = false,
|
||||
});
|
||||
|
||||
bool enabled;
|
||||
|
||||
@@ -13,5 +13,5 @@ dependencies:
|
||||
http: '>=0.13.0 <0.14.0'
|
||||
intl: any
|
||||
meta: '^1.1.8'
|
||||
dev_dependencies:
|
||||
test: '>=1.21.6 <1.22.0'
|
||||
immich_mobile:
|
||||
path: ../
|
||||
|
||||
Reference in New Issue
Block a user