@famgia/omnify-core 0.0.21 → 0.0.23
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/index.cjs +23 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2327,7 +2327,7 @@ function validateUnknownFieldsDetailed(propertyName, property, filePath, customT
|
|
|
2327
2327
|
)
|
|
2328
2328
|
);
|
|
2329
2329
|
} else {
|
|
2330
|
-
|
|
2330
|
+
errors.push(
|
|
2331
2331
|
validationError(
|
|
2332
2332
|
`Property '${propertyName}' has unknown field '${field}'`,
|
|
2333
2333
|
buildLocation7(filePath),
|
|
@@ -2340,16 +2340,17 @@ function validateUnknownFieldsDetailed(propertyName, property, filePath, customT
|
|
|
2340
2340
|
}
|
|
2341
2341
|
function getSuggestionForUnknownField(field) {
|
|
2342
2342
|
if (field === "required") {
|
|
2343
|
-
return `'required' is not a valid field.
|
|
2344
|
-
|
|
2343
|
+
return `'required' is not a valid field. This validation feature is not yet implemented.
|
|
2344
|
+
Properties are NOT nullable by default in the database.
|
|
2345
|
+
Use 'nullable: true' to make a field optional in the database.`;
|
|
2346
|
+
}
|
|
2347
|
+
if (field === "maxLength" || field === "minLength") {
|
|
2348
|
+
return `'${field}' is not a valid field. Use 'length' for database column size.
|
|
2349
|
+
Validation rules (minLength, maxLength, pattern, etc.) are not yet implemented.
|
|
2345
2350
|
Example:
|
|
2346
|
-
|
|
2351
|
+
name:
|
|
2347
2352
|
type: String
|
|
2348
|
-
#
|
|
2349
|
-
|
|
2350
|
-
phone:
|
|
2351
|
-
type: String
|
|
2352
|
-
nullable: true # optional field`;
|
|
2353
|
+
length: 255 # Database column size`;
|
|
2353
2354
|
}
|
|
2354
2355
|
if (field === "hidden") {
|
|
2355
2356
|
return `'hidden' is not a standard field. For Laravel, hidden fields are configured in the Model class.`;
|
|
@@ -2364,7 +2365,7 @@ Example:
|
|
|
2364
2365
|
target: User
|
|
2365
2366
|
# Creates author_id column automatically`;
|
|
2366
2367
|
}
|
|
2367
|
-
return `Valid property fields: type, displayName, nullable, default, unique, description, length, unsigned, precision, scale, enum, relation, target, onDelete, onUpdate, joinTable`;
|
|
2368
|
+
return `Unknown field '${field}'. Valid property fields: type, displayName, nullable, default, unique, description, length, unsigned, precision, scale, enum, relation, target, onDelete, onUpdate, joinTable`;
|
|
2368
2369
|
}
|
|
2369
2370
|
function validatePropertyType(propertyName, property, filePath, customTypes = []) {
|
|
2370
2371
|
const errors = [];
|
|
@@ -2707,6 +2708,18 @@ function validateSchema(schema, options = {}) {
|
|
|
2707
2708
|
}
|
|
2708
2709
|
if (schema.properties) {
|
|
2709
2710
|
for (const [name, property] of Object.entries(schema.properties)) {
|
|
2711
|
+
const propertyUnknownFields = property._unknownFields;
|
|
2712
|
+
if (propertyUnknownFields && propertyUnknownFields.length > 0) {
|
|
2713
|
+
for (const field of propertyUnknownFields) {
|
|
2714
|
+
errors.push(
|
|
2715
|
+
validationError(
|
|
2716
|
+
`Property '${name}' has unknown field '${field}'`,
|
|
2717
|
+
buildLocation7(schema.filePath),
|
|
2718
|
+
getSuggestionForUnknownField(field)
|
|
2719
|
+
)
|
|
2720
|
+
);
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2710
2723
|
const unknownFieldResult = validateUnknownFieldsDetailed(
|
|
2711
2724
|
name,
|
|
2712
2725
|
property,
|