Skip to content

Commit

Permalink
Merge dd01821 into ec0d8c4
Browse files Browse the repository at this point in the history
  • Loading branch information
mdholloway committed Jul 2, 2019
2 parents ec0d8c4 + dd01821 commit bc347ff
Show file tree
Hide file tree
Showing 7 changed files with 293 additions and 3 deletions.
29 changes: 28 additions & 1 deletion config.frontend.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,32 @@ wiktionary_project: &wiktionary_project
options: *default_options
/{api:sys}: *default_sys

commons_project: &commons_project
x-modules:
- spec:
paths:
/{api:v1}:
x-modules:
- path: projects/v1/default.wmf.yaml
options: *default_options
- path: v1/recommend-caption.yaml
options: '{{options.recommendation}}'
- path: projects/proxy.yaml
options: *proxy_options
/{api:sys}: *default_sys

wikidata_project: &wikidata_project
x-modules:
- spec:
paths:
/{api:v1}:
x-modules:
- path: projects/v1/wikidata.wmf.yaml
options: *default_options
- path: projects/proxy.yaml
options: *proxy_options
/{api:sys}: *default_sys

testing_project: &testing_project
x-modules:
- spec:
Expand Down Expand Up @@ -150,7 +176,8 @@ spec_root: &spec_root
/{domain:ru.wikipedia.org}: *wikipedia_project
/{domain:de.wikipedia.org}: *wikipedia_project
/{domain:test2.wikipedia.org}: *wikipedia_project
/{domain:commons.wikimedia.org}: *default_project
/{domain:commons.wikimedia.org}: *commons_project
/{domain:www.wikidata.org}: *wikidata_project

# labs, used for most tests
/{domain:en.wikipedia.beta.wmflabs.org}: *wikipedia_project
Expand Down
29 changes: 28 additions & 1 deletion config.fullstack.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,32 @@ wiktionary_project: &wiktionary_project
options: *proxy_options
/{api:sys}: *default_sys

commons_project: &commons_project
x-modules:
- spec:
paths:
/{api:v1}:
x-modules:
- path: projects/v1/default.wmf.yaml
options: *default_options
- path: v1/recommend-caption.yaml
options: '{{options.recommendation}}'
- path: projects/proxy.yaml
options: *proxy_options
/{api:sys}: *default_sys

wikidata_project: &wikidata_project
x-modules:
- spec:
paths:
/{api:v1}:
x-modules:
- path: projects/v1/wikidata.wmf.yaml
options: *default_options
- path: projects/proxy.yaml
options: *proxy_options
/{api:sys}: *default_sys

testing_project: &testing_project
x-modules:
- spec:
Expand Down Expand Up @@ -185,7 +211,8 @@ spec_root: &spec_root
/{domain:ru.wikipedia.org}: *wikipedia_project
/{domain:de.wikipedia.org}: *wikipedia_project
/{domain:test2.wikipedia.org}: *wikipedia_project
/{domain:commons.wikimedia.org}: *default_project
/{domain:commons.wikimedia.org}: *commons_project
/{domain:www.wikidata.org}: *wikidata_project

# labs, used for most tests
/{domain:en.wikipedia.beta.wmflabs.org}: *wikipedia_project
Expand Down
2 changes: 2 additions & 0 deletions projects/v1/wikidata.wmf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,6 @@ paths:
x-modules:
- path: v1/lists.js
options: '{{options.lists}}'
- path: v1/recommend-description.yaml
options: '{{options.recommendation}}'

