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
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Here is a visual representation of the above:
Installation is pretty simple, just copy and paste the following command:

~~~
dotnet tool install --global dotnet-dash --version 0.6.0-alpha
dotnet tool install --global dotnet-dash --version 0.6.1-alpha
~~~

If you have successfully installed Dash, the following command will bring up the help screen:
Expand All @@ -33,7 +33,7 @@ dotnet dash --help
Updating to the latest, or different, version of Dash is equally simple:

~~~
dotnet tool update --global dotnet-dash --version 0.6.0-alpha
dotnet tool update --global dotnet-dash --version 0.6.1-alpha
~~~

## Hello World example
Expand Down
4 changes: 2 additions & 2 deletions src/Dash/src/Dash/Dash.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>0.6.0-alpha</Version>
<Version>0.6.1-alpha</Version>
<PackAsTool>true</PackAsTool>
<ToolCommandName>dotnet-dash</ToolCommandName>
<PackageOutputPath>./nupkg</PackageOutputPath>
Expand Down
2 changes: 1 addition & 1 deletion src/Dash/src/Dash/Engine/IModelRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ public interface IModelRepository

EntityModel Get(string entityName);

bool TryGet(string entityName, out EntityModel entityModel);
bool TryGet(string entityName, out EntityModel? entityModel);
}
}
26 changes: 13 additions & 13 deletions src/Dash/src/Dash/Engine/Parsers/DefaultSourceCodeParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private ConfigurationNode ParseConfiguration(JsonDocument document)

var deserialized = JsonSerializer.Deserialize<ConfigurationNode>(configurationSourceCode);

foreach (var item in deserialized.Templates)
foreach (var item in deserialized!.Templates)
{
if (item.Output == null)
{
Expand All @@ -62,7 +62,7 @@ private ConfigurationNode ParseConfiguration(JsonDocument document)
return deserialized;
}

private ModelNode ParseModel(JsonDocument document)
private static ModelNode ParseModel(JsonDocument document)
{
var result = new ModelNode();

Expand All @@ -80,7 +80,7 @@ private ModelNode ParseModel(JsonDocument document)
return result;
}

private void TraverseRelationshipProperties(EntityDeclarationNode entityDeclarationNode, JsonElement.ObjectEnumerator objectProperties)
private static void TraverseRelationshipProperties(EntityDeclarationNode entityDeclarationNode, JsonElement.ObjectEnumerator objectProperties)
{
objectProperties.Reset();

Expand All @@ -97,28 +97,28 @@ private void TraverseRelationshipProperties(EntityDeclarationNode entityDeclarat
}
}

private void ProcessRelationshipProperty(JsonProperty objectProperty, string relationship, Action<string, string> func)
private static void ProcessRelationshipProperty(JsonProperty objectProperty, string relationship, Action<string, string> func)
{
if (objectProperty.Name.IsSame(relationship))
{
if (objectProperty.Value.ValueKind == JsonValueKind.Object)
{
foreach (var hasProperty in objectProperty.Value.EnumerateObject())
{
func(hasProperty.Name, hasProperty.Value.GetString());
func(hasProperty.Name, hasProperty.Value.GetString()!);
}
}
else if (objectProperty.Value.ValueKind == JsonValueKind.Array)
{
foreach (var hasProperty in objectProperty.Value.EnumerateArray())
{
func(hasProperty.GetString(), hasProperty.GetString());
func(hasProperty.GetString()!, hasProperty.GetString()!);
}
}
}
}

private void TryTraverseSeed(EntityDeclarationNode entityDeclarationNode, JsonElement.ObjectEnumerator entityObjectProperties)
private static void TryTraverseSeed(EntityDeclarationNode entityDeclarationNode, JsonElement.ObjectEnumerator entityObjectProperties)
{
foreach (var item in entityObjectProperties.Where(e => e.Name.IsSame("@@Seed")))
{
Expand All @@ -129,7 +129,7 @@ private void TryTraverseSeed(EntityDeclarationNode entityDeclarationNode, JsonEl
throw new ParserException("The 'FromCsv' value must be an Object");
}

var uri = new Uri(csvElement.GetProperty("Uri").GetString());
var uri = new Uri(csvElement.GetProperty("Uri").GetString()!);

var firstLineIsHeader = false;
if (csvElement.TryGetProperty("FirstLineIsHeader", out var value))
Expand All @@ -146,15 +146,15 @@ private void TryTraverseSeed(EntityDeclarationNode entityDeclarationNode, JsonEl
delimiter = delimiterJsonElement.GetString();
}

entityDeclarationNode.AddCsvSeedDeclarationNode(uri, firstLineIsHeader, delimiter, mapHeaders);
entityDeclarationNode.AddCsvSeedDeclarationNode(uri, firstLineIsHeader, delimiter, mapHeaders!);
continue;
}

throw new ParserException("Missing 'FromCsv' or 'FromData' property inside @@Seed");
}
}

