Skip to content

Commit c48ef14

Browse files
authored
[swift] remove unused lenientTypeCast option (#19764)
* [swift6] remove unused lenientTypeCast option * [swift6] remove unused lenientTypeCast option * [swift5] remove unused lenientTypeCast option
1 parent 74100e4 commit c48ef14

File tree

8 files changed

+0
-25
lines changed

8 files changed

+0
-25
lines changed

docs/generators/swift5.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
2727
|hashableModels|Make hashable models (default: true)| |true|
2828
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
2929
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
30-
|lenientTypeCast|Accept and cast values for simple types (string-&gt;bool, string-&gt;int, int-&gt;string)| |false|
3130
|library|Library template (sub-template) to use|<dl><dt>**urlsession**</dt><dd>[DEFAULT] HTTP client: URLSession</dd><dt>**alamofire**</dt><dd>HTTP client: Alamofire</dd><dt>**vapor**</dt><dd>HTTP client: Vapor</dd></dl>|urlsession|
3231
|mapFileBinaryToData|[WARNING] This option will be removed and enabled by default in the future once we've enhanced the code to work with `Data` in all the different situations. Map File and Binary to Data (default: false)| |false|
3332
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null|

docs/generators/swift6.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
2929
|hashableModels|Make hashable models (default: true)| |true|
3030
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
3131
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
32-
|lenientTypeCast|Accept and cast values for simple types (string-&gt;bool, string-&gt;int, int-&gt;string)| |false|
3332
|library|Library template (sub-template) to use|<dl><dt>**urlsession**</dt><dd>[DEFAULT] HTTP client: URLSession</dd><dt>**alamofire**</dt><dd>HTTP client: Alamofire</dd><dt>**vapor**</dt><dd>HTTP client: Vapor</dd></dl>|urlsession|
3433
|mapFileBinaryToData|[WARNING] This option will be removed and enabled by default in the future once we've enhanced the code to work with `Data` in all the different situations. Map File and Binary to Data (default: false)| |false|
3534
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null|

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
6464
public static final String READONLY_PROPERTIES = "readonlyProperties";
6565
public static final String SWIFT_USE_API_NAMESPACE = "swiftUseApiNamespace";
6666
public static final String DEFAULT_POD_AUTHORS = "OpenAPI Generator";
67-
public static final String LENIENT_TYPE_CAST = "lenientTypeCast";
6867
public static final String USE_SPM_FILE_STRUCTURE = "useSPMFileStructure";
6968
public static final String SWIFT_PACKAGE_PATH = "swiftPackagePath";
7069
public static final String ONE_OF_UNKNOWN_DEFAULT_CASE = "oneOfUnknownDefaultCase";
@@ -88,7 +87,6 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
8887
@Setter protected String projectName = "OpenAPIClient";
8988
@Setter protected boolean nonPublicApi = false;
9089
@Setter protected boolean objcCompatible = false;
91-
@Setter protected boolean lenientTypeCast = false;
9290
@Setter protected boolean readonlyProperties = false;
9391
@Setter protected boolean swiftUseApiNamespace = false;
9492
@Setter protected boolean useSPMFileStructure = false;
@@ -284,10 +282,6 @@ public Swift5ClientCodegen() {
284282
cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP,
285283
CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC)
286284
.defaultValue(Boolean.TRUE.toString()));
287-
cliOptions.add(new CliOption(LENIENT_TYPE_CAST,
288-
"Accept and cast values for simple types (string->bool, "
289-
+ "string->int, int->string)")
290-
.defaultValue(Boolean.FALSE.toString()));
291285
cliOptions.add(new CliOption(USE_BACKTICK_ESCAPES,
292286
"Escape reserved words using backticks (default: false)")
293287
.defaultValue(Boolean.FALSE.toString()));
@@ -552,8 +546,6 @@ public void processOpts() {
552546
}
553547
additionalProperties.put(VALIDATABLE, validatable);
554548

