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

Date field in api

rainpoiss opened this issue · comments

When making repeater in contentype .yml and using date field. Sample below:

statistics:
            label: Statistika
            type: repeater
            fields:
                year:
                    type: text
                    label: aasta
                    class: narrow
                    variant: inline
                slot_1_name:
                    type: text
                    label: Nimetus
                    class: narrow
                    variant: inline
                slot_1_value:
                    type: text
                    label: Arvuline väärtus
                    class: narrow
                    variant: inline
                slot_1_date:
                    type: date
                    label: kuupäev
                    variant: inline
                slot_2_name:
                    type: text
                    label: Nimetus
                    class: narrow
                    variant: inline
                slot_2_value:
                    type: text
                    label: Arvuline väärtus
                    class: narrow
                    variant: inline
                slot_2_date:
                    type: date
                    label: kuupäev
                    variant: inline
                slot_3_name:
                    type: text
                    label: Nimetus
                    class: narrow
                    variant: inline
                slot_3_value:
                    type: text
                    label: Arvuline väärtus
                    class: narrow
                    variant: inline
                slot_3_date:
                    type: date
                    label: kuupäev
                    variant: inline
                slot_4_name:
                    type: text
                    label: Nimetus
                    class: narrow
                    variant: inline
                slot_4_value:
                    type: text
                    label: Arvuline väärtus
                    class: narrow
                    variant: inline
                slot_4_date:
                    type: date
                    label: kuupäev
                    variant: inline

I will get the following result:

 "statistics": [
                    {
                        "slot_1_value": "12",
                        "slot_2_value": "1232",
                        "slot_3_value": "123456",
                        "slot_4_value": "1234567890",
                        "year": "2018",
                        "slot_1_name": "Metsatulekahjusid",
                        "slot_2_name": "p\u00f5lenguid",
                        "slot_3_name": "Korstnaid",
                        "slot_4_name": "V\u00e4rvipotte",
                        "date": "2018-10-08T"
                    },
                    {
                        "year": "2000",
                        "slot_1_value": "123",
                        "slot_2_value": "584",
                        "slot_3_value": "122",
                        "slot_4_value": "234",
                        "slot_1_name": "Hiiri",
                        "slot_2_name": "Hiirematte",
                        "slot_3_name": "Monitore",
                        "slot_4_name": "Oktoobreid",
                        "date": "2018-10-26T"
                    }
                ]

The date field is not repeated and name is wrong

@rainpoiss Thanks for the report. I have made a new release that properly outputs the fieldnames. It should be in the stores soon: v3.4.1.