As integration developers, we spend a lot of time working with schemas. For example, those schemas sometimes describe XML messages:
- Orders
- Invoices
- Customers
- Shipments
- EDI canonical models
- Internal enterprise messages
However, when working with APIs and modern applications, those contracts are often defined using JSON Schema.
Regardless of the format, sooner or later, we reach exactly the same requirement:
I have the schema. Now I need C# classes representing it.
For example, we may be building an Azure Function. Alternatively, we may need a custom integration component. In other cases, we may be creating an API, an automated test, or a helper library. Sometimes, we simply need code that can serialize and deserialize those messages.
Nevertheless, whatever the scenario, one thing has always annoyed me:
- After all, the schema already describes the message. Therefore, why should I describe the same message again manually in C#?
For this reason, this is another developer experience we wanted to simplify with the DevScope Integration Toolkit.
So, meet Schema to C#.
π One-Minute Brief
Integration developers frequently need C# models matching existing XML or JSON message contracts. DevScope Integration Toolkit: Schema to C# converts XSD and JSON Schema definitions directly into C# classes inside Visual Studio Code, reducing repetitive manual work and helping developers quickly turn integration contracts into code-ready models.
Schemas are contracts
In enterprise integration, schemas play an important role because they describe the structure of the messages being exchanged between systems.
For example, an XSD Schema can define things such as:
- Elements;
- Attributes;
- Complex types;
- Simple types;
- Data types;
- Cardinality;
- Optional elements;
- Repeating structures;
- Nested objects;
- Namespaces.
Similarly, JSON Schema provides similar capabilities for JSON documents.
For example, we might have a JSON Schema describing an order containing:
Order
βββ OrderNumber
βββ OrderDate
βββ Customer
β βββ Id
β βββ Name
β βββ Email
βββ Lines
βββ Line[]
βββ Product
βββ Quantity
βββ Price
The contract already exists. It already tells us what an Order looks like. Then we start writing an Azure Function or another .NET component, and suddenly we need to create:
public class Order
{
public string OrderNumber { get; set; }
public DateTime OrderDate { get; set; }
public Customer Customer { get; set; }
public List<Line> Lines { get; set; }
}
Then:
public class Customer
{
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
}
And:
public class Line
{
public string Product { get; set; }
public int Quantity { get; set; }
public decimal Price { get; set; }
}
There is nothing particularly difficult about doing this. But why are we doing it manually?
From XSD Schema to C#
Let’s start with XML.
Imagine that we already have an XSD Schema similar to this:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://schemas.devscope.net/orders"
elementFormDefault="qualified">
<xs:element name="Order">
<xs:complexType>
<xs:sequence>
<xs:element
name="OrderNumber"
type="xs:string" />
<xs:element
name="OrderDate"
type="xs:dateTime" />
<xs:element name="Customer">
<xs:complexType>
<xs:sequence>
<xs:element
name="Id"
type="xs:string" />
<xs:element
name="Name"
type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Looking at the XSD, we can easily understand the basic structure:
Order
βββ OrderNumber
βββ OrderDate
βββ Customer
βββ Id
βββ Name
Now let’s say we need to process this message inside some C# code.
Conceptually, we need something similar to:
public class Order
{
public string OrderNumber { get; set; }
public DateTime OrderDate { get; set; }
public Customer Customer { get; set; }
}
public class Customer
{
public string Id { get; set; }
public string Name { get; set; }
}
Of course, we can write those classes manually. For a schema this small, it doesn’t take long. Now imagine an enterprise schema containing:
- 50 elements;
- Several nested complex types;
- Multiple repeating records;
- Different data types;
- Hundreds of fields.
- Different namespaces.
- Multiple schemas (import or include)
Suddenly, manually translating the schema into C# isn’t quite so appealing. And more importantly, it isn’t adding much value. We’re basically translating information from one representation into another.
That is precisely the kind of repetitive work tooling should do for us.
Introducing Schema to C#
That is the idea behind Schema to C# in the DevScope Integration Toolkit.
The workflow is deliberately straightforward:
- Provide the schema.
- Let the tool analyze the structure.
- Generate the corresponding C# classes.
- Use those classes in your .NET solution.

Instead of manually reproducing the contract, we let the schema drive the model generation.
In simple terms:
XSD Schema
β
Schema to C#
β
C# Classes
Within Visual Studio, we had a command-line tool to perform these tasks: xsd AnotherOutput.xsd /classes /language:CS
But XSD isn’t the only schema format we work with today.
From JSON Schema to C#
Modern integration solutions also use JSON extensively.
REST APIs, SaaS applications, Azure Functions, messaging solutions, and many other platforms commonly exchange JSON payloads.
And when the structure of those messages is formally defined, we may have a JSON Schema.
Imagine a simplified schema:
{
"type": "object",
"properties": {
"orderNumber": {
"type": "string"
},
"orderDate": {
"type": "string",
"format": "date-time"
},
"customer": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
}
}
Again, the contract already tells us a lot:
- We know that we have an order.
- We know that it contains an order number.
- We know that it contains a date.
- And we know that
customeris another object containingidandname.
Why manually translate all that into C#? With Schema to C#, the same concept applies:
JSON Schema
β
Schema to C#
β
C# Classes

The source format is different. The developer requirement is exactly the same.
In this case, we can also choose one of the following serializers:
- Newtonsoft.Json
- or System.Text.Json
and other configurations like:
- The namespace.
- The Root class name.
- and serialization configurations.

Very useful when building Azure Functions or Local Functions
One scenario where I see this being particularly useful is Azure Functions or Logic Apps Local Functions.
Logic Apps can handle an enormous amount of integration logic without requiring custom code. But there are always scenarios where an Azure Function makes sense, or we need to call a Logic Apps Local Function to bypass a limitation or to simplify the workflow logic.
Perhaps we need:
- Complex business logic;
- Custom validation;
- A specialized transformation;
- A library that already exists in .NET;
- Processing that is difficult to implement directly in the workflow.
Imagine the Logic App sends an Order to an Azure Function. We already have the schema describing that Order.
Now the function needs to deserialize the incoming payload into an Order model. Instead of spending time manually creating the entire object model, we can generate it from the schema.
That gives us a much faster starting point for the code that actually matters.
Of course, this functionality isn’t limited to Azure Functions. There are many integration development scenarios where generating C# classes from a schema can be useful.
Stop manually recreating contracts
Of course, generating C# classes isn’t something nobody has ever done before. There are other tools and techniques for generating code from schemas.
That isn’t really the point.
The goal of the DevScope Integration Toolkit is to bring useful integration development capabilities together where we’re already working:
- Visual Studio Code.
If I’m editing my XSD inside VS Code and suddenly need C# classes, I shouldn’t need to leave my development environment and start looking for another tool. The same applies to JSON Schema.
The workflow should be simple:
- Schema β Generate β Code
Not:
- Schema β search the web or external tool β find a converter β upload/copy schema β configure converter β generate code β copy it back β continue developing
That context switching is exactly the kind of small friction that becomes annoying when repeated every day.
Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars LEGO set for my son.