Skip to content

Add OpenAPI Documentation Extension for HTTP Workflow Triggers#80

Merged
sfmskywalker merged 4 commits intodevelop/3.6.0from
feature/http-openapi
Sep 13, 2025
Merged

Add OpenAPI Documentation Extension for HTTP Workflow Triggers#80
sfmskywalker merged 4 commits intodevelop/3.6.0from
feature/http-openapi

Conversation

@cristinamudura
Copy link

📋 Summary

This PR introduces a new Elsa.Http.OpenApi extension module that automatically generates OpenAPI 3.0 documentation for HTTP endpoints exposed by Elsa workflows. The extension provides workflow-aware API documentation with interactive ReDoc interface.

✨ Key Features

  • 🔍 Automatic Endpoint Discovery: Extracts HTTP trigger endpoints from workflow definitions with complete metadata
  • 📊 OpenAPI 3.0 Specification: Generates standard-compliant OpenAPI JSON with workflow-specific organization
  • 📖 Interactive Documentation: Provides ReDoc UI at /documentation for browsing and testing endpoints
  • 🏷️ Workflow-Aware Organization: Groups endpoints by workflow name as tags and includes definition IDs in descriptions

🏗️ Architecture

Core Components

  • IWorkflowEndpointExtractor: Service that extracts HTTP endpoints from workflows with metadata lookup
  • IOpenApiGenerator: Service that generates OpenAPI 3.0 JSON specification
  • IElsaVersionProvider: Dedicated service for Elsa Core version detection
  • EndpointDefinition: Model representing HTTP endpoints with workflow metadata

Usage

builder.Services.AddElsa(elsa => elsa
    .UseHttp(http =>
    {
        http.ConfigureHttpOptions = options => configuration.GetSection("Http").Bind(options);
        
        if (useCaching)
            http.UseCache();
            
        // Add OpenAPI support for HTTP triggers
        http.UseOpenApi();
    })
);
// Elsa HTTP Endpoint activities.
app.UseWorkflows();

app.MapControllers();
...
// Map OpenApi Endpoints
app.MapWorkflowOpenApi();

cristinamudura added 3 commits August 28, 2025 10:48
- Implement IOpenApiGenerator and IWorkflowEndpointExtractor interfaces for OpenAPI documentation generation.
- Create services for generating OpenAPI JSON and extracting workflow HTTP endpoints.
- Add extension methods for configuring OpenAPI services and mapping endpoints.
- Define HttpOpenApiOptions for configuration settings.
- Introduce models for endpoint definitions and version retrieval.
- Update project file with necessary dependencies and descriptions.
… enhance endpoint definition, and remove unused options class
@cristinamudura cristinamudura changed the base branch from main to develop/3.6.0 August 28, 2025 09:06
@sfmskywalker sfmskywalker requested a review from Copilot August 28, 2025 09:21
Copy link
Member

@sfmskywalker sfmskywalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 🎉

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new OpenAPI documentation extension for Elsa workflows that automatically generates API documentation for HTTP workflow triggers. The extension provides workflow-aware OpenAPI 3.0 specifications with interactive ReDoc interface.

Key changes:

  • Automatic endpoint discovery from workflow definitions with HTTP triggers
  • OpenAPI 3.0 JSON generation service with workflow metadata integration
  • Interactive ReDoc UI accessible at /documentation endpoint

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
WorkflowEndpointExtractor.cs Extracts HTTP endpoints from workflows with metadata lookup
OpenApiGenerator.cs Generates OpenAPI 3.0 JSON from endpoint definitions
ElsaVersionProvider.cs Provides Elsa version detection from assembly attributes
EndpointDefinition.cs Data model for HTTP endpoint with workflow metadata
Various extension files Service registration, feature configuration, and endpoint mapping

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

…tractor.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@sfmskywalker sfmskywalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 🚀

@sfmskywalker sfmskywalker merged commit fd086a3 into develop/3.6.0 Sep 13, 2025
2 of 3 checks passed
@greptile-apps greptile-apps bot mentioned this pull request Mar 5, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants