Skip to content

Commit b999cd0

Browse files
committed
Bump version
1 parent 373514c commit b999cd0

File tree

4 files changed

+24
-19
lines changed

4 files changed

+24
-19
lines changed

openapi-to-har.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,22 +157,27 @@ const getBaseUrl = function (openApi, path, method) {
157157
* @param {Object} values Optional: query parameter values to use in the snippet if present
158158
* @returns {Object} Object describing the parameters in a given OpenAPI method
159159
*/
160-
const getParameterValues = function (param, values) {
161-
let value = 'SOME_' + (param.type || param.schema.type).toUpperCase() + '_VALUE'
160+
const getParameterValues = function (param, values) {
161+
let value =
162+
'SOME_' + (param.type || param.schema.type).toUpperCase() + '_VALUE';
162163
if (values && typeof values[param.name] !== 'undefined') {
163-
value = values[param.name] + '' /* adding a empty string to convert to string */
164+
value =
165+
values[param.name] + ''; /* adding a empty string to convert to string */
164166
} else if (typeof param.default !== 'undefined') {
165-
value = param.default + ''
166-
} else if (typeof param.schema !== 'undefined' && typeof param.schema.example !== 'undefined') {
167-
value = param.schema.example + ''
168-
} else if (typeof param.example !== 'undefined'){
169-
value = param.example + ''
167+
value = param.default + '';
168+
} else if (
169+
typeof param.schema !== 'undefined' &&
170+
typeof param.schema.example !== 'undefined'
171+
) {
172+
value = param.schema.example + '';
173+
} else if (typeof param.example !== 'undefined') {
174+
value = param.example + '';
170175
}
171176
return {
172177
name: param.name,
173-
value: value
174-
}
175-
}
178+
value: value,
179+
};
180+
};
176181

177182
/**
178183
* Get array of objects describing the query parameters for a path and method
@@ -214,7 +219,7 @@ const getQueryStrings = function (openApi, path, method, values) {
214219
typeof param.in !== 'undefined' &&
215220
param.in.toLowerCase() === 'query'
216221
) {
217-
queryStrings.push(getParameterValues(param, values))
222+
queryStrings.push(getParameterValues(param, values));
218223
}
219224
}
220225
}
@@ -308,7 +313,7 @@ const getHeadersArray = function (openApi, path, method) {
308313
typeof param.in !== 'undefined' &&
309314
param.in.toLowerCase() === 'header'
310315
) {
311-
headers.push(getParameterValues(param))
316+
headers.push(getParameterValues(param));
312317
}
313318
}
314319
}

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openapi-snippet",
3-
"version": "0.9.3",
3+
"version": "0.10.0",
44
"description": "Generates code snippets from Open API (previously Swagger) documents.",
55
"repository": {
66
"type": "git",

test/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const IBMOpenAPI = require('./ibm_watson_alchemy_data_news_api.json');
1111
const PetStoreOpenAPI = require('./petstore_swagger.json');
1212
const PetStoreOpenAPI3 = require('./petstore_oas.json');
1313
const ParameterSchemaReferenceAPI = require('./parameter_schema_reference');
14-
const ParameterExampleReferenceAPI = require('./parameter_example_swagger.json')
14+
const ParameterExampleReferenceAPI = require('./parameter_example_swagger.json');
1515

1616
test('Getting snippets should not result in error or undefined', function (t) {
1717
t.plan(1);
@@ -195,4 +195,4 @@ test('Testing the case when an example is provided, use the provided example val
195195
t.true(/ {tags: 'dog,cat', limit: '10'}/.test(snippet));
196196
t.false(/SOME_INTEGER_VALUE/.test(snippet));
197197
t.end();
198-
});
198+
});

0 commit comments

Comments
 (0)