@omnifyjp/ts 2.1.9 → 2.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/php/type-mapper.js +7 -0
- package/package.json +1 -1
package/dist/php/type-mapper.js
CHANGED
|
@@ -224,6 +224,13 @@ function mergeValidationRules(rules, vr, type) {
|
|
|
224
224
|
const [a, b] = vr['digitsBetween'];
|
|
225
225
|
rules.push(`digits_between:${a},${b}`);
|
|
226
226
|
}
|
|
227
|
+
// Remove max:{length} when numeric rules are present — Laravel interprets
|
|
228
|
+
// max as numeric comparison instead of string length when numeric/digits present
|
|
229
|
+
if (vr['numeric'] === true || vr['digits'] != null || vr['digitsBetween'] != null) {
|
|
230
|
+
const maxIdx = rules.findIndex(r => typeof r === 'string' && r.startsWith('max:'));
|
|
231
|
+
if (maxIdx !== -1)
|
|
232
|
+
rules.splice(maxIdx, 1);
|
|
233
|
+
}
|
|
227
234
|
if (vr['startsWith'] != null) {
|
|
228
235
|
const v = vr['startsWith'];
|
|
229
236
|
rules.push(`starts_with:${Array.isArray(v) ? v.join(',') : v}`);
|