[swift6] Encode request bodies as compact JSON

Merged
SP
4d ago
+0-14

Fixes #25186.

Drop .prettyPrinted from CodableHelper's default JSONEncoder, so request bodies are compact JSON. The JSON content is identical, only the whitespace goes. A jsonEncoder set by the user is unaffected, and so is anyone who sets outputFormatting themselves.

DateFormatTests.testCodableAlwaysResultsInUTCEncodedDate already removes .prettyPrinted, so that line becomes a no-op and the tests are unaffected.

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/swift6*.yaml || exit
    
    Commit all changed files.
  • @mention the technical committee: @jgavris @ehyche @Edubits @jaz-ah @4brunu @dydus0x14

Summary by cubic

Makes Swift 6 request bodies compact JSON by removing .prettyPrinted from CodableHelper's default JSONEncoder, so outgoing bodies no longer carry unnecessary whitespace.

  • Request bodies are now smaller on the wire; the JSON content is unchanged.
  • A user-supplied jsonEncoder is unaffected, and anyone setting outputFormatting themselves keeps full control.
  • Regenerates all swift6 samples to match the new default.