nox-validation 1.3.0 → 1.3.2

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/README.md CHANGED
@@ -32,9 +32,9 @@ npm install nox-validation
32
32
  ```javascript
33
33
  const { validate, helpers } = require("nox-validation");
34
34
 
35
- const all_fields = []; // fields of all collection
35
+ const all_fields = [];
36
36
 
37
- const relations = []; // all relations data
37
+ const relations = [];
38
38
 
39
39
  const schema = [
40
40
  {
@@ -113,6 +113,8 @@ const result = validate({
113
113
  apiVersion: "v1",
114
114
  language: "nl",
115
115
  maxLevel: 3,
116
+ onlyFormFields: false,
117
+ language_codes:[]
116
118
  });
117
119
  ```
118
120
 
@@ -133,7 +135,9 @@ const result = validate({
133
135
  byPassKeys: [],
134
136
  apiVersion: "v1",
135
137
  language: "nl",
136
- maxLevel: 3
138
+ maxLevel: 3,
139
+ onlyFormFields: false,
140
+ language_codes:[]
137
141
  });
138
142
  ```
139
143
 
@@ -141,9 +145,9 @@ const result = validate({
141
145
 
142
146
  ```javascript
143
147
  {
144
- status: true, // Validation passed
145
- error: {}, // Empty if no errors
146
- data: {} // Validated data
148
+ status: true,
149
+ error: {},
150
+ data: {}
147
151
  }
148
152
  ```
149
153
 
@@ -207,6 +211,16 @@ const result = validate({
207
211
 
208
212
  - Defines the level for generate tree structure.
209
213
 
214
+ #### `onlyFormFields` (Boolean)
215
+
216
+ Indicates the context in which the form is being used.
217
+ - `false`: Used when creating new data (full form).
218
+ - `true`: Used when editing or displaying only existing form fields.
219
+
220
+ #### `language_codes` (Array of IDs)
221
+ - Represents the selected translation language IDs.
222
+ - Each item in the array should be a valid language code or `_id` used for handling multilingual content.
223
+
210
224
  ## Result
211
225
 
212
226
  The `validate` function returns an object with two keys: