forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 2.3.0
This commit is contained in:
@@ -126,6 +126,8 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
}
|
||||
config.processOpts();
|
||||
config.preprocessSwagger(swagger);
|
||||
// TODO need to obtain version from a file instead of hardcoding it
|
||||
config.additionalProperties().put("generatorVersion", "2.2.3-SNAPSHOT");
|
||||
config.additionalProperties().put("generatedDate", DateTime.now().toString());
|
||||
config.additionalProperties().put("generatorClass", config.getClass().getName());
|
||||
config.additionalProperties().put("inputSpec", config.getInputSpec());
|
||||
|
||||
+9
@@ -711,6 +711,15 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
p.example = example;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toExampleValue(Property p) {
|
||||
if(p.getExample() != null) {
|
||||
return escapeText(p.getExample().toString());
|
||||
} else {
|
||||
return super.toExampleValue(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSwaggerType(Property p) {
|
||||
String swaggerType = super.getSwaggerType(p);
|
||||
|
||||
+3
-3
@@ -297,14 +297,14 @@ public class SpringCodegen extends AbstractJavaCodegen implements BeanValidation
|
||||
break;
|
||||
}
|
||||
|
||||
// add lamda for mustache templates
|
||||
additionalProperties.put("lamdaEscapeDoubleQuote", new Mustache.Lambda() {
|
||||
// add lambda for mustache templates
|
||||
additionalProperties.put("lambdaEscapeDoubleQuote", new Mustache.Lambda() {
|
||||
@Override
|
||||
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
|
||||
writer.write(fragment.execute().replaceAll("\"", Matcher.quoteReplacement("\\\"")));
|
||||
}
|
||||
});
|
||||
additionalProperties.put("lamdaRemoveLineBreak", new Mustache.Lambda() {
|
||||
additionalProperties.put("lambdaRemoveLineBreak", new Mustache.Lambda() {
|
||||
@Override
|
||||
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
|
||||
writer.write(fragment.execute().replaceAll("\\r|\\n", ""));
|
||||
|
||||
@@ -82,7 +82,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
|
||||
{{/maximum}}
|
||||
* @return {{name}}
|
||||
**/
|
||||
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||
{{#vendorExtensions.extraAnnotation}}
|
||||
{{{vendorExtensions.extraAnnotation}}}
|
||||
{{/vendorExtensions.extraAnnotation}}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class {{classname}}Controller implements {{classname}} {
|
||||
|
||||
{{/-first}}
|
||||
if (accept != null && accept.contains("{{{contentType}}}")) {
|
||||
return new ResponseEntity<{{>returnTypes}}>(objectMapper.readValue("{{#lamdaRemoveLineBreak}}{{#lamdaEscapeDoubleQuote}}{{{example}}}{{/lamdaEscapeDoubleQuote}}{{/lamdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.OK);
|
||||
return new ResponseEntity<{{>returnTypes}}>(objectMapper.readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.OK);
|
||||
}
|
||||
|
||||
{{/examples}}
|
||||
|
||||
@@ -9,3 +9,4 @@
|
||||
{{#version}}OpenAPI spec version: {{version}}{{/version}}
|
||||
{{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}}
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: {{{generatorVersion}}}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
+1
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.2.3-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user