Closed
Description
Describe the bug
The Optimizely Graph Client Tools, which should produce C# classes representing my models in my Graph instance is unable to handle some situations when generating models.
- Blocks or Pages that inherit subclasses (Other than PageData or BlockData) create models that inherit from two classes. This is not valid C# code. For example, any page model inherits from 'Content' and inherits from my 'BasePageData'. It should ONLY inherit 'BasePageData'.
public partial class BannerBlock:Content,BasePageBanner
{
...
All of my properties
...
}
- Some properties are added with an exclamation point at the end of the property type name. I don't have a clear understanding of why this happens. It is invalid C#.
public partial class ImageBlock:Content
{
...
... some properties
public ContentModelReference! Image { get; set; }
... some other properties
}
- Built in property types are added to blocks or pages but they are invalid property types.
public partial class BasePageData:Content
{
public IEnumerable<ContentAreaItemModel> PageBanner { get; set; }
[Searchable]
public string PageTitle { get; set; }
public string BodyText { get; set; }
public LinkItemNode BodyTextCta { get; set; }
public string BodyTextCtaAccessibilityText { get; set; }
public IEnumerable<ContentAreaItemModel> MainContent { get; set; }
public ContentModelReference ListingImage { get; set; }
For example, ContentAreaItemModel, LinkItemNode and ContentModelReference are all invalid property types, or at least they are not getting generated so my code base doesnt know what they are.
To Reproduce
Follow instructions from documentation: https://github.com/episerver/graph-net-sdk?tab=readme-ov-file#optimizely-graph-client-tool
- Create manifest: dotnet new tool-manifest
- Install tool: dotnet tool install Optimizely.Graph.Client.Tools --local
- Create models: dotnet ogschema src/MyProject/appsettings.Development.json src/MyProject/CodeGeneration
Expected behavior
Creates models for interacting with the graph from the command line.
Package (please complete the following information):
- Optimizely.ContentGraph.Cms 3.14.3
- Optimizely.Graph.Client 1.4.0