This package is used to validate a HTTP request/response against an OpenAPI specification.
This can be integrated in to a test suite to ensure the responses returned by your API conform to the OpenAPI specification.
dotnet add package OpenApiValidateor view on NuGet: https://www.nuget.org/packages/OpenApiValidate
See more detailed documentation for setup of the validator.
// Load the OpenApiDocumentvardocumentLoadResult=awaitOpenApiDocument.LoadAsync("https://petstore.swagger.io/v2/swagger.json");// Create the OpenApiValidatorvarvalidator=newOpenApiValidator(documentLoadResult.Document);// Validate the request and responsevarresponse=awaithttpClient.GetAsync("https://petstore.swagger.io/v2/store/inventory");awaitopenApiValidator.Validate(response);// will throw an exception if fails validation