Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Make sure enums are passed through
Browse files Browse the repository at this point in the history
  • Loading branch information
Dom Harrington committed Oct 26, 2017
1 parent 0255baf commit aab1c77
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,38 @@ test('it should work for request body inline', () => {
]);
});

test('should pass through enum', () => {
expect(
parametersToJsonSchema({
parameters: [
{
in: 'header',
name: 'Accept',
required: false,
schema: {
type: 'string',
enum: ['application/json', 'application/xml'],
}
},
],
}),
).toEqual([
{
label: 'Headers',
type: 'header',
schema: {
type: 'object',
properties: {
Accept: {
type: 'string',
enum: ['application/json', 'application/xml'],
}
},
required: [],
},
},
]);
});
test.skip('it should work for top-level request body $ref', () => {
expect(
parametersToJsonSchema(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module.exports = pathOperation => {
schema.type = 'array';
schema.items = current.schema.items;
}
if (current.schema.enum) schema.enum = current.schema.enum;
}

prev[current.name] = schema;
Expand Down

0 comments on commit aab1c77

Please sign in to comment.