diff --git a/packages/backend/src/core/chart/core.ts b/packages/backend/src/core/chart/core.ts index 8d0a89f2d6ae..4660c66b6e6e 100644 --- a/packages/backend/src/core/chart/core.ts +++ b/packages/backend/src/core/chart/core.ts @@ -94,6 +94,29 @@ type ToJsonSchema = { }; export function getJsonSchema(schema: S): ToJsonSchema>> { + const unflatten = (str: string, parent: Record) => { + const keys = str.split('.'); + const key = keys.shift(); + const nextKey = keys[0]; + + if (!key) return; + + if (!parent.properties[key]) { + parent.properties[key] = nextKey ? { + type: 'object', + properties: {}, + required: [], + } : { + type: 'array', + items: { + type: 'number', + }, + }; + } + + if (nextKey) unflatten(keys.join('.'), parent.properties[key] as Record); + }; + const jsonSchema = { type: 'object', properties: {} as Record, @@ -101,10 +124,7 @@ export function getJsonSchema(schema: S): ToJsonSchema>>; diff --git a/packages/misskey-js/src/autogen/apiClientJSDoc.ts b/packages/misskey-js/src/autogen/apiClientJSDoc.ts index 05d9077be265..2e0a9e8b503b 100644 --- a/packages/misskey-js/src/autogen/apiClientJSDoc.ts +++ b/packages/misskey-js/src/autogen/apiClientJSDoc.ts @@ -1,6 +1,6 @@ /* * version: 2023.12.2 - * generatedAt: 2024-01-03T14:50:11.647Z + * generatedAt: 2024-01-05T17:21:28.094Z */ import type { SwitchCaseResponseType } from '../api.js'; diff --git a/packages/misskey-js/src/autogen/endpoint.ts b/packages/misskey-js/src/autogen/endpoint.ts index 18fddd949c6f..cdc104fe84d9 100644 --- a/packages/misskey-js/src/autogen/endpoint.ts +++ b/packages/misskey-js/src/autogen/endpoint.ts @@ -1,6 +1,6 @@ /* * version: 2023.12.2 - * generatedAt: 2024-01-03T14:50:11.643Z + * generatedAt: 2024-01-05T17:21:28.090Z */ import type { diff --git a/packages/misskey-js/src/autogen/entities.ts b/packages/misskey-js/src/autogen/entities.ts index 2ec2ab291bef..39aea942d41e 100644 --- a/packages/misskey-js/src/autogen/entities.ts +++ b/packages/misskey-js/src/autogen/entities.ts @@ -1,6 +1,6 @@ /* * version: 2023.12.2 - * generatedAt: 2024-01-03T14:50:11.639Z + * generatedAt: 2024-01-05T17:21:28.088Z */ import { operations } from './types.js'; diff --git a/packages/misskey-js/src/autogen/models.ts b/packages/misskey-js/src/autogen/models.ts index a50f63b7c41f..3880b3823e3f 100644 --- a/packages/misskey-js/src/autogen/models.ts +++ b/packages/misskey-js/src/autogen/models.ts @@ -1,6 +1,6 @@ /* * version: 2023.12.2 - * generatedAt: 2024-01-03T14:50:11.637Z + * generatedAt: 2024-01-05T17:21:28.087Z */ import { components } from './types.js'; diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index f00a0df4b49f..744d2a4472bd 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -3,7 +3,7 @@ /* * version: 2023.12.2 - * generatedAt: 2024-01-03T14:50:11.515Z + * generatedAt: 2024-01-05T17:21:27.961Z */ /** @@ -10877,14 +10877,18 @@ export type operations = { 200: { content: { 'application/json': { - 'local.incCount': number[]; - 'local.incSize': number[]; - 'local.decCount': number[]; - 'local.decSize': number[]; - 'remote.incCount': number[]; - 'remote.incSize': number[]; - 'remote.decCount': number[]; - 'remote.decSize': number[]; + local: { + incCount: number[]; + incSize: number[]; + decCount: number[]; + decSize: number[]; + }; + remote: { + incCount: number[]; + incSize: number[]; + decCount: number[]; + decSize: number[]; + }; }; }; }; @@ -11012,30 +11016,44 @@ export type operations = { 200: { content: { 'application/json': { - 'requests.failed': number[]; - 'requests.succeeded': number[]; - 'requests.received': number[]; - 'notes.total': number[]; - 'notes.inc': number[]; - 'notes.dec': number[]; - 'notes.diffs.normal': number[]; - 'notes.diffs.reply': number[]; - 'notes.diffs.renote': number[]; - 'notes.diffs.withFile': number[]; - 'users.total': number[]; - 'users.inc': number[]; - 'users.dec': number[]; - 'following.total': number[]; - 'following.inc': number[]; - 'following.dec': number[]; - 'followers.total': number[]; - 'followers.inc': number[]; - 'followers.dec': number[]; - 'drive.totalFiles': number[]; - 'drive.incFiles': number[]; - 'drive.decFiles': number[]; - 'drive.incUsage': number[]; - 'drive.decUsage': number[]; + requests: { + failed: number[]; + succeeded: number[]; + received: number[]; + }; + notes: { + total: number[]; + inc: number[]; + dec: number[]; + diffs: { + normal: number[]; + reply: number[]; + renote: number[]; + withFile: number[]; + }; + }; + users: { + total: number[]; + inc: number[]; + dec: number[]; + }; + following: { + total: number[]; + inc: number[]; + dec: number[]; + }; + followers: { + total: number[]; + inc: number[]; + dec: number[]; + }; + drive: { + totalFiles: number[]; + incFiles: number[]; + decFiles: number[]; + incUsage: number[]; + decUsage: number[]; + }; }; }; }; @@ -11095,20 +11113,28 @@ export type operations = { 200: { content: { 'application/json': { - 'local.total': number[]; - 'local.inc': number[]; - 'local.dec': number[]; - 'local.diffs.normal': number[]; - 'local.diffs.reply': number[]; - 'local.diffs.renote': number[]; - 'local.diffs.withFile': number[]; - 'remote.total': number[]; - 'remote.inc': number[]; - 'remote.dec': number[]; - 'remote.diffs.normal': number[]; - 'remote.diffs.reply': number[]; - 'remote.diffs.renote': number[]; - 'remote.diffs.withFile': number[]; + local: { + total: number[]; + inc: number[]; + dec: number[]; + diffs: { + normal: number[]; + reply: number[]; + renote: number[]; + withFile: number[]; + }; + }; + remote: { + total: number[]; + inc: number[]; + dec: number[]; + diffs: { + normal: number[]; + reply: number[]; + renote: number[]; + withFile: number[]; + }; + }; }; }; }; @@ -11237,18 +11263,30 @@ export type operations = { 200: { content: { 'application/json': { - 'local.followings.total': number[]; - 'local.followings.inc': number[]; - 'local.followings.dec': number[]; - 'local.followers.total': number[]; - 'local.followers.inc': number[]; - 'local.followers.dec': number[]; - 'remote.followings.total': number[]; - 'remote.followings.inc': number[]; - 'remote.followings.dec': number[]; - 'remote.followers.total': number[]; - 'remote.followers.inc': number[]; - 'remote.followers.dec': number[]; + local: { + followings: { + total: number[]; + inc: number[]; + dec: number[]; + }; + followers: { + total: number[]; + inc: number[]; + dec: number[]; + }; + }; + remote: { + followings: { + total: number[]; + inc: number[]; + dec: number[]; + }; + followers: { + total: number[]; + inc: number[]; + dec: number[]; + }; + }; }; }; }; @@ -11313,10 +11351,12 @@ export type operations = { total: number[]; inc: number[]; dec: number[]; - 'diffs.normal': number[]; - 'diffs.reply': number[]; - 'diffs.renote': number[]; - 'diffs.withFile': number[]; + diffs: { + normal: number[]; + reply: number[]; + renote: number[]; + withFile: number[]; + }; }; }; }; @@ -11378,10 +11418,14 @@ export type operations = { 200: { content: { 'application/json': { - 'upv.user': number[]; - 'pv.user': number[]; - 'upv.visitor': number[]; - 'pv.visitor': number[]; + upv: { + user: number[]; + visitor: number[]; + }; + pv: { + user: number[]; + visitor: number[]; + }; }; }; }; @@ -11443,8 +11487,12 @@ export type operations = { 200: { content: { 'application/json': { - 'local.count': number[]; - 'remote.count': number[]; + local: { + count: number[]; + }; + remote: { + count: number[]; + }; }; }; }; @@ -11504,12 +11552,16 @@ export type operations = { 200: { content: { 'application/json': { - 'local.total': number[]; - 'local.inc': number[]; - 'local.dec': number[]; - 'remote.total': number[]; - 'remote.inc': number[]; - 'remote.dec': number[]; + local: { + total: number[]; + inc: number[]; + dec: number[]; + }; + remote: { + total: number[]; + inc: number[]; + dec: number[]; + }; }; }; };