Skip to content

Commit

Permalink
feat(tool): Allow patching specs
Browse files Browse the repository at this point in the history
Signed-off-by: jld3103 <jld3103yt@gmail.com>
  • Loading branch information
provokateurin committed Oct 28, 2023
1 parent 0c59170 commit 91a518c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions .cspell/tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ icudtl
inkscape
intellij
jetbrains
jsonpatch
jvmargs
klass
lcov
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 8 additions & 0 deletions tool/generate-specs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 91a518c

Please sign in to comment.