@goast/kotlin 0.3.8 → 0.3.10

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.
@@ -85,7 +85,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
85
85
  ("Content-Disposition" to "form-data; name=\"$name\"")
86
86
  addPart(
87
87
  partHeaders.toHeaders(),
88
- Serializer.jacksonObjectMapper.writeValueAsString(content)
88
+ Serializer.jacksonObjectMapper.writeValueAsString(part.body)
89
89
  .toRequestBody(JsonMediaType.toMediaTypeOrNull())
90
90
  )
91
91
  }
@@ -249,7 +249,9 @@ class DefaultKotlinModelGenerator extends file_generator_1.KotlinFileGenerator {
249
249
  return ctx.config.addJacksonAnnotations && schema.discriminator
250
250
  ? ast_1.kt.annotation(ast_1.kt.refs.jackson.jsonTypeInfo(), [
251
251
  ast_1.kt.argument.named('use', 'JsonTypeInfo.Id.NAME'),
252
- ast_1.kt.argument.named('include', 'JsonTypeInfo.As.EXISTING_PROPERTY'),
252
+ ast_1.kt.argument.named('include', 'properties' in schema && schema.properties.has(schema.discriminator.propertyName)
253
+ ? 'JsonTypeInfo.As.EXISTING_PROPERTY'
254
+ : 'JsonTypeInfo.As.PROPERTY'),
253
255
  ast_1.kt.argument.named('property', ast_1.kt.string(schema.discriminator.propertyName)),
254
256
  ast_1.kt.argument.named('visible', 'true'),
255
257
  ])
@@ -246,7 +246,9 @@ export class DefaultKotlinModelGenerator extends KotlinFileGenerator {
246
246
  return ctx.config.addJacksonAnnotations && schema.discriminator
247
247
  ? kt.annotation(kt.refs.jackson.jsonTypeInfo(), [
248
248
  kt.argument.named('use', 'JsonTypeInfo.Id.NAME'),
249
- kt.argument.named('include', 'JsonTypeInfo.As.EXISTING_PROPERTY'),
249
+ kt.argument.named('include', 'properties' in schema && schema.properties.has(schema.discriminator.propertyName)
250
+ ? 'JsonTypeInfo.As.EXISTING_PROPERTY'
251
+ : 'JsonTypeInfo.As.PROPERTY'),
250
252
  kt.argument.named('property', kt.string(schema.discriminator.propertyName)),
251
253
  kt.argument.named('visible', 'true'),
252
254
  ])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goast/kotlin",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
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": [