|
1 |
| -§/** |
| 1 | +/** |
2 | 2 | * swagger-ui - Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API
|
3 | 3 | * @version v2.1.4
|
4 | 4 | * @link http://swagger.io
|
@@ -26810,11 +26810,50 @@ SwaggerUi.partials.signature = (function () {
|
26810 | 26810 | }
|
26811 | 26811 | };
|
26812 | 26812 |
|
| 26813 | + var wrapTag = function (name, value) { |
| 26814 | + var str = [ |
| 26815 | + '<', name, '>', |
| 26816 | + value, |
| 26817 | + '</', name, '>' |
| 26818 | + ]; |
| 26819 | + |
| 26820 | + return str.join(''); |
| 26821 | + }; |
| 26822 | + |
| 26823 | + var createXMLSample = function (name, definition) { |
| 26824 | + var primitivesMap = { |
| 26825 | + 'string': { |
| 26826 | + 'date': new Date(1).toISOString().split('T')[0], |
| 26827 | + 'date-time' : new Date(1).toISOString(), |
| 26828 | + 'default': 'string' |
| 26829 | + }, |
| 26830 | + 'integer': 1, |
| 26831 | + 'number': 1.1, |
| 26832 | + 'boolean': true |
| 26833 | + }; |
| 26834 | + var type = definition.type; |
| 26835 | + var format = definition.format; |
| 26836 | + var value; |
| 26837 | + |
| 26838 | + if (_.keys(primitivesMap).indexOf(type) !== -1) { |
| 26839 | + if (type === 'string') { |
| 26840 | + value = format ? primitivesMap.string[format] : primitivesMap.string.default; |
| 26841 | + } else { |
| 26842 | + value = primitivesMap[type]; |
| 26843 | + } |
| 26844 | + |
| 26845 | + return wrapTag(name, value); |
| 26846 | + } |
| 26847 | + |
| 26848 | + return ''; |
| 26849 | + }; |
| 26850 | + |
26813 | 26851 | return {
|
26814 | 26852 | getModelSignature: getModelSignature,
|
26815 | 26853 | createJSONSample: createJSONSample,
|
26816 | 26854 | getParameterModelSignature: getParameterModelSignature,
|
26817 |
| - createParameterJSONSample: createParameterJSONSample |
| 26855 | + createParameterJSONSample: createParameterJSONSample, |
| 26856 | + createXMLSample: createXMLSample |
26818 | 26857 | };
|
26819 | 26858 |
|
26820 | 26859 | })();
|
|
0 commit comments