Skip to content

Commit

Permalink
Merge pull request #236 from modelix/bugfix/MODELIX-530-fix-reference…
Browse files Browse the repository at this point in the history
…-resolving

fix(modelql): access to references outside of queries
  • Loading branch information
languitar authored Sep 11, 2023
2 parents b1ab8f3 + a3aae14 commit a1d5c09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ abstract class ModelQLNode(val client: ModelQLClient) : INode, ISupportsModelQL,
}

private fun IMonoStep<INode>.nodeRefAndConcept(): IMonoStep<IZip2Output<Any?, INodeReference, ConceptReference?>> {
return nodeReference().zip(conceptReference())
return map { it.nodeReference().zip(it.conceptReference()) }
}

private fun IFluxStep<INode>.nodeRefAndConcept(): IFluxStep<IZip2Output<Any?, INodeReference, ConceptReference?>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,13 @@ class ModelQLClientTest {
println(result)
assertEquals(listOf(1002, 2002), result)
}

@Test
fun `test IMonoStep nodeRefAndConcept`() = runTest { httpClient ->
val client = ModelQLClient("http://localhost/query", httpClient)

val nullNode = client.getRootNode().getReferenceTarget("nonExistentReference")

assertEquals(null, nullNode)
}
}

0 comments on commit a1d5c09

Please # to comment.