@goast/kotlin 0.5.7 → 0.5.9-beta.1

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 (118) hide show
  1. package/LICENSE +21 -21
  2. package/assets/client/okhttp3/ApiAbstractions.kt +30 -30
  3. package/assets/client/okhttp3/ApiClient.kt +253 -253
  4. package/assets/client/okhttp3/ApiResponse.kt +43 -43
  5. package/assets/client/okhttp3/Errors.kt +21 -21
  6. package/assets/client/okhttp3/PartConfig.kt +11 -11
  7. package/assets/client/okhttp3/RequestConfig.kt +18 -18
  8. package/assets/client/okhttp3/RequestMethod.kt +8 -8
  9. package/assets/client/okhttp3/ResponseExtensions.kt +24 -24
  10. package/assets/client/spring-reactive-web-clients/ApiRequestFile.kt +33 -33
  11. package/esm/src/ast/references/jackson.d.ts +8 -5
  12. package/esm/src/ast/references/jackson.d.ts.map +1 -1
  13. package/esm/src/ast/references/jackson.js +14 -6
  14. package/esm/src/config.d.ts +10 -0
  15. package/esm/src/config.d.ts.map +1 -1
  16. package/esm/src/config.js +1 -0
  17. package/esm/src/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts.map +1 -1
  18. package/esm/src/generators/services/okhttp3-clients/okhttp3-client-generator.js +36 -32
  19. package/esm/src/generators/services/okhttp3-clients/okhttp3-clients-generator.d.ts.map +1 -1
  20. package/esm/src/generators/services/okhttp3-clients/okhttp3-clients-generator.js +22 -6
  21. package/esm/src/generators/services/spring-controllers/spring-controller-generator.d.ts.map +1 -1
  22. package/esm/src/generators/services/spring-controllers/spring-controller-generator.js +23 -13
  23. package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.d.ts.map +1 -1
  24. package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.js +4 -1
  25. package/package.json +3 -3
  26. package/script/src/ast/references/jackson.d.ts +8 -5
  27. package/script/src/ast/references/jackson.d.ts.map +1 -1
  28. package/script/src/ast/references/jackson.js +20 -7
  29. package/script/src/config.d.ts +10 -0
  30. package/script/src/config.d.ts.map +1 -1
  31. package/script/src/config.js +1 -0
  32. package/script/src/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts.map +1 -1
  33. package/script/src/generators/services/okhttp3-clients/okhttp3-client-generator.js +36 -32
  34. package/script/src/generators/services/okhttp3-clients/okhttp3-clients-generator.d.ts.map +1 -1
  35. package/script/src/generators/services/okhttp3-clients/okhttp3-clients-generator.js +22 -6
  36. package/script/src/generators/services/spring-controllers/spring-controller-generator.d.ts.map +1 -1
  37. package/script/src/generators/services/spring-controllers/spring-controller-generator.js +23 -13
  38. package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.d.ts.map +1 -1
  39. package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.js +4 -1
  40. package/src/mod.ts +0 -8
  41. package/src/src/assets.ts +0 -9
  42. package/src/src/ast/_index.ts +0 -66
  43. package/src/src/ast/common.ts +0 -1
  44. package/src/src/ast/index.ts +0 -1
  45. package/src/src/ast/node.ts +0 -10
  46. package/src/src/ast/nodes/annotation.ts +0 -79
  47. package/src/src/ast/nodes/argument.ts +0 -62
  48. package/src/src/ast/nodes/call.ts +0 -75
  49. package/src/src/ast/nodes/class.ts +0 -178
  50. package/src/src/ast/nodes/collection-literal.ts +0 -49
  51. package/src/src/ast/nodes/constructor.ts +0 -126
  52. package/src/src/ast/nodes/doc-tag.ts +0 -138
  53. package/src/src/ast/nodes/doc.ts +0 -111
  54. package/src/src/ast/nodes/enum-value.ts +0 -100
  55. package/src/src/ast/nodes/enum.ts +0 -163
  56. package/src/src/ast/nodes/function.ts +0 -178
  57. package/src/src/ast/nodes/generic-parameter.ts +0 -54
  58. package/src/src/ast/nodes/init-block.ts +0 -38
  59. package/src/src/ast/nodes/interface.ts +0 -133
  60. package/src/src/ast/nodes/lambda-type.ts +0 -73
  61. package/src/src/ast/nodes/lambda.ts +0 -74
  62. package/src/src/ast/nodes/object.ts +0 -102
  63. package/src/src/ast/nodes/parameter.ts +0 -118
  64. package/src/src/ast/nodes/property.ts +0 -225
  65. package/src/src/ast/nodes/reference.ts +0 -178
  66. package/src/src/ast/nodes/string.ts +0 -114
  67. package/src/src/ast/nodes/types.ts +0 -23
  68. package/src/src/ast/references/index.ts +0 -10
  69. package/src/src/ast/references/jackson.ts +0 -44
  70. package/src/src/ast/references/jakarta.ts +0 -14
  71. package/src/src/ast/references/java.ts +0 -27
  72. package/src/src/ast/references/kotlin.ts +0 -41
  73. package/src/src/ast/references/kotlinx.ts +0 -14
  74. package/src/src/ast/references/okhttp3.ts +0 -5
  75. package/src/src/ast/references/reactor.ts +0 -5
  76. package/src/src/ast/references/spring-reactive.ts +0 -33
  77. package/src/src/ast/references/spring.ts +0 -86
  78. package/src/src/ast/references/swagger.ts +0 -23
  79. package/src/src/ast/utils/get-kotlin-builder-options.ts +0 -19
  80. package/src/src/ast/utils/to-kt-node.ts +0 -31
  81. package/src/src/ast/utils/write-kt-annotations.ts +0 -15
  82. package/src/src/ast/utils/write-kt-arguments.ts +0 -45
  83. package/src/src/ast/utils/write-kt-enum-values.ts +0 -27
  84. package/src/src/ast/utils/write-kt-generic-parameters.ts +0 -12
  85. package/src/src/ast/utils/write-kt-members.ts +0 -25
  86. package/src/src/ast/utils/write-kt-node.ts +0 -37
  87. package/src/src/ast/utils/write-kt-parameters.ts +0 -25
  88. package/src/src/common-results.ts +0 -4
  89. package/src/src/config.ts +0 -48
  90. package/src/src/file-builder.ts +0 -112
  91. package/src/src/generators/file-generator.ts +0 -29
  92. package/src/src/generators/index.ts +0 -5
  93. package/src/src/generators/models/args.ts +0 -136
  94. package/src/src/generators/models/index.ts +0 -4
  95. package/src/src/generators/models/model-generator.ts +0 -725
  96. package/src/src/generators/models/models-generator.ts +0 -65
  97. package/src/src/generators/models/models.ts +0 -95
  98. package/src/src/generators/services/okhttp3-clients/args.ts +0 -90
  99. package/src/src/generators/services/okhttp3-clients/index.ts +0 -4
  100. package/src/src/generators/services/okhttp3-clients/models.ts +0 -73
  101. package/src/src/generators/services/okhttp3-clients/okhttp3-client-generator.ts +0 -609
  102. package/src/src/generators/services/okhttp3-clients/okhttp3-clients-generator.ts +0 -169
  103. package/src/src/generators/services/okhttp3-clients/refs.ts +0 -59
  104. package/src/src/generators/services/spring-controllers/args.ts +0 -95
  105. package/src/src/generators/services/spring-controllers/index.ts +0 -4
  106. package/src/src/generators/services/spring-controllers/models.ts +0 -76
  107. package/src/src/generators/services/spring-controllers/refs.ts +0 -17
  108. package/src/src/generators/services/spring-controllers/spring-controller-generator.ts +0 -1097
  109. package/src/src/generators/services/spring-controllers/spring-controllers-generator.ts +0 -140
  110. package/src/src/generators/services/spring-reactive-web-clients/args.ts +0 -103
  111. package/src/src/generators/services/spring-reactive-web-clients/index.ts +0 -4
  112. package/src/src/generators/services/spring-reactive-web-clients/models.ts +0 -62
  113. package/src/src/generators/services/spring-reactive-web-clients/refs.ts +0 -11
  114. package/src/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.ts +0 -583
  115. package/src/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.ts +0 -125
  116. package/src/src/import-collection.ts +0 -98
  117. package/src/src/types.ts +0 -3
  118. package/src/src/utils.ts +0 -47
