Skip to content

Repository files navigation

OpenApi Validate

GitHub Workflow StatusGitHub release (latest SemVer)NuGet VersionGitHub

Introduction

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.

Installation

dotnet add package OpenApiValidate

or view on NuGet: https://www.nuget.org/packages/OpenApiValidate

Usage

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

About

NuGet package for validating requests and responses against OpenApi specifications

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages