@rline/schema 9.4.0 → 9.5.0

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/model.schema.json CHANGED
@@ -1,16 +1,8 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "title": "Model",
4
+ "type": "object",
4
5
  "properties": {
5
- "type": {
6
- "enum": [
7
- "class",
8
- "enum",
9
- "type",
10
- "interface",
11
- "constant"
12
- ]
13
- },
14
6
  "implementings": {
15
7
  "type": "array",
16
8
  "description": "Which abstract model is extended by the entity?",
@@ -35,7 +27,14 @@
35
27
  "type": "array",
36
28
  "uniqueItems": true,
37
29
  "items": {
38
- "$ref": "#/definitions/Property"
30
+ "allOf": [
31
+ {
32
+ "$ref": "#/definitions/Property"
33
+ }
34
+ ],
35
+ "required": [
36
+ "type"
37
+ ]
39
38
  }
40
39
  },
41
40
  "relations": {
@@ -49,7 +48,7 @@
49
48
  "additionalProperties": false,
50
49
  "definitions": {
51
50
  "ModelName": {
52
- "description": "Name of the models (class-names, entity-name) accross the projects.",
51
+ "type": "string",
53
52
  "enum": [
54
53
  "User",
55
54
  "Role",
@@ -114,7 +113,7 @@
114
113
  ]
115
114
  },
116
115
  "PropertyName": {
117
- "description": "Name of the property names used accross the projects",
116
+ "type": "string",
118
117
  "enum": [
119
118
  "firstName",
120
119
  "lastName",
@@ -284,55 +283,13 @@
284
283
  "$ref": "#/definitions/UiProperty"
285
284
  },
286
285
  {
287
- "properties": {
288
- "name": {
289
- "$ref": "#/definitions/PropertyName"
290
- },
291
- "type": {
292
- "$ref": "#/definitions/RelationType"
293
- },
294
- "target": {
295
- "$ref": "#/definitions/ModelName"
296
- },
297
- "targetProperty": {
298
- "description": "Reference property in the target entity",
299
- "$ref": "#/definitions/PropertyName"
300
- },
301
- "eager": {
302
- "type": "boolean",
303
- "default": true,
304
- "description": "Load the relation data by default"
305
- },
306
- "join": {
307
- "description": "should join the column/table?",
308
- "type": "boolean",
309
- "default": true
310
- },
311
- "cascade": {
312
- "description": "should cascade the realtion during entity creation",
313
- "type": "boolean",
314
- "default": true
315
- },
316
- "onDelete": {
317
- "description": "what should happen when the relation is deleted?",
318
- "$ref": "#/definitions/OnDelete",
319
- "default": "SET NULL"
320
- },
321
- "onUpdate": {
322
- "description": "what should happen when the relation is udpated",
323
- "$ref": "#/definitions/OnUpdate"
324
- }
325
- },
326
- "additionalProperties": false,
327
- "required": [
328
- "type",
329
- "target"
330
- ]
286
+ "$ref": "#/definitions/RelationPropertyOptionsRaw"
331
287
  }
332
288
  ]
333
289
  },
334
290
  "RelationType": {
335
- "title": "RelationType",
291
+ "title": "Relation Type",
292
+ "type": "string",
336
293
  "enum": [
337
294
  "many-to-many",
338
295
  "many-to-one",
@@ -341,7 +298,7 @@
341
298
  ]
342
299
  },
343
300
  "OnDelete": {
344
- "title": "OnDelete",
301
+ "type": "string",
345
302
  "enum": [
346
303
  "RESTRICT",
347
304
  "CASCADE",
@@ -352,7 +309,7 @@
352
309
  "default": "SET NULL"
353
310
  },
354
311
  "OnUpdate": {
355
- "title": "OnUpdate",
312
+ "type": "string",
356
313
  "enum": [
357
314
  "RESTRICT",
358
315
  "CASCADE",
@@ -362,8 +319,53 @@
362
319
  ],
363
320
  "default": "SET NULL"
364
321
  },
322
+ "RelationPropertyOptionsRaw": {
323
+ "type": "object",
324
+ "properties": {
325
+ "name": {
326
+ "$ref": "#/definitions/PropertyName"
327
+ },
328
+ "type": {
329
+ "$ref": "#/definitions/RelationType"
330
+ },
331
+ "target": {
332
+ "$ref": "#/definitions/ModelName"
333
+ },
334
+ "targetProperty": {
335
+ "description": "Reference property in the target entity",
336
+ "$ref": "#/definitions/PropertyName"
337
+ },
338
+ "eager": {
339
+ "type": "boolean",
340
+ "default": true
341
+ },
342
+ "join": {
343
+ "description": "should join the column/table?",
344
+ "type": "boolean",
345
+ "default": true
346
+ },
347
+ "cascade": {
348
+ "description": "should cascade the realtion during entity creation",
349
+ "type": "boolean",
350
+ "default": true
351
+ },
352
+ "onDelete": {
353
+ "description": "what should happen when the relation is deleted?",
354
+ "$ref": "#/definitions/OnDelete",
355
+ "default": "SET NULL"
356
+ },
357
+ "onUpdate": {
358
+ "description": "what should happen when the relation is udpated",
359
+ "$ref": "#/definitions/OnUpdate"
360
+ }
361
+ },
362
+ "additionalProperties": false,
363
+ "required": [
364
+ "type",
365
+ "target"
366
+ ]
367
+ },
365
368
  "CommonProperty": {
366
- "description": "Common property options",
367
369
  "allOf": [
368
370
  {
369
371
  "$ref": "#/definitions/General"
@@ -386,27 +388,29 @@
386
388
  ]
387
389
  },
388
390
  "General": {
391
+ "type": "object",
389
392
  "properties": {
390
393
  "name": {
391
394
  "$ref": "#/definitions/PropertyName"
392
395
  },
396
+ "type": {
397
+ "$ref": "#/definitions/PropertyType"
398
+ },
393
399
  "description": {
394
- "type": "string",
395
- "description": "Property description"
400
+ "type": "string"
396
401
  },
397
402
  "required": {
398
403
  "type": "boolean",
399
- "default": true,
400
- "description": "Is property required?"
404
+ "default": true
401
405
  },
402
406
  "unique": {
403
407
  "type": "boolean",
404
- "default": true,
405
- "description": "Is property unique?"
408
+ "default": true
406
409
  }
407
410
  }
408
411
  },
409
412
  "Transform": {
413
+ "type": "object",
410
414
  "properties": {
411
415
  "acceptString": {
412
416
  "type": "boolean",
@@ -416,6 +420,7 @@
416
420
  }
417
421
  },
418
422
  "Validation": {
423
+ "type": "object",
419
424
  "properties": {
420
425
  "equalToProperty": {
421
426
  "$ref": "#/definitions/PropertyName",
@@ -428,20 +433,20 @@
428
433
  }
429
434
  },
430
435
  "Encryption": {
436
+ "type": "object",
431
437
  "properties": {
432
438
  "hash": {
433
439
  "type": "boolean",
434
- "default": true,
435
- "description": "Should hash value?"
440
+ "default": true
436
441
  },
437
442
  "encrypt": {
438
443
  "type": "boolean",
439
- "default": true,
440
- "description": "Should encrypt value?"
444
+ "default": true
441
445
  }
442
446
  }
443
447
  },
444
448
  "Dto": {
449
+ "type": "object",
445
450
  "properties": {
446
451
  "write": {
447
452
  "type": "boolean",
@@ -460,6 +465,7 @@
460
465
  }
461
466
  },
462
467
  "UiProperty": {
468
+ "type": "object",
463
469
  "properties": {
464
470
  "label": {
465
471
  "type": "string"
@@ -497,6 +503,7 @@
497
503
  }
498
504
  },
499
505
  "String": {
506
+ "type": "object",
500
507
  "properties": {
501
508
  "type": {
502
509
  "const": "string"
@@ -508,12 +515,10 @@
508
515
  "$ref": "#/definitions/StringFormat"
509
516
  },
510
517
  "minLength": {
511
- "type": "integer",
512
- "description": "Minimum allowed length for the string value."
518
+ "type": "integer"
513
519
  },
514
520
  "maxLength": {
515
- "type": "integer",
516
- "description": "Maximum allowed length for the string value."
521
+ "type": "integer"
517
522
  },
518
523
  "isIn": {
519
524
  "type": "array",
@@ -575,6 +580,7 @@
575
580
  "$ref": "#/definitions/CommonNumber"
576
581
  },
577
582
  {
583
+ "type": "object",
578
584
  "properties": {
579
585
  "type": {
580
586
  "const": "number"
@@ -615,44 +621,46 @@
615
621
  "$ref": "#/definitions/CommonNumber"
616
622
  },
617
623
  {
618
- "properties": {
619
- "type": {
620
- "const": "integer"
621
- },
622
- "default": {
623
- "type": "integer"
624
- },
625
- "isIn": {
626
- "type": "array",
627
- "description": "Is the vlaue in the provided list?",
628
- "items": {
629
- "oneOf": [
630
- {
631
- "type": "integer"
632
- }
633
- ]
624
+ "$ref": "#/definitions/IntergerPropertyOptionsRaw"
625
+ }
626
+ ]
627
+ },
628
+ "IntergerPropertyOptionsRaw": {
629
+ "type": "object",
630
+ "properties": {
631
+ "type": {
632
+ "const": "integer"
633
+ },
634
+ "default": {
635
+ "type": "integer"
636
+ },
637
+ "isIn": {
638
+ "type": "array",
639
+ "items": {
640
+ "oneOf": [
641
+ {
642
+ "type": "integer"
634
643
  }
635
- },
636
- "isNotIn": {
637
- "type": "array",
638
- "description": "Is the value not in the provided list?",
639
- "items": {
640
- "oneOf": [
641
- {
642
- "type": "integer"
643
- }
644
- ]
644
+ ]
645
+ }
646
+ },
647
+ "isNotIn": {
648
+ "type": "array",
649
+ "items": {
650
+ "oneOf": [
651
+ {
652
+ "type": "integer"
645
653
  }
646
- }
647
- },
648
- "required": [
649
- "type"
650
- ]
654
+ ]
655
+ }
651
656
  }
657
+ },
658
+ "required": [
659
+ "type"
652
660
  ]
653
661
  },
654
662
  "Boolean": {
655
- "description": "Boolean property options",
663
+ "type": "object",
656
664
  "properties": {
657
665
  "type": {
658
666
  "const": "boolean"
@@ -666,6 +674,7 @@
666
674
  ]
667
675
  },
668
676
  "Date": {
677
+ "type": "object",
669
678
  "properties": {
670
679
  "type": {
671
680
  "const": "date"
@@ -685,6 +694,7 @@
685
694
  ]
686
695
  },
687
696
  "Object": {
697
+ "type": "object",
688
698
  "properties": {
689
699
  "type": {
690
700
  "const": "object"
@@ -702,13 +712,16 @@
702
712
  ]
703
713
  },
704
714
  "Array": {
705
- "description": "Array property options",
715
+ "type": "object",
706
716
  "properties": {
707
717
  "type": {
708
718
  "const": "array"
709
719
  },
710
720
  "default": {
711
- "type": "array"
721
+ "type": "array",
722
+ "items": {
723
+ "$ref": "#/definitions/Property"
724
+ }
712
725
  },
713
726
  "minSize": {
714
727
  "type": "integer"
@@ -718,14 +731,6 @@
718
731
  },
719
732
  "items": {
720
733
  "$ref": "#/definitions/Property"
721
- },
722
- "contain": {
723
- "type": "array",
724
- "description": "Should the array contain a list of value?"
725
- },
726
- "notContain": {
727
- "type": "array",
728
- "description": "Should the array NOT contain a list of value?"
729
734
  }
730
735
  },
731
736
  "required": [
@@ -734,94 +739,95 @@
734
739
  ]
735
740
  },
736
741
  "NumberFormat": {
742
+ "type": "string",
737
743
  "description": "Number format such as rate (0-5), percentage (0-100)",
738
744
  "enum": [
739
- [
740
- "integer",
741
- "float",
742
- "double",
743
- "decimal",
744
- "positive-integer",
745
- "negative-integer",
746
- "non-negative-integer",
747
- "non-positive-integer",
748
- "percentage",
749
- "currency",
750
- "rate",
751
- "scientific-notation",
752
- "hexadecimal",
753
- "octal",
754
- "binary",
755
- "roman-numeral",
756
- "prime-number",
757
- "natural-number",
758
- "odd-number",
759
- "even-number",
760
- "latitude",
761
- "longitude",
762
- "timezone-offset",
763
- "temperature-celsius",
764
- "temperature-fahrenheit",
765
- "angle-degree",
766
- "angle-radian",
767
- "year",
768
- "month",
769
- "day",
770
- "age",
771
- "count",
772
- "rating",
773
- "probability",
774
- "weight",
775
- "height",
776
- "distance",
777
- "speed",
778
- "time-duration",
779
- "voltage",
780
- "current",
781
- "frequency",
782
- "acceleration"
783
- ]
745
+ "integer",
746
+ "float",
747
+ "double",
748
+ "decimal",
749
+ "positive-integer",
750
+ "negative-integer",
751
+ "non-negative-integer",
752
+ "non-positive-integer",
753
+ "percentage",
754
+ "currency",
755
+ "rate",
756
+ "scientific-notation",
757
+ "hexadecimal",
758
+ "octal",
759
+ "binary",
760
+ "roman-numeral",
761
+ "prime-number",
762
+ "natural-number",
763
+ "odd-number",
764
+ "even-number",
765
+ "latitude",
766
+ "longitude",
767
+ "timezone-offset",
768
+ "temperature-celsius",
769
+ "temperature-fahrenheit",
770
+ "angle-degree",
771
+ "angle-radian",
772
+ "year",
773
+ "month",
774
+ "day",
775
+ "age",
776
+ "count",
777
+ "rating",
778
+ "probability",
779
+ "weight",
780
+ "height",
781
+ "distance",
782
+ "speed",
783
+ "time-duration",
784
+ "voltage",
785
+ "current",
786
+ "frequency",
787
+ "acceleration"
788
+ ]
789
+ },
790
+ "PropertyType": {
791
+ "type": "string",
792
+ "description": "Propert type",
793
+ "enum": [
794
+ "string",
795
+ "number",
796
+ "integer",
797
+ "boolean",
798
+ "date",
799
+ "object",
800
+ "array"
784
801
  ]
785
802
  },
786
803
  "CommonNumber": {
787
- "description": "Common number property options",
804
+ "type": "object",
788
805
  "properties": {
789
806
  "isEven": {
790
- "type": "boolean",
791
- "description": "Is the number even?"
807
+ "type": "boolean"
792
808
  },
793
809
  "isOdd": {
794
- "type": "boolean",
795
- "description": "Is the number odd?"
810
+ "type": "boolean"
796
811
  },
797
812
  "numberFormat": {
798
813
  "$ref": "#/definitions/NumberFormat"
799
814
  },
800
815
  "minimum": {
801
- "type": "number",
802
- "description": "Minimum allowed value for the number"
816
+ "type": "number"
803
817
  },
804
818
  "maximum": {
805
- "type": "number",
806
- "description": "Maximum allowed value for the number"
819
+ "type": "number"
807
820
  },
808
821
  "moreThanProperty": {
809
- "type": "array",
810
- "description": "Is the value more than the provided properties' value?",
811
- "items": {
812
- "$ref": "#/definitions/PropertyName"
813
- }
822
+ "$ref": "#/definitions/PropertyName"
814
823
  },
815
824
  "lessThanProperty": {
816
- "type": "array",
817
- "description": "Is the value less than the provided properties' value?",
818
- "items": {
819
- "$ref": "#/definitions/PropertyName"
820
- }
825
+ "$ref": "#/definitions/PropertyName"
821
826
  }
822
827
  }
823
828
  },
824
829
  "StringFormat": {
830
+ "type": "string",
825
831
  "description": "String format such as email, password, uuid, ip6, ip4 and so more",
826
832
  "enum": [
827
833
  "short",
@@ -872,6 +878,7 @@
872
878
  ]
873
879
  },
874
880
  "InputType": {
881
+ "type": "string",
875
882
  "description": "UI input type",
876
883
  "enum": [
877
884
  "text",
@@ -896,7 +903,7 @@
896
903
  ]
897
904
  },
898
905
  "Icon": {
899
- "description": "Google Material Symbols",
906
+ "type": "string",
900
907
  "enum": [
901
908
  "search",
902
909
  "home",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rline/schema",
3
- "version": "9.4.0",
3
+ "version": "9.5.0",
4
4
  "description": "Common json schemas",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -21,9 +21,6 @@
21
21
  "rline",
22
22
  "library"
23
23
  ],
24
- "dependencies": {
25
- "@swc/helpers": "~0.5.11"
26
- },
27
24
  "files": [
28
25
  "*.schema.json"
29
26
  ],
@@ -10,6 +10,14 @@
10
10
  "type": "string",
11
11
  "description": "Project's root directory, the relative path to the directory of the main schema file such as `./schemas` and `./src`"
12
12
  },
13
+ "prefix": {
14
+ "type": "string",
15
+ "minLength": 1
16
+ },
17
+ "suffix": {
18
+ "type": "string",
19
+ "minLength": 1
20
+ },
13
21
  "main": {
14
22
  "type": "string",
15
23
  "description": "The entity file such as `main.schema.json` or `schema.json` or `model.schema.json`"