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

Commit

Permalink
Make sure types are passed through correctly for non-body items
Browse files Browse the repository at this point in the history
  • Loading branch information
Dom Harrington committed Dec 1, 2017
1 parent ab1406c commit 4c28df0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,36 @@ test('should pass through defaults', () => {
]);
});

test('it should pass through type for non-body parameters', () => {
expect(
parametersToJsonSchema({
parameters: [
{
in: 'query',
name: 'checkbox',
schema: {
type: 'boolean',
},
},
],
}),
).toEqual([
{
label: 'Query Params',
type: 'query',
schema: {
type: 'object',
properties: {
checkbox: {
type: 'boolean',
},
},
required: [],
},
},
]);
});

test('it should pass through description', () => {
expect(
parametersToJsonSchema({
Expand Down
6 changes: 3 additions & 3 deletions packages/api-explorer-ui/dist/index.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function getOtherParams(pathOperation) {

if (current.schema.default) schema.default = current.schema.default;
if (current.schema.enum) schema.enum = current.schema.enum;
if (current.schema.type) schema.type = current.schema.type;
}

prev[current.name] = schema;
Expand Down

0 comments on commit 4c28df0

Please sign in to comment.