# How to configure array objects in a plugin? Using json\_schema with type: objects?

**URL:** https://meta.discourse.org/t/json-schema-type-objects/405376
**Category:** Development
**Created:** [June 16, 2026, 4:03am UTC](https://meta.discourse.org/t/json-schema-type-objects/405376 "2026-06-16T04:03:39Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![singi2016cn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/singi2016cn/32/532755_2.png) [@singi2016cn](https://meta.discourse.org/u/singi2016cn)
#### Post date: [June 16, 2026, 4:03am UTC](https://meta.discourse.org/t/json-schema-type-objects/405376/1 "2026-06-16T04:03:39Z")

</div>

How do I configure array objects in a plugin? I tried using `json_schema`, but object property configuration doesn’t support selectors like `category`; only text input is possible. Meanwhile, `type: objects` simply doesn’t work in plugin configurations at all.

Configuration for `json_schema`:

```yaml
  quectel_online_customer_category_customers:
    default: "[]"
    client: true
    json_schema: QuectelOnlineCustomer::SiteSettings::CategoryCustomersJsonSchema

```

plugins/quectel-online-customer/lib/quectel\_online\_customer/site\_settings/category\_customers\_json\_schema.rb

```glimmer-javascript
# frozen_string_literal: true

module QuectelOnlineCustomer
  module SiteSettings
    class CategoryCustomersJsonSchema
      def self.schema
        @schema ||= begin
          {
            type: "array",
            uniqueItems: true,
            default: [],
            items: {
              type: "object",
              title: "Category Customer Configuration",
              additionalProperties: false, # Prevent submission of undefined fields
              required: %w[category customers], # Both fields are required
              properties: {
                category: {
                  type: "category",
                  description: "The forum category to bind",
                  label: "Category"
                },
                customers: {
                  type: "usernames", # Multi-select users, replacing single username
                  description: "Customer accounts assigned to this category, supports multi-selection",
                  label: "Customer Users"
                }
              }
            }
          }
        end
      end
    end
  end
end

```

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [June 22, 2026, 10:10pm UTC](https://meta.discourse.org/t/json-schema-type-objects/405376/2 "2026-06-22T22:10:26Z")

</div>

`type:objects` should work in plugins! we use it ourselves here for example

[https://github.com/discourse/discourse/blob/eba9a3b69cf637fccba1a00978f2269b4fccf9d4/plugins/discourse-openid-connect/config/settings.yml#L59-L71](https://github.com/discourse/discourse/blob/eba9a3b69cf637fccba1a00978f2269b4fccf9d4/plugins/discourse-openid-connect/config/settings.yml#L59-L71)

---

<div class="post-metadata">

### Author: ![singi2016cn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/singi2016cn/32/532755_2.png) [@singi2016cn](https://meta.discourse.org/u/singi2016cn)
#### Post date: [June 23, 2026, 1:25am UTC](https://meta.discourse.org/t/json-schema-type-objects/405376/3 "2026-06-23T01:25:35Z")

</div>

Yes, that is indeed possible. However, `type:objects` does not support `type:category` either. My requirement is to select both categories and groups.

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [June 23, 2026, 1:16pm UTC](https://meta.discourse.org/t/json-schema-type-objects/405376/4 "2026-06-23T13:16:15Z")

</div>

Oh I see, so the object settings are added directly to your `settings.yml` you’d want to format it like this:

```yml
oauth2_category_example:
    type: objects
    default: []
    area: "oauth2"
    schema:
      name: category_rule
      identifier: name
      properties:
        name:
          type: string
          required: true
          label: Rule name
          description: A label for this rule
        category:
          type: categories
          required: true
          label: Category
          description: The category this rule applies to
          validations:
            max: 1
        groups:
          type: groups
          label: Groups
          description: Groups associated with this category

```

Which would produce a category dropdown like this

 ![image](https://global.discourse-cdn.com/meta/original/4X/8/c/e/8ce516a659c22ea7dbc954183b8dc6cb2adaeef6.png)

---

<div class="post-metadata">

### Author: ![singi2016cn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/singi2016cn/32/532755_2.png) [@singi2016cn](https://meta.discourse.org/u/singi2016cn)
#### Post date: [June 24, 2026, 2:40am UTC](https://meta.discourse.org/t/json-schema-type-objects/405376/5 "2026-06-24T02:40:55Z")

</div>

Doesn’t `type:category` support single selection?

---

<div class="post-metadata">

### Author: ![singi2016cn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/singi2016cn/32/532755_2.png) [@singi2016cn](https://meta.discourse.org/u/singi2016cn)
#### Post date: [June 24, 2026, 2:48am UTC](https://meta.discourse.org/t/json-schema-type-objects/405376/6 "2026-06-24T02:48:57Z")

</div>

![image](https://global.discourse-cdn.com/meta/original/4X/9/7/a/97ad89f567feece63c4eecd5883d68a3f64bbf83.png)

According to this configuration

```yaml
quectel_online_customer_category_customer_group:
    type: objects
    default: []
    schema:
      name: "Category Customer Group"
      identifier: name
      properties:
        name:
          type: string
          required: true
          label: Name
          description: Name
        category:
          type: categories
          required: true
          label: "Category"
          description: "Category name. Please view it on the <a href=\"/categories\" target=\"_blank\">All Categories</a> page"
        group_name:
          type: groups
          required: true
          label: "Customer Service Group Name"
          description: "Customer service group name (English characters). Please view it on the <a href=\"/admin/groups\" target=\"_blank\">Customer Service Groups</a> page"

```

I encountered the following error:

```javascript
Error occurred:

- While rendering:
  {{outlet}} for -top-level
    -top-level
      {{outlet}} for application
        application
          DiscourseRoot
            {{outlet}} for admin
              admin
                {{outlet}} for admin.schema
                  schema
                    SchemaSettingNewEditor
                      SchemaSettingField
                        SchemaSettingTypeCategories
                          CategorySelector

section-link.gjs:149
 Attempted to rerender, but the Ember application has had an unrecoverable error occur during render. You should reload the application after fixing the cause of the error.
categories.gjs:13
 Uncaught (in promise) TypeError: this.args.value?.map is not a function
    at SchemaSettingTypeCategories.<anonymous> (categories.gjs:13:9)

```

Is this related to my version?

Discourse v2026.1.4 — [Commits · discourse/discourse · GitHub](https://github.com/discourse/discourse/commits/f9f6863056) — Ember v6.6.0

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [June 24, 2026, 4:15pm UTC](https://meta.discourse.org/t/json-schema-type-objects/405376/7 "2026-06-24T16:15:19Z")

</div>

do you have any stale configuration saved to the setting? could you try resetting it to the default with the reset button if it appears?

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/9/d/c9d3c1ac55b2d188e852e8060124551b56c13ce1.png)

---

<div class="post-metadata">

### Author: ![singi2016cn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/singi2016cn/32/532755_2.png) [@singi2016cn](https://meta.discourse.org/u/singi2016cn)
#### Post date: [June 25, 2026, 2:10am UTC](https://meta.discourse.org/t/json-schema-type-objects/405376/8 "2026-06-25T02:10:32Z")

</div>

I don’t see a reset button. The page looks exactly like the screenshot, and the items under the category aren’t rendering.

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [June 25, 2026, 7:24pm UTC](https://meta.discourse.org/t/json-schema-type-objects/405376/9 "2026-06-25T19:24:07Z")

</div>

Hmmm I’m not sure what would be going wrong there… I’ve tested the categories option with the objects type so I know it works, and it shouldn’t be an issue with your version. I still wonder if something is stuck in a bad state somewhere, can you try a separate setting with a new name just to test it out? is this on github or anywhere so I can try it?

---

<div class="post-metadata">

### Author: ![singi2016cn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/singi2016cn/32/532755_2.png) [@singi2016cn](https://meta.discourse.org/u/singi2016cn)
#### Post date: [June 26, 2026, 1:41am UTC](https://meta.discourse.org/t/json-schema-type-objects/405376/10 "2026-06-26T01:41:59Z")

</div>

`type:categories` is acceptable, but `type:category` is not.

However, the configuration below works well even when only a single selection is made, so `type:category` is no longer needed.

```plaintext
category:
  type: categories
  required: true
  label: "Category"
  description: "Category name"
  validations:
	max: 1

```

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [June 28, 2026, 1:42am UTC](https://meta.discourse.org/t/json-schema-type-objects/405376/11 "2026-06-28T01:42:22Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
