아무도 셰이프리스를 사용하여이 테스트를 수행하는 방법을 알고 있지 않습니까? 나는 특정 인스턴스의 독립적 인 경우 클래스 A, 대한 JsonSchema 창출을하고 있어요로셰이프를 사용하여 유형 수준 필터링
package net.jtownson.swakka.jsonschema
import org.scalatest.FlatSpec
import org.scalatest.Matchers._
class OptionalFieldSpec extends FlatSpec {
case class A(i: Int, j: Option[Int])
"an extractor of some kind" should "get the (non)optional fields from a case class" in {
extractNonOptionalFieldNames[A] shouldBe List("i")
extractOptionalFieldNames[A] shouldBe List("j")
}
def extractNonOptionalFieldNames[T <: Product](/* implicit typeclass instances? */): List[String] = ???
def extractOptionalFieldNames[T <: Product]: List[String] = ???
}
나는 더 런타임 A의 인스턴스 또는 그 상응하는 일반 의약품이 없습니다. 스키마에는 이 필요하며 비 필수 필드 목록 인 필드가 필요합니다. 예 : 이 같은
{
"type" -> "object",
"required" -> ["i"],
"properties" -> {
"i" -> {
"type" -> "integer",
"format" -> "int32"
}
}
}
당신이 원하는'LabelledGeneric'을 - 당신에게 유형 레벨 필드 이름의 증거뿐만 아니라 자신의 유형을 줄 것이다. 그 너머에, 그냥 그 HList를 필터링하려는 것 같습니다. – Alec