@@ -165,7 +165,7 @@ def generateBySpec(
165165 | try {
166166 | Right(readFromArray[T](bytes))
167167 | } catch {
168- | case e: Exception =>
168+ | case e: JsonReaderException =>
169169 | Left(DeserializationException(String(bytes, java.nio.charset.StandardCharsets.UTF_8), e, metadata))
170170 | }
171171 | else Left(UnexpectedStatusCode(String(bytes, java.nio.charset.StandardCharsets.UTF_8), metadata))
@@ -325,10 +325,12 @@ def resourceCode(
325325
326326 val (requiredParams, optParams) = method.scalaParameters.partition(_._2.required)
327327 def params (indent : String ) =
328- requiredParams.map((n, t) => s " ${toComment(t.description)}$indent$n: ${t.scalaType(arrType)}" ) :::
328+ requiredParams.map((n, t) => s " ${toComment(t.description, indent )}$indent$n: ${t.scalaType(arrType)}" ) :::
329329 req.toList.map(r => s " ${indent}request: ${r.scalaType(arrType)}" ) :::
330330 uploadProtocol.toList.map((typ, default) => s " ${indent}uploadProtocol: $typ = \" $default\" " ) :::
331- optParams.map((n, t) => s " ${toComment(t.description)}$indent$n: ${t.scalaType(arrType)} = None " ) :::
331+ optParams.map((n, t) =>
332+ s " ${toComment(t.description, indent)}$indent$n: ${t.scalaType(arrType)} = None "
333+ ) :::
332334 List (
333335 s " ${indent}endpointUrl: Uri = $rootPkg.baseUrl " ,
334336 s " ${indent}commonQueryParams: QueryParameters = " + ((
@@ -385,7 +387,8 @@ def resourceCode(
385387 )
386388 case _ => (responseType(" String" ), " .response(asEmptyResponse)" )
387389
388- s """ | def ${toScalaName(k)}(\n ${params(indent = " " ).mkString(" ,\n " )}\n ): $resType = { $queryParams
390+ s """ | ${toComment(method.description)} def ${toScalaName(k)}(\n ${params(indent = " " )
391+ .mkString(" ,\n " )}\n ): $resType = { $queryParams
389392 | $setReqUri
390393 | resourceRequest. ${method.httpMethod.toLowerCase()}(requestUri.addParams(params)) $body$mapResponse
391394 | } """ .stripMargin
@@ -529,6 +532,7 @@ case class MediaUpload(protocols: Map[String, MediaUploadProtocol], accept: List
529532
530533case class Method (
531534 httpMethod : String ,
535+ description : Option [String ],
532536 path : String ,
533537 flatPath : Option [FlatPath ],
534538 parameters : Map [String , Parameter ],
@@ -589,6 +593,7 @@ object Method:
589593 given Reader [Method ] = reader[ujson.Obj ].map { o =>
590594 Method (
591595 httpMethod = o(" httpMethod" ).str,
596+ description = o.value.get(" description" ).map(_.str),
592597 path = o(" path" ).str,
593598 flatPath = o.value
594599 .get(" flatPath" )
0 commit comments