Hey everyone! I’m super excited to finally release...
# feed
m
Hey everyone! I’m super excited to finally release SpraypaintKt 2.0! 🎉 Inspired by SpraypaintJS, it lets you fully interact with a JSON:API-compliant API using resources and annotations (all thanks to KSP 🚀). It's available for all the targets supported by Kotlin (android, jvm, ios, wasm, js, ...) The core package doesn’t come with an HTTP client baked in, but don’t worry—there’s a ktor integration package ready to go! If you’re using something other than Ktor, you can easily implement the
HttpClient
interface and plug in your own client. Almost the entire JSON:API spec is supported, and there’s a powerful query builder (inspired by Laravel Eloquent and SpraypaintJS) that’s great for edge cases and spec extensions. Check out the API docs (classes, methods, and more) here: SpraypaintKt Docs Can’t wait to hear what you think and see what you build with it! 💻🔥
🎉 3
c
Hey, nice library! I'm a bit confused with the goals (but I probably misunderstood). My understanding was that JSON:API was meant to allow HATEOAS, where clients consume the API to know where to find stuff, instead of hard-coding all endpoints on their side. Since the library is using KSP to generate code, how does the project benefit from JSON:API?
m
Well the goal was to create a universal JSON:API clients that let you define the resources you want to interact with (a resource is basically a model that gets data from a certain endpoint, and you specify what attributes/relationships you want to fetch. Other than fetching from the same resource you fetched, you can update or delete it. You can also easily create a new one. TLDR: The main goal is to create models/resources that are able to do CRUD on these entities KSP is used to generate the real model you'll use in your project. You start by creating a schema from which KSP will create a new class (the resource). With this you can start using all the methods. This was made basically to allow the maximum flexibility and simplicity when writing schemas, while leaving complexity to KSP and the library
s
With Why is the original called SprayPaint? I am not familiar with JSONAPI… does the naming make any sense?
m
No, Spraypaint is a name to recall the original SpraypaintJS (made for Javascript as a client for the JSON:API backend Graphiti written in Ruby, but usable also for any other backend JSON:API-compliant) just because the API is very similar (Maybe I should add a disclaimer to the README that states "This project is not affiliated with Graphiti or SpraypaintJS")
👍 1
👀 1
s
Yeah, I’m on iPad. Apples autocorrection sometimes „corrects“ correct words to the wrong. I understand that you call it like the original. But does the originals name make any sense? Spraypaint would be a good name for anything doing graphics, maybe a SKIA competitor or so. Seems like the name was chosen because it sounds cool.
m
It's related to the main package Graphiti: here's the page where they explain it better: https://www.graphiti.dev/guides/why