Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions lib/schemaUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -761,13 +761,21 @@ module.exports = {
}
else {
_.forEach(commonPathVars, (variable) => {
let description = this.getParameterDescription(variable);
let description = this.getParameterDescription(variable),
paramValue = options.schemaFaker ?
safeSchemaFaker(variable.schema || {}, 'schema', components, 'REQUEST',
SCHEMA_FORMATS.DEFAULT, options.indentCharacter, schemaCache) : '';

// Use path variable example value as param value
// Reference to https://github.com/postmanlabs/openapi-to-postman/issues/204
if (options.requestParametersResolution === 'example' && variable.schema && variable.schema.example) {
paramValue = variable.schema.example;
}

variables.push({
key: variable.name,
// we only fake the schema for param-level pathVars
value: options.schemaFaker ?
safeSchemaFaker(variable.schema || {}, 'schema', components, 'REQUEST',
SCHEMA_FORMATS.DEFAULT, options.indentCharacter, schemaCache) : '',
value: paramValue,
description: description
});
});
Expand Down