MCPcopy
hub / github.com/ory/kratos / UpdateNodeValuesFromJSON

Method UpdateNodeValuesFromJSON

ui/container/container.go:299–311  ·  view source on GitHub ↗

UpdateNodeValuesFromJSON sets the container's fields to the provided values.

(raw json.RawMessage, prefix string, group node.UiNodeGroup)

Source from the content-addressed store, hash-verified

297
298// UpdateNodeValuesFromJSON sets the container's fields to the provided values.
299func (c *Container) UpdateNodeValuesFromJSON(raw json.RawMessage, prefix string, group node.UiNodeGroup) {
300 for k, v := range jsonx.Flatten(raw) {
301 k = addPrefix(k, prefix, ".")
302
303 if n := c.Nodes.Find(k); n != nil {
304 n.Attributes.SetValue(v)
305 n.Group = group
306 continue
307 }
308
309 c.Nodes.Upsert(node.NewInputFieldFromJSON(k, v, group))
310 }
311}
312
313// Unset removes a field from the container.
314func (c *Container) UnsetNode(id string) {

Callers 10

returnToProfileFormMethod · 0.80
hydrateFormMethod · 0.80
HandleErrorMethod · 0.80
NewFromHTTPRequestFunction · 0.80
NewFromJSONFunction · 0.80
NewFromStructFunction · 0.80
TestNodesSortFunction · 0.80

Calls 5

NewInputFieldFromJSONFunction · 0.92
addPrefixFunction · 0.85
UpsertMethod · 0.80
SetValueMethod · 0.65
FindMethod · 0.45

Tested by 1

TestNodesSortFunction · 0.64