Skip to content

Commit

Permalink
#27: Added ApiDescription class for generating library Public Api in …
Browse files Browse the repository at this point in the history
…form of markdown
  • Loading branch information
MarcinCelej committed May 14, 2023
1 parent 02989b0 commit 0161852
Show file tree
Hide file tree
Showing 8 changed files with 362 additions and 95 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Technical Debt for Synergy.Contracts

Total: 5

## [ApiDescription.cs](../../../Synergy.Documentation/Api/ApiDescription.cs)
- TODO: Marcin Celej [from: Marcin Celej on: 08-04-2023]: Duplicated class

## [CodeFile.cs](../../../Synergy.Documentation/Code/CodeFile.cs)
- TODO: Marcin Celej [from: Marcin Celej on: 14-05-2023]: rename to SourceFile

## [CodeFolder.cs](../../../Synergy.Documentation/Code/CodeFolder.cs)
- TODO: Marcin Celej [from: Marcin Celej on: 14-05-2023]: Rename to SourceFolder

## [TodoPattern.cs](../../../Synergy.Documentation/Todos/Patterns/TodoPattern.cs)
- TODO: Marcin Celej [from: Marcin Celej on: 14-04-2023]: Add way to exclude some files from the scan - by path

## [TodoExplorer.cs](../../../Synergy.Documentation/Todos/TodoExplorer.cs)
- TODO: Marcin Celej [from: Marcin Celej on: 30-04-2023]: Publish this library via nuget
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Synergy.Documentation.Code;
using Synergy.Documentation.Todos;

namespace Synergy.Documentation.Tests.Todos;
namespace Synergy.Documentation.Tests.Architecture;

[UsesVerify]
public class Todos
Expand All @@ -10,7 +10,7 @@ public class Todos
public async Task Generate()
{
var rootFolder = CodeFolder.Current()
.Up(2);
.Up(3);
var technicalDebt = TodoExplorer.DebtFor("Synergy.Contracts", rootFolder);

await Verifier
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Synergy.Documentation.Api;

namespace Synergy.Documentation.Tests.Architecture.Public;

[UsesVerify]
public class Api
{
[Fact]
public async Task Generate()
{
// ARRANGE
var assembly = typeof(ApiDescription).Assembly;

// ACT
var publicApi = ApiDescription.GenerateFor(assembly);

// ASSERT
await Verifier.Verify(publicApi, "md")
.UseMethodName("of." + assembly.GetName()
.Name);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Synergy.Documentation

## Todos.TodoExplorer (abstract class)
- TodoExplorer.DebtFor(
name: string,
from: CodeFolder,
currentPath: string [CallerFilePath, Optional],
patterns: params TodoPattern[] [ParamArray]
) : string

## Todos.Patterns.CsharpTodoPattern (record) : TodoPattern, IEquatable<TodoPattern>, IEquatable<CsharpTodoPattern>
- FileExtension: string { get; set; }
- Regex: Regex { get; set; }
- TodoExtractor: Func<Match, string> { get; set; }
- ctor()

## Todos.Patterns.GherkinTodoPattern (record) : TodoPattern, IEquatable<TodoPattern>, IEquatable<GherkinTodoPattern>
- FileExtension: string { get; set; }
- Regex: Regex { get; set; }
- TodoExtractor: Func<Match, string> { get; set; }
- ctor()

## Todos.Patterns.TextTodoPattern (record) : TodoPattern, IEquatable<TodoPattern>, IEquatable<TextTodoPattern>
- FileExtension: string { get; set; }
- Regex: Regex { get; set; }
- TodoExtractor: Func<Match, string> { get; set; }
- ctor()

## Todos.Patterns.TodoPattern (abstract class) : IEquatable<TodoPattern>
- FileExtension: string { get; set; }
- Regex: Regex { get; set; }
- TodoExtractor: Func<Match, string> { get; set; }

## Code.ClassReader (class)
- ctor()
- ClassReader.ReadMethodBody(
methodName: string,
sourceFilePath: string [CallerFilePath, Optional]
) : string? [NullableContext]

## Code.CodeFile (class)
- Extension: string { get; }
- FileName: string { get; }
- FileNameWithoutExtension: string { get; }
- FilePath: string { get; }
- Folder: CodeFolder { get; }
- ctor(
filePath: string
)
- CodeFile.Current(
path: string [CallerFilePath, Optional]
) : CodeFolder
- RelativeTo(
folder: CodeFolder
) : CodeFile
- ToString() : string

## Code.CodeFolder (class)
- Path: string { get; }
- ctor(
path: string
)
- CodeFolder.Current(
path: string [CallerFilePath, Optional]
) : CodeFolder
- File(
fileName: string
) : CodeFile
- ToString() : string
- Up(
jumps: int [Optional]
) : CodeFolder

## 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

## Api.ClassDocumentation (class) : Markdown+Document, IEnumerable<Markdown+IElement>, IEnumerable
- ctor(
type: Type
)
- Append(
element: Markdown+IElement
) : Markdown+Document
- Append(
newElements: IEnumerable<Markdown+IElement>
) : Markdown+Document
- GetEnumerator() : IEnumerator<Markdown+IElement>
- ToString() : string

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<ParentFile>Todos</ParentFile>
<DependentUpon>Todos.cs</DependentUpon>
</None>
<None Update="Architecture\Public\Api.of.Synergy.Behaviours.Testing.verified.md">
<ParentFile>Api</ParentFile>
<DependentUpon>Api.cs</DependentUpon>
</None>
</ItemGroup>

<ItemGroup>
Expand Down

This file was deleted.

Loading

0 comments on commit 0161852

Please sign in to comment.