Conversation
There was a problem hiding this comment.
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
ICrudEndpointsto 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 ConfigureGroup → ConfigureModule 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"); |
There was a problem hiding this comment.
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.
| endpoint.WithDescription("Retrieves a product by its unique identifier").WithTags("Get"); | |
| endpoint.WithDescription("Retrieves a paged list of products").WithTags("List"); |
| ConfigAll.Builder?.Invoke(app); | ||
| specific?.Builder?.Invoke(app); | ||
| } | ||
| public void ConfigureAll(Action<RouteHandlerBuilder> configure) |
There was a problem hiding this comment.
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.
| public void ConfigureAll(Action<RouteHandlerBuilder> configure) | |
| internal void ConfigureAll(Action<RouteHandlerBuilder> configure) |
| // Example 2: Apply metadata to all CRUD endpoints | ||
| crud.ConfigureAll(endpoints => | ||
| { | ||
| endpoints.WithDescription("Products CRUD endpoint"); | ||
| }); |
There was a problem hiding this comment.
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).
| /// <param name="endpointName">The generic endpoint to disable. This parameter must not be null.</param> | ||
| public void DisableEndpoint(GenericEndpoint endpointName); | ||
|
|
There was a problem hiding this comment.
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.
| using Api.Context.Models; | ||
|
|
There was a problem hiding this comment.
using Api.Context.Models; appears unused in this DTO file. Consider removing it to avoid warnings and keep the sample code clean.
| using Api.Context.Models; |
| - [Modular architecture](architecture.md) | ||
| - [Basic usage](basic-usage.md) | ||
| - [Custom endpoints](customization.md#custom-endpoints) |
There was a problem hiding this comment.
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).
| - [Modular architecture](architecture.md) | ||
| - [Basic usage](basic-usage.md) | ||
|
|
There was a problem hiding this comment.
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.
| <File Path="docs/architecture.md" /> | ||
| <File Path="docs/assembly-scanning.md" /> | ||
| <File Path="docs/basic-usage.md" /> | ||
| <File Path="docs/customization.md" /> |
There was a problem hiding this comment.
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.
| <File Path="docs/customization.md" /> | |
| <File Path="docs/customization.md" /> | |
| <File Path="docs/assembly-scanning.md" /> |
| <?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> |
There was a problem hiding this comment.
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.
| ConfigureModule("api/products", opt => | ||
| { | ||
| opt.WithTags("Productos") | ||
| .WithDescription("Endpoints for managing products in the inventory"); | ||
| }); | ||
|
|
||
| AddCRUD<Product, int>("products", crud => |
There was a problem hiding this comment.
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.
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 ☂️ |
No description provided.