플러그인에서 배열 객체를 어떻게 구성합니까? 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
type:objects는 플러그인에서 작동해야 합니다! 저희도 여기서 실제로 사용하고 있습니다.
네, 실제로 가능합니다. 하지만 type:objects 안에서는 type:category도 지원하지 않습니다. 제 요구사항은 카테고리 및 그룹을 선택하는 것입니다.
아, 그렇군요. 그래서 객체 설정이 직접 settings.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
이렇게 하면 다음과 같은 카테고리 드롭다운이 생성됩니다.
type:category 단일 선택을 지원하지 않나요?
이 설정을 따라 진행했습니다.
quectel_online_customer_category_customer_group:
type: objects
default: []
schema:
name: "类别客服分组"
identifier: name
properties:
name:
type: string
required: true
label: 名称
description: 名称
category:
type: categories
required: true
label: "类别"
description: "类别名称,请在 <a href=\"/categories\" target=\"_blank\">所有类别</a> 页面查看"
group_name:
type: groups
required: true
label: "客服分组名称"
description: "客服分组名称,英文字符,请在 <a href=\"/admin/groups\" target=\"_blank\">客服分组</a> 页面查看"
아래와 같은 오류가 발생했습니다:
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)
이것이 제 버전과 관련이 있을까요?
Discourse v2026.1.4 — Commits · discourse/discourse · GitHub — Ember v6.6.0
설정 파일에 오래된 설정이 저장되어 있나요? 리셋 버튼이 보인다면 기본값으로 초기화해 보실 수 있을까요?
초기화 버튼을 찾을 수 없으며, 페이지는 스크린샷과 동일한 상태입니다. 카테고리 아래에 있는 항목이 렌더링되지 않습니다.
음, 거기서 무슨 일이 일어나고 있는지 정확히 모르겠네요… categories 옵션을 objects 타입으로 테스트해 봤기 때문에 작동한다는 걸 알고 있고, 사용 중인 버전에서 문제가 발생하지는 않아야 합니다. 어딘가에 잘못된 상태에 갇겨 있는 건 아닌지 여전히 의문이 듭니다. 테스트를 위해 새 이름으로 별도의 설정을 만들어 볼 수 있을까요? GitHub나 다른 곳에 공유된 건지 확인해서 제가 직접 테스트해 볼 수 있을까요?
type:categories는 사용할 수 있지만, type:category는 사용할 수 없습니다.
하지만 아래 설정은 하나만 선택하는 경우에도 잘 작동하므로, type:category는 더 이상 필요하지 않습니다.
category:
type: categories
required: true
label: "카테고리"
description: "카테고리 이름"
validations:
max: 1