【发布时间】:2018-08-22 00:01:34
【问题描述】:
我想生成案例类的 json 模式,以便向其他服务提供一些信息,这些服务将使用 rest api 公开我的应用程序
我有这门课:
case class Vendor(
name: String,
synonyms: List[String],
transalit: String,
urlPart: String)
我怎样才能生成这样的:
{
"type":"object",
"properties":{
"name":{
"type":"string"
},
"synonyms":{
"type":"array",
"items":{
"type":"string"
}
},
"translit":{
"type":"string"
},
"urlPart":{
"type":"string"
}
}
}
我找到了这个:https://github.com/coursera/autoschema 但 sbt 找不到依赖项。
我也发现了这个Is there a way to get a JSON-Schema from a Scala Case Class hierarchy?,这个问题与我的非常相似,但没有答案..
也许我正在寻找不存在的答案。使用其他技术可能会更好
【问题讨论】: