@goast/kotlin 0.3.12 → 0.3.13
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/cjs/lib/generators/models/model-generator.js +4 -3
- package/cjs/lib/generators/services/okhttp3-clients/okhttp3-client-generator.js +3 -2
- package/cjs/lib/generators/services/okhttp3-clients/okhttp3-clients-generator.js +6 -4
- package/cjs/lib/generators/services/spring-controllers/spring-controller-generator.js +6 -5
- package/esm/lib/generators/models/model-generator.js +3 -3
- package/esm/lib/generators/services/okhttp3-clients/okhttp3-client-generator.js +2 -2
- package/esm/lib/generators/services/okhttp3-clients/okhttp3-clients-generator.js +5 -4
- package/esm/lib/generators/services/spring-controllers/spring-controller-generator.js +5 -5
- package/package.json +2 -2
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DefaultKotlinModelGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
/* eslint-disable unused-imports/no-unused-vars */
|
|
5
6
|
const path_1 = require("path");
|
|
6
|
-
const fs_extra_1 = require("fs-extra");
|
|
7
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
7
8
|
const core_1 = require("@goast/core");
|
|
8
9
|
const ast_1 = require("../../ast");
|
|
9
10
|
const file_builder_1 = require("../../file-builder");
|
|
@@ -19,8 +20,8 @@ class DefaultKotlinModelGenerator extends file_generator_1.KotlinFileGenerator {
|
|
|
19
20
|
const packageName = this.getPackageName(ctx, { schema: ctx.schema });
|
|
20
21
|
const filePath = `${ctx.config.outputDir}/${packageName.replace(/\./g, '/')}/${typeName}.kt`;
|
|
21
22
|
console.log(`Generating model ${packageName}.${typeName} to ${filePath}...`);
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
fs_extra_1.default.ensureDirSync((0, path_1.dirname)(filePath));
|
|
24
|
+
fs_extra_1.default.writeFileSync(filePath, new file_builder_1.KotlinFileBuilder(packageName, ctx.config).append(this.getFileContent(ctx, {})).toString());
|
|
24
25
|
return { type: ast_1.kt.reference(typeName, packageName) };
|
|
25
26
|
}
|
|
26
27
|
else {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DefaultKotlinOkHttp3Generator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
/* eslint-disable unused-imports/no-unused-vars */
|
|
5
6
|
const fs_1 = require("fs");
|
|
6
7
|
const path_1 = require("path");
|
|
7
|
-
const fs_extra_1 = require("fs-extra");
|
|
8
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
8
9
|
const core_1 = require("@goast/core");
|
|
9
10
|
const ast_1 = require("../../../ast");
|
|
10
11
|
const file_builder_1 = require("../../../file-builder");
|
|
@@ -15,7 +16,7 @@ class DefaultKotlinOkHttp3Generator extends file_generator_1.KotlinFileGenerator
|
|
|
15
16
|
const typeName = this.getApiClientName(ctx, {});
|
|
16
17
|
const packageName = this.getPackageName(ctx, {});
|
|
17
18
|
const filePath = this.getFilePath(ctx, { packageName });
|
|
18
|
-
|
|
19
|
+
fs_extra_1.default.ensureDirSync((0, path_1.dirname)(filePath));
|
|
19
20
|
console.log(`Generating client for service ${ctx.service.name} to ${filePath}...`);
|
|
20
21
|
const builder = new file_builder_1.KotlinFileBuilder(packageName, ctx.config);
|
|
21
22
|
builder.append(this.getClientFileContent(ctx, {}));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.KotlinOkHttp3ClientsGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const fs_1 = require("fs");
|
|
5
6
|
const path_1 = require("path");
|
|
6
|
-
const fs_extra_1 = require("fs-extra");
|
|
7
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
7
8
|
const core_1 = require("@goast/core");
|
|
8
9
|
const models_1 = require("./models");
|
|
9
10
|
const okhttp3_client_generator_1 = require("./okhttp3-client-generator");
|
|
@@ -62,10 +63,11 @@ class KotlinOkHttp3ClientsGenerator extends core_1.OpenApiServicesGenerationProv
|
|
|
62
63
|
copyInfrastructureFiles(ctx) {
|
|
63
64
|
const sourceDir = (0, path_1.resolve)((0, path_1.dirname)(require.resolve('@goast/kotlin')), '../assets/client/okhttp3');
|
|
64
65
|
const targetDir = (0, path_1.resolve)(ctx.config.outputDir, ctx.infrastructurePackageName.replace(/\./g, '/'));
|
|
65
|
-
|
|
66
|
-
const files =
|
|
66
|
+
fs_extra_1.default.ensureDirSync(targetDir);
|
|
67
|
+
const files = fs_extra_1.default.readdirSync(sourceDir);
|
|
67
68
|
for (const file of files) {
|
|
68
|
-
const fileContent =
|
|
69
|
+
const fileContent = fs_extra_1.default
|
|
70
|
+
.readFileSync((0, path_1.resolve)(sourceDir, file))
|
|
69
71
|
.toString()
|
|
70
72
|
.replace(/@PACKAGE_NAME@/g, ctx.infrastructurePackageName);
|
|
71
73
|
(0, fs_1.writeFileSync)((0, path_1.resolve)(targetDir, file), fileContent);
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DefaultKotlinSpringControllerGenerator = void 0;
|
|
4
4
|
exports.listToFlux = listToFlux;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
5
6
|
/* eslint-disable unused-imports/no-unused-vars */
|
|
6
|
-
const fs_extra_1 = require("fs-extra");
|
|
7
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
7
8
|
const core_1 = require("@goast/core");
|
|
8
9
|
const ast_1 = require("../../../ast");
|
|
9
10
|
const file_builder_1 = require("../../../file-builder");
|
|
@@ -13,7 +14,7 @@ class DefaultKotlinSpringControllerGenerator extends file_generator_1.KotlinFile
|
|
|
13
14
|
generate(ctx) {
|
|
14
15
|
const packageName = this.getPackageName(ctx, {});
|
|
15
16
|
const dirPath = this.getDirectoryPath(ctx, { packageName });
|
|
16
|
-
|
|
17
|
+
fs_extra_1.default.ensureDirSync(dirPath);
|
|
17
18
|
console.log(`Generating service ${ctx.service.id} to ${dirPath}...`);
|
|
18
19
|
return {
|
|
19
20
|
apiInterface: this.generateApiInterfaceFile(ctx, { dirPath, packageName }),
|
|
@@ -30,7 +31,7 @@ class DefaultKotlinSpringControllerGenerator extends file_generator_1.KotlinFile
|
|
|
30
31
|
console.log(` Generating API interface ${typeName} to ${fileName}...`);
|
|
31
32
|
const builder = new file_builder_1.KotlinFileBuilder(packageName, ctx.config);
|
|
32
33
|
builder.append(this.getApiInterfaceFileContent(ctx, { interfaceName: typeName }));
|
|
33
|
-
|
|
34
|
+
fs_extra_1.default.writeFileSync(filePath, builder.toString());
|
|
34
35
|
return { typeName, packageName };
|
|
35
36
|
}
|
|
36
37
|
getApiInterfaceFileContent(ctx, args) {
|
|
@@ -159,7 +160,7 @@ class DefaultKotlinSpringControllerGenerator extends file_generator_1.KotlinFile
|
|
|
159
160
|
console.log(` Generating API controller ${typeName} to ${fileName}...`);
|
|
160
161
|
const builder = new file_builder_1.KotlinFileBuilder(packageName, ctx.config);
|
|
161
162
|
builder.append(this.getApiControllerFileContent(ctx, { controllerName: typeName }));
|
|
162
|
-
|
|
163
|
+
fs_extra_1.default.writeFileSync(filePath, builder.toString());
|
|
163
164
|
return { typeName, packageName };
|
|
164
165
|
}
|
|
165
166
|
getApiControllerFileContent(ctx, args) {
|
|
@@ -217,7 +218,7 @@ class DefaultKotlinSpringControllerGenerator extends file_generator_1.KotlinFile
|
|
|
217
218
|
console.log(` Generating API delegate ${typeName} to ${fileName}...`);
|
|
218
219
|
const builder = new file_builder_1.KotlinFileBuilder(packageName, ctx.config);
|
|
219
220
|
builder.append(this.getApiDelegateInterfaceFileContent(ctx, { delegateInterfaceName: typeName }));
|
|
220
|
-
|
|
221
|
+
fs_extra_1.default.writeFileSync(filePath, builder.toString());
|
|
221
222
|
return { typeName, packageName };
|
|
222
223
|
}
|
|
223
224
|
getApiDelegateInterfaceFileContent(ctx, args) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable unused-imports/no-unused-vars */
|
|
2
2
|
import { dirname } from 'path';
|
|
3
|
-
import
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
4
|
import { appendValueGroup, createOverwriteProxy, getSchemaReference, modify, modifyEach, notNullish, resolveAnyOfAndAllOf, toCasing, } from '../../../index.js';
|
|
5
5
|
import { kt } from '../../ast/index.js';
|
|
6
6
|
import { KotlinFileBuilder } from '../../file-builder.js';
|
|
@@ -16,8 +16,8 @@ export class DefaultKotlinModelGenerator extends KotlinFileGenerator {
|
|
|
16
16
|
const packageName = this.getPackageName(ctx, { schema: ctx.schema });
|
|
17
17
|
const filePath = `${ctx.config.outputDir}/${packageName.replace(/\./g, '/')}/${typeName}.kt`;
|
|
18
18
|
console.log(`Generating model ${packageName}.${typeName} to ${filePath}...`);
|
|
19
|
-
ensureDirSync(dirname(filePath));
|
|
20
|
-
writeFileSync(filePath, new KotlinFileBuilder(packageName, ctx.config).append(this.getFileContent(ctx, {})).toString());
|
|
19
|
+
fs.ensureDirSync(dirname(filePath));
|
|
20
|
+
fs.writeFileSync(filePath, new KotlinFileBuilder(packageName, ctx.config).append(this.getFileContent(ctx, {})).toString());
|
|
21
21
|
return { type: kt.reference(typeName, packageName) };
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable unused-imports/no-unused-vars */
|
|
2
2
|
import { writeFileSync } from 'fs';
|
|
3
3
|
import { dirname } from 'path';
|
|
4
|
-
import
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
5
|
import { SourceBuilder, appendValueGroup, builderTemplate as s, createOverwriteProxy, toCasing, resolveAnyOfAndAllOf, } from '../../../../index.js';
|
|
6
6
|
import { kt } from '../../../ast/index.js';
|
|
7
7
|
import { KotlinFileBuilder } from '../../../file-builder.js';
|
|
@@ -12,7 +12,7 @@ export class DefaultKotlinOkHttp3Generator extends KotlinFileGenerator {
|
|
|
12
12
|
const typeName = this.getApiClientName(ctx, {});
|
|
13
13
|
const packageName = this.getPackageName(ctx, {});
|
|
14
14
|
const filePath = this.getFilePath(ctx, { packageName });
|
|
15
|
-
ensureDirSync(dirname(filePath));
|
|
15
|
+
fs.ensureDirSync(dirname(filePath));
|
|
16
16
|
console.log(`Generating client for service ${ctx.service.name} to ${filePath}...`);
|
|
17
17
|
const builder = new KotlinFileBuilder(packageName, ctx.config);
|
|
18
18
|
builder.append(this.getClientFileContent(ctx, {}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { writeFileSync } from 'fs';
|
|
2
2
|
import { dirname, resolve } from 'path';
|
|
3
|
-
import
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
4
|
import { Factory, OpenApiServicesGenerationProviderBase } from '../../../../index.js';
|
|
5
5
|
import { defaultKotlinOkHttp3ClientsGeneratorConfig, } from './models.js';
|
|
6
6
|
import { DefaultKotlinOkHttp3Generator } from './okhttp3-client-generator.js';
|
|
@@ -59,10 +59,11 @@ export class KotlinOkHttp3ClientsGenerator extends OpenApiServicesGenerationProv
|
|
|
59
59
|
copyInfrastructureFiles(ctx) {
|
|
60
60
|
const sourceDir = resolve(dirname(require.resolve('@goast/kotlin')), '../assets/client/okhttp3');
|
|
61
61
|
const targetDir = resolve(ctx.config.outputDir, ctx.infrastructurePackageName.replace(/\./g, '/'));
|
|
62
|
-
ensureDirSync(targetDir);
|
|
63
|
-
const files = readdirSync(sourceDir);
|
|
62
|
+
fs.ensureDirSync(targetDir);
|
|
63
|
+
const files = fs.readdirSync(sourceDir);
|
|
64
64
|
for (const file of files) {
|
|
65
|
-
const fileContent =
|
|
65
|
+
const fileContent = fs
|
|
66
|
+
.readFileSync(resolve(sourceDir, file))
|
|
66
67
|
.toString()
|
|
67
68
|
.replace(/@PACKAGE_NAME@/g, ctx.infrastructurePackageName);
|
|
68
69
|
writeFileSync(resolve(targetDir, file), fileContent);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable unused-imports/no-unused-vars */
|
|
2
|
-
import
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
3
|
import { SourceBuilder, appendValueGroup, builderTemplate as s, createOverwriteProxy, notNullish, toCasing, resolveAnyOfAndAllOf, } from '../../../../index.js';
|
|
4
4
|
import { kt } from '../../../ast/index.js';
|
|
5
5
|
import { KotlinFileBuilder } from '../../../file-builder.js';
|
|
@@ -9,7 +9,7 @@ export class DefaultKotlinSpringControllerGenerator extends KotlinFileGenerator
|
|
|
9
9
|
generate(ctx) {
|
|
10
10
|
const packageName = this.getPackageName(ctx, {});
|
|
11
11
|
const dirPath = this.getDirectoryPath(ctx, { packageName });
|
|
12
|
-
ensureDirSync(dirPath);
|
|
12
|
+
fs.ensureDirSync(dirPath);
|
|
13
13
|
console.log(`Generating service ${ctx.service.id} to ${dirPath}...`);
|
|
14
14
|
return {
|
|
15
15
|
apiInterface: this.generateApiInterfaceFile(ctx, { dirPath, packageName }),
|
|
@@ -26,7 +26,7 @@ export class DefaultKotlinSpringControllerGenerator extends KotlinFileGenerator
|
|
|
26
26
|
console.log(` Generating API interface ${typeName} to ${fileName}...`);
|
|
27
27
|
const builder = new KotlinFileBuilder(packageName, ctx.config);
|
|
28
28
|
builder.append(this.getApiInterfaceFileContent(ctx, { interfaceName: typeName }));
|
|
29
|
-
writeFileSync(filePath, builder.toString());
|
|
29
|
+
fs.writeFileSync(filePath, builder.toString());
|
|
30
30
|
return { typeName, packageName };
|
|
31
31
|
}
|
|
32
32
|
getApiInterfaceFileContent(ctx, args) {
|
|
@@ -155,7 +155,7 @@ export class DefaultKotlinSpringControllerGenerator extends KotlinFileGenerator
|
|
|
155
155
|
console.log(` Generating API controller ${typeName} to ${fileName}...`);
|
|
156
156
|
const builder = new KotlinFileBuilder(packageName, ctx.config);
|
|
157
157
|
builder.append(this.getApiControllerFileContent(ctx, { controllerName: typeName }));
|
|
158
|
-
writeFileSync(filePath, builder.toString());
|
|
158
|
+
fs.writeFileSync(filePath, builder.toString());
|
|
159
159
|
return { typeName, packageName };
|
|
160
160
|
}
|
|
161
161
|
getApiControllerFileContent(ctx, args) {
|
|
@@ -213,7 +213,7 @@ export class DefaultKotlinSpringControllerGenerator extends KotlinFileGenerator
|
|
|
213
213
|
console.log(` Generating API delegate ${typeName} to ${fileName}...`);
|
|
214
214
|
const builder = new KotlinFileBuilder(packageName, ctx.config);
|
|
215
215
|
builder.append(this.getApiDelegateInterfaceFileContent(ctx, { delegateInterfaceName: typeName }));
|
|
216
|
-
writeFileSync(filePath, builder.toString());
|
|
216
|
+
fs.writeFileSync(filePath, builder.toString());
|
|
217
217
|
return { typeName, packageName };
|
|
218
218
|
}
|
|
219
219
|
getApiDelegateInterfaceFileContent(ctx, args) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goast/kotlin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.13",
|
|
4
4
|
"repository": "https://github.com/MaSch0212/goast.git",
|
|
5
5
|
"description": "Provides gOAst generators for generating Kotlin code from OpenAPI specifications.",
|
|
6
6
|
"keywords": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"fs-extra": "^11.2.0",
|
|
26
26
|
"node-fetch": "^2.7.0",
|
|
27
27
|
"yaml": "^2.6.0",
|
|
28
|
-
"@goast/core": "0.3.
|
|
28
|
+
"@goast/core": "0.3.8",
|
|
29
29
|
"tslib": "2.6.3"
|
|
30
30
|
},
|
|
31
31
|
"packageManager": "pnpm@9.5.0",
|