MCPcopy Create free account
hub / github.com/Exrick/xpay / getModelSignature

Function getModelSignature

xpay-code/src/main/resources/static/swagger/swagger-ui.js:24268–24614  ·  view source on GitHub ↗
(name, schema, models, modelPropertyMacro)

Source from the content-addressed store, hash-verified

24266
24267 // copy-pasted from swagger-js
24268 var getModelSignature = function (name, schema, models, modelPropertyMacro) {
24269 var strongOpen = '<span class="strong">';
24270 var strongClose = '</span>';
24271
24272 var optionHtml = function (label, value) {
24273 return '<tr><td class="optionName">' + label + ':</td><td>' + value + '</td></tr>';
24274 };
24275
24276
24277 // Allow for ignoring the 'name' argument.... shifting the rest
24278 if(_.isObject(arguments[0])) {
24279 name = void 0;
24280 schema = arguments[0];
24281 models = arguments[1];
24282 modelPropertyMacro = arguments[2];
24283 }
24284
24285 models = models || {};
24286
24287 // Resolve the schema (Handle nested schemas)
24288 schema = resolveSchema(schema);
24289
24290 // Return for empty object
24291 if(_.isEmpty(schema)) {
24292 return strongOpen + 'Empty' + strongClose;
24293 }
24294
24295 // Dereference $ref from 'models'
24296 if(typeof schema.$ref === 'string') {
24297 name = simpleRef(schema.$ref);
24298 schema = models[name];
24299 if(typeof schema === 'undefined')
24300 {
24301 return strongOpen + name + ' is not defined!' + strongClose;
24302 }
24303 }
24304
24305 if(typeof name !== 'string') {
24306 name = schema.title || 'Inline Model';
24307 }
24308
24309 // If we are a Model object... adjust accordingly
24310 if(schema.definition) {
24311 schema = schema.definition;
24312 }
24313
24314 if(typeof modelPropertyMacro !== 'function') {
24315 modelPropertyMacro = function(prop){
24316 return (prop || {}).default;
24317 };
24318 }
24319
24320 var references = {};
24321 var seenModels = [];
24322 var inlineModels = 0;
24323
24324 // Generate current HTML
24325 var html = processModel(schema, name);

Callers 1

Calls 3

resolveSchemaFunction · 0.85
simpleRefFunction · 0.85
processModelFunction · 0.85

Tested by

no test coverage detected