Skip to content

Commit 05e5029

Browse files
committed
Regen samples
1 parent 8a17590 commit 05e5029

5 files changed

Lines changed: 95 additions & 61 deletions

File tree

samples/client/petstore/scala-sttp-circe/.openapi-generator/FILES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ src/main/scala/org/openapitools/client/core/DateSerializers.scala
1212
src/main/scala/org/openapitools/client/core/JsonSupport.scala
1313
src/main/scala/org/openapitools/client/model/Animal.scala
1414
src/main/scala/org/openapitools/client/model/ApiResponse.scala
15+
src/main/scala/org/openapitools/client/model/Cat.scala
1516
src/main/scala/org/openapitools/client/model/Category.scala
1617
src/main/scala/org/openapitools/client/model/Collar.scala
18+
src/main/scala/org/openapitools/client/model/Dog.scala
1719
src/main/scala/org/openapitools/client/model/EnumTest.scala
1820
src/main/scala/org/openapitools/client/model/Kennel.scala
1921
src/main/scala/org/openapitools/client/model/Order.scala

samples/client/petstore/scala-sttp-circe/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ Class | Method | HTTP request | Description
9393

9494
- [Animal](Animal.md)
9595
- [ApiResponse](ApiResponse.md)
96+
- [Cat](Cat.md)
9697
- [Category](Category.md)
9798
- [Collar](Collar.md)
99+
- [Dog](Dog.md)
98100
- [EnumTest](EnumTest.md)
99101
- [Kennel](Kennel.md)
100102
- [Order](Order.md)

samples/client/petstore/scala-sttp-circe/src/main/scala/org/openapitools/client/model/Animal.scala

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ import io.circe.{Decoder, DecodingFailure, Encoder, Json}
1515
import io.circe.syntax._
1616
import org.openapitools.client.core.JsonSupport._
1717

18-
sealed trait Animal {
19-
def className: String
20-
def color: Option[String]
21-
}
18+
trait Animal
2219
object Animal {
2320
implicit val encoderAnimal: Encoder[Animal] = Encoder.instance {
2421
case obj: Cat => obj.asJson.mapObject(("className" -> "CAT".asJson) +: _)
@@ -33,60 +30,3 @@ object Animal {
3330
}
3431
}
3532

36-
case class Cat(
37-
className: String,
38-
color: Option[String] = None,
39-
declawed: Option[Boolean] = None
40-
) extends Animal
41-
object Cat {
42-
implicit val encoderCat: Encoder[Cat] = Encoder.instance { t =>
43-
Json.fromFields{
44-
Seq(
45-
Some("className" -> t.className.asJson),
46-
t.color.map(v => "color" -> v.asJson),
47-
t.declawed.map(v => "declawed" -> v.asJson)
48-
).flatten
49-
}
50-
}
51-
implicit val decoderCat: Decoder[Cat] = Decoder.instance { c =>
52-
for {
53-
className <- c.downField("className").as[String]
54-
color <- c.downField("color").as[Option[String]]
55-
declawed <- c.downField("declawed").as[Option[Boolean]]
56-
} yield Cat(
57-
className = className,
58-
color = color,
59-
declawed = declawed
60-
)
61-
}
62-
}
63-
64-
case class Dog(
65-
className: String,
66-
color: Option[String] = None,
67-
breed: Option[String] = None
68-
) extends Animal
69-
object Dog {
70-
implicit val encoderDog: Encoder[Dog] = Encoder.instance { t =>
71-
Json.fromFields{
72-
Seq(
73-
Some("className" -> t.className.asJson),
74-
t.color.map(v => "color" -> v.asJson),
75-
t.breed.map(v => "breed" -> v.asJson)
76-
).flatten
77-
}
78-
}
79-
implicit val decoderDog: Decoder[Dog] = Decoder.instance { c =>
80-
for {
81-
className <- c.downField("className").as[String]
82-
color <- c.downField("color").as[Option[String]]
83-
breed <- c.downField("breed").as[Option[String]]
84-
} yield Dog(
85-
className = className,
86-
color = color,
87-
breed = breed
88-
)
89-
}
90-
}
91-
92-
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* OpenAPI Petstore
3+
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
4+
*
5+
* The version of the OpenAPI document: 1.0.0
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
package org.openapitools.client.model
13+
14+
import io.circe.{Decoder, DecodingFailure, Encoder, Json}
15+
import io.circe.syntax._
16+
import org.openapitools.client.core.JsonSupport._
17+
18+
case class Cat(
19+
className: String,
20+
color: Option[String] = None,
21+
declawed: Option[Boolean] = None
22+
) extends Animal
23+
object Cat {
24+
implicit val encoderCat: Encoder[Cat] = Encoder.instance { t =>
25+
Json.fromFields{
26+
Seq(
27+
Some("className" -> t.className.asJson),
28+
t.color.map(v => "color" -> v.asJson),
29+
t.declawed.map(v => "declawed" -> v.asJson)
30+
).flatten
31+
}
32+
}
33+
implicit val decoderCat: Decoder[Cat] = Decoder.instance { c =>
34+
for {
35+
className <- c.downField("className").as[String]
36+
color <- c.downField("color").as[Option[String]]
37+
declawed <- c.downField("declawed").as[Option[Boolean]]
38+
} yield Cat(
39+
className = className,
40+
color = color,
41+
declawed = declawed
42+
)
43+
}
44+
}
45+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* OpenAPI Petstore
3+
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
4+
*
5+
* The version of the OpenAPI document: 1.0.0
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
package org.openapitools.client.model
13+
14+
import io.circe.{Decoder, DecodingFailure, Encoder, Json}
15+
import io.circe.syntax._
16+
import org.openapitools.client.core.JsonSupport._
17+
18+
case class Dog(
19+
className: String,
20+
color: Option[String] = None,
21+
breed: Option[String] = None
22+
) extends Animal
23+
object Dog {
24+
implicit val encoderDog: Encoder[Dog] = Encoder.instance { t =>
25+
Json.fromFields{
26+
Seq(
27+
Some("className" -> t.className.asJson),
28+
t.color.map(v => "color" -> v.asJson),
29+
t.breed.map(v => "breed" -> v.asJson)
30+
).flatten
31+
}
32+
}
33+
implicit val decoderDog: Decoder[Dog] = Decoder.instance { c =>
34+
for {
35+
className <- c.downField("className").as[String]
36+
color <- c.downField("color").as[Option[String]]
37+
breed <- c.downField("breed").as[Option[String]]
38+
} yield Dog(
39+
className = className,
40+
color = color,
41+
breed = breed
42+
)
43+
}
44+
}
45+

0 commit comments

Comments
 (0)