public static JsonNode GetPropertyNode()

in src/Azure.Deployments.Extensibility.Core/V2/Json/JsonNodeExtensions.cs [27:61]


        public static JsonNode GetPropertyNode(this JsonNode? node, JsonPointerProxy propertyPath) =>
            GetPropertyNode(node, propertyPath.ToJsonPointer());

        public static JsonNode GetPropertyNode(this JsonNode? node, JsonPointer propertyPath) =>
            TryGetPropertyNode(node, propertyPath) ?? throw new InvalidOperationException($"Property {propertyPath} not found.");

        public static T? TryGetPropertyValue<T>(this JsonNode? node, JsonPointerProxy propertyPath) =>
            TryGetPropertyValue<T>(node, propertyPath.ToJsonPointer());

        public static T? TryGetPropertyValue<T>(this JsonNode? node, JsonPointer propertyPath) =>
            TryGetPropertyNode(node, propertyPath) is JsonNode propertyNode ? propertyNode.GetValue<T>() : default;

        public static T GetPropertyValue<T>(this JsonNode? node, JsonPointerProxy propertyPath) =>
            GetPropertyValue<T>(node, propertyPath.ToJsonPointer());

        public static T GetPropertyValue<T>(this JsonNode? node, JsonPointer propertyPath) =>
            TryGetPropertyValue<T>(node, propertyPath) ?? throw new InvalidOperationException($"Property {propertyPath} not found.");

        public static JsonNode WithPropertyValue(this JsonNode? node, JsonPointerProxy propertyPath, JsonNode propertyValue) =>
            WithPropertyValue(node, propertyPath.ToJsonPointer(), propertyValue);

        public static JsonNode WithPropertyValue(this JsonNode? node, JsonPointer propertyPath, JsonNode propertyValue)
        {
            ArgumentNullException.ThrowIfNull(node, nameof(node));

            if (propertyPath.Count == 0)
            {
                throw new ArgumentException("Argument cannot be empty.", nameof(propertyPath));
            }

            var patch = new JsonPatch(PatchOperation.Add(propertyPath, propertyValue));
            var patchResult = patch.Apply(node);

            return patchResult.Result ?? throw new InvalidOperationException(patchResult.Error);
        }