Skip to content

Overriding Keys' Values in Map[ADT, ...]? #245

Answered by andyglow
kevinmeredith asked this question in Q&A
Discussion options

You must be logged in to vote

Well.. override def toString: String = "B" is the run-time construction
whereas scala-jsonschema was designed as compile-time code generator..
which means all the info about the schema is taken from types

in your case you can use KeyPattern[T] typeclass which would override the string used for patternProperties key definition.

Try

implicit val discriminatorPattern: KeyPattern[Discriminator] = KeyPattern.mk("^(?:B|C)$")

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by andyglow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants