@@ -368,14 +368,14 @@ def resourceCode(
368368 case None => None
369369
370370 val (requiredParams, optParams) = method.scalaParameters.partition(_._2.required)
371- val params =
372- requiredParams.map((n, t) => s " ${toComment(t.description)}$n: ${t.scalaType(arrType)}" ) :::
373- req.toList.map(r => s " request: ${r.scalaType(arrType)}" ) :::
374- uploadProtocol.toList.map((typ, default) => s " uploadProtocol: $typ = \" $default\" " ) :::
375- optParams.map((n, t) => s " ${toComment(t.description)}$n: ${t.scalaType(arrType)} = None " ) :::
371+ def params ( indent : String ) =
372+ requiredParams.map((n, t) => s " ${toComment(t.description)}$indent$ n: ${t.scalaType(arrType)}" ) :::
373+ req.toList.map(r => s " ${indent} request: ${r.scalaType(arrType)}" ) :::
374+ uploadProtocol.toList.map((typ, default) => s " ${indent} uploadProtocol: $typ = \" $default\" " ) :::
375+ optParams.map((n, t) => s " ${toComment(t.description)}$indent$ n: ${t.scalaType(arrType)} = None " ) :::
376376 List (
377- s " endpointUrl: Uri = $rootPkg.baseUrl " ,
378- " commonQueryParams: QueryParameters = " + ((
377+ s " ${indent} endpointUrl: Uri = $rootPkg.baseUrl " ,
378+ s " ${indent} commonQueryParams: QueryParameters = " + ((
379379 method.mediaUploads,
380380 commonQueryParams.collectFirst { case (" uploadType" , Parameter (_, _, e : SchemaType .Enum , _, _)) => e }
381381 ) match {
@@ -431,10 +431,10 @@ def resourceCode(
431431 )
432432 case _ => (responseType(" String" ), " .response(asEmptyResponse)" )
433433
434- s """ |def ${toScalaName(k)}(\n ${params.mkString(" ,\n " )}): $resType = { $queryParams
435- | $setReqUri
436- | resourceRequest. ${method.httpMethod.toLowerCase()}(requestUri.addParams(params)) $body$mapResponse
437- |} """ .stripMargin
434+ s """ | def ${toScalaName(k)}(\n ${params(indent = " " ) .mkString(" ,\n " )}\n ): $resType = { $queryParams
435+ | $setReqUri
436+ | resourceRequest. ${method.httpMethod.toLowerCase()}(requestUri.addParams(params)) $body$mapResponse
437+ | } """ .stripMargin
438438 }
439439 .mkString(" \n " , " \n\n " , " \n " ) +
440440 " }"
@@ -489,12 +489,12 @@ def schemasCode(
489489 val enumType =
490490 if jsonCodec == JsonCodec .ZioJson then SchemaType .EnumType .Literal
491491 else SchemaType .EnumType .Nominal (s " $scalaName. $n" )
492- s " ${toComment(t.withTypeDescription)}$n: ${
492+ s " ${toComment(t.withTypeDescription)} $n: ${
493493 (if (t.optional) s " ${t.scalaType(arrType, enumType)} = None " else t.scalaType(arrType, enumType))
494494 }"
495495 }
496496 .mkString(" " , " ,\n " , " " )}
497- |) {\n ${`def toJsonString`(scalaName)}\n}\n
497+ |) {\n ${`def toJsonString`(scalaName)}\n}\n
498498 |
499499 | ${jsonDecoder(scalaName)}
500500 | """ .stripMargin
@@ -810,7 +810,7 @@ object SchemaType:
810810 read[List [String ]](e)
811811 .zip(read[List [String ]](o(" enumDescriptions" )))
812812 .map((v, vd) => EnumValue (value = v, enumDescription = vd)),
813- false
813+ optional
814814 )
815815 case _ =>
816816 o.value.get(" additionalProperties" ).map(_.obj) match
0 commit comments