@@ -1,43 +1,43 @@
1
- package @PACKAGE_NAME@
2
-
3
- enum class ResponseType {
4
- Success, Informational, Redirection, ClientError, ServerError
5
- }
6
-
7
- interface Response
8
-
9
- abstract class ApiResponse<T>(val responseType: ResponseType) : Response {
10
- abstract val statusCode: Int
11
- abstract val headers: Map<String, List<String>>
12
- }
13
-
14
- class Success<T>(
15
- val data: T,
16
- override val statusCode: Int = -1,
17
- override val headers: Map<String, List<String>> = mapOf()
18
- ) : ApiResponse<T>(ResponseType.Success)
19
-
20
- class Informational<T>(
21
- val statusText: String,
22
- override val statusCode: Int = -1,
23
- override val headers: Map<String, List<String>> = mapOf()
24
- ) : ApiResponse<T>(ResponseType.Informational)
25
-
26
- class Redirection<T>(
27
- override val statusCode: Int = -1,
28
- override val headers: Map<String, List<String>> = mapOf()
29
- ) : ApiResponse<T>(ResponseType.Redirection)
30
-
31
- class ClientError<T>(
32
- val message: String? = null,
33
- val body: Any? = null,
34
- override val statusCode: Int = -1,
35
- override val headers: Map<String, List<String>> = mapOf()
36
- ) : ApiResponse<T>(ResponseType.ClientError)
37
-
38
- class ServerError<T>(
39
- val message: String? = null,
40
- val body: Any? = null,
41
- override val statusCode: Int = -1,
42
- override val headers: Map<String, List<String>>
43
- ) : ApiResponse<T>(ResponseType.ServerError)
1
+ package @PACKAGE_NAME@
2
+
3
+ enum class ResponseType {
4
+ Success, Informational, Redirection, ClientError, ServerError
5
+ }
6
+
7
+ interface Response
8
+
9
+ abstract class ApiResponse<T>(val responseType: ResponseType) : Response {
10
+ abstract val statusCode: Int
11
+ abstract val headers: Map<String, List<String>>
12
+ }
13
+
14
+ class Success<T>(
15
+ val data: T,
16
+ override val statusCode: Int = -1,
17
+ override val headers: Map<String, List<String>> = mapOf()
18
+ ) : ApiResponse<T>(ResponseType.Success)
19
+
20
+ class Informational<T>(
21
+ val statusText: String,
22
+ override val statusCode: Int = -1,
23
+ override val headers: Map<String, List<String>> = mapOf()
24
+ ) : ApiResponse<T>(ResponseType.Informational)
25
+
26
+ class Redirection<T>(
27
+ override val statusCode: Int = -1,
28
+ override val headers: Map<String, List<String>> = mapOf()
29
+ ) : ApiResponse<T>(ResponseType.Redirection)
30
+
31
+ class ClientError<T>(
32
+ val message: String? = null,
33
+ val body: Any? = null,
34
+ override val statusCode: Int = -1,
35
+ override val headers: Map<String, List<String>> = mapOf()
36
+ ) : ApiResponse<T>(ResponseType.ClientError)
37
+
38
+ class ServerError<T>(
39
+ val message: String? = null,
40
+ val body: Any? = null,
41
+ override val statusCode: Int = -1,
42
+ override val headers: Map<String, List<String>>
43
+ ) : ApiResponse<T>(ResponseType.ServerError)
@@ -1,21 +1,21 @@
1
- @file:Suppress("unused")
2
-
3
- package @PACKAGE_NAME@
4
-
5
- import java.lang.RuntimeException
6
-
7
- open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) :
8
- RuntimeException(message) {
9
-
10
- companion object {
11
- private const val serialVersionUID: Long = 123L
12
- }
13
- }
14
-
15
- open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) :
16
- RuntimeException(message) {
17
-
18
- companion object {
19
- private const val serialVersionUID: Long = 456L
20
- }
21
- }
1
+ @file:Suppress("unused")
2
+
3
+ package @PACKAGE_NAME@
4
+
5
+ import java.lang.RuntimeException
6
+
7
+ open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) :
8
+ RuntimeException(message) {
9
+
10
+ companion object {
11
+ private const val serialVersionUID: Long = 123L
12
+ }
13
+ }
14
+
15
+ open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) :
16
+ RuntimeException(message) {
17
+
18
+ companion object {
19
+ private const val serialVersionUID: Long = 456L
20
+ }
21
+ }
@@ -1,11 +1,11 @@
1
- package @PACKAGE_NAME@
2
-
3
- /**
4
- * Defines a config object for a given part of a multi-part request.
5
- * NOTE: Headers is a Map<String,String> because rfc2616 defines
6
- * multi-valued headers as csv-only.
7
- */
8
- data class PartConfig<T>(
9
- val headers: MutableMap<String, String> = mutableMapOf(),
10
- val body: T? = null
11
- )
1
+ package @PACKAGE_NAME@
2
+
3
+ /**
4
+ * Defines a config object for a given part of a multi-part request.
5
+ * NOTE: Headers is a Map<String,String> because rfc2616 defines
6
+ * multi-valued headers as csv-only.
7
+ */
8
+ data class PartConfig<T>(
9
+ val headers: MutableMap<String, String> = mutableMapOf(),
10
+ val body: T? = null
11
+ )
@@ -1,18 +1,18 @@
1
- package @PACKAGE_NAME@
2
-
3
- /**
4
- * Defines a config object for a given request.
5
- * NOTE: This object doesn't include 'body' because it
6
- * allows for caching of the constructed object
7
- * for many request definitions.
8
- * NOTE: Headers is a Map<String,String> because rfc2616 defines
9
- * multi-valued headers as csv-only.
10
- */
11
- data class RequestConfig<T>(
12
- val method: RequestMethod,
13
- val path: String,
14
- val headers: MutableMap<String, String> = mutableMapOf(),
15
- val query: MutableMap<String, List<String>> = mutableMapOf(),
16
- val requiresAuthentication: Boolean,
17
- val body: T? = null
18
- )
1
+ package @PACKAGE_NAME@
2
+
3
+ /**
4
+ * Defines a config object for a given request.
5
+ * NOTE: This object doesn't include 'body' because it
6
+ * allows for caching of the constructed object
7
+ * for many request definitions.
8
+ * NOTE: Headers is a Map<String,String> because rfc2616 defines
9
+ * multi-valued headers as csv-only.
10
+ */
11
+ data class RequestConfig<T>(
12
+ val method: RequestMethod,
13
+ val path: String,
14
+ val headers: MutableMap<String, String> = mutableMapOf(),
15
+ val query: MutableMap<String, List<String>> = mutableMapOf(),
16
+ val requiresAuthentication: Boolean,
17
+ val body: T? = null
18
+ )
@@ -1,8 +1,8 @@
1
- package @PACKAGE_NAME@
2
-
3
- /**
4
- * Provides enumerated HTTP verbs
5
- */
6
- enum class RequestMethod {
7
- GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT
8
- }
1
+ package @PACKAGE_NAME@
2
+
3
+ /**
4
+ * Provides enumerated HTTP verbs
5
+ */
6
+ enum class RequestMethod {
7
+ GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT
8
+ }
@@ -1,24 +1,24 @@
1
- package @PACKAGE_NAME@
2
-
3
- import okhttp3.Response
4
-
5
- /**
6
- * Provides an extension to evaluation whether the response is a 1xx code
7
- */
8
- val Response.isInformational: Boolean get() = this.code in 100..199
9
-
10
- /**
11
- * Provides an extension to evaluation whether the response is a 3xx code
12
- */
13
- @Suppress("EXTENSION_SHADOWED_BY_MEMBER")
14
- val Response.isRedirect: Boolean get() = this.code in 300..399
15
-
16
- /**
17
- * Provides an extension to evaluation whether the response is a 4xx code
18
- */
19
- val Response.isClientError: Boolean get() = this.code in 400..499
20
-
21
- /**
22
- * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
23
- */
24
- val Response.isServerError: Boolean get() = this.code in 500..999
1
+ package @PACKAGE_NAME@
2
+
3
+ import okhttp3.Response
4
+
5
+ /**
6
+ * Provides an extension to evaluation whether the response is a 1xx code
7
+ */
8
+ val Response.isInformational: Boolean get() = this.code in 100..199
9
+
10
+ /**
11
+ * Provides an extension to evaluation whether the response is a 3xx code
12
+ */
13
+ @Suppress("EXTENSION_SHADOWED_BY_MEMBER")
14
+ val Response.isRedirect: Boolean get() = this.code in 300..399
15
+
16
+ /**
17
+ * Provides an extension to evaluation whether the response is a 4xx code
18
+ */
19
+ val Response.isClientError: Boolean get() = this.code in 400..499
20
+
21
+ /**
22
+ * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
23
+ */
24
+ val Response.isServerError: Boolean get() = this.code in 500..999
@@ -1,33 +1,33 @@
1
- package @PACKAGE_NAME@
2
-
3
- import org.springframework.core.io.buffer.DataBuffer
4
- import org.springframework.http.MediaType
5
- import org.springframework.http.client.MultipartBodyBuilder
6
- import org.springframework.http.codec.multipart.FilePart
7
- import java.io.File
8
-
9
- interface ApiRequestFile {
10
- companion object {
11
- fun from(file: File): ApiRequestFile =
12
- object : ApiRequestFile {
13
- override fun addToBuilder(builder: MultipartBodyBuilder) {
14
- builder
15
- .part("file", file)
16
- .filename(file.name)
17
- .contentType(MediaType.APPLICATION_OCTET_STREAM)
18
- }
19
- }
20
-
21
- fun from(filePart: FilePart): ApiRequestFile =
22
- object : ApiRequestFile {
23
- override fun addToBuilder(builder: MultipartBodyBuilder) {
24
- builder
25
- .asyncPart("file", filePart.content(), DataBuffer::class.java)
26
- .filename(filePart.filename())
27
- .contentType(filePart.headers().contentType ?: MediaType.APPLICATION_OCTET_STREAM)
28
- }
29
- }
30
- }
31
-
32
- fun addToBuilder(builder: MultipartBodyBuilder)
33
- }
1
+ package @PACKAGE_NAME@
2
+
3
+ import org.springframework.core.io.buffer.DataBuffer
4
+ import org.springframework.http.MediaType
5
+ import org.springframework.http.client.MultipartBodyBuilder
6
+ import org.springframework.http.codec.multipart.FilePart
7
+ import java.io.File
8
+
9
+ interface ApiRequestFile {
10
+ companion object {
11
+ fun from(file: File): ApiRequestFile =
12
+ object : ApiRequestFile {
13
+ override fun addToBuilder(builder: MultipartBodyBuilder) {
14
+ builder
15
+ .part("file", file)
16
+ .filename(file.name)
17
+ .contentType(MediaType.APPLICATION_OCTET_STREAM)
18
+ }
19
+ }
20
+
21
+ fun from(filePart: FilePart): ApiRequestFile =
22
+ object : ApiRequestFile {
23
+ override fun addToBuilder(builder: MultipartBodyBuilder) {
24
+ builder
25
+ .asyncPart("file", filePart.content(), DataBuffer::class.java)
26
+ .filename(filePart.filename())
27
+ .contentType(filePart.headers().contentType ?: MediaType.APPLICATION_OCTET_STREAM)
28
+ }
29
+ }
30
+ }
31
+
32
+ fun addToBuilder(builder: MultipartBodyBuilder)
33
+ }
@@ -1,4 +1,6 @@
1
- import { type KtReferenceFactory } from '../nodes/reference.js';
1
+ import type { SourceBuilder } from '@goast/core';
2
+ import type { SpringBootVersion } from '../../config.js';
3
+ import { type KtReference, type KtReferenceFactory } from '../nodes/reference.js';
2
4
  export declare const jsonTypeInfo: KtReferenceFactory;
