diff --git a/.travis.yml b/.travis.yml index b220e67bc21..d6a4f8bedcc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,8 +20,8 @@ cache: - $HOME/samples/client/petstore/typescript-fetch/builds/es6-target/typings - $HOME/samples/client/petstore/typescript-fetch/builds/with-npm-version/node_modules - $HOME/samples/client/petstore/typescript-fetch/npm/with-npm-version/typings - - $HOME/samples/client/petstore/typescript-angular/node_modules - - $HOME/samples/client/petstore/typescript-angular/typings + - $HOME/samples/client/petstore/typescript-angularjs/node_modules + - $HOME/samples/client/petstore/typescript-angularjs/typings - $HOME/.cocoapods/repos/master # note: docker is not yet supported in iOS build #services: diff --git a/bin/typescript-angular2-petstore-all.sh b/bin/typescript-angular-v2-petstore-all.sh similarity index 82% rename from bin/typescript-angular2-petstore-all.sh rename to bin/typescript-angular-v2-petstore-all.sh index d60082e2ec2..ae2ae18719f 100755 --- a/bin/typescript-angular2-petstore-all.sh +++ b/bin/typescript-angular-v2-petstore-all.sh @@ -28,13 +28,13 @@ fi export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" echo "Typescript Petstore API client (default)" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -o samples/client/petstore/typescript-angular2/default --additional-properties ngVersion=2" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -o samples/client/petstore/typescript-angular-v2/default --additional-properties ngVersion=2" java $JAVA_OPTS -jar $executable $ags echo "Typescript Petstore API client (npm setting)" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular2/npm --additional-properties ngVersion=2" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular-v2/npm --additional-properties ngVersion=2" java $JAVA_OPTS -jar $executable $ags echo "Typescript Petstore API client (with interfaces generated)" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -o samples/client/petstore/typescript-angular2/with-interfaces -D withInterfaces=true --additional-properties ngVersion=2" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces -D withInterfaces=true --additional-properties ngVersion=2" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular2-petstore-interfaces.sh b/bin/typescript-angular-v2-petstore-interfaces.sh similarity index 88% rename from bin/typescript-angular2-petstore-interfaces.sh rename to bin/typescript-angular-v2-petstore-interfaces.sh index 2ada8e7f803..bbc8861fce3 100755 --- a/bin/typescript-angular2-petstore-interfaces.sh +++ b/bin/typescript-angular-v2-petstore-interfaces.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -o samples/client/petstore/typescript-angular2/with-interfaces -D withInterfaces=true --additional-properties ngVersion=2" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces -D withInterfaces=true --additional-properties ngVersion=2" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular4-petstore-with-npm.sh b/bin/typescript-angular-v2-petstore-with-npm.sh similarity index 88% rename from bin/typescript-angular4-petstore-with-npm.sh rename to bin/typescript-angular-v2-petstore-with-npm.sh index 597a83630e1..c19bead1557 100755 --- a/bin/typescript-angular4-petstore-with-npm.sh +++ b/bin/typescript-angular-v2-petstore-with-npm.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular4/npm --additional-properties ngVersion=4" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular-v2/npm --additional-properties ngVersion=2" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular2-petstore.sh b/bin/typescript-angular-v2-petstore.sh similarity index 92% rename from bin/typescript-angular2-petstore.sh rename to bin/typescript-angular-v2-petstore.sh index 63e5d6dd2d8..bdac72ae304 100755 --- a/bin/typescript-angular2-petstore.sh +++ b/bin/typescript-angular-v2-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -o samples/client/petstore/typescript-angular2/default --additional-properties ngVersion=2" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -o samples/client/petstore/typescript-angular-v2/default --additional-properties ngVersion=2" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular2-petstore-with-npm.sh b/bin/typescript-angular-v4-petstore-with-npm.sh similarity index 88% rename from bin/typescript-angular2-petstore-with-npm.sh rename to bin/typescript-angular-v4-petstore-with-npm.sh index ae148bc88f5..f0fcba26874 100755 --- a/bin/typescript-angular2-petstore-with-npm.sh +++ b/bin/typescript-angular-v4-petstore-with-npm.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular2/npm --additional-properties ngVersion=2" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular-v4/npm --additional-properties ngVersion=4" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular-petstore.sh b/bin/typescript-angularjs-petstore.sh similarity index 100% rename from bin/typescript-angular-petstore.sh rename to bin/typescript-angularjs-petstore.sh diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java deleted file mode 100644 index 759a5bdff09..00000000000 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java +++ /dev/null @@ -1,360 +0,0 @@ -package io.swagger.codegen.languages; - -import java.io.File; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import io.swagger.codegen.CliOption; -import io.swagger.codegen.CodegenModel; -import io.swagger.codegen.CodegenParameter; -import io.swagger.codegen.CodegenOperation; -import io.swagger.codegen.SupportingFile; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.FileProperty; -import io.swagger.models.properties.MapProperty; -import io.swagger.models.properties.ObjectProperty; -import io.swagger.models.properties.Property; - -public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCodegen { - private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm"); - - public static final String NPM_NAME = "npmName"; - public static final String NPM_VERSION = "npmVersion"; - public static final String NPM_REPOSITORY = "npmRepository"; - public static final String SNAPSHOT = "snapshot"; - public static final String WITH_INTERFACES = "withInterfaces"; - public static final String NG_VERSION = "ngVersion"; - - protected String npmName = null; - protected String npmVersion = "1.0.0"; - protected String npmRepository = null; - protected String ngVersion = "4"; - - public TypeScriptAngular2ClientCodegen() { - super(); - this.outputFolder = "generated-code/typescript-angular2"; - - embeddedTemplateDir = templateDir = "typescript-angular2"; - modelTemplateFiles.put("model.mustache", ".ts"); - apiTemplateFiles.put("api.service.mustache", ".ts"); - languageSpecificPrimitives.add("Blob"); - typeMapping.put("file","Blob"); - apiPackage = "api"; - modelPackage = "model"; - - - this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package")); - this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package")); - 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(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString())); - this.cliOptions.add(new CliOption(NG_VERSION, "The version of Angular (2 or 4). Default is '4'")); - } - - @Override - protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, ModelImpl swaggerModel) { - codegenModel.additionalPropertiesType = getTypeDeclaration(swaggerModel.getAdditionalProperties()); - addImport(codegenModel, codegenModel.additionalPropertiesType); - } - - @Override - public String getName() { - return "typescript-angular"; - } - - @Override - public String getHelp() { - return "Generates a TypeScript Angular (2.x or 4.x) client library."; - } - - @Override - public void processOpts() { - super.processOpts(); - supportingFiles.add(new SupportingFile("models.mustache", modelPackage().replace('.', File.separatorChar), "models.ts")); - supportingFiles.add(new SupportingFile("apis.mustache", apiPackage().replace('.', File.separatorChar), "api.ts")); - supportingFiles.add(new SupportingFile("index.mustache", getIndexDirectory(), "index.ts")); - supportingFiles.add(new SupportingFile("api.module.mustache", getIndexDirectory(), "api.module.ts")); - supportingFiles.add(new SupportingFile("rxjs-operators.mustache", getIndexDirectory(), "rxjs-operators.ts")); - supportingFiles.add(new SupportingFile("configuration.mustache", getIndexDirectory(), "configuration.ts")); - supportingFiles.add(new SupportingFile("variables.mustache", getIndexDirectory(), "variables.ts")); - supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); - supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); - - if(additionalProperties.containsKey(NPM_NAME)) { - addNpmPackageGeneration(); - } - - if(additionalProperties.containsKey(WITH_INTERFACES)) { - boolean withInterfaces = Boolean.parseBoolean(additionalProperties.get(WITH_INTERFACES).toString()); - if (withInterfaces) { - apiTemplateFiles.put("apiInterface.mustache", "Interface.ts"); - } - } - - // determine NG version - if (additionalProperties.containsKey(NG_VERSION)) { - if ("2".equals(additionalProperties.get(NG_VERSION).toString())) { - additionalProperties.put("isNg2x", true); - setNgVersion("2"); - } else if ("4".equals(additionalProperties.get(NG_VERSION).toString())) { - additionalProperties.put("isNg4x", true); - setNgVersion("4"); - } else { - throw new IllegalArgumentException("Invalid ngVersion, which must be either '2' or '4'"); - } - } else { - // default to 4 - additionalProperties.put("isNg4x", true); - setNgVersion("4"); - } - } - - private void addNpmPackageGeneration() { - if(additionalProperties.containsKey(NPM_NAME)) { - this.setNpmName(additionalProperties.get(NPM_NAME).toString()); - } - - if (additionalProperties.containsKey(NPM_VERSION)) { - this.setNpmVersion(additionalProperties.get(NPM_VERSION).toString()); - } - - if (additionalProperties.containsKey(SNAPSHOT) && Boolean.valueOf(additionalProperties.get(SNAPSHOT).toString())) { - this.setNpmVersion(npmVersion + "-SNAPSHOT." + SNAPSHOT_SUFFIX_FORMAT.format(new Date())); - } - additionalProperties.put(NPM_VERSION, npmVersion); - - if (additionalProperties.containsKey(NPM_REPOSITORY)) { - this.setNpmRepository(additionalProperties.get(NPM_REPOSITORY).toString()); - } - - //Files for building our lib - supportingFiles.add(new SupportingFile("README.mustache", getIndexDirectory(), "README.md")); - supportingFiles.add(new SupportingFile("package.mustache", getIndexDirectory(), "package.json")); - supportingFiles.add(new SupportingFile("typings.mustache", getIndexDirectory(), "typings.json")); - supportingFiles.add(new SupportingFile("tsconfig.mustache", getIndexDirectory(), "tsconfig.json")); - } - - private String getIndexDirectory() { - String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.'))); - return indexPackage.replace('.', File.separatorChar); - } - - @Override - public boolean isDataTypeFile(final String dataType) { - return dataType != null && dataType.equals("Blob"); - } - - @Override - public String getTypeDeclaration(Property p) { - Property inner; - if(p instanceof ArrayProperty) { - ArrayProperty mp1 = (ArrayProperty)p; - inner = mp1.getItems(); - return this.getSwaggerType(p) + "<" + this.getTypeDeclaration(inner) + ">"; - } else if(p instanceof MapProperty) { - MapProperty mp = (MapProperty)p; - inner = mp.getAdditionalProperties(); - return "{ [key: string]: " + this.getTypeDeclaration(inner) + "; }"; - } else if(p instanceof FileProperty) { - return "Blob"; - } else if(p instanceof ObjectProperty) { - return "any"; - } else { - return super.getTypeDeclaration(p); - } - } - - @Override - public String getSwaggerType(Property p) { - String swaggerType = super.getSwaggerType(p); - if(isLanguagePrimitive(swaggerType) || isLanguageGenericType(swaggerType)) { - return swaggerType; - } - applyLocalTypeMapping(swaggerType); - return swaggerType; - } - - private String applyLocalTypeMapping(String type) { - if (typeMapping.containsKey(type)) { - type = typeMapping.get(type); - } - return type; - } - - private boolean isLanguagePrimitive(String type) { - return languageSpecificPrimitives.contains(type); - } - - private boolean isLanguageGenericType(String type) { - for (String genericType: languageGenericTypes) { - if (type.startsWith(genericType + "<")) { - return true; - } - } - return false; - } - - @Override - public void postProcessParameter(CodegenParameter parameter) { - super.postProcessParameter(parameter); - parameter.dataType = applyLocalTypeMapping(parameter.dataType); - } - - @Override - public Map postProcessOperations(Map operations) { - Map objs = (Map) operations.get("operations"); - - // Add filename information for api imports - objs.put("apiFilename", getApiFilenameFromClassname(objs.get("classname").toString())); - - List ops = (List) objs.get("operation"); - for (CodegenOperation op : ops) { - // Convert httpMethod to Angular's RequestMethod enum - // https://angular.io/docs/ts/latest/api/http/index/RequestMethod-enum.html - switch (op.httpMethod) { - case "GET": - op.httpMethod = "RequestMethod.Get"; - break; - case "POST": - op.httpMethod = "RequestMethod.Post"; - break; - case "PUT": - op.httpMethod = "RequestMethod.Put"; - break; - case "DELETE": - op.httpMethod = "RequestMethod.Delete"; - break; - case "OPTIONS": - op.httpMethod = "RequestMethod.Options"; - break; - case "HEAD": - op.httpMethod = "RequestMethod.Head"; - break; - case "PATCH": - op.httpMethod = "RequestMethod.Patch"; - break; - default: - throw new RuntimeException("Unknown HTTP Method " + op.httpMethod + " not allowed"); - } - - // Convert path to TypeScript template string - op.path = op.path.replaceAll("\\{(.*?)\\}", "\\$\\{$1\\}"); - } - - // Add additional filename information for model imports in the services - List> imports = (List>) operations.get("imports"); - for(Map im : imports) { - im.put("filename", im.get("import")); - im.put("classname", getModelnameFromModelFilename(im.get("filename").toString())); - } - - return operations; - } - - @Override - public Map postProcessModels(Map objs) { - Map result = super.postProcessModels(objs); - - // Add additional filename information for imports - List models = (List) postProcessModelsEnum(result).get("models"); - for (Object _mo : models) { - Map mo = (Map) _mo; - CodegenModel cm = (CodegenModel) mo.get("model"); - mo.put("tsImports", toTsImports(cm.imports)); - } - - return result; - } - - private List> toTsImports(Set imports) { - List> tsImports = new ArrayList<>(); - for(String im : imports) { - HashMap tsImport = new HashMap<>(); - tsImport.put("classname", im); - tsImport.put("filename", toModelFilename(im)); - tsImports.add(tsImport); - } - return tsImports; - } - - @Override - public String toApiName(String name) { - if (name.length() == 0) { - return "DefaultService"; - } - return initialCaps(name) + "Service"; - } - - @Override - public String toApiFilename(String name) { - if (name.length() == 0) { - return "default.service"; - } - return camelize(name, true) + ".service"; - } - - @Override - public String toApiImport(String name) { - return apiPackage() + "/" + toApiFilename(name); - } - - @Override - public String toModelFilename(String name) { - return camelize(toModelName(name), true); - } - - @Override - public String toModelImport(String name) { - return modelPackage() + "/" + toModelFilename(name); - } - - public String getNgVersion() { - return ngVersion; - } - - public void setNgVersion(String ngVersion) { - this.ngVersion = ngVersion; - } - - public String getNpmName() { - return npmName; - } - - public void setNpmName(String npmName) { - this.npmName = npmName; - } - - public String getNpmVersion() { - return npmVersion; - } - - public void setNpmVersion(String npmVersion) { - this.npmVersion = npmVersion; - } - - public String getNpmRepository() { - return npmRepository; - } - - public void setNpmRepository(String npmRepository) { - this.npmRepository = npmRepository; - } - - private String getApiFilenameFromClassname(String classname) { - String name = classname.substring(0, classname.length() - "Service".length()); - return toApiFilename(name); - } - - private String getModelnameFromModelFilename(String filename) { - String name = filename.substring((modelPackage() + "/").length()); - return camelize(name); - } - -} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java index e1c58e894af..20f4dc16a89 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java @@ -1,21 +1,77 @@ package io.swagger.codegen.languages; import java.io.File; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; -import io.swagger.codegen.SupportingFile; +import io.swagger.codegen.CliOption; +import io.swagger.codegen.CodegenModel; import io.swagger.codegen.CodegenParameter; +import io.swagger.codegen.CodegenOperation; +import io.swagger.codegen.SupportingFile; +import io.swagger.models.ModelImpl; +import io.swagger.models.properties.ArrayProperty; +import io.swagger.models.properties.BooleanProperty; +import io.swagger.models.properties.FileProperty; +import io.swagger.models.properties.MapProperty; +import io.swagger.models.properties.ObjectProperty; import io.swagger.models.properties.Property; public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCodegen { + private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm"); + + public static final String NPM_NAME = "npmName"; + public static final String NPM_VERSION = "npmVersion"; + public static final String NPM_REPOSITORY = "npmRepository"; + public static final String SNAPSHOT = "snapshot"; + public static final String WITH_INTERFACES = "withInterfaces"; + public static final String NG_VERSION = "ngVersion"; + + protected String npmName = null; + protected String npmVersion = "1.0.0"; + protected String npmRepository = null; + protected String ngVersion = "4"; + + public TypeScriptAngularClientCodegen() { + super(); + this.outputFolder = "generated-code/typescript-angular"; + + embeddedTemplateDir = templateDir = "typescript-angular"; + modelTemplateFiles.put("model.mustache", ".ts"); + apiTemplateFiles.put("api.service.mustache", ".ts"); + languageSpecificPrimitives.add("Blob"); + typeMapping.put("file","Blob"); + apiPackage = "api"; + modelPackage = "model"; + + + this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package")); + this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package")); + 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(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString())); + this.cliOptions.add(new CliOption(NG_VERSION, "The version of Angular (2 or 4). Default is '4'")); + } + + @Override + protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, ModelImpl swaggerModel) { + codegenModel.additionalPropertiesType = getTypeDeclaration(swaggerModel.getAdditionalProperties()); + addImport(codegenModel, codegenModel.additionalPropertiesType); + } @Override public String getName() { - return "typescript-angularjs"; + return "typescript-angular"; } @Override public String getHelp() { - return "Generates a TypeScript AngularJS client library."; + return "Generates a TypeScript Angular (2.x or 4.x) client library."; } @Override @@ -25,34 +81,64 @@ public void processOpts() { supportingFiles.add(new SupportingFile("apis.mustache", apiPackage().replace('.', File.separatorChar), "api.ts")); supportingFiles.add(new SupportingFile("index.mustache", getIndexDirectory(), "index.ts")); supportingFiles.add(new SupportingFile("api.module.mustache", getIndexDirectory(), "api.module.ts")); - supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("rxjs-operators.mustache", getIndexDirectory(), "rxjs-operators.ts")); + supportingFiles.add(new SupportingFile("configuration.mustache", getIndexDirectory(), "configuration.ts")); + supportingFiles.add(new SupportingFile("variables.mustache", getIndexDirectory(), "variables.ts")); supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); - } - - public TypeScriptAngularClientCodegen() { - super(); - outputFolder = "generated-code/typescript-angular"; - modelTemplateFiles.put("model.mustache", ".ts"); - apiTemplateFiles.put("api.mustache", ".ts"); - embeddedTemplateDir = templateDir = "typescript-angular"; - apiPackage = "api"; - modelPackage = "model"; - } + if(additionalProperties.containsKey(NPM_NAME)) { + addNpmPackageGeneration(); + } - @Override - public String getSwaggerType(Property p) { - String swaggerType = super.getSwaggerType(p); - if(isLanguagePrimitive(swaggerType) || isLanguageGenericType(swaggerType)) { - return swaggerType; + if(additionalProperties.containsKey(WITH_INTERFACES)) { + boolean withInterfaces = Boolean.parseBoolean(additionalProperties.get(WITH_INTERFACES).toString()); + if (withInterfaces) { + apiTemplateFiles.put("apiInterface.mustache", "Interface.ts"); + } + } + + // determine NG version + if (additionalProperties.containsKey(NG_VERSION)) { + if ("2".equals(additionalProperties.get(NG_VERSION).toString())) { + additionalProperties.put("isNg2x", true); + setNgVersion("2"); + } else if ("4".equals(additionalProperties.get(NG_VERSION).toString())) { + additionalProperties.put("isNg4x", true); + setNgVersion("4"); + } else { + throw new IllegalArgumentException("Invalid ngVersion, which must be either '2' or '4'"); + } + } else { + // default to 4 + additionalProperties.put("isNg4x", true); + setNgVersion("4"); } - return addModelPrefix(swaggerType); } - @Override - public void postProcessParameter(CodegenParameter parameter) { - super.postProcessParameter(parameter); - parameter.dataType = addModelPrefix(parameter.dataType); + private void addNpmPackageGeneration() { + if(additionalProperties.containsKey(NPM_NAME)) { + this.setNpmName(additionalProperties.get(NPM_NAME).toString()); + } + + if (additionalProperties.containsKey(NPM_VERSION)) { + this.setNpmVersion(additionalProperties.get(NPM_VERSION).toString()); + } + + if (additionalProperties.containsKey(SNAPSHOT) && Boolean.valueOf(additionalProperties.get(SNAPSHOT).toString())) { + this.setNpmVersion(npmVersion + "-SNAPSHOT." + SNAPSHOT_SUFFIX_FORMAT.format(new Date())); + } + additionalProperties.put(NPM_VERSION, npmVersion); + + if (additionalProperties.containsKey(NPM_REPOSITORY)) { + this.setNpmRepository(additionalProperties.get(NPM_REPOSITORY).toString()); + } + + //Files for building our lib + supportingFiles.add(new SupportingFile("README.mustache", getIndexDirectory(), "README.md")); + supportingFiles.add(new SupportingFile("package.mustache", getIndexDirectory(), "package.json")); + supportingFiles.add(new SupportingFile("typings.mustache", getIndexDirectory(), "typings.json")); + supportingFiles.add(new SupportingFile("tsconfig.mustache", getIndexDirectory(), "tsconfig.json")); } private String getIndexDirectory() { @@ -60,16 +146,44 @@ private String getIndexDirectory() { return indexPackage.replace('.', File.separatorChar); } - private String addModelPrefix(String swaggerType) { - String type = null; - if (typeMapping.containsKey(swaggerType)) { - type = typeMapping.get(swaggerType); + @Override + public boolean isDataTypeFile(final String dataType) { + return dataType != null && dataType.equals("Blob"); + } + + @Override + public String getTypeDeclaration(Property p) { + Property inner; + if(p instanceof ArrayProperty) { + ArrayProperty mp1 = (ArrayProperty)p; + inner = mp1.getItems(); + return this.getSwaggerType(p) + "<" + this.getTypeDeclaration(inner) + ">"; + } else if(p instanceof MapProperty) { + MapProperty mp = (MapProperty)p; + inner = mp.getAdditionalProperties(); + return "{ [key: string]: " + this.getTypeDeclaration(inner) + "; }"; + } else if(p instanceof FileProperty) { + return "Blob"; + } else if(p instanceof ObjectProperty) { + return "any"; } else { - type = swaggerType; + return super.getTypeDeclaration(p); + } + } + + @Override + public String getSwaggerType(Property p) { + String swaggerType = super.getSwaggerType(p); + if(isLanguagePrimitive(swaggerType) || isLanguageGenericType(swaggerType)) { + return swaggerType; } + applyLocalTypeMapping(swaggerType); + return swaggerType; + } - if (!isLanguagePrimitive(type) && !isLanguageGenericType(type)) { - type = "models." + swaggerType; + private String applyLocalTypeMapping(String type) { + if (typeMapping.containsKey(type)) { + type = typeMapping.get(type); } return type; } @@ -86,4 +200,161 @@ private boolean isLanguageGenericType(String type) { } return false; } + + @Override + public void postProcessParameter(CodegenParameter parameter) { + super.postProcessParameter(parameter); + parameter.dataType = applyLocalTypeMapping(parameter.dataType); + } + + @Override + public Map postProcessOperations(Map operations) { + Map objs = (Map) operations.get("operations"); + + // Add filename information for api imports + objs.put("apiFilename", getApiFilenameFromClassname(objs.get("classname").toString())); + + List ops = (List) objs.get("operation"); + for (CodegenOperation op : ops) { + // Convert httpMethod to Angular's RequestMethod enum + // https://angular.io/docs/ts/latest/api/http/index/RequestMethod-enum.html + switch (op.httpMethod) { + case "GET": + op.httpMethod = "RequestMethod.Get"; + break; + case "POST": + op.httpMethod = "RequestMethod.Post"; + break; + case "PUT": + op.httpMethod = "RequestMethod.Put"; + break; + case "DELETE": + op.httpMethod = "RequestMethod.Delete"; + break; + case "OPTIONS": + op.httpMethod = "RequestMethod.Options"; + break; + case "HEAD": + op.httpMethod = "RequestMethod.Head"; + break; + case "PATCH": + op.httpMethod = "RequestMethod.Patch"; + break; + default: + throw new RuntimeException("Unknown HTTP Method " + op.httpMethod + " not allowed"); + } + + // Convert path to TypeScript template string + op.path = op.path.replaceAll("\\{(.*?)\\}", "\\$\\{$1\\}"); + } + + // Add additional filename information for model imports in the services + List> imports = (List>) operations.get("imports"); + for(Map im : imports) { + im.put("filename", im.get("import")); + im.put("classname", getModelnameFromModelFilename(im.get("filename").toString())); + } + + return operations; + } + + @Override + public Map postProcessModels(Map objs) { + Map result = super.postProcessModels(objs); + + // Add additional filename information for imports + List models = (List) postProcessModelsEnum(result).get("models"); + for (Object _mo : models) { + Map mo = (Map) _mo; + CodegenModel cm = (CodegenModel) mo.get("model"); + mo.put("tsImports", toTsImports(cm.imports)); + } + + return result; + } + + private List> toTsImports(Set imports) { + List> tsImports = new ArrayList<>(); + for(String im : imports) { + HashMap tsImport = new HashMap<>(); + tsImport.put("classname", im); + tsImport.put("filename", toModelFilename(im)); + tsImports.add(tsImport); + } + return tsImports; + } + + @Override + public String toApiName(String name) { + if (name.length() == 0) { + return "DefaultService"; + } + return initialCaps(name) + "Service"; + } + + @Override + public String toApiFilename(String name) { + if (name.length() == 0) { + return "default.service"; + } + return camelize(name, true) + ".service"; + } + + @Override + public String toApiImport(String name) { + return apiPackage() + "/" + toApiFilename(name); + } + + @Override + public String toModelFilename(String name) { + return camelize(toModelName(name), true); + } + + @Override + public String toModelImport(String name) { + return modelPackage() + "/" + toModelFilename(name); + } + + public String getNgVersion() { + return ngVersion; + } + + public void setNgVersion(String ngVersion) { + this.ngVersion = ngVersion; + } + + public String getNpmName() { + return npmName; + } + + public void setNpmName(String npmName) { + this.npmName = npmName; + } + + public String getNpmVersion() { + return npmVersion; + } + + public void setNpmVersion(String npmVersion) { + this.npmVersion = npmVersion; + } + + public String getNpmRepository() { + return npmRepository; + } + + public void setNpmRepository(String npmRepository) { + this.npmRepository = npmRepository; + } + + private String getApiFilenameFromClassname(String classname) { + String name = classname.substring(0, classname.length() - "Service".length()); + return toApiFilename(name); + } + + private String getModelnameFromModelFilename(String filename) { + String name = filename.substring((modelPackage() + "/").length()); + return camelize(name); + } + } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularJsClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularJsClientCodegen.java new file mode 100644 index 00000000000..1e61fab05b9 --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularJsClientCodegen.java @@ -0,0 +1,89 @@ +package io.swagger.codegen.languages; + +import java.io.File; + +import io.swagger.codegen.SupportingFile; +import io.swagger.codegen.CodegenParameter; +import io.swagger.models.properties.Property; + +public class TypeScriptAngularJsClientCodegen extends AbstractTypeScriptClientCodegen { + + @Override + public String getName() { + return "typescript-angularjs"; + } + + @Override + public String getHelp() { + return "Generates a TypeScript AngularJS client library."; + } + + @Override + public void processOpts() { + super.processOpts(); + supportingFiles.add(new SupportingFile("models.mustache", modelPackage().replace('.', File.separatorChar), "models.ts")); + supportingFiles.add(new SupportingFile("apis.mustache", apiPackage().replace('.', File.separatorChar), "api.ts")); + supportingFiles.add(new SupportingFile("index.mustache", getIndexDirectory(), "index.ts")); + supportingFiles.add(new SupportingFile("api.module.mustache", getIndexDirectory(), "api.module.ts")); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); + + } + + public TypeScriptAngularJsClientCodegen() { + super(); + outputFolder = "generated-code/typescript-angularjs"; + modelTemplateFiles.put("model.mustache", ".ts"); + apiTemplateFiles.put("api.mustache", ".ts"); + embeddedTemplateDir = templateDir = "typescript-angularjs"; + apiPackage = "api"; + modelPackage = "model"; + } + + @Override + public String getSwaggerType(Property p) { + String swaggerType = super.getSwaggerType(p); + if(isLanguagePrimitive(swaggerType) || isLanguageGenericType(swaggerType)) { + return swaggerType; + } + return addModelPrefix(swaggerType); + } + + @Override + public void postProcessParameter(CodegenParameter parameter) { + super.postProcessParameter(parameter); + parameter.dataType = addModelPrefix(parameter.dataType); + } + + private String getIndexDirectory() { + String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.'))); + return indexPackage.replace('.', File.separatorChar); + } + + private String addModelPrefix(String swaggerType) { + String type = null; + if (typeMapping.containsKey(swaggerType)) { + type = typeMapping.get(swaggerType); + } else { + type = swaggerType; + } + + if (!isLanguagePrimitive(type) && !isLanguageGenericType(type)) { + type = "models." + swaggerType; + } + return type; + } + + private boolean isLanguagePrimitive(String type) { + return languageSpecificPrimitives.contains(type); + } + + private boolean isLanguageGenericType(String type) { + for (String genericType: languageGenericTypes) { + if (type.startsWith(genericType + "<")) { + return true; + } + } + return false; + } +} diff --git a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig index 670be0ef233..c9a01a179f6 100644 --- a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig +++ b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig @@ -69,9 +69,9 @@ io.swagger.codegen.languages.Swift4Codegen io.swagger.codegen.languages.Swift3Codegen io.swagger.codegen.languages.SwiftCodegen io.swagger.codegen.languages.TizenClientCodegen -io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen -io.swagger.codegen.languages.TypeScriptAngularClientCodegen io.swagger.codegen.languages.TypeScriptAureliaClientCodegen +io.swagger.codegen.languages.TypeScriptAngularClientCodegen +io.swagger.codegen.languages.TypeScriptAngularJsClientCodegen io.swagger.codegen.languages.TypeScriptFetchClientCodegen io.swagger.codegen.languages.TypeScriptJqueryClientCodegen io.swagger.codegen.languages.TypeScriptNodeClientCodegen diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/README.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/README.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/README.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angular/README.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/api.module.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/api.module.mustache index 1b01079af8c..d41c4114222 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular/api.module.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/api.module.mustache @@ -1,13 +1,25 @@ -import * as api from './api/api'; -import * as angular from 'angular'; +import { NgModule, ModuleWithProviders } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { HttpModule } from '@angular/http'; +import { Configuration } from './configuration'; {{#apiInfo}} -const apiModule = angular.module('api', []) {{#apis}} -{{#operations}} -.service('{{classname}}', api.{{classname}}) -{{/operations}} +import { {{classname}} } from './{{importPath}}'; {{/apis}} +{{/apiInfo}} -export default apiModule; -{{/apiInfo}} \ No newline at end of file +@NgModule({ + imports: [ CommonModule, HttpModule ], + declarations: [], + exports: [], + providers: [ {{#apiInfo}}{{#apis}}{{classname}}{{#hasMore}}, {{/hasMore}}{{/apis}}{{/apiInfo}} ] +}) +export class ApiModule { + public static forConfig(configurationFactory: () => Configuration): ModuleWithProviders { + return { + ngModule: ApiModule, + providers: [ {provide: Configuration, useFactory: configurationFactory}] + } + } +} diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.service.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/api.service.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/apiInterface.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/apiInterface.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/apiInterface.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angular/apiInterface.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/configuration.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/configuration.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/gitignore b/modules/swagger-codegen/src/main/resources/typescript-angular/gitignore index 35e2fb2b02e..149b5765472 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular/gitignore +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/gitignore @@ -1,3 +1,4 @@ wwwroot/*.js node_modules typings +dist diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/index.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/index.mustache index 557365516ad..c312b70fa3e 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular/index.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/index.mustache @@ -1,2 +1,5 @@ export * from './api/api'; -export * from './model/models'; \ No newline at end of file +export * from './model/models'; +export * from './variables'; +export * from './configuration'; +export * from './api.module'; \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/model.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/model.mustache index f1bded256c0..0d5cf4c146e 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular/model.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/model.mustache @@ -1,38 +1,16 @@ {{>licenseInfo}} -import * as models from './models'; - {{#models}} {{#model}} +{{#tsImports}} +import { {{classname}} } from './{{filename}}'; +{{/tsImports}} + + {{#description}} /** * {{{description}}} */ {{/description}} -export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ -{{#vars}} -{{#description}} - /** - * {{{description}}} - */ -{{/description}} - "{{name}}"{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; -{{/vars}} -} - -{{#hasEnums}} -export namespace {{classname}} { -{{#vars}} -{{#isEnum}} - export enum {{enumName}} { - {{#allowableValues}} - {{#enumVars}} - {{{name}}} = {{{value}}}{{^-last}},{{/-last}} - {{/enumVars}} - {{/allowableValues}} - } -{{/isEnum}} -{{/vars}} -} -{{/hasEnums}} +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>modelGeneric}}{{/isEnum}} {{/model}} {{/models}} diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/modelEnum.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/modelEnum.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/modelEnum.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angular/modelEnum.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/modelGeneric.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/modelGeneric.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/modelGeneric.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angular/modelGeneric.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/package.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/package.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/package.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angular/package.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/rxjs-operators.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/rxjs-operators.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/rxjs-operators.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angular/rxjs-operators.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/tsconfig.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/tsconfig.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/tsconfig.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angular/tsconfig.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/typings.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/typings.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/typings.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angular/typings.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/variables.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/variables.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/variables.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angular/variables.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.module.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.module.mustache deleted file mode 100644 index d41c4114222..00000000000 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.module.mustache +++ /dev/null @@ -1,25 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { HttpModule } from '@angular/http'; -import { Configuration } from './configuration'; - -{{#apiInfo}} -{{#apis}} -import { {{classname}} } from './{{importPath}}'; -{{/apis}} -{{/apiInfo}} - -@NgModule({ - imports: [ CommonModule, HttpModule ], - declarations: [], - exports: [], - providers: [ {{#apiInfo}}{{#apis}}{{classname}}{{#hasMore}}, {{/hasMore}}{{/apis}}{{/apiInfo}} ] -}) -export class ApiModule { - public static forConfig(configurationFactory: () => Configuration): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [ {provide: Configuration, useFactory: configurationFactory}] - } - } -} diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/index.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/index.mustache deleted file mode 100644 index c312b70fa3e..00000000000 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/index.mustache +++ /dev/null @@ -1,5 +0,0 @@ -export * from './api/api'; -export * from './model/models'; -export * from './variables'; -export * from './configuration'; -export * from './api.module'; \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/model.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/model.mustache deleted file mode 100644 index 0d5cf4c146e..00000000000 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/model.mustache +++ /dev/null @@ -1,16 +0,0 @@ -{{>licenseInfo}} -{{#models}} -{{#model}} -{{#tsImports}} -import { {{classname}} } from './{{filename}}'; -{{/tsImports}} - - -{{#description}} -/** - * {{{description}}} - */ -{{/description}} -{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>modelGeneric}}{{/isEnum}} -{{/model}} -{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/typescript-angularjs/api.module.mustache b/modules/swagger-codegen/src/main/resources/typescript-angularjs/api.module.mustache new file mode 100644 index 00000000000..1b01079af8c --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-angularjs/api.module.mustache @@ -0,0 +1,13 @@ +import * as api from './api/api'; +import * as angular from 'angular'; + +{{#apiInfo}} +const apiModule = angular.module('api', []) +{{#apis}} +{{#operations}} +.service('{{classname}}', api.{{classname}}) +{{/operations}} +{{/apis}} + +export default apiModule; +{{/apiInfo}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-angularjs/api.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular/api.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angularjs/api.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/apis.mustache b/modules/swagger-codegen/src/main/resources/typescript-angularjs/apis.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/apis.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angularjs/apis.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/git_push.sh.mustache b/modules/swagger-codegen/src/main/resources/typescript-angularjs/git_push.sh.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/git_push.sh.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angularjs/git_push.sh.mustache diff --git a/samples/client/petstore/typescript-angular/.gitignore b/modules/swagger-codegen/src/main/resources/typescript-angularjs/gitignore similarity index 100% rename from samples/client/petstore/typescript-angular/.gitignore rename to modules/swagger-codegen/src/main/resources/typescript-angularjs/gitignore diff --git a/samples/client/petstore/typescript-angular/index.ts b/modules/swagger-codegen/src/main/resources/typescript-angularjs/index.mustache similarity index 100% rename from samples/client/petstore/typescript-angular/index.ts rename to modules/swagger-codegen/src/main/resources/typescript-angularjs/index.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/licenseInfo.mustache b/modules/swagger-codegen/src/main/resources/typescript-angularjs/licenseInfo.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/licenseInfo.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angularjs/licenseInfo.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angularjs/model.mustache b/modules/swagger-codegen/src/main/resources/typescript-angularjs/model.mustache new file mode 100644 index 00000000000..f1bded256c0 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-angularjs/model.mustache @@ -0,0 +1,38 @@ +{{>licenseInfo}} +import * as models from './models'; + +{{#models}} +{{#model}} +{{#description}} +/** + * {{{description}}} + */ +{{/description}} +export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ +{{#vars}} +{{#description}} + /** + * {{{description}}} + */ +{{/description}} + "{{name}}"{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; +{{/vars}} +} + +{{#hasEnums}} +export namespace {{classname}} { +{{#vars}} +{{#isEnum}} + export enum {{enumName}} { + {{#allowableValues}} + {{#enumVars}} + {{{name}}} = {{{value}}}{{^-last}},{{/-last}} + {{/enumVars}} + {{/allowableValues}} + } +{{/isEnum}} +{{/vars}} +} +{{/hasEnums}} +{{/model}} +{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/models.mustache b/modules/swagger-codegen/src/main/resources/typescript-angularjs/models.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/models.mustache rename to modules/swagger-codegen/src/main/resources/typescript-angularjs/models.mustache diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngularClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngularClientOptionsProvider.java index 2ac48e6cf1a..d0e53eaeb21 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngularClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngularClientOptionsProvider.java @@ -1,17 +1,23 @@ package io.swagger.codegen.options; -import io.swagger.codegen.CodegenConstants; - import com.google.common.collect.ImmutableMap; import java.util.Map; +import io.swagger.codegen.CodegenConstants; +import io.swagger.codegen.languages.TypeScriptAngularClientCodegen; + public class TypeScriptAngularClientOptionsProvider implements OptionsProvider { public static final String SUPPORTS_ES6_VALUE = "false"; public static final String SORT_PARAMS_VALUE = "false"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase"; + private static final String NMP_NAME = "npmName"; + private static final String NMP_VERSION = "1.1.2"; + private static final String NPM_REPOSITORY = "https://registry.npmjs.org"; public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; + public static final String NG_VERSION = "2"; + @Override public String getLanguage() { @@ -22,9 +28,15 @@ public String getLanguage() { public Map createOptions() { ImmutableMap.Builder builder = new ImmutableMap.Builder(); return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) - .put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE) .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) + .put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE) + .put(TypeScriptAngularClientCodegen.NPM_NAME, NMP_NAME) + .put(TypeScriptAngularClientCodegen.NPM_VERSION, NMP_VERSION) + .put(TypeScriptAngularClientCodegen.SNAPSHOT, Boolean.FALSE.toString()) + .put(TypeScriptAngularClientCodegen.WITH_INTERFACES, Boolean.FALSE.toString()) + .put(TypeScriptAngularClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY) + .put(TypeScriptAngularClientCodegen.NG_VERSION, NG_VERSION) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .build(); } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngularJsClientOptionsProvider.java similarity index 54% rename from modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java rename to modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngularJsClientOptionsProvider.java index fa10ebc2168..5fe0ccb2ee5 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngularJsClientOptionsProvider.java @@ -1,42 +1,30 @@ package io.swagger.codegen.options; +import io.swagger.codegen.CodegenConstants; + import com.google.common.collect.ImmutableMap; import java.util.Map; -import io.swagger.codegen.CodegenConstants; -import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen; - -public class TypeScriptAngular2ClientOptionsProvider implements OptionsProvider { +public class TypeScriptAngularJsClientOptionsProvider implements OptionsProvider { public static final String SUPPORTS_ES6_VALUE = "false"; public static final String SORT_PARAMS_VALUE = "false"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; - private static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase"; - private static final String NMP_NAME = "npmName"; - private static final String NMP_VERSION = "1.1.2"; - private static final String NPM_REPOSITORY = "https://registry.npmjs.org"; + public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase"; public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; - public static final String NG_VERSION = "2"; - @Override public String getLanguage() { - return "typescript-angular2"; + return "typescript-angularjs"; } @Override public Map createOptions() { ImmutableMap.Builder builder = new ImmutableMap.Builder(); return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) + .put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE) .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) - .put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE) - .put(TypeScriptAngular2ClientCodegen.NPM_NAME, NMP_NAME) - .put(TypeScriptAngular2ClientCodegen.NPM_VERSION, NMP_VERSION) - .put(TypeScriptAngular2ClientCodegen.SNAPSHOT, Boolean.FALSE.toString()) - .put(TypeScriptAngular2ClientCodegen.WITH_INTERFACES, Boolean.FALSE.toString()) - .put(TypeScriptAngular2ClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY) - .put(TypeScriptAngular2ClientCodegen.NG_VERSION, NG_VERSION) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .build(); } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptNodeClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptNodeClientOptionsProvider.java index a3e98c64f9e..791ab320f1c 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptNodeClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptNodeClientOptionsProvider.java @@ -5,7 +5,7 @@ import java.util.Map; import io.swagger.codegen.CodegenConstants; -import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen; +import io.swagger.codegen.languages.TypeScriptAngularClientCodegen; public class TypeScriptNodeClientOptionsProvider implements OptionsProvider { @@ -32,10 +32,10 @@ public Map createOptions() { .put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE) .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) - .put(TypeScriptAngular2ClientCodegen.NPM_NAME, NMP_NAME) - .put(TypeScriptAngular2ClientCodegen.NPM_VERSION, NMP_VERSION) - .put(TypeScriptAngular2ClientCodegen.SNAPSHOT, Boolean.FALSE.toString()) - .put(TypeScriptAngular2ClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY) + .put(TypeScriptAngularClientCodegen.NPM_NAME, NMP_NAME) + .put(TypeScriptAngularClientCodegen.NPM_VERSION, NMP_VERSION) + .put(TypeScriptAngularClientCodegen.SNAPSHOT, Boolean.FALSE.toString()) + .put(TypeScriptAngularClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .build(); } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypeScriptAngularClientOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypeScriptAngularClientOptionsTest.java index 2a68ab37110..f7b8f994231 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypeScriptAngularClientOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypeScriptAngularClientOptionsTest.java @@ -4,7 +4,7 @@ import io.swagger.codegen.CodegenConfig; import io.swagger.codegen.languages.TypeScriptAngularClientCodegen; import io.swagger.codegen.options.TypeScriptAngularClientOptionsProvider; - +import io.swagger.codegen.options.TypeScriptAngularClientOptionsProvider; import mockit.Expectations; import mockit.Tested; @@ -30,6 +30,8 @@ protected void setExpectations() { times = 1; clientCodegen.setModelPropertyNaming(TypeScriptAngularClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); times = 1; + clientCodegen.setNgVersion(TypeScriptAngularClientOptionsProvider.NG_VERSION); + times = 1; clientCodegen.setSupportsES6(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.SUPPORTS_ES6_VALUE)); times = 1; }}; diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypeScriptAngularModelTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypeScriptAngularModelTest.java index bf5a211f312..310fe4ff90a 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypeScriptAngularModelTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypeScriptAngularModelTest.java @@ -1,5 +1,10 @@ package io.swagger.codegen.typescript.typescriptangular; +import org.testng.Assert; +import org.testng.annotations.Test; + +import com.google.common.collect.Sets; + import io.swagger.codegen.CodegenModel; import io.swagger.codegen.CodegenProperty; import io.swagger.codegen.DefaultCodegen; @@ -7,11 +12,12 @@ import io.swagger.models.ArrayModel; import io.swagger.models.Model; import io.swagger.models.ModelImpl; -import io.swagger.models.properties.*; - -import com.google.common.collect.Sets; -import org.testng.Assert; -import org.testng.annotations.Test; +import io.swagger.models.properties.ArrayProperty; +import io.swagger.models.properties.DateTimeProperty; +import io.swagger.models.properties.DateProperty; +import io.swagger.models.properties.LongProperty; +import io.swagger.models.properties.RefProperty; +import io.swagger.models.properties.StringProperty; @SuppressWarnings("static-method") public class TypeScriptAngularModelTest { @@ -59,6 +65,7 @@ public void simpleModelTest() { Assert.assertEquals(property3.complexType, null); Assert.assertEquals(property3.datatype, "Date"); Assert.assertEquals(property3.name, "createdAt"); + Assert.assertEquals(property3.baseType, "Date"); Assert.assertEquals(property3.defaultValue, "null"); Assert.assertTrue(property3.hasMore); Assert.assertFalse(property3.required); @@ -69,6 +76,7 @@ public void simpleModelTest() { Assert.assertEquals(property4.complexType, null); Assert.assertEquals(property4.datatype, "string"); Assert.assertEquals(property4.name, "birthDate"); + Assert.assertEquals(property4.baseType, "string"); Assert.assertEquals(property4.defaultValue, "null"); Assert.assertFalse(property4.hasMore); Assert.assertFalse(property4.required); @@ -125,10 +133,10 @@ public void complexPropertyTest() { final CodegenProperty property1 = cm.vars.get(0); Assert.assertEquals(property1.baseName, "children"); - Assert.assertEquals(property1.datatype, "models.Children"); + Assert.assertEquals(property1.datatype, "Children"); Assert.assertEquals(property1.name, "children"); Assert.assertEquals(property1.defaultValue, "null"); - Assert.assertEquals(property1.baseType, "models.Children"); + Assert.assertEquals(property1.baseType, "Children"); Assert.assertFalse(property1.required); Assert.assertTrue(property1.isNotContainer); } @@ -149,8 +157,8 @@ public void complexListPropertyTest() { final CodegenProperty property1 = cm.vars.get(0); Assert.assertEquals(property1.baseName, "children"); - Assert.assertEquals(property1.complexType, "models.Children"); - Assert.assertEquals(property1.datatype, "Array"); + Assert.assertEquals(property1.complexType, "Children"); + Assert.assertEquals(property1.datatype, "Array"); Assert.assertEquals(property1.name, "children"); Assert.assertEquals(property1.baseType, "Array"); Assert.assertFalse(property1.required); @@ -184,6 +192,7 @@ public void mapModelTest() { Assert.assertEquals(cm.description, "a map model"); Assert.assertEquals(cm.vars.size(), 0); Assert.assertEquals(cm.imports.size(), 1); - Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("models.Children")).size(), 1); + Assert.assertEquals(cm.additionalPropertiesType, "Children"); + Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); } } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypescriptAngular2AdditionalPropertiesIntegrationTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypescriptAngularAdditionalPropertiesIntegrationTest.java similarity index 73% rename from modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypescriptAngular2AdditionalPropertiesIntegrationTest.java rename to modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypescriptAngularAdditionalPropertiesIntegrationTest.java index db3121c1dc0..aa2fd7565f2 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypescriptAngular2AdditionalPropertiesIntegrationTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypescriptAngularAdditionalPropertiesIntegrationTest.java @@ -1,18 +1,18 @@ -package io.swagger.codegen.typescript.typescriptangular2; +package io.swagger.codegen.typescript.typescriptangular; import java.util.HashMap; import java.util.Map; import io.swagger.codegen.AbstractIntegrationTest; import io.swagger.codegen.CodegenConfig; -import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen; +import io.swagger.codegen.languages.TypeScriptAngularClientCodegen; import io.swagger.codegen.testutils.IntegrationTestPathsConfig; -public class TypescriptAngular2AdditionalPropertiesIntegrationTest extends AbstractIntegrationTest { +public class TypescriptAngularAdditionalPropertiesIntegrationTest extends AbstractIntegrationTest { @Override protected CodegenConfig getCodegenConfig() { - return new TypeScriptAngular2ClientCodegen(); + return new TypeScriptAngularClientCodegen(); } @Override diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypescriptAngular2ArrayAndObjectIntegrationTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypescriptAngularArrayAndObjectIntegrationTest.java similarity index 73% rename from modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypescriptAngular2ArrayAndObjectIntegrationTest.java rename to modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypescriptAngularArrayAndObjectIntegrationTest.java index 6f0c861866e..13f9954170a 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypescriptAngular2ArrayAndObjectIntegrationTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypescriptAngularArrayAndObjectIntegrationTest.java @@ -1,18 +1,18 @@ -package io.swagger.codegen.typescript.typescriptangular2; +package io.swagger.codegen.typescript.typescriptangular; import java.util.HashMap; import java.util.Map; import io.swagger.codegen.AbstractIntegrationTest; import io.swagger.codegen.CodegenConfig; -import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen; +import io.swagger.codegen.languages.TypeScriptAngularClientCodegen; import io.swagger.codegen.testutils.IntegrationTestPathsConfig; -public class TypescriptAngular2ArrayAndObjectIntegrationTest extends AbstractIntegrationTest { +public class TypescriptAngularArrayAndObjectIntegrationTest extends AbstractIntegrationTest { @Override protected CodegenConfig getCodegenConfig() { - return new TypeScriptAngular2ClientCodegen(); + return new TypeScriptAngularClientCodegen(); } @Override diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypescriptAngular2PestoreIntegrationTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypescriptAngularPestoreIntegrationTest.java similarity index 73% rename from modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypescriptAngular2PestoreIntegrationTest.java rename to modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypescriptAngularPestoreIntegrationTest.java index 19461664c37..cbc308b8d8b 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypescriptAngular2PestoreIntegrationTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypescriptAngularPestoreIntegrationTest.java @@ -1,18 +1,18 @@ -package io.swagger.codegen.typescript.typescriptangular2; +package io.swagger.codegen.typescript.typescriptangular; import java.util.HashMap; import java.util.Map; import io.swagger.codegen.AbstractIntegrationTest; import io.swagger.codegen.CodegenConfig; -import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen; +import io.swagger.codegen.languages.TypeScriptAngularClientCodegen; import io.swagger.codegen.testutils.IntegrationTestPathsConfig; -public class TypescriptAngular2PestoreIntegrationTest extends AbstractIntegrationTest { +public class TypescriptAngularPestoreIntegrationTest extends AbstractIntegrationTest { @Override protected CodegenConfig getCodegenConfig() { - return new TypeScriptAngular2ClientCodegen(); + return new TypeScriptAngularClientCodegen(); } @Override diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypeScriptAngular2ClientOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypeScriptAngular2ClientOptionsTest.java deleted file mode 100644 index 14ac486fdfd..00000000000 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypeScriptAngular2ClientOptionsTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package io.swagger.codegen.typescript.typescriptangular2; - -import io.swagger.codegen.AbstractOptionsTest; -import io.swagger.codegen.CodegenConfig; -import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen; -import io.swagger.codegen.options.TypeScriptAngular2ClientOptionsProvider; -import io.swagger.codegen.options.TypeScriptAngularClientOptionsProvider; -import mockit.Expectations; -import mockit.Tested; - -public class TypeScriptAngular2ClientOptionsTest extends AbstractOptionsTest { - - @Tested - private TypeScriptAngular2ClientCodegen clientCodegen; - - public TypeScriptAngular2ClientOptionsTest() { - super(new TypeScriptAngular2ClientOptionsProvider()); - } - - @Override - protected CodegenConfig getCodegenConfig() { - return clientCodegen; - } - - @SuppressWarnings("unused") - @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setModelPropertyNaming(TypeScriptAngularClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); - times = 1; - clientCodegen.setNgVersion(TypeScriptAngular2ClientOptionsProvider.NG_VERSION); - times = 1; - clientCodegen.setSupportsES6(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.SUPPORTS_ES6_VALUE)); - times = 1; - }}; - } -} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangularjs/TypeScriptAngularJsClientOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangularjs/TypeScriptAngularJsClientOptionsTest.java new file mode 100644 index 00000000000..21ec78e7552 --- /dev/null +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangularjs/TypeScriptAngularJsClientOptionsTest.java @@ -0,0 +1,37 @@ +package io.swagger.codegen.typescript.typescriptangular; + +import io.swagger.codegen.AbstractOptionsTest; +import io.swagger.codegen.CodegenConfig; +import io.swagger.codegen.languages.TypeScriptAngularJsClientCodegen; +import io.swagger.codegen.options.TypeScriptAngularJsClientOptionsProvider; + +import mockit.Expectations; +import mockit.Tested; + +public class TypeScriptAngularJsClientOptionsTest extends AbstractOptionsTest { + + @Tested + private TypeScriptAngularJsClientCodegen clientCodegen; + + public TypeScriptAngularJsClientOptionsTest() { + super(new TypeScriptAngularJsClientOptionsProvider()); + } + + @Override + protected CodegenConfig getCodegenConfig() { + return clientCodegen; + } + + @SuppressWarnings("unused") + @Override + protected void setExpectations() { + new Expectations(clientCodegen) {{ + clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptAngularJsClientOptionsProvider.SORT_PARAMS_VALUE)); + times = 1; + clientCodegen.setModelPropertyNaming(TypeScriptAngularJsClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); + times = 1; + clientCodegen.setSupportsES6(Boolean.valueOf(TypeScriptAngularJsClientOptionsProvider.SUPPORTS_ES6_VALUE)); + times = 1; + }}; + } +} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypeScriptAngular2ModelTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangularjs/TypeScriptAngularJsModelTest.java similarity index 83% rename from modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypeScriptAngular2ModelTest.java rename to modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangularjs/TypeScriptAngularJsModelTest.java index b8fbc4e3c16..7f3fd744a20 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypeScriptAngular2ModelTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangularjs/TypeScriptAngularJsModelTest.java @@ -1,28 +1,22 @@ -package io.swagger.codegen.typescript.typescriptangular2; - -import org.testng.Assert; -import org.testng.annotations.Test; - -import com.google.common.collect.Sets; +package io.swagger.codegen.typescript.typescriptangular; import io.swagger.codegen.CodegenModel; import io.swagger.codegen.CodegenProperty; import io.swagger.codegen.DefaultCodegen; -import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen; +import io.swagger.codegen.languages.TypeScriptAngularJsClientCodegen; import io.swagger.models.ArrayModel; import io.swagger.models.Model; import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.DateTimeProperty; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.LongProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; +import io.swagger.models.properties.*; + +import com.google.common.collect.Sets; +import org.testng.Assert; +import org.testng.annotations.Test; @SuppressWarnings("static-method") -public class TypeScriptAngular2ModelTest { +public class TypeScriptAngularJsModelTest { - @Test(description = "convert a simple TypeScript Angular2 model") + @Test(description = "convert a simple TypeScript Angular model") public void simpleModelTest() { final Model model = new ModelImpl() .description("a sample model") @@ -32,7 +26,7 @@ public void simpleModelTest() { .property("birthDate", new DateProperty()) .required("id") .required("name"); - final DefaultCodegen codegen = new TypeScriptAngular2ClientCodegen(); + final DefaultCodegen codegen = new TypeScriptAngularJsClientCodegen(); final CodegenModel cm = codegen.fromModel("sample", model); Assert.assertEquals(cm.name, "sample"); @@ -65,7 +59,6 @@ public void simpleModelTest() { Assert.assertEquals(property3.complexType, null); Assert.assertEquals(property3.datatype, "Date"); Assert.assertEquals(property3.name, "createdAt"); - Assert.assertEquals(property3.baseType, "Date"); Assert.assertEquals(property3.defaultValue, "null"); Assert.assertTrue(property3.hasMore); Assert.assertFalse(property3.required); @@ -76,7 +69,6 @@ public void simpleModelTest() { Assert.assertEquals(property4.complexType, null); Assert.assertEquals(property4.datatype, "string"); Assert.assertEquals(property4.name, "birthDate"); - Assert.assertEquals(property4.baseType, "string"); Assert.assertEquals(property4.defaultValue, "null"); Assert.assertFalse(property4.hasMore); Assert.assertFalse(property4.required); @@ -90,7 +82,7 @@ public void listPropertyTest() { .property("id", new LongProperty()) .property("urls", new ArrayProperty().items(new StringProperty())) .required("id"); - final DefaultCodegen codegen = new TypeScriptAngular2ClientCodegen(); + final DefaultCodegen codegen = new TypeScriptAngularJsClientCodegen(); final CodegenModel cm = codegen.fromModel("sample", model); Assert.assertEquals(cm.name, "sample"); @@ -123,7 +115,7 @@ public void complexPropertyTest() { final Model model = new ModelImpl() .description("a sample model") .property("children", new RefProperty("#/definitions/Children")); - final DefaultCodegen codegen = new TypeScriptAngular2ClientCodegen(); + final DefaultCodegen codegen = new TypeScriptAngularJsClientCodegen(); final CodegenModel cm = codegen.fromModel("sample", model); Assert.assertEquals(cm.name, "sample"); @@ -133,10 +125,10 @@ public void complexPropertyTest() { final CodegenProperty property1 = cm.vars.get(0); Assert.assertEquals(property1.baseName, "children"); - Assert.assertEquals(property1.datatype, "Children"); + Assert.assertEquals(property1.datatype, "models.Children"); Assert.assertEquals(property1.name, "children"); Assert.assertEquals(property1.defaultValue, "null"); - Assert.assertEquals(property1.baseType, "Children"); + Assert.assertEquals(property1.baseType, "models.Children"); Assert.assertFalse(property1.required); Assert.assertTrue(property1.isNotContainer); } @@ -147,7 +139,7 @@ public void complexListPropertyTest() { .description("a sample model") .property("children", new ArrayProperty() .items(new RefProperty("#/definitions/Children"))); - final DefaultCodegen codegen = new TypeScriptAngular2ClientCodegen(); + final DefaultCodegen codegen = new TypeScriptAngularJsClientCodegen(); final CodegenModel cm = codegen.fromModel("sample", model); Assert.assertEquals(cm.name, "sample"); @@ -157,8 +149,8 @@ public void complexListPropertyTest() { final CodegenProperty property1 = cm.vars.get(0); Assert.assertEquals(property1.baseName, "children"); - Assert.assertEquals(property1.complexType, "Children"); - Assert.assertEquals(property1.datatype, "Array"); + Assert.assertEquals(property1.complexType, "models.Children"); + Assert.assertEquals(property1.datatype, "Array"); Assert.assertEquals(property1.name, "children"); Assert.assertEquals(property1.baseType, "Array"); Assert.assertFalse(property1.required); @@ -170,7 +162,7 @@ public void arrayModelTest() { final Model model = new ArrayModel() .description("an array model") .items(new RefProperty("#/definitions/Children")); - final DefaultCodegen codegen = new TypeScriptAngular2ClientCodegen(); + final DefaultCodegen codegen = new TypeScriptAngularJsClientCodegen(); final CodegenModel cm = codegen.fromModel("sample", model); Assert.assertEquals(cm.name, "sample"); @@ -184,7 +176,7 @@ public void mapModelTest() { final Model model = new ModelImpl() .description("a map model") .additionalProperties(new RefProperty("#/definitions/Children")); - final DefaultCodegen codegen = new TypeScriptAngular2ClientCodegen(); + final DefaultCodegen codegen = new TypeScriptAngularJsClientCodegen(); final CodegenModel cm = codegen.fromModel("sample", model); Assert.assertEquals(cm.name, "sample"); @@ -192,7 +184,6 @@ public void mapModelTest() { Assert.assertEquals(cm.description, "a map model"); Assert.assertEquals(cm.vars.size(), 0); Assert.assertEquals(cm.imports.size(), 1); - Assert.assertEquals(cm.additionalPropertiesType, "Children"); - Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); + Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("models.Children")).size(), 1); } } diff --git a/pom.xml b/pom.xml index 6f6a819a76c..a2839090114 100644 --- a/pom.xml +++ b/pom.xml @@ -669,7 +669,7 @@ - samples/client/petstore/typescript-angular/npm + samples/client/petstore/typescript-angularjs/npm @@ -832,8 +832,9 @@ samples/client/petstore/typescript-angular--> - samples/client/petstore/typescript-angular2/npm - samples/client/petstore/typescript-angular4/npm + samples/client/petstore/typescript-angularjs + samples/client/petstore/typescript-angular-v2/npm + samples/client/petstore/typescript-angular-v4/npm samples/client/petstore/swift3/default/SwaggerClientTests samples/client/petstore/swift3/promisekit/SwaggerClientTests samples/client/petstore/swift3/rxswift/SwaggerClientTests diff --git a/pom.xml.circleci b/pom.xml.circleci index 79009abd23d..5e658cd2dd1 100644 --- a/pom.xml.circleci +++ b/pom.xml.circleci @@ -664,7 +664,7 @@ - samples/client/petstore/typescript-angular/npm + samples/client/petstore/typescript-angularjs/npm diff --git a/samples/client/petstore/typescript-angular2/default/.gitignore b/samples/client/petstore/typescript-angular-v2/default/.gitignore similarity index 100% rename from samples/client/petstore/typescript-angular2/default/.gitignore rename to samples/client/petstore/typescript-angular-v2/default/.gitignore diff --git a/samples/client/petstore/typescript-angular/.swagger-codegen-ignore b/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen-ignore similarity index 100% rename from samples/client/petstore/typescript-angular/.swagger-codegen-ignore rename to samples/client/petstore/typescript-angular-v2/default/.swagger-codegen-ignore diff --git a/samples/client/petstore/typescript-angular2/default/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION similarity index 100% rename from samples/client/petstore/typescript-angular2/default/.swagger-codegen/VERSION rename to samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION diff --git a/samples/client/petstore/typescript-angular2/default/LICENSE b/samples/client/petstore/typescript-angular-v2/default/LICENSE similarity index 100% rename from samples/client/petstore/typescript-angular2/default/LICENSE rename to samples/client/petstore/typescript-angular-v2/default/LICENSE diff --git a/samples/client/petstore/typescript-angular2/default/api.module.ts b/samples/client/petstore/typescript-angular-v2/default/api.module.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/api.module.ts rename to samples/client/petstore/typescript-angular-v2/default/api.module.ts diff --git a/samples/client/petstore/typescript-angular2/default/api/api.ts b/samples/client/petstore/typescript-angular-v2/default/api/api.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/api/api.ts rename to samples/client/petstore/typescript-angular-v2/default/api/api.ts diff --git a/samples/client/petstore/typescript-angular2/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/api/pet.service.ts rename to samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts diff --git a/samples/client/petstore/typescript-angular2/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v2/default/api/store.service.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/api/store.service.ts rename to samples/client/petstore/typescript-angular-v2/default/api/store.service.ts diff --git a/samples/client/petstore/typescript-angular2/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/api/user.service.ts rename to samples/client/petstore/typescript-angular-v2/default/api/user.service.ts diff --git a/samples/client/petstore/typescript-angular2/default/configuration.ts b/samples/client/petstore/typescript-angular-v2/default/configuration.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/configuration.ts rename to samples/client/petstore/typescript-angular-v2/default/configuration.ts diff --git a/samples/client/petstore/typescript-angular/git_push.sh b/samples/client/petstore/typescript-angular-v2/default/git_push.sh similarity index 100% rename from samples/client/petstore/typescript-angular/git_push.sh rename to samples/client/petstore/typescript-angular-v2/default/git_push.sh diff --git a/samples/client/petstore/typescript-angular2/default/index.ts b/samples/client/petstore/typescript-angular-v2/default/index.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/index.ts rename to samples/client/petstore/typescript-angular-v2/default/index.ts diff --git a/samples/client/petstore/typescript-angular2/default/model/ApiResponse.ts b/samples/client/petstore/typescript-angular-v2/default/model/ApiResponse.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/model/ApiResponse.ts rename to samples/client/petstore/typescript-angular-v2/default/model/ApiResponse.ts diff --git a/samples/client/petstore/typescript-angular2/default/model/category.ts b/samples/client/petstore/typescript-angular-v2/default/model/category.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/model/category.ts rename to samples/client/petstore/typescript-angular-v2/default/model/category.ts diff --git a/samples/client/petstore/typescript-angular2/default/model/models.ts b/samples/client/petstore/typescript-angular-v2/default/model/models.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/model/models.ts rename to samples/client/petstore/typescript-angular-v2/default/model/models.ts diff --git a/samples/client/petstore/typescript-angular2/default/model/order.ts b/samples/client/petstore/typescript-angular-v2/default/model/order.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/model/order.ts rename to samples/client/petstore/typescript-angular-v2/default/model/order.ts diff --git a/samples/client/petstore/typescript-angular2/default/model/pet.ts b/samples/client/petstore/typescript-angular-v2/default/model/pet.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/model/pet.ts rename to samples/client/petstore/typescript-angular-v2/default/model/pet.ts diff --git a/samples/client/petstore/typescript-angular2/default/model/tag.ts b/samples/client/petstore/typescript-angular-v2/default/model/tag.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/model/tag.ts rename to samples/client/petstore/typescript-angular-v2/default/model/tag.ts diff --git a/samples/client/petstore/typescript-angular2/default/model/user.ts b/samples/client/petstore/typescript-angular-v2/default/model/user.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/model/user.ts rename to samples/client/petstore/typescript-angular-v2/default/model/user.ts diff --git a/samples/client/petstore/typescript-angular2/default/rxjs-operators.ts b/samples/client/petstore/typescript-angular-v2/default/rxjs-operators.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/rxjs-operators.ts rename to samples/client/petstore/typescript-angular-v2/default/rxjs-operators.ts diff --git a/samples/client/petstore/typescript-angular2/default/variables.ts b/samples/client/petstore/typescript-angular-v2/default/variables.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/default/variables.ts rename to samples/client/petstore/typescript-angular-v2/default/variables.ts diff --git a/samples/client/petstore/typescript-angular2/npm/.gitignore b/samples/client/petstore/typescript-angular-v2/npm/.gitignore similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/.gitignore rename to samples/client/petstore/typescript-angular-v2/npm/.gitignore diff --git a/samples/client/petstore/typescript-angular2/default/.swagger-codegen-ignore b/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen-ignore similarity index 100% rename from samples/client/petstore/typescript-angular2/default/.swagger-codegen-ignore rename to samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen-ignore diff --git a/samples/client/petstore/typescript-angular2/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/.swagger-codegen/VERSION rename to samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION diff --git a/samples/client/petstore/typescript-angular2/npm/README.md b/samples/client/petstore/typescript-angular-v2/npm/README.md similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/README.md rename to samples/client/petstore/typescript-angular-v2/npm/README.md diff --git a/samples/client/petstore/typescript-angular2/npm/api.module.ts b/samples/client/petstore/typescript-angular-v2/npm/api.module.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/api.module.ts rename to samples/client/petstore/typescript-angular-v2/npm/api.module.ts diff --git a/samples/client/petstore/typescript-angular2/npm/api/api.ts b/samples/client/petstore/typescript-angular-v2/npm/api/api.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/api/api.ts rename to samples/client/petstore/typescript-angular-v2/npm/api/api.ts diff --git a/samples/client/petstore/typescript-angular2/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/api/pet.service.ts rename to samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts diff --git a/samples/client/petstore/typescript-angular2/npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/api/store.service.ts rename to samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts diff --git a/samples/client/petstore/typescript-angular2/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/api/user.service.ts rename to samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts diff --git a/samples/client/petstore/typescript-angular2/npm/configuration.ts b/samples/client/petstore/typescript-angular-v2/npm/configuration.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/configuration.ts rename to samples/client/petstore/typescript-angular-v2/npm/configuration.ts diff --git a/samples/client/petstore/typescript-angular2/default/git_push.sh b/samples/client/petstore/typescript-angular-v2/npm/git_push.sh similarity index 100% rename from samples/client/petstore/typescript-angular2/default/git_push.sh rename to samples/client/petstore/typescript-angular-v2/npm/git_push.sh diff --git a/samples/client/petstore/typescript-angular2/npm/index.ts b/samples/client/petstore/typescript-angular-v2/npm/index.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/index.ts rename to samples/client/petstore/typescript-angular-v2/npm/index.ts diff --git a/samples/client/petstore/typescript-angular2/npm/model/ApiResponse.ts b/samples/client/petstore/typescript-angular-v2/npm/model/ApiResponse.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/model/ApiResponse.ts rename to samples/client/petstore/typescript-angular-v2/npm/model/ApiResponse.ts diff --git a/samples/client/petstore/typescript-angular2/npm/model/category.ts b/samples/client/petstore/typescript-angular-v2/npm/model/category.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/model/category.ts rename to samples/client/petstore/typescript-angular-v2/npm/model/category.ts diff --git a/samples/client/petstore/typescript-angular2/npm/model/models.ts b/samples/client/petstore/typescript-angular-v2/npm/model/models.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/model/models.ts rename to samples/client/petstore/typescript-angular-v2/npm/model/models.ts diff --git a/samples/client/petstore/typescript-angular2/npm/model/order.ts b/samples/client/petstore/typescript-angular-v2/npm/model/order.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/model/order.ts rename to samples/client/petstore/typescript-angular-v2/npm/model/order.ts diff --git a/samples/client/petstore/typescript-angular2/npm/model/pet.ts b/samples/client/petstore/typescript-angular-v2/npm/model/pet.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/model/pet.ts rename to samples/client/petstore/typescript-angular-v2/npm/model/pet.ts diff --git a/samples/client/petstore/typescript-angular2/npm/model/tag.ts b/samples/client/petstore/typescript-angular-v2/npm/model/tag.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/model/tag.ts rename to samples/client/petstore/typescript-angular-v2/npm/model/tag.ts diff --git a/samples/client/petstore/typescript-angular2/npm/model/user.ts b/samples/client/petstore/typescript-angular-v2/npm/model/user.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/model/user.ts rename to samples/client/petstore/typescript-angular-v2/npm/model/user.ts diff --git a/samples/client/petstore/typescript-angular2/npm/package-lock.json b/samples/client/petstore/typescript-angular-v2/npm/package-lock.json similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/package-lock.json rename to samples/client/petstore/typescript-angular-v2/npm/package-lock.json diff --git a/samples/client/petstore/typescript-angular2/npm/package.json b/samples/client/petstore/typescript-angular-v2/npm/package.json similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/package.json rename to samples/client/petstore/typescript-angular-v2/npm/package.json diff --git a/samples/client/petstore/typescript-angular2/npm/pom.xml b/samples/client/petstore/typescript-angular-v2/npm/pom.xml similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/pom.xml rename to samples/client/petstore/typescript-angular-v2/npm/pom.xml diff --git a/samples/client/petstore/typescript-angular2/npm/rxjs-operators.ts b/samples/client/petstore/typescript-angular-v2/npm/rxjs-operators.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/rxjs-operators.ts rename to samples/client/petstore/typescript-angular-v2/npm/rxjs-operators.ts diff --git a/samples/client/petstore/typescript-angular2/npm/tsconfig.json b/samples/client/petstore/typescript-angular-v2/npm/tsconfig.json similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/tsconfig.json rename to samples/client/petstore/typescript-angular-v2/npm/tsconfig.json diff --git a/samples/client/petstore/typescript-angular2/npm/typings.json b/samples/client/petstore/typescript-angular-v2/npm/typings.json similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/typings.json rename to samples/client/petstore/typescript-angular-v2/npm/typings.json diff --git a/samples/client/petstore/typescript-angular2/npm/variables.ts b/samples/client/petstore/typescript-angular-v2/npm/variables.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/variables.ts rename to samples/client/petstore/typescript-angular-v2/npm/variables.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/.gitignore b/samples/client/petstore/typescript-angular-v2/with-interfaces/.gitignore similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/.gitignore rename to samples/client/petstore/typescript-angular-v2/with-interfaces/.gitignore diff --git a/samples/client/petstore/typescript-angular2/npm/.swagger-codegen-ignore b/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen-ignore similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/.swagger-codegen-ignore rename to samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen-ignore diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/.swagger-codegen/VERSION rename to samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api.module.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api.module.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/api.module.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/api.module.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/PetApi.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/PetApi.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/api/PetApi.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/api/PetApi.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/PetApiInterface.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/PetApiInterface.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/api/PetApiInterface.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/api/PetApiInterface.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApi.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/StoreApi.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApi.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/api/StoreApi.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApiInterface.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/StoreApiInterface.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApiInterface.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/api/StoreApiInterface.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/UserApi.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/UserApi.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/api/UserApi.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/api/UserApi.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/UserApiInterface.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/UserApiInterface.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/api/UserApiInterface.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/api/UserApiInterface.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/api.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/api.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/api/api.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/api/api.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/api/pet.service.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/pet.serviceInterface.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.serviceInterface.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/api/pet.serviceInterface.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.serviceInterface.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/store.service.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/api/store.service.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/store.serviceInterface.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.serviceInterface.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/api/store.serviceInterface.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.serviceInterface.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/api/user.service.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/user.serviceInterface.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.serviceInterface.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/api/user.serviceInterface.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.serviceInterface.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/configuration.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/configuration.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts diff --git a/samples/client/petstore/typescript-angular2/npm/git_push.sh b/samples/client/petstore/typescript-angular-v2/with-interfaces/git_push.sh similarity index 100% rename from samples/client/petstore/typescript-angular2/npm/git_push.sh rename to samples/client/petstore/typescript-angular-v2/with-interfaces/git_push.sh diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/index.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/index.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/index.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/index.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/Category.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/Category.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/model/Category.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/model/Category.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/Order.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/Order.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/model/Order.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/model/Order.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/Pet.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/Pet.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/model/Pet.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/model/Pet.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/Tag.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/Tag.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/model/Tag.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/model/Tag.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/User.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/User.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/model/User.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/model/User.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/apiResponse.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/apiResponse.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/model/apiResponse.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/model/apiResponse.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/models.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/models.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/model/models.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/model/models.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/rxjs-operators.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/rxjs-operators.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/rxjs-operators.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/rxjs-operators.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/variables.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/variables.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/variables.ts rename to samples/client/petstore/typescript-angular-v2/with-interfaces/variables.ts diff --git a/samples/client/petstore/typescript-angular4/npm/.gitignore b/samples/client/petstore/typescript-angular-v4/npm/.gitignore similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/.gitignore rename to samples/client/petstore/typescript-angular-v4/npm/.gitignore diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/.swagger-codegen-ignore b/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen-ignore similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/.swagger-codegen-ignore rename to samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen-ignore diff --git a/samples/client/petstore/typescript-angular4/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/.swagger-codegen/VERSION rename to samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION diff --git a/samples/client/petstore/typescript-angular4/npm/README.md b/samples/client/petstore/typescript-angular-v4/npm/README.md similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/README.md rename to samples/client/petstore/typescript-angular-v4/npm/README.md diff --git a/samples/client/petstore/typescript-angular4/npm/api.module.ts b/samples/client/petstore/typescript-angular-v4/npm/api.module.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/api.module.ts rename to samples/client/petstore/typescript-angular-v4/npm/api.module.ts diff --git a/samples/client/petstore/typescript-angular4/npm/api/api.ts b/samples/client/petstore/typescript-angular-v4/npm/api/api.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/api/api.ts rename to samples/client/petstore/typescript-angular-v4/npm/api/api.ts diff --git a/samples/client/petstore/typescript-angular4/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/api/pet.service.ts rename to samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts diff --git a/samples/client/petstore/typescript-angular4/npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/api/store.service.ts rename to samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts diff --git a/samples/client/petstore/typescript-angular4/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/api/user.service.ts rename to samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts diff --git a/samples/client/petstore/typescript-angular4/npm/configuration.ts b/samples/client/petstore/typescript-angular-v4/npm/configuration.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/configuration.ts rename to samples/client/petstore/typescript-angular-v4/npm/configuration.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/git_push.sh b/samples/client/petstore/typescript-angular-v4/npm/git_push.sh similarity index 100% rename from samples/client/petstore/typescript-angular2/with-interfaces/git_push.sh rename to samples/client/petstore/typescript-angular-v4/npm/git_push.sh diff --git a/samples/client/petstore/typescript-angular4/npm/index.ts b/samples/client/petstore/typescript-angular-v4/npm/index.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/index.ts rename to samples/client/petstore/typescript-angular-v4/npm/index.ts diff --git a/samples/client/petstore/typescript-angular4/npm/model/apiResponse.ts b/samples/client/petstore/typescript-angular-v4/npm/model/apiResponse.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/model/apiResponse.ts rename to samples/client/petstore/typescript-angular-v4/npm/model/apiResponse.ts diff --git a/samples/client/petstore/typescript-angular4/npm/model/category.ts b/samples/client/petstore/typescript-angular-v4/npm/model/category.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/model/category.ts rename to samples/client/petstore/typescript-angular-v4/npm/model/category.ts diff --git a/samples/client/petstore/typescript-angular4/npm/model/models.ts b/samples/client/petstore/typescript-angular-v4/npm/model/models.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/model/models.ts rename to samples/client/petstore/typescript-angular-v4/npm/model/models.ts diff --git a/samples/client/petstore/typescript-angular4/npm/model/order.ts b/samples/client/petstore/typescript-angular-v4/npm/model/order.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/model/order.ts rename to samples/client/petstore/typescript-angular-v4/npm/model/order.ts diff --git a/samples/client/petstore/typescript-angular4/npm/model/pet.ts b/samples/client/petstore/typescript-angular-v4/npm/model/pet.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/model/pet.ts rename to samples/client/petstore/typescript-angular-v4/npm/model/pet.ts diff --git a/samples/client/petstore/typescript-angular4/npm/model/tag.ts b/samples/client/petstore/typescript-angular-v4/npm/model/tag.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/model/tag.ts rename to samples/client/petstore/typescript-angular-v4/npm/model/tag.ts diff --git a/samples/client/petstore/typescript-angular4/npm/model/user.ts b/samples/client/petstore/typescript-angular-v4/npm/model/user.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/model/user.ts rename to samples/client/petstore/typescript-angular-v4/npm/model/user.ts diff --git a/samples/client/petstore/typescript-angular4/npm/package-lock.json b/samples/client/petstore/typescript-angular-v4/npm/package-lock.json similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/package-lock.json rename to samples/client/petstore/typescript-angular-v4/npm/package-lock.json diff --git a/samples/client/petstore/typescript-angular4/npm/package.json b/samples/client/petstore/typescript-angular-v4/npm/package.json similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/package.json rename to samples/client/petstore/typescript-angular-v4/npm/package.json diff --git a/samples/client/petstore/typescript-angular4/npm/pom.xml b/samples/client/petstore/typescript-angular-v4/npm/pom.xml similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/pom.xml rename to samples/client/petstore/typescript-angular-v4/npm/pom.xml diff --git a/samples/client/petstore/typescript-angular4/npm/rxjs-operators.ts b/samples/client/petstore/typescript-angular-v4/npm/rxjs-operators.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/rxjs-operators.ts rename to samples/client/petstore/typescript-angular-v4/npm/rxjs-operators.ts diff --git a/samples/client/petstore/typescript-angular4/npm/tsconfig.json b/samples/client/petstore/typescript-angular-v4/npm/tsconfig.json similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/tsconfig.json rename to samples/client/petstore/typescript-angular-v4/npm/tsconfig.json diff --git a/samples/client/petstore/typescript-angular4/npm/typings.json b/samples/client/petstore/typescript-angular-v4/npm/typings.json similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/typings.json rename to samples/client/petstore/typescript-angular-v4/npm/typings.json diff --git a/samples/client/petstore/typescript-angular4/npm/variables.ts b/samples/client/petstore/typescript-angular-v4/npm/variables.ts similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/variables.ts rename to samples/client/petstore/typescript-angular-v4/npm/variables.ts diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/ApiResponse.ts b/samples/client/petstore/typescript-angular2/with-interfaces/model/ApiResponse.ts deleted file mode 100644 index 3af781cf580..00000000000 --- a/samples/client/petstore/typescript-angular2/with-interfaces/model/ApiResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - - -/** - * Describes the result of uploading an image resource - */ -export interface ApiResponse { - code?: number; - - type?: string; - - message?: string; - -} diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/gitignore b/samples/client/petstore/typescript-angularjs/.gitignore similarity index 87% rename from modules/swagger-codegen/src/main/resources/typescript-angular2/gitignore rename to samples/client/petstore/typescript-angularjs/.gitignore index 149b5765472..35e2fb2b02e 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/gitignore +++ b/samples/client/petstore/typescript-angularjs/.gitignore @@ -1,4 +1,3 @@ wwwroot/*.js node_modules typings -dist diff --git a/samples/client/petstore/typescript-angular4/npm/.swagger-codegen-ignore b/samples/client/petstore/typescript-angularjs/.swagger-codegen-ignore similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/.swagger-codegen-ignore rename to samples/client/petstore/typescript-angularjs/.swagger-codegen-ignore diff --git a/samples/client/petstore/typescript-angular/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angularjs/.swagger-codegen/VERSION similarity index 100% rename from samples/client/petstore/typescript-angular/.swagger-codegen/VERSION rename to samples/client/petstore/typescript-angularjs/.swagger-codegen/VERSION diff --git a/samples/client/petstore/typescript-angular/README.md b/samples/client/petstore/typescript-angularjs/README.md similarity index 100% rename from samples/client/petstore/typescript-angular/README.md rename to samples/client/petstore/typescript-angularjs/README.md diff --git a/samples/client/petstore/typescript-angular/api.module.ts b/samples/client/petstore/typescript-angularjs/api.module.ts similarity index 100% rename from samples/client/petstore/typescript-angular/api.module.ts rename to samples/client/petstore/typescript-angularjs/api.module.ts diff --git a/samples/client/petstore/typescript-angular/api/PetApi.ts b/samples/client/petstore/typescript-angularjs/api/PetApi.ts similarity index 100% rename from samples/client/petstore/typescript-angular/api/PetApi.ts rename to samples/client/petstore/typescript-angularjs/api/PetApi.ts diff --git a/samples/client/petstore/typescript-angular/api/StoreApi.ts b/samples/client/petstore/typescript-angularjs/api/StoreApi.ts similarity index 100% rename from samples/client/petstore/typescript-angular/api/StoreApi.ts rename to samples/client/petstore/typescript-angularjs/api/StoreApi.ts diff --git a/samples/client/petstore/typescript-angular/api/UserApi.ts b/samples/client/petstore/typescript-angularjs/api/UserApi.ts similarity index 100% rename from samples/client/petstore/typescript-angular/api/UserApi.ts rename to samples/client/petstore/typescript-angularjs/api/UserApi.ts diff --git a/samples/client/petstore/typescript-angular/api/api.ts b/samples/client/petstore/typescript-angularjs/api/api.ts similarity index 100% rename from samples/client/petstore/typescript-angular/api/api.ts rename to samples/client/petstore/typescript-angularjs/api/api.ts diff --git a/samples/client/petstore/typescript-angular4/npm/git_push.sh b/samples/client/petstore/typescript-angularjs/git_push.sh similarity index 100% rename from samples/client/petstore/typescript-angular4/npm/git_push.sh rename to samples/client/petstore/typescript-angularjs/git_push.sh diff --git a/samples/client/petstore/typescript-angularjs/index.ts b/samples/client/petstore/typescript-angularjs/index.ts new file mode 100644 index 00000000000..557365516ad --- /dev/null +++ b/samples/client/petstore/typescript-angularjs/index.ts @@ -0,0 +1,2 @@ +export * from './api/api'; +export * from './model/models'; \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular/model/Category.ts b/samples/client/petstore/typescript-angularjs/model/Category.ts similarity index 100% rename from samples/client/petstore/typescript-angular/model/Category.ts rename to samples/client/petstore/typescript-angularjs/model/Category.ts diff --git a/samples/client/petstore/typescript-angular/model/Order.ts b/samples/client/petstore/typescript-angularjs/model/Order.ts similarity index 100% rename from samples/client/petstore/typescript-angular/model/Order.ts rename to samples/client/petstore/typescript-angularjs/model/Order.ts diff --git a/samples/client/petstore/typescript-angular/model/Pet.ts b/samples/client/petstore/typescript-angularjs/model/Pet.ts similarity index 100% rename from samples/client/petstore/typescript-angular/model/Pet.ts rename to samples/client/petstore/typescript-angularjs/model/Pet.ts diff --git a/samples/client/petstore/typescript-angular/model/Tag.ts b/samples/client/petstore/typescript-angularjs/model/Tag.ts similarity index 100% rename from samples/client/petstore/typescript-angular/model/Tag.ts rename to samples/client/petstore/typescript-angularjs/model/Tag.ts diff --git a/samples/client/petstore/typescript-angular/model/User.ts b/samples/client/petstore/typescript-angularjs/model/User.ts similarity index 100% rename from samples/client/petstore/typescript-angular/model/User.ts rename to samples/client/petstore/typescript-angularjs/model/User.ts diff --git a/samples/client/petstore/typescript-angular/model/models.ts b/samples/client/petstore/typescript-angularjs/model/models.ts similarity index 100% rename from samples/client/petstore/typescript-angular/model/models.ts rename to samples/client/petstore/typescript-angularjs/model/models.ts diff --git a/samples/client/petstore/typescript-angular/package.json b/samples/client/petstore/typescript-angularjs/package.json similarity index 100% rename from samples/client/petstore/typescript-angular/package.json rename to samples/client/petstore/typescript-angularjs/package.json diff --git a/samples/client/petstore/typescript-angular/pom.xml b/samples/client/petstore/typescript-angularjs/pom.xml similarity index 100% rename from samples/client/petstore/typescript-angular/pom.xml rename to samples/client/petstore/typescript-angularjs/pom.xml diff --git a/samples/client/petstore/typescript-angular/tsconfig.json b/samples/client/petstore/typescript-angularjs/tsconfig.json similarity index 100% rename from samples/client/petstore/typescript-angular/tsconfig.json rename to samples/client/petstore/typescript-angularjs/tsconfig.json diff --git a/samples/client/petstore/typescript-angular/tsd.json b/samples/client/petstore/typescript-angularjs/tsd.json similarity index 100% rename from samples/client/petstore/typescript-angular/tsd.json rename to samples/client/petstore/typescript-angularjs/tsd.json