Nested constraints Lexicon to MLF

did:plc:3mdq56yhyqq5k6d4guztheaf opened this Apr 13, 2026 1 comments
did:plc:3mdq56yhyqq5k6d4guztheaf opened Apr 13, 2026

Here's a minimal example of where Lexicon to MLF conversion fails when there are constraints on the items of an array,

{
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1,
  "id": "com.example.minimal",
  "defs": {
    "main": {
      "type": "record",
      "description": "",
      "key": "tid",
      "record": {
        "type": "object",
        "required": [],
        "properties": {
          "tags": {
            "type": "ref",
            "ref": "#tags"
          }
        }
      }
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 200
      },
      "maxLength": 20
    }
  }
}

The current output is:

@main
record minimal {
    tags: tags,
}

def type tags = string[] constrained {
        maxLength: 20,
    };

But it should rather be something like:

@main
record minimal {
    tags: tags,
}

def type tags = (string constrained {
    minLength: 1,
    maxLength: 200,
  })[] constrained {
    maxLength: 20,
};

No activity yet.

cospan · schematic version control on atproto built on AT Protocol