Skip to content

Commit

Permalink
Another attempt at recreating
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Sturgeon committed Apr 2, 2018
1 parent ea73d31 commit 84709e5
Show file tree
Hide file tree
Showing 6 changed files with 725 additions and 1,068 deletions.
4 changes: 3 additions & 1 deletion lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,9 @@ function checkPathItem(pathItem, path, openapi, options) {
op.should.not.have.property('produces');
op.should.not.have.property('schemes');
op.should.have.property('responses');
op.responses.should.not.be.empty();
if (!(typeof op.responses === 'object' && Object.keys(op.responses).length > 0)) {
should.fail(false,true,'Operation object responses must be a non-empty object');
}
if (op.summary) op.summary.should.have.type('string');
if (op.description) op.description.should.have.type('string');
if (typeof op.operationId !== 'undefined') {
Expand Down
4 changes: 2 additions & 2 deletions test/loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ describe('loader.js', () => {

it('does not resolve references by default', async () => {
const spec = await loader.loadSpec(samplesDir + 'refs/openapi.yaml');
should(spec.paths.a).have.key('$ref');
should(spec.paths['/a']).have.key('$ref');
});

it('resolves refs when passed { resolve: true }', async () => {
const spec = await loader.loadSpec(samplesDir + 'refs/openapi.yaml', { resolve: true });
should(spec.paths.a.post.description).equal('Some operation object');
should(spec.paths['/a'].post.description).equal('Some operation object');
});

it('throws OpenError for non-existant file', async () => {
Expand Down
Loading

0 comments on commit 84709e5

Please sign in to comment.