(value, modelsToIgnore)
| 24703 | |
| 24704 | // copy-pasted from swagger-js |
| 24705 | var createJSONSample = function (value, modelsToIgnore) { |
| 24706 | modelsToIgnore = modelsToIgnore || {}; |
| 24707 | |
| 24708 | modelsToIgnore[value.name] = value; |
| 24709 | |
| 24710 | // Response support |
| 24711 | if (value.examples && _.isPlainObject(value.examples)) { |
| 24712 | value = _.cloneDeep(value); |
| 24713 | var keys = Object.keys(value.examples); |
| 24714 | |
| 24715 | _.forEach(keys, function(key) { |
| 24716 | if(key.indexOf('application/json') === 0) { |
| 24717 | var example = value.examples[key]; |
| 24718 | if (_.isString(example)) { |
| 24719 | example = jsyaml.safeLoad(example); |
| 24720 | } |
| 24721 | value.definition.example = example; |
| 24722 | return schemaToJSON(value.definition, example, modelsToIgnore, value.modelPropertyMacro); |
| 24723 | } |
| 24724 | }); |
| 24725 | } |
| 24726 | |
| 24727 | if (value.examples) { |
| 24728 | value = _.cloneDeep(value); |
| 24729 | var example = value.examples; |
| 24730 | if (_.isString(example)) { |
| 24731 | example = jsyaml.safeLoad(example); |
| 24732 | } |
| 24733 | value.definition.example = example; |
| 24734 | return schemaToJSON(value.definition, example, modelsToIgnore, value.modelPropertyMacro); |
| 24735 | } |
| 24736 | |
| 24737 | return schemaToJSON(value.definition, value.models, modelsToIgnore, value.modelPropertyMacro); |
| 24738 | }; |
| 24739 | |
| 24740 | // copy-pasted from swagger-js |
| 24741 | var getParameterModelSignature = function (type, definitions) { |
no test coverage detected