summaryrefslogtreecommitdiff
path: root/buildscripts/idl/tests/compatibility_test_pass/old/compatibility_test_pass_old.idl
blob: 99bc674cccd6c848263eb250e0490def809b53a0 (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
# 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_pass/old/imports.idl"

types:
    intStringToInt:
        bson_serialization_type:
                                - int
                                - string
        description: "The bson_serialization_type changes from [int, string] in the old command's
                      reply field type to int in the new command's reply field type"
        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"
    
    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"

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

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

    RequiredNewFieldReply:
        description: "This reply contains a field that is optional in the old command but is
                      required in the new command."
        fields:
            requiredNewField:
                type: string
                optional: true
    
    OptionalNewField:
        description: "This struct contains a field that is required in the old command but is
                      optional in the new command."
        fields:
            optionalNewField:
                type: string
    
    AddedNewFieldReply:
        description: "This reply contains a field that is added in the new command."
    
    UnstableOldFieldReply:
        description: "This reply contains a field that is unstable in the old command and is
                      unstable and optional in the new command."
        fields:
            unstableOldField:
                type: string
                unstable: true

    EnumSubsetReply:
        description: "This reply contains an enum field where the new enum values is a subset
                      of the old reply type's enum values"
        fields:
            replyField:
                type: NewReplyFieldEnumSubset
    
    BsonSubsetReply:
        description: "This reply contains a field type where the new bson_serialization_type
                      is a subset of the old bson_serialization_type"
        fields:
            bsonSubsetReplyField:
                type: intStringToInt
    
    BsonSubsetReplyTwo:
        description: "This reply contains a field type where the new bson_serialization_type
                      is a subset of the old bson_serialization_type"
        fields:
            bsonSubsetReplyFieldTwo:
                type: intStringBoolToIntString

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

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

commands:
    testCommand:
        description: "old passing test command"
        command_name: testCommand
        namespace: ignored
        cpp_name: testCommand
        strict: true
        api_version: "1"
        reply_type: OkReply

    removedCommandNotInAPIV1:
        description: "removing a command not in API v1 passes"
        command_name: removedCommandNotInAPIV1
        namespace: ignored
        cpp_name: removedCommandNotInAPIV1
        strict: true
        api_version: ""
        reply_type: OkReply
    
    newReplyFieldStable:
        description: "new command contains a stable reply field that is unstable
                      in the corresponding old command and still passes"
        command_name: newReplyFieldStable
        namespace: ignored
        cpp_name: newReplyFieldStable
        strict: true
        api_version: "1"
        reply_type: StableNewFieldReply
    
    newReplyFieldRequired:
        description: "new command contains a required reply field that is optional
                      in the corresponding old command and still passes"
        command_name: newReplyFieldRequired
        namespace: ignored
        cpp_name: newReplyFieldRequired
        strict: true
        api_version: "1"
        reply_type: RequiredNewFieldReply

    newReplyFieldAdded:
        description: "new command adds a new reply field and still passes"
        command_name: newReplyFieldAdded
        namespace: ignored
        cpp_name: newReplyFieldAdded
        strict: true
        api_version: "1"
        reply_type: AddedNewFieldReply
    
    oldReplyFieldUnstable:
        description: "old reply field is unstable so new commmand passes even if its new reply
                      field is unstable"
        command_name: oldReplyFieldUnstable
        namespace: ignored
        cpp_name: oldReplyFieldUnstable
        strict: true
        api_version: "1"
        reply_type: UnstableOldFieldReply

    importedReplyCommand:
        description: "reply is imported"
        command_name: importedReplyCommand
        namespace: ignored
        cpp_name: importedReplyCommand
        strict: true
        api_version: "1"
        reply_type: ImportedStableNewFieldReply

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

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

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

    newReplyFieldTypeStructRecursiveOne:
        description: "new command passes because its reply field type is a struct that is
                      compatible 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 passes because its reply field type is a struct that is
                      compatible with the old reply field type struct"
        command_name: newReplyFieldTypeStructRecursiveTwo
        namespace: ignored
        cpp_name: newReplyFieldTypeStructRecursiveTwo
        strict: true
        api_version: "1"
        reply_type: StructFieldTypeRecursiveReplyTwo

    newNamespaceIgnored:
        description: "new command passes when its namespace is changed to ignored"
        command_name: newNamespaceIgnored
        namespace: concatenate_with_db_or_uuid
        cpp_name: newNamespaceIgnored
        strict: true
        api_version: "1"
        reply_type: OkReply

    newNamespaceConcatenateWithDbOrUuid:
        description: "new command passes when its namespace is changed to concatenate_with_db_or_uuid
                      from concatenate_with_db"
        command_name: newNamespaceConcatenateWithDbOrUuid
        namespace: concatenate_with_db
        cpp_name: newNamespaceConcatenateWithDbOrUuid
        strict: true
        api_version: "1"
        reply_type: OkReply

    newNamespaceTypeToIgnored:
        description: "new command passes when its namespace is changed from type to ignored"
        command_name: newNamespaceTypeToIgnored
        namespace: type
        type: string
        cpp_name: newNamespaceTypeToIgnored
        strict: true
        api_version: "1"
        reply_type: OkReply

    oldNamespaceTypeNamespaceString:
        description: "If old command has namespace: type and type: namespacestring, the new namespace
                      can be changed to concatenate_with_db"
        command_name: oldNamespaceTypeNamespaceString
        namespace: type
        type: namespacestring
        cpp_name: oldNamespaceTypeNamespaceString
        strict: true
        api_version: "1"
        reply_type: OkReply

    oldNamespaceTypeNamespaceStringTwo:
        description: "If old command has namespace: type and type: namespacestring, the new namespace
                      can be changed to concatenate_with_db_or_uuid"
        command_name: oldNamespaceTypeNamespaceStringTwo
        namespace: type
        type: namespacestring
        cpp_name: oldNamespaceTypeNamespaceStringTwo
        strict: true
        api_version: "1"
        reply_type: OkReply

    newTypeSuperset:
        description: "new command passes because its type is a superset
                      of the old type"
        command_name: newTypeSuperset
        namespace: type
        type: intStringToIntStringBool
        cpp_name: newTypeSuperset
        strict: true
        api_version: "1"
        reply_type: OkReply

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

    newTypeFieldOptional:
        description: "new command type contains an optional field that is required
                      in the corresponding old command and still passes"
        command_name: newTypeFieldOptional
        namespace: type
        type: OptionalNewField
        cpp_name: newTypeFieldOptional
        strict: true
        api_version: "1"
        reply_type: OkReply