Uploaded image for project: 'RAML Module Builder'
  1. RAML Module Builder
  2. RMB-906

comparison and sort should obey fields' natural types by default

    XMLWordPrintable

Details

    • Story
    • Status: Open (View Workflow)
    • TBD
    • Resolution: Unresolved
    • None
    • None
    • None
    • CP: Non-roadmap backlog
    • Core: Platform
    • TBD

    Description

      Overview:

      Allow to declare number fields in schema.json so that comparison and sort by default use number order, not string order.

      Workaround:

      https://github.com/folio-org/raml-module-builder/tree/v33.2.9#cql-matching-comparing-and-sorting-numbers says:

      Add the /number modifier to enable number matching, comparing and sorting, for example age ==/number 18, age >=/number 21 and sortBy age/number.

      The workaround requires additional front-end effort:

      https://github.com/folio-org/ui-requests/pull/904/commits/4c8b5f968ebc0ad17c1563c6a01437a0d20235af

      This additional effort is not justified and should be avoided.

      Additional information:

      A field "foo" may contain a String in one record and a number in some other record:

      "foo": 1
      "foo": "2"
      "foo": "3b" 

      CQL2PgJson doesn't know the data content when building the query.

      This can only be fixed if a field is explicitly declared as number in schema.json.

      Current implementation that requires the workaround:

      https://github.com/folio-org/raml-module-builder/blob/v33.2.9/cql2pgjson/src/main/java/org/folio/cql2pgjson/CQL2PgJSON.java#L983-L984

      https://github.com/folio-org/raml-module-builder/blob/v33.2.9/cql2pgjson/src/main/java/org/folio/cql2pgjson/CQL2PgJSON.java#L405-L409

      Implementation:

      Add a "number" array to the table entry in schema.json similar to the "index" array:

      "number": {
        [ { "fieldName": "foo" },
          { "fieldName": "request.position" }
        ]
      } 

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                zburke Zak_Burke
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:

                  TestRail: Runs

                    TestRail: Cases