@@ -27,7 +27,7 @@ export function copyToClipboard(elId) {
27
27
}
28
28
29
29
/* Generates an schema object containing type and constraint info */
30
- export function getTypeInfo ( schema , overrideAttributes = null ) {
30
+ export function getTypeInfo ( schema ) {
31
31
if ( ! schema ) {
32
32
return ;
33
33
}
@@ -77,9 +77,9 @@ export function getTypeInfo(schema, overrideAttributes = null) {
77
77
if ( schema . minimum !== undefined && schema . maximum !== undefined ) {
78
78
returnObj . constrain = `${ schema . exclusiveMinimum ? '>' : '' } ${ schema . minimum } \u00a0\u22ef\u00a0${ schema . exclusiveMaximum ? '<' : '' } \u00a0${ schema . maximum } ` ;
79
79
} else if ( schema . minimum !== undefined && schema . maximum === undefined ) {
80
- returnObj . constrain = `${ schema . exclusiveMinimum ? '>' : 'β₯ ' } ${ schema . minimum } ` ;
80
+ returnObj . constrain = `${ schema . exclusiveMinimum ? '>' : '>= ' } ${ schema . minimum } ` ;
81
81
} else if ( schema . minimum === undefined && schema . maximum !== undefined ) {
82
- returnObj . constrain = `${ schema . exclusiveMaximum ? '<' : 'β€ ' } ${ schema . maximum } ` ;
82
+ returnObj . constrain = `${ schema . exclusiveMaximum ? '<' : '<= ' } ${ schema . maximum } ` ;
83
83
}
84
84
if ( schema . multipleOf !== undefined ) {
85
85
returnObj . constrain = `(multiple of ${ schema . multipleOf } )` ;
@@ -88,36 +88,25 @@ export function getTypeInfo(schema, overrideAttributes = null) {
88
88
if ( schema . minLength !== undefined && schema . maxLength !== undefined ) {
89
89
returnObj . constrain = `(${ schema . minLength } to ${ schema . maxLength } chars)` ;
90
90
} else if ( schema . minLength !== undefined && schema . maxLength === undefined ) {
91
- returnObj . constrain = `β₯ ${ schema . minLength } chars` ;
91
+ returnObj . constrain = `min ${ schema . minLength } chars` ;
92
92
} else if ( schema . minLength === undefined && schema . maxLength !== undefined ) {
93
- returnObj . constrain = `β€${ schema . maxLength } chars` ;
94
- }
95
- }
96
-
97
- if ( overrideAttributes ) {
98
- if ( overrideAttributes . readOnly ) {
99
- returnObj . readOnly = 'π' ;
100
- }
101
- if ( overrideAttributes . writeOnly ) {
102
- returnObj . writeOnly = 'π' ;
103
- }
104
- if ( overrideAttributes . deprecated ) {
105
- returnObj . deprecated = 'β' ;
93
+ returnObj . constrain = `max ${ schema . maxLength } chars` ;
106
94
}
107
95
}
108
96
109
97
// ${returnObj.readOnly}${returnObj.writeOnly}${returnObj.deprecated}\u00a0
110
98
let html = `${ returnObj . format ? returnObj . format : returnObj . type } ` ;
99
+ let readWriteConstraints = '' ;
111
100
if ( returnObj . readOnly ) {
112
- html += ' π' ;
101
+ readWriteConstraints += 'π' ;
113
102
}
114
103
if ( returnObj . writeOnly ) {
115
- html += ' π' ;
104
+ readWriteConstraints += 'π' ;
116
105
}
117
106
if ( returnObj . deprecated ) {
118
- html += ' β' ;
107
+ readWriteConstraints += 'β' ;
119
108
}
120
- html += `~|~${ returnObj . constrain } ~|~${ ( returnObj . type === 'enum' ? returnObj . allowedValues : returnObj . pattern ) } ~|~${ returnObj . description } ` ;
109
+ html += `~|~${ readWriteConstraints } ${ returnObj . constrain } ~|~${ ( returnObj . type === 'enum' ? returnObj . allowedValues : returnObj . pattern ) } ~|~${ returnObj . description } ` ;
121
110
returnObj . html = html ;
122
111
return returnObj ;
123
112
}
0 commit comments