Skip to content

Commit

Permalink
#24: Moved Architecture Diagrams classes into dedicated folders
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinCelej committed May 21, 2023
1 parent 15be833 commit 07893de
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
using System.Runtime.InteropServices;
using System.Text;
using JetBrains.Annotations;
using Synergy.Architecture.Diagrams.Extensions;

namespace Synergy.Architecture.Diagrams.Api
{
// TODO: Marcin Celej [from: Marcin Celej on: 08-04-2023]: remove this class from here - check what it is used for

public static class ApiDescription
internal static class ApiDescription
{
static readonly BindingFlags bindingFlags = BindingFlags.FlattenHierarchy | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Synergy.Architecture.Diagrams.Sequence;
using Synergy.Contracts;

namespace Synergy.Architecture.Diagrams;
namespace Synergy.Architecture.Diagrams.Documentation;

public class TechnicalBlueprint
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Reflection;

namespace Synergy.Architecture.Diagrams;
namespace Synergy.Architecture.Diagrams.Extensions;

internal static class ReflectionExtensions
{
Expand All @@ -23,7 +23,7 @@ public static bool IsAssignableTo(this Type type, string assignableType)

public static Attribute? GetCustomAttribute(this Type type, string attributeType)
=> type.GetCustomAttributes().FirstOrDefault(a => a.GetType().IsAssignableTo(attributeType));

public static Attribute? GetCustomAttribute(this MethodInfo method, string attributeType)
=> method.GetCustomAttributes().FirstOrDefault(a => a.GetType().IsAssignableTo(attributeType));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Text;
using Synergy.Architecture.Annotations.Diagrams.Sequence;
using Synergy.Architecture.Diagrams.Api;
using Synergy.Architecture.Diagrams.Documentation;
using Synergy.Contracts;
using Synergy.Reflection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using PlantUml.Net;
using Synergy.Architecture.Annotations.Diagrams.Sequence;
using Synergy.Architecture.Diagrams.Api;
using Synergy.Architecture.Diagrams.Documentation;
using Synergy.Architecture.Diagrams.Extensions;
using Synergy.Contracts;
using Synergy.Reflection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
<ProjectReference Include="..\Synergy.Architecture.Annotations\Synergy.Architecture.Annotations.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\Reflection\Synergy.Reflection\CustomAttributeExtensions.cs">
<Link>CustomAttributeExtensions.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
<PackageReference Include="PlantUml.Net" Version="1.4.80" />
</ItemGroup>
Expand All @@ -37,4 +31,10 @@
<None Include="license.txt" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\Reflection\Synergy.Reflection\CustomAttributeExtensions.cs">
<Link>Extensions\CustomAttributeExtensions.cs</Link>
</Compile>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Technical Debt for Synergy.Contracts

Total: 3

## [SequenceDiagramActivationAttribute.cs](../../../Synergy.Architecture.Annotations/Diagrams/Sequence/SequenceDiagramActivationAttribute.cs)
- TODO: Marcin Celej [from: Marcin Celej on: 08-04-2023]: Add optional attributes when compilation constant CODE_ANALYSIS (or other) is present
Total: 2

## [ApiDescription.cs](../../../Synergy.Architecture.Diagrams/Api/ApiDescription.cs)
- TODO: Marcin Celej [from: Marcin Celej on: 08-04-2023]: remove this class from here - check what it is used for
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Synergy.Architecture.Annotations.Diagrams.Sequence;
using Synergy.Architecture.Diagrams;
using Synergy.Architecture.Diagrams.Documentation;
using Synergy.Documentation.Api;

namespace Synergy.Architecture.Tests.Architecture.Public;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,6 @@
type: Type
) : TAttribute[] [Extension]

## TechnicalBlueprint (class)
- ctor()
- Add(
diagram: params SequenceDiagram[] [ParamArray]
) : TechnicalBlueprint
- Add(
diagram: IEnumerable<SequenceDiagram>
) : TechnicalBlueprint
- Intro(
markdown: string
) : TechnicalBlueprint
- Register<TComponent, TImplementation>() : TechnicalBlueprint [NullableContext]
- Register(
interface: Type,
services: IServiceProvider
) : TechnicalBlueprint
- Register(
interface: Type,
implementation: Type
) : TechnicalBlueprint
- Render() : string
- TechnicalBlueprint.Titled(
title: string
) : TechnicalBlueprint
- ToString() : string

## Sequence.SequenceDiagram (record) : IEquatable<SequenceDiagram>
- Actor: SequenceDiagramActor [Nullable] { get; set; }
- Components: TechnicalBlueprint+DiagramComponents? { get; set; }
Expand Down Expand Up @@ -110,30 +84,33 @@
- GenerateDiagramContent() : StringBuilder
- GenerateDiagramUrl() : string

## Api.ApiDescription (abstract class)
- ApiDescription.For(
method: MethodInfo,
withAttributes: bool [Optional]
) : string
- ApiDescription.GenerateFor(
assembly: Assembly
) : string
- ApiDescription.GenerateFor(
types: IEnumerable<Type>,
description: StringBuilder? [Nullable, Optional],
assemblyName: string? [Nullable, Optional]
) : string
- ApiDescription.GetTypeName(
method: MethodInfo
) : string
- ApiDescription.GetTypeName(
parameter: ParameterInfo
) : string
- ApiDescription.GetTypeName(
type: Type
) : string
## Documentation.TechnicalBlueprint (class)
- ctor()
- Add(
diagram: params SequenceDiagram[] [ParamArray]
) : TechnicalBlueprint
- Add(
diagram: IEnumerable<SequenceDiagram>
) : TechnicalBlueprint
- Intro(
markdown: string
) : TechnicalBlueprint
- Register<TComponent, TImplementation>() : TechnicalBlueprint [NullableContext]
- Register(
interface: Type,
services: IServiceProvider
) : TechnicalBlueprint
- Register(
interface: Type,
implementation: Type
) : TechnicalBlueprint
- Render() : string
- TechnicalBlueprint.Titled(
title: string
) : TechnicalBlueprint
- ToString() : string

## TechnicalBlueprint+DiagramComponents (class)
## Documentation.TechnicalBlueprint+DiagramComponents (class)
- ctor()
- Register<TComponent, TImplementation>() : void [NullableContext]
- Register(
Expand Down
6 changes: 3 additions & 3 deletions Reflection/Synergy.Reflection/CustomAttributeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ private static T[] GetInheritedAttributes<T>([NotNull] IEnumerable<object> allAt
Fail.IfArgumentNull(allAttributes, nameof(allAttributes));

T[] attributes = allAttributes
.Where(a => a is T)
.Cast<T>()
.ToArray();
.Where(a => a is T)
.Cast<T>()
.ToArray();

Fail.IfCollectionContainsNull(attributes, $"Attributes collection on {name}");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO;
using System.Threading.Tasks;
using Synergy.Architecture.Diagrams;
using Synergy.Architecture.Diagrams.Documentation;
using Synergy.Architecture.Diagrams.Sequence;
using Synergy.Documentation.Code;
using Synergy.Sample.Web.API.Controllers;
Expand Down
8 changes: 4 additions & 4 deletions Web/Sample/Synergy.Sample.Web.API.Tests/Users/Users.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Content-Length: 129

### 2.2. Get created user pointed by "Location" header (1 request)

### 2.2.2. Request to [Get user located at http://localhost/api/v1/users/42dcb695c2c241b6aef90281aa2cf9d7]
### 2.2.2. Request to [Get user located at http://localhost/api/v1/users/e1efd892e55746e7a9199de1493ebd42]

- Request
```
Expand Down Expand Up @@ -137,7 +137,7 @@ Content-Length: 129

### 3.1. Get user by id (1 request)

### 3.1.1. Request to [Get user with id "42dcb695c2c241b6aef90281aa2cf9d7"]
### 3.1.1. Request to [Get user with id "e1efd892e55746e7a9199de1493ebd42"]

- Request
```
Expand Down Expand Up @@ -391,7 +391,7 @@ Content-Length: 351

### 6.1. Delete user by id (1 request)

### 6.1.1. Request to [Delete user with id "42dcb695c2c241b6aef90281aa2cf9d7"]
### 6.1.1. Request to [Delete user with id "e1efd892e55746e7a9199de1493ebd42"]

- Request
```
Expand All @@ -418,7 +418,7 @@ Content-Length: 2

### 6.2. Try to get the deleted user (1 request)

### 6.2.2. Request to [Get user with id "42dcb695c2c241b6aef90281aa2cf9d7"]
### 6.2.2. Request to [Get user with id "e1efd892e55746e7a9199de1493ebd42"]

- Request
```
Expand Down

0 comments on commit 07893de

Please sign in to comment.