Skip to content

tidusjar/Wiremock.OpenAPIValidator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WireMock Open API Validator

Build Publish Nuget Quality Gate Status

This tool is intended to test your Wiremock stubs against an OpenAPI (v3) specification. This will check the following

Type of Check Description
API Method Ensure the mock is matching the API Verb provided
URL Pattern Match Ensure the mock will actually match the URL
Parameters Checks all required parameters are present and the object type is correct. Will also check optional parameters but will only produce a warning
Response Checks the response object and ensuring the types also match

Installation

.Net CLI (Global)

dotnet tool install --global Wiremock.OpenAPIValidator


Usage

wiremockopenapi -o "C:/git/MyApi/OpenApi.yml" -w "C:/git/wiremock/stubs/mappings"

Example Workflow

steps:
- uses: actions/checkout@v3
- name: Setup .NET
    uses: actions/setup-dotnet@v2
    with:
    dotnet-version: 6.0.x
- name: Install Wiremock OpenAPI Validator Tool
    run: dotnet tool install --global Wiremock.OpenAPIValidator
- name: Run Validator
    run: |
    wiremockopenapi -o "./openapi/openapi.yaml" -w "./wiremock/mappings"

-o, --openApiPath             Required. File path to the Open API Spec

-w, --wiremockMappingsPath    Required. File path to the stubs mappings folder

--help                        Display this help screen.

--version                     Display version information.

Example Output

Example Result