Browse Source

feat(tool): Allow patching specs

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/980/head
jld3103 1 year ago
parent
commit
bd286cf03a
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 1
      .cspell/tools.txt
  2. 7
      CONTRIBUTING.md
  3. 11
      tool/generate-specs.sh

1
.cspell/tools.txt

@ -30,6 +30,7 @@ icudtl
inkscape
intellij
jetbrains
jsonpatch
jvmargs
klass
lcov

7
CONTRIBUTING.md

@ -11,11 +11,16 @@ Currently included are:
To set up all these tools run the `./tool/setup.sh` script.
Note that you need to have Dart installed and [`~/.pub-cache/bin/` needs to be in your PATH](https://dart.dev/tools/pub/cmd/pub-global#running-a-script-from-your-path) before running the script.
You will need to have the following packages installed:
You will need to have the following dependencies installed to get the app running:
- [yq](https://github.com/kislyuk/yq)
- [sqlite3](https://pub.dev/packages/sqflite_common_ffi#getting-started)
- [appindicator3](https://pub.dev/packages/tray_manager#quick-start)
For working with lower levels like generating the OpenAPI specifications a few more dependencies are required:
- [jsonpatch](https://pypi.org/project/jsonpatch)
- [PHP](https://www.php.net)
- [composer](https://getcomposer.org)
## Picking an issue
You may wish to start with our list of [good first issues](https://github.com/nextcloud/neon/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)

11
tool/generate-specs.sh

@ -50,6 +50,17 @@ done
generate_spec "." "notifications"
)
for spec in packages/nextcloud/lib/src/api/*.openapi.json; do
name="$(basename "$spec" | cut -d "." -f 1)"
dir="packages/nextcloud/lib/src/patches/$name"
if [ -d "$dir" ]; then
for patch in "$dir/"*; do
cp "$spec" "/tmp/nextcloud-neon/$name.json"
jsonpatch --indent 4 "/tmp/nextcloud-neon/$name.json" "$patch" > "$spec"
done
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

Loading…
Cancel
Save