skiptools / skip-supabase

Supabase integration for Skip apps
GNU Lesser General Public License v3.0
3 stars 1 forks source link

How can I add the Kotlin serialization plugin or dependency? #4

Open lexum0 opened 1 day ago

lexum0 commented 1 day ago

I have tried to implement Kotlin code that works on an Android app directly with SKIP INSERT: but I keep getting the error: kotlinx.serialization.SerializationException: Serializer for class 'Country' is not found. Please ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied.

Opening the app in Android Studio ends up saying PLUGIN_IS_NOT_ENABLED

I have tried different methods to add the serialization plugin but nothing works. I'm also using the Supatodo sample app (https://github.com/skiptools/skipapp-supatodo)

What's the right way to add serialization?

Supabase uses kotlinx.serialization to decode the query data with @Serializable (https://supabase.com/docs/guides/getting-started/quickstarts/kotlin)

marcprux commented 1 day ago

In order to maintain parity with the Swift Supabase API, Skip's Supabase wrapper uses a custom CodableSerializer to handle encoding and decoding. This wasn't working for decoding previously, only encoding.

I've just added some very basic support for Codable serialization in 0.0.4 (in https://github.com/skiptools/skip-supabase/pull/5). There is still a lot of work to be done to flesh it out, but it might be enough to get started with further enhancements and PRs. Take a look at SkipSupabaseTests to see what is implemented and what isn't.

lexum0 commented 1 day ago

I am able to decode the data manually now thanks to the new changes, by using the new data property. Thank you

The .value property doesn't seem to be working, but I can work for now with the .data property

lexum0 commented 4 hours ago

The .value property is working too. I ran new tests today and it's working as expected