@@ -199,11 +199,6 @@ function currentOperation(casing: String?): String {
199199 */
200200attribute @@@targetField(_ targetField: AttributeTargetField[])
201201
202- /* *
203- * Marks an attribute to be applicable to type defs and fields.
204- */
205- attribute @@@supportTypeDef()
206-
207202/* *
208203 * Marks an attribute to be used for data validation.
209204 */
@@ -237,13 +232,13 @@ attribute @@@once()
237232 * @param sort: Allows you to specify in what order the entries of the ID are stored in the database. The available options are Asc and Desc.
238233 * @param clustered: Defines whether the ID is clustered or non-clustered. Defaults to true.
239234 */
240- attribute @id(map: String ?, length: Int ?, sort: SortOrder?, clustered: Boolean ?) @@@prisma @@@supportTypeDef @@@ once
235+ attribute @id(map: String ?, length: Int ?, sort: SortOrder?, clustered: Boolean ?) @@@prisma @@@once
241236
242237/* *
243238 * Defines a default value for a field.
244239 * @param value: An expression (e.g. 5, true, now(), auth()).
245240 */
246- attribute @default(_ value: ContextType , map: String ?) @@@prisma @@@supportTypeDef
241+ attribute @default(_ value: ContextType , map: String ?) @@@prisma
247242
248243/* *
249244 * Defines a unique constraint for this field.
@@ -264,7 +259,7 @@ attribute @unique(map: String?, length: Int?, sort: SortOrder?, clustered: Boole
264259 * @param sort: Allows you to specify in what order the entries of the ID are stored in the database. The available options are Asc and Desc.
265260 * @param clustered: Defines whether the ID is clustered or non-clustered. Defaults to true.
266261 */
267- attribute @@id(_ fields: FieldReference [], name: String ?, map: String ?, length: Int ?, sort: SortOrder?, clustered: Boolean ?) @@@prisma
262+ attribute @@id(_ fields: FieldReference [], name: String ?, map: String ?, length: Int ?, sort: SortOrder?, clustered: Boolean ?) @@@prisma @@@once
268263
269264/* *
270265 * Defines a compound unique constraint for the specified fields.
@@ -560,82 +555,82 @@ attribute @omit()
560555/* *
561556 * Validates length of a string field.
562557 */
563- attribute @length(_ min: Int ?, _ max: Int ?, _ message: String ?) @@@targetField([StringField]) @@@validation @@@supportTypeDef
558+ attribute @length(_ min: Int ?, _ max: Int ?, _ message: String ?) @@@targetField([StringField]) @@@validation
564559
565560/* *
566561 * Validates a string field value starts with the given text.
567562 */
568- attribute @startsWith(_ text: String , _ message: String ?) @@@targetField([StringField]) @@@validation @@@supportTypeDef
563+ attribute @startsWith(_ text: String , _ message: String ?) @@@targetField([StringField]) @@@validation
569564
570565/* *
571566 * Validates a string field value ends with the given text.
572567 */
573- attribute @endsWith(_ text: String , _ message: String ?) @@@targetField([StringField]) @@@validation @@@supportTypeDef
568+ attribute @endsWith(_ text: String , _ message: String ?) @@@targetField([StringField]) @@@validation
574569
575570/* *
576571 * Validates a string field value contains the given text.
577572 */
578- attribute @contains(_ text: String , _ message: String ?) @@@targetField([StringField]) @@@validation @@@supportTypeDef
573+ attribute @contains(_ text: String , _ message: String ?) @@@targetField([StringField]) @@@validation
579574
580575/* *
581576 * Validates a string field value matches a regex.
582577 */
583- attribute @regex(_ regex: String , _ message: String ?) @@@targetField([StringField]) @@@validation @@@supportTypeDef
578+ attribute @regex(_ regex: String , _ message: String ?) @@@targetField([StringField]) @@@validation
584579
585580/* *
586581 * Validates a string field value is a valid email address.
587582 */
588- attribute @email(_ message: String ?) @@@targetField([StringField]) @@@validation @@@supportTypeDef
583+ attribute @email(_ message: String ?) @@@targetField([StringField]) @@@validation
589584
590585/* *
591586 * Validates a string field value is a valid ISO datetime.
592587 */
593- attribute @datetime(_ message: String ?) @@@targetField([StringField]) @@@validation @@@supportTypeDef
588+ attribute @datetime(_ message: String ?) @@@targetField([StringField]) @@@validation
594589
595590/* *
596591 * Validates a string field value is a valid url.
597592 */
598- attribute @url(_ message: String ?) @@@targetField([StringField]) @@@validation @@@supportTypeDef
593+ attribute @url(_ message: String ?) @@@targetField([StringField]) @@@validation
599594
600595/* *
601596 * Trims whitespaces from the start and end of the string.
602597 */
603- attribute @trim() @@@targetField([StringField]) @@@validation @@@supportTypeDef
598+ attribute @trim() @@@targetField([StringField]) @@@validation
604599
605600/* *
606601 * Transform entire string toLowerCase.
607602 */
608- attribute @lower() @@@targetField([StringField]) @@@validation @@@supportTypeDef
603+ attribute @lower() @@@targetField([StringField]) @@@validation
609604
610605/* *
611606 * Transform entire string toUpperCase.
612607 */
613- attribute @upper() @@@targetField([StringField]) @@@validation @@@supportTypeDef
608+ attribute @upper() @@@targetField([StringField]) @@@validation
614609
615610/* *
616611 * Validates a number field is greater than the given value.
617612 */
618- attribute @gt(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation @@@supportTypeDef
613+ attribute @gt(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation
619614
620615/* *
621616 * Validates a number field is greater than or equal to the given value.
622617 */
623- attribute @gte(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation @@@supportTypeDef
618+ attribute @gte(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation
624619
625620/* *
626621 * Validates a number field is less than the given value.
627622 */
628- attribute @lt(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation @@@supportTypeDef
623+ attribute @lt(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation
629624
630625/* *
631626 * Validates a number field is less than or equal to the given value.
632627 */
633- attribute @lte(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation @@@supportTypeDef
628+ attribute @lte(_ value: Int , _ message: String ?) @@@targetField([IntField, FloatField, DecimalField]) @@@validation
634629
635630/* *
636631 * Validates the entity with a complex condition.
637632 */
638- attribute @@validate(_ value: Boolean , _ message: String ?, _ path: String []?) @@@validation @@@supportTypeDef
633+ attribute @@validate(_ value: Boolean , _ message: String ?, _ path: String []?) @@@validation
639634
640635/* *
641636 * Validates length of a string field.
@@ -706,7 +701,7 @@ function raw(value: String): Any {
706701/* *
707702 * Marks a field to be strong-typed JSON.
708703 */
709- attribute @json() @@@targetField([TypeDefField])
704+ attribute @json() @@@targetField([TypeDefField]) @@@deprecated( 'The "@json" attribute is not needed anymore. ZenStack will automatically use JSON to store typed fields.' )
710705
711706/* *
712707 * Marks a field to be computed.
@@ -723,4 +718,19 @@ function auth(): Any {
723718 * Used to specify the model for resolving `auth()` function call in access policies. A Zmodel
724719 * can have at most one model with this attribute. By default, the model named "User" is used.
725720 */
726- attribute @@auth() @@@supportTypeDef
721+ attribute @@auth()
722+
723+ /* *
724+ * Attaches arbitrary metadata to a model or type def.
725+ */
726+ attribute @@meta(_ name: String , _ value: Any )
727+
728+ /* *
729+ * Attaches arbitrary metadata to a field.
730+ */
731+ attribute @meta(_ name: String , _ value: Any )
732+
733+ /* *
734+ * Marks an attribute as deprecated.
735+ */
736+ attribute @@@deprecated(_ message: String )
0 commit comments