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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
|
# Copyright (C) 2018-present MongoDB, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the Server Side Public License, version 1,
# as published by MongoDB, Inc.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Server Side Public License for more details.
#
# You should have received a copy of the Server Side Public License
# along with this program. If not, see
# <http://www.mongodb.com/licensing/server-side-public-license>.
#
# As a special exception, the copyright holders give permission to link the
# code of portions of this program with the OpenSSL library under certain
# conditions as described in each individual source file and distribute
# linked combinations including the program with the OpenSSL library. You
# must comply with the Server Side Public License in all respects for
# all of the code used other than as permitted herein. If you modify file(s)
# with this exception, you may extend this exception to your version of the
# file(s), but you are not obligated to do so. If you do not wish to do so,
# delete this exception statement from your version. If you delete this
# exception statement from all source files in the program, then also delete
# it in the license file.
#
# IDL Unit Tests IDL file
global:
# Use a nested namespace simply to exercise nested namespace support for the code generator.
cpp_namespace: "mongo::idl::test"
cpp_includes:
- "mongo/idl/idl_test_types.h"
- "mongo/idl/idl_test.h"
imports:
- "mongo/idl/basic_types.idl"
- "mongo/idl/unittest_import.idl"
types:
##################################################################################################
#
# Test a custom non-BSONElement deserialization and serialization methods for a bindata type
#
##################################################################################################
bindata_custom:
bson_serialization_type: bindata
bindata_subtype: generic
description: "A MongoDB BinDataCustomType"
cpp_type: "mongo::BinDataCustomType"
serializer: mongo::BinDataCustomType::serializeToBSON
deserializer: mongo::BinDataCustomType::parseFromBSON
##################################################################################################
#
# Test a custom non-BSONElement deserialization and serialization methods for an any type
#
##################################################################################################
any_basic_type:
bson_serialization_type: any
description: "An Any Type"
cpp_type: "mongo::AnyBasicType"
serializer: mongo::AnyBasicType::serializeToBSON
deserializer: mongo::AnyBasicType::parseFromBSON
##################################################################################################
#
# Test a custom non-BSONElement deserialization and serialization methods for an object type
#
##################################################################################################
object_basic_type:
bson_serialization_type: object
description: "An object Type"
cpp_type: "mongo::ObjectBasicType"
serializer: mongo::ObjectBasicType::serializeToBSON
deserializer: mongo::ObjectBasicType::parseFromBSON
##################################################################################################
#
# Test types used in parser chaining testing
#
##################################################################################################
ChainedType:
bson_serialization_type: chain
description: "An Chain Type to test chaining"
cpp_type: "mongo::ChainedType"
serializer: mongo::ChainedType::serializeToBSON
deserializer: mongo::ChainedType::parseFromBSON
AnotherChainedType:
bson_serialization_type: chain
description: "Another Chain Type to test chaining"
cpp_type: "mongo::AnotherChainedType"
serializer: mongo::AnotherChainedType::serializeToBSON
deserializer: mongo::AnotherChainedType::parseFromBSON
##################################################################################################
#
# Unit test structs for a single value to ensure type validation works correctly
#
##################################################################################################
enums:
StringEnum:
description: "An example string enum"
type: string
values:
s0: "zero"
s1: "one"
s2: "two"
structs:
one_plain_object:
description: UnitTest for a single BSONObj
generate_comparison_operators: true
fields:
value: object
one_plain_optional_object:
description: UnitTest for optional BSONObj
generate_comparison_operators: true
fields:
value: object
value2: object
opt_value:
type: object
optional: true
opt_value2:
type: object
optional: true
reply_type_struct:
description: Used for testing the IDL command reply_type field
fields:
reply_field: int
##################################################################################################
#
# Structs to test derived parsers
#
##################################################################################################
DerivedBaseStruct:
description: UnitTest for parser that will derive from a type
fields:
field1: int
field2: int
##################################################################################################
#
# Structs to test various options for structs/fields
#
##################################################################################################
RequiredStrictField3:
description: UnitTest for a strict struct with 3 required fields
fields:
field1: int
field2: int
field3: int
RequiredNonStrictField3:
description: UnitTest for a non-strict struct with 3 required fields
strict: false
fields:
1:
type: int
cpp_name: cppField1
2:
type: int
cpp_name: cppField2
3:
type: int
cpp_name: cppField3
##################################################################################################
#
# Structs to test comparison options
#
##################################################################################################
CompareAllField3:
description: UnitTest for a struct with 3 int fields to test comparison
generate_comparison_operators: true
fields:
field1: int
field2: int
field3: int
CompareSomeField3:
description: |
UnitTest for a struct with 3 int fields to test comparison, but only 2 are compared.
generate_comparison_operators: true
fields:
field3:
type: int
comparison_order: 3
field2: int
field1:
type: int
comparison_order: 1
##################################################################################################
#
# Nested Structs with duplicate types
#
##################################################################################################
NestedWithDuplicateTypes:
description: UnitTest for a non-strict struct with 3 required fields
strict: false
fields:
field1: RequiredStrictField3
field2:
type: RequiredNonStrictField3
optional: true
field3: RequiredStrictField3
##################################################################################################
#
# Structs to test various options for fields
#
##################################################################################################
ignoredField:
description: UnitTest for a struct with an ignored_field
fields:
required_field: int
ignored_field:
type: int
ignore: true
##################################################################################################
#
# Test a custom non-BSONElement deserialization and serialization methods for a string type
#
##################################################################################################
one_namespacestring:
description: UnitTest for a single namespacestring
fields:
value: namespacestring
##################################################################################################
#
# Test a custom non-BSONElement deserialization and serialization methods for a bindata type
#
##################################################################################################
one_bindata_custom:
description: UnitTest for a custom bindata
fields:
value: bindata_custom
##################################################################################################
#
# Test a custom non-BSONElement deserialization and serialization methods for an any type
#
##################################################################################################
one_any_basic_type:
description: UnitTest for a single any type
fields:
value: any_basic_type
##################################################################################################
#
# Test a custom non-BSONElement deserialization and serialization methods for an object type
#
##################################################################################################
one_object_basic_type:
description: UnitTest for a single object type
fields:
value: object_basic_type
##################################################################################################
#
# Test types that accept multiple serialization types
#
##################################################################################################
one_safeint64:
description: UnitTest for a single safeInt64
fields:
value: safeInt64
##################################################################################################
#
# Test fields with default values
#
##################################################################################################
default_values:
description: UnitTest for default values
fields:
V_string:
type: string
default: '"a default"'
V_int:
type: int
default: 42
V_long:
type: long
default: 423
V_double:
type: double
default: 3.14159
V_bool:
type: bool
default: true
##################################################################################################
#
# Test fields with optional values
#
##################################################################################################
optional_field:
description: UnitTest for a optional field
fields:
field1:
type: string
optional: true
field2:
type: int
optional: true
field3:
type: object
optional: true
field4:
type: bindata_generic
optional: true
field5:
type: bindata_uuid
optional: true
always_serialize_field:
description: UnitTest for always_serialize fields
fields:
field1:
type: string
always_serialize: true
optional: true
field2:
type: int
always_serialize: true
optional: true
field3:
type: object
always_serialize: true
optional: true
field4:
type: object
always_serialize: true
optional: true
field5:
type: object
always_serialize: false
optional: true
##################################################################################################
#
# Test array of simple types
#
##################################################################################################
simple_int_array:
description: UnitTest for arrays of ints
fields:
field1:
type: array<int>
simple_array_fields:
description: UnitTest for arrays of simple types
fields:
field1:
type: array<string>
field2:
type: array<int>
field3:
type: array<double>
field4:
type: array<bindata_generic>
field5:
type: array<bindata_uuid>
optional_array_fields:
description: UnitTest for arrays of optional simple types
fields:
field1:
type: array<string>
optional: true
field2:
type: array<int>
optional: true
field3:
type: array<double>
optional: true
field4:
type: array<bindata_generic>
optional: true
field5:
type: array<bindata_uuid>
optional: true
##################################################################################################
#
# Test array of complex types
#
##################################################################################################
complex_array_fields:
description: UnitTest for arrays of complex optional and non-optional simple types
fields:
field1:
type: array<safeInt64>
field2:
type: array<namespacestring>
field3:
type: array<any_basic_type>
field4:
type: array<object_basic_type>
field5:
type: array<object>
field6:
type: array<one_string>
field1o:
type: array<safeInt64>
optional: true
field2o:
type: array<namespacestring>
optional: true
field3o:
type: array<any_basic_type>
optional: true
field4o:
type: array<object_basic_type>
optional: true
field5o:
type: array<object>
optional: true
field6o:
type: array<one_string>
optional: true
##################################################################################################
#
# Test Chained Types
#
##################################################################################################
chained_string_basic_type:
description: Base struct type for a chained string
strict: false
fields:
stringField: string
chained_any_basic_type:
description: Base struct type for a chained any
strict: false
fields:
anyField: any_basic_type
chained_object_basic_type:
description: Base struct type for a chained object
strict: false
fields:
objectField: object_basic_type
chained_struct_only:
description: UnitTest for chained struct with only chained types
strict: false
chained_types:
ChainedType : ChainedType
AnotherChainedType : AnotherChainedType
chained_struct_mixed:
description: Chained struct with chained structs and fields
strict: true
inline_chained_structs: false
chained_structs:
chained_any_basic_type : chained_any_basic_type
chained_object_basic_type : ChainedObjectBasicType
fields:
field3: string
chained_struct_type_mixed:
description: Chained struct with chained types, structs, and fields
strict: false
chained_types:
ChainedType : chained_type
AnotherChainedType:
cpp_name: AnotherChainedType
chained_structs:
chained_string_basic_type:
cpp_name: ChainedStringBasicType
fields:
field3:
type: int
chained_string_inline_basic_type:
description: Base struct type for a chained string
strict: true
fields:
stringField: string
field1o:
type: string
optional: true
field2o:
type: int
optional: true
field3o:
type: object
optional: true
field4o:
type: bindata_generic
optional: true
field5o:
type: bindata_uuid
optional: true
chained_struct_inline:
description: Chained struct with chained structs and fields
strict: true
inline_chained_structs: true
chained_structs:
chained_string_inline_basic_type : chained_string_inline_basic_type
fields:
field3: string
##################################################################################################
#
# Test struct with enum
#
##################################################################################################
one_int_enum:
description: mock
fields:
value: IntEnum
one_string_enum:
description: mock
fields:
value: StringEnum
StructWithEnum:
description: mock
fields:
field1: IntEnum
field2: StringEnum
field1o:
type: IntEnum
optional: true
field2o:
type: StringEnum
optional: true
fieldDefault:
type: StringEnum
default: s1
##################################################################################################
#
# Test struct with variant
#
##################################################################################################
one_variant:
description: UnitTest for a single variant which accepts int or string
strict: false
fields:
value:
type:
variant: [int, string]
one_variant_safeInt:
description: UnitTest for a single variant with an alternative type which has multiple
BSON serialization types
strict: false
fields:
value:
type:
variant: [safeInt, string]
one_variant_compound:
description: UnitTest for a single variant which accepts string, doc, or array of string
strict: false
fields:
value:
type:
variant:
- string
- object
- array<string>
one_variant_struct:
description: UnitTest for a single variant which accepts an int or a struct
strict: false
fields:
value:
type:
variant:
- int
- one_string
one_variant_safeInt_array:
description: UnitTest for a single variant which accepts a string or array of safeInt
strict: false
fields:
value:
type:
variant:
- string
- array<safeInt>
one_variant_struct_array:
description: UnitTest for a single variant which accepts an int or array of structs
strict: false
fields:
value:
type:
variant:
- int
- array<one_string>
one_variant_two_arrays:
description: UnitTest for a single variant which accepts array of int or array of string
strict: false
fields:
value:
type:
variant:
- array<int>
- array<string>
one_variant_optional:
description: UnitTest for a single optional variant
strict: false
fields:
value:
type:
variant: [int, string]
optional: true
two_variants:
description: UnitTest for a struct with two variant fields
strict: false
fields:
value0:
type:
variant: [int, string]
value1:
type:
variant: [object, array<string>]
chained_struct_variant:
description: Struct with chained variant
strict: false
inline_chained_structs: false
chained_structs:
one_variant_compound: one_variant_compound
fields:
field1: string
chained_struct_variant_inline:
description: Struct with inline chained variant
strict: false
inline_chained_structs: true
chained_structs:
one_variant_compound: one_variant_compound
fields:
field1: string
chained_struct_variant_struct:
description: Struct with chained variant that has a struct alternative type
strict: false
inline_chained_structs: false
chained_structs:
one_variant_struct: one_variant_struct
fields:
field1: string
chained_struct_variant_struct_inline:
description: Struct with inline chained variant that has a struct alternative type
strict: false
inline_chained_structs: true
chained_structs:
one_variant_struct: one_variant_struct
fields:
field1: string
##################################################################################################
#
# Using Validators
#
##################################################################################################
int_basic_ranges:
description: Struct using basic range validators on ints
fields:
positive_int:
type: int
validator: { gt: 0 }
negative_int:
type: int
validator: { lt: 0 }
non_negative_int:
type: int
validator: { gte: 0 }
non_positive_int:
type: int
validator: { lte: 0 }
byte_range_int:
type: int
validator: { gte: 0, lt: 256 }
range_int:
type: int
# Use INT32_MIN+1 for min since MSVC does not like -2147483647 as a constant.
validator: { gte: -2147483647, lte: 2147483647 }
double_basic_ranges:
description: Struct using basic range validators on doubles
fields:
positive_double:
type: double
validator: { gt: 0.0 }
negative_double:
type: double
validator: { lt: 0.0 }
non_negative_double:
type: double
validator: { gte: 0.0 }
non_positive_double:
type: double
validator: { lte: 0.0 }
range_double:
type: double
validator: { gte: -12345678901234500000, lte: 12345678901234500000 }
callback_validators:
description: Struct using fields with callback validators
fields:
int_even:
type: int
validator: { callback: 'validateEvenNumber' }
double_nearly_int:
type: double
validator: { callback: 'validateNearlyInt' }
string_starts_with_x:
type: string
validator: { callback: "validateStartsWith<'x'>" }
string_starts_with_x2:
type: string
optional: true
validator: { callback: "validateStartsWith<'x'>" }
chained_validators:
description: Uses a chained struct that includes fields with validators
chained_structs:
int_basic_ranges: int_basic_ranges
unusual_callback_validators:
description: Struct using fields with unusual callback validators
fields:
int_even:
type: int
optional: true
validator: { callback: 'validateEvenNumber' }
string_starts_with_x:
type: string
optional: true
validator: { callback: "validateStartsWith<'x'>" }
array_of_int:
type: array<int>
validator: { callback: "validateEvenNumber" }
array_of_int_optional:
type: array<int>
optional: true
validator: { callback: "validateEvenNumber" }
one_int:
type: one_int
validator: { callback: 'validateOneInt' }
one_int_optional:
type: one_int
optional: true
validator: { callback: 'validateOneInt' }
one_int_array:
type: array<one_int>
validator: { callback: 'validateOneInt' }
##################################################################################################
#
# Test commands
#
##################################################################################################
commands:
BasicIgnoredCommand:
description: UnitTest for a basic ignored command
command_name: BasicIgnoredCommand
namespace: ignored
api_version: ""
fields:
field1: int
field2: string
BasicConcatenateWithDbCommand:
description: UnitTest for a basic concatenate_with_db command
command_name: BasicConcatenateWithDbCommand
namespace: concatenate_with_db
api_version: ""
fields:
field1: int
field2: string
BasicConcatenateWithDbOrUUIDCommand:
description: UnitTest for a basic concatenate_with_db_or_uuid command
command_name: BasicConcatenateWithDbOrUUIDCommand
namespace: concatenate_with_db_or_uuid
api_version: ""
fields:
field1: int
field2: string
BasicNamespaceConstGetterCommand:
description: UnitTest for a basic concatenate_with_db_or_uuid command
command_name: BasicNamespaceConstGetterCommand
namespace: concatenate_with_db_or_uuid
api_version: ""
non_const_getter: true
fields:
field1: int
KnownFieldCommand:
description: UnitTest for a command that has a field that is special known generic command field
command_name: KnownFieldCommand
namespace: concatenate_with_db
api_version: ""
fields:
field1: int
maxTimeMS: int
DocSequenceCommand:
description: UnitTest for a basic command with fields marked with supports_doc_sequence
command_name: DocSequenceCommand
namespace: concatenate_with_db
api_version: ""
fields:
field1: int
field2: string
structs:
type: array<one_string>
supports_doc_sequence: true
objects:
type: array<object>
supports_doc_sequence: true
objects_custom:
type: array<object_basic_type>
supports_doc_sequence: true
optional: true
DocSequenceCommandNonStrict:
description: UnitTest for a basic command with fields marked with supports_doc_sequence and non-strict parsing
command_name: DocSequenceCommandNonStrict
namespace: concatenate_with_db
api_version: ""
strict: false
fields:
field1: int
field2: string
structs:
type: array<one_string>
supports_doc_sequence: true
objects:
type: array<object>
supports_doc_sequence: true
objects_custom:
type: array<object_basic_type>
supports_doc_sequence: true
optional: true
chained_command_type_mixed:
description: Chained command with chained types, structs, and fields
command_name: chained_command_type_mixed
namespace: concatenate_with_db
api_version: ""
strict: false
chained_types:
ChainedType : chained_type
AnotherChainedType:
cpp_name: AnotherChainedType
chained_structs:
chained_string_basic_type:
cpp_name: ChainedStringBasicType
fields:
field3:
type: int
CommandTypeStringCommand:
description: Command with custom type string
command_name: CommandTypeStringCommand
namespace: type
api_version: ""
type: string
fields:
field1: int
CommandTypeArrayObjectCommand:
description: Command with just an array of object parameter
command_name: CommandTypeArrayObjectCommand
namespace: type
api_version: ""
type: array<object>
CommandTypeStructCommand:
description: Command with just a struct parameter
command_name: CommandTypeStructCommand
namespace: type
api_version: ""
type: one_string
CommandTypeArrayStructCommand:
description: Command with just an array of struct parameter
command_name: CommandTypeArrayStructCommand
namespace: type
api_version: ""
type: array<one_string>
CommandTypeStructValidatorCommand:
description: Command with a struct type that has a validator
command_name: CommandTypeStructValidatorCommand
namespace: type
api_version: ""
type: int_basic_ranges
CommandTypeVariantCommand:
description: Command with a variant parameter
command_name: CommandTypeVariantCommand
namespace: type
api_version: ""
type:
variant: [int, string, array<string>]
CommandTypeVariantStructCommand:
description: Command with a variant parameter that can be a struct
command_name: CommandTypeVariantStructCommand
namespace: type
api_version: ""
type:
variant: [bool, one_string]
_underscore_command:
description: Command with custom type string
command_name: _underscore_command
namespace: type
api_version: ""
type: string
cpp_name: WellNamedCommand
fields:
field1: int
int_type_command:
description: Command with custom type int
command_name: int_type_command
namespace: type
api_version: ""
type: int
fields:
field1: int
int_array_type_command:
description: Command with custom type for array of int
command_name: int_array_type_command
namespace: type
api_version: ""
type: array<int>
fields:
field1: int
validated_command:
description: Renamed command with validator
command_name: validated_command
namespace: ignored
api_version: ""
cpp_name: doubleBasicRanges
fields:
positive_double:
type: double
validator: { gt: 0.0 }
negative_double:
type: double
validator: { lt: 0.0 }
CommandWithReplyType:
description: A command with its reply type specified by an IDL struct
command_name: CommandWithReplyType
namespace: ignored
api_version: ""
reply_type: reply_type_struct
CommandWithOkReply:
description: "A mock command that replies with only {ok: 1}"
command_name: CommandWithOkReply
namespace: ignored
api_version: ""
reply_type: OkReply
CommandWithAnyTypeMember:
description: "A mock command to test IDLAnyType"
command_name: CommandWithValueTypeMember
namespace: ignored
api_version: ""
reply_type: OkReply
fields:
anyTypeField: IDLAnyType
CommandWithAnyTypeOwnedMember:
description: "A mock command to test IDLAnyTypeOwned"
command_name: CommandWithAnyTypeOwnedMember
namespace: ignored
api_version: ""
reply_type: OkReply
fields:
anyTypeField: IDLAnyTypeOwned
# Test that we correctly generate C++ base classes for versioned API commands with different
# key names, command names, and C++ names.
APIVersion1CommandIDLName:
description: A versioned API command
command_name: APIVersion1CommandRuntimeName
namespace: ignored
strict: true
api_version: "1"
reply_type: OkReply
APIVersion1CommandIDLName2:
description: A versioned API command
command_name: APIVersion1CommandRuntimeName2
cpp_name: APIVersion1CommandCPPName2
namespace: ignored
strict: true
api_version: "1"
reply_type: OkReply
# Test whether the C++ code for a command with alias name is currently generated.
APIVersion1CommandWithAlias:
description: A versioned API command with alias
command_name: NewCommandName
command_alias: OldCommandName
namespace: ignored
strict: true
api_version: "1"
reply_type: OkReply
##################################################################################################
#
# Test field lists
#
##################################################################################################
generic_argument_lists:
my_generic_args_list:
description: UnitTest for generic arguments list
fields:
my_generic_field_0:
forward_to_shards: false
my_generic_field_1:
forward_to_shards: true
my_generic_field_3: {}
generic_reply_field_lists:
my_generic_reply_field_list:
description: UnitTest for generic reply fields list
fields:
my_generic_field_0:
forward_from_shards: false
my_generic_field_1:
forward_from_shards: true
my_generic_field_3: {}
|