xiaohutai / jsonapi

[Bolt Extension] JSON API for Bolt CMS

Home Page:https://market.bolt.cm/view/bolt/jsonapi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No thumbnail link in JSON response

mamoot64 opened this issue · comments

Hi,

It seems there is a problem with the display of image link in JSON response.
I have defined a content type like this :

My content type defined a imagelist type.

The JSON response provide this :

  "data": [
        {
            "id": "4",
            "type": "actualites",
            "attributes": {
                "slug": "les-dates-speciales-du-cabaret-le-french-cancan",
                "datepublish": "2016-06-29T17:23:00+02:00",
                "datedepublish": "2016-12-31T00:00:00+01:00",
                "title": "Les dates sp\u00e9ciales du cabaret le French Cancan",
                "date": "2016-06-29T00:00:00+02:00",
                "images": [
                    {
                        "filename": "2016-05\/10623411-992955337442674-8787364297011246488-o.jpg",
                        "title": "2016-05\/10623411-992955337442674-8787364297011246488-o.jpg",
                        "id": "0",
                        "order": "0",
                        "progress": "0",
                        "element": ""
                    }
                ],
                "body": "<p>Le Cabaret French Cancan vous r\u00e9serve des soir\u00e9es sp\u00e9ciales tout au long de l'ann\u00e9e !<\/p>",
                "facebook": "",
                "length": "short",
                "incomingrelation": ""
            },

There is no thumbnail link !

Thank's for your answer !!!

@acidline What bolt and jsonapi version are you running? I am not encountering your issue at all. I am running Bolt V3 and JSONAPI 3.0.3. Your imagelist seems to have a lot of different attributes, not included in Bolt V3. Thanks for the bug report!

@Raistlfiren My version of Bolt is 3.1.0 et version of JSONAPI is 3.0.3

My image list is defined with these parameters :

        images:
            type: imagelist
            required: true
            label: Images

It seems that the Parser object don't create à File Type but a Default type. ($field->getData() give the imagelist array like my previous post)

Thank's for your answer

Thanks @acidline for that information. The reason it is doing that, is because it is looking at the field name instead of the actual type (I don't know why I did that). I am going to make a hotfix tonight or tomorrow and push it soon.

Ok Raistifiren, it's a good news ! I'm waiting for your fix ;)

Thank's

Thank you for the report :) I have merged in new changes fixing the problem. Please try the latest release and see if it works for you. Thanks!

That's perfect @Raistlfiren

I've 'url' and 'thumbnail' in my imagelist json structure .

Thank's for your work.