Skip to main content
net10.0.NETFramework4.8net8.0net9.0

OPC UA runtime schema generation (XSD, OPC Binary and JSON Schema) for encodeable and complex data types.

Published
Oct 12, 2026
8d ago
Total Downloads
5.0K
5,044

Install

dotnet add package OPCFoundation.NetStandard.Opc.Ua.Core.Schema --version 2.0.1
ProductVersions
.NET
net10.0net8.0net9.0
Other
.NETFramework4.8

README

OPCFoundation.NetStandard.Opc.Ua.Core.Schema

Runtime schema generation for OPC UA data types.

This package produces schemas for the encodeable types generated by the OPC UA stack and for complex types that are added dynamically at runtime. Schemas are built as strongly-typed object models in code (no embedded schema strings), so unused generation paths are trimmed away and the feature is NativeAOT friendly.

Supported encodings:

  • XSD for the XML encoding.
  • BSD (OPC Binary, Part 6) for the binary encoding.
  • JSON Schema (Part 6 Annex C) for the JSON encoding, in both compact (reversible) and verbose flavors.

It also generates the OpenAPI 3.0 document of the REST binding (WebApiOpenApiGenerator, Part 6 G.3) from the route table and the request and response types, either with a JSON object as every body or with a component schema per message and structure.

Usage

IServiceProvider services = new ServiceCollection()
    .AddOpcUa()
    .AddSchemaGeneration()
    .Services
    .BuildServiceProvider();

ISchemaProvider provider = services.GetRequiredService<ISchemaProvider>();

if (provider.TryGetSchema(typeId, UaSchemaFormat.JsonCompact, UaSchemaScope.Type, out IUaSchema? schema))
{
    string json = schema.ToSchemaString();
}

The provider can also be assembled without dependency injection:

IDataTypeDefinitionResolver resolver = new DataTypeDefinitionRegistry();
ISchemaProvider provider = new DefaultSchemaProvider(
    resolver,
    [
        new JsonSchemaGenerator(),
        new XsdSchemaGenerator(),
        new BsdSchemaGenerator()
    ]);

Generated model registration extensions add public structure and enumeration activators to an IEncodeableFactory. Use EncodeableFactoryDefinitionSource when schemas should be resolved directly from those compiled definitions instead of a manual registry.

See docs/SchemaGeneration.md in the repository for details.

Changes from Previous Version

No structural changes between v2.0.0 and v2.0.1.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.Compatibility metadata lists 4 target frameworks; confirm the exact target used by your application.The published metadata declares 77 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.