Does JsonSchemaExporter handle decimal pattern correctly?
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
### Description
```csharp
using System;
using System.Text.Json;
using System.Text.Json.Schema;
using System.Text.Json.Serialization;
var x = new JsonSerializerOptions();
x.WriteIndented = true;
x.TypeInfoResolver = JsonSerializerOptions.Default.TypeInfoResolver;
x.NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString;
x.Converters.Add(new JsonStringEnumConverter());
Console.WriteLine(JsonSchemaExporter.GetJsonSchemaAsNode(x, typeof(decimal)).ToJsonString(x));
Console.WriteLine(JsonSerializer.Deserialize("\"1E4\"", x));
```
### Reproduction Steps
See above.
The deserialization of `"1E4"` works and prints `10000`, but the pattern produced doesn't seem to handle the exponent syntax.
The produced schema today is:
```
{
"type": [
"string",
"number"
],
"pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d\u002B)?$"
}
```
### Expected behavior
Pattern should allow `1E4`
### Actual behavior
It doesn't
### Regression?
_No response_
### Known Workarounds
_No response_
### Configuration
_No response_
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.