38 |
39 |
40 | #### Request/Response
41 | Laid out in a two colum for easy view & compare
42 |
43 |
44 |
45 |
46 | #### Schema View
47 | All Request/Response schema and Response JSONs are expanded by default, so that you dont have to click and reveal each level for easy browsing and read
48 |
49 |
50 |
51 |
52 | #### Console
53 | Built in console, fields are pre-filled with values if exist in spec, request body is generated and filled based on schema, allowing you to quickly try out the end-point with a single click
54 |
55 |
56 |
57 |
58 | #### Authentication Support
59 | All the authentication methods are supported. Along with instructions on how to use it
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/src/assets/styles/index.scss:
--------------------------------------------------------------------------------
1 | @import "~@/assets/styles/_vars.scss";
2 | @import "~@/assets/styles/_typography.scss";
3 | @import "~@/assets/styles/_element_vars.scss"; /* This contains all customizations and then loading of elements theme css */
4 | @import "~@/assets/styles/_sw_form.scss";
5 | @import "~@/assets/styles/_table.scss";
6 | @import "~@/assets/styles/_slideout.scss";
7 | @import url("https://fonts.googleapis.com/css?family=Nunito:300,400,600,700");
8 |
9 |
10 | body, html{
11 | width:100%;
12 | height:100%;
13 | margin:0;
14 | padding:0;
15 | font-family: $sw-font-family, 'Nunito', sans-serif;
16 | font-weight:400;
17 | font-size: 14px;
18 | color:#333;
19 | letter-spacing:normal;
20 | &::-webkit-scrollbar {width: 8px; height:8px}
21 | &::-webkit-scrollbar-track {background-color: transparent;}
22 | &::-webkit-scrollbar-thumb {
23 | background-color: rgba(0,0,0,0.4);
24 | border-radius:3px;
25 | }
26 | }
27 |
28 | input, select, button {
29 | font-family: $sw-font-family, 'Nunito', sans-serif;
30 | font-weight:400;
31 | }
32 |
33 | a{
34 | color: darken($sw-info,5%);
35 | }
36 |
37 | .sw-row {
38 | display:flex;
39 | align-items:center;
40 | flex-direction: row;
41 | }
42 | .sw-col {
43 | display:flex;
44 | align-items:stretch;
45 | flex-direction: column;
46 | }
47 |
48 | .sw-section-title {
49 | font-size:20px;
50 | white-space:nowrap;
51 | overflow: hidden;
52 | text-overflow: ellipsis;
53 | }
54 |
55 |
56 | .sw-section-heading1 {
57 | font-size: 16px;
58 | font-weight:bold;
59 | margin: 20px 0 4px 0;
60 | }
61 |
62 | .sw-section-heading2 {
63 | font-size: 14px;
64 | font-weight:bold;
65 | margin: 16px 0 4px 0;
66 | }
67 |
68 | .sw-section-heading3 {
69 | font-size: 12px;
70 | font-weight:bold;
71 | margin: 12px 0 4px 0;
72 | }
73 |
74 | .sw-gray-text{
75 | vertical-align: middle;
76 | color: #999;
77 | }
78 |
79 | .sw-gray-small-text{
80 | font-size: 12px;
81 | line-height: 12px;
82 | vertical-align: middle;
83 | color: #999;
84 | }
85 |
86 | .sw-blue-small-text{
87 | font-size: 12px;
88 | line-height: 12px;
89 | vertical-align: middle;
90 | color: $sw-blue-text;;
91 | }
92 | .sw-blue-bold-small-text{
93 | font-size: 12px;
94 | font-weight:bold;
95 | line-height: 12px;
96 | vertical-align: middle;
97 | color: $sw-blue-text;;
98 | }
99 |
100 |
101 | .sw-border{
102 | border:1px solid $sw-border-color;
103 | border-radius: $sw-border-radius;
104 | }
105 | .sw-light-border{
106 | border:1px solid $sw-light-border-color;
107 | border-radius: $sw-border-radius;
108 | }
--------------------------------------------------------------------------------
/dist/css/chunk-53aeb0d8.972b1ce3.css:
--------------------------------------------------------------------------------
1 | .sw-tree{font-family:roboto-mono,Monaco,Menlo,Consolas;font-size:12px}.sw-tree .sw-tree-content{padding-left:1em;border-left:1px dotted #ccc}.sw-tree .sw-tree-bracket-left,.sw-tree .sw-tree-bracket-right{cursor:pointer;border:1px solid transparent;border-radius:3px;padding:0 20px 2px 0}.sw-tree .sw-tree-bracket-left:hover,.sw-tree .sw-tree-bracket-right:hover{color:#ff791a;background:#efefef;border:1px solid #ccc}.sw-tree .sw-datatype-null{color:#ed4337}.sw-tree .sw-datatype-bool,.sw-tree .sw-datatype-boolean,.sw-tree .sw-datatype-inte,.sw-tree .sw-datatype-numb,.sw-tree .sw-datatype-number{color:#47afe8}.sw-tree .sw-datatype-stri,.sw-tree .sw-datatype-string{color:#86b300}.sw-tree .sw-datatype-enum{color:#f90}.sw-tree .sw-content-block{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;width:100%}.sw-tree .sw-content-block .sw-content,.sw-tree .sw-content-block .sw-content-key{white-space:nowrap}.sw-tree .sw-content-block .sw-content.sw-datatype-enum{white-space:normal;padding-top:0;min-width:150px}.sw-tree .sw-content-block:hover{background:#efefef}.sw-tree .sw-descr{min-width:100px;white-space:nowrap;text-overflow:ellipsis;width:100%;display:inline-block;overflow:hidden;color:#999;text-align:right}.sw-tree .sw-descr.sw-descr-collapsed{white-space:nowrap}.sw-tree .sw-descr.sw-descr-expanded{white-space:normal}.sw-tree .sw-show-descr .sw-descr{display:block}.sw-tree .sw-hide-descr .sw-descr{display:none}.sw-tree .sw-descr-expanded+.sw-descr-expander{border-left:2px solid #ccc}.sw-tree .sw-descr-expander{padding:0 5px;margin-left:5px;cursor:pointer;color:orange}.sw-tree .sw-descr-expander:hover{color:#ff4500}.sw-param-req[data-v-949a757c]{color:#ff4500;font-size:16px;vertical-align:middle}.sw-param-name[data-v-949a757c]{font-family:monospace;margin:0;color:#333;text-align:right;line-height:12px}.sw-param-type[data-v-949a757c]{margin:0;color:#aaa;text-align:right;line-height:12px}.sw-param-type-title[data-v-cc7e0de4]{font-weight:700;margin-top:16px}.sw-datatype[data-v-cc7e0de4]{color:#aaa;display:inline-block;width:50px;margin-right:5px}.sw-fieldname[data-v-cc7e0de4]{display:inline-block}.sw-tree-node[data-v-cc7e0de4]{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:stretch;-ms-flex-pack:stretch;justify-content:stretch;width:100%}.sw-make-request[data-v-cc7e0de4]{padding:0;margin-top:8px}.sw-response-status[data-v-cc7e0de4]{margin-left:5px;font-size:12px;font-weight:700}.sw-response-status.sw-2xx[data-v-cc7e0de4]{color:#739900}.sw-response-status.sw-3xx[data-v-cc7e0de4],.sw-response-status.sw-4xx[data-v-cc7e0de4]{color:#c00}.sw-section-gap[data-v-cc7e0de4]{margin-top:24px}.sw-live-response[data-v-cc7e0de4]{max-height:400px;max-width:100%;overflow:scroll}
--------------------------------------------------------------------------------
/src/assets/styles/_typography.scss:
--------------------------------------------------------------------------------
1 | @import "~@/assets/styles/_vars.scss";
2 |
3 | //Light
4 | @font-face {
5 | font-family: 'Metropolis';
6 | src: url($font_path + 'Metropolis-Light.woff2')format('woff2') ;
7 | font-weight: 200;
8 | font-style: normal;
9 | }
10 |
11 | //Regular
12 | @font-face {
13 | font-family: 'Metropolis';
14 | src: url($font_path + 'Metropolis-Regular.woff2')format('woff2') ;
15 | font-weight: 400;
16 | font-style: normal;
17 | }
18 |
19 | //Semibold
20 | @font-face {
21 | font-family: 'Metropolis';
22 | src: url($font_path + 'Metropolis-Medium.woff2')format('woff2') ;
23 | font-weight: 500;
24 | font-style: normal;
25 | }
26 |
27 | //Bold
28 | @font-face {
29 | font-family: 'Metropolis';
30 | src: url($font_path + 'Metropolis-SemiBold.woff2')format('woff2') ;
31 | font-weight: 600;
32 | font-style: normal;
33 | }
34 |
35 | //Monospaced font
36 | //Regular
37 | @font-face {
38 | font-family: 'roboto-mono';
39 | src: url($font_path + 'roboto-mono-regular.woff2')format('woff2') ;
40 | font-weight: 400;
41 | font-style: normal;
42 | }
43 |
44 | @font-face {
45 | font-family: 'roboto-mono';
46 | src: url($font_path + 'roboto-mono-bold.woff2')format('woff2') ;
47 | font-weight: 500;
48 | font-style: normal;
49 | }
50 |
51 |
52 | h1{ font-family:$sw-font-family; font-size:26px; font-weight:200; letter-spacing:normal; }
53 | h2{ font-family:$sw-font-family; font-size:24px; font-weight:200; letter-spacing:normal; }
54 | h3{ font-family:$sw-font-family; font-size:22px; font-weight:200; letter-spacing:normal; }
55 | h4{ font-family:$sw-font-family; font-size:18px; font-weight:200; letter-spacing:normal; }
56 | h5{ font-family:$sw-font-family; font-size:16px; font-weight:200; letter-spacing:normal; }
57 | h6{ font-family:$sw-font-family; font-size:14px; font-weight:200; letter-spacing:normal; }
58 |
59 | h1,h2,h3,h4,h5,h5{
60 | margin-block-end: 0.2em;
61 | }
62 | p{margin-block-start: 0.5em;}
63 | code,
64 | pre{
65 | font-family: $sw-font-mono;
66 | }
67 |
68 | .sw-bold-small-text{
69 | font-size:12px;
70 | margin-bottom: 4px;
71 | font-weight:bold;
72 | }
73 |
74 |
75 | .sw-markdown-block{
76 | p:only-child{
77 | color:#999;
78 | font-size:12px;
79 | line-height:normal;
80 | margin-top:0;
81 | }
82 | p{
83 | line-height: 16px;
84 | }
85 | code{
86 | background-color: rgba(0, 0, 0, 0.02);
87 | padding: 0px 6px;
88 | border: 1px solid #eee;
89 | border-radius: 3px;
90 | color: #666;
91 | font-size: 12px;
92 | }
93 | pre{
94 | code {
95 | border:none;
96 | background-color:transparent;
97 | color:#ccc;
98 |
99 | }
100 | white-space: pre-wrap;
101 | background-color: #263238;
102 | color: white;
103 | padding: 12px 14px 15px 14px;
104 | overflow-x: auto;
105 | line-height: normal;
106 | border-radius: 2px;
107 | border: 1px solid rgba(38, 50, 56, 0.1);
108 | }
109 | ul,ol{
110 | padding-inline-start:30px
111 | }
112 | li{
113 | line-height: 1.2em;
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/src/assets/styles/_sw_form.scss:
--------------------------------------------------------------------------------
1 | @import "~@/assets/styles/_vars.scss";
2 |
3 | //Button
4 | .sw-btn{
5 | border-radius: $sw-border-radius;
6 | font-weight: 600;
7 | display: inline-block;
8 | padding: 6px 16px;
9 | font-size: 12px;
10 | outline: 0;
11 | line-height: 1;
12 | text-align: center;
13 | white-space: nowrap;
14 | border: 1px solid $sw-border-color;
15 | background-color:$sw-white;
16 | transition: background-color 0.2s;
17 | user-select: none;
18 | cursor: pointer;
19 | &.sw-large{
20 | padding:8px 14px;
21 | }
22 | &.sw-small{
23 | padding:5px 12px;
24 | }
25 | &.sw-circle{
26 | border-radius:50%;
27 | }
28 |
29 | &.sw-primary{
30 | background-color:$sw-primary-color;
31 | border-color:darken($sw-primary-color,2%);
32 | color:#fff;
33 | &:hover{
34 | background-color:darken( $sw-primary-color, 8% );
35 | }
36 | }
37 |
38 | &.sw-plain{
39 | background-color:#fff;
40 | border-color:#333;
41 | color:#333;
42 | &:hover{
43 | border-color:$sw-primary-color;
44 | }
45 | }
46 |
47 | }
48 |
49 | // Form Inputs
50 | textarea,
51 | input[type="text"]:not(.el-input__inner),
52 | input[type="password"]:not(.el-input__inner){
53 | border-radius:$sw-border-radius;
54 | border:1px solid #C5D9E8;
55 | transition: border .2s;
56 | outline: none;
57 | font-size:$--input-font-size;
58 | height:$--input-height;
59 | padding: 0 5px;
60 | box-sizing: border-box;
61 | &::placeholder { color: #ccc;}
62 | &:-ms-input-placeholder {color: #ccc;}
63 | &::-ms-input-placeholder {color: #ccc;}
64 |
65 | &.sw-medium{
66 | font-size:$--input-medium-font-size;
67 | height:$--input-medium-height;
68 | }
69 | &.sw-small{
70 | font-size:$--input-small-font-size;
71 | height:$--input-small-height;
72 | }
73 |
74 | &.sw-primary{
75 | border-color:$sw-primary-color;
76 | }
77 |
78 |
79 | &.sw-dark{
80 | border-color: darken($sw-primary-color,15%);
81 | background-color:#222;
82 | color:#fff;
83 | font-size:13px;
84 | &::placeholder { color: #555;}
85 | &:-ms-input-placeholder {color: #555;}
86 | &::-ms-input-placeholder {color: #555;}
87 | &:disabled{
88 | border-color:#444;
89 | background-color:#2A2A2A;
90 | }
91 | }
92 | &:focus,
93 | &:active{
94 | border-color:$sw-primary-color;
95 | }
96 | &:disabled{
97 | border-color:lifghten($sw-border-color,10%);
98 | background-color:rbga(0,0,0, 0.2);
99 | }
100 | }
101 |
102 | textarea{
103 | &::-webkit-scrollbar-track{
104 | background-color: transparent;
105 | }
106 |
107 | &::-webkit-scrollbar{
108 | width: 8px;
109 | height: 8px;
110 | background-color: transparent;
111 | }
112 |
113 | &::-webkit-scrollbar-thumb{
114 | background-color: rgba(50,50,50, .5);
115 | }
116 |
117 |
118 | }
119 |
120 |
121 | //Radio
122 | .sw-radio {
123 | display: none;
124 | & + label {
125 | -webkit-appearance: none;
126 | background-color:$sw-primary-color;
127 | border: 4px solid $sw-primary-color;
128 | border-radius: 10px;
129 | width: 100%;
130 | display: inline-block;
131 | position: relative;
132 | width: 10px;
133 | height: 10px;
134 | }
135 | }
136 |
137 | .regular-radio:checked + label {
138 | background: $sw-dark-bg1;
139 | border: 4px solid $sw-primary-color;
140 | }
141 |
--------------------------------------------------------------------------------
/src/components/ParameterInputs.vue:
--------------------------------------------------------------------------------
1 |
2 | |
9 | *{{param.name}}
10 |
11 | |
12 |
13 |
14 |
15 |
16 |
17 | |
43 |
44 |
45 |
46 |
47 |
48 |
49 | {{ param.schema.pattern? "Pattern: " + param.schema.pattern : "" }}
50 |
51 |
52 | |
53 |
| Type | 8 |Authentication Procedure | 9 |||||
|---|---|---|---|---|---|
|
12 | {{scheme.type}} {{scheme.scheme?scheme.scheme:""}}
13 |
14 | |
15 |
16 |
17 |
18 | If Activated, all requests will send '{{scheme.name}}' in '{{scheme.in}}' with the given value
19 |
20 |
21 |
22 |
23 | |
24 |
25 |
26 |
27 | If Activated, all requests will send 'Authorization'
28 | header that contains the word 'Basic' followed by a space and a base64-encoded string username:password.
29 |
30 |
31 |
32 |
33 |
34 | |
35 |
36 | If Activated, all requests will send 'Authorization'
37 | header that contains the word 'Bearer' followed by a space and a Token String.
38 |
39 |
40 |
41 |
43 | Once activated, this token will be sent in 'Authorization' header of every request
42 | |
44 |
45 |
46 |
47 | Auth URL:
48 | {{flow.authorizationUrl}} Token URL:
49 | {{flow.tokenUrl}} Refresh URL:
50 |
51 | Scopes:
52 | {{flow.refreshUrl}}
53 | {{scopeName}},
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | Directions: Register this client with
62 | {{ getOAuthBaseUrl(flow.authorizationUrl) }}
|
68 | 69 | {{ scheme.type }} 70 | | 71 |
n)return NaN;return parseInt(c,r)}}return+e};if(!m(" 0o1")||!m("0b1")||m("+0x1")){m=function(t){var e=arguments.length<1?0:t,a=this;return a instanceof m&&(v?c(function(){y.valueOf.call(a)}):s(a)!=f)?i(new h(g(e)),a,m):g(e)};for(var w,_=a("9e1e")?l(h):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),x=0;_.length>x;x++)n(h,w=_[x])&&!n(m,w)&&u(m,w,p(h,w));m.prototype=y,y.constructor=m,a("2aba")(r,f,m)}},f1ac:function(t,e,a){"use strict";var r=a("07a6"),n=a.n(r);n.a},f410:function(t,e,a){a("1af6"),t.exports=a("584a").Array.isArray},fdef:function(t,e){t.exports="\t\n\v\f\r \u2028\u2029\ufeff"}}]);
2 | //# sourceMappingURL=chunk-2f70627e-legacy.3eab5b78.js.map
--------------------------------------------------------------------------------
/dist/js/chunk-da3973d8.709e0552.js:
--------------------------------------------------------------------------------
1 | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-da3973d8"],{"004a":function(e,t,a){"use strict";var s=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{class:"sw-tree "+(e.showDescr?"sw-show-descr":"sw-hide-descr")+" sw-format-"+e.displayFormat,style:{"background-color":e.treeContentBackground,position:e.currentDeep>1?"":"relative"},on:{click:function(t){return t.stopPropagation(),e.handleClick(t)}}},[Array.isArray(e.data)||e.isObject(e.data)?[a("bracket-left",{attrs:{visible:e.visible,data:e.data,"show-length":e.showLength,"not-last-key":e.notLastKey},on:{"update:visible":function(t){e.visible=t}}},[e.currentDeep>1&&!Array.isArray(e.parentData)?a("span",[e._v(e._s(e.currentKey)+":")]):e._e()]),e._l(e.data,function(t,s){return a("div",{directives:[{name:"show",rawName:"v-show",value:e.visible,expression:"visible"}],key:s,staticClass:"sw-tree-content"},[a("json-tree",{attrs:{"parent-data":e.data,data:t,deep:e.deep,"show-length":e.showLength,path:e.path+(Array.isArray(e.data)?"["+s+"]":"."+s),"allow-interaction":e.allowInteraction,"current-key":s,"display-format":e.displayFormat,"current-deep":e.currentDeep+1},on:{click:e.handleItemClick}})],1)}),a("bracket-right",{attrs:{visible:e.visible,data:e.data,"not-last-key":e.notLastKey},on:{"update:visible":function(t){e.visible=t}}})]:a("content-block",{attrs:{parentDataType:e.getDataType(e.parentData),dataType:e.getDataType(e.data),text:e.data+"",notLastKey:e.notLastKey,displayFormat:e.displayFormat,currentKey:e.currentKey}})],2)},r=[],n=(a("6b54"),a("ac6a"),function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"sw-content-block"},["object"===e.parentDataType?a("div",{staticClass:"sw-content-key"},[e._v(e._s(e.currentKey)+":")]):e._e(),a("div",{class:"sw-content sw-datatype-"+("json"===e.displayFormat?e.dataType:e.text.substring(0,4))},[e._v(e._s(e.getText()))]),a("div",{staticStyle:{flex:"1","min-width":"15px"}}),a("div",{ref:"descrDiv",class:"sw-descr "+e.descrClass},[e._v("\n "+e._s(e.description)+" \n ")]),e.description?a("span",{staticClass:"sw-descr-expander",on:{click:function(t){return e.handleItemToggleDescr()}}},[e._v(" \n "+e._s("sw-descr-collapsed"===e.descrClass?"⤵":"⤴")+"\n ")]):e._e()])}),i=[],l=(a("28a5"),{props:{parentDataType:String,dataType:String,text:String,notLastKey:Boolean,currentKey:[Number,String],displayFormat:{type:String,default:"json"}},data(){return{description:this.getDescription(),descrClass:"sw-descr-collapsed",showDescrExpander:!0}},methods:{getText(){if("text"===this.displayFormat)return this.text.split("~|~")[0];let e=this.text;return"string"===this.dataType&&(e=`"${e}"`),this.notLastKey&&(e+=","),e},getDescription(){if("text"===this.displayFormat){let e=this.text.split("~|~");return e[1]?e[1]:""}return""},handleItemToggleDescr(){"sw-descr-collapsed"===this.descrClass?this.descrClass="sw-descr-expanded":this.descrClass="sw-descr-collapsed",this.$emit("toggleDescription")}}}),o=l,c=a("2877"),p=Object(c["a"])(o,n,i,!1,null,null,null),u=p.exports,m=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[e._t("default"),a("span",{directives:[{name:"show",rawName:"v-show",value:e.dataVisiable,expression:"dataVisiable"}],staticClass:"sw-tree-bracket-left",on:{click:function(t){return t.stopPropagation(),e.toggleBrackets(t)}}},[e._v("\n "+e._s(Array.isArray(e.data)?"[":"{")+"\n ")]),a("span",{directives:[{name:"show",rawName:"v-show",value:!e.dataVisiable,expression:"!dataVisiable"}],staticClass:"sw-tree-bracket-left",on:{click:function(t){return t.stopPropagation(),e.toggleBrackets(t)}}},[e._v("\n "+e._s(e.doubleBracketsGenerator(e.data))+"\n ")])],2)},d=[],h={props:{visible:{required:!0,type:Boolean},data:{required:!0},notLastKey:Boolean},computed:{dataVisiable:{get(){return this.visible},set(e){this.$emit("update:visible",e)}}},methods:{toggleBrackets(){this.dataVisiable=!this.dataVisiable},bracketsFormatter(e){return this.notLastKey?`${e},`:e}}},y={mixins:[h],props:{showLength:Boolean},methods:{doubleBracketsGenerator(e){const t=Array.isArray(e);let a=t?"[...]":"{...}";if(this.showLength){const s=t?`${e.length} items`:`${Object.keys(e).length} keys`;a+=` // ${s}`}return this.bracketsFormatter(a)}}},v=y,b=Object(c["a"])(v,m,d,!1,null,null,null),f=b.exports,w=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{directives:[{name:"show",rawName:"v-show",value:e.dataVisiable,expression:"dataVisiable"}]},[a("span",{staticClass:"sw-tree-bracket-right",on:{click:function(t){return t.stopPropagation(),e.toggleBrackets(t)}}},[e._v("\n "+e._s(e.bracketsFormatter(Array.isArray(e.data)?"]":"}"))+"\n ")])])},g=[],x={mixins:[h]},S=x,_=Object(c["a"])(S,w,g,!1,null,null,null),k=_.exports,C={name:"json-tree",components:{ContentBlock:u,BracketLeft:f,BracketRight:k},props:{data:{},deep:{type:Number,default:1/0},showLength:{type:Boolean,default:!1},path:{type:String,default:"root"},allowInteraction:{type:Boolean,default:!0},parentData:{},currentDeep:{type:Number,default:1},currentKey:[Number,String],displayFormat:{type:String,default:"json"}},data(){return{visible:this.currentDeep<=this.deep,treeContentBackground:"transparent",showDescr:!0}},computed:{lastKey(){if(Array.isArray(this.parentData))return this.parentData.length-1;if(this.isObject(this.parentData)){let e=Object.keys(this.parentData);return e[e.length-1]}},notLastKey(){return this.currentKey!==this.lastKey}},methods:{handleClick(e){this.allowInteraction&&this.$emit("click",this.path,this.data)},handleItemClick(e,t){this.$emit("click",e,t)},isObject(e){return"object"===this.getDataType(e)},getDataType(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}},watch:{deep(e){this.visible=this.currentDeep<=e}}},E=C,F=(a("f1ac"),Object(c["a"])(E,s,r,!1,null,null,null));t["a"]=F.exports},"07a6":function(e,t,a){},"0ccf":function(e,t,a){},"1bbf":function(e,t,a){"use strict";a.r(t);var s=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[e._m(0),e._l(e.responsesLocalCopy,function(t,s){return a("div",{key:s,staticClass:"sw-response-status"},[a("div",{staticClass:"sw-row"},[a("div",[a("span",{staticClass:"sw-section-heading2"},[e._v(" "+e._s(s)+" ")]),a("span",{staticClass:"sw-small-text"},[e._v(" : "+e._s(t.description)+" ")])]),a("div",{staticStyle:{flex:"1"}}),a("div",{staticStyle:{position:"relative",top:"25px","min-width":"160px","z-index":"1",display:"flex"}},[1==e.mimeRespCountForEachStatus[s]?a("span",{staticClass:"sw-section-heading",staticStyle:{"line-height":"26px"}},[e._v(" \n "+e._s(e.selectedMimeValueForEachStatus[s])+"\n ")]):e.mimeRespCountForEachStatus[s]>1?a("el-select",{attrs:{size:"medium","popper-class":"sw-small-height-options"},model:{value:e.selectedMimeValueForEachStatus[s],callback:function(t){e.$set(e.selectedMimeValueForEachStatus,s,t)},expression:"selectedMimeValueForEachStatus[statusRespCode]"}},e._l(e.mimeResponsesForEachStatus[s],function(e,t){return a("el-option",{key:t,attrs:{label:t,value:t}})}),1):e._e()],1)]),t.content?a("div",{staticClass:"sw-row"},[a("el-tabs",{staticStyle:{flex:"1",overflow:"hidden"},model:{value:e.activeTabForEachRespStatus[s],callback:function(t){e.$set(e.activeTabForEachRespStatus,s,t)},expression:"activeTabForEachRespStatus[statusRespCode]"}},[a("el-tab-pane",{staticClass:"sw-tab-pane",attrs:{label:"Example",name:"exampleTab"}},[e.selectedMimeValueForEachStatus[s]&&"json"===e.mimeResponsesForEachStatus[s][e.selectedMimeValueForEachStatus[s]].examples[0].exampleType?a("json-tree",{attrs:{path:"/",data:e.mimeResponsesForEachStatus[s][e.selectedMimeValueForEachStatus[s]].examples[0].exampleValue},on:{click:e.showPath}}):e.selectedMimeValueForEachStatus[s]?a("textarea",{directives:[{name:"model",rawName:"v-model",value:e.mimeResponsesForEachStatus[s][e.selectedMimeValueForEachStatus[s]].examples[0].exampleValue,expression:"mimeResponsesForEachStatus[statusRespCode][selectedMimeValueForEachStatus[statusRespCode]].examples[0].exampleValue"}],staticClass:"sw-mono-font",staticStyle:{"min-height":"150px"},domProps:{value:e.mimeResponsesForEachStatus[s][e.selectedMimeValueForEachStatus[s]].examples[0].exampleValue},on:{input:function(t){t.target.composing||e.$set(e.mimeResponsesForEachStatus[s][e.selectedMimeValueForEachStatus[s]].examples[0],"exampleValue",t.target.value)}}}):e._e()],1),a("el-tab-pane",{staticClass:"sw-tab-pane",attrs:{label:"Model",name:"schemaTab"}},[e.selectedMimeValueForEachStatus[s]&&e.mimeResponsesForEachStatus[s][e.selectedMimeValueForEachStatus[s]].schemaTree?a("json-tree",{attrs:{path:"/",data:e.mimeResponsesForEachStatus[s][e.selectedMimeValueForEachStatus[s]].schemaTree,"display-format":"text"}}):e._e()],1)],1)],1):e._e(),t.headers?a("div",[a("div",{staticClass:"sw-section-heading3 sw-gray-text"},[e._v(" Response Headers")]),a("parameter-inputs",{attrs:{parameters:e.headersForEachRespStatus[s],showInputs:!1}})],1):e._e()])})],2)},r=[function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"sw-section-heading1",staticStyle:{display:"flex","align-items":"center"}},[a("i",{staticClass:"el-icon-download",staticStyle:{"font-sixe":"16px"}}),a("div",{staticStyle:{"margin-left":"5px"}},[e._v("RESPONSE")])])}];function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e){for(var t=1;t
";
102 | if (schema.format){
103 | html = html + ` ${lineBreak} (${schema.format})`;
104 | }
105 | if (schema.pattern && !schema.enum){
106 | html = html + ` ${lineBreak}(${schema.pattern})`;
107 | }
108 | return html;
109 | }
110 |
111 |
112 | /* For changing JSON-Schema to a Object Model that can be represnted in a tree-view */
113 | function schemaToModel (schema, obj) {
114 | if (schema==null){
115 | return;
116 | }
117 | if (schema.type==="object" || schema.properties){
118 | for( let key in schema.properties ){
119 | obj[key] = schemaToModel(schema.properties[key],{});
120 | }
121 | }
122 | else if (schema.type==="array" || schema.items ){
123 | //let temp = Object.assign({}, schema.items );
124 | obj = [schemaToModel(schema.items,{}) ]
125 | }
126 | else if (schema.allOf ){
127 | if (schema.allOf.length===1){
128 | if (!schema.allOf[0]){
129 | return `string~|~${schema.description?schema.description:''}`;
130 | }
131 | else{
132 | let overrideAttrib = {
133 | "readOnly":schema.readOnly,
134 | "writeOnly":schema.writeOnly,
135 | "depricated":schema.deprecated
136 | };
137 | return `${ getTypeInfo(schema.allOf[0],overrideAttrib) }~|~${schema.description?schema.description:''}`
138 | }
139 | }
140 |
141 | // If allOf is an array of multiple elements, then they are the keys of an object
142 | let objWithAllProps = {};
143 | schema.allOf.map(function(v){
144 | if (v && v.properties){
145 | let partialObj = schemaToModel(v,{});
146 | Object.assign(objWithAllProps, partialObj);
147 | }
148 | });
149 | obj = objWithAllProps;
150 | }
151 | else{
152 | return `${getTypeInfo(schema)}~|~${schema.description?schema.description:''}`;
153 | }
154 | return obj;
155 | }
156 |
157 |
158 |
159 |
160 | /* Create Example object */
161 | function generateExample(examples, example, schema, mimeType, outputType){
162 | let finalExamples = [];
163 | if (examples){
164 | for (let eg in examples){
165 | let egJson="";
166 | //TODO: in case the mimeType is XML then parse it as XML
167 | //egJson = JSON.parse(examples[eg].value);
168 | finalExamples.push({
169 | "exampleType" : "json",
170 | "exampleValue": outputType==="text"?JSON.stringify(examples[eg].value,undefined,2):examples[eg].value
171 | });
172 | }
173 | }
174 | else if (example){
175 | //TODO: in case the mimeType is XML then parse it as XML
176 | finalExamples.push({
177 | "exampleType" : "json",
178 | "exampleValue": outputType==="text"?JSON.stringify(example,undefined,2):example
179 | });
180 | }
181 |
182 | if (finalExamples.length==0 ){
183 | // If schema examples are not provided then generate one from Schema (only JSON fomat)
184 | if (schema){
185 | //TODO: in case the mimeType is XML then parse it as XML
186 | let egJson = schemaToObj(schema,{}, {includeReadOnly:true, includeWriteOnly:true, deprecated:true});
187 | finalExamples.push({
188 | "exampleType" : "json",
189 | "exampleValue": outputType==="text"?JSON.stringify(egJson,undefined,2):egJson
190 | });
191 | }
192 | else{
193 | // No Example or Schema provided
194 | finalExamples.push({
195 | "exampleType" : "text",
196 | "exampleValue": ""
197 | });
198 | }
199 | }
200 | return finalExamples;
201 | }
202 |
203 | /* For changing JSON-Schema to a Sample Object, as per the schema */
204 | function schemaToObj (schema, obj, config={}) {
205 | if (schema==null){
206 | return;
207 | }
208 | if (schema.type==="object" || schema.properties){
209 | for( let key in schema.properties ){
210 | if ( schema.properties[key].deprecated ) {
211 | continue;
212 | }
213 | if ( schema.properties[key].readOnly && !config.includeReadOnly ) {
214 | continue;
215 | }
216 | if ( schema.properties[key].writeOnly && !config.includeWriteOnly ) {
217 | continue;
218 | }
219 | //let temp = Object.assign({}, schema.properties[key] );
220 | obj[key] = schemaToObj(schema.properties[key],{}, config);
221 | }
222 | }
223 | else if (schema.type==="array" || schema.items ){
224 | //let temp = Object.assign({}, schema.items );
225 | obj = [schemaToObj(schema.items,{}, config) ]
226 | }
227 | else if (schema.allOf ){
228 |
229 | if (schema.allOf.length===1){
230 | if (!schema.allOf[0]){
231 | return "string";
232 | }
233 | else{
234 | return getSampleValueByType(schema.allOf[0]);
235 | }
236 | }
237 | let objWithAllProps = {};
238 | schema.allOf.map(function(v){
239 | if (v && v.type){
240 | let partialObj = schemaToObj(v,{}, config);
241 | Object.assign(objWithAllProps, partialObj);
242 | }
243 | });
244 | obj = objWithAllProps;
245 | }
246 | else{
247 | return getSampleValueByType(schema);
248 | }
249 | return obj;
250 | }
251 |
252 | function getSampleValueByType(schemaObj) {
253 | if (schemaObj.example) {
254 | return schemaObj.example;
255 | }
256 |
257 | if (Object.keys(schemaObj).length === 0) {
258 | return null;
259 | }
260 |
261 | const typeValue = schemaObj.format || schemaObj.type || (schemaObj.enum ? 'enum' : null);
262 | switch (typeValue) {
263 | case 'int32':
264 | case 'int64':
265 | case 'integer':
266 | return 0;
267 | case 'float':
268 | case 'double':
269 | case 'number':
270 | return 0.5;
271 | case 'string':
272 | return (schemaObj.enum ? schemaObj.enum[0] : (schemaObj.pattern ? schemaObj.pattern : "string"))
273 | case 'byte':
274 | return btoa('string');
275 | case 'binary':
276 | return 'binary';
277 | case 'boolean':
278 | return false;
279 | case 'date':
280 | return (new Date(0)).toISOString().split('T')[0];
281 | case 'date-time':
282 | return (new Date(0)).toISOString();
283 | case 'dateTime':
284 | return (new Date(0)).toISOString();
285 | case 'password':
286 | return 'password';
287 | case 'enum':
288 | return schemaObj.enum[0];
289 | case 'uri':
290 | return 'http://example.com';
291 | case 'uuid':
292 | return '3fa85f64-5717-4562-b3fc-2c963f66afa6';
293 | case 'email':
294 | return 'user@example.com';
295 | case 'hostname':
296 | return 'example.com';
297 | case 'ipv4':
298 | return '198.51.100.42';
299 | case 'ipv6':
300 | return '2001:0db8:5b96:0000:0000:426f:8e17:642a';
301 | case 'circular':
302 | return 'CIRCULAR REF';
303 | default:
304 | if (schemaObj.nullable) {
305 | return null;
306 | }
307 | else {
308 | console.warn('Unknown schema value', schemaObj);
309 | return '?';
310 | }
311 | }
312 | }
313 |
314 | function schemaToElTree(schema, obj, name) {
315 | if (schema.type==="object" || schema.properties){
316 | for( let key in schema.properties ){
317 | let temp = Object.assign({}, schema.properties[key] );
318 | if (schema.properties[key].type==="object" || schema.properties[key].properties){
319 | obj.push({
320 | "label": {label:key , type:schema.properties[key].type, descr:schema.properties[key].description},
321 | "children": schemaToElTree(temp, [], key)
322 | });
323 | }
324 | else if (schema.properties[key].type==="array" || schema.properties[key].items){
325 | let typeOfArr="";
326 | if (schema.properties[key].items.properties){
327 | typeOfArr = "array of objects";
328 | }
329 | else {
330 | typeOfArr = "array of " + schema.properties[key].items.type;
331 | }
332 | obj.push({
333 | "label" : {label:"[ "+key+" ]", type:typeOfArr, descr:schema.properties[key].description},
334 | "children": schemaToElTree(temp, [], key)
335 | });
336 | }
337 | else{
338 | let typeOfField="";
339 | if (schema.properties[key].enum){
340 | typeOfField = "Enum: " + schema.properties[key].enum.join(" | ");
341 | }
342 | else{
343 | typeOfField = schema.properties[key].type;
344 | }
345 | obj.push({
346 | "label": {label:key, type:typeOfField, descr:schema.properties[key].description},
347 | });
348 | }
349 | }
350 | }
351 | else if (schema.type==="array"){
352 | if (schema.items.type==="object" || schema.items.properties){
353 | let temp = Object.assign({}, schema.items);
354 | return schemaToElTree(temp, []);
355 | }
356 | else if (schema.items.type==="array"){
357 | obj.push({
358 | "label": {label:"[ "+schema.items.type+" ]", type:schema.items.type, descr:schema.items.description }
359 | });
360 | }
361 | else{
362 | return;
363 | /*
364 | obj.push({
365 | "label": {label:"["+schema.items.type+" ]", type:schema.items.type, descr:schema.items.description}
366 | });
367 | */
368 | }
369 | }
370 | else{
371 | obj.push({
372 | "label" : {label:name, type:schema.type, descr:schema.description}
373 | });
374 | }
375 | return obj;
376 | }
377 |
378 | function getBaseUrlFromUrl(url){
379 | let pathArray = url.split( '/' );
380 | return pathArray[0] + "//" + pathArray[2];
381 | }
382 |
383 | function removeCircularReferences(level=0) {
384 | const seen = new WeakSet();
385 | return (key, value) => {
386 | if (typeof value === "object" && value !== null) {
387 | if (seen.has(value)) {
388 | //let dupVal = Object.assign({}, value);
389 | //return;
390 | if (level > 0){
391 | return {};
392 | }
393 | else{
394 | let dupVal = JSON.parse(JSON.stringify(value, removeCircularReferences(level+1)));
395 | seen.add(dupVal);
396 | return dupVal;
397 | }
398 |
399 | }
400 | seen.add(value);
401 | }
402 | return value;
403 | };
404 | };
405 |
406 |
407 | export { debounce, schemaToModel, schemaToObj, schemaToElTree, generateExample, getTypeInfo, getBaseUrlFromUrl, removeCircularReferences }
408 |
--------------------------------------------------------------------------------
/dist/js/chunk-45efbef8-legacy.87a975ea.js:
--------------------------------------------------------------------------------
1 | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-45efbef8"],{"044b":function(e,t){function s(e){return!!e.constructor&&"function"===typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function n(e){return"function"===typeof e.readFloatLE&&"function"===typeof e.slice&&s(e.slice(0,0))}
2 | /*!
3 | * Determine if an object is a Buffer
4 | *
5 | * @author Feross Aboukhadijeh