mirror of
https://github.com/apple/container.git
synced 2026-08-28 11:26:32 +00:00
Fix inconsistent volume createdAt JSON encoding (#1556)
- Closes #1533 - This PR aligns `volume list --format json` date encoding with volume inspect by using ISO-8601 instead of the default numeric reference-date format.
This commit is contained in:
@@ -43,7 +43,8 @@ extension Application.VolumeCommand {
|
||||
let volumes = try await ClientVolume.list()
|
||||
|
||||
if format == .json {
|
||||
try Output.emit(Output.renderJSON(volumes))
|
||||
let options = JSONOptions(dateEncodingStrategy: .iso8601)
|
||||
try Output.emit(Output.renderJSON(volumes, options: options))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -319,7 +319,9 @@ class TestCLIAnonymousVolumes: CLITest {
|
||||
|
||||
// Parse JSON to verify metadata
|
||||
let data = output.data(using: .utf8)!
|
||||
let volumes = try JSONDecoder().decode([Volume].self, from: data)
|
||||
let decoder = JSONDecoder()
|
||||
decoder.dateDecodingStrategy = .iso8601
|
||||
let volumes = try decoder.decode([Volume].self, from: data)
|
||||
|
||||
let anonVolume = volumes.first { $0.name == volumeName }
|
||||
#expect(anonVolume != nil, "should find anonymous volume in list")
|
||||
|
||||
Reference in New Issue
Block a user