[json] Provide pretty json schema node text in case the node is an object

Previously used asText() method always returns empty string for object nodes, which makes using the readChildNode(..) API inconvenient. Currently, we use pretty rendered string here

GitOrigin-RevId: 4c22553db897e371d6013f8dd8a7be2aa782c431
This commit is contained in:
Nikita Katkov
2024-07-11 16:39:38 +02:00
committed by intellij-monorepo-bot
parent 0040e3f019
commit 9dbc5b0a65
3 changed files with 3 additions and 3 deletions

View File

@@ -36,7 +36,7 @@ internal class InheritedJsonSchemaObjectView(
}
override fun readChildNodeValue(vararg childNodeName: String): String? {
return baseIfConditionOrOtherWithArgument(JsonSchemaObject::readChildNodeValue, childNodeName, Any?::isNotNull)
return baseIfConditionOrOtherWithArgument(JsonSchemaObject::readChildNodeValue, childNodeName, String?::isNotBlank)
}
override fun hasChildNode(vararg childNodeName: String): Boolean {

View File

@@ -38,7 +38,7 @@ internal class MergedJsonSchemaObjectView(
}
override fun readChildNodeValue(vararg childNodeName: String): String? {
return baseIfConditionOrOtherWithArgument(JsonSchemaObject::readChildNodeValue, childNodeName, Any?::isNotNull)
return baseIfConditionOrOtherWithArgument(JsonSchemaObject::readChildNodeValue, childNodeName, String?::isNotBlank)
}
override fun hasChildNode(vararg childNodeName: String): Boolean {

View File

@@ -38,7 +38,7 @@ internal object JacksonSchemaNodeAccessor : RawJsonSchemaNodeAccessor<JsonNode>
if (!node.isObject) return null
return getChild(node, *relativeChildPath)
.takeIf { it !is MissingNode }
?.asText()
?.toPrettyString()
}
override fun readTextNodeValue(node: JsonNode, vararg relativeChildPath: String): String? {