summaryrefslogtreecommitdiff
path: root/buildscripts/idl/tests/compatibility_test_fail/old/compatibility_test_fail_old.idl
blob: 6a0fb8ff267748095f4fc0ee2d14bcbf6cb445de (plain)
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
# Copyright (C) 2021-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.
#

global:
    cpp_namespace: "mongo"

imports:
    - "mongo/idl/basic_types.idl"
    - "../buildscripts/idl/tests/compatibility_test_fail/old/imports.idl"

types:
    intToIntString:
        bson_serialization_type: int
        description: "The bson_serialization_type changes from int in the old command's reply
                      field type to [int, string] in the new command's reply field type"
        cpp_type: "std::int32_t"

    intStringToIntStringBool:
        bson_serialization_type:
                                - int
                                - string
        description: "The bson_serialization_type changes from [int, string] in the old command's
                      reply field type to [int, string, bool] in the new command's reply field
                      type"
        cpp_type: "std::int32_t"

    oldBsonSerializationTypeAny:
        bson_serialization_type:
                                - int
                                - any
        description: "The old bson_serialization_type contains 'any'"
        cpp_type: "std::int32_t"

    newBsonSerializationTypeAny:
        bson_serialization_type:
                                - int
        description: "The new bson_serialization_type contains 'any'"
        cpp_type: "std::int32_t"
    
    intStringBoolToIntString:
        bson_serialization_type:
                                - int
                                - string
                                - bool
        description: "The bson_serialization_type changes from [int, string, bool] in the old
                      command's reply field type to [int, string] in the new command's reply
                      field type"
        cpp_type: "std::int32_t"

enums:
    NewReplyFieldEnumNotSubset:
        description: "The new reply type is an enum that is not a subset of the old reply type's 
                      enum values"
        type: string
        values:
            valueOne: "one"
            valueTwo: "two"
    
    EnumNotSuperset:
        description: "The new enum is not a superset of the old enum values"
        type: string
        values:
            valueOne: "one"
            valueTwo: "two"
            valueThree: "three"

structs:
    UnstableNewFieldReply:
        description: "This reply contains a field that is stable in the old command but is
                      unstable in the new command."
        fields:
            unstableNewField:
                type: string

    OptionalNewFieldReply:
        description: "This reply contains a field that is required in the old command but is
                      optional in the new command."
        fields:
            optionalNewField:
                type: string
    
    RequiredNewField:
        description: "This struct contains a field that is optional in the old command but is
                      required in the new command."
        fields:
            requiredNewField:
                type: string
                optional: true
    
    MissingNewFieldReply:
        description: "This reply contains a field that exists in the old command but is
                      missing in the new command."
        fields:
            missingNewField:
                type: string

    EnumNotSubsetReply:
        description: "This reply contains an enum field where the new enum values is not a subset
                      of the old reply type's enum values"
        fields:
            enumNotSubsetReplyField:
                type: NewReplyFieldEnumNotSubset

    NotEnumFieldReply:
        description: "This reply contains a field that is an enum type in the old command but
                      is not an enum type in the new command"
        fields:
            notEnumReplyField:
                type: NewReplyFieldEnumNotSubset

    NotStructFieldReply:
        description: "This reply contains a field that is a struct type in the old command but
                      is not a struct type in the new command"
        fields:
            notStructReplyField:
                type: StructReplyFieldType

    StructReplyFieldType:
        description: "This is a struct reply field type"

    EnumOrStructFieldReply:
        description: "This reply contains a field that is a non-enum or struct type in the old
                      command but is an enum or struct in the new command"
        fields:
            EnumOrStructReplyField:
                type: intToIntString

    BsonNotSubsetReply:
        description: "This reply contains a field type where the new bson_serialization_type
                      is not a subset of the old bson_serialization_type"
        fields:
            bsonNotSubsetReplyField:
                type: intToIntString

    BsonNotSubsetReplyTwo:
        description: "This reply contains a field type where the new bson_serialization_type
                      is not a subset of the old bson_serialization_type"
        fields:
            bsonNotSubsetReplyFieldTwo:
                type: intStringToIntStringBool

    OldBsonSerializationTypeAnyReply:
        description: "This reply contains a field whose old type has a bson_serialization_type
                      that contains 'any'"
        fields:
            oldBsonSerializationTypeAnyReplyField:
                type: oldBsonSerializationTypeAny

    NewBsonSerializationTypeAnyReply:
        description: "This reply contains a field whose new type has a bson_serialization_type
                      that contains 'any'"
        fields:
            newBsonSerializationTypeAnyReplyField:
                type: newBsonSerializationTypeAny

    StructFieldTypeRecursiveReplyOne:
        description: "This reply contains a field whose new type is a struct that is not 
                      compatible with the old field type"
        fields:
            structReplyField:
                type: UnstableNewFieldReply
    
    StructFieldTypeRecursiveReplyTwo:
        description: "This reply contains a field whose new type is a struct that is not 
                      compatible with the old field type"
        fields:
            structReplyField:
                type: StructType

    StructType:
        description: "This struct contains a field whose new type is incompatible with the 
                      old field type"
        fields:
            fieldOne:
                type: BsonNotSubsetReply

commands:
    invalidAPIVersionOld:
        description: "old command fails because of invalid API version"
        command_name: invalidAPIVersionOld
        namespace: ignored
        cpp_name: invalidAPIVersionOld
        strict: true
        api_version: "whatever"
        reply_type: OkReply

    duplicateCommandOld:
        description: "duplicate command in old commands fails because a command with the same name
                      is in duplicate_command_fail_old.idl"
        command_name: duplicateCommandOld
        namespace: ignored
        cpp_name: duplicateCommandOld
        strict: true
        api_version: "1"
        reply_type: OkReply

    removedCommand:
        description: "command will be removed from compatibility_test_fail/new which results 
                      in an error"
        command_name: removedCommand
        namespace: ignored
        cpp_name: removedCommand
        strict: true
        api_version: "1"
        reply_type: OkReply
    
    newReplyFieldUnstable:
        description: "new command fails because it contains an unstable reply field that is stable
                      in the corresponding old command"
        command_name: newReplyFieldUnstable
        namespace: ignored
        cpp_name: newReplyFieldUnstable
        strict: true
        api_version: "1"
        reply_type: UnstableNewFieldReply
    
    newReplyFieldOptional:
        description: "new command fails because it contains an optional reply field that is
                      required in the corresponding old command"
        command_name: newReplyFieldOptional
        namespace: ignored
        cpp_name: newReplyFieldOptional
        strict: true
        api_version: "1"
        reply_type: OptionalNewFieldReply

    newReplyFieldMissing:
        description: "new command fails because it is missing a reply field that exists in
                      the corresponding old command"
        command_name: newReplyFieldMissing
        namespace: ignored
        cpp_name: newReplyFieldMissing
        strict: true
        api_version: "1"
        reply_type: MissingNewFieldReply
    
    importedReplyCommand:
        description: "reply is imported and should fail"
        command_name: importedReplyCommand
        namespace: ignored
        cpp_name: importedReplyCommand
        strict: true
        api_version: "1"
        reply_type: ImportedUnstableNewFieldReply

    newReplyFieldTypeEnumNotSubset:
        description: "new command fails because its reply field type is an enum that is not
                      a subset of the corresponding old reply field type's enum values"
        command_name: newReplyFieldTypeEnumNotSubset
        namespace: ignored
        cpp_name: newReplyFieldTypeEnumNotSubset
        strict: true
        api_version: "1"
        reply_type: EnumNotSubsetReply

    newReplyFieldTypeNotEnum:
        description: "new command fails because its reply field type is not an enum when the
                      old reply field type is an enum"
        command_name: newReplyFieldTypeNotEnum
        namespace: ignored
        cpp_name: newReplyFieldTypeNotEnum
        strict: true
        api_version: "1"
        reply_type: NotEnumFieldReply

    newReplyFieldTypeNotStruct:
        description: "new command fails because its reply field type is not a struct when the
                      old reply field type is a struct"
        command_name: newReplyFieldTypeNotStruct
        namespace: ignored
        cpp_name: newReplyFieldTypeNotStruct
        strict: true
        api_version: "1"
        reply_type: NotStructFieldReply

    newReplyFieldTypeEnumOrStruct:
        description: "new command fails because it contains a field that is a non-enum or struct
                      type in the old command, and an enum or struct in the new command"
        command_name: newReplyFieldTypeEnumOrStruct
        namespace: ignored
        cpp_name: newReplyFieldTypeEnumOrStruct
        strict: true
        api_version: "1"
        reply_type: EnumOrStructFieldReply

    newReplyFieldTypeBsonNotSubset:
        description: "new command fails because its reply field type has a bson_serialization_type
                      that is not a subset of the corresponding old reply field type's
                      bson_serialization_type"
        command_name: newReplyFieldTypeBsonNotSubset
        namespace: ignored
        cpp_name: newReplyFieldTypeBsonNotSubset
        strict: true
        api_version: "1"
        reply_type: BsonNotSubsetReply

    newReplyFieldTypeBsonNotSubsetTwo:
        description: "new command fails because its reply field type has a bson_serialization_type
                      that is not a subset of the corresponding old reply field type's
                      bson_serialization_type"
        command_name: newReplyFieldTypeBsonNotSubsetTwo
        namespace: ignored
        cpp_name: newReplyFieldTypeBsonNotSubsetTwo
        strict: true
        api_version: "1"
        reply_type: BsonNotSubsetReplyTwo

    oldReplyFieldTypeBsonAny:
        description: "old command fails because its reply field type has a bson_serialization_type
                      that contains 'any'"
        command_name: oldReplyFieldTypeBsonAny
        namespace: ignored
        cpp_name: oldReplyFieldTypeBsonAny
        strict: true
        api_version: "1"
        reply_type: OldBsonSerializationTypeAnyReply

    newReplyFieldTypeBsonAny:
        description: "new command fails because its reply field type has a bson_serialization_type
                      that contains 'any'"
        command_name: newReplyFieldTypeBsonAny
        namespace: ignored
        cpp_name: newReplyFieldTypeBsonAny
        strict: true
        api_version: "1"
        reply_type: NewBsonSerializationTypeAnyReply

    newReplyFieldTypeStructRecursiveOne:
        description: "new command fails because its reply field type is a struct that is
                      incompatible with the old reply field type struct"
        command_name: newReplyFieldTypeStructRecursiveOne
        namespace: ignored
        cpp_name: newReplyFieldTypeStructRecursiveOne
        strict: true
        api_version: "1"
        reply_type: StructFieldTypeRecursiveReplyOne

    newReplyFieldTypeStructRecursiveTwo:
        description: "new command fails because its reply field type is a struct that is
                      incompatible with the old reply field type struct"
        command_name: newReplyFieldTypeStructRecursiveTwo
        namespace: ignored
        cpp_name: newReplyFieldTypeStructRecursiveTwo
        strict: true
        api_version: "1"
        reply_type: StructFieldTypeRecursiveReplyTwo

    newNamespaceNotIgnored:
        description: "new command fails because its namespace is not ignored"
        command_name: newNamespaceNotIgnored
        namespace: ignored
        cpp_name: newNamespaceNotIgnored
        strict: true
        api_version: "1"
        reply_type: OkReply

    newNamespaceNotConcatenateWithDbOrUuid:
        description: "new command fails because its namespace is not concatenate_with_db_or_uuid
                      or ignored"
        command_name: newNamespaceNotConcatenateWithDbOrUuid
        namespace: concatenate_with_db_or_uuid
        cpp_name: newNamespaceNotConcatenateWithDbOrUuid
        strict: true
        api_version: "1"
        reply_type: OkReply

    newNamespaceNotConcatenateWithDb:
        description: "new command fails because its namespace changes to type"
        command_name: newNamespaceNotConcatenateWithDb
        namespace: concatenate_with_db
        cpp_name: newNamespaceNotConcatenateWithDb
        strict: true
        api_version: "1"
        reply_type: OkReply

    newNamespaceNotType:
        description: "new command fails because its namespace changes from type in
                      an incompatible way"
        command_name: newNamespaceNotType
        namespace: type
        type: string
        cpp_name: newNamespaceNotType
        strict: true
        api_version: "1"
        reply_type: OkReply

    oldTypeBsonAny:
        description: "old command fails because its type has a bson_serialization_type
                      that contains 'any'"
        command_name: oldTypeBsonAny
        namespace: type
        type: oldBsonSerializationTypeAny
        cpp_name: oldTypeBsonAny
        strict: true
        api_version: "1"
        reply_type: OkReply

    newTypeBsonAny:
        description: "new command fails because its type has a bson_serialization_type
                      that contains 'any'"
        command_name: newTypeBsonAny
        namespace: type
        type: newBsonSerializationTypeAny
        cpp_name: newTypeBsonAny
        strict: true
        api_version: "1"
        reply_type: OkReply

    newTypeNotSuperset:
        description: "new command fails because its type is not a superset
                      of the old type"
        command_name: newTypeNotSuperset
        namespace: type
        type: intStringBoolToIntString
        cpp_name: newTypeNotSuperset
        strict: true
        api_version: "1"
        reply_type: OkReply

    newTypeEnumNotSuperset:
        description: "new command fails because its type is an enum that is not
                      a superset of the corresponding old type's enum values"
        command_name: newTypeEnumNotSuperset
        namespace: type
        type: EnumNotSuperset
        cpp_name: newTypeEnumNotSuperset
        strict: true
        api_version: "1"
        reply_type: OkReply

    newTypeNotEnum:
        description: "new command fails because its type is not an enum when the
                      old type is an enum"
        command_name: newTypeNotEnum
        namespace: type
        type: EnumNotSuperset
        cpp_name: newTypeNotEnum
        strict: true
        api_version: "1"
        reply_type: OkReply

    newTypeNotStruct:
        description: "new command fails because its type is not a struct when the
                      old type is a struct"
        command_name: newTypeNotStruct
        namespace: type
        type: StructType
        cpp_name: newTypeNotStruct
        strict: true
        api_version: "1"
        reply_type: OkReply

    newTypeEnumOrStruct:
        description: "new command fails because the type is a non-enum or struct
                      type in the old command, and an enum or struct in the new command"
        command_name: newTypeEnumOrStruct
        namespace: type
        type: namespacestring
        cpp_name: newTypeEnumOrStruct
        strict: true
        api_version: "1"
        reply_type: OkReply

    newTypeStructRecursive:
        description: "new command fails because its type is a struct that is
                      incompatible with the old type struct"
        command_name: newTypeStructRecursive
        namespace: type
        type: StructFieldTypeRecursiveReplyOne
        cpp_name: newTypeStructRecursive
        strict: true
        api_version: "1"
        reply_type: OkReply

    newTypeFieldUnstable:
        description: "new command fails because it contains an unstable type field that is stable
                      in the corresponding old command"
        command_name: newTypeFieldUnstable
        namespace: type
        type: UnstableNewFieldReply
        cpp_name: newTypeFieldUnstable
        strict: true
        api_version: "1"
        reply_type: OkReply

    newTypeFieldRequired:
        description: "new command fails because it contains a required reply field that is
                      optional in the corresponding old command"
        command_name: newTypeFieldRequired
        namespace: type
        type: RequiredNewField
        cpp_name: newTypeFieldRequired
        strict: true
        api_version: "1"
        reply_type: OkReply

    newTypeFieldMissing:
        description: "new command fails because it is missing a type field that exists in
                      the corresponding old command"
        command_name: newTypeFieldMissing
        namespace: type
        type: MissingNewFieldReply
        cpp_name: newTypeFieldMissing
        strict: true
        api_version: "1"
        reply_type: OkReply