{"_id":"@agebrock/jsonschema-to-csharp","_rev":"1-b4d3ee23c5627b555059125dcfc8af5a","name":"@agebrock/jsonschema-to-csharp","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@agebrock/jsonschema-to-csharp","version":"0.0.1","description":"converts a JSON Schema to C# classes using node-api-dotnet","main":"./cjs/index.js","keywords":["csharp","generator","dotnetnode","jsonschema"],"author":{"name":"Christoph Hagenbrock","email":"agebrock@users.noreply.github.com"},"license":"Apache-2.0","scripts":{"build":"tsc --emitDeclarationOnly -d  --outDir ./cjs && tsc --module commonjs --outDir ./cjs"},"dependencies":{"node-api-dotnet":"^0.5.6"},"devDependencies":{"@types/node":"^16.18.84","typescript":"^5.3.3"},"_id":"@agebrock/jsonschema-to-csharp@0.0.1","types":"./cjs/index.d.ts","_nodeVersion":"21.6.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-M5S7a897ZYiqdgq2c0gYkQ+jsiYMjcUNUGdyiicJU9JlExbtFA8PfCM4JtCLvXwzS5QVtTEHyc1bqxjQWImKcQ==","shasum":"a51977970d1cd742bf9390d447376384f2af32a5","tarball":"https://registry.npmjs.org/@agebrock/jsonschema-to-csharp/-/jsonschema-to-csharp-0.0.1.tgz","fileCount":50,"unpackedSize":2461239,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHKkcLe7BjPHnb03Gl26FeI0PjS9nlmFqnMsrPrkNt2cAiBfqMMuWBEOnjaPGjNg2A6dy7xxE+eSLFDLQj/56pXgpw=="}]},"_npmUser":{"name":"chbrock","email":"christoph.hagenbrock@googlemail.com"},"directories":{},"maintainers":[{"name":"chbrock","email":"christoph.hagenbrock@googlemail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jsonschema-to-csharp_0.0.1_1710146587909_0.13579172307409038"},"_hasShrinkwrap":false},"0.0.2":{"name":"@agebrock/jsonschema-to-csharp","version":"0.0.2","description":"converts a JSON Schema to C# classes using node-api-dotnet","main":"./cjs/index.js","keywords":["csharp","generator","dotnetnode","jsonschema"],"author":{"name":"Christoph Hagenbrock","email":"agebrock@users.noreply.github.com"},"license":"Apache-2.0","scripts":{"build":"tsc --emitDeclarationOnly -d  --outDir ./cjs && tsc --module commonjs --outDir ./cjs"},"dependencies":{"node-api-dotnet":"^0.5.6"},"devDependencies":{"@types/node":"^16.18.84","typescript":"^5.3.3"},"_id":"@agebrock/jsonschema-to-csharp@0.0.2","types":"./cjs/index.d.ts","_nodeVersion":"21.6.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-X3t3n6G323IdZ8UQHBDV6no4kt/7kg9HS3JIM/PiRjkzhuMR8pwek7x0sMlbOjODCpEkT3P+o1y4k4U1t7EtFQ==","shasum":"ee2b595e8ebb30345931ef8f3351963222f2eb02","tarball":"https://registry.npmjs.org/@agebrock/jsonschema-to-csharp/-/jsonschema-to-csharp-0.0.2.tgz","fileCount":50,"unpackedSize":2461019,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC0xoySwVgrDjfm0xPdMI6mcHOyFyOcP/ouXrFJMlo01wIhAOQoWjUUa4PfP7GdGRqOwHzA2uvqohGuYp2YdNdXQllV"}]},"_npmUser":{"name":"chbrock","email":"christoph.hagenbrock@googlemail.com"},"directories":{},"maintainers":[{"name":"chbrock","email":"christoph.hagenbrock@googlemail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jsonschema-to-csharp_0.0.2_1710147103807_0.08836861621847825"},"_hasShrinkwrap":false}},"time":{"created":"2024-03-11T08:43:07.813Z","0.0.1":"2024-03-11T08:43:08.137Z","modified":"2024-03-11T08:51:44.482Z","0.0.2":"2024-03-11T08:51:44.040Z"},"maintainers":[{"name":"chbrock","email":"christoph.hagenbrock@googlemail.com"}],"description":"converts a JSON Schema to C# classes using node-api-dotnet","keywords":["csharp","generator","dotnetnode","jsonschema"],"author":{"name":"Christoph Hagenbrock","email":"agebrock@users.noreply.github.com"},"license":"Apache-2.0","readme":"\r\n# JSON Schema to C# Class Converter for Node.js\r\n\r\nConvert JSON Schemas into C# classes seamlessly within your Node.js applications, leveraging the power of a C# library supporting all features.\r\n\r\n## Overview\r\n\r\nTransforming JSON Schemas into C# classes has never been easier! With the JSON Schema to C# Class Converter for Node.js, you can effortlessly bridge the gap between JSON data structures and C# objects. Say goodbye to manual translation and hello to automated, error-free conversion.\r\n\r\n## Features\r\n\r\n- **Seamless Integration**: Integrate the converter effortlessly into your Node.js projects, enabling smooth interoperability between JSON Schemas and C# classes.\r\n- **Full Feature Support**: Enjoy support for all JSON Schema features, including complex data types, validation rules, and more, ensuring accurate translation into C# classes.\r\n- **Flexible Configuration**: Customize the generation process using a variety of options, such as namespace, data annotations, default values, and more, to meet your specific requirements.\r\n- **Native Record Support**: Generate C# classes as native records for enhanced readability and conciseness, leveraging the latest language features.\r\n- **Autocomplete Support**: TypeScript-based library provides autocomplete support for C# classes in your favorite editor, enhancing developer productivity.\r\n\r\n## Installation\r\n\r\nTo install the library, simply use npm:\r\n\r\n```bash\r\nnpm install @agebrock/jsonschema-to-csharp\r\n```\r\n\r\n## Examples\r\n\r\n### Using Newtonsoft.Json\r\n\r\n```javascript\r\n'use strict';\r\n\r\nconst { convert, GeneratorOptions, GeneratorSettings } = require(\"@agebrock/jsonschema-to-csharp\");\r\n\r\n// Example usage\r\nconst schema = '{\"type\": \"object\", \"properties\": {\"name\": {\"type\": \"string\"}, \"age\": {\"type\": \"number\"}}}';\r\nconst className = 'Person';\r\nconst settings = new GeneratorSettings();\r\nsettings.Namespace = \"TestNamespace\";\r\nsettings.JsonLibrary = GeneratorOptions.JsonLibrary.NewtonsoftJson;\r\nsettings.ClassStyle = GeneratorOptions.ClassStyle.Poco;\r\n\r\nconvert(schema, className, settings).then(console.log);\r\n```\r\n\r\nResults to the following output:\r\n\r\n```csharp\r\nusing System;\r\nusing Newtonsoft.Json;\r\nusing System.Collections.Generic;\r\nusing System.Runtime.Serialization;\r\nusing Converters = Newtonsoft.Json.Converters;\r\n\r\nnamespace TestNamespace\r\n{\r\n    #pragma warning disable // Disable all warnings\r\n\r\n    public class Person\r\n    {\r\n        [JsonProperty(\"name\", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]\r\n        public string Name { get; set; }\r\n\r\n        [JsonProperty(\"age\", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]\r\n        public double Age { get; set; }\r\n\r\n        private IDictionary<string, object> _additionalProperties;\r\n\r\n        [JsonExtensionData]\r\n        public IDictionary<string, object> AdditionalProperties\r\n        {\r\n            get { return _additionalProperties ?? (_additionalProperties = new Dictionary<string, object>()); }\r\n            set { _additionalProperties = value; }\r\n        }\r\n\r\n    }\r\n}\r\n```\r\n\r\n### Using System.Text.Json (POCO)\r\n\r\n```javascript\r\n'use strict';\r\n\r\nconst { convert, GeneratorOptions, GeneratorSettings } = require(\"@agebrock/jsonschema-to-csharp\");\r\n\r\n// Example usage\r\nconst schema = '{\"type\": \"object\", \"properties\": {\"name\": {\"type\": \"string\"}, \"age\": {\"type\": \"number\"}}}';\r\nconst className = 'Person';\r\nconst settings = new GeneratorSettings();\r\nsettings.Namespace = \"TestNamespace\";\r\nsettings.JsonLibrary = GeneratorOptions.JsonLibrary.SystemTextJson;\r\nsettings.ClassStyle = GeneratorOptions.ClassStyle.Poco;\r\n\r\nconvert(schema, className, settings).then(console.log);\r\n```\r\n\r\nResults to the following output:\r\n\r\n```csharp\r\nusing System;\r\nusing System.Text;\r\nusing System.Collections.Generic;\r\nusing System.Runtime.Serialization;\r\nusing System.Text.Json.Serialization;\r\n\r\nnamespace TestNamespace\r\n{\r\n    #pragma warning disable // Disable all warnings\r\n\r\n    public class Person\r\n    {\r\n\r\n        [JsonPropertyName(\"name\")]\r\n        public string Name { get; set; }\r\n\r\n        [JsonPropertyName(\"age\")]\r\n        public double Age { get; set; }\r\n\r\n        private IDictionary<string, object> _additionalProperties;\r\n\r\n        [JsonExtensionData]\r\n        public IDictionary<string, object> AdditionalProperties\r\n        {\r\n            get { return _additionalProperties ?? (_additionalProperties = new Dictionary<string, object>()); }\r\n            set { _additionalProperties = value; }\r\n        }\r\n\r\n    }\r\n}\r\n```\r\n\r\n\r\n### Using System.Text.Json (Native Records)\r\n\r\n```javascript\r\n'use strict';\r\n\r\nconst { convert, GeneratorOptions, GeneratorSettings } = require(\"@agebrock/jsonschema-to-csharp\");\r\n\r\n// Example usage\r\nconst schema = '{\"type\": \"object\", \"properties\": {\"name\": {\"type\": \"string\"}, \"age\": {\"type\": \"number\"}}}';\r\nconst className = 'Person';\r\nconst settings = new GeneratorSettings();\r\nsettings.Namespace = \"TestNamespace\";\r\nsettings.JsonLibrary = GeneratorOptions.JsonLibrary.SystemTextJson;\r\nsettings.ClassStyle = GeneratorOptions.ClassStyle.Record;\r\nsettings.GenerateNativeRecords = true;\r\n\r\nconvert(schema, className, settings).then(console.log);\r\n```\r\n\r\nResults to the following output:\r\n\r\n```csharp\r\nusing System;\r\nusing System.Text;\r\nusing System.Collections.Generic;\r\nusing System.Runtime.Serialization;\r\nusing System.Text.Json.Serialization;\r\n\r\nnamespace TestNamespace\r\n{\r\n    #pragma warning disable // Disable all warnings\r\n\r\n    public class Person\r\n    {\r\n        [JsonConstructor]\r\n\r\n        public Person(double @age, string @name)\r\n\r\n        {\r\n\r\n            this.Name = @name;\r\n\r\n            this.Age = @age;\r\n\r\n        }\r\n        [JsonPropertyName(\"name\")]\r\n        public string Name { get; }\r\n\r\n        [JsonPropertyName(\"age\")]\r\n        public double Age { get; }\r\n\r\n        private IDictionary<string, object> _additionalProperties;\r\n\r\n        [JsonExtensionData]\r\n        public IDictionary<string, object> AdditionalProperties\r\n        {\r\n            get { return _additionalProperties ?? (_additionalProperties = new Dictionary<string, object>()); }\r\n            set { _additionalProperties = value; }\r\n        }\r\n\r\n    }\r\n}\r\n```\r\n\r\n## License\r\n\r\nThis project is licensed under the Apache-2.0 License.","readmeFilename":"readme.md"}