deta icon indicating copy to clipboard operation
deta copied to clipboard

Best way to document a schema?

Open otherjoel opened this issue 5 years ago • 3 comments

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.

otherjoel avatar Feb 03 '20 15:02 otherjoel

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!

Bogdanp avatar Feb 04 '20 08:02 Bogdanp

I took a look at the source for defstruct and, well, let’s say it gave me pause.

otherjoel avatar Feb 08 '20 19:02 otherjoel

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

otherjoel avatar Apr 27 '20 17:04 otherjoel