<@UJV6CBCKW> I've just rewritten the composite tes...
# http4k
d
@Razi Kheir I've just rewritten the composite test to check that it works:
Copy code
@Test
    fun `composite can use a mixture of overridden and non overridden values`() {
        data class Target(val foo: String, val bar: Int, var foobar: Int?)

        val finalEnv = from("bar" to "123") overrides from("FOO" to "bill")

        val key = EnvironmentKey.composite {
            Target(
                required("FOO")(it),
                int().required("BAR")(it),
                int().optional("FOOBAR")(it)
            )
        }

        assertThat(key(finalEnv), equalTo(Target("bill", 123, null)))
    }
}
😁 1
r
Using this way works for optional composites 🙂 Don’t know why I used the spec thing from the tests, this is actually much nicer! Thanks again Dave 🙂
d
There isn't an example of the composite config on the site. I'll try to add one.
👍 1
r
Is your website source tracked in repo too? If so I don’t mind adding it 🙂
d
@Razi Kheir thanks! You can add it to here and it will get automatically built into the right place: https://github.com/http4k/http4k/tree/master/src/docs/guide/modules/cloud_native
🎉 1
r
Will do 🙂