Sorting
SortOrder
Section titled “SortOrder”The order or direction to sort results by.
Value | Description |
---|---|
asc | Ascending order (e.g., low to high or A to Z) |
desc | Descending order (e.g., high to low or Z to A) |
Formats
Section titled “Formats”A JSON example of this model.
"asc"
The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: SortOrder.yamltype: stringenum: - asc - desc
The TypeSpec code for this model.
enum SortOrder { asc, desc,}
SortQueryParams
Section titled “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 |
Formats
Section titled “Formats”A JSON example of this model.
/common-grants/opportunities?sortBy=lastModifiedAt&sortOrder=asc
The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: SortQueryParams.yamltype: objectproperties: sortBy: examples: - lastModifiedAt description: The field to sort by customSortBy: type: string examples: - customField description: Implementation-defined sort key sortOrder: $ref: SortOrder.yaml examples: - asc description: The order to sort byrequired: - sortBydescription: Query parameters for sorting
The TypeSpec code for this model.
/** 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;}
SortBodyParams
Section titled “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 |
Formats
Section titled “Formats”A JSON example of this model.
{ "sortBy": "lastModifiedAt", "sortOrder": "asc"}
The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: SortBodyParams.yamltype: objectproperties: sortBy: examples: - lastModifiedAt description: The field to sort by customSortBy: type: string examples: - customField description: Implementation-defined sort key sortOrder: $ref: SortOrder.yaml examples: - asc description: The order to sort byrequired: - sortBydescription: Sorting parameters included in the request body
The TypeSpec code for this model.
/** 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;}
SortedResultsInfo
Section titled “SortedResultsInfo”Information about the sort order of the items returned. This model should be included in responses that support sorting.
Parameter | Type | Description |
---|---|---|
sortBy | string | The field to sort by |
customSortBy | string | An implementation-defined sort key |
sortOrder | SortOrder | The order to sort by |
errors | Array<string> | The errors that occurred during sorting |
Formats
Section titled “Formats”A JSON example of this model.
{ "sortBy": "lastModifiedAt", "customSortBy": "customField", "sortOrder": "asc"}
The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: SortedResultsInfo.yamltype: objectproperties: sortBy: type: string examples: - lastModifiedAt description: The field results are sorted by, or "custom" if an implementation-defined sort key is used customSortBy: type: string examples: - customField description: Implementation-defined sort key used to sort the results, if applicable sortOrder: $ref: SortOrder.yaml examples: - asc description: The order in which the results are sorted, e.g. ascending or descending errors: type: array items: type: string description: Non-fatal errors that occurred during sortingrequired: - sortBy - sortOrderdescription: Information about the sort order of the items returned
The TypeSpec code for this model.
/** Information about the sort order of the items returned */model SortedResultsInfo { /** The field results are sorted by, or "custom" if an implementation-defined sort key is used */ @example("lastModifiedAt") sortBy: string;
/** Implementation-defined sort key used to sort the results, if applicable */ @example("customField") customSortBy?: string;
/** The order in which the results are sorted, e.g. ascending or descending */ @example(SortOrder.asc) sortOrder: SortOrder;
/** Non-fatal errors that occurred during sorting */ errors?: string[];}