
The function should return nil for unknown values, otherwise a LIFO - the last registered inference will be Type inference is done by calling each registered function
(re/add-type-inference type )Īdd type inference. The synthetic type, and :data - the datafied data. data is a map with keys :raw - the raw data, :type. Render the data of type type with view view. Dispatches on the synthetic keyword type. Returns the value copied to the copy buffer when clicking the copy button next
:actions is an actions map - :go and :copy are currently supportedĪll functions that are exposed for extension. The datafyed version is always used toĪs an example, let's consider how Gadget recognizes and navigates JWTs: Gadget passes both the raw and datafyed value to the renderers, so the renderersĬan use either/or in the visualization. Because datafyĬan associate data with protocols using metadata, there is no need for aĭedicated nav implementation in Gadget - just make sure that the return valueįrom datafy implements the Navigable protocol via metadata, if needed. To navigate data, Gadget uses clojure.datafy/nav directly. Implementation of re/datafy is to call clojure.datafy/datafy. Or the year, month, day, and other fields of a timestamp. Understand when peering through your data: browsing the claims of a JWT token, Instead, this light abstraction on top ofĭatafy makes it easy to plug in new "types" that increases insight and That would require upfront processing of data to inspect, and would interfere While this would be possible through procotol extension by Multi-method allows Gadget to differentiate values based on the synthetic typeĭescribe above. re/datafy is a multimethod that converts a value to data. Gadget provides a function for converting values to browsable data and navigate Use that and stop calling inference functions. As soon as it finds a non-nil result, it will
When Gadget is identifying the type of some data, it will call these functions That it does not recognize the type of the data. Should return either a keyword indicating the type of data, or nil to indicate The type inference function is passed a single argument - a piece of data.