Skip to content

Commit 55688f0

Browse files
committed
Simplify sjsonnew
1 parent 7b907aa commit 55688f0

File tree

1 file changed

+9
-32
lines changed

1 file changed

+9
-32
lines changed

sbtPlugin/src/main/scala/org/polyvariant/smithytraitcodegen/SmithyTraitCodegen.scala

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -46,41 +46,18 @@ object SmithyTraitCodegen {
4646

4747
object Args {
4848

49-
// format: off
50-
private type ArgsDeconstructed = String :*: String :*: os.Path :*: PathRef :*: List[PathRef] :*: List[String] :*: LNil
51-
// format: on
52-
5349
private implicit val pathFormat: JsonFormat[os.Path] = BasicJsonProtocol
5450
.projectFormat[os.Path, File](p => p.toIO, file => os.Path(file))
5551

56-
implicit val argsIso = LList.iso[Args, ArgsDeconstructed](
57-
{
58-
args: Args => ("javaPackage", args.javaPackage) :*:
59-
("smithyNamespace", args.smithyNamespace) :*:
60-
("targetDir", args.targetDir) :*:
61-
("smithySourcesDir", args.smithySourcesDir) :*:
62-
("dependencies", args.dependencies) :*:
63-
("externalProviders", args.externalProviders) :*:
64-
LNil
65-
},
66-
{
67-
case (_, javaPackage) :*:
68-
(_, smithyNamespace) :*:
69-
(_, targetDir) :*:
70-
(_, smithySourcesDir) :*:
71-
(_, dependencies) :*:
72-
(_, externalProviders) :*:
73-
LNil =>
74-
Args(
75-
javaPackage = javaPackage,
76-
smithyNamespace = smithyNamespace,
77-
targetDir = targetDir,
78-
smithySourcesDir = smithySourcesDir,
79-
dependencies = dependencies,
80-
externalProviders = externalProviders,
81-
)
82-
},
83-
)
52+
implicit val argsFmt: JsonFormat[Args] =
53+
caseClass(Args.apply _, Args.unapply _)(
54+
"javaPackage",
55+
"smithyNamespace",
56+
"targetDir",
57+
"smithySourcesDir",
58+
"dependencies",
59+
"externalProviders",
60+
)
8461

8562
}
8663

0 commit comments

Comments
 (0)