Soenneker.OpenApi.Diagnostics
3.0.7
Prefix Reserved
dotnet add package Soenneker.OpenApi.Diagnostics --version 3.0.7
NuGet\Install-Package Soenneker.OpenApi.Diagnostics -Version 3.0.7
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="Soenneker.OpenApi.Diagnostics" Version="3.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.OpenApi.Diagnostics" Version="3.0.7" />
<PackageReference Include="Soenneker.OpenApi.Diagnostics" />
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 Soenneker.OpenApi.Diagnostics --version 3.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Soenneker.OpenApi.Diagnostics, 3.0.7"
#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 Soenneker.OpenApi.Diagnostics@3.0.7
#: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=Soenneker.OpenApi.Diagnostics&version=3.0.7
#tool nuget:?package=Soenneker.OpenApi.Diagnostics&version=3.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Soenneker.OpenApi.Diagnostics
A comprehensive OpenAPI document diagnostic utility that helps identify issues that could affect client generation and API documentation.
Features
Top-Level Showstopper Issues
- Empty or Invalid OperationId detection
- Invalid $ref identifier validation
- Empty enum array detection
- Schema name conflict detection
- Polymorphic type validation
- Path parameter validation
- Recursive model validation
- Default value validation
- Empty schema detection
Mid-Level Problems
- allOf usage validation
- Name collision detection
- Schema combination validation
- Format/type combination validation
- OpenAPI version validation
Subtle Problems
- Discriminator mapping validation
- Description/summary validation
- Parameter/response reference validation
- Media type validation
- Request body validation
Kiota-Specific Issues
- File size validation
- Empty key detection
- Nullable property validation
- Enum type validation
- Discriminator property validation
Installation
dotnet add package Soenneker.OpenApi.Diagnostics
Usage
Basic Usage
using Microsoft.Extensions.DependencyInjection;
using Soenneker.OpenApi.Diagnostics;
using Soenneker.OpenApi.Diagnostics.Abstract;
// Register the service
services.AddOpenApiDiagnostics();
// Use the service
public class MyService
{
private readonly IOpenApiDiagnostics _diagnostics;
public MyService(IOpenApiDiagnostics diagnostics)
{
_diagnostics = diagnostics;
}
public async Task AnalyzeOpenApiDocument(string jsonContent)
{
var issues = await _diagnostics.AnalyzeJson(jsonContent);
foreach (var issue in issues)
{
Console.WriteLine($"Severity: {issue.Severity}");
Console.WriteLine($"Category: {issue.Category}");
Console.WriteLine($"Code: {issue.Code}");
Console.WriteLine($"Message: {issue.Message}");
Console.WriteLine($"Location: {issue.Location}");
if (issue.Details != null)
Console.WriteLine($"Details: {issue.Details}");
Console.WriteLine();
}
}
}
Analyzing a File
var issues = await _diagnostics.AnalyzeFile("path/to/openapi.json");
Analyzing a Document
var document = new OpenApiDocument();
// ... populate document ...
var issues = await _diagnostics.AnalyzeDocument(document);
Diagnostic Categories
The library categorizes issues into the following categories:
- OperationId
- Reference
- Enum
- SchemaNaming
- PolymorphicType
- PathParameter
- RecursiveModel
- DefaultValue
- EmptySchema
- SchemaCombination
- FormatType
- Version
- Discriminator
- Description
- MediaType
- RequestBody
- FileSize
- EmptyKey
- Nullable
- Other
Severity Levels
Issues are classified into three severity levels:
- Error: Critical issues that will prevent client generation
- Warning: Issues that may cause problems but won't prevent generation
- Info: Issues that may affect functionality but are not critical
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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.
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.7)
- Microsoft.OpenApi (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.