diff --git a/generation/src/jvmMain/kotlin/io/github/nomisrev/openapi/Models.kt b/generation/src/jvmMain/kotlin/io/github/nomisrev/openapi/Models.kt index d51c21f..8c1dde7 100644 --- a/generation/src/jvmMain/kotlin/io/github/nomisrev/openapi/Models.kt +++ b/generation/src/jvmMain/kotlin/io/github/nomisrev/openapi/Models.kt @@ -194,10 +194,20 @@ private fun Model.Object.toTypeSpec(): TypeSpec = Nam.toClassName(context), properties .map { prop -> + val propName = Nam.toPropName(prop) ParameterSpec.builder( Nam.toPropName(prop), prop.model.toTypeName().copy(nullable = prop.isNullable) ) + .apply { + if (propName != prop.baseName) + addAnnotation( + annotationSpec() + .toBuilder() + .addMember("%S", prop.baseName) + .build() + ) + } .description(prop.description) .defaultValue(prop.model.value) .apply {