From ccb12c6984371a897c2d352ab5c02a662794da61 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sat, 28 Oct 2023 08:17:39 +0200 Subject: [PATCH] feat(tool): Allow patching specs Signed-off-by: jld3103 --- CONTRIBUTING.md | 1 + tool/generate-specs.sh | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0c67f9620b6..001621e9784 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,6 +13,7 @@ Note that you need to have Dart installed and [`~/.pub-cache/bin/` needs to be i You will need to have the following packages installed: - [yq](https://github.com/kislyuk/yq) +- [jsonpatch](https://pypi.org/project/jsonpatch) - [sqlite3](https://pub.dev/packages/sqflite_common_ffi#getting-started) - [appindicator3](https://pub.dev/packages/tray_manager#quick-start) diff --git a/tool/generate-specs.sh b/tool/generate-specs.sh index 3680fea0c75..dba89f42428 100755 --- a/tool/generate-specs.sh +++ b/tool/generate-specs.sh @@ -50,6 +50,14 @@ done generate_spec "." "notifications" ) +for spec in packages/nextcloud/lib/src/api/*.openapi.json; do + name="$(basename "$spec" | cut -d "." -f 1)" + if [ -f "tool/patches/$name.json" ]; then + cp "$spec" "/tmp/nextcloud-neon/$name.json" + jsonpatch --indent 4 "/tmp/nextcloud-neon/$name.json" "tool/patches/$name.json" > "$spec" + fi +done + ( cd external/nextcloud-server composer exec merge-specs -- --core ../../packages/nextcloud/lib/src/api/core.openapi.json --merged /tmp/nextcloud-neon/merged.json ../../packages/nextcloud/lib/src/api/*.openapi.json --openapi-version 3.1.0