Skip to content

schemas: Indent .lock.json for readability - #231

Draft
Bham06 wants to merge 1 commit into
crossplane:mainfrom
Bham06:indent-schema-lock-json
Draft

schemas: Indent .lock.json for readability#231
Bham06 wants to merge 1 commit into
crossplane:mainfrom
Bham06:indent-schema-lock-json

Conversation

@Bham06

@Bham06 Bham06 commented Jul 28, 2026

Copy link
Copy Markdown

Description of your changes

schemas/.lock.json was written on a single line, which is hard to read and
causes avoidable merge conflicts whenever more than one dependency changes.

This writes the lock file with json.MarshalIndent (two-space indent) plus a
trailing newline, so each dependency is on its own line. Reads are unaffected:
getLock decodes with a json.Decoder, and indented JSON is still valid. Map
keys marshal in sorted order, so the output is deterministic.

Fixes #168

I have:

  • Read and followed Crossplane's contribution process.
  • Run ./nix.sh flake check to ensure this PR is ready for review. Ran go test ./internal/schemas/manager/... ./internal/dependency/..., go vet, and gofmt, and reviewed the change against .golangci.yml; relied on CI for the full flake check.
  • Added or updated unit tests. (Added TestUpdateLockIsIndented.)
  • Linked a PR or a docs tracking issue to document this change. Internal on-disk lock file format; no user-facing docs.
  • Added backport release-x.y labels to auto-backport this PR. Minor readability change; left to maintainer discretion.

The schema lock file (.lock.json) was written on a single line, making it
hard to read and prone to merge conflicts whenever more than one
dependency changed.

Write it with json.MarshalIndent (two-space indent) and a trailing
newline so each dependency is on its own line. Reads are unaffected;
getLock decodes the file with a json.Decoder and indented JSON remains
valid.

Fixes crossplane#168

Signed-off-by: Bham06 <heu319@student.bham.ac.uk>
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.

Indent schemas/.lock.json

1 participant