You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm parsing some Toml (a python Pipfile), but only care about one of the sections in the Toml, so haven't specified all possible sections that might be in the file.
I end up getting errors for all sections that I haven't catered for:
(6,2) : error : Unable to set the property packages on object type PipFile.
(38,2) : error : Unable to set the property dev-packages on object type PipFile.
(61,2) : error : Unable to set the property pipenv on object type PipFile.
This wouldn't be the case for the standard json deserializer
The text was updated successfully, but these errors were encountered:
Thanks @TylerReid. #41 appears to capture simple properties, but when an object is received, I still see errors.
Test program to reproduce with Tomlyn 0.15.0:
using Tomlyn;
namespace TomlynTest;
public class SimpleModel
{
public string? Name { get; set; }
}
class Program
{
static void Main(string[] args)
{
var input = @"values = ['1','2','3']
[config]
required = false";
var model = Toml.ToModel<SimpleModel>(input, options: new TomlModelOptions
{
IgnoreMissingProperties = true,
});
Console.WriteLine(model);
}
}
Output:
><> dotnet run
Unhandled exception. Tomlyn.TomlException: (2,2) : error : Unable to set the property config on object type TomlynTest.SimpleModel.
at Tomlyn.Toml.ToModel[T](DocumentSyntax syntax, TomlModelOptions options)
at Tomlyn.Toml.ToModel[T](String text, String sourcePath, TomlModelOptions options)
at TomlynTest.Program.Main(String[] args) in /home/bacongobbler/code/tomlyn-test/Program.cs:line 18
I'm parsing some Toml (a python Pipfile), but only care about one of the sections in the Toml, so haven't specified all possible sections that might be in the file.
I end up getting errors for all sections that I haven't catered for:
This wouldn't be the case for the standard json deserializer
The text was updated successfully, but these errors were encountered: