Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/LEGO.AsyncAPI.Readers/V2/AsyncApiSchemaDeserializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ public class JsonSchemaDeserializer
}
},
{
"exclusiveMaximum", (a, n) => { a.ExclusiveMaximum = bool.Parse(n.GetScalarValue()); }
"exclusiveMaximum", (a, n) =>
{
a.ExclusiveMaximum = double.Parse(n.GetScalarValue(), NumberStyles.Float, n.Context.Settings.CultureInfo);
}
},
{
"minimum",
Expand All @@ -71,7 +74,10 @@ public class JsonSchemaDeserializer
}
},
{
"exclusiveMinimum", (a, n) => { a.ExclusiveMinimum = bool.Parse(n.GetScalarValue()); }
"exclusiveMinimum", (a, n) =>
{
a.ExclusiveMinimum = double.Parse(n.GetScalarValue(), NumberStyles.Float, n.Context.Settings.CultureInfo);
}
},
{
"maxLength", (a, n) => { a.MaxLength = int.Parse(n.GetScalarValue(), n.Context.Settings.CultureInfo); }
Expand Down
4 changes: 2 additions & 2 deletions src/LEGO.AsyncAPI/Models/AsyncApiSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class AsyncApiSchema : IAsyncApiReferenceable, IAsyncApiExtensible, IAsyn
/// <summary>
/// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html.
/// </summary>
public bool? ExclusiveMaximum { get; set; }
public double? ExclusiveMaximum { get; set; }

/// <summary>
/// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html.
Expand All @@ -52,7 +52,7 @@ public class AsyncApiSchema : IAsyncApiReferenceable, IAsyncApiExtensible, IAsyn
/// <summary>
/// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html.
/// </summary>
public bool? ExclusiveMinimum { get; set; }
public double? ExclusiveMinimum { get; set; }

/// <summary>
/// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html.
Expand Down
10 changes: 5 additions & 5 deletions test/LEGO.AsyncAPI.Tests/Models/AsyncApiSchema_Should.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class AsyncApiSchema_Should : TestBase
Title = "title1",
MultipleOf = 3,
Maximum = 42,
ExclusiveMinimum = true,
ExclusiveMinimum = 42,
Minimum = 10,
Default = new AsyncApiAny(15),
Type = SchemaType.Integer,
Expand All @@ -37,7 +37,7 @@ public class AsyncApiSchema_Should : TestBase
Title = "title1",
MultipleOf = 3,
Maximum = double.MaxValue,
ExclusiveMinimum = true,
ExclusiveMinimum = double.MinValue,
Minimum = double.MinValue,
Default = new AsyncApiAny(15),
Type = SchemaType.Integer,
Expand Down Expand Up @@ -211,7 +211,7 @@ public class AsyncApiSchema_Should : TestBase
Title = "title1",
MultipleOf = 3,
Maximum = 42,
ExclusiveMinimum = true,
ExclusiveMinimum = 42,
Minimum = 10,
Default = new AsyncApiAny(15),
Type = SchemaType.Integer,
Expand Down Expand Up @@ -307,7 +307,7 @@ public void SerializeAsJson_WithAdvancedSchemaNumber_V2Works()
"type": "integer",
"maximum": 42,
"minimum": 10,
"exclusiveMinimum": true,
"exclusiveMinimum": 42,
"multipleOf": 3,
"default": 15,
"nullable": true,
Expand Down Expand Up @@ -335,7 +335,7 @@ public void SerializeAsJson_WithAdvancedSchemaBigNumbers_V2Works()
"type": "integer",
"maximum": 1.7976931348623157E+308,
"minimum": -1.7976931348623157E+308,
"exclusiveMinimum": true,
"exclusiveMinimum": -1.7976931348623157E+308,
"multipleOf": 3,
"default": 15,
"nullable": true,
Expand Down