forked from loafle/openapi-generator-original
Fix isNotRequired/required on models
This commit is contained in:
@@ -1 +1 @@
|
||||
sbt.version=0.12.3
|
||||
sbt.version=0.12.4
|
||||
@@ -11,7 +11,14 @@ import collection.mutable
|
||||
class {{classname}}(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
||||
|
||||
{{#operation}}
|
||||
def {{nickname}}({{#allParams}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}}{{^returnType}}: Future[Unit]{{/returnType}} = {
|
||||
|
||||
def {{nickname}}({{#allParams}}
|
||||
{{#optional}}
|
||||
{{paramName}}: Option[{{dataType}}] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{#hasMore}}, {{/hasMore}}
|
||||
{{/optional}}
|
||||
{{^optional}}
|
||||
{{paramName}}: {{dataType}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#hasMore}}, {{/hasMore}}
|
||||
{{/optional}}{{/allParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}}{{^returnType}}: Future[Unit]{{/returnType}} = {
|
||||
// create path and map variables
|
||||
val path =
|
||||
("{{path}}"
|
||||
|
||||
@@ -2,16 +2,17 @@ package {{package}}
|
||||
|
||||
import org.joda.time.DateTime
|
||||
|
||||
{{#imports}}import {{import}}
|
||||
{{/imports}}
|
||||
|
||||
{{#models}}
|
||||
|
||||
{{#model}}
|
||||
|
||||
case class {{className}} (
|
||||
case class {{classname}} (
|
||||
{{#vars}}
|
||||
|
||||
{{#description}}/* {{{description}}} */
|
||||
{{/description}}
|
||||
{{name}}: {{datatype}}{{#hasMore}},{{newline}} {{/hasMore}}
|
||||
{{/vars}})
|
||||
{{name}}: {{#isNotRequired}}Option[{{/isNotRequired}}{{datatype}}{{#isNotRequired}}]{{/isNotRequired}} {{#hasMore}},{{/hasMore}}{{#description}} // {{description}}{{/description}}{{newline}}
|
||||
{{/vars}}
|
||||
)
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
@@ -442,8 +442,7 @@ class Codegen(config: CodegenConfig) {
|
||||
"defaultValue" -> config.toDeclaration(propertyDocSchema)._2,
|
||||
"description" -> propertyDocSchema.description,
|
||||
"notes" -> propertyDocSchema.description,
|
||||
"required" -> propertyDocSchema.required.toString,
|
||||
"isNotRequired" -> (!propertyDocSchema.required).toString,
|
||||
(if(propertyDocSchema.required) "required" else "isNotRequired") -> "true",
|
||||
"getter" -> config.toGetter(prop._1, config.toDeclaration(propertyDocSchema)._1),
|
||||
"setter" -> config.toSetter(prop._1, config.toDeclaration(propertyDocSchema)._1),
|
||||
"isList" -> isList,
|
||||
|
||||
@@ -95,10 +95,7 @@ object ScalaAsyncClientGenerator extends App {
|
||||
if (!r.startsWith("http") && !r.startsWith("file")) sys.props("fileMap") = r
|
||||
r
|
||||
}
|
||||
val baseUrl = {
|
||||
val r = opts.baseUrl()
|
||||
if (r == null || r.trim.isEmpty) None else Some(r)
|
||||
}
|
||||
val baseUrl = opts.baseUrl.get
|
||||
val cfg = SwaggerGenConfig(
|
||||
api = SwaggerApi(opts.name(), resUrl, opts.`package`(), apiKey = opts.apiKey.get, baseUrl = baseUrl),
|
||||
templateDir = new File(opts.templateDir()),
|
||||
|
||||
Reference in New Issue
Block a user