Skip to content

Remove/unset property of Node #295

@koenpunt

Description

@koenpunt

Is it possible to remove/unset a property of a Yams.Node object?

I'm able to add or replace properties quite easily;

var data = try Yams.compose(yaml: yamlString)
data["SomeAdditionalProp"] = Yams.Node(displayName)
data["SomeAdditionalProp2"] = "String"

But I couldn't figure out a way to remove a property. Is this possible?

As a workaround I convert the node to Any, cast that to a dictionary, filter it, and convert it to a node again, but this isn't very efficient..

Edit: I must say, in my case I'm actually trying to rename a property, which I would be able to achieve by assigning a new property, and removing the old. If however there's a way of renaming a property directly, that –of course– would work as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions