@alauda/doom 0.11.3 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/plugins/api/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { usePageData } from '@rspress/core/runtime';
|
|
|
3
3
|
import { Badge, getCustomMDXComponent } from '@rspress/core/theme';
|
|
4
4
|
import BananaSlug from 'github-slugger';
|
|
5
5
|
import { OpenAPIV3 } from 'openapi-types';
|
|
6
|
-
import { useMemo, useState } from 'react';
|
|
6
|
+
import { Fragment, useMemo, useState } from 'react';
|
|
7
7
|
import { DEFAULT_COMMON_REFS, omitRoutePathRefs, resolveRef } from '../utils.js';
|
|
8
8
|
import { HeadingTitle } from './_HeadingTitle.js';
|
|
9
9
|
import { Markdown } from './_Markdown.js';
|
|
@@ -115,9 +115,9 @@ export const OpenAPIPath = ({ path, openapiPath: openapiPath_, pathPrefix: pathP
|
|
|
115
115
|
const requestBodySchema = requestBodyRef
|
|
116
116
|
? resolveRef(openapi, requestBodyRef)
|
|
117
117
|
: undefined;
|
|
118
|
-
return (_jsxs(
|
|
119
|
-
}), refs?.map((ref
|
|
120
|
-
return (_jsx(OpenAPIRef, { schema: ref, openapiPath: openapiPath, collectRefs: false },
|
|
118
|
+
return (_jsxs(Fragment, { children: [_jsxs(HeadingTitle, { slugger: slugger, level: 3, children: [_jsx(X.code, { children: method }), summary] }), _jsx(Markdown, { children: description }), parameters && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: "Parameters" }), _jsx(OpenAPIParameters, { parameters: parameters, openapi: openapi })] })), requestBodySchema && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: "Request Body" }), _jsxs(X.p, { children: [_jsx(RefLink, { "$ref": requestBodyRef }), requestBodySchema.required && _jsx(Badge, { children: "required" })] })] })), responses && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: "Response" }), _jsx(OpenAPIResponses, { responses: responses, openapi: openapi })] }))] }, method));
|
|
119
|
+
}), refs?.map((ref) => {
|
|
120
|
+
return (_jsx(OpenAPIRef, { schema: ref, openapiPath: openapiPath, collectRefs: false }, ref));
|
|
121
121
|
})] }));
|
|
122
122
|
};
|
|
123
123
|
export default OpenAPIPath;
|
|
@@ -81,7 +81,7 @@ export const OpenAPIRef = ({ schema, openapiPath: openapiPath_, collectRefs = tr
|
|
|
81
81
|
return [];
|
|
82
82
|
}, []);
|
|
83
83
|
if (!schemaItem || !openapi) {
|
|
84
|
-
console.error(`No OpenAPI schema definition found for ${schema}`);
|
|
84
|
+
console.error(`No OpenAPI schema definition found for ${schema}\n`);
|
|
85
85
|
return null;
|
|
86
86
|
}
|
|
87
87
|
const refs = useMemo(() => {
|
|
@@ -92,6 +92,6 @@ export const OpenAPIRef = ({ schema, openapiPath: openapiPath_, collectRefs = tr
|
|
|
92
92
|
}, page.routePath));
|
|
93
93
|
}
|
|
94
94
|
}, [collectRefs, openapi, page.routePath, schema]);
|
|
95
|
-
return (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slug: schema, level: 2, children: modelName(schema) }), _jsx(Markdown, { children: schemaItem.description }), schemaItem.properties && (_jsx(OpenAPIProperties, { properties: schemaItem.properties, openapi: openapi })), refs?.map((schema
|
|
95
|
+
return (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slug: schema, level: 2, children: modelName(schema) }), _jsx(Markdown, { children: schemaItem.description }), schemaItem.properties && (_jsx(OpenAPIProperties, { properties: schemaItem.properties, openapi: openapi })), refs?.map((schema) => (_jsx(OpenAPIRef, { schema: schema, openapiPath: openapiPath, collectRefs: false }, schema)))] }));
|
|
96
96
|
};
|
|
97
97
|
export default OpenAPIRef;
|
package/lib/utils/helpers.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import { StringMapper } from '../shared/types.js';
|
|
|
2
2
|
export declare const baseResolve: (...paths: string[]) => string;
|
|
3
3
|
export declare const pkgResolve: (...paths: string[]) => string;
|
|
4
4
|
export declare const resolveStaticConfig: <T = unknown>(filepath: string) => Promise<T>;
|
|
5
|
-
export declare function generateRuntimeModule<T, R = T
|
|
5
|
+
export declare function generateRuntimeModule<T, R = T>(patterns: string[], kind: string, cwd: string, isProd: boolean, mapper?: (input: T) => R | Promise<R>): Promise<StringMapper>;
|