Skip to content

Simplify HOCON data structure. #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Feb 27, 2020
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
84a3c5a
Move Hocon.Immutable into Hocon namespace
Arkatufus Feb 20, 2020
2eedda3
Mark old classes as internal classes
Arkatufus Feb 20, 2020
280a826
Convert old data type to new ones
Arkatufus Feb 20, 2020
2e09c9d
Convert old data type to new data type
Arkatufus Feb 20, 2020
84dd12c
Improve backward compatibility
Arkatufus Feb 21, 2020
0b7beb2
Convert old Config to use the new data structure.
Arkatufus Feb 24, 2020
2d5e60c
Add caching to Config
Arkatufus Feb 24, 2020
10d2659
Update ApiApprover text file to reflect the new data structure.
Arkatufus Feb 24, 2020
2ea0ce5
Merge branch 'dev' into Simplify_Data_Structure
Arkatufus Feb 24, 2020
b5a687e
Bump Linux .NET SDK version from 2.1.500 to 2.1.504 to match the wind…
Arkatufus Feb 24, 2020
8c4a583
force csproj LangVersion tag to 7.2
Arkatufus Feb 24, 2020
1c095b6
Remove throw statement, throw does not make sense since this is not a…
Arkatufus Feb 25, 2020
debc2e6
Add missing getters needed for Akka compatibility
Arkatufus Feb 25, 2020
3ad3d69
Merge branch 'dev' into Simplify_Data_Structure
Arkatufus Feb 25, 2020
279978f
Add serialization hacks (surrogate) from Akka.NET to fix serializatio…
Arkatufus Feb 25, 2020
8fa5415
Merge branch 'dev' into Simplify_Data_Structure
Arkatufus Feb 25, 2020
cdc4f1c
Remove Newtonsoft.Json nuget dependency
Arkatufus Feb 26, 2020
d91901c
Defensive coding
Arkatufus Feb 26, 2020
1deb2a7
Adjust surface API
Arkatufus Feb 26, 2020
ac1e4ad
Clean ghost Immutable projects from .sln file. Prevented CI build fro…
Arkatufus Feb 26, 2020
f9b4b75
Prepend Hocon to classes names that are too generic
Arkatufus Feb 27, 2020
f109c44
Remove caching from Config
Arkatufus Feb 27, 2020
63305ed
Force garbage collection so that memory allocation stat result only r…
Arkatufus Feb 27, 2020
9afc666
Update the approved API list to reflect the static extension class na…
Arkatufus Feb 27, 2020
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
12 changes: 0 additions & 12 deletions Hocon.sln
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hocon.Extensions.Configurat
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hocon.Extensions.Configuration.Tests", "src\Hocon.Extensions.Configuration.Tests\Hocon.Extensions.Configuration.Tests.csproj", "{F7862234-3330-43DE-86BB-D6E67F2146BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hocon.Immutable", "src\Hocon.Immutable\Hocon.Immutable.csproj", "{FB439177-CA10-4BA8-993D-A51D1BEE2A0E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hocon.Immutable.Tests", "src\Hocon.Immutable.Tests\Hocon.Immutable.Tests.csproj", "{FEEC6F6B-2511-4BEC-9568-4E6AE6C1D275}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SerializationDebug", "src\examples\SerializationDebug\SerializationDebug.csproj", "{6D1D4813-7AB6-4268-A9DF-627A60E08FB1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hocon.API.Tests", "src\Hocon.API.Tests\Hocon.API.Tests.csproj", "{2EC48C29-E5A7-4C3F-AB26-1C121E098867}"
Expand Down Expand Up @@ -93,14 +89,6 @@ Global
{F7862234-3330-43DE-86BB-D6E67F2146BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F7862234-3330-43DE-86BB-D6E67F2146BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F7862234-3330-43DE-86BB-D6E67F2146BC}.Release|Any CPU.Build.0 = Release|Any CPU
{FB439177-CA10-4BA8-993D-A51D1BEE2A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FB439177-CA10-4BA8-993D-A51D1BEE2A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB439177-CA10-4BA8-993D-A51D1BEE2A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB439177-CA10-4BA8-993D-A51D1BEE2A0E}.Release|Any CPU.Build.0 = Release|Any CPU
{FEEC6F6B-2511-4BEC-9568-4E6AE6C1D275}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FEEC6F6B-2511-4BEC-9568-4E6AE6C1D275}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FEEC6F6B-2511-4BEC-9568-4E6AE6C1D275}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FEEC6F6B-2511-4BEC-9568-4E6AE6C1D275}.Release|Any CPU.Build.0 = Release|Any CPU
{6D1D4813-7AB6-4268-A9DF-627A60E08FB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D1D4813-7AB6-4268-A9DF-627A60E08FB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D1D4813-7AB6-4268-A9DF-627A60E08FB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ NUGET_EXE=$TOOLS_DIR/nuget.exe
NUGET_URL=https://dist.nuget.org/win-x86-commandline/v4.0.0/nuget.exe
FAKE_VERSION=4.61.2
FAKE_EXE=$TOOLS_DIR/FAKE/tools/FAKE.exe
DOTNET_VERSION=2.1.500
DOTNET_VERSION=2.1.504
DOTNET_INSTALLER_URL=https://raw.githubusercontent.com/dotnet/cli/v$DOTNET_VERSION/scripts/obtain/dotnet-install.sh
DOTNET_CHANNEL=LTS;
DOCFX_VERSION=2.40.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using Hocon.Immutable.Extensions;
using Xunit;

namespace Hocon.Immutable.Tests
namespace Hocon.Tests
{
public class ApiTest
{
Expand Down Expand Up @@ -56,7 +55,7 @@ public class ApiTest
[MemberData(nameof(ObjectArrayData))]
public void CanIntelligentlyUseIndexerTypeToAccessMembers(string hocon)
{
var config = HoconParser.Parse(hocon).ToHoconImmutable();
var config = HoconParser.Parse(hocon);

Assert.Equal(1, config["a"][0]["a"].GetInt());
Assert.Equal(2, config["a"][0]["b"].GetInt());
Expand Down Expand Up @@ -128,7 +127,7 @@ public void CanAutomaticallyCastValuesToPrimitives()

root_2 : 1234
}";
var config = HoconParser.Parse(hocon).ToHoconImmutable();
var config = HoconParser.Parse(hocon);

#pragma warning disable 618
Assert.True(config.Value.GetBoolean("root.bool")); // legacy
Expand Down
2 changes: 1 addition & 1 deletion src/HOCON.Tests/Extensions/IsStringTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class IsStringTests
}
";

public HoconRoot TestHocon => HoconParser.Parse(RawTestHocon);
public HoconObject TestHocon => HoconParser.Parse(RawTestHocon);

[Fact]
public void IsString_should_detect_String_literals()
Expand Down
6 changes: 3 additions & 3 deletions src/HOCON.Tests/QuotedString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public void Bugfix_190_should_unquote_quotedstrings_on_parse()
";

var parsed = HoconParser.Parse(hocon);
var unwrapped = parsed.GetObject("adapters").ToDictionary(x => x.Key, v => v.Value.GetString());
var unwrapped = parsed.GetObject("adapters").Unwrapped;

// check to make sure these strings aren't quoted
unwrapped["gremlin"].Should().Be("Akka.Remote.Transport.FailureInjectorProvider,Akka.Remote");
unwrapped["trttl"].Should().Be("Akka.Remote.Transport.ThrottlerProvider,Akka.Remote");
unwrapped["gremlin"].Should().Equals("Akka.Remote.Transport.FailureInjectorProvider,Akka.Remote");
unwrapped["trttl"].Should().Equals("Akka.Remote.Transport.ThrottlerProvider,Akka.Remote");
}
}
}
1 change: 0 additions & 1 deletion src/Hocon.API.Tests/Hocon.API.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
<ItemGroup>
<ProjectReference Include="..\Hocon.Configuration\Hocon.Configuration.csproj" />
<ProjectReference Include="..\Hocon.Extensions.Configuration\Hocon.Extensions.Configuration.csproj" />
<ProjectReference Include="..\Hocon.Immutable\Hocon.Immutable.csproj" />
<ProjectReference Include="..\Hocon\Hocon.csproj" />
</ItemGroup>

