From 51f80bb557fa9cb246dc8e059ed10deafe8095f5 Mon Sep 17 00:00:00 2001 From: dadachi Date: Sun, 24 May 2026 07:21:00 +0900 Subject: [PATCH] Fix description silently dropped by encodeDefaults=false MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Retrofit kotlinx Json (NetModule) keeps encodeDefaults=false, so a @Serializable request-body property equal to its declared default is omitted from the payload. ItemTagBodyDetail.description = "" (== default) was dropped, so clearing a description on edit was silently ignored by the server's partial update. Drop the default (both call sites already pass description explicitly); update DemoItemTagRepositoryTest to pass description explicitly. Bump versionCode to 11 / versionName to 3.2.6 and update CHANGELOG. Mirrors NativeAppTemplate-Android a78f42e. (The DeviceRegistrationBody fix in that commit does not apply — the Free variant has no device registration.) Co-Authored-By: Claude Opus 4.7 (1M context) --- CHANGELOG.md | 5 +++++ app/build.gradle.kts | 4 ++-- .../demo/item_tag/DemoItemTagRepositoryTest.kt | 2 ++ .../nativeapptemplatefree/model/ItemTagBodyDetail.kt | 6 +++++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cffcd6d..37bbcbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## [3.2.6] - 2026-05-24 + +### Fixed +- Clearing an item tag's description on edit was silently ignored — the Retrofit JSON config keeps `encodeDefaults = false`, so `ItemTagBodyDetail.description = ""` (equal to its declared default) was dropped from the request body and the server's partial update left the old description in place. Removed the default so the empty string is always sent + ## [3.2.5] - 2026-05-08 ### Changed diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d00300e..09a583a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -14,8 +14,8 @@ android { applicationId = "com.nativeapptemplate.nativeapptemplatefree" targetSdk = 36 minSdk = 26 - versionCode = 10 - versionName = "3.2.5" + versionCode = 11 + versionName = "3.2.6" vectorDrawables { useSupportLibrary = true diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/item_tag/DemoItemTagRepositoryTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/item_tag/DemoItemTagRepositoryTest.kt index facf169..23d1902 100644 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/item_tag/DemoItemTagRepositoryTest.kt +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/demo/item_tag/DemoItemTagRepositoryTest.kt @@ -71,6 +71,7 @@ class DemoItemTagRepositoryTest { ItemTagBody( itemTagBodyDetail = ItemTagBodyDetail( name = itemTagData.getName(), + description = "", ), ), ).first(), @@ -86,6 +87,7 @@ class DemoItemTagRepositoryTest { itemTagBody = ItemTagBody( itemTagBodyDetail = ItemTagBodyDetail( name = itemTagData.getName(), + description = "", ), ), ).first(), diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagBodyDetail.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagBodyDetail.kt index 90f055d..45f4683 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagBodyDetail.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTagBodyDetail.kt @@ -8,5 +8,9 @@ import kotlinx.serialization.Serializable @Parcelize data class ItemTagBodyDetail( val name: String, - val description: String = "", + // No default: with the Json config's encodeDefaults = false, a value equal to + // its default ("") is dropped from the payload, so clearing a description on + // edit would be silently ignored by the server's partial update. Both call + // sites supply description explicitly. + val description: String, ) : Parcelable