プラグイン内で配列オブジェクトをどのように設定すればよいでしょうか。json_schema を試してみましたが、オブジェクトのプロパティ設定では category のようなセレクターは使用できず、テキスト入力のみ可能です。また、type: objects はプラグイン設定では全く機能しません。
json_schema の設定
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
# frozen_string_literal: true
module QuectelOnlineCustomer
module SiteSettings
class CategoryCustomersJsonSchema
def self.schema
@schema ||= begin
{
type: "array",
uniqueItems: true,
default: [],
items: {
type: "object",
title: "カテゴリカスタマー設定",
additionalProperties: false, # 未定義フィールドの送信を禁止
required: %w[category customers], # 2 つのフィールドが必須
properties: {
category: {
type: "category",
description: "紐付けるフォーラムカテゴリ",
label: "カテゴリ"
},
customers: {
type: "usernames", # 単一ユーザー名 username の代わりに複数ユーザー選択
description: "このカテゴリに割り当てるカスタマーアカウント。複数選択可能",
label: "カスタマーユーザー"
}
}
}
}
end
end
end
end
end