forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 2.3.0
This commit is contained in:
@@ -288,6 +288,14 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
private Model getParent(Model model) {
|
||||
if (model instanceof ComposedModel) {
|
||||
Model parent = ((ComposedModel) model).getParent();
|
||||
if (parent == null) {
|
||||
// check for interfaces
|
||||
List<RefModel> interfaces = ((ComposedModel) model).getInterfaces();
|
||||
if (interfaces.size() > 0) {
|
||||
RefModel interf = interfaces.get(0);
|
||||
return definitions.get(interf.getSimpleRef());
|
||||
}
|
||||
}
|
||||
if(parent != null) {
|
||||
return definitions.get(parent.getReference());
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ApexClientCodegen extends AbstractJavaCodegen {
|
||||
private static final String API_VERSION = "apiVersion";
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ApexClientCodegen.class);
|
||||
private String classPrefix = "Swag";
|
||||
private String apiVersion = "36.0";
|
||||
private String apiVersion = "39.0";
|
||||
|
||||
public ApexClientCodegen() {
|
||||
super();
|
||||
|
||||
@@ -31,6 +31,7 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
|
||||
public static final String SNAPSHOT = "snapshot";
|
||||
public static final String USE_OPAQUE_TOKEN = "useOpaqueToken";
|
||||
public static final String INJECTION_TOKEN = "injectionToken";
|
||||
public static final String WITH_INTERFACES = "withInterfaces";
|
||||
|
||||
protected String npmName = null;
|
||||
protected String npmVersion = "1.0.0";
|
||||
@@ -56,6 +57,7 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
|
||||
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
|
||||
this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(USE_OPAQUE_TOKEN, "When setting this property to true, OpaqueToken is used instead of InjectionToken", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,6 +97,13 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
|
||||
this.setOpaqueToken();
|
||||
}
|
||||
additionalProperties.put(INJECTION_TOKEN, this.injectionToken);
|
||||
|
||||
if(additionalProperties.containsKey(WITH_INTERFACES)) {
|
||||
boolean withInterfaces = Boolean.parseBoolean(additionalProperties.get(WITH_INTERFACES).toString());
|
||||
if (withInterfaces) {
|
||||
apiTemplateFiles.put("apiInterface.mustache", "Interface.ts");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addNpmPackageGeneration() {
|
||||
|
||||
Reference in New Issue
Block a user