Skip to content

Enhancements in "sorting" feature #448

@PedroDiez

Description

@PedroDiez

Problem description
Current Commonalities Sorting section indicates

Image

This section is moved without changes to the new Commonalities refactor in PR #441 into section ### 4.2. Sorting.

Around this section a fair point has been raised about the default value for order

This issue is open to discuss and agree in clarifications for the default value for this concept to be added in new section ### 4.2. Sorting, once PR#441 is merged.

Some background:

  • When indicating this definition probably it was mainly thinking in dates or numerical concepts for orderBy where it makes sense to have descending order as default (most recent items first, higher values first).

  • However, when the concept is a "string" (alphanumeric value), it makes sense to be ascending order (from "a" to "z", from "0" to "9").

For combination scenarios (sorting by more than one concept), could be several ways. I think two options would be reasonable from beginning:

  • Delegate to the API WG and document in the API
  • Model order "default" value based on the nature of the first concept indicated in orderBy

Possible evolution

Enhance the rules for order default value:

  • When orderBy only contains an attribute:
    • In case it represents a date, date-time or numeric attribute: order default value is desc.
    • In case it represents a string alphanumeric attribute: order default value is asc.
  • When orderBy contains several attributes:
    • order default value is decided based on the nature of the first attribute, according to previous bullet, as aligned and agreed in the specific API Working Group for the API. Therefore it is needed to agree in the first attribute to be indicated (*)
    • Specific considerations about sorting logic can be decided upon internal agreement in the specific API Working Group

(*) Otherwise we would need to think in a flexible model indicating the default order value for each orderBy attribute allowed, and based on the attributes indication in the query, apply that ordering.

Alternative solution
Based on discussion

Additional context
NOTE: For the second bullet (When orderBy contains several attributes:) currently there are no real use cases in CAMARA yet. Other option is to not define this yet and not allowed this option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fall25documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions