---
title: "How to Validate OpenAPI Specification Against Implementation Using Dredd CLI?"  
description: "How to Validate OpenAPI Specification Against Implementation Using Dredd CLI?"  
author: "Manish Sharma"  
published: 2026-08-19  
updated: 2026-08-18  
canonical: https://answers.mindstick.com/qa/117083/how-to-validate-openapi-specification-against-implementation-using-dredd-cli  
category: "API Testing"  
tags: ["Dredd", "OpenAPI", "Contract Testing", "CLI", "API Schema"]  
reading_time: 1 minute  

---

# How to Validate OpenAPI Specification Against Implementation Using Dredd CLI?

Dredd is a language-agnostic command-line tool that performs contract testing by comparing backend API responses with an OpenAPI/Swagger or API Blueprint definition file.

## How to initialize and run Dredd CLI for contract testing?

Dredd makes contract testing straightforward directly from command prompt.

### 1. Install Dredd

```
npm install -g dredd
```

### 2. Initialize Configuration

```
dredd init
```

This command interactively generates a **dredd.yml** configuration file specifying API description files, backend server URLs, and hook scripts.

### 3. Run Contract Tests

```
dredd openapi.yaml http://127.0.0.1:3000
```

Dredd sends requests to the live backend server and validates status codes, response headers, and body schemas against the OpenAPI specification.


---

Original Source: https://answers.mindstick.com/qa/117083/how-to-validate-openapi-specification-against-implementation-using-dredd-cli

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
