Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ported codegen v2 issue 6941 to v3 #808

Merged
merged 1 commit into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1484,14 +1484,6 @@ else if (schema instanceof ComposedSchema) {
}
}

System.out.println(codegenModel.name);
System.out.println(codegenModel.dataType);
System.out.println(codegenModel.getIsInteger());
System.out.println(codegenModel.getIsNumber());
System.out.println(codegenModel.getIsBoolean());
System.out.println("--------");


return codegenModel;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public abstract class AbstractSwiftCodegen extends DefaultCodegenConfig {
public static final String SWIFT_USE_API_NAMESPACE = "swiftUseApiNamespace";
public static final String DEFAULT_POD_AUTHORS = "Swagger Codegen";
public static final String LENIENT_TYPE_CAST = "lenientTypeCast";
protected static final String MODEL_CLASSES = "modelClasses";
protected static final String USE_MODEL_CLASSES = "useModelClasses";

private static final String LIBRARY_PROMISE_KIT = "PromiseKit";
private static final String LIBRARY_RX_SWIFT = "RxSwift";
Expand Down Expand Up @@ -192,6 +194,10 @@ public void processOpts() {
additionalProperties.put(POD_AUTHORS, DEFAULT_POD_AUTHORS);
}

if (additionalProperties.containsKey(MODEL_CLASSES)) {
additionalProperties.put(USE_MODEL_CLASSES, true);
}

setLenientTypeCast(convertPropertyToBooleanAndWriteBack(LENIENT_TYPE_CAST));

supportingFiles.add(new SupportingFile("Podspec.mustache",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/handlebars/swift4/modelObject.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

public struct {{classname}}: Codable {
public {{#useModelClasses}}class{{/useModelClasses}}{{^useModelClasses}}struct{{/useModelClasses}} {{classname}}: Codable {

{{#allVars}}{{#is this 'enum'}}{{> modelInlineEnumDeclaration}}
{{/is}}{{/allVars}}{{#allVars}}{{#is this 'enum'}} {{#description}}/** {{description}} */
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/handlebars/swift5/modelObject.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

public struct {{classname}}: Codable {
public {{#useModelClasses}}class{{/useModelClasses}}{{^useModelClasses}}struct{{/useModelClasses}} {{classname}}: Codable {

{{#allVars}}
{{#isEnum}}
Expand Down