How to serialize items in client library?


#1

I have…

  • [ ] Checked the logs and have provided the logs if I found something suspicious there

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [ ] Bug report
  • [ ] Performance issue
  • [x ] Documentation issue or request

Current behavior

Currently i cant find any documentation on how to serialize an items list in the client library, i am trying with my class

public sealed class FaqData
{
    public Dictionary<string, string> headline { get; set; }
    public Dictionary<string, string> subheader { get; set; }
    [JsonConverter(typeof(InvariantConverter))]
    public List<FaqItem> items { get; set; }
}

public sealed class FaqItem
{
    public string Title { get; set; }
    public string Text { get; set; }
}

I looked at Nested Schema translation to c# code

But this doesnt work for some reason when doing it like an array[] type:

public sealed class FaqData
{
    public Dictionary<string, string> headline { get; set; }
    public Dictionary<string, string> subheader { get; set; }
    [JsonConverter(typeof(InvariantConverter))]
    public FaqItem[] items { get; set; }
}
public class FaqItem
{
    public string Title { get; set; }
    public string Text { get; set; }
}

Expected behavior

I would like to have a wiki page on the client library explaining how to serialize array items with localization behaviour.

Minimal reproduction of the problem


See others for schema.
public SquidexClientManager Manager()
{
var clientManager = new SquidexClientManager(BaseUrl, Appname, Client_Id, Client_Secret);
return clientManager;
}

public void GetFaq()
{
    var clientManager = Manager();
    var faqrepo = clientManager.GetClient<Faq, FaqData>("faq");
    var faqs =  faqrepo.GetAsync().Result;
 }

This will result in an error stating:

One or more errors occurred. (Property must have a invariant language property.)

Can you advise me on how to fix this, or where to read the correct documentation, sorry im still very new to squidex and have searched high and low.

Environment

  • [ ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ x] Cloud version

Version: [CLOUD]

Browser:

  • [x ] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

Others:
Including json for schema:
{
“fields”: [
{
“name”: “headline”,
“properties”: {
“editor”: “Input”,
“fieldType”: “String”
},
“_links”: {
“update”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/2”,
“method”: “PUT”
},
“hide”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/2/hide”,
“method”: “PUT”
},
“disable”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/2/disable”,
“method”: “PUT”
},
“lock”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/2/lock”,
“method”: “PUT”
},
“delete”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/2”,
“method”: “DELETE”
}
},
“canDelete”: true,
“canDisable”: true,
“canHide”: true,
“canLock”: true,
“canUpdate”: true,
“partitioning”: “language”
},
{
“name”: “subheader”,
“properties”: {
“editor”: “Input”,
“fieldType”: “String”
},
“_links”: {
“update”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/3”,
“method”: “PUT”
},
“hide”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/3/hide”,
“method”: “PUT”
},
“disable”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/3/disable”,
“method”: “PUT”
},
“lock”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/3/lock”,
“method”: “PUT”
},
“delete”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/3”,
“method”: “DELETE”
}
},
“canDelete”: true,
“canDisable”: true,
“canHide”: true,
“canLock”: true,
“canUpdate”: true,
“partitioning”: “language”
},
{
“name”: “items”,
“properties”: {
“editor”: “Default”,
“fieldType”: “Array”
},
“_links”: {
“update”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1”,
“method”: “PUT”
},
“hide”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/hide”,
“method”: “PUT”
},
“disable”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/disable”,
“method”: “PUT”
},
“fields/add”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/nested”,
“method”: “POST”
},
“fields/order”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/nested/ordering”,
“method”: “PUT”
},
“lock”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/lock”,
“method”: “PUT”
},
“delete”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1”,
“method”: “DELETE”
}
},
“canAddField”: true,
“canDelete”: true,
“canDisable”: true,
“canOrderFields”: true,
“canHide”: true,
“canLock”: true,
“canUpdate”: true,
“partitioning”: “language”,
“nested”: [
{
“name”: “Title”,
“properties”: {
“editor”: “Input”,
“fieldType”: “String”
},
“_links”: {
“update”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/nested/4”,
“method”: “PUT”
},
“hide”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/nested/4/hide”,
“method”: “PUT”
},
“show”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/nested/4/disable”,
“method”: “PUT”
},
“lock”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/nested/4/lock”,
“method”: “PUT”
},
“delete”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/nested/4”,
“method”: “DELETE”
}
},
“canDelete”: true,
“canHide”: true,
“canLock”: true,
“canShow”: true,
“canUpdate”: true
},
{
“name”: “Text”,
“properties”: {
“editor”: “RichText”,
“fieldType”: “String”
},
“_links”: {
“update”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/nested/5”,
“method”: “PUT”
},
“hide”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/nested/5/hide”,
“method”: “PUT”
},
“show”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/nested/5/disable”,
“method”: “PUT”
},
“lock”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/nested/5/lock”,
“method”: “PUT”
},
“delete”: {
“href”: “/api/apps/adhub-estate/schemas/faq/fields/1/nested/5”,
“method”: “DELETE”
}
},
“canDelete”: true,
“canHide”: true,
“canLock”: true,
“canShow”: true,
“canUpdate”: true
}
]
}
],
“properties”: {}
}


#2

Hi, the same question has been asked recently: Nested Schema translation to c# code