Fork me on GitHub
#malli
<
2023-03-09
>
emccue16:03:11

Random bit of info - you can use JFR to listen for class redefinitions. Might this be usable for detecting reloaded namespace vars?

emccue16:03:17

public static void startJfr() throws IOException, ParseException {
    var path = Paths.get("jfr.xml");
    var config = Configuration.create(path);
    var events = List.of("jdk.SocketRead", "jdk.SocketWrite", "jdk.TLSHandshake");
    Runnable task = () -> {
        try (EventStream es = new RecordingStream(config)) {
            events.forEach(event -> es.onEvent(event, System.out::println));
            es.start();
        }
    };
    new Thread(task).start();
}

emccue16:03:22

<configuration version="2.0">
    <event name="jdk.SocketRead">
        <setting name="enabled">true</setting>
        <setting name="stackTrace">true</setting>
        <setting name="threshold" control="socket-io-threshold">0 s</setting>
    </event>
    <event name="jdk.SocketWrite">
        <setting name="enabled">true</setting>
        <setting name="stackTrace">true</setting>
        <setting name="threshold" control="socket-io-threshold">0 s</setting>
    </event>
    <event name="jdk.TLSHandshake">
        <setting name="enabled">true</setting>
        <setting name="stackTrace">true</setting>
        <setting name="threshold" control="socket-io-threshold">0 s</setting>
    </event>
</configuration>

emccue16:03:29

jdk.ClassRedefinition

emccue16:03:34

specifically this event^

d19:03:31

Hi, there! Does malli have a function like spec2's select? Something like this maybe, supporting selecting nested keys:

(let [schema [:map
                [::name string?]
                [::age pos-int?]
                [::address
                 [:map
                  [::address.city string?]
                  [::address.country string?]]]]]
    (m/select schema [::name ::address {::address [::address.city]}]))

d19:03:35

Thanks! I implemented my own function, looks very much like this one. Just wonder why this can't be on malli itself, as it seems some people(including me) think it is useful

👍 4
ikitommi07:03:56

This would be nice, can’t recall the difference of EQL and Spec Select syntax, are they the same?