api-core-lib 12.0.42 → 12.0.44
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/dist/cli.cjs +9 -22
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -70,7 +70,11 @@ function parseSpecToModules(spec) {
|
|
|
70
70
|
}
|
|
71
71
|
let inputType = "undefined";
|
|
72
72
|
if (requestBody) {
|
|
73
|
-
|
|
73
|
+
if (requestBody.$ref) {
|
|
74
|
+
inputType = refToTypeName(requestBody.$ref);
|
|
75
|
+
} else if (requestBody.type === "object") {
|
|
76
|
+
inputType = "any";
|
|
77
|
+
}
|
|
74
78
|
} else if ((endpoint.parameters || []).some((p) => p.in === "query")) {
|
|
75
79
|
inputType = "QueryOptions";
|
|
76
80
|
}
|
|
@@ -120,8 +124,7 @@ async function runGenerator(options) {
|
|
|
120
124
|
console.log("\n" + import_chalk.default.blue("Step 3: Generating organized TypeScript types..."));
|
|
121
125
|
const typesOutputPath = import_path.default.join(options.output, "types");
|
|
122
126
|
ignoreFilePath = import_path.default.join(process.cwd(), `.openapi-generator-ignore-${Date.now()}`);
|
|
123
|
-
const ignoreContent =
|
|
124
|
-
# Main generator metadata
|
|
127
|
+
const ignoreContent = `# Main generator metadata
|
|
125
128
|
.openapi-generator/
|
|
126
129
|
# Documentation files
|
|
127
130
|
docs/
|
|
@@ -130,8 +133,7 @@ docs/
|
|
|
130
133
|
git_push.sh
|
|
131
134
|
# NPM helper files
|
|
132
135
|
.npmignore
|
|
133
|
-
README.md
|
|
134
|
-
`;
|
|
136
|
+
README.md`;
|
|
135
137
|
import_fs.default.writeFileSync(ignoreFilePath, ignoreContent);
|
|
136
138
|
console.log(import_chalk.default.gray("\u2713 Created temporary .openapi-generator-ignore file."));
|
|
137
139
|
const generatorCommand = [
|
|
@@ -140,14 +142,7 @@ README.md
|
|
|
140
142
|
`-g typescript-axios`,
|
|
141
143
|
`-o "${typesOutputPath}"`,
|
|
142
144
|
`--ignore-file-override "${ignoreFilePath}"`,
|
|
143
|
-
|
|
144
|
-
// ## البداية: التعديل الحاسم للتحكم في المخرجات ##
|
|
145
|
-
// ==========================================================
|
|
146
|
-
// [تعديل] سنقوم بتحديد ما نريد إنشاؤه وما لا نريده بشكل صريح
|
|
147
|
-
"--global-property models,supportingFiles=false",
|
|
148
|
-
// ==========================================================
|
|
149
|
-
// ## النهاية: التعديل الحاسم للتحكم في المخرجات ##
|
|
150
|
-
// ==========================================================
|
|
145
|
+
"--global-property models,apis=false,supportingFiles=false",
|
|
151
146
|
`--additional-properties=supportsES6=true,useSingleRequestParameter=true,withInterfaces=true,modelPropertyNaming=original`
|
|
152
147
|
].join(" ");
|
|
153
148
|
console.log(import_chalk.default.gray(`Executing command: npx @openapitools/openapi-generator-cli...`));
|
|
@@ -181,18 +176,10 @@ ${actionsTypeParts.join("\n")}
|
|
|
181
176
|
const actionsValueDefinition = `{
|
|
182
177
|
${actionsValueParts.join(",\n")}
|
|
183
178
|
}`;
|
|
184
|
-
const fileContent =
|
|
185
|
-
* This file is auto-generated by api-core-lib.
|
|
186
|
-
* Do not edit this file directly.
|
|
187
|
-
* @module ${moduleName}
|
|
188
|
-
*/
|
|
189
|
-
|
|
179
|
+
const fileContent = `
|
|
190
180
|
import type { ApiModuleConfig, ActionConfigModule, QueryOptions } from 'api-core-lib';
|
|
191
181
|
import type { ${[...allModelTypes].join(", ")} } from '../types';
|
|
192
182
|
|
|
193
|
-
/**
|
|
194
|
-
* Defines the configuration for the ${moduleName} API module.
|
|
195
|
-
*/
|
|
196
183
|
export const ${moduleName}Module: ApiModuleConfig<${actionsTypeDefinition}> = {
|
|
197
184
|
baseEndpoint: '${moduleData.baseEndpoint}',
|
|
198
185
|
actions: ${actionsValueDefinition},
|