Skip to content

Tool fails to correctly build models #66

Closed
@ethan-schofer

Description

@ethan-schofer

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.

  1. 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
  ...
}
  1. 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
 }
  1. 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

  1. Create manifest: dotnet new tool-manifest
  2. Install tool: dotnet tool install Optimizely.Graph.Client.Tools --local
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    1.4.2Release 1.4.2 - Client toolsbugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions