-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtest_dynamic_resources.py
More file actions
2773 lines (2594 loc) · 127 KB
/
test_dynamic_resources.py
File metadata and controls
2773 lines (2594 loc) · 127 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import datetime
from typing import Union
from pydantic import Base64Bytes
from scim2_models.annotations import CaseExact
from scim2_models.annotations import Mutability
from scim2_models.annotations import Required
from scim2_models.annotations import Returned
from scim2_models.annotations import Uniqueness
from scim2_models.attributes import ComplexAttribute
from scim2_models.reference import URI
from scim2_models.reference import External
from scim2_models.reference import Reference
from scim2_models.resources.resource import Extension
from scim2_models.resources.resource import Resource
from scim2_models.resources.schema import Attribute
from scim2_models.resources.schema import Schema
def test_make_group_model_from_schema(load_sample):
payload = load_sample("rfc7643-8.7.1-schema-group.json")
schema = Schema.model_validate(payload)
Group = Resource.from_schema(schema)
assert Group.__schema__ == "urn:ietf:params:scim:schemas:core:2.0:Group"
# displayName
assert Group.get_field_root_type("display_name") is str
assert not Group.get_field_multiplicity("display_name")
assert (
Group.model_fields["display_name"].description
== "A human-readable name for the Group. REQUIRED."
)
assert Group.get_field_annotation("display_name", Required) == Required.true
assert Group.get_field_annotation("display_name", CaseExact) == CaseExact.false
assert (
Group.get_field_annotation("display_name", Mutability) == Mutability.read_write
)
assert Group.get_field_annotation("display_name", Returned) == Returned.default
assert Group.get_field_annotation("display_name", Uniqueness) == Uniqueness.none
# members
Members = Group.get_field_root_type("members")
assert Members == Group.Members
assert issubclass(Members, ComplexAttribute)
assert Group.get_field_multiplicity("members")
assert (
Group.model_fields["members"].description == "A list of members of the Group."
)
assert Group.get_field_annotation("members", Required) == Required.false
assert Group.get_field_annotation("members", CaseExact) == CaseExact.false
assert Group.get_field_annotation("members", Mutability) == Mutability.read_write
assert Group.get_field_annotation("members", Returned) == Returned.default
assert Group.get_field_annotation("members", Uniqueness) == Uniqueness.none
# members.value
assert Members.get_field_root_type("value") is str
assert not Members.get_field_multiplicity("value")
assert (
Members.model_fields["value"].description
== "Identifier of the member of this Group."
)
assert Members.get_field_annotation("value", Required) == Required.false
assert Members.get_field_annotation("value", CaseExact) == CaseExact.false
assert Members.get_field_annotation("value", Mutability) == Mutability.immutable
assert Members.get_field_annotation("value", Returned) == Returned.default
assert Members.get_field_annotation("value", Uniqueness) == Uniqueness.none
# Members.ref
assert (
Members.get_field_root_type("ref") == Reference[Union["User", "Group"]] # noqa: F821
)
assert not Members.get_field_multiplicity("ref")
assert (
Members.model_fields["ref"].description
== "The URI corresponding to a SCIM resource that is a member of this Group."
)
assert Members.model_fields["ref"].serialization_alias == "$ref"
assert Members.get_field_annotation("ref", Required) == Required.false
assert Members.get_field_annotation("ref", CaseExact) == CaseExact.false
assert Members.get_field_annotation("ref", Mutability) == Mutability.immutable
assert Members.get_field_annotation("ref", Returned) == Returned.default
assert Members.get_field_annotation("ref", Uniqueness) == Uniqueness.none
# Members.type
assert Members.get_field_root_type("type") is str
assert not Members.get_field_multiplicity("type")
assert (
Members.model_fields["type"].description
== "A label indicating the type of resource, e.g., 'User' or 'Group'."
)
assert Members.get_field_annotation("type", Required) == Required.false
assert Members.get_field_annotation("type", CaseExact) == CaseExact.false
assert Members.model_fields["type"].examples == ["User", "Group"]
assert Members.get_field_annotation("type", Mutability) == Mutability.immutable
assert Members.get_field_annotation("type", Returned) == Returned.default
assert Members.get_field_annotation("type", Uniqueness) == Uniqueness.none
# Members.display
assert Members.get_field_root_type("display") is str
assert not Members.get_field_multiplicity("display")
assert (
Members.model_fields["display"].description
== "A human-readable name for the group member, primarily used for display purposes."
)
assert Members.get_field_annotation("display", Required) == Required.false
assert Members.get_field_annotation("display", CaseExact) == CaseExact.false
assert Members.get_field_annotation("display", Mutability) == Mutability.read_only
assert Members.get_field_annotation("display", Returned) == Returned.default
assert Members.get_field_annotation("display", Uniqueness) == Uniqueness.none
payload = load_sample("rfc7643-8.4-group.json")
obj = Group.model_validate(payload)
assert obj.schemas == ["urn:ietf:params:scim:schemas:core:2.0:Group"]
assert obj.id == "e9e30dba-f08f-4109-8486-d5c6a331660a"
assert obj.display_name == "Tour Guides"
assert obj.members[0].value == "2819c223-7f76-453a-919d-413861904646"
assert obj.members[0].ref == Reference(
"https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646"
)
assert obj.members[0].display == "Babs Jensen"
assert obj.members[1].value == "902c246b-6245-4190-8e05-00816be7344a"
assert obj.members[1].ref == Reference(
"https://example.com/v2/Users/902c246b-6245-4190-8e05-00816be7344a"
)
assert obj.members[1].display == "Mandy Pepperidge"
assert obj.meta.resource_type == "Group"
assert obj.meta.created == datetime.datetime(
2010, 1, 23, 4, 56, 22, tzinfo=datetime.timezone.utc
)
assert obj.meta.last_modified == datetime.datetime(
2011, 5, 13, 4, 42, 34, tzinfo=datetime.timezone.utc
)
assert obj.meta.version == 'W\\/"3694e05e9dff592"'
assert (
obj.meta.location
== "https://example.com/v2/Groups/e9e30dba-f08f-4109-8486-d5c6a331660a"
)
assert obj.model_dump() == payload
def test_make_user_model_from_schema(load_sample):
payload = load_sample("rfc7643-8.7.1-schema-user.json")
schema = Schema.model_validate(payload)
User = Resource.from_schema(schema)
assert User.__schema__ == "urn:ietf:params:scim:schemas:core:2.0:User"
# user_name
assert User.get_field_root_type("user_name") is str
assert not User.get_field_multiplicity("user_name")
assert (
User.model_fields["user_name"].description
== "Unique identifier for the User, typically used by the user to directly authenticate to the service provider. Each User MUST include a non-empty userName value. This identifier MUST be unique across the service provider's entire set of Users. REQUIRED."
)
assert User.get_field_annotation("user_name", Required) == Required.true
assert User.get_field_annotation("user_name", CaseExact) == CaseExact.false
assert User.get_field_annotation("user_name", Mutability) == Mutability.read_write
assert User.get_field_annotation("user_name", Returned) == Returned.default
assert User.get_field_annotation("user_name", Uniqueness) == Uniqueness.server
# name
Name = User.get_field_root_type("name")
assert Name == User.Name
assert issubclass(Name, ComplexAttribute)
assert not User.get_field_multiplicity("name")
assert (
User.model_fields["name"].description
== "The components of the user's real name. Providers MAY return just the full name as a single string in the formatted sub-attribute, or they MAY return just the individual component attributes using the other sub-attributes, or they MAY return both. If both variants are returned, they SHOULD be describing the same name, with the formatted name indicating how the component attributes should be combined."
)
assert User.get_field_annotation("name", Required) == Required.false
assert User.get_field_annotation("name", CaseExact) == CaseExact.false
assert User.get_field_annotation("name", Mutability) == Mutability.read_write
assert User.get_field_annotation("name", Returned) == Returned.default
assert User.get_field_annotation("name", Uniqueness) == Uniqueness.none
# name.formatted
assert Name.get_field_root_type("formatted") is str
assert not Name.get_field_multiplicity("formatted")
assert (
Name.model_fields["formatted"].description
== "The full name, including all middle names, titles, and suffixes as appropriate, formatted for display (e.g., 'Ms. Barbara J Jensen, III')."
)
assert Name.get_field_annotation("formatted", Required) == Required.false
assert Name.get_field_annotation("formatted", CaseExact) == CaseExact.false
assert Name.get_field_annotation("formatted", Mutability) == Mutability.read_write
assert Name.get_field_annotation("formatted", Returned) == Returned.default
assert Name.get_field_annotation("formatted", Uniqueness) == Uniqueness.none
# name.family_name
assert Name.get_field_root_type("family_name") is str
assert not Name.get_field_multiplicity("family_name")
assert (
Name.model_fields["family_name"].description
== "The family name of the User, or last name in most Western languages (e.g., 'Jensen' given the full name 'Ms. Barbara J Jensen, III')."
)
assert Name.get_field_annotation("family_name", Required) == Required.false
assert Name.get_field_annotation("family_name", CaseExact) == CaseExact.false
assert Name.get_field_annotation("family_name", Mutability) == Mutability.read_write
assert Name.get_field_annotation("family_name", Returned) == Returned.default
assert Name.get_field_annotation("family_name", Uniqueness) == Uniqueness.none
# name.given_name
assert Name.get_field_root_type("given_name") is str
assert not Name.get_field_multiplicity("given_name")
assert (
Name.model_fields["given_name"].description
== "The given name of the User, or first name in most Western languages (e.g., 'Barbara' given the full name 'Ms. Barbara J Jensen, III')."
)
assert Name.get_field_annotation("given_name", Required) == Required.false
assert Name.get_field_annotation("given_name", CaseExact) == CaseExact.false
assert Name.get_field_annotation("given_name", Mutability) == Mutability.read_write
assert Name.get_field_annotation("given_name", Returned) == Returned.default
assert Name.get_field_annotation("given_name", Uniqueness) == Uniqueness.none
# name.middle_name
assert Name.get_field_root_type("middle_name") is str
assert not Name.get_field_multiplicity("middle_name")
assert (
Name.model_fields["middle_name"].description
== "The middle name(s) of the User (e.g., 'Jane' given the full name 'Ms. Barbara J Jensen, III')."
)
assert Name.get_field_annotation("middle_name", Required) == Required.false
assert Name.get_field_annotation("middle_name", CaseExact) == CaseExact.false
assert Name.get_field_annotation("middle_name", Mutability) == Mutability.read_write
assert Name.get_field_annotation("middle_name", Returned) == Returned.default
assert Name.get_field_annotation("middle_name", Uniqueness) == Uniqueness.none
# name.honorific_prefix
assert Name.get_field_root_type("honorific_prefix") is str
assert not Name.get_field_multiplicity("honorific_prefix")
assert (
Name.model_fields["honorific_prefix"].description
== "The honorific prefix(es) of the User, or title in most Western languages (e.g., 'Ms.' given the full name 'Ms. Barbara J Jensen, III')."
)
assert Name.get_field_annotation("honorific_prefix", Required) == Required.false
assert Name.get_field_annotation("honorific_prefix", CaseExact) == CaseExact.false
assert (
Name.get_field_annotation("honorific_prefix", Mutability)
== Mutability.read_write
)
assert Name.get_field_annotation("honorific_prefix", Returned) == Returned.default
assert Name.get_field_annotation("honorific_prefix", Uniqueness) == Uniqueness.none
# name.honorific_suffix
assert Name.get_field_root_type("honorific_suffix") is str
assert not Name.get_field_multiplicity("honorific_suffix")
assert (
Name.model_fields["honorific_suffix"].description
== "The honorific suffix(es) of the User, or suffix in most Western languages (e.g., 'III' given the full name 'Ms. Barbara J Jensen, III')."
)
assert Name.get_field_annotation("honorific_suffix", Required) == Required.false
assert Name.get_field_annotation("honorific_suffix", CaseExact) == CaseExact.false
assert (
Name.get_field_annotation("honorific_suffix", Mutability)
== Mutability.read_write
)
assert Name.get_field_annotation("honorific_suffix", Returned) == Returned.default
assert Name.get_field_annotation("honorific_suffix", Uniqueness) == Uniqueness.none
# display_name
assert User.get_field_root_type("display_name") is str
assert not User.get_field_multiplicity("display_name")
assert (
User.model_fields["display_name"].description
== "The name of the User, suitable for display to end-users. The name SHOULD be the full name of the User being described, if known."
)
assert User.get_field_annotation("display_name", Required) == Required.false
assert User.get_field_annotation("display_name", CaseExact) == CaseExact.false
assert (
User.get_field_annotation("display_name", Mutability) == Mutability.read_write
)
assert User.get_field_annotation("display_name", Returned) == Returned.default
assert User.get_field_annotation("display_name", Uniqueness) == Uniqueness.none
# nick_name
assert User.get_field_root_type("nick_name") is str
assert not User.get_field_multiplicity("nick_name")
assert (
User.model_fields["nick_name"].description
== "The casual way to address the user in real life, e.g., 'Bob' or 'Bobby' instead of 'Robert'. This attribute SHOULD NOT be used to represent a User's username (e.g., 'bjensen' or 'mpepperidge')."
)
assert User.get_field_annotation("nick_name", Required) == Required.false
assert User.get_field_annotation("nick_name", CaseExact) == CaseExact.false
assert User.get_field_annotation("nick_name", Mutability) == Mutability.read_write
assert User.get_field_annotation("nick_name", Returned) == Returned.default
assert User.get_field_annotation("nick_name", Uniqueness) == Uniqueness.none
# profile_url
assert User.get_field_root_type("profile_url") == Reference[External]
assert not User.get_field_multiplicity("profile_url")
assert (
User.model_fields["profile_url"].description
== "A fully qualified URL pointing to a page representing the User's online profile."
)
assert User.get_field_annotation("profile_url", Required) == Required.false
assert User.get_field_annotation("profile_url", CaseExact) == CaseExact.false
assert User.get_field_annotation("profile_url", Mutability) == Mutability.read_write
assert User.get_field_annotation("profile_url", Returned) == Returned.default
assert User.get_field_annotation("profile_url", Uniqueness) == Uniqueness.none
# title
assert User.get_field_root_type("title") is str
assert not User.get_field_multiplicity("title")
assert (
User.model_fields["title"].description
== 'The user\'s title, such as "Vice President."'
)
assert User.get_field_annotation("title", Required) == Required.false
assert User.get_field_annotation("title", CaseExact) == CaseExact.false
assert User.get_field_annotation("title", Mutability) == Mutability.read_write
assert User.get_field_annotation("title", Returned) == Returned.default
assert User.get_field_annotation("title", Uniqueness) == Uniqueness.none
# user_type
assert User.get_field_root_type("user_type") is str
assert not User.get_field_multiplicity("user_type")
assert (
User.model_fields["user_type"].description
== "Used to identify the relationship between the organization and the user. Typical values used might be 'Contractor', 'Employee', 'Intern', 'Temp', 'External', and 'Unknown', but any value may be used."
)
assert User.get_field_annotation("user_type", Required) == Required.false
assert User.get_field_annotation("user_type", CaseExact) == CaseExact.false
assert User.get_field_annotation("user_type", Mutability) == Mutability.read_write
assert User.get_field_annotation("user_type", Returned) == Returned.default
assert User.get_field_annotation("user_type", Uniqueness) == Uniqueness.none
# preferred_language
assert User.get_field_root_type("preferred_language") is str
assert not User.get_field_multiplicity("preferred_language")
assert (
User.model_fields["preferred_language"].description
== "Indicates the User's preferred written or spoken language. Generally used for selecting a localized user interface; e.g., 'en_US' specifies the language English and country US."
)
assert User.get_field_annotation("preferred_language", Required) == Required.false
assert User.get_field_annotation("preferred_language", CaseExact) == CaseExact.false
assert (
User.get_field_annotation("preferred_language", Mutability)
== Mutability.read_write
)
assert User.get_field_annotation("preferred_language", Returned) == Returned.default
assert (
User.get_field_annotation("preferred_language", Uniqueness) == Uniqueness.none
)
# locale
assert User.get_field_root_type("locale") is str
assert not User.get_field_multiplicity("locale")
assert (
User.model_fields["locale"].description
== "Used to indicate the User's default location for purposes of localizing items such as currency, date time format, or numerical representations."
)
assert User.get_field_annotation("locale", Required) == Required.false
assert User.get_field_annotation("locale", CaseExact) == CaseExact.false
assert User.get_field_annotation("locale", Mutability) == Mutability.read_write
assert User.get_field_annotation("locale", Returned) == Returned.default
assert User.get_field_annotation("locale", Uniqueness) == Uniqueness.none
# timezone
assert User.get_field_root_type("timezone") is str
assert not User.get_field_multiplicity("timezone")
assert (
User.model_fields["timezone"].description
== "The User's time zone in the 'Olson' time zone database format, e.g., 'America/Los_Angeles'."
)
assert User.get_field_annotation("timezone", Required) == Required.false
assert User.get_field_annotation("timezone", CaseExact) == CaseExact.false
assert User.get_field_annotation("timezone", Mutability) == Mutability.read_write
assert User.get_field_annotation("timezone", Returned) == Returned.default
assert User.get_field_annotation("timezone", Uniqueness) == Uniqueness.none
# active
assert User.get_field_root_type("active") is bool
assert not User.get_field_multiplicity("active")
assert (
User.model_fields["active"].description
== "A Boolean value indicating the User's administrative status."
)
assert User.get_field_annotation("active", Required) == Required.false
assert User.get_field_annotation("active", CaseExact) == CaseExact.false
assert User.get_field_annotation("active", Mutability) == Mutability.read_write
assert User.get_field_annotation("active", Returned) == Returned.default
assert User.get_field_annotation("active", Uniqueness) == Uniqueness.none
# password
assert User.get_field_root_type("password") is str
assert not User.get_field_multiplicity("password")
assert (
User.model_fields["password"].description
== "The User's cleartext password. This attribute is intended to be used as a means to specify an initial password when creating a new User or to reset an existing User'spassword."
)
assert User.get_field_annotation("password", Required) == Required.false
assert User.get_field_annotation("password", CaseExact) == CaseExact.false
assert User.get_field_annotation("password", Mutability) == Mutability.write_only
assert User.get_field_annotation("password", Returned) == Returned.never
assert User.get_field_annotation("password", Uniqueness) == Uniqueness.none
# emails
Emails = User.get_field_root_type("emails")
assert Emails == User.Emails
assert issubclass(Emails, ComplexAttribute)
assert User.get_field_multiplicity("emails")
assert (
User.model_fields["emails"].description
== "Email addresses for the user. The value SHOULD be canonicalized by the service provider, e.g., 'bjensen@example.com' instead of 'bjensen@EXAMPLE.COM'. Canonical type values of 'work', 'home', and 'other'."
)
assert User.get_field_annotation("emails", Required) == Required.false
assert User.get_field_annotation("emails", CaseExact) == CaseExact.false
assert User.get_field_annotation("emails", Mutability) == Mutability.read_write
assert User.get_field_annotation("emails", Returned) == Returned.default
assert User.get_field_annotation("emails", Uniqueness) == Uniqueness.none
# email.value
assert Emails.get_field_root_type("value") is str
assert not Emails.get_field_multiplicity("value")
assert (
Emails.model_fields["value"].description
== "Email addresses for the user. The value SHOULD be canonicalized by the service provider, e.g., 'bjensen@example.com' instead of 'bjensen@EXAMPLE.COM'. Canonical type values of 'work', 'home', and 'other'."
)
assert Emails.get_field_annotation("value", Required) == Required.false
assert Emails.get_field_annotation("value", CaseExact) == CaseExact.false
assert Emails.get_field_annotation("value", Mutability) == Mutability.read_write
assert Emails.get_field_annotation("value", Returned) == Returned.default
assert Emails.get_field_annotation("value", Uniqueness) == Uniqueness.none
# email.display
assert Emails.get_field_root_type("display") is str
assert not Emails.get_field_multiplicity("display")
assert (
Emails.model_fields["display"].description
== "A human-readable name, primarily used for display purposes. READ-ONLY."
)
assert Emails.get_field_annotation("display", Required) == Required.false
assert Emails.get_field_annotation("display", CaseExact) == CaseExact.false
assert Emails.get_field_annotation("display", Mutability) == Mutability.read_write
assert Emails.get_field_annotation("display", Returned) == Returned.default
assert Emails.get_field_annotation("display", Uniqueness) == Uniqueness.none
# email.type
assert Emails.get_field_root_type("type") is str
assert not Emails.get_field_multiplicity("type")
assert (
Emails.model_fields["type"].description
== "A label indicating the attribute's function, e.g., 'work' or 'home'."
)
assert Emails.get_field_annotation("type", Required) == Required.false
assert Emails.get_field_annotation("type", CaseExact) == CaseExact.false
assert Emails.model_fields["type"].examples == ["work", "home", "other"]
assert Emails.get_field_annotation("type", Mutability) == Mutability.read_write
assert Emails.get_field_annotation("type", Returned) == Returned.default
assert Emails.get_field_annotation("type", Uniqueness) == Uniqueness.none
# email.primary
assert Emails.get_field_root_type("primary") is bool
assert not Emails.get_field_multiplicity("primary")
assert (
Emails.model_fields["primary"].description
== "A Boolean value indicating the 'primary' or preferred attribute value for this attribute, e.g., the preferred mailing address or primary email address. The primary attribute value 'True' MUST appear no more than once."
)
assert Emails.get_field_annotation("primary", Required) == Required.false
assert Emails.get_field_annotation("primary", CaseExact) == CaseExact.false
assert Emails.get_field_annotation("primary", Mutability) == Mutability.read_write
assert Emails.get_field_annotation("primary", Returned) == Returned.default
assert Emails.get_field_annotation("primary", Uniqueness) == Uniqueness.none
# phone_numbers
PhoneNumbers = User.get_field_root_type("phone_numbers")
assert PhoneNumbers == User.PhoneNumbers
assert issubclass(PhoneNumbers, ComplexAttribute)
assert User.get_field_multiplicity("phone_numbers")
assert (
User.model_fields["phone_numbers"].description
== "Phone numbers for the User. The value SHOULD be canonicalized by the service provider according to the format specified in RFC 3966, e.g., 'tel:+1-201-555-0123'. Canonical type values of 'work', 'home', 'mobile', 'fax', 'pager', and 'other'."
)
assert User.get_field_annotation("phone_numbers", Required) == Required.false
assert User.get_field_annotation("phone_numbers", CaseExact) == CaseExact.false
assert (
User.get_field_annotation("phone_numbers", Mutability) == Mutability.read_write
)
assert User.get_field_annotation("phone_numbers", Returned) == Returned.default
assert User.get_field_annotation("phone_numbers", Uniqueness) == Uniqueness.none
# phone_number.value
assert PhoneNumbers.get_field_root_type("value") is str
assert not PhoneNumbers.get_field_multiplicity("value")
assert PhoneNumbers.model_fields["value"].description == "Phone number of the User."
assert PhoneNumbers.get_field_annotation("value", Required) == Required.false
assert PhoneNumbers.get_field_annotation("value", CaseExact) == CaseExact.false
assert (
PhoneNumbers.get_field_annotation("value", Mutability) == Mutability.read_write
)
assert PhoneNumbers.get_field_annotation("value", Returned) == Returned.default
assert PhoneNumbers.get_field_annotation("value", Uniqueness) == Uniqueness.none
# phone_number.display
assert PhoneNumbers.get_field_root_type("display") is str
assert not PhoneNumbers.get_field_multiplicity("display")
assert (
PhoneNumbers.model_fields["display"].description
== "A human-readable name, primarily used for display purposes. READ-ONLY."
)
assert PhoneNumbers.get_field_annotation("display", Required) == Required.false
assert PhoneNumbers.get_field_annotation("display", CaseExact) == CaseExact.false
assert (
PhoneNumbers.get_field_annotation("display", Mutability)
== Mutability.read_write
)
assert PhoneNumbers.get_field_annotation("display", Returned) == Returned.default
assert PhoneNumbers.get_field_annotation("display", Uniqueness) == Uniqueness.none
# phone_number.type
assert PhoneNumbers.get_field_root_type("type") is str
assert not PhoneNumbers.get_field_multiplicity("type")
assert (
PhoneNumbers.model_fields["type"].description
== "A label indicating the attribute's function, e.g., 'work', 'home', 'mobile'."
)
assert PhoneNumbers.get_field_annotation("type", Required) == Required.false
assert PhoneNumbers.get_field_annotation("type", CaseExact) == CaseExact.false
assert PhoneNumbers.model_fields["type"].examples == [
"work",
"home",
"mobile",
"fax",
"pager",
"other",
]
assert (
PhoneNumbers.get_field_annotation("type", Mutability) == Mutability.read_write
)
assert PhoneNumbers.get_field_annotation("type", Returned) == Returned.default
assert PhoneNumbers.get_field_annotation("type", Uniqueness) == Uniqueness.none
# phone_number.primary
assert PhoneNumbers.get_field_root_type("primary") is bool
assert not PhoneNumbers.get_field_multiplicity("primary")
assert (
PhoneNumbers.model_fields["primary"].description
== "A Boolean value indicating the 'primary' or preferred attribute value for this attribute, e.g., the preferred phone number or primary phone number. The primary attribute value 'True' MUST appear no more than once."
)
assert PhoneNumbers.get_field_annotation("primary", Required) == Required.false
assert PhoneNumbers.get_field_annotation("primary", CaseExact) == CaseExact.false
assert (
PhoneNumbers.get_field_annotation("primary", Mutability)
== Mutability.read_write
)
assert PhoneNumbers.get_field_annotation("primary", Returned) == Returned.default
assert PhoneNumbers.get_field_annotation("primary", Uniqueness) == Uniqueness.none
# ims
Ims = User.get_field_root_type("ims")
assert Ims == User.Ims
assert issubclass(Ims, ComplexAttribute)
assert User.get_field_multiplicity("ims")
assert (
User.model_fields["ims"].description
== "Instant messaging addresses for the User."
)
assert User.get_field_annotation("ims", Required) == Required.false
assert User.get_field_annotation("ims", CaseExact) == CaseExact.false
assert User.get_field_annotation("ims", Mutability) == Mutability.read_write
assert User.get_field_annotation("ims", Returned) == Returned.default
assert User.get_field_annotation("ims", Uniqueness) == Uniqueness.none
# im.value
assert Ims.get_field_root_type("value") is str
assert not Ims.get_field_multiplicity("value")
assert (
Ims.model_fields["value"].description
== "Instant messaging address for the User."
)
assert Ims.get_field_annotation("value", Required) == Required.false
assert Ims.get_field_annotation("value", CaseExact) == CaseExact.false
assert Ims.get_field_annotation("value", Mutability) == Mutability.read_write
assert Ims.get_field_annotation("value", Returned) == Returned.default
assert Ims.get_field_annotation("value", Uniqueness) == Uniqueness.none
# im.display
assert Ims.get_field_root_type("display") is str
assert not Ims.get_field_multiplicity("display")
assert (
Ims.model_fields["display"].description
== "A human-readable name, primarily used for display purposes. READ-ONLY."
)
assert Ims.get_field_annotation("display", Required) == Required.false
assert Ims.get_field_annotation("display", CaseExact) == CaseExact.false
assert Ims.get_field_annotation("display", Mutability) == Mutability.read_write
assert Ims.get_field_annotation("display", Returned) == Returned.default
assert Ims.get_field_annotation("display", Uniqueness) == Uniqueness.none
# im.type
assert Ims.get_field_root_type("type") is str
assert not Ims.get_field_multiplicity("type")
assert (
Ims.model_fields["type"].description
== "A label indicating the attribute's function, e.g., 'aim', 'gtalk', 'xmpp'."
)
assert Ims.get_field_annotation("type", Required) == Required.false
assert Ims.get_field_annotation("type", CaseExact) == CaseExact.false
assert Ims.model_fields["type"].examples == [
"aim",
"gtalk",
"icq",
"xmpp",
"msn",
"skype",
"qq",
"yahoo",
]
assert Ims.get_field_annotation("type", Mutability) == Mutability.read_write
assert Ims.get_field_annotation("type", Returned) == Returned.default
assert Ims.get_field_annotation("type", Uniqueness) == Uniqueness.none
# im.primary
assert Ims.get_field_root_type("primary") is bool
assert not Ims.get_field_multiplicity("primary")
assert (
Ims.model_fields["primary"].description
== "A Boolean value indicating the 'primary' or preferred attribute value for this attribute, e.g., the preferred messenger or primary messenger. The primary attribute value 'True' MUST appear no more than once."
)
assert Ims.get_field_annotation("primary", Required) == Required.false
assert Ims.get_field_annotation("primary", CaseExact) == CaseExact.false
assert Ims.get_field_annotation("primary", Mutability) == Mutability.read_write
assert Ims.get_field_annotation("primary", Returned) == Returned.default
assert Ims.get_field_annotation("primary", Uniqueness) == Uniqueness.none
# photos
Photos = User.get_field_root_type("photos")
assert Photos == User.Photos
assert issubclass(Photos, ComplexAttribute)
assert User.get_field_multiplicity("photos")
assert User.model_fields["photos"].description == "URLs of photos of the User."
assert User.get_field_annotation("photos", Required) == Required.false
assert User.get_field_annotation("photos", CaseExact) == CaseExact.false
assert User.get_field_annotation("photos", Mutability) == Mutability.read_write
assert User.get_field_annotation("photos", Returned) == Returned.default
assert User.get_field_annotation("photos", Uniqueness) == Uniqueness.none
# photo.value
assert Photos.get_field_root_type("value") == Reference[External]
assert not Photos.get_field_multiplicity("value")
assert Photos.model_fields["value"].description == "URL of a photo of the User."
assert Photos.get_field_annotation("value", Required) == Required.false
assert Photos.get_field_annotation("value", CaseExact) == CaseExact.true
assert Photos.get_field_annotation("value", Mutability) == Mutability.read_write
assert Photos.get_field_annotation("value", Returned) == Returned.default
assert Photos.get_field_annotation("value", Uniqueness) == Uniqueness.none
# photo.display
assert Photos.get_field_root_type("display") is str
assert not Photos.get_field_multiplicity("display")
assert (
Photos.model_fields["display"].description
== "A human-readable name, primarily used for display purposes. READ-ONLY."
)
assert Photos.get_field_annotation("display", Required) == Required.false
assert Photos.get_field_annotation("display", CaseExact) == CaseExact.false
assert Photos.get_field_annotation("display", Mutability) == Mutability.read_write
assert Photos.get_field_annotation("display", Returned) == Returned.default
assert Photos.get_field_annotation("display", Uniqueness) == Uniqueness.none
# photo.type
assert Photos.get_field_root_type("type") is str
assert not Photos.get_field_multiplicity("type")
assert (
Photos.model_fields["type"].description
== "A label indicating the attribute's function, i.e., 'photo' or 'thumbnail'."
)
assert Photos.get_field_annotation("type", Required) == Required.false
assert Photos.get_field_annotation("type", CaseExact) == CaseExact.false
assert Photos.model_fields["type"].examples == ["photo", "thumbnail"]
assert Photos.get_field_annotation("type", Mutability) == Mutability.read_write
assert Photos.get_field_annotation("type", Returned) == Returned.default
assert Photos.get_field_annotation("type", Uniqueness) == Uniqueness.none
# photo.primary
assert Photos.get_field_root_type("primary") is bool
assert not Photos.get_field_multiplicity("primary")
assert (
Photos.model_fields["primary"].description
== "A Boolean value indicating the 'primary' or preferred attribute value for this attribute, e.g., the preferred photo or thumbnail. The primary attribute value 'True' MUST appear no more than once."
)
assert Photos.get_field_annotation("primary", Required) == Required.false
assert Photos.get_field_annotation("primary", CaseExact) == CaseExact.false
assert Photos.get_field_annotation("primary", Mutability) == Mutability.read_write
assert Photos.get_field_annotation("primary", Returned) == Returned.default
assert Photos.get_field_annotation("primary", Uniqueness) == Uniqueness.none
# addresses
Addresses = User.get_field_root_type("addresses")
assert Addresses == User.Addresses
assert issubclass(Addresses, ComplexAttribute)
assert User.get_field_multiplicity("addresses")
assert (
User.model_fields["addresses"].description
== "A physical mailing address for this User. Canonical type values of 'work', 'home', and 'other'. This attribute is a complex type with the following sub-attributes."
)
assert User.get_field_annotation("addresses", Required) == Required.false
assert User.get_field_annotation("addresses", CaseExact) == CaseExact.false
assert User.get_field_annotation("addresses", Mutability) == Mutability.read_write
assert User.get_field_annotation("addresses", Returned) == Returned.default
assert User.get_field_annotation("addresses", Uniqueness) == Uniqueness.none
# address.formatted
assert Addresses.get_field_root_type("formatted") is str
assert not Addresses.get_field_multiplicity("formatted")
assert (
Addresses.model_fields["formatted"].description
== "The full mailing address, formatted for display or use with a mailing label. This attribute MAY contain newlines."
)
assert Addresses.get_field_annotation("formatted", Required) == Required.false
assert Addresses.get_field_annotation("formatted", CaseExact) == CaseExact.false
assert (
Addresses.get_field_annotation("formatted", Mutability) == Mutability.read_write
)
assert Addresses.get_field_annotation("formatted", Returned) == Returned.default
assert Addresses.get_field_annotation("formatted", Uniqueness) == Uniqueness.none
# address.street_address
assert Addresses.get_field_root_type("street_address") is str
assert not Addresses.get_field_multiplicity("street_address")
assert (
Addresses.model_fields["street_address"].description
== "The full street address component, which may include house number, street name, P.O. box, and multi-line extended street address information. This attribute MAY contain newlines."
)
assert Addresses.get_field_annotation("street_address", Required) == Required.false
assert (
Addresses.get_field_annotation("street_address", CaseExact) == CaseExact.false
)
assert (
Addresses.get_field_annotation("street_address", Mutability)
== Mutability.read_write
)
assert (
Addresses.get_field_annotation("street_address", Returned) == Returned.default
)
assert (
Addresses.get_field_annotation("street_address", Uniqueness) == Uniqueness.none
)
# address.locality
assert Addresses.get_field_root_type("locality") is str
assert not Addresses.get_field_multiplicity("locality")
assert (
Addresses.model_fields["locality"].description
== "The city or locality component."
)
assert Addresses.get_field_annotation("locality", Required) == Required.false
assert Addresses.get_field_annotation("locality", CaseExact) == CaseExact.false
assert (
Addresses.get_field_annotation("locality", Mutability) == Mutability.read_write
)
assert Addresses.get_field_annotation("locality", Returned) == Returned.default
assert Addresses.get_field_annotation("locality", Uniqueness) == Uniqueness.none
# address.region
assert Addresses.get_field_root_type("region") is str
assert not Addresses.get_field_multiplicity("region")
assert (
Addresses.model_fields["region"].description == "The state or region component."
)
assert Addresses.get_field_annotation("region", Required) == Required.false
assert Addresses.get_field_annotation("region", CaseExact) == CaseExact.false
assert Addresses.get_field_annotation("region", Mutability) == Mutability.read_write
assert Addresses.get_field_annotation("region", Returned) == Returned.default
assert Addresses.get_field_annotation("region", Uniqueness) == Uniqueness.none
# address.postal_code
assert Addresses.get_field_root_type("postal_code") is str
assert not Addresses.get_field_multiplicity("postal_code")
assert (
Addresses.model_fields["postal_code"].description
== "The zip code or postal code component."
)
assert Addresses.get_field_annotation("postal_code", Required) == Required.false
assert Addresses.get_field_annotation("postal_code", CaseExact) == CaseExact.false
assert (
Addresses.get_field_annotation("postal_code", Mutability)
== Mutability.read_write
)
assert Addresses.get_field_annotation("postal_code", Returned) == Returned.default
assert Addresses.get_field_annotation("postal_code", Uniqueness) == Uniqueness.none
# address.country
assert Addresses.get_field_root_type("country") is str
assert not Addresses.get_field_multiplicity("country")
assert (
Addresses.model_fields["country"].description == "The country name component."
)
assert Addresses.get_field_annotation("country", Required) == Required.false
assert Addresses.get_field_annotation("country", CaseExact) == CaseExact.false
assert (
Addresses.get_field_annotation("country", Mutability) == Mutability.read_write
)
assert Addresses.get_field_annotation("country", Returned) == Returned.default
assert Addresses.get_field_annotation("country", Uniqueness) == Uniqueness.none
# address.type
assert Addresses.get_field_root_type("type") is str
assert not Addresses.get_field_multiplicity("type")
assert (
Addresses.model_fields["type"].description
== "A label indicating the attribute's function, e.g., 'work' or 'home'."
)
assert Addresses.get_field_annotation("type", Required) == Required.false
assert Addresses.get_field_annotation("type", CaseExact) == CaseExact.false
assert Addresses.model_fields["type"].examples == ["work", "home", "other"]
assert Addresses.get_field_annotation("type", Mutability) == Mutability.read_write
assert Addresses.get_field_annotation("type", Returned) == Returned.default
assert Addresses.get_field_annotation("type", Uniqueness) == Uniqueness.none
# address.primary
assert Addresses.get_field_root_type("primary") is bool
assert not Addresses.get_field_multiplicity("primary")
assert (
Addresses.model_fields["primary"].description
== "A Boolean value indicating the 'primary' or preferred attribute value for this attribute, e.g., the preferred mailing address or primary email address. The primary attribute value 'True' MUST appear no more than once."
)
assert Addresses.get_field_annotation("primary", Required) == Required.false
assert Addresses.get_field_annotation("primary", CaseExact) == CaseExact.false
assert (
Addresses.get_field_annotation("primary", Mutability) == Mutability.read_write
)
assert Addresses.get_field_annotation("primary", Returned) == Returned.default
assert Addresses.get_field_annotation("primary", Uniqueness) == Uniqueness.none
# groups
Groups = User.get_field_root_type("groups")
assert Groups == User.Groups
assert issubclass(Groups, ComplexAttribute)
assert User.get_field_multiplicity("groups")
assert (
User.model_fields["groups"].description
== "A list of groups to which the user belongs, either through direct membership, through nested groups, or dynamically calculated."
)
assert User.get_field_annotation("groups", Required) == Required.false
assert User.get_field_annotation("groups", CaseExact) == CaseExact.false
assert User.get_field_annotation("groups", Mutability) == Mutability.read_only
assert User.get_field_annotation("groups", Returned) == Returned.default
assert User.get_field_annotation("groups", Uniqueness) == Uniqueness.none
# group.value
assert Groups.get_field_root_type("value") is str
assert not Groups.get_field_multiplicity("value")
assert (
Groups.model_fields["value"].description
== "The identifier of the User's group."
)
assert Groups.get_field_annotation("value", Required) == Required.false
assert Groups.get_field_annotation("value", CaseExact) == CaseExact.false
assert Groups.get_field_annotation("value", Mutability) == Mutability.read_only
assert Groups.get_field_annotation("value", Returned) == Returned.default
assert Groups.get_field_annotation("value", Uniqueness) == Uniqueness.none
# group.ref
assert Groups.get_field_root_type("ref") == Reference["Group"] # noqa: F821
assert not Groups.get_field_multiplicity("ref")
assert (
Groups.model_fields["ref"].description
== "The URI of the corresponding 'Group' resource to which the user belongs."
)
assert Groups.get_field_annotation("ref", Required) == Required.false
assert Groups.get_field_annotation("ref", CaseExact) == CaseExact.false
assert Groups.get_field_annotation("ref", Mutability) == Mutability.read_only
assert Groups.get_field_annotation("ref", Returned) == Returned.default
assert Groups.get_field_annotation("ref", Uniqueness) == Uniqueness.none
# group.display
assert Groups.get_field_root_type("display") is str
assert not Groups.get_field_multiplicity("display")
assert (
Groups.model_fields["display"].description
== "A human-readable name, primarily used for display purposes. READ-ONLY."
)
assert Groups.get_field_annotation("display", Required) == Required.false
assert Groups.get_field_annotation("display", CaseExact) == CaseExact.false
assert Groups.get_field_annotation("display", Mutability) == Mutability.read_only
assert Groups.get_field_annotation("display", Returned) == Returned.default
assert Groups.get_field_annotation("display", Uniqueness) == Uniqueness.none
# group.type
assert Groups.get_field_root_type("type") is str
assert not Groups.get_field_multiplicity("type")
assert (
Groups.model_fields["type"].description
== "A label indicating the attribute's function, e.g., 'direct' or 'indirect'."
)
assert Groups.get_field_annotation("type", Required) == Required.false
assert Groups.get_field_annotation("type", CaseExact) == CaseExact.false
assert Groups.model_fields["type"].examples == [
"direct",
"indirect",
]
assert Groups.get_field_annotation("type", Mutability) == Mutability.read_only
assert Groups.get_field_annotation("type", Returned) == Returned.default
assert Groups.get_field_annotation("type", Uniqueness) == Uniqueness.none
# entitlements
Entitlements = User.get_field_root_type("entitlements")
assert Entitlements == User.Entitlements
assert issubclass(Entitlements, ComplexAttribute)
assert User.get_field_multiplicity("entitlements")
assert (
User.model_fields["entitlements"].description
== "A list of entitlements for the User that represent a thing the User has."
)
assert User.get_field_annotation("entitlements", Required) == Required.false
assert User.get_field_annotation("entitlements", CaseExact) == CaseExact.false
assert (
User.get_field_annotation("entitlements", Mutability) == Mutability.read_write
)
assert User.get_field_annotation("entitlements", Returned) == Returned.default
assert User.get_field_annotation("entitlements", Uniqueness) == Uniqueness.none
# entitlement.value
assert Entitlements.get_field_root_type("value") is str
assert not Entitlements.get_field_multiplicity("value")
assert (
Entitlements.model_fields["value"].description == "The value of an entitlement."
)
assert Entitlements.get_field_annotation("value", Required) == Required.false
assert Entitlements.get_field_annotation("value", CaseExact) == CaseExact.false
assert (
Entitlements.get_field_annotation("value", Mutability) == Mutability.read_write
)
assert Entitlements.get_field_annotation("value", Returned) == Returned.default
assert Entitlements.get_field_annotation("value", Uniqueness) == Uniqueness.none
# entitlement.display
assert Entitlements.get_field_root_type("display") is str
assert not Entitlements.get_field_multiplicity("display")
assert (
Entitlements.model_fields["display"].description
== "A human-readable name, primarily used for display purposes. READ-ONLY."
)
assert Entitlements.get_field_annotation("display", Required) == Required.false
assert Entitlements.get_field_annotation("display", CaseExact) == CaseExact.false
assert (
Entitlements.get_field_annotation("display", Mutability)
== Mutability.read_write
)
assert Entitlements.get_field_annotation("display", Returned) == Returned.default
assert Entitlements.get_field_annotation("display", Uniqueness) == Uniqueness.none
# entitlement.type
assert Entitlements.get_field_root_type("type") is str
assert not Entitlements.get_field_multiplicity("type")
assert (
Entitlements.model_fields["type"].description
== "A label indicating the attribute's function."
)
assert Entitlements.get_field_annotation("type", Required) == Required.false
assert Entitlements.get_field_annotation("type", CaseExact) == CaseExact.false
assert (
Entitlements.get_field_annotation("type", Mutability) == Mutability.read_write
)
assert Entitlements.get_field_annotation("type", Returned) == Returned.default
assert Entitlements.get_field_annotation("type", Uniqueness) == Uniqueness.none
# entitlement.primary
assert Entitlements.get_field_root_type("primary") is bool
assert not Entitlements.get_field_multiplicity("primary")
assert (
Entitlements.model_fields["primary"].description
== "A Boolean value indicating the 'primary' or preferred attribute value for this attribute. The primary attribute value 'True' MUST appear no more than once."
)
assert Entitlements.get_field_annotation("primary", Required) == Required.false
assert Entitlements.get_field_annotation("primary", CaseExact) == CaseExact.false
assert (
Entitlements.get_field_annotation("primary", Mutability)
== Mutability.read_write
)
assert Entitlements.get_field_annotation("primary", Returned) == Returned.default
assert Entitlements.get_field_annotation("primary", Uniqueness) == Uniqueness.none
# roles
Roles = User.get_field_root_type("roles")
assert Roles == User.Roles
assert issubclass(Roles, ComplexAttribute)
assert User.get_field_multiplicity("roles")
assert (
User.model_fields["roles"].description
== "A list of roles for the User that collectively represent who the User is, e.g., 'Student', 'Faculty'."
)
assert User.get_field_annotation("roles", Required) == Required.false
assert User.get_field_annotation("roles", CaseExact) == CaseExact.false
assert User.get_field_annotation("roles", Mutability) == Mutability.read_write
assert User.get_field_annotation("roles", Returned) == Returned.default
assert User.get_field_annotation("roles", Uniqueness) == Uniqueness.none
# role.value
assert Roles.get_field_root_type("value") is str
assert not Roles.get_field_multiplicity("value")
assert Roles.model_fields["value"].description == "The value of a role."
assert Roles.get_field_annotation("value", Required) == Required.false
assert Roles.get_field_annotation("value", CaseExact) == CaseExact.false