Skip to content

Commit eb28c8b

Browse files
jenkins-botGerrit Code Review
authored andcommitted
Merge "Search: Mark simple search routes production ready"
2 parents bdc91c3 + e8010f9 commit eb28c8b

File tree

7 files changed

+36
-39
lines changed

7 files changed

+36
-39
lines changed

extension-repo.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,18 @@
639639
"path": "/wikibase/v1/property-data-types",
640640
"method": "GET",
641641
"factory": "Wikibase\\Repo\\Domains\\Crud\\RouteHandlers\\GetPropertyDataTypesHandler::factory"
642+
},
643+
{
644+
"path": "/wikibase/v0/search/items",
645+
"method": "GET",
646+
"class": "Wikibase\\Repo\\Domains\\Search\\RouteHandlers\\SimpleItemSearchRouteHandler",
647+
"services": [ "WbSearch.SimpleItemSearch", "WbSearch.MiddlewareHandler" ]
648+
},
649+
{
650+
"path": "/wikibase/v0/search/properties",
651+
"method": "GET",
652+
"class": "Wikibase\\Repo\\Domains\\Search\\RouteHandlers\\SimplePropertySearchRouteHandler",
653+
"services": [ "WbSearch.SimplePropertySearch", "WbSearch.MiddlewareHandler" ]
642654
}
643655
],
644656
"SpecialPages": {

repo/domains/crud/tests/mocha/api-testing/RouteCoverageTest.js

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ const happyPathBuilders = require( '../helpers/happyPathRequestBuilders' );
55
const extensionRepoConfig = require( '../../../../../../extension-repo.json' );
66

77
describe( 'Route Coverage Tests', () => {
8-
const EXCLUDED_ROUTES = [
9-
'GET /v1/openapi.json',
10-
'GET /v1/property-data-types'
11-
];
12-
138
const mockInputs = {
149
itemId: 'Q123',
1510
propertyId: 'P123',
@@ -29,6 +24,8 @@ describe( 'Route Coverage Tests', () => {
2924
method: route.method,
3025
path: route.path.split( '/wikibase' )[ 1 ]
3126
} )
27+
).filter(
28+
( route ) => route.path.startsWith( '/v1/entities' ) || route.path.startsWith( '/v1/statements' )
3229
);
3330
}
3431

@@ -50,22 +47,20 @@ describe( 'Route Coverage Tests', () => {
5047
}
5148

5249
it( 'should have all production routes covered in happy path builders', () => {
53-
const productionRoutes = getAllProductionRoutes()
54-
.map( ( route ) => routeToString( route ) )
55-
.filter( ( route ) => !EXCLUDED_ROUTES.includes( route ) );
50+
const productionRoutes = getAllProductionRoutes().map( routeToString );
51+
const happyPathRoutes = getAllHappyPathRoutes().map( routeToString );
5652

57-
const happyPathRoutes = getAllHappyPathRoutes()
58-
.map( ( route ) => routeToString( route ) );
53+
assert.ok( productionRoutes.length > 0, 'No production routes found.' );
54+
assert.ok( happyPathRoutes.length > 0, 'No happy path routes found.' );
5955

6056
const missingRoutes = productionRoutes.filter(
6157
( route ) => !happyPathRoutes.includes( route )
6258
);
6359

64-
if ( missingRoutes.length > 0 ) {
65-
assert.fail(
66-
`Found ${missingRoutes.length} production routes not covered in happy path builders:\n\n` +
67-
missingRoutes.join( '\n' )
68-
);
69-
}
60+
assert.ok(
61+
!missingRoutes.length > 0,
62+
`Found ${missingRoutes.length} production routes not covered in happy path builders:\n\n` +
63+
missingRoutes.join( '\n' )
64+
);
7065
} );
7166
} );

repo/domains/search/specs/index.fragment.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
"openapi": "3.1.0",
33
"info": {
44
"title": "Wikibase Search Domain REST API",
5-
"version": "0.1",
5+
"version": "0.2",
66
"description": "OpenAPI fragment of the Wikibase Search domain REST API"
77
},
88
"paths": {
99
"/v0/search/items": {
1010
"get": {
1111
"operationId": "simpleItemSearch",
1212
"tags": [ "item search" ],
13-
"summary": "[WIP] Simple Item search by label and aliases",
14-
"description": "This endpoint is currently in development and is not recommended for production use",
13+
"summary": "Simple Item search by label and aliases",
1514
"parameters": [
1615
{
1716
"$ref": "./global/parameters.json#/SearchQuery",
@@ -31,8 +30,7 @@
3130
"get": {
3231
"operationId": "simplePropertySearch",
3332
"tags": [ "property search" ],
34-
"summary": "[WIP] Simple Property search by label and aliases",
35-
"description": "This endpoint is currently in development and is not recommended for production use",
33+
"summary": "Simple Property search by label and aliases",
3634
"parameters": [
3735
{
3836
"$ref": "./global/parameters.json#/SearchQuery",

repo/rest-api/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CHANGELOG {#wb_rest_api_changelog}
22

3+
## Version 1.2
4+
5+
* Added endpoint `GET /wikibase/v0/search/properties` ([T386377](https://phabricator.wikimedia.org/T386377))
6+
* Added endpoint `GET /wikibase/v0/search/items` ([T383132](https://phabricator.wikimedia.org/T383132))
7+
8+
39
## Version 1.1
410

511
* Added endpoint `POST /wikibase/v1/entities/properties` ([T342992](https://phabricator.wikimedia.org/T342992))

repo/rest-api/routes.dev.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,5 @@
33
"path": "/wikibase/v0/suggest/{entity_type}",
44
"method": "GET",
55
"factory": "Wikibase\\Repo\\Domains\\Crud\\RouteHandlers\\SuggestEntitiesRouteHandler::factory"
6-
},
7-
{
8-
"path": "/wikibase/v0/search/items",
9-
"method": "GET",
10-
"class": "Wikibase\\Repo\\Domains\\Search\\RouteHandlers\\SimpleItemSearchRouteHandler",
11-
"services": [ "WbSearch.SimpleItemSearch", "WbSearch.MiddlewareHandler" ]
12-
},
13-
{
14-
"path": "/wikibase/v0/search/properties",
15-
"method": "GET",
16-
"class": "Wikibase\\Repo\\Domains\\Search\\RouteHandlers\\SimplePropertySearchRouteHandler",
17-
"services": [ "WbSearch.SimplePropertySearch", "WbSearch.MiddlewareHandler" ]
186
}
197
]

repo/rest-api/specs/openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"openapi": "3.1.0",
33
"info": {
44
"title": "Wikibase REST API",
5-
"version": "1.1",
5+
"version": "1.2",
66
"description": "OpenAPI definition of Wikibase REST API",
77
"contact": {
88
"name": "Wikimedia Deutschland - Wikibase Product Platform Team",

repo/rest-api/src/openapi.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"openapi": "3.1.0",
33
"info": {
44
"title": "Wikibase REST API",
5-
"version": "1.1",
5+
"version": "1.2",
66
"description": "OpenAPI definition of Wikibase REST API",
77
"contact": {
88
"name": "Wikimedia Deutschland - Wikibase Product Platform Team",
@@ -33594,8 +33594,7 @@
3359433594
"tags": [
3359533595
"item search"
3359633596
],
33597-
"summary": "[WIP] Simple Item search by label and aliases",
33598-
"description": "This endpoint is currently in development and is not recommended for production use",
33597+
"summary": "Simple Item search by label and aliases",
3359933598
"parameters": [
3360033599
{
3360133600
"example": "potato",
@@ -33828,8 +33827,7 @@
3382833827
"tags": [
3382933828
"property search"
3383033829
],
33831-
"summary": "[WIP] Simple Property search by label and aliases",
33832-
"description": "This endpoint is currently in development and is not recommended for production use",
33830+
"summary": "Simple Property search by label and aliases",
3383333831
"parameters": [
3383433832
{
3383533833
"example": "taxon",

0 commit comments

Comments
 (0)