Skip to content

Avoid escaping slashes in JSON output - #2205

Merged
jglogan merged 1 commit into
apple:mainfrom
taljeon:codex/json-output-unescaped-slashes
Aug 28, 2026
Merged

jglogan merged 1 commit into
apple:mainfrom
taljeon:codex/json-output-unescaped-slashes

Conversation

@taljeon

@taljeon taljeon commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Fixes #2204.

Swift's default JSONEncoder output escapes forward slashes, which makes CLI JSON paths and URLs harder to read and copy. This change makes the shared CLI JSON renderer always use .withoutEscapingSlashes and routes machine list --format json through that renderer while preserving its ISO-8601 date encoding.

OpenAI Codex assisted with investigation, implementation, and verification. The final change is limited to JSON rendering behavior and focused regression coverage.

Testing

  • Tested locally

  • Added/updated tests

  • Added/updated docs

  • swift test --filter RenderJSONTests — 7 tests passed

  • swift test --filter ContainerCommandsTests — 30 tests passed

  • make test — 763 tests passed

  • strict swift format lint passed for all changed files

@github-actions github-actions Bot added the cli label Aug 28, 2026
@jglogan
jglogan self-requested a review August 28, 2026 20:42
@jglogan

jglogan commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

@taljeon I'm going to let this build completely before approving but it looks like it should be fine to merge.

One thing I noticed when I searched our commands is that MachineInspect doesn't offer a format option or use the shared output code. Feel free to create an issue and PR for that if you like and that should be an easy review and merge as well.

Edit: actually it looks like all our inspect commands are JSON only so it could be a cross-cutting change to have all of them use the common output code and support --format (we could exclude table mode for inspect).

@github-actions

Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 24.85%
Integration 66.91%
Combined 76.31%

@jglogan
jglogan merged commit d65874d into apple:main Aug 28, 2026
4 checks passed
@jglogan

jglogan commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

@taljeon Thanks for taking care of this! Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request]: Don't escape slashes in container JSON output.

2 participants

Sponsor
SponsoredKunjungi sekarang
Promo