Skip to content

Commit 3109258

Browse files
committed
Merge branch 'sdavis-r7-master'
2 parents 5a143ec + f482132 commit 3109258

File tree

7 files changed

+41
-16
lines changed

7 files changed

+41
-16
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,15 @@ public String toEnumValue(String value, String datatype) {
722722
}
723723
}
724724

725+
@Override
726+
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Model> definitions, Swagger swagger) {
727+
CodegenOperation op = super.fromOperation(path, httpMethod, operation, definitions, swagger);
728+
729+
op.path = sanitizePath(op.path);
730+
731+
return op;
732+
}
733+
725734
private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
726735
// This generator uses inline classes to define enums, which breaks when
727736
// dealing with models that have subTypes. To clean this up, we will analyze
@@ -811,6 +820,11 @@ public void setSerializableModel(Boolean serializableModel) {
811820
this.serializableModel = serializableModel;
812821
}
813822

823+
private String sanitizePath(String p) {
824+
//prefer replace a ", instead of a fuLL URL encode for readability
825+
return p.replaceAll("\"", "%22");
826+
}
827+
814828
public void setFullJavaUtil(boolean fullJavaUtil) {
815829
this.fullJavaUtil = fullJavaUtil;
816830
}

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,9 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation
684684
op.returnType = normalizeType(op.returnType);
685685
}
686686

687+
//path is an unescaped variable in the mustache template api.mustache line 82 '<&path>'
688+
op.path = sanitizePath(op.path);
689+
687690
// Set vendor-extension to be used in template:
688691
// x-codegen-hasMoreRequired
689692
// x-codegen-hasMoreOptional
@@ -738,6 +741,11 @@ public CodegenModel fromModel(String name, Model model, Map<String, Model> allDe
738741
return codegenModel;
739742
}
740743

744+
private String sanitizePath(String p) {
745+
//prefer replace a ', instead of a fuLL URL encode for readability
746+
return p.replaceAll("'", "%27");
747+
}
748+
741749
private String trimBrackets(String s) {
742750
if (s != null) {
743751
int beginIdx = s.charAt(0) == '[' ? 1 : 0;

modules/swagger-codegen/src/main/resources/php/api.mustache

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ use \{{invokerPackage}}\ObjectSerializer;
8686
* Operation {{{operationId}}}
8787
*
8888
* {{{summary}}}.
89-
*
90-
{{#allParams}} * @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
91-
{{/allParams}} *
89+
*/
90+
{{#allParams}} // * @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
91+
{{/allParams}}
92+
/**
9293
* @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
9394
* @throws \{{invokerPackage}}\ApiException on non-2xx response
9495
*/
@@ -103,9 +104,10 @@ use \{{invokerPackage}}\ObjectSerializer;
103104
* Operation {{{operationId}}}WithHttpInfo
104105
*
105106
* {{{summary}}}.
106-
*
107-
{{#allParams}} * @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
108-
{{/allParams}} *
107+
*/
108+
{{#allParams}} // * @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
109+
{{/allParams}}
110+
/**
109111
* @return Array of {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings)
110112
* @throws \{{invokerPackage}}\ApiException on non-2xx response
111113
*/

modules/swagger-codegen/src/main/resources/php/model.mustache

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ use \ArrayAccess;
2929
/**
3030
* {{classname}} Class Doc Comment
3131
*
32-
* @category Class
32+
* @category Class */
3333
{{#description}}
34-
* @description {{description}}
34+
// @description {{description}}
3535
{{/description}}
36+
/**
3637
* @package {{invokerPackage}}
3738
* @author http://github.com/swagger-api/swagger-codegen
3839
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2

modules/swagger-codegen/src/main/resources/php/model_test.mustache

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ namespace {{invokerPackage}};
2525
/**
2626
* {{classname}}Test Class Doc Comment
2727
*
28-
* @category Class
29-
* @description {{#description}}{{description}}{{/description}}{{^description}}{{classname}}{{/description}}
28+
* @category Class */
29+
// * @description {{#description}}{{description}}{{/description}}{{^description}}{{classname}}{{/description}}
30+
/**
3031
* @package {{invokerPackage}}
3132
* @author http://github.com/swagger-api/swagger-codegen
3233
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2

modules/swagger-codegen/src/main/resources/php/partial_header.mustache

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
{{#appName}}
33
* {{{appName}}}
44
*
5-
{{/appName}}
5+
{{/appName}} */
66
{{#appDescription}}
7-
* {{{appDescription}}}
8-
*
7+
//* {{{appDescription}}}
98
{{/appDescription}}
10-
* {{#version}}OpenAPI spec version: {{{version}}}{{/version}}
9+
/* {{#version}}OpenAPI spec version: {{{version}}}{{/version}}
1110
* {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}}
1211
* Generated by: https://github.com/swagger-api/swagger-codegen.git
1312
*

modules/swagger-codegen/src/main/resources/ruby/api_info.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{{#appName}}
2-
{{{appName}}}
2+
#{{{appName}}}
33

44
{{/appName}}
55
{{#appDescription}}
6-
{{{appDescription}}}
6+
#{{{appDescription}}}
77

88
{{/appDescription}}
99
{{#version}}OpenAPI spec version: {{version}}{{/version}}

0 commit comments

Comments
 (0)