docs(api): 更新Swagger文档以统一路径和定义引用格式

Swagger文档中的路径和定义引用格式已标准化,确保一致性和减少混乱。此更改包括将所有路径和引用转换为小写,并移除定义中的重复引号。

修复了由不一致的引用格式引起的解析错误,提高了文档的准确性和可读性。
```
This commit is contained in:
ivamp 2024-08-04 17:24:36 +08:00
parent 4439b142e3
commit 43a79e9bd4
6 changed files with 2549 additions and 3414 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,18 +5,19 @@
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
* *
* The version of the OpenAPI document: 1.0 * The version of the OpenAPI document: 1.0
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */
import type { Configuration } from "./configuration";
import type { Configuration } from './configuration';
// Some imports not used depending on template conditions // Some imports not used depending on template conditions
// @ts-ignore // @ts-ignore
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from "axios"; import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from "axios"; import globalAxios from 'axios';
export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
@ -25,10 +26,10 @@ export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
* @export * @export
*/ */
export const COLLECTION_FORMATS = { export const COLLECTION_FORMATS = {
csv: ",", csv: ",",
ssv: " ", ssv: " ",
tsv: "\t", tsv: "\t",
pipes: "|", pipes: "|",
}; };
/** /**
@ -37,8 +38,8 @@ export const COLLECTION_FORMATS = {
* @interface RequestArgs * @interface RequestArgs
*/ */
export interface RequestArgs { export interface RequestArgs {
url: string; url: string;
options: RawAxiosRequestConfig; options: RawAxiosRequestConfig;
} }
/** /**
@ -47,19 +48,15 @@ export interface RequestArgs {
* @class BaseAPI * @class BaseAPI
*/ */
export class BaseAPI { export class BaseAPI {
protected configuration: Configuration | undefined; protected configuration: Configuration | undefined;
constructor( constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
configuration?: Configuration, if (configuration) {
protected basePath: string = BASE_PATH, this.configuration = configuration;
protected axios: AxiosInstance = globalAxios, this.basePath = configuration.basePath ?? basePath;
) { }
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath ?? basePath;
} }
} };
}
/** /**
* *
@ -68,24 +65,22 @@ export class BaseAPI {
* @extends {Error} * @extends {Error}
*/ */
export class RequiredError extends Error { export class RequiredError extends Error {
constructor( constructor(public field: string, msg?: string) {
public field: string, super(msg);
msg?: string, this.name = "RequiredError"
) { }
super(msg);
this.name = "RequiredError";
}
} }
interface ServerMap { interface ServerMap {
[key: string]: { [key: string]: {
url: string; url: string,
description: string; description: string,
}[]; }[];
} }
/** /**
* *
* @export * @export
*/ */
export const operationServerMap: ServerMap = {}; export const operationServerMap: ServerMap = {
}

View File

@ -5,139 +5,105 @@
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
* *
* The version of the OpenAPI document: 1.0 * The version of the OpenAPI document: 1.0
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */
import type { Configuration } from "./configuration"; import type { Configuration } from "./configuration";
import type { RequestArgs } from "./base"; import type { RequestArgs } from "./base";
import type { AxiosInstance, AxiosResponse } from "axios"; import type { AxiosInstance, AxiosResponse } from 'axios';
import { RequiredError } from "./base"; import { RequiredError } from "./base";
/** /**
* *
* @export * @export
*/ */
export const DUMMY_BASE_URL = "https://example.com"; export const DUMMY_BASE_URL = 'https://example.com'
/** /**
* *
* @throws {RequiredError} * @throws {RequiredError}
* @export * @export
*/ */
export const assertParamExists = function ( export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
functionName: string, if (paramValue === null || paramValue === undefined) {
paramName: string, throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
paramValue: unknown,
) {
if (paramValue === null || paramValue === undefined) {
throw new RequiredError(
paramName,
`Required parameter ${paramName} was null or undefined when calling ${functionName}.`,
);
}
};
/**
*
* @export
*/
export const setApiKeyToObject = async function (
object: any,
keyParamName: string,
configuration?: Configuration,
) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue =
typeof configuration.apiKey === "function"
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
};
/**
*
* @export
*/
export const setBasicAuthToObject = function (
object: any,
configuration?: Configuration,
) {
if (configuration && (configuration.username || configuration.password)) {
object["auth"] = {
username: configuration.username,
password: configuration.password,
};
}
};
/**
*
* @export
*/
export const setBearerAuthToObject = async function (
object: any,
configuration?: Configuration,
) {
if (configuration && configuration.accessToken) {
const accessToken =
typeof configuration.accessToken === "function"
? await configuration.accessToken()
: await configuration.accessToken;
object["Authorization"] = "Bearer " + accessToken;
}
};
/**
*
* @export
*/
export const setOAuthToObject = async function (
object: any,
name: string,
scopes: string[],
configuration?: Configuration,
) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue =
typeof configuration.accessToken === "function"
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
};
function setFlattenedQueryParams(
urlSearchParams: URLSearchParams,
parameter: any,
key: string = "",
): void {
if (parameter == null) return;
if (typeof parameter === "object") {
if (Array.isArray(parameter)) {
(parameter as any[]).forEach((item) =>
setFlattenedQueryParams(urlSearchParams, item, key),
);
} else {
Object.keys(parameter).forEach((currentKey) =>
setFlattenedQueryParams(
urlSearchParams,
parameter[currentKey],
`${key}${key !== "" ? "." : ""}${currentKey}`,
),
);
} }
} else { }
if (urlSearchParams.has(key)) {
urlSearchParams.append(key, parameter); /**
} else { *
urlSearchParams.set(key, parameter); * @export
*/
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
}
/**
*
* @export
*/
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
if (configuration && (configuration.username || configuration.password)) {
object["auth"] = { username: configuration.username, password: configuration.password };
}
}
/**
*
* @export
*/
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object["Authorization"] = "Bearer " + accessToken;
}
}
/**
*
* @export
*/
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
}
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
if (parameter == null) return;
if (typeof parameter === "object") {
if (Array.isArray(parameter)) {
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
}
else {
Object.keys(parameter).forEach(currentKey =>
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
);
}
}
else {
if (urlSearchParams.has(key)) {
urlSearchParams.append(key, parameter);
}
else {
urlSearchParams.set(key, parameter);
}
} }
}
} }
/** /**
@ -145,58 +111,40 @@ function setFlattenedQueryParams(
* @export * @export
*/ */
export const setSearchParams = function (url: URL, ...objects: any[]) { export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search); const searchParams = new URLSearchParams(url.search);
setFlattenedQueryParams(searchParams, objects); setFlattenedQueryParams(searchParams, objects);
url.search = searchParams.toString(); url.search = searchParams.toString();
}; }
/** /**
* *
* @export * @export
*/ */
export const serializeDataIfNeeded = function ( export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
value: any, const nonString = typeof value !== 'string';
requestOptions: any, const needsSerialization = nonString && configuration && configuration.isJsonMime
configuration?: Configuration, ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
) { : nonString;
const nonString = typeof value !== "string"; return needsSerialization
const needsSerialization = ? JSON.stringify(value !== undefined ? value : {})
nonString && configuration && configuration.isJsonMime : (value || "");
? configuration.isJsonMime(requestOptions.headers["Content-Type"]) }
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {})
: value || "";
};
/** /**
* *
* @export * @export
*/ */
export const toPathString = function (url: URL) { export const toPathString = function (url: URL) {
return url.pathname + url.search + url.hash; return url.pathname + url.search + url.hash
}; }
/** /**
* *
* @export * @export
*/ */
export const createRequestFunction = function ( export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
axiosArgs: RequestArgs, return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
globalAxios: AxiosInstance, const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
BASE_PATH: string, return axios.request<T, R>(axiosRequestArgs);
configuration?: Configuration,
) {
return <T = unknown, R = AxiosResponse<T>>(
axios: AxiosInstance = globalAxios,
basePath: string = BASE_PATH,
) => {
const axiosRequestArgs = {
...axiosArgs.options,
url:
(axios.defaults.baseURL ? "" : (configuration?.basePath ?? basePath)) +
axiosArgs.url,
}; };
return axios.request<T, R>(axiosRequestArgs); }
};
};

View File

@ -5,128 +5,106 @@
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
* *
* The version of the OpenAPI document: 1.0 * The version of the OpenAPI document: 1.0
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */
export interface ConfigurationParameters { export interface ConfigurationParameters {
apiKey?: apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
| string username?: string;
| Promise<string> password?: string;
| ((name: string) => string) accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
| ((name: string) => Promise<string>); basePath?: string;
username?: string; serverIndex?: number;
password?: string; baseOptions?: any;
accessToken?: formDataCtor?: new () => any;
| string
| Promise<string>
| ((name?: string, scopes?: string[]) => string)
| ((name?: string, scopes?: string[]) => Promise<string>);
basePath?: string;
serverIndex?: number;
baseOptions?: any;
formDataCtor?: new () => any;
} }
export class Configuration { export class Configuration {
/** /**
* parameter for apiKey security * parameter for apiKey security
* @param name security name * @param name security name
* @memberof Configuration * @memberof Configuration
*/ */
apiKey?: apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
| string /**
| Promise<string> * parameter for basic security
| ((name: string) => string) *
| ((name: string) => Promise<string>); * @type {string}
/** * @memberof Configuration
* parameter for basic security */
* username?: string;
* @type {string} /**
* @memberof Configuration * parameter for basic security
*/ *
username?: string; * @type {string}
/** * @memberof Configuration
* parameter for basic security */
* password?: string;
* @type {string} /**
* @memberof Configuration * parameter for oauth2 security
*/ * @param name security name
password?: string; * @param scopes oauth2 scope
/** * @memberof Configuration
* parameter for oauth2 security */
* @param name security name accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
* @param scopes oauth2 scope /**
* @memberof Configuration * override base path
*/ *
accessToken?: * @type {string}
| string * @memberof Configuration
| Promise<string> */
| ((name?: string, scopes?: string[]) => string) basePath?: string;
| ((name?: string, scopes?: string[]) => Promise<string>); /**
/** * override server index
* override base path *
* * @type {number}
* @type {string} * @memberof Configuration
* @memberof Configuration */
*/ serverIndex?: number;
basePath?: string; /**
/** * base options for axios calls
* override server index *
* * @type {any}
* @type {number} * @memberof Configuration
* @memberof Configuration */
*/ baseOptions?: any;
serverIndex?: number; /**
/** * The FormData constructor that will be used to create multipart form data
* base options for axios calls * requests. You can inject this here so that execution environments that
* * do not support the FormData class can still run the generated client.
* @type {any} *
* @memberof Configuration * @type {new () => FormData}
*/ */
baseOptions?: any; formDataCtor?: new () => any;
/**
* The FormData constructor that will be used to create multipart form data
* requests. You can inject this here so that execution environments that
* do not support the FormData class can still run the generated client.
*
* @type {new () => FormData}
*/
formDataCtor?: new () => any;
constructor(param: ConfigurationParameters = {}) { constructor(param: ConfigurationParameters = {}) {
this.apiKey = param.apiKey; this.apiKey = param.apiKey;
this.username = param.username; this.username = param.username;
this.password = param.password; this.password = param.password;
this.accessToken = param.accessToken; this.accessToken = param.accessToken;
this.basePath = param.basePath; this.basePath = param.basePath;
this.serverIndex = param.serverIndex; this.serverIndex = param.serverIndex;
this.baseOptions = param.baseOptions; this.baseOptions = param.baseOptions;
this.formDataCtor = param.formDataCtor; this.formDataCtor = param.formDataCtor;
} }
/** /**
* Check if the given MIME is a JSON MIME. * Check if the given MIME is a JSON MIME.
* JSON MIME examples: * JSON MIME examples:
* application/json * application/json
* application/json; charset=UTF8 * application/json; charset=UTF8
* APPLICATION/JSON * APPLICATION/JSON
* application/vnd.company+json * application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions) * @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise. * @return True if the given MIME is JSON, false otherwise.
*/ */
public isJsonMime(mime: string): boolean { public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp( const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
"^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$", return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
"i", }
);
return (
mime !== null &&
(jsonMime.test(mime) ||
mime.toLowerCase() === "application/json-patch+json")
);
}
} }

View File

@ -5,12 +5,14 @@
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
* *
* The version of the OpenAPI document: 1.0 * The version of the OpenAPI document: 1.0
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */
export * from "./api"; export * from "./api";
export * from "./configuration"; export * from "./configuration";