Skip to content

Commit

Permalink
fix: allow operation without parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
skonves committed Apr 22, 2019
1 parent dbc1cfb commit ecb55cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/tester/factories/missing-parameter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ export const createMissingParameters: OperationTestFactory = {
type: 'operation',
create: function*({ verb, pathPattern, spec, validRequest }, { uriFactory }) {
const { parameters } = spec.paths[pathPattern][verb];
const required = parameters.filter(p => !isRef(p) && p.required);
const required = parameters
? parameters.filter(p => !isRef(p) && p.required)
: [];

for (const parameter of required) {
if (!isRef(parameter)) {
Expand Down
4 changes: 3 additions & 1 deletion src/tester/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export function createValidRequest(
): RequestParams {
const { parameters } = operation;

const required = parameters.filter(p => !isRef(p) && p.required);
const required = parameters
? parameters.filter(p => !isRef(p) && p.required)
: [];
const request: RequestParams = {
path: {},
headers: {},
Expand Down

0 comments on commit ecb55cc

Please sign in to comment.