ayon-backend icon indicating copy to clipboard operation
ayon-backend copied to clipboard

Resolver: Handle malformed URIs and provide error messages

Open martastain opened this issue 6 months ago • 0 comments

When a provided URI is malformed or does not make sense, return "error" field with the problem description instead of empty entity list.

When a URI issue is recoverable (such as "cAsEiNsEnSiTiVe" version name), attempt to fix the problem

[
  {
    "uri": "ayon+entity://ayontest/asset/char_hero?product=usdAsset&version=v00000021&representation=usd",
    "entities": [
      {
        "projectName": "ayontest",
        "folderId": "ac991b60b4cb11eeb7fc7730318c5a70",
        "productId": "506507b5ec8b11ee86565feb1905149c",
        "versionId": "d21458da394211ef8d7e0b740ae1b9fa",
        "representationId": "d21ee02e394211ef8c180b740ae1b9fa",
        "filePath": "{root[work]}/ayontest/asset/char_hero/publish/usd/usdAsset/v021/ynts_char_hero_usdAsset_v021.usd",
        "target": "representation"
      }
    ]
  },
  {
    "uri": "ayon+entity://ayontest/asset/char_hero?product=usdAsset&version=lAtEsT&representation=usd",
    "entities": [
      {
        "projectName": "ayontest",
        "folderId": "ac991b60b4cb11eeb7fc7730318c5a70",
        "productId": "506507b5ec8b11ee86565feb1905149c",
        "versionId": "1aa7484c4b5711efab716f26fd95f971",
        "representationId": "1ab343554b5711efb2fc6f26fd95f971",
        "filePath": "{root[work]}/ayontest/asset/char_hero/publish/usd/usdAsset/v025/ynts_char_hero_usdAsset_v025.usd",
        "target": "representation"
      }
    ]
  },
  {
    "uri": "ayon+entity://ayontest/asset/char_hero?product=usdAsset&version=vr0025&representation=usd",
    "error": "Invalid version name: vr0025"
  },
  {
    "uri": "ayon+entity://ayontest/asset/char_hero?product=usdAsset&version=v0025&task=modeling",
    "error": "Tasks and workfiles cannot be queried with products"
  },
  {
    "uri": "ayon+entity://ayontest/asset/char_hero?product=bambul\u00e1k",
    "error": "Invalid name: bambul\u00e1k"
  },
  {
    "uri": "ayon+entity://k\u0148our/flabadob/blib/blub/blip",
    "error": "Invalid project name: k\u0148our"
  },
  {
    "uri": "ayon+entity://ayontest/chrrr!",
    "error": "Invalid path element: chrrr!"
  }
]

martastain avatar Aug 02 '24 13:08 martastain