File tree Expand file tree Collapse file tree 4 files changed +5
-42
lines changed Expand file tree Collapse file tree 4 files changed +5
-42
lines changed Original file line number Diff line number Diff line change @@ -433,20 +433,6 @@ public void SerializeAsV2WithoutReference(IOpenApiWriter writer)
433
433
}
434
434
}
435
435
436
- //examples
437
- if ( Examples != null && Examples . Any ( ) )
438
- {
439
- writer . WritePropertyName ( "x-examples" ) ;
440
- writer . WriteStartObject ( ) ;
441
-
442
- foreach ( var example in Examples )
443
- {
444
- writer . WritePropertyName ( example . Key ) ;
445
- writer . WriteV2Examples ( writer , example . Value , OpenApiSpecVersion . OpenApi2_0 ) ;
446
- }
447
- writer . WriteEndObject ( ) ;
448
- }
449
-
450
436
// extensions
451
437
writer . WriteExtensions ( extensionsClone , OpenApiSpecVersion . OpenApi2_0 ) ;
452
438
Original file line number Diff line number Diff line change 1
- // Copyright (c) Microsoft Corporation. All rights reserved.
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT license.
3
3
4
4
using System ;
@@ -185,8 +185,7 @@ internal OpenApiBodyParameter ConvertToBodyParameter()
185
185
// V2 spec actually allows the body to have custom name.
186
186
// To allow round-tripping we use an extension to hold the name
187
187
Name = "body" ,
188
- Schema = Content . Values . FirstOrDefault ( ) ? . Schema ?? new JsonSchemaBuilder ( ) . Build ( ) ,
189
- Examples = Content . Values . FirstOrDefault ( ) ? . Examples ,
188
+ Schema = Content . Values . FirstOrDefault ( ) ? . Schema ?? new OpenApiSchema ( ) ,
190
189
Required = Required ,
191
190
Extensions = Extensions . ToDictionary ( static k => k . Key , static v => v . Value ) // Clone extensions so we can remove the x-bodyName extensions from the output V2 model.
192
191
} ;
@@ -220,8 +219,7 @@ internal IEnumerable<OpenApiFormDataParameter> ConvertToFormDataParameters()
220
219
Description = property . Value . GetDescription ( ) ,
221
220
Name = property . Key ,
222
221
Schema = property . Value ,
223
- Examples = Content . Values . FirstOrDefault ( ) ? . Examples ,
224
- Required = Content . First ( ) . Value . Schema . GetRequired ( ) ? . Contains ( property . Key ) ?? false
222
+ Required = Content . First ( ) . Value . Schema . Required . Contains ( property . Key )
225
223
} ;
226
224
}
227
225
}
Original file line number Diff line number Diff line change 1
- // Copyright (c) Microsoft Corporation. All rights reserved.
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT license.
3
3
4
4
using System ;
@@ -231,27 +231,6 @@ public void SerializeAsV2WithoutReference(IOpenApiWriter writer)
231
231
writer . WriteEndObject ( ) ;
232
232
}
233
233
234
- if ( Content . Values . Any ( m => m . Examples != null && m . Examples . Any ( ) ) )
235
- {
236
- writer . WritePropertyName ( "x-examples" ) ;
237
- writer . WriteStartObject ( ) ;
238
-
239
- foreach ( var mediaTypePair in Content )
240
- {
241
- var examples = mediaTypePair . Value . Examples ;
242
- if ( examples != null && examples . Any ( ) )
243
- {
244
- foreach ( var example in examples )
245
- {
246
- writer . WritePropertyName ( example . Key ) ;
247
- writer . WriteV2Examples ( writer , example . Value , OpenApiSpecVersion . OpenApi2_0 ) ;
248
- }
249
- }
250
- }
251
-
252
- writer . WriteEndObject ( ) ;
253
- }
254
-
255
234
writer . WriteExtensions ( mediatype . Value . Extensions , OpenApiSpecVersion . OpenApi2_0 ) ;
256
235
257
236
foreach ( var key in mediatype . Value . Extensions . Keys )
Original file line number Diff line number Diff line change 1
- // Copyright (c) Microsoft Corporation. All rights reserved.
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT license.
3
3
4
4
using System ;
You can’t perform that action at this time.
0 commit comments