private void TraverseModelEntities(ModelNode modelNode, JsonProperty entityObject)
private static void TraverseModelEntities(ModelNode modelNode, JsonProperty entityObject)
{
if (entityObject.Value.ValueKind == JsonValueKind.Object && !entityObject.Name.StartsWith("@@"))
{
Expand All @@ -167,7 +167,7 @@ private void TraverseModelEntities(ModelNode modelNode, JsonProperty entityObjec
}
}

private void TraverseAttributes(EntityDeclarationNode entityDeclarationNode, JsonElement.ObjectEnumerator attributes)
private static void TraverseAttributes(EntityDeclarationNode entityDeclarationNode, JsonElement.ObjectEnumerator attributes)
{
attributes.Reset();
foreach (var attribute in attributes)
Expand All @@ -176,14 +176,14 @@ private void TraverseAttributes(EntityDeclarationNode entityDeclarationNode, Jso
{
if (attribute.Value.ValueKind == JsonValueKind.String)
{
entityDeclarationNode.AddAttributeDeclaration(attribute.Name, attribute.Value.GetString());
entityDeclarationNode.AddAttributeDeclaration(attribute.Name, attribute.Value.GetString()!);
}
}
else
{
if (attribute.Name.IsSame("@@Inherits"))
{
entityDeclarationNode.AddInheritanceDeclaration(attribute.Value.GetString());
entityDeclarationNode.AddInheritanceDeclaration(attribute.Value.GetString()!);
}
else if (attribute.Name.IsSame("@@Abstract"))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public virtual EntityModel Get(string entityName)
throw new EntityModelNotFoundException($"Entity '{entityName}' was not found in the repository");
}

return entity;
return entity!;
}

public bool TryGet(string entityName, out EntityModel entityModel)
public bool TryGet(string entityName, out EntityModel? entityModel)
{
entityModel = _entityModels.SingleOrDefault(e => e.Name.IsSame(entityName));
return entityModel != null;
Expand Down
2 changes: 1 addition & 1 deletion src/Dash/src/Dash/Engine/Visitors/DefaultModelBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override Task Visit(AttributeDeclarationNode node)
var codeDataType = _codeLanguageProvider.Translate(result.DataType);
var databaseDataType = _databaseLanguageProvider.Translate(result.DataType);

entityModel.CodeAttributes.Add(new AttributeModel(node.AttributeName, result, codeDataType));
entityModel!.CodeAttributes.Add(new AttributeModel(node.AttributeName, result, codeDataType));
entityModel.DataAttributes.Add(new AttributeModel(node.AttributeName, result, databaseDataType));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Dash/test/Dash.Tests/Common/HttpUriDownloaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public async Task Visit_UriNodeDownloadSuccess_ShouldReturnSuccessfulTuple()
// Assert
result.Success.Should().BeTrue();
result.FileName.Should().Be("bar.csv");
result.Content.SequenceEqual(await stringContent.ReadAsByteArrayAsync()).Should().BeTrue();
result.Content.Should().NotBeNull().And.Subject.SequenceEqual(await stringContent.ReadAsByteArrayAsync()).Should().BeTrue();
}
}
}
2 changes: 1 addition & 1 deletion src/Dash/test/Dash.Tests/Dash.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>

<IsPackable>false</IsPackable>

Expand Down