fix(android): split wire types — one declaration per file
Hypothesis for the KSP2 "LibraryApi could not be resolved" failure: ArtistWire.kt and AlbumWire.kt each declared TWO @Serializable classes (the Ref and the Detail variant). LibraryApi imports the Detail variants but the file names match the Ref variants. KSP2's symbol indexing may key on `className.kt` and fail to surface the second declaration in a multi-class file. Splitting per the MatchingDeclarationName convention: - ArtistDetailWire.kt (new) - AlbumDetailWire.kt (new) - ArtistWire.kt / AlbumWire.kt now contain only their namesake type If this fixes it, the LibraryApi resolution will work without changing the @Provides signature. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
package com.fabledsword.minstrel.models.wire
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wire shape for `GET /api/albums/{id}` — server returns AlbumRef
|
||||||
|
* fields PLUS an embedded `tracks` array.
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
data class AlbumDetailWire(
|
||||||
|
val id: String,
|
||||||
|
val title: String,
|
||||||
|
@SerialName("artist_id") val artistId: String,
|
||||||
|
@SerialName("sort_title") val sortTitle: String = "",
|
||||||
|
@SerialName("artist_name") val artistName: String = "",
|
||||||
|
val year: Int? = null,
|
||||||
|
@SerialName("track_count") val trackCount: Int = 0,
|
||||||
|
@SerialName("duration_sec") val durationSec: Int = 0,
|
||||||
|
@SerialName("cover_url") val coverUrl: String = "",
|
||||||
|
val tracks: List<TrackWire> = emptyList(),
|
||||||
|
)
|
||||||
@@ -18,21 +18,3 @@ data class AlbumWire(
|
|||||||
@SerialName("duration_sec") val durationSec: Int = 0,
|
@SerialName("duration_sec") val durationSec: Int = 0,
|
||||||
@SerialName("cover_url") val coverUrl: String = "",
|
@SerialName("cover_url") val coverUrl: String = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
|
||||||
* Wire shape for `GET /api/albums/{id}` — server returns AlbumRef
|
|
||||||
* fields PLUS an embedded `tracks` array.
|
|
||||||
*/
|
|
||||||
@Serializable
|
|
||||||
data class AlbumDetailWire(
|
|
||||||
val id: String,
|
|
||||||
val title: String,
|
|
||||||
@SerialName("artist_id") val artistId: String,
|
|
||||||
@SerialName("sort_title") val sortTitle: String = "",
|
|
||||||
@SerialName("artist_name") val artistName: String = "",
|
|
||||||
val year: Int? = null,
|
|
||||||
@SerialName("track_count") val trackCount: Int = 0,
|
|
||||||
@SerialName("duration_sec") val durationSec: Int = 0,
|
|
||||||
@SerialName("cover_url") val coverUrl: String = "",
|
|
||||||
val tracks: List<TrackWire> = emptyList(),
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.fabledsword.minstrel.models.wire
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wire shape for `GET /api/artists/{id}` — server returns ArtistRef
|
||||||
|
* fields PLUS an embedded `albums` array.
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
data class ArtistDetailWire(
|
||||||
|
val id: String,
|
||||||
|
val name: String,
|
||||||
|
@SerialName("sort_name") val sortName: String = "",
|
||||||
|
@SerialName("album_count") val albumCount: Int = 0,
|
||||||
|
@SerialName("cover_url") val coverUrl: String = "",
|
||||||
|
val albums: List<AlbumWire> = emptyList(),
|
||||||
|
)
|
||||||
@@ -14,20 +14,3 @@ data class ArtistWire(
|
|||||||
@SerialName("album_count") val albumCount: Int = 0,
|
@SerialName("album_count") val albumCount: Int = 0,
|
||||||
@SerialName("cover_url") val coverUrl: String = "",
|
@SerialName("cover_url") val coverUrl: String = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
|
||||||
* Wire shape for `GET /api/artists/{id}` — server returns ArtistRef
|
|
||||||
* fields PLUS an embedded `albums` array. We can't directly map this
|
|
||||||
* to ArtistWire because Retrofit/kotlinx.serialization doesn't support
|
|
||||||
* a single record being two types; an explicit DetailWire spells out
|
|
||||||
* both halves and the repository handles the split.
|
|
||||||
*/
|
|
||||||
@Serializable
|
|
||||||
data class ArtistDetailWire(
|
|
||||||
val id: String,
|
|
||||||
val name: String,
|
|
||||||
@SerialName("sort_name") val sortName: String = "",
|
|
||||||
@SerialName("album_count") val albumCount: Int = 0,
|
|
||||||
@SerialName("cover_url") val coverUrl: String = "",
|
|
||||||
val albums: List<AlbumWire> = emptyList(),
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user