Expand Down
28 changes: 13 additions & 15 deletions src/Hocon.API.Tests/HoconAPISpec.ApproveConfiguration.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,29 @@ namespace Hocon
protected CDataConfigurationElement() { }
protected override void DeserializeElement(System.Xml.XmlReader reader, bool serializeCollectionKey) { }
}
public class Config : Hocon.HoconRoot, System.IEquatable<Hocon.Config>, System.Runtime.Serialization.ISerializable
public class Config : Hocon.HoconObject, System.IEquatable<Hocon.Config>, System.Runtime.Serialization.ISerializable
{
[System.ObsoleteAttribute("For json serialization/deserialization only", true)]
protected Config() { }
protected Config(Hocon.HoconValue value) { }
protected Config(Hocon.HoconValue value, Hocon.Config fallback) { }
public Config(Hocon.HoconRoot root) { }
public Config(Hocon.HoconRoot root, Hocon.Config fallback) { }
public Config(Hocon.HoconElement root) { }
[System.ObsoleteAttribute("Used for serialization only", true)]
public Config(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
protected Config(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static Hocon.Config Empty { get; }
public virtual System.Collections.Generic.IReadOnlyList<Hocon.HoconValue> Fallbacks { get; }
public virtual System.Collections.Generic.IReadOnlyList<Hocon.HoconObject> Fallbacks { get; }
public virtual bool IsEmpty { get; }
public Hocon.HoconValue Root { get; }
protected System.Collections.Generic.List<Hocon.HoconValue> _fallbacks { get; }
public override System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, Hocon.HoconField>> AsEnumerable() { }
public Hocon.HoconObject Root { get; }
protected System.Collections.Generic.List<Hocon.HoconObject> _fallbacks { get; }
public override System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, Hocon.HoconElement>> AsEnumerable() { }
public static Hocon.Config Create(Hocon.HoconElement root) { }
public static Hocon.Config Deserialize(string raw) { }
public virtual bool Equals(Hocon.Config other) { }
public override bool Equals(object obj) { }
public virtual Hocon.Config GetConfig(string path) { }
public virtual Hocon.Config GetConfig(Hocon.HoconPath path) { }
protected override Hocon.HoconValue GetNode(Hocon.HoconPath path) { }
[System.ObsoleteAttribute("Used for serialization only", true)]
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override Hocon.HoconElement GetValue(Hocon.HoconPath path) { }
public string Serialize() { }
public string ToString(bool useFallbackValues) { }
protected override bool TryGetNode(Hocon.HoconPath path, out Hocon.HoconValue result) { }
public override bool TryGetValue(Hocon.HoconPath path, out Hocon.HoconElement result) { }
public virtual Hocon.Config WithFallback(Hocon.Config fallback) { }
public static Hocon.Config +(Hocon.Config config, string fallback) { }
public static Hocon.Config +(string configHocon, Hocon.Config fallbackConfig) { }
Expand Down Expand Up @@ -66,7 +65,6 @@ namespace Hocon
public static Hocon.Config FromResource(string resourceName, object instanceInAssembly) { }
public static Hocon.Config FromResource<TAssembly>(string resourceName) { }
public static Hocon.Config FromResource(string resourceName, System.Reflection.Assembly assembly) { }
[System.ObsoleteAttribute("Call the ConfigurationFactory.Default method instead.")]
public static Hocon.Config Load() { }
public static Hocon.Config Load(string sectionName) { }
public static Hocon.Config ParseString(string hocon, Hocon.HoconIncludeCallbackAsync includeCallback) { }
Expand Down
Loading