File tree 1 file changed +4
-4
lines changed
src/core/plugins/json-schema-2020-12-samples/fn/types
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ const stringType = (schema, { sample } = {}) => {
126
126
let generatedString
127
127
128
128
if ( typeof pattern === "string" ) {
129
- generatedString = randexp ( pattern )
129
+ generatedString = applyStringConstraints ( randexp ( pattern ) , schema )
130
130
} else if ( typeof format === "string" ) {
131
131
generatedString = generateFormat ( schema )
132
132
} else if (
@@ -137,18 +137,18 @@ const stringType = (schema, { sample } = {}) => {
137
137
if ( Array . isArray ( sample ) || typeof sample === "object" ) {
138
138
generatedString = JSON . stringify ( sample )
139
139
} else {
140
- generatedString = String ( sample )
140
+ generatedString = applyStringConstraints ( String ( sample ) , schema )
141
141
}
142
142
} else if ( typeof contentMediaType === "string" ) {
143
143
const mediaTypeGenerator = mediaTypeAPI ( contentMediaType )
144
144
if ( typeof mediaTypeGenerator === "function" ) {
145
145
generatedString = mediaTypeGenerator ( schema )
146
146
}
147
147
} else {
148
- generatedString = randomString ( )
148
+ generatedString = applyStringConstraints ( randomString ( ) , schema )
149
149
}
150
150
151
- return encode ( applyStringConstraints ( generatedString , schema ) )
151
+ return encode ( generatedString )
152
152
}
153
153
154
154
export default stringType
You can’t perform that action at this time.
0 commit comments