Skip to content

Saving Boolean Metadata keyvalue results in string value #258

@osseonews

Description

@osseonews

Describe the bug

When you create a metadata key value in the admin dashboard where the value is Boolean, e.g. can_ship=true, the resulting key/value is treated as a string where true is "true" not Boolean (checkbox in the UI). This is different than when you create a boolean key/value via the API, where the boolean value becomes a real boolean and the UI shows a checkbox.

Solution would be: When you create a boolean key/value in the dashboard, where the value is either marked as true/false, the backend code should properly save these as boolean, and not strings. I haven't looked at the code yet where the key/value is stored, but probably you just need to check for true/false from the form and then save those as true booleans, as opposed to strings.

To Reproduce

Log into the dashboard, and create the metadata key/value in the dashboard itself with "true" or "false" as the values for the key. The boolean values become string and the UI shows a string as an edit. Conversely create the metadata key/value via the API and use "true" or "false" as the values and you will get a proper key/value with boolean and a checkmark in the UI.

System

Any dashboard app key/value

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions