Skip to content

feat: add multi-file merge support to generate command#36

Closed
kachawla wants to merge 1 commit into
mainfrom
pr1-generate-types
Closed

feat: add multi-file merge support to generate command#36
kachawla wants to merge 1 commit into
mainfrom
pr1-generate-types

Conversation

@kachawla
Copy link
Copy Markdown
Owner

@kachawla kachawla commented May 15, 2026

Overview

Update the existing generate subcommand of manifest-to-bicep to accept multiple manifest files. When given multiple YAML manifests with the same namespace, their Types maps are merged into a single output (types.json, index.json, index.md).

This supports per-type manifest files (e.g. containers.yaml, routes.yaml) as introduced by the automated resource type registration design, where each file defines a single resource type within a namespace.

Backward compatible: single-file usage works exactly as before.

Part of Unified Bicep extension publishing (PR 1/4). See design doc.

Changes

  • bicep-tools/cmd/manifest-to-bicep/main.go: Updated generate to accept <manifest1> [manifest2...] <output> (last arg is always output dir). Added mergeManifestFiles() that validates same namespace and rejects duplicate types.

Usage

Single file (backward compatible):

go run ./bicep-tools/cmd/manifest-to-bicep generate containers.yaml /tmp/out

Multiple files (merge into one output):

go run ./bicep-tools/cmd/manifest-to-bicep generate containers.yaml routes.yaml persistentVolumes.yaml /tmp/out

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

Adds a generate-types subcommand to manifest-to-bicep for producing only types.json, including support for merging multiple manifests that share a namespace.

Changes:

  • Registers the new generate-types Cobra subcommand.
  • Adds RunGenerateTypes, manifest merge logic, and types.json-only output handling.

Comment thread bicep-tools/cmd/manifest-to-bicep/main.go Outdated
@kachawla kachawla force-pushed the pr1-generate-types branch from c61cf5b to 8458df0 Compare May 15, 2026 19:08
@kachawla
Copy link
Copy Markdown
Owner Author

Re: Copilot's comment on the generate-bicep-types Makefile target reference in the help text (line 145)

Good catch. Removed the forward reference to the generate-bicep-types Makefile target (which is updated in PR 2). The help text now describes the intended usage pattern generically without referencing a target that doesn't exist yet in this PR's scope.

Fixed in the latest force-push.

@kachawla kachawla force-pushed the pr1-generate-types branch from 8458df0 to 81f917b Compare May 15, 2026 20:36
@kachawla kachawla requested a review from Copilot May 15, 2026 20:40
@kachawla kachawla changed the title feat: add generate-types subcommand with multi-file merge support feat: add multi-file merge support to generate command May 15, 2026
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

bicep-tools/cmd/manifest-to-bicep/main.go:121

  • This multi-file path still uses the full extension generator, which produces types.json, index.json, and index.md. The requested generate-types behavior needs a types-only path; otherwise callers that are aggregating namespace-specific types.json files will also overwrite or create index artifacts that should be rebuilt separately.
		result, err = generator.GenerateFromString(merged)

Comment thread bicep-tools/cmd/manifest-to-bicep/main.go
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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread bicep-tools/cmd/manifest-to-bicep/main_test.go Outdated
Comment thread bicep-tools/cmd/manifest-to-bicep/main_test.go Outdated
@kachawla kachawla force-pushed the pr1-generate-types branch 2 times, most recently from b927fe6 to a2cddf0 Compare May 15, 2026 21:33
Update the existing 'generate' subcommand of manifest-to-bicep to accept
multiple manifest files. When given multiple YAML manifests with the same
namespace, their Types maps are merged into a single output (types.json,
index.json, index.md).

This supports per-type manifest files (e.g. containers.yaml, routes.yaml)
as introduced by the automated resource type registration design, where
each file defines a single resource type within a namespace.

Backward compatible: single-file usage works exactly as before.

Part of: unified Bicep extension publishing (PR 1/4)
@kachawla kachawla force-pushed the pr1-generate-types branch from a2cddf0 to 6f82b5d Compare May 15, 2026 21:39
@kachawla kachawla closed this May 16, 2026
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.

2 participants