Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema 0.1.0-preview.0.2.0

This is a prerelease version of Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema.
dotnet add package Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema --version 0.1.0-preview.0.2.0
                    
NuGet\Install-Package Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema -Version 0.1.0-preview.0.2.0
                    
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="Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema" Version="0.1.0-preview.0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema" Version="0.1.0-preview.0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema" />
                    
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 Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema --version 0.1.0-preview.0.2.0
                    
#r "nuget: Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema, 0.1.0-preview.0.2.0"
                    
#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 Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema@0.1.0-preview.0.2.0
                    
#: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=Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema&version=0.1.0-preview.0.2.0&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema&version=0.1.0-preview.0.2.0&prerelease
                    
Install as a Cake Tool

Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema

AOT-compatible OpenAPI document transformer for the query parameter abstractions of Pure.RelationalSchema.Storage.PureQL.Projection: IParameterType, IParameter and IListParameter.

.NET build & test Build and Deploy NuGet License: MIT

Overview

Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions describes a value bound to a query parameter: its PureQL type and its value as invariant cell text, or, for a list parameter, its list type and its items. Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.Serialization writes them as JSON.

ASP.NET Core's OpenAPI generator cannot see that JSON: it reflects over the interfaces, so IString becomes an array of IChar objects and IBool an object with a boolValue. With the converters registered, it writes a collection or a dictionary of parameters without its items. This package provides two transformers:

  • PureQLParametersDocumentTransformer, an IOpenApiDocumentTransformer that replaces the generated IParameterType, IParameter and IListParameter component schemas with schemas matching the JSON the converters write.
  • PureQLParametersSchemaTransformer, an IOpenApiSchemaTransformer that makes the items of a collection and the values of a dictionary of parameters reference those components.

The schemas are built in code, without reflection, so the transformers work under trimming and native AOT.

Installation

dotnet add package Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema

Public API

Name Namespace Description
PureQLParametersDocumentTransformer Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema IOpenApiDocumentTransformer that replaces the generated schemas of IParameterType, IParameter and IListParameter
PureQLParametersSchemaTransformer Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema IOpenApiSchemaTransformer that points the items of a collection and the values of a dictionary of those types at their components

Schemas

Component JSON shape Required
IParameterType { "name": string, "nullable": boolean } name, nullable
IParameter { "type": IParameterType, "value": string, "items": IParameter[] } type, value
IListParameter { "type": IParameterType, "value": string, "items": IParameter[] } type, value, items
  • name is an enum of the 16 PureQL type names: integer, decimal, string, boolean, date, time, datetime, uuid, and the list types integerList … uuidList.
  • value is a string: the cell text, such as "9.99", the empty string for a typed null, or, for a list parameter, a JSON array of its items' values, such as "[\"paid\",\"shipped\"]".
  • items is optional on IParameter, since a list parameter written as an IParameter keeps its items, and required on IListParameter.
  • Every component and property has a description, and every component an example:
{
  "type": { "name": "stringList", "nullable": false },
  "value": "[\"paid\",\"shipped\"]",
  "items": [
    { "type": { "name": "string", "nullable": false }, "value": "paid" },
    { "type": { "name": "string", "nullable": false }, "value": "shipped" }
  ]
}

The schemas describe the JSON as it is written. When reading, the converters also accept a list parameter without its value, which they build from the items.

Collections and dictionaries

With the converters registered, ASP.NET Core still references the component of a parameter it meets as a property, a body or a response, but writes IParameter[] as {"type":"array"} and IReadOnlyDictionary<string, IParameter> as {"type":"object"}, without items or additionalProperties. When the document has no other reference to IParameter, it then has no IParameter component either, so the document transformer has nothing to replace.

PureQLParametersSchemaTransformer restores them: for a collection or a dictionary whose element type is IParameterType, IParameter or IListParameter (matched by its full name), it sets items or additionalProperties to the schema ASP.NET Core generates for the element type, which ASP.NET Core then writes as a reference to that type's component. Other schemas are left as they are.

Which components are replaced

The transformer replaces a component only if the document has it, and then adds the components it references: IListParameter brings IParameter, and IParameter brings IParameterType. Other schemas, such as the generated IString, IBool and IChar, are left as they are; register Pure.Primitives.Abstractions.OpenAPI.Schema as well if other endpoints use Pure primitives. The schemas are built anew for each document, so one document's transformers never change another's.

Usage

Register both transformers, and the System.Text.Json converters the schemas describe. Without the schema transformer, the request body of the endpoint below is an array without items:

using System.Text.Json.Serialization;
using Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.OpenAPI.Schema;
using Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.Parameter;
using Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.Serialization;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

builder.Services.AddOpenApi(options =>
{
    options.AddSchemaTransformer<PureQLParametersSchemaTransformer>();
    options.AddDocumentTransformer<PureQLParametersDocumentTransformer>();
});

builder.Services.ConfigureHttpJsonOptions(options =>
{
    foreach (JsonConverter converter in new PureQLParametersConverters())
    {
        options.SerializerOptions.Converters.Add(converter);
    }
});

WebApplication app = builder.Build();

app.MapOpenApi();
app.MapPost("/parameters", (IParameter[] parameters) => Results.Ok(parameters));

app.Run();

Outside the Web SDK

AddOpenApi comes with a source generator that intercepts the call. In a project on Microsoft.NET.Sdk rather than Microsoft.NET.Sdk.Web, such as a test project, enable its interceptors, or the build fails with CS9137:

<PropertyGroup>
  <InterceptorsNamespaces>$(InterceptorsNamespaces);Microsoft.AspNetCore.OpenApi.Generated</InterceptorsNamespaces>
</PropertyGroup>

Design Principles

  • Matches the JSON — the schemas describe what PureQLParametersConverters writes, and the tests check its output against them
  • Replace, never invent — a component is replaced only when the document has it or a replaced component references it
  • AOT-compatible — IsAotCompatible=true; schemas are built in code, without reflection
  • Two public types — PureQLParametersDocumentTransformer and PureQLParametersSchemaTransformer

Dependencies

The package does not reference the abstractions: it matches the components by the names ASP.NET Core gives them.

Target Frameworks

  • .NET 10
  • Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions — the interfaces these schemas describe
  • Pure.RelationalSchema.Storage.PureQL.Projection.Parameters.Abstractions.Serialization — the System.Text.Json converters that write the JSON described here
  • Pure.RelationalSchema.Storage.PureQL.Projection.Parameters — the implementations, one per PureQL literal and list literal
  • Pure.Primitives.Abstractions.OpenAPI.Schema, Pure.RelationalSchema.Abstractions.OpenAPI.Schema, Pure.RelationalSchema.Storage.Abstractions.OpenAPI.Schema — the transformers of the other Pure abstractions
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-preview.0.2.0 124 11/1/2026
0.1.0-preview.0.1.0 78 11/1/2026