9
9
using Microsoft . OpenApi . Interfaces ;
10
10
using Microsoft . OpenApi . Writers ;
11
11
12
+ #nullable enable
13
+
12
14
namespace Microsoft . OpenApi . Models
13
15
{
14
16
/// <summary>
15
17
/// Media Type Object.
16
18
/// </summary>
17
19
public class OpenApiMediaType : IOpenApiSerializable , IOpenApiExtensible
18
20
{
19
- private JsonSchema _schema ;
21
+ private JsonSchema ? _schema ;
20
22
21
23
/// <summary>
22
24
/// The schema defining the type used for the request body.
23
25
/// </summary>
24
- public virtual JsonSchema Schema
26
+ public virtual JsonSchema ? Schema
25
27
{
26
28
get => _schema ;
27
29
set => _schema = value ;
@@ -31,26 +33,26 @@ public virtual JsonSchema Schema
31
33
/// Example of the media type.
32
34
/// The example object SHOULD be in the correct format as specified by the media type.
33
35
/// </summary>
34
- public OpenApiAny Example { get ; set ; }
36
+ public OpenApiAny ? Example { get ; set ; }
35
37
36
38
/// <summary>
37
39
/// Examples of the media type.
38
40
/// Each example object SHOULD match the media type and specified schema if present.
39
41
/// </summary>
40
- public IDictionary < string , OpenApiExample > Examples { get ; set ; } = new Dictionary < string , OpenApiExample > ( ) ;
42
+ public IDictionary < string , OpenApiExample > ? Examples { get ; set ; } = new Dictionary < string , OpenApiExample > ( ) ;
41
43
42
44
/// <summary>
43
45
/// A map between a property name and its encoding information.
44
46
/// The key, being the property name, MUST exist in the schema as a property.
45
47
/// The encoding object SHALL only apply to requestBody objects
46
48
/// when the media type is multipart or application/x-www-form-urlencoded.
47
49
/// </summary>
48
- public IDictionary < string , OpenApiEncoding > Encoding { get ; set ; } = new Dictionary < string , OpenApiEncoding > ( ) ;
50
+ public IDictionary < string , OpenApiEncoding > ? Encoding { get ; set ; } = new Dictionary < string , OpenApiEncoding > ( ) ;
49
51
50
52
/// <summary>
51
53
/// Serialize <see cref="OpenApiExternalDocs"/> to Open Api v3.0.
52
54
/// </summary>
53
- public IDictionary < string , IOpenApiExtension > Extensions { get ; set ; } = new Dictionary < string , IOpenApiExtension > ( ) ;
55
+ public IDictionary < string , IOpenApiExtension > ? Extensions { get ; set ; } = new Dictionary < string , IOpenApiExtension > ( ) ;
54
56
55
57
/// <summary>
56
58
/// Parameterless constructor
@@ -60,7 +62,7 @@ public OpenApiMediaType() { }
60
62
/// <summary>
61
63
/// Initializes a copy of an <see cref="OpenApiMediaType"/> object
62
64
/// </summary>
63
- public OpenApiMediaType ( OpenApiMediaType mediaType )
65
+ public OpenApiMediaType ( OpenApiMediaType ? mediaType )
64
66
{
65
67
Schema = mediaType ? . Schema != null ? JsonNodeCloneHelper . CloneJsonSchema ( mediaType . Schema ) : null ;
66
68
Example = mediaType ? . Example != null ? JsonNodeCloneHelper . Clone ( mediaType . Example ) : null ;
0 commit comments