ParameterStyleParsers.OpenAPI 1.4.0-pre-314bd41e

This is a prerelease version of ParameterStyleParsers.OpenAPI.
There is a newer version of this package available.
See the version list below for details.
dotnet add package ParameterStyleParsers.OpenAPI --version 1.4.0-pre-314bd41e
                    
NuGet\Install-Package ParameterStyleParsers.OpenAPI -Version 1.4.0-pre-314bd41e
                    
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="ParameterStyleParsers.OpenAPI" Version="1.4.0-pre-314bd41e" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ParameterStyleParsers.OpenAPI" Version="1.4.0-pre-314bd41e" />
                    
Directory.Packages.props
<PackageReference Include="ParameterStyleParsers.OpenAPI" />
                    
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 ParameterStyleParsers.OpenAPI --version 1.4.0-pre-314bd41e
                    
#r "nuget: ParameterStyleParsers.OpenAPI, 1.4.0-pre-314bd41e"
                    
#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 ParameterStyleParsers.OpenAPI@1.4.0-pre-314bd41e
                    
#: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=ParameterStyleParsers.OpenAPI&version=1.4.0-pre-314bd41e&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=ParameterStyleParsers.OpenAPI&version=1.4.0-pre-314bd41e&prerelease
                    
Install as a Cake Tool

OpenAPI.ParameterStyleParsers

Parameter style parsers for OpenAPI.

The examples in the OpenAPI specification doesn't match RFC6570 fully, in those cases the examples in the specifications are followed.

Continuous Delivery

Installation

dotnet add package ParameterStyleParsers.OpenAPI

https://www.nuget.org/packages/ParameterStyleParsers.OpenAPI/

Getting Started

Create a parser by providing the OpenAPI parameter specification.

OpenAPI 3.2

var parser = OpenAPI.ParameterStyleParsers.ParameterValueParserFactory.OpenApi32(
    """
    {
        "name": "color",
        "in": "query",
        "schema": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "style": "form",
        "explode": true
    }
    """);

OpenAPI 3.1

var parser = OpenAPI.ParameterStyleParsers.ParameterValueParserFactory.OpenApi31(
    """
    {
        "name": "color",
        "in": "query",
        "schema": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "style": "form",
        "explode": true
    }
    """);

OpenAPI 3.0

var parser = OpenAPI.ParameterStyleParsers.ParameterValueParserFactory.OpenApi30(
    """
    {
        "name": "color",
        "in": "query",
        "schema": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "style": "form",
        "explode": true
    }
    """);

OpenAPI 2.0

var parser = OpenAPI.ParameterStyleParsers.ParameterValueParserFactory.OpenApi20(
    """
    {
        "name": "color",
        "in": "query",
        "required": false,
        "type": "array",
        "items": {
            "type": "string"
        },
        "collectionFormat": "multi"
    }
    """);

Parse a style serialized parameter

string styleSerializedParameter = "color=blue&color=black&color=brown";
Console.WriteLine(
    parser.TryParse(styleSerializedParameter, out JsonNode? json, out string? error)
        ? json?.ToJsonString()
        : error);
// ["blue","black","brown"]

Serialize json to a parameter style.

var json = JsonNode.Parse("""
    ["blue","black","brown"]
""");
var styleSerializedParameter = parser.Serialize(json);
Console.WriteLine(styleSerializedParameter);
// color=blue&color=black&color=brown

Schema References

Json pointers represented as URI fragments are supported, other URI's are currently not. It is possible to bring your own Json Schema implementation though.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ParameterStyleParsers.OpenAPI:

Package Downloads
Evaluation.OpenAPI

Evaluates API requests and responses using OpenAPI specifications

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.0 138 1/12/2026
1.4.0-pre-a82e71ac 98 1/12/2026
1.4.0-pre-98ae1991 96 1/11/2026
1.4.0-pre-6378fba7 96 1/11/2026
1.4.0-pre-314bd41e 95 1/11/2026
1.3.0 94 1/10/2026
1.3.0-pre-6a5eb765 97 1/10/2026
1.2.1-pre-f6232e95 95 1/10/2026
1.2.1-pre-a083f46c 95 1/10/2026
1.2.1-pre-0596ce88 95 1/10/2026
1.2.0 100 1/10/2026
1.2.0-pre-aa08d0af 96 1/10/2026
1.2.0-pre-63f9807e 94 1/10/2026
1.2.0-pre-452c2def 99 1/10/2026
1.2.0-pre-2203c5c2 97 1/10/2026
1.1.1 318 12/17/2025
1.1.1-pre-90b9f6b9 131 12/13/2025
1.1.1-pre-82653491 154 12/14/2025
1.1.0 215 11/25/2025
1.1.0-pre-be2cd81c 202 11/25/2025
Loading failed