Sorting
SortOrder
The order to sort by.
Value | Description |
---|---|
asc | Ascending order |
desc | Descending order |
enum SortOrder { asc, desc,}
$schema: https://json-schema.org/draft/2020-12/schema$id: SortOrder.yamltype: stringenum: - asc - desc
SortQueryParams
Query parameters for sorting. These parameters should be used on GET routes that support sorting.
Parameter | Type | Description |
---|---|---|
sortBy | unknown | The field to sort by, should be an enum for individual routes |
customSortBy | string | An implementation-defined sort key |
sortOrder | SortOrder | The order to sort by |
/** Query parameters for sorting */model SortQueryParams { /** The field to sort by */ @query @example("lastModifiedAt") sortBy: unknown;
/** Implementation-defined sort key */ @query @example("customField") customSortBy?: string;
/** The order to sort by */ @query @example(SortOrder.asc) sortOrder?: SortOrder;}
/common-grants/opportunities: get: parameters: - $ref: "#/components/parameters/CommonGrants.Sorting.SortQueryParams.sortBy" - $ref: "#/components/parameters/CommonGrants.Sorting.SortQueryParams.customSortBy" - $ref: "#/components/parameters/CommonGrants.Sorting.SortQueryParams.sortOrder"
Where the references to the parameters are defined as follows:
components: parameters: CommonGrants.Sorting.SortQueryParams.sortBy: name: sortBy in: query required: false description: The field to sort by, should be an enum for individual routes schema: # These would be defined by the protocol for a given route type: string enum: - lastModifiedAt - createdAt - title - status - closeDate - maxAwardAmount explode: false CommonGrants.Sorting.SortQueryParams.customSortBy: name: customSortBy in: query required: false description: An implementation-defined sort key schema: type: string explode: false CommonGrants.Sorting.SortQueryParams.sortOrder: name: sortOrder in: query required: false description: The order to sort by schema: $ref: "#/components/schemas/CommonGrants.Sorting.SortOrder"
/common-grants/opportunities?sortBy=lastModifiedAt&sortOrder=asc
SortBodyParams
Body parameters for sorting. These parameters should be used on POST and PUT routes that support sorting.
Parameter | Type | Description |
---|---|---|
sortBy | unknown | The field to sort by, should be an enum for individual routes |
customSortBy | string | An implementation-defined sort key |
sortOrder | SortOrder | The order to sort by |
/** Sorting parameters included in the request body */model SortBodyParams { /** The field to sort by */ @example("lastModifiedAt") sortBy: unknown;
/** Implementation-defined sort key */ @example("customField") customSortBy?: string;
/** The order to sort by */ @example(SortOrder.asc) sortOrder?: SortOrder;}
/common-grants/opportunities: post: requestBody: content: application/json: schema: $ref: "#/components/schemas/CommonGrants.Sorting.SortBodyParams"
Where the reference to the schema is defined as follows:
components: schemas: CommonGrants.Sorting.SortBodyParams: type: object properties: sortBy: # These would be defined by the protocol for a given route type: string enum: - lastModifiedAt - createdAt - title - status - closeDate - maxAwardAmount customSortBy: type: string sortOrder: $ref: "#/components/schemas/CommonGrants.Sorting.SortOrder"
Sorting by a protocol-defined field:
{ "sortBy": "lastModifiedAt", "sortOrder": "asc"}
Sorting by an implementation-defined field:
{ "sortBy": "custom", "customSortBy": "customField", "sortOrder": "asc"}
SortInfo
Information about the sort order of the items returned. This model should be used to represent the sorting details in responses.
Parameter | Type | Description |
---|---|---|
sortBy | string | The field to sort by |
customSortBy | string | An implementation-defined sort key |
sortOrder | SortOrder | The order to sort by |
/** Information about the sort order of the items returned */model SortInfo { /** The field to sort by */ @example("lastModifiedAt") sortBy: string;
/** Implementation-defined sort key */ @example("customField") customSortBy?: string;
/** The order to sort by */ @example(SortOrder.asc) sortOrder?: SortOrder;}
$schema: https://json-schema.org/draft/2020-12/schema$id: SortInfo.yamltype: objectproperties: sortBy: type: string description: The field to sort by customSortBy: type: string description: An implementation-defined sort key sortOrder: $ref: "#/components/schemas/CommonGrants.Sorting.SortOrder" description: The order to sort by
{ "sortBy": "lastModifiedAt", "customSortBy": "customField", "sortOrder": "asc"}