Skip to content

Commit 7d3da40

Browse files
authored
control-service: fix the examples in swagger (#945)
The examples for the query jobs endpoing (graphql) were not working (syntax was wrong/broken) so this is fixing them. I am also using markdown (which is supported by swagger) to visualize them instead of html tags (which is hard to maintain) Testing Done: started locally the service and inspected the swagger ui Signed-off-by: Antoni Ivanov <[email protected]>
1 parent 38f1061 commit 7d3da40

File tree

1 file changed

+148
-142
lines changed
  • projects/control-service/projects/model/apidefs/datajob-api

1 file changed

+148
-142
lines changed

projects/control-service/projects/model/apidefs/datajob-api/api.yaml

+148-142
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ paths:
142142
Check the latest example for the full list of supported query fields.<br/><br/>
143143
144144
Simplest query that you could make is to fetch the job names
145-
<pre>
146-
{<br/>
147-
jobs(pageNumber: 1, pageSize: 25) {<br/>
148-
content {<br/>
149-
jobName<br/>
150-
}<br/>
151-
}<br/>
152-
}<br/>
153-
</pre><br/>
145+
```
146+
{
147+
jobs(pageNumber: 1, pageSize: 25) {
148+
content {
149+
jobName
150+
}
151+
}
152+
}
153+
```
154154
155155
You could also use filtering and sorting function. Filter object has <b>property, pattern and sort</b> fields.<br/>
156156
* <b>property</b> points out which field you want to filter, if you point out some other field that is not supported,
@@ -160,155 +160,161 @@ paths:
160160
If a pattern string is not provided, then you must atleast provide the property field<br/>
161161
* <b>sort</b> should be an enum value - ASC (ascending) or DESC (descending) option [not required, default is ASC]
162162
Multiple filters could be applied, but <b>maximum one should contain sorting</b>!
163-
<pre>
164-
{<br/>
165-
jobs(<br/>
166-
pageNumber: 1,<br/>
167-
pageSize: 25,<br/>
168-
filter: [{<br/>
169-
property: "jobName",<br/>
170-
pattern: "starshot",<br/>
171-
sort: "DESC"<br/>
172-
}],<br/>
173-
) {<br/>
174-
content {<br/>
175-
jobName<br/>
176-
}<br/>
177-
}<br/>
178-
}<br/>
179-
</pre><br/>
163+
```
164+
{
165+
jobs(
166+
pageNumber: 1,
167+
pageSize: 25,
168+
filter: [{
169+
property: "jobName",
170+
pattern: "starshot",
171+
sort: DESC
172+
}],
173+
) {
174+
content {
175+
jobName
176+
}
177+
}
178+
}
179+
```
180180
181181
You could also search for a string into the properties that you are requesting, for instance:
182182
This query will search for job names, team names and descriptions which contains the provided "starshot" string
183-
<pre>
184-
{<br/>
185-
jobs(<br/>
186-
pageNumber: 1,<br/>
187-
pageSize: 25,<br/>
188-
search: "starshot"<br/>
189-
) {<br/>
190-
content {<br/>
191-
jobName,<br/>
192-
config {<br/>
193-
team<br/>
194-
description<br/>
195-
}<br/>
196-
}<br/>
197-
}<br/>
198-
}<br/>
199-
</pre><br/>
183+
```
184+
{
185+
jobs(
186+
pageNumber: 1,
187+
pageSize: 25,
188+
search: "starshot"
189+
) {
190+
content {
191+
jobName,
192+
config {
193+
team
194+
description
195+
}
196+
}
197+
}
198+
}
199+
```
200200
201201
Data jobs execution could also be searched by providing arguments to the <b>execution</b> field.
202202
Same as parent query arguments, the <b>pageNumber</b> and <b>pageSize</b> arguments are required! Page number should be a <b>number greater than 1</b>,
203203
and pageSize <b>should be between 1 and 100 results</b> (per page). You can also <b>filter</b> using the similar object structure as the parent query,
204204
but currently <b>filtering is not supported</b>, you can only provide field for sorting.
205205
This query will search
206-
<pre>
207-
{<br/>
208-
jobs(<br/>
209-
pageNumber: 1,<br/>
210-
pageSize: 25,<br/>
211-
) {<br/>
212-
content {<br/>
213-
jobName,<br/>
214-
deployments {<br/>
215-
id<br/>
216-
executions(<br/>
217-
pageNumber: 1,<br/>
218-
pageSize: 5<br/>
219-
filter: [{<br/>
220-
property: "deployments.executions.startTime",<br/>
221-
sort: "DESC",<br/>
222-
}],<br/>
223-
) {<br/>
206+
```
207+
{
208+
jobs(
209+
pageNumber: 1,
210+
pageSize: 25,
211+
) {
212+
content {
213+
jobName,
214+
deployments {
215+
id
216+
executions(
217+
pageNumber: 1,
218+
pageSize: 5,
219+
filter: [{
220+
teamNameIn: ["starshot"]
221+
}],
222+
order: {
223+
property: "startTime",
224+
direction: DESC
225+
}
226+
) {
224227
id
225228
status
226229
startTime
227230
endTime
228-
{</br>
229-
}<br/>
230-
}<br/>
231-
}<br/>
232-
}<br/>
233-
</pre><br/>
231+
{
232+
}
233+
}
234+
}
235+
}
236+
```
234237
235238
Full example of currently available for fetching fields. Note that if you combine searching and filtering, first
236239
it will apply filters and then within filtered jobs it will apply the search, vice versa is currently not supported:
237-
<pre>
238-
{<br/>
239-
jobs(<br/>
240-
pageNumber: 1,<br/>
241-
pageSize: 25,<br/>
242-
search: "daily",<br/>
243-
filter: [{<br/>
244-
property: "jobName",<br/>
245-
pattern: "import-sql",<br/>
246-
},{<br/>
247-
property: "team",<br/>
248-
pattern: "starshot",<br/>
249-
sort: "DESC" <br/>
250-
},{<br/>
251-
property: "deployments.enabled",<br/>
252-
pattern: "enabled",<br/>
253-
}],<br/>
254-
) {<br/>
255-
content {<br/>
256-
jobName<br/>
257-
config {<br/>
258-
team<br/>
259-
description<br/>
260-
sourceUrl<br/>
261-
schedule {<br/>
262-
scheduleCron<br/>
263-
nextRunEpochSeconds<br/>
264-
}<br/>
265-
contacts {<br/>
266-
notifiedOnJobFailureUserError<br/>
267-
notifiedOnJobFailurePlatformError<br/>
268-
notifiedOnJobSuccess<br/>
269-
notifiedOnJobDeploy<br/>
270-
}<br/>
271-
}<br/>
272-
deployments {<br/>
273-
id<br/>
274-
enabled<br/>
275-
jobVersion<br/>
276-
mode<br/>
277-
executions(<br/>
278-
pageNumber: 1,<br/>
279-
pageSize: 25<br/>
280-
filter: [{<br/>
281-
property: "deployments.executions.status",<br/>
282-
sort: "ASC",<br/>
283-
}],<br/>
284-
) {<br/>
285-
id<br/>
286-
type<br/>
287-
status<br/>
288-
message<br/>
289-
startTime<br/>
290-
endTime<br/>
291-
opId<br/>
292-
vkdVersion<br/>
293-
jobVersion<br/>
294-
jobSchedule<br/>
295-
resourcesCpuRequest<br/>
296-
resourcesCpuLimit</br>
297-
resourcesMemoryRequest</br>
298-
resourcesMemoryLimit</br>
299-
deployedDate</br>
300-
deployedBy</br>
301-
startedBy</br>
302-
logsUrl</br>
303-
}<br/>
304-
}<br/>
305-
}<br/>
306-
totalPages<br/>
307-
totalItems<br/>
308-
}<br/>
309-
}<br/>
310-
}<br/>
311-
</pre><br/>
240+
```
241+
{
242+
jobs(
243+
pageNumber: 1,
244+
pageSize: 25,
245+
search: "daily",
246+
filter: [{
247+
property: "jobName",
248+
pattern: "import-sql",
249+
},{
250+
property: "team",
251+
pattern: "starshot",
252+
sort: DESC
253+
},{
254+
property: "deployments.enabled",
255+
pattern: "enabled",
256+
}],
257+
) {
258+
content {
259+
jobName
260+
config {
261+
team
262+
description
263+
sourceUrl
264+
schedule {
265+
scheduleCron
266+
nextRunEpochSeconds
267+
}
268+
contacts {
269+
notifiedOnJobFailureUserError
270+
notifiedOnJobFailurePlatformError
271+
notifiedOnJobSuccess
272+
notifiedOnJobDeploy
273+
}
274+
}
275+
deployments {
276+
id
277+
enabled
278+
jobVersion
279+
mode
280+
executions(
281+
pageNumber: 1,
282+
pageSize: 25,
283+
filter: [{
284+
teamNameIn: ["starshot"]
285+
}],
286+
order: {
287+
property: "startTime",
288+
direction: DESC
289+
}
290+
) {
291+
id
292+
type
293+
status
294+
message
295+
startTime
296+
endTime
297+
opId
298+
vkdVersion
299+
jobVersion
300+
jobSchedule
301+
resourcesCpuRequest
302+
resourcesCpuLimit
303+
resourcesMemoryRequest
304+
resourcesMemoryLimit
305+
deployedDate
306+
deployedBy
307+
startedBy
308+
logsUrl
309+
}
310+
}
311+
}
312+
totalPages
313+
totalItems
314+
}
315+
}
316+
}
317+
```
312318
313319
parameters:
314320
- name: team_name

0 commit comments

Comments
 (0)