Skip to content

Commit

Permalink
Move GetOpenApiDocRouteHandler back into repo/rest-api/
Browse files Browse the repository at this point in the history
Bug: T384283
Change-Id: Ic41019c0268aa86770f9d03cb65a0709fb656fd6
  • Loading branch information
jakobw committed Jan 31, 2025
1 parent 1074be0 commit 8bc702e
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publishRestApiClient.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
'repo/includes',
'repo/domains/crud/src',
'repo/domains/search/src',
'repo/rest-api/src',
'lib/includes',
'client/maintenance',
'repo/maintenance',
Expand Down
3 changes: 2 additions & 1 deletion extension-repo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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/",
Expand Down
2 changes: 1 addition & 1 deletion repo/rest-api/docs/index.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion repo/rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare( strict_types=1 );

namespace Wikibase\Repo\Domains\Crud\RouteHandlers;
namespace Wikibase\Repo\RestApi;

use MediaWiki\Rest\Handler;
use MediaWiki\Rest\Response;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion repo/rest-api/tests/mocha/helpers/RequestBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { default: OpenAPIRequestCoercer } = require( 'openapi-request-coercer' );
const { default: OpenAPIRequestValidator } = require( 'openapi-request-validator' );

const basePath = 'rest.php/wikibase';
const openapiSchema = JSON.parse( readFileSync( `${__dirname}/../../../../domains/crud/src/RouteHandlers/openapi.json` ) );
const openapiSchema = JSON.parse( readFileSync( `${__dirname}/../../../src/openapi.json` ) );

class RequestBuilder {

Expand Down
2 changes: 1 addition & 1 deletion repo/rest-api/tests/mocha/helpers/chaiHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { readFileSync } = require( 'fs' );

function compileSchemaAndValidator() {
const openApiSchema = JSON.parse(
readFileSync( `${__dirname}/../../../../domains/crud/src/RouteHandlers/openapi.json` )
readFileSync( `${__dirname}/../../../src/openapi.json` )
);

const schemaValidator = new Ajv( { strictTypes: false } );
Expand Down

0 comments on commit 8bc702e

Please sign in to comment.