Closed P72B closed 4 months ago
Hi, @P72B. Thank you for reporting this issue.
Could you share a minimum project so I can reproduce the issue locally?
And what does req.body
return in JS? Are you sure it returns JsonElement
? I have not worked with JS for a long time, probably, you need first to deserialize the request payload using kotlin-serialization library in JS and only then pass it to the validation function
Hi @OptimumCode thank you for that incredible fast answer. You where right it's on the JS side. I had to JSON.stringify(reg.body)
of course. I was so sure it's a valid JsonElement ^^. So there is no bug. It's just me beeing blind.
I appreciate your work on this great lib. Thank you.
Invalid bug report
No worries, was happy to help) And I am glad that somebody uses the library)
Is there an existing issue for this?
Current Behavior
Setup: KMP project that includes json-schema-validator lib. JsonSchema.validate doesn't work on JS lib export. The kotlin unit test inside the kmp project works and the schema gets validated correctly. But when I take the generated JS lib output (gradle jsRun) from the kmp then I get an errror during NodeJS runtime schema validation attempt with the message "
element is not a object
".Expected Behavior
It should be validating same json schema on kotlin as well as on nodejs platform.
JSON schema
Library version
0.0.15
Anything else?