[MGNLCT-185] Ensure external assets are reference-able in content types (as fields) Created: 11/Aug/21  Updated: 20/Oct/21  Resolved: 09/Sep/21

Status: Closed
Project: Content Types
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Story Priority: Major
Reporter: Aleksandr Pchelintcev Assignee: Jorge Franco
Resolution: Not an issue Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
is cloned by MGNLGQL-104 GraphQL can query assets - also when ... Open
Template:
Acceptance criteria:
[X]* asset CT property type is available in SaaS environment and provides linking to S3 assets
[X]* assets can be used in GraphQL - now covered by graphQL ticket
[X]* assets can be linked and expanded in delivery endpoints
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:
Epic Link: Imaging and External DAM
Sprint: Cloud Service 17
Story Points: 3

 Description   

There is an asset content type defined for the dam-jcr module, which lets other content types define asset-typed properties and thus link to JCR assets.

 Note:

By default the asset chooser should allow picking from all available providers.

 

 



 Comments   
Comment by Christopher Zimmermann [ 01/Sep/21 ]

This is probably two problems:

  1. Content Types asset field only works with jcr assets - we need nice similar support for external assets.
  2. Cannot query assets with GraphQL when dam-jcr is missing. This depends on point 1 but there will need to be some adjustments.

Ticket split - GraphQL is now covered explicitly in: https://jira.magnolia-cms.com/browse/MGNLGQL-104

Comment by Christopher Zimmermann [ 02/Sep/21 ]

1st acceptance criteria is working for me as expected - based on this definitinon - see end:

model:
  nodeType: activity
  properties:
    name:
      label: Name
      i18n: true
      required: true
    description:
      type: richText
      label: Description - 6
      i18n: true
      required: false
      
    image:
      type: asset
Comment by Christopher Zimmermann [ 02/Sep/21 ]

However when I hit this rest delivery endpoint, the image reference is not "expanded" as expected.

 

class: info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpointDefinition
workspace: activities
bypassWorkspaceAcls: true

references:
  - name: assetReference
    propertyName: image
    referenceResolver:
      class: info.magnolia.rest.reference.dam.AssetReferenceResolverDefinition

 

 

Even though I added the reference - I still get - with the image not "expanded":

{
  "results": [
    {
      "@name": "Drone-flying",
      "@path": "/Drone-flying",
      "@id": "937f9612-1400-4809-8aea-7c758bfa1307",
      "@nodeType": "activity",
      "description": "<p>We&#39;ll go as a team and see who can get the coolest images without getting their drone shot down.</p>\n",
      "name": "Drone flying",
      "image": "s3:dam.urk7mju12so5gik0.beta.de.magnolia-cloud.com/Roof-erik-mclean-H1dlyzRwpq0-unsplash.jpg",
      "@nodes": []
    }
  ]
}

 

Comment by Jorge Franco [ 08/Sep/21 ]

Hey czimmermann, I have checked content types in cloud, and is working as expected. If you provide the AssetReferenceResolverDefinition, then you should add at least one rendition, original is the default:

references: 
 - name: assetReference
   propertyName: image
   referenceResolver: 
    class: info.magnolia.rest.reference.dam.AssetReferenceResolverDefinition
    assetRenditions: 
      - original

And this is the result:

{
  "results": [
    {
      "image": {
        "@name": "sombrero.jpg",
        "@path": "dam.iz27cw4orduvw72p.beta.de.magnolia-cloud.com/images/sombrero.jpg",
        "@id": "s3:dam.iz27cw4orduvw72p.beta.de.magnolia-cloud.com/images/sombrero.jpg",
        "@link": "https://s3.eu-central-1.amazonaws.com/dam.iz27cw4orduvw72p.beta.de.magnolia-cloud.com/images/sombrero.jpg?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEF0aDGV1LWNlbnRyYWwtMSJHMEUCIQDPY0PIVicdY8xWbTYLJe4vTRD9J1q%2Fpa0L1iZEVvLy1AIgQup%2Bro4I5c%2BfgnecwDlAUs2cgaaFb8Lj0MAX94JMNj4qrAMIpv%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARABGgwwMjQxMTAyNzc0NzgiDJC249eF2QKDDiivnCqAA2WifpxnpqPXC5bE6OF2VPWmMuea6jolyVlv%2FKR6Tf%2B0CyBZUnDRMyDfZaC2W1UEf2iBcxzeMl5caIjODWVh8Vhyl36r6ooLiV6I0jAa5jKmszAOQOIF%2B%2BNDjm55Iad%2F3%2F4cquc%2FgePAz7%2FmBtWmi0R2IEBaKS%2Fgk6Id7EVls8CSPJgv5M%2FlGk5fdVHB8oE%2BaP1lukmUIusnP3h%2BxB49FPIB7vLS38%2BpvrWEQni%2FhovqlE1xKgFkgGzzPfRHScCNgYddNKFsuRrb2goCPUFcNfPw5eJPdAPqFz2m9jSIcOnNptojmZ5Z4seEoBqr2G%2FM%2BAAcdWKAV6fg0pjO%2FHEFEqS2UGjXwA2zhey0oGyTuY%2FR%2BJkzKIsHXNDZeqatcry46O4eWfpUDX%2BEdBZQWuNw8EVarWDJAJ6LCU6kWs5TYCEXKBvsIDLV2%2FQVeiulxofYG7rGwiGHnREu59ZqaHh3ASW0THEtqiNjTta%2FVb4Wl%2Brc9CKOS5d1TnvXDnFoQzgoITDG5%2BKJBjqmAdhDu%2Fym4c1rd%2FSDNkPwLoOhIWcqnGEo%2FJs4G8o5H84aSbGqWcxLRB15p1NK6NmnnZPZPDKxyKO3kY8%2BpIJ6VBvYVaN0WLIN%2B2ViHmsl6cHRAaQQ7FrlVxkYFdhpWnU1BMKqeb1l8djEa5Gszgygu%2FNE0ndUNTpw%2BwEUWmhTpC92O8i4rKuWDFBNJg8R6GqzX64WUSRE4cfjKph6AJ6rRJidk3vpuAU%5C%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20210908T140211Z&X-Amz-SignedHeaders=host&X-Amz-Expires=600&X-Amz-Credential=ASIAQLHIVUNTMTDJFZA3%2F20210908%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Signature=18fc62e14d8cd5a041bd3e0cf5bba2c29d1f7a41cd0e12f6fbc147cac9fb0683",
        "metadata": {
          "fileName": "sombrero.jpg",
          "mimeType": "image/jpeg",
          "fileSize": "0",
          "height": "0",
          "width": "0",
          "format": "image/jpeg",
          "source": "dam.iz27cw4orduvw72p.beta.de.magnolia-cloud.com/images/sombrero.jpg",
          "date": "2021-09-08T16:02:07.511+02:00",
          "created": "2021-09-08T16:02:07.511+02:00",
          "modified": "2021-09-08T16:02:07.511+02:00"
        },
        "renditions": {
          "original": {
            "mimeType": "image/jpeg",
            "link": "https://s3.eu-central-1.amazonaws.com/dam.iz27cw4orduvw72p.beta.de.magnolia-cloud.com/images/sombrero.jpg?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEF0aDGV1LWNlbnRyYWwtMSJHMEUCIQDPY0PIVicdY8xWbTYLJe4vTRD9J1q%2Fpa0L1iZEVvLy1AIgQup%2Bro4I5c%2BfgnecwDlAUs2cgaaFb8Lj0MAX94JMNj4qrAMIpv%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARABGgwwMjQxMTAyNzc0NzgiDJC249eF2QKDDiivnCqAA2WifpxnpqPXC5bE6OF2VPWmMuea6jolyVlv%2FKR6Tf%2B0CyBZUnDRMyDfZaC2W1UEf2iBcxzeMl5caIjODWVh8Vhyl36r6ooLiV6I0jAa5jKmszAOQOIF%2B%2BNDjm55Iad%2F3%2F4cquc%2FgePAz7%2FmBtWmi0R2IEBaKS%2Fgk6Id7EVls8CSPJgv5M%2FlGk5fdVHB8oE%2BaP1lukmUIusnP3h%2BxB49FPIB7vLS38%2BpvrWEQni%2FhovqlE1xKgFkgGzzPfRHScCNgYddNKFsuRrb2goCPUFcNfPw5eJPdAPqFz2m9jSIcOnNptojmZ5Z4seEoBqr2G%2FM%2BAAcdWKAV6fg0pjO%2FHEFEqS2UGjXwA2zhey0oGyTuY%2FR%2BJkzKIsHXNDZeqatcry46O4eWfpUDX%2BEdBZQWuNw8EVarWDJAJ6LCU6kWs5TYCEXKBvsIDLV2%2FQVeiulxofYG7rGwiGHnREu59ZqaHh3ASW0THEtqiNjTta%2FVb4Wl%2Brc9CKOS5d1TnvXDnFoQzgoITDG5%2BKJBjqmAdhDu%2Fym4c1rd%2FSDNkPwLoOhIWcqnGEo%2FJs4G8o5H84aSbGqWcxLRB15p1NK6NmnnZPZPDKxyKO3kY8%2BpIJ6VBvYVaN0WLIN%2B2ViHmsl6cHRAaQQ7FrlVxkYFdhpWnU1BMKqeb1l8djEa5Gszgygu%2FNE0ndUNTpw%2BwEUWmhTpC92O8i4rKuWDFBNJg8R6GqzX64WUSRE4cfjKph6AJ6rRJidk3vpuAU%5C%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20210908T140211Z&X-Amz-SignedHeaders=host&X-Amz-Expires=600&X-Amz-Credential=ASIAQLHIVUNTMTDJFZA3%2F20210908%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Signature=18fc62e14d8cd5a041bd3e0cf5bba2c29d1f7a41cd0e12f6fbc147cac9fb0683"
          }
        }
      },
      "@nodes": []
    }
  ]
}

If you are not using a ReferenceResolver, then you get the id, not a link, as it happens with jcr assets. Instead of a UUID is the id of the s3 asset:

"image":"s3:dam.iz27cw4orduvw72p.beta.de.magnolia-cloud.com/images/sombrero.jpg"

Let me know if the current situation is ok, or we can make improvements.

Comment by Christopher Zimmermann [ 09/Sep/21 ]

Thanks! - let me try it

Comment by Christopher Zimmermann [ 09/Sep/21 ]

Yes I can confirm that it is working. FYI it is not necessary to add the '-original'. I think I originally was failing because I might have been using the wrong endpoint, I might have been using the one for main - rather then the specific one for my environment.
ie I might have been using:
`https://author-urk7mju12so5gik0.beta.de.magnolia-cloud.com/.rest/delivery/activities/v1`

Whereas it should only work on 'ct-activities' environment:
`https://author-urk7mju12so5gik0.beta.de.magnolia-cloud.com/.rest/environments/ct-assets/delivery/activities/v1`

So we can close ticket from my perspective.

Generated at Mon Feb 12 00:37:58 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.