Repository navigation
V1.1.0/docfx - #19
V1.1.0/docfx#19gimlichael wants to merge 8 commits into
Conversation
Type page examples now expose a Main entry point with public models, drop the redundant availability includes, and link to generated native and Docker run actions so readers can execute each sample.
Adds the run-actions manifest, settings and build script, and wires the run-actions content and template into docfx.json so example pages can publish native and Docker run scripts.
[Medium impact] The changes reach the DocFX build and five API example pages, not Carter's request-processing runtime. The PR should not merge until the previously reported compile error in the endpoint example is fixed.
|
| "dependsOn": [ | ||
| "Codebelt.Extensions.Carter@1.1.0" | ||
| ], | ||
| "source": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Codebelt.Extensions.Carter;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Http;\nusing Microsoft.AspNetCore.Http.Metadata;\nusing Microsoft.AspNetCore.Routing;\nusing Microsoft.AspNetCore.Routing.Patterns;\n\nnamespace DocfxExample;\n\npublic static class ProducesExtensionExample\n{\n public static void Main()\n {\n var endpointBuilder = new RouteEndpointBuilder(\n context => Task.CompletedTask,\n RoutePatternFactory.Parse(\"/api/orders\"),\n 0);\n\n var fakeBuilder = new FakeEndpointConventionBuilder();\n EndpointConventionBuilderExtensions.Produces<OrderSummary>(fakeBuilder, StatusCodes.Status200OK, \"application/json\");\n fakeBuilder.Produces(StatusCodes.Status404NotFound);\n\n foreach (var convention in fakeBuilder.Conventions)\n {\n convention(endpointBuilder);\n }\n\n foreach (var metadata in endpointBuilder.Metadata.OfType<IProducesResponseTypeMetadata>())\n {\n Console.WriteLine(\n $\"Status: {metadata.StatusCode}, \" +\n $\"Type: {metadata.Type?.Name ?? \"(none)\"}, \" +\n $\"ContentTypes: {string.Join(\", \", metadata.ContentTypes)}\");\n }\n }\n\n private sealed class FakeEndpointConventionBuilder : IEndpointConventionBuilder\n {\n public List<Action<EndpointBuilder>> Conventions { get; } = [];\n public void Add(Action<EndpointBuilder> convention) => Conventions.Add(convention);\n }\n}\n\npublic sealed record OrderSummary(int Id, string Name);" |
There was a problem hiding this comment.
Endpoint example cannot compile
The new runnable source imports both Codebelt.Extensions.Carter and Microsoft.AspNetCore.Builder, which each define EndpointConventionBuilderExtensions. The unqualified EndpointConventionBuilderExtensions.Produces<OrderSummary>(...) call fails with CS0104, so neither run script can show the response metadata.
Use fakeBuilder.Produces<OrderSummary>(...), as the repository tests do, or fully qualify the class. Update both the embedded source here and the example page.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .docfx/run-actions.manifest.json
Line: 45
Comment:
**Endpoint example cannot compile**
The new runnable source imports both `Codebelt.Extensions.Carter` and `Microsoft.AspNetCore.Builder`, which each define `EndpointConventionBuilderExtensions`. The unqualified `EndpointConventionBuilderExtensions.Produces<OrderSummary>(...)` call fails with `CS0104`, so neither run script can show the response metadata.
Use `fakeBuilder.Produces<OrderSummary>(...)`, as the repository tests do, or fully qualify the class. Update both the embedded source here and the example page.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #19 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 82 82
Branches 3 3
=========================================
Hits 82 82 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The image build script now generates run-actions via BuildRunActions.ps1 and removes generated artifacts in a finally block so failed builds leave no residue.
Registers the modern template overlay and adds the run-actions script so published examples can be run natively or in Docker.
DocFX renders the Examples heading automatically from the example front matter mapping, so the manual heading produced a duplicate section.
Clarifies that example headings are generated by DocFX and that INCLUDE directives are only allowed on namespace pages.
Regenerate DocFX run-actions artifacts to sync host-harness support in BuildRunActions.ps1 and add exampleId, uid, and fenceOrdinal metadata to run-actions.manifest.json.
| if ($hostProcess.HasExited -and $hostProcess.ExitCode -ne 0) { | ||
| $stdOut = $stdoutTask.GetAwaiter().GetResult() | ||
| $errOut = $stderrTask.GetAwaiter().GetResult() | ||
| throw "Host exited with code $($hostProcess.ExitCode). $stdOut $errOut" |
There was a problem hiding this comment.
When a host example sets probePath to an empty string, WaitForExit returns early if the app stops. This check accepts exit code zero, then reports that the host ran for the full startupDelayMs. A sample that forgets to keep the host running therefore passes. Reject any exit during the observation period, regardless of exit code.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .docfx/BuildRunActions.ps1
Line: 379-382
Comment:
**Stopped hosts pass the check**
When a host example sets `probePath` to an empty string, `WaitForExit` returns early if the app stops. This check accepts exit code zero, then reports that the host ran for the full `startupDelayMs`. A sample that forgets to keep the host running therefore passes. Reject any exit during the observation period, regardless of exit code.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
|



This pull request introduces DocFX run-actions tooling and updates the API type examples so readers can execute each sample natively or in Docker.
DocFX run-actions:
Runnable API examples:
Mainentry points with public models and removes redundant availability includes.Changelog:
CHANGELOG.mdfor1.1.0with the new DocFX run-actions tooling and runnable example updates.