Skip to content

[Feature Request]: Create a Lexicon Generator #31

@MasterJ93

Description

@MasterJ93

Summary

Create a solution for not only creating lexicons, but also converting them into Swift models and methods.

Pain points

At this time, all lexicon models and methods need to be written by hand. This can cause issues with missing out features, duplicating code, making mistakes, and sloppy implementations. Creating a lexicon generator would solve all of these problems.

The idea is to create an app and CLI tool that will do the following:

  • Create and validate the lexicon in a JSON format.
  • Take all of the AT Protocol-provided and Bluesky-provided lexicons and convert them into validated Swift models and methods.
  • Give proper syntax and clean code for each model and method, which would also conform to the ATProtoKit API Design Guidelines and the Swift API Design Guidelines.

There will be some limitations:

  • Some lexicons in Bluesky and AT Protocol are built into some places and will be treated differently. For example, all of the lexicons related to creating and managing sessions must be in ATProtocolConfiguration, and com.atproto.repo.uploadBlob is required to be in APIClientService.
  • The first version may not implement any lexicons that have the subscription value, due to their special nature and still-highly-moldable structure of the models and methods.

The app and CLI tool will simply allow you to insert the lexicon JSON files, as well as an optional configuration file of adding extra information (such as comments). The app will specifically show common errors among any JSON errors when creating or viewing a lexicon file (not available in version 1.0).

Considered Alternatives

N/A

Is this a breaking change?

No

Library Examples

The repo swift-atproto has a good understanding of what could be done in terms of the lexicon generator. However, using it as-is isn't ideal: a better one would need to be made that better fits with the design goals of ATProtoKit.

Additional Context

This will most likely be in another repository, so progress will be followed over there instead of here. When it's completed its goals, this issue will close.

Metadata

Metadata

Assignees

Labels

draftThis issue is simply a draft and should not be considered until it's completenew featureNew feature or request

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions