nuance-communications / mix-cli

A command line tool for the Mix V4 authoring API
Apache License 2.0
14 stars 2 forks source link

Fix inconsistencies between client-driven and backend-driven sort #95

Open grof opened 1 year ago

grof commented 1 year ago

Certain commands call endpoints that don't provide a sortBy parameter. These commands use the sort feature provided by cli.table instead. Other commands take advantage of the sortBy parameter when supported by the endpoint.

A first issue is with the way sorting is specified in the client vs. the backend. The client expects to see a column name with a +/- sign, as in "+ProjectId". The backend expects the property name with a +/- sign, as in "+projectId". We should let users enter "projectId" or "ProjectId" and normalize internally. This will only get applied to the first letter of the column/property, the rest of the column/property will be left as is.

A second issue is that the underlyingMixCommand:outputCLITable() grabs all the command options provided by the user and passes them to cli.table(). As a result, the sort parameter is passed and this creates unexpected behavior for commands that use backend-driven sort. The way the options are passed to MixCommand:outputCLITable() needs to be revisited.

If I remember correctly, certain commands have already been upgraded to use the sort functionality on the backend side. A first step will be to go through the existing commands that offer a sort option and identify those that are not yet making use of the backend sort functionality (if it is available on the endpoint). Those commands are the ones that will need to be updated in this issue.

grof commented 1 year ago

@TheTrio or @Jayk5 : I think one of you has looked into this. Can you comment here if there was anything to do? I seem to remember you had reported all was good. If so, please confirm. Thanks!

TheTrio commented 1 year ago

@grof I think this can be closed as well