Skip to content

Commit 29688e3

Browse files
jenkins-botGerrit Code Review
authored andcommitted
Merge "Search: Extract responses from spec"
2 parents 85f3478 + 0379e11 commit 29688e3

File tree

3 files changed

+391
-118
lines changed

3 files changed

+391
-118
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"BadRequest": {
3+
"description": "The request cannot be processed",
4+
"content": {
5+
"application/json": {
6+
"schema": {
7+
"type": "object",
8+
"properties": {
9+
"code": { "type": "string" },
10+
"message": { "type": "string" },
11+
"context": { "type": "object" }
12+
},
13+
"required": [ "code", "message" ],
14+
"additionalProperties": false
15+
},
16+
"examples": {
17+
"invalid-query-parameter": {
18+
"value": {
19+
"code": "invalid-query-parameter",
20+
"message": "Invalid query parameter: 'language'",
21+
"context": { "parameter": "language" }
22+
}
23+
}
24+
}
25+
}
26+
},
27+
"headers": {
28+
"Content-Language": {
29+
"description": "Language code of the language in which error message is provided",
30+
"schema": { "type": "string" },
31+
"required": true
32+
}
33+
}
34+
},
35+
"SearchItemSuccess": {
36+
"description": "A list of search results",
37+
"content": {
38+
"application/json": {
39+
"schema": { "$ref": "./schema-parts.json#/SearchItemResultList" },
40+
"example": {
41+
"results": [
42+
{
43+
"id": "Q123",
44+
"label": { "language": "en", "value": "potato" },
45+
"description": { "language": "en", "value": "staple food" },
46+
"match": { "type": "label", "language": "en", "text": "potato" }
47+
},
48+
{
49+
"id": "Q234",
50+
"label": { "language": "en", "value": "potato" },
51+
"description": { "language": "en", "value": "species of plant" },
52+
"match": { "type": "label", "language": "en", "text": "potato" }
53+
}
54+
]
55+
}
56+
}
57+
}
58+
},
59+
"SearchPropertySuccess": {
60+
"description": "A list of search results",
61+
"content": {
62+
"application/json": {
63+
"schema": { "$ref": "./schema-parts.json#/SearchPropertyResultList" },
64+
"example": {
65+
"results": [
66+
{
67+
"id": "P123",
68+
"label": { "language": "en", "value": "taxon name" },
69+
"description": { "language": "en", "value": "scientific name of a taxon" },
70+
"match": { "type": "label", "language": "en", "text": "taxon" }
71+
},
72+
{
73+
"id": "P234",
74+
"label": { "language": "en", "value": "taxon rank" },
75+
"description": { "language": "en", "value": "level in a taxonomic hierarchy" },
76+
"match": { "type": "label", "language": "en", "text": "taxon" }
77+
}
78+
]
79+
}
80+
}
81+
}
82+
}
83+
}

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

Lines changed: 4 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -20,65 +20,8 @@
2020
{ "$ref": "./global/parameters.json#/SearchLanguage" }
2121
],
2222
"responses": {
23-
"200": {
24-
"description": "A list of search results",
25-
"content": {
26-
"application/json": {
27-
"schema": {
28-
"$ref": "./global/schema-parts.json#/SearchItemResultList"
29-
},
30-
"example": {
31-
"results": [
32-
{
33-
"id": "Q123",
34-
"label": { "language": "en", "value": "potato" },
35-
"description": { "language": "en", "value": "staple food" },
36-
"match": { "type": "label", "language": "en", "text": "potato" }
37-
},
38-
{
39-
"id": "Q234",
40-
"label": { "language": "en", "value": "potato" },
41-
"description": { "language": "en", "value": "species of plant" },
42-
"match": { "type": "label", "language": "en", "text": "potato" }
43-
}
44-
]
45-
}
46-
}
47-
}
48-
},
49-
"400": {
50-
"description": "The request cannot be processed",
51-
"content": {
52-
"application/json": {
53-
"schema": {
54-
"type": "object",
55-
"properties": {
56-
"code": { "type": "string" },
57-
"message": { "type": "string" },
58-
"context": { "type": "object" }
59-
},
60-
"required": [ "code", "message" ],
61-
"additionalProperties": false
62-
},
63-
"examples": {
64-
"invalid-query-parameter": {
65-
"value": {
66-
"code": "invalid-query-parameter",
67-
"message": "Invalid query parameter: 'language'",
68-
"context": { "parameter": "language" }
69-
}
70-
}
71-
}
72-
}
73-
},
74-
"headers": {
75-
"Content-Language": {
76-
"description": "Language code of the language in which error message is provided",
77-
"schema": { "type": "string" },
78-
"required": true
79-
}
80-
}
81-
}
23+
"200": { "$ref": "./global/responses.json#/SearchItemSuccess" },
24+
"400": { "$ref": "./global/responses.json#/BadRequest" }
8225
}
8326
}
8427
},
@@ -96,65 +39,8 @@
9639
{ "$ref": "./global/parameters.json#/SearchLanguage" }
9740
],
9841
"responses": {
99-
"200": {
100-
"description": "A list of search results",
101-
"content": {
102-
"application/json": {
103-
"schema": {
104-
"$ref": "./global/schema-parts.json#/SearchPropertyResultList"
105-
},
106-
"example": {
107-
"results": [
108-
{
109-
"id": "P123",
110-
"label": { "language": "en", "value": "taxon name" },
111-
"description": { "language": "en", "value": "scientific name of a taxon" },
112-
"match": { "type": "label", "language": "en", "text": "taxon" }
113-
},
114-
{
115-
"id": "P234",
116-
"label": { "language": "en", "value": "taxon rank" },
117-
"description": { "language": "en", "value": "level in a taxonomic hierarchy" },
118-
"match": { "type": "label", "language": "en", "text": "taxon" }
119-
}
120-
]
121-
}
122-
}
123-
}
124-
},
125-
"400": {
126-
"description": "The request cannot be processed",
127-
"content": {
128-
"application/json": {
129-
"schema": {
130-
"type": "object",
131-
"properties": {
132-
"code": { "type": "string" },
133-
"message": { "type": "string" },
134-
"context": { "type": "object" }
135-
},
136-
"required": [ "code", "message" ],
137-
"additionalProperties": false
138-
},
139-
"examples": {
140-
"invalid-query-parameter": {
141-
"value": {
142-
"code": "invalid-query-parameter",
143-
"message": "Invalid query parameter: 'language'",
144-
"context": { "parameter": "language" }
145-
}
146-
}
147-
}
148-
}
149-
},
150-
"headers": {
151-
"Content-Language": {
152-
"description": "Language code of the language in which error message is provided",
153-
"schema": { "type": "string" },
154-
"required": true
155-
}
156-
}
157-
}
42+
"200": { "$ref": "./global/responses.json#/SearchPropertySuccess" },
43+
"400": { "$ref": "./global/responses.json#/BadRequest" }
15844
}
15945
}
16046
}

0 commit comments

Comments
 (0)