Skip to content

Commit f589e8a

Browse files
authored
Merge pull request #51674 from nextcloud/feat/openapi/merged-spec
feat(openapi): Generate merged spec for all apps
2 parents 9459724 + 95df189 commit f589e8a

File tree

6 files changed

+30733
-12
lines changed

6 files changed

+30733
-12
lines changed

.reuse/dep5

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,3 +342,7 @@ License: CC0-1.0
342342
Files: apps/theming/fonts/OpenDyslexic-Bold.otf apps/theming/fonts/OpenDyslexic-Regular.otf
343343
Copyright: 2012-2019 Abbie Gonzalez <https://abbiecod.es|[email protected]>, with Reserved Font Name OpenDyslexic.
344344
License: OFL-1.1-RFN
345+
346+
Files: openapi.json
347+
Copyright: 2025 Nextcloud GmbH and Nextcloud contributors
348+
License: AGPL-3.0-or-later

build/files-checker.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
'occ',
7070
'ocs',
7171
'ocs-provider',
72+
'openapi.json',
7273
'package-lock.json',
7374
'package.json',
7475
'psalm-ncu.xml',

build/openapi-checker.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,26 @@
33
# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
44
# SPDX-License-Identifier: AGPL-3.0-or-later
55

6+
specs=()
67
for path in core apps/*; do
78
if [ ! -f "$path/.noopenapi" ] && [[ "$(git check-ignore "$path")" != "$path" ]]; then
89
composer exec generate-spec "$path" "$path/openapi.json" || exit 1
10+
if [[ "$(basename "$path")" != "core" ]]; then
11+
if [ -f "$path/openapi-full.json" ]; then
12+
specs+=("$path/openapi-full.json")
13+
else
14+
specs+=("$path/openapi.json")
15+
fi;
16+
fi;
917
fi
1018
done
1119

12-
files="$(git diff --name-only)"
20+
composer exec merge-specs -- \
21+
--core core/openapi-full.json \
22+
--merged openapi.json \
23+
"${specs[@]}"
24+
25+
files="$(git ls-files --exclude-standard --modified --others)"
1326
changed=false
1427
for file in $files; do
1528
if [[ $file == *"openapi"*".json" ]]; then

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
"test": "phpunit --configuration tests/phpunit-autotest.xml",
7272
"test:db": "@composer run test -- --group DB,SLOWDB",
7373
"test:files_external": "phpunit --configuration tests/phpunit-autotest-external.xml",
74-
"rector": "rector --config=build/rector.php && composer cs:fix"
74+
"rector": "rector --config=build/rector.php && composer cs:fix",
75+
"openapi": "./build/openapi-checker.sh"
7576
},
7677
"extra": {
7778
"bamarni-bin": {

0 commit comments

Comments
 (0)