3
5
  export declare const jsonSubTypes: KtReferenceFactory;
4
6
  export declare const jsonClassDescription: KtReferenceFactory;
@@ -8,8 +10,9 @@ export declare const jsonInclude: KtReferenceFactory;
8
10
  export declare const jsonIgnore: KtReferenceFactory;
9
11
  export declare const jsonAnySetter: KtReferenceFactory;
10
12
  export declare const jsonAnyGetter: KtReferenceFactory;
11
- export declare const objectMapper: KtReferenceFactory;
12
- export declare const serializationFeature: KtReferenceFactory;
13
- export declare const deserializationFeature: KtReferenceFactory;
14
- export declare const jacksonObjectMapper: KtReferenceFactory;
13
+ export declare const objectMapper: <TBuilder extends SourceBuilder>(springBootVersion?: SpringBootVersion) => KtReference<TBuilder>;
14
+ export declare const serializationFeature: <TBuilder extends SourceBuilder>(springBootVersion?: SpringBootVersion) => KtReference<TBuilder>;
15
+ export declare const deserializationFeature: <TBuilder extends SourceBuilder>(springBootVersion?: SpringBootVersion) => KtReference<TBuilder>;
16
+ export declare const jacksonObjectMapper: <TBuilder extends SourceBuilder>(springBootVersion?: SpringBootVersion) => KtReference<TBuilder>;
17
+ export declare const jacksonMapperBuilder: <TBuilder extends SourceBuilder>(springBootVersion?: SpringBootVersion) => KtReference<TBuilder>;
15
18
  //# sourceMappingURL=jackson.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jackson.d.ts","sourceRoot":"","sources":["../../../../src/src/ast/references/jackson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG7E,eAAO,MAAM,YAAY,EAAE,kBAA4F,CAAC;AACxH,eAAO,MAAM,YAAY,EAAE,kBAA4F,CAAC;AACxH,eAAO,MAAM,oBAAoB,EAAE,kBAGlC,CAAC;AACF,eAAO,MAAM,YAAY,EAAE,kBAA4F,CAAC;AACxH,eAAO,MAAM,uBAAuB,EAAE,kBAGrC,CAAC;AACF,eAAO,MAAM,WAAW,EAAE,kBAA2F,CAAC;AACtH,eAAO,MAAM,UAAU,EAAE,kBAA0F,CAAC;AACpH,eAAO,MAAM,aAAa,EAAE,kBAG3B,CAAC;AACF,eAAO,MAAM,aAAa,EAAE,kBAG3B,CAAC;AAGF,eAAO,MAAM,YAAY,EAAE,kBAG1B,CAAC;AACF,eAAO,MAAM,oBAAoB,EAAE,kBAGlC,CAAC;AACF,eAAO,MAAM,sBAAsB,EAAE,kBAGpC,CAAC;AAGF,eAAO,MAAM,mBAAmB,EAAE,kBAGjC,CAAC"}
