•  
      request #9475 bind_value_ids are strings with a field of type sb (select box)
    Infos
    #9475
    Patrick-Jeffrey Pollo Guilbert (epatpol)
    2016-09-13 22:15
    2016-09-12 17:19
    9746
    Details
    bind_value_ids are strings with a field of type sb (select box)

    When using the following route : [GET] api/v1/tracker_reports/247/artifacts?values=all on the tuleap.net repository I get some values with are of type sb with string bind_values_ids. In the Mylyn Tuleap connector, this causes an exception as the connector expect numbers for select boxes, and strings for open lists. For example, this is an example where the bind_value_ids are Strings :

          {
            "field_id": 1511,
            "type": "sb",
            "label": "Support Team",
            "values": [
              {
                "id": "101",
                "uri": "user_groups/101",
                "label": "Developer",
                "users_uri": "user_groups/101/users",
                "short_name": "Developer",
                "key": "Developer"
              }
            ],
            "bind_value_ids": [
              "101"
            ]
          }

    and another where they are numbers :

          {
            "field_id": 1082,
            "type": "sb",
            "label": "Reported in version",
            "values": [
              {
                "id": "3229",
                "label": "6.8",
                "color": null
              }
            ],
            "bind_value_ids": [
              3229
            ]
          }

    As discussed in the mailing list, should I work my way around that in the connector code or is it easily fixable in the api route? 

    Best regards,

    Patrick

    API
    8.18
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Empty
    New
    Empty
    Attachments
    Empty
    References
    References list is empty

    Follow-ups

    User avatar
    AFAIK only user groups can have their identifier as string.

    As of today every list fields (selectbox, multiselectbox, openlist, checkbox, radio) can have three types of values:
    * users (nterray, epatpol, …)
    * user groups (Developers, Contractors, …)
    * static values (Todo, OnGoing, Done)

    This information is given by the property "bindings" for a field in the structure of the tracker.

    Does this information help you to find a workaround?
    User avatar
    Just a question, was it always like that? I can't imagine the mylyn connector working fine several years ago with this kind of logic. A lot is built around the fact that Tuleap select boxes can only accept values with int identifiers. Right now even if I use the type field in the JSON response ("sb") in this case, the connector expects only integers.

    Are there a lot of fields which can have string identifiers in select boxes? Or is it a more generic thing, where people could create their own fields and this way it would be very difficult to simply disregard these kind of fields...

    Thanks!
    User avatar
    Hmmm this would require more work, as TuleapSelectBox only expects BoundFieldValues which have values of type int only, and "101_3" is a string. I'm not sure what the correct course of action is here... I guess I would have to change BoundFieldValue to accept String as correct values. I'll see what that implies.
    User avatar
    Thanks for the explanation @nterray , I knew there was a reason for this!

    As for the type of the fields, yes I was wondering why the code didn't simply check the type instead of verifying the bind_values and creating an appropriate field in Eclipse.

    I'll see if this can easily be fixed in the connector and update this bug accordingly.
    User avatar
    After deeper investigation, we cannot always return an id because there are cases where id is a string. For example a user group may have id "101_3".

    You should base the behavior of the connector on the field type instead. [GET] api/v1/trackers/140 will return the structure of the tracker and you can distinguish open lists and selectboxes:
    * type=tbl: open list
    * type=sb: select box
    * type=msb: multiselectbox
    * type=cb: checkbox
    * type=rb: radio button

    Does it answer the question?

    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes