Custom field with a list

How do I make and interact with a custom field with a list of strings from a plugin?

I was thinking it will be something similar to the below code but I can’t find the correct way to do this.

   # array of strings
   Topic.register_custom_field_type('my_list', [:string])
    add_to_serializer(:topic, :my_list, false) {object.topic.my_list}

    DiscourseEvent.on(:topic_created) do |topic|
        topic.custom_fields["my_list"] = ["item1", "item2"] 
        topic.custom_fields["my_list"] = topic.custom_fields["my_list"].push("item3")