admin管理员组文章数量:1279208
I'm trying to generate only TypeScript types from my Swagger JSON specification using @openapitools/openapi-generator-cli
, but it keeps generating API controllers and resources even though I've disabled API generation in the configuration.
Here's my current openapitools.json
configuration:
{
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "6.2.1",
"generators": {
"typescript-types": {
"generatorName": "typescript-axios",
"output": "src/generated",
"glob": "swagger.json",
"skipValidateSpec": true,
"additionalProperties": {
"modelPropertyNaming": "original",
"typescriptThreePlus": true,
"enumNameSuffix": "",
"enumPropertyNaming": "UPPERCASE",
"withInterfaces": true,
"generateModels": true,
"supportsES6": true,
"modelPackage": "models",
"stringEnums": true,
"withoutRuntimeChecks": true,
"generateApis": false,
"generateApiDocumentation": false,
"generateApiTests": false,
"generateModelDocumentation": false,
"generateModelTests": false
}
}
}
}
}
Despite setting generateApis: false
and other API-related flags to false, I'm still getting generated code like:
/**
* ProductResourcesAPIsApi - axios parameter creator
* @export
*/
export const ProductResourcesAPIsApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* @summary Get Product Details by ID
* @param {string} xRequestID Request Tracking ID
* @param {string} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ProductResourcesAPIsApi
*/
public productControllerGetDetails(xRequestID
I only want the TypeScript types/interfaces to be generated, without any API-related code. How can I achieve this?
Things I've already tried:
- Setting all API-related generation flags to false
- Using
withSeparateModelsAndApi: true
- Setting
apiPackage: ""
版权声明:本文标题:How to generate only TypeScript types without API controllersresources from Swagger JSON? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741264897a2368274.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论