Nuget Package
JsonPointer.Net
Package Version
3.2.2
Can this library make doing something simpler?
When using the .NET configuration system, it is not currently possible to bind an entry from an IConfiguration to a JsonPointer on an options class. For example, the following always results in a null value for the MyPointer member on the MyOptions class:
// appsettings.json
{
"MyOptions": {
"MyPointer": "/some/pointer"
}
}
// Application code
public class MyOptions {
public JsonPointer MyPointer { get; set; }
}
// ...
void AddMyOptions(IServiceCollection services, IConfiguration configuration) {
services.AddOptions<MyOptions>().Bind(configuration.GetSection("MyOptions"));
}
The .NET configuration binder uses TypeConverters to convert from strings to the target target type. By adding TypeConverter implementations for types such as JsonPointer and JsonPath it would allow options classes to easily make use of the types in this repository.
Describe alternatives you've considered.
No response
Is there any other information you'd like to share regarding this enhancement?
No response
Code of Conduct
Nuget Package
JsonPointer.Net
Package Version
3.2.2
Can this library make doing something simpler?
When using the .NET configuration system, it is not currently possible to bind an entry from an
IConfigurationto aJsonPointeron an options class. For example, the following always results in a null value for theMyPointermember on theMyOptionsclass:The .NET configuration binder uses TypeConverters to convert from strings to the target target type. By adding
TypeConverterimplementations for types such asJsonPointerandJsonPathit would allow options classes to easily make use of the types in this repository.Describe alternatives you've considered.
No response
Is there any other information you'd like to share regarding this enhancement?
No response
Code of Conduct