revert misskey-js related changes (#14414)

This commit is contained in:
anatawa12 2024-08-16 20:59:25 +09:00 committed by GitHub
parent a18bf4bf18
commit daeab84905
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 593 additions and 566 deletions

View File

@ -67,7 +67,7 @@
"@typescript-eslint/parser": "7.17.0", "@typescript-eslint/parser": "7.17.0",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"cypress": "13.13.1", "cypress": "13.13.1",
"eslint": "9.9.0", "eslint": "9.8.0",
"globals": "15.8.0", "globals": "15.8.0",
"ncp": "2.0.0", "ncp": "2.0.0",
"start-server-and-test": "2.0.4" "start-server-and-test": "2.0.4"

View File

@ -92,6 +92,7 @@ export function genOpenapiSpec(config: Config, includeSelfRef = false) {
const hasBody = (schema.type === 'object' && schema.properties && Object.keys(schema.properties).length >= 1); const hasBody = (schema.type === 'object' && schema.properties && Object.keys(schema.properties).length >= 1);
const info = { const info = {
operationId: endpoint.name.replaceAll('/', '___'), // NOTE: スラッシュは使えない
summary: endpoint.name, summary: endpoint.name,
description: desc, description: desc,
externalDocs: { externalDocs: {
@ -209,15 +210,9 @@ export function genOpenapiSpec(config: Config, includeSelfRef = false) {
spec.paths['/' + endpoint.name] = { spec.paths['/' + endpoint.name] = {
...(endpoint.meta.allowGet ? { ...(endpoint.meta.allowGet ? {
get: { get: info,
...info,
operationId: 'get_____' + endpoint.name.replaceAll('/', '___'), // NOTE: スラッシュは使えない
},
} : {}), } : {}),
post: { post: info,
...info,
operationId: 'post_____' + endpoint.name.replaceAll('/', '___'), // NOTE: スラッシュは使えない
},
}; };
} }

View File

@ -7,15 +7,15 @@
"generate": "tsx src/generator.ts && eslint ./built/**/*.ts --fix" "generate": "tsx src/generator.ts && eslint ./built/**/*.ts --fix"
}, },
"devDependencies": { "devDependencies": {
"@readme/openapi-parser": "2.6.0", "@readme/openapi-parser": "2.5.0",
"@types/node": "22.3.0", "@types/node": "20.9.1",
"@typescript-eslint/eslint-plugin": "8.1.0", "@typescript-eslint/eslint-plugin": "6.11.0",
"@typescript-eslint/parser": "8.1.0", "@typescript-eslint/parser": "6.11.0",
"openapi-types": "12.1.3", "openapi-types": "12.1.3",
"openapi-typescript": "7.3.0", "openapi-typescript": "6.7.3",
"ts-case-convert": "2.0.7", "ts-case-convert": "2.0.2",
"tsx": "4.17.0", "tsx": "4.4.0",
"typescript": "5.5.4" "typescript": "5.3.3"
}, },
"files": [ "files": [
"built" "built"

View File

@ -1,4 +1,4 @@
import { mkdir, writeFile, readFile } from 'fs/promises'; import { mkdir, writeFile } from 'fs/promises';
import { OpenAPIV3_1 } from 'openapi-types'; import { OpenAPIV3_1 } from 'openapi-types';
import { toPascal } from 'ts-case-convert'; import { toPascal } from 'ts-case-convert';
import OpenAPIParser from '@readme/openapi-parser'; import OpenAPIParser from '@readme/openapi-parser';
@ -20,9 +20,7 @@ async function generateBaseTypes(
} }
lines.push(''); lines.push('');
const json = await readFile(openApiJsonPath, 'utf-8'); const generatedTypes = await openapiTS(openApiJsonPath, {
const generatedTypes = await openapiTS(json, {
exportType: true, exportType: true,
transform(schemaObject) { transform(schemaObject) {
if ('format' in schemaObject && schemaObject.format === 'binary') { if ('format' in schemaObject && schemaObject.format === 'binary') {

View File

@ -35,19 +35,19 @@
"directory": "packages/misskey-js" "directory": "packages/misskey-js"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/api-extractor": "7.47.6", "@microsoft/api-extractor": "7.47.4",
"@swc/jest": "0.2.36", "@swc/jest": "0.2.36",
"@types/jest": "29.5.12", "@types/jest": "29.5.12",
"@types/node": "22.3.0", "@types/node": "20.14.12",
"@typescript-eslint/eslint-plugin": "8.1.0", "@typescript-eslint/eslint-plugin": "7.17.0",
"@typescript-eslint/parser": "8.1.0", "@typescript-eslint/parser": "7.17.0",
"jest": "29.7.0", "jest": "29.7.0",
"jest-fetch-mock": "3.0.3", "jest-fetch-mock": "3.0.3",
"jest-websocket-mock": "2.5.0", "jest-websocket-mock": "2.5.0",
"mock-socket": "9.3.1", "mock-socket": "9.3.1",
"ncp": "2.0.0", "ncp": "2.0.0",
"nodemon": "3.1.4", "nodemon": "3.1.4",
"execa": "9.3.1", "execa": "9.3.0",
"tsd": "0.31.1", "tsd": "0.31.1",
"typescript": "5.5.4", "typescript": "5.5.4",
"esbuild": "0.23.0", "esbuild": "0.23.0",

File diff suppressed because it is too large Load Diff