@@ -44,17 +44,17 @@ public class OpenApiSchema : IOpenApiExtensible, IOpenApiSchema
44
44
/// <inheritdoc />
45
45
public Dictionary < string , IOpenApiSchema > ? Definitions { get ; set ; }
46
46
47
- private decimal ? _exclusiveMaximum ;
47
+ private string ? _exclusiveMaximum ;
48
48
/// <inheritdoc />
49
- public decimal ? ExclusiveMaximum
49
+ public string ? ExclusiveMaximum
50
50
{
51
51
get
52
52
{
53
- if ( _exclusiveMaximum . HasValue )
53
+ if ( ! string . IsNullOrEmpty ( _exclusiveMaximum ) )
54
54
{
55
55
return _exclusiveMaximum ;
56
56
}
57
- if ( IsExclusiveMaximum == true && _maximum . HasValue )
57
+ if ( IsExclusiveMaximum == true && ! string . IsNullOrEmpty ( _maximum ) )
58
58
{
59
59
return _maximum ;
60
60
}
@@ -73,17 +73,17 @@ public decimal? ExclusiveMaximum
73
73
/// DO NOT CHANGE THE VISIBILITY OF THIS PROPERTY TO PUBLIC
74
74
internal bool ? IsExclusiveMaximum { get ; set ; }
75
75
76
- private decimal ? _exclusiveMinimum ;
76
+ private string ? _exclusiveMinimum ;
77
77
/// <inheritdoc />
78
- public decimal ? ExclusiveMinimum
78
+ public string ? ExclusiveMinimum
79
79
{
80
80
get
81
81
{
82
- if ( _exclusiveMinimum . HasValue )
82
+ if ( ! string . IsNullOrEmpty ( _exclusiveMinimum ) )
83
83
{
84
84
return _exclusiveMinimum ;
85
85
}
86
- if ( IsExclusiveMinimum == true && _minimum . HasValue )
86
+ if ( IsExclusiveMinimum == true && ! string . IsNullOrEmpty ( _minimum ) )
87
87
{
88
88
return _minimum ;
89
89
}
@@ -114,9 +114,9 @@ public decimal? ExclusiveMinimum
114
114
/// <inheritdoc />
115
115
public string ? Description { get ; set ; }
116
116
117
- private decimal ? _maximum ;
117
+ private string ? _maximum ;
118
118
/// <inheritdoc />
119
- public decimal ? Maximum
119
+ public string ? Maximum
120
120
{
121
121
get
122
122
{
@@ -132,10 +132,10 @@ public decimal? Maximum
132
132
}
133
133
}
134
134
135
- private decimal ? _minimum ;
135
+ private string ? _minimum ;
136
136
137
137
/// <inheritdoc />
138
- public decimal ? Minimum
138
+ public string ? Minimum
139
139
{
140
140
get
141
141
{
@@ -334,38 +334,43 @@ public void SerializeAsV3(IOpenApiWriter writer)
334
334
SerializeInternal ( writer , OpenApiSpecVersion . OpenApi3_0 , ( writer , element ) => element . SerializeAsV3 ( writer ) ) ;
335
335
}
336
336
337
- private static void SerializeBounds ( IOpenApiWriter writer , OpenApiSpecVersion version , string propertyName , string exclusivePropertyName , string isExclusivePropertyName , decimal ? value , decimal ? exclusiveValue , bool ? isExclusiveValue )
337
+ private static void SerializeBounds ( IOpenApiWriter writer , OpenApiSpecVersion version , string propertyName , string exclusivePropertyName , string isExclusivePropertyName , string ? value , string ? exclusiveValue , bool ? isExclusiveValue )
338
338
{
339
339
if ( version >= OpenApiSpecVersion . OpenApi3_1 )
340
340
{
341
- if ( exclusiveValue . HasValue )
341
+ if ( ! string . IsNullOrEmpty ( exclusiveValue ) && exclusiveValue is not null )
342
342
{
343
343
// was explicitly set in the document or object model
344
- writer . WriteProperty ( exclusivePropertyName , exclusiveValue . Value ) ;
344
+ writer . WritePropertyName ( exclusivePropertyName ) ;
345
+ writer . WriteRaw ( exclusiveValue ) ;
345
346
}
346
- else if ( isExclusiveValue == true && value . HasValue )
347
+ else if ( isExclusiveValue == true && ! string . IsNullOrEmpty ( value ) && value is not null )
347
348
{
348
349
// came from parsing an old document
349
- writer . WriteProperty ( exclusivePropertyName , value ) ;
350
+ writer . WritePropertyName ( exclusivePropertyName ) ;
351
+ writer . WriteRaw ( value ) ;
350
352
}
351
- else if ( value . HasValue )
353
+ else if ( ! string . IsNullOrEmpty ( value ) && value is not null )
352
354
{
353
355
// was explicitly set in the document or object model
354
- writer . WriteProperty ( propertyName , value ) ;
356
+ writer . WritePropertyName ( propertyName ) ;
357
+ writer . WriteRaw ( value ) ;
355
358
}
356
359
}
357
360
else
358
361
{
359
- if ( exclusiveValue . HasValue )
362
+ if ( ! string . IsNullOrEmpty ( exclusiveValue ) && exclusiveValue is not null )
360
363
{
361
364
// was explicitly set in a new document being downcast or object model
362
- writer . WriteProperty ( propertyName , exclusiveValue . Value ) ;
365
+ writer . WritePropertyName ( propertyName ) ;
366
+ writer . WriteRaw ( exclusiveValue ) ;
363
367
writer . WriteProperty ( isExclusivePropertyName , true ) ;
364
368
}
365
- else if ( value . HasValue )
369
+ else if ( ! string . IsNullOrEmpty ( value ) && value is not null )
366
370
{
367
371
// came from parsing an old document, we're just mirroring the information
368
- writer . WriteProperty ( propertyName , value ) ;
372
+ writer . WritePropertyName ( propertyName ) ;
373
+ writer . WriteRaw ( value ) ;
369
374
if ( isExclusiveValue . HasValue )
370
375
writer . WriteProperty ( isExclusivePropertyName , isExclusiveValue . Value ) ;
371
376
}
0 commit comments