/
githubmirror
/
strapi
Обзор
Документация
Войти
/
githubmirror
/
strapi
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/plugins/documentation/server/src/services/helpers/utils/get-schema-data.ts
37 строк
932 B
Nico André
fix(documentation): align with Data.ID (#24976)
12 янв 2026, 12:10
Не верифицирован
12 янв 2026, 12:10
495fae4
Код
Авторство
О чём код?
import type { OpenAPIV3 } from 'openapi-types'; /** * @description Determines the format of the data response * * @param {boolean} isListOfEntities - Checks for a multiple entities * @param {object} attributes - The attributes found on a contentType * @returns object | array of attributes */ export default ( isListOfEntities: boolean, attributes: Record<string, OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject> ): OpenAPIV3.SchemaObject => { if (isListOfEntities) { return { type: 'array', items: { type: 'object', properties: { id: { oneOf: [{ type: 'string' }, { type: 'number' }] }, documentId: { type: 'string' }, ...attributes, }, }, }; } return { type: 'object', properties: { id: { oneOf: [{ type: 'string' }, { type: 'number' }] }, documentId: { type: 'string' }, ...attributes, }, }; };