@@ -44,17 +44,17 @@ public class OpenApiSchema : IOpenApiExtensible, IOpenApiSchema
4444 /// <inheritdoc />
4545 public Dictionary < string , IOpenApiSchema > ? Definitions { get ; set ; }
4646
47- private decimal ? _exclusiveMaximum ;
47+ private string ? _exclusiveMaximum ;
4848 /// <inheritdoc />
49- public decimal ? ExclusiveMaximum
49+ public string ? ExclusiveMaximum
5050 {
5151 get
5252 {
53- if ( _exclusiveMaximum . HasValue )
53+ if ( ! string . IsNullOrEmpty ( _exclusiveMaximum ) )
5454 {
5555 return _exclusiveMaximum ;
5656 }
57- if ( IsExclusiveMaximum == true && _maximum . HasValue )
57+ if ( IsExclusiveMaximum == true && ! string . IsNullOrEmpty ( _maximum ) )
5858 {
5959 return _maximum ;
6060 }
@@ -73,17 +73,17 @@ public decimal? ExclusiveMaximum
7373 /// DO NOT CHANGE THE VISIBILITY OF THIS PROPERTY TO PUBLIC
7474 internal bool ? IsExclusiveMaximum { get ; set ; }
7575
76- private decimal ? _exclusiveMinimum ;
76+ private string ? _exclusiveMinimum ;
7777 /// <inheritdoc />
78- public decimal ? ExclusiveMinimum
78+ public string ? ExclusiveMinimum
7979 {
8080 get
8181 {
82- if ( _exclusiveMinimum . HasValue )
82+ if ( ! string . IsNullOrEmpty ( _exclusiveMinimum ) )
8383 {
8484 return _exclusiveMinimum ;
8585 }
86- if ( IsExclusiveMinimum == true && _minimum . HasValue )
86+ if ( IsExclusiveMinimum == true && ! string . IsNullOrEmpty ( _minimum ) )
8787 {
8888 return _minimum ;
8989 }
@@ -114,9 +114,9 @@ public decimal? ExclusiveMinimum
114114 /// <inheritdoc />
115115 public string ? Description { get ; set ; }
116116
117- private decimal ? _maximum ;
117+ private string ? _maximum ;
118118 /// <inheritdoc />
119- public decimal ? Maximum
119+ public string ? Maximum
120120 {
121121 get
122122 {
@@ -132,10 +132,10 @@ public decimal? Maximum
132132 }
133133 }
134134
135- private decimal ? _minimum ;
135+ private string ? _minimum ;
136136
137137 /// <inheritdoc />
138- public decimal ? Minimum
138+ public string ? Minimum
139139 {
140140 get
141141 {
@@ -334,38 +334,43 @@ public void SerializeAsV3(IOpenApiWriter writer)
334334 SerializeInternal ( writer , OpenApiSpecVersion . OpenApi3_0 , ( writer , element ) => element . SerializeAsV3 ( writer ) ) ;
335335 }
336336
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 )
338338 {
339339 if ( version >= OpenApiSpecVersion . OpenApi3_1 )
340340 {
341- if ( exclusiveValue . HasValue )
341+ if ( ! string . IsNullOrEmpty ( exclusiveValue ) && exclusiveValue is not null )
342342 {
343343 // was explicitly set in the document or object model
344- writer . WriteProperty ( exclusivePropertyName , exclusiveValue . Value ) ;
344+ writer . WritePropertyName ( exclusivePropertyName ) ;
345+ writer . WriteRaw ( exclusiveValue ) ;
345346 }
346- else if ( isExclusiveValue == true && value . HasValue )
347+ else if ( isExclusiveValue == true && ! string . IsNullOrEmpty ( value ) && value is not null )
347348 {
348349 // came from parsing an old document
349- writer . WriteProperty ( exclusivePropertyName , value ) ;
350+ writer . WritePropertyName ( exclusivePropertyName ) ;
351+ writer . WriteRaw ( value ) ;
350352 }
351- else if ( value . HasValue )
353+ else if ( ! string . IsNullOrEmpty ( value ) && value is not null )
352354 {
353355 // was explicitly set in the document or object model
354- writer . WriteProperty ( propertyName , value ) ;
356+ writer . WritePropertyName ( propertyName ) ;
357+ writer . WriteRaw ( value ) ;
355358 }
356359 }
357360 else
358361 {
359- if ( exclusiveValue . HasValue )
362+ if ( ! string . IsNullOrEmpty ( exclusiveValue ) && exclusiveValue is not null )
360363 {
361364 // 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 ) ;
363367 writer . WriteProperty ( isExclusivePropertyName , true ) ;
364368 }
365- else if ( value . HasValue )
369+ else if ( ! string . IsNullOrEmpty ( value ) && value is not null )
366370 {
367371 // 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 ) ;
369374 if ( isExclusiveValue . HasValue )
370375 writer . WriteProperty ( isExclusivePropertyName , isExclusiveValue . Value ) ;
371376 }
0 commit comments