Custom model issues

Hello I’m using a custom model to build home page data.

Here is the model.

public sealed class HomePageData : IBasePage
    {
        [JsonConverter(typeof(InvariantConverter))]
        public string AppName { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public string Title { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public string Slug { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public string ClanName { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public string Slogan { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public string ReadMoreText { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public string HeroImage { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public string CommunitiesTitle { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public string CommunitiesHeader { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public List<GameCommunity> Communities { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public string SpotLightHeader { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public string SpotlightDEscription { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public MemberSpotlight MemberSpotlight { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public string Subheader { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public string WhyHeader { get; set; }

        [JsonConverter(typeof(InvariantConverter))]
        public List<CommunityBenefit> CommunityBenefits { get; set; }
    }
var page = await pagesClient.GraphQlAsync<JToken>(query);

return page.ToObject<HomePage>();

When the controller gets the model I see this error in the watch window.

AppName = ‘page.AppName’ threw an exception of type ‘System.InvalidOperationException’
‘page.SchemaName’ threw an exception of type ‘System.InvalidOperationException’

Please post the full exception information

'page.AppName' threw an exception of type 'System.InvalidOperationException'
   at Squidex.ClientLibrary.Content`1[[Absolved.Models.Pages.HomePageData, Absolved, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].GetDetails()
   at Squidex.ClientLibrary.Content`1[[Absolved.Models.Pages.HomePageData, Absolved, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].get_AppName()

'page.SchemaName' threw an exception of type 'System.InvalidOperationException'
"   at Squidex.ClientLibrary.Content`1[[Absolved.Models.Pages.HomePageData, 
Absolved, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].GetDetails()\r\n 

at Squidex.ClientLibrary.Content`1[[Absolved.Models.Pages.HomePageData, 
Absolved, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].get_SchemaName()"

Which Squidex version do you use?

I’m using a cloud version so I’m not sure how to tell. I could do a screen share since it’s a holiday here.

The Content class expect that is used with the REST API and therefore assumes that several other fields are available:

I’m seeing that error in the Locals window

Content has no self link

Maybe my model isn’t built properly?

That’s what the model I’m actually passing to the controller looks like.

using Squidex.ClientLibrary;

namespace Absolved.Models.Pages
{
    public sealed class HomePage : Content<HomePageData>
    {
    }
}

I should mention I’m using GraphQL to get the page data since I have a lot of referenced content.

Yes, I have seen it. Therefore I have said it: It assumes that it is used with REST. You have to create your own class for now.

Any examples I can use for reference?

You can just copy and paste content,. the only problem are the properties that use the links.

Yeah I was going to try that initially but what you just replied was what I was concerned about which is what prompted my question.