Skip to content

Commit 2bca27a

Browse files
committed
Add paging documentation.
1 parent d15f3c4 commit 2bca27a

File tree

1 file changed

+171
-0
lines changed
  • documentation/developer-guide/modules/tooling-guide/pages

1 file changed

+171
-0
lines changed

documentation/developer-guide/modules/tooling-guide/pages/bamm-cli.adoc

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,177 @@ As these entries are rather of static character without direct references to any
345345
* a general Collection - cursor and/or offset based paging
346346
* TimeSeries - cursor, offset and/or time based paging
347347

348+
For all these paging mechanisms, an additional entry with the name `PagingSchema` is generated in the `components/schemas` part of the specification,
349+
which is then used as the main response schema for the Aspect. Basically, instead of a single Aspect, a collection of Aspects is returned,
350+
together with optional total number of Aspects available in the collection:
351+
352+
[source,JSON]
353+
----
354+
"PagingSchema" : {
355+
"type" : "object",
356+
"properties" : {
357+
"items" : {
358+
"type" : "array",
359+
"items" : {
360+
"$ref" : "#/components/schemas/Test"
361+
}
362+
},
363+
"totalItems" : {
364+
"type" : "number"
365+
}
366+
}
367+
}
368+
----
369+
370+
Depending on the concrete paging model selected, there can be additional properties in the `PagingSchema` object.
371+
For cursor based paging, the `cursor` object denotes the position of the returned Aspects in relation to some other
372+
uniquely identifiable Aspect (`before` or `after` it):
373+
374+
[source,JSON]
375+
----
376+
"cursor" : {
377+
"type" : "object",
378+
"properties" : {
379+
"before" : {
380+
"type" : "string",
381+
"format" : "uuid"
382+
},
383+
"after" : {
384+
"type" : "string",
385+
"format" : "uuid"
386+
}
387+
}
388+
},
389+
----
390+
391+
For offset and time based paging, the data is returned in batches of requested size ("pages"), described using the following properties (the meaning of which is self explanatory):
392+
393+
[source,JSON]
394+
----
395+
"totalPages" : {
396+
"type" : "number"
397+
},
398+
"pageSize" : {
399+
"type" : "number"
400+
},
401+
"currentPage" : {
402+
"type" : "number"
403+
}
404+
----
405+
406+
In addition to the `PagingSchema` object, also several new parameters are added to the request parameters section of the generated document,
407+
with the help of which the size and/or the relative position of the returned data can be controlled.
408+
All paging mechanisms have the following parameters in common, the meaning of which can be discerned from their descriptions:
409+
410+
[source,JSON]
411+
----
412+
{
413+
"name" : "count",
414+
"in" : "query",
415+
"description" : "Number of items to return per call.",
416+
"required" : false,
417+
"schema" : {
418+
"type" : "number"
419+
}
420+
},
421+
{
422+
"name" : "totalItemCount",
423+
"in" : "query",
424+
"description" : "Flag that indicates that the total counts should be returned.",
425+
"required" : false,
426+
"schema" : {
427+
"type" : "boolean"
428+
}
429+
}
430+
----
431+
432+
Depending on the exact paging model selected, additional paging specific parameters are available.
433+
For offset based paging:
434+
[source,JSON]
435+
----
436+
"name" : "start",
437+
"in" : "query",
438+
"description" : "Starting index which is starting by 0",
439+
"required" : false,
440+
"schema" : {
441+
"type" : "number"
442+
}
443+
----
444+
445+
For cusrsor based paging:
446+
[source,JSON]
447+
----
448+
{
449+
"name" : "previous",
450+
"in" : "query",
451+
"description" : "URL to request the previous items. An empty value indicates there are no previous items.",
452+
"required" : false,
453+
"schema" : {
454+
"type" : "string",
455+
"format" : "uri"
456+
}
457+
},{
458+
"name" : "next",
459+
"in" : "query",
460+
"description" : "URL to request the next items. An empty value indicates there are no other items.",
461+
"required" : false,
462+
"schema" : {
463+
"type" : "string",
464+
"format" : "uri"
465+
}
466+
}, {
467+
"name" : "before",
468+
"in" : "query",
469+
"description" : "The cursor that points to the start of the page of items that has been returned.",
470+
"required" : false,
471+
"schema" : {
472+
"type" : "string",
473+
"format" : "uuid"
474+
}
475+
}, {
476+
"name" : "after",
477+
"in" : "query",
478+
"description" : "The cursor that points to the end of items that has been returned.",
479+
"required" : false,
480+
"schema" : {
481+
"type" : "string",
482+
"format" : "uuid"
483+
}
484+
}
485+
----
486+
487+
And finally for the time based paging:
488+
[source,JSON]
489+
----
490+
{
491+
"name" : "since",
492+
"in" : "query",
493+
"description" : "A timestamp that points to the start of the time-based data.",
494+
"required" : false,
495+
"schema" : {
496+
"type" : "string",
497+
"format" : "date-time"
498+
}
499+
}, {
500+
"name" : "until",
501+
"in" : "query",
502+
"description" : "A timestamp that points to the end of the time-based data.",
503+
"required" : false,
504+
"schema" : {
505+
"type" : "string",
506+
"format" : "date-time"
507+
}
508+
}, {
509+
"name" : "limit",
510+
"in" : "query",
511+
"description" : "Number of items to return per call.",
512+
"required" : false,
513+
"schema" : {
514+
"type" : "number"
515+
}
516+
}
517+
----
518+
348519
[[models-directory-structure]]
349520
== Understanding the models directory structure
350521

0 commit comments

Comments
 (0)