Skip to content

Specify sorting order in schema #197

Description

@VeaaC

Flatdata archives often utilize sorted resources, and a binary search to find elements withing those. It is easy to mess up the sorting when creating archive, though, leading to (sometimes) subtle bugs.

In order to avoid such bugs, it would be a nice feature if one could specify the ordering criteria for a collection directly in the flatdata specification.
This may not be possible for all collections (i.e., when the ordering criteria are not simple). But it could be helpful for most cases.

When the ordering criteria are specified, flatdata could auto-generate:

  • method(s) to find an element (or range of elements) in the collection
  • method(s) to validate sort order (e.g., when serializing a collection, flatdata generated code could throw an exception of the items being serialized are not in correct order).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions