Skip to content

fix(cli): skip empty YAML documents during apply - #409

Merged
rakyll merged 1 commit into
google:mainfrom
ktsoator:fix/apply-empty-yaml-documents
Sep 25, 2026
Merged

rakyll merged 1 commit into
google:mainfrom
ktsoator:fix/apply-empty-yaml-documents

Conversation

@ktsoator

@ktsoator ktsoator commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

ax apply fails with "missing kind" when a manifest contains an empty YAML document, such as a trailing "---". Skip empty documents so subsequent resources are processed, while preserving errors for explicit null values and invalid manifests.

To reproduce, save the following as workspaces.yaml:

apiVersion: ax.io/v1alpha1
kind: Workspace
metadata:
  name: first
spec: {}
---
# empty document
---
apiVersion: ax.io/v1alpha1
kind: Workspace
metadata:
  name: second
spec: {}

With an AX server available, run:

ax apply -f workspaces.yaml

Verified using the actual CLI against a local AX gRPC server with an in-memory store.

Before (process exit code: 1):

workspace.ax.io/first created
Error: applying document 2: missing kind

After (process exit code: 0):

workspace.ax.io/first created
workspace.ax.io/second created

Added regression tests. Verified with make test, make build, and go mod tidy with no module changes.

Handle empty documents while preserving errors for invalid manifests.
@rakyll
rakyll merged commit c5c1ac5 into google:main Sep 25, 2026
9 checks passed
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