Skip to content
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

Simplified Flows representation in YAML and JSON #71

Merged
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 C4InterFlow.Automation/C4InterFlow.Automation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<Deterministic>true</Deterministic>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Version>0.40.0</Version>
<Version>0.41.0</Version>
</PropertyGroup>

<PropertyGroup>
<PackageId>C4InterFlow.Automation</PackageId>
<PackageVersion>0.40.0</PackageVersion>
<PackageVersion>0.41.0</PackageVersion>
<Authors>Slava Vedernikov</Authors>
<Description>Revolutionise your Application Architecture Documentation with C4InterFlow. Designed for Architects and Engineers, this tool leverages the widely-recognised C4 Model (Architecture Visualisation framework), enhanced with unique features like Interface and Flow, to describe your Application Architecture as Code. Experience an intuitive, efficient way to document complex systems, ensuring clarity and consistency across your teams and products.</Description>
<Copyright>Copyright 2024 Slava Vedernikov</Copyright>
Expand Down
5 changes: 5 additions & 0 deletions C4InterFlow.Automation/Readers/JObjectStructuresResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ public JObjectStructuresResolver(JObject rootJObject)
else
{
interfaceFlow = new Flow(alias);
var interfaceFlows = token!["Flows"]?.ToObject<List<Flow>>();
if(interfaceFlows != null)
{
interfaceFlow.AddFlowsRange(interfaceFlows);
}
}

result = new Interface(ownerToken.Path, alias, label)
Expand Down
6 changes: 5 additions & 1 deletion C4InterFlow.Automation/Writers/CSharpToYamlAaCWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ public void AddFlowToComponentInterfaceYamlFile(string filePath,

var componentInterfaceJsonObject = architectureObject.SelectToken("..SoftwareSystems.*.Containers.*.Components.*.Interfaces.*") as JObject;

componentInterfaceJsonObject["Flow"] = flowJsonObject["Flow"];
var flows = flowJsonObject["Flow"]?["Flows"];
if(flows != null)
{
componentInterfaceJsonObject["Flows"] = flows;
}

var json = JsonConvert.SerializeObject(architectureObject, Formatting.Indented);
var yaml = new SerializerBuilder().Build().Serialize(JsonConvert.DeserializeObject<ExpandoObject>(json));
Expand Down
10 changes: 2 additions & 8 deletions C4InterFlow.Automation/Writers/CsvToJObjectExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ public static JObject AddFlowToSoftwareSystemInterfaceObject(this JObject jsonOb
}
});

jsonObject.Add("Flow", new JObject
{
{ "Flows", flows }
});
jsonObject.Add("Flows", flows);

return jsonObject;
}
Expand Down Expand Up @@ -168,10 +165,7 @@ public static JObject AddFlowToContainerInterfaceObject(this JObject jsonObject,
}
});

jsonObject.Add("Flow", new JObject
{
{ "Flows", flows }
});
jsonObject.Add("Flows", flows);

return jsonObject;
}
Expand Down
6 changes: 3 additions & 3 deletions C4InterFlow.Automation/Writers/JObjectBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public JObject BuildComponentInterfaceObject(string architectureNamespace, strin
currentObject.Add("Path", path != null ? path : string.Empty);
currentObject.Add("IsPrivate", isPrivate != null ? isPrivate.Value : false);
currentObject.Add("Protocol", protocol != null ? protocol : string.Empty);
currentObject.Add("Flow", new JObject());
currentObject.Add("Flows", new JArray());
currentObject.Add("Input", input != null ? input : string.Empty);
currentObject.Add("InputTemplate", inputTemplate != null ? inputTemplate : string.Empty);
currentObject.Add("Output", output != null ? output : string.Empty);
Expand All @@ -159,7 +159,7 @@ public JObject BuildContainerInterfaceObject(string architectureNamespace, strin
currentObject.Add("Label", label);
currentObject.Add("Description", description != null ? description : string.Empty);
currentObject.Add("Protocol", protocol != null ? protocol : string.Empty);
currentObject.Add("Flow", new JObject());
currentObject.Add("Flows", new JArray());
currentObject.Add("Input", input != null ? input : string.Empty);
currentObject.Add("InputTemplate", inputTemplate != null ? inputTemplate : string.Empty);
currentObject.Add("Output", output != null ? output : string.Empty);
Expand All @@ -177,7 +177,7 @@ public JObject BuildSoftwareSystemInterfaceObject(string architectureNamespace,
currentObject.Add("Label", label);
currentObject.Add("Description", description != null ? description : string.Empty);
currentObject.Add("Protocol", protocol != null ? protocol : string.Empty);
currentObject.Add("Flow", new JObject());
currentObject.Add("Flows", new JArray());
currentObject.Add("Input", input != null ? input : string.Empty);
currentObject.Add("InputTemplate", inputTemplate != null ? inputTemplate : string.Empty);
currentObject.Add("Output", output != null ? output : string.Empty);
Expand Down
2 changes: 1 addition & 1 deletion C4InterFlow.Cli/C4InterFlow.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.40.0</Version>
<Version>0.41.0</Version>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
Expand Down
4 changes: 2 additions & 2 deletions C4InterFlow/C4InterFlow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<Deterministic>true</Deterministic>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Version>0.40.0</Version>
<Version>0.41.0</Version>
</PropertyGroup>

<PropertyGroup>
<PackageId>C4InterFlow</PackageId>
<PackageVersion>0.40.0</PackageVersion>
<PackageVersion>0.41.0</PackageVersion>
<Authors>Slava Vedernikov</Authors>
<Description>Revolutionise your Application Architecture Documentation with C4InterFlow. Designed for Architects and Engineers, this tool leverages the widely-recognised C4 Model (Architecture Visualisation framework), enhanced with unique features like Interface and Flow, to describe your Application Architecture as Code. Experience an intuitive, efficient way to document complex systems, ensuring clarity and consistency across your teams and products.</Description>
<Copyright>Copyright 2024 Slava Vedernikov</Copyright>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,25 @@ ECommercePlatform:
Api:
Interfaces:
GetItems:
Flow:
Flows:
- Type: Use
Expression: Database.Interfaces.SelectItems
Flows:
- Type: Use
Expression: Database.Interfaces.SelectItems
AddItem:
Flow:
Flows:
- Type: Use
Expression: Database.Interfaces.InsertItem
Flows:
- Type: Use
Expression: Database.Interfaces.InsertItem
UpdateItem:
Flow:
Flows:
- Type: Use
Expression: Database.Interfaces.UpdateItem
Flows:
- Type: Use
Expression: Database.Interfaces.UpdateItem
DeleteItem:
Flow:
Flows:
- Type: Use
Expression: Database.Interfaces.DeleteItem
Flows:
- Type: Use
Expression: Database.Interfaces.DeleteItem
DeleteBasket:
Flow:
Flows:
- Type: Use
Expression: Database.Interfaces.DeleteBasket
Flows:
- Type: Use
Expression: Database.Interfaces.DeleteBasket
Database:
Interfaces:
InsertItem: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,26 @@ ECommercePlatform:
BuyingAndMerchandisingApp:
Interfaces:
ViewPurchaseOrders:
Flow:
Flows:
- Type: Use
Expression: BuyingService.Containers.Api.Interfaces.GetPurchaseOrders
Flows:
- Type: Use
Expression: BuyingService.Containers.Api.Interfaces.GetPurchaseOrders
CreatePurchaseOrder:
Flow:
Flows:
- Type: Use
Expression: BuyingService.Containers.Api.Interfaces.CreatePurchaseOrder
Flows:
- Type: Use
Expression: BuyingService.Containers.Api.Interfaces.CreatePurchaseOrder
UpdatePurchaseOrder:
Flow:
Flows:
- Type: Use
Expression: BuyingService.Containers.Api.Interfaces.UpdatePurchaseOrder
Flows:
- Type: Use
Expression: BuyingService.Containers.Api.Interfaces.UpdatePurchaseOrder
DeletePurchaseOrder:
Flow:
Flows:
- Type: Use
Expression: BuyingService.Containers.Api.Interfaces.DeletePurchaseOrder
Flows:
- Type: Use
Expression: BuyingService.Containers.Api.Interfaces.DeletePurchaseOrder
ViewProductPrices:
Flow:
Flows:
- Type: Use
Expression: PricingService.Containers.Api.Interfaces.GetProductPrices
Flows:
- Type: Use
Expression: PricingService.Containers.Api.Interfaces.GetProductPrices
UpdateProductPrices:
Flow:
Flows:
- Type: Use
Expression: PricingService.Containers.Api.Interfaces.UpdateProductPrices
Flows:
- Type: Use
Expression: PricingService.Containers.Api.Interfaces.UpdateProductPrices
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,27 @@ ECommercePlatform:
Api:
Interfaces:
GetPurchaseOrders:
Flow:
Flows:
- Type: Use
Expression: Database.Interfaces.SelectPurchaseOrder
Flows:
- Type: Use
Expression: Database.Interfaces.SelectPurchaseOrder
CreatePurchaseOrder:
Flow:
Flows:
- Type: Use
Expression: Database.Interfaces.InsertPurchaseOrder
- Type: Use
Expression: Messaging.Interfaces.SendPurchaseOrderCreatedEvent
Flows:
- Type: Use
Expression: Database.Interfaces.InsertPurchaseOrder
- Type: Use
Expression: Messaging.Interfaces.SendPurchaseOrderCreatedEvent
UpdatePurchaseOrder:
Flow:
Flows:
- Type: Use
Expression: Database.Interfaces.UpdatePurchaseOrder
- Type: Use
Expression: Messaging.Interfaces.SendPurchaseOrderUpdatedEvent
Flows:
- Type: Use
Expression: Database.Interfaces.UpdatePurchaseOrder
- Type: Use
Expression: Messaging.Interfaces.SendPurchaseOrderUpdatedEvent
DeletePurchaseOrder:
Flow:
Flows:
- Type: Use
Expression: Database.Interfaces.DeletePurchaseOrder
- Type: Use
Expression: Messaging.Interfaces.SendPurchaseOrderDeletedEvent
Flows:
- Type: Use
Expression: Database.Interfaces.DeletePurchaseOrder
- Type: Use
Expression: Messaging.Interfaces.SendPurchaseOrderDeletedEvent
Database:
Interfaces:
InsertPurchaseOrder: {}
Expand All @@ -47,23 +43,20 @@ ECommercePlatform:
MessageHandler:
Interfaces:
HandlePurchaseOrderCreatedEvent:
Flow:
Flows:
- Type: Use
Expression: Messaging.Interfaces.ReceivePurchaseOrderCreatedEvent
- Type: Use
Expression: WMS.Interfaces.CreatePurchaseOrder
Flows:
- Type: Use
Expression: Messaging.Interfaces.ReceivePurchaseOrderCreatedEvent
- Type: Use
Expression: WMS.Interfaces.CreatePurchaseOrder
HandlePurchaseOrderUpdatedEvent:
Flow:
Flows:
- Type: Use
Expression: Messaging.Interfaces.ReceivePurchaseOrderUpdatedEvent
- Type: Use
Expression: WMS.Interfaces.UpdatePurchaseOrder
Flows:
- Type: Use
Expression: Messaging.Interfaces.ReceivePurchaseOrderUpdatedEvent
- Type: Use
Expression: WMS.Interfaces.UpdatePurchaseOrder
HandlePurchaseOrderDeletedEvent:
Flow:
Flows:
- Type: Use
Expression: Messaging.Interfaces.ReceivePurchaseOrderDeletedEvent
- Type: Use
Expression: WMS.Interfaces.DeletePurchaseOrder
Flows:
- Type: Use
Expression: Messaging.Interfaces.ReceivePurchaseOrderDeletedEvent
- Type: Use
Expression: WMS.Interfaces.DeletePurchaseOrder
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ ECommercePlatform:
CRMApp:
Interfaces:
ViewHighRiskOrders:
Flow:
Flows:
- Type: Use
Expression: FraudService.Containers.Api.Interfaces.GetHighRiskOrders
Flows:
- Type: Use
Expression: FraudService.Containers.Api.Interfaces.GetHighRiskOrders
UpdateOrderFraudCheckResult:
Flow:
Flows:
- Type: Use
Expression: FraudService.Containers.Api.Interfaces.UpdateOrderFraudCheckResult
Flows:
- Type: Use
Expression: FraudService.Containers.Api.Interfaces.UpdateOrderFraudCheckResult
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ ECommercePlatform:
Api:
Interfaces:
GetHighRiskOrders:
Flow:
Flows:
- Type: Use
Expression: Database.Interfaces.SelectHighRiskOrders
Flows:
- Type: Use
Expression: Database.Interfaces.SelectHighRiskOrders
UpdateOrderFraudCheckResult:
Flow:
Flows:
- Type: Use
Expression: Database.Interfaces.UpdateFraudCheckResult
- Type: Use
Expression: Messaging.Interfaces.SendFraudCheckResultEvent
Flows:
- Type: Use
Expression: Database.Interfaces.UpdateFraudCheckResult
- Type: Use
Expression: Messaging.Interfaces.SendFraudCheckResultEvent
Database:
Interfaces:
InsertOrder: {}
Expand All @@ -29,15 +27,14 @@ ECommercePlatform:
MessageHandler:
Interfaces:
HandleOrderCreatedEvent:
Flow:
Flows:
- Type: Use
Expression: OrderService.Containers.Messaging.Interfaces.ReceiveOrderCreatedEvent
- Type: Use
Expression: Database.Interfaces.InsertOrder
- Type: Use
Expression: FraudEngine.Interfaces.GetFraudCheckResult
- Type: Use
Expression: Database.Interfaces.InsertFraudCheckResult
- Type: Use
Expression: Messaging.Interfaces.SendFraudCheckResultEvent
Flows:
- Type: Use
Expression: OrderService.Containers.Messaging.Interfaces.ReceiveOrderCreatedEvent
- Type: Use
Expression: Database.Interfaces.InsertOrder
- Type: Use
Expression: FraudEngine.Interfaces.GetFraudCheckResult
- Type: Use
Expression: Database.Interfaces.InsertFraudCheckResult
- Type: Use
Expression: Messaging.Interfaces.SendFraudCheckResultEvent
Loading