Skip to content

Commit

Permalink
Consistency, dot-access Map fields, bracket-index arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
blast-hardcheese committed Oct 3, 2019
1 parent 79c39c9 commit e187238
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -17,8 +17,8 @@ trait MappishImplicits {
def label(i: I): Option[String] = Some(buildLabel(i))
}

implicit def stringMIF[F[_]: IndexedFunctor] = buildMappishIndexedFunctor[F, String](x => s"[$x]")
implicit def httpMethodMIF[F[_]: IndexedFunctor] = buildMappishIndexedFunctor[F, io.swagger.v3.oas.models.PathItem.HttpMethod](x => s"[${x.name}]")
implicit def stringMIF[F[_]: IndexedFunctor] = buildMappishIndexedFunctor[F, String](x => s".$x")
implicit def httpMethodMIF[F[_]: IndexedFunctor] = buildMappishIndexedFunctor[F, io.swagger.v3.oas.models.PathItem.HttpMethod](x => s".${x.name}")

implicit def mappishFunctor[F[_], Z](implicit F: Functor[F]): Functor[Mappish[F, Z, ?]] = new Functor[Mappish[F, Z, ?]] {
def map[A, B](fa: Mappish[F, Z, A])(f: A => B): Mappish[F, Z, B] = Mappish(F.map(fa.value)({ case (z, a) => (z, f(a)) }))
Expand Down
6 changes: 3 additions & 3 deletions modules/codegen/src/test/scala/core/TrackerTests.scala
Expand Up @@ -88,7 +88,7 @@ Tracker should:
}

"map" in {
def pattern(name: String) = s".child2[${name}]"
def pattern(name: String) = s".child2.${name}"
forAll { parent: Parent =>
Tracker(parent)
.downField("child2", _.child2)
Expand Down Expand Up @@ -140,7 +140,7 @@ Tracker should:
| 200:
| description: Success
|""".stripMargin
val (_, UserError("Missing operationId (.paths[/foo].operations[GET].operationId)")) =
val (_, UserError("Missing operationId (.paths./foo.operations.GET.operationId)")) =
runInvalidSwaggerSpec(swagger)(Context.empty, CodegenTarget.Server, Http4s)
}

Expand All @@ -153,7 +153,7 @@ Tracker should:
| get:
| operationId: foo
|""".stripMargin
val (_, UserError("No responses defined for foo (.paths[/foo].operations[GET].responses)")) =
val (_, UserError("No responses defined for foo (.paths./foo.operations.GET.responses)")) =
runInvalidSwaggerSpec(swagger)(Context.empty, CodegenTarget.Server, Http4s)
}
}
Expand Down

0 comments on commit e187238

Please sign in to comment.