Skip to main content

OpenAPI (OAD) Plugin

The OAD plugin is the primary driver for spec-first verification. It maps supported Swagger and OpenAPI operations to Drift test cases.

1. When to Use This Plugin

Use the OAD plugin when your test suite targets an OpenAPI or Swagger specification. It is the foundational plugin required for most Drift test suites.

2. Registering the Plugin

Add the plugin to the plugins section of your Drift file:

plugins:
- name: oas

3. Supported Specification Formats

Use the following table to confirm which specification formats Drift supports.

Specification formatSupport status
Swagger 2.0Supported
OpenAPI 3.0Supported
OpenAPI 3.1Supported
OpenAPI 3.2Not supported
Swagger earlier than 2.0Not supported

4. Mapping Operations

Each test operation in Drift maps to an endpoint in your OpenAPI file via the target property.

operations:
getAllValues:
target: my-OAD:getProductByID # Points to the operationId in the OAD
description: "Get all values"

5. Setting Parameters

Drift automatically maps values from the parameters section of your YAML to the corresponding path, query, or header requirements in the OAD.

operations:
getProduct:
target: my-OAD:getProductByID
parameters:
path:
id: 100
query:
value: test

6. Bound Context Values

You can reference metadata from the current operation in the OAD as a bound value. This is useful for using spec-defined examples as test inputs.

parameters:
path:
id: ${my-OAD:operation.parameters.id.example} # Injects the example from the spec
query:
value: ${my-OAD:operation.summary} # Injects the summary text

Supported Metadata Properties:

  • tags, summary, description, operationId.
  • parameters (including example, examples, and extensions via ext).
  • deprecated and extensions (via ext).