1
+ {"version":3,"file":"jackson.d.ts","sourceRoot":"","sources":["../../../../src/src/ast/references/jackson.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,KAAK,WAAW,EAAe,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAY/F,eAAO,MAAM,YAAY,EAAE,kBAA4F,CAAC;AACxH,eAAO,MAAM,YAAY,EAAE,kBAA4F,CAAC;AACxH,eAAO,MAAM,oBAAoB,EAAE,kBAGlC,CAAC;AACF,eAAO,MAAM,YAAY,EAAE,kBAA4F,CAAC;AACxH,eAAO,MAAM,uBAAuB,EAAE,kBAGrC,CAAC;AACF,eAAO,MAAM,WAAW,EAAE,kBAA2F,CAAC;AACtH,eAAO,MAAM,UAAU,EAAE,kBAA0F,CAAC;AACpH,eAAO,MAAM,aAAa,EAAE,kBAG3B,CAAC;AACF,eAAO,MAAM,aAAa,EAAE,kBAG3B,CAAC;AAGF,eAAO,MAAM,YAAY,GAAI,QAAQ,SAAS,aAAa,sBACtC,iBAAiB,KACnC,WAAW,CAAC,QAAQ,CAAyF,CAAC;AACjH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,SAAS,aAAa,sBAC9C,iBAAiB,KACnC,WAAW,CAAC,QAAQ,CACuE,CAAC;AAC/F,eAAO,MAAM,sBAAsB,GAAI,QAAQ,SAAS,aAAa,sBAChD,iBAAiB,KACnC,WAAW,CAAC,QAAQ,CACyE,CAAC;AAGjG,eAAO,MAAM,mBAAmB,GAAI,QAAQ,SAAS,aAAa,sBAC7C,iBAAiB,KACnC,WAAW,CAAC,QAAQ,CAC2E,CAAC;AACnG,eAAO,MAAM,oBAAoB,GAAI,QAAQ,SAAS,aAAa,sBAC9C,iBAAiB,KACnC,WAAW,CAAC,QAAQ,CAC4E,CAAC"}
@@ -1,4 +1,11 @@
1
1
  import { ktReference } from '../nodes/reference.js';
2
+ /**
3
+ * Resolves a Jackson package name for the targeted Spring Boot version.
4
+ *
5
+ * Jackson 3 (the default in Spring Boot 4) moved every package **except annotations** from
6
+ * `com.fasterxml.jackson.*` to `tools.jackson.*`. Annotations stay on `com.fasterxml.jackson.annotation`.
7
+ */
8
+ const jacksonPackage = (subPackage, springBootVersion) => `${springBootVersion === 4 ? 'tools.jackson' : 'com.fasterxml.jackson'}.${subPackage}`;
2
9
  // com.fasterxml.jackson.annotation
3
10
  export const jsonTypeInfo = ktReference.factory('JsonTypeInfo', 'com.fasterxml.jackson.annotation');
4
11
  export const jsonSubTypes = ktReference.factory('JsonSubTypes', 'com.fasterxml.jackson.annotation');
@@ -9,9 +16,10 @@ export const jsonInclude = ktReference.factory('JsonInclude', 'com.fasterxml.jac
9
16
  export const jsonIgnore = ktReference.factory('JsonIgnore', 'com.fasterxml.jackson.annotation');
10
17
  export const jsonAnySetter = ktReference.factory('JsonAnySetter', 'com.fasterxml.jackson.annotation');
11
18
  export const jsonAnyGetter = ktReference.factory('JsonAnyGetter', 'com.fasterxml.jackson.annotation');
12
- // com.fasterxml.jackson.databind
13
- export const objectMapper = ktReference.factory('ObjectMapper', 'com.fasterxml.jackson.databind');
14
- export const serializationFeature = ktReference.factory('SerializationFeature', 'com.fasterxml.jackson.databind');
15
- export const deserializationFeature = ktReference.factory('DeserializationFeature', 'com.fasterxml.jackson.databind');
16
- // com.fasterxml.jackson.module.kotlin
17
- export const jacksonObjectMapper = ktReference.factory('jacksonObjectMapper', 'com.fasterxml.jackson.module.kotlin');
19
+ // com.fasterxml.jackson.databind (Jackson 2) / tools.jackson.databind (Jackson 3, Spring Boot 4)
20
+ export const objectMapper = (springBootVersion = 3) => ktReference('ObjectMapper', jacksonPackage('databind', springBootVersion));
21
+ export const serializationFeature = (springBootVersion = 3) => ktReference('SerializationFeature', jacksonPackage('databind', springBootVersion));
22
+ export const deserializationFeature = (springBootVersion = 3) => ktReference('DeserializationFeature', jacksonPackage('databind', springBootVersion));
23
+ // com.fasterxml.jackson.module.kotlin (Jackson 2) / tools.jackson.module.kotlin (Jackson 3, Spring Boot 4)
24
+ export const jacksonObjectMapper = (springBootVersion = 3) => ktReference('jacksonObjectMapper', jacksonPackage('module.kotlin', springBootVersion));
25
+ export const jacksonMapperBuilder = (springBootVersion = 3) => ktReference('jacksonMapperBuilder', jacksonPackage('module.kotlin', springBootVersion));
@@ -1,4 +1,6 @@
1
1
  import type { DefaultGenerationProviderConfig, OpenApiGeneratorConfig, StringCasing, StringCasingWithOptions } from '@goast/core';
2
+ /** The Spring Boot major version the Kotlin generators target. */
3
+ export type SpringBootVersion = 3 | 4;
2
4
  export type KotlinGeneratorConfig = OpenApiGeneratorConfig & {
3
5
  typeNameCasing: StringCasing | StringCasingWithOptions;
4
6
  parameterNameCasing: StringCasing | StringCasingWithOptions;
@@ -12,6 +14,14 @@ export type KotlinGeneratorConfig = OpenApiGeneratorConfig & {
12
14
  * @default false
13
15
  */
14
16
  includeSourceInDocs: boolean;
17
+ /**
18
+ * The targeted Spring Boot major version. Controls Jackson package names, Kotlin generic bounds, and
19
+ * `ResponseEntity` nullability so the generated code compiles against the matching framework generation.
20
+ * - `3`: Spring Boot 3 (Spring Framework 6 / Jackson 2). Produces output identical to previous versions.
21
+ * - `4`: Spring Boot 4 (Spring Framework 7 / Jackson 3 / JSpecify null-safety).
22
+ * @default 3
23
+ */
24
+ springBootVersion: SpringBootVersion;
15
25
  };
16
26
  export declare const defaultKotlinGeneratorConfig: DefaultGenerationProviderConfig<KotlinGeneratorConfig>;
17
27
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,+BAA+B,EAC/B,sBAAsB,EACtB,YAAY,EACZ,uBAAuB,EACxB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,qBAAqB,GAAG,sBAAsB,GAAG;IAC3D,cAAc,EAAE,YAAY,GAAG,uBAAuB,CAAC;IACvD,mBAAmB,EAAE,YAAY,GAAG,uBAAuB,CAAC;IAC5D,kBAAkB,EAAE,YAAY,GAAG,uBAAuB,CAAC;IAC3D,kBAAkB,EAAE,YAAY,GAAG,uBAAuB,CAAC;IAC3D,mBAAmB,EAAE,YAAY,GAAG,uBAAuB,CAAC;IAC5D,kBAAkB,EAAE,YAAY,GAAG,uBAAuB,CAAC;IAE3D,aAAa,EAAE,MAAM,EAAE,CAAC;IAExB;;;OAGG;IACH,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,+BAA+B,CAAC,qBAAqB,CAuB/F,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,+BAA+B,EAC/B,sBAAsB,EACtB,YAAY,EACZ,uBAAuB,EACxB,MAAM,aAAa,CAAC;AAErB,kEAAkE;AAClE,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,CAAC,CAAC;AAEtC,MAAM,MAAM,qBAAqB,GAAG,sBAAsB,GAAG;IAC3D,cAAc,EAAE,YAAY,GAAG,uBAAuB,CAAC;IACvD,mBAAmB,EAAE,YAAY,GAAG,uBAAuB,CAAC;IAC5D,kBAAkB,EAAE,YAAY,GAAG,uBAAuB,CAAC;IAC3D,kBAAkB,EAAE,YAAY,GAAG,uBAAuB,CAAC;IAC3D,mBAAmB,EAAE,YAAY,GAAG,uBAAuB,CAAC;IAC5D,kBAAkB,EAAE,YAAY,GAAG,uBAAuB,CAAC;IAE3D,aAAa,EAAE,MAAM,EAAE,CAAC;IAExB;;;OAGG;IACH,mBAAmB,EAAE,OAAO,CAAC;IAE7B;;;;;;OAMG;IACH,iBAAiB,EAAE,iBAAiB,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,+BAA+B,CAAC,qBAAqB,CAwB/F,CAAC"}
package/esm/src/config.js CHANGED
@@ -19,4 +19,5 @@ export const defaultKotlinGeneratorConfig = {
19
19
  'kotlin.jvm.*',
20
20
  ],
21
21
  includeSourceInDocs: false,
22
+ springBootVersion: 3,
22
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"okhttp3-client-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/okhttp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,EAAE,IAAI,CAAC,uBAAuB,GAAG,MAAM;IAU3F,SAAS,CAAC,yBAAyB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,yBAAyB,GAAG,gBAAgB,CAAC,OAAO,CAAC;IAUlH,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,GAAG,MAAM;IAQpE,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,eAAe,GAAG,MAAM;IAK3E,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,GAAG,MAAM;IAKnE,SAAS,CAAC,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,gBAAgB,GAAG,MAAM;IAI9E,OAAO,CAAC,kBAAkB;CAgB3B"}
1
+ {"version":3,"file":"okhttp3-client-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/okhttp3-clients/okhttp3-client-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,gBAAgB,EAErB,KAAK,gBAAgB,EAIrB,KAAK,YAAY,EAGjB,aAAa,EAEd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,iCAAiC,IAAI,IAAI,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,KAAK,EAAE,mCAAmC,EAAE,kCAAkC,EAAE,MAAM,aAAa,CAAC;AAE3G,KAAK,OAAO,GAAG,mCAAmC,CAAC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,OAAO,CAAC,kBAAkB;CAgB3B"}
@@ -30,14 +30,18 @@ export class DefaultKotlinOkHttp3Generator extends KotlinFileGenerator {
30
30
  ],
31
31
  extends: ctx.refs.apiClient(),
32
32
  primaryConstructor: kt.constructor([
33
- serializerAsParameter ? kt.parameter('objectMapper', kt.refs.jackson.objectMapper()) : null,
33
+ serializerAsParameter
34
+ ? kt.parameter('objectMapper', kt.refs.jackson.objectMapper(ctx.config.springBootVersion))
35
+ : null,
34
36
  kt.parameter('basePath', kt.refs.string(), { default: 'defaultBasePath' }),
35
37
  kt.parameter('client', kt.refs.okhttp3.okHttpClient(), {
36
38
  default: 'defaultClient',
37
39
  }),
38
- serializerAsParameter ? null : kt.parameter('objectMapper', kt.refs.jackson.objectMapper(), {
39
- default: kt.call([ctx.refs.serializer(), 'jacksonObjectMapper']),
40
- }),
40
+ serializerAsParameter
41
+ ? null
42
+ : kt.parameter('objectMapper', kt.refs.jackson.objectMapper(ctx.config.springBootVersion), {
43
+ default: kt.call([ctx.refs.serializer(), 'jacksonObjectMapper']),
44
+ }),
41
45
  ], null, {
42
46
  delegateTarget: 'super',
43
47
  delegateArguments: ['basePath', 'objectMapper', 'client'],
@@ -105,31 +109,31 @@ export class DefaultKotlinOkHttp3Generator extends KotlinFileGenerator {
105
109
  return appendValueGroup([
106
110
  s `val localVarResponse = ${kt.call([toCasing(endpoint.name + '_WithHttpInfo', ctx.config.functionNameCasing)], parameters.map((x) => toCasing(x.name, ctx.config.parameterNameCasing)))}`,
107
111
  '',
108
- s `return when (localVarResponse.responseType) {${s.indent `
112
+ s `return when (localVarResponse.responseType) {${s.indent `
109
113
  ${ctx.refs.responseType()}.Success -> ${responseSchema === undefined
110
114
  ? kt.refs.unit()
111
115
  : s `(localVarResponse as ${ctx.refs.success(['*'])}).data as ${this.getTypeUsage(ctx, {
112
116
  schema: responseSchema,
113
- })}`}
114
- ${ctx.refs.responseType()}.Informational -> throw ${kt.refs.java.unsupportedOperationException()}("Client does not support Informational responses.")
115
- ${ctx.refs.responseType()}.Redirection -> throw ${kt.refs.java.unsupportedOperationException()}("Client does not support Redirection responses.")
116
- ${ctx.refs.responseType()}.ClientError -> {${s.indent `
117
- val localVarError = localVarResponse as ${ctx.refs.clientError(['*'])}
118
- throw ${ctx.refs.clientException()}(${s.indent `
119
- "Client error : \${localVarError.statusCode} \${localVarError.message.orEmpty()}",
120
- localVarError.statusCode,
121
- localVarResponse`}
122
- )`}
123
- }
124
-
125
- ${ctx.refs.responseType()}.ServerError -> {${s.indent `
126
- val localVarError = localVarResponse as ${ctx.refs.serverError(['*'])}
127
- throw ${ctx.refs.serverException()}(${s.indent `
128
- "Server error : \${localVarError.statusCode} \${localVarError.message.orEmpty()}",
129
- localVarError.statusCode,
130
- localVarResponse`}
131
- )`}
132
- }`}
117
+ })}`}
118
+ ${ctx.refs.responseType()}.Informational -> throw ${kt.refs.java.unsupportedOperationException()}("Client does not support Informational responses.")
119
+ ${ctx.refs.responseType()}.Redirection -> throw ${kt.refs.java.unsupportedOperationException()}("Client does not support Redirection responses.")
120
+ ${ctx.refs.responseType()}.ClientError -> {${s.indent `
121
+ val localVarError = localVarResponse as ${ctx.refs.clientError(['*'])}
122
+ throw ${ctx.refs.clientException()}(${s.indent `
123
+ "Client error : \${localVarError.statusCode} \${localVarError.message.orEmpty()}",
124
+ localVarError.statusCode,
125
+ localVarResponse`}
126
+ )`}
127
+ }
128
+
129
+ ${ctx.refs.responseType()}.ServerError -> {${s.indent `
130
+ val localVarError = localVarResponse as ${ctx.refs.serverError(['*'])}
131
+ throw ${ctx.refs.serverException()}(${s.indent `
132
+ "Server error : \${localVarError.statusCode} \${localVarError.message.orEmpty()}",
133
+ localVarError.statusCode,
134
+ localVarResponse`}
135
+ )`}
136
+ }`}
133
137
  }`,
134
138
  ], '\n');
135
139
  }
@@ -208,16 +212,16 @@ export class DefaultKotlinOkHttp3Generator extends KotlinFileGenerator {
208
212
  result.values.push(`val localVariableBody = ${bodyParamName}`);
209
213
  }
210
214
  }
211
- result.values.push(s `val localVariableQuery: ${ctx.refs.multiValueMap()} = ${kt.call([kt.refs.mutableMapOf([kt.refs.string(), kt.refs.list([kt.refs.string()])])], [])}${queryParameters.length === 0 ? '' : s.indent `
212
- .apply {${s.indent `
215
+ result.values.push(s `val localVariableQuery: ${ctx.refs.multiValueMap()} = ${kt.call([kt.refs.mutableMapOf([kt.refs.string(), kt.refs.list([kt.refs.string()])])], [])}${queryParameters.length === 0 ? '' : s.indent `
216
+ .apply {${s.indent `
213
217
  ${appendValueGroup(queryParameters.map((param) => {
214
218
  const paramName = toCasing(param.name, ctx.config.parameterNameCasing);
215
219
  const toString = this.getParameterToString(ctx, { endpoint, parameter: param });
216
220
  const put = s `put(${kt.string(param.name)}, listOf(${paramName}${toString}))`;
217
- return param.required ? put : s `if (${paramName} != null) {${s.indent `
218
- ${put}`}
221
+ return param.required ? put : s `if (${paramName} != null) {${s.indent `
222
+ ${put}`}
219
223
  }`;
220
- }), '\n')}`}
224
+ }), '\n')}`}
221
225
  }`}`);
222
226
  result.values.push('val localVariableHeaders: MutableMap<String, String> = mutableMapOf()');
223
227
  if (((_b = endpoint.requestBody) === null || _b === void 0 ? void 0 : _b.content[0]) !== undefined) {
@@ -226,8 +230,8 @@ export class DefaultKotlinOkHttp3Generator extends KotlinFileGenerator {
226
230
  for (const header of headerParameters) {
227
231
  const paramName = toCasing(header.name, ctx.config.parameterNameCasing);
228
232
  const toString = this.getParameterToString(ctx, { endpoint, parameter: header });
229
- result.values.push(s `if (${paramName} != null) {${s.indent `
230
- localVariableHeaders["${header.name}"] = ${paramName}${toString}`}
233
+ result.values.push(s `if (${paramName} != null) {${s.indent `
234
+ localVariableHeaders["${header.name}"] = ${paramName}${toString}`}
231
235
  }`);
232
236
  }
233
237
  result.values.push(s `return ${kt.call([ctx.refs.requestConfig.infer()], [
@@ -1 +1 @@
1
- {"version":3,"file":"okhttp3-clients-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/okhttp3-clients/okhtt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AE,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,GACnC,OAAO;IAUV,SAAS,CAAC,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAc9D,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;YAKlC,uBAAuB;CA+DtC"}
1
+ {"version":3,"file":"okhttp3-clients-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/okhttp3-clients/okhttp3-clients-generator.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,UAAU,EAGf,OAAO,EACP,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAC5B,qCAAqC,EAGtC,MAAM,aAAa,CAAC;AAKrB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EAEL,KAAK,kCAAkC,EACvC,KAAK,mCAAmC,EACxC,KAAK,oCAAoC,EACzC,KAAK,kCAAkC,EACvC,KAAK,mCAAmC,EACzC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAiC,KAAK,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG3G,KAAK,KAAK,GAAG,kCAAkC,CAAC;AAChD,KAAK,MAAM,GAAG,mCAAmC,CAAC;AAClD,KAAK,MAAM,GAAG,mCAAmC,CAAC;AAClD,KAAK,aAAa,GAAG,kCAAkC,CAAC;AACxD,KAAK,OAAO,GAAG,oCAAoC,CAAC;AAEpD,qBAAa,6BAA8B,SAAQ,qCAAqC,CACtF,KAAK,EACL,MAAM,EACN,MAAM,EACN,aAAa,EACb,OAAO,CACR;IACC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAsC;gBAEnE,uBAAuB,CAAC,EAAE,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC;cAKhD,uBAAuB,CAAC,GAAG,EAAE,oCAAoC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1G,SAAS,CAAC,UAAU,IAAI,MAAM;IAQ9B,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,GAAG,YAAY,CAAC,aAAa,CAAC;IAQzF,SAAS,CAAC,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI;IAI1F,SAAS,CAAC,YAAY,CACpB,OAAO,EAAE,uBAAuB,CAAC,4BAA4B,CAAC,EAC9D,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,GACnC,OAAO;IAUV,SAAS,CAAC,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAc9D,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;YAKlC,uBAAuB;CAkFtC"}
@@ -85,25 +85,41 @@ export class KotlinOkHttp3ClientsGenerator extends OpenApiServicesGenerationProv
85
85
  ? 'val baseUrl: String, val objectMapper: ObjectMapper, val client: Factory = defaultClient'
86
86
  : 'val baseUrl: String, val client: Factory = defaultClient, val objectMapper: ObjectMapper = Serializer.jacksonObjectMapper');
87
87
  }
88
+ if (ctx.config.springBootVersion === 4) {
89
+ // Jackson 3 (Spring Boot 4) moved every package except annotations from
90
+ // `com.fasterxml.jackson.*` to `tools.jackson.*`. Rewrite the imports in the copied assets to match.
91
+ fileContent = fileContent.replace(/\bcom\.fasterxml\.jackson\.(core|databind|module|datatype|dataformat)\b/g, 'tools.jackson.$1');
92
+ }
88
93
  writeGeneratedFile(ctx.config, targetPath, fileContent);
89
94
  }
90
95
  if (ctx.config.serializer === 'static' ||
91
96
  typeof ctx.config.serializer === 'object' && ctx.config.serializer.mode === 'static') {
92
97
  const filePath = resolve(targetDir, 'Serializer.kt');
93
98
  console.log(`Generating Serializer to ${filePath}...`);
99
+ const springBootVersion = ctx.config.springBootVersion;
100
+ const jsonIncludeMember = toCasing(ctx.config.serializerJsonInclude, 'snake');
101
+ const defaultFactory = springBootVersion === 4
102
+ // Jackson 3's ObjectMapper is immutable; configuration moved to the (Kotlin) mapper builder.
103
+ ? s `${kt.refs.jackson.jacksonMapperBuilder(springBootVersion)}()${s.indent `
104
+ .findAndAddModules()
105
+ .changeDefaultPropertyInclusion { it.withValueInclusion(${kt.refs.jackson.jsonInclude()}.Include.${jsonIncludeMember}).withContentInclusion(${kt.refs.jackson.jsonInclude()}.Include.${jsonIncludeMember}) }
106
+ .configure(${kt.refs.jackson.serializationFeature(springBootVersion)}.WRITE_DATES_AS_TIMESTAMPS, false)
107
+ .configure(${kt.refs.jackson.deserializationFeature(springBootVersion)}.FAIL_ON_UNKNOWN_PROPERTIES, false)
108
+ .build()`}`
109
+ : s `${kt.refs.jackson.jacksonObjectMapper(springBootVersion)}()${s.indent `
110
+ .findAndRegisterModules()
111
+ .setSerializationInclusion(${kt.refs.jackson.jsonInclude()}.Include.${jsonIncludeMember})
112
+ .configure(${kt.refs.jackson.serializationFeature(springBootVersion)}.WRITE_DATES_AS_TIMESTAMPS, false)
113
+ .configure(${kt.refs.jackson.deserializationFeature(springBootVersion)}.FAIL_ON_UNKNOWN_PROPERTIES, false)`}`;
94
114
  const factory = typeof ctx.config.serializer === 'object'
95
115
  ? ctx.config.serializer.factory
96
- : s `${kt.refs.jackson.jacksonObjectMapper()}()${s.indent `
97
- .findAndRegisterModules()
98
- .setSerializationInclusion(${kt.refs.jackson.jsonInclude()}.Include.${toCasing(ctx.config.serializerJsonInclude, 'snake')})
99
- .configure(${kt.refs.jackson.serializationFeature()}.WRITE_DATES_AS_TIMESTAMPS, false)
100
- .configure(${kt.refs.jackson.deserializationFeature()}.FAIL_ON_UNKNOWN_PROPERTIES, false)`}`;
116
+ : defaultFactory;
101
117
  const builder = new KotlinFileBuilder(ctx.infrastructurePackageName, ctx.config);
102
118
  builder.append(kt.object({
103
119
  name: 'Serializer',
104
120
  members: [
105
121
  kt.property('jacksonObjectMapper', {
106
- type: kt.refs.jackson.objectMapper(),
122
+ type: kt.refs.jackson.objectMapper(ctx.config.springBootVersion),
107
123
  mutable: false,
108
124
  default: kt.call('run', [kt.lambda([], factory)]),
109
125
  }),