A human-friendly DSL for ATProto Lexicons mlf.lol

Array syntax not powerful enough #1

Closed stavola.xyz
Closed opened by stavola.xyz

I'm trying to express tags. So I want to have an array of strings.

The syntax would be something like (playground link):

tags: string[] constrained {
    maxLength: 100,
},

The maxLength now is on tags, but not on the individual items.

"tags": {
  "type": "array",
  "items": {
    "type": "string"
  },
  "maxLength": 100
}

I can't find any syntax in the docs to express it on an individual items level. It also doesn't transform it correctly from Lexicon to MLF.

So we technically support this already in three forms:

The first form is a bit ugly but works for quick and simple things, the latter two are nicer and give you more control over the representation in the final generated lexicon. We touch on it a bit here.

As for the failure to convert from Lexicon to MLF, yeah that was unfortunately one of the issues I ran into and have yet to solve. If you give me a concrete example in a separate issue, I'll see if I can fix it up after the vodjam. If you happen to get to it before me, I'd happily accept a PR!

Thanks for the detailed reply. The inline type is what I'm going for in my case. Maybe it would make sense to add/change the examples of the inline types with one for arrays. That would've helped me (or I just need to read more carefully next time).

Great, thanks!

I'll keep this issue open as a reminder to update the docs.

Docs updated!

Sign up or Sign in to add to the discussion.