
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@agebrock/jsonschema-to-csharp
Advanced tools
converts a JSON Schema to C# classes using node-api-dotnet
Convert JSON Schemas into C# classes seamlessly within your Node.js applications, leveraging the power of a C# library supporting all features.
Transforming 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.
To install the library, simply use npm:
npm install @agebrock/jsonschema-to-csharp
'use strict';
const { convert, GeneratorOptions, GeneratorSettings } = require("@agebrock/jsonschema-to-csharp");
// Example usage
const schema = '{"type": "object", "properties": {"name": {"type": "string"}, "age": {"type": "number"}}}';
const className = 'Person';
const settings = new GeneratorSettings();
settings.Namespace = "TestNamespace";
settings.JsonLibrary = GeneratorOptions.JsonLibrary.NewtonsoftJson;
settings.ClassStyle = GeneratorOptions.ClassStyle.Poco;
convert(schema, className, settings).then(console.log);
Results to the following output:
using System;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Converters = Newtonsoft.Json.Converters;
namespace TestNamespace
{
#pragma warning disable // Disable all warnings
public class Person
{
[JsonProperty("name", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
public string Name { get; set; }
[JsonProperty("age", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
public double Age { get; set; }
private IDictionary<string, object> _additionalProperties;
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties
{
get { return _additionalProperties ?? (_additionalProperties = new Dictionary<string, object>()); }
set { _additionalProperties = value; }
}
}
}
'use strict';
const { convert, GeneratorOptions, GeneratorSettings } = require("@agebrock/jsonschema-to-csharp");
// Example usage
const schema = '{"type": "object", "properties": {"name": {"type": "string"}, "age": {"type": "number"}}}';
const className = 'Person';
const settings = new GeneratorSettings();
settings.Namespace = "TestNamespace";
settings.JsonLibrary = GeneratorOptions.JsonLibrary.SystemTextJson;
settings.ClassStyle = GeneratorOptions.ClassStyle.Poco;
convert(schema, className, settings).then(console.log);
Results to the following output:
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text.Json.Serialization;
namespace TestNamespace
{
#pragma warning disable // Disable all warnings
public class Person
{
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("age")]
public double Age { get; set; }
private IDictionary<string, object> _additionalProperties;
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties
{
get { return _additionalProperties ?? (_additionalProperties = new Dictionary<string, object>()); }
set { _additionalProperties = value; }
}
}
}
'use strict';
const { convert, GeneratorOptions, GeneratorSettings } = require("@agebrock/jsonschema-to-csharp");
// Example usage
const schema = '{"type": "object", "properties": {"name": {"type": "string"}, "age": {"type": "number"}}}';
const className = 'Person';
const settings = new GeneratorSettings();
settings.Namespace = "TestNamespace";
settings.JsonLibrary = GeneratorOptions.JsonLibrary.SystemTextJson;
settings.ClassStyle = GeneratorOptions.ClassStyle.Record;
settings.GenerateNativeRecords = true;
convert(schema, className, settings).then(console.log);
Results to the following output:
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text.Json.Serialization;
namespace TestNamespace
{
#pragma warning disable // Disable all warnings
public class Person
{
[JsonConstructor]
public Person(double @age, string @name)
{
this.Name = @name;
this.Age = @age;
}
[JsonPropertyName("name")]
public string Name { get; }
[JsonPropertyName("age")]
public double Age { get; }
private IDictionary<string, object> _additionalProperties;
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties
{
get { return _additionalProperties ?? (_additionalProperties = new Dictionary<string, object>()); }
set { _additionalProperties = value; }
}
}
}
This project is licensed under the Apache-2.0 License.
FAQs
converts a JSON Schema to C# classes using node-api-dotnet
The npm package @agebrock/jsonschema-to-csharp receives a total of 0 weekly downloads. As such, @agebrock/jsonschema-to-csharp popularity was classified as not popular.
We found that @agebrock/jsonschema-to-csharp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.