From 6d90d4ba9cd211657c6d9310d2fc4a6f9cb7a0f0 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Mon, 6 Nov 2023 17:44:24 +0100 Subject: [PATCH] fix(nextcloud): Patch oneOf bugs Signed-off-by: jld3103 --- packages/nextcloud/lib/src/api/core.openapi.dart | 4 ++-- packages/nextcloud/lib/src/api/core.openapi.json | 2 +- packages/nextcloud/lib/src/api/sharebymail.openapi.dart | 4 ++-- packages/nextcloud/lib/src/api/sharebymail.openapi.json | 4 ++-- packages/nextcloud/lib/src/api/spreed.openapi.dart | 4 ++-- packages/nextcloud/lib/src/api/spreed.openapi.json | 2 +- packages/nextcloud/lib/src/api/user_status.openapi.dart | 4 ++-- packages/nextcloud/lib/src/api/user_status.openapi.json | 4 ++-- .../lib/src/patches/sharebymail/oneof-workaround.json | 7 +++++++ .../nextcloud/lib/src/patches/spreed/oneof-workaround.json | 5 +++++ .../lib/src/patches/user_status/oneof-workaround.json | 7 +++++++ 11 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 packages/nextcloud/lib/src/patches/sharebymail/oneof-workaround.json create mode 100644 packages/nextcloud/lib/src/patches/user_status/oneof-workaround.json diff --git a/packages/nextcloud/lib/src/api/core.openapi.dart b/packages/nextcloud/lib/src/api/core.openapi.dart index 86f7cfd9..2c999ad7 100644 --- a/packages/nextcloud/lib/src/api/core.openapi.dart +++ b/packages/nextcloud/lib/src/api/core.openapi.dart @@ -8023,9 +8023,9 @@ abstract class SharebymailCapabilities return; } - final match = [b._sharebymailCapabilities0, b._builtListJsonObject].singleWhereOrNull((final x) => x != null); + final match = [b._sharebymailCapabilities0, b._builtListJsonObject].firstWhereOrNull((final x) => x != null); if (match == null) { - throw StateError("Need exactly one of 'sharebymailCapabilities0', 'builtListJsonObject' for ${b._data}"); + throw StateError("Need at least one of 'sharebymailCapabilities0', 'builtListJsonObject' for ${b._data}"); } } } diff --git a/packages/nextcloud/lib/src/api/core.openapi.json b/packages/nextcloud/lib/src/api/core.openapi.json index 3c5c51e8..f334ef4c 100644 --- a/packages/nextcloud/lib/src/api/core.openapi.json +++ b/packages/nextcloud/lib/src/api/core.openapi.json @@ -1039,7 +1039,7 @@ } }, "SharebymailCapabilities": { - "oneOf": [ + "anyOf": [ { "type": "object", "required": [ diff --git a/packages/nextcloud/lib/src/api/sharebymail.openapi.dart b/packages/nextcloud/lib/src/api/sharebymail.openapi.dart index 63e7f164..493eb039 100644 --- a/packages/nextcloud/lib/src/api/sharebymail.openapi.dart +++ b/packages/nextcloud/lib/src/api/sharebymail.openapi.dart @@ -250,9 +250,9 @@ abstract class Capabilities implements CapabilitiesInterface, Built x != null); + final match = [b._capabilities0, b._builtListJsonObject].firstWhereOrNull((final x) => x != null); if (match == null) { - throw StateError("Need exactly one of 'capabilities0', 'builtListJsonObject' for ${b._data}"); + throw StateError("Need at least one of 'capabilities0', 'builtListJsonObject' for ${b._data}"); } } } diff --git a/packages/nextcloud/lib/src/api/sharebymail.openapi.json b/packages/nextcloud/lib/src/api/sharebymail.openapi.json index 81eff703..c6a36713 100644 --- a/packages/nextcloud/lib/src/api/sharebymail.openapi.json +++ b/packages/nextcloud/lib/src/api/sharebymail.openapi.json @@ -22,7 +22,7 @@ }, "schemas": { "Capabilities": { - "oneOf": [ + "anyOf": [ { "type": "object", "required": [ @@ -108,4 +108,4 @@ }, "paths": {}, "tags": [] -} \ No newline at end of file +} diff --git a/packages/nextcloud/lib/src/api/spreed.openapi.dart b/packages/nextcloud/lib/src/api/spreed.openapi.dart index dcfaadc8..2ec15a3f 100644 --- a/packages/nextcloud/lib/src/api/spreed.openapi.dart +++ b/packages/nextcloud/lib/src/api/spreed.openapi.dart @@ -20582,10 +20582,10 @@ abstract class RoomAddParticipantToRoomResponseApplicationJson_Ocs_Data } final match = [b._roomAddParticipantToRoomResponseApplicationJsonOcsData0, b._builtListJsonObject] - .singleWhereOrNull((final x) => x != null); + .firstWhereOrNull((final x) => x != null); if (match == null) { throw StateError( - "Need exactly one of 'roomAddParticipantToRoomResponseApplicationJsonOcsData0', 'builtListJsonObject' for ${b._data}", + "Need at least one of 'roomAddParticipantToRoomResponseApplicationJsonOcsData0', 'builtListJsonObject' for ${b._data}", ); } } diff --git a/packages/nextcloud/lib/src/api/spreed.openapi.json b/packages/nextcloud/lib/src/api/spreed.openapi.json index 21f15730..a44111ee 100644 --- a/packages/nextcloud/lib/src/api/spreed.openapi.json +++ b/packages/nextcloud/lib/src/api/spreed.openapi.json @@ -12896,7 +12896,7 @@ "$ref": "#/components/schemas/OCSMeta" }, "data": { - "oneOf": [ + "anyOf": [ { "type": "object", "required": [ diff --git a/packages/nextcloud/lib/src/api/user_status.openapi.dart b/packages/nextcloud/lib/src/api/user_status.openapi.dart index a24b1880..0c3eefa8 100644 --- a/packages/nextcloud/lib/src/api/user_status.openapi.dart +++ b/packages/nextcloud/lib/src/api/user_status.openapi.dart @@ -1827,9 +1827,9 @@ abstract class UserStatusRevertStatusResponseApplicationJson_Ocs_Data return; } - final match = [b._private, b._builtListJsonObject].singleWhereOrNull((final x) => x != null); + final match = [b._private, b._builtListJsonObject].firstWhereOrNull((final x) => x != null); if (match == null) { - throw StateError("Need exactly one of 'private', 'builtListJsonObject' for ${b._data}"); + throw StateError("Need at least one of 'private', 'builtListJsonObject' for ${b._data}"); } } } diff --git a/packages/nextcloud/lib/src/api/user_status.openapi.json b/packages/nextcloud/lib/src/api/user_status.openapi.json index 802ad16f..eb25731c 100644 --- a/packages/nextcloud/lib/src/api/user_status.openapi.json +++ b/packages/nextcloud/lib/src/api/user_status.openapi.json @@ -817,7 +817,7 @@ "$ref": "#/components/schemas/OCSMeta" }, "data": { - "oneOf": [ + "anyOf": [ { "$ref": "#/components/schemas/Private" }, @@ -1057,4 +1057,4 @@ } }, "tags": [] -} \ No newline at end of file +} diff --git a/packages/nextcloud/lib/src/patches/sharebymail/oneof-workaround.json b/packages/nextcloud/lib/src/patches/sharebymail/oneof-workaround.json new file mode 100644 index 00000000..8eb3eebc --- /dev/null +++ b/packages/nextcloud/lib/src/patches/sharebymail/oneof-workaround.json @@ -0,0 +1,7 @@ +[ + { + "op": "move", + "from": "/components/schemas/Capabilities/oneOf", + "path": "/components/schemas/Capabilities/anyOf" + } +] diff --git a/packages/nextcloud/lib/src/patches/spreed/oneof-workaround.json b/packages/nextcloud/lib/src/patches/spreed/oneof-workaround.json index 546656cf..57018875 100644 --- a/packages/nextcloud/lib/src/patches/spreed/oneof-workaround.json +++ b/packages/nextcloud/lib/src/patches/spreed/oneof-workaround.json @@ -8,5 +8,10 @@ "op": "move", "from": "/components/schemas/Room/properties/lastMessage/oneOf", "path": "/components/schemas/Room/properties/lastMessage/anyOf" + }, + { + "op": "move", + "from": "/paths/~1ocs~1v2.php~1apps~1spreed~1api~1{apiVersion}~1room~1{token}~1participants/post/responses/200/content/application~1json/schema/properties/ocs/properties/data/oneOf", + "path": "/paths/~1ocs~1v2.php~1apps~1spreed~1api~1{apiVersion}~1room~1{token}~1participants/post/responses/200/content/application~1json/schema/properties/ocs/properties/data/anyOf" } ] diff --git a/packages/nextcloud/lib/src/patches/user_status/oneof-workaround.json b/packages/nextcloud/lib/src/patches/user_status/oneof-workaround.json new file mode 100644 index 00000000..6f5533da --- /dev/null +++ b/packages/nextcloud/lib/src/patches/user_status/oneof-workaround.json @@ -0,0 +1,7 @@ +[ + { + "op": "move", + "from": "/paths/~1ocs~1v2.php~1apps~1user_status~1api~1v1~1user_status~1revert~1{messageId}/delete/responses/200/content/application~1json/schema/properties/ocs/properties/data/oneOf", + "path": "/paths/~1ocs~1v2.php~1apps~1user_status~1api~1v1~1user_status~1revert~1{messageId}/delete/responses/200/content/application~1json/schema/properties/ocs/properties/data/anyOf" + } +]