@goast/kotlin 0.4.18 → 0.4.20
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/assets/client/okhttp3/Serializer.kt +2 -0
- package/assets/client/spring-reactive-web-clients/ApiRequestFile.kt +33 -0
- package/esm/src/ast/nodes/call.d.ts.map +1 -1
- package/esm/src/ast/nodes/call.js +11 -1
- package/esm/src/ast/nodes/lambda-type.d.ts +2 -0
- package/esm/src/ast/nodes/lambda-type.d.ts.map +1 -1
- package/esm/src/ast/nodes/lambda-type.js +11 -4
- package/esm/src/ast/nodes/lambda.d.ts.map +1 -1
- package/esm/src/ast/nodes/lambda.js +10 -5
- package/esm/src/ast/references/index.d.ts +2 -0
- package/esm/src/ast/references/index.d.ts.map +1 -1
- package/esm/src/ast/references/index.js +2 -0
- package/esm/src/ast/references/java.d.ts +1 -0
- package/esm/src/ast/references/java.d.ts.map +1 -1
- package/esm/src/ast/references/java.js +1 -0
- package/esm/src/ast/references/kotlinx.d.ts +5 -0
- package/esm/src/ast/references/kotlinx.d.ts.map +1 -0
- package/esm/src/ast/references/kotlinx.js +6 -0
- package/esm/src/ast/references/spring-reactive.d.ts +9 -0
- package/esm/src/ast/references/spring-reactive.d.ts.map +1 -0
- package/esm/src/ast/references/spring-reactive.js +10 -0
- package/esm/src/ast/references/spring.d.ts +4 -0
- package/esm/src/ast/references/spring.d.ts.map +1 -1
- package/esm/src/ast/references/spring.js +6 -0
- package/esm/src/generators/index.d.ts +1 -0
- package/esm/src/generators/index.d.ts.map +1 -1
- package/esm/src/generators/index.js +1 -0
- package/esm/src/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts +1 -2
- package/esm/src/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts.map +1 -1
- package/esm/src/generators/services/spring-reactive-web-clients/args.d.ts +99 -0
- package/esm/src/generators/services/spring-reactive-web-clients/args.d.ts.map +1 -0
- package/esm/src/generators/services/spring-reactive-web-clients/args.js +1 -0
- package/esm/src/generators/services/spring-reactive-web-clients/index.d.ts +5 -0
- package/esm/src/generators/services/spring-reactive-web-clients/index.d.ts.map +1 -0
- package/esm/src/generators/services/spring-reactive-web-clients/index.js +4 -0
- package/esm/src/generators/services/spring-reactive-web-clients/models.d.ts +34 -0
- package/esm/src/generators/services/spring-reactive-web-clients/models.d.ts.map +1 -0
- package/esm/src/generators/services/spring-reactive-web-clients/models.js +8 -0
- package/esm/src/generators/services/spring-reactive-web-clients/refs.d.ts +5 -0
- package/esm/src/generators/services/spring-reactive-web-clients/refs.d.ts.map +1 -0
- package/esm/src/generators/services/spring-reactive-web-clients/refs.js +8 -0
- package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.d.ts +46 -0
- package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.d.ts.map +1 -0
- package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.js +383 -0
- package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.d.ts +23 -0
- package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.d.ts.map +1 -0
- package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.js +79 -0
- package/package.json +2 -2
- package/script/src/ast/nodes/call.d.ts.map +1 -1
- package/script/src/ast/nodes/call.js +11 -1
- package/script/src/ast/nodes/lambda-type.d.ts +2 -0
- package/script/src/ast/nodes/lambda-type.d.ts.map +1 -1
- package/script/src/ast/nodes/lambda-type.js +11 -4
- package/script/src/ast/nodes/lambda.d.ts.map +1 -1
- package/script/src/ast/nodes/lambda.js +10 -5
- package/script/src/ast/references/index.d.ts +2 -0
- package/script/src/ast/references/index.d.ts.map +1 -1
- package/script/src/ast/references/index.js +3 -1
- package/script/src/ast/references/java.d.ts +1 -0
- package/script/src/ast/references/java.d.ts.map +1 -1
- package/script/src/ast/references/java.js +2 -1
- package/script/src/ast/references/kotlinx.d.ts +5 -0
- package/script/src/ast/references/kotlinx.d.ts.map +1 -0
- package/script/src/ast/references/kotlinx.js +9 -0
- package/script/src/ast/references/spring-reactive.d.ts +9 -0
- package/script/src/ast/references/spring-reactive.d.ts.map +1 -0
- package/script/src/ast/references/spring-reactive.js +13 -0
- package/script/src/ast/references/spring.d.ts +4 -0
- package/script/src/ast/references/spring.d.ts.map +1 -1
- package/script/src/ast/references/spring.js +7 -1
- package/script/src/generators/index.d.ts +1 -0
- package/script/src/generators/index.d.ts.map +1 -1
- package/script/src/generators/index.js +1 -0
- package/script/src/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts +1 -2
- package/script/src/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts.map +1 -1
- package/script/src/generators/services/spring-reactive-web-clients/args.d.ts +99 -0
- package/script/src/generators/services/spring-reactive-web-clients/args.d.ts.map +1 -0
- package/script/src/generators/services/spring-reactive-web-clients/args.js +2 -0
- package/script/src/generators/services/spring-reactive-web-clients/index.d.ts +5 -0
- package/script/src/generators/services/spring-reactive-web-clients/index.d.ts.map +1 -0
- package/script/src/generators/services/spring-reactive-web-clients/index.js +8 -0
- package/script/src/generators/services/spring-reactive-web-clients/models.d.ts +34 -0
- package/script/src/generators/services/spring-reactive-web-clients/models.d.ts.map +1 -0
- package/script/src/generators/services/spring-reactive-web-clients/models.js +11 -0
- package/script/src/generators/services/spring-reactive-web-clients/refs.d.ts +5 -0
- package/script/src/generators/services/spring-reactive-web-clients/refs.d.ts.map +1 -0
- package/script/src/generators/services/spring-reactive-web-clients/refs.js +11 -0
- package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.d.ts +46 -0
- package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.d.ts.map +1 -0
- package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.js +388 -0
- package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.d.ts +23 -0
- package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.d.ts.map +1 -0
- package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.js +84 -0
- package/src/src/ast/nodes/call.ts +10 -1
- package/src/src/ast/nodes/lambda-type.ts +7 -2
- package/src/src/ast/nodes/lambda.ts +10 -4
- package/src/src/ast/references/index.ts +2 -0
- package/src/src/ast/references/java.ts +1 -0
- package/src/src/ast/references/kotlinx.ts +14 -0
- package/src/src/ast/references/spring-reactive.ts +33 -0
- package/src/src/ast/references/spring.ts +14 -0
- package/src/src/generators/index.ts +1 -0
- package/src/src/generators/services/okhttp3-clients/okhttp3-client-generator.ts +1 -2
- package/src/src/generators/services/spring-reactive-web-clients/args.ts +101 -0
- package/src/src/generators/services/spring-reactive-web-clients/index.ts +4 -0
- package/src/src/generators/services/spring-reactive-web-clients/models.ts +62 -0
- package/src/src/generators/services/spring-reactive-web-clients/refs.ts +11 -0
- package/src/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.ts +572 -0
- package/src/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.ts +128 -0
|
@@ -8,10 +8,18 @@ export const autowired: KtReferenceFactory = ktReference.factory(
|
|
|
8
8
|
|
|
9
9
|
// org.springframework.http
|
|
10
10
|
export const httpStatus: KtReferenceFactory = ktReference.factory('HttpStatus', 'org.springframework.http');
|
|
11
|
+
export const httpMethod: KtReferenceFactory = ktReference.factory('HttpMethod', 'org.springframework.http');
|
|
11
12
|
export const responseEntity: KtGenericReferenceFactory<1> = ktReference.genericFactory<1>(
|
|
12
13
|
'ResponseEntity',
|
|
13
14
|
'org.springframework.http',
|
|
14
15
|
);
|
|
16
|
+
export const mediaType: KtReferenceFactory = ktReference.factory('MediaType', 'org.springframework.http');
|
|
17
|
+
|
|
18
|
+
// org.springframework.http.client
|
|
19
|
+
export const multipartBodyBuilder: KtReferenceFactory = ktReference.factory(
|
|
20
|
+
'MultipartBodyBuilder',
|
|
21
|
+
'org.springframework.http.client',
|
|
22
|
+
);
|
|
15
23
|
|
|
16
24
|
// org.springframework.http.codec.multipart
|
|
17
25
|
export const filePart: KtReferenceFactory = ktReference.factory('FilePart', 'org.springframework.http.codec.multipart');
|
|
@@ -70,3 +78,9 @@ export const nativeWebRequest: KtReferenceFactory = ktReference.factory(
|
|
|
70
78
|
'NativeWebRequest',
|
|
71
79
|
'org.springframework.web.context.request',
|
|
72
80
|
);
|
|
81
|
+
|
|
82
|
+
// org.springframework.web.util
|
|
83
|
+
export const uriComponentsBuilder: KtReferenceFactory = ktReference.factory(
|
|
84
|
+
'UriComponentsBuilder',
|
|
85
|
+
'org.springframework.web.util',
|
|
86
|
+
);
|
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
|
|
19
19
|
import { kt } from '../../../ast/index.js';
|
|
20
20
|
import type { KtValue } from '../../../ast/nodes/types.js';
|
|
21
|
-
import type { KotlinImport } from '../../../common-results.js';
|
|
22
21
|
import { KotlinFileBuilder } from '../../../file-builder.js';
|
|
23
22
|
import type { ApiParameterWithMultipartInfo } from '../../../types.js';
|
|
24
23
|
import { modifyString } from '../../../utils.js';
|
|
@@ -36,7 +35,7 @@ export interface KotlinOkHttp3Generator<TOutput extends Output = Output> {
|
|
|
36
35
|
|
|
37
36
|
export class DefaultKotlinOkHttp3Generator extends KotlinFileGenerator<Context, Output>
|
|
38
37
|
implements KotlinOkHttp3Generator {
|
|
39
|
-
public generate(ctx: KotlinOkHttp3ClientGeneratorContext): MaybePromise<
|
|
38
|
+
public generate(ctx: KotlinOkHttp3ClientGeneratorContext): MaybePromise<Output> {
|
|
40
39
|
const typeName = this.getApiClientName(ctx, {});
|
|
41
40
|
const packageName = this.getPackageName(ctx, {});
|
|
42
41
|
const filePath = this.getFilePath(ctx, { packageName });
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { ApiEndpoint, ApiParameter, ApiSchema, SourceBuilder } from '@goast/core';
|
|
2
|
+
import type { kt } from '../../../ast/index.js';
|
|
3
|
+
import type { ApiParameterWithMultipartInfo } from '../../../types.js';
|
|
4
|
+
|
|
5
|
+
export type GetClientFileContent = object;
|
|
6
|
+
|
|
7
|
+
export type GetRequestsObject = object;
|
|
8
|
+
|
|
9
|
+
export type GetEndpointMembers = { endpoint: ApiEndpoint; parameters: ApiParameterWithMultipartInfo[] };
|
|
10
|
+
|
|
11
|
+
export type GetEndpointFunctionName = { endpoint: ApiEndpoint };
|
|
12
|
+
|
|
13
|
+
export type GetEndpointFunction = {
|
|
14
|
+
endpoint: ApiEndpoint;
|
|
15
|
+
parameters: ApiParameterWithMultipartInfo[];
|
|
16
|
+
responseSchema: ApiSchema | undefined;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type GetEndpointFunctionBody = {
|
|
20
|
+
endpoint: ApiEndpoint;
|
|
21
|
+
parameters: ApiParameterWithMultipartInfo[];
|
|
22
|
+
responseSchema: ApiSchema | undefined;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type GetEndpointRequestFunctionName = { endpoint: ApiEndpoint };
|
|
26
|
+
|
|
27
|
+
export type GetEndpointRequestFunction = {
|
|
28
|
+
endpoint: ApiEndpoint;
|
|
29
|
+
parameters: ApiParameterWithMultipartInfo[];
|
|
30
|
+
responseSchema: ApiSchema | undefined;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type GetEndpointRequestFunctionBody = {
|
|
34
|
+
endpoint: ApiEndpoint;
|
|
35
|
+
parameters: ApiParameterWithMultipartInfo[];
|
|
36
|
+
responseSchema: ApiSchema | undefined;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type GetEndpointFunctionWithHandler = {
|
|
40
|
+
endpoint: ApiEndpoint;
|
|
41
|
+
parameters: ApiParameterWithMultipartInfo[];
|
|
42
|
+
responseSchema: ApiSchema | undefined;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type GetEndpointFunctionWithHandlerBody = {
|
|
46
|
+
endpoint: ApiEndpoint;
|
|
47
|
+
parameters: ApiParameterWithMultipartInfo[];
|
|
48
|
+
responseSchema: ApiSchema | undefined;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type GetEndpointUriFunctionName = { endpoint: ApiEndpoint };
|
|
52
|
+
|
|
53
|
+
export type GetEndpointUriFunction = {
|
|
54
|
+
endpoint: ApiEndpoint;
|
|
55
|
+
parameters: ApiParameterWithMultipartInfo[];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type GetEndpointUriFunctionBody = {
|
|
59
|
+
endpoint: ApiEndpoint;
|
|
60
|
+
parameters: ApiParameterWithMultipartInfo[];
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type GetParameterToString = {
|
|
64
|
+
endpoint: ApiEndpoint;
|
|
65
|
+
parameter: ApiParameterWithMultipartInfo;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export type GetAdditionalClientMembers = object;
|
|
69
|
+
|
|
70
|
+
export type GetParameterType = { endpoint: ApiEndpoint; parameter: ApiParameterWithMultipartInfo };
|
|
71
|
+
|
|
72
|
+
export type GetRequestBodyType = { endpoint: ApiEndpoint };
|
|
73
|
+
|
|
74
|
+
export type GetParameterDefaultValue = {
|
|
75
|
+
endpoint: ApiEndpoint;
|
|
76
|
+
parameter: ApiParameter;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export type GetTypeUsage<TBuilder extends SourceBuilder> = {
|
|
80
|
+
schema: ApiSchema | undefined;
|
|
81
|
+
nullable?: boolean;
|
|
82
|
+
fallback?: kt.Type<TBuilder>;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export type GetPackageName = object;
|
|
86
|
+
|
|
87
|
+
export type GetResponseSchema = { endpoint: ApiEndpoint };
|
|
88
|
+
|
|
89
|
+
export type GetSchemaType = { schema: ApiSchema | undefined };
|
|
90
|
+
|
|
91
|
+
export type GetAllParameters = { endpoint: ApiEndpoint };
|
|
92
|
+
|
|
93
|
+
export type GetRequestBodyParamName = { endpoint: ApiEndpoint };
|
|
94
|
+
|
|
95
|
+
export type GetBasePath = object;
|
|
96
|
+
|
|
97
|
+
export type GetEndpointPath = { endpoint: ApiEndpoint };
|
|
98
|
+
|
|
99
|
+
export type GetFilePath = { packageName: string };
|
|
100
|
+
|
|
101
|
+
export type GetRequestsObjectName = object;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ApiEndpoint,
|
|
3
|
+
ApiService,
|
|
4
|
+
DefaultGenerationProviderConfig,
|
|
5
|
+
OpenApiServicesGenerationProviderContext,
|
|
6
|
+
} from '@goast/core';
|
|
7
|
+
|
|
8
|
+
import type { KotlinImport } from '../../../common-results.js';
|
|
9
|
+
import { defaultKotlinGeneratorConfig, type KotlinGeneratorConfig } from '../../../config.js';
|
|
10
|
+
import type { KotlinModelsGeneratorOutput } from '../../models/index.js';
|
|
11
|
+
import type { getReferenceFactories } from './refs.js';
|
|
12
|
+
|
|
13
|
+
export type KotlinSpringReactiveWebClientsGeneratorConfig = KotlinGeneratorConfig & {
|
|
14
|
+
packageName: string;
|
|
15
|
+
packageSuffix: string | ((service?: ApiService) => string);
|
|
16
|
+
infrastructurePackageName:
|
|
17
|
+
| string
|
|
18
|
+
| { mode: 'append-package-name' | 'append-full-package-name' | 'replace'; value: string };
|
|
19
|
+
|
|
20
|
+
basePath?: string | RegExp | ((basePath: string, service: ApiService) => string);
|
|
21
|
+
pathModifier?: RegExp | ((path: string, endpoint: ApiEndpoint) => string);
|
|
22
|
+
serializerJsonInclude: 'always' | 'non-null' | 'non-absent' | 'non-default' | 'non-empty' | 'use-defaults';
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const defaultKotlinSpringReactiveWebClientsGeneratorConfig: DefaultGenerationProviderConfig<
|
|
26
|
+
KotlinSpringReactiveWebClientsGeneratorConfig
|
|
27
|
+
> = {
|
|
28
|
+
...defaultKotlinGeneratorConfig,
|
|
29
|
+
|
|
30
|
+
packageName: 'com.openapi.generated',
|
|
31
|
+
packageSuffix: '.api.client',
|
|
32
|
+
infrastructurePackageName: { mode: 'append-full-package-name', value: '.infrastructure' },
|
|
33
|
+
serializerJsonInclude: 'non-absent',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type KotlinSpringReactiveWebClientsGeneratorInput = KotlinModelsGeneratorOutput;
|
|
37
|
+
|
|
38
|
+
export type KotlinSpringReactiveWebClientsGeneratorOutput = {
|
|
39
|
+
kotlin: {
|
|
40
|
+
clients: {
|
|
41
|
+
[serviceId: string]: KotlinSpringReactiveWebClientGeneratorOutput;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type KotlinSpringReactiveWebClientGeneratorOutput = KotlinImport;
|
|
47
|
+
|
|
48
|
+
export type KotlinSpringReactiveWebClientsGeneratorContext =
|
|
49
|
+
& OpenApiServicesGenerationProviderContext<
|
|
50
|
+
KotlinSpringReactiveWebClientsGeneratorInput,
|
|
51
|
+
KotlinSpringReactiveWebClientsGeneratorOutput,
|
|
52
|
+
KotlinSpringReactiveWebClientsGeneratorConfig,
|
|
53
|
+
KotlinSpringReactiveWebClientGeneratorOutput
|
|
54
|
+
>
|
|
55
|
+
& {
|
|
56
|
+
infrastructurePackageName: string;
|
|
57
|
+
refs: ReturnType<typeof getReferenceFactories>;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type KotlinSpringReactiveWebClientGeneratorContext = KotlinSpringReactiveWebClientsGeneratorContext & {
|
|
61
|
+
service: ApiService;
|
|
62
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { kt } from '../../../ast/index.js';
|
|
2
|
+
|
|
3
|
+
// See packages/kotlin/assets/client/spring-reactive-web-clients for reference
|
|
4
|
+
export function getReferenceFactories(infrastructurePackageName: string): {
|
|
5
|
+
apiRequestFile: kt.ReferenceFactory;
|
|
6
|
+
} {
|
|
7
|
+
return {
|
|
8
|
+
// ApiRequestFile.kt
|
|
9
|
+
apiRequestFile: kt.reference.factory('ApiRequestFile', infrastructurePackageName),
|
|
10
|
+
};
|
|
11
|
+
}
|