Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-14631

Add more attributes to REST resource for asset

Details

    • Improvement
    • Resolution: Done
    • Major
    • 3.29.0
    • 3.0.0
    • REST
    • 4

    Description

      The current asset resource as of 3.7 is

      {
        "downloadUrl": "http://127.0.0.1:8081/repository/maven-central/antlr/antlr/2.7.2/antlr-2.7.2.jar",
        "path": "antlr/antlr/2.7.2/antlr-2.7.2.jar",
        "id": "bWF2ZW4tY2VudHJhbDozZjVjYWUwMTc2MDIzM2I2MzA4OThiZjZmZTFkOTE2NA",
        "repository": "maven-central",
        "format": "maven2"
      }

      This is missing a lot of the available attributes for the asset. I am recommending to add the following:

      • content type
      • checksums (sha1 for all formats, possibly other checksums as support?)
      • an map of attributes for the format (more below)
      • possibly (up for debate):
        • etag (tbd as we have it in ES, not sure about Orient)
        • last modified

      A sample maven payload:

      {
        "downloadUrl": "http://127.0.0.1:8081/repository/maven-central/antlr/antlr/2.7.2/antlr-2.7.2.jar",
        "path": "antlr/antlr/2.7.2/antlr-2.7.2.jar",
        "id": "bWF2ZW4tY2VudHJhbDozZjVjYWUwMTc2MDIzM2I2MzA4OThiZjZmZTFkOTE2NA",
        "repository": "maven-central",
        "format": "maven2",
        "maven2": {
          "extension": "jar",
          "baseVersion": "2.7.2",
          "groupId": "antlr",
          "artifactId": "antlr",
          "version": "2.7.2",
          "assetKind": "ARTIFACT"
        },
        "checksum": {
          "sha1": "546b5220622c4d9b2da45ad1899224b6ce1c8830",
          "md5": "a73459120df5cadf75eaa98453433a01"
        },
        "lastModified": "2017-10-17T18:04:09Z"
      }
      

      This would mean the 'maven2' attribute would be dynamic. i.e. would be called 'npm' for npm format, 'nuget' for nuget, etc... and the contents would vary by format. Alternatively we could hard-code it to 'attributes' or something, but for API design you usually want to have consistency within a sub-resource. So I would prefer a changing name over changing attributes. Essentially a client has to grab the 'format' value and then find an attribute named that.

      Attachments

        Issue Links

          Activity

            People

              mkearns Michael Kearns
              cpeters Collin Peters
              Joe Tom Joe Tom
              NXRM - Gunter
              Votes:
              9 Vote for this issue
              Watchers:
              18 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                tigCommentSecurity.panel-title