docfix: fixing dynamic-entity example response for list

This commit is contained in:
simonredfern 2026-01-22 15:09:16 +01:00
parent f1a2915640
commit b4856ef2ac

View File

@ -581,11 +581,16 @@ case class DynamicEntityInfo(definition: String, entityName: String, bankId: Opt
(singleName -> (JObject(JField(idName, JString(ExampleValue.idExample.value)) :: getSingleExampleWithoutId.obj)))
}
def getExampleList: JObject = if (bankId.isDefined){
val objectList: JObject = (listName -> JArray(List(getSingleExample)))
bankIdJObject merge objectList
} else{
(listName -> JArray(List(getSingleExample)))
def getExampleList: JObject = {
// Create the list item without the singleName wrapper - the actual API response
// returns a flat list of objects, not wrapped in entity name
val listItem: JObject = JObject(JField(idName, JString(ExampleValue.idExample.value)) :: getSingleExampleWithoutId.obj)
if (bankId.isDefined) {
val objectList: JObject = (listName -> JArray(List(listItem)))
bankIdJObject merge objectList
} else {
(listName -> JArray(List(listItem)))
}
}
val canCreateRole: ApiRole = DynamicEntityInfo.canCreateRole(entityName, bankId)