@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.
Files changed (109) hide show
  1. package/assets/client/okhttp3/Serializer.kt +2 -0
  2. package/assets/client/spring-reactive-web-clients/ApiRequestFile.kt +33 -0
  3. package/esm/src/ast/nodes/call.d.ts.map +1 -1
  4. package/esm/src/ast/nodes/call.js +11 -1
  5. package/esm/src/ast/nodes/lambda-type.d.ts +2 -0
  6. package/esm/src/ast/nodes/lambda-type.d.ts.map +1 -1
  7. package/esm/src/ast/nodes/lambda-type.js +11 -4
  8. package/esm/src/ast/nodes/lambda.d.ts.map +1 -1
  9. package/esm/src/ast/nodes/lambda.js +10 -5
  10. package/esm/src/ast/references/index.d.ts +2 -0
  11. package/esm/src/ast/references/index.d.ts.map +1 -1
  12. package/esm/src/ast/references/index.js +2 -0
  13. package/esm/src/ast/references/java.d.ts +1 -0
  14. package/esm/src/ast/references/java.d.ts.map +1 -1
  15. package/esm/src/ast/references/java.js +1 -0
  16. package/esm/src/ast/references/kotlinx.d.ts +5 -0
  17. package/esm/src/ast/references/kotlinx.d.ts.map +1 -0
  18. package/esm/src/ast/references/kotlinx.js +6 -0
  19. package/esm/src/ast/references/spring-reactive.d.ts +9 -0
  20. package/esm/src/ast/references/spring-reactive.d.ts.map +1 -0
  21. package/esm/src/ast/references/spring-reactive.js +10 -0
  22. package/esm/src/ast/references/spring.d.ts +4 -0
  23. package/esm/src/ast/references/spring.d.ts.map +1 -1
  24. package/esm/src/ast/references/spring.js +6 -0
  25. package/esm/src/generators/index.d.ts +1 -0
  26. package/esm/src/generators/index.d.ts.map +1 -1
  27. package/esm/src/generators/index.js +1 -0
  28. package/esm/src/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts +1 -2
  29. package/esm/src/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts.map +1 -1
  30. package/esm/src/generators/services/spring-reactive-web-clients/args.d.ts +99 -0
  31. package/esm/src/generators/services/spring-reactive-web-clients/args.d.ts.map +1 -0
  32. package/esm/src/generators/services/spring-reactive-web-clients/args.js +1 -0
  33. package/esm/src/generators/services/spring-reactive-web-clients/index.d.ts +5 -0
  34. package/esm/src/generators/services/spring-reactive-web-clients/index.d.ts.map +1 -0
  35. package/esm/src/generators/services/spring-reactive-web-clients/index.js +4 -0
  36. package/esm/src/generators/services/spring-reactive-web-clients/models.d.ts +34 -0
  37. package/esm/src/generators/services/spring-reactive-web-clients/models.d.ts.map +1 -0
  38. package/esm/src/generators/services/spring-reactive-web-clients/models.js +8 -0
  39. package/esm/src/generators/services/spring-reactive-web-clients/refs.d.ts +5 -0
  40. package/esm/src/generators/services/spring-reactive-web-clients/refs.d.ts.map +1 -0
  41. package/esm/src/generators/services/spring-reactive-web-clients/refs.js +8 -0
  42. package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.d.ts +46 -0
  43. package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.d.ts.map +1 -0
  44. package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.js +383 -0
  45. package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.d.ts +23 -0
  46. package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.d.ts.map +1 -0
  47. package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.js +79 -0
  48. package/package.json +2 -2
  49. package/script/src/ast/nodes/call.d.ts.map +1 -1
  50. package/script/src/ast/nodes/call.js +11 -1
  51. package/script/src/ast/nodes/lambda-type.d.ts +2 -0
  52. package/script/src/ast/nodes/lambda-type.d.ts.map +1 -1
  53. package/script/src/ast/nodes/lambda-type.js +11 -4
  54. package/script/src/ast/nodes/lambda.d.ts.map +1 -1
  55. package/script/src/ast/nodes/lambda.js +10 -5
  56. package/script/src/ast/references/index.d.ts +2 -0
  57. package/script/src/ast/references/index.d.ts.map +1 -1
  58. package/script/src/ast/references/index.js +3 -1
  59. package/script/src/ast/references/java.d.ts +1 -0
  60. package/script/src/ast/references/java.d.ts.map +1 -1
  61. package/script/src/ast/references/java.js +2 -1
  62. package/script/src/ast/references/kotlinx.d.ts +5 -0
  63. package/script/src/ast/references/kotlinx.d.ts.map +1 -0
  64. package/script/src/ast/references/kotlinx.js +9 -0
  65. package/script/src/ast/references/spring-reactive.d.ts +9 -0
  66. package/script/src/ast/references/spring-reactive.d.ts.map +1 -0
  67. package/script/src/ast/references/spring-reactive.js +13 -0
  68. package/script/src/ast/references/spring.d.ts +4 -0
  69. package/script/src/ast/references/spring.d.ts.map +1 -1
  70. package/script/src/ast/references/spring.js +7 -1
  71. package/script/src/generators/index.d.ts +1 -0
  72. package/script/src/generators/index.d.ts.map +1 -1
  73. package/script/src/generators/index.js +1 -0
  74. package/script/src/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts +1 -2
  75. package/script/src/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts.map +1 -1
  76. package/script/src/generators/services/spring-reactive-web-clients/args.d.ts +99 -0
  77. package/script/src/generators/services/spring-reactive-web-clients/args.d.ts.map +1 -0
  78. package/script/src/generators/services/spring-reactive-web-clients/args.js +2 -0
  79. package/script/src/generators/services/spring-reactive-web-clients/index.d.ts +5 -0
  80. package/script/src/generators/services/spring-reactive-web-clients/index.d.ts.map +1 -0
  81. package/script/src/generators/services/spring-reactive-web-clients/index.js +8 -0
  82. package/script/src/generators/services/spring-reactive-web-clients/models.d.ts +34 -0
  83. package/script/src/generators/services/spring-reactive-web-clients/models.d.ts.map +1 -0
  84. package/script/src/generators/services/spring-reactive-web-clients/models.js +11 -0
  85. package/script/src/generators/services/spring-reactive-web-clients/refs.d.ts +5 -0
  86. package/script/src/generators/services/spring-reactive-web-clients/refs.d.ts.map +1 -0
  87. package/script/src/generators/services/spring-reactive-web-clients/refs.js +11 -0
  88. package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.d.ts +46 -0
  89. package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.d.ts.map +1 -0
  90. package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.js +388 -0
  91. package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.d.ts +23 -0
  92. package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.d.ts.map +1 -0
  93. package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.js +84 -0
  94. package/src/src/ast/nodes/call.ts +10 -1
  95. package/src/src/ast/nodes/lambda-type.ts +7 -2
  96. package/src/src/ast/nodes/lambda.ts +10 -4
  97. package/src/src/ast/references/index.ts +2 -0
  98. package/src/src/ast/references/java.ts +1 -0
  99. package/src/src/ast/references/kotlinx.ts +14 -0
  100. package/src/src/ast/references/spring-reactive.ts +33 -0
  101. package/src/src/ast/references/spring.ts +14 -0
  102. package/src/src/generators/index.ts +1 -0
  103. package/src/src/generators/services/okhttp3-clients/okhttp3-client-generator.ts +1 -2
  104. package/src/src/generators/services/spring-reactive-web-clients/args.ts +101 -0
  105. package/src/src/generators/services/spring-reactive-web-clients/index.ts +4 -0
  106. package/src/src/generators/services/spring-reactive-web-clients/models.ts +62 -0
  107. package/src/src/generators/services/spring-reactive-web-clients/refs.ts +11 -0
  108. package/src/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.ts +572 -0
  109. 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
+ );
@@ -2,3 +2,4 @@ export * from './file-generator.js';
2
2
  export * from './models/index.js';
3
3
  export * from './services/okhttp3-clients/index.js';
4
4
  export * from './services/spring-controllers/index.js';
5
+ export * from './services/spring-reactive-web-clients/index.js';
@@ -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<KotlinImport> {
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,4 @@
1
+ export * as DefaultKotlinSpringReactiveWebClientGeneratorArgs from './args.js';
2
+ export * from './models.js';
3
+ export * from './spring-reactive-web-client-generator.js';
4
+ export * from './spring-reactive-web-clients-generator.js';
@@ -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
+ }