From 8bc702e15f976dff02ac0920c320f01d077fbcd1 Mon Sep 17 00:00:00 2001 From: Jakob Warkotsch Date: Thu, 30 Jan 2025 18:15:14 +0100 Subject: [PATCH] Move GetOpenApiDocRouteHandler back into repo/rest-api/ Bug: T384283 Change-Id: Ic41019c0268aa86770f9d03cb65a0709fb656fd6 --- .github/workflows/publishRestApiClient.yml | 6 +++--- .phan/config.php | 1 + extension-repo.json | 3 ++- repo/rest-api/docs/index.js | 2 +- repo/rest-api/package.json | 2 +- .../src}/GetOpenApiDocRouteHandler.php | 2 +- .../crud/src/RouteHandlers => rest-api/src}/openapi.json | 0 repo/rest-api/tests/mocha/helpers/RequestBuilder.js | 2 +- repo/rest-api/tests/mocha/helpers/chaiHelper.js | 2 +- 9 files changed, 11 insertions(+), 9 deletions(-) rename repo/{domains/crud/src/RouteHandlers => rest-api/src}/GetOpenApiDocRouteHandler.php (93%) rename repo/{domains/crud/src/RouteHandlers => rest-api/src}/openapi.json (100%) diff --git a/.github/workflows/publishRestApiClient.yml b/.github/workflows/publishRestApiClient.yml index 06c952b2b71..ae79413ef29 100644 --- a/.github/workflows/publishRestApiClient.yml +++ b/.github/workflows/publishRestApiClient.yml @@ -3,7 +3,7 @@ on: push: branches: [ master ] paths: - - repo/domains/crud/src/RouteHandlers/openapi.json + - repo/rest-api/src/RouteHandlers/openapi.json - .github/workflows/publishRestApiClient.yml - .github/workflows/publishRestApiClient/** jobs: @@ -17,11 +17,11 @@ jobs: - name: Define next package version run: | NEXT_PATCH_VERSION=$(npx semver $(npm view @wmde/wikibase-rest-api version) --increment patch) - CURRENT_OAS_DOC_INTERFACE_VERSION=$(npx semver --coerce $(jq -r .info.version repo/domains/crud/src/RouteHandlers/openapi.json)) + CURRENT_OAS_DOC_INTERFACE_VERSION=$(npx semver --coerce $(jq -r .info.version repo/rest-api/src/RouteHandlers/openapi.json)) NEXT_VERSION=$(printf "$NEXT_PATCH_VERSION\n$CURRENT_OAS_DOC_INTERFACE_VERSION" | sort -V | tail -1) echo "VERSION=$NEXT_VERSION" >> $GITHUB_ENV - name: Copy OpenApi spec file - run: cp repo/domains/crud/src/RouteHandlers/openapi.json openapi.json + run: cp repo/rest-api/src/RouteHandlers/openapi.json openapi.json - name: Build the API client uses: addnab/docker-run-action@v3 with: diff --git a/.phan/config.php b/.phan/config.php index 4aa98664ab2..c00862e293e 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -34,6 +34,7 @@ 'repo/includes', 'repo/domains/crud/src', 'repo/domains/search/src', + 'repo/rest-api/src', 'lib/includes', 'client/maintenance', 'repo/maintenance', diff --git a/extension-repo.json b/extension-repo.json index 24f089a3699..514b5eec833 100644 --- a/extension-repo.json +++ b/extension-repo.json @@ -632,7 +632,7 @@ { "path": "/wikibase/v1/openapi.json", "method": "GET", - "factory": "Wikibase\\Repo\\Domains\\Crud\\RouteHandlers\\GetOpenApiDocRouteHandler::factory" + "factory": "Wikibase\\Repo\\RestApi\\GetOpenApiDocRouteHandler::factory" }, { "path": "/wikibase/v1/property-data-types", @@ -911,6 +911,7 @@ "Wikibase\\Repo\\": "repo/includes/", "Wikibase\\Repo\\Domains\\Search\\": "repo/domains/search/src/", "Wikibase\\Repo\\Domains\\Crud\\": "repo/domains/crud/src/", + "Wikibase\\Repo\\RestApi\\": "repo/rest-api/src/", "Wikibase\\Lib\\": "lib/includes/", "Wikibase\\Lib\\FederatedProperties\\": "lib/packages/wikibase/federated-properties/src/", "Wikibase\\Lib\\Changes\\": "lib/packages/wikibase/changes/src/", diff --git a/repo/rest-api/docs/index.js b/repo/rest-api/docs/index.js index bf71fa68681..1d231aa851b 100644 --- a/repo/rest-api/docs/index.js +++ b/repo/rest-api/docs/index.js @@ -1,7 +1,7 @@ import SwaggerUI from 'swagger-ui'; import 'swagger-ui/dist/swagger-ui.css'; -import spec from '../../domains/crud/src/RouteHandlers/openapi.json'; +import spec from '../src/openapi.json'; const ui = SwaggerUI( { spec, diff --git a/repo/rest-api/package.json b/repo/rest-api/package.json index a767bc0ff69..31afac41fdf 100644 --- a/repo/rest-api/package.json +++ b/repo/rest-api/package.json @@ -18,7 +18,7 @@ "build": "run-s build:docs build:spec", "build:docs": "webpack --config docs/webpack.config.js", "serve:docs": "webpack serve --config docs/webpack.config.js --mode development", - "build:spec": "redocly bundle specs/openapi.json --dereferenced -o ../domains/crud/src/RouteHandlers/openapi.json && cp ../domains/crud/src/RouteHandlers/openapi.json ../../docs/rest-api/openapi.json" + "build:spec": "redocly bundle specs/openapi.json --dereferenced -o src/openapi.json && cp src/openapi.json ../../docs/rest-api/openapi.json" }, "engines": { "node": ">=18" diff --git a/repo/domains/crud/src/RouteHandlers/GetOpenApiDocRouteHandler.php b/repo/rest-api/src/GetOpenApiDocRouteHandler.php similarity index 93% rename from repo/domains/crud/src/RouteHandlers/GetOpenApiDocRouteHandler.php rename to repo/rest-api/src/GetOpenApiDocRouteHandler.php index 0ce6d963b8c..ce4cc9c0cab 100644 --- a/repo/domains/crud/src/RouteHandlers/GetOpenApiDocRouteHandler.php +++ b/repo/rest-api/src/GetOpenApiDocRouteHandler.php @@ -1,6 +1,6 @@