- JSON 레이아웃: ARRAY 타입 스칼라/객체 배열 처리 로직 추가
eapim-admin CI / build (push) Has been cancelled

- JS: 배열 내부 객체(children) 및 타입(Render, Save) 동기화 로직 개선
- 스칼라 배열 예제 추가 및 Swagger 타입 매핑 로직 구현
This commit is contained in:
Rinjae
2026-07-23 19:13:16 +09:00
parent cd93e34840
commit 59dd28c23b
2 changed files with 86 additions and 6 deletions
+14 -6
View File
@@ -248,9 +248,11 @@
if (row.description && row.description.value) obj.properties[name].description = row.description.value;
if (row.name && row.name.locked) obj.properties[name]['x-djb-gw'] = true;
} else if (row.type.value === 'array') {
const itemType = (row.itemsType && row.itemsType.value) || 'string';
obj.properties[name] = {
type: 'array',
items: { type: (row.itemsType && row.itemsType.value) || 'string' }
// array<object>(GW GRID): 자식 행을 items.properties 로 직렬화. (누락 시 저장 왕복에서 자식 유실)
items: itemType === 'object' ? schemaArrayToObject(row.children || []) : { type: itemType }
};
if (row.description && row.description.value) obj.properties[name].description = row.description.value;
if (row.name && row.name.locked) obj.properties[name]['x-djb-gw'] = true;
@@ -672,6 +674,7 @@
const isLocked = row.name.locked;
const isObject = row.type.value === 'object';
const isArray = row.type.value === 'array';
const isArrayOfObject = isArray && (row.itemsType && row.itemsType.value) === 'object';
const expandedKey = `${path}.__expanded`;
const isExpanded = state[expandedKey] !== false;
@@ -681,7 +684,7 @@
<td class="py-2 px-2 text-center">${isLocked ? '<span class="text-slate-400 text-xs" title="게이트웨이 동기화">🔒</span>' : ''}</td>
<td class="py-2 px-2">
<div class="flex items-center gap-1" style="padding-left:${depth * 18}px;">
${isObject || isArray
${isObject || isArrayOfObject
? `<button data-toggle-expand="${path}" class="w-4 h-4 text-slate-400 hover:text-slate-700">${isExpanded ? '▾' : '▸'}</button>`
: `<span class="w-4 inline-block"></span>`}
<span class="text-xs text-slate-400 mr-1">${isObject ? '{}' : isArray ? '[]' : '·'}</span>
@@ -712,7 +715,7 @@
isArray
? `<div class="flex gap-1 items-center">
<span class="text-xs text-slate-400">items:</span>
${selectInput((row.itemsType && row.itemsType.value) || 'string', ['string', 'integer', 'number', 'boolean'], `data-path="${path}.itemsType.value"`, { extra: 'text-xs' })}
${selectInput((row.itemsType && row.itemsType.value) || 'string', ['string', 'integer', 'number', 'boolean', 'object'], `data-path="${path}.itemsType.value" data-rerender="step3"`, { extra: 'text-xs' })}
</div>`
: input(row.example.value, `data-path="${path}.example.value"`, { placeholder: '예제값' })}
</td>
@@ -724,8 +727,8 @@
</tr>
`;
// children
if (isObject && isExpanded) {
// children (object + array<object>(GRID) 공통)
if ((isObject || isArrayOfObject) && isExpanded) {
if (row.children && row.children.length) {
html += renderSchemaRows(row.children, `${path}.children`, depth + 1, seq);
}
@@ -1683,7 +1686,12 @@
example: wrap(p.example == null ? '' : p.example), children: null
};
if (t === 'object') row.children = schemaToRows(p);
else if (t === 'array') row.itemsType = wrap((p.items && p.items.type) || 'string');
else if (t === 'array') {
var itemType = (p.items && p.items.type) || 'string';
row.itemsType = wrap(itemType);
// array<object>(GW GRID): items.properties 를 자식 행으로 복원. (누락 시 자식 필드 유실)
if (itemType === 'object') row.children = schemaToRows(p.items);
}
return row;
}
function schemaToRows(schema) {