IOKode.WireShape.Testing 0.1.0-dev11

Prefix Reserved
This is a prerelease version of IOKode.WireShape.Testing.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package IOKode.WireShape.Testing --version 0.1.0-dev11
                    
NuGet\Install-Package IOKode.WireShape.Testing -Version 0.1.0-dev11
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IOKode.WireShape.Testing" Version="0.1.0-dev11" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IOKode.WireShape.Testing" Version="0.1.0-dev11" />
                    
Directory.Packages.props
<PackageReference Include="IOKode.WireShape.Testing" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add IOKode.WireShape.Testing --version 0.1.0-dev11
                    
#r "nuget: IOKode.WireShape.Testing, 0.1.0-dev11"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package IOKode.WireShape.Testing@0.1.0-dev11
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=IOKode.WireShape.Testing&version=0.1.0-dev11&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=IOKode.WireShape.Testing&version=0.1.0-dev11&prerelease
                    
Install as a Cake Tool

WireShape

WireShape is a .NET library for declaring, once and as data, what a value looks like once written. The serializer, an OpenAPI document, the binder of a route and a generated client then read that one declaration instead of each working the form out from the type.

The form of a value is settled by the code of a converter, and nothing can read it from there. A BookingReference is a record holding a string and travels as "QX7F2P", but a document generated from the type describes it as an object with one member, a client generated from that document asks for an object, and the binder cannot read one out of a route. The problem says the rest.

The base package names no serializer. What ships covers the HTTP API of an ASP.NET Core application written with System.Text.Json.

Installing it

The packages target net10.0 and are prerelease:

dotnet add package IOKode.WireShape --prerelease
To Install
Declare forms and ask a wire about them IOKode.WireShape
Ask System.Text.Json what a declaration does not say IOKode.WireShape.SystemTextJson
Read a declared value out of a route or a query string IOKode.WireShape.ComponentModel
Say what a declaration becomes in an OpenAPI document IOKode.WireShape.OpenApi
Write it into the documents Swashbuckle generates IOKode.WireShape.Swashbuckle
Read the calls an ASP.NET Core application serves, as a model of its API IOKode.WireShape.AspNetCore
Write a C# client of that model IOKode.WireShape.CSharpClient
Hold what a wire is declared from to its rules, in your tests IOKode.WireShape.Testing
Hold a document to its rules, in your tests IOKode.WireShape.OpenApi.Testing

A first declaration

var declaring = new WireBuilder();
var bookings = declaring.GetDeclarer("bookings");

bookings.Add<BookingReference>(new Shape.AsText(Pattern: "^[A-Z]{6}$"));
bookings.Add<Money>(new Shape.AsAnother(typeof(MoneyParts)));

var options = new JsonSerializerOptions(JsonSerializerDefaults.Web)
{
    TypeInfoResolver = new DefaultJsonTypeInfoResolver()
};

options.Converters.Add(new BookingReferenceJsonConverter());
options.Converters.Add(new MoneyJsonConverter());

Wire wire = declaring.Build(new JsonSerializerOptionsSerializer(options));

wire.GetShape(typeof(BookingReference));   // a text matching '^[A-Z]{6}$'

Getting started declares the whole example, and serves a document, reads a value out of a route and writes a client from it.

Documentation

  1. The problem
  2. Getting started
  3. Declaring a form
  4. Reading declarations from a source
  5. Hierarchies and enumerations
  6. Asking the wire
  7. Reading a value from text
  8. An OpenAPI document
  9. A document through Swashbuckle
  10. Reading what an application serves
  11. A client of an API
  12. The rules
  13. Glossary

Versions

Every package carries one version, moved for all of them at once, and the packages of one version are built from one tree. While they are prerelease, a form, a name or a signature changes where the one before it was wrong, and nothing is kept around to make the older way of saying it still work.

License

BSD 2-Clause. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-dev17 0 12/4/2026
0.1.0-dev16 55 11/23/2026
0.1.0-dev15 55 11/22/2026
0.1.0-dev14 60 11/16/2026
0.1.0-dev13 67 10/30/2026
0.1.0-dev12 64 10/30/2026
0.1.0-dev11 68 10/28/2026