From 3c47d09a77d83211fa8fc697cc08aa2cd958c3b3 Mon Sep 17 00:00:00 2001 From: Tibor Kantor Date: Thu, 18 Dec 2025 10:55:42 +0100 Subject: [PATCH 1/4] fix - removal of deprecated code --- .../templates/boat-swift5/modelObject.mustache | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/boat-scaffold/src/main/templates/boat-swift5/modelObject.mustache b/boat-scaffold/src/main/templates/boat-swift5/modelObject.mustache index b279ed134..890e4c8b8 100644 --- a/boat-scaffold/src/main/templates/boat-swift5/modelObject.mustache +++ b/boat-scaffold/src/main/templates/boat-swift5/modelObject.mustache @@ -25,11 +25,8 @@ {{/allVars}} {{#hasVars}} - @available(*, deprecated, message: "This initializer is deprecated, use the initializer and the setters of {{classname}}.Builder class.") - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init({{#allVars}}{{name}}: {{{datatypeWithEnum}}}{{#required}}{{#isNullable}}? = nil{{/isNullable}}{{/required}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allVars}}) { - {{#allVars}} - self.{{name}} = {{name}} - {{/allVars}} + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init() { + // All properties initialized with their default values } {{/hasVars}} @@ -70,8 +67,11 @@ /// Builder initializer method for {{classname}} DTO. {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func build() -> {{classname}} { - return {{classname}}({{#allVars}}{{name}}: {{name}}{{^-last}}, - {{/-last}}{{/allVars}}) + var result = {{classname}}() + {{#allVars}} + result.{{name}} = {{name}} + {{/allVars}} + return result } public static func ==(lhs: Builder, rhs: Builder) -> Bool { From e641955bec223b1325d8897f3dce94ddd1691f5d Mon Sep 17 00:00:00 2001 From: Tibor Kantor Date: Thu, 18 Dec 2025 11:02:58 +0100 Subject: [PATCH 2/4] fix - removal of comment --- .../src/main/templates/boat-swift5/modelObject.mustache | 1 - 1 file changed, 1 deletion(-) diff --git a/boat-scaffold/src/main/templates/boat-swift5/modelObject.mustache b/boat-scaffold/src/main/templates/boat-swift5/modelObject.mustache index 890e4c8b8..9b1c92d1b 100644 --- a/boat-scaffold/src/main/templates/boat-swift5/modelObject.mustache +++ b/boat-scaffold/src/main/templates/boat-swift5/modelObject.mustache @@ -26,7 +26,6 @@ {{#hasVars}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init() { - // All properties initialized with their default values } {{/hasVars}} From a84dee5e795bd63e32ec686d98196e0891abdbf4 Mon Sep 17 00:00:00 2001 From: Tibor Kantor Date: Thu, 18 Dec 2025 13:40:58 +0100 Subject: [PATCH 3/4] fix - revert original initialiser but made it internal --- .../main/templates/boat-swift5/modelObject.mustache | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/boat-scaffold/src/main/templates/boat-swift5/modelObject.mustache b/boat-scaffold/src/main/templates/boat-swift5/modelObject.mustache index 9b1c92d1b..725d44d0a 100644 --- a/boat-scaffold/src/main/templates/boat-swift5/modelObject.mustache +++ b/boat-scaffold/src/main/templates/boat-swift5/modelObject.mustache @@ -25,7 +25,10 @@ {{/allVars}} {{#hasVars}} - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init() { + internal init({{#allVars}}{{name}}: {{{datatypeWithEnum}}}{{#required}}{{#isNullable}}? = nil{{/isNullable}}{{/required}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allVars}}) { + {{#allVars}} + self.{{name}} = {{name}} + {{/allVars}} } {{/hasVars}} @@ -66,11 +69,8 @@ /// Builder initializer method for {{classname}} DTO. {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func build() -> {{classname}} { - var result = {{classname}}() - {{#allVars}} - result.{{name}} = {{name}} - {{/allVars}} - return result + return {{classname}}({{#allVars}}{{name}}: {{name}}{{^-last}}, + {{/-last}}{{/allVars}}) } public static func ==(lhs: Builder, rhs: Builder) -> Bool { From 9cee7cf48cc2b428bf678001dd8ce17307cc38e0 Mon Sep 17 00:00:00 2001 From: Tibor Kantor Date: Thu, 18 Dec 2025 14:06:51 +0100 Subject: [PATCH 4/4] chore - update release notes --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index a61506999..0cd3191a9 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,9 @@ It currently consists of # Release Notes BOAT is still under development and subject to change. +## 0.17.74 +* Swift5: Removed deprecated initializer from model objects. The initializer is now internal and only accessible through the Builder pattern, preventing breaking code from deprecation warnings. + ## 0.17.73 Added code related to generate webhook endpoints with different goal To add prehook and posthook request mappings for all the requests in spec yaml using webhooks.