Skip to content

♻️ Convert Model generator to Stencil template#182

Open
MadsBogeskov wants to merge 1 commit intoios-431-convert-enumeration-generator-to-stencil-template-v2from
ios-432-convert-model-generator-to-stencil-template-v2
Open

♻️ Convert Model generator to Stencil template#182
MadsBogeskov wants to merge 1 commit intoios-431-convert-enumeration-generator-to-stencil-template-v2from
ios-432-convert-model-generator-to-stencil-template-v2

Conversation

@MadsBogeskov
Copy link
Contributor

@MadsBogeskov MadsBogeskov commented Mar 16, 2026

Problem

Model.toSwift() uses inline string interpolation for the file wrapper.

Solution

Extract file wrapper to Model.stencil, keep complex body logic in Swift.

Testing

All 70 tests pass including golden file tests.

Stack

#169#179#180#181 → this PR → …

IOS-432


Note

Low Risk
Low risk refactor that changes how model Swift source is wrapped (imports/extension/#if DEBUG) but not the generated model body logic; main risk is subtle whitespace/format differences affecting generated output or golden tests.

Overview
Refactors Model.toSwift() to stop building the outer Swift file via manual string concatenation and instead render a new Model.stencil template.

The template now controls imports, optional extension {{ serviceName }} wrapping/indentation, and #if DEBUG gating for isInternalOnly, while Swift continues to generate the core modelBody and passes rendering context (embedded, packagesToImport, etc.) into the template renderer.

Written by Cursor Bugbot for commit 21994cf. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@MadsBogeskov MadsBogeskov force-pushed the ios-431-convert-enumeration-generator-to-stencil-template-v2 branch from ea90dad to ba38e2b Compare March 16, 2026 11:23
@MadsBogeskov MadsBogeskov force-pushed the ios-432-convert-model-generator-to-stencil-template-v2 branch from ef50499 to 4c4d9d2 Compare March 16, 2026 11:23
@MadsBogeskov MadsBogeskov force-pushed the ios-431-convert-enumeration-generator-to-stencil-template-v2 branch from ba38e2b to 33955f7 Compare March 16, 2026 11:40
@MadsBogeskov MadsBogeskov force-pushed the ios-432-convert-model-generator-to-stencil-template-v2 branch from 4c4d9d2 to 21994cf Compare March 16, 2026 11:40
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