Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-4521

Put dynamic workflowgroup links on Collections in an array

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Medium
    • Resolution: Duplicate
    • Affects Version/s: 7.0
    • Fix Version/s: None
    • Component/s: REST API v7
    • Labels:
      None
    • Attachments:
      0
    • Comments:
      4
    • Documentation Status:
      Needed

      Description

      The links to workflow groups are currently implemented on the collection endpoint as follows:

       "_links":{
       ...
       "workflowGroups/editor": {
       "href": "https://rest.url/api/core/collections/{id}/workflowGroups/editor"
       },
       "workflowGroups/finaleditor": {
       "href": "https://rest.url/api/core/collections/{id}/workflowGroups/finaleditor"
       },
       "workflowGroups/reviewer": {
       "href": "https://rest.url/api/core/collections/{id}/workflowGroups/reviewer"
       }
       }
      

      Exactly which workflow group links exist is variable. While this is valid HAL, doing it this way makes it less useful in TypeScript

      Currently the links on each model are part of the class. That way we can use type checking to detect when a link is used that can't exist, either directly on the model, or even as a string in a followLink() call. If you use a link that doesn't exist, the IDE will immediately point that out. The IDE can also autocomplete links in various contexts etc.

      With the way workflowGroup links work now the best we can do is specify in the class: there can be a variable number of links with names I can't predict, and that means we'll lose most of those type checking advantages.

      So I propose we use an array instead, in this case, and for future cases where we have a dynamic set of links:

       "_links":{
       ...
       "workflowGroups": [
       {
       "name": "editor",
       "href": "https://rest.url/api/core/collections/{id}/workflowGroups/editor"
       },
       {
       "name": "finaleditor",
       "href": "https://rest.url/api/core/collections/{id}/workflowGroups/finaleditor"
       },
       {
       "name": "reviewer",
       "href": "https://rest.url/api/core/collections/{id}/workflowGroups/reviewer"
       }
       ]
       }
      

      This is also perfectly valid HAL, but trivial to model in a TypeScript class: workflowGroups: HALLink[]. It limits the variability to just that workflowGroups link, and it also implies that all the links in the list represent resources of the same type.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            Art Lowel Art Lowel (Atmire)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: