Skip to content

REslava.ResultFlow β€” auto-generates Mermaid pipeline diagrams for FluentResults chainsΒ #257

Description

@reslava

Hey @altmann πŸ‘‹

I built a source generator called REslava.ResultFlow that auto-generates Mermaid flowchart diagrams from fluent Result chains β€” and it ships with built-in support for FluentResults out of the box.

Add [ResultFlow] to any FluentResults method:

using FluentResults;
using REslava.ResultFlow;

    [ResultFlow]
    public static Result<string> ProcessCheckout(int userId, int productId) =>
        FindUser(userId)
            .Bind(_ => FindProduct(productId))
            .Bind(p  => BuildOrder(userId, p))
            .Map(o   => $"Order #{o.Id} confirmed β€” {o.Amount:C}");```

The IDE code action (no build needed) injects the diagram as a comment directly above the method:

/*
```mermaid
flowchart LR
    N0_Bind["Bind<br/>User β†’ Product"]:::transform
    N0_Bind -->|ok| N1_Bind
    N0_Bind -->|fail| F0["Failure"]:::failure
    N1_Bind["Bind<br/>Product β†’ Order"]:::transform
    N1_Bind -->|ok| N2_Map
    N1_Bind -->|fail| F1["Failure"]:::failure
    N2_Map["Map<br/>Order β†’ String"]:::transform
    classDef transform fill:#e3f0e8,color:#2f7a5c
    classDef failure fill:#f8e3e3,color:#b13e3e
```*/
    [ResultFlow]
    public static Result<string> ProcessCheckout(int userId, int productId) =>
        FindUser(userId)
            .Bind(_ => FindProduct(productId))
            .Bind(p  => BuildOrder(userId, p))
            .Map(o   => $"Order #{o.Id} confirmed β€” {o.Amount:C}");

The diagram lives next to the code, zero runtime overhead, zero maintenance β€” it regenerates on every click.

For libraries not in the built-in dictionary, a resultflow.json file lets you classify any method names you want.

Just wanted to share β€” thought it might be useful to FluentResults users!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions