Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolver: Handle malformed URIs and provide error messages #307

Merged
merged 3 commits into from
Sep 20, 2024

Conversation

martastain
Copy link
Member

@martastain martastain commented Aug 2, 2024

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 martastain linked an issue Aug 2, 2024 that may be closed by this pull request
@martastain martastain self-assigned this Aug 2, 2024
@martastain martastain added the type: enhancement Improvement of existing functionality or minor addition label Aug 2, 2024
@martastain martastain requested review from BigRoy and Lypsolon August 2, 2024 13:13
api/resolve/__init__.py Outdated Show resolved Hide resolved
Copy link
Contributor

@BigRoy BigRoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me - did have the one comment about the entities field now being optional and potentially being None. ⚠️

@martastain
Copy link
Member Author

@Lypsolon could we merge this? It nows return an empty list instead of null when there's an error

@Lypsolon
Copy link

@Lypsolon could we merge this? It nows return an empty list instead of null when there's an error

i think we can merge it.

i will say i believe recovering false URIs is not the best idea as it will further hurt the performance.

@martastain martastain merged commit 2d7f25b into develop Sep 20, 2024
@martastain martastain deleted the 286-resolver-sane-responses-in-the-case-of-errors branch October 21, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resolver: Sane responses in the case of errors
3 participants