Skip to content

Develop#4

Merged
Henry-cmd325 merged 4 commits intomainfrom
develop
Mar 21, 2026
Merged

Develop#4
Henry-cmd325 merged 4 commits intomainfrom
develop

Conversation

@Henry-cmd325
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings March 21, 2026 02:03
@Henry-cmd325 Henry-cmd325 merged commit 7462bdf into main Mar 21, 2026
4 checks passed
Copy link
Copy Markdown

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 modernizes FastSharp’s CRUD endpoint infrastructure by introducing DTO contracts and splitting CRUD behavior into dedicated endpoint classes, while also updating documentation (English-only) and strengthening CI with test coverage reporting.

Changes:

  • Refactor generic CRUD mapping into per-endpoint classes (GetById/GetList/GetPaged/Create/Update/Delete) and expand ICrudEndpoints to support DTO contracts.
  • Update docs/README and samples to reflect the new configuration API (ConfigureModule, DTO usage, IEndpoint).
  • Add DTO-focused tests and a GitHub Actions workflow to run tests with coverage and upload to Codecov.

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
docs/roadmap.md English cleanup + roadmap items and docs links updated
docs/customization.md Rewritten customization guide; adds DTO contracts + custom endpoints section
docs/basic-usage.md Removed basic usage doc page
docs/assembly-scanning.md English-only rewrite and updated index links
docs/architecture.md English-only rewrite; updates ConfigureGroupConfigureModule in examples
TestResults/45897c75-1624-4731-9ed6-cc050062f741/coverage.cobertura.xml Adds a coverage artifact to the repo
Samples/Api/Modules/Products/ProductsModule.cs Updates sample module to new API + DTO configuration
Samples/Api/Modules/Products/Dtos/ProductRequest.cs Adds sample request DTO
Samples/Api/Modules/Products/Dtos/ProductDto.cs Adds sample DTO
README.md Major rewrite: new Quick Start + configuration examples + docs links
FastSharp.slnx Updates solution items list for docs
FastSharp.Tests/TestModel.cs Converts to file-scoped namespace and top-level type
FastSharp.Tests/Modules/GroupedModule.cs Updates tests to use ConfigureModule
FastSharp.Tests/Modules/DtoModules.cs Adds test modules covering DTO configurations
FastSharp.Tests/Modules/CustomModule.cs File-scoped namespace cleanup
FastSharp.Tests/FastSharpEndpointsTests.cs Adds DTO contract tests and expands CRUD behavior assertions
FastSharp.Tests/FastSharp.Tests.csproj Adds coverlet collector dependency
FastSharp.Tests/Dtos/TestModelDtos.cs Adds DTO types used by tests
FastSharp.Modules/Module.cs Refactors mapping; introduces ConfigureModule and explicit IFastModule.Map
FastSharp.Modules/IFastModule.cs Changes interface shape/visibility of Map
FastSharp.Modules/IEndpoint.cs File-scoped namespace cleanup
FastSharp.Modules/FastSharp.Modules.csproj Adds Mapster dependency
FastSharp.Modules/Endpoints/UpdateEndpoint.cs Adds Update endpoint implementation (+ DTO overload)
FastSharp.Modules/Endpoints/IGenericEndpoint.cs Introduces internal generic endpoint abstraction
FastSharp.Modules/Endpoints/GetPagedEndpoint.cs Adds paged endpoint implementation (+ DTO projection)
FastSharp.Modules/Endpoints/GetListEndpoint.cs Adds list endpoint implementation (+ DTO projection)
FastSharp.Modules/Endpoints/GetByIdEndpoint.cs Adds get-by-id implementation (+ DTO projection)
FastSharp.Modules/Endpoints/DeleteEndpoint.cs Adds delete endpoint implementation
FastSharp.Modules/Endpoints/CreateEndpoint.cs Adds create endpoint implementation (+ DTO + request/response overloads)
FastSharp.Modules/DependencyInjection.cs File-scoped namespace cleanup + minor comments
FastSharp.Modules/Configuration/ICrudEndpoints.cs Expands configuration surface (DTO contracts, per-endpoint config methods)
FastSharp.Modules/Configuration/GenericEndpoints.cs File-scoped namespace cleanup
FastSharp.Modules/Configuration/EndpointOptions.cs File-scoped namespace cleanup
FastSharp.Modules/Configuration/CRUDEndpoints.cs Refactors CRUD mapping to use endpoint classes + DTO contract wiring
.github/workflows/tests-coverage.yml Adds CI job for tests + coverage + Codecov upload
.github/copilot-instructions.md Adds repo-level guidance for documentation language and priorities