555-
setLenientTypeCast(convertPropertyToBooleanAndWriteBack(LENIENT_TYPE_CAST));
556-
557549
// make api and model doc path available in mustache template
558550
additionalProperties.put("apiDocPath", apiDocPath);
559551
additionalProperties.put("modelDocPath", modelDocPath);

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift6ClientCodegen.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ public class Swift6ClientCodegen extends DefaultCodegen implements CodegenConfig
6464
public static final String READONLY_PROPERTIES = "readonlyProperties";
6565
public static final String SWIFT_USE_API_NAMESPACE = "swiftUseApiNamespace";
6666
public static final String DEFAULT_POD_AUTHORS = "OpenAPI Generator";
67-
public static final String LENIENT_TYPE_CAST = "lenientTypeCast";
6867
public static final String USE_SPM_FILE_STRUCTURE = "useSPMFileStructure";
6968
public static final String SWIFT_PACKAGE_PATH = "swiftPackagePath";
7069
public static final String ONE_OF_UNKNOWN_DEFAULT_CASE = "oneOfUnknownDefaultCase";
@@ -95,8 +94,6 @@ public class Swift6ClientCodegen extends DefaultCodegen implements CodegenConfig
9594
@Setter
9695
protected boolean objcCompatible = false;
9796
@Setter
98-
protected boolean lenientTypeCast = false;
99-
@Setter
10097
protected boolean readonlyProperties = false;
10198
@Setter
10299
protected boolean swiftUseApiNamespace = false;
@@ -314,10 +311,6 @@ public Swift6ClientCodegen() {
314311
cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP,
315312
CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC)
316313
.defaultValue(Boolean.TRUE.toString()));
317-
cliOptions.add(new CliOption(LENIENT_TYPE_CAST,
318-
"Accept and cast values for simple types (string->bool, "
319-
+ "string->int, int->string)")
320-
.defaultValue(Boolean.FALSE.toString()));
321314
cliOptions.add(new CliOption(USE_BACKTICK_ESCAPES,
322315
"Escape reserved words using backticks (default: false)")
323316
.defaultValue(Boolean.FALSE.toString()));
@@ -604,8 +597,6 @@ public void processOpts() {
604597
}
605598
additionalProperties.put(COMBINE_DEFERRED, combineDeferred);
606599

607-
setLenientTypeCast(convertPropertyToBooleanAndWriteBack(LENIENT_TYPE_CAST));
608-
609600
// make api and model doc path available in mustache template
610601
additionalProperties.put("apiDocPath", apiDocPath);
611602
additionalProperties.put("modelDocPath", modelDocPath);

modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift5OptionsProvider.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public class Swift5OptionsProvider implements OptionsProvider {
3131
public static final String RESPONSE_AS_VALUE = "test";
3232
public static final String NON_PUBLIC_API_REQUIRED_VALUE = "false";
3333
public static final String OBJC_COMPATIBLE_VALUE = "false";
34-
public static final String LENIENT_TYPE_CAST_VALUE = "false";
3534
public static final String POD_SOURCE_VALUE = "{ :git => 'git@github.com:swagger-api/swagger-mustache.git'," +
3635
" :tag => 'v1.0.0-SNAPSHOT' }";
3736
public static final String POD_VERSION_VALUE = "v1.0.0-SNAPSHOT";
@@ -71,7 +70,6 @@ public Map<String, String> createOptions() {
7170
.put(Swift5ClientCodegen.RESPONSE_AS, RESPONSE_AS_VALUE)
7271
.put(CodegenConstants.NON_PUBLIC_API, NON_PUBLIC_API_REQUIRED_VALUE)
7372
.put(Swift5ClientCodegen.OBJC_COMPATIBLE, OBJC_COMPATIBLE_VALUE)
74-
.put(Swift5ClientCodegen.LENIENT_TYPE_CAST, LENIENT_TYPE_CAST_VALUE)
7573
.put(Swift5ClientCodegen.POD_SOURCE, POD_SOURCE_VALUE)
7674
.put(CodegenConstants.POD_VERSION, POD_VERSION_VALUE)
7775
.put(Swift5ClientCodegen.POD_AUTHORS, POD_AUTHORS_VALUE)

modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift6ClientCodegenOptionsProvider.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public class Swift6ClientCodegenOptionsProvider implements OptionsProvider {
3232
public static final String RESPONSE_AS_VALUE = "test";
3333
public static final String NON_PUBLIC_API_REQUIRED_VALUE = "false";
3434
public static final String OBJC_COMPATIBLE_VALUE = "false";
35-
public static final String LENIENT_TYPE_CAST_VALUE = "false";
3635
public static final String POD_SOURCE_VALUE = "{ :git => 'git@github.com:swagger-api/swagger-mustache.git'," +
3736
" :tag => 'v1.0.0-SNAPSHOT' }";
3837
public static final String POD_VERSION_VALUE = "v1.0.0-SNAPSHOT";
@@ -74,7 +73,6 @@ public Map<String, String> createOptions() {
7473
.put(Swift6ClientCodegen.RESPONSE_AS, RESPONSE_AS_VALUE)
7574
.put(CodegenConstants.NON_PUBLIC_API, NON_PUBLIC_API_REQUIRED_VALUE)
7675
.put(Swift6ClientCodegen.OBJC_COMPATIBLE, OBJC_COMPATIBLE_VALUE)
77-
.put(Swift6ClientCodegen.LENIENT_TYPE_CAST, LENIENT_TYPE_CAST_VALUE)
7876
.put(Swift6ClientCodegen.POD_SOURCE, POD_SOURCE_VALUE)
7977
.put(CodegenConstants.POD_VERSION, POD_VERSION_VALUE)
8078
.put(Swift6ClientCodegen.POD_AUTHORS, POD_AUTHORS_VALUE)

modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5OptionsTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ protected void verifyOptions() {
4545
verify(clientCodegen).setResponseAs(Swift5OptionsProvider.RESPONSE_AS_VALUE.split(","));
4646
verify(clientCodegen).setNonPublicApi(Boolean.parseBoolean(Swift5OptionsProvider.NON_PUBLIC_API_REQUIRED_VALUE));
4747
verify(clientCodegen).setObjcCompatible(Boolean.parseBoolean(Swift5OptionsProvider.OBJC_COMPATIBLE_VALUE));
48-
verify(clientCodegen).setLenientTypeCast(Boolean.parseBoolean(Swift5OptionsProvider.LENIENT_TYPE_CAST_VALUE));
4948
verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(Swift5OptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE));
5049
verify(clientCodegen).setReadonlyProperties(Boolean.parseBoolean(Swift5OptionsProvider.READONLY_PROPERTIES_VALUE));
5150
verify(clientCodegen).setGenerateModelAdditionalProperties(Boolean.parseBoolean(Swift5OptionsProvider.GENERATE_MODEL_ADDITIONAL_PROPERTIES_VALUE));

modules/openapi-generator/src/test/java/org/openapitools/codegen/swift6/Swift6ClientCodegenOptionsTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ protected void verifyOptions() {
4646
verify(clientCodegen)
4747
.setNonPublicApi(Boolean.parseBoolean(Swift6ClientCodegenOptionsProvider.NON_PUBLIC_API_REQUIRED_VALUE));
4848
verify(clientCodegen).setObjcCompatible(Boolean.parseBoolean(Swift6ClientCodegenOptionsProvider.OBJC_COMPATIBLE_VALUE));
49-
verify(clientCodegen).setLenientTypeCast(Boolean.parseBoolean(Swift6ClientCodegenOptionsProvider.LENIENT_TYPE_CAST_VALUE));
5049
verify(clientCodegen).setPrependFormOrBodyParameters(
5150
Boolean.valueOf(Swift6ClientCodegenOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE));
5251
verify(clientCodegen)

0 commit comments

Comments
 (0)