Skip to content

Add support for asserting against open API schema

Choose a tag to compare

@thetutlage thetutlage released this 18 Mar 12:26

After this release, you will be able to register the open API schemas and assert API responses against it. Here's a small example.

const config = {
  openApi: {
    schemas: [join(__dirname, '..', 'api-spec.json')],
  },
}

configure({
  plugins: [assert(config)],
})

Validate response as follows.

test('get users', ({ assert }) => {
  const response = await supertest(baseUrl).get('/users')
  assert.isValidateApiResponse(response)
})

Commits

  • docs(README): add open API assertion example 46ef0e2
  • feat: add support for validating responses against api schema ed7b71f
  • feat: automatically augment TestContext 1c402fd
  • chore: update dependencies 8b71324

v1.2.4...v1.3.0