8 changes: 8 additions & 0 deletions test/features/specification/monitoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ describe('Monitoring tests', function() {
{
domain: 'en.wiktionary.org',
specURI: `${server.config.baseURL('en.wiktionary.org')}/?spec`
},
{
domain: 'www.wikidata.org',
specURI: `${server.config.baseURL('www.wikidata.org')}/?spec`
},
{
domain: 'commons.wikimedia.org',
specURI: `${server.config.baseURL('commons.wikimedia.org')}/?spec`
}],
(options) => {
return preq.get(options.specURI)
Expand Down
110 changes: 110 additions & 0 deletions v1/recommend-caption.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
info:
version: 1.0.0
title: Recommendation API
description: Recommendation API
termsOfService: https://github.com/wikimedia/restbase
license:
name: Apache license, v2
url: https://www.apache.org/licenses/LICENSE-2.0
tags:
- name: Recommendation
description: contribution recommendations
paths:
/recommendation/caption/addition/{target}:
get:
tags:
- Recommendation
summary: Recommend files missing a caption (label) in the target language
parameters:
- name: target
in: path
description: The target wiki language code for suggestions
required: true
schema:
type: string
responses:
200:
description: list of candidates for caption addition
content:
application/json:
schema:
$ref: '#/components/schemas/caption_recommendation_result'
default:
description: Error
content:
application/problem+json:
schema:
$ref: '#/components/schemas/problem'
x-request-handler:
- get_from_backend:
request:
uri: '{{options.host}}/{{domain}}/v1/caption/addition/{target}'
x-monitor: false

/recommendation/caption/translation/from/{source}/to/{target}:
get:
tags:
- Recommendation
summary: Recommend files with a caption (label) in the source language but missing one in the target language
parameters:
- name: source
in: path
description: The source wiki language code for suggestions
required: true
schema:
type: string
- name: target
in: path
description: The target wiki language code for suggestions
required: true
schema:
type: string
responses:
200:
description: list of candidates for caption translation
content:
application/json:
schema:
$ref: '#/components/schemas/caption_recommendation_result'
default:
description: Error
content:
application/problem+json:
schema:
$ref: '#/components/schemas/problem'
x-request-handler:
- get_from_backend:
request:
uri: '{{options.host}}/{{domain}}/v1/caption/translation/from/{source}/to/{target}'
x-monitor: false

components:
schemas:
caption_recommendation_result:
type: array
description: list of candidates for caption addition or translation
items:
type: object
properties:
pageid:
type: integer
description: wiki page id
ns:
type: integer
description: numeric page namespace (should always be 6)
title:
type: string
description: page title (with namespace prefix)
mime:
type: string
description: the MIME type of the file
structured:
type: object
description: structured data from Structured Data on Commons
properties:
captions:
type: object
description: captions, by language, from Structured Data on Commons
globalusage:
type: object
description: pages using this image on the source or target wiki, by language
116 changes: 116 additions & 0 deletions v1/recommend-description.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
info:
version: 1.0.0
title: Recommendation API
description: Recommendation API
termsOfService: https://github.com/wikimedia/restbase
license:
name: Apache license, v2
url: https://www.apache.org/licenses/LICENSE-2.0
tags:
- name: Recommendation
description: contribution recommendations
paths:
/recommendation/description/addition/{target}:
get:
tags:
- Recommendation
summary: Recommend Wikibase items missing a description in the target language
parameters:
- name: target
in: path
description: The target wiki language code for suggestions
required: true
schema:
type: string
responses:
200:
description: list of candidates for description addition
content:
application/json:
schema:
$ref: '#/components/schemas/description_recommendation_result'
default:
description: Error
content:
application/problem+json:
schema:
$ref: '#/components/schemas/problem'
x-request-handler:
- get_from_backend:
request:
uri: '{{options.host}}/{{domain}}/v1/description/addition/{target}'
x-monitor: false

/recommendation/description/translation/from/{source}/to/{target}:
get:
tags:
- Recommendation
summary: Recommend Wikibase items with a description in the source language but missing one in the target language
parameters:
- name: source
in: path
description: The source wiki language code for suggestions
required: true
schema:
type: string
- name: target
in: path
description: The target wiki language code for suggestions
required: true
schema:
type: string
responses:
200:
description: list of candidates for description translation
content:
application/json:
schema:
$ref: '#/components/schemas/description_recommendation_result'
default:
description: Error
content:
application/problem+json:
schema:
$ref: '#/components/schemas/problem'
x-request-handler:
- get_from_backend:
request:
uri: '{{options.host}}/{{domain}}/v1/description/translation/from/{source}/to/{target}'
x-monitor: false

components:
schemas:
description_recommendation_result:
type: array
description: list of candidates for description addition or translation
items:
type: object
properties:
pageid:
type: integer
description: wiki page id
ns:
type: integer
description: numeric page namespace (should always be 0)
title:
type: string
description: page title
wikibase_item:
type: object
description: info about the corresponding item in Wikidata
properties:
type:
type: string
description: entity type (should always be "item")
id:
type: string
description: Wikibase ID (should be Q-prefixed)
labels:
type: object
description: item labels by language
descriptions:
type: object
description: item descriptions by language
sitelinks:
type: object
description: item sitelinks by wiki (e.g., 'dewiki')
2 changes: 1 addition & 1 deletion v1/recommend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ info:
url: https://www.apache.org/licenses/LICENSE-2.0
tags:
- name: Recommendation
description: article translation recommendations
description: contribution recommendations
paths:
/recommendation/article/creation/translation/{from_lang}:
get: &recommendation_article_creation_translation_from-lang_get_spec
Expand Down

0 comments on commit bc347ff

Please sign in to comment.