MCPcopy Create free account
hub / github.com/arktypeio/arktype / writeInnerJson

Function writeInnerJson

ark/schema/node.ts:2232–2243  ·  view source on GitHub ↗
(node: BaseNode)

Source from the content-addressed store, hash-verified

2230 )(node, node.$.cfg, ...Object.values(rootApplyRuntimeOf(node.$.cfg)))
2231
2232export const writeInnerJson = (node: BaseNode): JsonObject => {
2233 const json: JsonObject = {}
2234 for (const k in node.inner) {
2235 const keyImpl = node.impl.keys[k]
2236 if (keyImpl.unserialized) continue
2237 const serialize =
2238 keyImpl.serialize ??
2239 (keyImpl.child ? serializeListableChild : defaultValueSerializer)
2240 json[k] = serialize((node.inner as Dict)[k] as never)
2241 }
2242 return (node.impl.fixJson?.(json) as JsonObject | undefined) ?? json
2243}
2244
2245const serializeListableChild = (listableNode: listable<BaseNode>) =>
2246 isArray(listableNode) ?

Callers 2

constructorMethod · 0.90
fullJsonFunction · 0.85

Calls 1

serializeFunction · 0.70

Tested by

no test coverage detected