Merge branch 'master' of https://github.com/sdavis-r7/swagger-codegen into sdavis-r7-master

Conflicts:
	modules/swagger-codegen/src/main/resources/php/model.mustache
	modules/swagger-codegen/src/main/resources/php/model_generic.mustache
This commit is contained in:
wing328
2016-06-27 16:20:44 +08:00
7 changed files with 41 additions and 16 deletions

View File

@@ -722,6 +722,15 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
}
}
@Override
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Model> definitions, Swagger swagger) {
CodegenOperation op = super.fromOperation(path, httpMethod, operation, definitions, swagger);
op.path = sanitizePath(op.path);
return op;
}
private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
// This generator uses inline classes to define enums, which breaks when
// dealing with models that have subTypes. To clean this up, we will analyze
@@ -811,6 +820,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
this.serializableModel = serializableModel;
}
private String sanitizePath(String p) {
//prefer replace a ", instead of a fuLL URL encode for readability
return p.replaceAll("\"", "%22");
}
public void setFullJavaUtil(boolean fullJavaUtil) {
this.fullJavaUtil = fullJavaUtil;
}

View File

@@ -684,6 +684,9 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
op.returnType = normalizeType(op.returnType);
}
//path is an unescaped variable in the mustache template api.mustache line 82 '<&path>'
op.path = sanitizePath(op.path);
// Set vendor-extension to be used in template:
// x-codegen-hasMoreRequired
// x-codegen-hasMoreOptional
@@ -738,6 +741,11 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
return codegenModel;
}
private String sanitizePath(String p) {
//prefer replace a ', instead of a fuLL URL encode for readability
return p.replaceAll("'", "%27");
}
private String trimBrackets(String s) {
if (s != null) {
int beginIdx = s.charAt(0) == '[' ? 1 : 0;