Skip to content

Commit e4d3337

Browse files
committed
adaptor; parameter examples
1 parent b5489e9 commit e4d3337

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

adaptor.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ function convertOperation(op,verb,path,pathItem,obj,api) {
197197
for (let p of schemaProperties) {
198198
if (typeof param.schema[p] !== 'undefined') parameter[p] = param.schema[p];
199199
}
200+
parameter.example = JSON.stringify(sampler.sample(param.schema,{},api));
200201
parameter.isBoolean = (param.schema.type === 'boolean');
201202
parameter.isPrimitiveType = (!param.schema["x-oldref"]);
202203
parameter.dataFormat = param.schema.format;
@@ -253,7 +254,8 @@ function convertOperation(op,verb,path,pathItem,obj,api) {
253254
operation.formParams.push(clone(parameter));
254255
operation.hasFormParams = true;
255256
}
256-
}
257+
} // end of effective parameters
258+
257259
operation.bodyParams = [];
258260
if (op.requestBody) {
259261
operation.openapi.requestBody = op.requestBody;
@@ -269,6 +271,7 @@ function convertOperation(op,verb,path,pathItem,obj,api) {
269271
operation.bodyParam.isDateTime = false;
270272
operation.bodyParam.baseName = 'body';
271273
operation.bodyParam.paramName = 'body';
274+
operation.bodyParam.baseType = 'object';
272275
operation.bodyParam.required = op.requestBody.required||false;
273276
operation.bodyParam.optional = !operation.bodyParam.required;
274277
if (operation.bodyParam.required) operation.hasRequiredParams = true;
@@ -291,6 +294,7 @@ function convertOperation(op,verb,path,pathItem,obj,api) {
291294
obj.hasConsumes = true;
292295
}
293296
operation.bodyParam.schema = contentType.schema;
297+
operation.bodyParam.example = JSON.stringify(sampler.sample(contentType.schema,{},api));
294298
for (let p in schemaProperties) {
295299
if (typeof contentType.schema[p] !== 'undefined') operation.bodyParam[p] = contentType.schema[p];
296300
}

0 commit comments

Comments
 (0)