agrevster / pocketbase-kotlin

A multi-platform Kotlin SDK for Pocketbase.
https://agrevster.github.io/pocketbase-kotlin/
MIT License
25 stars 6 forks source link

create records adds " to the values #8

Closed EduFdezSoy closed 2 months ago

EduFdezSoy commented 2 months ago

When doing

    suspend fun createChapter(): Chapter {
        val response = client.records.create<Chapter>(
            "test",
            //A workaround to the limitations on JSON with multipart form data
            mapOf(
                "title" to Json.encodeToJsonElement(recordToCreate.title),
                // ...

where recordToCreate.title is title = "test from android" it saves in pocketbase with a pair of " image

its not too bad for text but when doing email validation or some other pattern it fails cause the "

EduFdezSoy commented 2 months ago

same behavior when doing

"text".toJsonPrimitive()
agrevster commented 2 months ago

I’ll look into it

agrevster commented 2 months ago

I explicitly added the quotes to the test... odd https://github.com/agrevster/pocketbase-kotlin/blob/f650e2baec6380bd0b005a8b3870eeaa6ed6e83a/src/commonTest/kotlin/services/RecordServiceFileUpload.kt#L105 You’re right that’s not how it’s supposed to be.

agrevster commented 2 months ago

Fixed @EduFdezSoy
68fbf6a17972aa6f3a2545669901f6919870c24c