diff --git a/CHANGELOG.md b/CHANGELOG.md index c7d402e..d41f95d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### Version: 0.5.2 +#### Date: Jun-02-2026 + +- Document required NuGet packages (`contentstack.csharp`, `contentstack.utils`, `Newtonsoft.Json`, `Markdig`) in README and as an `` comment header in every generated `.cs` file. + ### Version: 0.5.1 #### Date: Jan-12-2026 diff --git a/README.md b/README.md index 19aaaf5..dc68dc6 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,26 @@ To install Contenstack model generator run following command: dotnet tool install -g contentstack.model.generator ``` +## Required NuGet Packages + +The files generated by this tool depend on the following NuGet packages. You must install them in your **application project** (not the generator itself) before the generated code will compile: + +```bash +dotnet add package contentstack.csharp +dotnet add package contentstack.utils +dotnet add package Newtonsoft.Json +dotnet add package Markdig +``` + +| Package | Provides | +| --- | --- | +| `contentstack.csharp` | `Contentstack.Core` and `Contentstack.Core.Models` namespaces | +| `contentstack.utils` | `Contentstack.Utils.Models` and `Contentstack.Utils.Interfaces` namespaces | +| `Newtonsoft.Json` | `Newtonsoft.Json`, `Newtonsoft.Json.Converters`, `Newtonsoft.Json.Linq` namespaces | +| `Markdig` | Markdown-to-HTML conversion used in `ContentstackStringExtension` | + +> **Note:** Every generated `.cs` file includes an `` comment at the top listing these packages as a reminder. + ## How to use Once you install ```contentstack.model.generator``` run ```--help``` to view available commands. diff --git a/contentstack.model.generator/ModelGenerator.cs b/contentstack.model.generator/ModelGenerator.cs index 3550594..cd5d729 100644 --- a/contentstack.model.generator/ModelGenerator.cs +++ b/contentstack.model.generator/ModelGenerator.cs @@ -68,10 +68,18 @@ public class ModelGenerator [Option(CommandOptionType.NoValue, ShortName = "N", LongName = "is-nullable", Description = "The features that protect against throwing a System.NullReferenceException can be disruptive when turned on.")] public bool IsNullable { get; } - [VersionOption("0.5.1")] + [VersionOption("0.5.2")] public bool Version { get; } - private readonly string _templateStart = @"using System; + private readonly string _templateStart = @"// +// Generated by contentstack.model.generator +// This file requires the following NuGet packages to be installed in your project: +// dotnet add package contentstack.csharp +// dotnet add package contentstack.utils +// dotnet add package Newtonsoft.Json +// dotnet add package Markdig +// +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -400,7 +408,15 @@ private void CreateEmbeddedObjectClass(string NameSpace, DirectoryInfo directory { var sb = new StringBuilder(); // Adding using at start of file - var usingDirectives = @"using System; + var usingDirectives = @"// +// Generated by contentstack.model.generator +// This file requires the following NuGet packages to be installed in your project: +// dotnet add package contentstack.csharp +// dotnet add package contentstack.utils +// dotnet add package Newtonsoft.Json +// dotnet add package Markdig +// +using System; using Newtonsoft.Json; using Contentstack.Core; using Newtonsoft.Json.Linq; @@ -1107,8 +1123,8 @@ private void CreateStringHelperClass(string nameSpace, DirectoryInfo directoryIn using (var sw = file.CreateText()) { var sb = new StringBuilder(); - sb.AppendLine("using Markdig;"); sb.AppendLine(_templateStart); + sb.AppendLine("using Markdig;"); sb.AppendLine("using System.ComponentModel;"); sb.AppendLine("using System.Reflection;"); diff --git a/contentstack.model.generator/contentstack.model.generator.csproj b/contentstack.model.generator/contentstack.model.generator.csproj index 7112a5c..be7645b 100644 --- a/contentstack.model.generator/contentstack.model.generator.csproj +++ b/contentstack.model.generator/contentstack.model.generator.csproj @@ -13,15 +13,15 @@ true ./nupkg true - 0.5.1 + 0.5.2 Contentstack - 0.5.1 + 0.5.2 Contentstack.Model.Generator LICENSE.txt - Improved Error messages + Document required NuGet packages in README and generated file headers true true - v0.5.1 + v0.5.2 Release;Debug