Browse Source

dynamite,nextcloud: Add missing fromJsonString and toJsonString for oneOf, anyOf and allOf

pull/140/head
jld3103 2 years ago
parent
commit
af63766d6f
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 35
      packages/dynamite/lib/src/openapi_builder.dart
  2. 43
      packages/nextcloud/lib/src/nextcloud.openapi.dart

35
packages/dynamite/lib/src/openapi_builder.dart

@ -1299,8 +1299,24 @@ TypeResult resolveType(
);
},
),
Constructor(
(final b) {
b
..factory = true
..lambda = true
..name = 'fromJsonString'
..requiredParameters.add(
Parameter(
(final b) => b
..name = 'data'
..type = refer('String'),
),
)
..body = Code('$identifier.fromJson(json.decode(data))');
},
),
])
..methods.add(
..methods.addAll([
Method(
(final b) => b
..name = 'toJson'
@ -1308,7 +1324,22 @@ TypeResult resolveType(
..lambda = true
..body = const Code('_data'),
),
);
Method(
(final b) => b
..name = 'toJsonString'
..returns = refer('String')
..lambda = true
..static = true
..requiredParameters.add(
Parameter(
(final b) => b
..name = 'data'
..type = refer('dynamic'),
),
)
..body = const Code('json.encode(data)'),
),
]);
},
),
);

43
packages/nextcloud/lib/src/nextcloud.openapi.dart

@ -2829,6 +2829,9 @@ class CoreNavigationApps_Ocs_Data_Order {
);
}
factory CoreNavigationApps_Ocs_Data_Order.fromJsonString(String data) =>
CoreNavigationApps_Ocs_Data_Order.fromJson(json.decode(data));
final dynamic _data;
final int? $int;
@ -2838,6 +2841,8 @@ class CoreNavigationApps_Ocs_Data_Order {
// coverage:ignore-start
dynamic toJson() => _data;
// coverage:ignore-end
static String toJsonString(dynamic data) => json.encode(data);
}
@JsonSerializable()
@ -3348,6 +3353,9 @@ class NotificationsNotification_SubjectRichParameters {
);
}
factory NotificationsNotification_SubjectRichParameters.fromJsonString(String data) =>
NotificationsNotification_SubjectRichParameters.fromJson(json.decode(data));
final dynamic _data;
final Map<String, dynamic>? mapStringDynamic;
@ -3355,6 +3363,8 @@ class NotificationsNotification_SubjectRichParameters {
// coverage:ignore-start
dynamic toJson() => _data;
// coverage:ignore-end
static String toJsonString(dynamic data) => json.encode(data);
}
class NotificationsNotification_MessageRichParameters {
@ -3374,6 +3384,9 @@ class NotificationsNotification_MessageRichParameters {
);
}
factory NotificationsNotification_MessageRichParameters.fromJsonString(String data) =>
NotificationsNotification_MessageRichParameters.fromJson(json.decode(data));
final dynamic _data;
final Map<String, dynamic>? mapStringDynamic;
@ -3381,6 +3394,8 @@ class NotificationsNotification_MessageRichParameters {
// coverage:ignore-start
dynamic toJson() => _data;
// coverage:ignore-end
static String toJsonString(dynamic data) => json.encode(data);
}
@JsonSerializable()
@ -3976,6 +3991,8 @@ class UserStatusClearAt_Time {
);
}
factory UserStatusClearAt_Time.fromJsonString(String data) => UserStatusClearAt_Time.fromJson(json.decode(data));
final dynamic _data;
final UserStatusClearAt_Time0? userStatusClearAtTime0;
@ -3986,6 +4003,8 @@ class UserStatusClearAt_Time {
// coverage:ignore-start
dynamic toJson() => _data;
// coverage:ignore-end
static String toJsonString(dynamic data) => json.encode(data);
}
@JsonSerializable()
@ -4034,6 +4053,9 @@ class UserStatusPublicUserStatus_ClearAt {
);
}
factory UserStatusPublicUserStatus_ClearAt.fromJsonString(String data) =>
UserStatusPublicUserStatus_ClearAt.fromJson(json.decode(data));
final dynamic _data;
final UserStatusClearAt? userStatusClearAt;
@ -4044,6 +4066,8 @@ class UserStatusPublicUserStatus_ClearAt {
// coverage:ignore-start
dynamic toJson() => _data;
// coverage:ignore-end
static String toJsonString(dynamic data) => json.encode(data);
}
enum UserStatusType {
@ -4166,6 +4190,9 @@ class UserStatusFindStatus_Ocs_Data {
);
}
factory UserStatusFindStatus_Ocs_Data.fromJsonString(String data) =>
UserStatusFindStatus_Ocs_Data.fromJson(json.decode(data));
final dynamic _data;
final UserStatusPublicUserStatus? userStatusPublicUserStatus;
@ -4173,6 +4200,8 @@ class UserStatusFindStatus_Ocs_Data {
// coverage:ignore-start
dynamic toJson() => _data;
// coverage:ignore-end
static String toJsonString(dynamic data) => json.encode(data);
}
@JsonSerializable()
@ -4239,6 +4268,8 @@ class UserStatus_ClearAt {
);
}
factory UserStatus_ClearAt.fromJsonString(String data) => UserStatus_ClearAt.fromJson(json.decode(data));
final dynamic _data;
final UserStatusClearAt? userStatusClearAt;
@ -4249,6 +4280,8 @@ class UserStatus_ClearAt {
// coverage:ignore-start
dynamic toJson() => _data;
// coverage:ignore-end
static String toJsonString(dynamic data) => json.encode(data);
}
@JsonSerializable()
@ -4308,6 +4341,9 @@ class UserStatusGetUserStatus_Ocs_Data {
);
}
factory UserStatusGetUserStatus_Ocs_Data.fromJsonString(String data) =>
UserStatusGetUserStatus_Ocs_Data.fromJson(json.decode(data));
final dynamic _data;
final UserStatus? userStatus;
@ -4315,6 +4351,8 @@ class UserStatusGetUserStatus_Ocs_Data {
// coverage:ignore-start
dynamic toJson() => _data;
// coverage:ignore-end
static String toJsonString(dynamic data) => json.encode(data);
}
@JsonSerializable()
@ -4382,6 +4420,9 @@ class UserStatusPredefinedStatus_ClearAt {
);
}
factory UserStatusPredefinedStatus_ClearAt.fromJsonString(String data) =>
UserStatusPredefinedStatus_ClearAt.fromJson(json.decode(data));
final dynamic _data;
final UserStatusClearAt? userStatusClearAt;
@ -4392,6 +4433,8 @@ class UserStatusPredefinedStatus_ClearAt {
// coverage:ignore-start
dynamic toJson() => _data;
// coverage:ignore-end
static String toJsonString(dynamic data) => json.encode(data);
}
@JsonSerializable()

Loading…
Cancel
Save