mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 19:08:52 +00:00
Merge pull request #4175 from bshamblen/master
Fixes for html2 template
This commit is contained in:
commit
cafcf51e3f
@ -12,70 +12,84 @@
|
||||
|
||||
{{>js_prettify}}
|
||||
{{>js_bootstrap}}
|
||||
{{>marked}}
|
||||
|
||||
<script>
|
||||
|
||||
$( document ).ready(function() {
|
||||
marked.setOptions({
|
||||
renderer: new marked.Renderer(),
|
||||
gfm: true,
|
||||
tables: true,
|
||||
breaks: false,
|
||||
pedantic: false,
|
||||
sanitize: false,
|
||||
smartLists: true,
|
||||
smartypants: false
|
||||
});
|
||||
|
||||
var textFile = null;
|
||||
var textFile = null;
|
||||
|
||||
/// Function to be used to download a text json schema
|
||||
function makeTextFile(text) {
|
||||
/// Function to be used to download a text json schema
|
||||
function makeTextFile(text) {
|
||||
|
||||
var data = new Blob([text], {type: 'text/plain'});
|
||||
var data = new Blob([text], {type: 'text/plain'});
|
||||
|
||||
// If we are replacing a previously generated file we need to
|
||||
// manually revoke the object URL to avoid memory leaks.
|
||||
if (textFile !== null) {
|
||||
window.URL.revokeObjectURL(textFile);
|
||||
// If we are replacing a previously generated file we need to
|
||||
// manually revoke the object URL to avoid memory leaks.
|
||||
if (textFile !== null) {
|
||||
window.URL.revokeObjectURL(textFile);
|
||||
}
|
||||
|
||||
textFile = window.URL.createObjectURL(data);
|
||||
|
||||
var a = document.createElement("a");
|
||||
document.body.appendChild(a);
|
||||
a.style = "display: none";
|
||||
a.href = textFile;
|
||||
a.download = 'schema.txt';
|
||||
a.click();
|
||||
|
||||
return textFile;
|
||||
};
|
||||
|
||||
/// TODO: Implement resizing for expanding within iframe
|
||||
function callResize() {
|
||||
window.parent.postMessage('resize', "*");
|
||||
}
|
||||
|
||||
textFile = window.URL.createObjectURL(data);
|
||||
|
||||
var a = document.createElement("a");
|
||||
document.body.appendChild(a);
|
||||
a.style = "display: none";
|
||||
|
||||
a.href = textFile;
|
||||
a.download = 'schema.txt';
|
||||
a.click();
|
||||
|
||||
return textFile;
|
||||
};
|
||||
|
||||
/// TODO: Implement resizing for expanding within iframe
|
||||
function callResize() {
|
||||
window.parent.postMessage('resize', "*");
|
||||
|
||||
}
|
||||
function processMarked() {
|
||||
$(".marked").each(function() {
|
||||
$(this).html(marked($(this).html()));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// load google web fonts
|
||||
loadGoogleFontCss();
|
||||
// load google web fonts
|
||||
loadGoogleFontCss();
|
||||
|
||||
|
||||
// Bootstrap Scrollspy
|
||||
$(this).scrollspy({ target: '#scrollingNav', offset: 18 });
|
||||
// Bootstrap Scrollspy
|
||||
$(this).scrollspy({ target: '#scrollingNav', offset: 18 });
|
||||
|
||||
// Content-Scroll on Navigation click.
|
||||
$('.sidenav').find('a').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var id = $(this).attr('href');
|
||||
if ($(id).length > 0)
|
||||
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) }, 400);
|
||||
window.location.hash = $(this).attr('href');
|
||||
});
|
||||
// Content-Scroll on Navigation click.
|
||||
$('.sidenav').find('a').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var id = $(this).attr('href');
|
||||
if ($(id).length > 0)
|
||||
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) }, 400);
|
||||
window.location.hash = $(this).attr('href');
|
||||
});
|
||||
|
||||
// Quickjump on Pageload to hash position.
|
||||
if(window.location.hash) {
|
||||
var id = window.location.hash;
|
||||
if ($(id).length > 0)
|
||||
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) }, 0);
|
||||
}
|
||||
// Quickjump on Pageload to hash position.
|
||||
if(window.location.hash) {
|
||||
var id = window.location.hash;
|
||||
if ($(id).length > 0)
|
||||
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) }, 0);
|
||||
}
|
||||
|
||||
|
||||
function initDynamic() {
|
||||
|
||||
function initDynamic() {
|
||||
// tabs
|
||||
$('.nav-tabs-examples a').click(function (e) {
|
||||
e.preventDefault();
|
||||
@ -83,35 +97,35 @@ function initDynamic() {
|
||||
});
|
||||
|
||||
|
||||
$('.nav-tabs-examples').find('a:first').tab('show');
|
||||
$('.nav-tabs-examples').find('a:first').tab('show');
|
||||
|
||||
// call scrollspy refresh method
|
||||
$(window).scrollspy('refresh');
|
||||
}
|
||||
|
||||
}
|
||||
initDynamic();
|
||||
initDynamic();
|
||||
|
||||
// Pre- / Code-Format
|
||||
prettyPrint();
|
||||
// Pre- / Code-Format
|
||||
prettyPrint();
|
||||
|
||||
//Convert elements with "marked" class to markdown
|
||||
processMarked();
|
||||
|
||||
/**
|
||||
* Load google fonts.
|
||||
*/
|
||||
function loadGoogleFontCss() {
|
||||
/**
|
||||
* Load google fonts.
|
||||
*/
|
||||
function loadGoogleFontCss() {
|
||||
WebFont.load({
|
||||
active: function() {
|
||||
// Update scrollspy
|
||||
$(window).scrollspy('refresh')
|
||||
},
|
||||
google: {
|
||||
families: ['Source Code Pro', 'Source Sans Pro:n4,n6,n7']
|
||||
}
|
||||
active: function() {
|
||||
// Update scrollspy
|
||||
$(window).scrollspy('refresh')
|
||||
},
|
||||
google: {
|
||||
families: ['Source Code Pro', 'Source Sans Pro:n4,n6,n7']
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
@ -192,7 +206,7 @@ function loadGoogleFontCss() {
|
||||
|
||||
<hr>
|
||||
|
||||
<p>{{{appDescription}}}</p>
|
||||
<p class="marked">{{appDescription}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="sections">
|
||||
@ -224,7 +238,7 @@ function loadGoogleFontCss() {
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<p></p>
|
||||
<p>{{notes}}</p>
|
||||
<p class="marked">{{notes}}</p>
|
||||
<p></p>
|
||||
<br />
|
||||
|
||||
@ -375,6 +389,21 @@ curl -X <span style="text-transform: uppercase;">{{httpMethod}}</span>{{#authMet
|
||||
</table>
|
||||
{{/hasBodyParam}}
|
||||
|
||||
{{#hasFormParams}}
|
||||
<div class="methodsubtabletitle">Form parameters</div>
|
||||
<table id="methodsubtable">
|
||||
<tr>
|
||||
<th width="150px">Name</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<!---->
|
||||
{{#formParams}}
|
||||
{{>param}}
|
||||
{{/formParams}}
|
||||
|
||||
</table>
|
||||
{{/hasFormParams}}
|
||||
|
||||
{{#hasQueryParams}}
|
||||
<div class="methodsubtabletitle">Query parameters</div>
|
||||
<table id="methodsubtable">
|
||||
|
@ -56,7 +56,7 @@ var _createClass = (function () { function defineProperties(target, props) { for
|
||||
|
||||
var _templateObject = _taggedTemplateLiteral(['\n <div class="any">\n ', '\n\n <span class="type type-any"><any></span>\n\n ', '\n\t\t \n\t\t ', '\n\t\t ', '\n\t\t ', '\n </div>\n '], ['\n <div class="any">\n ', '\n\n <span class="type type-any"><any></span>\n\n ', '\n\t\t \n\t\t ', '\n\t\t ', '\n\t\t ', '\n </div>\n ']),
|
||||
_templateObject2 = _taggedTemplateLiteral(['\n <a class="title"><span class="toggle-handle"></span>', ' </a>\n '], ['\n <a class="title"><span class="toggle-handle"></span>', ' </a>\n ']),
|
||||
_templateObject3 = _taggedTemplateLiteral(['\n <div class="inner description">', '</div>\n '], ['\n <div class="inner description">', '</div>\n ']),
|
||||
_templateObject3 = _taggedTemplateLiteral(['\n <div class="inner description marked">', '</div>\n '], ['\n <div class="inner description marked">', '</div>\n ']),
|
||||
_templateObject4 = _taggedTemplateLiteral(['\n <div class="inner required">Required: ', '</div>\n '], ['\n <div class="inner required">Required: ', '</div>\n ']),
|
||||
_templateObject5 = _taggedTemplateLiteral(['\n <div class="inner default">Default: ', '</div>\n '], ['\n <div class="inner default">Default: ', '</div>\n ']),
|
||||
_templateObject6 = _taggedTemplateLiteral(['\n <div class="inner pattern">Pattern: ', '</div>\n '], ['\n <div class="inner pattern">Pattern: ', '</div>\n ']),
|
||||
@ -160,7 +160,7 @@ var JSONSchemaView = (function () {
|
||||
return '';
|
||||
}
|
||||
|
||||
return ('\n <!-- Any -->\n ' + (0, _helpersJs._if)(this.isAny)(_templateObject, (0, _helpersJs._if)(this.showToggle)(_templateObject2, this.schema.title || ''), (0, _helpersJs._if)(this.schema.description && !this.isCollapsed)(_templateObject3, this.schema.description), (0, _helpersJs._if)(this.schema.required && !this.isCollapsed)(_templateObject4, this.schema.required), (0, _helpersJs._if)(this.schema['default'] && !this.isCollapsed)(_templateObject5, this.schema['default']), (0, _helpersJs._if)(this.schema.pattern && !this.isCollapsed)(_templateObject6, this.schema.pattern)) + '\n\n <!-- Primitive -->\n ' + (0, _helpersJs._if)(this.isPrimitive)(_templateObject7, (0, _helpersJs._if)(this.showToggle)(_templateObject2, this.schema.title || ''), this.schema.type, (0, _helpersJs._if)(!this.isCollapsed && this.schema.format)(_templateObject8, this.schema.format), (0, _helpersJs._if)(!this.isCollapsed && this.schema.minimum)(_templateObject9, this.schema.minimum), (0, _helpersJs._if)(!this.isCollapsed && this.schema.exclusiveMinimum)(_templateObject10, this.schema.exclusiveMinimum), (0, _helpersJs._if)(!this.isCollapsed && this.schema.maximum)(_templateObject11, this.schema.maximum), (0, _helpersJs._if)(!this.isCollapsed && this.schema.exclusiveMaximum)(_templateObject12, this.schema.exclusiveMaximum), (0, _helpersJs._if)(!this.isCollapsed && this.schema.minLength)(_templateObject13, this.schema.minLength), (0, _helpersJs._if)(!this.isCollapsed && this.schema.maxLength)(_templateObject14, this.schema.maxLength), (0, _helpersJs._if)(this.schema.description && !this.isCollapsed)(_templateObject3, this.schema.description), (0, _helpersJs._if)(this.schema.required && !this.isCollapsed)(_templateObject15), (0, _helpersJs._if)(this.schema['default'] && !this.isCollapsed)(_templateObject5, this.schema['default']), (0, _helpersJs._if)(this.schema.pattern && !this.isCollapsed)(_templateObject6, this.schema.pattern), (0, _helpersJs._if)(!this.isCollapsed && this.schema['enum'])(_templateObject16, this['enum'](this.schema, this.isCollapsed, this.open)), (0, _helpersJs._if)(this.schema.allOf && !this.isCollapsed)(_templateObject17, this.xOf(this.schema, 'allOf')), (0, _helpersJs._if)(this.schema.oneOf && !this.isCollapsed)(_templateObject17, this.xOf(this.schema, 'oneOf')), (0, _helpersJs._if)(this.schema.anyOf && !this.isCollapsed)(_templateObject17, this.xOf(this.schema, 'anyOf'))) + '\n\n\n <!-- Array -->\n ' + (0, _helpersJs._if)(this.isArray)(_templateObject18, this.schema.title || '', (0, _helpersJs._if)(this.isCollapsed)(_templateObject19), (0, _helpersJs._if)(!this.isCollapsed && (this.schema.uniqueItems || this.schema.minItems || this.schema.maxItems))(_templateObject20, this.schema.minItems || 0, this.schema.maxItems || '∞', (0, _helpersJs._if)(!this.isCollapsed && this.schema.uniqueItems)(_templateObject21)), (0, _helpersJs._if)(!this.isCollapsed && this.schema.description)(_templateObject22, this.schema.description), (0, _helpersJs._if)(!this.isCollapsed && this.schema['enum'])(_templateObject16, this['enum'](this.schema, this.isCollapsed, this.open)), (0, _helpersJs._if)(this.schema.allOf && !this.isCollapsed)(_templateObject17, this.xOf(this.schema, 'allOf')), (0, _helpersJs._if)(this.schema.oneOf && !this.isCollapsed)(_templateObject17, this.xOf(this.schema, 'oneOf')), (0, _helpersJs._if)(this.schema.anyOf && !this.isCollapsed)(_templateObject17, this.xOf(this.schema, 'anyOf')), (0, _helpersJs._if)(!this.isCollapsed)(_templateObject23)) + '\n\n <!-- Object -->\n ' + (0, _helpersJs._if)(!this.isPrimitive && !this.isArray && !this.isAny)(_templateObject24, this.schema.title || '', (0, _helpersJs._if)(this.isCollapsed)(_templateObject25), (0, _helpersJs._if)(!this.isCollapsed && this.schema.description)(_templateObject22, this.schema.description),
|
||||
return ('\n <!-- Any -->\n ' + (0, _helpersJs._if)(this.isAny)(_templateObject, (0, _helpersJs._if)(this.showToggle)(_templateObject2, this.schema.title || ''), (0, _helpersJs._if)(this.schema.description && !this.isCollapsed)(_templateObject3, marked(this.schema.description || "")), (0, _helpersJs._if)(this.schema.required && !this.isCollapsed)(_templateObject4, this.schema.required), (0, _helpersJs._if)(this.schema['default'] && !this.isCollapsed)(_templateObject5, this.schema['default']), (0, _helpersJs._if)(this.schema.pattern && !this.isCollapsed)(_templateObject6, this.schema.pattern)) + '\n\n <!-- Primitive -->\n ' + (0, _helpersJs._if)(this.isPrimitive)(_templateObject7, (0, _helpersJs._if)(this.showToggle)(_templateObject2, this.schema.title || ''), this.schema.type, (0, _helpersJs._if)(!this.isCollapsed && this.schema.format)(_templateObject8, this.schema.format), (0, _helpersJs._if)(!this.isCollapsed && this.schema.minimum)(_templateObject9, this.schema.minimum), (0, _helpersJs._if)(!this.isCollapsed && this.schema.exclusiveMinimum)(_templateObject10, this.schema.exclusiveMinimum), (0, _helpersJs._if)(!this.isCollapsed && this.schema.maximum)(_templateObject11, this.schema.maximum), (0, _helpersJs._if)(!this.isCollapsed && this.schema.exclusiveMaximum)(_templateObject12, this.schema.exclusiveMaximum), (0, _helpersJs._if)(!this.isCollapsed && this.schema.minLength)(_templateObject13, this.schema.minLength), (0, _helpersJs._if)(!this.isCollapsed && this.schema.maxLength)(_templateObject14, this.schema.maxLength), (0, _helpersJs._if)(this.schema.description && !this.isCollapsed)(_templateObject3, marked(this.schema.description || "")), (0, _helpersJs._if)(this.schema.required && !this.isCollapsed)(_templateObject15), (0, _helpersJs._if)(this.schema['default'] && !this.isCollapsed)(_templateObject5, this.schema['default']), (0, _helpersJs._if)(this.schema.pattern && !this.isCollapsed)(_templateObject6, this.schema.pattern), (0, _helpersJs._if)(!this.isCollapsed && this.schema['enum'])(_templateObject16, this['enum'](this.schema, this.isCollapsed, this.open)), (0, _helpersJs._if)(this.schema.allOf && !this.isCollapsed)(_templateObject17, this.xOf(this.schema, 'allOf')), (0, _helpersJs._if)(this.schema.oneOf && !this.isCollapsed)(_templateObject17, this.xOf(this.schema, 'oneOf')), (0, _helpersJs._if)(this.schema.anyOf && !this.isCollapsed)(_templateObject17, this.xOf(this.schema, 'anyOf'))) + '\n\n\n <!-- Array -->\n ' + (0, _helpersJs._if)(this.isArray)(_templateObject18, this.schema.title || '', (0, _helpersJs._if)(this.isCollapsed)(_templateObject19), (0, _helpersJs._if)(!this.isCollapsed && (this.schema.uniqueItems || this.schema.minItems || this.schema.maxItems))(_templateObject20, this.schema.minItems || 0, this.schema.maxItems || '∞', (0, _helpersJs._if)(!this.isCollapsed && this.schema.uniqueItems)(_templateObject21)), (0, _helpersJs._if)(!this.isCollapsed && this.schema.description)(_templateObject22, marked(this.schema.description || "")), (0, _helpersJs._if)(!this.isCollapsed && this.schema['enum'])(_templateObject16, this['enum'](this.schema, this.isCollapsed, this.open)), (0, _helpersJs._if)(this.schema.allOf && !this.isCollapsed)(_templateObject17, this.xOf(this.schema, 'allOf')), (0, _helpersJs._if)(this.schema.oneOf && !this.isCollapsed)(_templateObject17, this.xOf(this.schema, 'oneOf')), (0, _helpersJs._if)(this.schema.anyOf && !this.isCollapsed)(_templateObject17, this.xOf(this.schema, 'anyOf')), (0, _helpersJs._if)(!this.isCollapsed)(_templateObject23)) + '\n\n <!-- Object -->\n ' + (0, _helpersJs._if)(!this.isPrimitive && !this.isArray && !this.isAny)(_templateObject24, this.schema.title || '', (0, _helpersJs._if)(this.isCollapsed)(_templateObject25), (0, _helpersJs._if)(!this.isCollapsed && this.schema.description)(_templateObject22, marked(this.schema.description || "")),
|
||||
|
||||
(0, _helpersJs._if)(this.schema.required && !this.isCollapsed && this.options.isBodyParam != true)(_templateObject26, this.schema.required),
|
||||
(0, _helpersJs._if)(this.schema.required && !this.isCollapsed && this.options.isBodyParam == true)(_templateObject266, this.schema.required),
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user