Implement Bicep module documentation generation - #20183
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Test this change out locally with the following install scripts (Action run 32170321111) VSCode
Azure CLI
|
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds experimental module documentation generation across Bicep.Core, CLI, and JSON-RPC.
Changes:
- Adds typed documentation models and Scriban rendering.
- Adds
bicep docs generate/outputwith discovery and atomic writes. - Adds RPC client support, feature configuration, and tests.
Reviewed changes
Copilot reviewed 77 out of 77 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
.gitattributes |
Enforces fixture line endings. |
docs/experimental-features.md |
Documents the feature flag. |
src/Directory.Packages.props |
Adds Scriban version. |
src/vscode-bicep/schemas/bicepconfig.schema.json |
Defines docs feature configuration. |
src/Bicep.Testing/TestFeatureProviderFactory.cs |
Propagates the feature flag. |
src/Bicep.RpcClient/PooledBicepClientFactory.cs |
Forwards pooled documentation requests. |
src/Bicep.RpcClient/Models/Models.cs |
Adds documentation RPC models. |
src/Bicep.RpcClient/IBicepDocumentationClient.cs |
Defines documentation client capability. |
src/Bicep.RpcClient/BicepClient.cs |
Implements documentation RPC calls. |
src/Bicep.RpcClient.Tests/PooledBicepClientFactoryTests.cs |
Tests pooled forwarding. |
src/Bicep.RpcClient.Tests/Files/PublicApis/Azure.Bicep.RpcClient.txt |
Updates public API baseline. |
src/Bicep.RpcClient.Tests/BicepClientUnitTests.cs |
Tests RPC methods and versions. |
src/Bicep.Core/Features/RecordBasedFeatureProvider.cs |
Exposes docs feature state. |
src/Bicep.Core/Features/IFeatureProvider.cs |
Adds feature-provider contract. |
src/Bicep.Core/Features/FeatureProvider.cs |
Reads docs feature configuration. |
src/Bicep.Core/Documentation/Templates/Markdown.scriban |
Provides built-in Markdown rendering. |
src/Bicep.Core/Documentation/IBicepDocumentationGenerator.cs |
Defines generation API. |
src/Bicep.Core/Documentation/BicepDocumentationUsageExample.cs |
Models usage examples. |
src/Bicep.Core/Documentation/BicepDocumentationTypeAnalyzer.cs |
Projects Bicep type metadata. |
src/Bicep.Core/Documentation/BicepDocumentationTemplateLoader.cs |
Resolves template includes. |
src/Bicep.Core/Documentation/BicepDocumentationScriptModelFactory.cs |
Creates the Scriban model. |
src/Bicep.Core/Documentation/BicepDocumentationResourceType.cs |
Models resource types. |
src/Bicep.Core/Documentation/BicepDocumentationReference.cs |
Models module references. |
src/Bicep.Core/Documentation/BicepDocumentationPreset.cs |
Defines rendering presets. |
src/Bicep.Core/Documentation/BicepDocumentationParameter.cs |
Models parameters and discriminators. |
src/Bicep.Core/Documentation/BicepDocumentationOutput.cs |
Models outputs. |
src/Bicep.Core/Documentation/BicepDocumentationOrdering.cs |
Provides deterministic ordering. |
src/Bicep.Core/Documentation/BicepDocumentationModel.cs |
Defines the aggregate docs model. |
src/Bicep.Core/Documentation/BicepDocumentationGenerator.cs |
Builds and renders documentation. |
src/Bicep.Core/Documentation/BicepDocumentationGenerationOptions.cs |
Defines rendering options. |
src/Bicep.Core/Documentation/BicepDocumentationFunction.cs |
Models exported functions. |
src/Bicep.Core/Documentation/BicepDocumentationException.cs |
Defines documentation failures. |
src/Bicep.Core/Documentation/BicepDocumentationExampleDiscovery.cs |
Discovers local examples. |
src/Bicep.Core/Documentation/BicepDocumentationDataCollection.cs |
Models telemetry information. |
src/Bicep.Core/Configuration/ExperimentalFeaturesEnabled.cs |
Adds docs feature configuration. |
src/Bicep.Core/BicepCoreServiceCollectionExtensions.cs |
Registers the generator. |
src/Bicep.Core/Bicep.Core.csproj |
Embeds template and references Scriban. |
src/Bicep.Core.UnitTests/Features/OverriddenFeatureProvider.cs |
Supports feature overrides. |
src/Bicep.Core.UnitTests/Features/FeatureProviderTests.cs |
Tests feature compatibility. |
src/Bicep.Core.UnitTests/Features/FeatureProviderOverrides.cs |
Adds docs override state. |
src/Bicep.Core.UnitTests/Documentation/ThrowingFileExplorer.cs |
Supports I/O failure tests. |
src/Bicep.Core.UnitTests/Documentation/Files/ExpectedMarkdown.md |
Defines Markdown golden output. |
src/Bicep.Core.UnitTests/Documentation/BicepDocumentationTypeAnalyzerTests.cs |
Tests type projection. |
src/Bicep.Core.UnitTests/Documentation/BicepDocumentationTemplateLoaderTests.cs |
Tests include loading. |
src/Bicep.Core.UnitTests/Documentation/BicepDocumentationScriptModelFactoryTests.cs |
Tests Scriban model projection. |
src/Bicep.Core.UnitTests/Documentation/BicepDocumentationOrderingTests.cs |
Tests stable ordering. |
src/Bicep.Core.UnitTests/Documentation/BicepDocumentationGeneratorTests.cs |
Tests model generation and rendering. |
src/Bicep.Core.UnitTests/Documentation/BicepDocumentationExampleDiscoveryTests.cs |
Tests example discovery. |
src/Bicep.Core.UnitTests/Configuration/ConfigurationManagerTests.cs |
Updates configuration expectations. |
src/Bicep.Core.UnitTests/Bicep.Core.UnitTests.csproj |
Embeds Markdown fixtures. |
src/Bicep.Cli/Services/OutputWriter.cs |
Adds atomic file replacement. |
src/Bicep.Cli/Services/DocsModuleScanner.cs |
Resolves modules and outputs. |
src/Bicep.Cli/Services/DocsFileWriter.cs |
Wraps atomic documentation writes. |
src/Bicep.Cli/Services/DocsCommandRunner.cs |
Compiles and renders modules. |
src/Bicep.Cli/Rpc/ICliJsonRpcProtocol.cs |
Defines documentation RPC operations. |
src/Bicep.Cli/Rpc/CliJsonRpcServer.cs |
Implements documentation RPC operations. |
src/Bicep.Cli/Program.cs |
Registers docs commands and services. |
src/Bicep.Cli/Helpers/IServiceCollectionExtensions.cs |
Registers command handlers. |
src/Bicep.Cli/Constants/CliConstants.cs |
Adds docs command constants. |
src/Bicep.Cli/Commands/JsonRpcCommand.cs |
Injects documentation RPC services. |
src/Bicep.Cli/Commands/DocsOutputCommand.cs |
Implements stdout rendering. |
src/Bicep.Cli/Commands/DocsGenerateCommand.cs |
Implements file generation. |
src/Bicep.Cli/Commands/DocsCommand.cs |
Defines the docs command group. |
src/Bicep.Cli/Arguments/DocsOutputArguments.cs |
Defines output arguments. |
src/Bicep.Cli/Arguments/DocsGenerateArguments.cs |
Defines generate arguments. |
src/Bicep.Cli.IntegrationTests/JsonRpcCommandTests.cs |
Tests documentation RPC behavior. |
src/Bicep.Cli.IntegrationTests/HelpTests.cs |
Tests docs help output. |
src/Bicep.Cli.IntegrationTests/Files/DocsCommandTests/Comprehensive/tests/e2e/restricted/main.test.bicep |
Provides test usage example. |
src/Bicep.Cli.IntegrationTests/Files/DocsCommandTests/Comprehensive/templates/custom.scriban |
Provides custom template fixture. |
src/Bicep.Cli.IntegrationTests/Files/DocsCommandTests/Comprehensive/shared/_footer.md |
Provides include fixture. |
src/Bicep.Cli.IntegrationTests/Files/DocsCommandTests/Comprehensive/README.expected.md |
Defines CLI golden output. |
src/Bicep.Cli.IntegrationTests/Files/DocsCommandTests/Comprehensive/modules/logging.bicep |
Provides referenced module fixture. |
src/Bicep.Cli.IntegrationTests/Files/DocsCommandTests/Comprehensive/main.bicep |
Provides comprehensive module fixture. |
src/Bicep.Cli.IntegrationTests/Files/DocsCommandTests/Comprehensive/examples/default/main.bicep |
Provides default usage example. |
src/Bicep.Cli.IntegrationTests/Files/DocsCommandTests/Comprehensive/bicepconfig.json |
Enables docs in fixture. |
src/Bicep.Cli.IntegrationTests/Files/DocsCommandTests/Comprehensive/_header.md |
Provides header include fixture. |
src/Bicep.Cli.IntegrationTests/DocsCommandTests.cs |
Tests CLI generation and failures. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5b6b551b-dfe1-461c-8caa-e9d250df1026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5b6b551b-dfe1-461c-8caa-e9d250df1026
AVM full-registry documentation validationValidated Bicep PR #20183 commit
Full evidence: summary, validation log, 573-row comparison CSV, and 49-row semantic mismatch report Evidence file SHA256: The validated reusable AVM template and no-fallback verifier are tracked in AVM tools PR #67. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5b6b551b-dfe1-461c-8caa-e9d250df1026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5b6b551b-dfe1-461c-8caa-e9d250df1026
Adopt standard output arguments and the shared resolver, remove documentation-only writer and scanner wrappers, and retain deterministic safety and failure behavior across CLI and JSON-RPC. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5b6b551b-dfe1-461c-8caa-e9d250df1026
Keep the template path exception test valid on both Windows and Unix runners. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5b6b551b-dfe1-461c-8caa-e9d250df1026
AVM full-registry documentation validationValidated Bicep PR #20183 commit
Full evidence (573-row comparison, semantic mismatch report, summary, validation log, and compiler diagnostics): https://gist.github.com/jaredfholgate/71babd2c996edf08473dcdb10a58aa12 Evidence manifest SHA256: The validated reusable AVM template and no-fallback verifier are tracked in AVM tools PR #67. |
Add an optional docs config for entrypoints, output, templates, custom values, configurable example sources, and conditional parent-to-child example reassignment across CLI, Core, and JSON-RPC. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5b6b551b-dfe1-461c-8caa-e9d250df1026
Semantic comparison correctionThe earlier AVM evidence comment reported 49 unexplained semantic-index differences. That result has now been fully investigated and superseded by validation of commit
Final full-registry result:
Updated evidence: https://gist.github.com/jaredfholgate/71babd2c996edf08473dcdb10a58aa12 Evidence manifest SHA256: The matching docs configuration and verifier are in AVM tools PR #67 at The byte-parity template still validates rendering and file behavior rather than semantic section reconstruction; the separate corrected semantic index is the evidence for parameter/example coverage. |
Document command enablement, every CLI input, configuration schema and precedence, worked JSON examples, discovery reassignment, templates, diagnostics, and the complete template model. Ensure bulk generation emits the experimental disclaimer once after a successful compilation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5b6b551b-dfe1-461c-8caa-e9d250df1026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5b6b551b-dfe1-461c-8caa-e9d250df1026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5b6b551b-dfe1-461c-8caa-e9d250df1026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5b6b551b-dfe1-461c-8caa-e9d250df1026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5b6b551b-dfe1-461c-8caa-e9d250df1026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5b6b551b-dfe1-461c-8caa-e9d250df1026
Description
Adds the experimental
bicep docs generatecommand, which renders module documentation from Bicep's semantic model plus discovered usage examples through Scriban.Implements REP 0025: Module documentation generation commands and supersedes Azure/bicep#19694.
The validated AVM templates, root configuration, semantic verifier, and full-repository runner are in Azure/azure-verified-modules-tools PR #67.
Example usage
--stdoutfollows the existing Bicep output-option contract and cannot be combined with--pattern,--outdir, or--outfile.What's included
CLI
bicep docs generatecommand with explicit.bicepor--patterninput--stdout,--outdir, and--outfilebehaviorCore engine
Bicep.CoreConfiguration
documentationsection inbicepconfig.jsonbicepconfig.schema.jsonvalidation/IntelliSenseJSON-RPC
bicep/generateDocsandbicep/outputDocsremain directly onIBicepClientbicepconfig.jsonConfiguration
{ "documentation": { "output": { "file": "README.md" }, "template": { "file": "docs/templates/readme.scriban", "includeRoot": "docs/templates", "values": { "owner": "Platform Team" } }, "examples": { "sources": [ { "path": "examples", "include": ["*.bicep", "**/main.bicep"], "exclude": ["**/dependencies*.bicep"] } ], "reassignments": [] } } }Configured relative template paths are anchored to the resolved config file's directory. CLI template paths remain current-directory-relative.
bicepconfig.jsonremains nearest-file-wins with no ancestor merging. A module with its own config does not inherit repository-level documentation settings and receives built-in defaults for omitted values. Repositories requiring uniform settings should prevent nested configs until configuration inheritance is designed separately.Full experimental reference:
docs/experimental/docs-commands.md.Impact on existing commands
InputOutputArgumentsResolversupports a fixed output filename resolver so docs can useREADME.mdrather than extension replacement. Existing callers omit it and retain their existing behavior. Common filesystem/path exception predicates now live inBicep.IO; CLI-wide central exception handling is intentionally not changed in this PR.Documentation uses the standard non-atomic
OutputWriter.WriteToFileAsyncpath used by other commands. Compilation and rendering complete before the write, so those failures do not overwrite an existing output.Validation
Bicep.Core.UnitTests: 7,001 passedBicep.Cli.IntegrationTests: 1,137 passedBicep.Cli.UnitTests: 72 passedBicep.IO.UnitTests: 145 passedBicep.RpcClient.Tests: 96 passed, 1 skippedTrimmed single-file publish — Release
win-x64, commit583ede7ae0617361fa66e08feae8d5d457de3017:includematched exactlybicepconfig.jsonmatched exactly30F50C158D1C6715E1A28C1FDF8F9691EE243226FE24AC82970AADD610BCCB18Full
Azure/bicep-registry-modulesvalidation against the same Bicep commit:00:13:36.2321022avm/ptn/app/container-job-toolkithas genuine compilation errors (BCP426,BCP104,BCP287, andBCP036)Checklist