You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I create an Enumeratum Enum, and use either the @title annotation or withTitle directly on the schema, the title is not shown in the rendered JSON Schema.
To Reproduce
Welcome to Scala 2.12.15 (OpenJDK 64-Bit Server VM, Java 11.0.15).
Type in expressions for evaluation. Or try :help.
scala> import enumeratum.Enum
import enumeratum.Enum
scala> import enumeratum.EnumEntry
import enumeratum.EnumEntry
scala> import json.schema._
import json.schema._
scala> :paste
// Entering paste mode (ctrl-D to finish)
@title("foo")
sealed trait Foo extends EnumEntry
object Foo extends Enum[Foo] {
val values = findValues
case object Bar extends Foo
case object Baz extends Foo
import com.github.andyglow.jsonschema.EnumeratumSupport._
implicit val jsonSchema = json.Json.schema[Foo]
}
// Exiting paste mode, now interpreting.
defined trait Foo
defined object Foo
scala> println(Foo.jsonSchema)
enum[string]("Bar","Baz") title=`foo`
scala> import com.github.andyglow.jsonschema.AsCirce._
import com.github.andyglow.jsonschema.AsCirce._
scala> import json.schema.Version._
import json.schema.Version._
scala> Foo.jsonSchema.asCirce(Draft04()).spaces2
res1: String =
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"type" : "string",
"enum" : [
"Bar",
"Baz"
]
}
Additional context
I tried additional Draft versions, all behave the same. I had a look at json-schema.org and didn't see anything that suggested the title shouldn't be there. Using an app like http://json-schema.app, the title attribute is used if I manually add it.
The text was updated successfully, but these errors were encountered:
Describe the bug
If I create an Enumeratum
Enum
, and use either the@title
annotation orwithTitle
directly on the schema, the title is not shown in the rendered JSON Schema.To Reproduce
Expected behavior
I expect the output to be
Actual results
See above.
Versions:
Additional context
I tried additional Draft versions, all behave the same. I had a look at json-schema.org and didn't see anything that suggested the
title
shouldn't be there. Using an app like http://json-schema.app, thetitle
attribute is used if I manually add it.The text was updated successfully, but these errors were encountered: