Renaming Fields
Rename a field using schemafy.
If you are aware of the specific field you'd like to rename, "schemafy" offers an interesting and easy way by asking for it in the function as a Box<str> type.
However, more generally, you can always ask for the target (and schema) objects, where you have the full capabilities of Stof at your disposal. This enables you to create additional fields, drop fields, rename fields, search for fields, etc.
It is easier to read, understand, maintain, and use schemas if you always define the desired fields instead of the undesired fields (unlike in the example above). This is more of a preference and might lead to more code in cases, but it's more predictable.
This code example uses the "search" functionality in the Object Library to create a field in a specific location if it does not already exist with the name we are expecting.
Last updated
Was this helpful?