{
opt.WithTags("Productos")
.WithDescription("Endpoints for managing products in the inventory");
endpoint.WithDescription("Retrieves a product by its unique identifier").WithTags("Get");
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

This config is applied to GetPaged, but the description says “Retrieves a product by its unique identifier”, which is misleading for a paged list endpoint. Please update the description (and/or tags) to match the actual route behavior.

Suggested change
endpoint.WithDescription("Retrieves a product by its unique identifier").WithTags("Get");
endpoint.WithDescription("Retrieves a paged list of products").WithTags("List");

Copilot uses AI. Check for mistakes.
ConfigAll.Builder?.Invoke(app);
specific?.Builder?.Invoke(app);
}
public void ConfigureAll(Action<RouteHandlerBuilder> configure)
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

CRUDEndpoints exposes ConfigureAll(Action<RouteHandlerBuilder> ...), but AddCRUD only provides ICrudEndpoints<TDbContext> to callers and the interface does not include this overload. This makes the method effectively unreachable for typical consumers and also causes docs confusion. Either add the overload to ICrudEndpoints or remove/privatize it and update the docs/examples accordingly.

Suggested change
public void ConfigureAll(Action<RouteHandlerBuilder> configure)
internal void ConfigureAll(Action<RouteHandlerBuilder> configure)

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +37
// Example 2: Apply metadata to all CRUD endpoints
crud.ConfigureAll(endpoints =>
{
endpoints.WithDescription("Products CRUD endpoint");
});
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

The example calls crud.ConfigureAll(endpoints => ...), but AddCRUD exposes ICrudEndpoints<TDbContext> and that interface doesn't define a non-generic ConfigureAll(Action<RouteHandlerBuilder>) overload. As written, this snippet won't compile; either add this overload to ICrudEndpoints (and implement it) or update the docs to use an existing API (e.g., ConfigureAll<TDto>(...) or individual endpoint config methods).

Copilot uses AI. Check for mistakes.
Comment on lines +11 to +13
/// <param name="endpointName">The generic endpoint to disable. This parameter must not be null.</param>
public void DisableEndpoint(GenericEndpoint endpointName);

Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

Changing the configuration API from fluent chaining (returning ICrudEndpoints<TDbContext>) to void is a breaking change for existing consumers. If backward compatibility matters, consider keeping the fluent return type (or providing both forms) so existing module configuration code continues to compile.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +2
using Api.Context.Models;

Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

using Api.Context.Models; appears unused in this DTO file. Consider removing it to avoid warnings and keep the sample code clean.

Suggested change
using Api.Context.Models;

Copilot uses AI. Check for mistakes.
Comment on lines +7 to +9
- [Modular architecture](architecture.md)
- [Basic usage](basic-usage.md)
- [Custom endpoints](customization.md#custom-endpoints)
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

basic-usage.md is linked in the docs index here, but docs/basic-usage.md is removed in this PR. This makes the roadmap index link broken; either restore basic-usage.md or update the link to the new location/content (and keep the docs section consistent across files).

Copilot uses AI. Check for mistakes.
Comment on lines +89 to +91
- [Modular architecture](architecture.md)
- [Basic usage](basic-usage.md)

Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

This index still links to basic-usage.md, but docs/basic-usage.md is deleted in this PR. Update this link (and any other references in this file) to avoid broken navigation.

Copilot uses AI. Check for mistakes.
<File Path="docs/architecture.md" />
<File Path="docs/assembly-scanning.md" />
<File Path="docs/basic-usage.md" />
<File Path="docs/customization.md" />
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

docs/assembly-scanning.md still exists (and is linked from the README), but it was removed from the solution items here. If the intent is to keep docs discoverable in the solution, consider re-adding docs/assembly-scanning.md (and any other kept docs like docs/index.md) to this folder.

Suggested change
<File Path="docs/customization.md" />
<File Path="docs/customization.md" />
<File Path="docs/assembly-scanning.md" />

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +6
<?xml version="1.0" encoding="utf-8"?>
<coverage line-rate="0.8240000000000001" branch-rate="0.6338" version="1.9" timestamp="1774046183" lines-covered="309" lines-valid="375" branches-covered="116" branches-valid="183">
<sources>
<source>C:\Users\SYTEC\source\repos\Henry-cmd325\FastSharp\</source>
</sources>
<packages>
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

This Cobertura report looks like a generated test artifact (it even contains an absolute local path under <sources>). Committing files under TestResults/ will create noisy diffs and conflicts; please remove this file from the PR and add TestResults/ (or at least coverage.cobertura.xml) to .gitignore.

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +20
ConfigureModule("api/products", opt =>
{
opt.WithTags("Productos")
.WithDescription("Endpoints for managing products in the inventory");
});

AddCRUD<Product, int>("products", crud =>
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

With ConfigureModule("api/products", ...) and then AddCRUD(...)("products", ...), the final CRUD routes will be grouped under api/products/products (duplicated segment). Consider using a module prefix like "/api" (or "api/") and keep the CRUD prefix as "products", or set the module prefix to "/api" and CRUD prefix to "products" so the resulting base route is /api/products.

Copilot uses AI. Check for mistakes.
@codecov-commenter
Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

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