Skip to content

Commit

Permalink
Merge pull request #880 from vanhoanHoang/fix/mdoc-request-path-proce…
Browse files Browse the repository at this point in the history
…ssing

Fix path processing logic in addToMdocRequest
Closes #915
  • Loading branch information
waltkb authored Jan 30, 2025
2 parents b01593d + 16d59ed commit 15d4211
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ data class InputDescriptorField(
}

fun addToMdocRequest(mDocRequestBuilder: MDocRequestBuilder, intentToRetain: Boolean = false): MDocRequestBuilder {
path.firstOrNull()?.trimStart('$')?.replace("['", "")?.replace("']", ".")?.trimEnd('.')?.split('.')
?.also { pathSegments ->
mDocRequestBuilder.addDataElementRequest(pathSegments.first(), pathSegments.last(), intentToRetain)
}
path.firstOrNull()?.trimStart('$')?.replace("['", "")?.replace("']", ".")?.trimEnd('.')
?.let { it.substringBeforeLast('.') to it.substringAfterLast('.') }
?.also { (namespace, lastSegment) ->
mDocRequestBuilder.addDataElementRequest(namespace, lastSegment, intentToRetain)
}
return mDocRequestBuilder
}
}
Expand Down

0 comments on commit 15d4211

Please sign in to comment.