mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 16:36:54 +00:00
JSON type in Dynamic Entity
This commit is contained in:
parent
cc812f230f
commit
eb49ea7593
@ -2538,6 +2538,14 @@ object ExampleValue {
|
||||
| "type": "integer",
|
||||
| "example": "698761728934",
|
||||
| "description": "description of **number** field, can be markdown text."
|
||||
| },
|
||||
| "metadata": {
|
||||
| "type": "json",
|
||||
| "example": {
|
||||
| "tags": ["important", "verified"],
|
||||
| "settings": {"color": "blue", "priority": 1}
|
||||
| },
|
||||
| "description": "description of **metadata** field (JSON object or array), can be markdown text."
|
||||
| }
|
||||
| }
|
||||
| }
|
||||
|
||||
@ -2966,7 +2966,7 @@ object Glossary extends MdcLoggable {
|
||||
|
|
||||
|**Supported field types:**
|
||||
|
|
||||
|STRING, INTEGER, DOUBLE, BOOLEAN, DATE_WITH_DAY (format: yyyy-MM-dd), and reference types (foreign keys)
|
||||
|STRING, INTEGER, DOUBLE, BOOLEAN, DATE_WITH_DAY (format: yyyy-MM-dd), JSON (objects and arrays), and reference types (foreign keys)
|
||||
|
|
||||
|**The hasPersonalEntity flag:**
|
||||
|
|
||||
|
||||
@ -2321,6 +2321,17 @@ trait APIMethods400 extends MdcLoggable {
|
||||
| "summary": {
|
||||
| "type": "string",
|
||||
| "example": "User received 'No such price' error using Stripe API"
|
||||
| },
|
||||
| "custom_metadata": {
|
||||
| "type": "json",
|
||||
| "example": {
|
||||
| "priority": "high",
|
||||
| "tags": ["support", "billing"],
|
||||
| "context": {
|
||||
| "page": "checkout",
|
||||
| "step": 3
|
||||
| }
|
||||
| }
|
||||
| }
|
||||
| }
|
||||
| },
|
||||
@ -2513,6 +2524,17 @@ trait APIMethods400 extends MdcLoggable {
|
||||
| "summary": {
|
||||
| "type": "string",
|
||||
| "example": "User received 'No such price' error using Stripe API"
|
||||
| },
|
||||
| "custom_metadata": {
|
||||
| "type": "json",
|
||||
| "example": {
|
||||
| "priority": "high",
|
||||
| "tags": ["support", "billing"],
|
||||
| "context": {
|
||||
| "page": "checkout",
|
||||
| "step": 3
|
||||
| }
|
||||
| }
|
||||
| }
|
||||
| }
|
||||
| },
|
||||
|
||||
@ -249,6 +249,17 @@ object DynamicEntityFieldType extends OBPEnumeration[DynamicEntityFieldType]{
|
||||
|
||||
override def wrongTypeMsg: String = s"the value's type should be $this, format is $dateFormat."
|
||||
}
|
||||
object json extends Value {
|
||||
val jValueType = classOf[JValue]
|
||||
override def isJValueValid(jValue: JValue): Boolean = {
|
||||
jValue match {
|
||||
case _: JObject => true
|
||||
case _: JArray => true
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
override def wrongTypeMsg: String = "the value's type should be a JSON object or array."
|
||||
}
|
||||
//object array extends Value{val jValueType = classOf[JArray]}
|
||||
//object `object` extends Value{val jValueType = classOf[JObject]} //TODO in the future, we consider support nested type
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user