Releases: openapi-library/OpenAPIValidators
0.9.1 / 28 April 2020
0.9.0 / 28 April 2020
Introducing a new Jest plugin - jest-openapi
!
I wanted to make a Jest plugin because there are twice the number of Jest npm downloads (=users?) as chai npm downloads - thus helping more developers verify their servers against their OpenAPI specs.
jest-openapi
mirrors chai-openapi-response-validator
for Jest. Jest users can use jest-openapi
as they would jest-extended
. See the README and #69 for more information.
chai-openapi-response-validator
remains the same, with major refactoring because this repo has been converted into a monorepo to help maintain the Jest and chai plugins together #69
0.8.0 / 13 April 2020
Features:
-
Added a TypeScript Declaration File so you can use this plugin in TypeScript projects without import type errors #61. See usage guide
-
Changed some negated assertions to pass instead of fail #67
expect(res).to.not.satisfyApiSpec
used to mean "expectres
to match but not satisfy a response defined in your API spec".
nowexpect(res).to.not.satisfyApiSpec
means "expectres
to neither match nor satisfy a response defined in your API spec".
So ifres
matches no responses in your API spec, thenexpect(res).to.not.satisfyApiSpec
passes. -
Much more useful and consistent assertion failure messages #67, see diff:
0.7.2 / 6 April 2020
0.7.1 / 21 Feb 2019
Fixes:
- Correctly validate falsy response bodies #49 (AlexDobeck)
0.7.0 / 27 Dec 2019
Features:
- Users can now validate objects against individual schema objects #38, e.g.:
Given an API spec including:
...
components:
schemas:
ExampleSchemaObject:
type: string
...
Assert in unit tests:
expect('foo').to.satisfySchemaDefinedInApiSpec('ExampleSchemaObject') // passes
expect(['foo']).to.satisfySchemaDefinedInApiSpec('ExampleSchemaObject') // throws useful error
For a fuller guide, see docs from master or the original PR
0.6.0 / 22 Dec 2019
Features:
- User can define api spec directly as object #39, e.g.
before(async() => {
const apiSpec = (await axios.get('url/to/openapi/spec')).data;
chai.use(chaiResponseValidator(apiSpec)); // no need to write apiSpec out to a file
}
0.5.1 / 19 Dec 2019
Fixes:
- User of superagent-based request packages (e.g. supertest, chai-http) can validate responses with text/html headers #35
0.5.0 / 19 Dec 2019
0.4.0 / 1 Dec 2019
- Now support responses defined in your OpenAPI 2 and 3 specs that reference Response Definition Objects (e.g.
$ref: '#/components/responses/ExampleResponseDefinitionObject'
) #26