@@ -166,6 +166,11 @@ function isEmpty(field: Any[]): Boolean {
166166 */  
167167attribute  @@@targetField(targetField: AttributeTargetField[])
168168
169+ /* *
170+  * Marks an attribute to be used for data validation. 
171+  */  
172+ attribute  @@@validation()
173+ 
169174/* *
170175 * Indicates the expression context a function can be used. 
171176 */  
@@ -377,67 +382,67 @@ attribute @omit()
377382/* *
378383 * Validates length of a string field. 
379384 */  
380- attribute  @length(_ min: Int ?, _ max: Int ?, _ message: String ?) @@@targetField([StringField])
385+ attribute  @length(_ min: Int ?, _ max: Int ?, _ message: String ?) @@@targetField([StringField]) @@@validation 
381386
382387/* *
383388 * Validates a string field value starts with the given text. 
384389 */  
385- attribute  @startsWith(_ text: String , _ message: String ?) @@@targetField([StringField])
390+ attribute  @startsWith(_ text: String , _ message: String ?) @@@targetField([StringField]) @@@validation 
386391
387392/* *
388393 * Validates a string field value ends with the given text. 
389394 */  
390- attribute  @endsWith(_ text: String , _ message: String ?) @@@targetField([StringField])
395+ attribute  @endsWith(_ text: String , _ message: String ?) @@@targetField([StringField]) @@@validation 
391396
392397/* *
393398 * Validates a string field value contains the given text. 
394399 */  
395- attribute  @contains(_ text: String , _ message: String ?) @@@targetField([StringField])
400+ attribute  @contains(_ text: String , _ message: String ?) @@@targetField([StringField]) @@@validation 
396401
397402/* *
398403 * Validates a string field value matches a regex. 
399404 */  
400- attribute  @regex(_ regex: String , _ message: String ?) @@@targetField([StringField])
405+ attribute  @regex(_ regex: String , _ message: String ?) @@@targetField([StringField]) @@@validation 
401406
402407/* *
403408 * Validates a string field value is a valid email address. 
404409 */  
405- attribute  @email(_ message: String ?) @@@targetField([StringField])
410+ attribute  @email(_ message: String ?) @@@targetField([StringField]) @@@validation 
406411
407412/* *
408413 * Validates a string field value is a valid ISO datetime. 
409414 */  
410- attribute  @datetime(_ message: String ?) @@@targetField([StringField])
415+ attribute  @datetime(_ message: String ?) @@@targetField([StringField]) @@@validation 
411416
412417/* *
413418 * Validates a string field value is a valid url. 
414419 */  
415- attribute  @url(_ message: String ?) @@@targetField([StringField])
420+ attribute  @url(_ message: String ?) @@@targetField([StringField]) @@@validation 
416421
417422/* *
418423 * Validates a number field is greater than the given value. 
419424 */  
420- attribute  @gt(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField])
425+ attribute  @gt(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation 
421426
422427/* *
423428 * Validates a number field is greater than or equal to the given value. 
424429 */  
425- attribute  @gte(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField])
430+ attribute  @gte(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation 
426431
427432/* *
428433 * Validates a number field is less than the given value. 
429434 */  
430- attribute  @lt(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField])
435+ attribute  @lt(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation 
431436
432437/* *
433438 * Validates a number field is less than or equal to the given value. 
434439 */  
435- attribute  @lte(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField])
440+ attribute  @lte(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation 
436441
437442/* *
438443 * Validates the entity with a complex condition. 
439444 */  
440- attribute  @@validate(_ value: Boolean , _ message: String ?)
445+ attribute  @@validate(_ value: Boolean , _ message: String ?) @@@validation 
441446
442447/* *
443448 * Validates length of a string field. 
0 commit comments