infra stuff in gleam

atproto_sdl: printed SDL for a local def named record fails to re-parse #33

Open mokkenstorm.dev
Open opened by mokkenstorm.dev

The SDL grammar reserves record as a top-level keyword, but real-world lexicons use it as a local def name: com.atproto.repo.listRecords (upstream bluesky-social/atproto) has an object def literally named record.

--to sdl happily prints type record { ... } and records: [record]!, but re-parsing that output fails:

listRecords.sdl:3:33: expected type, found record

So print succeeds and parse of the printed output does not, which breaks the printer-is-total round-trip guarantee for a lexicon that exists in the wild.

Workaround used in at-record: renamed the local def to recordEntry (schema-local, invisible on the wire). Possible fixes: contextual keywords (only treat record as a keyword in declaration position), or an escape/quoting syntax for colliding def names.

Sign up or Sign in to add to the discussion.