كيف يمكنني تكوين كائنات المصفوفة في الإضافة؟ لقد جربت 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], # كلا الحقلين إلزاميان
properties: {
category: {
type: "category",
description: "فئة المنتدى المرتبطة",
label: "الفئة"
},
customers: {
type: "usernames", # مستخدمون متعددون كبديل لاسم المستخدم الواحد username
description: "حسابات خدمة العملاء المخصصة لهذه الفئة، تدعم الاختيار المتعدد",
label: "مستخدمو خدمة العملاء"
}
}
}
}
end
end
end
end
end