mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 16:36:54 +00:00
bugfix: Fixing malformed example in Dynamic Entity diagnostics that
caused a problem!
This commit is contained in:
parent
c7b65538b5
commit
00d6b792c8
@ -440,7 +440,7 @@ trait APIMethods600 {
|
||||
|
|
||||
|**What It Checks:**
|
||||
|This endpoint analyzes all dynamic entities (both system and bank level) for:
|
||||
|* Boolean fields with invalid example values (e.g., `"{"tok"` instead of `"true"` or `"false"`)
|
||||
|* Boolean fields with invalid example values (e.g., actual JSON booleans or invalid strings instead of `"true"` or `"false"`)
|
||||
|* Malformed JSON in field definitions
|
||||
|* Fields that cannot be converted to their declared types
|
||||
|* Other validation issues that cause Swagger generation to fail
|
||||
@ -469,8 +469,8 @@ trait APIMethods600 {
|
||||
| "entity_name": "Customer",
|
||||
| "bank_id": "gh.29.uk",
|
||||
| "field_name": "is_active",
|
||||
| "example_value": "{"tok",
|
||||
| "error_message": "Boolean field has invalid example value. Expected 'true' or 'false', got: '{"tok'"
|
||||
| "example_value": "malformed_value",
|
||||
| "error_message": "Boolean field has invalid example value. Expected 'true' or 'false', got: 'malformed_value'"
|
||||
|}
|
||||
|```
|
||||
|
|
||||
@ -488,8 +488,8 @@ trait APIMethods600 {
|
||||
entity_name = "MyEntity",
|
||||
bank_id = "gh.29.uk",
|
||||
field_name = "is_active",
|
||||
example_value = "{\"tok",
|
||||
error_message = "Boolean field has invalid example value. Expected 'true' or 'false', got: '{\"tok'"
|
||||
example_value = "malformed_value",
|
||||
error_message = "Boolean field has invalid example value. Expected 'true' or 'false', got: 'malformed_value'"
|
||||
)
|
||||
),
|
||||
total_issues = 1
|
||||
|
||||
@ -194,7 +194,17 @@ sealed trait DynamicEntityFieldType extends EnumValue {
|
||||
object DynamicEntityFieldType extends OBPEnumeration[DynamicEntityFieldType]{
|
||||
object number extends Value{val jValueType = classOf[JDouble]}
|
||||
object integer extends Value{val jValueType = classOf[JInt]}
|
||||
object boolean extends Value{val jValueType = classOf[JBool]}
|
||||
object boolean extends Value {
|
||||
val jValueType = classOf[JString]
|
||||
override def isJValueValid(jValue: JValue): Boolean = {
|
||||
super.isJValueValid(jValue) && {
|
||||
val value = jValue.asInstanceOf[JString].s
|
||||
val lowerValue = value.toLowerCase
|
||||
lowerValue == "true" || lowerValue == "false"
|
||||
}
|
||||
}
|
||||
override def wrongTypeMsg: String = s"""the value's type should be string "true" or "false"."""
|
||||
}
|
||||
object string extends Value{
|
||||
val jValueType = classOf[JString]
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user