Skip to content

Fix Swift helper indentation and PHP header comment grammar#2930

Merged
schani merged 1 commit into
masterfrom
fix/swift-indent-php-comment-grammar
Jul 13, 2026
Merged

Fix Swift helper indentation and PHP header comment grammar#2930
schani merged 1 commit into
masterfrom
fix/swift-indent-php-comment-grammar

Conversation

@schani

@schani schani commented Jul 13, 2026

Copy link
Copy Markdown
Member

Two cosmetic fixes to generated output, found while testing 25.0.0-pre1.

Swift: generated helpers were misindented

The multiline templates in SwiftRenderer.ts encoded indentation level L as 2L−1 leading tabs, so all the emitted helper code — JSONNull, JSONCodingKey, JSONAny, the custom dateDecodingStrategy, and the Alamofire extension — rendered method bodies at 12 spaces inside 4-space-indented declarations:

    public func hash(into hasher: inout Hasher) {
            // No-op
    }

This PR halves the leading tab runs (every run in the file was odd-length, so the mapping is exact), making the generated Swift uniformly 4-space indented:

    public func hash(into hasher: inout Hasher) {
        // No-op
    }

The change is whitespace-only: 169 template lines in SwiftRenderer.ts, no logic touched.

PHP: header comment grammar

// This is a autogenerated file:// This is an autogenerated file:

Testing

  • npm run build clean, npm run test:unit passes (71/71).
  • Verified generated Swift for samples that exercise JSONNull, JSONAny, JSONCodingKey, and the date decoder is uniformly indented, and that the PHP header renders correctly.

Unrelated nit noticed while testing, not fixable in a PR: the npm next dist-tag for the quicktype package still points at 9.0.13 — probably worth an npm dist-tag rm quicktype next.

🤖 Generated with Claude Code

The multiline templates in SwiftRenderer emitted indentation level L as
2L-1 tabs, so generated helper code (JSONNull, JSONCodingKey, JSONAny,
the date-decoding strategy, and the Alamofire extension) rendered
method bodies at 12 spaces inside 4-space-indented declarations.
Halve the leading tab runs so every level is one tab and the generated
Swift is uniformly 4-space indented.

Also fix "This is a autogenerated file" -> "an" in the PHP file header.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@schani schani merged commit 8a3d48b into master Jul 13, 2026
24 checks passed
@schani schani deleted the fix/swift-indent-php-comment-grammar branch July 13, 2026 21:55
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.

1 participant