Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions contentstack.model.generator/ModelGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ public class ModelGenerator
using Contentstack.Core.Models;
using Contentstack.Utils.Models;
using Contentstack.Utils.Interfaces;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;";
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;";

private readonly List<Contenttype> _contentTypes = new List<Contenttype>();
StackResponse stack;
Expand Down Expand Up @@ -550,9 +550,9 @@ private void CreateLinkClass(string NameSpace, DirectoryInfo directoryInfo)

// Creating Class
AddClass(contentstackLinkClass, sb);
sb.AppendLine($" [JsonProperty(propertyName: \"title\")]");
sb.AppendLine($" [JsonPropertyName(\"title\")]");
sb.AppendLine($" public string{nullableString()} Title {{ get; set; }}");
sb.AppendLine($" [JsonProperty(propertyName: \"href\")]");
sb.AppendLine($" [JsonPropertyName(\"href\")]");
sb.AppendLine($" public string{nullableString()} Href {{ get; set; }}");

// End of namespace and class
Expand Down Expand Up @@ -741,17 +741,17 @@ private void CreateFile(string contentTypeName, string nameSpace, Contenttype co

// Add Const
sb.AppendLine($" public const string ContentType = \"{contentType.Uid}\";");
sb.AppendLine($" [JsonProperty(propertyName: \"uid\")]");
sb.AppendLine($" [JsonPropertyName(\"uid\")]");
sb.AppendLine($" public string{nullableString()} Uid {{ get; set; }}");
sb.AppendLine($" [JsonProperty(propertyName: \"_content_type_uid\")]");
sb.AppendLine($" [JsonPropertyName(\"_content_type_uid\")]");
sb.AppendLine($" public string{nullableString()} ContentTypeUid {{ get; set; }}");

//Adding Params to contentType
AddParams(contentTypeName, contentType.Schema, sb);

if (fields)
{
sb.AppendLine($" [JsonProperty(propertyName: \"_embedded_items\")]");
sb.AppendLine($" [JsonPropertyName(\"_embedded_items\")]");
sb.AppendLine(" public Dictionary<string, List<IEmbeddedObject>>{nullableString()} embeddedItems { get; set; }");
}

Expand Down Expand Up @@ -875,7 +875,7 @@ private void AddParams(string contentType, List<Field> schema, in StringBuilder
{
foreach (var field in schema)
{
sb.AppendLine($" [JsonProperty(propertyName: \"{field.Uid}\")]");
sb.AppendLine($" [JsonPropertyName(\"{field.Uid}\")]");
if (field.DataType == "text" && field.FieldMetadata.IsMarkdown)
{
sb.AppendLine($" public {GetDatatypeForField(field, contentType)} {FirstLetterToUpperCase(field.Uid)} {{");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="4.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading