deta
deta copied to clipboard
Best way to document a schema?
How would you go about writing Scribble docs for a deta schema? Use defstruct and add a caveat that it’s not actually a vanilla struct? Or just document the make- id function?
It would be neat if there was a defschema form for Scribble, but I can see why it might not be high on the list.
I haven't thought much about this yet, because I mostly use deta in private applications. I agree that a defschema would be neat. I don't think I'll get to that any time soon since it's not a priority for me, but I'd be happy to accept any changes toward that end!
I took a look at the source for defstruct and, well, let’s say it gave me pause.
Update: Using defstruct* with the #:constructor-name argument actually works very well. It produces Scribble reference link/bindings for the getters, setters, type predicate and constructor.
Example: https://thelocalyarn.com/code/uv/scribbled/cache-rkt.html#%28part._.Schema%29